@@ -12,29 +12,26 @@ import {
1212
1313dotenv . config ( ) ;
1414
15+ type ContractConfigWithoutChainId = {
16+ address : `0x${string } `;
17+ abi : any [ ] ;
18+ } ;
19+
1520type ArbitratorContracts = {
1621 default : {
1722 contracts : {
18- KlerosCore : {
19- address : `0x${string } `;
20- abi : any [ ] ;
21- } ;
22- SortitionModule : {
23- address : `0x${string } `;
24- abi : any [ ] ;
25- } ;
26- EvidenceModule : {
27- address : `0x${string } `;
28- abi : any [ ] ;
29- } ;
30- DisputeTemplateRegistry : {
31- address : `0x${string } `;
32- abi : any [ ] ;
33- } ;
23+ KlerosCore : ContractConfigWithoutChainId ;
24+ KlerosCoreNeo : ContractConfigWithoutChainId ;
25+ SortitionModule : ContractConfigWithoutChainId ;
26+ SortitionModuleNeo : ContractConfigWithoutChainId ;
27+ EvidenceModule : ContractConfigWithoutChainId ;
28+ DisputeTemplateRegistry : ContractConfigWithoutChainId ;
3429 } ;
3530 } ;
3631} ;
3732
33+ type ContractNameSuffix = "" | "Neo" ;
34+
3835const addArbitratorContract = ( {
3936 results,
4037 chain,
@@ -44,7 +41,7 @@ const addArbitratorContract = ({
4441 results : ContractConfig [ ] ;
4542 chain : Chain ;
4643 name : string ;
47- contract : { address : `0x${ string } ` ; abi : any [ ] } ;
44+ contract : ContractConfigWithoutChainId ;
4845} ) => {
4946 results . push ( {
5047 name,
@@ -58,6 +55,7 @@ const addArbitratorContract = ({
5855const readArtifacts = async (
5956 viemChainName : string ,
6057 hardhatChainName : string ,
58+ contractNameSuffix : ContractNameSuffix ,
6159 arbitratorContracts : ArbitratorContracts
6260) => {
6361 const chains = await import ( "wagmi/chains" ) ;
@@ -86,8 +84,14 @@ const readArtifacts = async (
8684 }
8785 }
8886
89- const { KlerosCore, SortitionModule, EvidenceModule, DisputeTemplateRegistry } =
90- arbitratorContracts . default . contracts ;
87+ const coreContractName = `KlerosCore${ contractNameSuffix } ` as keyof typeof arbitratorContracts . default . contracts ;
88+ const { [ coreContractName ] : KlerosCore } = arbitratorContracts . default . contracts ;
89+
90+ const sortitionModuleContractName =
91+ `SortitionModule${ contractNameSuffix } ` as keyof typeof arbitratorContracts . default . contracts ;
92+ const { [ sortitionModuleContractName ] : SortitionModule } = arbitratorContracts . default . contracts ;
93+
94+ const { EvidenceModule, DisputeTemplateRegistry } = arbitratorContracts . default . contracts ;
9195
9296 const arbitratorContractConfigs = [
9397 { name : "KlerosCore" , contract : KlerosCore } ,
@@ -105,28 +109,32 @@ const getConfig = async (): Promise<Config> => {
105109 const deployment = process . env . REACT_APP_DEPLOYMENT ?? "devnet" ;
106110 let viemNetwork : string ;
107111 let hardhatNetwork : string ;
112+ let contractNameSuffix : ContractNameSuffix ;
108113 let arbitratorContracts ;
109114 switch ( deployment ) {
110115 case "devnet" :
111116 viemNetwork = "arbitrumSepolia" ;
112117 hardhatNetwork = "arbitrumSepoliaDevnet" ;
118+ contractNameSuffix = "" ;
113119 arbitratorContracts = arbitratorDevnet ;
114120 break ;
115121 case "testnet" :
116122 viemNetwork = "arbitrumSepolia" ;
117123 hardhatNetwork = "arbitrumSepolia" ;
124+ contractNameSuffix = "" ;
118125 arbitratorContracts = arbitratorTestnet ;
119126 break ;
120127 case "mainnet" :
121128 viemNetwork = "arbitrum" ;
122129 hardhatNetwork = "arbitrum" ;
130+ contractNameSuffix = "Neo" ;
123131 arbitratorContracts = arbitratorMainnet ;
124132 break ;
125133 default :
126134 throw new Error ( `Unknown deployment ${ deployment } ` ) ;
127135 }
128136
129- const deploymentContracts = await readArtifacts ( viemNetwork , hardhatNetwork , arbitratorContracts ) ;
137+ const deploymentContracts = await readArtifacts ( viemNetwork , hardhatNetwork , contractNameSuffix , arbitratorContracts ) ;
130138
131139 return {
132140 out : "src/hooks/contracts/generated.ts" ,
0 commit comments