fix(balancer): miscellaneous improvements before resync (#104)
* fix(balancer): ignore self balance change Euler pool emit a balance change for the pool itself. We don't want to have it because it's an unknown token from Tycho's perspective. example: https://etherscan.io/tx/0x4a9ea683052afefdae3d189862868c3a7dc8f431d1d9828b6bfd9451a8816426#eventlog#338 * refactor(balancer): rename balancer module to balancer-v2 * ci: make clippy happy --------- Co-authored-by: zizou <111426680+flopell@users.noreply.github.com>
This commit is contained in:
30
substreams/ethereum-balancer-v2/Cargo.toml
Normal file
30
substreams/ethereum-balancer-v2/Cargo.toml
Normal file
@@ -0,0 +1,30 @@
|
||||
[package]
|
||||
name = "ethereum-balancer-v2"
|
||||
version = "0.2.3"
|
||||
edition = "2021"
|
||||
|
||||
[lib]
|
||||
name = "ethereum_balancer_v2"
|
||||
crate-type = ["cdylib"]
|
||||
|
||||
[dependencies]
|
||||
substreams.workspace = true
|
||||
substreams-ethereum.workspace = true
|
||||
prost.workspace = true
|
||||
prost-types.workspace = true
|
||||
hex-literal.workspace = true
|
||||
ethabi.workspace = true
|
||||
hex.workspace = true
|
||||
bytes = "1.5.0"
|
||||
anyhow = "1.0.75"
|
||||
num-bigint = "0.4.4"
|
||||
itertools = "0.12.0"
|
||||
tycho-substreams.workspace = true
|
||||
|
||||
[build-dependencies]
|
||||
anyhow = "1"
|
||||
substreams-ethereum = "0.9"
|
||||
|
||||
# Required so that ethabi > ethereum-types build correctly under wasm32-unknown-unknown
|
||||
[target.wasm32-unknown-unknown.dependencies]
|
||||
getrandom = { version = "0.2", features = ["custom"] }
|
||||
25
substreams/ethereum-balancer-v2/Readme.md
Normal file
25
substreams/ethereum-balancer-v2/Readme.md
Normal file
@@ -0,0 +1,25 @@
|
||||
# Balancer Substream
|
||||
|
||||
## Open tasks
|
||||
|
||||
### Missing rate provider state
|
||||
|
||||
Any pool that does use rate providers, is currently not supported by tycho since we do
|
||||
not witness the contract creation of rate providers and thus can't provide the required
|
||||
contract state.
|
||||
|
||||
This is planned to be resolved with the dynamic contract indexing module.
|
||||
|
||||
## Static Attributes
|
||||
|
||||
| name | type | description |
|
||||
|--------------------|-------|---------------------------------------------------------------------------------------------------------|
|
||||
| pool_type | str | A unique identifier per pool type. Set depending on the factory |
|
||||
| normalized weights | json | The normalised weights of a weighted pool. |
|
||||
| pool_id | str | A hex encoded balancer pool id. |
|
||||
| rate_providers | json | A list of rate provider addresses. |
|
||||
| bpt | bytes | The balancer lp token, set if the pool support entering and exiting lp postions via the swap interface. |
|
||||
| main_token | bytes | The main token address for a linear pool |
|
||||
| wrapped_token | bytes | The wrapped token address for a linear pool |
|
||||
| fee | int | The fee charged by the pool set at deployment time |
|
||||
| upper_target | int | The upper target for a linear pool |
|
||||
22
substreams/ethereum-balancer-v2/abi/README.md
Normal file
22
substreams/ethereum-balancer-v2/abi/README.md
Normal file
@@ -0,0 +1,22 @@
|
||||
# ABIs
|
||||
|
||||
`get_abis.py` is a simple python script using the etherscan API (free plan) to gather ABIs for all of the contracts we are tracking!
|
||||
|
||||
We then can define all of the abis via `substreams_ethereum::Abigen::new` in our `build.rs`.
|
||||
|
||||
## Recommendation
|
||||
|
||||
It would be apt to convert (maybe through copilot) the python code into the `build.rs` file and then automate the `Abigen` functionality.
|
||||
|
||||
## Usage
|
||||
|
||||
Requires `python 3.8+`,
|
||||
|
||||
```bash
|
||||
cd abi
|
||||
python get_abis.py
|
||||
```
|
||||
|
||||
This will populate the files in the `abi` folder.
|
||||
|
||||
When the `build.rs` file runs (when `rust-analyzer` activates or `cargo build` is manually ran), Abigen will generate new rust src files from the abis in the `src/abi` folder.
|
||||
@@ -0,0 +1,283 @@
|
||||
[
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "contract IVault",
|
||||
"name": "vault",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "contract IProtocolFeePercentagesProvider",
|
||||
"name": "protocolFeeProvider",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "factoryVersion",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "poolVersion",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "constructor"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [],
|
||||
"name": "FactoryDisabled",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "pool",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "PoolCreated",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "name",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "symbol",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"internalType": "contract IERC20[]",
|
||||
"name": "tokens",
|
||||
"type": "address[]"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amplificationParameter",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "contract IRateProvider[]",
|
||||
"name": "rateProviders",
|
||||
"type": "address[]"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256[]",
|
||||
"name": "tokenRateCacheDurations",
|
||||
"type": "uint256[]"
|
||||
},
|
||||
{
|
||||
"internalType": "bool",
|
||||
"name": "exemptFromYieldProtocolFeeFlag",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "swapFeePercentage",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "owner",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "bytes32",
|
||||
"name": "salt",
|
||||
"type": "bytes32"
|
||||
}
|
||||
],
|
||||
"name": "create",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "contract ComposableStablePool",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "disable",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "bytes4",
|
||||
"name": "selector",
|
||||
"type": "bytes4"
|
||||
}
|
||||
],
|
||||
"name": "getActionId",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bytes32",
|
||||
"name": "",
|
||||
"type": "bytes32"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getAuthorizer",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "contract IAuthorizer",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getCreationCode",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bytes",
|
||||
"name": "",
|
||||
"type": "bytes"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getCreationCodeContracts",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "contractA",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "contractB",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getPauseConfiguration",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "pauseWindowDuration",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "bufferPeriodDuration",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getPoolVersion",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getProtocolFeePercentagesProvider",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "contract IProtocolFeePercentagesProvider",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getVault",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "contract IVault",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "isDisabled",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bool",
|
||||
"name": "",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "pool",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "isPoolFromFactory",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bool",
|
||||
"name": "",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "version",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
}
|
||||
]
|
||||
325
substreams/ethereum-balancer-v2/abi/erc_linear_pool_factory.json
Normal file
325
substreams/ethereum-balancer-v2/abi/erc_linear_pool_factory.json
Normal file
@@ -0,0 +1,325 @@
|
||||
[
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "contract IVault",
|
||||
"name": "vault",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "contract IProtocolFeePercentagesProvider",
|
||||
"name": "protocolFeeProvider",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "contract IBalancerQueries",
|
||||
"name": "queries",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "factoryVersion",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "poolVersion",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "initialPauseWindowDuration",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "bufferPeriodDuration",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "constructor"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "pool",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "uint256",
|
||||
"name": "protocolId",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "Erc4626LinearPoolCreated",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [],
|
||||
"name": "FactoryDisabled",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "pool",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "PoolCreated",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "name",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "symbol",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"internalType": "contract IERC20",
|
||||
"name": "mainToken",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "contract IERC20",
|
||||
"name": "wrappedToken",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "upperTarget",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "swapFeePercentage",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "owner",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "protocolId",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "bytes32",
|
||||
"name": "salt",
|
||||
"type": "bytes32"
|
||||
}
|
||||
],
|
||||
"name": "create",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "contract LinearPool",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "disable",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "bytes4",
|
||||
"name": "selector",
|
||||
"type": "bytes4"
|
||||
}
|
||||
],
|
||||
"name": "getActionId",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bytes32",
|
||||
"name": "",
|
||||
"type": "bytes32"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getAuthorizer",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "contract IAuthorizer",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getCreationCode",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bytes",
|
||||
"name": "",
|
||||
"type": "bytes"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getCreationCodeContracts",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "contractA",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "contractB",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getLastCreatedPool",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getPauseConfiguration",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "pauseWindowDuration",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "bufferPeriodDuration",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getPoolVersion",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getProtocolFeePercentagesProvider",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "contract IProtocolFeePercentagesProvider",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getVault",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "contract IVault",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "isDisabled",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bool",
|
||||
"name": "",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "pool",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "isPoolFromFactory",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bool",
|
||||
"name": "",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "version",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,338 @@
|
||||
[
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "contract IVault",
|
||||
"name": "vault",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "contract IProtocolFeePercentagesProvider",
|
||||
"name": "protocolFeeProvider",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "contract IBalancerQueries",
|
||||
"name": "queries",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "factoryVersion",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "poolVersion",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "initialPauseWindowDuration",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "bufferPeriodDuration",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_eulerProtocol",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "constructor"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "pool",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "uint256",
|
||||
"name": "protocolId",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "EulerLinearPoolCreated",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [],
|
||||
"name": "FactoryDisabled",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "pool",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "PoolCreated",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "name",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "symbol",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"internalType": "contract IERC20",
|
||||
"name": "mainToken",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "contract IERC20",
|
||||
"name": "wrappedToken",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "upperTarget",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "swapFeePercentage",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "owner",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "protocolId",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "create",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "contract LinearPool",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "disable",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "eulerProtocol",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "bytes4",
|
||||
"name": "selector",
|
||||
"type": "bytes4"
|
||||
}
|
||||
],
|
||||
"name": "getActionId",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bytes32",
|
||||
"name": "",
|
||||
"type": "bytes32"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getAuthorizer",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "contract IAuthorizer",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getCreationCode",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bytes",
|
||||
"name": "",
|
||||
"type": "bytes"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getCreationCodeContracts",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "contractA",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "contractB",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getLastCreatedPool",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getPauseConfiguration",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "pauseWindowDuration",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "bufferPeriodDuration",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getPoolVersion",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getProtocolFeePercentagesProvider",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "contract IProtocolFeePercentagesProvider",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getVault",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "contract IVault",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "isDisabled",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bool",
|
||||
"name": "",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "pool",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "isPoolFromFactory",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bool",
|
||||
"name": "",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "version",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,325 @@
|
||||
[
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "contract IVault",
|
||||
"name": "vault",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "contract IProtocolFeePercentagesProvider",
|
||||
"name": "protocolFeeProvider",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "contract IBalancerQueries",
|
||||
"name": "queries",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "factoryVersion",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "poolVersion",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "initialPauseWindowDuration",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "bufferPeriodDuration",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "constructor"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [],
|
||||
"name": "FactoryDisabled",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "pool",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "uint256",
|
||||
"name": "protocolId",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "GearboxLinearPoolCreated",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "pool",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "PoolCreated",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "name",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "symbol",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"internalType": "contract IERC20",
|
||||
"name": "mainToken",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "contract IERC20",
|
||||
"name": "wrappedToken",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "upperTarget",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "swapFeePercentage",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "owner",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "protocolId",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "bytes32",
|
||||
"name": "salt",
|
||||
"type": "bytes32"
|
||||
}
|
||||
],
|
||||
"name": "create",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "contract GearboxLinearPool",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "disable",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "bytes4",
|
||||
"name": "selector",
|
||||
"type": "bytes4"
|
||||
}
|
||||
],
|
||||
"name": "getActionId",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bytes32",
|
||||
"name": "",
|
||||
"type": "bytes32"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getAuthorizer",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "contract IAuthorizer",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getCreationCode",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bytes",
|
||||
"name": "",
|
||||
"type": "bytes"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getCreationCodeContracts",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "contractA",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "contractB",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getLastCreatedPool",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getPauseConfiguration",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "pauseWindowDuration",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "bufferPeriodDuration",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getPoolVersion",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getProtocolFeePercentagesProvider",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "contract IProtocolFeePercentagesProvider",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getVault",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "contract IVault",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "isDisabled",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bool",
|
||||
"name": "",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "pool",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "isPoolFromFactory",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bool",
|
||||
"name": "",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "version",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
}
|
||||
]
|
||||
56
substreams/ethereum-balancer-v2/abi/get_abis.py
Normal file
56
substreams/ethereum-balancer-v2/abi/get_abis.py
Normal file
@@ -0,0 +1,56 @@
|
||||
#!/usr/bin/python
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import time
|
||||
import urllib.request
|
||||
|
||||
# Exports contract ABI in JSON
|
||||
|
||||
abis = {
|
||||
# Factories
|
||||
"WeightedPoolFactoryV1": "0x8E9aa87E45e92bad84D5F8DD1bff34Fb92637dE9",
|
||||
"WeightedPoolFactoryV2": "0xcC508a455F5b0073973107Db6a878DdBDab957bC",
|
||||
"WeightedPoolFactoryV3": "0x5Dd94Da3644DDD055fcf6B3E1aa310Bb7801EB8b",
|
||||
"WeightedPoolFactoryV4": "0x897888115Ada5773E02aA29F775430BFB5F34c51",
|
||||
"WeightedPool2TokensFactory": "0xA5bf2ddF098bb0Ef6d120C98217dD6B141c74EE0", # 80Bal-20WETH
|
||||
"ComposableStablePoolFactory (v5)": "0xDB8d758BCb971e482B2C45f7F8a7740283A1bd3A",
|
||||
"ERC4626LinearPoolFactory (v4)": "0x813EE7a840CE909E7Fea2117A44a90b8063bd4fd",
|
||||
"EulerLinearPoolFactory": "0x5F43FBa61f63Fa6bFF101a0A0458cEA917f6B347",
|
||||
# "GearboxLinearPoolFactory (v2)": "0x39A79EB449Fc05C92c39aA6f0e9BfaC03BE8dE5B",
|
||||
"ManagedPoolFactory (v2)": "0xBF904F9F340745B4f0c4702c7B6Ab1e808eA6b93",
|
||||
"SiloLinearPoolFactory (v2)": "0x4E11AEec21baF1660b1a46472963cB3DA7811C89",
|
||||
"YearnLinearPoolFactory (v2)": "0x5F5222Ffa40F2AEd6380D022184D6ea67C776eE0",
|
||||
# Vault
|
||||
"Vault": "0xBA12222222228d8Ba445958a75a0704d566BF2C8",
|
||||
}
|
||||
|
||||
ABI_ENDPOINT = (
|
||||
"https://api.etherscan.io/api?module=contract&action=getabi&address={address}"
|
||||
)
|
||||
|
||||
if etherscan_key := os.environ.get("ETHERSCAN_API_TOKEN"):
|
||||
print("API KEY Loaded!")
|
||||
ABI_ENDPOINT += f"&apikey={etherscan_key}"
|
||||
|
||||
|
||||
def __main__():
|
||||
for name, addr in abis.items():
|
||||
normalized_name = "_".join(re.findall(r"[A-Z]+[a-z]*\d*", name)).lower()
|
||||
print(f"Getting ABI for {name} at {addr} ({normalized_name})")
|
||||
|
||||
try:
|
||||
with urllib.request.urlopen(ABI_ENDPOINT.format(address=addr)) as response:
|
||||
response_json = json.loads(response.read().decode())
|
||||
abi_json = json.loads(response_json["result"])
|
||||
result = json.dumps(abi_json, indent=4, sort_keys=True)
|
||||
with open(f"{normalized_name}.json", "w") as f:
|
||||
f.write(result)
|
||||
except Exception as err:
|
||||
print(response.content)
|
||||
raise err
|
||||
time.sleep(0.25)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
__main__()
|
||||
353
substreams/ethereum-balancer-v2/abi/managed_pool_factory.json
Normal file
353
substreams/ethereum-balancer-v2/abi/managed_pool_factory.json
Normal file
@@ -0,0 +1,353 @@
|
||||
[
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "contract IVault",
|
||||
"name": "vault",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "contract IProtocolFeePercentagesProvider",
|
||||
"name": "protocolFeeProvider",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "contract IExternalWeightedMath",
|
||||
"name": "externalWeightedMath",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "contract IRecoveryModeHelper",
|
||||
"name": "recoveryModeHelper",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "factoryVersion",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "poolVersion",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "initialPauseWindowDuration",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "bufferPeriodDuration",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "constructor"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [],
|
||||
"name": "FactoryDisabled",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "pool",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "PoolCreated",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"components": [
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "name",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "symbol",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"internalType": "address[]",
|
||||
"name": "assetManagers",
|
||||
"type": "address[]"
|
||||
}
|
||||
],
|
||||
"internalType": "struct ManagedPool.ManagedPoolParams",
|
||||
"name": "params",
|
||||
"type": "tuple"
|
||||
},
|
||||
{
|
||||
"components": [
|
||||
{
|
||||
"internalType": "contract IERC20[]",
|
||||
"name": "tokens",
|
||||
"type": "address[]"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256[]",
|
||||
"name": "normalizedWeights",
|
||||
"type": "uint256[]"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "swapFeePercentage",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "bool",
|
||||
"name": "swapEnabledOnStart",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"internalType": "bool",
|
||||
"name": "mustAllowlistLPs",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "managementAumFeePercentage",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "aumFeeId",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"internalType": "struct ManagedPoolSettings.ManagedPoolSettingsParams",
|
||||
"name": "settingsParams",
|
||||
"type": "tuple"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "owner",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "bytes32",
|
||||
"name": "salt",
|
||||
"type": "bytes32"
|
||||
}
|
||||
],
|
||||
"name": "create",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "pool",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "disable",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "bytes4",
|
||||
"name": "selector",
|
||||
"type": "bytes4"
|
||||
}
|
||||
],
|
||||
"name": "getActionId",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bytes32",
|
||||
"name": "",
|
||||
"type": "bytes32"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getAuthorizer",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "contract IAuthorizer",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getCreationCode",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bytes",
|
||||
"name": "",
|
||||
"type": "bytes"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getCreationCodeContracts",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "contractA",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "contractB",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getPauseConfiguration",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "pauseWindowDuration",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "bufferPeriodDuration",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getPoolVersion",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getProtocolFeePercentagesProvider",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "contract IProtocolFeePercentagesProvider",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getRecoveryModeHelper",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "contract IRecoveryModeHelper",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getVault",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "contract IVault",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getWeightedMath",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "contract IExternalWeightedMath",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "isDisabled",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bool",
|
||||
"name": "",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "pool",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "isPoolFromFactory",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bool",
|
||||
"name": "",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "version",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,325 @@
|
||||
[
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "contract IVault",
|
||||
"name": "vault",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "contract IProtocolFeePercentagesProvider",
|
||||
"name": "protocolFeeProvider",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "contract IBalancerQueries",
|
||||
"name": "queries",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "factoryVersion",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "poolVersion",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "initialPauseWindowDuration",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "bufferPeriodDuration",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "constructor"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [],
|
||||
"name": "FactoryDisabled",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "pool",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "PoolCreated",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "pool",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "uint256",
|
||||
"name": "protocolId",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "SiloLinearPoolCreated",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "name",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "symbol",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"internalType": "contract IERC20",
|
||||
"name": "mainToken",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "contract IERC20",
|
||||
"name": "wrappedToken",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "upperTarget",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "swapFeePercentage",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "owner",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "protocolId",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "bytes32",
|
||||
"name": "salt",
|
||||
"type": "bytes32"
|
||||
}
|
||||
],
|
||||
"name": "create",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "contract SiloLinearPool",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "disable",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "bytes4",
|
||||
"name": "selector",
|
||||
"type": "bytes4"
|
||||
}
|
||||
],
|
||||
"name": "getActionId",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bytes32",
|
||||
"name": "",
|
||||
"type": "bytes32"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getAuthorizer",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "contract IAuthorizer",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getCreationCode",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bytes",
|
||||
"name": "",
|
||||
"type": "bytes"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getCreationCodeContracts",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "contractA",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "contractB",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getLastCreatedPool",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getPauseConfiguration",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "pauseWindowDuration",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "bufferPeriodDuration",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getPoolVersion",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getProtocolFeePercentagesProvider",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "contract IProtocolFeePercentagesProvider",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getVault",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "contract IVault",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "isDisabled",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bool",
|
||||
"name": "",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "pool",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "isPoolFromFactory",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bool",
|
||||
"name": "",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "version",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
}
|
||||
]
|
||||
1179
substreams/ethereum-balancer-v2/abi/vault.json
Normal file
1179
substreams/ethereum-balancer-v2/abi/vault.json
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,120 @@
|
||||
[
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "contract IVault",
|
||||
"name": "vault",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "constructor"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "pool",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "PoolCreated",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "name",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "symbol",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"internalType": "contract IERC20[]",
|
||||
"name": "tokens",
|
||||
"type": "address[]"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256[]",
|
||||
"name": "weights",
|
||||
"type": "uint256[]"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "swapFeePercentage",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "owner",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "create",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getPauseConfiguration",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "pauseWindowDuration",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "bufferPeriodDuration",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getVault",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "contract IVault",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "pool",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "isPoolFromFactory",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bool",
|
||||
"name": "",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,232 @@
|
||||
[
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "contract IVault",
|
||||
"name": "vault",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "contract IProtocolFeePercentagesProvider",
|
||||
"name": "protocolFeeProvider",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "constructor"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [],
|
||||
"name": "FactoryDisabled",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "pool",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "PoolCreated",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "name",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "symbol",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"internalType": "contract IERC20[]",
|
||||
"name": "tokens",
|
||||
"type": "address[]"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256[]",
|
||||
"name": "normalizedWeights",
|
||||
"type": "uint256[]"
|
||||
},
|
||||
{
|
||||
"internalType": "contract IRateProvider[]",
|
||||
"name": "rateProviders",
|
||||
"type": "address[]"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "swapFeePercentage",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "owner",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "create",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "disable",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "bytes4",
|
||||
"name": "selector",
|
||||
"type": "bytes4"
|
||||
}
|
||||
],
|
||||
"name": "getActionId",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bytes32",
|
||||
"name": "",
|
||||
"type": "bytes32"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getAuthorizer",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "contract IAuthorizer",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getCreationCode",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bytes",
|
||||
"name": "",
|
||||
"type": "bytes"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getCreationCodeContracts",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "contractA",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "contractB",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getPauseConfiguration",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "pauseWindowDuration",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "bufferPeriodDuration",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getProtocolFeePercentagesProvider",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "contract IProtocolFeePercentagesProvider",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getVault",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "contract IVault",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "isDisabled",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bool",
|
||||
"name": "",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "pool",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "isPoolFromFactory",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bool",
|
||||
"name": "",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,268 @@
|
||||
[
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "contract IVault",
|
||||
"name": "vault",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "contract IProtocolFeePercentagesProvider",
|
||||
"name": "protocolFeeProvider",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "factoryVersion",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "poolVersion",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "constructor"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [],
|
||||
"name": "FactoryDisabled",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "pool",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "PoolCreated",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "name",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "symbol",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"internalType": "contract IERC20[]",
|
||||
"name": "tokens",
|
||||
"type": "address[]"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256[]",
|
||||
"name": "normalizedWeights",
|
||||
"type": "uint256[]"
|
||||
},
|
||||
{
|
||||
"internalType": "contract IRateProvider[]",
|
||||
"name": "rateProviders",
|
||||
"type": "address[]"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "swapFeePercentage",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "owner",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "create",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "disable",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "bytes4",
|
||||
"name": "selector",
|
||||
"type": "bytes4"
|
||||
}
|
||||
],
|
||||
"name": "getActionId",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bytes32",
|
||||
"name": "",
|
||||
"type": "bytes32"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getAuthorizer",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "contract IAuthorizer",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getCreationCode",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bytes",
|
||||
"name": "",
|
||||
"type": "bytes"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getCreationCodeContracts",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "contractA",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "contractB",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getPauseConfiguration",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "pauseWindowDuration",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "bufferPeriodDuration",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getPoolVersion",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getProtocolFeePercentagesProvider",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "contract IProtocolFeePercentagesProvider",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getVault",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "contract IVault",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "isDisabled",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bool",
|
||||
"name": "",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "pool",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "isPoolFromFactory",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bool",
|
||||
"name": "",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "version",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,273 @@
|
||||
[
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "contract IVault",
|
||||
"name": "vault",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "contract IProtocolFeePercentagesProvider",
|
||||
"name": "protocolFeeProvider",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "factoryVersion",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "poolVersion",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "constructor"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [],
|
||||
"name": "FactoryDisabled",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "pool",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "PoolCreated",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "name",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "symbol",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"internalType": "contract IERC20[]",
|
||||
"name": "tokens",
|
||||
"type": "address[]"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256[]",
|
||||
"name": "normalizedWeights",
|
||||
"type": "uint256[]"
|
||||
},
|
||||
{
|
||||
"internalType": "contract IRateProvider[]",
|
||||
"name": "rateProviders",
|
||||
"type": "address[]"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "swapFeePercentage",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "owner",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "bytes32",
|
||||
"name": "salt",
|
||||
"type": "bytes32"
|
||||
}
|
||||
],
|
||||
"name": "create",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "disable",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "bytes4",
|
||||
"name": "selector",
|
||||
"type": "bytes4"
|
||||
}
|
||||
],
|
||||
"name": "getActionId",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bytes32",
|
||||
"name": "",
|
||||
"type": "bytes32"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getAuthorizer",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "contract IAuthorizer",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getCreationCode",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bytes",
|
||||
"name": "",
|
||||
"type": "bytes"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getCreationCodeContracts",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "contractA",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "contractB",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getPauseConfiguration",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "pauseWindowDuration",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "bufferPeriodDuration",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getPoolVersion",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getProtocolFeePercentagesProvider",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "contract IProtocolFeePercentagesProvider",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getVault",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "contract IVault",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "isDisabled",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bool",
|
||||
"name": "",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "pool",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "isPoolFromFactory",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bool",
|
||||
"name": "",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "version",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,125 @@
|
||||
[
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "contract IVault",
|
||||
"name": "vault",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "constructor"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "pool",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "PoolCreated",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "name",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "symbol",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"internalType": "contract IERC20[]",
|
||||
"name": "tokens",
|
||||
"type": "address[]"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256[]",
|
||||
"name": "weights",
|
||||
"type": "uint256[]"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "swapFeePercentage",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "bool",
|
||||
"name": "oracleEnabled",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "owner",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "create",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getPauseConfiguration",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "pauseWindowDuration",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "bufferPeriodDuration",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getVault",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "contract IVault",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "pool",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "isPoolFromFactory",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bool",
|
||||
"name": "",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,325 @@
|
||||
[
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "contract IVault",
|
||||
"name": "vault",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "contract IProtocolFeePercentagesProvider",
|
||||
"name": "protocolFeeProvider",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "contract IBalancerQueries",
|
||||
"name": "queries",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "factoryVersion",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "poolVersion",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "initialPauseWindowDuration",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "bufferPeriodDuration",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "constructor"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [],
|
||||
"name": "FactoryDisabled",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "pool",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "PoolCreated",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "pool",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "uint256",
|
||||
"name": "protocolId",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "YearnLinearPoolCreated",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "name",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "symbol",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"internalType": "contract IERC20",
|
||||
"name": "mainToken",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "contract IERC20",
|
||||
"name": "wrappedToken",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "upperTarget",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "swapFeePercentage",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "owner",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "protocolId",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "bytes32",
|
||||
"name": "salt",
|
||||
"type": "bytes32"
|
||||
}
|
||||
],
|
||||
"name": "create",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "contract LinearPool",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "disable",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "bytes4",
|
||||
"name": "selector",
|
||||
"type": "bytes4"
|
||||
}
|
||||
],
|
||||
"name": "getActionId",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bytes32",
|
||||
"name": "",
|
||||
"type": "bytes32"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getAuthorizer",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "contract IAuthorizer",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getCreationCode",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bytes",
|
||||
"name": "",
|
||||
"type": "bytes"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getCreationCodeContracts",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "contractA",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "contractB",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getLastCreatedPool",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getPauseConfiguration",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "pauseWindowDuration",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "bufferPeriodDuration",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getPoolVersion",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getProtocolFeePercentagesProvider",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "contract IProtocolFeePercentagesProvider",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getVault",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "contract IVault",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "isDisabled",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bool",
|
||||
"name": "",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "pool",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "isPoolFromFactory",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bool",
|
||||
"name": "",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "version",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
}
|
||||
]
|
||||
12
substreams/ethereum-balancer-v2/buf.gen.yaml
Normal file
12
substreams/ethereum-balancer-v2/buf.gen.yaml
Normal file
@@ -0,0 +1,12 @@
|
||||
|
||||
version: v1
|
||||
plugins:
|
||||
- plugin: buf.build/community/neoeinstein-prost:v0.2.2
|
||||
out: src/pb
|
||||
opt:
|
||||
- file_descriptor_set=false
|
||||
|
||||
- plugin: buf.build/community/neoeinstein-prost-crate:v0.3.1
|
||||
out: src/pb
|
||||
opt:
|
||||
- no_features
|
||||
44
substreams/ethereum-balancer-v2/build.rs
Normal file
44
substreams/ethereum-balancer-v2/build.rs
Normal file
@@ -0,0 +1,44 @@
|
||||
use anyhow::Result;
|
||||
use std::{fs, io::Write};
|
||||
use substreams_ethereum::Abigen;
|
||||
|
||||
fn main() -> Result<()> {
|
||||
let abi_folder = "abi";
|
||||
let output_folder = "src/abi";
|
||||
|
||||
let files = fs::read_dir(abi_folder)?;
|
||||
let mut mod_rs_content = String::new();
|
||||
mod_rs_content.push_str("#![allow(clippy::all)]\n");
|
||||
|
||||
for file in files {
|
||||
let file = file?;
|
||||
let file_name = file.file_name();
|
||||
let file_name = file_name.to_string_lossy();
|
||||
|
||||
if !file_name.ends_with(".json") {
|
||||
continue;
|
||||
}
|
||||
|
||||
let contract_name = file_name.split('.').next().unwrap();
|
||||
|
||||
let input_path = format!("{}/{}", abi_folder, file_name);
|
||||
let output_path = format!("{}/{}.rs", output_folder, contract_name);
|
||||
|
||||
mod_rs_content.push_str(&format!("pub mod {};\n", contract_name));
|
||||
|
||||
if std::path::Path::new(&output_path).exists() {
|
||||
continue;
|
||||
}
|
||||
|
||||
Abigen::new(contract_name, &input_path)?
|
||||
.generate()?
|
||||
.write_to_file(&output_path)?;
|
||||
}
|
||||
|
||||
let mod_rs_path = format!("{}/mod.rs", output_folder);
|
||||
let mut mod_rs_file = fs::File::create(mod_rs_path)?;
|
||||
|
||||
mod_rs_file.write_all(mod_rs_content.as_bytes())?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
216
substreams/ethereum-balancer-v2/integration_test.tycho.yaml
Normal file
216
substreams/ethereum-balancer-v2/integration_test.tycho.yaml
Normal file
@@ -0,0 +1,216 @@
|
||||
substreams_yaml_path: ./substreams.yaml
|
||||
protocol_type_names:
|
||||
- "balancer_v2_pool"
|
||||
adapter_contract: "BalancerV2SwapAdapter"
|
||||
adapter_build_signature: "constructor(address)"
|
||||
adapter_build_args: "0xBA12222222228d8Ba445958a75a0704d566BF2C8"
|
||||
skip_balance_check: true
|
||||
initialized_accounts:
|
||||
- "0xba12222222228d8ba445958a75a0704d566bf2c8"
|
||||
# Uncomment entries below to include composable stable pool dependencies
|
||||
# wstETH dependencies
|
||||
# - "0x72D07D7DcA67b8A406aD1Ec34ce969c90bFEE768"
|
||||
# - "0xb8ffc3cd6e7cf5a098a1c92f48009765b24088dc"
|
||||
# - "0xae7ab96520de3a18e5e111b5eaab095312d7fe84"
|
||||
# - "0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0"
|
||||
# - "0x2b33cf282f867a7ff693a66e11b0fcc5552e4425"
|
||||
# - "0x17144556fd3424edc8fc8a4c940b2d04936d17eb"
|
||||
# sfrxETH dependencies
|
||||
# - "0x302013E7936a39c358d07A3Df55dc94EC417E3a1"
|
||||
# - "0xac3e018457b222d93114458476f3e3416abbe38f"
|
||||
# rETH dependencies
|
||||
# - "0x1a8F81c256aee9C640e14bB0453ce247ea0DFE6F"
|
||||
# - "0x07fcabcbe4ff0d80c2b1eb42855c0131b6cba2f4"
|
||||
# - "0x1d8f8f00cfa6758d7be78336684788fb0ee0fa46"
|
||||
# - "0xae78736cd615f374d3085123a210448e74fc6393"
|
||||
tests:
|
||||
# WeightedPoolFactoryV4 - 0x897888115Ada5773E02aA29F775430BFB5F34c51
|
||||
- name: test_weighted_pool_v4
|
||||
start_block: 20128706
|
||||
stop_block: 20128806
|
||||
expected_components:
|
||||
- id: "0xe96a45f66bdda121b24f0a861372a72e8889523d00020000000000000000069b"
|
||||
tokens:
|
||||
- "0x38C2a4a7330b22788374B8Ff70BBa513C8D848cA"
|
||||
- "0x514910771AF9Ca656af840dff83E8264EcF986CA"
|
||||
static_attributes:
|
||||
rate_providers: "0x5b22307830303030303030303030303030303030303030303030303030303030303030303030303030303030222c22307830303030303030303030303030303030303030303030303030303030303030303030303030303030225d"
|
||||
normalized_weights: "0x5b22307830623161326263326563353030303030222c22307830326336386166306262313430303030225d"
|
||||
fee: "0x11c37937e08000"
|
||||
manual_updates: "0x01"
|
||||
pool_type: "0x5765696768746564506f6f6c466163746f72795634"
|
||||
creation_tx: "0xa63c671046ad2075ec8ea83ac21199cf3e3a5f433e72ec4c117cbabfb9b18de2"
|
||||
|
||||
# WeightedPool2TokensFactory - 0xA5bf2ddF098bb0Ef6d120C98217dD6B141c74EE0
|
||||
- name: weighted_legacy_creation
|
||||
start_block: 13148365
|
||||
stop_block: 13148465
|
||||
expected_components:
|
||||
- id: "0xbf96189eee9357a95c7719f4f5047f76bde804e5000200000000000000000087"
|
||||
tokens:
|
||||
- "0x5A98FcBEA516Cf06857215779Fd812CA3beF1B32"
|
||||
- "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"
|
||||
static_attributes:
|
||||
weights: "0x5b22307830623161326263326563353030303030222c22307830326336386166306262313430303030225d"
|
||||
fee: "0x08e1bc9bf04000"
|
||||
manual_updates: "0x01"
|
||||
pool_type: "0x5765696768746564506f6f6c32546f6b656e73466163746f7279"
|
||||
creation_tx: "0xdced662e41b1608c386551bbc89894a10321fd8bd58782e22077d1044cf99cb5"
|
||||
|
||||
# ComposableStablePoolFactory - 0xDB8d758BCb971e482B2C45f7F8a7740283A1bd3A
|
||||
- name: test_composable_stable_pool_creation
|
||||
start_block: 17677300
|
||||
stop_block: 17678400
|
||||
expected_components:
|
||||
- id: "0x42ed016f826165c2e5976fe5bc3df540c5ad0af700000000000000000000058b"
|
||||
tokens:
|
||||
- "0x42ed016f826165c2e5976fe5bc3df540c5ad0af7"
|
||||
- "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0"
|
||||
- "0xac3E018457B222d93114458476f3E3416Abbe38F"
|
||||
- "0xae78736Cd615f374D3085123A210448E74Fc6393"
|
||||
static_attributes:
|
||||
rate_providers: "0x5b22307837326430376437646361363762386134303661643165633334636539363963393062666565373638222c22307833303230313365373933366133396333353864303761336466353564633934656334313765336131222c22307831613866383163323536616565396336343065313462623034353363653234376561306466653666225d"
|
||||
bpt: "0x42ed016f826165c2e5976fe5bc3df540c5ad0af7"
|
||||
fee: "0x5af3107a4000"
|
||||
manual_updates: "0x01"
|
||||
pool_type: "0x436f6d706f7361626c65537461626c65506f6f6c466163746f7279"
|
||||
skip_simulation: true
|
||||
creation_tx: "0x53ff6bab0d8a76a998e29e59da8068ad906ae85507a1c2fbf2505e2cb52fd754"
|
||||
|
||||
# ERC4626LinearPoolFactory - 0x813EE7a840CE909E7Fea2117A44a90b8063bd4fd
|
||||
- name: test_erc4626_linear_pool_creation
|
||||
start_block: 17480142
|
||||
stop_block: 17480242
|
||||
expected_components:
|
||||
- id: "0x3fcb7085b8f2f473f80bf6d879cae99ea4de934400000000000000000000056d"
|
||||
tokens:
|
||||
- "0x39Dd7790e75C6F663731f7E1FdC0f35007D3879b"
|
||||
- "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"
|
||||
- "0x3fcb7085b8f2f473f80bf6d879cae99ea4de9344"
|
||||
static_attributes:
|
||||
wrapped_token: "0x39dd7790e75c6f663731f7e1fdc0f35007d3879b"
|
||||
fee: "0x00b5e620f48000"
|
||||
manual_updates: "0x01"
|
||||
pool_type: "0x455243343632364c696e656172506f6f6c466163746f7279"
|
||||
upper_target: "0x108b2a2c28029094000000"
|
||||
bpt: "0x3fcb7085b8f2f473f80bf6d879cae99ea4de9344"
|
||||
main_token: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"
|
||||
skip_simulation: true
|
||||
creation_tx: "0x5ff97870685370bab3876a4335d28c42e24659064fe78b486d6fb1b37b992877"
|
||||
|
||||
# EulerLinearPoolFactory - 0x5F43FBa61f63Fa6bFF101a0A0458cEA917f6B347
|
||||
- name: test_euler_linear_pool_creation
|
||||
start_block: 16588117
|
||||
stop_block: 16588217
|
||||
expected_components:
|
||||
- id: "0xd4e7c1f3da1144c9e2cfd1b015eda7652b4a439900000000000000000000046a"
|
||||
tokens:
|
||||
- "0xD4e7C1F3DA1144c9E2CfD1b015eDA7652b4a4399"
|
||||
- "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
|
||||
- "0xEb91861f8A4e1C12333F42DCE8fB0Ecdc28dA716"
|
||||
static_attributes:
|
||||
wrapped_token: "0xeb91861f8a4e1c12333f42dce8fb0ecdc28da716"
|
||||
fee: "0x00b5e620f48000"
|
||||
manual_updates: "0x01"
|
||||
pool_type: "0x45756c65724c696e656172506f6f6c466163746f7279"
|
||||
upper_target: "0x108b2a2c28029094000000"
|
||||
bpt: "0xd4e7c1f3da1144c9e2cfd1b015eda7652b4a4399"
|
||||
main_token: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"
|
||||
skip_simulation: true
|
||||
creation_tx: "0x4a9ea683052afefdae3d189862868c3a7dc8f431d1d9828b6bfd9451a8816426"
|
||||
|
||||
# SiloLinearPoolFactory - 0x4E11AEec21baF1660b1a46472963cB3DA7811C89
|
||||
- name: test_silo_linear_pool_creation
|
||||
start_block: 17173185
|
||||
stop_block: 17173187
|
||||
expected_components:
|
||||
- id: "0x74cbfaf94a3577c539a9dcee9870a6349a33b34f000000000000000000000534"
|
||||
tokens:
|
||||
- "0x192E67544694a7bAA2DeA94f9B1Df58BB3395A12"
|
||||
- "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"
|
||||
- "0x74cbfaf94a3577c539a9dcee9870a6349a33b34f"
|
||||
static_attributes:
|
||||
wrapped_token: "0x192e67544694a7baa2dea94f9b1df58bb3395a12"
|
||||
fee: "0x00e8d4a51000"
|
||||
manual_updates: "0x01"
|
||||
pool_type: "0x53696c6f4c696e656172506f6f6c466163746f7279"
|
||||
upper_target: "0x00"
|
||||
bpt: "0x74cbfaf94a3577c539a9dcee9870a6349a33b34f"
|
||||
main_token: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"
|
||||
skip_simulation: true
|
||||
creation_tx: "0x215c9f4256ab450368132f4063611ae8cdd98e80bea7e44ecf0600ed1d757018"
|
||||
|
||||
# YearnLinearPoolFactory - 0x5F5222Ffa40F2AEd6380D022184D6ea67C776eE0a
|
||||
- name: test_yearn_linear_pool_creation
|
||||
start_block: 17052601
|
||||
stop_block: 17052605
|
||||
expected_components:
|
||||
- id: "0xac5b4ef7ede2f2843a704e96dcaa637f4ba3dc3f00000000000000000000051d"
|
||||
tokens:
|
||||
- "0x806E02Dea8d4a0882caD9fA3Fa75B212328692dE"
|
||||
- "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"
|
||||
- "0xac5b4ef7ede2f2843a704e96dcaa637f4ba3dc3f"
|
||||
static_attributes:
|
||||
wrapped_token: "0x806e02dea8d4a0882cad9fa3fa75b212328692de"
|
||||
fee: "0x00e8d4a51000"
|
||||
manual_updates: "0x01"
|
||||
pool_type: "0x596561726e4c696e656172506f6f6c466163746f7279"
|
||||
upper_target: "0x00"
|
||||
bpt: "0xac5b4ef7ede2f2843a704e96dcaa637f4ba3dc3f"
|
||||
main_token: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"
|
||||
skip_simulation: true
|
||||
creation_tx: "0x497aa03ce84d236c183204ddfc6762c8e4158da1ebc5e7e18e7f6cceaa497a2a"
|
||||
|
||||
# WeigthedPoolFactoryV1 - 0x8E9aa87E45e92bad84D5F8DD1bff34Fb92637dE9
|
||||
- name: test_weighted_pool_v1
|
||||
start_block: 13899835
|
||||
stop_block: 13901090
|
||||
expected_components:
|
||||
- id: "0xcb0e14e96f2cefa8550ad8e4aea344f211e5061d00020000000000000000011a"
|
||||
tokens:
|
||||
- "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"
|
||||
- "0xcAfE001067cDEF266AfB7Eb5A286dCFD277f3dE5"
|
||||
static_attributes:
|
||||
manual_updates: "0x01"
|
||||
fee: "0x038d7ea4c68000"
|
||||
normalized_weights: "0x5b22307830326336386166306262313430303030222c22307830623161326263326563353030303030225d"
|
||||
pool_type: "0x5765696768746564506f6f6c466163746f72795631"
|
||||
skip_simulation: false
|
||||
creation_tx: "0xc5c3b384644363aa15cf9a0c33dfebd22df351446bce92ee49ead7d5d896b4e9"
|
||||
|
||||
# WeigthedPoolFactoryV2 - 0xcC508a455F5b0073973107Db6a878DdBDab957bC
|
||||
- name: test_weighted_pool_v2
|
||||
start_block: 15732922
|
||||
stop_block: 15742922
|
||||
initialized_accounts:
|
||||
expected_components:
|
||||
- id: "0xe340ebfcaa544da8bb1ee9005f1a346d50ec422e000200000000000000000396"
|
||||
tokens:
|
||||
- "0x3472A5A71965499acd81997a54BBA8D852C6E53d"
|
||||
- "0xae78736Cd615f374D3085123A210448E74Fc6393"
|
||||
static_attributes:
|
||||
manual_updates: "0x01"
|
||||
fee: "0x08e1bc9bf04000"
|
||||
normalized_weights: "0x5b22307830366630356235396433623230303030222c22307830366630356235396433623230303030225d"
|
||||
rate_providers: "0x5b22307830303030303030303030303030303030303030303030303030303030303030303030303030303030222c22307831613866383163323536616565396336343065313462623034353363653234376561306466653666225d"
|
||||
pool_type: "0x5765696768746564506f6f6c466163746f72795632"
|
||||
skip_simulation: true # can't simulate because it has rate provider
|
||||
creation_tx: "0x9a949a52e4179d0c57dcffd6884d5787febfb92f8f4b7e114ef8cfbda0292a79"
|
||||
|
||||
# WeigthedPoolFactoryV3 - 0x5Dd94Da3644DDD055fcf6B3E1aa310Bb7801EB8b
|
||||
- name: test_weighted_pool_v3
|
||||
start_block: 16975289
|
||||
stop_block: 16975290
|
||||
expected_components:
|
||||
- id: "0xd278166dabaf26707362f7cfdd204b277fd2a4600002000000000000000004f6"
|
||||
tokens:
|
||||
- "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"
|
||||
- "0xE60779CC1b2c1d0580611c526a8DF0E3f870EC48"
|
||||
static_attributes:
|
||||
manual_updates: "0x01"
|
||||
fee: "0x11c37937e08000"
|
||||
normalized_weights: "0x5b22307830366630356235396433623230303030222c22307830366630356235396433623230303030225d"
|
||||
rate_providers: "0x5b22307830303030303030303030303030303030303030303030303030303030303030303030303030303030222c22307830303030303030303030303030303030303030303030303030303030303030303030303030303030225d"
|
||||
pool_type: "0x5765696768746564506f6f6c466163746f72795633"
|
||||
skip_simulation: true # not enough liquidity added within more than 100k blocks
|
||||
creation_tx: "0x3dda8ac9423f0018dffdda343c376cc1781ad12cb49827770351411d84036bf8"
|
||||
File diff suppressed because it is too large
Load Diff
1446
substreams/ethereum-balancer-v2/src/abi/erc_linear_pool_factory.rs
Normal file
1446
substreams/ethereum-balancer-v2/src/abi/erc_linear_pool_factory.rs
Normal file
File diff suppressed because it is too large
Load Diff
1512
substreams/ethereum-balancer-v2/src/abi/euler_linear_pool_factory.rs
Normal file
1512
substreams/ethereum-balancer-v2/src/abi/euler_linear_pool_factory.rs
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
1568
substreams/ethereum-balancer-v2/src/abi/managed_pool_factory.rs
Normal file
1568
substreams/ethereum-balancer-v2/src/abi/managed_pool_factory.rs
Normal file
File diff suppressed because it is too large
Load Diff
14
substreams/ethereum-balancer-v2/src/abi/mod.rs
Normal file
14
substreams/ethereum-balancer-v2/src/abi/mod.rs
Normal file
@@ -0,0 +1,14 @@
|
||||
#![allow(clippy::all)]
|
||||
pub mod yearn_linear_pool_factory;
|
||||
pub mod composable_stable_pool_factory;
|
||||
pub mod vault;
|
||||
pub mod weighted_pool_factory_v4;
|
||||
pub mod weighted_pool_tokens_factory;
|
||||
pub mod silo_linear_pool_factory;
|
||||
pub mod weighted_pool_factory_v3;
|
||||
pub mod weighted_pool_factory_v2;
|
||||
pub mod euler_linear_pool_factory;
|
||||
pub mod weighted_pool_factory_v1;
|
||||
pub mod managed_pool_factory;
|
||||
pub mod erc_linear_pool_factory;
|
||||
pub mod gearbox_linear_pool_factory;
|
||||
1446
substreams/ethereum-balancer-v2/src/abi/silo_linear_pool_factory.rs
Normal file
1446
substreams/ethereum-balancer-v2/src/abi/silo_linear_pool_factory.rs
Normal file
File diff suppressed because it is too large
Load Diff
4588
substreams/ethereum-balancer-v2/src/abi/vault.rs
Normal file
4588
substreams/ethereum-balancer-v2/src/abi/vault.rs
Normal file
File diff suppressed because it is too large
Load Diff
1316
substreams/ethereum-balancer-v2/src/abi/weighted_pool_factory.rs
Normal file
1316
substreams/ethereum-balancer-v2/src/abi/weighted_pool_factory.rs
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,633 @@
|
||||
const INTERNAL_ERR: &'static str = "`ethabi_derive` internal error";
|
||||
/// Contract's functions.
|
||||
#[allow(dead_code, unused_imports, unused_variables)]
|
||||
pub mod functions {
|
||||
use super::INTERNAL_ERR;
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct Create {
|
||||
pub name: String,
|
||||
pub symbol: String,
|
||||
pub tokens: Vec<Vec<u8>>,
|
||||
pub weights: Vec<substreams::scalar::BigInt>,
|
||||
pub swap_fee_percentage: substreams::scalar::BigInt,
|
||||
pub owner: Vec<u8>,
|
||||
}
|
||||
impl Create {
|
||||
const METHOD_ID: [u8; 4] = [251u8, 206u8, 3u8, 147u8];
|
||||
pub fn decode(
|
||||
call: &substreams_ethereum::pb::eth::v2::Call,
|
||||
) -> Result<Self, String> {
|
||||
let maybe_data = call.input.get(4..);
|
||||
if maybe_data.is_none() {
|
||||
return Err("no data to decode".to_string());
|
||||
}
|
||||
let mut values = ethabi::decode(
|
||||
&[
|
||||
ethabi::ParamType::String,
|
||||
ethabi::ParamType::String,
|
||||
ethabi::ParamType::Array(
|
||||
Box::new(ethabi::ParamType::Address),
|
||||
),
|
||||
ethabi::ParamType::Array(
|
||||
Box::new(ethabi::ParamType::Uint(256usize)),
|
||||
),
|
||||
ethabi::ParamType::Uint(256usize),
|
||||
ethabi::ParamType::Address,
|
||||
],
|
||||
maybe_data.unwrap(),
|
||||
)
|
||||
.map_err(|e| format!("unable to decode call.input: {:?}", e))?;
|
||||
values.reverse();
|
||||
Ok(Self {
|
||||
name: values
|
||||
.pop()
|
||||
.expect(INTERNAL_ERR)
|
||||
.into_string()
|
||||
.expect(INTERNAL_ERR),
|
||||
symbol: values
|
||||
.pop()
|
||||
.expect(INTERNAL_ERR)
|
||||
.into_string()
|
||||
.expect(INTERNAL_ERR),
|
||||
tokens: values
|
||||
.pop()
|
||||
.expect(INTERNAL_ERR)
|
||||
.into_array()
|
||||
.expect(INTERNAL_ERR)
|
||||
.into_iter()
|
||||
.map(|inner| {
|
||||
inner.into_address().expect(INTERNAL_ERR).as_bytes().to_vec()
|
||||
})
|
||||
.collect(),
|
||||
weights: values
|
||||
.pop()
|
||||
.expect(INTERNAL_ERR)
|
||||
.into_array()
|
||||
.expect(INTERNAL_ERR)
|
||||
.into_iter()
|
||||
.map(|inner| {
|
||||
let mut v = [0 as u8; 32];
|
||||
inner
|
||||
.into_uint()
|
||||
.expect(INTERNAL_ERR)
|
||||
.to_big_endian(v.as_mut_slice());
|
||||
substreams::scalar::BigInt::from_unsigned_bytes_be(&v)
|
||||
})
|
||||
.collect(),
|
||||
swap_fee_percentage: {
|
||||
let mut v = [0 as u8; 32];
|
||||
values
|
||||
.pop()
|
||||
.expect(INTERNAL_ERR)
|
||||
.into_uint()
|
||||
.expect(INTERNAL_ERR)
|
||||
.to_big_endian(v.as_mut_slice());
|
||||
substreams::scalar::BigInt::from_unsigned_bytes_be(&v)
|
||||
},
|
||||
owner: values
|
||||
.pop()
|
||||
.expect(INTERNAL_ERR)
|
||||
.into_address()
|
||||
.expect(INTERNAL_ERR)
|
||||
.as_bytes()
|
||||
.to_vec(),
|
||||
})
|
||||
}
|
||||
pub fn encode(&self) -> Vec<u8> {
|
||||
let data = ethabi::encode(
|
||||
&[
|
||||
ethabi::Token::String(self.name.clone()),
|
||||
ethabi::Token::String(self.symbol.clone()),
|
||||
{
|
||||
let v = self
|
||||
.tokens
|
||||
.iter()
|
||||
.map(|inner| ethabi::Token::Address(
|
||||
ethabi::Address::from_slice(&inner),
|
||||
))
|
||||
.collect();
|
||||
ethabi::Token::Array(v)
|
||||
},
|
||||
{
|
||||
let v = self
|
||||
.weights
|
||||
.iter()
|
||||
.map(|inner| ethabi::Token::Uint(
|
||||
ethabi::Uint::from_big_endian(
|
||||
match inner.clone().to_bytes_be() {
|
||||
(num_bigint::Sign::Plus, bytes) => bytes,
|
||||
(num_bigint::Sign::NoSign, bytes) => bytes,
|
||||
(num_bigint::Sign::Minus, _) => {
|
||||
panic!("negative numbers are not supported")
|
||||
}
|
||||
}
|
||||
.as_slice(),
|
||||
),
|
||||
))
|
||||
.collect();
|
||||
ethabi::Token::Array(v)
|
||||
},
|
||||
ethabi::Token::Uint(
|
||||
ethabi::Uint::from_big_endian(
|
||||
match self.swap_fee_percentage.clone().to_bytes_be() {
|
||||
(num_bigint::Sign::Plus, bytes) => bytes,
|
||||
(num_bigint::Sign::NoSign, bytes) => bytes,
|
||||
(num_bigint::Sign::Minus, _) => {
|
||||
panic!("negative numbers are not supported")
|
||||
}
|
||||
}
|
||||
.as_slice(),
|
||||
),
|
||||
),
|
||||
ethabi::Token::Address(ethabi::Address::from_slice(&self.owner)),
|
||||
],
|
||||
);
|
||||
let mut encoded = Vec::with_capacity(4 + data.len());
|
||||
encoded.extend(Self::METHOD_ID);
|
||||
encoded.extend(data);
|
||||
encoded
|
||||
}
|
||||
pub fn output_call(
|
||||
call: &substreams_ethereum::pb::eth::v2::Call,
|
||||
) -> Result<Vec<u8>, String> {
|
||||
Self::output(call.return_data.as_ref())
|
||||
}
|
||||
pub fn output(data: &[u8]) -> Result<Vec<u8>, String> {
|
||||
let mut values = ethabi::decode(
|
||||
&[ethabi::ParamType::Address],
|
||||
data.as_ref(),
|
||||
)
|
||||
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
|
||||
Ok(
|
||||
values
|
||||
.pop()
|
||||
.expect("one output data should have existed")
|
||||
.into_address()
|
||||
.expect(INTERNAL_ERR)
|
||||
.as_bytes()
|
||||
.to_vec(),
|
||||
)
|
||||
}
|
||||
pub fn match_call(call: &substreams_ethereum::pb::eth::v2::Call) -> bool {
|
||||
match call.input.get(0..4) {
|
||||
Some(signature) => Self::METHOD_ID == signature,
|
||||
None => false,
|
||||
}
|
||||
}
|
||||
pub fn call(&self, address: Vec<u8>) -> Option<Vec<u8>> {
|
||||
use substreams_ethereum::pb::eth::rpc;
|
||||
let rpc_calls = rpc::RpcCalls {
|
||||
calls: vec![
|
||||
rpc::RpcCall { to_addr : address, data : self.encode(), }
|
||||
],
|
||||
};
|
||||
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
||||
let response = responses
|
||||
.get(0)
|
||||
.expect("one response should have existed");
|
||||
if response.failed {
|
||||
return None;
|
||||
}
|
||||
match Self::output(response.raw.as_ref()) {
|
||||
Ok(data) => Some(data),
|
||||
Err(err) => {
|
||||
use substreams_ethereum::Function;
|
||||
substreams::log::info!(
|
||||
"Call output for function `{}` failed to decode with error: {}",
|
||||
Self::NAME, err
|
||||
);
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
impl substreams_ethereum::Function for Create {
|
||||
const NAME: &'static str = "create";
|
||||
fn match_call(call: &substreams_ethereum::pb::eth::v2::Call) -> bool {
|
||||
Self::match_call(call)
|
||||
}
|
||||
fn decode(
|
||||
call: &substreams_ethereum::pb::eth::v2::Call,
|
||||
) -> Result<Self, String> {
|
||||
Self::decode(call)
|
||||
}
|
||||
fn encode(&self) -> Vec<u8> {
|
||||
self.encode()
|
||||
}
|
||||
}
|
||||
impl substreams_ethereum::rpc::RPCDecodable<Vec<u8>> for Create {
|
||||
fn output(data: &[u8]) -> Result<Vec<u8>, String> {
|
||||
Self::output(data)
|
||||
}
|
||||
}
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct GetPauseConfiguration {}
|
||||
impl GetPauseConfiguration {
|
||||
const METHOD_ID: [u8; 4] = [45u8, 164u8, 124u8, 64u8];
|
||||
pub fn decode(
|
||||
call: &substreams_ethereum::pb::eth::v2::Call,
|
||||
) -> Result<Self, String> {
|
||||
Ok(Self {})
|
||||
}
|
||||
pub fn encode(&self) -> Vec<u8> {
|
||||
let data = ethabi::encode(&[]);
|
||||
let mut encoded = Vec::with_capacity(4 + data.len());
|
||||
encoded.extend(Self::METHOD_ID);
|
||||
encoded.extend(data);
|
||||
encoded
|
||||
}
|
||||
pub fn output_call(
|
||||
call: &substreams_ethereum::pb::eth::v2::Call,
|
||||
) -> Result<
|
||||
(substreams::scalar::BigInt, substreams::scalar::BigInt),
|
||||
String,
|
||||
> {
|
||||
Self::output(call.return_data.as_ref())
|
||||
}
|
||||
pub fn output(
|
||||
data: &[u8],
|
||||
) -> Result<
|
||||
(substreams::scalar::BigInt, substreams::scalar::BigInt),
|
||||
String,
|
||||
> {
|
||||
let mut values = ethabi::decode(
|
||||
&[
|
||||
ethabi::ParamType::Uint(256usize),
|
||||
ethabi::ParamType::Uint(256usize),
|
||||
],
|
||||
data.as_ref(),
|
||||
)
|
||||
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
|
||||
values.reverse();
|
||||
Ok((
|
||||
{
|
||||
let mut v = [0 as u8; 32];
|
||||
values
|
||||
.pop()
|
||||
.expect(INTERNAL_ERR)
|
||||
.into_uint()
|
||||
.expect(INTERNAL_ERR)
|
||||
.to_big_endian(v.as_mut_slice());
|
||||
substreams::scalar::BigInt::from_unsigned_bytes_be(&v)
|
||||
},
|
||||
{
|
||||
let mut v = [0 as u8; 32];
|
||||
values
|
||||
.pop()
|
||||
.expect(INTERNAL_ERR)
|
||||
.into_uint()
|
||||
.expect(INTERNAL_ERR)
|
||||
.to_big_endian(v.as_mut_slice());
|
||||
substreams::scalar::BigInt::from_unsigned_bytes_be(&v)
|
||||
},
|
||||
))
|
||||
}
|
||||
pub fn match_call(call: &substreams_ethereum::pb::eth::v2::Call) -> bool {
|
||||
match call.input.get(0..4) {
|
||||
Some(signature) => Self::METHOD_ID == signature,
|
||||
None => false,
|
||||
}
|
||||
}
|
||||
pub fn call(
|
||||
&self,
|
||||
address: Vec<u8>,
|
||||
) -> Option<(substreams::scalar::BigInt, substreams::scalar::BigInt)> {
|
||||
use substreams_ethereum::pb::eth::rpc;
|
||||
let rpc_calls = rpc::RpcCalls {
|
||||
calls: vec![
|
||||
rpc::RpcCall { to_addr : address, data : self.encode(), }
|
||||
],
|
||||
};
|
||||
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
||||
let response = responses
|
||||
.get(0)
|
||||
.expect("one response should have existed");
|
||||
if response.failed {
|
||||
return None;
|
||||
}
|
||||
match Self::output(response.raw.as_ref()) {
|
||||
Ok(data) => Some(data),
|
||||
Err(err) => {
|
||||
use substreams_ethereum::Function;
|
||||
substreams::log::info!(
|
||||
"Call output for function `{}` failed to decode with error: {}",
|
||||
Self::NAME, err
|
||||
);
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
impl substreams_ethereum::Function for GetPauseConfiguration {
|
||||
const NAME: &'static str = "getPauseConfiguration";
|
||||
fn match_call(call: &substreams_ethereum::pb::eth::v2::Call) -> bool {
|
||||
Self::match_call(call)
|
||||
}
|
||||
fn decode(
|
||||
call: &substreams_ethereum::pb::eth::v2::Call,
|
||||
) -> Result<Self, String> {
|
||||
Self::decode(call)
|
||||
}
|
||||
fn encode(&self) -> Vec<u8> {
|
||||
self.encode()
|
||||
}
|
||||
}
|
||||
impl substreams_ethereum::rpc::RPCDecodable<
|
||||
(substreams::scalar::BigInt, substreams::scalar::BigInt),
|
||||
> for GetPauseConfiguration {
|
||||
fn output(
|
||||
data: &[u8],
|
||||
) -> Result<
|
||||
(substreams::scalar::BigInt, substreams::scalar::BigInt),
|
||||
String,
|
||||
> {
|
||||
Self::output(data)
|
||||
}
|
||||
}
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct GetVault {}
|
||||
impl GetVault {
|
||||
const METHOD_ID: [u8; 4] = [141u8, 146u8, 138u8, 248u8];
|
||||
pub fn decode(
|
||||
call: &substreams_ethereum::pb::eth::v2::Call,
|
||||
) -> Result<Self, String> {
|
||||
Ok(Self {})
|
||||
}
|
||||
pub fn encode(&self) -> Vec<u8> {
|
||||
let data = ethabi::encode(&[]);
|
||||
let mut encoded = Vec::with_capacity(4 + data.len());
|
||||
encoded.extend(Self::METHOD_ID);
|
||||
encoded.extend(data);
|
||||
encoded
|
||||
}
|
||||
pub fn output_call(
|
||||
call: &substreams_ethereum::pb::eth::v2::Call,
|
||||
) -> Result<Vec<u8>, String> {
|
||||
Self::output(call.return_data.as_ref())
|
||||
}
|
||||
pub fn output(data: &[u8]) -> Result<Vec<u8>, String> {
|
||||
let mut values = ethabi::decode(
|
||||
&[ethabi::ParamType::Address],
|
||||
data.as_ref(),
|
||||
)
|
||||
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
|
||||
Ok(
|
||||
values
|
||||
.pop()
|
||||
.expect("one output data should have existed")
|
||||
.into_address()
|
||||
.expect(INTERNAL_ERR)
|
||||
.as_bytes()
|
||||
.to_vec(),
|
||||
)
|
||||
}
|
||||
pub fn match_call(call: &substreams_ethereum::pb::eth::v2::Call) -> bool {
|
||||
match call.input.get(0..4) {
|
||||
Some(signature) => Self::METHOD_ID == signature,
|
||||
None => false,
|
||||
}
|
||||
}
|
||||
pub fn call(&self, address: Vec<u8>) -> Option<Vec<u8>> {
|
||||
use substreams_ethereum::pb::eth::rpc;
|
||||
let rpc_calls = rpc::RpcCalls {
|
||||
calls: vec![
|
||||
rpc::RpcCall { to_addr : address, data : self.encode(), }
|
||||
],
|
||||
};
|
||||
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
||||
let response = responses
|
||||
.get(0)
|
||||
.expect("one response should have existed");
|
||||
if response.failed {
|
||||
return None;
|
||||
}
|
||||
match Self::output(response.raw.as_ref()) {
|
||||
Ok(data) => Some(data),
|
||||
Err(err) => {
|
||||
use substreams_ethereum::Function;
|
||||
substreams::log::info!(
|
||||
"Call output for function `{}` failed to decode with error: {}",
|
||||
Self::NAME, err
|
||||
);
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
impl substreams_ethereum::Function for GetVault {
|
||||
const NAME: &'static str = "getVault";
|
||||
fn match_call(call: &substreams_ethereum::pb::eth::v2::Call) -> bool {
|
||||
Self::match_call(call)
|
||||
}
|
||||
fn decode(
|
||||
call: &substreams_ethereum::pb::eth::v2::Call,
|
||||
) -> Result<Self, String> {
|
||||
Self::decode(call)
|
||||
}
|
||||
fn encode(&self) -> Vec<u8> {
|
||||
self.encode()
|
||||
}
|
||||
}
|
||||
impl substreams_ethereum::rpc::RPCDecodable<Vec<u8>> for GetVault {
|
||||
fn output(data: &[u8]) -> Result<Vec<u8>, String> {
|
||||
Self::output(data)
|
||||
}
|
||||
}
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct IsPoolFromFactory {
|
||||
pub pool: Vec<u8>,
|
||||
}
|
||||
impl IsPoolFromFactory {
|
||||
const METHOD_ID: [u8; 4] = [102u8, 52u8, 183u8, 83u8];
|
||||
pub fn decode(
|
||||
call: &substreams_ethereum::pb::eth::v2::Call,
|
||||
) -> Result<Self, String> {
|
||||
let maybe_data = call.input.get(4..);
|
||||
if maybe_data.is_none() {
|
||||
return Err("no data to decode".to_string());
|
||||
}
|
||||
let mut values = ethabi::decode(
|
||||
&[ethabi::ParamType::Address],
|
||||
maybe_data.unwrap(),
|
||||
)
|
||||
.map_err(|e| format!("unable to decode call.input: {:?}", e))?;
|
||||
values.reverse();
|
||||
Ok(Self {
|
||||
pool: values
|
||||
.pop()
|
||||
.expect(INTERNAL_ERR)
|
||||
.into_address()
|
||||
.expect(INTERNAL_ERR)
|
||||
.as_bytes()
|
||||
.to_vec(),
|
||||
})
|
||||
}
|
||||
pub fn encode(&self) -> Vec<u8> {
|
||||
let data = ethabi::encode(
|
||||
&[ethabi::Token::Address(ethabi::Address::from_slice(&self.pool))],
|
||||
);
|
||||
let mut encoded = Vec::with_capacity(4 + data.len());
|
||||
encoded.extend(Self::METHOD_ID);
|
||||
encoded.extend(data);
|
||||
encoded
|
||||
}
|
||||
pub fn output_call(
|
||||
call: &substreams_ethereum::pb::eth::v2::Call,
|
||||
) -> Result<bool, String> {
|
||||
Self::output(call.return_data.as_ref())
|
||||
}
|
||||
pub fn output(data: &[u8]) -> Result<bool, String> {
|
||||
let mut values = ethabi::decode(
|
||||
&[ethabi::ParamType::Bool],
|
||||
data.as_ref(),
|
||||
)
|
||||
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
|
||||
Ok(
|
||||
values
|
||||
.pop()
|
||||
.expect("one output data should have existed")
|
||||
.into_bool()
|
||||
.expect(INTERNAL_ERR),
|
||||
)
|
||||
}
|
||||
pub fn match_call(call: &substreams_ethereum::pb::eth::v2::Call) -> bool {
|
||||
match call.input.get(0..4) {
|
||||
Some(signature) => Self::METHOD_ID == signature,
|
||||
None => false,
|
||||
}
|
||||
}
|
||||
pub fn call(&self, address: Vec<u8>) -> Option<bool> {
|
||||
use substreams_ethereum::pb::eth::rpc;
|
||||
let rpc_calls = rpc::RpcCalls {
|
||||
calls: vec![
|
||||
rpc::RpcCall { to_addr : address, data : self.encode(), }
|
||||
],
|
||||
};
|
||||
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
||||
let response = responses
|
||||
.get(0)
|
||||
.expect("one response should have existed");
|
||||
if response.failed {
|
||||
return None;
|
||||
}
|
||||
match Self::output(response.raw.as_ref()) {
|
||||
Ok(data) => Some(data),
|
||||
Err(err) => {
|
||||
use substreams_ethereum::Function;
|
||||
substreams::log::info!(
|
||||
"Call output for function `{}` failed to decode with error: {}",
|
||||
Self::NAME, err
|
||||
);
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
impl substreams_ethereum::Function for IsPoolFromFactory {
|
||||
const NAME: &'static str = "isPoolFromFactory";
|
||||
fn match_call(call: &substreams_ethereum::pb::eth::v2::Call) -> bool {
|
||||
Self::match_call(call)
|
||||
}
|
||||
fn decode(
|
||||
call: &substreams_ethereum::pb::eth::v2::Call,
|
||||
) -> Result<Self, String> {
|
||||
Self::decode(call)
|
||||
}
|
||||
fn encode(&self) -> Vec<u8> {
|
||||
self.encode()
|
||||
}
|
||||
}
|
||||
impl substreams_ethereum::rpc::RPCDecodable<bool> for IsPoolFromFactory {
|
||||
fn output(data: &[u8]) -> Result<bool, String> {
|
||||
Self::output(data)
|
||||
}
|
||||
}
|
||||
}
|
||||
/// Contract's events.
|
||||
#[allow(dead_code, unused_imports, unused_variables)]
|
||||
pub mod events {
|
||||
use super::INTERNAL_ERR;
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct PoolCreated {
|
||||
pub pool: Vec<u8>,
|
||||
}
|
||||
impl PoolCreated {
|
||||
const TOPIC_ID: [u8; 32] = [
|
||||
131u8,
|
||||
164u8,
|
||||
143u8,
|
||||
188u8,
|
||||
252u8,
|
||||
153u8,
|
||||
19u8,
|
||||
53u8,
|
||||
49u8,
|
||||
78u8,
|
||||
116u8,
|
||||
208u8,
|
||||
73u8,
|
||||
106u8,
|
||||
171u8,
|
||||
106u8,
|
||||
25u8,
|
||||
135u8,
|
||||
233u8,
|
||||
146u8,
|
||||
221u8,
|
||||
200u8,
|
||||
93u8,
|
||||
221u8,
|
||||
188u8,
|
||||
196u8,
|
||||
214u8,
|
||||
221u8,
|
||||
110u8,
|
||||
242u8,
|
||||
233u8,
|
||||
252u8,
|
||||
];
|
||||
pub fn match_log(log: &substreams_ethereum::pb::eth::v2::Log) -> bool {
|
||||
if log.topics.len() != 2usize {
|
||||
return false;
|
||||
}
|
||||
if log.data.len() != 0usize {
|
||||
return false;
|
||||
}
|
||||
return log.topics.get(0).expect("bounds already checked").as_ref()
|
||||
== Self::TOPIC_ID;
|
||||
}
|
||||
pub fn decode(
|
||||
log: &substreams_ethereum::pb::eth::v2::Log,
|
||||
) -> Result<Self, String> {
|
||||
Ok(Self {
|
||||
pool: ethabi::decode(
|
||||
&[ethabi::ParamType::Address],
|
||||
log.topics[1usize].as_ref(),
|
||||
)
|
||||
.map_err(|e| {
|
||||
format!(
|
||||
"unable to decode param 'pool' from topic of type 'address': {:?}",
|
||||
e
|
||||
)
|
||||
})?
|
||||
.pop()
|
||||
.expect(INTERNAL_ERR)
|
||||
.into_address()
|
||||
.expect(INTERNAL_ERR)
|
||||
.as_bytes()
|
||||
.to_vec(),
|
||||
})
|
||||
}
|
||||
}
|
||||
impl substreams_ethereum::Event for PoolCreated {
|
||||
const NAME: &'static str = "PoolCreated";
|
||||
fn match_log(log: &substreams_ethereum::pb::eth::v2::Log) -> bool {
|
||||
Self::match_log(log)
|
||||
}
|
||||
fn decode(
|
||||
log: &substreams_ethereum::pb::eth::v2::Log,
|
||||
) -> Result<Self, String> {
|
||||
Self::decode(log)
|
||||
}
|
||||
}
|
||||
}
|
||||
1324
substreams/ethereum-balancer-v2/src/abi/weighted_pool_factory_v2.rs
Normal file
1324
substreams/ethereum-balancer-v2/src/abi/weighted_pool_factory_v2.rs
Normal file
File diff suppressed because it is too large
Load Diff
1498
substreams/ethereum-balancer-v2/src/abi/weighted_pool_factory_v3.rs
Normal file
1498
substreams/ethereum-balancer-v2/src/abi/weighted_pool_factory_v3.rs
Normal file
File diff suppressed because it is too large
Load Diff
1511
substreams/ethereum-balancer-v2/src/abi/weighted_pool_factory_v4.rs
Normal file
1511
substreams/ethereum-balancer-v2/src/abi/weighted_pool_factory_v4.rs
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,558 @@
|
||||
|
||||
const INTERNAL_ERR: &'static str = "`ethabi_derive` internal error";
|
||||
/// Contract's functions.
|
||||
#[allow(dead_code, unused_imports, unused_variables)]
|
||||
pub mod functions {
|
||||
use super::INTERNAL_ERR;
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct Create {
|
||||
pub name: String,
|
||||
pub symbol: String,
|
||||
pub tokens: Vec<Vec<u8>>,
|
||||
pub weights: Vec<substreams::scalar::BigInt>,
|
||||
pub swap_fee_percentage: substreams::scalar::BigInt,
|
||||
pub oracle_enabled: bool,
|
||||
pub owner: Vec<u8>,
|
||||
}
|
||||
impl Create {
|
||||
const METHOD_ID: [u8; 4] = [21u8, 150u8, 1u8, 155u8];
|
||||
pub fn decode(call: &substreams_ethereum::pb::eth::v2::Call) -> Result<Self, String> {
|
||||
let maybe_data = call.input.get(4..);
|
||||
if maybe_data.is_none() {
|
||||
return Err("no data to decode".to_string());
|
||||
}
|
||||
let mut values = ethabi::decode(
|
||||
&[
|
||||
ethabi::ParamType::String,
|
||||
ethabi::ParamType::String,
|
||||
ethabi::ParamType::Array(Box::new(ethabi::ParamType::Address)),
|
||||
ethabi::ParamType::Array(Box::new(ethabi::ParamType::Uint(256usize))),
|
||||
ethabi::ParamType::Uint(256usize),
|
||||
ethabi::ParamType::Bool,
|
||||
ethabi::ParamType::Address,
|
||||
],
|
||||
maybe_data.unwrap(),
|
||||
)
|
||||
.map_err(|e| format!("unable to decode call.input: {:?}", e))?;
|
||||
values.reverse();
|
||||
Ok(Self {
|
||||
name: values
|
||||
.pop()
|
||||
.expect(INTERNAL_ERR)
|
||||
.into_string()
|
||||
.expect(INTERNAL_ERR),
|
||||
symbol: values
|
||||
.pop()
|
||||
.expect(INTERNAL_ERR)
|
||||
.into_string()
|
||||
.expect(INTERNAL_ERR),
|
||||
tokens: values
|
||||
.pop()
|
||||
.expect(INTERNAL_ERR)
|
||||
.into_array()
|
||||
.expect(INTERNAL_ERR)
|
||||
.into_iter()
|
||||
.map(|inner| {
|
||||
inner
|
||||
.into_address()
|
||||
.expect(INTERNAL_ERR)
|
||||
.as_bytes()
|
||||
.to_vec()
|
||||
})
|
||||
.collect(),
|
||||
weights: values
|
||||
.pop()
|
||||
.expect(INTERNAL_ERR)
|
||||
.into_array()
|
||||
.expect(INTERNAL_ERR)
|
||||
.into_iter()
|
||||
.map(|inner| {
|
||||
let mut v = [0 as u8; 32];
|
||||
inner
|
||||
.into_uint()
|
||||
.expect(INTERNAL_ERR)
|
||||
.to_big_endian(v.as_mut_slice());
|
||||
substreams::scalar::BigInt::from_unsigned_bytes_be(&v)
|
||||
})
|
||||
.collect(),
|
||||
swap_fee_percentage: {
|
||||
let mut v = [0 as u8; 32];
|
||||
values
|
||||
.pop()
|
||||
.expect(INTERNAL_ERR)
|
||||
.into_uint()
|
||||
.expect(INTERNAL_ERR)
|
||||
.to_big_endian(v.as_mut_slice());
|
||||
substreams::scalar::BigInt::from_unsigned_bytes_be(&v)
|
||||
},
|
||||
oracle_enabled: values
|
||||
.pop()
|
||||
.expect(INTERNAL_ERR)
|
||||
.into_bool()
|
||||
.expect(INTERNAL_ERR),
|
||||
owner: values
|
||||
.pop()
|
||||
.expect(INTERNAL_ERR)
|
||||
.into_address()
|
||||
.expect(INTERNAL_ERR)
|
||||
.as_bytes()
|
||||
.to_vec(),
|
||||
})
|
||||
}
|
||||
pub fn encode(&self) -> Vec<u8> {
|
||||
let data = ethabi::encode(&[
|
||||
ethabi::Token::String(self.name.clone()),
|
||||
ethabi::Token::String(self.symbol.clone()),
|
||||
{
|
||||
let v = self
|
||||
.tokens
|
||||
.iter()
|
||||
.map(|inner| ethabi::Token::Address(ethabi::Address::from_slice(&inner)))
|
||||
.collect();
|
||||
ethabi::Token::Array(v)
|
||||
},
|
||||
{
|
||||
let v = self
|
||||
.weights
|
||||
.iter()
|
||||
.map(|inner| {
|
||||
ethabi::Token::Uint(ethabi::Uint::from_big_endian(
|
||||
match inner.clone().to_bytes_be() {
|
||||
(num_bigint::Sign::Plus, bytes) => bytes,
|
||||
(num_bigint::Sign::NoSign, bytes) => bytes,
|
||||
(num_bigint::Sign::Minus, _) => {
|
||||
panic!("negative numbers are not supported")
|
||||
}
|
||||
}
|
||||
.as_slice(),
|
||||
))
|
||||
})
|
||||
.collect();
|
||||
ethabi::Token::Array(v)
|
||||
},
|
||||
ethabi::Token::Uint(ethabi::Uint::from_big_endian(
|
||||
match self
|
||||
.swap_fee_percentage
|
||||
.clone()
|
||||
.to_bytes_be()
|
||||
{
|
||||
(num_bigint::Sign::Plus, bytes) => bytes,
|
||||
(num_bigint::Sign::NoSign, bytes) => bytes,
|
||||
(num_bigint::Sign::Minus, _) => {
|
||||
panic!("negative numbers are not supported")
|
||||
}
|
||||
}
|
||||
.as_slice(),
|
||||
)),
|
||||
ethabi::Token::Bool(self.oracle_enabled.clone()),
|
||||
ethabi::Token::Address(ethabi::Address::from_slice(&self.owner)),
|
||||
]);
|
||||
let mut encoded = Vec::with_capacity(4 + data.len());
|
||||
encoded.extend(Self::METHOD_ID);
|
||||
encoded.extend(data);
|
||||
encoded
|
||||
}
|
||||
pub fn output_call(
|
||||
call: &substreams_ethereum::pb::eth::v2::Call,
|
||||
) -> Result<Vec<u8>, String> {
|
||||
Self::output(call.return_data.as_ref())
|
||||
}
|
||||
pub fn output(data: &[u8]) -> Result<Vec<u8>, String> {
|
||||
let mut values = ethabi::decode(&[ethabi::ParamType::Address], data.as_ref())
|
||||
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
|
||||
Ok(values
|
||||
.pop()
|
||||
.expect("one output data should have existed")
|
||||
.into_address()
|
||||
.expect(INTERNAL_ERR)
|
||||
.as_bytes()
|
||||
.to_vec())
|
||||
}
|
||||
pub fn match_call(call: &substreams_ethereum::pb::eth::v2::Call) -> bool {
|
||||
match call.input.get(0..4) {
|
||||
Some(signature) => Self::METHOD_ID == signature,
|
||||
None => false,
|
||||
}
|
||||
}
|
||||
pub fn call(&self, address: Vec<u8>) -> Option<Vec<u8>> {
|
||||
use substreams_ethereum::pb::eth::rpc;
|
||||
let rpc_calls = rpc::RpcCalls {
|
||||
calls: vec![rpc::RpcCall { to_addr: address, data: self.encode() }],
|
||||
};
|
||||
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
||||
let response = responses
|
||||
.get(0)
|
||||
.expect("one response should have existed");
|
||||
if response.failed {
|
||||
return None;
|
||||
}
|
||||
match Self::output(response.raw.as_ref()) {
|
||||
Ok(data) => Some(data),
|
||||
Err(err) => {
|
||||
use substreams_ethereum::Function;
|
||||
substreams::log::info!(
|
||||
"Call output for function `{}` failed to decode with error: {}",
|
||||
Self::NAME,
|
||||
err
|
||||
);
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
impl substreams_ethereum::Function for Create {
|
||||
const NAME: &'static str = "create";
|
||||
fn match_call(call: &substreams_ethereum::pb::eth::v2::Call) -> bool {
|
||||
Self::match_call(call)
|
||||
}
|
||||
fn decode(call: &substreams_ethereum::pb::eth::v2::Call) -> Result<Self, String> {
|
||||
Self::decode(call)
|
||||
}
|
||||
fn encode(&self) -> Vec<u8> {
|
||||
self.encode()
|
||||
}
|
||||
}
|
||||
impl substreams_ethereum::rpc::RPCDecodable<Vec<u8>> for Create {
|
||||
fn output(data: &[u8]) -> Result<Vec<u8>, String> {
|
||||
Self::output(data)
|
||||
}
|
||||
}
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct GetPauseConfiguration {}
|
||||
impl GetPauseConfiguration {
|
||||
const METHOD_ID: [u8; 4] = [45u8, 164u8, 124u8, 64u8];
|
||||
pub fn decode(call: &substreams_ethereum::pb::eth::v2::Call) -> Result<Self, String> {
|
||||
Ok(Self {})
|
||||
}
|
||||
pub fn encode(&self) -> Vec<u8> {
|
||||
let data = ethabi::encode(&[]);
|
||||
let mut encoded = Vec::with_capacity(4 + data.len());
|
||||
encoded.extend(Self::METHOD_ID);
|
||||
encoded.extend(data);
|
||||
encoded
|
||||
}
|
||||
pub fn output_call(
|
||||
call: &substreams_ethereum::pb::eth::v2::Call,
|
||||
) -> Result<(substreams::scalar::BigInt, substreams::scalar::BigInt), String> {
|
||||
Self::output(call.return_data.as_ref())
|
||||
}
|
||||
pub fn output(
|
||||
data: &[u8],
|
||||
) -> Result<(substreams::scalar::BigInt, substreams::scalar::BigInt), String> {
|
||||
let mut values = ethabi::decode(
|
||||
&[ethabi::ParamType::Uint(256usize), ethabi::ParamType::Uint(256usize)],
|
||||
data.as_ref(),
|
||||
)
|
||||
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
|
||||
values.reverse();
|
||||
Ok((
|
||||
{
|
||||
let mut v = [0 as u8; 32];
|
||||
values
|
||||
.pop()
|
||||
.expect(INTERNAL_ERR)
|
||||
.into_uint()
|
||||
.expect(INTERNAL_ERR)
|
||||
.to_big_endian(v.as_mut_slice());
|
||||
substreams::scalar::BigInt::from_unsigned_bytes_be(&v)
|
||||
},
|
||||
{
|
||||
let mut v = [0 as u8; 32];
|
||||
values
|
||||
.pop()
|
||||
.expect(INTERNAL_ERR)
|
||||
.into_uint()
|
||||
.expect(INTERNAL_ERR)
|
||||
.to_big_endian(v.as_mut_slice());
|
||||
substreams::scalar::BigInt::from_unsigned_bytes_be(&v)
|
||||
},
|
||||
))
|
||||
}
|
||||
pub fn match_call(call: &substreams_ethereum::pb::eth::v2::Call) -> bool {
|
||||
match call.input.get(0..4) {
|
||||
Some(signature) => Self::METHOD_ID == signature,
|
||||
None => false,
|
||||
}
|
||||
}
|
||||
pub fn call(
|
||||
&self,
|
||||
address: Vec<u8>,
|
||||
) -> Option<(substreams::scalar::BigInt, substreams::scalar::BigInt)> {
|
||||
use substreams_ethereum::pb::eth::rpc;
|
||||
let rpc_calls = rpc::RpcCalls {
|
||||
calls: vec![rpc::RpcCall { to_addr: address, data: self.encode() }],
|
||||
};
|
||||
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
||||
let response = responses
|
||||
.get(0)
|
||||
.expect("one response should have existed");
|
||||
if response.failed {
|
||||
return None;
|
||||
}
|
||||
match Self::output(response.raw.as_ref()) {
|
||||
Ok(data) => Some(data),
|
||||
Err(err) => {
|
||||
use substreams_ethereum::Function;
|
||||
substreams::log::info!(
|
||||
"Call output for function `{}` failed to decode with error: {}",
|
||||
Self::NAME,
|
||||
err
|
||||
);
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
impl substreams_ethereum::Function for GetPauseConfiguration {
|
||||
const NAME: &'static str = "getPauseConfiguration";
|
||||
fn match_call(call: &substreams_ethereum::pb::eth::v2::Call) -> bool {
|
||||
Self::match_call(call)
|
||||
}
|
||||
fn decode(call: &substreams_ethereum::pb::eth::v2::Call) -> Result<Self, String> {
|
||||
Self::decode(call)
|
||||
}
|
||||
fn encode(&self) -> Vec<u8> {
|
||||
self.encode()
|
||||
}
|
||||
}
|
||||
impl
|
||||
substreams_ethereum::rpc::RPCDecodable<(
|
||||
substreams::scalar::BigInt,
|
||||
substreams::scalar::BigInt,
|
||||
)> for GetPauseConfiguration
|
||||
{
|
||||
fn output(
|
||||
data: &[u8],
|
||||
) -> Result<(substreams::scalar::BigInt, substreams::scalar::BigInt), String> {
|
||||
Self::output(data)
|
||||
}
|
||||
}
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct GetVault {}
|
||||
impl GetVault {
|
||||
const METHOD_ID: [u8; 4] = [141u8, 146u8, 138u8, 248u8];
|
||||
pub fn decode(call: &substreams_ethereum::pb::eth::v2::Call) -> Result<Self, String> {
|
||||
Ok(Self {})
|
||||
}
|
||||
pub fn encode(&self) -> Vec<u8> {
|
||||
let data = ethabi::encode(&[]);
|
||||
let mut encoded = Vec::with_capacity(4 + data.len());
|
||||
encoded.extend(Self::METHOD_ID);
|
||||
encoded.extend(data);
|
||||
encoded
|
||||
}
|
||||
pub fn output_call(
|
||||
call: &substreams_ethereum::pb::eth::v2::Call,
|
||||
) -> Result<Vec<u8>, String> {
|
||||
Self::output(call.return_data.as_ref())
|
||||
}
|
||||
pub fn output(data: &[u8]) -> Result<Vec<u8>, String> {
|
||||
let mut values = ethabi::decode(&[ethabi::ParamType::Address], data.as_ref())
|
||||
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
|
||||
Ok(values
|
||||
.pop()
|
||||
.expect("one output data should have existed")
|
||||
.into_address()
|
||||
.expect(INTERNAL_ERR)
|
||||
.as_bytes()
|
||||
.to_vec())
|
||||
}
|
||||
pub fn match_call(call: &substreams_ethereum::pb::eth::v2::Call) -> bool {
|
||||
match call.input.get(0..4) {
|
||||
Some(signature) => Self::METHOD_ID == signature,
|
||||
None => false,
|
||||
}
|
||||
}
|
||||
pub fn call(&self, address: Vec<u8>) -> Option<Vec<u8>> {
|
||||
use substreams_ethereum::pb::eth::rpc;
|
||||
let rpc_calls = rpc::RpcCalls {
|
||||
calls: vec![rpc::RpcCall { to_addr: address, data: self.encode() }],
|
||||
};
|
||||
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
||||
let response = responses
|
||||
.get(0)
|
||||
.expect("one response should have existed");
|
||||
if response.failed {
|
||||
return None;
|
||||
}
|
||||
match Self::output(response.raw.as_ref()) {
|
||||
Ok(data) => Some(data),
|
||||
Err(err) => {
|
||||
use substreams_ethereum::Function;
|
||||
substreams::log::info!(
|
||||
"Call output for function `{}` failed to decode with error: {}",
|
||||
Self::NAME,
|
||||
err
|
||||
);
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
impl substreams_ethereum::Function for GetVault {
|
||||
const NAME: &'static str = "getVault";
|
||||
fn match_call(call: &substreams_ethereum::pb::eth::v2::Call) -> bool {
|
||||
Self::match_call(call)
|
||||
}
|
||||
fn decode(call: &substreams_ethereum::pb::eth::v2::Call) -> Result<Self, String> {
|
||||
Self::decode(call)
|
||||
}
|
||||
fn encode(&self) -> Vec<u8> {
|
||||
self.encode()
|
||||
}
|
||||
}
|
||||
impl substreams_ethereum::rpc::RPCDecodable<Vec<u8>> for GetVault {
|
||||
fn output(data: &[u8]) -> Result<Vec<u8>, String> {
|
||||
Self::output(data)
|
||||
}
|
||||
}
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct IsPoolFromFactory {
|
||||
pub pool: Vec<u8>,
|
||||
}
|
||||
impl IsPoolFromFactory {
|
||||
const METHOD_ID: [u8; 4] = [102u8, 52u8, 183u8, 83u8];
|
||||
pub fn decode(call: &substreams_ethereum::pb::eth::v2::Call) -> Result<Self, String> {
|
||||
let maybe_data = call.input.get(4..);
|
||||
if maybe_data.is_none() {
|
||||
return Err("no data to decode".to_string());
|
||||
}
|
||||
let mut values = ethabi::decode(&[ethabi::ParamType::Address], maybe_data.unwrap())
|
||||
.map_err(|e| format!("unable to decode call.input: {:?}", e))?;
|
||||
values.reverse();
|
||||
Ok(Self {
|
||||
pool: values
|
||||
.pop()
|
||||
.expect(INTERNAL_ERR)
|
||||
.into_address()
|
||||
.expect(INTERNAL_ERR)
|
||||
.as_bytes()
|
||||
.to_vec(),
|
||||
})
|
||||
}
|
||||
pub fn encode(&self) -> Vec<u8> {
|
||||
let data =
|
||||
ethabi::encode(&[ethabi::Token::Address(ethabi::Address::from_slice(&self.pool))]);
|
||||
let mut encoded = Vec::with_capacity(4 + data.len());
|
||||
encoded.extend(Self::METHOD_ID);
|
||||
encoded.extend(data);
|
||||
encoded
|
||||
}
|
||||
pub fn output_call(call: &substreams_ethereum::pb::eth::v2::Call) -> Result<bool, String> {
|
||||
Self::output(call.return_data.as_ref())
|
||||
}
|
||||
pub fn output(data: &[u8]) -> Result<bool, String> {
|
||||
let mut values = ethabi::decode(&[ethabi::ParamType::Bool], data.as_ref())
|
||||
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
|
||||
Ok(values
|
||||
.pop()
|
||||
.expect("one output data should have existed")
|
||||
.into_bool()
|
||||
.expect(INTERNAL_ERR))
|
||||
}
|
||||
pub fn match_call(call: &substreams_ethereum::pb::eth::v2::Call) -> bool {
|
||||
match call.input.get(0..4) {
|
||||
Some(signature) => Self::METHOD_ID == signature,
|
||||
None => false,
|
||||
}
|
||||
}
|
||||
pub fn call(&self, address: Vec<u8>) -> Option<bool> {
|
||||
use substreams_ethereum::pb::eth::rpc;
|
||||
let rpc_calls = rpc::RpcCalls {
|
||||
calls: vec![rpc::RpcCall { to_addr: address, data: self.encode() }],
|
||||
};
|
||||
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
||||
let response = responses
|
||||
.get(0)
|
||||
.expect("one response should have existed");
|
||||
if response.failed {
|
||||
return None;
|
||||
}
|
||||
match Self::output(response.raw.as_ref()) {
|
||||
Ok(data) => Some(data),
|
||||
Err(err) => {
|
||||
use substreams_ethereum::Function;
|
||||
substreams::log::info!(
|
||||
"Call output for function `{}` failed to decode with error: {}",
|
||||
Self::NAME,
|
||||
err
|
||||
);
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
impl substreams_ethereum::Function for IsPoolFromFactory {
|
||||
const NAME: &'static str = "isPoolFromFactory";
|
||||
fn match_call(call: &substreams_ethereum::pb::eth::v2::Call) -> bool {
|
||||
Self::match_call(call)
|
||||
}
|
||||
fn decode(call: &substreams_ethereum::pb::eth::v2::Call) -> Result<Self, String> {
|
||||
Self::decode(call)
|
||||
}
|
||||
fn encode(&self) -> Vec<u8> {
|
||||
self.encode()
|
||||
}
|
||||
}
|
||||
impl substreams_ethereum::rpc::RPCDecodable<bool> for IsPoolFromFactory {
|
||||
fn output(data: &[u8]) -> Result<bool, String> {
|
||||
Self::output(data)
|
||||
}
|
||||
}
|
||||
}
|
||||
/// Contract's events.
|
||||
#[allow(dead_code, unused_imports, unused_variables)]
|
||||
pub mod events {
|
||||
use super::INTERNAL_ERR;
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct PoolCreated {
|
||||
pub pool: Vec<u8>,
|
||||
}
|
||||
impl PoolCreated {
|
||||
const TOPIC_ID: [u8; 32] = [
|
||||
131u8, 164u8, 143u8, 188u8, 252u8, 153u8, 19u8, 53u8, 49u8, 78u8, 116u8, 208u8, 73u8,
|
||||
106u8, 171u8, 106u8, 25u8, 135u8, 233u8, 146u8, 221u8, 200u8, 93u8, 221u8, 188u8,
|
||||
196u8, 214u8, 221u8, 110u8, 242u8, 233u8, 252u8,
|
||||
];
|
||||
pub fn match_log(log: &substreams_ethereum::pb::eth::v2::Log) -> bool {
|
||||
if log.topics.len() != 2usize {
|
||||
return false;
|
||||
}
|
||||
if log.data.len() != 0usize {
|
||||
return false;
|
||||
}
|
||||
return log
|
||||
.topics
|
||||
.get(0)
|
||||
.expect("bounds already checked")
|
||||
.as_ref()
|
||||
== Self::TOPIC_ID;
|
||||
}
|
||||
pub fn decode(log: &substreams_ethereum::pb::eth::v2::Log) -> Result<Self, String> {
|
||||
Ok(Self {
|
||||
pool: ethabi::decode(&[ethabi::ParamType::Address], log.topics[1usize].as_ref())
|
||||
.map_err(|e| {
|
||||
format!(
|
||||
"unable to decode param 'pool' from topic of type 'address': {:?}",
|
||||
e
|
||||
)
|
||||
})?
|
||||
.pop()
|
||||
.expect(INTERNAL_ERR)
|
||||
.into_address()
|
||||
.expect(INTERNAL_ERR)
|
||||
.as_bytes()
|
||||
.to_vec(),
|
||||
})
|
||||
}
|
||||
}
|
||||
impl substreams_ethereum::Event for PoolCreated {
|
||||
const NAME: &'static str = "PoolCreated";
|
||||
fn match_log(log: &substreams_ethereum::pb::eth::v2::Log) -> bool {
|
||||
Self::match_log(log)
|
||||
}
|
||||
fn decode(log: &substreams_ethereum::pb::eth::v2::Log) -> Result<Self, String> {
|
||||
Self::decode(log)
|
||||
}
|
||||
}
|
||||
}
|
||||
1446
substreams/ethereum-balancer-v2/src/abi/yearn_linear_pool_factory.rs
Normal file
1446
substreams/ethereum-balancer-v2/src/abi/yearn_linear_pool_factory.rs
Normal file
File diff suppressed because it is too large
Load Diff
3
substreams/ethereum-balancer-v2/src/lib.rs
Normal file
3
substreams/ethereum-balancer-v2/src/lib.rs
Normal file
@@ -0,0 +1,3 @@
|
||||
mod abi;
|
||||
mod modules;
|
||||
mod pool_factories;
|
||||
267
substreams/ethereum-balancer-v2/src/modules.rs
Normal file
267
substreams/ethereum-balancer-v2/src/modules.rs
Normal file
@@ -0,0 +1,267 @@
|
||||
use crate::{abi, pool_factories};
|
||||
use anyhow::Result;
|
||||
use itertools::Itertools;
|
||||
use std::collections::HashMap;
|
||||
use substreams::{
|
||||
hex,
|
||||
pb::substreams::StoreDeltas,
|
||||
store::{StoreAddBigInt, StoreGet, StoreGetString, StoreNew, StoreSet, StoreSetString},
|
||||
};
|
||||
use substreams_ethereum::{pb::eth, Event};
|
||||
use tycho_substreams::{
|
||||
balances::aggregate_balances_changes, contract::extract_contract_changes_builder, prelude::*,
|
||||
};
|
||||
|
||||
pub const VAULT_ADDRESS: &[u8] = &hex!("BA12222222228d8Ba445958a75a0704d566BF2C8");
|
||||
|
||||
#[substreams::handlers::map]
|
||||
pub fn map_components(block: eth::v2::Block) -> Result<BlockTransactionProtocolComponents> {
|
||||
// Gather contract changes by indexing `PoolCreated` events and analysing the `Create` call
|
||||
// We store these as a hashmap by tx hash since we need to agg by tx hash later
|
||||
Ok(BlockTransactionProtocolComponents {
|
||||
tx_components: block
|
||||
.transactions()
|
||||
.filter_map(|tx| {
|
||||
let components = tx
|
||||
.logs_with_calls()
|
||||
.filter_map(|(log, call)| {
|
||||
pool_factories::address_map(
|
||||
call.call.address.as_slice(),
|
||||
log,
|
||||
call.call,
|
||||
tx,
|
||||
)
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
if !components.is_empty() {
|
||||
Some(TransactionProtocolComponents { tx: Some(tx.into()), components })
|
||||
} else {
|
||||
None
|
||||
}
|
||||
})
|
||||
.collect::<Vec<_>>(),
|
||||
})
|
||||
}
|
||||
|
||||
/// Simply stores the `ProtocolComponent`s with the pool address as the key and the pool id as value
|
||||
#[substreams::handlers::store]
|
||||
pub fn store_components(map: BlockTransactionProtocolComponents, store: StoreSetString) {
|
||||
map.tx_components
|
||||
.into_iter()
|
||||
.for_each(|tx_pc| {
|
||||
tx_pc
|
||||
.components
|
||||
.into_iter()
|
||||
.for_each(|pc| store.set(0, format!("pool:{0}", &pc.id[..42]), &pc.id))
|
||||
});
|
||||
}
|
||||
|
||||
/// Since the `PoolBalanceChanged` and `Swap` events administer only deltas, we need to leverage a
|
||||
/// map and a store to be able to tally up final balances for tokens in a pool.
|
||||
#[substreams::handlers::map]
|
||||
pub fn map_relative_balances(
|
||||
block: eth::v2::Block,
|
||||
store: StoreGetString,
|
||||
) -> Result<BlockBalanceDeltas, anyhow::Error> {
|
||||
let balance_deltas = block
|
||||
.logs()
|
||||
.filter(|log| log.address() == VAULT_ADDRESS)
|
||||
.flat_map(|vault_log| {
|
||||
let mut deltas = Vec::new();
|
||||
|
||||
if let Some(ev) =
|
||||
abi::vault::events::PoolBalanceChanged::match_and_decode(vault_log.log)
|
||||
{
|
||||
let component_id = format!("0x{}", hex::encode(ev.pool_id));
|
||||
|
||||
if store
|
||||
.get_last(format!("pool:{}", &component_id[..42]))
|
||||
.is_some()
|
||||
{
|
||||
for (token, delta) in ev
|
||||
.tokens
|
||||
.iter()
|
||||
.zip(ev.deltas.iter())
|
||||
.filter(|(token, _)| **token != hex::decode(&component_id[2..42]).unwrap())
|
||||
{
|
||||
deltas.push(BalanceDelta {
|
||||
ord: vault_log.ordinal(),
|
||||
tx: Some(vault_log.receipt.transaction.into()),
|
||||
token: token.to_vec(),
|
||||
delta: delta.to_signed_bytes_be(),
|
||||
component_id: component_id.as_bytes().to_vec(),
|
||||
});
|
||||
}
|
||||
}
|
||||
} else if let Some(ev) = abi::vault::events::Swap::match_and_decode(vault_log.log) {
|
||||
let component_id = format!("0x{}", hex::encode(ev.pool_id));
|
||||
|
||||
if store
|
||||
.get_last(format!("pool:{}", &component_id[..42]))
|
||||
.is_some()
|
||||
{
|
||||
deltas.extend_from_slice(&[
|
||||
BalanceDelta {
|
||||
ord: vault_log.ordinal(),
|
||||
tx: Some(vault_log.receipt.transaction.into()),
|
||||
token: ev.token_in.to_vec(),
|
||||
delta: ev.amount_in.to_signed_bytes_be(),
|
||||
component_id: component_id.as_bytes().to_vec(),
|
||||
},
|
||||
BalanceDelta {
|
||||
ord: vault_log.ordinal(),
|
||||
tx: Some(vault_log.receipt.transaction.into()),
|
||||
token: ev.token_out.to_vec(),
|
||||
delta: ev.amount_out.neg().to_signed_bytes_be(),
|
||||
component_id: component_id.as_bytes().to_vec(),
|
||||
},
|
||||
]);
|
||||
}
|
||||
} else if let Some(ev) =
|
||||
abi::vault::events::PoolBalanceManaged::match_and_decode(vault_log.log)
|
||||
{
|
||||
let component_id = format!("0x{}", hex::encode(ev.pool_id));
|
||||
deltas.extend_from_slice(&[BalanceDelta {
|
||||
ord: vault_log.ordinal(),
|
||||
tx: Some(vault_log.receipt.transaction.into()),
|
||||
token: ev.token.to_vec(),
|
||||
delta: ev.cash_delta.to_signed_bytes_be(),
|
||||
component_id: component_id.as_bytes().to_vec(),
|
||||
}]);
|
||||
}
|
||||
|
||||
deltas
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
Ok(BlockBalanceDeltas { balance_deltas })
|
||||
}
|
||||
|
||||
/// It's significant to include both the `pool_id` and the `token_id` for each balance delta as the
|
||||
/// store key to ensure that there's a unique balance being tallied for each.
|
||||
#[substreams::handlers::store]
|
||||
pub fn store_balances(deltas: BlockBalanceDeltas, store: StoreAddBigInt) {
|
||||
tycho_substreams::balances::store_balance_changes(deltas, store);
|
||||
}
|
||||
|
||||
/// This is the main map that handles most of the indexing of this substream.
|
||||
/// Every contract change is grouped by transaction index via the `transaction_changes`
|
||||
/// map. Each block of code will extend the `TransactionChanges` struct with the
|
||||
/// cooresponding changes (balance, component, contract), inserting a new one if it doesn't exist.
|
||||
/// At the very end, the map can easily be sorted by index to ensure the final
|
||||
/// `BlockChanges` is ordered by transactions properly.
|
||||
#[substreams::handlers::map]
|
||||
pub fn map_protocol_changes(
|
||||
block: eth::v2::Block,
|
||||
grouped_components: BlockTransactionProtocolComponents,
|
||||
deltas: BlockBalanceDeltas,
|
||||
components_store: StoreGetString,
|
||||
balance_store: StoreDeltas, // Note, this map module is using the `deltas` mode for the store.
|
||||
) -> Result<BlockChanges> {
|
||||
// We merge contract changes by transaction (identified by transaction index) making it easy to
|
||||
// sort them at the very end.
|
||||
let mut transaction_changes: HashMap<_, TransactionChangesBuilder> = HashMap::new();
|
||||
|
||||
// `ProtocolComponents` are gathered from `map_pools_created` which just need a bit of work to
|
||||
// convert into `TransactionChanges`
|
||||
let default_attributes = vec![
|
||||
Attribute {
|
||||
name: "balance_owner".to_string(),
|
||||
value: VAULT_ADDRESS.to_vec(),
|
||||
change: ChangeType::Creation.into(),
|
||||
},
|
||||
Attribute {
|
||||
name: "update_marker".to_string(),
|
||||
value: vec![1u8],
|
||||
change: ChangeType::Creation.into(),
|
||||
},
|
||||
];
|
||||
grouped_components
|
||||
.tx_components
|
||||
.iter()
|
||||
.for_each(|tx_component| {
|
||||
// initialise builder if not yet present for this tx
|
||||
let tx = tx_component.tx.as_ref().unwrap();
|
||||
let builder = transaction_changes
|
||||
.entry(tx.index)
|
||||
.or_insert_with(|| TransactionChangesBuilder::new(tx));
|
||||
|
||||
// iterate over individual components created within this tx
|
||||
tx_component
|
||||
.components
|
||||
.iter()
|
||||
.for_each(|component| {
|
||||
builder.add_protocol_component(component);
|
||||
let entity_change = EntityChanges {
|
||||
component_id: component.id.clone(),
|
||||
attributes: default_attributes.clone(),
|
||||
};
|
||||
builder.add_entity_change(&entity_change)
|
||||
});
|
||||
});
|
||||
|
||||
// Balance changes are gathered by the `StoreDelta` based on `PoolBalanceChanged` creating
|
||||
// `BlockBalanceDeltas`. We essentially just process the changes that occurred to the `store`
|
||||
// this block. Then, these balance changes are merged onto the existing map of tx contract
|
||||
// changes, inserting a new one if it doesn't exist.
|
||||
aggregate_balances_changes(balance_store, deltas)
|
||||
.into_iter()
|
||||
.for_each(|(_, (tx, balances))| {
|
||||
let builder = transaction_changes
|
||||
.entry(tx.index)
|
||||
.or_insert_with(|| TransactionChangesBuilder::new(&tx));
|
||||
balances
|
||||
.values()
|
||||
.for_each(|token_bc_map| {
|
||||
token_bc_map
|
||||
.values()
|
||||
.for_each(|bc| builder.add_balance_change(bc))
|
||||
});
|
||||
});
|
||||
|
||||
// Extract and insert any storage changes that happened for any of the components.
|
||||
extract_contract_changes_builder(
|
||||
&block,
|
||||
|addr| {
|
||||
components_store
|
||||
.get_last(format!("pool:0x{0}", hex::encode(addr)))
|
||||
.is_some() ||
|
||||
addr.eq(VAULT_ADDRESS)
|
||||
},
|
||||
&mut transaction_changes,
|
||||
);
|
||||
|
||||
transaction_changes
|
||||
.iter_mut()
|
||||
.for_each(|(_, change)| {
|
||||
// this indirection is necessary due to borrowing rules.
|
||||
let addresses = change
|
||||
.changed_contracts()
|
||||
.map(|e| e.to_vec())
|
||||
.collect::<Vec<_>>();
|
||||
addresses
|
||||
.into_iter()
|
||||
.for_each(|address| {
|
||||
if address != VAULT_ADDRESS {
|
||||
// We reconstruct the component_id from the address here
|
||||
let id = components_store
|
||||
.get_last(format!("pool:0x{}", hex::encode(address)))
|
||||
.unwrap(); // Shouldn't happen because we filter by known components in
|
||||
// `extract_contract_changes_builder`
|
||||
change.mark_component_as_updated(&id);
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
// Process all `transaction_changes` for final output in the `BlockChanges`,
|
||||
// sorted by transaction index (the key).
|
||||
Ok(BlockChanges {
|
||||
block: Some((&block).into()),
|
||||
changes: transaction_changes
|
||||
.drain()
|
||||
.sorted_unstable_by_key(|(index, _)| *index)
|
||||
.filter_map(|(_, builder)| builder.build())
|
||||
.collect::<Vec<_>>(),
|
||||
})
|
||||
}
|
||||
437
substreams/ethereum-balancer-v2/src/pool_factories.rs
Normal file
437
substreams/ethereum-balancer-v2/src/pool_factories.rs
Normal file
@@ -0,0 +1,437 @@
|
||||
use crate::{abi, modules::VAULT_ADDRESS};
|
||||
use substreams::hex;
|
||||
use substreams_ethereum::{
|
||||
pb::eth::v2::{Call, Log, TransactionTrace},
|
||||
Event, Function,
|
||||
};
|
||||
use tycho_substreams::{
|
||||
attributes::{json_serialize_address_list, json_serialize_bigint_list},
|
||||
prelude::*,
|
||||
};
|
||||
|
||||
/// Helper function to get pool_registered event
|
||||
fn get_pool_registered(
|
||||
tx: &TransactionTrace,
|
||||
pool_address: &Vec<u8>,
|
||||
) -> abi::vault::events::PoolRegistered {
|
||||
tx.logs_with_calls()
|
||||
.filter(|(log, _)| log.address == VAULT_ADDRESS)
|
||||
.filter_map(|(log, _)| abi::vault::events::PoolRegistered::match_and_decode(log))
|
||||
.find(|pool| pool.pool_address == *pool_address)
|
||||
.unwrap()
|
||||
.clone()
|
||||
}
|
||||
|
||||
fn get_token_registered(
|
||||
tx: &TransactionTrace,
|
||||
pool_id: &[u8],
|
||||
) -> abi::vault::events::TokensRegistered {
|
||||
tx.logs_with_calls()
|
||||
.filter(|(log, _)| log.address == VAULT_ADDRESS)
|
||||
.filter_map(|(log, _)| abi::vault::events::TokensRegistered::match_and_decode(log))
|
||||
.find(|ev| ev.pool_id == pool_id)
|
||||
.unwrap()
|
||||
.clone()
|
||||
}
|
||||
|
||||
// This is the main function that handles the creation of `ProtocolComponent`s with `Attribute`s
|
||||
// based on the specific factory address. There's 3 factory groups that are represented here:
|
||||
// - Weighted Pool Factories
|
||||
// - Linear Pool Factories
|
||||
// - Stable Pool Factories
|
||||
// (Balancer does have a bit more (esp. in the deprecated section) that could be implemented as
|
||||
// desired.)
|
||||
// We use the specific ABIs to decode both the log event and corresponding call to gather
|
||||
// `PoolCreated` event information alongside the `Create` call data that provide us details to
|
||||
// fulfill both the required details + any extra `Attributes`
|
||||
// Ref: https://docs.balancer.fi/reference/contracts/deployment-addresses/mainnet.html
|
||||
pub fn address_map(
|
||||
pool_factory_address: &[u8],
|
||||
log: &Log,
|
||||
call: &Call,
|
||||
tx: &TransactionTrace,
|
||||
) -> Option<ProtocolComponent> {
|
||||
match *pool_factory_address {
|
||||
hex!("8E9aa87E45e92bad84D5F8DD1bff34Fb92637dE9") => {
|
||||
let create_call =
|
||||
abi::weighted_pool_factory_v1::functions::Create::match_and_decode(call)?;
|
||||
let pool_created =
|
||||
abi::weighted_pool_factory_v1::events::PoolCreated::match_and_decode(log)?;
|
||||
let pool_registered = get_pool_registered(tx, &pool_created.pool);
|
||||
|
||||
Some(
|
||||
ProtocolComponent::new(
|
||||
&format!("0x{}", hex::encode(pool_registered.pool_id)),
|
||||
&(tx.into()),
|
||||
)
|
||||
.with_contracts(&[pool_created.pool, VAULT_ADDRESS.to_vec()])
|
||||
.with_tokens(&create_call.tokens)
|
||||
.with_attributes(&[
|
||||
("pool_type", "WeightedPoolFactoryV1".as_bytes()),
|
||||
("normalized_weights", &json_serialize_bigint_list(&create_call.weights)),
|
||||
(
|
||||
"fee",
|
||||
&create_call
|
||||
.swap_fee_percentage
|
||||
.to_signed_bytes_be(),
|
||||
),
|
||||
("manual_updates", &[1u8]),
|
||||
])
|
||||
.as_swap_type("balancer_v2_pool", ImplementationType::Vm),
|
||||
)
|
||||
}
|
||||
hex!("cC508a455F5b0073973107Db6a878DdBDab957bC") => {
|
||||
let create_call =
|
||||
abi::weighted_pool_factory_v2::functions::Create::match_and_decode(call)?;
|
||||
let pool_created =
|
||||
abi::weighted_pool_factory_v2::events::PoolCreated::match_and_decode(log)?;
|
||||
let pool_registered = get_pool_registered(tx, &pool_created.pool);
|
||||
|
||||
Some(
|
||||
ProtocolComponent::new(
|
||||
&format!("0x{}", hex::encode(pool_registered.pool_id)),
|
||||
&(tx.into()),
|
||||
)
|
||||
.with_contracts(&[pool_created.pool, VAULT_ADDRESS.to_vec()])
|
||||
.with_tokens(&create_call.tokens)
|
||||
.with_attributes(&[
|
||||
("pool_type", "WeightedPoolFactoryV2".as_bytes()),
|
||||
(
|
||||
"normalized_weights",
|
||||
&json_serialize_bigint_list(&create_call.normalized_weights),
|
||||
),
|
||||
("rate_providers", &json_serialize_address_list(&create_call.rate_providers)),
|
||||
(
|
||||
"fee",
|
||||
&create_call
|
||||
.swap_fee_percentage
|
||||
.to_signed_bytes_be(),
|
||||
),
|
||||
("manual_updates", &[1u8]),
|
||||
])
|
||||
.as_swap_type("balancer_v2_pool", ImplementationType::Vm),
|
||||
)
|
||||
}
|
||||
hex!("5Dd94Da3644DDD055fcf6B3E1aa310Bb7801EB8b") => {
|
||||
let create_call =
|
||||
abi::weighted_pool_factory_v3::functions::Create::match_and_decode(call)?;
|
||||
let pool_created =
|
||||
abi::weighted_pool_factory_v3::events::PoolCreated::match_and_decode(log)?;
|
||||
let pool_registered = get_pool_registered(tx, &pool_created.pool);
|
||||
|
||||
Some(
|
||||
ProtocolComponent::new(
|
||||
&format!("0x{}", hex::encode(pool_registered.pool_id)),
|
||||
&(tx.into()),
|
||||
)
|
||||
.with_contracts(&[pool_created.pool, VAULT_ADDRESS.to_vec()])
|
||||
.with_tokens(&create_call.tokens)
|
||||
.with_attributes(&[
|
||||
("pool_type", "WeightedPoolFactoryV3".as_bytes()),
|
||||
(
|
||||
"normalized_weights",
|
||||
&json_serialize_bigint_list(&create_call.normalized_weights),
|
||||
),
|
||||
("rate_providers", &json_serialize_address_list(&create_call.rate_providers)),
|
||||
(
|
||||
"fee",
|
||||
&create_call
|
||||
.swap_fee_percentage
|
||||
.to_signed_bytes_be(),
|
||||
),
|
||||
("manual_updates", &[1u8]),
|
||||
])
|
||||
.as_swap_type("balancer_v2_pool", ImplementationType::Vm),
|
||||
)
|
||||
}
|
||||
hex!("897888115Ada5773E02aA29F775430BFB5F34c51") => {
|
||||
let create_call =
|
||||
abi::weighted_pool_factory_v4::functions::Create::match_and_decode(call)?;
|
||||
let pool_created =
|
||||
abi::weighted_pool_factory_v4::events::PoolCreated::match_and_decode(log)?;
|
||||
let pool_registered = get_pool_registered(tx, &pool_created.pool);
|
||||
|
||||
Some(
|
||||
ProtocolComponent::new(
|
||||
&format!("0x{}", hex::encode(pool_registered.pool_id)),
|
||||
&(tx.into()),
|
||||
)
|
||||
.with_contracts(&[pool_created.pool, VAULT_ADDRESS.to_vec()])
|
||||
.with_tokens(&create_call.tokens)
|
||||
.with_attributes(&[
|
||||
("pool_type", "WeightedPoolFactoryV4".as_bytes()),
|
||||
(
|
||||
"normalized_weights",
|
||||
&json_serialize_bigint_list(&create_call.normalized_weights),
|
||||
),
|
||||
("rate_providers", &json_serialize_address_list(&create_call.rate_providers)),
|
||||
(
|
||||
"fee",
|
||||
&create_call
|
||||
.swap_fee_percentage
|
||||
.to_signed_bytes_be(),
|
||||
),
|
||||
("manual_updates", &[1u8]),
|
||||
])
|
||||
.as_swap_type("balancer_v2_pool", ImplementationType::Vm),
|
||||
)
|
||||
}
|
||||
hex!("DB8d758BCb971e482B2C45f7F8a7740283A1bd3A") => {
|
||||
let create_call =
|
||||
abi::composable_stable_pool_factory::functions::Create::match_and_decode(call)?;
|
||||
let pool_created =
|
||||
abi::composable_stable_pool_factory::events::PoolCreated::match_and_decode(log)?;
|
||||
let pool_registered = get_pool_registered(tx, &pool_created.pool);
|
||||
let tokens_registered = get_token_registered(tx, &pool_registered.pool_id);
|
||||
|
||||
Some(
|
||||
ProtocolComponent::new(
|
||||
&format!("0x{}", hex::encode(pool_registered.pool_id)),
|
||||
&(tx.into()),
|
||||
)
|
||||
.with_contracts(&[pool_created.pool.clone(), VAULT_ADDRESS.to_vec()])
|
||||
.with_tokens(&tokens_registered.tokens)
|
||||
.with_attributes(&[
|
||||
("pool_type", "ComposableStablePoolFactory".as_bytes()),
|
||||
("bpt", &pool_created.pool),
|
||||
(
|
||||
"fee",
|
||||
&create_call
|
||||
.swap_fee_percentage
|
||||
.to_signed_bytes_be(),
|
||||
),
|
||||
("rate_providers", &json_serialize_address_list(&create_call.rate_providers)),
|
||||
("manual_updates", &[1u8]),
|
||||
])
|
||||
.as_swap_type("balancer_v2_pool", ImplementationType::Vm),
|
||||
)
|
||||
}
|
||||
hex!("813EE7a840CE909E7Fea2117A44a90b8063bd4fd") => {
|
||||
let create_call =
|
||||
abi::erc_linear_pool_factory::functions::Create::match_and_decode(call)?;
|
||||
let pool_created =
|
||||
abi::erc_linear_pool_factory::events::PoolCreated::match_and_decode(log)?;
|
||||
let pool_registered = get_pool_registered(tx, &pool_created.pool);
|
||||
let tokens_registered = get_token_registered(tx, &pool_registered.pool_id);
|
||||
|
||||
Some(
|
||||
ProtocolComponent::new(
|
||||
&format!("0x{}", hex::encode(pool_registered.pool_id)),
|
||||
&(tx.into()),
|
||||
)
|
||||
.with_contracts(&[pool_created.pool.clone(), VAULT_ADDRESS.to_vec()])
|
||||
.with_tokens(&tokens_registered.tokens)
|
||||
.with_attributes(&[
|
||||
("pool_type", "ERC4626LinearPoolFactory".as_bytes()),
|
||||
(
|
||||
"upper_target",
|
||||
&create_call
|
||||
.upper_target
|
||||
.to_signed_bytes_be(),
|
||||
),
|
||||
("manual_updates", &[1u8]),
|
||||
("bpt", &pool_created.pool),
|
||||
("main_token", &create_call.main_token),
|
||||
("wrapped_token", &create_call.wrapped_token),
|
||||
(
|
||||
"fee",
|
||||
&create_call
|
||||
.swap_fee_percentage
|
||||
.to_signed_bytes_be(),
|
||||
),
|
||||
])
|
||||
.as_swap_type("balancer_v2_pool", ImplementationType::Vm),
|
||||
)
|
||||
}
|
||||
hex!("5F43FBa61f63Fa6bFF101a0A0458cEA917f6B347") => {
|
||||
let create_call =
|
||||
abi::euler_linear_pool_factory::functions::Create::match_and_decode(call)?;
|
||||
let pool_created =
|
||||
abi::euler_linear_pool_factory::events::PoolCreated::match_and_decode(log)?;
|
||||
let pool_registered = get_pool_registered(tx, &pool_created.pool);
|
||||
let tokens_registered = get_token_registered(tx, &pool_registered.pool_id);
|
||||
|
||||
Some(
|
||||
ProtocolComponent::new(
|
||||
&format!("0x{}", hex::encode(pool_registered.pool_id)),
|
||||
&(tx.into()),
|
||||
)
|
||||
.with_contracts(&[pool_created.pool.clone(), VAULT_ADDRESS.to_vec()])
|
||||
.with_tokens(&tokens_registered.tokens)
|
||||
.with_attributes(&[
|
||||
("pool_type", "EulerLinearPoolFactory".as_bytes()),
|
||||
(
|
||||
"upper_target",
|
||||
&create_call
|
||||
.upper_target
|
||||
.to_signed_bytes_be(),
|
||||
),
|
||||
("manual_updates", &[1u8]),
|
||||
("bpt", &pool_created.pool),
|
||||
("main_token", &create_call.main_token),
|
||||
("wrapped_token", &create_call.wrapped_token),
|
||||
(
|
||||
"fee",
|
||||
&create_call
|
||||
.swap_fee_percentage
|
||||
.to_signed_bytes_be(),
|
||||
),
|
||||
])
|
||||
.as_swap_type("balancer_v2_pool", ImplementationType::Vm),
|
||||
)
|
||||
}
|
||||
// ❌ Reading the deployed factory for Gearbox showcases that it's currently disabled
|
||||
// hex!("39A79EB449Fc05C92c39aA6f0e9BfaC03BE8dE5B") => {
|
||||
// let create_call =
|
||||
// abi::gearbox_linear_pool_factory::functions::Create::match_and_decode(call)?;
|
||||
// let pool_created =
|
||||
// abi::gearbox_linear_pool_factory::events::PoolCreated::match_and_decode(log)?;
|
||||
|
||||
// Some(tycho::ProtocolComponent {
|
||||
// id: hex::encode(&pool_created.pool),
|
||||
// tokens: vec![create_call.main_token, create_call.wrapped_token],
|
||||
// contracts: vec![pool_addr.into(), pool_created.pool],
|
||||
// static_att: vec![
|
||||
// tycho::Attribute {
|
||||
// name: "pool_type".into(),
|
||||
// value: "GearboxLinearPoolFactory".into(),
|
||||
// change: tycho::ChangeType::Creation.into(),
|
||||
// },
|
||||
// tycho::Attribute {
|
||||
// name: "upper_target".into(),
|
||||
// value: create_call.upper_target.to_signed_bytes_be(),
|
||||
// change: tycho::ChangeType::Creation.into(),
|
||||
// },
|
||||
// ],
|
||||
// change: tycho::ChangeType::Creation.into(),
|
||||
// })
|
||||
// }
|
||||
// ❌ The `ManagedPoolFactory` is a bit ✨ unique ✨, so we'll leave it commented out for
|
||||
// now Take a look at it's `Create` call to see how the params are structured.
|
||||
// hex!("BF904F9F340745B4f0c4702c7B6Ab1e808eA6b93") => {
|
||||
// let create_call =
|
||||
// abi::managed_pool_factory::functions::Create::match_and_decode(call)?;
|
||||
// let pool_created =
|
||||
// abi::managed_pool_factory::events::PoolCreated::match_and_decode(log)?;
|
||||
|
||||
// Some(tycho::ProtocolComponent {
|
||||
// id: hex::encode(&pool_created.pool),
|
||||
// tokens: create_call.tokens,
|
||||
// contracts: vec![pool_addr.into(), pool_created.pool],
|
||||
// static_att: vec![
|
||||
// tycho::Attribute {
|
||||
// name: "pool_type".into(),
|
||||
// value: "ManagedPoolFactory".into(),
|
||||
// change: tycho::ChangeType::Creation.into(),
|
||||
// },
|
||||
// ],
|
||||
// change: tycho::ChangeType::Creation.into(),
|
||||
// })
|
||||
// }
|
||||
hex!("4E11AEec21baF1660b1a46472963cB3DA7811C89") => {
|
||||
let create_call =
|
||||
abi::silo_linear_pool_factory::functions::Create::match_and_decode(call)?;
|
||||
let pool_created =
|
||||
abi::silo_linear_pool_factory::events::PoolCreated::match_and_decode(log)?;
|
||||
let pool_registered = get_pool_registered(tx, &pool_created.pool);
|
||||
let tokens_registered = get_token_registered(tx, &pool_registered.pool_id);
|
||||
|
||||
Some(
|
||||
ProtocolComponent::new(
|
||||
&format!("0x{}", hex::encode(pool_registered.pool_id)),
|
||||
&(tx.into()),
|
||||
)
|
||||
.with_contracts(&[pool_created.pool.clone(), VAULT_ADDRESS.to_vec()])
|
||||
.with_tokens(&tokens_registered.tokens)
|
||||
.with_attributes(&[
|
||||
("pool_type", "SiloLinearPoolFactory".as_bytes()),
|
||||
(
|
||||
"upper_target",
|
||||
&create_call
|
||||
.upper_target
|
||||
.to_signed_bytes_be(),
|
||||
),
|
||||
("manual_updates", &[1u8]),
|
||||
("bpt", &pool_created.pool),
|
||||
("main_token", &create_call.main_token),
|
||||
("wrapped_token", &create_call.wrapped_token),
|
||||
(
|
||||
"fee",
|
||||
&create_call
|
||||
.swap_fee_percentage
|
||||
.to_signed_bytes_be(),
|
||||
),
|
||||
])
|
||||
.as_swap_type("balancer_v2_pool", ImplementationType::Vm),
|
||||
)
|
||||
}
|
||||
hex!("5F5222Ffa40F2AEd6380D022184D6ea67C776eE0") => {
|
||||
let create_call =
|
||||
abi::yearn_linear_pool_factory::functions::Create::match_and_decode(call)?;
|
||||
let pool_created =
|
||||
abi::yearn_linear_pool_factory::events::PoolCreated::match_and_decode(log)?;
|
||||
let pool_registered = get_pool_registered(tx, &pool_created.pool);
|
||||
let tokens_registered = get_token_registered(tx, &pool_registered.pool_id);
|
||||
|
||||
Some(
|
||||
ProtocolComponent::new(
|
||||
&format!("0x{}", hex::encode(pool_registered.pool_id)),
|
||||
&(tx.into()),
|
||||
)
|
||||
.with_contracts(&[pool_created.pool.clone(), VAULT_ADDRESS.to_vec()])
|
||||
.with_tokens(&tokens_registered.tokens)
|
||||
.with_attributes(&[
|
||||
("pool_type", "YearnLinearPoolFactory".as_bytes()),
|
||||
(
|
||||
"upper_target",
|
||||
&create_call
|
||||
.upper_target
|
||||
.to_signed_bytes_be(),
|
||||
),
|
||||
("manual_updates", &[1u8]),
|
||||
("bpt", &pool_created.pool),
|
||||
("main_token", &create_call.main_token),
|
||||
("wrapped_token", &create_call.wrapped_token),
|
||||
(
|
||||
"fee",
|
||||
&create_call
|
||||
.swap_fee_percentage
|
||||
.to_signed_bytes_be(),
|
||||
),
|
||||
])
|
||||
.as_swap_type("balancer_v2_pool", ImplementationType::Vm),
|
||||
)
|
||||
}
|
||||
// The `WeightedPool2TokenFactory` is a deprecated contract, but we've included
|
||||
// it to be able to track one of the highest TVL pools: 80BAL-20WETH.
|
||||
hex!("A5bf2ddF098bb0Ef6d120C98217dD6B141c74EE0") => {
|
||||
let create_call =
|
||||
abi::weighted_pool_tokens_factory::functions::Create::match_and_decode(call)?;
|
||||
let pool_created =
|
||||
abi::weighted_pool_tokens_factory::events::PoolCreated::match_and_decode(log)?;
|
||||
let pool_registered = get_pool_registered(tx, &pool_created.pool);
|
||||
|
||||
Some(
|
||||
ProtocolComponent::new(
|
||||
&format!("0x{}", hex::encode(pool_registered.pool_id)),
|
||||
&(tx.into()),
|
||||
)
|
||||
.with_contracts(&[pool_created.pool, VAULT_ADDRESS.to_vec()])
|
||||
.with_tokens(&create_call.tokens)
|
||||
.with_attributes(&[
|
||||
("pool_type", "WeightedPool2TokensFactory".as_bytes()),
|
||||
("weights", &json_serialize_bigint_list(&create_call.weights)),
|
||||
(
|
||||
"fee",
|
||||
&create_call
|
||||
.swap_fee_percentage
|
||||
.to_signed_bytes_be(),
|
||||
),
|
||||
("manual_updates", &[1u8]),
|
||||
])
|
||||
.as_swap_type("balancer_v2_pool", ImplementationType::Vm),
|
||||
)
|
||||
}
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
64
substreams/ethereum-balancer-v2/substreams.yaml
Normal file
64
substreams/ethereum-balancer-v2/substreams.yaml
Normal file
@@ -0,0 +1,64 @@
|
||||
specVersion: v0.1.0
|
||||
package:
|
||||
name: "ethereum_balancer_v2"
|
||||
version: v0.2.3
|
||||
|
||||
protobuf:
|
||||
files:
|
||||
- tycho/evm/v1/vm.proto
|
||||
- tycho/evm/v1/common.proto
|
||||
- tycho/evm/v1/utils.proto
|
||||
importPaths:
|
||||
- ../../proto
|
||||
|
||||
binaries:
|
||||
default:
|
||||
type: wasm/rust-v1
|
||||
file: ../target/wasm32-unknown-unknown/release/ethereum_balancer_v2.wasm
|
||||
|
||||
modules:
|
||||
- name: map_components
|
||||
kind: map
|
||||
initialBlock: 12272146
|
||||
inputs:
|
||||
- source: sf.ethereum.type.v2.Block
|
||||
output:
|
||||
type: proto:tycho.evm.v1.BlockTransactionProtocolComponents
|
||||
|
||||
- name: store_components
|
||||
kind: store
|
||||
initialBlock: 12272146
|
||||
updatePolicy: set
|
||||
valueType: string
|
||||
inputs:
|
||||
- map: map_components
|
||||
|
||||
- name: map_relative_balances
|
||||
kind: map
|
||||
initialBlock: 12272146
|
||||
inputs:
|
||||
- source: sf.ethereum.type.v2.Block
|
||||
- store: store_components
|
||||
output:
|
||||
type: proto:tycho.evm.v1.BlockBalanceDeltas
|
||||
|
||||
- name: store_balances
|
||||
kind: store
|
||||
initialBlock: 12272146
|
||||
updatePolicy: add
|
||||
valueType: bigint
|
||||
inputs:
|
||||
- map: map_relative_balances
|
||||
|
||||
- name: map_protocol_changes
|
||||
kind: map
|
||||
initialBlock: 12272146
|
||||
inputs:
|
||||
- source: sf.ethereum.type.v2.Block
|
||||
- map: map_components
|
||||
- map: map_relative_balances
|
||||
- store: store_components
|
||||
- store: store_balances
|
||||
mode: deltas # This is the key property that simplifies `BalanceChange` handling
|
||||
output:
|
||||
type: proto:tycho.evm.v1.BlockChanges
|
||||
Reference in New Issue
Block a user