Files
tycho-protocol-sdk/substreams/ethereum-uniswap-v3-logs-only/proto/v1/uniswap.proto
Zizou 9e8e360889 refactor(substreams): improve logic to ignore updates (#96)
* refactor(substreams): ignore transaction if contracts update are ignored.

There are some cases where we ignore contracts updates (for example if the old and new values are the same). In that case if the transaction only contains ignored updates we don't emit it.

* refactor(substreams): ignore deletions for freshly created attributes.

There are cases where an attribute can be created and deleted during the same transaction. To avoid sending a confusing deletion for something that was never created before, we just ignore the deletion in that particular case.

* feat(substreams): Add uniswap V3 logs only module (#98)

* feat(substreams): add uniswapV3 logs only Substreams module

* refactor(substreams): encode everything as big endian

* refactor(substreams): mark changes as creation when a tick liq is updated from 0

This will allow the SDK to detect cases where a tick is created and deleted in the same transaction and ignore it.

* ci(substreams): ignore built files for uniswapv3 logs only module and clean code

* refactor(substreams): update uniswapv3 substreams with new SDK interface

* feat(subtreams): emit default token balances value for uniswapv3

---------

Co-authored-by: zizou <111426680+flopell@users.noreply.github.com>

---------

Co-authored-by: zizou <111426680+flopell@users.noreply.github.com>
2024-11-07 05:16:55 +00:00

177 lines
3.8 KiB
Protocol Buffer

syntax = "proto3";
package uniswap.v3;
message Pool {
bytes address = 1;
bytes token0 = 2;
bytes token1 = 3;
bytes created_tx_hash = 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.
uint64 index = 4;
}
// A change to a pool's tick.
message TickDelta {
// The address of the pool.
bytes pool_address = 1;
// The index of the tick.
int32 tick_index = 2;
// The liquidity net delta of this tick. Bigint encoded as signed little endian bytes.
bytes liquidity_net_delta = 3;
// Used to determine the order of the balance changes. Necessary for the balance store.
uint64 ordinal = 4;
Transaction transaction = 5;
}
// A group of TickDelta
message TickDeltas {
repeated TickDelta deltas = 1;
}
// A change to a pool's liquidity.
message LiquidityChange {
// The address of the pool.
bytes pool_address = 1;
// The liquidity changed amount. Bigint encoded as signed little endian bytes.
bytes value = 2;
// The type of update, can be absolute or delta.
LiquidityChangeType change_type = 3;
// Used to determine the order of the balance changes. Necessary for the balance store.
uint64 ordinal = 4;
Transaction transaction = 5;
}
// A group of LiquidityChange
message LiquidityChanges {
repeated LiquidityChange changes = 1;
}
enum LiquidityChangeType {
DELTA = 0;
ABSOLUTE = 1;
}
message Events {
repeated PoolEvent pool_events = 3;
message PoolEvent {
oneof type {
Initialize initialize = 1;
Mint mint = 2;
Collect collect = 3;
Burn burn = 4;
Swap swap = 5;
Flash flash = 6;
SetFeeProtocol set_fee_protocol = 7;
CollectProtocol collect_protocol = 8;
}
uint64 log_ordinal = 100;
string pool_address = 102;
string token0 = 103;
string token1 = 104;
Transaction transaction = 105;
message Initialize {
// Unsigned
string sqrt_price = 1;
int32 tick = 2;
}
message Mint {
string sender = 1;
string owner = 2;
// Signed
int32 tick_lower = 3;
// Signed
int32 tick_upper = 4;
// Unsigned
string amount = 5;
// Unsigned
string amount_0 = 6;
// Unsigned
string amount_1 = 7;
}
message Collect {
string owner = 1;
string recipient = 2;
int32 tick_lower = 3;
int32 tick_upper = 4;
// Unsigned
string amount_0 = 5;
// Unsigned
string amount_1 = 6;
}
message Burn {
string owner = 1;
int32 tick_lower = 2;
int32 tick_upper = 3;
// Unsigned
string amount = 4;
// Unsigned
string amount_0 = 5;
// Unsigned
string amount_1 = 6;
}
message Swap {
string sender = 1;
string recipient = 2;
// Signed
string amount_0 = 3;
// Signed
string amount_1 = 4;
// Unsigned
string sqrt_price = 6;
// Unsigned
string liquidity = 7;
int32 tick = 8;
}
message Flash {
string sender = 1;
string recipient = 2;
// Unsigned
string amount_0 = 3;
// Unsigned
string amount_1 = 4;
// Unsigned
string paid_0 = 5;
// Unsigned
string paid_1 = 6;
}
message SetFeeProtocol {
// Unsigned
uint64 fee_protocol_0_old = 1;
// Unsigned
uint64 fee_protocol_1_old = 2;
// Unsigned
uint64 fee_protocol_0_new = 3;
// Unsigned
uint64 fee_protocol_1_new = 4;
}
message CollectProtocol {
string sender = 1;
string recipient = 2;
// Unsigned
string amount_0 = 3;
// Unsigned
string amount_1 = 4;
}
}
}