-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update contract address handling and types across projects
- Loading branch information
Showing
14 changed files
with
87 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 6 additions & 2 deletions
8
typescript/base/src/projects/ima/mainnet/MainnetImaProject.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,21 @@ | ||
import { ContractAddressMap, MainContractAddress } from "../../../domain/types"; | ||
import { ImaProject } from "../ImaProject"; | ||
import { Instance } from "../../../instance"; | ||
import { MainnetImaInstance } from "./MainnetImaInstance"; | ||
|
||
export class MainnetImaProject<ContractType> extends | ||
ImaProject<ContractType> { | ||
mainContractName = "MessageProxyForMainnet"; | ||
|
||
getAbiFilename (version: string) { | ||
return `${this.metadata.name}-${version}-abi.json`; | ||
} | ||
|
||
createInstance (address: string): Instance<ContractType> { | ||
createInstance (target: MainContractAddress | ContractAddressMap) | ||
: Instance<ContractType> { | ||
return new MainnetImaInstance( | ||
this, | ||
address | ||
target | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 14 additions & 6 deletions
20
typescript/base/src/projects/ima/schain/SchainImaProject.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,34 @@ | ||
import { | ||
ContractAddress, | ||
ContractAddressMap, | ||
MainContractAddress | ||
} from "../../../domain/types"; | ||
import { ImaProject } from "../ImaProject"; | ||
import { Instance } from "../../../instance"; | ||
import { PREDEPLOYED_ALIAS } from "../../../domain/constants"; | ||
import { SchainImaInstance } from "./SchainImaInstance"; | ||
|
||
export class SchainImaProject<ContractType> extends | ||
ImaProject<ContractType> { | ||
mainContractName = "MessageProxyForSchain"; | ||
|
||
getAbiFilename (version: string) { | ||
return `${this.metadata.name}-${version}-abi.json`; | ||
} | ||
|
||
getInstance (aliasOrAddress: string) { | ||
if (aliasOrAddress === PREDEPLOYED_ALIAS) { | ||
getInstance (target: string | MainContractAddress | ContractAddressMap) { | ||
if (target === PREDEPLOYED_ALIAS) { | ||
return this.createInstance(SchainImaInstance.PREDEPLOYED. | ||
get("MessageProxyForSchain")!); | ||
get("MessageProxyForSchain")! as ContractAddress); | ||
} | ||
return super.getInstance(aliasOrAddress); | ||
return super.getInstance(target); | ||
} | ||
|
||
createInstance (address: string): Instance<ContractType> { | ||
createInstance (target: MainContractAddress | ContractAddressMap) | ||
: Instance<ContractType> { | ||
return new SchainImaInstance( | ||
this, | ||
address | ||
target | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters