@@ -39,77 +39,82 @@ access(all) fun main(contractAddress: String): EVMContractConfig {
3939
4040 // Read authorizedCOA
4141 var authorizedCOA = " "
42- let coaCalldata = EVM .encodeABIWithSignature (" authorizedCOA()" , [])
43- let coaResult = EVM .dryCall (
42+ let coaResult = EVM .dryCallWithSigAndArgs (
4443 from : fromAddress ,
4544 to : evmContractAddress ,
46- data : coaCalldata ,
45+ signature : " authorizedCOA()" ,
46+ args : [],
4747 gasLimit : 100_000 ,
48- value : EVM .Balance (attoflow : 0 )
48+ value : EVM .Balance (attoflow : 0 ),
49+ resultTypes : [Type <EVM .EVMAddress >()]
4950 )
5051 if coaResult .status == EVM .Status .successful {
51- let decoded = EVM . decodeABI ( types : [ Type < EVM . EVMAddress >()], data : coaResult . data )
52- authorizedCOA = (decoded [0 ] as ! EVM .EVMAddress ).toString ()
52+ assert ( coaResult . results . length == 1 , message : " Invalid response from authorizedCOA() " )
53+ authorizedCOA = (coaResult . results [0 ] as ! EVM .EVMAddress ).toString ()
5354 }
5455
5556 // Read allowlistEnabled
5657 var allowlistEnabled = false
57- let allowlistCalldata = EVM .encodeABIWithSignature (" allowlistEnabled()" , [])
58- let allowlistResult = EVM .dryCall (
58+ let allowlistResult = EVM .dryCallWithSigAndArgs (
5959 from : fromAddress ,
6060 to : evmContractAddress ,
61- data : allowlistCalldata ,
61+ signature : " allowlistEnabled()" ,
62+ args : [],
6263 gasLimit : 100_000 ,
63- value : EVM .Balance (attoflow : 0 )
64+ value : EVM .Balance (attoflow : 0 ),
65+ resultTypes : [Type <Bool >()]
6466 )
6567 if allowlistResult .status == EVM .Status .successful {
66- let decoded = EVM . decodeABI ( types : [ Type < Bool >()], data : allowlistResult . data )
67- allowlistEnabled = decoded [0 ] as ! Bool
68+ assert ( allowlistResult . results . length == 1 , message : " Invalid response from allowlistEnabled() " )
69+ allowlistEnabled = allowlistResult . results [0 ] as ! Bool
6870 }
6971
7072 // Read blocklistEnabled
7173 var blocklistEnabled = false
72- let blocklistCalldata = EVM .encodeABIWithSignature (" blocklistEnabled()" , [])
73- let blocklistResult = EVM .dryCall (
74+ let blocklistResult = EVM .dryCallWithSigAndArgs (
7475 from : fromAddress ,
7576 to : evmContractAddress ,
76- data : blocklistCalldata ,
77+ signature : " blocklistEnabled()" ,
78+ args : [],
7779 gasLimit : 100_000 ,
78- value : EVM .Balance (attoflow : 0 )
80+ value : EVM .Balance (attoflow : 0 ),
81+ resultTypes : [Type <Bool >()]
7982 )
8083 if blocklistResult .status == EVM .Status .successful {
81- let decoded = EVM . decodeABI ( types : [ Type < Bool >()], data : blocklistResult . data )
82- blocklistEnabled = decoded [0 ] as ! Bool
84+ assert ( blocklistResult . results . length == 1 , message : " Invalid response from blocklistEnabled() " )
85+ blocklistEnabled = blocklistResult . results [0 ] as ! Bool
8386 }
8487
8588 // Read maxPendingRequestsPerUser
8689 var maxPendingRequestsPerUser : UInt256 = 0
87- let maxCalldata = EVM .encodeABIWithSignature (" maxPendingRequestsPerUser()" , [])
88- let maxResult = EVM .dryCall (
90+ let maxResult = EVM .dryCallWithSigAndArgs (
8991 from : fromAddress ,
9092 to : evmContractAddress ,
91- data : maxCalldata ,
93+ signature : " maxPendingRequestsPerUser()" ,
94+ args : [],
9295 gasLimit : 100_000 ,
93- value : EVM .Balance (attoflow : 0 )
96+ value : EVM .Balance (attoflow : 0 ),
97+ resultTypes : [Type <UInt256 >()]
9498 )
9599 if maxResult .status == EVM .Status .successful {
96- let decoded = EVM . decodeABI ( types : [ Type < UInt256 >()], data : maxResult . data )
97- maxPendingRequestsPerUser = decoded [0 ] as ! UInt256
100+ assert ( maxResult . results . length == 1 , message : " Invalid response from maxPendingRequestsPerUser() " )
101+ maxPendingRequestsPerUser = maxResult . results [0 ] as ! UInt256
98102 }
99103
100104 // Read getPendingRequestCount
101105 var pendingRequestCount : UInt256 = 0
102- let countCalldata = EVM .encodeABIWithSignature (" getPendingRequestCount()" , [])
103- let countResult = EVM .dryCall (
106+ let countResult = EVM .dryCallWithSigAndArgs (
104107 from : fromAddress ,
105108 to : evmContractAddress ,
106- data : countCalldata ,
109+ signature : " getPendingRequestCount()" ,
110+ args : [],
107111 gasLimit : 100_000 ,
108- value : EVM .Balance (attoflow : 0 )
112+ value : EVM .Balance (attoflow : 0 ),
113+ resultTypes : [Type <UInt256 >()]
109114 )
110115 if countResult .status == EVM .Status .successful {
111- let decoded = EVM . decodeABI ( types : [ Type < UInt256 >()], data : countResult . data )
112- pendingRequestCount = decoded [0 ] as ! UInt256
116+ assert ( countResult . results . length == 1 , message : " Invalid response from getPendingRequestCount() " )
117+ pendingRequestCount = countResult . results [0 ] as ! UInt256
113118 }
114119
115120 return EVMContractConfig (
0 commit comments