@@ -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 ,
@@ -531,13 +531,13 @@ impl EthereumAdapter {
531
531
async fn code (
532
532
& self ,
533
533
logger : & Logger ,
534
- address : Address ,
534
+ address : alloy :: primitives :: Address ,
535
535
block_ptr : BlockPtr ,
536
- ) -> Result < Bytes , EthereumRpcError > {
537
- let web3 = self . web3 . clone ( ) ;
536
+ ) -> Result < alloy :: primitives :: Bytes , EthereumRpcError > {
537
+ let alloy = self . alloy . clone ( ) ;
538
538
let logger = Logger :: new ( & logger, o ! ( "provider" => self . provider. clone( ) ) ) ;
539
539
540
- let block_id = self . block_ptr_to_id ( & block_ptr) ;
540
+ let block_id = self . block_ptr_to_alloy_block_id ( & block_ptr) ;
541
541
let retry_log_message = format ! ( "eth_getCode RPC call for block {}" , block_ptr) ;
542
542
543
543
retry ( retry_log_message, & logger)
@@ -549,13 +549,12 @@ impl EthereumAdapter {
549
549
. limit ( ENV_VARS . request_retries )
550
550
. timeout_secs ( ENV_VARS . json_rpc_timeout . as_secs ( ) )
551
551
. run ( move || {
552
- let web3 = web3 . cheap_clone ( ) ;
552
+ let alloy = alloy . cheap_clone ( ) ;
553
553
async move {
554
- let result: Result < Bytes , web3:: Error > =
555
- web3. eth ( ) . code ( address, Some ( block_id) ) . boxed ( ) . await ;
554
+ let result = alloy. get_code_at ( address) . block_id ( block_id) . await ;
556
555
match result {
557
556
Ok ( code) => Ok ( code) ,
558
- Err ( err) => Err ( EthereumRpcError :: Web3Error ( err) ) ,
557
+ Err ( err) => Err ( EthereumRpcError :: AlloyError ( err) ) ,
559
558
}
560
559
}
561
560
} )
@@ -1513,9 +1512,9 @@ impl EthereumAdapterTrait for EthereumAdapter {
1513
1512
async fn get_code (
1514
1513
& self ,
1515
1514
logger : & Logger ,
1516
- address : H160 ,
1515
+ address : alloy :: primitives :: Address ,
1517
1516
block_ptr : BlockPtr ,
1518
- ) -> Result < Bytes , EthereumRpcError > {
1517
+ ) -> Result < alloy :: primitives :: Bytes , EthereumRpcError > {
1519
1518
debug ! (
1520
1519
logger, "eth_getCode" ;
1521
1520
"address" => format!( "{}" , address) ,
0 commit comments