File tree Expand file tree Collapse file tree
batcher/aligned-sdk/src/eth Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ use std:: sync:: Arc ;
2+
3+ use ethers:: prelude:: * ;
4+
5+ use crate :: core:: errors:: VerificationError ;
6+
7+ abigen ! (
8+ ProofAggregationServiceContract ,
9+ "abi/AlignedProofAggregationService.json"
10+ ) ;
11+
12+ pub type AlignedProofAggregationService = ProofAggregationServiceContract < Provider < Http > > ;
13+
14+ pub async fn aligned_proof_aggregation_service (
15+ provider : Provider < Http > ,
16+ contract_address : H160 ,
17+ ) -> Result < AlignedProofAggregationService , VerificationError > {
18+ let client = Arc :: new ( provider) ;
19+
20+ // Verify that the contract has code at the given address
21+ let code = client
22+ . get_code ( contract_address, None )
23+ . await
24+ . map_err ( |e| VerificationError :: EthereumProviderError ( e. to_string ( ) ) ) ?;
25+ if code. is_empty ( ) {
26+ return Err ( VerificationError :: EthereumNotAContract ( contract_address) ) ;
27+ }
28+
29+ Ok ( AlignedProofAggregationService :: new (
30+ contract_address,
31+ client,
32+ ) )
33+ }
You can’t perform that action at this time.
0 commit comments