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

feat: add LSM to the SDK's v0.45.16-ics-lsm branch #16747

Merged
Merged
Show file tree
Hide file tree
Changes from 151 commits
Commits
Show all changes
152 commits
Select commit Hold shift + click to select a range
00e671a
proto-gen
sampocs Jun 20, 2023
319337f
copied over staking protos
sampocs Jun 20, 2023
e81ad50
updated proto package name and fixed lint errors
sampocs Jun 20, 2023
25460ac
generated staking protos
sampocs Jun 20, 2023
01505b7
copied over module level files
sampocs Jun 20, 2023
988802b
removed min self delegation
sampocs Jun 20, 2023
b175c50
copied over staking types
sampocs Jun 20, 2023
c86a47b
copied over staking client
sampocs Jun 20, 2023
29052f5
copied over teststaking
sampocs Jun 20, 2023
b59ecbf
fixed build errors related to teststaking or min-self-delegation
sampocs Jun 20, 2023
cc8b59c
copied over staking simulation
sampocs Jun 20, 2023
0cfb4cb
copied over staking keeper
sampocs Jun 21, 2023
af19f65
removed GetLiquidDelegation
sampocs Jun 21, 2023
aa8b986
removed GetLiquidValidator
sampocs Jun 21, 2023
fd8434f
removed GetLiquidHistoricalInfo
sampocs Jun 21, 2023
b941dc8
removed GetLiquidBondedValidatorsByPower
sampocs Jun 21, 2023
38b5c5d
removed GetAllLiquidDelegations
sampocs Jun 21, 2023
c087b45
resolved batch of build errors in staking
sampocs Jun 21, 2023
7881f29
resolved batch of build errors from staking in other modules
sampocs Jun 21, 2023
c351d6d
fixed simulation tests for non-lsm txs
sampocs Jun 21, 2023
a1b58ed
misc small changes while fixing staking unit tests
sampocs Jun 21, 2023
fba2912
added back delegation_test that was removed
sampocs Jun 21, 2023
da29a2d
copied over slashing files
sampocs Jun 21, 2023
62289c7
removed/fixed tests that reference min_self_delegation
sampocs Jun 21, 2023
5743c84
fixed unit tests related to jailing a validator
sampocs Jun 22, 2023
7a79d16
fixed staking cli tests
sampocs Jun 22, 2023
35511cb
moved over distribution protos
sampocs Jun 22, 2023
6bf293a
generated distribution protos
sampocs Jun 22, 2023
dcc0582
copied over module level distribution files
sampocs Jun 22, 2023
1b74df5
copied over distribution types
sampocs Jun 22, 2023
e801f0e
copied over distribution simulation files
sampocs Jun 22, 2023
a83f0d9
copied over distribution client files
sampocs Jun 22, 2023
b861af2
copied over distribution keeper files
sampocs Jun 22, 2023
b28fafc
fixed build errors and moved withdrawal_suite into catch-all suite
sampocs Jun 22, 2023
9cf01f1
fixed distribution unit tests
sampocs Jun 22, 2023
e49b0af
added api endpoints for tokenize share queries
sampocs Jun 22, 2023
be4b680
added back in norace annotation
sampocs Jun 23, 2023
825ab95
Merge pull request #9 from iqlusioninc/sam/lsm-staking
sampocs Jun 23, 2023
2bc9256
removed min commission rate
sampocs Jun 26, 2023
be14241
added total liquid staked and tokenize share locks to genesis state
sampocs Jun 26, 2023
696e29e
added get all tokenize share locks
sampocs Jun 26, 2023
1ada588
added liquid staking data to init/export genesis
sampocs Jun 26, 2023
589252c
added unit test for init/export liquid staking genesis
sampocs Jun 26, 2023
cb150a5
stride audit fixes
sampocs Jun 26, 2023
8d59687
rename key to prefix
sampocs Jun 26, 2023
6b1dfc9
used getter for account prefix
sampocs Jun 26, 2023
36ed39a
Merge pull request #11 from iqlusioninc/sam/remove-min-commission-rate
sampocs Jun 27, 2023
3bf4bc8
Merge branch 'v0.45.16-ics-lsm' into sam/lsm-genesis
sampocs Jun 27, 2023
dc5ab59
Merge pull request #12 from iqlusioninc/sam/lsm-genesis
sampocs Jun 27, 2023
6ebf1a5
Merge branch 'v0.45.16-ics-lsm' into sam/stride-audit-fixes
sampocs Jun 27, 2023
8723b96
updated createICAAccount to closer resemble ibc code
sampocs Jun 27, 2023
5dcb6ee
Merge pull request #15 from iqlusioninc/sam/stride-audit-fixes
sampocs Jun 27, 2023
5d37c9c
fixed bug when calling BeforeTokenizeShareRecordRemoved hook
sampocs Jun 28, 2023
6158c69
flushed out lsm simulation tests
sampocs Jun 28, 2023
1b4d7e8
Merge pull request #16 from iqlusioninc/sam/lsm-sim-tests
sampocs Jun 28, 2023
a4d21b7
renamed AccountIsLiquidStakingProvider and added clarifying docstring
sampocs Jul 7, 2023
69e6bb7
added more docs to CancelUndelegation and added handler
sampocs Jul 7, 2023
750e5c4
added docstrings
sampocs Jul 7, 2023
cb57da8
removed validatorBond arg from NewDelegation
sampocs Jul 7, 2023
a063614
fixed random gen state unit tests
sampocs Jul 7, 2023
18d4262
renamed ValidatorBondDisabled to ValidatorBondCapDisabled
sampocs Jul 7, 2023
a2fa5d4
add adr + spec
riley-stride Jul 7, 2023
2496cd5
fixed bug in DecreaseValidatorBond and added unit test
sampocs Jul 7, 2023
415c00f
tweaked createICAAccount helper to be more accurate
sampocs Jul 7, 2023
6881884
passed pointer to validator in LS accounting functions and added dele…
sampocs Jul 7, 2023
97efdac
added back min-self-delegation flagged as deprecated
sampocs Jul 7, 2023
40b8762
upgrade handler and test
riley-stride Jul 8, 2023
1f1d294
correction to: added back min-self-delegation flagged as deprecated
sampocs Jul 10, 2023
6e60a2f
removed BeforeTokenizeShareRecordRemoved hook
sampocs Jul 10, 2023
ba8e4f5
updates to ADR
sampocs Jul 10, 2023
2160de7
one more change to ADR
sampocs Jul 10, 2023
22b324a
fixed unit tests around min-self-delegation
sampocs Jul 10, 2023
7aadb58
added rest endpoints to LSM queries
sampocs Jul 10, 2023
cbd11e9
fixed typo in UnbondValidator tx comment
sampocs Jul 10, 2023
a781080
removed BeforeTokenizeShareRecordRemoved hook
sampocs Jul 10, 2023
7966dd0
Merge branch 'v0.45.16-ics-lsm' into sam/lsm-distribution
sampocs Jul 10, 2023
d76b05d
Merge pull request #18 from iqlusioninc/sam/lsm-distribution
sampocs Jul 10, 2023
42be4e8
fold adr001 adr002 adr003 and marko's adr61 into a single adr
riley-stride Jul 11, 2023
95d9c92
fix merge conflicts
riley-stride Jul 11, 2023
b8d94b6
docs: clarify LSM terminology
riley-stride Jul 11, 2023
90a10d6
adr touch-ups
riley-stride Jul 11, 2023
de16d98
move adr to docs/architecture
riley-stride Jul 11, 2023
02a42df
added clarification around slash accounting
sampocs Jul 11, 2023
a118c0f
moved shares calculation under if statement in Delegate
sampocs Jul 11, 2023
370c61c
fix: add pagination to x/staking all-tokenize-share-records query
riley-stride Jul 11, 2023
4cae98e
added back in BeforeTokenizeShareRecordRemoved hook
sampocs Jul 12, 2023
fc84876
Merge branch 'v0.45.16-ics-lsm' of github.com:iqlusioninc/cosmos-sdk …
sampocs Jul 12, 2023
eeaa85e
debug print line
riley-stride Jul 13, 2023
9a80096
fix: add pagination to all-tokenize-share-records proto response
riley-stride Jul 13, 2023
eec7bca
rm upgrade handler and move migration helpers from app/upgrades to x/…
riley-stride Jul 13, 2023
f649cff
rm BeforeTokenizeShareRecordRemoved hooks
riley-stride Jul 13, 2023
bcf3697
Revert "rm upgrade handler and move migration helpers from app/upgrad…
riley-stride Jul 13, 2023
230a866
rm upgrade handler and move migration helpers from app/upgrades to x/…
riley-stride Jul 13, 2023
5e6b974
Revert "rm BeforeTokenizeShareRecordRemoved hooks"
riley-stride Jul 13, 2023
0081ec4
Revert "debug print line"
riley-stride Jul 14, 2023
ad084a4
handled rounding precision case in tokenize and redeem
sampocs Jul 14, 2023
da7f8b7
updated lsm token to map 1:1 with shares
sampocs Jul 14, 2023
f5fd65b
added unit tests around the precision error cases
sampocs Jul 14, 2023
dfaf21d
changed slashed token calculation
sampocs Jul 14, 2023
0d5a180
added lsm share token description to ADR
sampocs Jul 14, 2023
522730b
fixed bug in TokenizeShareRecordReward query
sampocs Jul 14, 2023
ce3788c
Merge pull request #20 from iqlusioninc/sam/lsm-slashed-token-adjustment
sampocs Jul 14, 2023
e81dfc9
fix: handle liquid staked coins in sim; update sim ops
MSalopek Jul 17, 2023
3de5258
test: use valoper bech prefix in sims
MSalopek Jul 17, 2023
7b4eac5
resolved conflicts with SDK 46+ protos, errors, and keys
sampocs Jul 18, 2023
aa65e67
Merge pull request #21 from MSalopek/masa/lsm-simulator-fixes
sampocs Jul 18, 2023
c65247c
shortened message names for ledger support
sampocs Jul 18, 2023
a17ee03
Merge branch 'v0.45.16-ics-lsm' of github.com:iqlusioninc/cosmos-sdk …
sampocs Jul 18, 2023
df60236
deprecated min_self_delegation in CreateValidator tx
sampocs Jul 18, 2023
0ffbbe5
validator TotalLiquidShares -> LiquidShares
sampocs Jul 19, 2023
932a971
validator TotalValidatorBondShares -> ValidatorBondShares
sampocs Jul 19, 2023
733a254
deprecated min_self_delegation in EditValidator tx
sampocs Jul 19, 2023
e731d3f
updated adr
sampocs Jul 19, 2023
60931f0
Merge branch 'v0.45.16-ics-lsm' into sam/lsm-tokens-to-shares
sampocs Jul 20, 2023
a432395
Merge pull request #19 from iqlusioninc/sam/lsm-tokens-to-shares
sampocs Jul 20, 2023
53cca31
added clarifying comment in slash panic
sampocs Jul 20, 2023
73e72b9
nit changes from latest review
sampocs Jul 20, 2023
d9e4e93
added pagination to tokenize share record query
sampocs Jul 26, 2023
2ee275d
lint/format
sampocs Jul 26, 2023
7d651a6
backported fix to #12931
sampocs Jul 26, 2023
04843f4
moved removal of tokenize share locks outside of iterator
sampocs Jul 31, 2023
3024452
removed validator pointer from liquid staking accounting functions
sampocs Jul 31, 2023
9f5ad8e
update to adr wrt purpose of tokenize share lock
sampocs Jul 31, 2023
f4ce1eb
increased validator bond shares during delegation
sampocs Aug 1, 2023
81ef370
exacerbates -> exacerbate in ADR
sampocs Aug 1, 2023
679cf5d
moved and renamed files
sampocs Aug 1, 2023
aa24023
refactored migrations
sampocs Aug 1, 2023
3082897
wired up migration
sampocs Aug 1, 2023
018ecc8
added legacy types
sampocs Aug 2, 2023
15637da
copied over test
sampocs Aug 2, 2023
47f9991
WIP: migrate to old testing framework
sampocs Aug 2, 2023
a7255b0
added validators and delegations unit tests, params test WIP
sampocs Aug 2, 2023
128be08
finished unit test for params
sampocs Aug 2, 2023
4d6ab68
Merge branch 'v0.45.16-ics-lsm' into v0.45.16-ics-lsm_upgrade-handler
sampocs Aug 3, 2023
a87d1a1
resolved conflicts
sampocs Aug 3, 2023
321f888
moved validator bond check after keeper.Delegate
sampocs Aug 3, 2023
160611e
moved validator lookup back under if statement
sampocs Aug 3, 2023
80b365e
added cancel unbonding delegation cli command
sampocs Aug 3, 2023
8f4c9dc
fixed unit test
sampocs Aug 3, 2023
aab739e
Merge pull request #25 from iqlusioninc/sam/lsm-add-cancel-unbonding-…
sampocs Aug 3, 2023
b75a00e
chore: add migrateUBDEntries to migration
riley-stride Aug 4, 2023
213f038
chore: call migrateUBDEntries from upgrade handler
riley-stride Aug 4, 2023
79044d1
test: tweak store, keys, migrations for UBD unit test
riley-stride Aug 8, 2023
0063de6
test: copy paste UBD unit test from https://github.com/cosmos/cosmos-…
riley-stride Aug 8, 2023
3d19da9
cleaned up UBD unit test and incremented consensus version
sampocs Aug 8, 2023
2967e8a
removed legacy subspace from migrator
sampocs Aug 8, 2023
63e834b
registered migration
sampocs Aug 9, 2023
0041b6a
Merge pull request #17 from iqlusioninc/v0.45.16-ics-lsm_upgrade-handler
sampocs Aug 10, 2023
ac34f8b
Merge pull request #24 from iqlusioninc/sam/lsm-update-validator-bond…
sampocs Aug 10, 2023
e633749
make format
sampocs Aug 11, 2023
846943c
increased validator bond shares during redelegation
sampocs Aug 11, 2023
c571075
increment validator bond shares in cancel unbonding
sampocs Aug 14, 2023
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
2 changes: 1 addition & 1 deletion codec/amino_codec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ func TestAminoCodecUnpackAnyFails(t *testing.T) {

func TestAminoCodecFullDecodeAndEncode(t *testing.T) {
// This tx comes from https://github.com/cosmos/cosmos-sdk/issues/8117.
txSigned := `{"type":"cosmos-sdk/StdTx","value":{"msg":[{"type":"cosmos-sdk/MsgCreateValidator","value":{"description":{"moniker":"fulltest","identity":"satoshi","website":"example.com","details":"example inc"},"commission":{"rate":"0.500000000000000000","max_rate":"1.000000000000000000","max_change_rate":"0.200000000000000000"},"min_self_delegation":"1000000","delegator_address":"cosmos14pt0q5cwf38zt08uu0n6yrstf3rndzr5057jys","validator_address":"cosmosvaloper14pt0q5cwf38zt08uu0n6yrstf3rndzr52q28gr","pubkey":{"type":"tendermint/PubKeyEd25519","value":"CYrOiM3HtS7uv1B1OAkknZnFYSRpQYSYII8AtMMtev0="},"value":{"denom":"umuon","amount":"700000000"}}}],"fee":{"amount":[{"denom":"umuon","amount":"6000"}],"gas":"160000"},"signatures":[{"pub_key":{"type":"tendermint/PubKeySecp256k1","value":"AwAOXeWgNf1FjMaayrSnrOOKz+Fivr6DiI/i0x0sZCHw"},"signature":"RcnfS/u2yl7uIShTrSUlDWvsXo2p2dYu6WJC8VDVHMBLEQZWc8bsINSCjOnlsIVkUNNe1q/WCA9n3Gy1+0zhYA=="}],"memo":"","timeout_height":"0"}}`
txSigned := `{"type":"cosmos-sdk/StdTx","value":{"msg":[{"type":"cosmos-sdk/MsgCreateValidator","value":{"description":{"moniker":"fulltest","identity":"satoshi","website":"example.com","details":"example inc"},"commission":{"rate":"0.500000000000000000","max_rate":"1.000000000000000000","max_change_rate":"0.200000000000000000"},"min_self_delegation":"0","delegator_address":"cosmos14pt0q5cwf38zt08uu0n6yrstf3rndzr5057jys","validator_address":"cosmosvaloper14pt0q5cwf38zt08uu0n6yrstf3rndzr52q28gr","pubkey":{"type":"tendermint/PubKeyEd25519","value":"CYrOiM3HtS7uv1B1OAkknZnFYSRpQYSYII8AtMMtev0="},"value":{"denom":"umuon","amount":"700000000"}}}],"fee":{"amount":[{"denom":"umuon","amount":"6000"}],"gas":"160000"},"signatures":[{"pub_key":{"type":"tendermint/PubKeySecp256k1","value":"AwAOXeWgNf1FjMaayrSnrOOKz+Fivr6DiI/i0x0sZCHw"},"signature":"RcnfS/u2yl7uIShTrSUlDWvsXo2p2dYu6WJC8VDVHMBLEQZWc8bsINSCjOnlsIVkUNNe1q/WCA9n3Gy1+0zhYA=="}],"memo":"","timeout_height":"0"}}`
legacyCdc := simapp.MakeTestEncodingConfig().Amino
var tx legacytx.StdTx
err := legacyCdc.UnmarshalJSON([]byte(txSigned), &tx)
Expand Down
409 changes: 409 additions & 0 deletions docs/architecture/adr-061-liquid-staking.md

Large diffs are not rendered by default.

728 changes: 721 additions & 7 deletions docs/core/proto-docs.md

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions proto/cosmos/base/store/v1beta1/listening.proto
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ message StoreKVPair {
// BlockMetadata contains all the abci event data of a block
// the file streamer dump them into files together with the state changes.
message BlockMetadata {
// DeliverTx encapulate deliver tx request and response.
message DeliverTx {
tendermint.abci.RequestDeliverTx request = 1;
tendermint.abci.ResponseDeliverTx response = 2;
}
tendermint.abci.RequestBeginBlock request_begin_block = 1;
tendermint.abci.ResponseBeginBlock response_begin_block = 2;
repeated DeliverTx deliver_txs = 3;
tendermint.abci.RequestEndBlock request_end_block = 4;
tendermint.abci.ResponseEndBlock response_end_block = 5;
tendermint.abci.ResponseCommit response_commit = 6;
// DeliverTx encapulate deliver tx request and response.
message DeliverTx {
tendermint.abci.RequestDeliverTx request = 1;
tendermint.abci.ResponseDeliverTx response = 2;
}
tendermint.abci.RequestBeginBlock request_begin_block = 1;
tendermint.abci.ResponseBeginBlock response_begin_block = 2;
repeated DeliverTx deliver_txs = 3;
tendermint.abci.RequestEndBlock request_end_block = 4;
tendermint.abci.ResponseEndBlock response_end_block = 5;
tendermint.abci.ResponseCommit response_commit = 6;
}
11 changes: 11 additions & 0 deletions proto/cosmos/distribution/v1beta1/distribution.proto
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,17 @@ message DelegationDelegatorReward {
[(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins", (gogoproto.nullable) = false];
}

// TokenizeShareRecordReward represents the properties of tokenize share
message TokenizeShareRecordReward {
option (gogoproto.goproto_getters) = false;
option (gogoproto.goproto_stringer) = true;

uint64 record_id = 1;

repeated cosmos.base.v1beta1.DecCoin reward = 2
[(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins", (gogoproto.nullable) = false];
}

// CommunityPoolSpendProposalWithDeposit defines a CommunityPoolSpendProposal
// with a deposit
message CommunityPoolSpendProposalWithDeposit {
Expand Down
25 changes: 25 additions & 0 deletions proto/cosmos/distribution/v1beta1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ service Query {
rpc CommunityPool(QueryCommunityPoolRequest) returns (QueryCommunityPoolResponse) {
option (google.api.http).get = "/cosmos/distribution/v1beta1/community_pool";
}

// TokenizeShareRecordReward queries the tokenize share record rewards
rpc TokenizeShareRecordReward(QueryTokenizeShareRecordRewardRequest)
returns (QueryTokenizeShareRecordRewardResponse) {
option (google.api.http).get = "/cosmos/distribution/v1beta1/{owner_address}/tokenize_share_record_rewards";
}
}

// QueryParamsRequest is the request type for the Query/Params RPC method.
Expand Down Expand Up @@ -216,3 +222,22 @@ message QueryCommunityPoolResponse {
repeated cosmos.base.v1beta1.DecCoin pool = 1
[(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins", (gogoproto.nullable) = false];
}

// QueryTokenizeShareRecordRewardRequest is the request type for the Query/TokenizeShareRecordReward RPC
// method.
message QueryTokenizeShareRecordRewardRequest {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;

string owner_address = 1 [(gogoproto.moretags) = "yaml:\"owner_address\""];
}

// QueryTokenizeShareRecordRewardResponse is the response type for the Query/TokenizeShareRecordReward
// RPC method.
message QueryTokenizeShareRecordRewardResponse {
// rewards defines all the rewards accrued by a delegator.
repeated TokenizeShareRecordReward rewards = 1 [(gogoproto.nullable) = false];
// total defines the sum of all the rewards.
repeated cosmos.base.v1beta1.DecCoin total = 2
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins"];
}
32 changes: 32 additions & 0 deletions proto/cosmos/distribution/v1beta1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ service Msg {
// full commission to the validator address.
rpc WithdrawValidatorCommission(MsgWithdrawValidatorCommission) returns (MsgWithdrawValidatorCommissionResponse);

// WithdrawTokenizeShareRecordReward defines a method to withdraw reward for an owning TokenizeShareRecord
rpc WithdrawTokenizeShareRecordReward(MsgWithdrawTokenizeShareRecordReward)
returns (MsgWithdrawTokenizeShareRecordRewardResponse);

// WithdrawAllTokenizeShareRecordReward defines a method to withdraw reward for all owning TokenizeShareRecord
rpc WithdrawAllTokenizeShareRecordReward(MsgWithdrawAllTokenizeShareRecordReward)
returns (MsgWithdrawAllTokenizeShareRecordRewardResponse);

// FundCommunityPool defines a method to allow an account to directly
// fund the community pool.
rpc FundCommunityPool(MsgFundCommunityPool) returns (MsgFundCommunityPoolResponse);
Expand Down Expand Up @@ -64,6 +72,30 @@ message MsgWithdrawValidatorCommission {
// MsgWithdrawValidatorCommissionResponse defines the Msg/WithdrawValidatorCommission response type.
message MsgWithdrawValidatorCommissionResponse {}

// MsgWithdrawTokenizeShareRecordReward withdraws tokenize share rewards for a specific record
message MsgWithdrawTokenizeShareRecordReward {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;

string owner_address = 1 [(gogoproto.moretags) = "yaml:\"owner_address\""];
uint64 record_id = 2;
}

// MsgWithdrawTokenizeShareRecordReward defines the Msg/WithdrawTokenizeShareRecordReward response type.
message MsgWithdrawTokenizeShareRecordRewardResponse {}

// MsgWithdrawAllTokenizeShareRecordReward withdraws tokenize share rewards or all
// records owned by the designated owner
message MsgWithdrawAllTokenizeShareRecordReward {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;

string owner_address = 1 [(gogoproto.moretags) = "yaml:\"owner_address\""];
}

// MsgWithdrawAllTokenizeShareRecordRewardResponse defines the Msg/WithdrawTokenizeShareRecordReward response type.
message MsgWithdrawAllTokenizeShareRecordRewardResponse {}

// MsgFundCommunityPool allows an account to directly
// fund the community pool.
message MsgFundCommunityPool {
Expand Down
28 changes: 28 additions & 0 deletions proto/cosmos/staking/v1beta1/genesis.proto
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ option go_package = "github.com/cosmos/cosmos-sdk/x/staking/types";

import "gogoproto/gogo.proto";
import "cosmos/staking/v1beta1/staking.proto";
import "google/protobuf/timestamp.proto";

// GenesisState defines the staking module's genesis state.
message GenesisState {
Expand Down Expand Up @@ -38,6 +39,33 @@ message GenesisState {
repeated Redelegation redelegations = 7 [(gogoproto.nullable) = false];

bool exported = 8;

// store tokenize share records to provide reward to record owners
repeated TokenizeShareRecord tokenize_share_records = 9 [(gogoproto.nullable) = false];

// last tokenize share record id, used for next share record id calculation
uint64 last_tokenize_share_record_id = 10;

// total number of liquid staked tokens at genesis
bytes total_liquid_staked_tokens = 11 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.moretags) = "yaml:\"total_liquid_staked_tokens\"",
(gogoproto.nullable) = false
];

// tokenize shares locks at genesis
repeated TokenizeShareLock tokenize_share_locks = 12 [(gogoproto.nullable) = false];
}

// TokenizeSharesLock required for specifying account locks at genesis
message TokenizeShareLock {
// Address of the account that is locked
string address = 1;
// Status of the lock (LOCKED or LOCK_EXPIRING)
string status = 2;
// Completion time if the lock is expiring
google.protobuf.Timestamp completion_time = 3
[(gogoproto.nullable) = false, (gogoproto.stdtime) = true, (gogoproto.moretags) = "yaml:\"completion_time\""];
}

// LastValidatorPower required for validator set update logic.
Expand Down
144 changes: 141 additions & 3 deletions proto/cosmos/staking/v1beta1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import "cosmos/base/query/v1beta1/pagination.proto";
import "gogoproto/gogo.proto";
import "google/api/annotations.proto";
import "cosmos/staking/v1beta1/staking.proto";
import "cosmos/base/v1beta1/coin.proto";

option go_package = "github.com/cosmos/cosmos-sdk/x/staking/types";

Expand Down Expand Up @@ -90,6 +91,50 @@ service Query {
rpc Params(QueryParamsRequest) returns (QueryParamsResponse) {
option (google.api.http).get = "/cosmos/staking/v1beta1/params";
}

riley-stride marked this conversation as resolved.
Show resolved Hide resolved
// Query for individual tokenize share record information by share by id
rpc TokenizeShareRecordById(QueryTokenizeShareRecordByIdRequest) returns (QueryTokenizeShareRecordByIdResponse) {
option (google.api.http).get = "/cosmos/staking/v1beta1/tokenize_share_record_by_id/{id}";
}

// Query for individual tokenize share record information by share denom
rpc TokenizeShareRecordByDenom(QueryTokenizeShareRecordByDenomRequest)
returns (QueryTokenizeShareRecordByDenomResponse) {
option (google.api.http).get = "/cosmos/staking/v1beta1/tokenize_share_record_by_denom/{denom}";
}

// Query tokenize share records by address
rpc TokenizeShareRecordsOwned(QueryTokenizeShareRecordsOwnedRequest)
returns (QueryTokenizeShareRecordsOwnedResponse) {
option (google.api.http).get = "/cosmos/staking/v1beta1/tokenize_share_record_owned/{owner}";
}

// Query for all tokenize share records
rpc AllTokenizeShareRecords(QueryAllTokenizeShareRecordsRequest) returns (QueryAllTokenizeShareRecordsResponse) {
option (google.api.http).get = "/cosmos/staking/v1beta1/tokenize_share_records";
}

// Query for last tokenize share record id
rpc LastTokenizeShareRecordId(QueryLastTokenizeShareRecordIdRequest)
returns (QueryLastTokenizeShareRecordIdResponse) {
option (google.api.http).get = "/cosmos/staking/v1beta1/last_tokenize_share_record_id";
}

// Query for total tokenized staked assets
rpc TotalTokenizeSharedAssets(QueryTotalTokenizeSharedAssetsRequest)
returns (QueryTotalTokenizeSharedAssetsResponse) {
option (google.api.http).get = "/cosmos/staking/v1beta1/total_tokenize_shared_assets";
}

// Query for total liquid staked (including tokenized shares or owned by an liquid staking provider)
rpc TotalLiquidStaked(QueryTotalLiquidStaked) returns (QueryTotalLiquidStakedResponse) {
option (google.api.http).get = "/cosmos/staking/v1beta1/total_liquid_staked";
}

// Query tokenize share locks
rpc TokenizeShareLockInfo(QueryTokenizeShareLockInfo) returns (QueryTokenizeShareLockInfoResponse) {
option (google.api.http).get = "/cosmos/staking/v1beta1/tokenize_share_lock_info/{address}";
}
}

// QueryValidatorsRequest is request type for Query/Validators RPC method.
Expand Down Expand Up @@ -118,7 +163,7 @@ message QueryValidatorRequest {

// QueryValidatorResponse is response type for the Query/Validator RPC method
message QueryValidatorResponse {
// validator defines the the validator info.
// validator defines the validator info.
Validator validator = 1 [(gogoproto.nullable) = false];
}

Expand Down Expand Up @@ -288,7 +333,7 @@ message QueryDelegatorValidatorsRequest {
// QueryDelegatorValidatorsResponse is response type for the
// Query/DelegatorValidators RPC method.
message QueryDelegatorValidatorsResponse {
// validators defines the the validators' info of a delegator.
// validators defines the validators' info of a delegator.
repeated Validator validators = 1 [(gogoproto.nullable) = false];

// pagination defines the pagination in the response.
Expand All @@ -311,7 +356,7 @@ message QueryDelegatorValidatorRequest {
// QueryDelegatorValidatorResponse response type for the
// Query/DelegatorValidator RPC method.
message QueryDelegatorValidatorResponse {
// validator defines the the validator info.
// validator defines the validator info.
Validator validator = 1 [(gogoproto.nullable) = false];
}

Expand Down Expand Up @@ -346,3 +391,96 @@ message QueryParamsResponse {
// params holds all the parameters of this module.
Params params = 1 [(gogoproto.nullable) = false];
}

// QueryTokenizeShareRecordByIdRequest is request type for the
// Query/QueryTokenizeShareRecordById RPC method.
message QueryTokenizeShareRecordByIdRequest {
uint64 id = 1;
}

// QueryTokenizeShareRecordByIdRequest is response type for the
// Query/QueryTokenizeShareRecordById RPC method.
message QueryTokenizeShareRecordByIdResponse {
TokenizeShareRecord record = 1 [(gogoproto.nullable) = false];
}

// QueryTokenizeShareRecordByDenomRequest is request type for the
// Query/QueryTokenizeShareRecordByDenom RPC method.
message QueryTokenizeShareRecordByDenomRequest {
string denom = 1;
}

// QueryTokenizeShareRecordByDenomResponse is response type for the
// Query/QueryTokenizeShareRecordByDenom RPC method.
message QueryTokenizeShareRecordByDenomResponse {
TokenizeShareRecord record = 1 [(gogoproto.nullable) = false];
}

// QueryTokenizeShareRecordsOwnedRequest is request type for the
// Query/QueryTokenizeShareRecordsOwned RPC method.
message QueryTokenizeShareRecordsOwnedRequest {
string owner = 1;
}

// QueryTokenizeShareRecordsOwnedResponse is response type for the
// Query/QueryTokenizeShareRecordsOwned RPC method.
message QueryTokenizeShareRecordsOwnedResponse {
repeated TokenizeShareRecord records = 1 [(gogoproto.nullable) = false];
}

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

// QueryAllTokenizeShareRecordsResponse is response type for the
// Query/QueryAllTokenizeShareRecords RPC method.
message QueryAllTokenizeShareRecordsResponse {
repeated TokenizeShareRecord records = 1 [(gogoproto.nullable) = false];
// pagination defines the pagination in the response.
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}

// QueryLastTokenizeShareRecordIdRequest is request type for the
// Query/QueryLastTokenizeShareRecordId RPC method.
message QueryLastTokenizeShareRecordIdRequest {}

// QueryLastTokenizeShareRecordIdResponse is response type for the
// Query/QueryLastTokenizeShareRecordId RPC method.
message QueryLastTokenizeShareRecordIdResponse {
uint64 id = 1;
}

// QueryTotalTokenizeSharedAssetsRequest is request type for the
// Query/QueryTotalTokenizeSharedAssets RPC method.
message QueryTotalTokenizeSharedAssetsRequest {}

// QueryTotalTokenizeSharedAssetsResponse is response type for the
// Query/QueryTotalTokenizeSharedAssets RPC method.
message QueryTotalTokenizeSharedAssetsResponse {
cosmos.base.v1beta1.Coin value = 1 [(gogoproto.nullable) = false];
}

// QueryTotalLiquidStakedRequest is request type for the
// Query/QueryQueryTotalLiquidStaked RPC method.
message QueryTotalLiquidStaked {}

// QueryTotalLiquidStakedResponse is response type for the
// Query/QueryQueryTotalLiquidStaked RPC method.
message QueryTotalLiquidStakedResponse {
string tokens = 1;
riley-stride marked this conversation as resolved.
Show resolved Hide resolved
}

// QueryTokenizeShareLockInfo queries the tokenize share lock information
// associated with given account
message QueryTokenizeShareLockInfo {
string address = 1;
}
// QueryTokenizeShareLockInfoResponse is the response from the
// QueryTokenizeShareLockInfo query
message QueryTokenizeShareLockInfoResponse {
string status = 1;
string expiration_time = 2;
}
Loading