@@ -7,48 +7,53 @@ evm.runOnEvms("bytecode-verification-token-router", async (chain, signer, log) =
7
7
// The root path of the foundry project
8
8
const rootPath = path . resolve ( '../evm/' ) ;
9
9
10
- const verifiersData = verificationApiKeys . find ( ( x ) => x . chainId == chain . chainId ) ;
11
- const verifiers = flattenObject ( verifiersData ! ) ;
12
- delete verifiers . chainId ;
10
+ const verifiers = verificationApiKeys [ chain . chainId ] ;
11
+ if ( ! verifiers ) {
12
+ log ( chalk . red ( `No verifiers found for chain ${ chain . chainId } ` ) ) ;
13
+ return ;
14
+ }
13
15
14
- for ( let [ name , apiKey ] of Object . entries ( verifiers ) ) {
15
- name = name . split ( "-" ) [ 0 ] ;
16
+ for ( let [ verifier , data ] of Object . entries ( verifiers ) ) {
17
+ const apiKey = typeof data === 'string' ? data : data . key ;
18
+ const verifierUrl = typeof data === 'string' ? undefined : data . apiUrl ;
16
19
17
20
// Implementation data
18
21
const implementationName = "TokenRouter" ;
19
22
const implementationPath = 'src/TokenRouter/TokenRouter.sol' ;
20
23
const implementationAddress = getContractAddress ( "TokenRouterImplementation" , chain . chainId ) ;
21
24
const implementationDeploymentArgs = getDeploymentArgs ( "TokenRouterImplementation" , chain . chainId ) ;
22
25
const implementationConstructorSignature = "constructor(address,address,address,uint16,bytes32,bytes32,uint32)" ;
23
- const verifyImplementationCommand = getVerifyCommand (
26
+ const verifyImplementationCommand = getVerifyCommand ( {
24
27
chain,
25
- implementationName ,
26
- implementationPath ,
27
- implementationAddress ,
28
- implementationConstructorSignature ,
29
- implementationDeploymentArgs ,
30
- name ,
28
+ contractName : implementationName ,
29
+ contractPath : implementationPath ,
30
+ contractAddress : implementationAddress ,
31
+ constructorSignature : implementationConstructorSignature ,
32
+ constructorArgs : implementationDeploymentArgs ,
33
+ verifier,
34
+ verifierUrl,
31
35
apiKey
32
- ) ;
36
+ } ) ;
33
37
34
38
// Proxy data
35
39
const proxyName = "ERC1967Proxy" ;
36
40
const proxyPath = 'lib/openzeppelin-contracts/contracts/proxy/ERC1967/ERC1967Proxy.sol' ;
37
- const proxyAddress = getContractAddress ( "MatchingEngineProxy " , chain . chainId ) ;
38
- const proxyDeploymentArgs = getDeploymentArgs ( "MatchingEngineProxy " , chain . chainId ) ;
41
+ const proxyAddress = getContractAddress ( "TokenRouterProxy " , chain . chainId ) ;
42
+ const proxyDeploymentArgs = getDeploymentArgs ( "TokenRouterProxy " , chain . chainId ) ;
39
43
const proxyConstructorSignature = "constructor(address,bytes)" ;
40
- const verifyProxyCommand = getVerifyCommand (
44
+ const verifyProxyCommand = getVerifyCommand ( {
41
45
chain,
42
- proxyName ,
43
- proxyPath ,
44
- proxyAddress ,
45
- proxyConstructorSignature ,
46
- proxyDeploymentArgs ,
47
- name ,
46
+ contractName : proxyName ,
47
+ contractPath : proxyPath ,
48
+ contractAddress : proxyAddress ,
49
+ constructorSignature : proxyConstructorSignature ,
50
+ constructorArgs : proxyDeploymentArgs ,
51
+ verifier,
52
+ verifierUrl,
48
53
apiKey
49
- ) ;
54
+ } ) ;
50
55
51
- log ( chalk . green ( `Verifying bytecode on ${ name } ...` ) ) ;
56
+ log ( chalk . green ( `Verifying bytecode on ${ verifier } ...` ) ) ;
52
57
log ( chalk . green ( "Verifying implementation bytecode..." ) ) ;
53
58
execSync ( verifyImplementationCommand , { stdio : "inherit" , cwd : rootPath } ) ;
54
59
console . log ( )
0 commit comments