fix: small fix and refactor after testing EkuboV2 (#188)
* fix: add `balance_owner` attribute for ekubo_v2 components * refactor: rename `ekubo` into `ekubo-v2` * refactor: freeze `substreams-helper` version in ekubo V2 module * docs: improve integration test comment * docs: add TODO to remove `balance_owner` in favor of `AccountBalances` --------- Co-authored-by: zizou <111426680+flopell@users.noreply.github.com>
This commit is contained in:
27
substreams/Cargo.lock
generated
27
substreams/Cargo.lock
generated
@@ -261,7 +261,7 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ethereum-ekubo"
|
||||
name = "ethereum-ekubo-v2"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
@@ -274,7 +274,7 @@ dependencies = [
|
||||
"serde_qs",
|
||||
"substreams",
|
||||
"substreams-ethereum",
|
||||
"substreams-helper 0.0.2",
|
||||
"substreams-helper 0.0.2 (git+https://github.com/propeller-heads/tycho-protocol-sdk.git?rev=e4609be)",
|
||||
"tycho-substreams 0.2.0 (git+https://github.com/propeller-heads/tycho-protocol-sdk.git?rev=3c08359)",
|
||||
]
|
||||
|
||||
@@ -1470,6 +1470,29 @@ dependencies = [
|
||||
"tiny-keccak",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "substreams-helper"
|
||||
version = "0.0.2"
|
||||
source = "git+https://github.com/propeller-heads/tycho-protocol-sdk.git?rev=e4609be#e4609bed0bb3c73a13864a951b8cb64c523bc148"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"base64",
|
||||
"bigdecimal",
|
||||
"downcast-rs",
|
||||
"ethabi 18.0.0",
|
||||
"hex",
|
||||
"hex-literal 0.4.1",
|
||||
"num-bigint",
|
||||
"pad",
|
||||
"prost 0.11.9",
|
||||
"prost-types 0.12.6",
|
||||
"substreams",
|
||||
"substreams-entity-change",
|
||||
"substreams-ethereum",
|
||||
"thiserror 1.0.69",
|
||||
"tiny-keccak",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "substreams-macro"
|
||||
version = "0.5.22"
|
||||
|
||||
@@ -14,7 +14,7 @@ members = [
|
||||
"ethereum-template-factory",
|
||||
"ethereum-template-singleton",
|
||||
"ethereum-uniswap-v4",
|
||||
"ethereum-ekubo",
|
||||
"ethereum-ekubo-v2",
|
||||
]
|
||||
resolver = "2"
|
||||
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
[package]
|
||||
name = "ethereum-ekubo"
|
||||
name = "ethereum-ekubo-v2"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[lib]
|
||||
name = "ethereum_ekubo"
|
||||
name = "ethereum_ekubo_v2"
|
||||
crate-type = ["cdylib"]
|
||||
|
||||
[dependencies]
|
||||
substreams = "0.5.22"
|
||||
substreams-ethereum = "0.9.9"
|
||||
substreams-helper = { path = "../crates/substreams-helper" } # TODO Update to git once pushed
|
||||
prost = "0.11"
|
||||
substreams-helper = { git = "https://github.com/propeller-heads/tycho-protocol-sdk.git", rev = "e4609be" }
|
||||
tycho-substreams = { git = "https://github.com/propeller-heads/tycho-protocol-sdk.git", rev = "3c08359" }
|
||||
prost = "0.11"
|
||||
anyhow = "1.0.95"
|
||||
ethabi = "18.0.0"
|
||||
num-bigint = "0.4.6"
|
||||
24
substreams/ethereum-ekubo-v2/integration_test.tycho.yaml
Normal file
24
substreams/ethereum-ekubo-v2/integration_test.tycho.yaml
Normal file
@@ -0,0 +1,24 @@
|
||||
adapter_contract: "EkuboSwapAdapter"
|
||||
adapter_build_signature: "constructor(address)"
|
||||
adapter_build_args: "0x16e186ecdc94083fff53ef2a41d46b92a54f61e2"
|
||||
skip_balance_check: true # Fails because the pool id is not the owner of the tokens. Needs to be address in the testing framework.
|
||||
protocol_type_names:
|
||||
- "ekubo_v2_pool"
|
||||
tests:
|
||||
- name: test_pool_creation
|
||||
start_block: 22048334
|
||||
stop_block: 22048335
|
||||
expected_components:
|
||||
- id: "0x3565d037d3f435ba5dc6381a9f4dc03d3db8d96c0100f7271b4bbeba3b6b2c14"
|
||||
tokens:
|
||||
- "0x0000000000000000000000000000000000000000"
|
||||
- "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"
|
||||
static_attributes:
|
||||
token0: "0x0000000000000000000000000000000000000000"
|
||||
token1: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"
|
||||
fee: "0x0000000000000000"
|
||||
tick_spacing: "0x00000000"
|
||||
extension_id: "0x00000000"
|
||||
extension: "0x514d5de68852628af2f1236f780866989660ada6"
|
||||
creation_tx: "0x7c2e697e73dc1f114a5473d1015c411f10585b2b671bee0bd6d5706895e16b27"
|
||||
skip_simulation: true # Native implementation
|
||||
@@ -1,5 +1,5 @@
|
||||
use itertools::Itertools;
|
||||
use substreams::scalar::BigInt;
|
||||
use substreams::{hex, scalar::BigInt};
|
||||
use substreams_helper::hex::Hexable;
|
||||
use tycho_substreams::models::{
|
||||
Attribute, BalanceChange, BlockChanges, ChangeType, EntityChanges, FinancialType,
|
||||
@@ -57,7 +57,7 @@ fn maybe_create_component(
|
||||
contracts: vec![],
|
||||
change: ChangeType::Creation.into(),
|
||||
protocol_type: Some(ProtocolType {
|
||||
name: "ekubo".to_string(),
|
||||
name: "ekubo_v2_pool".to_string(),
|
||||
financial_type: FinancialType::Swap.into(),
|
||||
implementation_type: ImplementationType::Custom.into(),
|
||||
attribute_schema: vec![],
|
||||
@@ -114,6 +114,12 @@ fn maybe_create_component(
|
||||
name: "sqrt_ratio".to_string(),
|
||||
value: pi.sqrt_ratio,
|
||||
},
|
||||
Attribute {
|
||||
change: ChangeType::Creation.into(),
|
||||
name: "balance_owner".to_string(), /* TODO: We should use AccountBalances
|
||||
* instead */
|
||||
value: hex!("e0e0e08A6A4b9Dc7bD67BCB7aadE5cF48157d444").to_vec(),
|
||||
},
|
||||
],
|
||||
},
|
||||
vec![
|
||||
@@ -1,7 +1,8 @@
|
||||
specVersion: v0.1.0
|
||||
package:
|
||||
name: "ethereum_ekubo"
|
||||
name: "ethereum_ekubo_v2"
|
||||
version: v0.1.0
|
||||
url: "https://github.com/propeller-heads/tycho-protocol-sdk/tree/main/substreams/ethereum-ekubo-v2"
|
||||
|
||||
protobuf:
|
||||
files:
|
||||
@@ -12,14 +13,13 @@ protobuf:
|
||||
- ../../proto
|
||||
- ./proto
|
||||
excludePaths:
|
||||
- sf/substreams
|
||||
- google
|
||||
- tycho
|
||||
|
||||
binaries:
|
||||
default:
|
||||
type: wasm/rust-v1
|
||||
file: ../target/wasm32-unknown-unknown/release/ethereum_ekubo.wasm
|
||||
file: ../target/wasm32-unknown-unknown/release/ethereum_ekubo_v2.wasm
|
||||
|
||||
network: ethereum
|
||||
networks:
|
||||
@@ -1,23 +0,0 @@
|
||||
adapter_contract: "EkuboSwapAdapter"
|
||||
adapter_build_signature: "constructor(address)"
|
||||
adapter_build_args: "0x16e186ecdc94083fff53ef2a41d46b92a54f61e2"
|
||||
skip_balance_check: true # This seems to fail because testing/src/runner:TestRunner.validate_state tries to interpret the component id as an Ethereum address?
|
||||
protocol_type_names:
|
||||
- "ekubo"
|
||||
tests:
|
||||
- name: test_pool_creation
|
||||
start_block: 7811236
|
||||
stop_block: 7811283
|
||||
expected_components:
|
||||
- id: "0xae76f216ce250b7b9a388d59cbbf92407d7ccee71a99b27ad521508b1c74681f"
|
||||
tokens:
|
||||
- "0x0000000000000000000000000000000000000000"
|
||||
- "0xb1b388f2ef1bb1f7979f009381f797f94b90c094"
|
||||
static_attributes:
|
||||
token0: "0x0000000000000000000000000000000000000000"
|
||||
token1: "0xb1b388f2ef1bb1f7979f009381f797f94b90c094"
|
||||
fee: "0x00c49ba5e353f7ce"
|
||||
tick_spacing: "0x0000175e"
|
||||
extension: "0x0000000000000000000000000000000000000000"
|
||||
creation_tx: "0x4b39d41ae3b823409ba6a92e2937f52f545acfd9cb7ecf7fb8eb7ea2e3b9985e"
|
||||
skip_simulation: false
|
||||
Reference in New Issue
Block a user