Skip to content

Commit

Permalink
Merge pull request #260 from koinos/lp-tracker
Browse files Browse the repository at this point in the history
Lp tracker
  • Loading branch information
sgerbino authored Oct 24, 2024
2 parents 5bd1080 + 309c8a2 commit e61a1be
Show file tree
Hide file tree
Showing 3 changed files with 119 additions and 2 deletions.
28 changes: 28 additions & 0 deletions koinos/koindx_tracker/koindx_tracker.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
syntax = "proto3";

package koinos.koindx_tracker;
option go_package = "github.com/koinos/koinos-proto-golang/v2/koinos/koindx_tracker";

import "koinos/options.proto";

message liquidity_record {
bytes address = 1 [(btype) = ADDRESS];
uint64 balance = 2 [jstype = JS_STRING];
uint64 prev_coin_ms_hi = 3 [jstype = JS_STRING];
uint64 prev_coin_ms_lo = 4 [jstype = JS_STRING];
uint64 last_update = 5 [jstype = JS_STRING];
}

message tvl_record {
uint64 value = 1 [jstype = JS_STRING];
}

message initialize_event {
string token_a = 1;
string token_b = 2;
}

message sync_event {
uint64 reserve_a = 1 [jstype = JS_STRING];
uint64 reserve_b = 2 [jstype = JS_STRING];
}
83 changes: 83 additions & 0 deletions koinos/rpc/koindx_tracker/koindx_tracker_rpc.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
syntax = "proto3";

package koinos.rpc.koindx_tracker;
option go_package = "github.com/koinos/koinos-proto-golang/v2/koinos/rpc/koindx_tracker";

import "koinos/koindx_tracker/koindx_tracker.proto";
import "koinos/options.proto";
import "koinos/rpc/rpc.proto";

message pool_pair {
bytes pool = 1 [(btype) = ADDRESS];
string token_a = 2;
string token_b = 3;
}

message get_pools_request {
oneof target {
bytes start = 1 [(btype) = ADDRESS];
bytes pool = 2 [(btype) = ADDRESS];
}
uint64 limit = 3 [jstype = JS_STRING];
}

message get_pools_response {
repeated pool_pair values = 1;
}

message account_liquidity {
bytes address = 1 [(btype) = ADDRESS];
uint64 balance = 2 [jstype = JS_STRING];
uint64 coin_ms_hi = 3 [jstype = JS_STRING];
uint64 coin_ms_lo = 4 [jstype = JS_STRING];
}

message get_liquidity_request {
bytes pool = 1 [(btype) = ADDRESS];
bytes start = 2 [(btype) = ADDRESS];
uint64 limit = 3 [jstype = JS_STRING];
optional uint64 start_ms = 4 [jstype = JS_STRING];
optional uint64 end_ms = 5 [jstype = JS_STRING];
}

message get_liquidity_response {
repeated account_liquidity values = 1;
}

message pool_tvl {
bytes pool = 1 [(btype) = ADDRESS];
uint64 tvl = 2 [jstype = JS_STRING];
}

message get_tvl_request {
oneof target {
bytes start = 1 [(btype) = ADDRESS];
bytes pool = 2 [(btype) = ADDRESS];
}

uint64 limit = 3 [jstype = JS_STRING];
optional uint64 ms = 4 [jstype = JS_STRING];
}

message get_tvl_response {
repeated pool_tvl values = 1;
}

message koindx_tracker_request {
oneof request {
rpc.reserved_rpc reserved = 1;
get_pools_request get_pools = 2;
get_liquidity_request get_liquidity = 3;
get_tvl_request get_tvl = 4;
}
}

message koindx_tracker_response {
oneof response {
rpc.reserved_rpc reserved = 1;
rpc.error_status error = 2;
get_pools_response get_pools = 3;
get_liquidity_response get_liquidity = 4;
get_tvl_response get_tvl = 5;
}
}
10 changes: 8 additions & 2 deletions koinos/standards/kcs4.proto
Original file line number Diff line number Diff line change
Expand Up @@ -75,21 +75,23 @@ message transfer_arguments {
bytes from = 1 [(btype) = ADDRESS];
bytes to = 2 [(btype) = ADDRESS];
uint64 value = 3 [jstype = JS_STRING];
string memo = 4;
optional string memo = 4;
}

message transfer_result {}

message mint_arguments {
bytes to = 1 [(btype) = ADDRESS];
uint64 value = 2 [jstype = JS_STRING];
optional string memo = 3;
}

message mint_result {}

message burn_arguments {
bytes from = 1 [(btype) = ADDRESS];
uint64 value = 2 [jstype = JS_STRING];
optional string memo = 3;
}

message burn_result {}
Expand All @@ -98,29 +100,33 @@ message approve_arguments {
bytes owner = 1 [(koinos.btype) = ADDRESS];
bytes spender = 2 [(koinos.btype) = ADDRESS];
uint64 value = 3 [jstype = JS_STRING];
optional string memo = 4;
}

message approve_result {}

message burn_event {
bytes from = 1 [(btype) = ADDRESS];
uint64 value = 2 [jstype = JS_STRING];
optional string memo = 3;
}

message mint_event {
bytes to = 1 [(btype) = ADDRESS];
uint64 value = 2 [jstype = JS_STRING];
optional string memo = 3;
}

message transfer_event {
bytes from = 1 [(btype) = ADDRESS];
bytes to = 2 [(btype) = ADDRESS];
uint64 value = 3 [jstype = JS_STRING];
string memo = 4;
optional string memo = 4;
}

message approve_event {
bytes owner = 1 [(koinos.btype) = ADDRESS];
bytes spender = 2 [(koinos.btype) = ADDRESS];
uint64 value = 3 [jstype = JS_STRING];
optional string memo = 4;
}

0 comments on commit e61a1be

Please sign in to comment.