Skip to content

Commit

Permalink
Build/update proto (#852)
Browse files Browse the repository at this point in the history
build: update core proto files
  • Loading branch information
snobbee authored Dec 9, 2023
1 parent 7423069 commit 816c695
Show file tree
Hide file tree
Showing 21 changed files with 2,708 additions and 32 deletions.
2 changes: 1 addition & 1 deletion core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"integration": "./scripts/integration.sh",
"test": "yarn jest --passWithNoTests --collect-coverage --projects jest-unit.config.js",
"test:integration": "yarn jest --projects --collect-coverage jest-integration.config.js",
"syncProto": "rm -rf proto && degit Sifchain/sifnode/proto/sifnode#${TAG:-'develop'} proto/sifnode && degit Sifchain/sifnode/third_party/proto#${TAG:-'develop'} proto/third_party",
"syncProto": "rm -rf proto && degit Sifchain/sifnode/proto/sifnode#${TAG:-'master'} proto/sifnode && degit Sifchain/sifnode/third_party/proto#${TAG:-'master'} proto/third_party",
"codegen": "protoc -I=proto -I=proto/third_party proto/sifnode/**/**/*.proto --plugin=../node_modules/.bin/protoc-gen-ts_proto --ts_proto_out=src/generated/proto --ts_proto_opt='esModuleInterop=true,forceLong=long,useOptionals=messages'"
},
"files": [
Expand Down
2 changes: 2 additions & 0 deletions core/proto/sifnode/clp/v1/genesis.proto
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ option go_package = "github.com/Sifchain/sifnode/x/clp/types";

import "sifnode/clp/v1/params.proto";
import "sifnode/clp/v1/types.proto";
import "sifnode/clp/v1/rewards_bucket.proto";

// GenesisState - all clp state that must be provided at genesis
// TODO: Add parameters to Genesis state ,such as minimum liquidity required to
Expand All @@ -16,4 +17,5 @@ message GenesisState {
repeated string address_whitelist = 2;
repeated sifnode.clp.v1.Pool pool_list = 3;
repeated sifnode.clp.v1.LiquidityProvider liquidity_providers = 4;
repeated RewardsBucket rewards_bucket_list = 5 [(gogoproto.nullable) = false];
}
3 changes: 3 additions & 0 deletions core/proto/sifnode/clp/v1/params.proto
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ message RewardParams {
repeated RewardPeriod reward_periods = 4;
string reward_period_start_time =
5; // start time of the current (or last) reward period
uint64 rewards_lock_period = 6; // in blocks
string rewards_epoch_identifier = 7; // week, day, hour, etc
bool rewards_distribute = 8; // true if reward bucket should be distributed
}

// These params are non-governable and are calculated on chain
Expand Down
30 changes: 29 additions & 1 deletion core/proto/sifnode/clp/v1/querier.proto
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import "sifnode/clp/v1/types.proto";
import "sifnode/clp/v1/params.proto";
import "cosmos/base/query/v1beta1/pagination.proto";
import "google/api/annotations.proto";
import "sifnode/clp/v1/rewards_bucket.proto";

option go_package = "github.com/Sifchain/sifnode/x/clp/types";

Expand Down Expand Up @@ -59,6 +60,15 @@ service Query {
rpc GetPoolShareEstimate(PoolShareEstimateReq) returns (PoolShareEstimateRes) {
option (google.api.http).get = "/sifchain/clp/v1/pool_share_estimate";
};
// Queries a list of RewardsBucket items.
rpc GetRewardsBucket (RewardsBucketReq) returns (RewardsBucketRes) {
option (google.api.http).get = "/sifchain/clp/v1/rewards_bucket/{denom}";

}
rpc GetRewardsBucketAll (AllRewardsBucketReq) returns (AllRewardsBucketRes) {
option (google.api.http).get = "/sifchain/clp/v1/clp/rewards_bucket";

}
}

message PoolReq {
Expand Down Expand Up @@ -262,4 +272,22 @@ message SwapInfo {
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Uint",
(gogoproto.nullable) = false
];
}
}

message RewardsBucketReq {
string denom = 1;
}

message RewardsBucketRes {
RewardsBucket rewards_bucket = 1 [(gogoproto.nullable) = false];
}

message AllRewardsBucketReq {
cosmos.base.query.v1beta1.PageRequest pagination = 1;
}

message AllRewardsBucketRes {
repeated RewardsBucket rewards_bucket = 1 [(gogoproto.nullable) = false];
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}

17 changes: 17 additions & 0 deletions core/proto/sifnode/clp/v1/rewards_bucket.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
syntax = "proto3";
package sifnode.clp.v1;

import "gogoproto/gogo.proto";

option go_package = "github.com/Sifchain/sifnode/x/clp/types";

message RewardsBucket {
string denom = 1;
string amount = 2 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.nullable) = false,
(gogoproto.moretags) = "yaml:\"amount\""
];

}

12 changes: 12 additions & 0 deletions core/proto/sifnode/clp/v1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ syntax = "proto3";
package sifnode.clp.v1;

import "gogoproto/gogo.proto";
import "cosmos/base/coin.proto";
import "sifnode/clp/v1/types.proto";
import "sifnode/clp/v1/params.proto";

Expand Down Expand Up @@ -34,6 +35,7 @@ service Msg {
rpc ModifyLiquidityProtectionRates(MsgModifyLiquidityProtectionRates) returns (MsgModifyLiquidityProtectionRatesResponse);
rpc AddProviderDistributionPeriod(MsgAddProviderDistributionPeriodRequest) returns (MsgAddProviderDistributionPeriodResponse);
rpc UpdateSwapFeeParams(MsgUpdateSwapFeeParamsRequest) returns (MsgUpdateSwapFeeParamsResponse);
rpc AddLiquidityToRewardsBucket (MsgAddLiquidityToRewardsBucketRequest) returns (MsgAddLiquidityToRewardsBucketResponse);
}

// message MsgUpdateStakingRewardParams{
Expand Down Expand Up @@ -198,6 +200,9 @@ message MsgUpdateRewardsParamsRequest {
string signer = 1 [ (gogoproto.moretags) = "yaml:\"signer\"" ];
uint64 liquidity_removal_lock_period = 2; // in blocks
uint64 liquidity_removal_cancel_period = 3; // in blocks
uint64 rewards_lock_period = 4; // in blocks
string rewards_epoch_identifier = 5; // week, day, hour, etc
bool rewards_distribute = 6; // true or false
}

message MsgUpdateRewardsParamsResponse {}
Expand Down Expand Up @@ -281,3 +286,10 @@ message MsgUpdateSwapFeeParamsRequest {
}

message MsgUpdateSwapFeeParamsResponse {}

message MsgAddLiquidityToRewardsBucketRequest {
string signer = 1;
repeated cosmos.base.v1beta1.Coin amount = 2 [(gogoproto.nullable) = false];
}

message MsgAddLiquidityToRewardsBucketResponse {}
13 changes: 13 additions & 0 deletions core/proto/sifnode/clp/v1/types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ syntax = "proto3";
package sifnode.clp.v1;

import "gogoproto/gogo.proto";
import "cosmos/base/coin.proto";

option go_package = "github.com/Sifchain/sifnode/x/clp/types";

Expand Down Expand Up @@ -79,6 +80,12 @@ message Pool {
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Uint",
(gogoproto.nullable) = false
];
// the amount of external asset rewards distributed to liquidity providers from reward buckets
string reward_amount_external = 19 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Uint",
(gogoproto.nullable) = false,
(gogoproto.moretags) = "yaml:\"reward_amount_external\""
];
}

message LiquidityProvider {
Expand All @@ -90,6 +97,12 @@ message LiquidityProvider {
];
string liquidity_provider_address = 3;
repeated LiquidityUnlock unlocks = 4;
int64 last_updated_block = 5; // contains the block height of the last update
// distributed or added to liquidity provider shares rewards
repeated cosmos.base.v1beta1.Coin reward_amount = 6 [
(gogoproto.nullable) = false,
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"
];
}

message LiquidityUnlock {
Expand Down
40 changes: 40 additions & 0 deletions core/proto/sifnode/epochs/v1/genesis.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
syntax = "proto3";
package sifnode.epochs.v1;

import "gogoproto/gogo.proto";
import "google/protobuf/duration.proto";
import "google/protobuf/timestamp.proto";

option go_package = "github.com/Sifchain/sifnode/x/epochs/types";

// EpochInfo defines the message interface containing the relevant informations about
// an epoch.
message EpochInfo {
// identifier of the epoch
string identifier = 1;
// start_time of the epoch
google.protobuf.Timestamp start_time = 2
[(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
// duration of the epoch
google.protobuf.Duration duration = 3 [
(gogoproto.nullable) = false,
(gogoproto.stdduration) = true
];
// current_epoch is the integer identifier of the epoch
int64 current_epoch = 4;
// current_epoch_start_time defines the timestamp of the start of the epoch
google.protobuf.Timestamp current_epoch_start_time = 5 [
(gogoproto.stdtime) = true,
(gogoproto.nullable) = false
];
// epoch_counting_started reflects if the counting for the epoch has started
bool epoch_counting_started = 6;
// current_epoch_start_height of the epoch
int64 current_epoch_start_height = 7;
}

// GenesisState defines the epochs module's genesis state.
message GenesisState {
// epochs is a slice of EpochInfo that defines the epochs in the genesis state
repeated EpochInfo epochs = 1 [(gogoproto.nullable) = false];
}
51 changes: 51 additions & 0 deletions core/proto/sifnode/epochs/v1/query.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
syntax = "proto3";
package sifnode.epochs.v1;

import "cosmos/base/query/v1beta1/pagination.proto";
import "sifnode/epochs/v1/genesis.proto";
import "gogoproto/gogo.proto";
import "google/api/annotations.proto";

option go_package = "github.com/Sifchain/sifnode/x/epochs/types";

// Query defines the gRPC querier service.
service Query {
// EpochInfos provide running epochInfos
rpc EpochInfos(QueryEpochsInfoRequest) returns (QueryEpochsInfoResponse) {
option (google.api.http).get = "/Sifchain/sifnode/epochs/v1/epochs";
}
// CurrentEpoch provide current epoch of specified identifier
rpc CurrentEpoch(QueryCurrentEpochRequest) returns (QueryCurrentEpochResponse) {
option (google.api.http).get = "/Sifchain/sifnode/epochs/v1/current_epoch";
}
}

// QueryEpochsInfoRequest is the request type for the Query/EpochInfos RPC
// method.
message QueryEpochsInfoRequest {
// pagination defines an optional pagination for the request.
cosmos.base.query.v1beta1.PageRequest pagination = 1;
}

// QueryEpochsInfoResponse is the response type for the Query/EpochInfos RPC
// method.
message QueryEpochsInfoResponse {
// epochs is a slice of all EpochInfos
repeated EpochInfo epochs = 1 [(gogoproto.nullable) = false];
// pagination defines an optional pagination for the request.
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}

// QueryCurrentEpochRequest is the request type for the Query/EpochInfos RPC
// method.
message QueryCurrentEpochRequest {
// identifier of the current epoch
string identifier = 1;
}

// QueryCurrentEpochResponse is the response type for the Query/EpochInfos RPC
// method.
message QueryCurrentEpochResponse {
// current_epoch is the number of the current epoch
int64 current_epoch = 1;
}
Loading

1 comment on commit 816c695

@vercel
Copy link

@vercel vercel bot commented on 816c695 Dec 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

sifchain-ui – ./

dex.sifchain.finance
sifchain-ui-git-master-sifchain.vercel.app
sifchain-ui-sifchain.vercel.app

Please sign in to comment.