Merge pull request #99 from propeller-heads/lp/uniswap-v2-default-balances
feat(uniswap_v2): set default balances on pool creation
This commit is contained in:
2
substreams/Cargo.lock
generated
2
substreams/Cargo.lock
generated
@@ -330,7 +330,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ethereum-uniswap-v2"
|
name = "ethereum-uniswap-v2"
|
||||||
version = "0.3.0"
|
version = "0.3.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"ethabi 18.0.0",
|
"ethabi 18.0.0",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "ethereum-uniswap-v2"
|
name = "ethereum-uniswap-v2"
|
||||||
version = "0.3.0"
|
version = "0.3.1"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
specVersion: v0.1.0
|
specVersion: v0.1.0
|
||||||
package:
|
package:
|
||||||
name: "ethereum_pancakeswap"
|
name: "ethereum_pancakeswap"
|
||||||
version: v0.2.1
|
version: v0.3.1
|
||||||
|
|
||||||
protobuf:
|
protobuf:
|
||||||
files:
|
files:
|
||||||
@@ -15,7 +15,7 @@ protobuf:
|
|||||||
binaries:
|
binaries:
|
||||||
default:
|
default:
|
||||||
type: wasm/rust-v1
|
type: wasm/rust-v1
|
||||||
file: ../../target/wasm32-unknown-unknown/substreams/ethereum_uniswap_v2.wasm
|
file: ../target/wasm32-unknown-unknown/release/ethereum_uniswap_v2.wasm
|
||||||
|
|
||||||
modules:
|
modules:
|
||||||
- name: map_pools_created
|
- name: map_pools_created
|
||||||
@@ -31,7 +31,7 @@ modules:
|
|||||||
kind: store
|
kind: store
|
||||||
initialBlock: 15614590
|
initialBlock: 15614590
|
||||||
updatePolicy: set_if_not_exists
|
updatePolicy: set_if_not_exists
|
||||||
valueType: proto:tycho.evm.v1.ProtocolComponent
|
valueType: proto:tycho.evm.uniswap.v2.Pool
|
||||||
inputs:
|
inputs:
|
||||||
- map: map_pools_created
|
- map: map_pools_created
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
specVersion: v0.1.0
|
specVersion: v0.1.0
|
||||||
package:
|
package:
|
||||||
name: "ethereum_sushiswap_v2"
|
name: "ethereum_sushiswap_v2"
|
||||||
version: v0.2.1
|
version: v0.3.1
|
||||||
|
|
||||||
protobuf:
|
protobuf:
|
||||||
files:
|
files:
|
||||||
@@ -15,7 +15,7 @@ protobuf:
|
|||||||
binaries:
|
binaries:
|
||||||
default:
|
default:
|
||||||
type: wasm/rust-v1
|
type: wasm/rust-v1
|
||||||
file: ../../target/wasm32-unknown-unknown/substreams/ethereum_uniswap_v2.wasm
|
file: ../target/wasm32-unknown-unknown/release/ethereum_uniswap_v2.wasm
|
||||||
|
|
||||||
modules:
|
modules:
|
||||||
- name: map_pools_created
|
- name: map_pools_created
|
||||||
@@ -4,7 +4,6 @@ use ethabi::ethereum_types::Address;
|
|||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use substreams::prelude::BigInt;
|
use substreams::prelude::BigInt;
|
||||||
use substreams_ethereum::pb::eth::v2::{self as eth};
|
use substreams_ethereum::pb::eth::v2::{self as eth};
|
||||||
|
|
||||||
use substreams_helper::{event_handler::EventHandler, hex::Hexable};
|
use substreams_helper::{event_handler::EventHandler, hex::Hexable};
|
||||||
|
|
||||||
use crate::abi::factory::events::PairCreated;
|
use crate::abi::factory::events::PairCreated;
|
||||||
@@ -58,7 +57,7 @@ fn get_pools(block: ð::Block, new_pools: &mut Vec<TransactionChanges>, params
|
|||||||
}],
|
}],
|
||||||
component_changes: vec![ProtocolComponent {
|
component_changes: vec![ProtocolComponent {
|
||||||
id: event.pair.to_hex(),
|
id: event.pair.to_hex(),
|
||||||
tokens: vec![event.token0, event.token1],
|
tokens: vec![event.token0.clone(), event.token1.clone()],
|
||||||
contracts: vec![],
|
contracts: vec![],
|
||||||
static_att: vec![
|
static_att: vec![
|
||||||
// Trading Fee is hardcoded to 0.3%, saved as int in bps (basis points)
|
// Trading Fee is hardcoded to 0.3%, saved as int in bps (basis points)
|
||||||
@@ -69,7 +68,7 @@ fn get_pools(block: ð::Block, new_pools: &mut Vec<TransactionChanges>, params
|
|||||||
},
|
},
|
||||||
Attribute {
|
Attribute {
|
||||||
name: "pool_address".to_string(),
|
name: "pool_address".to_string(),
|
||||||
value: event.pair,
|
value: event.pair.clone(),
|
||||||
change: ChangeType::Creation.into(),
|
change: ChangeType::Creation.into(),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@@ -82,7 +81,18 @@ fn get_pools(block: ð::Block, new_pools: &mut Vec<TransactionChanges>, params
|
|||||||
}),
|
}),
|
||||||
tx: Some(tycho_tx),
|
tx: Some(tycho_tx),
|
||||||
}],
|
}],
|
||||||
balance_changes: vec![],
|
balance_changes: vec![
|
||||||
|
BalanceChange {
|
||||||
|
token: event.token0,
|
||||||
|
balance: BigInt::from(0).to_signed_bytes_be(),
|
||||||
|
component_id: event.pair.to_hex().as_bytes().to_vec(),
|
||||||
|
},
|
||||||
|
BalanceChange {
|
||||||
|
token: event.token1,
|
||||||
|
balance: BigInt::from(0).to_signed_bytes_be(),
|
||||||
|
component_id: event.pair.to_hex().as_bytes().to_vec(),
|
||||||
|
},
|
||||||
|
],
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user