1- import { arbitrum , arbitrumSepolia } from "viem/chains" ;
1+ import { type PublicClient , type WalletClient , getContract } from "viem" ;
2+ import { type ContractConfig , type DeploymentName , deployments , getAddress } from "./utils" ;
23import {
34 klerosCoreConfig as devnetCoreConfig ,
45 sortitionModuleConfig as devnetSortitionConfig ,
@@ -46,35 +47,19 @@ import {
4647 pnkConfig as mainnetPnkConfig ,
4748 klerosCoreSnapshotProxyConfig as mainnetSnapshotProxyConfig ,
4849} from "./mainnet.viem" ;
49- import { type PublicClient , type WalletClient , getContract } from "viem" ;
50-
51- const deployments = {
52- devnet : {
53- chainId : arbitrumSepolia . id ,
54- } ,
55- university : {
56- chainId : arbitrumSepolia . id ,
57- } ,
58- testnet : {
59- chainId : arbitrumSepolia . id ,
60- } ,
61- mainnetNeo : {
62- chainId : arbitrum . id ,
63- } ,
64- } as const ;
65-
66- type DeploymentName = keyof typeof deployments ;
67-
68- type ContractConfig = {
69- address : Record < number , `0x${string } `> ;
70- abi : readonly any [ ] ;
71- } ;
7250
7351type ContractInstance = {
7452 address : `0x${string } `;
7553 abi : readonly any [ ] ;
7654} ;
7755
56+ function getContractConfig ( { config, chainId } : { config : ContractConfig ; chainId : number } ) : ContractInstance {
57+ return {
58+ address : getAddress ( config , chainId ) ,
59+ abi : config . abi ,
60+ } ;
61+ }
62+
7863type ContractInstances = {
7964 klerosCore : ContractInstance ;
8065 sortition : ContractInstance ;
@@ -91,19 +76,6 @@ type ContractInstances = {
9176 klerosCoreSnapshotProxy : ContractInstance ;
9277} ;
9378
94- function getAddress ( config : ContractConfig , chainId : number ) : `0x${string } ` {
95- const address = config . address [ chainId ] ;
96- if ( ! address ) throw new Error ( `No address found for chainId ${ chainId } ` ) ;
97- return address ;
98- }
99-
100- function getContractConfig ( { config, chainId } : { config : ContractConfig ; chainId : number } ) : ContractInstance {
101- return {
102- address : getAddress ( config , chainId ) ,
103- abi : config . abi ,
104- } ;
105- }
106-
10779function getCommonConfigs ( {
10880 chainId,
10981 configs,
0 commit comments