@@ -33,8 +33,8 @@ use graph::{
33
33
web3:: {
34
34
self ,
35
35
types:: {
36
- Address , BlockId , BlockNumber as Web3BlockNumber , Bytes , CallRequest , Filter ,
37
- FilterBuilder , Log , Transaction , TransactionReceipt , H256 ,
36
+ BlockId , BlockNumber as Web3BlockNumber , Bytes , CallRequest , Filter , FilterBuilder ,
37
+ Log , Transaction , TransactionReceipt , H256 ,
38
38
} ,
39
39
} ,
40
40
BlockNumber , ChainStore , CheapClone , DynTryFuture , Error , EthereumCallCache , Logger ,
@@ -659,13 +659,13 @@ impl EthereumAdapter {
659
659
async fn code (
660
660
& self ,
661
661
logger : & Logger ,
662
- address : Address ,
662
+ address : alloy :: primitives :: Address ,
663
663
block_ptr : BlockPtr ,
664
- ) -> Result < Bytes , EthereumRpcError > {
665
- let web3 = self . web3 . clone ( ) ;
664
+ ) -> Result < alloy :: primitives :: Bytes , EthereumRpcError > {
665
+ let alloy = self . alloy . clone ( ) ;
666
666
let logger = Logger :: new ( & logger, o ! ( "provider" => self . provider. clone( ) ) ) ;
667
667
668
- let block_id = self . block_ptr_to_id ( & block_ptr) ;
668
+ let block_id = self . block_ptr_to_alloy_block_id ( & block_ptr) ;
669
669
let retry_log_message = format ! ( "eth_getCode RPC call for block {}" , block_ptr) ;
670
670
671
671
retry ( retry_log_message, & logger)
@@ -677,13 +677,12 @@ impl EthereumAdapter {
677
677
. limit ( ENV_VARS . request_retries )
678
678
. timeout_secs ( ENV_VARS . json_rpc_timeout . as_secs ( ) )
679
679
. run ( move || {
680
- let web3 = web3 . cheap_clone ( ) ;
680
+ let alloy = alloy . cheap_clone ( ) ;
681
681
async move {
682
- let result: Result < Bytes , web3:: Error > =
683
- web3. eth ( ) . code ( address, Some ( block_id) ) . boxed ( ) . await ;
682
+ let result = alloy. get_code_at ( address) . block_id ( block_id) . await ;
684
683
match result {
685
684
Ok ( code) => Ok ( code) ,
686
- Err ( err) => Err ( EthereumRpcError :: Web3Error ( err) ) ,
685
+ Err ( err) => Err ( EthereumRpcError :: AlloyError ( err) ) ,
687
686
}
688
687
}
689
688
} )
@@ -1528,9 +1527,9 @@ impl EthereumAdapterTrait for EthereumAdapter {
1528
1527
async fn get_code (
1529
1528
& self ,
1530
1529
logger : & Logger ,
1531
- address : H160 ,
1530
+ address : alloy :: primitives :: Address ,
1532
1531
block_ptr : BlockPtr ,
1533
- ) -> Result < Bytes , EthereumRpcError > {
1532
+ ) -> Result < alloy :: primitives :: Bytes , EthereumRpcError > {
1534
1533
debug ! (
1535
1534
logger, "eth_getCode" ;
1536
1535
"address" => format!( "{}" , address) ,
0 commit comments