-
Notifications
You must be signed in to change notification settings - Fork 151
Implement build.rs bindings generation #3827
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
09b74a3
b879cfa
df03e93
63f914a
319f708
a197a1f
386295c
f57e73d
495dbb7
865e32e
c259961
0592d9f
e95a825
40d9bf8
442203f
9e7b790
bdf4a97
e13888c
e6a6eb5
57c71e8
9f08fac
2f8b2d0
f32040d
b811309
d9a4486
33b6570
7e17ee9
691ecb6
e1b4ef7
d7c325e
9d27684
f4381f7
dada99d
2a5a46f
457f2a2
65e646b
c5c5816
c244ac5
9d8878b
0583047
b00f81c
8c3a0ec
5e95aaa
6a4fe80
e013220
bde15e7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| # Generated by build.rs, will contain the contract bindings | ||
| src/alloy | ||
jmg-duarte marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have no clue how to review this other than by asking AI.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can do them one by one. I did this whole with AI too and did multilple rounds with different contexts. But this was more about proving that I was able to migrate everything with minimal changes on the main codebase |
Large diffs are not rendered by default.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,88 +1,11 @@ | ||
| #![allow(clippy::let_unit_value)] | ||
|
|
||
| pub use ethcontract; | ||
| // This module get's auto-generated by the contracts build.rs | ||
| #[rustfmt::skip] | ||
| pub mod alloy; | ||
| pub mod errors; | ||
| use { | ||
| anyhow::{Result, anyhow, bail}, | ||
| ethcontract::{ | ||
| Contract, | ||
| common::{DeploymentInformation, contract::Network}, | ||
| }, | ||
| }; | ||
|
|
||
| pub fn deployment(contract: &Contract, chain_id: u64) -> Result<&Network> { | ||
| contract | ||
| .networks | ||
| .get(&chain_id.to_string()) | ||
| // Note that we are conflating network IDs with chain IDs. In general | ||
| // they cannot be considered the same, but for the networks that we | ||
| // support (xDAI, Görli and Mainnet) they are. | ||
| .ok_or_else(|| anyhow!("missing {} deployment for {}", contract.name, chain_id)) | ||
| } | ||
|
|
||
| pub fn deployment_block(contract: &Contract, chain_id: u64) -> Result<u64> { | ||
| let deployment_info = deployment(contract, chain_id)? | ||
| .deployment_information | ||
| .ok_or_else(|| anyhow!("missing deployment information for {}", contract.name))?; | ||
|
|
||
| match deployment_info { | ||
| DeploymentInformation::BlockNumber(block) => Ok(block), | ||
| DeploymentInformation::TransactionHash(tx) => { | ||
| bail!("missing deployment block number for {}", tx) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| #[macro_use] | ||
| mod macros; | ||
| pub mod errors; | ||
|
|
||
| #[cfg(feature = "bin")] | ||
| pub mod paths; | ||
| pub mod vault; | ||
| pub mod web3; | ||
|
|
||
| #[cfg(test)] | ||
| mod tests { | ||
| use { | ||
| super::*, | ||
| crate::alloy::networks::{ARBITRUM_ONE, GNOSIS, MAINNET, SEPOLIA}, | ||
| }; | ||
|
|
||
| #[test] | ||
| fn deployment_addresses() { | ||
| for network in &[MAINNET, GNOSIS, SEPOLIA, ARBITRUM_ONE] { | ||
| assert!( | ||
| alloy::BalancerV2NoProtocolFeeLiquidityBootstrappingPoolFactory::deployment_address(network).is_some() | ||
| ) | ||
| } | ||
| for network in &[MAINNET, ARBITRUM_ONE] { | ||
| assert!( | ||
| alloy::BalancerV2WeightedPool2TokensFactory::deployment_address(network).is_some() | ||
| ); | ||
| assert!( | ||
| alloy::BalancerV2LiquidityBootstrappingPoolFactory::deployment_address(network) | ||
| .is_some() | ||
| ); | ||
| } | ||
|
|
||
| assert!(alloy::BalancerV2WeightedPoolFactory::deployment_address(&MAINNET).is_some()); | ||
|
|
||
| for network in &[MAINNET, GNOSIS, ARBITRUM_ONE] { | ||
| assert!(alloy::BalancerV2StablePoolFactoryV2::deployment_address(network).is_some()); | ||
| } | ||
| } | ||
|
|
||
| #[test] | ||
| fn deployment_information() { | ||
| assert!(alloy::BalancerV2WeightedPoolFactory::deployment_address(&MAINNET).is_some()); | ||
| for network in &[MAINNET, ARBITRUM_ONE] { | ||
| assert!( | ||
| alloy::BalancerV2WeightedPool2TokensFactory::deployment_address(network).is_some() | ||
| ); | ||
| } | ||
| for network in &[MAINNET, GNOSIS, ARBITRUM_ONE] { | ||
| assert!(alloy::BalancerV2StablePoolFactoryV2::deployment_address(network).is_some()); | ||
| } | ||
| } | ||
| } |
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,7 +19,6 @@ use { | |
| GPv2Settlement, | ||
| HooksTrampoline, | ||
| IUniswapV3Factory, | ||
| InstanceExt, | ||
| WETH9, | ||
| support::Balances, | ||
| }, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.