-
Notifications
You must be signed in to change notification settings - Fork 396
Expand file tree
/
Copy pathaligned_service_manager.rs
More file actions
35 lines (28 loc) · 1.15 KB
/
aligned_service_manager.rs
File metadata and controls
35 lines (28 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
use std::sync::Arc;
use ethers::prelude::*;
use crate::common::errors::VerificationError;
abigen!(
AlignedLayerServiceManagerContract,
"abi/AlignedLayerServiceManager.json",
methods {
verifyBatchInclusion(bytes32,bytes32,bytes32,bytes20,bytes32,bytes,uint256) as verify_batch_inclusion_legacy;
verifyBatchInclusion(bytes32,bytes32,bytes32,bytes20,bytes32,bytes,uint256,address) as verify_batch_inclusion;
disabledVerifiers() as disabled_verifiers;
},
);
type AlignedLayerServiceManager = AlignedLayerServiceManagerContract<Provider<Http>>;
pub async fn aligned_service_manager(
provider: Provider<Http>,
contract_address: H160,
) -> Result<AlignedLayerServiceManager, VerificationError> {
let client = Arc::new(provider);
// Verify that the contract has code at the given address
let code = client
.get_code(contract_address, None)
.await
.map_err(|e| VerificationError::EthereumProviderError(e.to_string()))?;
if code.is_empty() {
return Err(VerificationError::EthereumNotAContract(contract_address));
}
Ok(AlignedLayerServiceManager::new(contract_address, client))
}