-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export const PREDEPLOYED_ALIAS = "predeployed"; | ||
export const REPOSITORY_URL = "https://skalenetwork.github.io/skale-contracts/"; | ||
export const METADATA_FILENAME = "metadata.json"; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import { ImaInstance } from "../ImaInstance"; | ||
|
||
|
||
export class SchainImaInstance<ContractType> extends | ||
ImaInstance<ContractType> { | ||
static PREDEPLOYED = new Map<string, string>([ | ||
[ | ||
"CommunityLocker", | ||
"0xD2aaa00300000000000000000000000000000000" | ||
], | ||
[ | ||
"KeyStorage", | ||
"0xd2aaa00200000000000000000000000000000000" | ||
], | ||
[ | ||
"MessageProxyForSchain", | ||
"0xd2AAa00100000000000000000000000000000000" | ||
], | ||
[ | ||
"ProxyAdmin", | ||
"0xd2aAa00000000000000000000000000000000000" | ||
], | ||
[ | ||
"TokenManagerERC1155", | ||
"0xD2aaA00900000000000000000000000000000000" | ||
], | ||
[ | ||
"TokenManagerERC20", | ||
"0xD2aAA00500000000000000000000000000000000" | ||
], | ||
[ | ||
"TokenManagerERC721", | ||
"0xD2aaa00600000000000000000000000000000000" | ||
], | ||
[ | ||
"TokenManagerERC721WithMetadata", | ||
"0xd2AaA00a00000000000000000000000000000000" | ||
], | ||
[ | ||
"TokenManagerEth", | ||
"0xd2AaA00400000000000000000000000000000000" | ||
], | ||
[ | ||
"TokenManagerLinker", | ||
"0xD2aAA00800000000000000000000000000000000" | ||
] | ||
]); | ||
|
||
getContractAddress (name: string): Promise<string> { | ||
Check failure on line 49 in typescript/base/src/projects/ima/schain/SchainImaInstance.ts GitHub Actions / typescript (20)
Check failure on line 49 in typescript/base/src/projects/ima/schain/SchainImaInstance.ts GitHub Actions / typescript (16)
Check failure on line 49 in typescript/base/src/projects/ima/schain/SchainImaInstance.ts GitHub Actions / typescript (19)
Check failure on line 49 in typescript/base/src/projects/ima/schain/SchainImaInstance.ts GitHub Actions / typescript (18)
Check failure on line 49 in typescript/base/src/projects/ima/schain/SchainImaInstance.ts GitHub Actions / typescript (18)
Check failure on line 49 in typescript/base/src/projects/ima/schain/SchainImaInstance.ts GitHub Actions / typescript (16)
Check failure on line 49 in typescript/base/src/projects/ima/schain/SchainImaInstance.ts GitHub Actions / typescript (20)
|
||
if (SchainImaInstance.PREDEPLOYED.has(name)) { | ||
return Promise.resolve(SchainImaInstance.PREDEPLOYED. | ||
get(name) as string); | ||
} | ||
throw new Error(`Can't get address of ${name} contract`); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
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> { | ||
getAbiFilename (version: string) { | ||
return `${this.metadata.name}-${version}-abi.json`; | ||
} | ||
|
||
getInstance (aliasOrAddress: string) { | ||
if (aliasOrAddress === PREDEPLOYED_ALIAS) { | ||
return this.createInstance(SchainImaInstance.PREDEPLOYED. | ||
get("MessageProxyForSchain")!); | ||
} | ||
return super.getInstance(aliasOrAddress); | ||
} | ||
|
||
createInstance (address: string): Instance<ContractType> { | ||
return new SchainImaInstance( | ||
this, | ||
address | ||
); | ||
} | ||
} |