Skip to content

Commit

Permalink
Add support for BalancerV2ComposableStablePoolFactoryV6 in contracts (#…
Browse files Browse the repository at this point in the history
…3099)

# Description
Add support for BalancerV2ComposableStablePoolFactoryV6 in contracts. It
is compatible with V5, so no changes are needed:
https://github.com/balancer/balancer-deployments/pull/108/files#diff-8730c2b8ae6de974591d1c41121ef43dc296a98f578c960359f328e9d54afe50R3-R4
  • Loading branch information
m-lord-renkse authored Oct 31, 2024
1 parent 9bc0269 commit 516b0fe
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 1 deletion.
37 changes: 37 additions & 0 deletions crates/contracts/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,43 @@ fn main() {
},
)
});
generate_contract_with_config("BalancerV2ComposableStablePoolFactoryV6", |builder| {
builder
.contract_mod_override("balancer_v2_composable_stable_pool_factory_v6")
.add_network(
MAINNET,
Network {
address: addr("0x5B42eC6D40f7B7965BE5308c70e2603c0281C1E9"),
// <https://etherscan.io/tx/0x4149cadfe5d3431205d9819fca44ed7a4c2b101adc51adc75cc4586dee237be8>
deployment_information: Some(DeploymentInformation::BlockNumber(19314764)),
},
)
.add_network(
GNOSIS,
Network {
address: addr("0x47B489bf5836f83ABD928C316F8e39bC0587B020"),
// <https://gnosisscan.io/tx/0xc3fc1fb96712a0659b7e9e5f406f63bdf5cbd5df9e04f0372c28f75785036791>
deployment_information: Some(DeploymentInformation::BlockNumber(32650879)),
},
)
.add_network(
// <https://docs.balancer.fi/reference/contracts/deployment-addresses/sepolia.html#ungrouped-active-current-contracts>
SEPOLIA,
Network {
address: addr("0x05503B3aDE04aCA81c8D6F88eCB73Ba156982D2B"),
// <https://sepolia.etherscan.io/tx/0x53aa3587002469b758e2bb87135d9599fd06e7be944fe61c7f82045c45328566>
deployment_information: Some(DeploymentInformation::BlockNumber(5369821)),
},
)
.add_network(
ARBITRUM_ONE,
Network {
address: addr("0x4bdCc2fb18AEb9e2d281b0278D946445070EAda7"),
// <https://arbiscan.io/tx/0xfa1e7642e135fb32dc14c990b851e5e7a0ac7a463e3a60c5003ae4142396f45e>
deployment_information: Some(DeploymentInformation::BlockNumber(184805448)),
},
)
});
generate_contract("BalancerV2WeightedPool");
generate_contract_with_config("BalancerV2StablePool", |builder| {
builder.add_method_alias(
Expand Down
1 change: 1 addition & 0 deletions crates/contracts/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ include_contracts! {
BalancerV2ComposableStablePoolFactoryV3;
BalancerV2ComposableStablePoolFactoryV4;
BalancerV2ComposableStablePoolFactoryV5;
BalancerV2ComposableStablePoolFactoryV6;
BalancerV2LiquidityBootstrappingPool;
BalancerV2LiquidityBootstrappingPoolFactory;
BalancerV2NoProtocolFeeLiquidityBootstrappingPoolFactory;
Expand Down
1 change: 1 addition & 0 deletions crates/driver/src/infra/liquidity/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ impl BalancerV2 {
contracts::BalancerV2ComposableStablePoolFactoryV3::raw_contract(),
contracts::BalancerV2ComposableStablePoolFactoryV4::raw_contract(),
contracts::BalancerV2ComposableStablePoolFactoryV5::raw_contract(),
contracts::BalancerV2ComposableStablePoolFactoryV6::raw_contract(),
]),
pool_deny_list: Vec::new(),
graph_url: graph_url.clone(),
Expand Down
11 changes: 10 additions & 1 deletion crates/shared/src/sources/balancer_v2/pool_fetching.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ use {
BalancerV2ComposableStablePoolFactoryV3,
BalancerV2ComposableStablePoolFactoryV4,
BalancerV2ComposableStablePoolFactoryV5,
BalancerV2ComposableStablePoolFactoryV6,
BalancerV2LiquidityBootstrappingPoolFactory,
BalancerV2NoProtocolFeeLiquidityBootstrappingPoolFactory,
BalancerV2StablePoolFactoryV2,
Expand Down Expand Up @@ -180,6 +181,7 @@ pub enum BalancerFactoryKind {
ComposableStableV3,
ComposableStableV4,
ComposableStableV5,
ComposableStableV6,
}

impl BalancerFactoryKind {
Expand All @@ -197,6 +199,7 @@ impl BalancerFactoryKind {
Self::ComposableStableV3,
Self::ComposableStableV4,
Self::ComposableStableV5,
Self::ComposableStableV6,
],
100 => vec![
Self::WeightedV3,
Expand All @@ -205,11 +208,13 @@ impl BalancerFactoryKind {
Self::ComposableStableV3,
Self::ComposableStableV4,
Self::ComposableStableV5,
Self::ComposableStableV6,
],
11155111 => vec![
Self::WeightedV4,
Self::ComposableStableV4,
Self::ComposableStableV5,
Self::ComposableStableV6,
Self::NoProtocolFeeLiquidityBootstrapping,
],
_ => Default::default(),
Expand Down Expand Up @@ -271,6 +276,9 @@ impl BalancerContracts {
BalancerFactoryKind::ComposableStableV5 => {
instance!(BalancerV2ComposableStablePoolFactoryV5)
}
BalancerFactoryKind::ComposableStableV6 => {
instance!(BalancerV2ComposableStablePoolFactoryV6)
}
};

factories.insert(kind, instance);
Expand Down Expand Up @@ -422,7 +430,8 @@ async fn create_aggregate_pool_fetcher(
BalancerFactoryKind::ComposableStable
| BalancerFactoryKind::ComposableStableV3
| BalancerFactoryKind::ComposableStableV4
| BalancerFactoryKind::ComposableStableV5 => {
| BalancerFactoryKind::ComposableStableV5
| BalancerFactoryKind::ComposableStableV6 => {
registry!(BalancerV2ComposableStablePoolFactory, instance)
}
};
Expand Down

0 comments on commit 516b0fe

Please sign in to comment.