11use anyhow:: Error ;
2- use ethabi:: { Error as ABIError , Function , ParamType , Token } ;
32use graph:: blockchain:: ChainIdentifier ;
43use graph:: components:: subgraph:: MappingError ;
54use graph:: data:: store:: ethereum:: call;
@@ -98,8 +97,8 @@ pub struct ContractCall {
9897 pub contract_name : String ,
9998 pub address : Address ,
10099 pub block_ptr : BlockPtr ,
101- pub function : Function ,
102- pub args : Vec < Token > ,
100+ pub function : graph :: abi :: Function ,
101+ pub args : Vec < graph :: abi :: DecodedValue > ,
103102 pub gas : Option < u32 > ,
104103}
105104
@@ -113,13 +112,12 @@ pub enum EthereumRpcError {
113112
114113#[ derive( Error , Debug ) ]
115114pub enum ContractCallError {
116- #[ error( "ABI error: {0}" ) ]
117- ABIError ( #[ from] ABIError ) ,
118- /// `Token` is not of expected `ParamType`
119- #[ error( "type mismatch, token {0:?} is not of kind {1:?}" ) ]
120- TypeError ( Token , ParamType ) ,
121- #[ error( "error encoding input call data: {0}" ) ]
122- EncodingError ( ethabi:: Error ) ,
115+ #[ error( "ABI error: {0:#}" ) ]
116+ ABIError ( anyhow:: Error ) ,
117+ #[ error( "type mismatch, decoded value {0:?} is not of kind {1:?}" ) ]
118+ TypeError ( graph:: abi:: DecodedValue , graph:: abi:: ParamType ) ,
119+ #[ error( "error encoding input call data: {0:#}" ) ]
120+ EncodingError ( anyhow:: Error ) ,
123121 #[ error( "call error: {0}" ) ]
124122 Web3Error ( web3:: Error ) ,
125123 #[ error( "ethereum node took too long to perform call" ) ]
@@ -1174,7 +1172,7 @@ pub trait EthereumAdapter: Send + Sync + 'static {
11741172 logger : & Logger ,
11751173 call : & ContractCall ,
11761174 cache : Arc < dyn EthereumCallCache > ,
1177- ) -> Result < ( Option < Vec < Token > > , call:: Source ) , ContractCallError > ;
1175+ ) -> Result < ( Option < Vec < graph :: abi :: DecodedValue > > , call:: Source ) , ContractCallError > ;
11781176
11791177 /// Make multiple contract calls in a single batch. The returned `Vec`
11801178 /// has results in the same order as the calls in `calls` on input. The
@@ -1184,7 +1182,7 @@ pub trait EthereumAdapter: Send + Sync + 'static {
11841182 logger : & Logger ,
11851183 calls : & [ & ContractCall ] ,
11861184 cache : Arc < dyn EthereumCallCache > ,
1187- ) -> Result < Vec < ( Option < Vec < Token > > , call:: Source ) > , ContractCallError > ;
1185+ ) -> Result < Vec < ( Option < Vec < graph :: abi :: DecodedValue > > , call:: Source ) > , ContractCallError > ;
11881186
11891187 fn get_balance (
11901188 & self ,
@@ -1213,9 +1211,9 @@ mod tests {
12131211 use graph:: blockchain:: TriggerFilter as _;
12141212 use graph:: firehose:: { CallToFilter , CombinedFilter , LogFilter , MultiLogFilter } ;
12151213 use graph:: petgraph:: graphmap:: GraphMap ;
1216- use graph:: prelude:: ethabi:: ethereum_types:: H256 ;
12171214 use graph:: prelude:: web3:: types:: Address ;
12181215 use graph:: prelude:: web3:: types:: Bytes ;
1216+ use graph:: prelude:: web3:: types:: H256 ;
12191217 use graph:: prelude:: EthereumCall ;
12201218 use hex:: ToHex ;
12211219 use itertools:: Itertools ;
0 commit comments