Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improving osmosis dex data #77

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 23 additions & 2 deletions Osmosis/osmosis-dex-data/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const project: CosmosProject = {
endpoint: ["https://rpc.osmosis.zone:443"],
chaintypes: new Map([
[
"osmosis.gamm.v1beta1",
"osmosis.gamm.v1beta1Swaps",
{
file: "./proto/osmosis/gamm/v1beta1/tx.proto",
messages: [
Expand All @@ -48,6 +48,13 @@ const project: CosmosProject = {
],
},
],
[
" osmosis.poolmanager.v1beta1Swaps",
{
file: "./proto/osmosis/poolmanager/v1beta1/tx.proto",
messages: ["MsgSwapExactAmountIn", "MsgSwapExactAmountOut"],
},
],
[
" osmosis.poolmanager.v1beta1",
{
Expand All @@ -67,7 +74,7 @@ const project: CosmosProject = {
dataSources: [
{
kind: CosmosDatasourceKind.Runtime,
startBlock: 13200000,
startBlock: 13338625,
mapping: {
file: "./dist/index.js",
handlers: [
Expand All @@ -78,13 +85,27 @@ const project: CosmosProject = {
type: "/osmosis.gamm.v1beta1.MsgSwapExactAmountIn",
},
},
{
handler: "handleMsgSwapExactAmountIn",
kind: CosmosHandlerKind.Message,
filter: {
type: "/osmosis.poolmanager.v1beta1.MsgSwapExactAmountIn",
},
},
{
handler: "handleMsgSwapExactAmountOut",
kind: CosmosHandlerKind.Message,
filter: {
type: "/osmosis.gamm.v1beta1.MsgSwapExactAmountOut",
},
},
{
handler: "handleMsgSwapExactAmountOut",
kind: CosmosHandlerKind.Message,
filter: {
type: "/osmosis.poolmanager.v1beta1.MsgSwapExactAmountOut",
},
},
{
handler: "handleMsgJoinSwapShareAmountOut",
kind: CosmosHandlerKind.Message,
Expand Down
152 changes: 152 additions & 0 deletions Osmosis/osmosis-dex-data/proto/osmosis/poolmanager/v1beta1/tx.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
syntax = "proto3";
package osmosis.poolmanager.v1beta1;

import "gogoproto/gogo.proto";
import "amino/amino.proto";
import "cosmos/base/v1beta1/coin.proto";
import "osmosis/poolmanager/v1beta1/swap_route.proto";

option go_package = "github.com/osmosis-labs/osmosis/v22/x/poolmanager/types";

service Msg {
rpc SwapExactAmountIn(MsgSwapExactAmountIn)
returns (MsgSwapExactAmountInResponse);
rpc SwapExactAmountOut(MsgSwapExactAmountOut)
returns (MsgSwapExactAmountOutResponse);
rpc SplitRouteSwapExactAmountIn(MsgSplitRouteSwapExactAmountIn)
returns (MsgSplitRouteSwapExactAmountInResponse);
rpc SplitRouteSwapExactAmountOut(MsgSplitRouteSwapExactAmountOut)
returns (MsgSplitRouteSwapExactAmountOutResponse);
rpc SetDenomPairTakerFee(MsgSetDenomPairTakerFee)
returns (MsgSetDenomPairTakerFeeResponse);
}

// ===================== MsgSwapExactAmountIn
message MsgSwapExactAmountIn {
option (amino.name) = "osmosis/poolmanager/swap-exact-amount-in";

string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ];
repeated SwapAmountInRoute routes = 2 [ (gogoproto.nullable) = false ];
cosmos.base.v1beta1.Coin token_in = 3 [
(gogoproto.moretags) = "yaml:\"token_in\"",
(gogoproto.nullable) = false
];
string token_out_min_amount = 4 [

(gogoproto.customtype) = "cosmossdk.io/math.Int",
(gogoproto.moretags) = "yaml:\"token_out_min_amount\"",
(gogoproto.nullable) = false
];
}

message MsgSwapExactAmountInResponse {
string token_out_amount = 1 [

(gogoproto.customtype) = "cosmossdk.io/math.Int",
(gogoproto.moretags) = "yaml:\"token_out_amount\"",
(gogoproto.nullable) = false
];
}

// ===================== MsgSplitRouteSwapExactAmountIn
message MsgSplitRouteSwapExactAmountIn {
option (amino.name) = "osmosis/poolmanager/split-amount-in";

string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ];
repeated SwapAmountInSplitRoute routes = 2 [ (gogoproto.nullable) = false ];
string token_in_denom = 3
[ (gogoproto.moretags) = "yaml:\"token_in_denom\"" ];
string token_out_min_amount = 4 [

(gogoproto.customtype) = "cosmossdk.io/math.Int",
(gogoproto.moretags) = "yaml:\"token_out_min_amount\"",
(gogoproto.nullable) = false
];
}

message MsgSplitRouteSwapExactAmountInResponse {
string token_out_amount = 1 [

(gogoproto.customtype) = "cosmossdk.io/math.Int",
(gogoproto.moretags) = "yaml:\"token_out_amount\"",
(gogoproto.nullable) = false
];
}

// ===================== MsgSwapExactAmountOut
message MsgSwapExactAmountOut {
option (amino.name) = "osmosis/poolmanager/swap-exact-amount-out";

string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ];
repeated SwapAmountOutRoute routes = 2 [ (gogoproto.nullable) = false ];
string token_in_max_amount = 3 [

(gogoproto.customtype) = "cosmossdk.io/math.Int",
(gogoproto.moretags) = "yaml:\"token_in_max_amount\"",
(gogoproto.nullable) = false
];
cosmos.base.v1beta1.Coin token_out = 4 [
(gogoproto.moretags) = "yaml:\"token_out\"",
(gogoproto.nullable) = false
];
}

message MsgSwapExactAmountOutResponse {
string token_in_amount = 1 [

(gogoproto.customtype) = "cosmossdk.io/math.Int",
(gogoproto.moretags) = "yaml:\"token_in_amount\"",
(gogoproto.nullable) = false
];
}

// ===================== MsgSplitRouteSwapExactAmountOut
message MsgSplitRouteSwapExactAmountOut {
option (amino.name) = "osmosis/poolmanager/split-amount-out";

string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ];
repeated SwapAmountOutSplitRoute routes = 2 [ (gogoproto.nullable) = false ];
string token_out_denom = 3
[ (gogoproto.moretags) = "yaml:\"token_out_denom\"" ];
string token_in_max_amount = 4 [

(gogoproto.customtype) = "cosmossdk.io/math.Int",
(gogoproto.moretags) = "yaml:\"token_in_max_amount\"",
(gogoproto.nullable) = false
];
}

message MsgSplitRouteSwapExactAmountOutResponse {
string token_in_amount = 1 [

(gogoproto.customtype) = "cosmossdk.io/math.Int",
(gogoproto.moretags) = "yaml:\"token_in_amount\"",
(gogoproto.nullable) = false
];
}

// ===================== MsgSetDenomPairTakerFee
message MsgSetDenomPairTakerFee {
option (amino.name) = "osmosis/poolmanager/set-denom-pair-taker-fee";

string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ];
repeated DenomPairTakerFee denom_pair_taker_fee = 2 [
(gogoproto.moretags) = "yaml:\"denom_pair_taker_fee\"",
(gogoproto.nullable) = false
];
}

message MsgSetDenomPairTakerFeeResponse { bool success = 1; }

message DenomPairTakerFee {
// denom0 and denom1 get automatically lexigographically sorted
// when being stored, so the order of input here does not matter.
string denom0 = 1 [ (gogoproto.moretags) = "yaml:\"denom0\"" ];
string denom1 = 2 [ (gogoproto.moretags) = "yaml:\"denom1\"" ];
string taker_fee = 3 [

(gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
(gogoproto.moretags) = "yaml:\"taker_fee\"",
(gogoproto.nullable) = false
];
}
7 changes: 5 additions & 2 deletions Osmosis/osmosis-dex-data/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ type Swap @entity {
blockHeight: BigInt!
date: Date!
message: Message!
msgType: String!
tokenInDenom: String
tokenInAmount: BigInt
tokenOutMin: BigInt
Expand All @@ -34,9 +35,11 @@ type SwapRoute @entity {
id: ID!
pool: Pool!
swap: Swap!
tokenInDenom: String
tokenOutDenom: String
# tokenInDenom: String
# tokenOutDenom: String
poolLiquidity: Float
tokensIn: String
tokensOut: String
}

type Pool @entity {
Expand Down
Loading
Loading