feat: ethereum-balancer implementation
This commit is contained in:
BIN
substreams/ethereum-balancer/.DS_Store
vendored
Normal file
BIN
substreams/ethereum-balancer/.DS_Store
vendored
Normal file
Binary file not shown.
1269
substreams/ethereum-balancer/Cargo.lock
generated
Normal file
1269
substreams/ethereum-balancer/Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
29
substreams/ethereum-balancer/Cargo.toml
Normal file
29
substreams/ethereum-balancer/Cargo.toml
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
[package]
|
||||||
|
name = "substreams-balancer"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
[lib]
|
||||||
|
name = "substreams_balancer"
|
||||||
|
crate-type = ["cdylib"]
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
substreams = "0.5"
|
||||||
|
substreams-ethereum = "0.9.9"
|
||||||
|
prost = "0.11"
|
||||||
|
hex-literal = "0.4.1"
|
||||||
|
ethabi = "18.0.0"
|
||||||
|
hex = "0.4.2"
|
||||||
|
bytes = "1.5.0"
|
||||||
|
anyhow = "1.0.75"
|
||||||
|
prost-types = "0.12.3"
|
||||||
|
num-bigint = "0.4.4"
|
||||||
|
itertools = "0.12.0"
|
||||||
|
|
||||||
|
[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"] }
|
||||||
9
substreams/ethereum-balancer/abi/README.md
Normal file
9
substreams/ethereum-balancer/abi/README.md
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
# 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.
|
||||||
@@ -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/abi/erc_linear_pool_factory.json
Normal file
325
substreams/ethereum-balancer/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"
|
||||||
|
}
|
||||||
|
]
|
||||||
338
substreams/ethereum-balancer/abi/euler_linear_pool_factory.json
Normal file
338
substreams/ethereum-balancer/abi/euler_linear_pool_factory.json
Normal file
@@ -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"
|
||||||
|
}
|
||||||
|
]
|
||||||
54
substreams/ethereum-balancer/abi/get_abis.py
Normal file
54
substreams/ethereum-balancer/abi/get_abis.py
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
import json
|
||||||
|
import os
|
||||||
|
import re
|
||||||
|
import time
|
||||||
|
|
||||||
|
import requests
|
||||||
|
|
||||||
|
# Exports contract ABI in JSON
|
||||||
|
|
||||||
|
abis = {
|
||||||
|
"WeightedPoolFactory (v4)": "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]*", name)).lower()
|
||||||
|
print(f"Getting ABI for {name} at {addr} ({normalized_name})")
|
||||||
|
|
||||||
|
try:
|
||||||
|
...
|
||||||
|
response = requests.get(ABI_ENDPOINT.format(address=addr))
|
||||||
|
response_json = response.json()
|
||||||
|
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/abi/managed_pool_factory.json
Normal file
353
substreams/ethereum-balancer/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"
|
||||||
|
}
|
||||||
|
]
|
||||||
325
substreams/ethereum-balancer/abi/silo_linear_pool_factory.json
Normal file
325
substreams/ethereum-balancer/abi/silo_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": [],
|
||||||
|
"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/abi/vault.json
Normal file
1179
substreams/ethereum-balancer/abi/vault.json
Normal file
File diff suppressed because it is too large
Load Diff
273
substreams/ethereum-balancer/abi/weighted_pool_factory.json
Normal file
273
substreams/ethereum-balancer/abi/weighted_pool_factory.json
Normal file
@@ -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"
|
||||||
|
}
|
||||||
|
]
|
||||||
325
substreams/ethereum-balancer/abi/yearn_linear_pool_factory.json
Normal file
325
substreams/ethereum-balancer/abi/yearn_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": [],
|
||||||
|
"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/buf.gen.yaml
Normal file
12
substreams/ethereum-balancer/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
|
||||||
43
substreams/ethereum-balancer/build.rs
Normal file
43
substreams/ethereum-balancer/build.rs
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
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();
|
||||||
|
|
||||||
|
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(())
|
||||||
|
}
|
||||||
19
substreams/ethereum-balancer/proto/factory.proto
Normal file
19
substreams/ethereum-balancer/proto/factory.proto
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
package eth.factory.v1;
|
||||||
|
|
||||||
|
message Pools {
|
||||||
|
repeated Pool pools = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Pool {
|
||||||
|
bytes pool_id = 1;
|
||||||
|
fixed64 log_ordinal = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Transfer {
|
||||||
|
bytes from = 1;
|
||||||
|
bytes to = 2;
|
||||||
|
string token = 3;
|
||||||
|
string amount = 4;
|
||||||
|
}
|
||||||
15
substreams/ethereum-balancer/proto/pool.proto
Normal file
15
substreams/ethereum-balancer/proto/pool.proto
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
package eth.pool.v1;
|
||||||
|
|
||||||
|
message Transfers {
|
||||||
|
repeated Transfer transfers = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Transfer {
|
||||||
|
string from = 1;
|
||||||
|
string to = 2;
|
||||||
|
uint64 token_id = 3;
|
||||||
|
string trx_hash = 4;
|
||||||
|
uint64 ordinal = 5;
|
||||||
|
}
|
||||||
108
substreams/ethereum-balancer/proto/tycho/evm/v1/common.proto
Normal file
108
substreams/ethereum-balancer/proto/tycho/evm/v1/common.proto
Normal file
@@ -0,0 +1,108 @@
|
|||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
package tycho.evm.v1;
|
||||||
|
|
||||||
|
// This file contains the proto definitions for Substreams common to all integrations.
|
||||||
|
|
||||||
|
// A struct describing a block.
|
||||||
|
message Block {
|
||||||
|
// The blocks hash.
|
||||||
|
bytes hash = 1;
|
||||||
|
// The parent blocks hash.
|
||||||
|
bytes parent_hash = 2;
|
||||||
|
// The block number.
|
||||||
|
uint64 number = 3;
|
||||||
|
// The block timestamp.
|
||||||
|
uint64 ts = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
// A struct describing a transaction.
|
||||||
|
message Transaction {
|
||||||
|
// The transaction hash.
|
||||||
|
bytes hash = 1;
|
||||||
|
// The sender of the transaction.
|
||||||
|
bytes from = 2;
|
||||||
|
// The receiver of the transaction.
|
||||||
|
bytes to = 3;
|
||||||
|
// The transactions index within the block.
|
||||||
|
// TODO: should this be uint32? to match the type from the native substream type?
|
||||||
|
uint64 index = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Enum to specify the type of a change.
|
||||||
|
enum ChangeType {
|
||||||
|
CHANGE_TYPE_UNSPECIFIED = 0;
|
||||||
|
CHANGE_TYPE_UPDATE = 1;
|
||||||
|
CHANGE_TYPE_CREATION = 2;
|
||||||
|
CHANGE_TYPE_DELETION = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
// A custom struct representing an arbitrary attribute of a protocol component.
|
||||||
|
// This is mainly used by the native integration to track the necessary information about the protocol.
|
||||||
|
message Attribute {
|
||||||
|
// The name of the attribute.
|
||||||
|
string name = 1;
|
||||||
|
// The value of the attribute.
|
||||||
|
bytes value = 2;
|
||||||
|
// The type of change the attribute underwent.
|
||||||
|
ChangeType change = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
// A struct describing a part of the protocol.
|
||||||
|
// Note: For example this can be a UniswapV2 pair, that tracks the two ERC20 tokens used by the pair,
|
||||||
|
// the component would represent a single contract. In case of VM integration, such component would
|
||||||
|
// not need any attributes, because all the relevant info would be tracked via storage slots and balance changes.
|
||||||
|
// It can also be a wrapping contract, like WETH, that has a constant price, but it allows swapping tokens.
|
||||||
|
// This is why the name ProtocolComponent is used instead of "Pool" or "Pair".
|
||||||
|
message ProtocolComponent {
|
||||||
|
// A unique identifier for the component within the protocol.
|
||||||
|
// Can be e.g. a stringified address or a string describing the trading pair.
|
||||||
|
string id = 1;
|
||||||
|
// Addresses of the ERC20 tokens used by the component.
|
||||||
|
repeated bytes tokens = 2;
|
||||||
|
// Addresses of the contracts used by the component.
|
||||||
|
// Usually it is a single contract, but some protocols use multiple contracts.
|
||||||
|
repeated bytes contracts = 3;
|
||||||
|
// Attributes of the component. Used mainly be the native integration.
|
||||||
|
// The inner ChangeType of the attribute has to match the ChangeType of the ProtocolComponent.
|
||||||
|
repeated Attribute static_att = 4;
|
||||||
|
// Type of change the component underwent.
|
||||||
|
ChangeType change = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ProtocolComponents {
|
||||||
|
repeated ProtocolComponent components = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// A struct for following the changes of Total Value Locked (TVL) of a protocol component.
|
||||||
|
// Note that if a ProtocolComponent contains multiple contracts, the TVL is tracked for the component as a whole.
|
||||||
|
// E.g. for UniswapV2 pair WETH/USDC, this tracks the USDC and WETH balance of the pair contract.
|
||||||
|
message BalanceChange {
|
||||||
|
// The address of the ERC20 token whose balance changed.
|
||||||
|
bytes token = 1;
|
||||||
|
// The new balance of the token.
|
||||||
|
bytes balance = 2;
|
||||||
|
// The id of the component whose TVL is tracked.
|
||||||
|
// If the protocol component includes multiple contracts, the balance change must be aggregated to reflect how much tokens can be traded.
|
||||||
|
bytes component_id = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
// A struct for following the changes of Total Value Locked (TVL) of a protocol component.
|
||||||
|
// Note that if a ProtocolComponent contains multiple contracts, the TVL is tracked for the component as a whole.
|
||||||
|
// E.g. for UniswapV2 pair WETH/USDC, this tracks the USDC and WETH balance of the pair contract.
|
||||||
|
message BalanceDelta {
|
||||||
|
uint64 ord = 1;
|
||||||
|
// The tx hash of the transaction that caused the balance change.
|
||||||
|
Transaction tx = 2;
|
||||||
|
// The address of the ERC20 token whose balance changed.
|
||||||
|
bytes token = 3;
|
||||||
|
// The delta balance of the token.
|
||||||
|
bytes delta = 4;
|
||||||
|
// The id of the component whose TVL is tracked.
|
||||||
|
// If the protocol component includes multiple contracts, the balance change must be aggregated to reflect how much tokens can be traded.
|
||||||
|
bytes component_id = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
message BalanceDeltas {
|
||||||
|
repeated BalanceDelta balance_deltas = 1;
|
||||||
|
}
|
||||||
32
substreams/ethereum-balancer/proto/tycho/evm/v1/entity.proto
Normal file
32
substreams/ethereum-balancer/proto/tycho/evm/v1/entity.proto
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
package tycho.evm.v1;
|
||||||
|
|
||||||
|
import "tycho/evm/v1/common.proto";
|
||||||
|
|
||||||
|
// This file contains the definition for the native integration of Substreams.
|
||||||
|
|
||||||
|
// A component is a set of attributes that are associated with a custom entity.
|
||||||
|
message EntityChanges {
|
||||||
|
// A unique identifier of the entity within the protocol.
|
||||||
|
string component_id = 1;
|
||||||
|
// The set of attributes that are associated with the entity.
|
||||||
|
repeated Attribute attributes = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message TransactionEntityChanges {
|
||||||
|
Transaction tx = 1;
|
||||||
|
repeated EntityChanges entity_changes = 2;
|
||||||
|
// An array of newly added components.
|
||||||
|
repeated ProtocolComponent component_changes = 3;
|
||||||
|
// An array of balance changes to components.
|
||||||
|
repeated BalanceChange balance_changes = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
// A set of transaction changes within a single block.
|
||||||
|
message BlockEntityChanges {
|
||||||
|
// The block for which these changes are collectively computed.
|
||||||
|
Block block = 1;
|
||||||
|
// The set of transaction changes observed in the specified block.
|
||||||
|
repeated TransactionEntityChanges changes = 2;
|
||||||
|
}
|
||||||
50
substreams/ethereum-balancer/proto/tycho/evm/v1/vm.proto
Normal file
50
substreams/ethereum-balancer/proto/tycho/evm/v1/vm.proto
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
package tycho.evm.v1;
|
||||||
|
|
||||||
|
import "tycho/evm/v1/common.proto";
|
||||||
|
|
||||||
|
// This file contains proto definitions specific to the VM integration.
|
||||||
|
|
||||||
|
// A key value entry into contract storage.
|
||||||
|
message ContractSlot {
|
||||||
|
// A contract's storage slot.
|
||||||
|
bytes slot = 2;
|
||||||
|
// The new value for this storage slot.
|
||||||
|
bytes value = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Changes made to a single contract's state.
|
||||||
|
message ContractChange {
|
||||||
|
// The contract's address
|
||||||
|
bytes address = 1;
|
||||||
|
// The new native balance of the contract, empty bytes indicates no change.
|
||||||
|
bytes balance = 2;
|
||||||
|
// The new code of the contract, empty bytes indicates no change.
|
||||||
|
bytes code = 3;
|
||||||
|
// The changes to this contract's slots, empty sequence indicates no change.
|
||||||
|
repeated ContractSlot slots = 4;
|
||||||
|
// Whether this is an update, a creation or a deletion.
|
||||||
|
ChangeType change = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
// A set of changes aggregated by transaction.
|
||||||
|
message TransactionContractChanges {
|
||||||
|
// The transaction instance that results in the changes.
|
||||||
|
Transaction tx = 1;
|
||||||
|
// Contains the changes induced by the above transaction, aggregated on a per-contract basis.
|
||||||
|
// Must include changes to every contract that is tracked by all ProtocolComponents.
|
||||||
|
repeated ContractChange contract_changes = 2;
|
||||||
|
// An array of any component changes.
|
||||||
|
repeated ProtocolComponent component_changes = 3;
|
||||||
|
// An array of balance changes to components.
|
||||||
|
repeated BalanceChange balance_changes = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
// A set of transaction changes within a single block.
|
||||||
|
message BlockContractChanges {
|
||||||
|
// The block for which these changes are collectively computed.
|
||||||
|
Block block = 1;
|
||||||
|
// The set of transaction changes observed in the specified block.
|
||||||
|
repeated TransactionContractChanges changes = 2;
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
1689
substreams/ethereum-balancer/src/abi/erc_linear_pool_factory.rs
Normal file
1689
substreams/ethereum-balancer/src/abi/erc_linear_pool_factory.rs
Normal file
File diff suppressed because it is too large
Load Diff
1765
substreams/ethereum-balancer/src/abi/euler_linear_pool_factory.rs
Normal file
1765
substreams/ethereum-balancer/src/abi/euler_linear_pool_factory.rs
Normal file
File diff suppressed because it is too large
Load Diff
1689
substreams/ethereum-balancer/src/abi/gearbox_linear_pool_factory.rs
Normal file
1689
substreams/ethereum-balancer/src/abi/gearbox_linear_pool_factory.rs
Normal file
File diff suppressed because it is too large
Load Diff
1735
substreams/ethereum-balancer/src/abi/managed_pool_factory.rs
Normal file
1735
substreams/ethereum-balancer/src/abi/managed_pool_factory.rs
Normal file
File diff suppressed because it is too large
Load Diff
10
substreams/ethereum-balancer/src/abi/mod.rs
Normal file
10
substreams/ethereum-balancer/src/abi/mod.rs
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
pub mod yearn_linear_pool_factory;
|
||||||
|
pub mod composable_stable_pool_factory;
|
||||||
|
pub mod vault;
|
||||||
|
pub mod weighted_pool_tokens_factory;
|
||||||
|
pub mod silo_linear_pool_factory;
|
||||||
|
pub mod euler_linear_pool_factory;
|
||||||
|
pub mod weighted_pool_factory;
|
||||||
|
pub mod managed_pool_factory;
|
||||||
|
pub mod erc_linear_pool_factory;
|
||||||
|
pub mod gearbox_linear_pool_factory;
|
||||||
1689
substreams/ethereum-balancer/src/abi/silo_linear_pool_factory.rs
Normal file
1689
substreams/ethereum-balancer/src/abi/silo_linear_pool_factory.rs
Normal file
File diff suppressed because it is too large
Load Diff
5268
substreams/ethereum-balancer/src/abi/vault.rs
Normal file
5268
substreams/ethereum-balancer/src/abi/vault.rs
Normal file
File diff suppressed because it is too large
Load Diff
1511
substreams/ethereum-balancer/src/abi/weighted_pool_factory.rs
Normal file
1511
substreams/ethereum-balancer/src/abi/weighted_pool_factory.rs
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,641 @@
|
|||||||
|
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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
1689
substreams/ethereum-balancer/src/abi/yearn_linear_pool_factory.rs
Normal file
1689
substreams/ethereum-balancer/src/abi/yearn_linear_pool_factory.rs
Normal file
File diff suppressed because it is too large
Load Diff
495
substreams/ethereum-balancer/src/lib.rs
Normal file
495
substreams/ethereum-balancer/src/lib.rs
Normal file
@@ -0,0 +1,495 @@
|
|||||||
|
use std::collections::HashMap;
|
||||||
|
|
||||||
|
use anyhow::Result;
|
||||||
|
use substreams::pb::substreams::StoreDeltas;
|
||||||
|
use substreams::store::{
|
||||||
|
StoreAdd, StoreAddBigInt, StoreGet, StoreGetBigInt, StoreGetProto, StoreNew,
|
||||||
|
StoreSetIfNotExists, StoreSetIfNotExistsProto,
|
||||||
|
};
|
||||||
|
use substreams::{hex, log};
|
||||||
|
|
||||||
|
use substreams::key;
|
||||||
|
use substreams::scalar::BigInt;
|
||||||
|
use substreams_ethereum::block_view::{CallView, LogView};
|
||||||
|
use substreams_ethereum::pb::eth;
|
||||||
|
use substreams_ethereum::pb::eth::v2::{balance_change, Call, Log, TransactionTrace};
|
||||||
|
use substreams_ethereum::{Event, Function};
|
||||||
|
|
||||||
|
use itertools::Itertools;
|
||||||
|
use pb::tycho::evm::v1::{self as tycho};
|
||||||
|
|
||||||
|
mod abi;
|
||||||
|
mod pb;
|
||||||
|
|
||||||
|
const VAULT_ADDRESS: &[u8] = &hex!("BA12222222228d8Ba445958a75a0704d566BF2C8");
|
||||||
|
|
||||||
|
/// This trait defines some helpers for serializing and deserializing `Vec<BigInt` which is needed
|
||||||
|
/// to be able to encode the `normalized_weights` and `weights` `Attribute`s. This should also be
|
||||||
|
/// handled by any downstream application.
|
||||||
|
trait SerializableVecBigInt {
|
||||||
|
fn serialize_bytes(&self) -> Vec<u8>;
|
||||||
|
fn deserialize_bytes(bytes: &[u8]) -> Vec<BigInt>;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl SerializableVecBigInt for Vec<BigInt> {
|
||||||
|
fn serialize_bytes(&self) -> Vec<u8> {
|
||||||
|
self.iter()
|
||||||
|
.flat_map(|big_int| big_int.to_signed_bytes_be())
|
||||||
|
.collect()
|
||||||
|
}
|
||||||
|
fn deserialize_bytes(bytes: &[u8]) -> Vec<BigInt> {
|
||||||
|
bytes
|
||||||
|
.chunks_exact(32)
|
||||||
|
.map(|chunk| BigInt::from_signed_bytes_be(chunk))
|
||||||
|
.collect::<Vec<BigInt>>()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// This struct purely exists to spoof the `PartialEq` trait for `Transaction` so we can use it in
|
||||||
|
/// a later groupby operation.
|
||||||
|
struct TransactionWrapper(tycho::Transaction);
|
||||||
|
|
||||||
|
impl PartialEq for TransactionWrapper {
|
||||||
|
fn eq(&self, other: &Self) -> bool {
|
||||||
|
self.0.hash == other.0.hash
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 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 cooresponding call to gather
|
||||||
|
/// `PoolCreated` event information alongside the `Create` calldata that provide us details to
|
||||||
|
/// fufill both the required details + any extra `Attributes`
|
||||||
|
/// Ref: https://docs.balancer.fi/reference/contracts/deployment-addresses/mainnet.html
|
||||||
|
fn pool_factory_map(pool_addr: &[u8], log: &Log, call: &Call) -> Option<tycho::ProtocolComponent> {
|
||||||
|
match pool_addr {
|
||||||
|
&hex!("897888115Ada5773E02aA29F775430BFB5F34c51") => {
|
||||||
|
let create_call =
|
||||||
|
abi::weighted_pool_factory::functions::Create::match_and_decode(call)?;
|
||||||
|
let pool_created =
|
||||||
|
abi::weighted_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: "WeightedPoolFactory".into(),
|
||||||
|
change: tycho::ChangeType::Creation.into(),
|
||||||
|
},
|
||||||
|
tycho::Attribute {
|
||||||
|
name: "swap_fee_percentage".into(),
|
||||||
|
value: create_call.swap_fee_percentage.to_signed_bytes_be(),
|
||||||
|
change: tycho::ChangeType::Creation.into(),
|
||||||
|
},
|
||||||
|
tycho::Attribute {
|
||||||
|
name: "normalized_weights".into(),
|
||||||
|
value: create_call.normalized_weights.serialize_bytes(),
|
||||||
|
change: tycho::ChangeType::Creation.into(),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
change: tycho::ChangeType::Creation.into(),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
&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)?;
|
||||||
|
|
||||||
|
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: "ComposableStablePoolFactory".into(),
|
||||||
|
change: tycho::ChangeType::Creation.into(),
|
||||||
|
},
|
||||||
|
tycho::Attribute {
|
||||||
|
name: "swap_fee_percentage".into(),
|
||||||
|
value: create_call.swap_fee_percentage.to_signed_bytes_be(),
|
||||||
|
change: tycho::ChangeType::Creation.into(),
|
||||||
|
},
|
||||||
|
tycho::Attribute {
|
||||||
|
name: "amplification_parameter".into(),
|
||||||
|
value: create_call.amplification_parameter.to_signed_bytes_be(),
|
||||||
|
change: tycho::ChangeType::Creation.into(),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
change: tycho::ChangeType::Creation.into(),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
&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)?;
|
||||||
|
|
||||||
|
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: "ERC4626LinearPoolFactory".into(),
|
||||||
|
change: tycho::ChangeType::Creation.into(),
|
||||||
|
},
|
||||||
|
tycho::Attribute {
|
||||||
|
name: "swap_fee_percentage".into(),
|
||||||
|
value: create_call.swap_fee_percentage.to_signed_bytes_be(),
|
||||||
|
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(),
|
||||||
|
},
|
||||||
|
// Note, `lower_target` is generally hardcoded for all pools, not located in call data
|
||||||
|
// Note, rate provider might be provided as `create.protocol_id`, but as a BigInt. needs investigation
|
||||||
|
],
|
||||||
|
change: tycho::ChangeType::Creation.into(),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
&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)?;
|
||||||
|
|
||||||
|
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: "EulerLinearPoolFactory".into(),
|
||||||
|
change: tycho::ChangeType::Creation.into(),
|
||||||
|
},
|
||||||
|
tycho::Attribute {
|
||||||
|
name: "swap_fee_percentage".into(),
|
||||||
|
value: create_call.swap_fee_percentage.to_signed_bytes_be(),
|
||||||
|
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(),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
&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: "swap_fee_percentage".into(),
|
||||||
|
value: create_call.swap_fee_percentage.to_signed_bytes_be(),
|
||||||
|
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(),
|
||||||
|
// },
|
||||||
|
// tycho::Attribute {
|
||||||
|
// name: "swap_fee_percentage".into(),
|
||||||
|
// value: create_call.swap_fee_percentage.to_signed_bytes_be(),
|
||||||
|
// 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)?;
|
||||||
|
|
||||||
|
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: "SiloLinearPoolFactory".into(),
|
||||||
|
change: tycho::ChangeType::Creation.into(),
|
||||||
|
},
|
||||||
|
tycho::Attribute {
|
||||||
|
name: "swap_fee_percentage".into(),
|
||||||
|
value: create_call.swap_fee_percentage.to_signed_bytes_be(),
|
||||||
|
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(),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
&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)?;
|
||||||
|
|
||||||
|
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: "YearnLinearPoolFactory".into(),
|
||||||
|
change: tycho::ChangeType::Creation.into(),
|
||||||
|
},
|
||||||
|
tycho::Attribute {
|
||||||
|
name: "swap_fee_percentage".into(),
|
||||||
|
value: create_call.swap_fee_percentage.to_signed_bytes_be(),
|
||||||
|
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 `WeightedPool2TokenFactory` is a deprecated contract but we've included it since one
|
||||||
|
// of the highest TVL pools, 80BAL-20WETH, is able to be tracked.
|
||||||
|
&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)?;
|
||||||
|
|
||||||
|
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: "WeightedPool2TokensFactory".into(),
|
||||||
|
change: tycho::ChangeType::Creation.into(),
|
||||||
|
},
|
||||||
|
tycho::Attribute {
|
||||||
|
name: "swap_fee_percentage".into(),
|
||||||
|
value: create_call.swap_fee_percentage.to_signed_bytes_be(),
|
||||||
|
change: tycho::ChangeType::Creation.into(),
|
||||||
|
},
|
||||||
|
// TODO
|
||||||
|
tycho::Attribute {
|
||||||
|
name: "weights".into(),
|
||||||
|
value: create_call.weights.serialize_bytes(),
|
||||||
|
change: tycho::ChangeType::Creation.into(),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
change: tycho::ChangeType::Creation.into(),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
_ => None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Since the `PoolBalanceChanged` 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_balance_deltas(block: eth::v2::Block) -> Result<tycho::BalanceDeltas, anyhow::Error> {
|
||||||
|
Ok(tycho::BalanceDeltas {
|
||||||
|
balance_deltas: block
|
||||||
|
.events::<abi::vault::events::PoolBalanceChanged>(&[&VAULT_ADDRESS])
|
||||||
|
.flat_map(|(event, log)| {
|
||||||
|
event
|
||||||
|
.tokens
|
||||||
|
.iter()
|
||||||
|
.zip(event.deltas.iter())
|
||||||
|
.map(|(token, delta)| tycho::BalanceDelta {
|
||||||
|
ord: log.log.ordinal,
|
||||||
|
tx: Some(tycho::Transaction {
|
||||||
|
hash: log.receipt.transaction.hash.clone(),
|
||||||
|
from: log.receipt.transaction.from.clone(),
|
||||||
|
to: log.receipt.transaction.to.clone(),
|
||||||
|
index: Into::<u64>::into(log.receipt.transaction.index).clone(),
|
||||||
|
}),
|
||||||
|
token: token.clone(),
|
||||||
|
delta: delta.to_signed_bytes_be(),
|
||||||
|
component_id: event.pool_id.into(),
|
||||||
|
})
|
||||||
|
.collect::<Vec<_>>()
|
||||||
|
})
|
||||||
|
.collect::<Vec<_>>(),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 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_balance_changes(deltas: tycho::BalanceDeltas, store: StoreAddBigInt) {
|
||||||
|
deltas.balance_deltas.iter().for_each(|delta| {
|
||||||
|
store.add(
|
||||||
|
delta.ord,
|
||||||
|
format!(
|
||||||
|
"pool:{0}:token:{1}",
|
||||||
|
hex::encode(&delta.component_id),
|
||||||
|
hex::encode(&delta.token)
|
||||||
|
),
|
||||||
|
BigInt::from_signed_bytes_be(&delta.delta),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// This is the main map that handles most of the indexing of this substream.
|
||||||
|
#[substreams::handlers::map]
|
||||||
|
pub fn map_changes(
|
||||||
|
block: eth::v2::Block,
|
||||||
|
deltas: tycho::BalanceDeltas,
|
||||||
|
store: StoreDeltas, // Note, this map module is using the `deltas` mode for the store.
|
||||||
|
) -> Result<tycho::BlockContractChanges> {
|
||||||
|
// 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
|
||||||
|
let mut transaction_contract_changes = block
|
||||||
|
.transactions()
|
||||||
|
.flat_map(|tx| {
|
||||||
|
tx.logs_with_calls()
|
||||||
|
.filter(|(_, call)| !call.call.state_reverted)
|
||||||
|
.filter_map(|(log, call)| {
|
||||||
|
let pool_factory_address = call.call.address.as_slice();
|
||||||
|
|
||||||
|
Some((
|
||||||
|
tx.hash.clone(),
|
||||||
|
tycho::TransactionContractChanges {
|
||||||
|
tx: Some(tycho::Transaction {
|
||||||
|
hash: tx.hash.clone(),
|
||||||
|
from: tx.from.clone(),
|
||||||
|
to: tx.to.clone(),
|
||||||
|
index: Into::<u64>::into(tx.index).clone(),
|
||||||
|
}),
|
||||||
|
contract_changes: vec![],
|
||||||
|
balance_changes: vec![],
|
||||||
|
component_changes: vec![pool_factory_map(
|
||||||
|
pool_factory_address,
|
||||||
|
&log,
|
||||||
|
&call.call,
|
||||||
|
)?],
|
||||||
|
},
|
||||||
|
))
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.collect::<HashMap<_, _>>();
|
||||||
|
|
||||||
|
// Balance changes are gathered by the `StoreDelta` based on `PoolBalanceChanged` creating `BalanceDeltas`
|
||||||
|
// We essentially just process the changes that occured 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.
|
||||||
|
store
|
||||||
|
.deltas
|
||||||
|
.into_iter()
|
||||||
|
.zip(deltas.balance_deltas)
|
||||||
|
.map(|(store_delta, balance_delta)| {
|
||||||
|
let pool_id = key::segment_at(&store_delta.key, 1);
|
||||||
|
let token_id = key::segment_at(&store_delta.key, 3);
|
||||||
|
(
|
||||||
|
balance_delta.tx.unwrap(),
|
||||||
|
tycho::BalanceChange {
|
||||||
|
token: hex::decode(token_id).expect("Token ID not valid hex"),
|
||||||
|
balance: store_delta.new_value,
|
||||||
|
component_id: hex::decode(pool_id).expect("Token ID not valid hex"),
|
||||||
|
},
|
||||||
|
)
|
||||||
|
})
|
||||||
|
// We need to group the balance changes by tx hash for the `TransactionContractChanges` agg
|
||||||
|
.group_by(|(tx, _)| TransactionWrapper(tx.clone()))
|
||||||
|
.into_iter()
|
||||||
|
.for_each(|(tx_wrapped, group)| {
|
||||||
|
let tx = tx_wrapped.0;
|
||||||
|
|
||||||
|
if let Some(tx_change) = transaction_contract_changes.get_mut(&tx.hash) {
|
||||||
|
tx_change
|
||||||
|
.balance_changes
|
||||||
|
.extend(group.map(|(_, change)| change.clone()));
|
||||||
|
} else {
|
||||||
|
transaction_contract_changes.insert(
|
||||||
|
tx.hash.clone(),
|
||||||
|
tycho::TransactionContractChanges {
|
||||||
|
tx: Some(tx),
|
||||||
|
contract_changes: vec![],
|
||||||
|
component_changes: vec![],
|
||||||
|
balance_changes: group
|
||||||
|
.map(|(_, change)| change.clone())
|
||||||
|
.collect::<Vec<_>>(),
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Ok(tycho::BlockContractChanges {
|
||||||
|
block: Some(tycho::Block {
|
||||||
|
number: block.number,
|
||||||
|
hash: block.hash.clone(),
|
||||||
|
parent_hash: block
|
||||||
|
.header
|
||||||
|
.as_ref()
|
||||||
|
.expect("Block header not present")
|
||||||
|
.parent_hash
|
||||||
|
.clone(),
|
||||||
|
ts: block.timestamp_seconds(),
|
||||||
|
}),
|
||||||
|
changes: transaction_contract_changes
|
||||||
|
.into_iter()
|
||||||
|
.map(|(_, v)| v)
|
||||||
|
.sorted_unstable_by_key(|tx_change| tx_change.tx.clone().unwrap().index)
|
||||||
|
.collect::<Vec<_>>(),
|
||||||
|
})
|
||||||
|
}
|
||||||
28
substreams/ethereum-balancer/src/pb/eth.balancer.v1.rs
Normal file
28
substreams/ethereum-balancer/src/pb/eth.balancer.v1.rs
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
// @generated
|
||||||
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||||
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||||
|
pub struct Pools {
|
||||||
|
#[prost(message, repeated, tag="1")]
|
||||||
|
pub pools: ::prost::alloc::vec::Vec<Pool>,
|
||||||
|
}
|
||||||
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||||
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||||
|
pub struct Pool {
|
||||||
|
#[prost(bytes="vec", tag="1")]
|
||||||
|
pub pool_id: ::prost::alloc::vec::Vec<u8>,
|
||||||
|
#[prost(fixed64, tag="2")]
|
||||||
|
pub log_ordinal: u64,
|
||||||
|
}
|
||||||
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||||
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||||
|
pub struct Transfer {
|
||||||
|
#[prost(bytes="vec", tag="1")]
|
||||||
|
pub from: ::prost::alloc::vec::Vec<u8>,
|
||||||
|
#[prost(bytes="vec", tag="2")]
|
||||||
|
pub to: ::prost::alloc::vec::Vec<u8>,
|
||||||
|
#[prost(string, tag="3")]
|
||||||
|
pub token: ::prost::alloc::string::String,
|
||||||
|
#[prost(string, tag="4")]
|
||||||
|
pub amount: ::prost::alloc::string::String,
|
||||||
|
}
|
||||||
|
// @@protoc_insertion_point(module)
|
||||||
28
substreams/ethereum-balancer/src/pb/eth.factory.v1.rs
Normal file
28
substreams/ethereum-balancer/src/pb/eth.factory.v1.rs
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
// @generated
|
||||||
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||||
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||||
|
pub struct Pools {
|
||||||
|
#[prost(message, repeated, tag="1")]
|
||||||
|
pub pools: ::prost::alloc::vec::Vec<Pool>,
|
||||||
|
}
|
||||||
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||||
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||||
|
pub struct Pool {
|
||||||
|
#[prost(bytes="vec", tag="1")]
|
||||||
|
pub pool_id: ::prost::alloc::vec::Vec<u8>,
|
||||||
|
#[prost(fixed64, tag="2")]
|
||||||
|
pub log_ordinal: u64,
|
||||||
|
}
|
||||||
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||||
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||||
|
pub struct Transfer {
|
||||||
|
#[prost(bytes="vec", tag="1")]
|
||||||
|
pub from: ::prost::alloc::vec::Vec<u8>,
|
||||||
|
#[prost(bytes="vec", tag="2")]
|
||||||
|
pub to: ::prost::alloc::vec::Vec<u8>,
|
||||||
|
#[prost(string, tag="3")]
|
||||||
|
pub token: ::prost::alloc::string::String,
|
||||||
|
#[prost(string, tag="4")]
|
||||||
|
pub amount: ::prost::alloc::string::String,
|
||||||
|
}
|
||||||
|
// @@protoc_insertion_point(module)
|
||||||
22
substreams/ethereum-balancer/src/pb/eth.pool.v1.rs
Normal file
22
substreams/ethereum-balancer/src/pb/eth.pool.v1.rs
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
// @generated
|
||||||
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||||
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||||
|
pub struct Transfers {
|
||||||
|
#[prost(message, repeated, tag="1")]
|
||||||
|
pub transfers: ::prost::alloc::vec::Vec<Transfer>,
|
||||||
|
}
|
||||||
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||||
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||||
|
pub struct Transfer {
|
||||||
|
#[prost(string, tag="1")]
|
||||||
|
pub from: ::prost::alloc::string::String,
|
||||||
|
#[prost(string, tag="2")]
|
||||||
|
pub to: ::prost::alloc::string::String,
|
||||||
|
#[prost(uint64, tag="3")]
|
||||||
|
pub token_id: u64,
|
||||||
|
#[prost(string, tag="4")]
|
||||||
|
pub trx_hash: ::prost::alloc::string::String,
|
||||||
|
#[prost(uint64, tag="5")]
|
||||||
|
pub ordinal: u64,
|
||||||
|
}
|
||||||
|
// @@protoc_insertion_point(module)
|
||||||
9
substreams/ethereum-balancer/src/pb/mod.rs
Normal file
9
substreams/ethereum-balancer/src/pb/mod.rs
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
pub mod tycho {
|
||||||
|
pub mod evm {
|
||||||
|
// @@protoc_insertion_point(attribute:tycho.evm.v1)
|
||||||
|
pub mod v1 {
|
||||||
|
include!("tycho.evm.v1.rs");
|
||||||
|
// @@protoc_insertion_point(tycho.evm.v1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
235
substreams/ethereum-balancer/src/pb/tycho.evm.v1.rs
Normal file
235
substreams/ethereum-balancer/src/pb/tycho.evm.v1.rs
Normal file
@@ -0,0 +1,235 @@
|
|||||||
|
// @generated
|
||||||
|
// This file contains the proto definitions for Substreams common to all integrations.
|
||||||
|
|
||||||
|
/// A struct describing a block.
|
||||||
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||||
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||||
|
pub struct Block {
|
||||||
|
/// The blocks hash.
|
||||||
|
#[prost(bytes="vec", tag="1")]
|
||||||
|
pub hash: ::prost::alloc::vec::Vec<u8>,
|
||||||
|
/// The parent blocks hash.
|
||||||
|
#[prost(bytes="vec", tag="2")]
|
||||||
|
pub parent_hash: ::prost::alloc::vec::Vec<u8>,
|
||||||
|
/// The block number.
|
||||||
|
#[prost(uint64, tag="3")]
|
||||||
|
pub number: u64,
|
||||||
|
/// The block timestamp.
|
||||||
|
#[prost(uint64, tag="4")]
|
||||||
|
pub ts: u64,
|
||||||
|
}
|
||||||
|
/// A struct describing a transaction.
|
||||||
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||||
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||||
|
pub struct Transaction {
|
||||||
|
/// The transaction hash.
|
||||||
|
#[prost(bytes="vec", tag="1")]
|
||||||
|
pub hash: ::prost::alloc::vec::Vec<u8>,
|
||||||
|
/// The sender of the transaction.
|
||||||
|
#[prost(bytes="vec", tag="2")]
|
||||||
|
pub from: ::prost::alloc::vec::Vec<u8>,
|
||||||
|
/// The receiver of the transaction.
|
||||||
|
#[prost(bytes="vec", tag="3")]
|
||||||
|
pub to: ::prost::alloc::vec::Vec<u8>,
|
||||||
|
/// The transactions index within the block.
|
||||||
|
#[prost(uint64, tag="4")]
|
||||||
|
pub index: u64,
|
||||||
|
}
|
||||||
|
/// A custom struct representing an arbitrary attribute of a protocol component.
|
||||||
|
/// This is mainly used by the native integration to track the necessary information about the protocol.
|
||||||
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||||
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||||
|
pub struct Attribute {
|
||||||
|
/// The name of the attribute.
|
||||||
|
#[prost(string, tag="1")]
|
||||||
|
pub name: ::prost::alloc::string::String,
|
||||||
|
/// The value of the attribute.
|
||||||
|
#[prost(bytes="vec", tag="2")]
|
||||||
|
pub value: ::prost::alloc::vec::Vec<u8>,
|
||||||
|
/// The type of change the attribute underwent.
|
||||||
|
#[prost(enumeration="ChangeType", tag="3")]
|
||||||
|
pub change: i32,
|
||||||
|
}
|
||||||
|
/// A struct describing a part of the protocol.
|
||||||
|
/// Note: For example this can be a UniswapV2 pair, that tracks the two ERC20 tokens used by the pair,
|
||||||
|
/// the component would represent a single contract. In case of VM integration, such component would
|
||||||
|
/// not need any attributes, because all the relevant info would be tracked via storage slots and balance changes.
|
||||||
|
/// It can also be a wrapping contract, like WETH, that has a constant price, but it allows swapping tokens.
|
||||||
|
/// This is why the name ProtocolComponent is used instead of "Pool" or "Pair".
|
||||||
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||||
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||||
|
pub struct ProtocolComponent {
|
||||||
|
/// A unique identifier for the component within the protocol.
|
||||||
|
/// Can be e.g. a stringified address or a string describing the trading pair.
|
||||||
|
#[prost(string, tag="1")]
|
||||||
|
pub id: ::prost::alloc::string::String,
|
||||||
|
/// Addresses of the ERC20 tokens used by the component.
|
||||||
|
#[prost(bytes="vec", repeated, tag="2")]
|
||||||
|
pub tokens: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec<u8>>,
|
||||||
|
/// Addresses of the contracts used by the component.
|
||||||
|
/// Usually it is a single contract, but some protocols use multiple contracts.
|
||||||
|
#[prost(bytes="vec", repeated, tag="3")]
|
||||||
|
pub contracts: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec<u8>>,
|
||||||
|
/// Attributes of the component. Used mainly be the native integration.
|
||||||
|
/// The inner ChangeType of the attribute has to match the ChangeType of the ProtocolComponent.
|
||||||
|
#[prost(message, repeated, tag="4")]
|
||||||
|
pub static_att: ::prost::alloc::vec::Vec<Attribute>,
|
||||||
|
/// Type of change the component underwent.
|
||||||
|
#[prost(enumeration="ChangeType", tag="5")]
|
||||||
|
pub change: i32,
|
||||||
|
}
|
||||||
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||||
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||||
|
pub struct ProtocolComponents {
|
||||||
|
#[prost(message, repeated, tag="1")]
|
||||||
|
pub components: ::prost::alloc::vec::Vec<ProtocolComponent>,
|
||||||
|
}
|
||||||
|
/// A struct for following the changes of Total Value Locked (TVL) of a protocol component.
|
||||||
|
/// Note that if a ProtocolComponent contains multiple contracts, the TVL is tracked for the component as a whole.
|
||||||
|
/// E.g. for UniswapV2 pair WETH/USDC, this tracks the USDC and WETH balance of the pair contract.
|
||||||
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||||
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||||
|
pub struct BalanceChange {
|
||||||
|
/// The address of the ERC20 token whose balance changed.
|
||||||
|
#[prost(bytes="vec", tag="1")]
|
||||||
|
pub token: ::prost::alloc::vec::Vec<u8>,
|
||||||
|
/// The new balance of the token.
|
||||||
|
#[prost(bytes="vec", tag="2")]
|
||||||
|
pub balance: ::prost::alloc::vec::Vec<u8>,
|
||||||
|
/// The id of the component whose TVL is tracked.
|
||||||
|
/// If the protocol component includes multiple contracts, the balance change must be aggregated to reflect how much tokens can be traded.
|
||||||
|
#[prost(bytes="vec", tag="3")]
|
||||||
|
pub component_id: ::prost::alloc::vec::Vec<u8>,
|
||||||
|
}
|
||||||
|
/// A struct for following the changes of Total Value Locked (TVL) of a protocol component.
|
||||||
|
/// Note that if a ProtocolComponent contains multiple contracts, the TVL is tracked for the component as a whole.
|
||||||
|
/// E.g. for UniswapV2 pair WETH/USDC, this tracks the USDC and WETH balance of the pair contract.
|
||||||
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||||
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||||
|
pub struct BalanceDelta {
|
||||||
|
#[prost(uint64, tag="1")]
|
||||||
|
pub ord: u64,
|
||||||
|
/// The tx hash of the transaction that caused the balance change.
|
||||||
|
#[prost(message, optional, tag="2")]
|
||||||
|
pub tx: ::core::option::Option<Transaction>,
|
||||||
|
/// The address of the ERC20 token whose balance changed.
|
||||||
|
#[prost(bytes="vec", tag="3")]
|
||||||
|
pub token: ::prost::alloc::vec::Vec<u8>,
|
||||||
|
/// The delta balance of the token.
|
||||||
|
#[prost(bytes="vec", tag="4")]
|
||||||
|
pub delta: ::prost::alloc::vec::Vec<u8>,
|
||||||
|
/// The id of the component whose TVL is tracked.
|
||||||
|
/// If the protocol component includes multiple contracts, the balance change must be aggregated to reflect how much tokens can be traded.
|
||||||
|
#[prost(bytes="vec", tag="5")]
|
||||||
|
pub component_id: ::prost::alloc::vec::Vec<u8>,
|
||||||
|
}
|
||||||
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||||
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||||
|
pub struct BalanceDeltas {
|
||||||
|
#[prost(message, repeated, tag="1")]
|
||||||
|
pub balance_deltas: ::prost::alloc::vec::Vec<BalanceDelta>,
|
||||||
|
}
|
||||||
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||||
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||||
|
pub struct BlockBalanceChanges {
|
||||||
|
#[prost(message, optional, tag="1")]
|
||||||
|
pub block: ::core::option::Option<Block>,
|
||||||
|
#[prost(message, repeated, tag="2")]
|
||||||
|
pub balance_changes: ::prost::alloc::vec::Vec<BalanceChange>,
|
||||||
|
}
|
||||||
|
/// Enum to specify the type of a change.
|
||||||
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
|
||||||
|
#[repr(i32)]
|
||||||
|
pub enum ChangeType {
|
||||||
|
Unspecified = 0,
|
||||||
|
Update = 1,
|
||||||
|
Creation = 2,
|
||||||
|
Deletion = 3,
|
||||||
|
}
|
||||||
|
impl ChangeType {
|
||||||
|
/// String value of the enum field names used in the ProtoBuf definition.
|
||||||
|
///
|
||||||
|
/// The values are not transformed in any way and thus are considered stable
|
||||||
|
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
|
||||||
|
pub fn as_str_name(&self) -> &'static str {
|
||||||
|
match self {
|
||||||
|
ChangeType::Unspecified => "CHANGE_TYPE_UNSPECIFIED",
|
||||||
|
ChangeType::Update => "CHANGE_TYPE_UPDATE",
|
||||||
|
ChangeType::Creation => "CHANGE_TYPE_CREATION",
|
||||||
|
ChangeType::Deletion => "CHANGE_TYPE_DELETION",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// Creates an enum from field names used in the ProtoBuf definition.
|
||||||
|
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
|
||||||
|
match value {
|
||||||
|
"CHANGE_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
|
||||||
|
"CHANGE_TYPE_UPDATE" => Some(Self::Update),
|
||||||
|
"CHANGE_TYPE_CREATION" => Some(Self::Creation),
|
||||||
|
"CHANGE_TYPE_DELETION" => Some(Self::Deletion),
|
||||||
|
_ => None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// This file contains proto definitions specific to the VM integration.
|
||||||
|
|
||||||
|
/// A key value entry into contract storage.
|
||||||
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||||
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||||
|
pub struct ContractSlot {
|
||||||
|
/// A contract's storage slot.
|
||||||
|
#[prost(bytes="vec", tag="2")]
|
||||||
|
pub slot: ::prost::alloc::vec::Vec<u8>,
|
||||||
|
/// The new value for this storage slot.
|
||||||
|
#[prost(bytes="vec", tag="3")]
|
||||||
|
pub value: ::prost::alloc::vec::Vec<u8>,
|
||||||
|
}
|
||||||
|
/// Changes made to a single contract's state.
|
||||||
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||||
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||||
|
pub struct ContractChange {
|
||||||
|
/// The contract's address
|
||||||
|
#[prost(bytes="vec", tag="1")]
|
||||||
|
pub address: ::prost::alloc::vec::Vec<u8>,
|
||||||
|
/// The new native balance of the contract, empty bytes indicates no change.
|
||||||
|
#[prost(bytes="vec", tag="2")]
|
||||||
|
pub balance: ::prost::alloc::vec::Vec<u8>,
|
||||||
|
/// The new code of the contract, empty bytes indicates no change.
|
||||||
|
#[prost(bytes="vec", tag="3")]
|
||||||
|
pub code: ::prost::alloc::vec::Vec<u8>,
|
||||||
|
/// The changes to this contract's slots, empty sequence indicates no change.
|
||||||
|
#[prost(message, repeated, tag="4")]
|
||||||
|
pub slots: ::prost::alloc::vec::Vec<ContractSlot>,
|
||||||
|
/// Whether this is an update, a creation or a deletion.
|
||||||
|
#[prost(enumeration="ChangeType", tag="5")]
|
||||||
|
pub change: i32,
|
||||||
|
}
|
||||||
|
/// A set of changes aggregated by transaction.
|
||||||
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||||
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||||
|
pub struct TransactionContractChanges {
|
||||||
|
/// The transaction instance that results in the changes.
|
||||||
|
#[prost(message, optional, tag="1")]
|
||||||
|
pub tx: ::core::option::Option<Transaction>,
|
||||||
|
/// Contains the changes induced by the above transaction, aggregated on a per-contract basis.
|
||||||
|
/// Must include changes to every contract that is tracked by all ProtocolComponents.
|
||||||
|
#[prost(message, repeated, tag="2")]
|
||||||
|
pub contract_changes: ::prost::alloc::vec::Vec<ContractChange>,
|
||||||
|
/// An array of any component changes.
|
||||||
|
#[prost(message, repeated, tag="3")]
|
||||||
|
pub component_changes: ::prost::alloc::vec::Vec<ProtocolComponent>,
|
||||||
|
/// An array of balance changes to components.
|
||||||
|
#[prost(message, repeated, tag="4")]
|
||||||
|
pub balance_changes: ::prost::alloc::vec::Vec<BalanceChange>,
|
||||||
|
}
|
||||||
|
/// A set of transaction changes within a single block.
|
||||||
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||||
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||||
|
pub struct BlockContractChanges {
|
||||||
|
/// The block for which these changes are collectively computed.
|
||||||
|
#[prost(message, optional, tag="1")]
|
||||||
|
pub block: ::core::option::Option<Block>,
|
||||||
|
/// The set of transaction changes observed in the specified block.
|
||||||
|
#[prost(message, repeated, tag="2")]
|
||||||
|
pub changes: ::prost::alloc::vec::Vec<TransactionContractChanges>,
|
||||||
|
}
|
||||||
|
// @@protoc_insertion_point(module)
|
||||||
45
substreams/ethereum-balancer/substreams.yaml
Normal file
45
substreams/ethereum-balancer/substreams.yaml
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
specVersion: v0.1.0
|
||||||
|
package:
|
||||||
|
name: "substreams_balancer"
|
||||||
|
version: v0.1.0
|
||||||
|
|
||||||
|
protobuf:
|
||||||
|
files:
|
||||||
|
- tycho/evm/v1/vm.proto
|
||||||
|
- tycho/evm/v1/common.proto
|
||||||
|
importPaths:
|
||||||
|
- ../../proto/tycho/evm/v1/
|
||||||
|
- ./proto
|
||||||
|
|
||||||
|
binaries:
|
||||||
|
default:
|
||||||
|
type: wasm/rust-v1
|
||||||
|
file: target/wasm32-unknown-unknown/release/substreams_balancer.wasm
|
||||||
|
|
||||||
|
modules:
|
||||||
|
- name: map_balance_deltas
|
||||||
|
kind: map
|
||||||
|
initialBlock: 12369300 # An arbitrary block that should change based on your requirements
|
||||||
|
inputs:
|
||||||
|
- source: sf.ethereum.type.v2.Block
|
||||||
|
output:
|
||||||
|
type: proto:tycho.evm.v1.BalanceDeltas
|
||||||
|
|
||||||
|
- name: store_balance_changes
|
||||||
|
kind: store
|
||||||
|
initialBlock: 12369300
|
||||||
|
updatePolicy: add
|
||||||
|
valueType: bigint
|
||||||
|
inputs:
|
||||||
|
- map: map_balance_deltas
|
||||||
|
|
||||||
|
- name: map_changes
|
||||||
|
kind: map
|
||||||
|
initialBlock: 12369300
|
||||||
|
inputs:
|
||||||
|
- source: sf.ethereum.type.v2.Block
|
||||||
|
- map: map_transactions_created
|
||||||
|
- store: store_balance_changes
|
||||||
|
mode: deltas # This is the key property that simplifies `BalanceChange` handling
|
||||||
|
output:
|
||||||
|
type: proto:tycho.evm.v1.BlockContractChanges
|
||||||
Reference in New Issue
Block a user