Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ where
let selector = "price(bytes32,address,address,uint256[])";

let res = self
.call(selector, args, overwrites, None, U256::from(0u64), None, block_overrides)?
.call(selector, args, overwrites, Some(Address::ZERO), U256::from(0u64), None, block_overrides)?
.return_value;

let decoded: PriceReturn = PriceReturn::abi_decode(&res).map_err(|e| {
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,11 @@ contract BalancerV3SwapAdapter is BalancerSwapHelpers {
override
returns (Capability[] memory capabilities)
{
capabilities = new Capability[](3);
capabilities = new Capability[](4);
capabilities[0] = Capability.SellOrder;
capabilities[1] = Capability.BuyOrder;
capabilities[2] = Capability.HardLimits;
capabilities[2] = Capability.PriceFunction;
capabilities[3] = Capability.HardLimits;
}

/// @inheritdoc ISwapAdapter
Expand Down
14 changes: 14 additions & 0 deletions protocols/adapter-integration/evm/test/BalancerV3SwapAdapter.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,20 @@ contract BalancerV3SwapAdapterTest is AdapterTest, ERC20, BalancerV3Errors {
vm.label(permit2, "Permit2");
}

function testGetCapabilitiesFuzz(
bytes32 pool,
address token0,
address token1
) public view {
Capability[] memory res = adapter.getCapabilities(pool, token0, token1);

assertEq(res.length, 4);
assertEq(uint256(res[0]), uint256(Capability.SellOrder));
assertEq(uint256(res[1]), uint256(Capability.BuyOrder));
assertEq(uint256(res[2]), uint256(Capability.PriceFunction));
assertEq(uint256(res[3]), uint256(Capability.HardLimits));
}

///////////////////////////////////////// ERC4626_ERC20_DIRECT
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Expand Down
34 changes: 10 additions & 24 deletions protocols/substreams/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions protocols/substreams/ethereum-balancer-v3/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ethereum-balancer-v3"
version = "0.4.0"
version = "0.4.1"
edition = "2021"

[lib]
Expand All @@ -11,12 +11,14 @@ crate-type = ["cdylib"]
substreams = "0.5.22"
substreams-ethereum = "0.9.9"
ethabi = "18.0.0"
hex = "0.4.3"
hex = { version = "0.4.3", features = ["serde"] }
anyhow = "1.0.75"
num-bigint = "0.4.4"
tycho-substreams = { git = "https://github.com/propeller-heads/tycho-protocol-sdk.git", rev = "51995f9" }
tycho-substreams = { path = "../crates/tycho-substreams" }
itertools = "0.13.0"
keccak-hash = "0.11.0"
serde = { version = "1.0", features = ["derive"] }
serde_qs = "0.13.0"

[build-dependencies]
anyhow = "1"
Expand Down
49 changes: 28 additions & 21 deletions protocols/substreams/ethereum-balancer-v3/Readme.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,45 @@
# balancer_v3 Substreams modules

This package was initialized via `substreams init`, using the `evm-events-calls` template.
This package indexes Balancer V3 pools across multiple networks using manifest-level
configuration. The same WASM module graph is reused; chain-specific contract addresses are
provided via substreams `params`.

## Usage

```bash
substreams build
substreams auth
substreams gui # Get streaming!
substreams registry login # Login to substreams.dev
substreams registry publish # Publish your Substreams to substreams.dev
substreams gui
substreams registry login
substreams registry publish
```

## Modules

All of these modules produce data filtered by these contracts:
- _vault_ at **0xba1333333333a1ba1108e8412f11850a5c319ba9**
- _stable_pool_factory_ at **0xb9d01ca61b9c181da1051bfdd28e1097e920ab14**
- _weighted_pool_factory_ at **0x201efd508c8dfe9de1a13c2452863a78cb2a86cc**
- stable_pool contracts created from _stable_pool_factory_
- weighted_pool contracts created from _weighted_pool_factory_
### `map_events_calls`

This module gets you events _and_ calls
## Configuration

Contract addresses are configured per manifest via query-string params on map/store modules:

### `map_events`
- `vault` — Balancer V3 Vault
- `vault_extension` — Vault extension contract
- `batch_router` — Batch router for swaps
- `permit2` — Permit2 authorization contract
- `weighted_factory` — Weighted pool factory
- `stable_factory` — Stable pool factory
- `reclamm_factory` — ReClamm pool factory
- `skip_rate_provider_pools` — When `true`, pools whose factory `Create` call includes any
`WITH_RATE` token are not emitted as protocol components (optional, default `false`). Set to
`true` on L2 deployments where RPC nodes lack DCI/tracing support; yield-bearing pools with rate
providers will not be indexed.

This module gets you only events that matched.
See `substreams.yaml` (Ethereum mainnet) and the network-specific manifests:

- `base-balancer-v3.yaml`
- `arbitrum-balancer-v3.yaml`
- `gnosis-balancer-v3.yaml`

Addresses are sourced from the [Balancer deployments repo](https://github.com/balancer/balancer-deployments).

### `map_calls`

This module gets you only calls that matched.

## Modules

- `map_components` — discovers pools from factory create calls
- `map_relative_balances` — tracks pool token balances via Vault storage
- `map_protocol_changes` — aggregates components, balances, and contract changes
Loading
Loading