1
1
use anyhow:: Error ;
2
- use ethabi:: { Error as ABIError , Function , ParamType , Token } ;
3
2
use graph:: blockchain:: ChainIdentifier ;
4
3
use graph:: components:: subgraph:: MappingError ;
5
4
use graph:: data:: store:: ethereum:: call;
@@ -98,8 +97,8 @@ pub struct ContractCall {
98
97
pub contract_name : String ,
99
98
pub address : Address ,
100
99
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 :: DynSolValue > ,
103
102
pub gas : Option < u32 > ,
104
103
}
105
104
@@ -113,13 +112,12 @@ pub enum EthereumRpcError {
113
112
114
113
#[ derive( Error , Debug ) ]
115
114
pub 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:: DynSolValue , graph:: abi:: DynSolType ) ,
119
+ #[ error( "error encoding input call data: {0:#}" ) ]
120
+ EncodingError ( anyhow:: Error ) ,
123
121
#[ error( "call error: {0}" ) ]
124
122
Web3Error ( web3:: Error ) ,
125
123
#[ error( "ethereum node took too long to perform call" ) ]
@@ -1174,7 +1172,7 @@ pub trait EthereumAdapter: Send + Sync + 'static {
1174
1172
logger : & Logger ,
1175
1173
call : & ContractCall ,
1176
1174
cache : Arc < dyn EthereumCallCache > ,
1177
- ) -> Result < ( Option < Vec < Token > > , call:: Source ) , ContractCallError > ;
1175
+ ) -> Result < ( Option < Vec < graph :: abi :: DynSolValue > > , call:: Source ) , ContractCallError > ;
1178
1176
1179
1177
/// Make multiple contract calls in a single batch. The returned `Vec`
1180
1178
/// has results in the same order as the calls in `calls` on input. The
@@ -1184,7 +1182,7 @@ pub trait EthereumAdapter: Send + Sync + 'static {
1184
1182
logger : & Logger ,
1185
1183
calls : & [ & ContractCall ] ,
1186
1184
cache : Arc < dyn EthereumCallCache > ,
1187
- ) -> Result < Vec < ( Option < Vec < Token > > , call:: Source ) > , ContractCallError > ;
1185
+ ) -> Result < Vec < ( Option < Vec < graph :: abi :: DynSolValue > > , call:: Source ) > , ContractCallError > ;
1188
1186
1189
1187
fn get_balance (
1190
1188
& self ,
@@ -1213,9 +1211,9 @@ mod tests {
1213
1211
use graph:: blockchain:: TriggerFilter as _;
1214
1212
use graph:: firehose:: { CallToFilter , CombinedFilter , LogFilter , MultiLogFilter } ;
1215
1213
use graph:: petgraph:: graphmap:: GraphMap ;
1216
- use graph:: prelude:: ethabi:: ethereum_types:: H256 ;
1217
1214
use graph:: prelude:: web3:: types:: Address ;
1218
1215
use graph:: prelude:: web3:: types:: Bytes ;
1216
+ use graph:: prelude:: web3:: types:: H256 ;
1219
1217
use graph:: prelude:: EthereumCall ;
1220
1218
use hex:: ToHex ;
1221
1219
use itertools:: Itertools ;
0 commit comments