-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
anvil_constants : helper functions to extract anvil eigen layer contr…
…acts easily
- Loading branch information
supernovahs
committed
Jun 20, 2024
1 parent
c67ddd0
commit 9df665c
Showing
13 changed files
with
335 additions
and
4 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
|
||
|
||
__CONTRACTS__: ## | ||
|
||
start-anvil-with-contracts-deployed: ## | ||
./crates/contracts/anvil/start_anvil_chain_with_el_and_avs_deployed.sh | ||
|
||
|
||
deploy-contracts-to-anvil-and-save-state: ## | ||
./crates/contracts/anvil/deploy_contracts_save_anvil_state.sh | ||
|
1 change: 1 addition & 0 deletions
1
crates/contracts/anvil/contracts-deployed-anvil-state.json/state.json
Large diffs are not rendered by default.
Oops, something went wrong.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
141 changes: 141 additions & 0 deletions
141
crates/contracts/bindings/utils/json/ContractsRegistry.json
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
[package] | ||
name = "examples-anvil-utils" | ||
version.workspace = true | ||
edition.workspace = true | ||
rust-version.workspace = true | ||
repository.workspace = true | ||
license-file.workspace = true | ||
authors.workspace = true | ||
|
||
|
||
[lints] | ||
workspace = true | ||
|
||
[dependencies] | ||
alloy-primitives.workspace = true | ||
eyre.workspace = true | ||
tokio = { workspace = true, features = ["macros", "rt-multi-thread"] } | ||
|
||
eigen-client-avsregistry.workspace = true | ||
eigen-testing-utils.workspace = true |
16 changes: 16 additions & 0 deletions
16
examples/anvil-utils/examples/get_contracts_from_registry.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
use eigen_testing_utils::anvil_constants::{ | ||
get_delegation_manager_address, get_erc20_mock_strategy, get_operator_state_retriever_address, | ||
get_registry_coordinator_address, get_service_manager_address, get_strategy_manager_address, | ||
}; | ||
use eyre::Result; | ||
|
||
#[tokio::main] | ||
pub async fn main() -> Result<()> { | ||
get_service_manager_address().await; | ||
get_registry_coordinator_address().await; | ||
get_operator_state_retriever_address().await; | ||
get_delegation_manager_address().await; | ||
get_strategy_manager_address().await; | ||
get_erc20_mock_strategy().await; | ||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
use alloy_network::Ethereum; | ||
use alloy_primitives::{address, Address, U256}; | ||
use alloy_provider::{ | ||
fillers::{ChainIdFiller, FillProvider, GasFiller, JoinFill, NonceFiller}, | ||
RootProvider, | ||
}; | ||
use alloy_transport_http::{Client, Http}; | ||
use eigen_utils::{ | ||
binding::ContractsRegistry::{self, contractNamesReturn}, | ||
get_provider, | ||
}; | ||
use once_cell::sync::Lazy; | ||
|
||
pub const CONTRACTS_REGISTRY: Address = address!("5FbDB2315678afecb367f032d93F642f64180aa3"); | ||
pub static ANVIL_RPC_URL: Lazy< | ||
FillProvider< | ||
JoinFill< | ||
JoinFill<JoinFill<alloy_provider::Identity, GasFiller>, NonceFiller>, | ||
ChainIdFiller, | ||
>, | ||
RootProvider<Http<Client>>, | ||
Http<Client>, | ||
Ethereum, | ||
>, | ||
> = Lazy::new(|| get_provider(&"http://localhost:8545".to_string())); | ||
|
||
pub async fn get_service_manager_address() { | ||
let contracts_registry = ContractsRegistry::new(CONTRACTS_REGISTRY, (*ANVIL_RPC_URL).clone()); | ||
|
||
let val = contracts_registry | ||
.contractNames(U256::from(0)) | ||
.call() | ||
.await | ||
.unwrap(); | ||
|
||
let contractNamesReturn { _0: first_name } = val; | ||
|
||
println!("contract name : {:?}", first_name); | ||
} | ||
|
||
pub async fn get_registry_coordinator_address() { | ||
let contracts_registry = ContractsRegistry::new(CONTRACTS_REGISTRY, (*ANVIL_RPC_URL).clone()); | ||
|
||
let val = contracts_registry | ||
.contractNames(U256::from(1)) | ||
.call() | ||
.await | ||
.unwrap(); | ||
|
||
let contractNamesReturn { _0: first_name } = val; | ||
|
||
println!("contract name : {:?}", first_name); | ||
} | ||
|
||
pub async fn get_operator_state_retriever_address() { | ||
let contracts_registry = ContractsRegistry::new(CONTRACTS_REGISTRY, (*ANVIL_RPC_URL).clone()); | ||
|
||
let val = contracts_registry | ||
.contractNames(U256::from(2)) | ||
.call() | ||
.await | ||
.unwrap(); | ||
|
||
let contractNamesReturn { _0: first_name } = val; | ||
|
||
println!("contract name : {:?}", first_name); | ||
} | ||
|
||
pub async fn get_delegation_manager_address() { | ||
let contracts_registry = ContractsRegistry::new(CONTRACTS_REGISTRY, (*ANVIL_RPC_URL).clone()); | ||
|
||
let val = contracts_registry | ||
.contractNames(U256::from(3)) | ||
.call() | ||
.await | ||
.unwrap(); | ||
|
||
let contractNamesReturn { _0: first_name } = val; | ||
|
||
println!("contract name : {:?}", first_name); | ||
} | ||
|
||
pub async fn get_strategy_manager_address() { | ||
let contracts_registry = ContractsRegistry::new(CONTRACTS_REGISTRY, (*ANVIL_RPC_URL).clone()); | ||
|
||
let val = contracts_registry | ||
.contractNames(U256::from(4)) | ||
.call() | ||
.await | ||
.unwrap(); | ||
|
||
let contractNamesReturn { _0: first_name } = val; | ||
|
||
println!("contract name : {:?}", first_name); | ||
} | ||
|
||
pub async fn get_erc20_mock_strategy() { | ||
let contracts_registry = ContractsRegistry::new(CONTRACTS_REGISTRY, (*ANVIL_RPC_URL).clone()); | ||
|
||
let val = contracts_registry | ||
.contractNames(U256::from(5)) | ||
.call() | ||
.await | ||
.unwrap(); | ||
|
||
let contractNamesReturn { _0: first_name } = val; | ||
|
||
println!("contract name : {:?}", first_name); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters