diff --git a/.github/workflows/buildtest.yaml b/.github/workflows/buildtest.yaml index f55ea3ad0..038a29361 100644 --- a/.github/workflows/buildtest.yaml +++ b/.github/workflows/buildtest.yaml @@ -31,7 +31,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v4 with: - go-version: "1.20.5" + go-version: "1.20.11" env: GOOS: ${{ matrix.targetos }} GOARCH: ${{ matrix.arch }} @@ -65,11 +65,10 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v4 with: - go-version: "1.20.5" + go-version: "1.20.11" env: GOOS: ${{ matrix.targetos }} GOARCH: ${{ matrix.arch }} - - name: Setup Golang caches uses: actions/cache@v3 with: @@ -90,9 +89,9 @@ jobs: excludelist+=" $(find ./ -type f -name '*.pb.go')" excludelist+=" $(find ./ -type f -name '*.pb.gw.go')" excludelist+=" $(find ./ -type f -path './test/*.go')" - excludelist+=" $(find ./ -type f -path './osmosis-types/*.go')" + excludelist+=" $(find ./ -type f -path './third-party-chains/*.go')" for filename in ${excludelist}; do - filename=$(echo $filename | sed 's/^./github.com\/ingenuity-build\/quicksilver/g') + filename=$(echo $filename | sed 's/^./github.com\/quicksilver-zone\/quicksilver/g') echo "Excluding ${filename} from coverage report..." sed -i.bak "/$(echo $filename | sed 's/\//\\\//g')/d" coverage.txt done diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index 11da3536b..3392e0f3a 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -24,7 +24,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v4 with: - go-version: "1.20.5" + go-version: "1.20.11" - name: Setup Golang caches uses: actions/cache@v3 diff --git a/Dockerfile b/Dockerfile index ebdf63290..49f81b8e7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,8 @@ -FROM golang:1.20-alpine3.18 AS builder +<<<<<<< HEAD +FROM 1.20.11-alpine3.18 AS builder +======= +FROM golang:1.20.11-alpine3.18 AS builder +>>>>>>> ff736a96 (v1.2.17 (#756)) RUN apk add --no-cache git musl-dev openssl-dev linux-headers ca-certificates build-base WORKDIR /src/app/ diff --git a/Makefile b/Makefile index 153414f5a..f1934a9d5 100755 --- a/Makefile +++ b/Makefile @@ -131,7 +131,7 @@ BUILD_TARGETS := build install check_version: ifneq ($(GO_MINOR_VERSION),20) - @echo "ERROR: Go version 1.20 is required for building Quicksilver. There are consensus breaking changes between binaries compiled with and without Go 1.20." + @echo "ERROR: Go version 1.20 is required for building Quicksilver. There are consensus breaking changes between binaries compiled with different Go versions." exit 1 endif diff --git a/docs/swagger.yml b/docs/swagger.yml index 005049d23..26155a256 100644 --- a/docs/swagger.yml +++ b/docs/swagger.yml @@ -1692,12 +1692,8 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } - // or ... - if (any.isSameTypeAs(Foo.getDefaultInstance())) { - foo = any.unpack(Foo.getDefaultInstance()); - } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -1707,7 +1703,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -1735,8 +1731,10 @@ paths: name "y.z". + JSON + ==== The JSON representation of an `Any` value uses the regular @@ -2005,12 +2003,8 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } - // or ... - if (any.isSameTypeAs(Foo.getDefaultInstance())) { - foo = any.unpack(Foo.getDefaultInstance()); - } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -2020,7 +2014,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -2048,8 +2042,10 @@ paths: name "y.z". + JSON + ==== The JSON representation of an `Any` value uses the regular @@ -2333,15 +2329,12 @@ paths: - Msg /quicksilver/tx/v1/interchainstaking/reopen_channel: post: - operationId: GovReopenChannel + operationId: GovSetLsmCaps responses: '200': description: A successful response. schema: type: object - description: >- - MsgGovReopenChannelResponse defines the MsgGovReopenChannel - response type. default: description: An unexpected error response. schema: @@ -2375,10 +2368,17 @@ paths: type: string description: type: string - connection_id: - type: string - port_id: + chain_id: type: string + caps: + type: object + properties: + validator_cap: + type: string + validator_bond_cap: + type: string + global_cap: + type: string authority: type: string tags: @@ -2950,6 +2950,14 @@ paths: jailed_since: type: string format: date-time + validator_bond_shares: + type: string + title: Number of shares self bonded from the validator + liquid_shares: + type: string + title: >- + Number of shares either tokenized or owned by a + liquid staking provider aggregate_intent: type: array items: @@ -3240,6 +3248,14 @@ paths: jailed_since: type: string format: date-time + validator_bond_shares: + type: string + title: Number of shares self bonded from the validator + liquid_shares: + type: string + title: >- + Number of shares either tokenized or owned by a + liquid staking provider aggregate_intent: type: array items: @@ -4237,6 +4253,14 @@ paths: jailed_since: type: string format: date-time + validator_bond_shares: + type: string + title: Number of shares self bonded from the validator + liquid_shares: + type: string + title: >- + Number of shares either tokenized or owned by a liquid + staking provider pagination: type: object properties: diff --git a/go.mod b/go.mod index 2c57a2c5b..d2b30e2c7 100644 --- a/go.mod +++ b/go.mod @@ -12,9 +12,9 @@ require ( github.com/cometbft/cometbft-db v0.8.0 github.com/confio/ics23/go v0.9.0 github.com/cosmos/cosmos-proto v1.0.0-beta.3 - github.com/cosmos/cosmos-sdk v0.46.15 + github.com/cosmos/cosmos-sdk v0.46.16 github.com/cosmos/gogoproto v1.4.3 - github.com/cosmos/ibc-go/v5 v5.3.1 + github.com/cosmos/ibc-go/v5 v5.3.2 github.com/gogo/protobuf v1.3.3 github.com/golang/protobuf v1.5.3 github.com/golangci/golangci-lint v1.54.1 @@ -100,7 +100,7 @@ require ( github.com/cosmos/btcutil v1.0.5 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/iavl v0.19.6 // indirect - github.com/cosmos/ledger-cosmos-go v0.12.2 // indirect + github.com/cosmos/ledger-cosmos-go v0.12.4 // indirect github.com/creachadair/taskgroup v0.6.0 // indirect github.com/curioswitch/go-reassign v0.2.0 // indirect github.com/daixiang0/gci v0.11.0 // indirect @@ -287,8 +287,8 @@ require ( github.com/yagipy/maintidx v1.0.0 // indirect github.com/yeya24/promlinter v0.2.0 // indirect github.com/ykadowak/zerologlint v0.1.3 // indirect - github.com/zondax/hid v0.9.1 // indirect - github.com/zondax/ledger-go v0.14.2 // indirect + github.com/zondax/hid v0.9.2 // indirect + github.com/zondax/ledger-go v0.14.3 // indirect gitlab.com/bosi/decorder v0.4.0 // indirect go.etcd.io/bbolt v1.3.7 // indirect go.tmz.dev/musttag v0.7.1 // indirect diff --git a/go.sum b/go.sum index 82af658f2..cd7d08960 100644 --- a/go.sum +++ b/go.sum @@ -375,8 +375,8 @@ github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= github.com/cosmos/cosmos-proto v1.0.0-beta.3 h1:VitvZ1lPORTVxkmF2fAp3IiA61xVwArQYKXTdEcpW6o= github.com/cosmos/cosmos-proto v1.0.0-beta.3/go.mod h1:t8IASdLaAq+bbHbjq4p960BvcTqtwuAxid3b/2rOD6I= -github.com/cosmos/cosmos-sdk v0.46.15 h1:50QSEO4ZU9QUHJ8Ul9N/o/hn/IE5dL7DwL/OY1wcoMg= -github.com/cosmos/cosmos-sdk v0.46.15/go.mod h1:9MRixWsgoJ2UmVsCRRePtENFPP3cM+gTC5azEpxgllo= +github.com/cosmos/cosmos-sdk v0.46.16 h1:RVGv1+RulLZeNyfCaPZrZtv0kY7ZZNAI6JGpub0Uh6o= +github.com/cosmos/cosmos-sdk v0.46.16/go.mod h1:05U50tAsOzQ8JOAePshJCbJQw5ib1YJR6IXcqyVI1Xg= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= @@ -384,13 +384,13 @@ github.com/cosmos/gogoproto v1.4.3 h1:RP3yyVREh9snv/lsOvmsAPQt8f44LgL281X0IOIhhc github.com/cosmos/gogoproto v1.4.3/go.mod h1:0hLIG5TR7IvV1fme1HCFKjfzW9X2x0Mo+RooWXCnOWU= github.com/cosmos/iavl v0.19.6 h1:XY78yEeNPrEYyNCKlqr9chrwoeSDJ0bV2VjocTk//OU= github.com/cosmos/iavl v0.19.6/go.mod h1:X9PKD3J0iFxdmgNLa7b2LYWdsGd90ToV5cAONApkEPw= -github.com/cosmos/ibc-go/v5 v5.3.1 h1:zuaIWMEoXM9egWmmAqzBPYLvEjYgB6xy6wZoc8xsZ5U= -github.com/cosmos/ibc-go/v5 v5.3.1/go.mod h1:Q2W1rjtwR738fqFQhE66dZ0frsLlr+Wiezlwei0TMGo= +github.com/cosmos/ibc-go/v5 v5.3.2 h1:PPSs5hNAjYd8jVfHvXsqfnCYd/r9C7wpu+O2A4TOO5g= +github.com/cosmos/ibc-go/v5 v5.3.2/go.mod h1:Q2W1rjtwR738fqFQhE66dZ0frsLlr+Wiezlwei0TMGo= github.com/cosmos/interchain-accounts v0.3.2 h1:7S5rSndahpjkzUvG00kKZrTZsEuVHuVC9a7p0qDVcF8= github.com/cosmos/keyring v1.2.0 h1:8C1lBP9xhImmIabyXW4c3vFjjLiBdGCmfLUfeZlV1Yo= github.com/cosmos/keyring v1.2.0/go.mod h1:fc+wB5KTk9wQ9sDx0kFXB3A0MaeGHM9AwRStKOQ5vOA= -github.com/cosmos/ledger-cosmos-go v0.12.2 h1:/XYaBlE2BJxtvpkHiBm97gFGSGmYGKunKyF3nNqAXZA= -github.com/cosmos/ledger-cosmos-go v0.12.2/go.mod h1:ZcqYgnfNJ6lAXe4HPtWgarNEY+B74i+2/8MhZw4ziiI= +github.com/cosmos/ledger-cosmos-go v0.12.4 h1:drvWt+GJP7Aiw550yeb3ON/zsrgW0jgh5saFCr7pDnw= +github.com/cosmos/ledger-cosmos-go v0.12.4/go.mod h1:fjfVWRf++Xkygt9wzCsjEBdjcf7wiiY35fv3ctT+k4M= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= @@ -1256,10 +1256,10 @@ github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9dec github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -github.com/zondax/hid v0.9.1 h1:gQe66rtmyZ8VeGFcOpbuH3r7erYtNEAezCAYu8LdkJo= -github.com/zondax/hid v0.9.1/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM= -github.com/zondax/ledger-go v0.14.2 h1:NDaba434N7JUVKg4P4nFv6TOjSkUosYb9sdiw3c61Zk= -github.com/zondax/ledger-go v0.14.2/go.mod h1:fZ3Dqg6qcdXWSOJFKMG8GCTnD7slO/RL2feOQv8K320= +github.com/zondax/hid v0.9.2 h1:WCJFnEDMiqGF64nlZz28E9qLVZ0KSJ7xpc5DLEyma2U= +github.com/zondax/hid v0.9.2/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM= +github.com/zondax/ledger-go v0.14.3 h1:wEpJt2CEcBJ428md/5MgSLsXLBos98sBOyxNmCjfUCw= +github.com/zondax/ledger-go v0.14.3/go.mod h1:IKKaoxupuB43g4NxeQmbLXv7T9AlQyie1UpHb342ycI= gitlab.com/bosi/decorder v0.4.0 h1:HWuxAhSxIvsITcXeP+iIRg9d1cVfvVkmlF7M68GaoDY= gitlab.com/bosi/decorder v0.4.0/go.mod h1:xarnteyUoJiOTEldDysquWKTVDCKo2TOIOIibSuWqOg= go-simpler.org/assert v0.5.0 h1:+5L/lajuQtzmbtEfh69sr5cRf2/xZzyJhFjoOz/PPqs= diff --git a/icq-relayer/Dockerfile b/icq-relayer/Dockerfile index 8dc77da35..1b4e96738 100644 --- a/icq-relayer/Dockerfile +++ b/icq-relayer/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.20-alpine3.18 as build +FROM 1.20.11-alpine3.18 as build WORKDIR /src/app diff --git a/icq-relayer/cmd/keys.go b/icq-relayer/cmd/keys.go index cf1b11b22..1518a0ff6 100644 --- a/icq-relayer/cmd/keys.go +++ b/icq-relayer/cmd/keys.go @@ -19,10 +19,8 @@ const ( defaultCoinType uint32 = sdk.CoinType ) -var ( - // FlagAccountPrefix allows the user to override the prefix for a given account - FlagAccountPrefix = "" -) +// FlagAccountPrefix allows the user to override the prefix for a given account +var FlagAccountPrefix = "" // keysCmd represents the keys command func keysCmd() *cobra.Command { diff --git a/icq-relayer/pkg/runner/run.go b/icq-relayer/pkg/runner/run.go index 2ace6bda9..cac84fa7d 100644 --- a/icq-relayer/pkg/runner/run.go +++ b/icq-relayer/pkg/runner/run.go @@ -218,7 +218,6 @@ type Query struct { } func handleHistoricRequests(queries []qstypes.Query, sourceChainId string, logger log.Logger, metrics prommetrics.Metrics) { - metrics.HistoricQueries.WithLabelValues("historic-queries").Set(float64(len(queries))) if len(queries) == 0 { @@ -365,7 +364,6 @@ func handleEvent(event coretypes.ResultEvent, logger log.Logger, metrics prommet } func RunGRPCQuery(ctx context.Context, client *lensclient.ChainClient, method string, reqBz []byte, md metadata.MD, metrics prommetrics.Metrics) (abcitypes.ResponseQuery, metadata.MD, error) { - // parse height header height, err := lensclient.GetHeightFromMetadata(md) if err != nil { @@ -422,6 +420,7 @@ func retryLightblock(ctx context.Context, client *lensclient.ChainClient, height } return lightBlock.(*tmtypes.LightBlock), err } + func doRequestWithMetrics(query Query, logger log.Logger, metrics prommetrics.Metrics) { startTime := time.Now() metrics.Requests.WithLabelValues("requests", query.Type).Inc() @@ -546,7 +545,6 @@ func doRequest(query Query, logger log.Logger, metrics prommetrics.Metrics) { // does not contain the Tx object (that we don't use, because the TxProof already contains a byte representation of tx anyway!) // Note: this function is compatible with 0.34 and 0.37 representations of transactions. func Tx(client *lensclient.ChainClient, hash []byte) (tmtypes.TxProof, int64, error) { - params := map[string]interface{}{ "hash": hash, "prove": true, @@ -611,7 +609,6 @@ func Tx(client *lensclient.ChainClient, hash []byte) (tmtypes.TxProof, int64, er } return result.Proof, int64(height), nil - } // a minimised representation of the Tx emitted by a Tx query, only containing Height and Proof and thus compatbiel with tm0.34 and tm0.37. @@ -670,7 +667,6 @@ func getHeader(ctx context.Context, client, submitClient *lensclient.ChainClient clientHeight, ok := trustedHeight.(clienttypes.Height) if !ok { return nil, fmt.Errorf("error: Could coerce trusted height") - } if !historicOk && clientHeight.RevisionHeight >= uint64(requestHeight+1) { @@ -808,7 +804,6 @@ func unique(msgSlice []sdk.Msg, logger log.Logger) []sdk.Msg { } func Close() error { - query := tmquery.MustParse(fmt.Sprintf("message.module='%s'", "interchainquery")) for _, chainClient := range globalCfg.Cl { diff --git a/proto/Dockerfile b/proto/Dockerfile index 8c3984541..aac9dfd20 100644 --- a/proto/Dockerfile +++ b/proto/Dockerfile @@ -1,5 +1,5 @@ FROM bufbuild/buf:latest as BUILDER -FROM golang:1.20-alpine +FROM 1.20.11-alpine RUN apk add --no-cache \ nodejs \ diff --git a/proto/quicksilver/interchainstaking/v1/interchainstaking.proto b/proto/quicksilver/interchainstaking/v1/interchainstaking.proto index a9e57afa7..0555264bd 100644 --- a/proto/quicksilver/interchainstaking/v1/interchainstaking.proto +++ b/proto/quicksilver/interchainstaking/v1/interchainstaking.proto @@ -57,6 +57,24 @@ message SubzoneInfo { string base_chainID = 2; } +message LsmCaps { + string validator_cap = 1 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + string validator_bond_cap = 2 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + string global_cap = 3 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; +} + message ICAAccount { string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // balance defines the different coins this balance holds. @@ -157,6 +175,18 @@ message Validator { (gogoproto.nullable) = false, (gogoproto.stdtime) = true ]; + // Number of shares self bonded from the validator + string validator_bond_shares = 10 [ + (gogoproto.moretags) = "yaml:\"validator_bond_shares\"", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + // Number of shares either tokenized or owned by a liquid staking provider + string liquid_shares = 11 [ + (gogoproto.moretags) = "yaml:\"liquid_shares\"", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; } message DelegatorIntent { diff --git a/proto/quicksilver/interchainstaking/v1/messages.proto b/proto/quicksilver/interchainstaking/v1/messages.proto index fc4024807..43a1e91b6 100644 --- a/proto/quicksilver/interchainstaking/v1/messages.proto +++ b/proto/quicksilver/interchainstaking/v1/messages.proto @@ -43,6 +43,13 @@ service Msg { body: "*" }; } + + rpc GovSetLsmCaps(MsgGovSetLsmCaps) returns (MsgGovSetLsmCapsResponse) { + option (google.api.http) = { + post: "/quicksilver/tx/v1/interchainstaking/reopen_channel" + body: "*" + }; + } } // MsgRequestRedemption represents a message type to request a burn of qAssets @@ -59,6 +66,9 @@ message MsgRequestRedemption { string from_address = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; } +// MsgRequestRedemptionResponse defines the MsgRequestRedemption response type. +message MsgRequestRedemptionResponse {} + // MsgSignalIntent represents a message type for signalling voting intent for // one or more validators. message MsgSignalIntent { @@ -70,8 +80,5 @@ message MsgSignalIntent { string from_address = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; } -// MsgRequestRedemptionResponse defines the MsgRequestRedemption response type. -message MsgRequestRedemptionResponse {} - // MsgSignalIntentResponse defines the MsgSignalIntent response type. message MsgSignalIntentResponse {} diff --git a/proto/quicksilver/interchainstaking/v1/proposals.proto b/proto/quicksilver/interchainstaking/v1/proposals.proto index e99b0f9ee..04a401dad 100644 --- a/proto/quicksilver/interchainstaking/v1/proposals.proto +++ b/proto/quicksilver/interchainstaking/v1/proposals.proto @@ -3,6 +3,7 @@ package quicksilver.interchainstaking.v1; import "cosmos_proto/cosmos.proto"; import "gogoproto/gogo.proto"; +import "quicksilver/interchainstaking/v1/interchainstaking.proto"; option go_package = "github.com/quicksilver-zone/quicksilver/x/interchainstaking/types"; @@ -111,3 +112,18 @@ message MsgGovCloseChannel { // MsgGovCloseChannelResponse defines the MsgGovCloseChannel response type. message MsgGovCloseChannelResponse {} + +message MsgGovSetLsmCaps { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + string title = 1; + string description = 2; + + string chain_id = 3 [(gogoproto.moretags) = "yaml:\"chain_id\""]; + LsmCaps caps = 4 [(gogoproto.moretags) = "yaml:\"caps\""]; + + string authority = 5 [(cosmos_proto.scalar) = "cosmos.AddressString"]; +} + +message MsgGovSetLsmCapsResponse {} diff --git a/proto/quicksilver/lsm-types/v1/types.proto b/proto/quicksilver/lsm-types/v1/types.proto new file mode 100644 index 000000000..a19c96acf --- /dev/null +++ b/proto/quicksilver/lsm-types/v1/types.proto @@ -0,0 +1,299 @@ +syntax = "proto3"; +package cosmos.staking.v1beta1; + +import "cosmos/base/query/v1beta1/pagination.proto"; +import "cosmos/base/v1beta1/coin.proto"; +import "cosmos/staking/v1beta1/staking.proto"; +import "gogoproto/gogo.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "github.com/quicksilver-zone/quicksilver/x/lsmtypes"; +option (gogoproto.equal_all) = true; + +// 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 + ]; +} + +// 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" + ]; +} + +// 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 {} + +// 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 { + option (gogoproto.equal) = false; + // 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 { + option (gogoproto.equal) = false; + 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; +} + +// 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; +} + +// TokenizeShareRecord represents a tokenized delegation +message TokenizeShareRecord { + option (gogoproto.equal) = true; + + uint64 id = 1; + string owner = 2; + string module_account = 3; // module account take the role of delegator + string validator = 4; // validator delegated to for tokenize share record creation +} + +// PendingTokenizeShareAuthorizations stores a list of addresses that have their +// tokenize share enablement in progress +message PendingTokenizeShareAuthorizations { + repeated string addresses = 1; +} + +// TokenizeShareLockStatus indicates whether the address is able to tokenize +// shares +enum TokenizeShareLockStatus { + option (gogoproto.goproto_enum_prefix) = false; + + // UNSPECIFIED defines an empty tokenize share lock status + TOKENIZE_SHARE_LOCK_STATUS_UNSPECIFIED = 0; + // LOCKED indicates the account is locked and cannot tokenize shares + TOKENIZE_SHARE_LOCK_STATUS_LOCKED = 1; + // UNLOCKED indicates the account is unlocked and can tokenize shares + TOKENIZE_SHARE_LOCK_STATUS_UNLOCKED = 2; + // LOCK_EXPIRING indicates the account is unable to tokenize shares, but + // will be able to tokenize shortly (after 1 unbonding period) + TOKENIZE_SHARE_LOCK_STATUS_LOCK_EXPIRING = 3; +} + +// MsgUnbondValidator defines a method for performing the status transition for +// a validator from bonded to unbonded +message MsgUnbondValidator { + string validator_address = 1 [(gogoproto.moretags) = "yaml:\"address\""]; +} + +// MsgUnbondValidatorResponse defines the Msg/UnbondValidator response type. +message MsgUnbondValidatorResponse {} + +// MsgTokenizeShares tokenizes a delegation +message MsgTokenizeShares { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + string delegator_address = 1 [(gogoproto.moretags) = "yaml:\"delegator_address\""]; + string validator_address = 2 [(gogoproto.moretags) = "yaml:\"validator_address\""]; + cosmos.base.v1beta1.Coin amount = 3 [(gogoproto.nullable) = false]; + string tokenized_share_owner = 4; +} + +// MsgTokenizeSharesResponse defines the Msg/MsgTokenizeShares response type. +message MsgTokenizeSharesResponse { + cosmos.base.v1beta1.Coin amount = 1 [(gogoproto.nullable) = false]; +} + +// MsgRedeemTokensForShares redeems a tokenized share back into a native +// delegation +message MsgRedeemTokensForShares { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + string delegator_address = 1 [(gogoproto.moretags) = "yaml:\"delegator_address\""]; + cosmos.base.v1beta1.Coin amount = 2 [(gogoproto.nullable) = false]; +} + +// MsgRedeemTokensForSharesResponse defines the Msg/MsgRedeemTokensForShares +// response type. +message MsgRedeemTokensForSharesResponse { + cosmos.base.v1beta1.Coin amount = 1 [(gogoproto.nullable) = false]; +} + +// MsgTransferTokenizeShareRecord transfer a tokenize share record +message MsgTransferTokenizeShareRecord { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + uint64 tokenize_share_record_id = 1; + string sender = 2; + string new_owner = 3; +} + +// MsgTransferTokenizeShareRecordResponse defines the +// Msg/MsgTransferTokenizeShareRecord response type. +message MsgTransferTokenizeShareRecordResponse {} + +// MsgDisableTokenizeShares prevents the tokenization of shares for a given +// address +message MsgDisableTokenizeShares { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + string delegator_address = 1 [(gogoproto.moretags) = "yaml:\"delegator_address\""]; +} + +// MsgDisableTokenizeSharesResponse defines the Msg/DisableTokenizeShares +// response type. +message MsgDisableTokenizeSharesResponse {} + +// MsgEnableTokenizeShares re-enables tokenization of shares for a given address +message MsgEnableTokenizeShares { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + string delegator_address = 1 [(gogoproto.moretags) = "yaml:\"delegator_address\""]; +} + +// MsgEnableTokenizeSharesResponse defines the Msg/EnableTokenizeShares response +// type. +message MsgEnableTokenizeSharesResponse { + google.protobuf.Timestamp completion_time = 1 [ + (gogoproto.nullable) = false, + (gogoproto.stdtime) = true + ]; +} + +// MsgValidatorBond defines a SDK message for performing validator self-bond of +// delegated coins from a delegator to a validator. +message MsgValidatorBond { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + string delegator_address = 1 [(gogoproto.moretags) = "yaml:\"delegator_address\""]; + string validator_address = 2 [(gogoproto.moretags) = "yaml:\"validator_address\""]; +} + +// MsgValidatorBondResponse defines the Msg/ValidatorBond response type. +message MsgValidatorBondResponse {} diff --git a/proto/quicksilver/lsm-types/v1/validator.proto b/proto/quicksilver/lsm-types/v1/validator.proto new file mode 100644 index 000000000..78421025b --- /dev/null +++ b/proto/quicksilver/lsm-types/v1/validator.proto @@ -0,0 +1,102 @@ +syntax = "proto3"; +package cosmos.lsmstaking.v1beta1; + +import "cosmos/base/query/v1beta1/pagination.proto"; +import "cosmos/base/v1beta1/coin.proto"; +import "cosmos/staking/v1beta1/staking.proto"; +import "cosmos_proto/cosmos.proto"; +import "gogoproto/gogo.proto"; +import "google/protobuf/any.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "github.com/quicksilver-zone/quicksilver/x/lsmtypes"; +option (gogoproto.equal_all) = true; + +// Validator defines a validator, together with the total amount of the +// Validator's bond shares and their exchange rate to coins. Slashing results in +// a decrease in the exchange rate, allowing correct calculation of future +// undelegations without iterating over delegators. When coins are delegated to +// this validator, the validator is credited with a delegation whose number of +// bond shares is based on the amount of coins delegated divided by the current +// exchange rate. Voting power can be calculated as total bonded shares +// multiplied by exchange rate. +message Validator { + option (gogoproto.equal) = false; + option (gogoproto.goproto_stringer) = false; + option (gogoproto.goproto_getters) = false; + + // operator_address defines the address of the validator's operator; bech + // encoded in JSON. + string operator_address = 1 [(gogoproto.moretags) = "yaml:\"operator_address\""]; + // consensus_pubkey is the consensus public key of the validator, as a + // Protobuf Any. + google.protobuf.Any consensus_pubkey = 2 [ + (cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey", + (gogoproto.moretags) = "yaml:\"consensus_pubkey\"" + ]; + // jailed defined whether the validator has been jailed from bonded status or + // not. + bool jailed = 3; + // status is the validator status (bonded/unbonding/unbonded). + cosmos.staking.v1beta1.BondStatus status = 4; + // tokens define the delegated tokens (incl. self-delegation). + string tokens = 5 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; + // delegator_shares defines total shares issued to a validator's delegators. + string delegator_shares = 6 [ + (gogoproto.moretags) = "yaml:\"delegator_shares\"", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + // description defines the description terms for the validator. + cosmos.staking.v1beta1.Description description = 7 [(gogoproto.nullable) = false]; + // unbonding_height defines, if unbonding, the height at which this validator + // has begun unbonding. + int64 unbonding_height = 8 [(gogoproto.moretags) = "yaml:\"unbonding_height\""]; + // unbonding_time defines, if unbonding, the min time for the validator to + // complete unbonding. + google.protobuf.Timestamp unbonding_time = 9 [ + (gogoproto.nullable) = false, + (gogoproto.stdtime) = true, + (gogoproto.moretags) = "yaml:\"unbonding_time\"" + ]; + // commission defines the commission parameters. + cosmos.staking.v1beta1.Commission commission = 10 [(gogoproto.nullable) = false]; + // Deprecated: This field has been deprecated with LSM in favor of the + // validator bond + string min_self_delegation = 11 [ + deprecated = true, + (gogoproto.moretags) = "yaml:\"min_self_delegation\"", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; + // strictly positive if this validator's unbonding has been stopped by + // external modules + int64 unbonding_on_hold_ref_count = 12; + // list of unbonding ids, each uniquely identifing an unbonding of this + // validator + repeated uint64 unbonding_ids = 13; + // Number of shares self bonded from the validator + string validator_bond_shares = 14 [ + (gogoproto.moretags) = "yaml:\"validator_bond_shares\"", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + // Number of shares either tokenized or owned by a liquid staking provider + string liquid_shares = 15 [ + (gogoproto.moretags) = "yaml:\"liquid_shares\"", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; +} + +message QueryValidatorsResponse { + option (gogoproto.equal) = false; + // validators contains all the queried validators. + repeated Validator validators = 1 [(gogoproto.nullable) = false]; + + // pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} diff --git a/scripts/protocgen.sh b/scripts/protocgen.sh index ada9b8db9..370f5faa5 100755 --- a/scripts/protocgen.sh +++ b/scripts/protocgen.sh @@ -19,4 +19,4 @@ cd .. cp -r github.com/quicksilver-zone/quicksilver/* ./ rm -rf github.com -go mod tidy -compat=1.20 +go mod tidy diff --git a/x/airdrop/types/messages.pb.go b/x/airdrop/types/messages.pb.go index de5757778..04c0d1a38 100644 --- a/x/airdrop/types/messages.pb.go +++ b/x/airdrop/types/messages.pb.go @@ -200,48 +200,48 @@ func init() { } var fileDescriptor_2b0828c7de1949a1 = []byte{ - // 655 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0x3d, 0x6f, 0x13, 0x4d, - 0x10, 0xf6, 0xd9, 0x79, 0xf3, 0xb1, 0xaf, 0xde, 0x0f, 0x8e, 0x10, 0x1c, 0x0b, 0xee, 0xac, 0x43, - 0x91, 0x4c, 0x90, 0xef, 0xe2, 0xf0, 0x11, 0xc9, 0x1d, 0x0e, 0x4d, 0x8a, 0xa0, 0xe0, 0x74, 0x34, - 0xd6, 0xfa, 0x6e, 0xd9, 0xac, 0xe2, 0xdb, 0x39, 0x6e, 0xd7, 0x56, 0x42, 0x85, 0x22, 0x21, 0x51, - 0x22, 0xf1, 0x07, 0x52, 0x53, 0x51, 0x20, 0x7a, 0xba, 0x94, 0x11, 0x34, 0x54, 0x06, 0x25, 0x48, - 0x50, 0xe7, 0x17, 0xa0, 0xdb, 0xdb, 0x73, 0xce, 0x22, 0x24, 0xa2, 0xf2, 0xde, 0xcc, 0x33, 0xcf, - 0xcc, 0x3c, 0x33, 0x63, 0xb4, 0xf0, 0xb4, 0xcf, 0xfc, 0x6d, 0xc1, 0x7a, 0x03, 0x12, 0x7b, 0x98, - 0xc5, 0x41, 0x0c, 0x91, 0x37, 0x68, 0x78, 0x21, 0x11, 0x02, 0x53, 0x22, 0xdc, 0x28, 0x06, 0x09, - 0xe6, 0x5c, 0x0e, 0xe6, 0x6a, 0x98, 0x3b, 0x68, 0x54, 0x2c, 0x1f, 0x44, 0x08, 0xc2, 0xeb, 0x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a1, 0x88, 0x4a, - 0xeb, 0x82, 0x9a, 0xcf, 0x0d, 0xf4, 0x57, 0xba, 0x7a, 0x55, 0xf7, 0xec, 0xd3, 0x72, 0xb3, 0xa9, - 0x54, 0x6a, 0x17, 0x21, 0x32, 0x76, 0xe7, 0xd6, 0xde, 0xa7, 0x6f, 0xaf, 0x8b, 0x0b, 0x4d, 0x63, - 0xd1, 0xa9, 0x7a, 0xf9, 0x8b, 0x90, 0x3b, 0xc9, 0x19, 0x64, 0xe7, 0xad, 0xd6, 0xc5, 0x7c, 0x6f, - 0x20, 0xf3, 0x8c, 0x81, 0xd5, 0xcf, 0xc9, 0xf6, 0x2b, 0xbc, 0x72, 0xf7, 0x8f, 0xe0, 0xa3, 0x4a, - 0x9b, 0xaa, 0xd2, 0x3b, 0x49, 0xa5, 0xde, 0x39, 0x95, 0xb2, 0x8c, 0xa1, 0x13, 0x01, 0xf4, 0x3a, - 0x22, 0xe1, 0x68, 0x3d, 0x3a, 0x38, 0xb2, 0x8c, 0xc3, 0x23, 0xcb, 0xf8, 0x7a, 0x64, 0x19, 0xaf, - 0x8e, 0xad, 0xc2, 0xe1, 0xb1, 0x55, 0xf8, 0x7c, 0x6c, 0x15, 0x1e, 0xaf, 0xe4, 0x06, 0x99, 0x23, - 0xad, 0x3f, 0x03, 0x4e, 0xc6, 0xb2, 0xec, 0x8c, 0x32, 0xa8, 0xe9, 0x76, 0x27, 0xd5, 0x7f, 0xc2, - 0xed, 0x9f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x63, 0x6a, 0x3e, 0x7f, 0x0e, 0x05, 0x00, 0x00, + // 654 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0xbb, 0x6f, 0x13, 0x4f, + 0x10, 0xf6, 0xd9, 0xf9, 0xe5, 0xb1, 0x3f, 0xf1, 0x3a, 0x42, 0x70, 0x2c, 0xf0, 0x59, 0x87, 0x22, + 0x19, 0x23, 0xdf, 0xc5, 0xe1, 0x11, 0xc9, 0x1d, 0x0e, 0x4d, 0x8a, 0xa0, 0xe0, 0x74, 0x34, 0xd6, + 0xfa, 0x6e, 0xd9, 0xac, 0xe2, 0xdb, 0x39, 0x6e, 0xd7, 0x56, 0x42, 0x85, 0x22, 0x21, 0x51, 0x22, + 0xf1, 0x0f, 0xa4, 0xa6, 0xa2, 0x40, 0xf4, 0x74, 0x29, 0x23, 0x68, 0xa8, 0x0c, 0x4a, 0x90, 0xa0, + 0xce, 0x5f, 0x80, 0x6e, 0x6f, 0xcf, 0x39, 0x8b, 0x90, 0x88, 0xca, 0x7b, 0x33, 0xdf, 0x37, 0x8f, + 0x6f, 0x66, 0x8c, 0x16, 0x9e, 0xf7, 0x99, 0xb7, 0x25, 0x58, 0x6f, 0x40, 0x22, 0x17, 0xb3, 0xc8, + 0x8f, 0x20, 0x74, 0x07, 0x0d, 0x37, 0x20, 0x42, 0x60, 0x4a, 0x84, 0x13, 0x46, 0x20, 0xc1, 0x9c, + 0xcb, 0xc0, 0x1c, 0x0d, 0x73, 0x06, 0x8d, 0x52, 0xd9, 0x03, 0x11, 0x80, 0x70, 0xbb, 0x58, 0x10, + 0x77, 0xd0, 0xe8, 0x12, 0x89, 0x1b, 0xae, 0x07, 0x8c, 0x27, 0xbc, 0xd2, 0x75, 0xed, 0x0f, 0x04, + 0x55, 0x51, 0x05, 0xd5, 0x8e, 0xf9, 0xc4, 0xd1, 0x51, 0x5f, 0x6e, 0xf2, 0xa1, 0x5d, 0xb3, 0x14, + 0x28, 0x24, 0xf6, 0xf8, 0xa5, 0xad, 0x37, 0x28, 0x00, 0xed, 0x11, 0x17, 0x87, 0xcc, 0xc5, 0x9c, + 0x83, 0xc4, 0x92, 0x01, 0x4f, 0x39, 0x8b, 0xd9, 0x36, 0xbc, 0x1e, 0x66, 0x81, 0x08, 0x30, 0xc7, + 0x94, 0x44, 0x71, 0xda, 0x31, 0x43, 0xc2, 0xb0,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0xbd, 0x67, 0xbb, 0x67, 0x54, 0xca, 0x52, 0x7a, 0x27, 0x04, 0xe8, 0x75, 0x44, 0x1c, 0xa0, 0x69, + 0xd4, 0x5a, 0x4f, 0xf6, 0x0f, 0xcb, 0xc6, 0xc1, 0x61, 0xd9, 0xf8, 0x7e, 0x58, 0x36, 0xde, 0x1c, + 0x95, 0x73, 0x07, 0x47, 0xe5, 0xdc, 0xd7, 0xa3, 0x72, 0xee, 0xe9, 0x72, 0x66, 0x90, 0x99, 0xb8, + 0xf5, 0x17, 0xc0, 0xc9, 0x58, 0xa2, 0xed, 0x51, 0x12, 0x35, 0xdd, 0xee, 0xa4, 0xfa, 0x4f, 0xb8, + 0xfb, 0x3b, 0x00, 0x00, 0xff, 0xff, 0xd7, 0xb2, 0xd0, 0x7c, 0x0e, 0x05, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/x/interchainquery/keeper/keeper.go b/x/interchainquery/keeper/keeper.go index 66f21045e..60ec541d9 100644 --- a/x/interchainquery/keeper/keeper.go +++ b/x/interchainquery/keeper/keeper.go @@ -131,7 +131,7 @@ func (k *Keeper) MakeRequest( callbackID string, ttl uint64, ) { - k.Logger(ctx).Info( + k.Logger(ctx).Debug( "MakeRequest", "connection_id", connectionID, "chain_id", chainID, @@ -161,7 +161,7 @@ func (k *Keeper) MakeRequest( k.SetQuery(ctx, *newQuery) } else { // a re-request of an existing query triggers resetting of height to trigger immediately. - k.Logger(ctx).Info("re-request", "LastHeight", existingQuery.LastHeight) + k.Logger(ctx).Debug("re-request", "LastHeight", existingQuery.LastHeight) existingQuery.LastHeight = sdk.ZeroInt() k.SetQuery(ctx, existingQuery) } diff --git a/x/interchainquery/types/messages.pb.go b/x/interchainquery/types/messages.pb.go index 1b170fce0..5723a80ef 100644 --- a/x/interchainquery/types/messages.pb.go +++ b/x/interchainquery/types/messages.pb.go @@ -149,12 +149,12 @@ var fileDescriptor_0640fcbc3e895a79 = []byte{ 0x82, 0x9d, 0x94,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57, 0x05, 0x74, 0x7c, 0xb6, 0xdc, 0x24, 0xc1, 0xb2, 0x57, + 0xd2, 0xbb, 0x7b, 0xf7, 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0x4a, 0xd0, 0x97, 0x34, 0x7a, 0x03, 0x00, 0x00, } diff --git a/x/interchainstaking/client/cli/cli_test.go b/x/interchainstaking/client/cli/cli_test.go index 230f4391a..46bc379b7 100644 --- a/x/interchainstaking/client/cli/cli_test.go +++ b/x/interchainstaking/client/cli/cli_test.go @@ -67,11 +67,11 @@ func (s *IntegrationTestSuite) SetupSuite() { Is_118: true, } zone.Validators = append(zone.Validators, - &types.Validator{ValoperAddress: "cosmosvaloper14lultfckehtszvzw4ehu0apvsr77afvyju5zzy", CommissionRate: sdk.MustNewDecFromStr("0.2"), VotingPower: sdk.NewInt(2000), DelegatorShares: sdk.NewDec(2000), Score: sdk.ZeroDec()}, - &types.Validator{ValoperAddress: "cosmosvaloper156gqf9837u7d4c4678yt3rl4ls9c5vuursrrzf", CommissionRate: sdk.MustNewDecFromStr("0.2"), VotingPower: sdk.NewInt(2000), DelegatorShares: sdk.NewDec(2000), Score: sdk.ZeroDec()}, - &types.Validator{ValoperAddress: "cosmosvaloper1a3yjj7d3qnx4spgvjcwjq9cw9snrrrhu5h6jll", CommissionRate: sdk.MustNewDecFromStr("0.2"), VotingPower: sdk.NewInt(2000), DelegatorShares: sdk.NewDec(2000), Score: sdk.ZeroDec()}, - &types.Validator{ValoperAddress: "cosmosvaloper1sjllsnramtg3ewxqwwrwjxfgc4n4ef9u2lcnj0", CommissionRate: sdk.MustNewDecFromStr("0.2"), VotingPower: sdk.NewInt(2000), DelegatorShares: sdk.NewDec(2000), Score: sdk.ZeroDec()}, - &types.Validator{ValoperAddress: "cosmosvaloper1z8zjv3lntpwxua0rtpvgrcwl0nm0tltgpgs6l7", CommissionRate: sdk.MustNewDecFromStr("0.2"), VotingPower: sdk.NewInt(2000), DelegatorShares: sdk.NewDec(2000), Score: sdk.ZeroDec()}, + &types.Validator{ValoperAddress: "cosmosvaloper1sjllsnramtg3ewxqwwrwjxfgc4n4ef9u2lcnj0", CommissionRate: sdk.MustNewDecFromStr("0.2"), VotingPower: sdk.NewInt(2000), DelegatorShares: sdk.NewDec(2000), Score: sdk.ZeroDec(), ValidatorBondShares: sdk.ZeroDec(), LiquidShares: sdk.ZeroDec()}, + &types.Validator{ValoperAddress: "cosmosvaloper156gqf9837u7d4c4678yt3rl4ls9c5vuursrrzf", CommissionRate: sdk.MustNewDecFromStr("0.2"), VotingPower: sdk.NewInt(2000), DelegatorShares: sdk.NewDec(2000), Score: sdk.ZeroDec(), ValidatorBondShares: sdk.ZeroDec(), LiquidShares: sdk.ZeroDec()}, + &types.Validator{ValoperAddress: "cosmosvaloper14lultfckehtszvzw4ehu0apvsr77afvyju5zzy", CommissionRate: sdk.MustNewDecFromStr("0.2"), VotingPower: sdk.NewInt(2000), DelegatorShares: sdk.NewDec(2000), Score: sdk.ZeroDec(), ValidatorBondShares: sdk.ZeroDec(), LiquidShares: sdk.ZeroDec()}, + &types.Validator{ValoperAddress: "cosmosvaloper1a3yjj7d3qnx4spgvjcwjq9cw9snrrrhu5h6jll", CommissionRate: sdk.MustNewDecFromStr("0.2"), VotingPower: sdk.NewInt(2000), DelegatorShares: sdk.NewDec(2000), Score: sdk.ZeroDec(), ValidatorBondShares: sdk.ZeroDec(), LiquidShares: sdk.ZeroDec()}, + &types.Validator{ValoperAddress: "cosmosvaloper1z8zjv3lntpwxua0rtpvgrcwl0nm0tltgpgs6l7", CommissionRate: sdk.MustNewDecFromStr("0.2"), VotingPower: sdk.NewInt(2000), DelegatorShares: sdk.NewDec(2000), Score: sdk.ZeroDec(), ValidatorBondShares: sdk.ZeroDec(), LiquidShares: sdk.ZeroDec()}, ) // setup basic genesis state diff --git a/x/interchainstaking/keeper/callbacks.go b/x/interchainstaking/keeper/callbacks.go index c613c963a..9a369468b 100644 --- a/x/interchainstaking/keeper/callbacks.go +++ b/x/interchainstaking/keeper/callbacks.go @@ -78,6 +78,7 @@ func (c Callbacks) RegisterCallbacks() icqtypes.QueryCallbacks { AddCallback("accountbalance", Callback(AccountBalanceCallback)). AddCallback("allbalances", Callback(AllBalancesCallback)). AddCallback("delegationaccountbalance", Callback(DelegationAccountBalanceCallback)). + AddCallback("delegationaccountbalances", Callback(DelegationAccountBalancesCallback)). AddCallback("signinginfo", Callback(SigningInfoCallback)) return a.(Callbacks) @@ -518,7 +519,7 @@ func DepositTxCallback(k *Keeper, ctx sdk.Context, args []byte, query icqtypes.Q return err } - txn, err := txDecoder(k.cdc)(res.Proof.Data) + txn, err := TxDecoder(k.cdc)(res.Proof.Data) if err != nil { return err } @@ -617,15 +618,70 @@ func DelegationAccountBalanceCallback(k *Keeper, ctx sdk.Context, args []byte, q return err } + k.Logger(ctx).Info("Received balance response for denom", "denom", coin.Denom) err = zone.DecrementWithdrawalWaitgroup() if err != nil { return err } + + // set the zone amount. + balance := zone.DelegationAddress.Balance + if ok, _ := zone.DelegationAddress.Balance.Find(coin.Denom); !ok { + zone.DelegationAddress.Balance = zone.DelegationAddress.Balance.Add(coin) + } else { + for idx, i := range balance { + if coin.Denom == i.Denom { + zone.DelegationAddress.Balance[idx].Amount = coin.Amount + break + } + } + } + k.SetZone(ctx, &zone) return k.FlushOutstandingDelegations(ctx, &zone, coin) } +func DelegationAccountBalancesCallback(k *Keeper, ctx sdk.Context, args []byte, query icqtypes.Query) error { + zone, found := k.GetZone(ctx, query.GetChainId()) + if !found { + return fmt.Errorf("no registered zone for chain id: %s", query.GetChainId()) + } + result := banktypes.QueryAllBalancesResponse{} + k.cdc.MustUnmarshal(args, &result) + + zone.WithdrawalWaitgroup-- + + addressBytes, err := addressutils.AccAddressFromBech32(zone.DelegationAddress.Address, zone.AccountPrefix) + if err != nil { + k.Logger(ctx).Error("cannot decode bech32 delegation addr") + return err + } + balances := result.GetBalances().Sort() + accountBalances := zone.DelegationAddress.Balance.Sort() + + for _, coin := range balances.Add(accountBalances...) { // we want to iterate over all denoms, including ones we currently have values for. + + k.ICQKeeper.MakeRequest( + ctx, + zone.ConnectionId, + zone.ChainId, + types.BankStoreKey, + append(banktypes.CreateAccountBalancesPrefix(addressBytes), []byte(coin.Denom)...), + sdk.NewInt(-1), + types.ModuleName, + "delegationaccountbalance", + 0, + ) + + k.Logger(ctx).Info("Emitting balance request for denom", "denom", coin.Denom) + zone.WithdrawalWaitgroup++ + } + k.SetZone(ctx, &zone) + + return nil +} + func AllBalancesCallback(k *Keeper, ctx sdk.Context, args []byte, query icqtypes.Query) error { // this shouldn't happen because query.Request comes from Quicksilver if len(query.Request) == 0 { @@ -672,8 +728,8 @@ func AllBalancesCallback(k *Keeper, ctx sdk.Context, args []byte, query icqtypes return k.SetAccountBalance(ctx, zone, balanceQuery.Address, args) } -// txDecoder. -func txDecoder(cdc codec.Codec) sdk.TxDecoder { +// TxDecoder. +func TxDecoder(cdc codec.Codec) sdk.TxDecoder { return func(txBytes []byte) (sdk.Tx, error) { // Make sure txBytes follow ADR-027. err := rejectNonADR027TxRaw(txBytes) diff --git a/x/interchainstaking/keeper/callbacks_test.go b/x/interchainstaking/keeper/callbacks_test.go index c74840ce1..16a99ae96 100644 --- a/x/interchainstaking/keeper/callbacks_test.go +++ b/x/interchainstaking/keeper/callbacks_test.go @@ -62,7 +62,7 @@ func (suite *KeeperTestSuite) setupIbc() (*app.Quicksilver, sdk.Context) { quicksilver.InterchainstakingKeeper.SetZone(ctx, &zone) // get the tx from fixture - txWithProofBz := decodeBase64NoErr(localDepositTxFixture) + txWithProofBz := decodeBase64NoErr(txFixtureLsm) txRes := icqtypes.GetTxWithProofResponse{} err := quicksilver.InterchainQueryKeeper.IBCKeeper.Codec().Unmarshal(txWithProofBz, &txRes) suite.NoError(err) @@ -255,25 +255,24 @@ func (suite *KeeperTestSuite) TestHandleValsetCallback() { require.True(foundQuery) }, }, - // TODO: trigger callback on status change. - // { - // name: "valid - status unbonding val[0]", - // valset: func(in stakingtypes.Validators) stakingtypes.QueryValidatorsResponse { - // in[0].Status = stakingtypes.Unbonding - // return stakingtypes.QueryValidatorsResponse{Validators: in} - // }, - // checks: func(require *require.Assertions, ctx sdk.Context, app *quicksilver.Quicksilver, in stakingtypes.Validators) { - // foundQuery := false - // _, addr, _ := bech32.DecodeAndConvert(in[0].OperatorAddress) - // data := stakingtypes.GetValidatorKey(addr) - // for _, i := range quicksilver.InterchainQueryKeeper.AllQueries(ctx) { - // if i.QueryType == storeStakingKey && bytes.Equal(i.Request, data) { - // foundQuery = true - // } - // } - // require.True(foundQuery) - // }, - // }, + { + name: "valid - status unbonding val[0]", + valset: func(in stakingtypes.Validators) stakingtypes.QueryValidatorsResponse { + in[0].Status = stakingtypes.Unbonding + return stakingtypes.QueryValidatorsResponse{Validators: in} + }, + checks: func(require *require.Assertions, ctx sdk.Context, quicksilver *app.Quicksilver, in stakingtypes.Validators) { + foundQuery := false + _, addr, _ := bech32.DecodeAndConvert(in[0].OperatorAddress) + data := stakingtypes.GetValidatorKey(addr) + for _, i := range quicksilver.InterchainQueryKeeper.AllQueries(ctx) { + if i.QueryType == storeStakingKey && bytes.Equal(i.Request, data) { + foundQuery = true + } + } + require.True(foundQuery) + }, + }, } for _, test := range tests { @@ -418,22 +417,22 @@ func (suite *KeeperTestSuite) TestHandleValidatorCallback() { { name: "valid - no-op", validator: stakingtypes.Validator{OperatorAddress: "cosmosvaloper1sjllsnramtg3ewxqwwrwjxfgc4n4ef9u2lcnj0", Jailed: false, Status: stakingtypes.Bonded, Tokens: sdk.NewInt(2000), DelegatorShares: sdk.NewDec(2000), Commission: stakingtypes.NewCommission(sdk.MustNewDecFromStr("0.2"), sdk.MustNewDecFromStr("0.2"), sdk.MustNewDecFromStr("0.2"))}, - expected: icstypes.Validator{ValoperAddress: "cosmosvaloper1sjllsnramtg3ewxqwwrwjxfgc4n4ef9u2lcnj0", CommissionRate: sdk.MustNewDecFromStr("0.2"), VotingPower: sdk.NewInt(2000), DelegatorShares: sdk.NewDec(2000), Score: sdk.ZeroDec(), Status: "BOND_STATUS_BONDED"}, + expected: icstypes.Validator{ValoperAddress: "cosmosvaloper1sjllsnramtg3ewxqwwrwjxfgc4n4ef9u2lcnj0", CommissionRate: sdk.MustNewDecFromStr("0.2"), VotingPower: sdk.NewInt(2000), DelegatorShares: sdk.NewDec(2000), Score: sdk.ZeroDec(), Status: "BOND_STATUS_BONDED", LiquidShares: sdk.ZeroDec(), ValidatorBondShares: sdk.ZeroDec()}, }, { name: "valid - +2000 tokens/shares", validator: stakingtypes.Validator{OperatorAddress: "cosmosvaloper156gqf9837u7d4c4678yt3rl4ls9c5vuursrrzf", Jailed: false, Status: stakingtypes.Bonded, Tokens: sdk.NewInt(4000), DelegatorShares: sdk.NewDec(4000), Commission: stakingtypes.NewCommission(sdk.MustNewDecFromStr("0.2"), sdk.MustNewDecFromStr("0.2"), sdk.MustNewDecFromStr("0.2"))}, - expected: icstypes.Validator{ValoperAddress: "cosmosvaloper156gqf9837u7d4c4678yt3rl4ls9c5vuursrrzf", CommissionRate: sdk.MustNewDecFromStr("0.2"), VotingPower: sdk.NewInt(4000), DelegatorShares: sdk.NewDec(4000), Score: sdk.ZeroDec(), Status: "BOND_STATUS_BONDED"}, + expected: icstypes.Validator{ValoperAddress: "cosmosvaloper156gqf9837u7d4c4678yt3rl4ls9c5vuursrrzf", CommissionRate: sdk.MustNewDecFromStr("0.2"), VotingPower: sdk.NewInt(4000), DelegatorShares: sdk.NewDec(4000), Score: sdk.ZeroDec(), Status: "BOND_STATUS_BONDED", LiquidShares: sdk.ZeroDec(), ValidatorBondShares: sdk.ZeroDec()}, }, { name: "valid - inc. commission", validator: stakingtypes.Validator{OperatorAddress: "cosmosvaloper14lultfckehtszvzw4ehu0apvsr77afvyju5zzy", Jailed: false, Status: stakingtypes.Bonded, Tokens: sdk.NewInt(2000), DelegatorShares: sdk.NewDec(2000), Commission: stakingtypes.NewCommission(sdk.MustNewDecFromStr("0.5"), sdk.MustNewDecFromStr("0.2"), sdk.MustNewDecFromStr("0.2"))}, - expected: icstypes.Validator{ValoperAddress: "cosmosvaloper14lultfckehtszvzw4ehu0apvsr77afvyju5zzy", CommissionRate: sdk.MustNewDecFromStr("0.5"), VotingPower: sdk.NewInt(2000), DelegatorShares: sdk.NewDec(2000), Score: sdk.ZeroDec(), Status: "BOND_STATUS_BONDED"}, + expected: icstypes.Validator{ValoperAddress: "cosmosvaloper14lultfckehtszvzw4ehu0apvsr77afvyju5zzy", CommissionRate: sdk.MustNewDecFromStr("0.5"), VotingPower: sdk.NewInt(2000), DelegatorShares: sdk.NewDec(2000), Score: sdk.ZeroDec(), Status: "BOND_STATUS_BONDED", LiquidShares: sdk.ZeroDec(), ValidatorBondShares: sdk.ZeroDec()}, }, { name: "valid - new validator", validator: stakingtypes.Validator{OperatorAddress: newVal, Jailed: false, Status: stakingtypes.Bonded, Tokens: sdk.NewInt(3000), DelegatorShares: sdk.NewDec(3050), Commission: stakingtypes.NewCommission(sdk.MustNewDecFromStr("0.25"), sdk.MustNewDecFromStr("0.2"), sdk.MustNewDecFromStr("0.2"))}, - expected: icstypes.Validator{ValoperAddress: newVal, CommissionRate: sdk.MustNewDecFromStr("0.25"), VotingPower: sdk.NewInt(3000), DelegatorShares: sdk.NewDec(3050), Score: sdk.ZeroDec(), Status: "BOND_STATUS_BONDED"}, + expected: icstypes.Validator{ValoperAddress: newVal, CommissionRate: sdk.MustNewDecFromStr("0.25"), VotingPower: sdk.NewInt(3000), DelegatorShares: sdk.NewDec(3050), Score: sdk.ZeroDec(), Status: "BOND_STATUS_BONDED", LiquidShares: sdk.ZeroDec(), ValidatorBondShares: sdk.ZeroDec()}, }, } @@ -1449,7 +1448,7 @@ func TestDelegationsCallbackAllPresentNoChange(t *testing.T) { data := cdc.MustMarshal(&response) - delegationQuery := stakingtypes.QueryDelegatorDelegationsRequest{DelegatorAddr: zone.DelegationAddress.Address, Pagination: &query.PageRequest{Limit: uint64(len(zone.Validators))}} + delegationQuery := stakingtypes.QueryDelegatorDelegationsRequest{DelegatorAddr: zone.DelegationAddress.Address, Pagination: &query.PageRequest{Limit: uint64(len(vals))}} bz := cdc.MustMarshal(&delegationQuery) err := keeper.DelegationsCallback(quicksilver.InterchainstakingKeeper, ctx, data, icqtypes.Query{ChainId: suite.chainB.ChainID, Request: bz}) @@ -1498,7 +1497,7 @@ func TestDelegationsCallbackAllPresentOneChange(t *testing.T) { data := cdc.MustMarshal(&response) - delegationQuery := stakingtypes.QueryDelegatorDelegationsRequest{DelegatorAddr: zone.DelegationAddress.Address, Pagination: &query.PageRequest{Limit: uint64(len(zone.Validators))}} + delegationQuery := stakingtypes.QueryDelegatorDelegationsRequest{DelegatorAddr: zone.DelegationAddress.Address, Pagination: &query.PageRequest{Limit: uint64(len(vals))}} bz := cdc.MustMarshal(&delegationQuery) err := keeper.DelegationsCallback(quicksilver.InterchainstakingKeeper, ctx, data, icqtypes.Query{ChainId: suite.chainB.ChainID, Request: bz}) @@ -1546,7 +1545,7 @@ func TestDelegationsCallbackOneMissing(t *testing.T) { data := cdc.MustMarshal(&response) - delegationQuery := stakingtypes.QueryDelegatorDelegationsRequest{DelegatorAddr: zone.DelegationAddress.Address, Pagination: &query.PageRequest{Limit: uint64(len(zone.Validators))}} + delegationQuery := stakingtypes.QueryDelegatorDelegationsRequest{DelegatorAddr: zone.DelegationAddress.Address, Pagination: &query.PageRequest{Limit: uint64(len(vals))}} bz := cdc.MustMarshal(&delegationQuery) err := keeper.DelegationsCallback(quicksilver.InterchainstakingKeeper, ctx, data, icqtypes.Query{ChainId: suite.chainB.ChainID, Request: bz}) @@ -1596,7 +1595,7 @@ func TestDelegationsCallbackOneAdditional(t *testing.T) { data := cdc.MustMarshal(&response) - delegationQuery := stakingtypes.QueryDelegatorDelegationsRequest{DelegatorAddr: zone.DelegationAddress.Address, Pagination: &query.PageRequest{Limit: uint64(len(zone.Validators))}} + delegationQuery := stakingtypes.QueryDelegatorDelegationsRequest{DelegatorAddr: zone.DelegationAddress.Address, Pagination: &query.PageRequest{Limit: uint64(len(vals))}} bz := cdc.MustMarshal(&delegationQuery) err := keeper.DelegationsCallback(quicksilver.InterchainstakingKeeper, ctx, data, icqtypes.Query{ChainId: suite.chainB.ChainID, Request: bz}) @@ -1849,37 +1848,6 @@ func TestDepositIntervalCallbackWithExistingTxs(t *testing.T) { suite.Equal(int(res.Pagination.Total)-3, txQueryCount) } -func (suite *KeeperTestSuite) TestDelegationAccountBalanceCallback() { - suite.Run("account balance", func() { - suite.SetupTest() - suite.setupTestZones() - - quicksilver := suite.GetQuicksilverApp(suite.chainA) - quicksilver.InterchainstakingKeeper.CallbackHandler().RegisterCallbacks() - ctx := suite.chainA.GetContext() - - zone, _ := quicksilver.InterchainstakingKeeper.GetZone(ctx, suite.chainB.ChainID) - zone.DepositAddress.IncrementBalanceWaitgroup() - zone.WithdrawalAddress.IncrementBalanceWaitgroup() - quicksilver.InterchainstakingKeeper.SetZone(ctx, &zone) - - response := sdk.NewCoin("qck", sdk.NewInt(10)) - respbz, err := quicksilver.AppCodec().Marshal(&response) - suite.NoError(err) - - delAddr := zone.DelegationAddress.Address - - accAddr, err := addressutils.AccAddressFromBech32(delAddr, "cosmos") - suite.NoError(err) - - data := append(banktypes.CreateAccountBalancesPrefix(accAddr), []byte("qck")...) - - err = keeper.DelegationAccountBalanceCallback(quicksilver.InterchainstakingKeeper, ctx, respbz, icqtypes.Query{ChainId: suite.chainB.ChainID, Request: data}) - - suite.NoError(err) - }) -} - func decodeBase64NoErr(str string) []byte { decoded, err := base64.StdEncoding.DecodeString(str) if err != nil { @@ -1902,7 +1870,7 @@ func (suite *KeeperTestSuite) TestDepositTxCallback() { name: "Deposit transaction successful", // txHash that come from DepositTxFixture txHash: "b1f1852d322328f6b8d8cacd180df2b1cbbd3dd64536c9ecbf1c896a15f6217a", - txWithProofbz: decodeBase64NoErr(localDepositTxFixture), + txWithProofbz: decodeBase64NoErr(txFixtureLsm), chainID: suite.chainB.ChainID, expectErr: false, }, @@ -1910,7 +1878,7 @@ func (suite *KeeperTestSuite) TestDepositTxCallback() { name: "Deposit transaction failed: txHash mismatch", // txHash that come from DepositTxFixture txHash: "2CC0F0C5106F30F5D26ABE8CB93F1EF0CCCE10754207C38B129D76ED3B7C75B2", - txWithProofbz: decodeBase64NoErr(localDepositTxFixture), + txWithProofbz: decodeBase64NoErr(txFixtureLsm), chainID: suite.chainB.ChainID, expectErr: true, }, @@ -1931,7 +1899,7 @@ func (suite *KeeperTestSuite) TestDepositTxCallback() { { name: "Deposit transaction failed: zone not registered", txHash: "b1f1852d322328f6b8d8cacd180df2b1cbbd3dd64536c9ecbf1c896a15f6217a", - txWithProofbz: decodeBase64NoErr(localDepositTxFixture), + txWithProofbz: decodeBase64NoErr(txFixtureLsm), chainID: "superNova", expectErr: true, }, @@ -2225,7 +2193,7 @@ func (suite *KeeperTestSuite) TestCheckTMHeaderForZone() { zone, _ := qckApp.InterchainstakingKeeper.GetZone(ctx, suite.chainB.ChainID) // get the tx from fixture - txWithProofBz := decodeBase64NoErr(localDepositTxFixture) + txWithProofBz := decodeBase64NoErr(txFixtureLsm) txRes := icqtypes.GetTxWithProofResponse{} _ = qckApp.InterchainQueryKeeper.IBCKeeper.Codec().Unmarshal(txWithProofBz, &txRes) @@ -2244,7 +2212,448 @@ func (suite *KeeperTestSuite) TestCheckTMHeaderForZone() { } } -var localDepositTxFixture = `GsEDCiCFDDobCzFK2Vf0BXcgdEycLSdJL8IP7PEVWKelDQeJ3xL2AgrXAQrUAQocL2Nvc21vcy5iYW5rLnYxYmV0YTEuTXNnU2VuZBKzAQotY29zbW9zMWEyemh0OHgyajBkcXZ1ZWpyOHB4cHU3ZHVlM3FtazQwbGdkeTNoEkFjb3Ntb3MxYXZ2ZWhmM25wdm42d2V5eHR2eXU3bWh3d3Zqcnl6dzY5ZzQzdHEwbmw4MHdxamdscjZoc2U1bWN6NBo/Cjdjb3Ntb3N2YWxvcGVyMWdnN3c4dzJ5OWpmdjc2YTJ5eWFoZTQyeTA5ZzlyeTJyYWE1cnF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3t3nFppZq/OiJ+/f0AsW+twSIgogx4ew5LC25gOeUAdpun5LhBSfIBHUbK7Zjyzn8VRr1ZwYhCESPQoUeQRs3t3nFppZq/OiJ+/f0AsW+twSIgogx4ew5LC25gOeUAdpun5LhBSfIBHUbK7Zjyzn8VRr1ZwYhCEaBggBEKvdDiJ+Cj0KFHkEbN7d5xaaWavzoifv39ALFvrcEiIKIMeHsOSwtuYDnlAHabp+S4QUnyAR1Gyu2Y8s5/FUa9WcGIQhEj0KFHkEbN7d5xaaWavzoifv39ALFvrcEiIKIMeHsOSwtuYDnlAHabp+S4QUnyAR1Gyu2Y8s5/FUa9WcGIQh` +func (suite *KeeperTestSuite) TestDepositLsmTxCallback() { + suite.Run("Deposit transaction successful", func() { + suite.SetupTest() + suite.setupTestZones() + + // setup quicksilver test app + quicksilver := suite.GetQuicksilverApp(suite.chainA) + quicksilver.InterchainstakingKeeper.CallbackHandler().RegisterCallbacks() + + // get chainA context + ctx := suite.chainA.GetContext() + + // get zone chainB context + zone, _ := quicksilver.InterchainstakingKeeper.GetZone(ctx, suite.chainB.ChainID) + zone.DepositAddress.IncrementBalanceWaitgroup() + zone.WithdrawalAddress.IncrementBalanceWaitgroup() + // add the validator from the gaiatest-1 network to our registered zone. This is required for LSM deposit as the tokenised share denom is checked against known validators. + err := quicksilver.InterchainstakingKeeper.SetValidator(ctx, zone.ChainId, icstypes.Validator{ + ValoperAddress: "cosmosvaloper1gg7w8w2y9jfv76a2yyahe42y09g9ry2raa5rqf", + CommissionRate: sdk.NewDecWithPrec(1, 1), + DelegatorShares: sdk.MustNewDecFromStr("4235376641.000000000000000000"), + VotingPower: sdk.NewInt(4235376641), + Status: "BOND_STATUS_BONDED", + Jailed: false, + Tombstoned: false, + ValidatorBondShares: sdk.MustNewDecFromStr("1000000.000000000000000000"), + LiquidShares: sdk.MustNewDecFromStr("4234076641.000000000000000000"), + }) + suite.NoError(err) + + // override the DepositAddress to match that of the chain where the fixture was captured. + zone.DepositAddress.Address = "cosmos1avvehf3npvn6weyxtvyu7mhwwvjryzw69g43tq0nl80wqjglr6hse5mcz4" + quicksilver.InterchainstakingKeeper.SetZone(ctx, &zone) + + // create tx fixture - this was taken from a live v1.2 chain (lfg-1 <-> gaiatest-1) hence the need to override client and consensus states, to match the source. + payload := icqtypes.GetTxWithProofResponse{} + payloadBytes := decodeBase64NoErr(txFixtureLsm) + + err = quicksilver.InterchainstakingKeeper.GetCodec().Unmarshal(payloadBytes, &payload) + // update payload header to ensure we can validate it. + payload.Header.Header.Time = ctx.BlockTime() + suite.NoError(err) + // cheat, and set the client state and consensus state for 07-tendermint-0 to match the incoming header. + quicksilver.IBCKeeper.ClientKeeper.SetClientState(ctx, "07-tendermint-0", lightclienttypes.NewClientState("gaiatest-1", lightclienttypes.DefaultTrustLevel, time.Hour, time.Hour, time.Second*50, payload.Header.TrustedHeight, []*ics23.ProofSpec{}, []string{}, false, false)) + quicksilver.IBCKeeper.ClientKeeper.SetClientConsensusState(ctx, "07-tendermint-0", payload.Header.TrustedHeight, payload.Header.ConsensusState()) + + requestData := tx.GetTxRequest{ + // hash of tx in `txFixture` + Hash: "b1f1852d322328f6b8d8cacd180df2b1cbbd3dd64536c9ecbf1c896a15f6217a", + } + // check receipt does not exist created. + _, found := quicksilver.InterchainstakingKeeper.GetReceipt(ctx, zone.ChainId, requestData.Hash) + + suite.False(found) + + resDataBz, err := quicksilver.AppCodec().Marshal(&requestData) + suite.NoError(err) + + // trigger the callback + err = keeper.DepositTxCallback(quicksilver.InterchainstakingKeeper, ctx, payloadBytes, icqtypes.Query{ChainId: suite.chainB.ChainID, Request: resDataBz}) + + suite.NoError(err) + + // expect quick1a2zht8x2j0dqvuejr8pxpu7due3qmk405vakg9 to have 5000 uqatoms now! + addrBytes, _ := addressutils.AccAddressFromBech32("cosmos1a2zht8x2j0dqvuejr8pxpu7due3qmk40lgdy3h", "") + newBalance := quicksilver.BankKeeper.GetAllBalances(ctx, addrBytes) + suite.Equal(newBalance.AmountOf("uqatom"), math.NewInt(5000)) + + // check receipt was created. + receipt, found := quicksilver.InterchainstakingKeeper.GetReceipt(ctx, zone.ChainId, requestData.Hash) + + suite.True(found) + + sdkTx, err := keeper.TxDecoder(quicksilver.InterchainstakingKeeper.GetCodec())(payload.Proof.Data) + suite.NoError(err) + + authTx, _ := sdkTx.(*tx.Tx) + + // validate receipt matches source / hash / amount + var msg sdk.Msg + suite.NoError(quicksilver.InterchainstakingKeeper.GetCodec().UnpackAny(authTx.Body.Messages[0], &msg)) + sendmsg, _ := msg.(*banktypes.MsgSend) + suite.Equal(receipt.Sender, sendmsg.FromAddress) + suite.Equal(receipt.Txhash, requestData.Hash) + bt := ctx.BlockTime() + suite.Equal(receipt.FirstSeen, &bt) + suite.Equal(receipt.Amount, sendmsg.Amount) + + // resubmitting the tx should not fail - it is silently ignored as we have now seen it before - but check the recipient balance has not changed. + err = keeper.DepositTxCallback(quicksilver.InterchainstakingKeeper, ctx, payloadBytes, icqtypes.Query{ChainId: suite.chainB.ChainID, Request: resDataBz}) + + suite.NoError(err) + + nowBalance := quicksilver.BankKeeper.GetAllBalances(ctx, addrBytes) + suite.Equal(nowBalance.AmountOf("uqatom"), math.NewInt(5000)) + }) +} + +func (suite *KeeperTestSuite) TestDepositTxCallback2() { + suite.Run("Deposit transaction successful", func() { + suite.SetupTest() + suite.setupTestZones() + + // setup quicksilver test app + quicksilver := suite.GetQuicksilverApp(suite.chainA) + quicksilver.InterchainstakingKeeper.CallbackHandler().RegisterCallbacks() + + // get chainA context + ctx := suite.chainA.GetContext() + + // get zone chainB context + zone, _ := quicksilver.InterchainstakingKeeper.GetZone(ctx, suite.chainB.ChainID) + zone.DepositAddress.IncrementBalanceWaitgroup() + zone.WithdrawalAddress.IncrementBalanceWaitgroup() + // add the validator from the gaiatest-1 network to our registered zone. This is required for LSM deposit as the tokenised share denom is checked against known validators. + err := quicksilver.InterchainstakingKeeper.SetValidator(ctx, zone.ChainId, icstypes.Validator{ + ValoperAddress: "cosmosvaloper1gg7w8w2y9jfv76a2yyahe42y09g9ry2raa5rqf", + CommissionRate: sdk.NewDecWithPrec(1, 1), + DelegatorShares: sdk.MustNewDecFromStr("4235376641.000000000000000000"), + VotingPower: sdk.NewInt(4235376641), + Status: "BOND_STATUS_BONDED", + Jailed: false, + Tombstoned: false, + ValidatorBondShares: sdk.MustNewDecFromStr("1000000.000000000000000000"), + LiquidShares: sdk.MustNewDecFromStr("4234076641.000000000000000000"), + }) + suite.NoError(err) + + // override the DepositAddress to match that of the chain where the fixture was captured. + zone.DepositAddress.Address = "cosmos1d2jrh4gj66smxns6xfv8mdd4keef5ek97knl9gw9skkzryjyhxjsywlfhm" + quicksilver.InterchainstakingKeeper.SetZone(ctx, &zone) + + // create tx fixture - this was taken from a live v1.2 chain (lfg-1 <-> gaiatest-1) hence the need to override client and consensus states, to match the source. + payload := icqtypes.GetTxWithProofResponse{} + payloadBytes := decodeBase64NoErr(txFixture) + + err = quicksilver.InterchainstakingKeeper.GetCodec().Unmarshal(payloadBytes, &payload) + // update payload header to ensure we can validate it. + payload.Header.Header.Time = ctx.BlockTime() + suite.NoError(err) + // cheat, and set the client state and consensus state for 07-tendermint-0 to match the incoming header. + quicksilver.IBCKeeper.ClientKeeper.SetClientState(ctx, "07-tendermint-0", lightclienttypes.NewClientState("gaiatest-1", lightclienttypes.DefaultTrustLevel, time.Hour, time.Hour, time.Second*50, payload.Header.TrustedHeight, []*ics23.ProofSpec{}, []string{}, false, false)) + quicksilver.IBCKeeper.ClientKeeper.SetClientConsensusState(ctx, "07-tendermint-0", payload.Header.TrustedHeight, payload.Header.ConsensusState()) + + requestData := tx.GetTxRequest{ + // hash of tx in `txFixture` + Hash: "fa7b199bfa3877d2f438ad7802a6b92cddde5e812f5620f1db735b7a90439938", + } + // check receipt does not exist created. + _, found := quicksilver.InterchainstakingKeeper.GetReceipt(ctx, zone.ChainId, requestData.Hash) + + suite.False(found) + + resDataBz, err := quicksilver.AppCodec().Marshal(&requestData) + suite.NoError(err) + + // trigger the callback + err = keeper.DepositTxCallback(quicksilver.InterchainstakingKeeper, ctx, payloadBytes, icqtypes.Query{ChainId: suite.chainB.ChainID, Request: resDataBz}) + + suite.NoError(err) + + // expect cosmos1a2zht8x2j0dqvuejr8pxpu7due3qmk40lgdy3h to have 500000 uqatoms now! + addrBytes, _ := addressutils.AccAddressFromBech32("cosmos1a2zht8x2j0dqvuejr8pxpu7due3qmk40lgdy3h", "") + newBalance := quicksilver.BankKeeper.GetAllBalances(ctx, addrBytes) + suite.Equal(newBalance.AmountOf("uqatom"), math.NewInt(500000)) + + // check receipt was created. + receipt, found := quicksilver.InterchainstakingKeeper.GetReceipt(ctx, zone.ChainId, requestData.Hash) + + suite.True(found) + + sdkTx, err := keeper.TxDecoder(quicksilver.InterchainstakingKeeper.GetCodec())(payload.Proof.Data) + suite.NoError(err) + + authTx, _ := sdkTx.(*tx.Tx) + + // validate receipt matches source / hash / amount + var msg sdk.Msg + suite.NoError(quicksilver.InterchainstakingKeeper.GetCodec().UnpackAny(authTx.Body.Messages[0], &msg)) + sendmsg, _ := msg.(*banktypes.MsgSend) + suite.Equal(receipt.Sender, sendmsg.FromAddress) + suite.Equal(receipt.Txhash, requestData.Hash) + bt := ctx.BlockTime() + suite.Equal(receipt.FirstSeen, &bt) + suite.Equal(receipt.Amount, sendmsg.Amount) + + // resubmitting the tx should not fail - it is silently ignored as we have now seen it before - but check the recipient balance has not changed. + err = keeper.DepositTxCallback(quicksilver.InterchainstakingKeeper, ctx, payloadBytes, icqtypes.Query{ChainId: suite.chainB.ChainID, Request: resDataBz}) + + suite.NoError(err) + + nowBalance := quicksilver.BankKeeper.GetAllBalances(ctx, addrBytes) + suite.Equal(nowBalance.AmountOf("uqatom"), math.NewInt(500000)) + }) +} + +func (suite *KeeperTestSuite) TestDepositLsmTxCallbackFailOnNonMatchingValidator() { + suite.Run("Deposit transaction successful", func() { + suite.SetupTest() + suite.setupTestZones() + + // setup quicksilver test app + quicksilver := suite.GetQuicksilverApp(suite.chainA) + quicksilver.InterchainstakingKeeper.CallbackHandler().RegisterCallbacks() + + // get chainA context + ctx := suite.chainA.GetContext() + + // get zone chainB context + zone, _ := quicksilver.InterchainstakingKeeper.GetZone(ctx, suite.chainB.ChainID) + zone.DepositAddress.IncrementBalanceWaitgroup() + zone.WithdrawalAddress.IncrementBalanceWaitgroup() + + // override the DepositAddress to match that of the chain where the fixture was captured. + zone.DepositAddress.Address = "cosmos1avvehf3npvn6weyxtvyu7mhwwvjryzw69g43tq0nl80wqjglr6hse5mcz4" + quicksilver.InterchainstakingKeeper.SetZone(ctx, &zone) + + // create tx fixture - this was taken from a live v1.2 chain (lfg-1 <-> gaiatest-1) hence the need to override client and consensus states, to match the source. + payload := icqtypes.GetTxWithProofResponse{} + payloadBytes := decodeBase64NoErr(txFixtureLsm) + + err := quicksilver.InterchainstakingKeeper.GetCodec().Unmarshal(payloadBytes, &payload) + // update payload header to ensure we can validate it. + payload.Header.Header.Time = ctx.BlockTime() + suite.NoError(err) + // cheat, and set the client state and consensus state for 07-tendermint-0 to match the incoming header. + quicksilver.IBCKeeper.ClientKeeper.SetClientState(ctx, "07-tendermint-0", lightclienttypes.NewClientState("gaiatest-1", lightclienttypes.DefaultTrustLevel, time.Hour, time.Hour, time.Second*50, payload.Header.TrustedHeight, []*ics23.ProofSpec{}, []string{}, false, false)) + quicksilver.IBCKeeper.ClientKeeper.SetClientConsensusState(ctx, "07-tendermint-0", payload.Header.TrustedHeight, payload.Header.ConsensusState()) + + requestData := tx.GetTxRequest{ + // hash of tx in `txFixture` + Hash: "b1f1852d322328f6b8d8cacd180df2b1cbbd3dd64536c9ecbf1c896a15f6217a", + } + // check receipt does not exist created. + _, found := quicksilver.InterchainstakingKeeper.GetReceipt(ctx, zone.ChainId, requestData.Hash) + + suite.False(found) + + resDataBz, err := quicksilver.AppCodec().Marshal(&requestData) + suite.NoError(err) + + // trigger the callback + err = keeper.DepositTxCallback(quicksilver.InterchainstakingKeeper, ctx, payloadBytes, icqtypes.Query{ChainId: suite.chainB.ChainID, Request: resDataBz}) + + suite.ErrorContains(err, "unable to validate coins. Ignoring.") + + // expect quick1a2zht8x2j0dqvuejr8pxpu7due3qmk405vakg9 to have 0 uqatoms, as the deposit failed. + addrBytes, _ := addressutils.AccAddressFromBech32("cosmos1a2zht8x2j0dqvuejr8pxpu7due3qmk40lgdy3h", "") + newBalance := quicksilver.BankKeeper.GetAllBalances(ctx, addrBytes) + suite.Equal(newBalance.AmountOf("uqatom"), math.NewInt(0)) + + _, found = quicksilver.InterchainstakingKeeper.GetReceipt(ctx, zone.ChainId, requestData.Hash) + + suite.False(found) + }) +} + +func (suite *KeeperTestSuite) TestDelegationAccountBalancesCallback() { + tcs := []struct { + Name string + PreviousBalance sdk.Coins + IncomingBalance sdk.Coins + ExpectedQueryCount int + ExpectedWaitgroup uint32 + }{ + { + Name: "initial nil, incoming uqck", + PreviousBalance: sdk.NewCoins(), + IncomingBalance: sdk.NewCoins(sdk.NewCoin("uqck", sdk.NewInt(1))), + ExpectedQueryCount: 1, // uqck + ExpectedWaitgroup: 1, + }, + { + Name: "initial uqck, incoming uqck", + PreviousBalance: sdk.NewCoins(sdk.NewCoin("uqck", sdk.NewInt(1))), + IncomingBalance: sdk.NewCoins(sdk.NewCoin("uqck", sdk.NewInt(1))), + ExpectedQueryCount: 1, // uqck + ExpectedWaitgroup: 1, + }, + { + Name: "initial uqck, incoming lsm", + PreviousBalance: sdk.NewCoins(sdk.NewCoin("uqck", sdk.NewInt(1))), + IncomingBalance: sdk.NewCoins(sdk.NewCoin(addressutils.GenerateAddressForTestWithPrefix("cosmosvaloper")+"/1", sdk.NewInt(1))), + ExpectedQueryCount: 2, // uqck + ExpectedWaitgroup: 2, + }, + { + Name: "initial uqck, incoming lsm + qck", + PreviousBalance: sdk.NewCoins(sdk.NewCoin("uqck", sdk.NewInt(1))), + IncomingBalance: sdk.NewCoins(sdk.NewCoin(addressutils.GenerateAddressForTestWithPrefix("cosmosvaloper")+"/1", sdk.NewInt(1)), sdk.NewCoin("uqck", sdk.NewInt(1))), + ExpectedQueryCount: 2, // uqck + ExpectedWaitgroup: 2, + }, + { + Name: "initial lsm, incoming uqck", + PreviousBalance: sdk.NewCoins(sdk.NewCoin(addressutils.GenerateAddressForTestWithPrefix("cosmosvaloper")+"/1", sdk.NewInt(1))), + IncomingBalance: sdk.NewCoins(sdk.NewCoin("uqck", sdk.NewInt(1))), + ExpectedQueryCount: 2, // uqck + ExpectedWaitgroup: 2, + }, + { + Name: "initial uqck, incoming nil", + PreviousBalance: sdk.NewCoins(sdk.NewCoin("uqck", sdk.NewInt(1))), + IncomingBalance: sdk.NewCoins(), + ExpectedQueryCount: 1, // uqck + ExpectedWaitgroup: 1, + }, + { + Name: "initial nil, incoming nil", + PreviousBalance: sdk.NewCoins(), + IncomingBalance: sdk.NewCoins(), + ExpectedQueryCount: 0, // uqck + ExpectedWaitgroup: 0, + }, + } + + for _, t := range tcs { + suite.Run(t.Name, func() { + suite.SetupTest() + suite.setupTestZones() + + app := suite.GetQuicksilverApp(suite.chainA) + app.InterchainstakingKeeper.CallbackHandler().RegisterCallbacks() + ctx := suite.chainA.GetContext() + + zone, _ := app.InterchainstakingKeeper.GetZone(ctx, suite.chainB.ChainID) + zone.WithdrawalWaitgroup = 1 + zone.DelegationAddress.Balance = t.PreviousBalance + app.InterchainstakingKeeper.SetZone(ctx, &zone) + + query := banktypes.QueryAllBalancesRequest{ + Address: zone.DelegationAddress.Address, + } + reqbz, err := app.AppCodec().Marshal(&query) + suite.Require().NoError(err) + + response := banktypes.QueryAllBalancesResponse{Balances: t.IncomingBalance} + respbz, err := app.AppCodec().Marshal(&response) + suite.Require().NoError(err) + + err = keeper.DelegationAccountBalancesCallback(app.InterchainstakingKeeper, ctx, respbz, icqtypes.Query{ChainId: suite.chainB.ChainID, Request: reqbz}) + suite.Require().NoError(err) + + // refetch zone + zone, _ = app.InterchainstakingKeeper.GetZone(ctx, suite.chainB.ChainID) + suite.Require().Equal(t.ExpectedWaitgroup, zone.WithdrawalWaitgroup) + + _, addr, err := bech32.DecodeAndConvert(zone.DelegationAddress.Address) + suite.Require().NoError(err) + data := banktypes.CreateAccountBalancesPrefix(addr) + + // check a ICQ request was made + for _, b := range t.IncomingBalance { + found := false + app.InterchainQueryKeeper.IterateQueries(ctx, func(index int64, queryInfo icqtypes.Query) (stop bool) { + if queryInfo.ChainId == zone.ChainId && + queryInfo.ConnectionId == zone.ConnectionId && + queryInfo.QueryType == icstypes.BankStoreKey && + bytes.Equal(queryInfo.Request, append(data, []byte(b.GetDenom())...)) { + found = true + return true + } + return false + }) + suite.Require().True(found) + } + }) + } +} + +func (suite *KeeperTestSuite) TestDelegationAccountBalanceCallback() { + suite.Run("delegation account balance", func() { + suite.SetupTest() + suite.setupTestZones() + + app := suite.GetQuicksilverApp(suite.chainA) + app.InterchainstakingKeeper.CallbackHandler().RegisterCallbacks() + ctx := suite.chainA.GetContext() + + zone, _ := app.InterchainstakingKeeper.GetZone(ctx, suite.chainB.ChainID) + zone.WithdrawalWaitgroup = 2 + zone.DelegationAddress.Balance = sdk.NewCoins(sdk.NewCoin("uatom", math.NewInt(500))) + app.InterchainstakingKeeper.SetZone(ctx, &zone) + + response := sdk.NewCoin("uatom", sdk.NewInt(10)) + respbz, err := app.AppCodec().Marshal(&response) + suite.Require().NoError(err) + + accAddr, err := sdk.AccAddressFromBech32(zone.DelegationAddress.Address) + suite.Require().NoError(err) + data := append(banktypes.CreateAccountBalancesPrefix(accAddr), []byte("uatom")...) + + err = keeper.DelegationAccountBalanceCallback(app.InterchainstakingKeeper, ctx, respbz, icqtypes.Query{ChainId: suite.chainB.ChainID, Request: data}) + suite.Require().NoError(err) + + ctx = suite.chainA.GetContext() + zone, _ = app.InterchainstakingKeeper.GetZone(ctx, suite.chainB.ChainID) + suite.Equal(uint32(5), zone.WithdrawalWaitgroup) // initial 2 is reduced to 1, but incremented by 4 (4x delegation messages) == 5 + suite.Equal(sdk.NewInt(10), zone.DelegationAddress.Balance.AmountOf("uatom")) + }) +} + +func (suite *KeeperTestSuite) TestDelegationAccountBalanceCallbackLSM() { + suite.Run("delegation account balance", func() { + suite.SetupTest() + suite.setupTestZones() + + app := suite.GetQuicksilverApp(suite.chainA) + app.InterchainstakingKeeper.CallbackHandler().RegisterCallbacks() + ctx := suite.chainA.GetContext() + + zone, _ := app.InterchainstakingKeeper.GetZone(ctx, suite.chainB.ChainID) + + valOper := app.InterchainstakingKeeper.GetValidatorAddresses(ctx, suite.chainB.ChainID)[0] + denom := valOper + "/1" + zone.WithdrawalWaitgroup = 2 + zone.DelegationAddress.Balance = sdk.NewCoins(sdk.NewCoin("uatom", math.NewInt(500))) + app.InterchainstakingKeeper.SetZone(ctx, &zone) + + response := sdk.NewCoin(denom, sdk.NewInt(10)) + respbz, err := app.AppCodec().Marshal(&response) + suite.Require().NoError(err) + + accAddr, err := sdk.AccAddressFromBech32(zone.DelegationAddress.Address) + suite.Require().NoError(err) + data := append(banktypes.CreateAccountBalancesPrefix(accAddr), []byte(denom)...) + + err = keeper.DelegationAccountBalanceCallback(app.InterchainstakingKeeper, ctx, respbz, icqtypes.Query{ChainId: suite.chainB.ChainID, Request: data}) + suite.Require().NoError(err) + + ctx = suite.chainA.GetContext() + zone, _ = app.InterchainstakingKeeper.GetZone(ctx, suite.chainB.ChainID) + suite.Equal(uint32(2), zone.WithdrawalWaitgroup) // initial 2 is reduced to 1, but incremented by 1 (1x redeem token messages) == 2 + suite.Equal(sdk.NewInt(500), zone.DelegationAddress.Balance.AmountOf("uatom")) + suite.Equal(sdk.NewInt(10), zone.DelegationAddress.Balance.AmountOf(denom)) + }) +} + +const ( + txFixtureLsm = "GsEDCiCFDDobCzFK2Vf0BXcgdEycLSdJL8IP7PEVWKelDQeJ3xL2AgrXAQrUAQocL2Nvc21vcy5iYW5rLnYxYmV0YTEuTXNnU2VuZBKzAQotY29zbW9zMWEyemh0OHgyajBkcXZ1ZWpyOHB4cHU3ZHVlM3FtazQwbGdkeTNoEkFjb3Ntb3MxYXZ2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eHsOSwtuYDnlAHabp+S4QUnyAR1Gyu2Y8s5/FUa9WcGKsh" +) func (suite *KeeperTestSuite) TestPerfBalanceCallbackUpdate() { suite.Run("perf balance", func() { diff --git a/x/interchainstaking/keeper/delegation.go b/x/interchainstaking/keeper/delegation.go index b7e61f9b3..00d39c9d9 100644 --- a/x/interchainstaking/keeper/delegation.go +++ b/x/interchainstaking/keeper/delegation.go @@ -4,8 +4,6 @@ import ( "errors" "fmt" - lsmstakingTypes "github.com/iqlusioninc/liquidity-staking-module/x/staking/types" - sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" @@ -16,6 +14,7 @@ import ( "github.com/quicksilver-zone/quicksilver/utils" "github.com/quicksilver-zone/quicksilver/x/interchainstaking/types" + lsmstakingTypes "github.com/quicksilver-zone/quicksilver/x/lsmtypes" ) // GetDelegation returns a specific delegation. @@ -206,19 +205,40 @@ func (*Keeper) PrepareDelegationMessagesForShares(zone *types.Zone, coins sdk.Co var msgs []sdk.Msg for _, coin := range coins.Sort() { if !coin.IsZero() { - msgs = append(msgs, &lsmstakingTypes.MsgRedeemTokensforShares{DelegatorAddress: zone.DelegationAddress.Address, Amount: coin}) + msgs = append(msgs, &lsmstakingTypes.MsgRedeemTokensForShares{DelegatorAddress: zone.DelegationAddress.Address, Amount: coin}) } } return msgs } +func (k Keeper) DetermineMaximumValidatorAllocations(ctx sdk.Context, zone *types.Zone) map[string]sdkmath.Int { + out := make(map[string]sdkmath.Int) + caps, found := k.GetLsmCaps(ctx, zone.ChainId) + if !found { + // No cap found, permit the transaction + return out + } + + for _, val := range k.GetValidators(ctx, zone.ChainId) { + // validator bond max + maxBondShares := val.ValidatorBondShares.Mul(caps.ValidatorBondCap).Sub(val.LiquidShares) + + // validator pc max + maxLiquidStakedShares := sdk.NewDecFromInt(val.VotingPower).Mul(caps.ValidatorCap).Sub(val.LiquidShares) + out[val.ValoperAddress] = sdkmath.MinInt(maxBondShares.TruncateInt(), maxLiquidStakedShares.TruncateInt()) + } + + return out +} + func (k *Keeper) DeterminePlanForDelegation(ctx sdk.Context, zone *types.Zone, amount sdk.Coins) (map[string]sdkmath.Int, error) { currentAllocations, currentSum, _, _ := k.GetDelegationMap(ctx, zone.ChainId) targetAllocations, err := k.GetAggregateIntentOrDefault(ctx, zone) if err != nil { return nil, err } - return types.DetermineAllocationsForDelegation(currentAllocations, currentSum, targetAllocations, amount) + maxCanAllocate := k.DetermineMaximumValidatorAllocations(ctx, zone) + return types.DetermineAllocationsForDelegation(currentAllocations, currentSum, targetAllocations, amount, maxCanAllocate) } func (k *Keeper) WithdrawDelegationRewardsForResponse(ctx sdk.Context, zone *types.Zone, delegator string, response []byte) error { @@ -291,7 +311,7 @@ func (k *Keeper) FlushOutstandingDelegations(ctx sdk.Context, zone *types.Zone, var pendingAmount sdk.Coins exclusionTime := ctx.BlockTime().AddDate(0, 0, -1) k.IterateZoneReceipts(ctx, zone.ChainId, func(_ int64, receiptInfo types.Receipt) (stop bool) { - if (receiptInfo.FirstSeen.After(exclusionTime) || receiptInfo.FirstSeen.Equal(exclusionTime)) && receiptInfo.Completed == nil { + if (receiptInfo.FirstSeen.After(exclusionTime) || receiptInfo.FirstSeen.Equal(exclusionTime)) && receiptInfo.Completed == nil && receiptInfo.Amount[0].Denom == delAddrBalance.Denom { pendingAmount = pendingAmount.Add(receiptInfo.Amount...) } return false @@ -300,19 +320,23 @@ func (k *Keeper) FlushOutstandingDelegations(ctx sdk.Context, zone *types.Zone, coinsToFlush, hasNeg := sdk.NewCoins(delAddrBalance).SafeSub(pendingAmount...) if hasNeg || coinsToFlush.IsZero() { k.Logger(ctx).Debug("delegate account balance negative, setting outdated reciepts") - k.SetReceiptsCompleted(ctx, zone.ChainId, exclusionTime, ctx.BlockTime()) + k.SetReceiptsCompleted(ctx, zone.ChainId, exclusionTime, ctx.BlockTime(), delAddrBalance.Denom) return nil } // set the zone amount to the coins to be flushed. - zone.DelegationAddress.Balance = coinsToFlush k.Logger(ctx).Info("flush delegations ", "total", coinsToFlush) - k.SetZone(ctx, zone) sendMsg := banktypes.MsgSend{ FromAddress: "", ToAddress: "", Amount: coinsToFlush, } - return k.handleSendToDelegate(ctx, zone, &sendMsg, fmt.Sprintf("batch/%d", exclusionTime.Unix())) + numMsgs, err := k.handleSendToDelegate(ctx, zone, &sendMsg, fmt.Sprintf("batch/%d", exclusionTime.Unix())) + if err != nil { + return err + } + zone.WithdrawalWaitgroup += uint32(numMsgs) + k.SetZone(ctx, zone) + return nil } diff --git a/x/interchainstaking/keeper/delegation_test.go b/x/interchainstaking/keeper/delegation_test.go index 43d943e84..ae17b9881 100644 --- a/x/interchainstaking/keeper/delegation_test.go +++ b/x/interchainstaking/keeper/delegation_test.go @@ -13,7 +13,7 @@ import ( "github.com/quicksilver-zone/quicksilver/app" "github.com/quicksilver-zone/quicksilver/utils/addressutils" - icstypes "github.com/quicksilver-zone/quicksilver/x/interchainstaking/types" + "github.com/quicksilver-zone/quicksilver/x/interchainstaking/types" ) func (suite *KeeperTestSuite) TestKeeper_DelegationStore() { @@ -56,7 +56,7 @@ func (suite *KeeperTestSuite) TestKeeper_DelegationStore() { icsKeeper.SetDelegation( ctx, zone.ChainId, - icstypes.NewDelegation( + types.NewDelegation( zone.DelegationAddress.Address, zoneValidatorAddresses[0], sdk.NewCoin(zone.BaseDenom, sdk.NewInt(3000000)), @@ -65,7 +65,7 @@ func (suite *KeeperTestSuite) TestKeeper_DelegationStore() { icsKeeper.SetDelegation( ctx, zone.ChainId, - icstypes.NewDelegation( + types.NewDelegation( zone.DelegationAddress.Address, zoneValidatorAddresses[1], sdk.NewCoin(zone.BaseDenom, sdk.NewInt(17000000)), @@ -74,7 +74,7 @@ func (suite *KeeperTestSuite) TestKeeper_DelegationStore() { icsKeeper.SetDelegation( ctx, zone.ChainId, - icstypes.NewDelegation( + types.NewDelegation( zone.DelegationAddress.Address, zoneValidatorAddresses[2], sdk.NewCoin(zone.BaseDenom, sdk.NewInt(20000000)), @@ -97,10 +97,14 @@ func (suite *KeeperTestSuite) TestKeeper_DelegationStore() { dds := icsKeeper.GetDelegatorDelegations(ctx, zone.ChainId, addr) suite.Len(dds, 3) suite.Equal(delegations, dds) + + suite.NoError(icsKeeper.RemoveDelegation(ctx, zone.ChainId, delegations[0])) + dds = icsKeeper.GetDelegatorDelegations(ctx, zone.ChainId, addr) + suite.Require().Len(dds, 2) } type delegationUpdate struct { - delegation icstypes.Delegation + delegation types.Delegation absolute bool } @@ -116,83 +120,83 @@ func (suite *KeeperTestSuite) TestUpdateDelegation() { tests := []struct { name string - delegation *icstypes.Delegation + delegation *types.Delegation updates []delegationUpdate - expected icstypes.Delegation + expected types.Delegation }{ { "single update, relative increase +3000", - &icstypes.Delegation{DelegationAddress: del1.String(), ValidatorAddress: val1.String(), Amount: sdk.NewCoin("denom", sdk.NewInt(3000))}, + &types.Delegation{DelegationAddress: del1.String(), ValidatorAddress: val1.String(), Amount: sdk.NewCoin("denom", sdk.NewInt(3000))}, []delegationUpdate{ { - delegation: icstypes.Delegation{DelegationAddress: del1.String(), ValidatorAddress: val1.String(), Amount: sdk.NewCoin("denom", sdk.NewInt(3000))}, + delegation: types.Delegation{DelegationAddress: del1.String(), ValidatorAddress: val1.String(), Amount: sdk.NewCoin("denom", sdk.NewInt(3000))}, absolute: false, }, }, - icstypes.Delegation{DelegationAddress: del1.String(), ValidatorAddress: val1.String(), Amount: sdk.NewCoin("denom", sdk.NewInt(6000))}, + types.Delegation{DelegationAddress: del1.String(), ValidatorAddress: val1.String(), Amount: sdk.NewCoin("denom", sdk.NewInt(6000))}, }, { "single update, relative increase +3000", - &icstypes.Delegation{DelegationAddress: del1.String(), ValidatorAddress: val2.String(), Amount: sdk.NewCoin("denom", sdk.NewInt(3000))}, + &types.Delegation{DelegationAddress: del1.String(), ValidatorAddress: val2.String(), Amount: sdk.NewCoin("denom", sdk.NewInt(3000))}, []delegationUpdate{ { - delegation: icstypes.Delegation{DelegationAddress: del1.String(), ValidatorAddress: val2.String(), Amount: sdk.NewCoin("denom", sdk.NewInt(3000))}, + delegation: types.Delegation{DelegationAddress: del1.String(), ValidatorAddress: val2.String(), Amount: sdk.NewCoin("denom", sdk.NewInt(3000))}, absolute: true, }, }, - icstypes.Delegation{DelegationAddress: del1.String(), ValidatorAddress: val2.String(), Amount: sdk.NewCoin("denom", sdk.NewInt(3000))}, + types.Delegation{DelegationAddress: del1.String(), ValidatorAddress: val2.String(), Amount: sdk.NewCoin("denom", sdk.NewInt(3000))}, }, { "multi update, relative increase +3000, +2000", - &icstypes.Delegation{DelegationAddress: del1.String(), ValidatorAddress: val3.String(), Amount: sdk.NewCoin("denom", sdk.NewInt(3000))}, + &types.Delegation{DelegationAddress: del1.String(), ValidatorAddress: val3.String(), Amount: sdk.NewCoin("denom", sdk.NewInt(3000))}, []delegationUpdate{ { - delegation: icstypes.Delegation{DelegationAddress: del1.String(), ValidatorAddress: val3.String(), Amount: sdk.NewCoin("denom", sdk.NewInt(3000))}, + delegation: types.Delegation{DelegationAddress: del1.String(), ValidatorAddress: val3.String(), Amount: sdk.NewCoin("denom", sdk.NewInt(3000))}, absolute: false, }, { - delegation: icstypes.Delegation{DelegationAddress: del1.String(), ValidatorAddress: val3.String(), Amount: sdk.NewCoin("denom", sdk.NewInt(2000))}, + delegation: types.Delegation{DelegationAddress: del1.String(), ValidatorAddress: val3.String(), Amount: sdk.NewCoin("denom", sdk.NewInt(2000))}, absolute: false, }, }, - icstypes.Delegation{DelegationAddress: del1.String(), ValidatorAddress: val3.String(), Amount: sdk.NewCoin("denom", sdk.NewInt(8000))}, + types.Delegation{DelegationAddress: del1.String(), ValidatorAddress: val3.String(), Amount: sdk.NewCoin("denom", sdk.NewInt(8000))}, }, { "multi update, relative +3000, absolute +2000", - &icstypes.Delegation{DelegationAddress: del1.String(), ValidatorAddress: val4.String(), Amount: sdk.NewCoin("denom", sdk.NewInt(3000))}, + &types.Delegation{DelegationAddress: del1.String(), ValidatorAddress: val4.String(), Amount: sdk.NewCoin("denom", sdk.NewInt(3000))}, []delegationUpdate{ { - delegation: icstypes.Delegation{DelegationAddress: del1.String(), ValidatorAddress: val4.String(), Amount: sdk.NewCoin("denom", sdk.NewInt(3000))}, + delegation: types.Delegation{DelegationAddress: del1.String(), ValidatorAddress: val4.String(), Amount: sdk.NewCoin("denom", sdk.NewInt(3000))}, absolute: false, }, { - delegation: icstypes.Delegation{DelegationAddress: del1.String(), ValidatorAddress: val4.String(), Amount: sdk.NewCoin("denom", sdk.NewInt(2000))}, + delegation: types.Delegation{DelegationAddress: del1.String(), ValidatorAddress: val4.String(), Amount: sdk.NewCoin("denom", sdk.NewInt(2000))}, absolute: true, }, }, - icstypes.Delegation{DelegationAddress: del1.String(), ValidatorAddress: val4.String(), Amount: sdk.NewCoin("denom", sdk.NewInt(2000))}, + types.Delegation{DelegationAddress: del1.String(), ValidatorAddress: val4.String(), Amount: sdk.NewCoin("denom", sdk.NewInt(2000))}, }, { "new delegation, relative increase +10000", nil, []delegationUpdate{ { - delegation: icstypes.Delegation{DelegationAddress: del1.String(), ValidatorAddress: val5.String(), Amount: sdk.NewCoin("denom", sdk.NewInt(10000))}, + delegation: types.Delegation{DelegationAddress: del1.String(), ValidatorAddress: val5.String(), Amount: sdk.NewCoin("denom", sdk.NewInt(10000))}, absolute: false, }, }, - icstypes.Delegation{DelegationAddress: del1.String(), ValidatorAddress: val5.String(), Amount: sdk.NewCoin("denom", sdk.NewInt(10000))}, + types.Delegation{DelegationAddress: del1.String(), ValidatorAddress: val5.String(), Amount: sdk.NewCoin("denom", sdk.NewInt(10000))}, }, { "new delegation, absolute increase +15000", nil, []delegationUpdate{ { - delegation: icstypes.Delegation{DelegationAddress: del1.String(), ValidatorAddress: val6.String(), Amount: sdk.NewCoin("denom", sdk.NewInt(15000))}, + delegation: types.Delegation{DelegationAddress: del1.String(), ValidatorAddress: val6.String(), Amount: sdk.NewCoin("denom", sdk.NewInt(15000))}, absolute: true, }, }, - icstypes.Delegation{DelegationAddress: del1.String(), ValidatorAddress: val6.String(), Amount: sdk.NewCoin("denom", sdk.NewInt(15000))}, + types.Delegation{DelegationAddress: del1.String(), ValidatorAddress: val6.String(), Amount: sdk.NewCoin("denom", sdk.NewInt(15000))}, }, } @@ -241,7 +245,7 @@ func (suite *KeeperTestSuite) TestStoreGetDeleteDelegation() { _, found = qApp.InterchainstakingKeeper.GetDelegation(ctx, zone.ChainId, delegator.String(), validator.String()) suite.False(found) - newDelegation := icstypes.NewDelegation(delegator.String(), validator.String(), sdk.NewCoin("uatom", sdk.NewInt(5000))) + newDelegation := types.NewDelegation(delegator.String(), validator.String(), sdk.NewCoin("uatom", sdk.NewInt(5000))) qApp.InterchainstakingKeeper.SetDelegation(ctx, zone.ChainId, newDelegation) fetchedDelegation, found := qApp.InterchainstakingKeeper.GetDelegation(ctx, zone.ChainId, delegator.String(), validator.String()) @@ -285,7 +289,7 @@ func (suite *KeeperTestSuite) TestFlushOutstandingDelegations() { receiptOneTime := cutOffTime.Add(-2 * time.Hour) receiptTwoTime := cutOffTime.Add(-3 * time.Hour) - rcpt1 := icstypes.Receipt{ + rcpt1 := types.Receipt{ ChainId: suite.chainB.ChainID, Sender: userAddress, Txhash: "TestDeposit01", @@ -299,7 +303,7 @@ func (suite *KeeperTestSuite) TestFlushOutstandingDelegations() { Completed: nil, } - rcpt2 := icstypes.Receipt{ + rcpt2 := types.Receipt{ ChainId: suite.chainB.ChainID, Sender: userAddress, Txhash: "TestDeposit02", @@ -320,7 +324,7 @@ func (suite *KeeperTestSuite) TestFlushOutstandingDelegations() { count := 0 zone, found := quicksilver.InterchainstakingKeeper.GetZone(ctx, suite.chainB.ChainID) suite.True(found) - quicksilver.InterchainstakingKeeper.IterateZoneReceipts(ctx, zone.ChainId, func(index int64, receiptInfo icstypes.Receipt) (stop bool) { + quicksilver.InterchainstakingKeeper.IterateZoneReceipts(ctx, zone.ChainId, func(index int64, receiptInfo types.Receipt) (stop bool) { if receiptInfo.Completed == nil { count++ } @@ -339,7 +343,7 @@ func (suite *KeeperTestSuite) TestFlushOutstandingDelegations() { receiptOneTime := cutOffTime.Add(-2 * time.Hour) receiptTwoTime := cutOffTime.Add(2 * time.Hour) - rcpt1 := icstypes.Receipt{ + rcpt1 := types.Receipt{ ChainId: suite.chainB.ChainID, Sender: userAddress, Txhash: "TestDeposit01", @@ -353,7 +357,7 @@ func (suite *KeeperTestSuite) TestFlushOutstandingDelegations() { Completed: nil, } - rcpt2 := icstypes.Receipt{ + rcpt2 := types.Receipt{ ChainId: suite.chainB.ChainID, Sender: userAddress, Txhash: "TestDeposit02", @@ -373,7 +377,7 @@ func (suite *KeeperTestSuite) TestFlushOutstandingDelegations() { count := 0 zone, found := quicksilver.InterchainstakingKeeper.GetZone(ctx, suite.chainB.ChainID) suite.True(found) - quicksilver.InterchainstakingKeeper.IterateZoneReceipts(ctx, zone.ChainId, func(index int64, receiptInfo icstypes.Receipt) (stop bool) { + quicksilver.InterchainstakingKeeper.IterateZoneReceipts(ctx, zone.ChainId, func(index int64, receiptInfo types.Receipt) (stop bool) { if receiptInfo.Completed == nil { count++ } @@ -390,7 +394,7 @@ func (suite *KeeperTestSuite) TestFlushOutstandingDelegations() { receiptOneTime := cutOffTime.Add(-2 * time.Hour) // -26h receiptTwoTime := cutOffTime.Add(2 * time.Hour) // -22h - rcpt1 := icstypes.Receipt{ + rcpt1 := types.Receipt{ ChainId: suite.chainB.ChainID, Sender: userAddress, Txhash: "TestDeposit01", @@ -404,7 +408,7 @@ func (suite *KeeperTestSuite) TestFlushOutstandingDelegations() { Completed: nil, } - rcpt2 := icstypes.Receipt{ + rcpt2 := types.Receipt{ ChainId: suite.chainB.ChainID, Sender: userAddress, Txhash: "TestDeposit02", @@ -425,7 +429,7 @@ func (suite *KeeperTestSuite) TestFlushOutstandingDelegations() { count := 0 zone, found := quicksilver.InterchainstakingKeeper.GetZone(ctx, suite.chainB.ChainID) suite.True(found) - quicksilver.InterchainstakingKeeper.IterateZoneReceipts(ctx, zone.ChainId, func(index int64, receiptInfo icstypes.Receipt) (stop bool) { + quicksilver.InterchainstakingKeeper.IterateZoneReceipts(ctx, zone.ChainId, func(index int64, receiptInfo types.Receipt) (stop bool) { if receiptInfo.Completed == nil { count++ } @@ -444,7 +448,7 @@ func (suite *KeeperTestSuite) TestFlushOutstandingDelegations() { receiptOneTime := cutOffTime.Add(-2 * time.Hour) receiptTwoTime := cutOffTime.Add(-3 * time.Hour) - rcpt1 := icstypes.Receipt{ + rcpt1 := types.Receipt{ ChainId: suite.chainB.ChainID, Sender: userAddress, Txhash: "TestDeposit01", @@ -458,7 +462,7 @@ func (suite *KeeperTestSuite) TestFlushOutstandingDelegations() { Completed: nil, } - rcpt2 := icstypes.Receipt{ + rcpt2 := types.Receipt{ ChainId: suite.chainB.ChainID, Sender: userAddress, Txhash: "TestDeposit02", @@ -479,7 +483,7 @@ func (suite *KeeperTestSuite) TestFlushOutstandingDelegations() { count := 0 zone, found := quicksilver.InterchainstakingKeeper.GetZone(ctx, suite.chainB.ChainID) suite.True(found) - quicksilver.InterchainstakingKeeper.IterateZoneReceipts(ctx, zone.ChainId, func(index int64, receiptInfo icstypes.Receipt) (stop bool) { + quicksilver.InterchainstakingKeeper.IterateZoneReceipts(ctx, zone.ChainId, func(index int64, receiptInfo types.Receipt) (stop bool) { if receiptInfo.Completed == nil { count++ } @@ -498,7 +502,7 @@ func (suite *KeeperTestSuite) TestFlushOutstandingDelegations() { receiptOneTime := cutOffTime.Add(-2 * time.Hour) receiptTwoTime := cutOffTime.Add(2 * time.Hour) - rcpt1 := icstypes.Receipt{ + rcpt1 := types.Receipt{ ChainId: suite.chainB.ChainID, Sender: userAddress, Txhash: "TestDeposit01", @@ -512,7 +516,7 @@ func (suite *KeeperTestSuite) TestFlushOutstandingDelegations() { Completed: nil, } - rcpt2 := icstypes.Receipt{ + rcpt2 := types.Receipt{ ChainId: suite.chainB.ChainID, Sender: userAddress, Txhash: "TestDeposit02", @@ -533,7 +537,7 @@ func (suite *KeeperTestSuite) TestFlushOutstandingDelegations() { count := 0 zone, found := quicksilver.InterchainstakingKeeper.GetZone(ctx, suite.chainB.ChainID) suite.True(found) - quicksilver.InterchainstakingKeeper.IterateZoneReceipts(ctx, zone.ChainId, func(index int64, receiptInfo icstypes.Receipt) (stop bool) { + quicksilver.InterchainstakingKeeper.IterateZoneReceipts(ctx, zone.ChainId, func(index int64, receiptInfo types.Receipt) (stop bool) { if receiptInfo.Completed == nil { count++ } @@ -550,7 +554,7 @@ func (suite *KeeperTestSuite) TestFlushOutstandingDelegations() { setStatements: func(ctx sdk.Context, quicksilver *app.Quicksilver) { cutOffTime := ctx.BlockTime().AddDate(0, 0, -1) receiptOneTime := cutOffTime.Add(-2 * time.Hour) - rcpt1 := icstypes.Receipt{ + rcpt1 := types.Receipt{ ChainId: suite.chainB.ChainID, Sender: userAddress, Txhash: "TestDeposit01", @@ -564,7 +568,7 @@ func (suite *KeeperTestSuite) TestFlushOutstandingDelegations() { Completed: nil, } - rcpt2 := icstypes.Receipt{ + rcpt2 := types.Receipt{ ChainId: suite.chainB.ChainID, Sender: userAddress, Txhash: "TestDeposit02", @@ -585,7 +589,7 @@ func (suite *KeeperTestSuite) TestFlushOutstandingDelegations() { count := 0 zone, found := quicksilver.InterchainstakingKeeper.GetZone(ctx, suite.chainB.ChainID) suite.True(found) - quicksilver.InterchainstakingKeeper.IterateZoneReceipts(ctx, zone.ChainId, func(index int64, receiptInfo icstypes.Receipt) (stop bool) { + quicksilver.InterchainstakingKeeper.IterateZoneReceipts(ctx, zone.ChainId, func(index int64, receiptInfo types.Receipt) (stop bool) { if receiptInfo.Completed == nil { count++ } @@ -610,6 +614,8 @@ func (suite *KeeperTestSuite) TestFlushOutstandingDelegations() { test.setStatements(ctx, quicksilver) zone, found := quicksilver.InterchainstakingKeeper.GetZone(ctx, suite.chainB.ChainID) + zone.DelegationAddress.Balance = zone.DelegationAddress.Balance.Add(test.delAddrBalance) + quicksilver.InterchainstakingKeeper.SetZone(ctx, &zone) suite.True(found) err := quicksilver.InterchainstakingKeeper.FlushOutstandingDelegations(ctx, &zone, test.delAddrBalance) // refetch zone after FlushOutstandingDelegations setZone(). @@ -620,7 +626,7 @@ func (suite *KeeperTestSuite) TestFlushOutstandingDelegations() { suite.NoError(err) msgs = append(msgs, quicksilver.InterchainstakingKeeper.PrepareDelegationMessagesForCoins(&zone, allocations)...) for _, msg := range msgs { - err := quicksilver.InterchainstakingKeeper.HandleDelegate(ctx, msg, "batch/1577836910") + err := quicksilver.InterchainstakingKeeper.HandleDelegate(ctx, msg, types.EpochMsgMemo(types.MsgTypeBatch, ctx.BlockTime().AddDate(0, 0, -1).Unix())) suite.NoError(err) } } @@ -637,37 +643,37 @@ func (suite *KeeperTestSuite) TestPerformanceDelegation() { const chainID = "quicksilver-1" // Set zone - quicksilver.InterchainstakingKeeper.SetZone(ctx, &icstypes.Zone{ + quicksilver.InterchainstakingKeeper.SetZone(ctx, &types.Zone{ ConnectionId: "connection-test", ChainId: chainID, LocalDenom: "uqck", BaseDenom: "qck", - DelegationAddress: &icstypes.ICAAccount{ + DelegationAddress: &types.ICAAccount{ Address: addressutils.GenerateAddressForTestWithPrefix("quicksilver"), }, - PerformanceAddress: &icstypes.ICAAccount{ + PerformanceAddress: &types.ICAAccount{ Address: addressutils.GenerateAddressForTestWithPrefix("quicksilver"), }, }) // Check set zone zone, ok := quicksilver.InterchainstakingKeeper.GetZone(ctx, chainID) suite.True(ok, "expected to retrieve a zone") - suite.NotEqual(icstypes.Zone{}, zone, "Expecting a non-blank zone") + suite.NotEqual(types.Zone{}, zone, "Expecting a non-blank zone") // set val - val0 := icstypes.Validator{ValoperAddress: "cosmosvaloper1sjllsnramtg3ewxqwwrwjxfgc4n4ef9u2lcnj0", CommissionRate: sdk.MustNewDecFromStr("1"), VotingPower: sdk.NewInt(2000), Status: stakingtypes.BondStatusBonded} + val0 := types.Validator{ValoperAddress: "cosmosvaloper1sjllsnramtg3ewxqwwrwjxfgc4n4ef9u2lcnj0", CommissionRate: sdk.MustNewDecFromStr("1"), VotingPower: sdk.NewInt(2000), Status: stakingtypes.BondStatusBonded} err := quicksilver.InterchainstakingKeeper.SetValidator(ctx, zone.ChainId, val0) suite.NoError(err) - val1 := icstypes.Validator{ValoperAddress: "cosmosvaloper156gqf9837u7d4c4678yt3rl4ls9c5vuursrrzf", CommissionRate: sdk.MustNewDecFromStr("1"), VotingPower: sdk.NewInt(2000), Status: stakingtypes.BondStatusBonded} + val1 := types.Validator{ValoperAddress: "cosmosvaloper156gqf9837u7d4c4678yt3rl4ls9c5vuursrrzf", CommissionRate: sdk.MustNewDecFromStr("1"), VotingPower: sdk.NewInt(2000), Status: stakingtypes.BondStatusBonded} err = quicksilver.InterchainstakingKeeper.SetValidator(ctx, zone.ChainId, val1) suite.NoError(err) - val2 := icstypes.Validator{ValoperAddress: "cosmosvaloper14lultfckehtszvzw4ehu0apvsr77afvyju5zzy", CommissionRate: sdk.MustNewDecFromStr("1"), VotingPower: sdk.NewInt(2000), Status: stakingtypes.BondStatusBonded} + val2 := types.Validator{ValoperAddress: "cosmosvaloper14lultfckehtszvzw4ehu0apvsr77afvyju5zzy", CommissionRate: sdk.MustNewDecFromStr("1"), VotingPower: sdk.NewInt(2000), Status: stakingtypes.BondStatusBonded} err = quicksilver.InterchainstakingKeeper.SetValidator(ctx, zone.ChainId, val2) suite.NoError(err) - val3 := icstypes.Validator{ValoperAddress: "cosmosvaloper1z8zjv3lntpwxua0rtpvgrcwl0nm0tltgpgs6l7", CommissionRate: sdk.MustNewDecFromStr("1"), VotingPower: sdk.NewInt(2000), Status: stakingtypes.BondStatusBonded} + val3 := types.Validator{ValoperAddress: "cosmosvaloper1z8zjv3lntpwxua0rtpvgrcwl0nm0tltgpgs6l7", CommissionRate: sdk.MustNewDecFromStr("1"), VotingPower: sdk.NewInt(2000), Status: stakingtypes.BondStatusBonded} err = quicksilver.InterchainstakingKeeper.SetValidator(ctx, zone.ChainId, val3) suite.NoError(err) @@ -675,7 +681,7 @@ func (suite *KeeperTestSuite) TestPerformanceDelegation() { // create perf delegation performanceAddress := zone.PerformanceAddress - perfDelegation := icstypes.Delegation{ + perfDelegation := types.Delegation{ DelegationAddress: performanceAddress.Address, ValidatorAddress: vals[1].ValoperAddress, Amount: sdk.NewCoin(zone.BaseDenom, sdk.NewInt(1000)), @@ -699,10 +705,10 @@ func (suite *KeeperTestSuite) TestDelegationPlan() { jsonDelegations, _ := base64.RawStdEncoding.DecodeString(delegationFixture) quicksilver := suite.GetQuicksilverApp(suite.chainA) ctx := suite.chainA.GetContext() - var delegations icstypes.QueryDelegationsResponse + var delegations types.QueryDelegationsResponse quicksilver.InterchainstakingKeeper.GetCodec().MustUnmarshalJSON(jsonDelegations, &delegations) - zone := icstypes.Zone{ + zone := types.Zone{ ConnectionId: "connection-0", ChainId: "cosmoshub-4", AccountPrefix: "cosmos", @@ -712,7 +718,7 @@ func (suite *KeeperTestSuite) TestDelegationPlan() { jsonVals, _ := base64.RawStdEncoding.DecodeString(val2fixture) - vals := make([]icstypes.Validator, 0) + vals := make([]types.Validator, 0) err := json.Unmarshal(jsonVals, &vals) suite.NoError(err) @@ -739,7 +745,7 @@ func (suite *KeeperTestSuite) TestDelegationPlan() { currentAllocations, currentSum, _, _ := quicksilver.InterchainstakingKeeper.GetDelegationMap(ctx, zone.ChainId) - allocations, err := icstypes.DetermineAllocationsForDelegation(currentAllocations, currentSum, targetAllocations, amount) + allocations, err := types.DetermineAllocationsForDelegation(currentAllocations, currentSum, targetAllocations, amount, make(map[string]sdkmath.Int)) suite.NoError(err) for valoper, alloc := range allocations { @@ -756,6 +762,63 @@ func (suite *KeeperTestSuite) TestDelegationPlan() { } } +func (suite *KeeperTestSuite) TestDetermineMaximumValidatorAllocationsNoCaps() { + suite.SetupTest() + suite.setupTestZones() + + quicksilver := suite.GetQuicksilverApp(suite.chainA) + ctx := suite.chainA.GetContext() + + zone, found := quicksilver.InterchainstakingKeeper.GetZone(ctx, suite.chainB.ChainID) + suite.True(found) + + suite.Equal(make(map[string]sdkmath.Int, 0), quicksilver.InterchainstakingKeeper.DetermineMaximumValidatorAllocations(ctx, &zone)) +} + +func (suite *KeeperTestSuite) TestDetermineMaximumValidatorAllocations() { + suite.SetupTest() + suite.setupTestZones() + + quicksilver := suite.GetQuicksilverApp(suite.chainA) + ctx := suite.chainA.GetContext() + + quicksilver.InterchainstakingKeeper.SetLsmCaps(ctx, suite.chainB.ChainID, types.LsmCaps{GlobalCap: sdk.NewDecWithPrec(50, 2), ValidatorBondCap: sdk.NewDec(50), ValidatorCap: sdk.NewDecWithPrec(50, 2)}) + + zone, found := quicksilver.InterchainstakingKeeper.GetZone(ctx, suite.chainB.ChainID) + + validators := quicksilver.InterchainstakingKeeper.GetValidators(ctx, zone.ChainId) + // val 0: constraint by validator cap - 50% of 1000 = 500 - 450 = 50. + validators[0].VotingPower = sdkmath.NewInt(1000) + validators[0].ValidatorBondShares = sdk.NewDec(200) + validators[0].LiquidShares = sdk.NewDec(450) + _ = quicksilver.InterchainstakingKeeper.SetValidator(ctx, zone.ChainId, validators[0]) + + // val 1: constraint by validator cap, with zero liquid shares - 50% of 1000 = 500 - 0 = 500. + validators[1].VotingPower = sdkmath.NewInt(1000) + validators[1].ValidatorBondShares = sdk.NewDec(200) + validators[1].LiquidShares = sdk.NewDec(0) + _ = quicksilver.InterchainstakingKeeper.SetValidator(ctx, zone.ChainId, validators[1]) + + // val 2: constraint by valbond cap - 50 * 2 = 100 - 50 = 50. + validators[2].VotingPower = sdkmath.NewInt(1000) + validators[2].ValidatorBondShares = sdk.NewDec(2) + validators[2].LiquidShares = sdk.NewDec(50) + _ = quicksilver.InterchainstakingKeeper.SetValidator(ctx, zone.ChainId, validators[2]) + + // val 3: constraint by valbond cap, zero ls - 50 * 2 = 100 - 0 = 100. + validators[3].VotingPower = sdkmath.NewInt(1000) + validators[3].ValidatorBondShares = sdk.NewDec(2) + validators[3].LiquidShares = sdk.NewDec(0) + _ = quicksilver.InterchainstakingKeeper.SetValidator(ctx, zone.ChainId, validators[3]) + + suite.True(found) + + suite.Equal(quicksilver.InterchainstakingKeeper.DetermineMaximumValidatorAllocations(ctx, &zone)[validators[0].ValoperAddress], sdkmath.NewInt(50)) + suite.Equal(quicksilver.InterchainstakingKeeper.DetermineMaximumValidatorAllocations(ctx, &zone)[validators[1].ValoperAddress], sdkmath.NewInt(500)) + suite.Equal(quicksilver.InterchainstakingKeeper.DetermineMaximumValidatorAllocations(ctx, &zone)[validators[2].ValoperAddress], sdkmath.NewInt(50)) + suite.Equal(quicksilver.InterchainstakingKeeper.DetermineMaximumValidatorAllocations(ctx, &zone)[validators[3].ValoperAddress], sdkmath.NewInt(100)) +} + // values below are data dumps taken from the live quicksilver-2 and cosmoshub-4 chains, to be used as fixtures. const ( diff --git a/x/interchainstaking/keeper/hooks.go b/x/interchainstaking/keeper/hooks.go index afcc15529..5763bb8e2 100644 --- a/x/interchainstaking/keeper/hooks.go +++ b/x/interchainstaking/keeper/hooks.go @@ -9,7 +9,6 @@ import ( distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - "github.com/quicksilver-zone/quicksilver/utils/addressutils" epochstypes "github.com/quicksilver-zone/quicksilver/x/epochs/types" "github.com/quicksilver-zone/quicksilver/x/interchainstaking/types" ) @@ -147,20 +146,17 @@ func (k *Keeper) AfterEpochEnd(ctx sdk.Context, epochIdentifier string, epochNum 0, ) - addressBytes, err := addressutils.AccAddressFromBech32(zone.DelegationAddress.Address, zone.AccountPrefix) - if err != nil { - k.Logger(ctx).Error("cannot decode bech32 delegation addr") - return false - } + balancesQuery := banktypes.QueryAllBalancesRequest{Address: zone.DelegationAddress.Address} + bz = k.cdc.MustMarshal(&balancesQuery) k.ICQKeeper.MakeRequest( ctx, zone.ConnectionId, zone.ChainId, - types.BankStoreKey, - append(banktypes.CreateAccountBalancesPrefix(addressBytes), []byte(zone.BaseDenom)...), + "cosmos.bank.v1beta1.Query/AllBalances", + bz, sdk.NewInt(-1), types.ModuleName, - "delegationaccountbalance", + "delegationaccountbalances", 0, ) // increment waitgroup; decremented in delegationaccountbalance callback diff --git a/x/interchainstaking/keeper/ibc_packet_handlers.go b/x/interchainstaking/keeper/ibc_packet_handlers.go index 21c29d62c..bf586c79f 100644 --- a/x/interchainstaking/keeper/ibc_packet_handlers.go +++ b/x/interchainstaking/keeper/ibc_packet_handlers.go @@ -9,7 +9,6 @@ import ( "time" "github.com/golang/protobuf/proto" // nolint:staticcheck - lsmstakingtypes "github.com/iqlusioninc/liquidity-staking-module/x/staking/types" sdkmath "cosmossdk.io/math" @@ -31,6 +30,7 @@ import ( "github.com/quicksilver-zone/quicksilver/utils/addressutils" queryTypes "github.com/quicksilver-zone/quicksilver/x/interchainquery/types" "github.com/quicksilver-zone/quicksilver/x/interchainstaking/types" + lsmstakingtypes "github.com/quicksilver-zone/quicksilver/x/lsmtypes" ) type TypedMsg struct { @@ -108,7 +108,7 @@ func (k *Keeper) HandleAcknowledgement(ctx sdk.Context, packet channeltypes.Pack for msgIndex, msg := range msgs { // use msgData for v0.45 and below and msgResponse for v0.46+ - // nolint:staticcheck // SA1019 ignore this! + //nolint:staticcheck // SA1019 ignore this! var msgResponse []byte // check that the msgResponses slice is at least the length of the current index. @@ -138,28 +138,30 @@ func (k *Keeper) HandleAcknowledgement(ctx sdk.Context, packet channeltypes.Pack return err } continue - case "/liquidstaking.staking.v1beta1.MsgRedeemTokensforShares": - // TODO: handle this before LSM + case "/cosmos.staking.v1beta1.MsgRedeemTokensForShares": if !success { - return nil + if err := k.HandleFailedRedeemTokens(ctx, msg.Msg, packetData.Memo); err != nil { + return err + } + continue } - response := lsmstakingtypes.MsgRedeemTokensforSharesResponse{} + response := lsmstakingtypes.MsgRedeemTokensForSharesResponse{} err = proto.Unmarshal(msgResponse, &response) if err != nil { - k.Logger(ctx).Error("unable to unmarshal MsgRedeemTokensforShares response", "error", err) + k.Logger(ctx).Error("unable to unmarshal MsgRedeemTokensForShares response", "error", err) return err } k.Logger(ctx).Info("Tokens redeemed for shares", "response", response) // we should update delegation records here. - if err := k.HandleRedeemTokens(ctx, msg.Msg, response.Amount); err != nil { + if err := k.HandleRedeemTokens(ctx, msg.Msg, response.Amount, packetData.Memo); err != nil { return err } continue - case "/liquidstaking.staking.v1beta1.MsgTokenizeShares": - // TODO: handle this before LSM + case "/cosmos.staking.v1beta1.MsgTokenizeShares": if !success { + // We can safely ignore this, as this can reasonably fail, and we cater for this in the flush logic. return nil } response := lsmstakingtypes.MsgTokenizeSharesResponse{} @@ -176,9 +178,11 @@ func (k *Keeper) HandleAcknowledgement(ctx sdk.Context, packet channeltypes.Pack } continue case "/cosmos.staking.v1beta1.MsgDelegate": - // TODO: can we safely ignore this? if !success { - return nil + if err := k.HandleFailedDelegate(ctx, msg.Msg, packetData.Memo); err != nil { + return err + } + continue } response := stakingtypes.MsgDelegateResponse{} err = proto.Unmarshal(msgResponse, &response) @@ -386,7 +390,8 @@ func (k *Keeper) HandleCompleteSend(ctx sdk.Context, msg sdk.Msg, memo string) e case zone.IsDelegateAddress(sMsg.FromAddress): return k.HandleWithdrawForUser(ctx, zone, sMsg, memo) case zone.IsDelegateAddress(sMsg.ToAddress) && zone.DepositAddress.Address == sMsg.FromAddress: - return k.handleSendToDelegate(ctx, zone, sMsg, memo) + _, err := k.handleSendToDelegate(ctx, zone, sMsg, memo) + return err default: err = fmt.Errorf("unexpected completed send (2) from %s to %s (amount: %s)", sMsg.FromAddress, sMsg.ToAddress, sMsg.Amount) k.Logger(ctx).Error(err.Error()) @@ -395,16 +400,17 @@ func (k *Keeper) HandleCompleteSend(ctx sdk.Context, msg sdk.Msg, memo string) e } func (k *Keeper) handleRewardsDelegation(ctx sdk.Context, zone types.Zone, msg *banktypes.MsgSend) error { - return k.handleSendToDelegate(ctx, &zone, msg, "rewards") + _, err := k.handleSendToDelegate(ctx, &zone, msg, "rewards") + return err } -func (k *Keeper) handleSendToDelegate(ctx sdk.Context, zone *types.Zone, msg *banktypes.MsgSend, memo string) error { +func (k *Keeper) handleSendToDelegate(ctx sdk.Context, zone *types.Zone, msg *banktypes.MsgSend, memo string) (int, error) { var msgs []sdk.Msg for _, coin := range msg.Amount { if coin.Denom == zone.BaseDenom { allocations, err := k.DeterminePlanForDelegation(ctx, zone, msg.Amount) if err != nil { - return err + return 0, err } msgs = append(msgs, k.PrepareDelegationMessagesForCoins(zone, allocations)...) } else { @@ -414,7 +420,7 @@ func (k *Keeper) handleSendToDelegate(ctx sdk.Context, zone *types.Zone, msg *ba k.Logger(ctx).Info("messages to send", "messages", msgs) - return k.SubmitTx(ctx, msgs, zone.DelegationAddress, memo, zone.MessagesPerTx) + return len(msgs), k.SubmitTx(ctx, msgs, zone.DelegationAddress, memo, zone.MessagesPerTx) } // HandleWithdrawForUser handles withdraw for user will check that the msgSend we have successfully executed matches an existing withdrawal record. @@ -544,25 +550,23 @@ func (k *Keeper) HandleTokenizedShares(ctx sdk.Context, msg sdk.Msg, sharesAmoun for _, dist := range withdrawalRecord.Distribution { if equalLsmCoin(dist.Valoper, dist.Amount, sharesAmount) { withdrawalRecord.Amount = withdrawalRecord.Amount.Add(sharesAmount) - // matched amount - if len(withdrawalRecord.Distribution) == len(withdrawalRecord.Amount) { - // we just added the last tokens - k.Logger(ctx).Info("Found matching withdrawal; marking for send") - k.DeleteWithdrawalRecord(ctx, zone.ChainId, memo, types.WithdrawStatusTokenize) - withdrawalRecord.Status = types.WithdrawStatusSend - sendMsg := &banktypes.MsgSend{FromAddress: zone.DelegationAddress.Address, ToAddress: withdrawalRecord.Recipient, Amount: withdrawalRecord.Amount} - err = k.SubmitTx(ctx, []sdk.Msg{sendMsg}, zone.DelegationAddress, memo, zone.MessagesPerTx) - if err != nil { - return err - } - } else { - k.Logger(ctx).Info("Found matching withdrawal; awaiting additional messages") - } - k.SetWithdrawalRecord(ctx, withdrawalRecord) break } } - return nil + + k.SetWithdrawalRecord(ctx, withdrawalRecord) + + if len(withdrawalRecord.Distribution) != len(withdrawalRecord.Amount) { + k.Logger(ctx).Info(fmt.Sprintf("Found matching withdrawal (%d/%d); awaiting additional messages", len(withdrawalRecord.Amount), len(withdrawalRecord.Distribution))) + } else { + k.Logger(ctx).Info("Found matching withdrawal; marking for send") + k.DeleteWithdrawalRecord(ctx, zone.ChainId, memo, types.WithdrawStatusTokenize) + withdrawalRecord.Status = types.WithdrawStatusSend + k.SetWithdrawalRecord(ctx, withdrawalRecord) + sendMsg := &banktypes.MsgSend{FromAddress: zone.DelegationAddress.Address, ToAddress: withdrawalRecord.Recipient, Amount: withdrawalRecord.Amount} + err = k.SubmitTx(ctx, []sdk.Msg{sendMsg}, zone.DelegationAddress, memo, zone.MessagesPerTx) + } + return err } func (k *Keeper) HandleBeginRedelegate(ctx sdk.Context, msg sdk.Msg, completion time.Time, memo string) error { @@ -882,10 +886,10 @@ func (k *Keeper) HandleFailedUndelegate(ctx sdk.Context, msg sdk.Msg, memo strin return nil } -func (k *Keeper) HandleRedeemTokens(ctx sdk.Context, msg sdk.Msg, amount sdk.Coin) error { +func (k *Keeper) HandleRedeemTokens(ctx sdk.Context, msg sdk.Msg, amount sdk.Coin, memo string) error { k.Logger(ctx).Info("Received MsgRedeemTokensforShares acknowledgement") // first, type assertion. we should have stakingtypes.MsgRedeemTokensforShares - redeemMsg, ok := msg.(*lsmstakingtypes.MsgRedeemTokensforShares) + redeemMsg, ok := msg.(*lsmstakingtypes.MsgRedeemTokensForShares) if !ok { k.Logger(ctx).Error("unable to cast source message to MsgRedeemTokensforShares") return errors.New("unable to cast source message to MsgRedeemTokensforShares") @@ -899,9 +903,71 @@ func (k *Keeper) HandleRedeemTokens(ctx sdk.Context, msg sdk.Msg, amount sdk.Coi return fmt.Errorf("zone for delegate account %s not found", redeemMsg.DelegatorAddress) } + switch { + case strings.HasPrefix(memo, "batch"): + k.Logger(ctx).Debug("batch delegation", "memo", memo, "tx", redeemMsg) + exclusionTimestampUnix, err := strconv.ParseInt(strings.Split(memo, "/")[1], 10, 64) + if err != nil { + return err + } + k.Logger(ctx).Debug("outstanding delegations ack-received") + k.SetReceiptsCompleted(ctx, zone.ChainId, time.Unix(exclusionTimestampUnix, 0), ctx.BlockTime(), redeemMsg.Amount.Denom) + zone.DelegationAddress.Balance = zone.DelegationAddress.Balance.Sub(redeemMsg.Amount) + k.SetZone(ctx, zone) + if zone.WithdrawalWaitgroup == 0 { + k.Logger(ctx).Info("Triggering redemption rate calc after delegation flush") + if err = k.TriggerRedemptionRate(ctx, zone); err != nil { + return err + } + } + + default: + receipt, found := k.GetReceipt(ctx, zone.ChainId, memo) + if !found { + return fmt.Errorf("unable to find receipt for hash %s", memo) + } + t := ctx.BlockTime() + receipt.Completed = &t + k.SetReceipt(ctx, receipt) + } return k.UpdateDelegationRecordForAddress(ctx, redeemMsg.DelegatorAddress, validatorAddress, amount, zone, false) } +func (k *Keeper) HandleFailedRedeemTokens(ctx sdk.Context, msg sdk.Msg, memo string) error { + k.Logger(ctx).Info("Received MsgRedeemTokensForShares failure acknowledgement") + // first, type assertion. we should have lsmstakingtypes.MsgRedeemTokensForShares + redeemMsg, ok := msg.(*lsmstakingtypes.MsgRedeemTokensForShares) + if !ok { + k.Logger(ctx).Error("unable to cast source message to MsgRedeemTokensForShares") + return errors.New("unable to cast source message to MsgRedeemTokensForShares") + } + zone, found := k.GetZoneForDelegateAccount(ctx, redeemMsg.DelegatorAddress) + if !found { + // most likely a performance account... + if _, found := k.GetZoneForPerformanceAccount(ctx, redeemMsg.DelegatorAddress); !found { + return nil + } + return fmt.Errorf("unable to find zone for address %s", redeemMsg.DelegatorAddress) + } + + switch { + case strings.HasPrefix(memo, "batch"): + k.Logger(ctx).Error("batch token redemption failed", "memo", memo, "tx", redeemMsg) + zone.WithdrawalWaitgroup-- + k.SetZone(ctx, zone) + if zone.WithdrawalWaitgroup == 0 { + k.Logger(ctx).Info("Triggering redemption rate calc after delegation flush") + if err := k.TriggerRedemptionRate(ctx, zone); err != nil { + return err + } + } + + default: + // no-op + } + return nil +} + func (k *Keeper) HandleDelegate(ctx sdk.Context, msg sdk.Msg, memo string) error { k.Logger(ctx).Info("Received MsgDelegate acknowledgement") // first, type assertion. we should have stakingtypes.MsgDelegate @@ -921,16 +987,17 @@ func (k *Keeper) HandleDelegate(ctx sdk.Context, msg sdk.Msg, memo string) error switch { case memo == "rewards": case strings.HasPrefix(memo, "batch"): - k.Logger(ctx).Debug("batch delegation", "memo", memo, "tx", delegateMsg) + k.Logger(ctx).Error("batch delegation", "memo", memo, "tx", delegateMsg) exclusionTimestampUnix, err := strconv.ParseInt(strings.Split(memo, "/")[1], 10, 64) if err != nil { return err } k.Logger(ctx).Debug("outstanding delegations ack-received") - k.SetReceiptsCompleted(ctx, zone.ChainId, time.Unix(exclusionTimestampUnix, 0), ctx.BlockTime()) + k.SetReceiptsCompleted(ctx, zone.ChainId, time.Unix(exclusionTimestampUnix, 0), ctx.BlockTime(), delegateMsg.Amount.Denom) zone.DelegationAddress.Balance = zone.DelegationAddress.Balance.Sub(delegateMsg.Amount) + zone.WithdrawalWaitgroup-- k.SetZone(ctx, zone) - if zone.DelegationAddress.Balance.IsZero() && zone.WithdrawalWaitgroup == 0 { + if zone.WithdrawalWaitgroup == 0 { k.Logger(ctx).Info("Triggering redemption rate calc after delegation flush") if err := k.TriggerRedemptionRate(ctx, zone); err != nil { return err @@ -950,6 +1017,41 @@ func (k *Keeper) HandleDelegate(ctx sdk.Context, msg sdk.Msg, memo string) error return k.UpdateDelegationRecordForAddress(ctx, delegateMsg.DelegatorAddress, delegateMsg.ValidatorAddress, delegateMsg.Amount, zone, false) } +func (k *Keeper) HandleFailedDelegate(ctx sdk.Context, msg sdk.Msg, memo string) error { + k.Logger(ctx).Info("Received MsgDelegate failure acknowledgement") + // first, type assertion. we should have stakingtypes.MsgDelegate + delegateMsg, ok := msg.(*stakingtypes.MsgDelegate) + if !ok { + k.Logger(ctx).Error("unable to cast source message to MsgDelegate") + return errors.New("unable to cast source message to MsgDelegate") + } + zone, found := k.GetZoneForDelegateAccount(ctx, delegateMsg.DelegatorAddress) + if !found { + // most likely a performance account... + if _, found := k.GetZoneForPerformanceAccount(ctx, delegateMsg.DelegatorAddress); found { + return nil + } + return fmt.Errorf("unable to find zone for address %s", delegateMsg.DelegatorAddress) + } + + switch { + case strings.HasPrefix(memo, "batch"): + k.Logger(ctx).Error("batch delegation failed", "memo", memo, "tx", delegateMsg) + zone.WithdrawalWaitgroup-- + k.SetZone(ctx, zone) + if zone.WithdrawalWaitgroup == 0 { + k.Logger(ctx).Info("Triggering redemption rate calc after delegation flush") + if err := k.TriggerRedemptionRate(ctx, zone); err != nil { + return err + } + } + + default: + // no-op + } + return nil +} + func (k *Keeper) HandleUpdatedWithdrawAddress(ctx sdk.Context, msg sdk.Msg) error { k.Logger(ctx).Info("Received MsgSetWithdrawAddress acknowledgement") // first, type assertion. we should have distrtypes.MsgSetWithdrawAddress @@ -1135,7 +1237,7 @@ func (k *Keeper) HandleWithdrawRewards(ctx sdk.Context, msg sdk.Msg) error { k.SetZone(ctx, zone) } k.Logger(ctx).Info("Received MsgWithdrawDelegatorReward acknowledgement", "wg", zone.WithdrawalWaitgroup, "delegator", withdrawalMsg.DelegatorAddress) - switch zone.WithdrawalWaitgroup == 0 && zone.DelegationAddress.Balance.IsZero() { + switch zone.WithdrawalWaitgroup == 0 { case true: k.Logger(ctx).Info("triggering redemption rate calc after rewards withdrawal") return k.TriggerRedemptionRate(ctx, zone) @@ -1245,7 +1347,7 @@ func (*Keeper) prepareRewardsDistributionMsgs(zone types.Zone, rewards sdkmath.I } func equalLsmCoin(valoper string, amount uint64, lsmAmount sdk.Coin) bool { - if strings.Contains(lsmAmount.Denom, valoper) { + if strings.HasPrefix(lsmAmount.Denom, valoper) { return lsmAmount.Amount.Equal(sdk.NewIntFromUint64(amount)) } return false diff --git a/x/interchainstaking/keeper/ibc_packet_handlers_test.go b/x/interchainstaking/keeper/ibc_packet_handlers_test.go index 17c6fb679..d6a9cb208 100644 --- a/x/interchainstaking/keeper/ibc_packet_handlers_test.go +++ b/x/interchainstaking/keeper/ibc_packet_handlers_test.go @@ -7,7 +7,6 @@ import ( "testing" "time" - lsmstakingtypes "github.com/iqlusioninc/liquidity-staking-module/x/staking/types" "github.com/stretchr/testify/require" "cosmossdk.io/math" @@ -27,7 +26,8 @@ import ( "github.com/quicksilver-zone/quicksilver/utils" "github.com/quicksilver-zone/quicksilver/utils/addressutils" "github.com/quicksilver-zone/quicksilver/utils/randomutils" - icstypes "github.com/quicksilver-zone/quicksilver/x/interchainstaking/types" + "github.com/quicksilver-zone/quicksilver/x/interchainstaking/types" + lsmstakingtypes "github.com/quicksilver-zone/quicksilver/x/lsmtypes" ) var TestChannel = channeltypes.Channel{ @@ -83,7 +83,7 @@ func (suite *KeeperTestSuite) TestHandleMsgTransferGood() { ibcDenom := utils.DeriveIbcDenom(channel.Counterparty.PortId, channel.Counterparty.ChannelId, tc.amount.Denom) - err := quicksilver.BankKeeper.MintCoins(ctx, icstypes.ModuleName, sdk.NewCoins(sdk.NewCoin(ibcDenom, tc.amount.Amount))) + err := quicksilver.BankKeeper.MintCoins(ctx, types.ModuleName, sdk.NewCoins(sdk.NewCoin(ibcDenom, tc.amount.Amount))) suite.NoError(err) if tc.feeAmount != nil { @@ -98,7 +98,7 @@ func (suite *KeeperTestSuite) TestHandleMsgTransferGood() { sender := zone.WithdrawalAddress.Address suite.NoError(err) - txMacc := quicksilver.AccountKeeper.GetModuleAddress(icstypes.ModuleName) + txMacc := quicksilver.AccountKeeper.GetModuleAddress(types.ModuleName) feeMacc := quicksilver.AccountKeeper.GetModuleAddress(authtypes.FeeCollectorName) transferMsg := ibctransfertypes.MsgTransfer{ @@ -106,13 +106,12 @@ func (suite *KeeperTestSuite) TestHandleMsgTransferGood() { SourceChannel: "channel-0", Token: tc.amount, Sender: sender, - Receiver: quicksilver.AccountKeeper.GetModuleAddress(icstypes.ModuleName).String(), + Receiver: quicksilver.AccountKeeper.GetModuleAddress(types.ModuleName).String(), } suite.NoError(quicksilver.InterchainstakingKeeper.HandleMsgTransfer(ctx, &transferMsg)) txMaccBalance := quicksilver.BankKeeper.GetAllBalances(ctx, txMacc) feeMaccBalance := quicksilver.BankKeeper.GetAllBalances(ctx, feeMacc) - fmt.Println(feeMaccBalance) zoneAddress, err := addressutils.AccAddressFromBech32(zone.WithdrawalAddress.Address, "") suite.NoError(err) wdAccountBalance := quicksilver.BankKeeper.GetAllBalances(ctx, zoneAddress) @@ -159,22 +158,22 @@ func TestHandleMsgTransferBadRecipient(t *testing.T) { func (suite *KeeperTestSuite) TestHandleQueuedUnbondings() { tests := []struct { name string - records func(ctx sdk.Context, qs *app.Quicksilver, zone *icstypes.Zone) []icstypes.WithdrawalRecord - delegations func(ctx sdk.Context, qs *app.Quicksilver, zone *icstypes.Zone) []icstypes.Delegation - redelegations func(ctx sdk.Context, qs *app.Quicksilver, zone *icstypes.Zone) []icstypes.RedelegationRecord + records func(ctx sdk.Context, qs *app.Quicksilver, zone *types.Zone) []types.WithdrawalRecord + delegations func(ctx sdk.Context, qs *app.Quicksilver, zone *types.Zone) []types.Delegation + redelegations func(ctx sdk.Context, qs *app.Quicksilver, zone *types.Zone) []types.RedelegationRecord expectTransition []bool expectError bool }{ { name: "valid", - records: func(ctx sdk.Context, qs *app.Quicksilver, zone *icstypes.Zone) []icstypes.WithdrawalRecord { + records: func(ctx sdk.Context, qs *app.Quicksilver, zone *types.Zone) []types.WithdrawalRecord { vals := qs.InterchainstakingKeeper.GetValidatorAddresses(ctx, zone.ChainId) - return []icstypes.WithdrawalRecord{ + return []types.WithdrawalRecord{ { ChainId: zone.ChainId, Delegator: addressutils.GenerateAccAddressForTest().String(), - Distribution: []*icstypes.Distribution{ + Distribution: []*types.Distribution{ {Valoper: vals[0], Amount: 1000000}, {Valoper: vals[1], Amount: 1000000}, {Valoper: vals[2], Amount: 1000000}, @@ -184,13 +183,13 @@ func (suite *KeeperTestSuite) TestHandleQueuedUnbondings() { Amount: sdk.NewCoins(sdk.NewCoin("uatom", sdk.NewInt(4000000))), BurnAmount: sdk.NewCoin("uqatom", sdk.NewInt(4000000)), Txhash: "7C8B95EEE82CB63771E02EBEB05E6A80076D70B2E0A1C457F1FD1A0EF2EA961D", - Status: icstypes.WithdrawStatusQueued, + Status: types.WithdrawStatusQueued, }, } }, - delegations: func(ctx sdk.Context, qs *app.Quicksilver, zone *icstypes.Zone) []icstypes.Delegation { + delegations: func(ctx sdk.Context, qs *app.Quicksilver, zone *types.Zone) []types.Delegation { vals := qs.InterchainstakingKeeper.GetValidatorAddresses(ctx, zone.ChainId) - return []icstypes.Delegation{ + return []types.Delegation{ { DelegationAddress: zone.DelegationAddress.Address, ValidatorAddress: vals[0], @@ -213,21 +212,21 @@ func (suite *KeeperTestSuite) TestHandleQueuedUnbondings() { }, } }, - redelegations: func(ctx sdk.Context, qs *app.Quicksilver, zone *icstypes.Zone) []icstypes.RedelegationRecord { - return []icstypes.RedelegationRecord{} + redelegations: func(ctx sdk.Context, qs *app.Quicksilver, zone *types.Zone) []types.RedelegationRecord { + return []types.RedelegationRecord{} }, expectTransition: []bool{true}, expectError: false, }, { name: "valid - two", - records: func(ctx sdk.Context, qs *app.Quicksilver, zone *icstypes.Zone) []icstypes.WithdrawalRecord { + records: func(ctx sdk.Context, qs *app.Quicksilver, zone *types.Zone) []types.WithdrawalRecord { vals := qs.InterchainstakingKeeper.GetValidatorAddresses(ctx, zone.ChainId) - return []icstypes.WithdrawalRecord{ + return []types.WithdrawalRecord{ { ChainId: zone.ChainId, Delegator: addressutils.GenerateAccAddressForTest().String(), - Distribution: []*icstypes.Distribution{ + Distribution: []*types.Distribution{ {Valoper: vals[0], Amount: 1000000}, {Valoper: vals[1], Amount: 1000000}, {Valoper: vals[2], Amount: 1000000}, @@ -237,12 +236,12 @@ func (suite *KeeperTestSuite) TestHandleQueuedUnbondings() { Amount: sdk.NewCoins(sdk.NewCoin("uatom", sdk.NewInt(4000000))), BurnAmount: sdk.NewCoin("uqatom", sdk.NewInt(4000000)), Txhash: "7C8B95EEE82CB63771E02EBEB05E6A80076D70B2E0A1C457F1FD1A0EF2EA961D", - Status: icstypes.WithdrawStatusQueued, + Status: types.WithdrawStatusQueued, }, { ChainId: zone.ChainId, Delegator: addressutils.GenerateAccAddressForTest().String(), - Distribution: []*icstypes.Distribution{ + Distribution: []*types.Distribution{ {Valoper: vals[0], Amount: 5000000}, {Valoper: vals[1], Amount: 2500000}, {Valoper: vals[2], Amount: 5000000}, @@ -252,13 +251,13 @@ func (suite *KeeperTestSuite) TestHandleQueuedUnbondings() { Amount: sdk.NewCoins(sdk.NewCoin("uatom", sdk.NewInt(15000000))), BurnAmount: sdk.NewCoin("uqatom", sdk.NewInt(15000000)), Txhash: "d786f7d4c94247625c2882e921a790790eb77a00d0534d5c3154d0a9c5ab68f5", - Status: icstypes.WithdrawStatusQueued, + Status: types.WithdrawStatusQueued, }, } }, - delegations: func(ctx sdk.Context, qs *app.Quicksilver, zone *icstypes.Zone) []icstypes.Delegation { + delegations: func(ctx sdk.Context, qs *app.Quicksilver, zone *types.Zone) []types.Delegation { vals := qs.InterchainstakingKeeper.GetValidatorAddresses(ctx, zone.ChainId) - return []icstypes.Delegation{ + return []types.Delegation{ { DelegationAddress: zone.DelegationAddress.Address, ValidatorAddress: vals[0], @@ -281,21 +280,21 @@ func (suite *KeeperTestSuite) TestHandleQueuedUnbondings() { }, } }, - redelegations: func(ctx sdk.Context, qs *app.Quicksilver, zone *icstypes.Zone) []icstypes.RedelegationRecord { - return []icstypes.RedelegationRecord{} + redelegations: func(ctx sdk.Context, qs *app.Quicksilver, zone *types.Zone) []types.RedelegationRecord { + return []types.RedelegationRecord{} }, expectTransition: []bool{true, true}, expectError: false, }, { name: "invalid - locked tokens", - records: func(ctx sdk.Context, qs *app.Quicksilver, zone *icstypes.Zone) []icstypes.WithdrawalRecord { + records: func(ctx sdk.Context, qs *app.Quicksilver, zone *types.Zone) []types.WithdrawalRecord { vals := qs.InterchainstakingKeeper.GetValidatorAddresses(ctx, zone.ChainId) - return []icstypes.WithdrawalRecord{ + return []types.WithdrawalRecord{ { ChainId: zone.ChainId, Delegator: addressutils.GenerateAccAddressForTest().String(), - Distribution: []*icstypes.Distribution{ + Distribution: []*types.Distribution{ {Valoper: vals[0], Amount: 1000000}, {Valoper: vals[1], Amount: 1000000}, {Valoper: vals[2], Amount: 1000000}, @@ -305,13 +304,13 @@ func (suite *KeeperTestSuite) TestHandleQueuedUnbondings() { Amount: sdk.NewCoins(sdk.NewCoin("uatom", sdk.NewInt(4000000))), BurnAmount: sdk.NewCoin("uqatom", sdk.NewInt(4000000)), Txhash: "7C8B95EEE82CB63771E02EBEB05E6A80076D70B2E0A1C457F1FD1A0EF2EA961D", - Status: icstypes.WithdrawStatusQueued, + Status: types.WithdrawStatusQueued, }, } }, - delegations: func(ctx sdk.Context, qs *app.Quicksilver, zone *icstypes.Zone) []icstypes.Delegation { + delegations: func(ctx sdk.Context, qs *app.Quicksilver, zone *types.Zone) []types.Delegation { vals := qs.InterchainstakingKeeper.GetValidatorAddresses(ctx, zone.ChainId) - return []icstypes.Delegation{ + return []types.Delegation{ { DelegationAddress: zone.DelegationAddress.Address, ValidatorAddress: vals[0], @@ -334,9 +333,9 @@ func (suite *KeeperTestSuite) TestHandleQueuedUnbondings() { }, } }, - redelegations: func(ctx sdk.Context, qs *app.Quicksilver, zone *icstypes.Zone) []icstypes.RedelegationRecord { + redelegations: func(ctx sdk.Context, qs *app.Quicksilver, zone *types.Zone) []types.RedelegationRecord { vals := qs.InterchainstakingKeeper.GetValidatorAddresses(ctx, zone.ChainId) - return []icstypes.RedelegationRecord{ + return []types.RedelegationRecord{ { ChainId: zone.ChainId, EpochNumber: 1, @@ -352,13 +351,13 @@ func (suite *KeeperTestSuite) TestHandleQueuedUnbondings() { }, { name: "mixed - locked tokens but both succeed (previously failed)", - records: func(ctx sdk.Context, qs *app.Quicksilver, zone *icstypes.Zone) []icstypes.WithdrawalRecord { + records: func(ctx sdk.Context, qs *app.Quicksilver, zone *types.Zone) []types.WithdrawalRecord { vals := qs.InterchainstakingKeeper.GetValidatorAddresses(ctx, zone.ChainId) - return []icstypes.WithdrawalRecord{ + return []types.WithdrawalRecord{ { ChainId: zone.ChainId, Delegator: addressutils.GenerateAccAddressForTest().String(), - Distribution: []*icstypes.Distribution{ + Distribution: []*types.Distribution{ {Valoper: vals[0], Amount: 5000000}, {Valoper: vals[1], Amount: 2500000}, {Valoper: vals[2], Amount: 5000000}, @@ -368,12 +367,12 @@ func (suite *KeeperTestSuite) TestHandleQueuedUnbondings() { Amount: sdk.NewCoins(sdk.NewCoin("uatom", sdk.NewInt(15000000))), BurnAmount: sdk.NewCoin("uqatom", sdk.NewInt(15000000)), Txhash: "d786f7d4c94247625c2882e921a790790eb77a00d0534d5c3154d0a9c5ab68f5", - Status: icstypes.WithdrawStatusQueued, + Status: types.WithdrawStatusQueued, }, { ChainId: zone.ChainId, Delegator: addressutils.GenerateAccAddressForTest().String(), - Distribution: []*icstypes.Distribution{ + Distribution: []*types.Distribution{ {Valoper: vals[0], Amount: 1000000}, {Valoper: vals[1], Amount: 1000000}, {Valoper: vals[2], Amount: 1000000}, @@ -383,13 +382,13 @@ func (suite *KeeperTestSuite) TestHandleQueuedUnbondings() { Amount: sdk.NewCoins(sdk.NewCoin("uatom", sdk.NewInt(4000000))), BurnAmount: sdk.NewCoin("uqatom", sdk.NewInt(4000000)), Txhash: "7C8B95EEE82CB63771E02EBEB05E6A80076D70B2E0A1C457F1FD1A0EF2EA961D", - Status: icstypes.WithdrawStatusQueued, + Status: types.WithdrawStatusQueued, }, } }, - delegations: func(ctx sdk.Context, qs *app.Quicksilver, zone *icstypes.Zone) []icstypes.Delegation { + delegations: func(ctx sdk.Context, qs *app.Quicksilver, zone *types.Zone) []types.Delegation { vals := qs.InterchainstakingKeeper.GetValidatorAddresses(ctx, zone.ChainId) - return []icstypes.Delegation{ + return []types.Delegation{ { DelegationAddress: zone.DelegationAddress.Address, ValidatorAddress: vals[0], @@ -412,9 +411,9 @@ func (suite *KeeperTestSuite) TestHandleQueuedUnbondings() { }, } }, - redelegations: func(ctx sdk.Context, qs *app.Quicksilver, zone *icstypes.Zone) []icstypes.RedelegationRecord { + redelegations: func(ctx sdk.Context, qs *app.Quicksilver, zone *types.Zone) []types.RedelegationRecord { vals := qs.InterchainstakingKeeper.GetValidatorAddresses(ctx, zone.ChainId) - return []icstypes.RedelegationRecord{ + return []types.RedelegationRecord{ { ChainId: zone.ChainId, EpochNumber: 1, @@ -476,14 +475,14 @@ func (suite *KeeperTestSuite) TestHandleQueuedUnbondings() { for idx, record := range records { // check record with old status is opposite to expectedTransition (if false, this record should exist in status 3) - _, found := quicksilver.InterchainstakingKeeper.GetWithdrawalRecord(ctx, zone.ChainId, record.Txhash, icstypes.WithdrawStatusQueued) + _, found := quicksilver.InterchainstakingKeeper.GetWithdrawalRecord(ctx, zone.ChainId, record.Txhash, types.WithdrawStatusQueued) suite.Equal(!test.expectTransition[idx], found) // check record with new status is as per expectedTransition (if false, this record should not exist in status 4) - _, found = quicksilver.InterchainstakingKeeper.GetWithdrawalRecord(ctx, zone.ChainId, record.Txhash, icstypes.WithdrawStatusUnbond) + _, found = quicksilver.InterchainstakingKeeper.GetWithdrawalRecord(ctx, zone.ChainId, record.Txhash, types.WithdrawStatusUnbond) suite.Equal(test.expectTransition[idx], found) if test.expectTransition[idx] { - actualRecord, found := quicksilver.InterchainstakingKeeper.GetWithdrawalRecord(ctx, zone.ChainId, record.Txhash, icstypes.WithdrawStatusUnbond) + actualRecord, found := quicksilver.InterchainstakingKeeper.GetWithdrawalRecord(ctx, zone.ChainId, record.Txhash, types.WithdrawStatusUnbond) suite.True(found) for _, unbonding := range actualRecord.Distribution { r, found := quicksilver.InterchainstakingKeeper.GetUnbondingRecord(ctx, zone.ChainId, unbonding.Valoper, 1) @@ -499,19 +498,19 @@ func (suite *KeeperTestSuite) TestHandleQueuedUnbondings() { func (suite *KeeperTestSuite) TestHandleWithdrawForUser() { tests := []struct { name string - records func(zone *icstypes.Zone) []icstypes.WithdrawalRecord + records func(zone *types.Zone) []types.WithdrawalRecord message banktypes.MsgSend memo string err bool }{ { name: "invalid - no matching record", - records: func(zone *icstypes.Zone) []icstypes.WithdrawalRecord { - return []icstypes.WithdrawalRecord{ + records: func(zone *types.Zone) []types.WithdrawalRecord { + return []types.WithdrawalRecord{ { ChainId: zone.ChainId, Delegator: addressutils.GenerateAccAddressForTest().String(), - Distribution: []*icstypes.Distribution{ + Distribution: []*types.Distribution{ {Valoper: addressutils.GenerateValAddressForTest().String(), Amount: 1000000}, {Valoper: addressutils.GenerateValAddressForTest().String(), Amount: 1000000}, {Valoper: addressutils.GenerateValAddressForTest().String(), Amount: 1000000}, @@ -521,7 +520,7 @@ func (suite *KeeperTestSuite) TestHandleWithdrawForUser() { Amount: sdk.NewCoins(sdk.NewCoin("uatom", sdk.NewInt(4000000))), BurnAmount: sdk.NewCoin("uqatom", sdk.NewInt(4000000)), Txhash: "7C8B95EEE82CB63771E02EBEB05E6A80076D70B2E0A1C457F1FD1A0EF2EA961D", - Status: icstypes.WithdrawStatusQueued, + Status: types.WithdrawStatusQueued, }, } }, @@ -531,12 +530,12 @@ func (suite *KeeperTestSuite) TestHandleWithdrawForUser() { }, { name: "valid", - records: func(zone *icstypes.Zone) []icstypes.WithdrawalRecord { - return []icstypes.WithdrawalRecord{ + records: func(zone *types.Zone) []types.WithdrawalRecord { + return []types.WithdrawalRecord{ { ChainId: zone.ChainId, Delegator: addressutils.GenerateAccAddressForTest().String(), - Distribution: []*icstypes.Distribution{ + Distribution: []*types.Distribution{ {Valoper: addressutils.GenerateValAddressForTest().String(), Amount: 1000000}, {Valoper: addressutils.GenerateValAddressForTest().String(), Amount: 1000000}, {Valoper: addressutils.GenerateValAddressForTest().String(), Amount: 1000000}, @@ -546,7 +545,7 @@ func (suite *KeeperTestSuite) TestHandleWithdrawForUser() { Amount: sdk.NewCoins(sdk.NewCoin("uatom", sdk.NewInt(4000000))), BurnAmount: sdk.NewCoin("uqatom", sdk.NewInt(4000000)), Txhash: "7C8B95EEE82CB63771E02EBEB05E6A80076D70B2E0A1C457F1FD1A0EF2EA961D", - Status: icstypes.WithdrawStatusSend, + Status: types.WithdrawStatusSend, }, } }, @@ -558,12 +557,12 @@ func (suite *KeeperTestSuite) TestHandleWithdrawForUser() { }, { name: "valid - two", - records: func(zone *icstypes.Zone) []icstypes.WithdrawalRecord { - return []icstypes.WithdrawalRecord{ + records: func(zone *types.Zone) []types.WithdrawalRecord { + return []types.WithdrawalRecord{ { ChainId: zone.ChainId, Delegator: addressutils.GenerateAccAddressForTest().String(), - Distribution: []*icstypes.Distribution{ + Distribution: []*types.Distribution{ {Valoper: addressutils.GenerateValAddressForTest().String(), Amount: 1000000}, {Valoper: addressutils.GenerateValAddressForTest().String(), Amount: 1000000}, {Valoper: addressutils.GenerateValAddressForTest().String(), Amount: 1000000}, @@ -573,12 +572,12 @@ func (suite *KeeperTestSuite) TestHandleWithdrawForUser() { Amount: sdk.NewCoins(sdk.NewCoin("uatom", sdk.NewInt(4000000))), BurnAmount: sdk.NewCoin("uqatom", sdk.NewInt(4000000)), Txhash: "7C8B95EEE82CB63771E02EBEB05E6A80076D70B2E0A1C457F1FD1A0EF2EA961D", - Status: icstypes.WithdrawStatusSend, + Status: types.WithdrawStatusSend, }, { ChainId: zone.ChainId, Delegator: addressutils.GenerateAccAddressForTest().String(), - Distribution: []*icstypes.Distribution{ + Distribution: []*types.Distribution{ {Valoper: addressutils.GenerateValAddressForTest().String(), Amount: 5000000}, {Valoper: addressutils.GenerateValAddressForTest().String(), Amount: 1250000}, {Valoper: addressutils.GenerateValAddressForTest().String(), Amount: 5000000}, @@ -588,7 +587,7 @@ func (suite *KeeperTestSuite) TestHandleWithdrawForUser() { Amount: sdk.NewCoins(sdk.NewCoin("uatom", sdk.NewInt(15000000))), BurnAmount: sdk.NewCoin("uqatom", sdk.NewInt(15000000)), Txhash: "d786f7d4c94247625c2882e921a790790eb77a00d0534d5c3154d0a9c5ab68f5", - Status: icstypes.WithdrawStatusSend, + Status: types.WithdrawStatusSend, }, } }, @@ -619,9 +618,9 @@ func (suite *KeeperTestSuite) TestHandleWithdrawForUser() { // set up zones for _, record := range records { quicksilver.InterchainstakingKeeper.SetWithdrawalRecord(ctx, record) - err := quicksilver.BankKeeper.MintCoins(ctx, icstypes.ModuleName, sdk.NewCoins(record.BurnAmount)) + err := quicksilver.BankKeeper.MintCoins(ctx, types.ModuleName, sdk.NewCoins(record.BurnAmount)) suite.NoError(err) - err = quicksilver.BankKeeper.SendCoinsFromModuleToModule(ctx, icstypes.ModuleName, icstypes.EscrowModuleAccount, sdk.NewCoins(record.BurnAmount)) + err = quicksilver.BankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, types.EscrowModuleAccount, sdk.NewCoins(record.BurnAmount)) suite.NoError(err) } @@ -633,17 +632,17 @@ func (suite *KeeperTestSuite) TestHandleWithdrawForUser() { suite.NoError(err) } - hash, err := icstypes.ParseTxMsgMemo(test.memo, icstypes.MsgTypeUnbondSend) + hash, err := types.ParseTxMsgMemo(test.memo, types.MsgTypeUnbondSend) suite.NoError(err) - quicksilver.InterchainstakingKeeper.IterateZoneStatusWithdrawalRecords(ctx, zone.ChainId, icstypes.WithdrawStatusSend, func(idx int64, withdrawal icstypes.WithdrawalRecord) bool { + quicksilver.InterchainstakingKeeper.IterateZoneStatusWithdrawalRecords(ctx, zone.ChainId, types.WithdrawStatusSend, func(idx int64, withdrawal types.WithdrawalRecord) bool { if withdrawal.Txhash == hash { suite.Fail("unexpected withdrawal record; status should be Completed.") } return false }) - quicksilver.InterchainstakingKeeper.IterateZoneStatusWithdrawalRecords(ctx, zone.ChainId, icstypes.WithdrawStatusCompleted, func(idx int64, withdrawal icstypes.WithdrawalRecord) bool { + quicksilver.InterchainstakingKeeper.IterateZoneStatusWithdrawalRecords(ctx, zone.ChainId, types.WithdrawStatusCompleted, func(idx int64, withdrawal types.WithdrawalRecord) bool { if withdrawal.Txhash != hash { suite.Fail("unexpected withdrawal record; status should be Completed.") } @@ -658,19 +657,19 @@ func (suite *KeeperTestSuite) TestHandleWithdrawForUserLSM() { v2 := addressutils.GenerateValAddressForTest().String() tests := []struct { name string - records func(zone *icstypes.Zone) []icstypes.WithdrawalRecord + records func(zone *types.Zone) []types.WithdrawalRecord message []banktypes.MsgSend memo string err bool }{ { name: "valid", - records: func(zone *icstypes.Zone) []icstypes.WithdrawalRecord { - return []icstypes.WithdrawalRecord{ + records: func(zone *types.Zone) []types.WithdrawalRecord { + return []types.WithdrawalRecord{ { ChainId: zone.ChainId, Delegator: addressutils.GenerateAccAddressForTest().String(), - Distribution: []*icstypes.Distribution{ + Distribution: []*types.Distribution{ {Valoper: v1, Amount: 1000000}, {Valoper: v2, Amount: 1000000}, }, @@ -678,7 +677,7 @@ func (suite *KeeperTestSuite) TestHandleWithdrawForUserLSM() { Amount: sdk.NewCoins(sdk.NewCoin("uatom", sdk.NewInt(2000000))), BurnAmount: sdk.NewCoin("uqatom", sdk.NewInt(2000000)), Txhash: "7C8B95EEE82CB63771E02EBEB05E6A80076D70B2E0A1C457F1FD1A0EF2EA961D", - Status: icstypes.WithdrawStatusSend, + Status: types.WithdrawStatusSend, }, } }, @@ -691,12 +690,12 @@ func (suite *KeeperTestSuite) TestHandleWithdrawForUserLSM() { }, { name: "valid - unequal", - records: func(zone *icstypes.Zone) []icstypes.WithdrawalRecord { - return []icstypes.WithdrawalRecord{ + records: func(zone *types.Zone) []types.WithdrawalRecord { + return []types.WithdrawalRecord{ { ChainId: zone.ChainId, Delegator: addressutils.GenerateAccAddressForTest().String(), - Distribution: []*icstypes.Distribution{ + Distribution: []*types.Distribution{ {Valoper: v1, Amount: 1000000}, {Valoper: v2, Amount: 1500000}, }, @@ -704,7 +703,7 @@ func (suite *KeeperTestSuite) TestHandleWithdrawForUserLSM() { Amount: sdk.NewCoins(sdk.NewCoin("uatom", sdk.NewInt(2500000))), BurnAmount: sdk.NewCoin("uqatom", sdk.NewInt(2500000)), Txhash: "7C8B95EEE82CB63771E02EBEB05E6A80076D70B2E0A1C457F1FD1A0EF2EA961D", - Status: icstypes.WithdrawStatusSend, + Status: types.WithdrawStatusSend, }, } }, @@ -732,13 +731,13 @@ func (suite *KeeperTestSuite) TestHandleWithdrawForUserLSM() { records := test.records(&zone) - startBalance := quicksilver.BankKeeper.GetAllBalances(ctx, quicksilver.AccountKeeper.GetModuleAddress(icstypes.ModuleName)) + startBalance := quicksilver.BankKeeper.GetAllBalances(ctx, quicksilver.AccountKeeper.GetModuleAddress(types.ModuleName)) // set up zones for _, record := range records { quicksilver.InterchainstakingKeeper.SetWithdrawalRecord(ctx, record) - err := quicksilver.BankKeeper.MintCoins(ctx, icstypes.ModuleName, sdk.NewCoins(record.BurnAmount)) + err := quicksilver.BankKeeper.MintCoins(ctx, types.ModuleName, sdk.NewCoins(record.BurnAmount)) suite.NoError(err) - err = quicksilver.BankKeeper.SendCoinsFromModuleToModule(ctx, icstypes.ModuleName, icstypes.EscrowModuleAccount, sdk.NewCoins(record.BurnAmount)) + err = quicksilver.BankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, types.EscrowModuleAccount, sdk.NewCoins(record.BurnAmount)) suite.NoError(err) } @@ -752,24 +751,24 @@ func (suite *KeeperTestSuite) TestHandleWithdrawForUserLSM() { } } - hash, err := icstypes.ParseTxMsgMemo(test.memo, icstypes.MsgTypeUnbondSend) + hash, err := types.ParseTxMsgMemo(test.memo, types.MsgTypeUnbondSend) suite.NoError(err) - quicksilver.InterchainstakingKeeper.IterateZoneStatusWithdrawalRecords(ctx, zone.ChainId, icstypes.WithdrawStatusSend, func(idx int64, withdrawal icstypes.WithdrawalRecord) bool { + quicksilver.InterchainstakingKeeper.IterateZoneStatusWithdrawalRecords(ctx, zone.ChainId, types.WithdrawStatusSend, func(idx int64, withdrawal types.WithdrawalRecord) bool { if withdrawal.Txhash == hash { suite.Fail("unexpected withdrawal record; status should be Completed.") } return false }) - quicksilver.InterchainstakingKeeper.IterateZoneStatusWithdrawalRecords(ctx, zone.ChainId, icstypes.WithdrawStatusCompleted, func(idx int64, withdrawal icstypes.WithdrawalRecord) bool { + quicksilver.InterchainstakingKeeper.IterateZoneStatusWithdrawalRecords(ctx, zone.ChainId, types.WithdrawStatusCompleted, func(idx int64, withdrawal types.WithdrawalRecord) bool { if withdrawal.Txhash != hash { suite.Fail("unexpected withdrawal record; status should be Completed.") } return false }) - postBurnBalance := quicksilver.BankKeeper.GetAllBalances(ctx, quicksilver.AccountKeeper.GetModuleAddress(icstypes.ModuleName)) + postBurnBalance := quicksilver.BankKeeper.GetAllBalances(ctx, quicksilver.AccountKeeper.GetModuleAddress(types.ModuleName)) suite.Equal(startBalance, postBurnBalance) }) } @@ -780,17 +779,17 @@ func (suite *KeeperTestSuite) TestHandleWithdrawRewards() { user := addressutils.GenerateAddressForTestWithPrefix("quick") tests := []struct { name string - setup func(ctx sdk.Context, quicksilver *app.Quicksilver, zone *icstypes.Zone) - msg func(zone *icstypes.Zone) sdk.Msg - checks func(ctx sdk.Context, quicksilver *app.Quicksilver, zone *icstypes.Zone) + setup func(ctx sdk.Context, quicksilver *app.Quicksilver, zone *types.Zone) + msg func(zone *types.Zone) sdk.Msg + checks func(ctx sdk.Context, quicksilver *app.Quicksilver, zone *types.Zone) triggered bool err bool }{ { name: "wrong msg", - setup: func(ctx sdk.Context, quicksilver *app.Quicksilver, zone *icstypes.Zone) {}, - checks: func(ctx sdk.Context, quicksilver *app.Quicksilver, zone *icstypes.Zone) {}, - msg: func(zone *icstypes.Zone) sdk.Msg { + setup: func(ctx sdk.Context, quicksilver *app.Quicksilver, zone *types.Zone) {}, + checks: func(ctx sdk.Context, quicksilver *app.Quicksilver, zone *types.Zone) {}, + msg: func(zone *types.Zone) sdk.Msg { return &distrtypes.MsgWithdrawValidatorCommission{ ValidatorAddress: val, } @@ -800,12 +799,12 @@ func (suite *KeeperTestSuite) TestHandleWithdrawRewards() { }, { name: "wrong context", - setup: func(ctx sdk.Context, quicksilver *app.Quicksilver, zone *icstypes.Zone) { + setup: func(ctx sdk.Context, quicksilver *app.Quicksilver, zone *types.Zone) { zone.ConnectionId = "" quicksilver.InterchainstakingKeeper.SetZone(ctx, zone) }, - checks: func(ctx sdk.Context, quicksilver *app.Quicksilver, zone *icstypes.Zone) {}, - msg: func(zone *icstypes.Zone) sdk.Msg { + checks: func(ctx sdk.Context, quicksilver *app.Quicksilver, zone *types.Zone) {}, + msg: func(zone *types.Zone) sdk.Msg { return &distrtypes.MsgWithdrawDelegatorReward{ DelegatorAddress: user, ValidatorAddress: val, @@ -817,12 +816,12 @@ func (suite *KeeperTestSuite) TestHandleWithdrawRewards() { // try to decrement when waitgroup = 0 { name: "try to decrement when waitgroup = 0", - setup: func(ctx sdk.Context, quicksilver *app.Quicksilver, zone *icstypes.Zone) { + setup: func(ctx sdk.Context, quicksilver *app.Quicksilver, zone *types.Zone) { zone.WithdrawalWaitgroup = 0 quicksilver.InterchainstakingKeeper.SetZone(ctx, zone) }, - checks: func(ctx sdk.Context, quicksilver *app.Quicksilver, zone *icstypes.Zone) {}, - msg: func(zone *icstypes.Zone) sdk.Msg { + checks: func(ctx sdk.Context, quicksilver *app.Quicksilver, zone *types.Zone) {}, + msg: func(zone *types.Zone) sdk.Msg { return &distrtypes.MsgWithdrawDelegatorReward{ DelegatorAddress: user, ValidatorAddress: val, @@ -833,7 +832,7 @@ func (suite *KeeperTestSuite) TestHandleWithdrawRewards() { }, { name: "valid case with balances != 0", - setup: func(ctx sdk.Context, quicksilver *app.Quicksilver, zone *icstypes.Zone) { + setup: func(ctx sdk.Context, quicksilver *app.Quicksilver, zone *types.Zone) { zone.WithdrawalWaitgroup = 1 balances := sdk.NewCoins( sdk.NewCoin( @@ -844,28 +843,28 @@ func (suite *KeeperTestSuite) TestHandleWithdrawRewards() { zone.DelegationAddress.Balance = balances quicksilver.InterchainstakingKeeper.SetZone(ctx, zone) }, - checks: func(ctx sdk.Context, quicksilver *app.Quicksilver, zone *icstypes.Zone) {}, - msg: func(zone *icstypes.Zone) sdk.Msg { + checks: func(ctx sdk.Context, quicksilver *app.Quicksilver, zone *types.Zone) {}, + msg: func(zone *types.Zone) sdk.Msg { return &distrtypes.MsgWithdrawDelegatorReward{ DelegatorAddress: user, ValidatorAddress: val, } }, - triggered: false, + triggered: true, err: false, }, { name: "valid case trigger redemption rate and check if delegatorAddress == performanceAddress", - setup: func(ctx sdk.Context, quicksilver *app.Quicksilver, zone *icstypes.Zone) { + setup: func(ctx sdk.Context, quicksilver *app.Quicksilver, zone *types.Zone) { zone.WithdrawalWaitgroup = 1 quicksilver.InterchainstakingKeeper.SetZone(ctx, zone) }, - checks: func(ctx sdk.Context, quicksilver *app.Quicksilver, zone *icstypes.Zone) { + checks: func(ctx sdk.Context, quicksilver *app.Quicksilver, zone *types.Zone) { newZone, found := quicksilver.InterchainstakingKeeper.GetZone(ctx, zone.ChainId) suite.True(found) suite.Zero(newZone.WithdrawalWaitgroup) }, - msg: func(zone *icstypes.Zone) sdk.Msg { + msg: func(zone *types.Zone) sdk.Msg { return &distrtypes.MsgWithdrawDelegatorReward{ DelegatorAddress: user, ValidatorAddress: val, @@ -876,12 +875,12 @@ func (suite *KeeperTestSuite) TestHandleWithdrawRewards() { }, { name: "valid case trigger redemption rate and without checking if delegatorAddress == performanceAddress", - setup: func(ctx sdk.Context, quicksilver *app.Quicksilver, zone *icstypes.Zone) { + setup: func(ctx sdk.Context, quicksilver *app.Quicksilver, zone *types.Zone) { zone.WithdrawalWaitgroup = 0 quicksilver.InterchainstakingKeeper.SetZone(ctx, zone) }, - checks: func(ctx sdk.Context, quicksilver *app.Quicksilver, zone *icstypes.Zone) {}, - msg: func(zone *icstypes.Zone) sdk.Msg { + checks: func(ctx sdk.Context, quicksilver *app.Quicksilver, zone *types.Zone) {}, + msg: func(zone *types.Zone) sdk.Msg { return &distrtypes.MsgWithdrawDelegatorReward{ DelegatorAddress: zone.PerformanceAddress.Address, ValidatorAddress: val, @@ -944,7 +943,7 @@ func (suite *KeeperTestSuite) TestHandleFailedUnbondSend() { user := addressutils.GenerateAddressForTestWithPrefix("quick") tests := []struct { name string - record func(zone *icstypes.Zone) icstypes.WithdrawalRecord + record func(zone *types.Zone) types.WithdrawalRecord message []banktypes.MsgSend memo string err []bool @@ -959,11 +958,11 @@ func (suite *KeeperTestSuite) TestHandleFailedUnbondSend() { }, { name: "invalid - no matching record", - record: func(zone *icstypes.Zone) icstypes.WithdrawalRecord { - return icstypes.WithdrawalRecord{ + record: func(zone *types.Zone) types.WithdrawalRecord { + return types.WithdrawalRecord{ ChainId: zone.ChainId, Delegator: addressutils.GenerateAccAddressForTest().String(), - Distribution: []*icstypes.Distribution{ + Distribution: []*types.Distribution{ {Valoper: v1, Amount: 1000000}, {Valoper: v2, Amount: 1000000}, }, @@ -971,7 +970,7 @@ func (suite *KeeperTestSuite) TestHandleFailedUnbondSend() { Amount: sdk.NewCoins(sdk.NewCoin("uatom", sdk.NewInt(4000000))), BurnAmount: sdk.NewCoin("uqatom", sdk.NewInt(4000000)), Txhash: "7C8B95EEE82CB63771E02EBEB05E6A80076D70B2E0A1C457F1FD1A0EF2EA961D", - Status: icstypes.WithdrawStatusQueued, + Status: types.WithdrawStatusQueued, } }, message: []banktypes.MsgSend{}, @@ -981,11 +980,11 @@ func (suite *KeeperTestSuite) TestHandleFailedUnbondSend() { }, { name: "invalid - try msg send 2 times with one txHash", - record: func(zone *icstypes.Zone) icstypes.WithdrawalRecord { - return icstypes.WithdrawalRecord{ + record: func(zone *types.Zone) types.WithdrawalRecord { + return types.WithdrawalRecord{ ChainId: zone.ChainId, Delegator: addressutils.GenerateAccAddressForTest().String(), - Distribution: []*icstypes.Distribution{ + Distribution: []*types.Distribution{ {Valoper: v1, Amount: 1000000}, {Valoper: v2, Amount: 1000000}, }, @@ -993,7 +992,7 @@ func (suite *KeeperTestSuite) TestHandleFailedUnbondSend() { Amount: sdk.NewCoins(sdk.NewCoin("uatom", sdk.NewInt(2000000))), BurnAmount: sdk.NewCoin("uqatom", sdk.NewInt(2000000)), Txhash: "7C8B95EEE82CB63771E02EBEB05E6A80076D70B2E0A1C457F1FD1A0EF2EA961D", - Status: icstypes.WithdrawStatusSend, + Status: types.WithdrawStatusSend, } }, message: []banktypes.MsgSend{ @@ -1012,11 +1011,11 @@ func (suite *KeeperTestSuite) TestHandleFailedUnbondSend() { }, { name: "valid", - record: func(zone *icstypes.Zone) icstypes.WithdrawalRecord { - return icstypes.WithdrawalRecord{ + record: func(zone *types.Zone) types.WithdrawalRecord { + return types.WithdrawalRecord{ ChainId: zone.ChainId, Delegator: addressutils.GenerateAccAddressForTest().String(), - Distribution: []*icstypes.Distribution{ + Distribution: []*types.Distribution{ {Valoper: v1, Amount: 1000000}, {Valoper: v2, Amount: 1000000}, }, @@ -1024,7 +1023,7 @@ func (suite *KeeperTestSuite) TestHandleFailedUnbondSend() { Amount: sdk.NewCoins(sdk.NewCoin("uatom", sdk.NewInt(2000000))), BurnAmount: sdk.NewCoin("uqatom", sdk.NewInt(2000000)), Txhash: "7C8B95EEE82CB63771E02EBEB05E6A80076D70B2E0A1C457F1FD1A0EF2EA961D", - Status: icstypes.WithdrawStatusSend, + Status: types.WithdrawStatusSend, } }, message: []banktypes.MsgSend{ @@ -1052,7 +1051,7 @@ func (suite *KeeperTestSuite) TestHandleFailedUnbondSend() { suite.Fail("unable to retrieve zone for test") } - var record icstypes.WithdrawalRecord + var record types.WithdrawalRecord if test.record != nil { // set up zones record = test.record(&zone) @@ -1073,12 +1072,12 @@ func (suite *KeeperTestSuite) TestHandleFailedUnbondSend() { } if test.check { - newRecord, found := quicksilver.InterchainstakingKeeper.GetWithdrawalRecord(ctx, zone.ChainId, record.Txhash, icstypes.WithdrawStatusUnbond) + newRecord, found := quicksilver.InterchainstakingKeeper.GetWithdrawalRecord(ctx, zone.ChainId, record.Txhash, types.WithdrawStatusUnbond) if !found { suite.Fail("unable to retrieve new withdrawal record for test") } - suite.Equal(ctx.BlockTime().Add(icstypes.DefaultWithdrawalRequeueDelay), newRecord.CompletionTime) - suite.Equal(newRecord.Status, icstypes.WithdrawStatusUnbond) + suite.Equal(ctx.BlockTime().Add(types.DefaultWithdrawalRequeueDelay), newRecord.CompletionTime) + suite.Equal(newRecord.Status, types.WithdrawStatusUnbond) } }) } @@ -1097,7 +1096,7 @@ func (suite *KeeperTestSuite) TestReceiveAckErrForBeginRedelegate() { } validators := quicksilver.InterchainstakingKeeper.GetValidators(ctx, zone.ChainId) // create redelegation record - record := icstypes.RedelegationRecord{ + record := types.RedelegationRecord{ ChainId: suite.chainB.ChainID, EpochNumber: 1, Source: validators[0].ValoperAddress, @@ -1115,7 +1114,7 @@ func (suite *KeeperTestSuite) TestReceiveAckErrForBeginRedelegate() { packetData := icatypes.InterchainAccountPacketData{ Type: icatypes.EXECUTE_TX, Data: data, - Memo: icstypes.EpochRebalanceMemo(1), + Memo: types.EpochRebalanceMemo(1), } packet := channeltypes.Packet{Data: quicksilver.InterchainstakingKeeper.GetCodec().MustMarshalJSON(&packetData)} @@ -1143,21 +1142,21 @@ func (suite *KeeperTestSuite) TestReceiveAckErrForBeginUndelegate() { tests := []struct { name string epoch int64 - withdrawalRecords func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []icstypes.WithdrawalRecord - unbondingRecords func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []icstypes.UnbondingRecord - msgs func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []sdk.Msg - expectedWithdrawalRecords func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []icstypes.WithdrawalRecord + withdrawalRecords func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) []types.WithdrawalRecord + unbondingRecords func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) []types.UnbondingRecord + msgs func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) []sdk.Msg + expectedWithdrawalRecords func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) []types.WithdrawalRecord }{ { name: "1 wdr, 2 vals, 1k+1k, 1800 qasset", epoch: 1, - withdrawalRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []icstypes.WithdrawalRecord { + withdrawalRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) []types.WithdrawalRecord { vals := qs.InterchainstakingKeeper.GetValidatorAddresses(ctx, zone.ChainId) - return []icstypes.WithdrawalRecord{ + return []types.WithdrawalRecord{ { ChainId: suite.chainB.ChainID, Delegator: delegator1, - Distribution: []*icstypes.Distribution{ + Distribution: []*types.Distribution{ { Valoper: vals[0], Amount: 1000, @@ -1171,13 +1170,13 @@ func (suite *KeeperTestSuite) TestReceiveAckErrForBeginUndelegate() { Amount: sdk.NewCoins(sdk.NewCoin(zone.BaseDenom, sdk.NewInt(2000))), BurnAmount: sdk.NewCoin(zone.LocalDenom, sdk.NewInt(1800)), Txhash: hash1, - Status: icstypes.WithdrawStatusUnbond, + Status: types.WithdrawStatusUnbond, }, } }, - unbondingRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []icstypes.UnbondingRecord { + unbondingRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) []types.UnbondingRecord { vals := qs.InterchainstakingKeeper.GetValidatorAddresses(ctx, zone.ChainId) - return []icstypes.UnbondingRecord{ + return []types.UnbondingRecord{ { ChainId: suite.chainB.ChainID, EpochNumber: 1, @@ -1186,7 +1185,7 @@ func (suite *KeeperTestSuite) TestReceiveAckErrForBeginUndelegate() { }, } }, - msgs: func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []sdk.Msg { + msgs: func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) []sdk.Msg { vals := qs.InterchainstakingKeeper.GetValidatorAddresses(ctx, zone.ChainId) return []sdk.Msg{ &stakingtypes.MsgUndelegate{ @@ -1196,13 +1195,13 @@ func (suite *KeeperTestSuite) TestReceiveAckErrForBeginUndelegate() { }, } }, - expectedWithdrawalRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []icstypes.WithdrawalRecord { + expectedWithdrawalRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) []types.WithdrawalRecord { vals := qs.InterchainstakingKeeper.GetValidatorAddresses(ctx, zone.ChainId) - return []icstypes.WithdrawalRecord{ + return []types.WithdrawalRecord{ { ChainId: suite.chainB.ChainID, Delegator: delegator1, - Distribution: []*icstypes.Distribution{ + Distribution: []*types.Distribution{ { Valoper: vals[1], Amount: 1000, @@ -1212,7 +1211,7 @@ func (suite *KeeperTestSuite) TestReceiveAckErrForBeginUndelegate() { Amount: sdk.NewCoins(sdk.NewCoin(zone.BaseDenom, sdk.NewInt(1000))), BurnAmount: sdk.NewCoin(zone.LocalDenom, sdk.NewInt(900)), Txhash: hash1, - Status: icstypes.WithdrawStatusUnbond, + Status: types.WithdrawStatusUnbond, }, { ChainId: suite.chainB.ChainID, @@ -1222,7 +1221,7 @@ func (suite *KeeperTestSuite) TestReceiveAckErrForBeginUndelegate() { Amount: sdk.NewCoins(sdk.NewCoin(zone.BaseDenom, sdk.NewInt(1000))), BurnAmount: sdk.NewCoin(zone.LocalDenom, sdk.NewInt(900)), Txhash: fmt.Sprintf("%064d", 1), - Status: icstypes.WithdrawStatusQueued, + Status: types.WithdrawStatusQueued, }, } }, @@ -1230,13 +1229,13 @@ func (suite *KeeperTestSuite) TestReceiveAckErrForBeginUndelegate() { { name: "1 wdr, 1 vals, 1k, 900 qasset", epoch: 1, - withdrawalRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []icstypes.WithdrawalRecord { + withdrawalRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) []types.WithdrawalRecord { vals := qs.InterchainstakingKeeper.GetValidatorAddresses(ctx, zone.ChainId) - return []icstypes.WithdrawalRecord{ + return []types.WithdrawalRecord{ { ChainId: suite.chainB.ChainID, Delegator: delegator1, - Distribution: []*icstypes.Distribution{ + Distribution: []*types.Distribution{ { Valoper: vals[0], Amount: 1000, @@ -1246,13 +1245,13 @@ func (suite *KeeperTestSuite) TestReceiveAckErrForBeginUndelegate() { Amount: sdk.NewCoins(sdk.NewCoin(zone.BaseDenom, sdk.NewInt(1000))), BurnAmount: sdk.NewCoin(zone.LocalDenom, sdk.NewInt(900)), Txhash: hash1, - Status: icstypes.WithdrawStatusUnbond, + Status: types.WithdrawStatusUnbond, }, } }, - unbondingRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []icstypes.UnbondingRecord { + unbondingRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) []types.UnbondingRecord { vals := qs.InterchainstakingKeeper.GetValidatorAddresses(ctx, zone.ChainId) - return []icstypes.UnbondingRecord{ + return []types.UnbondingRecord{ { ChainId: suite.chainB.ChainID, EpochNumber: 1, @@ -1261,7 +1260,7 @@ func (suite *KeeperTestSuite) TestReceiveAckErrForBeginUndelegate() { }, } }, - msgs: func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []sdk.Msg { + msgs: func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) []sdk.Msg { vals := qs.InterchainstakingKeeper.GetValidatorAddresses(ctx, zone.ChainId) return []sdk.Msg{ &stakingtypes.MsgUndelegate{ @@ -1271,8 +1270,8 @@ func (suite *KeeperTestSuite) TestReceiveAckErrForBeginUndelegate() { }, } }, - expectedWithdrawalRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []icstypes.WithdrawalRecord { - return []icstypes.WithdrawalRecord{ + expectedWithdrawalRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) []types.WithdrawalRecord { + return []types.WithdrawalRecord{ { ChainId: suite.chainB.ChainID, Delegator: delegator1, @@ -1281,7 +1280,7 @@ func (suite *KeeperTestSuite) TestReceiveAckErrForBeginUndelegate() { Amount: sdk.NewCoins(sdk.NewCoin(zone.BaseDenom, sdk.NewInt(1000))), BurnAmount: sdk.NewCoin(zone.LocalDenom, sdk.NewInt(900)), Txhash: hash1, - Status: icstypes.WithdrawStatusQueued, + Status: types.WithdrawStatusQueued, }, } }, @@ -1289,13 +1288,13 @@ func (suite *KeeperTestSuite) TestReceiveAckErrForBeginUndelegate() { { name: "3 wdr, 2 vals, 1k+0.5k, 1350 qasset; 1k+2k, 2700 qasset; 600+400, 900qasset", epoch: 2, - withdrawalRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []icstypes.WithdrawalRecord { + withdrawalRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) []types.WithdrawalRecord { vals := qs.InterchainstakingKeeper.GetValidatorAddresses(ctx, zone.ChainId) - return []icstypes.WithdrawalRecord{ + return []types.WithdrawalRecord{ { ChainId: suite.chainB.ChainID, Delegator: delegator1, - Distribution: []*icstypes.Distribution{ + Distribution: []*types.Distribution{ { Valoper: vals[0], Amount: 1000, @@ -1309,12 +1308,12 @@ func (suite *KeeperTestSuite) TestReceiveAckErrForBeginUndelegate() { Amount: sdk.NewCoins(sdk.NewCoin(zone.BaseDenom, sdk.NewInt(1500))), BurnAmount: sdk.NewCoin(zone.LocalDenom, sdk.NewInt(1350)), Txhash: hash1, - Status: icstypes.WithdrawStatusUnbond, + Status: types.WithdrawStatusUnbond, }, { ChainId: suite.chainB.ChainID, Delegator: delegator2, - Distribution: []*icstypes.Distribution{ + Distribution: []*types.Distribution{ { Valoper: vals[0], Amount: 1000, @@ -1328,12 +1327,12 @@ func (suite *KeeperTestSuite) TestReceiveAckErrForBeginUndelegate() { Amount: sdk.NewCoins(sdk.NewCoin(zone.BaseDenom, sdk.NewInt(3000))), BurnAmount: sdk.NewCoin(zone.LocalDenom, sdk.NewInt(2700)), Txhash: hash2, - Status: icstypes.WithdrawStatusUnbond, + Status: types.WithdrawStatusUnbond, }, { ChainId: suite.chainB.ChainID, Delegator: delegator1, - Distribution: []*icstypes.Distribution{ + Distribution: []*types.Distribution{ { Valoper: vals[0], Amount: 600, @@ -1347,13 +1346,13 @@ func (suite *KeeperTestSuite) TestReceiveAckErrForBeginUndelegate() { Amount: sdk.NewCoins(sdk.NewCoin(zone.BaseDenom, sdk.NewInt(1000))), BurnAmount: sdk.NewCoin(zone.LocalDenom, sdk.NewInt(900)), Txhash: hash3, - Status: icstypes.WithdrawStatusUnbond, + Status: types.WithdrawStatusUnbond, }, } }, - unbondingRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []icstypes.UnbondingRecord { + unbondingRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) []types.UnbondingRecord { vals := qs.InterchainstakingKeeper.GetValidatorAddresses(ctx, zone.ChainId) - return []icstypes.UnbondingRecord{ + return []types.UnbondingRecord{ { ChainId: suite.chainB.ChainID, EpochNumber: 2, @@ -1362,7 +1361,7 @@ func (suite *KeeperTestSuite) TestReceiveAckErrForBeginUndelegate() { }, } }, - msgs: func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []sdk.Msg { + msgs: func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) []sdk.Msg { vals := qs.InterchainstakingKeeper.GetValidatorAddresses(ctx, zone.ChainId) return []sdk.Msg{ &stakingtypes.MsgUndelegate{ @@ -1372,13 +1371,13 @@ func (suite *KeeperTestSuite) TestReceiveAckErrForBeginUndelegate() { }, } }, - expectedWithdrawalRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []icstypes.WithdrawalRecord { + expectedWithdrawalRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) []types.WithdrawalRecord { vals := qs.InterchainstakingKeeper.GetValidatorAddresses(ctx, zone.ChainId) - return []icstypes.WithdrawalRecord{ + return []types.WithdrawalRecord{ { ChainId: suite.chainB.ChainID, Delegator: delegator1, - Distribution: []*icstypes.Distribution{ + Distribution: []*types.Distribution{ { Valoper: vals[0], Amount: 1000, @@ -1388,12 +1387,12 @@ func (suite *KeeperTestSuite) TestReceiveAckErrForBeginUndelegate() { Amount: sdk.NewCoins(sdk.NewCoin(zone.BaseDenom, sdk.NewInt(1000))), BurnAmount: sdk.NewCoin(zone.LocalDenom, sdk.NewInt(900)), Txhash: hash1, - Status: icstypes.WithdrawStatusUnbond, + Status: types.WithdrawStatusUnbond, }, { ChainId: suite.chainB.ChainID, Delegator: delegator2, - Distribution: []*icstypes.Distribution{ + Distribution: []*types.Distribution{ { Valoper: vals[0], Amount: 1000, @@ -1403,12 +1402,12 @@ func (suite *KeeperTestSuite) TestReceiveAckErrForBeginUndelegate() { Amount: sdk.NewCoins(sdk.NewCoin(zone.BaseDenom, sdk.NewInt(1000))), BurnAmount: sdk.NewCoin(zone.LocalDenom, sdk.NewInt(900)), Txhash: hash2, - Status: icstypes.WithdrawStatusUnbond, + Status: types.WithdrawStatusUnbond, }, { ChainId: suite.chainB.ChainID, Delegator: delegator1, - Distribution: []*icstypes.Distribution{ + Distribution: []*types.Distribution{ { Valoper: vals[0], Amount: 600, @@ -1418,7 +1417,7 @@ func (suite *KeeperTestSuite) TestReceiveAckErrForBeginUndelegate() { Amount: sdk.NewCoins(sdk.NewCoin(zone.BaseDenom, sdk.NewInt(600))), BurnAmount: sdk.NewCoin(zone.LocalDenom, sdk.NewInt(540)), Txhash: hash3, - Status: icstypes.WithdrawStatusUnbond, + Status: types.WithdrawStatusUnbond, }, { ChainId: suite.chainB.ChainID, @@ -1428,7 +1427,7 @@ func (suite *KeeperTestSuite) TestReceiveAckErrForBeginUndelegate() { Amount: sdk.NewCoins(sdk.NewCoin(zone.BaseDenom, sdk.NewInt(500))), BurnAmount: sdk.NewCoin(zone.LocalDenom, sdk.NewInt(450)), Txhash: fmt.Sprintf("%064d", 1), - Status: icstypes.WithdrawStatusQueued, + Status: types.WithdrawStatusQueued, }, { ChainId: suite.chainB.ChainID, @@ -1438,7 +1437,7 @@ func (suite *KeeperTestSuite) TestReceiveAckErrForBeginUndelegate() { Amount: sdk.NewCoins(sdk.NewCoin(zone.BaseDenom, sdk.NewInt(2000))), BurnAmount: sdk.NewCoin(zone.LocalDenom, sdk.NewInt(1800)), Txhash: fmt.Sprintf("%064d", 2), - Status: icstypes.WithdrawStatusQueued, + Status: types.WithdrawStatusQueued, }, { ChainId: suite.chainB.ChainID, @@ -1448,7 +1447,7 @@ func (suite *KeeperTestSuite) TestReceiveAckErrForBeginUndelegate() { Amount: sdk.NewCoins(sdk.NewCoin(zone.BaseDenom, sdk.NewInt(400))), BurnAmount: sdk.NewCoin(zone.LocalDenom, sdk.NewInt(360)), Txhash: fmt.Sprintf("%064d", 3), - Status: icstypes.WithdrawStatusQueued, + Status: types.WithdrawStatusQueued, }, } }, @@ -1483,7 +1482,7 @@ func (suite *KeeperTestSuite) TestReceiveAckErrForBeginUndelegate() { packetData := icatypes.InterchainAccountPacketData{ Type: icatypes.EXECUTE_TX, Data: data, - Memo: icstypes.EpochWithdrawalMemo(test.epoch), + Memo: types.EpochWithdrawalMemo(test.epoch), } packet := channeltypes.Packet{Data: quicksilver.InterchainstakingKeeper.GetCodec().MustMarshalJSON(&packetData)} @@ -1536,25 +1535,25 @@ func (suite *KeeperTestSuite) TestRebalanceDueToIntentChange() { quicksilver.InterchainstakingKeeper.DeleteValidator(ctx, zone.ChainId, valoper) } - val0 := icstypes.Validator{ValoperAddress: "cosmosvaloper1sjllsnramtg3ewxqwwrwjxfgc4n4ef9u2lcnj0", CommissionRate: sdk.MustNewDecFromStr("1"), VotingPower: sdk.NewInt(2000), Status: stakingtypes.BondStatusBonded} + val0 := types.Validator{ValoperAddress: "cosmosvaloper1sjllsnramtg3ewxqwwrwjxfgc4n4ef9u2lcnj0", CommissionRate: sdk.MustNewDecFromStr("1"), VotingPower: sdk.NewInt(2000), Status: stakingtypes.BondStatusBonded} err := quicksilver.InterchainstakingKeeper.SetValidator(ctx, zone.ChainId, val0) suite.NoError(err) - val1 := icstypes.Validator{ValoperAddress: "cosmosvaloper156gqf9837u7d4c4678yt3rl4ls9c5vuursrrzf", CommissionRate: sdk.MustNewDecFromStr("1"), VotingPower: sdk.NewInt(2000), Status: stakingtypes.BondStatusBonded} + val1 := types.Validator{ValoperAddress: "cosmosvaloper156gqf9837u7d4c4678yt3rl4ls9c5vuursrrzf", CommissionRate: sdk.MustNewDecFromStr("1"), VotingPower: sdk.NewInt(2000), Status: stakingtypes.BondStatusBonded} err = quicksilver.InterchainstakingKeeper.SetValidator(ctx, zone.ChainId, val1) suite.NoError(err) - val2 := icstypes.Validator{ValoperAddress: "cosmosvaloper14lultfckehtszvzw4ehu0apvsr77afvyju5zzy", CommissionRate: sdk.MustNewDecFromStr("1"), VotingPower: sdk.NewInt(2000), Status: stakingtypes.BondStatusBonded} + val2 := types.Validator{ValoperAddress: "cosmosvaloper14lultfckehtszvzw4ehu0apvsr77afvyju5zzy", CommissionRate: sdk.MustNewDecFromStr("1"), VotingPower: sdk.NewInt(2000), Status: stakingtypes.BondStatusBonded} err = quicksilver.InterchainstakingKeeper.SetValidator(ctx, zone.ChainId, val2) suite.NoError(err) - val3 := icstypes.Validator{ValoperAddress: "cosmosvaloper1z8zjv3lntpwxua0rtpvgrcwl0nm0tltgpgs6l7", CommissionRate: sdk.MustNewDecFromStr("1"), VotingPower: sdk.NewInt(2000), Status: stakingtypes.BondStatusBonded} + val3 := types.Validator{ValoperAddress: "cosmosvaloper1z8zjv3lntpwxua0rtpvgrcwl0nm0tltgpgs6l7", CommissionRate: sdk.MustNewDecFromStr("1"), VotingPower: sdk.NewInt(2000), Status: stakingtypes.BondStatusBonded} err = quicksilver.InterchainstakingKeeper.SetValidator(ctx, zone.ChainId, val3) suite.NoError(err) vals = quicksilver.InterchainstakingKeeper.GetValidators(ctx, zone.ChainId) - delegations := []icstypes.Delegation{ + delegations := []types.Delegation{ { DelegationAddress: zone.DelegationAddress.Address, ValidatorAddress: vals[0].ValoperAddress, @@ -1596,7 +1595,7 @@ func (suite *KeeperTestSuite) TestRebalanceDueToIntentChange() { suite.NoError(err) // change intents to trigger redelegations from val[3] - intents := icstypes.ValidatorIntents{ + intents := types.ValidatorIntents{ {ValoperAddress: vals[0].ValoperAddress, Weight: sdk.NewDecWithPrec(3, 1)}, {ValoperAddress: vals[1].ValoperAddress, Weight: sdk.NewDecWithPrec(3, 1)}, {ValoperAddress: vals[2].ValoperAddress, Weight: sdk.NewDecWithPrec(3, 1)}, @@ -1609,7 +1608,7 @@ func (suite *KeeperTestSuite) TestRebalanceDueToIntentChange() { suite.NoError(err) // mock ack for redelegations - quicksilver.InterchainstakingKeeper.IteratePrefixedRedelegationRecords(ctx, []byte(zone.ChainId), func(idx int64, _ []byte, record icstypes.RedelegationRecord) (stop bool) { + quicksilver.InterchainstakingKeeper.IteratePrefixedRedelegationRecords(ctx, []byte(zone.ChainId), func(idx int64, _ []byte, record types.RedelegationRecord) (stop bool) { if record.EpochNumber == 2 { msg := stakingtypes.MsgBeginRedelegate{ DelegatorAddress: zone.DelegationAddress.Address, @@ -1617,7 +1616,7 @@ func (suite *KeeperTestSuite) TestRebalanceDueToIntentChange() { ValidatorDstAddress: record.Destination, Amount: sdk.NewCoin("uatom", math.NewInt(record.Amount)), } - err := quicksilver.InterchainstakingKeeper.HandleBeginRedelegate(ctx, &msg, time.Now().Add(time.Hour*24*7), icstypes.EpochRebalanceMemo(2)) + err := quicksilver.InterchainstakingKeeper.HandleBeginRedelegate(ctx, &msg, time.Now().Add(time.Hour*24*7), types.EpochRebalanceMemo(2)) if err != nil { return false } @@ -1635,7 +1634,7 @@ func (suite *KeeperTestSuite) TestRebalanceDueToIntentChange() { // change intents to trigger transitive redelegations which should fail rebalance zone, _ = quicksilver.InterchainstakingKeeper.GetZone(ctx, suite.chainB.ChainID) - intents = icstypes.ValidatorIntents{ + intents = types.ValidatorIntents{ {ValoperAddress: vals[0].ValoperAddress, Weight: sdk.NewDecWithPrec(1, 1)}, {ValoperAddress: vals[1].ValoperAddress, Weight: sdk.NewDecWithPrec(3, 1)}, {ValoperAddress: vals[2].ValoperAddress, Weight: sdk.NewDecWithPrec(3, 1)}, @@ -1673,23 +1672,23 @@ func (suite *KeeperTestSuite) TestRebalanceDueToDelegationChange() { quicksilver.InterchainstakingKeeper.DeleteValidator(ctx, zone.ChainId, valoper) } - val0 := icstypes.Validator{ValoperAddress: "cosmosvaloper1sjllsnramtg3ewxqwwrwjxfgc4n4ef9u2lcnj0", CommissionRate: sdk.MustNewDecFromStr("1"), VotingPower: sdk.NewInt(2000), Status: stakingtypes.BondStatusBonded} + val0 := types.Validator{ValoperAddress: "cosmosvaloper1sjllsnramtg3ewxqwwrwjxfgc4n4ef9u2lcnj0", CommissionRate: sdk.MustNewDecFromStr("1"), VotingPower: sdk.NewInt(2000), Status: stakingtypes.BondStatusBonded} err := quicksilver.InterchainstakingKeeper.SetValidator(ctx, zone.ChainId, val0) suite.NoError(err) - val1 := icstypes.Validator{ValoperAddress: "cosmosvaloper156gqf9837u7d4c4678yt3rl4ls9c5vuursrrzf", CommissionRate: sdk.MustNewDecFromStr("1"), VotingPower: sdk.NewInt(2000), Status: stakingtypes.BondStatusBonded} + val1 := types.Validator{ValoperAddress: "cosmosvaloper156gqf9837u7d4c4678yt3rl4ls9c5vuursrrzf", CommissionRate: sdk.MustNewDecFromStr("1"), VotingPower: sdk.NewInt(2000), Status: stakingtypes.BondStatusBonded} err = quicksilver.InterchainstakingKeeper.SetValidator(ctx, zone.ChainId, val1) suite.NoError(err) - val2 := icstypes.Validator{ValoperAddress: "cosmosvaloper14lultfckehtszvzw4ehu0apvsr77afvyju5zzy", CommissionRate: sdk.MustNewDecFromStr("1"), VotingPower: sdk.NewInt(2000), Status: stakingtypes.BondStatusBonded} + val2 := types.Validator{ValoperAddress: "cosmosvaloper14lultfckehtszvzw4ehu0apvsr77afvyju5zzy", CommissionRate: sdk.MustNewDecFromStr("1"), VotingPower: sdk.NewInt(2000), Status: stakingtypes.BondStatusBonded} err = quicksilver.InterchainstakingKeeper.SetValidator(ctx, zone.ChainId, val2) suite.NoError(err) - val3 := icstypes.Validator{ValoperAddress: "cosmosvaloper1z8zjv3lntpwxua0rtpvgrcwl0nm0tltgpgs6l7", CommissionRate: sdk.MustNewDecFromStr("1"), VotingPower: sdk.NewInt(2000), Status: stakingtypes.BondStatusBonded} + val3 := types.Validator{ValoperAddress: "cosmosvaloper1z8zjv3lntpwxua0rtpvgrcwl0nm0tltgpgs6l7", CommissionRate: sdk.MustNewDecFromStr("1"), VotingPower: sdk.NewInt(2000), Status: stakingtypes.BondStatusBonded} err = quicksilver.InterchainstakingKeeper.SetValidator(ctx, zone.ChainId, val3) suite.NoError(err) - delegations := []icstypes.Delegation{ + delegations := []types.Delegation{ { DelegationAddress: zone.DelegationAddress.Address, ValidatorAddress: val0.ValoperAddress, @@ -1732,7 +1731,7 @@ func (suite *KeeperTestSuite) TestRebalanceDueToDelegationChange() { err = quicksilver.InterchainstakingKeeper.Rebalance(ctx, &zone, 1) suite.NoError(err) - quicksilver.InterchainstakingKeeper.IterateAllDelegations(ctx, zone.ChainId, func(delegation icstypes.Delegation) bool { + quicksilver.InterchainstakingKeeper.IterateAllDelegations(ctx, zone.ChainId, func(delegation types.Delegation) bool { if delegation.ValidatorAddress == val0.ValoperAddress { delegation.Amount = delegation.Amount.Add(sdk.NewInt64Coin("uatom", 4000)) quicksilver.InterchainstakingKeeper.SetDelegation(ctx, zone.ChainId, delegation) @@ -1745,7 +1744,7 @@ func (suite *KeeperTestSuite) TestRebalanceDueToDelegationChange() { suite.NoError(err) // mock ack for redelegations - quicksilver.InterchainstakingKeeper.IteratePrefixedRedelegationRecords(ctx, []byte(zone.ChainId), func(idx int64, _ []byte, record icstypes.RedelegationRecord) (stop bool) { + quicksilver.InterchainstakingKeeper.IteratePrefixedRedelegationRecords(ctx, []byte(zone.ChainId), func(idx int64, _ []byte, record types.RedelegationRecord) (stop bool) { if record.EpochNumber == 2 { msg := stakingtypes.MsgBeginRedelegate{ DelegatorAddress: zone.DelegationAddress.Address, @@ -1753,7 +1752,7 @@ func (suite *KeeperTestSuite) TestRebalanceDueToDelegationChange() { ValidatorDstAddress: record.Destination, Amount: sdk.NewCoin("uatom", math.NewInt(record.Amount)), } - err := quicksilver.InterchainstakingKeeper.HandleBeginRedelegate(ctx, &msg, time.Now().Add(time.Hour*24*7), icstypes.EpochRebalanceMemo(2)) + err := quicksilver.InterchainstakingKeeper.HandleBeginRedelegate(ctx, &msg, time.Now().Add(time.Hour*24*7), types.EpochRebalanceMemo(2)) if err != nil { return false } @@ -1768,7 +1767,7 @@ func (suite *KeeperTestSuite) TestRebalanceDueToDelegationChange() { suite.False(present) // change validator delegation to trigger transitive redelegations which should fail rebalance - quicksilver.InterchainstakingKeeper.IterateAllDelegations(ctx, zone.ChainId, func(delegation icstypes.Delegation) bool { + quicksilver.InterchainstakingKeeper.IterateAllDelegations(ctx, zone.ChainId, func(delegation types.Delegation) bool { if delegation.ValidatorAddress == val0.ValoperAddress { delegation.Amount = delegation.Amount.Sub(sdk.NewInt64Coin("uatom", 4000)) quicksilver.InterchainstakingKeeper.SetDelegation(ctx, zone.ChainId, delegation) @@ -1812,7 +1811,7 @@ func (suite *KeeperTestSuite) Test_v045Callback() { quicksilver.InterchainstakingKeeper.IBCKeeper.ChannelKeeper.SetChannel(ctx, "transfer", "channel-0", TestChannel) ibcDenom := utils.DeriveIbcDenom("transfer", "channel-0", zone.BaseDenom) - err := quicksilver.BankKeeper.MintCoins(ctx, icstypes.ModuleName, sdk.NewCoins(sdk.NewCoin(ibcDenom, sdk.NewInt(100)))) + err := quicksilver.BankKeeper.MintCoins(ctx, types.ModuleName, sdk.NewCoins(sdk.NewCoin(ibcDenom, sdk.NewInt(100)))) suite.NoError(err) transferMsg := ibctransfertypes.MsgTransfer{ @@ -1820,7 +1819,7 @@ func (suite *KeeperTestSuite) Test_v045Callback() { SourceChannel: "channel-0", Token: sdk.NewCoin(zone.BaseDenom, sdk.NewInt(100)), Sender: sender, - Receiver: quicksilver.AccountKeeper.GetModuleAddress(icstypes.ModuleName).String(), + Receiver: quicksilver.AccountKeeper.GetModuleAddress(types.ModuleName).String(), } response := ibctransfertypes.MsgTransferResponse{ Sequence: 1, @@ -1835,7 +1834,7 @@ func (suite *KeeperTestSuite) Test_v045Callback() { suite.Fail("unable to retrieve zone for test") } - txMacc := quicksilver.AccountKeeper.GetModuleAddress(icstypes.ModuleName) + txMacc := quicksilver.AccountKeeper.GetModuleAddress(types.ModuleName) feeMacc := quicksilver.AccountKeeper.GetModuleAddress(authtypes.FeeCollectorName) txMaccBalance2 := quicksilver.BankKeeper.GetAllBalances(ctx, txMacc) feeMaccBalance2 := quicksilver.BankKeeper.GetAllBalances(ctx, feeMacc) @@ -1942,7 +1941,7 @@ func (suite *KeeperTestSuite) Test_v046Callback() { quicksilver.InterchainstakingKeeper.IBCKeeper.ChannelKeeper.SetChannel(ctx, "transfer", "channel-0", TestChannel) ibcDenom := utils.DeriveIbcDenom("transfer", "channel-0", zone.BaseDenom) - err := quicksilver.BankKeeper.MintCoins(ctx, icstypes.ModuleName, sdk.NewCoins(sdk.NewCoin(ibcDenom, sdk.NewInt(100)))) + err := quicksilver.BankKeeper.MintCoins(ctx, types.ModuleName, sdk.NewCoins(sdk.NewCoin(ibcDenom, sdk.NewInt(100)))) suite.NoError(err) transferMsg := ibctransfertypes.MsgTransfer{ @@ -1950,7 +1949,7 @@ func (suite *KeeperTestSuite) Test_v046Callback() { SourceChannel: "channel-0", Token: sdk.NewCoin(zone.BaseDenom, sdk.NewInt(100)), Sender: sender, - Receiver: quicksilver.AccountKeeper.GetModuleAddress(icstypes.ModuleName).String(), + Receiver: quicksilver.AccountKeeper.GetModuleAddress(types.ModuleName).String(), } response := ibctransfertypes.MsgTransferResponse{ Sequence: 1, @@ -1966,7 +1965,7 @@ func (suite *KeeperTestSuite) Test_v046Callback() { suite.Fail("unable to retrieve zone for test") } - txMacc := quicksilver.AccountKeeper.GetModuleAddress(icstypes.ModuleName) + txMacc := quicksilver.AccountKeeper.GetModuleAddress(types.ModuleName) feeMacc := quicksilver.AccountKeeper.GetModuleAddress(authtypes.FeeCollectorName) txMaccBalance2 := quicksilver.BankKeeper.GetAllBalances(ctx, txMacc) feeMaccBalance2 := quicksilver.BankKeeper.GetAllBalances(ctx, feeMacc) @@ -2067,22 +2066,22 @@ func (suite *KeeperTestSuite) TestReceiveAckForBeginUndelegate() { tests := []struct { name string epoch int64 - withdrawalRecords func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []icstypes.WithdrawalRecord - unbondingRecords func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []icstypes.UnbondingRecord - msgs func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []sdk.Msg + withdrawalRecords func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) []types.WithdrawalRecord + unbondingRecords func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) []types.UnbondingRecord + msgs func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) []sdk.Msg completionTime time.Time - expectedWithdrawalRecords func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []icstypes.WithdrawalRecord + expectedWithdrawalRecords func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) []types.WithdrawalRecord }{ { name: "1 wdr, 2 vals, 1k+1k, 1800 qasset", epoch: 1, - withdrawalRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []icstypes.WithdrawalRecord { + withdrawalRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) []types.WithdrawalRecord { vals := qs.InterchainstakingKeeper.GetValidatorAddresses(ctx, zone.ChainId) - return []icstypes.WithdrawalRecord{ + return []types.WithdrawalRecord{ { ChainId: suite.chainB.ChainID, Delegator: delegator1, - Distribution: []*icstypes.Distribution{ + Distribution: []*types.Distribution{ { Valoper: vals[0], Amount: 1000, @@ -2096,13 +2095,13 @@ func (suite *KeeperTestSuite) TestReceiveAckForBeginUndelegate() { Amount: sdk.NewCoins(sdk.NewCoin(zone.BaseDenom, sdk.NewInt(2000))), BurnAmount: sdk.NewCoin(zone.LocalDenom, sdk.NewInt(1800)), Txhash: hash1, - Status: icstypes.WithdrawStatusUnbond, + Status: types.WithdrawStatusUnbond, }, } }, - unbondingRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []icstypes.UnbondingRecord { + unbondingRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) []types.UnbondingRecord { vals := qs.InterchainstakingKeeper.GetValidatorAddresses(ctx, zone.ChainId) - return []icstypes.UnbondingRecord{ + return []types.UnbondingRecord{ { ChainId: suite.chainB.ChainID, EpochNumber: 1, @@ -2111,7 +2110,7 @@ func (suite *KeeperTestSuite) TestReceiveAckForBeginUndelegate() { }, } }, - msgs: func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []sdk.Msg { + msgs: func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) []sdk.Msg { vals := qs.InterchainstakingKeeper.GetValidatorAddresses(ctx, zone.ChainId) return []sdk.Msg{ &stakingtypes.MsgUndelegate{ @@ -2122,13 +2121,13 @@ func (suite *KeeperTestSuite) TestReceiveAckForBeginUndelegate() { } }, completionTime: oneMonth, - expectedWithdrawalRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []icstypes.WithdrawalRecord { + expectedWithdrawalRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) []types.WithdrawalRecord { vals := qs.InterchainstakingKeeper.GetValidatorAddresses(ctx, zone.ChainId) - return []icstypes.WithdrawalRecord{ + return []types.WithdrawalRecord{ { ChainId: suite.chainB.ChainID, Delegator: delegator1, - Distribution: []*icstypes.Distribution{ + Distribution: []*types.Distribution{ { Valoper: vals[0], Amount: 1000, @@ -2142,7 +2141,7 @@ func (suite *KeeperTestSuite) TestReceiveAckForBeginUndelegate() { Amount: sdk.NewCoins(sdk.NewCoin(zone.BaseDenom, sdk.NewInt(2000))), BurnAmount: sdk.NewCoin(zone.LocalDenom, sdk.NewInt(1800)), Txhash: hash1, - Status: icstypes.WithdrawStatusUnbond, + Status: types.WithdrawStatusUnbond, CompletionTime: oneMonth, }, } @@ -2151,13 +2150,13 @@ func (suite *KeeperTestSuite) TestReceiveAckForBeginUndelegate() { { name: "1 wdr, 1 vals, 1k, 900 qasset", epoch: 1, - withdrawalRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []icstypes.WithdrawalRecord { + withdrawalRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) []types.WithdrawalRecord { vals := qs.InterchainstakingKeeper.GetValidatorAddresses(ctx, zone.ChainId) - return []icstypes.WithdrawalRecord{ + return []types.WithdrawalRecord{ { ChainId: suite.chainB.ChainID, Delegator: delegator1, - Distribution: []*icstypes.Distribution{ + Distribution: []*types.Distribution{ { Valoper: vals[0], Amount: 1000, @@ -2167,13 +2166,13 @@ func (suite *KeeperTestSuite) TestReceiveAckForBeginUndelegate() { Amount: sdk.NewCoins(sdk.NewCoin(zone.BaseDenom, sdk.NewInt(1000))), BurnAmount: sdk.NewCoin(zone.LocalDenom, sdk.NewInt(900)), Txhash: hash1, - Status: icstypes.WithdrawStatusUnbond, + Status: types.WithdrawStatusUnbond, }, } }, - unbondingRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []icstypes.UnbondingRecord { + unbondingRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) []types.UnbondingRecord { vals := qs.InterchainstakingKeeper.GetValidatorAddresses(ctx, zone.ChainId) - return []icstypes.UnbondingRecord{ + return []types.UnbondingRecord{ { ChainId: suite.chainB.ChainID, EpochNumber: 1, @@ -2182,7 +2181,7 @@ func (suite *KeeperTestSuite) TestReceiveAckForBeginUndelegate() { }, } }, - msgs: func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []sdk.Msg { + msgs: func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) []sdk.Msg { vals := qs.InterchainstakingKeeper.GetValidatorAddresses(ctx, zone.ChainId) return []sdk.Msg{ &stakingtypes.MsgUndelegate{ @@ -2193,13 +2192,13 @@ func (suite *KeeperTestSuite) TestReceiveAckForBeginUndelegate() { } }, completionTime: oneMonth, - expectedWithdrawalRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []icstypes.WithdrawalRecord { + expectedWithdrawalRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) []types.WithdrawalRecord { vals := qs.InterchainstakingKeeper.GetValidatorAddresses(ctx, zone.ChainId) - return []icstypes.WithdrawalRecord{ + return []types.WithdrawalRecord{ { ChainId: suite.chainB.ChainID, Delegator: delegator1, - Distribution: []*icstypes.Distribution{ + Distribution: []*types.Distribution{ { Valoper: vals[0], Amount: 1000, @@ -2209,7 +2208,7 @@ func (suite *KeeperTestSuite) TestReceiveAckForBeginUndelegate() { Amount: sdk.NewCoins(sdk.NewCoin(zone.BaseDenom, sdk.NewInt(1000))), BurnAmount: sdk.NewCoin(zone.LocalDenom, sdk.NewInt(900)), Txhash: hash1, - Status: icstypes.WithdrawStatusUnbond, + Status: types.WithdrawStatusUnbond, CompletionTime: oneMonth, }, } @@ -2218,13 +2217,13 @@ func (suite *KeeperTestSuite) TestReceiveAckForBeginUndelegate() { { name: "3 wdr, 2 vals, 1k+0.5k, 1350 qasset; 1k+2k, 2700 qasset; 600+400, 900qasset", epoch: 2, - withdrawalRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []icstypes.WithdrawalRecord { + withdrawalRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) []types.WithdrawalRecord { vals := qs.InterchainstakingKeeper.GetValidatorAddresses(ctx, zone.ChainId) - return []icstypes.WithdrawalRecord{ + return []types.WithdrawalRecord{ { ChainId: suite.chainB.ChainID, Delegator: delegator1, - Distribution: []*icstypes.Distribution{ + Distribution: []*types.Distribution{ { Valoper: vals[0], Amount: 1000, @@ -2238,12 +2237,12 @@ func (suite *KeeperTestSuite) TestReceiveAckForBeginUndelegate() { Amount: sdk.NewCoins(sdk.NewCoin(zone.BaseDenom, sdk.NewInt(1500))), BurnAmount: sdk.NewCoin(zone.LocalDenom, sdk.NewInt(1350)), Txhash: hash1, - Status: icstypes.WithdrawStatusUnbond, + Status: types.WithdrawStatusUnbond, }, { ChainId: suite.chainB.ChainID, Delegator: delegator2, - Distribution: []*icstypes.Distribution{ + Distribution: []*types.Distribution{ { Valoper: vals[0], Amount: 1000, @@ -2257,12 +2256,12 @@ func (suite *KeeperTestSuite) TestReceiveAckForBeginUndelegate() { Amount: sdk.NewCoins(sdk.NewCoin(zone.BaseDenom, sdk.NewInt(3000))), BurnAmount: sdk.NewCoin(zone.LocalDenom, sdk.NewInt(2700)), Txhash: hash2, - Status: icstypes.WithdrawStatusUnbond, + Status: types.WithdrawStatusUnbond, }, { ChainId: suite.chainB.ChainID, Delegator: delegator1, - Distribution: []*icstypes.Distribution{ + Distribution: []*types.Distribution{ { Valoper: vals[0], Amount: 600, @@ -2276,13 +2275,13 @@ func (suite *KeeperTestSuite) TestReceiveAckForBeginUndelegate() { Amount: sdk.NewCoins(sdk.NewCoin(zone.BaseDenom, sdk.NewInt(1000))), BurnAmount: sdk.NewCoin(zone.LocalDenom, sdk.NewInt(900)), Txhash: hash3, - Status: icstypes.WithdrawStatusUnbond, + Status: types.WithdrawStatusUnbond, }, } }, - unbondingRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []icstypes.UnbondingRecord { + unbondingRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) []types.UnbondingRecord { vals := qs.InterchainstakingKeeper.GetValidatorAddresses(ctx, zone.ChainId) - return []icstypes.UnbondingRecord{ + return []types.UnbondingRecord{ { ChainId: suite.chainB.ChainID, EpochNumber: 2, @@ -2291,7 +2290,7 @@ func (suite *KeeperTestSuite) TestReceiveAckForBeginUndelegate() { }, } }, - msgs: func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []sdk.Msg { + msgs: func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) []sdk.Msg { vals := qs.InterchainstakingKeeper.GetValidatorAddresses(ctx, zone.ChainId) return []sdk.Msg{ &stakingtypes.MsgUndelegate{ @@ -2302,13 +2301,13 @@ func (suite *KeeperTestSuite) TestReceiveAckForBeginUndelegate() { } }, completionTime: nilTime, - expectedWithdrawalRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []icstypes.WithdrawalRecord { + expectedWithdrawalRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) []types.WithdrawalRecord { vals := qs.InterchainstakingKeeper.GetValidatorAddresses(ctx, zone.ChainId) - return []icstypes.WithdrawalRecord{ + return []types.WithdrawalRecord{ { ChainId: suite.chainB.ChainID, Delegator: delegator1, - Distribution: []*icstypes.Distribution{ + Distribution: []*types.Distribution{ { Valoper: vals[0], Amount: 1000, @@ -2322,12 +2321,12 @@ func (suite *KeeperTestSuite) TestReceiveAckForBeginUndelegate() { Amount: sdk.NewCoins(sdk.NewCoin(zone.BaseDenom, sdk.NewInt(1500))), BurnAmount: sdk.NewCoin(zone.LocalDenom, sdk.NewInt(1350)), Txhash: hash1, - Status: icstypes.WithdrawStatusUnbond, + Status: types.WithdrawStatusUnbond, }, { ChainId: suite.chainB.ChainID, Delegator: delegator2, - Distribution: []*icstypes.Distribution{ + Distribution: []*types.Distribution{ { Valoper: vals[0], Amount: 1000, @@ -2341,12 +2340,12 @@ func (suite *KeeperTestSuite) TestReceiveAckForBeginUndelegate() { Amount: sdk.NewCoins(sdk.NewCoin(zone.BaseDenom, sdk.NewInt(3000))), BurnAmount: sdk.NewCoin(zone.LocalDenom, sdk.NewInt(2700)), Txhash: hash2, - Status: icstypes.WithdrawStatusUnbond, + Status: types.WithdrawStatusUnbond, }, { ChainId: suite.chainB.ChainID, Delegator: delegator1, - Distribution: []*icstypes.Distribution{ + Distribution: []*types.Distribution{ { Valoper: vals[0], Amount: 600, @@ -2360,7 +2359,7 @@ func (suite *KeeperTestSuite) TestReceiveAckForBeginUndelegate() { Amount: sdk.NewCoins(sdk.NewCoin(zone.BaseDenom, sdk.NewInt(1000))), BurnAmount: sdk.NewCoin(zone.LocalDenom, sdk.NewInt(900)), Txhash: hash3, - Status: icstypes.WithdrawStatusUnbond, + Status: types.WithdrawStatusUnbond, }, } }, @@ -2368,13 +2367,13 @@ func (suite *KeeperTestSuite) TestReceiveAckForBeginUndelegate() { { name: "2 wdr, 1 vals, 1k; 2 vals; 123 + 456 ", epoch: 1, - withdrawalRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []icstypes.WithdrawalRecord { + withdrawalRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) []types.WithdrawalRecord { vals := qs.InterchainstakingKeeper.GetValidatorAddresses(ctx, zone.ChainId) - return []icstypes.WithdrawalRecord{ + return []types.WithdrawalRecord{ { ChainId: suite.chainB.ChainID, Delegator: delegator1, - Distribution: []*icstypes.Distribution{ + Distribution: []*types.Distribution{ { Valoper: vals[0], Amount: 1000, @@ -2384,12 +2383,12 @@ func (suite *KeeperTestSuite) TestReceiveAckForBeginUndelegate() { Amount: sdk.NewCoins(sdk.NewCoin(zone.BaseDenom, sdk.NewInt(1000))), BurnAmount: sdk.NewCoin(zone.LocalDenom, sdk.NewInt(900)), Txhash: hash1, - Status: icstypes.WithdrawStatusUnbond, + Status: types.WithdrawStatusUnbond, }, { ChainId: suite.chainB.ChainID, Delegator: delegator2, - Distribution: []*icstypes.Distribution{ + Distribution: []*types.Distribution{ { Valoper: vals[1], Amount: 123, @@ -2403,13 +2402,13 @@ func (suite *KeeperTestSuite) TestReceiveAckForBeginUndelegate() { Amount: sdk.NewCoins(sdk.NewCoin(zone.BaseDenom, sdk.NewInt(579))), BurnAmount: sdk.NewCoin(zone.LocalDenom, sdk.NewInt(521)), Txhash: hash2, - Status: icstypes.WithdrawStatusUnbond, + Status: types.WithdrawStatusUnbond, }, } }, - unbondingRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []icstypes.UnbondingRecord { + unbondingRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) []types.UnbondingRecord { vals := qs.InterchainstakingKeeper.GetValidatorAddresses(ctx, zone.ChainId) - return []icstypes.UnbondingRecord{ + return []types.UnbondingRecord{ { ChainId: suite.chainB.ChainID, EpochNumber: 1, @@ -2424,7 +2423,7 @@ func (suite *KeeperTestSuite) TestReceiveAckForBeginUndelegate() { }, } }, - msgs: func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []sdk.Msg { + msgs: func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) []sdk.Msg { vals := qs.InterchainstakingKeeper.GetValidatorAddresses(ctx, zone.ChainId) return []sdk.Msg{ &stakingtypes.MsgUndelegate{ @@ -2440,8 +2439,8 @@ func (suite *KeeperTestSuite) TestReceiveAckForBeginUndelegate() { } }, completionTime: nilTime, - expectedWithdrawalRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []icstypes.WithdrawalRecord { - return []icstypes.WithdrawalRecord{} + expectedWithdrawalRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) []types.WithdrawalRecord { + return []types.WithdrawalRecord{} }, }, } @@ -2475,7 +2474,7 @@ func (suite *KeeperTestSuite) TestReceiveAckForBeginUndelegate() { packetData := icatypes.InterchainAccountPacketData{ Type: icatypes.EXECUTE_TX, Data: data, - Memo: icstypes.EpochWithdrawalMemo(test.epoch), + Memo: types.EpochWithdrawalMemo(test.epoch), } packet := channeltypes.Packet{Data: quicksilver.InterchainstakingKeeper.GetCodec().MustMarshalJSON(&packetData)} @@ -2541,7 +2540,7 @@ func (suite *KeeperTestSuite) TestReceiveAckForBeginRedelegateNonNilCompletion() } validators := quicksilver.InterchainstakingKeeper.GetValidators(ctx, zone.ChainId) // create redelegation record - record := icstypes.RedelegationRecord{ + record := types.RedelegationRecord{ ChainId: suite.chainB.ChainID, EpochNumber: 1, Source: validators[0].ValoperAddress, @@ -2551,7 +2550,7 @@ func (suite *KeeperTestSuite) TestReceiveAckForBeginRedelegateNonNilCompletion() quicksilver.InterchainstakingKeeper.SetRedelegationRecord(ctx, record) - beforeSource := icstypes.Delegation{ + beforeSource := types.Delegation{ DelegationAddress: zone.DelegationAddress.Address, ValidatorAddress: validators[0].ValoperAddress, Amount: sdk.NewCoin(zone.BaseDenom, math.NewInt(2000)), @@ -2567,7 +2566,7 @@ func (suite *KeeperTestSuite) TestReceiveAckForBeginRedelegateNonNilCompletion() packetData := icatypes.InterchainAccountPacketData{ Type: icatypes.EXECUTE_TX, Data: data, - Memo: icstypes.EpochRebalanceMemo(1), + Memo: types.EpochRebalanceMemo(1), } packet := channeltypes.Packet{Data: quicksilver.InterchainstakingKeeper.GetCodec().MustMarshalJSON(&packetData)} @@ -2628,7 +2627,7 @@ func (suite *KeeperTestSuite) TestReceiveAckForBeginRedelegateNilCompletion() { } validators := quicksilver.InterchainstakingKeeper.GetValidators(ctx, zone.ChainId) // create redelegation record - record := icstypes.RedelegationRecord{ + record := types.RedelegationRecord{ ChainId: suite.chainB.ChainID, EpochNumber: epoch, Source: validators[0].ValoperAddress, @@ -2638,13 +2637,13 @@ func (suite *KeeperTestSuite) TestReceiveAckForBeginRedelegateNilCompletion() { quicksilver.InterchainstakingKeeper.SetRedelegationRecord(ctx, record) - beforeTarget := icstypes.Delegation{ + beforeTarget := types.Delegation{ DelegationAddress: zone.DelegationAddress.Address, ValidatorAddress: validators[1].ValoperAddress, Amount: sdk.NewCoin(zone.BaseDenom, math.NewInt(2000)), } - beforeSource := icstypes.Delegation{ + beforeSource := types.Delegation{ DelegationAddress: zone.DelegationAddress.Address, ValidatorAddress: validators[0].ValoperAddress, Amount: sdk.NewCoin(zone.BaseDenom, math.NewInt(1001)), @@ -2661,7 +2660,7 @@ func (suite *KeeperTestSuite) TestReceiveAckForBeginRedelegateNilCompletion() { packetData := icatypes.InterchainAccountPacketData{ Type: icatypes.EXECUTE_TX, Data: data, - Memo: icstypes.EpochRebalanceMemo(epoch), + Memo: types.EpochRebalanceMemo(epoch), } packet := channeltypes.Packet{Data: quicksilver.InterchainstakingKeeper.GetCodec().MustMarshalJSON(&packetData)} @@ -2786,18 +2785,25 @@ func (suite *KeeperTestSuite) TestReceiveAckForRedeemTokens() { } vals := quicksilver.InterchainstakingKeeper.GetValidatorAddresses(ctx, zone.ChainId) - delegationRecord := icstypes.Delegation{ + delegationRecord := types.Delegation{ DelegationAddress: zone.DelegationAddress.Address, ValidatorAddress: vals[0], - Amount: sdk.NewCoin(vals[0]+"0x", sdk.NewInt(1000)), - Height: 1, - RedelegationEnd: 1, + Amount: sdk.NewCoin(zone.BaseDenom, sdk.NewInt(1000)), } quicksilver.InterchainstakingKeeper.SetDelegation(ctx, zone.ChainId, delegationRecord) + txHash := randomutils.GenerateRandomHashAsHex(32) + t := ctx.BlockTime().Add(-time.Minute * 5) + quicksilver.InterchainstakingKeeper.SetReceipt(ctx, types.Receipt{ + ChainId: zone.ChainId, + Sender: addressutils.GenerateAddressForTestWithPrefix(zone.AccountPrefix), + Txhash: txHash, + Amount: sdk.NewCoins(sdk.NewCoin(vals[0]+"/1", sdk.NewInt(100))), + FirstSeen: &t, + }) - redeemTokens := &lsmstakingtypes.MsgRedeemTokensforShares{ + redeemTokens := &lsmstakingtypes.MsgRedeemTokensForShares{ DelegatorAddress: zone.DelegationAddress.Address, - Amount: sdk.NewCoin(vals[0]+"0x", sdk.NewInt(100)), + Amount: sdk.NewCoin(vals[0]+"/1", sdk.NewInt(100)), } data, err := icatypes.SerializeCosmosTx(quicksilver.InterchainstakingKeeper.GetCodec(), []sdk.Msg{redeemTokens}) suite.NoError(err) @@ -2806,12 +2812,13 @@ func (suite *KeeperTestSuite) TestReceiveAckForRedeemTokens() { packetData := icatypes.InterchainAccountPacketData{ Type: icatypes.EXECUTE_TX, Data: data, + Memo: txHash, } packet := channeltypes.Packet{Data: quicksilver.InterchainstakingKeeper.GetCodec().MustMarshalJSON(&packetData)} - response := lsmstakingtypes.MsgRedeemTokensforSharesResponse{ - Amount: sdk.NewCoin(vals[0]+"0x", sdk.NewInt(100)), + response := lsmstakingtypes.MsgRedeemTokensForSharesResponse{ + Amount: sdk.NewCoin(zone.BaseDenom, sdk.NewInt(100)), } anyResponse, err := codectypes.NewAnyWithValue(&response) @@ -2833,9 +2840,7 @@ func (suite *KeeperTestSuite) TestReceiveAckForRedeemTokens() { delegationRecord, found = quicksilver.InterchainstakingKeeper.GetDelegation(ctx, zone.ChainId, zone.DelegationAddress.Address, vals[0]) suite.True(found) - suite.Equal(delegationRecord.Amount, sdk.NewCoin(vals[0]+"0x", sdk.NewInt(1100))) - suite.Equal(delegationRecord.Height, int64(1)) - suite.Equal(delegationRecord.RedelegationEnd, int64(1)) + suite.Equal(delegationRecord.Amount, sdk.NewCoin(zone.BaseDenom, sdk.NewInt(1100))) } func (suite *KeeperTestSuite) TestReceiveAckForTokenizedShares() { @@ -2854,10 +2859,10 @@ func (suite *KeeperTestSuite) TestReceiveAckForTokenizedShares() { user := addressutils.GenerateAddressForTestWithPrefix("quick") txHash := randomutils.GenerateRandomHashAsHex(32) - withdrawalRecord := icstypes.WithdrawalRecord{ + withdrawalRecord := types.WithdrawalRecord{ ChainId: suite.chainB.ChainID, Delegator: user, - Distribution: []*icstypes.Distribution{ + Distribution: []*types.Distribution{ { Valoper: vals[0], Amount: 1000, @@ -2865,20 +2870,20 @@ func (suite *KeeperTestSuite) TestReceiveAckForTokenizedShares() { }, Recipient: addressutils.GenerateAddressForTestWithPrefix(zone.GetAccountPrefix()), Amount: sdk.Coins{}, - BurnAmount: sdk.NewCoin(zone.LocalDenom, sdk.NewInt(1800)), + BurnAmount: sdk.NewCoin(zone.LocalDenom, sdk.NewInt(800)), Txhash: txHash, - Status: icstypes.WithdrawStatusTokenize, + Status: types.WithdrawStatusTokenize, CompletionTime: ctx.BlockTime().Add(-1 * time.Hour), - Acknowledged: true, + Acknowledged: false, } quicksilver.InterchainstakingKeeper.SetWithdrawalRecord(ctx, withdrawalRecord) - _, found = quicksilver.InterchainstakingKeeper.GetWithdrawalRecord(ctx, zone.ChainId, txHash, icstypes.WithdrawStatusTokenize) + _, found = quicksilver.InterchainstakingKeeper.GetWithdrawalRecord(ctx, zone.ChainId, txHash, types.WithdrawStatusTokenize) suite.True(found) tokenizeShares := &lsmstakingtypes.MsgTokenizeShares{ DelegatorAddress: zone.DelegationAddress.Address, ValidatorAddress: vals[0], - Amount: sdk.NewCoin(vals[0]+"1", sdk.NewInt(1000)), + Amount: sdk.NewCoin(zone.BaseDenom, sdk.NewInt(1000)), TokenizedShareOwner: addressutils.GenerateAddressForTestWithPrefix(zone.GetAccountPrefix()), } data, err := icatypes.SerializeCosmosTx(quicksilver.InterchainstakingKeeper.GetCodec(), []sdk.Msg{tokenizeShares}) @@ -2894,7 +2899,7 @@ func (suite *KeeperTestSuite) TestReceiveAckForTokenizedShares() { packet := channeltypes.Packet{Data: quicksilver.InterchainstakingKeeper.GetCodec().MustMarshalJSON(&packetData)} response := lsmstakingtypes.MsgTokenizeSharesResponse{ - Amount: sdk.NewCoin(vals[0]+"1", sdk.NewInt(1000)), + Amount: sdk.NewCoin(vals[0]+"/1", sdk.NewInt(1000)), } anyResponse, err := codectypes.NewAnyWithValue(&response) @@ -2912,8 +2917,13 @@ func (suite *KeeperTestSuite) TestReceiveAckForTokenizedShares() { err = quicksilver.InterchainstakingKeeper.HandleAcknowledgement(ctx, packet, ackBytes) suite.NoError(err) - _, found = quicksilver.InterchainstakingKeeper.GetWithdrawalRecord(ctx, zone.ChainId, txHash, icstypes.WithdrawStatusTokenize) + _, found = quicksilver.InterchainstakingKeeper.GetWithdrawalRecord(ctx, zone.ChainId, txHash, types.WithdrawStatusTokenize) suite.False(found) + + wr, found := quicksilver.InterchainstakingKeeper.GetWithdrawalRecord(ctx, zone.ChainId, txHash, types.WithdrawStatusSend) + suite.True(found) + + suite.Equal(wr.Amount[0], response.Amount) } func (suite *KeeperTestSuite) TestReceiveAckForDelegate() { @@ -2934,7 +2944,7 @@ func (suite *KeeperTestSuite) TestReceiveAckForDelegate() { firstSeen := ctx.BlockTime().Add(-10 * time.Hour) completed := ctx.BlockTime().Add(-1 * time.Hour) - receipt := icstypes.Receipt{ + receipt := types.Receipt{ ChainId: zone.ChainId, Sender: user, Txhash: txHash, @@ -3060,10 +3070,10 @@ func (suite *KeeperTestSuite) TestReceiveAckErrForBankSend() { v2 := addressutils.GenerateValAddressForTest().String() user := addressutils.GenerateAddressForTestWithPrefix("quick") - withdrawalRecord := icstypes.WithdrawalRecord{ + withdrawalRecord := types.WithdrawalRecord{ ChainId: zone.ChainId, Delegator: addressutils.GenerateAccAddressForTest().String(), - Distribution: []*icstypes.Distribution{ + Distribution: []*types.Distribution{ {Valoper: v1, Amount: 1000000}, {Valoper: v2, Amount: 1000000}, }, @@ -3071,7 +3081,7 @@ func (suite *KeeperTestSuite) TestReceiveAckErrForBankSend() { Amount: sdk.NewCoins(sdk.NewCoin("uatom", sdk.NewInt(2000000))), BurnAmount: sdk.NewCoin("uqatom", sdk.NewInt(2000000)), Txhash: "7C8B95EEE82CB63771E02EBEB05E6A80076D70B2E0A1C457F1FD1A0EF2EA961D", - Status: icstypes.WithdrawStatusSend, + Status: types.WithdrawStatusSend, } quicksilver.InterchainstakingKeeper.SetWithdrawalRecord(ctx, withdrawalRecord) quicksilver.InterchainstakingKeeper.SetAddressZoneMapping(ctx, user, zone.ChainId) @@ -3099,11 +3109,11 @@ func (suite *KeeperTestSuite) TestReceiveAckErrForBankSend() { err = quicksilver.InterchainstakingKeeper.HandleAcknowledgement(ctx, packet, ackBytes) suite.NoError(err) - newRecord, found := quicksilver.InterchainstakingKeeper.GetWithdrawalRecord(ctx, zone.ChainId, "7C8B95EEE82CB63771E02EBEB05E6A80076D70B2E0A1C457F1FD1A0EF2EA961D", icstypes.WithdrawStatusUnbond) + newRecord, found := quicksilver.InterchainstakingKeeper.GetWithdrawalRecord(ctx, zone.ChainId, "7C8B95EEE82CB63771E02EBEB05E6A80076D70B2E0A1C457F1FD1A0EF2EA961D", types.WithdrawStatusUnbond) if !found { suite.Fail("unable to retrieve new withdrawal record for test") } - suite.Equal(ctx.BlockTime().Add(icstypes.DefaultWithdrawalRequeueDelay), newRecord.CompletionTime) + suite.Equal(ctx.BlockTime().Add(types.DefaultWithdrawalRequeueDelay), newRecord.CompletionTime) } func (suite *KeeperTestSuite) TestHandleMaturedUbondings() { @@ -3115,20 +3125,20 @@ func (suite *KeeperTestSuite) TestHandleMaturedUbondings() { tests := []struct { name string epoch int64 - withdrawalRecords func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []icstypes.WithdrawalRecord + withdrawalRecords func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) []types.WithdrawalRecord completionTime time.Time - expectedWithdrawalRecords func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []icstypes.WithdrawalRecord + expectedWithdrawalRecords func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) []types.WithdrawalRecord }{ { name: "1 wdr, valid completion time, acknowledged ", epoch: 1, - withdrawalRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []icstypes.WithdrawalRecord { + withdrawalRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) []types.WithdrawalRecord { vals := qs.InterchainstakingKeeper.GetValidatorAddresses(ctx, zone.ChainId) - return []icstypes.WithdrawalRecord{ + return []types.WithdrawalRecord{ { ChainId: suite.chainB.ChainID, Delegator: delegator1, - Distribution: []*icstypes.Distribution{ + Distribution: []*types.Distribution{ { Valoper: vals[0], Amount: 1000, @@ -3142,19 +3152,19 @@ func (suite *KeeperTestSuite) TestHandleMaturedUbondings() { Amount: sdk.NewCoins(sdk.NewCoin(zone.BaseDenom, sdk.NewInt(2000))), BurnAmount: sdk.NewCoin(zone.LocalDenom, sdk.NewInt(1800)), Txhash: hash1, - Status: icstypes.WithdrawStatusUnbond, + Status: types.WithdrawStatusUnbond, CompletionTime: ctx.BlockTime().Add(-1 * time.Hour), Acknowledged: true, }, } }, - expectedWithdrawalRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []icstypes.WithdrawalRecord { + expectedWithdrawalRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) []types.WithdrawalRecord { vals := qs.InterchainstakingKeeper.GetValidatorAddresses(ctx, zone.ChainId) - return []icstypes.WithdrawalRecord{ + return []types.WithdrawalRecord{ { ChainId: suite.chainB.ChainID, Delegator: delegator1, - Distribution: []*icstypes.Distribution{ + Distribution: []*types.Distribution{ { Valoper: vals[0], Amount: 1000, @@ -3168,7 +3178,7 @@ func (suite *KeeperTestSuite) TestHandleMaturedUbondings() { Amount: sdk.NewCoins(sdk.NewCoin(zone.BaseDenom, sdk.NewInt(2000))), BurnAmount: sdk.NewCoin(zone.LocalDenom, sdk.NewInt(1800)), Txhash: hash1, - Status: icstypes.WithdrawStatusSend, + Status: types.WithdrawStatusSend, CompletionTime: ctx.BlockTime().Add(-1 * time.Hour), Acknowledged: true, }, @@ -3178,13 +3188,13 @@ func (suite *KeeperTestSuite) TestHandleMaturedUbondings() { { name: "1 wdr, invalid completion time, acknowledged ", epoch: 1, - withdrawalRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []icstypes.WithdrawalRecord { + withdrawalRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) []types.WithdrawalRecord { vals := qs.InterchainstakingKeeper.GetValidatorAddresses(ctx, zone.ChainId) - return []icstypes.WithdrawalRecord{ + return []types.WithdrawalRecord{ { ChainId: suite.chainB.ChainID, Delegator: delegator1, - Distribution: []*icstypes.Distribution{ + Distribution: []*types.Distribution{ { Valoper: vals[0], Amount: 1000, @@ -3198,19 +3208,19 @@ func (suite *KeeperTestSuite) TestHandleMaturedUbondings() { Amount: sdk.NewCoins(sdk.NewCoin(zone.BaseDenom, sdk.NewInt(2000))), BurnAmount: sdk.NewCoin(zone.LocalDenom, sdk.NewInt(1800)), Txhash: hash1, - Status: icstypes.WithdrawStatusUnbond, + Status: types.WithdrawStatusUnbond, CompletionTime: ctx.BlockTime().Add(1 * time.Hour), Acknowledged: true, }, } }, - expectedWithdrawalRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []icstypes.WithdrawalRecord { + expectedWithdrawalRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) []types.WithdrawalRecord { vals := qs.InterchainstakingKeeper.GetValidatorAddresses(ctx, zone.ChainId) - return []icstypes.WithdrawalRecord{ + return []types.WithdrawalRecord{ { ChainId: suite.chainB.ChainID, Delegator: delegator1, - Distribution: []*icstypes.Distribution{ + Distribution: []*types.Distribution{ { Valoper: vals[0], Amount: 1000, @@ -3224,7 +3234,7 @@ func (suite *KeeperTestSuite) TestHandleMaturedUbondings() { Amount: sdk.NewCoins(sdk.NewCoin(zone.BaseDenom, sdk.NewInt(2000))), BurnAmount: sdk.NewCoin(zone.LocalDenom, sdk.NewInt(1800)), Txhash: hash1, - Status: icstypes.WithdrawStatusUnbond, + Status: types.WithdrawStatusUnbond, CompletionTime: ctx.BlockTime().Add(1 * time.Hour), Acknowledged: true, }, @@ -3234,13 +3244,13 @@ func (suite *KeeperTestSuite) TestHandleMaturedUbondings() { { name: "1 wdr, invalid completion time, unacknowledged ", epoch: 1, - withdrawalRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []icstypes.WithdrawalRecord { + withdrawalRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) []types.WithdrawalRecord { vals := qs.InterchainstakingKeeper.GetValidatorAddresses(ctx, zone.ChainId) - return []icstypes.WithdrawalRecord{ + return []types.WithdrawalRecord{ { ChainId: suite.chainB.ChainID, Delegator: delegator1, - Distribution: []*icstypes.Distribution{ + Distribution: []*types.Distribution{ { Valoper: vals[0], Amount: 1000, @@ -3254,19 +3264,19 @@ func (suite *KeeperTestSuite) TestHandleMaturedUbondings() { Amount: sdk.NewCoins(sdk.NewCoin(zone.BaseDenom, sdk.NewInt(2000))), BurnAmount: sdk.NewCoin(zone.LocalDenom, sdk.NewInt(1800)), Txhash: hash1, - Status: icstypes.WithdrawStatusUnbond, + Status: types.WithdrawStatusUnbond, CompletionTime: ctx.BlockTime().Add(1 * time.Hour), Acknowledged: false, }, } }, - expectedWithdrawalRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []icstypes.WithdrawalRecord { + expectedWithdrawalRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) []types.WithdrawalRecord { vals := qs.InterchainstakingKeeper.GetValidatorAddresses(ctx, zone.ChainId) - return []icstypes.WithdrawalRecord{ + return []types.WithdrawalRecord{ { ChainId: suite.chainB.ChainID, Delegator: delegator1, - Distribution: []*icstypes.Distribution{ + Distribution: []*types.Distribution{ { Valoper: vals[0], Amount: 1000, @@ -3280,7 +3290,7 @@ func (suite *KeeperTestSuite) TestHandleMaturedUbondings() { Amount: sdk.NewCoins(sdk.NewCoin(zone.BaseDenom, sdk.NewInt(2000))), BurnAmount: sdk.NewCoin(zone.LocalDenom, sdk.NewInt(1800)), Txhash: hash1, - Status: icstypes.WithdrawStatusUnbond, + Status: types.WithdrawStatusUnbond, CompletionTime: ctx.BlockTime().Add(1 * time.Hour), Acknowledged: false, }, @@ -3291,13 +3301,13 @@ func (suite *KeeperTestSuite) TestHandleMaturedUbondings() { { name: "valid completion time, Unacknowledged ", epoch: 1, - withdrawalRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []icstypes.WithdrawalRecord { + withdrawalRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) []types.WithdrawalRecord { vals := qs.InterchainstakingKeeper.GetValidatorAddresses(ctx, zone.ChainId) - return []icstypes.WithdrawalRecord{ + return []types.WithdrawalRecord{ { ChainId: suite.chainB.ChainID, Delegator: delegator1, - Distribution: []*icstypes.Distribution{ + Distribution: []*types.Distribution{ { Valoper: vals[0], Amount: 1000, @@ -3307,19 +3317,19 @@ func (suite *KeeperTestSuite) TestHandleMaturedUbondings() { Amount: sdk.NewCoins(sdk.NewCoin(zone.BaseDenom, sdk.NewInt(1000))), BurnAmount: sdk.NewCoin(zone.LocalDenom, sdk.NewInt(900)), Txhash: hash1, - Status: icstypes.WithdrawStatusUnbond, + Status: types.WithdrawStatusUnbond, CompletionTime: ctx.BlockTime().Add(-1 * time.Hour), Acknowledged: false, }, } }, - expectedWithdrawalRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []icstypes.WithdrawalRecord { + expectedWithdrawalRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) []types.WithdrawalRecord { vals := qs.InterchainstakingKeeper.GetValidatorAddresses(ctx, zone.ChainId) - return []icstypes.WithdrawalRecord{ + return []types.WithdrawalRecord{ { ChainId: suite.chainB.ChainID, Delegator: delegator1, - Distribution: []*icstypes.Distribution{ + Distribution: []*types.Distribution{ { Valoper: vals[0], Amount: 1000, @@ -3329,7 +3339,7 @@ func (suite *KeeperTestSuite) TestHandleMaturedUbondings() { Amount: sdk.NewCoins(sdk.NewCoin(zone.BaseDenom, sdk.NewInt(1000))), BurnAmount: sdk.NewCoin(zone.LocalDenom, sdk.NewInt(900)), Txhash: hash1, - Status: icstypes.WithdrawStatusUnbond, + Status: types.WithdrawStatusUnbond, CompletionTime: ctx.BlockTime().Add(-1 * time.Hour), Acknowledged: false, }, @@ -3339,13 +3349,13 @@ func (suite *KeeperTestSuite) TestHandleMaturedUbondings() { { name: "valid completion time, 1 acknowledged and 1 unacknowledged ", epoch: 2, - withdrawalRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []icstypes.WithdrawalRecord { + withdrawalRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) []types.WithdrawalRecord { vals := qs.InterchainstakingKeeper.GetValidatorAddresses(ctx, zone.ChainId) - return []icstypes.WithdrawalRecord{ + return []types.WithdrawalRecord{ { ChainId: suite.chainB.ChainID, Delegator: delegator1, - Distribution: []*icstypes.Distribution{ + Distribution: []*types.Distribution{ { Valoper: vals[0], Amount: 1000, @@ -3359,14 +3369,14 @@ func (suite *KeeperTestSuite) TestHandleMaturedUbondings() { Amount: sdk.NewCoins(sdk.NewCoin(zone.BaseDenom, sdk.NewInt(1500))), BurnAmount: sdk.NewCoin(zone.LocalDenom, sdk.NewInt(1350)), Txhash: hash1, - Status: icstypes.WithdrawStatusUnbond, + Status: types.WithdrawStatusUnbond, CompletionTime: ctx.BlockTime().Add(-1 * time.Hour), Acknowledged: false, }, { ChainId: suite.chainB.ChainID, Delegator: delegator2, - Distribution: []*icstypes.Distribution{ + Distribution: []*types.Distribution{ { Valoper: vals[0], Amount: 1000, @@ -3380,19 +3390,19 @@ func (suite *KeeperTestSuite) TestHandleMaturedUbondings() { Amount: sdk.NewCoins(sdk.NewCoin(zone.BaseDenom, sdk.NewInt(3000))), BurnAmount: sdk.NewCoin(zone.LocalDenom, sdk.NewInt(2700)), Txhash: hash2, - Status: icstypes.WithdrawStatusUnbond, + Status: types.WithdrawStatusUnbond, CompletionTime: ctx.BlockTime().Add(-1 * time.Hour), Acknowledged: true, }, } }, - expectedWithdrawalRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []icstypes.WithdrawalRecord { + expectedWithdrawalRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) []types.WithdrawalRecord { vals := qs.InterchainstakingKeeper.GetValidatorAddresses(ctx, zone.ChainId) - return []icstypes.WithdrawalRecord{ + return []types.WithdrawalRecord{ { ChainId: suite.chainB.ChainID, Delegator: delegator1, - Distribution: []*icstypes.Distribution{ + Distribution: []*types.Distribution{ { Valoper: vals[0], Amount: 1000, @@ -3406,14 +3416,14 @@ func (suite *KeeperTestSuite) TestHandleMaturedUbondings() { Amount: sdk.NewCoins(sdk.NewCoin(zone.BaseDenom, sdk.NewInt(1500))), BurnAmount: sdk.NewCoin(zone.LocalDenom, sdk.NewInt(1350)), Txhash: hash1, - Status: icstypes.WithdrawStatusUnbond, + Status: types.WithdrawStatusUnbond, CompletionTime: ctx.BlockTime().Add(-1 * time.Hour), Acknowledged: false, }, { ChainId: suite.chainB.ChainID, Delegator: delegator2, - Distribution: []*icstypes.Distribution{ + Distribution: []*types.Distribution{ { Valoper: vals[0], Amount: 1000, @@ -3427,7 +3437,7 @@ func (suite *KeeperTestSuite) TestHandleMaturedUbondings() { Amount: sdk.NewCoins(sdk.NewCoin(zone.BaseDenom, sdk.NewInt(3000))), BurnAmount: sdk.NewCoin(zone.LocalDenom, sdk.NewInt(2700)), Txhash: hash2, - Status: icstypes.WithdrawStatusSend, + Status: types.WithdrawStatusSend, CompletionTime: ctx.BlockTime().Add(-1 * time.Hour), Acknowledged: true, }, @@ -3480,22 +3490,22 @@ func (suite *KeeperTestSuite) TestHandleTokenizedShares() { name string epoch int64 txHash string - withdrawalRecords func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []icstypes.WithdrawalRecord - msgs func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []sdk.Msg - sharesAmount func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) sdk.Coins - expectedWithdrawalRecords func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []icstypes.WithdrawalRecord + withdrawalRecords func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) []types.WithdrawalRecord + msgs func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) []sdk.Msg + sharesAmount func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) sdk.Coins + expectedWithdrawalRecords func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) []types.WithdrawalRecord }{ { name: "1 wdr, 2 distributions, 2 msgs, withdraw success", epoch: 1, txHash: txHash, - withdrawalRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []icstypes.WithdrawalRecord { + withdrawalRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) []types.WithdrawalRecord { vals := qs.InterchainstakingKeeper.GetValidatorAddresses(ctx, zone.ChainId) - return []icstypes.WithdrawalRecord{ + return []types.WithdrawalRecord{ { ChainId: suite.chainB.ChainID, Delegator: delegator, - Distribution: []*icstypes.Distribution{ + Distribution: []*types.Distribution{ { Valoper: vals[0], Amount: 1000, @@ -3509,13 +3519,13 @@ func (suite *KeeperTestSuite) TestHandleTokenizedShares() { Amount: sdk.Coins{}, BurnAmount: sdk.NewCoin(zone.LocalDenom, sdk.NewInt(1800)), Txhash: txHash, - Status: icstypes.WithdrawStatusTokenize, + Status: types.WithdrawStatusTokenize, CompletionTime: ctx.BlockTime().Add(-1 * time.Hour), Acknowledged: true, }, } }, - msgs: func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []sdk.Msg { + msgs: func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) []sdk.Msg { vals := qs.InterchainstakingKeeper.GetValidatorAddresses(ctx, zone.ChainId) return []sdk.Msg{ &lsmstakingtypes.MsgTokenizeShares{ @@ -3532,7 +3542,7 @@ func (suite *KeeperTestSuite) TestHandleTokenizedShares() { }, } }, - sharesAmount: func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) sdk.Coins { + sharesAmount: func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) sdk.Coins { vals := qs.InterchainstakingKeeper.GetValidatorAddresses(ctx, zone.ChainId) return sdk.NewCoins( @@ -3540,21 +3550,21 @@ func (suite *KeeperTestSuite) TestHandleTokenizedShares() { sdk.NewCoin(vals[1]+"1", sdk.NewInt(1000)), ) }, - expectedWithdrawalRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []icstypes.WithdrawalRecord { - return []icstypes.WithdrawalRecord{} + expectedWithdrawalRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) []types.WithdrawalRecord { + return []types.WithdrawalRecord{} }, }, { name: "1 wdr, 2 distributions, 1 msgs, withdraw half", epoch: 1, txHash: txHash, - withdrawalRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []icstypes.WithdrawalRecord { + withdrawalRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) []types.WithdrawalRecord { vals := qs.InterchainstakingKeeper.GetValidatorAddresses(ctx, zone.ChainId) - return []icstypes.WithdrawalRecord{ + return []types.WithdrawalRecord{ { ChainId: suite.chainB.ChainID, Delegator: delegator, - Distribution: []*icstypes.Distribution{ + Distribution: []*types.Distribution{ { Valoper: vals[0], Amount: 1000, @@ -3568,13 +3578,13 @@ func (suite *KeeperTestSuite) TestHandleTokenizedShares() { Amount: sdk.Coins{}, BurnAmount: sdk.NewCoin(zone.LocalDenom, sdk.NewInt(1800)), Txhash: txHash, - Status: icstypes.WithdrawStatusTokenize, + Status: types.WithdrawStatusTokenize, CompletionTime: ctx.BlockTime().Add(-1 * time.Hour), Acknowledged: true, }, } }, - msgs: func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []sdk.Msg { + msgs: func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) []sdk.Msg { vals := qs.InterchainstakingKeeper.GetValidatorAddresses(ctx, zone.ChainId) return []sdk.Msg{ &lsmstakingtypes.MsgTokenizeShares{ @@ -3585,21 +3595,21 @@ func (suite *KeeperTestSuite) TestHandleTokenizedShares() { }, } }, - sharesAmount: func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) sdk.Coins { + sharesAmount: func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) sdk.Coins { vals := qs.InterchainstakingKeeper.GetValidatorAddresses(ctx, zone.ChainId) return sdk.NewCoins( - sdk.NewCoin(vals[0]+"0x", sdk.NewInt(1000)), + sdk.NewCoin(vals[0]+"/1", sdk.NewInt(1000)), ) }, - expectedWithdrawalRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []icstypes.WithdrawalRecord { + expectedWithdrawalRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) []types.WithdrawalRecord { vals := qs.InterchainstakingKeeper.GetValidatorAddresses(ctx, zone.ChainId) - return []icstypes.WithdrawalRecord{ + return []types.WithdrawalRecord{ { ChainId: suite.chainB.ChainID, Delegator: delegator, - Distribution: []*icstypes.Distribution{ + Distribution: []*types.Distribution{ { Valoper: vals[0], Amount: 1000, @@ -3610,10 +3620,10 @@ func (suite *KeeperTestSuite) TestHandleTokenizedShares() { }, }, Recipient: addressutils.GenerateAddressForTestWithPrefix(zone.GetAccountPrefix()), - Amount: sdk.Coins{sdk.NewCoin(vals[0]+"0x", sdk.NewInt(1000))}, + Amount: sdk.Coins{sdk.NewCoin(vals[0]+"/1", sdk.NewInt(1000))}, BurnAmount: sdk.NewCoin(zone.LocalDenom, sdk.NewInt(1800)), Txhash: txHash, - Status: icstypes.WithdrawStatusTokenize, + Status: types.WithdrawStatusTokenize, CompletionTime: ctx.BlockTime().Add(-1 * time.Hour), Acknowledged: true, }, @@ -3624,13 +3634,13 @@ func (suite *KeeperTestSuite) TestHandleTokenizedShares() { name: "1 wdr, 2 distributions, 1 msgs, not match amount", epoch: 1, txHash: txHash, - withdrawalRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []icstypes.WithdrawalRecord { + withdrawalRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) []types.WithdrawalRecord { vals := qs.InterchainstakingKeeper.GetValidatorAddresses(ctx, zone.ChainId) - return []icstypes.WithdrawalRecord{ + return []types.WithdrawalRecord{ { ChainId: suite.chainB.ChainID, Delegator: delegator, - Distribution: []*icstypes.Distribution{ + Distribution: []*types.Distribution{ { Valoper: vals[0], Amount: 1000, @@ -3644,13 +3654,13 @@ func (suite *KeeperTestSuite) TestHandleTokenizedShares() { Amount: sdk.Coins{}, BurnAmount: sdk.NewCoin(zone.LocalDenom, sdk.NewInt(1800)), Txhash: txHash, - Status: icstypes.WithdrawStatusTokenize, + Status: types.WithdrawStatusTokenize, CompletionTime: ctx.BlockTime().Add(-1 * time.Hour), Acknowledged: true, }, } }, - msgs: func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []sdk.Msg { + msgs: func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) []sdk.Msg { vals := qs.InterchainstakingKeeper.GetValidatorAddresses(ctx, zone.ChainId) return []sdk.Msg{ &lsmstakingtypes.MsgTokenizeShares{ @@ -3661,21 +3671,21 @@ func (suite *KeeperTestSuite) TestHandleTokenizedShares() { }, } }, - sharesAmount: func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) sdk.Coins { + sharesAmount: func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) sdk.Coins { vals := qs.InterchainstakingKeeper.GetValidatorAddresses(ctx, zone.ChainId) return sdk.NewCoins( - sdk.NewCoin(vals[0]+"0x", sdk.NewInt(500)), + sdk.NewCoin(vals[0]+"/1", sdk.NewInt(500)), ) }, - expectedWithdrawalRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []icstypes.WithdrawalRecord { + expectedWithdrawalRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) []types.WithdrawalRecord { vals := qs.InterchainstakingKeeper.GetValidatorAddresses(ctx, zone.ChainId) - return []icstypes.WithdrawalRecord{ + return []types.WithdrawalRecord{ { ChainId: suite.chainB.ChainID, Delegator: delegator, - Distribution: []*icstypes.Distribution{ + Distribution: []*types.Distribution{ { Valoper: vals[0], Amount: 1000, @@ -3689,7 +3699,7 @@ func (suite *KeeperTestSuite) TestHandleTokenizedShares() { Amount: nil, BurnAmount: sdk.NewCoin(zone.LocalDenom, sdk.NewInt(1800)), Txhash: txHash, - Status: icstypes.WithdrawStatusTokenize, + Status: types.WithdrawStatusTokenize, CompletionTime: ctx.BlockTime().Add(-1 * time.Hour), Acknowledged: true, }, @@ -3700,13 +3710,13 @@ func (suite *KeeperTestSuite) TestHandleTokenizedShares() { name: "1 wdr, 2 distributions, 2 msgs, not match denom", epoch: 1, txHash: txHash, - withdrawalRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []icstypes.WithdrawalRecord { + withdrawalRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) []types.WithdrawalRecord { vals := qs.InterchainstakingKeeper.GetValidatorAddresses(ctx, zone.ChainId) - return []icstypes.WithdrawalRecord{ + return []types.WithdrawalRecord{ { ChainId: suite.chainB.ChainID, Delegator: delegator, - Distribution: []*icstypes.Distribution{ + Distribution: []*types.Distribution{ { Valoper: vals[0], Amount: 1000, @@ -3720,13 +3730,13 @@ func (suite *KeeperTestSuite) TestHandleTokenizedShares() { Amount: sdk.Coins{}, BurnAmount: sdk.NewCoin(zone.LocalDenom, sdk.NewInt(1800)), Txhash: txHash, - Status: icstypes.WithdrawStatusTokenize, + Status: types.WithdrawStatusTokenize, CompletionTime: ctx.BlockTime().Add(-1 * time.Hour), Acknowledged: true, }, } }, - msgs: func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []sdk.Msg { + msgs: func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) []sdk.Msg { vals := qs.InterchainstakingKeeper.GetValidatorAddresses(ctx, zone.ChainId) return []sdk.Msg{ &lsmstakingtypes.MsgTokenizeShares{ @@ -3743,20 +3753,20 @@ func (suite *KeeperTestSuite) TestHandleTokenizedShares() { }, } }, - sharesAmount: func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) sdk.Coins { + sharesAmount: func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) sdk.Coins { return sdk.NewCoins( sdk.NewCoin("not_match_denom_0x", sdk.NewInt(1000)), sdk.NewCoin("not_match_denom_1x", sdk.NewInt(1000)), ) }, - expectedWithdrawalRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []icstypes.WithdrawalRecord { + expectedWithdrawalRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) []types.WithdrawalRecord { vals := qs.InterchainstakingKeeper.GetValidatorAddresses(ctx, zone.ChainId) - return []icstypes.WithdrawalRecord{ + return []types.WithdrawalRecord{ { ChainId: suite.chainB.ChainID, Delegator: delegator, - Distribution: []*icstypes.Distribution{ + Distribution: []*types.Distribution{ { Valoper: vals[0], Amount: 1000, @@ -3770,7 +3780,7 @@ func (suite *KeeperTestSuite) TestHandleTokenizedShares() { Amount: nil, BurnAmount: sdk.NewCoin(zone.LocalDenom, sdk.NewInt(1800)), Txhash: txHash, - Status: icstypes.WithdrawStatusTokenize, + Status: types.WithdrawStatusTokenize, CompletionTime: ctx.BlockTime().Add(-1 * time.Hour), Acknowledged: true, }, @@ -3781,13 +3791,13 @@ func (suite *KeeperTestSuite) TestHandleTokenizedShares() { name: "2 wdr, 2 distributions, 2 msgs, not match denom", epoch: 1, txHash: txHash, - withdrawalRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []icstypes.WithdrawalRecord { + withdrawalRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) []types.WithdrawalRecord { vals := qs.InterchainstakingKeeper.GetValidatorAddresses(ctx, zone.ChainId) - return []icstypes.WithdrawalRecord{ + return []types.WithdrawalRecord{ { ChainId: suite.chainB.ChainID, Delegator: delegator, - Distribution: []*icstypes.Distribution{ + Distribution: []*types.Distribution{ { Valoper: vals[0], Amount: 1000, @@ -3801,14 +3811,14 @@ func (suite *KeeperTestSuite) TestHandleTokenizedShares() { Amount: sdk.Coins{}, BurnAmount: sdk.NewCoin(zone.LocalDenom, sdk.NewInt(1800)), Txhash: txHash, - Status: icstypes.WithdrawStatusTokenize, + Status: types.WithdrawStatusTokenize, CompletionTime: ctx.BlockTime().Add(-1 * time.Hour), Acknowledged: true, }, { ChainId: suite.chainB.ChainID, Delegator: delegator, - Distribution: []*icstypes.Distribution{ + Distribution: []*types.Distribution{ { Valoper: vals[0], Amount: 1000, @@ -3822,13 +3832,13 @@ func (suite *KeeperTestSuite) TestHandleTokenizedShares() { Amount: sdk.Coins{}, BurnAmount: sdk.NewCoin(zone.LocalDenom, sdk.NewInt(1800)), Txhash: txHash1, - Status: icstypes.WithdrawStatusTokenize, + Status: types.WithdrawStatusTokenize, CompletionTime: ctx.BlockTime().Add(-1 * time.Hour), Acknowledged: true, }, } }, - msgs: func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []sdk.Msg { + msgs: func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) []sdk.Msg { vals := qs.InterchainstakingKeeper.GetValidatorAddresses(ctx, zone.ChainId) return []sdk.Msg{ &lsmstakingtypes.MsgTokenizeShares{ @@ -3845,21 +3855,21 @@ func (suite *KeeperTestSuite) TestHandleTokenizedShares() { }, } }, - sharesAmount: func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) sdk.Coins { + sharesAmount: func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) sdk.Coins { vals := qs.InterchainstakingKeeper.GetValidatorAddresses(ctx, zone.ChainId) return sdk.NewCoins( - sdk.NewCoin(vals[0]+"0x", sdk.NewInt(1000)), - sdk.NewCoin(vals[1]+"1x", sdk.NewInt(1000)), + sdk.NewCoin(vals[0]+"/1", sdk.NewInt(1000)), + sdk.NewCoin(vals[1]+"/2", sdk.NewInt(1000)), ) }, - expectedWithdrawalRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []icstypes.WithdrawalRecord { + expectedWithdrawalRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) []types.WithdrawalRecord { vals := qs.InterchainstakingKeeper.GetValidatorAddresses(ctx, zone.ChainId) - return []icstypes.WithdrawalRecord{ + return []types.WithdrawalRecord{ { ChainId: suite.chainB.ChainID, Delegator: delegator, - Distribution: []*icstypes.Distribution{ + Distribution: []*types.Distribution{ { Valoper: vals[0], Amount: 1000, @@ -3873,7 +3883,7 @@ func (suite *KeeperTestSuite) TestHandleTokenizedShares() { Amount: nil, BurnAmount: sdk.NewCoin(zone.LocalDenom, sdk.NewInt(1800)), Txhash: txHash1, - Status: icstypes.WithdrawStatusTokenize, + Status: types.WithdrawStatusTokenize, CompletionTime: ctx.BlockTime().Add(-1 * time.Hour), Acknowledged: true, }, @@ -3909,7 +3919,7 @@ func (suite *KeeperTestSuite) TestHandleTokenizedShares() { ewdrs := test.expectedWithdrawalRecords(ctx, quicksilver, zone) if len(ewdrs) == 0 { - _, found := quicksilver.InterchainstakingKeeper.GetWithdrawalRecord(ctx, zone.ChainId, test.txHash, icstypes.WithdrawStatusTokenize) + _, found := quicksilver.InterchainstakingKeeper.GetWithdrawalRecord(ctx, zone.ChainId, test.txHash, types.WithdrawStatusTokenize) suite.False(found) } @@ -3964,18 +3974,18 @@ func (suite *KeeperTestSuite) TestGetValidatorForToken() { name string err bool setupConnection bool - amount func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) sdk.Coin - expectVal func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) string + amount func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) sdk.Coin + expectVal func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) string }{ { name: "Found validator", err: false, setupConnection: true, - amount: func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) sdk.Coin { + amount: func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) sdk.Coin { vals := qs.InterchainstakingKeeper.GetValidatorAddresses(ctx, zone.ChainId) - return sdk.NewCoin(vals[0]+"0x", sdk.NewInt(100)) + return sdk.NewCoin(vals[0]+"/1", sdk.NewInt(100)) }, - expectVal: func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) string { + expectVal: func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) string { vals := qs.InterchainstakingKeeper.GetValidatorAddresses(ctx, zone.ChainId) return vals[0] }, @@ -3984,10 +3994,10 @@ func (suite *KeeperTestSuite) TestGetValidatorForToken() { name: "Not found validator", err: true, setupConnection: true, - amount: func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) sdk.Coin { + amount: func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) sdk.Coin { return sdk.NewCoin("hello", sdk.NewInt(100)) }, - expectVal: func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) string { + expectVal: func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) string { return "" }, }, @@ -3995,10 +4005,10 @@ func (suite *KeeperTestSuite) TestGetValidatorForToken() { name: "Not setup connection", err: true, setupConnection: false, - amount: func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) sdk.Coin { + amount: func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) sdk.Coin { return sdk.NewCoin("hello", sdk.NewInt(100)) }, - expectVal: func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) string { + expectVal: func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) string { return "" }, }, @@ -4037,13 +4047,13 @@ func (suite *KeeperTestSuite) TestGetValidatorForToken() { func (suite *KeeperTestSuite) TestHandleCompleteSend() { testCases := []struct { name string - message func(zone *icstypes.Zone) sdk.Msg + message func(zone *types.Zone) sdk.Msg memo string expectedError error }{ { name: "unexpected completed send", - message: func(zone *icstypes.Zone) sdk.Msg { + message: func(zone *types.Zone) sdk.Msg { return &banktypes.MsgSend{ FromAddress: "", ToAddress: "", @@ -4054,7 +4064,7 @@ func (suite *KeeperTestSuite) TestHandleCompleteSend() { }, { name: "From WithdrawalAddress", - message: func(zone *icstypes.Zone) sdk.Msg { + message: func(zone *types.Zone) sdk.Msg { return &banktypes.MsgSend{ FromAddress: zone.WithdrawalAddress.Address, ToAddress: "", @@ -4065,7 +4075,7 @@ func (suite *KeeperTestSuite) TestHandleCompleteSend() { }, { name: "From DepositAddress to DelegateAddress", - message: func(zone *icstypes.Zone) sdk.Msg { + message: func(zone *types.Zone) sdk.Msg { return &banktypes.MsgSend{ FromAddress: zone.DepositAddress.Address, ToAddress: zone.DelegationAddress.Address, @@ -4077,7 +4087,7 @@ func (suite *KeeperTestSuite) TestHandleCompleteSend() { }, { name: "From DepositAddress", - message: func(zone *icstypes.Zone) sdk.Msg { + message: func(zone *types.Zone) sdk.Msg { return &banktypes.MsgSend{ FromAddress: zone.DelegationAddress.Address, ToAddress: "", @@ -4121,9 +4131,9 @@ func (suite *KeeperTestSuite) TestHandleFailedBankSend() { user := addressutils.GenerateAddressForTestWithPrefix("quick") tests := []struct { name string - record func(zone *icstypes.Zone) icstypes.WithdrawalRecord + record func(zone *types.Zone) types.WithdrawalRecord setupConnection bool - message func(zone *icstypes.Zone) sdk.Msg + message func(zone *types.Zone) sdk.Msg memo string err bool check bool @@ -4131,8 +4141,8 @@ func (suite *KeeperTestSuite) TestHandleFailedBankSend() { { name: "invalid - can not cast to MsgSend", setupConnection: false, - message: func(zone *icstypes.Zone) sdk.Msg { - return &icstypes.MsgRequestRedemption{} + message: func(zone *types.Zone) sdk.Msg { + return &types.MsgRequestRedemption{} }, memo: "withdrawal/7C8B95EEE82CB63771E02EBEB05E6A80076D70B2E0A1C457F1FD1A0EF2EA961D", err: true, @@ -4141,7 +4151,7 @@ func (suite *KeeperTestSuite) TestHandleFailedBankSend() { { name: "invalid - not has connection", setupConnection: false, - message: func(zone *icstypes.Zone) sdk.Msg { + message: func(zone *types.Zone) sdk.Msg { return &banktypes.MsgSend{ FromAddress: zone.DelegationAddress.Address, Amount: sdk.NewCoins(sdk.NewCoin(v1+"1", sdk.NewInt(1000000))), @@ -4154,7 +4164,7 @@ func (suite *KeeperTestSuite) TestHandleFailedBankSend() { { name: "Send from DelegateAddress then HandleFailedUnbondSend, invalid - unable to parse tx hash", setupConnection: true, - message: func(zone *icstypes.Zone) sdk.Msg { + message: func(zone *types.Zone) sdk.Msg { return &banktypes.MsgSend{ FromAddress: zone.DelegationAddress.Address, Amount: sdk.NewCoins(sdk.NewCoin(v1+"1", sdk.NewInt(1000000))), @@ -4167,11 +4177,11 @@ func (suite *KeeperTestSuite) TestHandleFailedBankSend() { { name: "Send from DelegateAddress then HandleFailedUnbondSend, invalid - no matching record", setupConnection: true, - record: func(zone *icstypes.Zone) icstypes.WithdrawalRecord { - return icstypes.WithdrawalRecord{ + record: func(zone *types.Zone) types.WithdrawalRecord { + return types.WithdrawalRecord{ ChainId: zone.ChainId, Delegator: addressutils.GenerateAccAddressForTest().String(), - Distribution: []*icstypes.Distribution{ + Distribution: []*types.Distribution{ {Valoper: v1, Amount: 1000000}, {Valoper: v2, Amount: 1000000}, }, @@ -4179,10 +4189,10 @@ func (suite *KeeperTestSuite) TestHandleFailedBankSend() { Amount: sdk.NewCoins(sdk.NewCoin("uatom", sdk.NewInt(4000000))), BurnAmount: sdk.NewCoin("uqatom", sdk.NewInt(4000000)), Txhash: "7C8B95EEE82CB63771E02EBEB05E6A80076D70B2E0A1C457F1FD1A0EF2EA961D", - Status: icstypes.WithdrawStatusQueued, + Status: types.WithdrawStatusQueued, } }, - message: func(zone *icstypes.Zone) sdk.Msg { + message: func(zone *types.Zone) sdk.Msg { return &banktypes.MsgSend{ FromAddress: zone.DelegationAddress.Address, Amount: sdk.NewCoins(sdk.NewCoin(v1+"1", sdk.NewInt(1000000))), @@ -4195,11 +4205,11 @@ func (suite *KeeperTestSuite) TestHandleFailedBankSend() { { name: "Send from DelegateAddress then HandleFailedUnbondSend, invalid - try msg send 2 times with one txHash", setupConnection: true, - record: func(zone *icstypes.Zone) icstypes.WithdrawalRecord { - return icstypes.WithdrawalRecord{ + record: func(zone *types.Zone) types.WithdrawalRecord { + return types.WithdrawalRecord{ ChainId: zone.ChainId, Delegator: addressutils.GenerateAccAddressForTest().String(), - Distribution: []*icstypes.Distribution{ + Distribution: []*types.Distribution{ {Valoper: v1, Amount: 1000000}, {Valoper: v2, Amount: 1000000}, }, @@ -4207,10 +4217,10 @@ func (suite *KeeperTestSuite) TestHandleFailedBankSend() { Amount: sdk.NewCoins(sdk.NewCoin("uatom", sdk.NewInt(2000000))), BurnAmount: sdk.NewCoin("uqatom", sdk.NewInt(2000000)), Txhash: "7C8B95EEE82CB63771E02EBEB05E6A80076D70B2E0A1C457F1FD1A0EF2EA961D", - Status: icstypes.WithdrawStatusSend, + Status: types.WithdrawStatusSend, } }, - message: func(zone *icstypes.Zone) sdk.Msg { + message: func(zone *types.Zone) sdk.Msg { return &banktypes.MsgSend{ FromAddress: zone.DelegationAddress.Address, Amount: sdk.NewCoins(sdk.NewCoin(v1+"1", sdk.NewInt(1000000))), @@ -4223,11 +4233,11 @@ func (suite *KeeperTestSuite) TestHandleFailedBankSend() { { name: "Send from DelegateAddress then HandleFailedUnbondSend, valid", setupConnection: true, - record: func(zone *icstypes.Zone) icstypes.WithdrawalRecord { - return icstypes.WithdrawalRecord{ + record: func(zone *types.Zone) types.WithdrawalRecord { + return types.WithdrawalRecord{ ChainId: zone.ChainId, Delegator: addressutils.GenerateAccAddressForTest().String(), - Distribution: []*icstypes.Distribution{ + Distribution: []*types.Distribution{ {Valoper: v1, Amount: 1000000}, {Valoper: v2, Amount: 1000000}, }, @@ -4235,10 +4245,10 @@ func (suite *KeeperTestSuite) TestHandleFailedBankSend() { Amount: sdk.NewCoins(sdk.NewCoin("uatom", sdk.NewInt(2000000))), BurnAmount: sdk.NewCoin("uqatom", sdk.NewInt(2000000)), Txhash: "7C8B95EEE82CB63771E02EBEB05E6A80076D70B2E0A1C457F1FD1A0EF2EA961D", - Status: icstypes.WithdrawStatusSend, + Status: types.WithdrawStatusSend, } }, - message: func(zone *icstypes.Zone) sdk.Msg { + message: func(zone *types.Zone) sdk.Msg { return &banktypes.MsgSend{ FromAddress: zone.DelegationAddress.Address, Amount: sdk.NewCoins(sdk.NewCoin(v1+"1", sdk.NewInt(1000000))), @@ -4251,7 +4261,7 @@ func (suite *KeeperTestSuite) TestHandleFailedBankSend() { { name: "Send from WithdrawlAddress, valid - but nothing change", setupConnection: true, - message: func(zone *icstypes.Zone) sdk.Msg { + message: func(zone *types.Zone) sdk.Msg { return &banktypes.MsgSend{ FromAddress: zone.WithdrawalAddress.WithdrawalAddress, Amount: sdk.NewCoins(sdk.NewCoin(v1+"1", sdk.NewInt(1000000))), @@ -4264,7 +4274,7 @@ func (suite *KeeperTestSuite) TestHandleFailedBankSend() { { name: "Send from DepositAddress to DelegationAddress, valid - but nothing change", setupConnection: true, - message: func(zone *icstypes.Zone) sdk.Msg { + message: func(zone *types.Zone) sdk.Msg { return &banktypes.MsgSend{ FromAddress: zone.DepositAddress.Address, ToAddress: zone.DelegationAddress.Address, @@ -4292,7 +4302,7 @@ func (suite *KeeperTestSuite) TestHandleFailedBankSend() { suite.Fail("unable to retrieve zone for test") } - var record icstypes.WithdrawalRecord + var record types.WithdrawalRecord if test.record != nil { record = test.record(&zone) quicksilver.InterchainstakingKeeper.SetWithdrawalRecord(ctx, record) @@ -4310,11 +4320,11 @@ func (suite *KeeperTestSuite) TestHandleFailedBankSend() { } if test.check { - newRecord, found := quicksilver.InterchainstakingKeeper.GetWithdrawalRecord(ctx, zone.ChainId, record.Txhash, icstypes.WithdrawStatusUnbond) + newRecord, found := quicksilver.InterchainstakingKeeper.GetWithdrawalRecord(ctx, zone.ChainId, record.Txhash, types.WithdrawStatusUnbond) if !found { suite.Fail("unable to retrieve new withdrawal record for test") } - suite.Equal(ctx.BlockTime().Add(icstypes.DefaultWithdrawalRequeueDelay), newRecord.CompletionTime) + suite.Equal(ctx.BlockTime().Add(types.DefaultWithdrawalRequeueDelay), newRecord.CompletionTime) } }) } @@ -4324,50 +4334,39 @@ func (suite *KeeperTestSuite) TestHandleRedeemTokens() { tests := []struct { name string errs []bool - tokens func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []sdk.Coin - msgs func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []sdk.Msg - delegationRecords func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []icstypes.Delegation - expectedDelegationRecords func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []icstypes.Delegation + msgs func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) []sdk.Msg + delegationRecords func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) []types.Delegation + expectedDelegationRecords func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) []types.Delegation }{ { name: "1 record, 1 msgs, redeem success", errs: []bool{false}, - delegationRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []icstypes.Delegation { + delegationRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) []types.Delegation { vals := qs.InterchainstakingKeeper.GetValidatorAddresses(ctx, zone.ChainId) - return []icstypes.Delegation{ + return []types.Delegation{ { DelegationAddress: zone.DelegationAddress.Address, ValidatorAddress: vals[0], - Amount: sdk.NewCoin(vals[0]+"0x", sdk.NewInt(1000)), - Height: 1, - RedelegationEnd: 1, + Amount: sdk.NewCoin(zone.BaseDenom, sdk.NewInt(1000)), }, } }, - tokens: func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []sdk.Coin { - vals := qs.InterchainstakingKeeper.GetValidatorAddresses(ctx, zone.ChainId) - return []sdk.Coin{ - sdk.NewCoin(vals[0]+"0x", sdk.NewInt(200)), - } - }, - msgs: func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []sdk.Msg { + msgs: func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) []sdk.Msg { vals := qs.InterchainstakingKeeper.GetValidatorAddresses(ctx, zone.ChainId) return []sdk.Msg{ - &lsmstakingtypes.MsgRedeemTokensforShares{ + &lsmstakingtypes.MsgRedeemTokensForShares{ DelegatorAddress: zone.DelegationAddress.Address, - Amount: sdk.NewCoin(vals[0]+"0x", sdk.NewInt(500)), + Amount: sdk.NewCoin(vals[0]+"/1", sdk.NewInt(200)), }, } }, - expectedDelegationRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []icstypes.Delegation { + expectedDelegationRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) []types.Delegation { vals := qs.InterchainstakingKeeper.GetValidatorAddresses(ctx, zone.ChainId) - return []icstypes.Delegation{ + return []types.Delegation{ { DelegationAddress: zone.DelegationAddress.Address, ValidatorAddress: vals[0], - Amount: sdk.NewCoin(vals[0]+"0x", sdk.NewInt(1200)), - Height: 1, - RedelegationEnd: 1, + Amount: sdk.NewCoin(zone.BaseDenom, sdk.NewInt(1200)), }, } }, @@ -4375,61 +4374,46 @@ func (suite *KeeperTestSuite) TestHandleRedeemTokens() { { name: "2 record, 2 msgs, redeem success", errs: []bool{false, false}, - delegationRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []icstypes.Delegation { + delegationRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) []types.Delegation { vals := qs.InterchainstakingKeeper.GetValidatorAddresses(ctx, zone.ChainId) - return []icstypes.Delegation{ + return []types.Delegation{ { DelegationAddress: zone.DelegationAddress.Address, ValidatorAddress: vals[0], - Amount: sdk.NewCoin(vals[0]+"0x", sdk.NewInt(1000)), - Height: 1, - RedelegationEnd: 1, + Amount: sdk.NewCoin(zone.BaseDenom, sdk.NewInt(1000)), }, { DelegationAddress: zone.DelegationAddress.Address, ValidatorAddress: vals[1], - Amount: sdk.NewCoin(vals[1]+"1x", sdk.NewInt(1000)), - Height: 1, - RedelegationEnd: 1, + Amount: sdk.NewCoin(zone.BaseDenom, sdk.NewInt(1000)), }, } }, - tokens: func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []sdk.Coin { - vals := qs.InterchainstakingKeeper.GetValidatorAddresses(ctx, zone.ChainId) - return []sdk.Coin{ - sdk.NewCoin(vals[0]+"0x", sdk.NewInt(100)), - sdk.NewCoin(vals[1]+"1x", sdk.NewInt(200)), - } - }, - msgs: func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []sdk.Msg { + msgs: func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) []sdk.Msg { vals := qs.InterchainstakingKeeper.GetValidatorAddresses(ctx, zone.ChainId) return []sdk.Msg{ - &lsmstakingtypes.MsgRedeemTokensforShares{ + &lsmstakingtypes.MsgRedeemTokensForShares{ DelegatorAddress: zone.DelegationAddress.Address, - Amount: sdk.NewCoin(vals[0]+"0x", sdk.NewInt(100)), + Amount: sdk.NewCoin(vals[0]+"/1", sdk.NewInt(100)), }, - &lsmstakingtypes.MsgRedeemTokensforShares{ + &lsmstakingtypes.MsgRedeemTokensForShares{ DelegatorAddress: zone.DelegationAddress.Address, - Amount: sdk.NewCoin(vals[1]+"1x", sdk.NewInt(200)), + Amount: sdk.NewCoin(vals[1]+"/2", sdk.NewInt(200)), }, } }, - expectedDelegationRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []icstypes.Delegation { + expectedDelegationRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) []types.Delegation { vals := qs.InterchainstakingKeeper.GetValidatorAddresses(ctx, zone.ChainId) - return []icstypes.Delegation{ + return []types.Delegation{ { DelegationAddress: zone.DelegationAddress.Address, ValidatorAddress: vals[0], - Amount: sdk.NewCoin(vals[0]+"0x", sdk.NewInt(1100)), - Height: 1, - RedelegationEnd: 1, + Amount: sdk.NewCoin(zone.BaseDenom, sdk.NewInt(1100)), }, { DelegationAddress: zone.DelegationAddress.Address, ValidatorAddress: vals[1], - Amount: sdk.NewCoin(vals[1]+"1x", sdk.NewInt(1200)), - Height: 1, - RedelegationEnd: 1, + Amount: sdk.NewCoin(zone.BaseDenom, sdk.NewInt(1200)), }, } }, @@ -4437,61 +4421,46 @@ func (suite *KeeperTestSuite) TestHandleRedeemTokens() { { name: "2 record, 2 msgs, redeem failed first msg", errs: []bool{true, false}, - delegationRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []icstypes.Delegation { + delegationRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) []types.Delegation { vals := qs.InterchainstakingKeeper.GetValidatorAddresses(ctx, zone.ChainId) - return []icstypes.Delegation{ + return []types.Delegation{ { DelegationAddress: zone.DelegationAddress.Address, ValidatorAddress: vals[0], - Amount: sdk.NewCoin(vals[0]+"0x", sdk.NewInt(1000)), - Height: 1, - RedelegationEnd: 1, + Amount: sdk.NewCoin(zone.BaseDenom, sdk.NewInt(1000)), }, { DelegationAddress: zone.DelegationAddress.Address, ValidatorAddress: vals[1], - Amount: sdk.NewCoin(vals[1]+"1x", sdk.NewInt(1000)), - Height: 1, - RedelegationEnd: 1, + Amount: sdk.NewCoin(zone.BaseDenom, sdk.NewInt(1000)), }, } }, - tokens: func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []sdk.Coin { - vals := qs.InterchainstakingKeeper.GetValidatorAddresses(ctx, zone.ChainId) - return []sdk.Coin{ - sdk.NewCoin(vals[0]+"3x", sdk.NewInt(100)), - sdk.NewCoin(vals[1]+"1x", sdk.NewInt(200)), - } - }, - msgs: func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []sdk.Msg { + msgs: func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) []sdk.Msg { vals := qs.InterchainstakingKeeper.GetValidatorAddresses(ctx, zone.ChainId) return []sdk.Msg{ - &lsmstakingtypes.MsgRedeemTokensforShares{ + &lsmstakingtypes.MsgRedeemTokensForShares{ DelegatorAddress: zone.DelegationAddress.Address, Amount: sdk.NewCoin("hello", sdk.NewInt(100)), }, - &lsmstakingtypes.MsgRedeemTokensforShares{ + &lsmstakingtypes.MsgRedeemTokensForShares{ DelegatorAddress: zone.DelegationAddress.Address, - Amount: sdk.NewCoin(vals[1]+"1x", sdk.NewInt(200)), + Amount: sdk.NewCoin(vals[1]+"/2", sdk.NewInt(200)), }, } }, - expectedDelegationRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone icstypes.Zone) []icstypes.Delegation { + expectedDelegationRecords: func(ctx sdk.Context, qs *app.Quicksilver, zone types.Zone) []types.Delegation { vals := qs.InterchainstakingKeeper.GetValidatorAddresses(ctx, zone.ChainId) - return []icstypes.Delegation{ + return []types.Delegation{ { DelegationAddress: zone.DelegationAddress.Address, ValidatorAddress: vals[0], - Amount: sdk.NewCoin(vals[0]+"0x", sdk.NewInt(1000)), - Height: 1, - RedelegationEnd: 1, + Amount: sdk.NewCoin(zone.BaseDenom, sdk.NewInt(1000)), }, { DelegationAddress: zone.DelegationAddress.Address, ValidatorAddress: vals[1], - Amount: sdk.NewCoin(vals[1]+"1x", sdk.NewInt(1200)), - Height: 1, - RedelegationEnd: 1, + Amount: sdk.NewCoin(zone.BaseDenom, sdk.NewInt(1200)), }, } }, @@ -4508,8 +4477,6 @@ func (suite *KeeperTestSuite) TestHandleRedeemTokens() { ctx = ctx.WithContext(context.WithValue(ctx.Context(), utils.ContextKey("connectionID"), suite.path.EndpointA.ConnectionID)) zone, found := quicksilver.InterchainstakingKeeper.GetZone(ctx, suite.chainB.ChainID) - - tokens := test.tokens(ctx, quicksilver, zone) if !found { suite.Fail("unable to retrieve zone for test") } @@ -4517,8 +4484,22 @@ func (suite *KeeperTestSuite) TestHandleRedeemTokens() { for _, dr := range test.delegationRecords(ctx, quicksilver, zone) { quicksilver.InterchainstakingKeeper.SetDelegation(ctx, zone.ChainId, dr) } + + t := ctx.BlockTime().Add(-time.Minute * 2) + for idx, msg := range test.msgs(ctx, quicksilver, zone) { - err := quicksilver.InterchainstakingKeeper.HandleRedeemTokens(ctx, msg, tokens[idx]) + txHash := randomutils.GenerateRandomHashAsHex(32) + lsmMsg, ok := msg.(*lsmstakingtypes.MsgRedeemTokensForShares) + suite.True(ok) + quicksilver.InterchainstakingKeeper.SetReceipt(ctx, types.Receipt{ + ChainId: suite.chainB.ChainID, + Sender: lsmMsg.DelegatorAddress, + Txhash: txHash, + Amount: sdk.NewCoins(lsmMsg.Amount), + FirstSeen: &t, + }) + + err := quicksilver.InterchainstakingKeeper.HandleRedeemTokens(ctx, msg, sdk.NewCoin(zone.BaseDenom, lsmMsg.Amount.Amount), txHash) if test.errs[idx] { suite.Error(err) } else { @@ -4530,9 +4511,168 @@ func (suite *KeeperTestSuite) TestHandleRedeemTokens() { dr, found := quicksilver.InterchainstakingKeeper.GetDelegation(ctx, zone.ChainId, edr.DelegationAddress, edr.ValidatorAddress) suite.True(found) suite.Equal(dr.Amount, edr.Amount) - suite.Equal(dr.Height, edr.Height) - suite.Equal(dr.RedelegationEnd, edr.RedelegationEnd) } }) } } + +func (suite *KeeperTestSuite) TestHandleFailedDelegate_Batch_OK() { + suite.SetupTest() + suite.setupTestZones() + + app := suite.GetQuicksilverApp(suite.chainA) + ctx := suite.chainA.GetContext() + + zone, found := app.InterchainstakingKeeper.GetZone(ctx, suite.chainB.ChainID) + suite.True(found) + + zone.WithdrawalWaitgroup = 100 + app.InterchainstakingKeeper.SetZone(ctx, &zone) + + vals := app.InterchainstakingKeeper.GetValidatorAddresses(ctx, suite.chainB.ChainID) + msg := stakingtypes.MsgDelegate{DelegatorAddress: zone.DelegationAddress.Address, ValidatorAddress: vals[0], Amount: sdk.NewCoin("uatom", sdk.NewInt(100))} + var msgMsg sdk.Msg = &msg + err := app.InterchainstakingKeeper.HandleFailedDelegate(ctx, msgMsg, "batch/12345678") + suite.NoError(err) + + zone, found = app.InterchainstakingKeeper.GetZone(ctx, suite.chainB.ChainID) + suite.True(found) + suite.Equal(uint32(99), zone.WithdrawalWaitgroup) +} + +func (suite *KeeperTestSuite) TestHandleFailedDelegate_PerfAddress_OK() { + suite.SetupTest() + suite.setupTestZones() + + app := suite.GetQuicksilverApp(suite.chainA) + ctx := suite.chainA.GetContext() + + zone, found := app.InterchainstakingKeeper.GetZone(ctx, suite.chainB.ChainID) + suite.True(found) + + zone.WithdrawalWaitgroup = 100 + app.InterchainstakingKeeper.SetZone(ctx, &zone) + + vals := app.InterchainstakingKeeper.GetValidatorAddresses(ctx, suite.chainB.ChainID) + msg := stakingtypes.MsgDelegate{DelegatorAddress: zone.PerformanceAddress.Address, ValidatorAddress: vals[0], Amount: sdk.NewCoin("uatom", sdk.NewInt(100))} + var msgMsg sdk.Msg = &msg + err := app.InterchainstakingKeeper.HandleFailedDelegate(ctx, msgMsg, "batch/12345678") + suite.NoError(err) + + zone, found = app.InterchainstakingKeeper.GetZone(ctx, suite.chainB.ChainID) + suite.True(found) + // delegator was perf address, no change in waitgroup + suite.Equal(uint32(100), zone.WithdrawalWaitgroup) +} + +func (suite *KeeperTestSuite) TestHandleFailedDelegate_NotBatch_OK() { + suite.SetupTest() + suite.setupTestZones() + + app := suite.GetQuicksilverApp(suite.chainA) + ctx := suite.chainA.GetContext() + + zone, found := app.InterchainstakingKeeper.GetZone(ctx, suite.chainB.ChainID) + suite.True(found) + + zone.WithdrawalWaitgroup = 100 + app.InterchainstakingKeeper.SetZone(ctx, &zone) + + vals := app.InterchainstakingKeeper.GetValidatorAddresses(ctx, suite.chainB.ChainID) + msg := stakingtypes.MsgDelegate{DelegatorAddress: zone.DelegationAddress.Address, ValidatorAddress: vals[0], Amount: sdk.NewCoin("uatom", sdk.NewInt(100))} + var msgMsg sdk.Msg = &msg + err := app.InterchainstakingKeeper.HandleFailedDelegate(ctx, msgMsg, randomutils.GenerateRandomHashAsHex(32)) + suite.NoError(err) + + zone, found = app.InterchainstakingKeeper.GetZone(ctx, suite.chainB.ChainID) + suite.True(found) + // memo was not a batch id, so don't decrement withdrawal wg + suite.Equal(uint32(100), zone.WithdrawalWaitgroup) +} + +func (suite *KeeperTestSuite) TestHandleFailedDelegate_BatchTriggerRR_OK() { + suite.SetupTest() + suite.setupTestZones() + + app := suite.GetQuicksilverApp(suite.chainA) + ctx := suite.chainA.GetContext() + + zone, found := app.InterchainstakingKeeper.GetZone(ctx, suite.chainB.ChainID) + suite.True(found) + + zone.WithdrawalWaitgroup = 1 + app.InterchainstakingKeeper.SetZone(ctx, &zone) + preQueries := app.InterchainQueryKeeper.AllQueries(ctx) + + vals := app.InterchainstakingKeeper.GetValidatorAddresses(ctx, suite.chainB.ChainID) + msg := stakingtypes.MsgDelegate{DelegatorAddress: zone.DelegationAddress.Address, ValidatorAddress: vals[0], Amount: sdk.NewCoin("uatom", sdk.NewInt(100))} + var msgMsg sdk.Msg = &msg + err := app.InterchainstakingKeeper.HandleFailedDelegate(ctx, msgMsg, "batch/12345678") + suite.NoError(err) + + zone, found = app.InterchainstakingKeeper.GetZone(ctx, suite.chainB.ChainID) + suite.True(found) + // memo was not a batch id, so don't decrement withdrawal wg + suite.Equal(uint32(0), zone.WithdrawalWaitgroup) + + postQueries := app.InterchainQueryKeeper.AllQueries(ctx) + + // we should have exactly one additional query + suite.Equal(len(postQueries), len(preQueries)+1) + + distributeRewardsPreQueryCount := 0 + distributeRewardsPostQueryCount := 0 + for _, q := range preQueries { + if q.CallbackId == "distributerewards" { + distributeRewardsPreQueryCount++ + } + } + + for _, q := range postQueries { + if q.CallbackId == "distributerewards" { + distributeRewardsPostQueryCount++ + } + } + + suite.Equal(distributeRewardsPostQueryCount, distributeRewardsPreQueryCount+1) +} + +func (suite *KeeperTestSuite) TestHandleFailedDelegate_BadAddr_Fail() { + suite.SetupTest() + suite.setupTestZones() + + app := suite.GetQuicksilverApp(suite.chainA) + ctx := suite.chainA.GetContext() + + zone, found := app.InterchainstakingKeeper.GetZone(ctx, suite.chainB.ChainID) + suite.True(found) + + zone.WithdrawalWaitgroup = 100 + app.InterchainstakingKeeper.SetZone(ctx, &zone) + + vals := app.InterchainstakingKeeper.GetValidatorAddresses(ctx, suite.chainB.ChainID) + msg := stakingtypes.MsgDelegate{DelegatorAddress: addressutils.GenerateAddressForTestWithPrefix("cosmos"), ValidatorAddress: vals[0], Amount: sdk.NewCoin("uatom", sdk.NewInt(100))} + var msgMsg sdk.Msg = &msg + err := app.InterchainstakingKeeper.HandleFailedDelegate(ctx, msgMsg, randomutils.GenerateRandomHashAsHex(32)) + suite.ErrorContains(err, "unable to find zone for address") +} + +func (suite *KeeperTestSuite) TestHandleFailedDelegate_BadMsg_Fail() { + suite.SetupTest() + suite.setupTestZones() + + app := suite.GetQuicksilverApp(suite.chainA) + ctx := suite.chainA.GetContext() + + zone, found := app.InterchainstakingKeeper.GetZone(ctx, suite.chainB.ChainID) + suite.True(found) + + zone.WithdrawalWaitgroup = 100 + app.InterchainstakingKeeper.SetZone(ctx, &zone) + + vals := app.InterchainstakingKeeper.GetValidatorAddresses(ctx, suite.chainB.ChainID) + msg := stakingtypes.MsgBeginRedelegate{DelegatorAddress: zone.DelegationAddress.Address, ValidatorSrcAddress: vals[0], ValidatorDstAddress: vals[1], Amount: sdk.NewCoin("uatom", sdk.NewInt(100))} + var msgMsg sdk.Msg = &msg + err := app.InterchainstakingKeeper.HandleFailedDelegate(ctx, msgMsg, "batch/12345678") + suite.ErrorContains(err, "unable to cast source message to MsgDelegate") +} diff --git a/x/interchainstaking/keeper/keeper.go b/x/interchainstaking/keeper/keeper.go index cda8ba836..10040a5cc 100644 --- a/x/interchainstaking/keeper/keeper.go +++ b/x/interchainstaking/keeper/keeper.go @@ -12,6 +12,7 @@ import ( "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" "github.com/cosmos/cosmos-sdk/store/prefix" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -37,6 +38,7 @@ import ( interchainquerykeeper "github.com/quicksilver-zone/quicksilver/x/interchainquery/keeper" icqtypes "github.com/quicksilver-zone/quicksilver/x/interchainquery/types" "github.com/quicksilver-zone/quicksilver/x/interchainstaking/types" + lsmstakingtypes "github.com/quicksilver-zone/quicksilver/x/lsmtypes" ) // Keeper of this module maintains collections of registered zones. @@ -206,6 +208,7 @@ func (k *Keeper) SetValidatorsForZone(ctx sdk.Context, data []byte, icqQuery icq } if validatorsReq.Pagination == nil { + k.Logger(ctx).Debug("unmarshalled a QueryValidatorsRequest with a nil Pagination", "zone", icqQuery.ChainId) validatorsReq.Pagination = new(query.PageRequest) } validatorsReq.Pagination.Key = validatorsRes.Pagination.NextKey @@ -236,6 +239,18 @@ func (k *Keeper) SetValidatorsForZone(ctx sdk.Context, data []byte, icqQuery icq case !val.DelegatorShares.Equal(validator.DelegatorShares): k.Logger(ctx).Debug("Validator shares amount change; fetching proof", "valoper", validator.OperatorAddress, "from", val.DelegatorShares, "to", validator.DelegatorShares) toQuery = true + case val.Jailed != validator.Jailed: + k.Logger(ctx).Debug("jail status change; fetching proof", "valoper", validator.OperatorAddress, "from", val.Jailed, "to", validator.Jailed) + toQuery = true + case val.Status != validator.Status.String(): + k.Logger(ctx).Debug("bond status change; fetching proof", "valoper", validator.OperatorAddress, "from", val.Status, "to", validator.Status.String()) + toQuery = true + case !validator.LiquidShares.IsNil() && !val.LiquidShares.Equal(validator.LiquidShares): + k.Logger(ctx).Debug("liquid shares amount change; fetching proof", "valoper", validator.OperatorAddress, "from", val.LiquidShares, "to", validator.LiquidShares) + toQuery = true + case !validator.ValidatorBondShares.IsNil() && !val.ValidatorBondShares.Equal(validator.ValidatorBondShares): + k.Logger(ctx).Debug("Validator bond shares amount change; fetching proof", "valoper", validator.OperatorAddress, "from", val.ValidatorBondShares, "to", validator.ValidatorBondShares) + toQuery = true } if toQuery { @@ -267,14 +282,16 @@ func (k *Keeper) SetValidatorForZone(ctx sdk.Context, zone *types.Zone, data []b } val, found := k.GetValidator(ctx, zone.ChainId, valAddrBytes) if !found { - k.Logger(ctx).Info("Unable to find validator - adding...", "valoper", validator.OperatorAddress) + k.Logger(ctx).Debug("Unable to find validator - adding...", "valoper", validator.OperatorAddress) jailTime := time.Time{} if validator.IsJailed() { - consAddr, err := validator.GetConsAddr() + var pk cryptotypes.PubKey + err := k.cdc.UnpackAny(validator.ConsensusPubkey, &pk) if err != nil { return err } + consAddr := sdk.ConsAddress(pk.Address().Bytes()) k.SetValidatorAddrByConsAddr(ctx, zone.ChainId, validator.OperatorAddress, consAddr) jailTime = ctx.BlockTime() @@ -314,10 +331,12 @@ func (k *Keeper) SetValidatorForZone(ctx sdk.Context, zone *types.Zone, data []b if !val.Jailed && validator.IsJailed() { k.Logger(ctx).Info("Transitioning validator to jailed state", "valoper", validator.OperatorAddress, "old_vp", val.VotingPower, "new_vp", validator.Tokens, "new_shares", validator.DelegatorShares, "old_shares", val.DelegatorShares) - consAddr, err := validator.GetConsAddr() + var pk cryptotypes.PubKey + err := k.cdc.UnpackAny(validator.ConsensusPubkey, &pk) if err != nil { return err } + consAddr := sdk.ConsAddress(pk.Address().Bytes()) k.SetValidatorAddrByConsAddr(ctx, zone.ChainId, validator.OperatorAddress, consAddr) err = k.EmitSigningInfoQuery(ctx, zone.ConnectionId, zone.ChainId, validator) @@ -346,7 +365,7 @@ func (k *Keeper) SetValidatorForZone(ctx sdk.Context, zone *types.Zone, data []b return err } } else if val.Jailed && !validator.IsJailed() { - k.Logger(ctx).Info("Transitioning validator to unjailed state", "valoper", validator.OperatorAddress) + k.Logger(ctx).Debug("Transitioning validator to unjailed state", "valoper", validator.OperatorAddress) val.Jailed = false val.JailedSince = time.Time{} @@ -373,6 +392,16 @@ func (k *Keeper) SetValidatorForZone(ctx sdk.Context, zone *types.Zone, data []b val.Status = validator.Status.String() } + if !validator.ValidatorBondShares.IsNil() && !val.ValidatorBondShares.Equal(validator.ValidatorBondShares) { + k.Logger(ctx).Info("Validator bonded shares change; updating", "valoper", validator.OperatorAddress, "oldShares", val.ValidatorBondShares, "newShares", validator.ValidatorBondShares) + val.ValidatorBondShares = validator.ValidatorBondShares + } + + if !validator.LiquidShares.IsNil() && !val.LiquidShares.Equal(validator.LiquidShares) { + k.Logger(ctx).Info("Validator liquid shares change; updating", "valoper", validator.OperatorAddress, "oldShares", val.LiquidShares, "newShares", validator.LiquidShares) + val.LiquidShares = validator.LiquidShares + } + if err := k.SetValidator(ctx, zone.ChainId, val); err != nil { return err } @@ -534,7 +563,7 @@ func (k *Keeper) EmitValSetQuery(ctx sdk.Context, connectionID, chainID string, return nil } -func (k *Keeper) EmitValidatorQuery(ctx sdk.Context, connectionID, chainID string, validator stakingtypes.Validator) error { +func (k *Keeper) EmitValidatorQuery(ctx sdk.Context, connectionID, chainID string, validator lsmstakingtypes.Validator) error { _, addr, err := bech32.DecodeAndConvert(validator.OperatorAddress) if err != nil { return fmt.Errorf("EmitValidatorQuery failed to decode validator.OperatorAddress: %q got error: %w", @@ -579,7 +608,7 @@ func (k *Keeper) EmitDepositIntervalQuery(ctx sdk.Context, zone *types.Zone) { ) } -func (k *Keeper) EmitSigningInfoQuery(ctx sdk.Context, connectionID, chainID string, validator stakingtypes.Validator) error { +func (k *Keeper) EmitSigningInfoQuery(ctx sdk.Context, connectionID, chainID string, validator lsmstakingtypes.Validator) error { _, addr, err := bech32.DecodeAndConvert(validator.OperatorAddress) if err != nil { return err @@ -618,11 +647,9 @@ func (k *Keeper) GetDelegationsInProcess(ctx sdk.Context, chainID string) sdkmat func (k *Keeper) UpdateRedemptionRate(ctx sdk.Context, zone *types.Zone, epochRewards sdkmath.Int) { delegationsInProcess := k.GetDelegationsInProcess(ctx, zone.ChainId) ratio, isZero := k.GetRatio(ctx, zone, epochRewards.Add(delegationsInProcess)) - k.Logger(ctx).Info("Epochly rewards", "coins", epochRewards) - k.Logger(ctx).Info("Last redemption rate", "rate", zone.LastRedemptionRate) - k.Logger(ctx).Info("Current redemption rate", "rate", zone.RedemptionRate) - k.Logger(ctx).Info("New redemption rate", "rate", ratio, "supply", k.BankKeeper.GetSupply(ctx, zone.LocalDenom).Amount, "lv", k.GetDelegatedAmount(ctx, zone).Amount.Add(epochRewards).Add(delegationsInProcess)) + k.Logger(ctx).Info("Redemption Rate Update", "chain", zone.ChainId, "epochly_rewards", epochRewards, "last_rate", zone.LastRedemptionRate, "current_rate", zone.RedemptionRate, "new_rate", ratio, "supply", k.BankKeeper.GetSupply(ctx, zone.LocalDenom).Amount, "lv", k.GetDelegatedAmount(ctx, zone).Amount.Add(epochRewards).Add(delegationsInProcess)) + // TODO: make max deltas params. // soft cap redemption rate, instead of panicking. delta := ratio.Quo(zone.RedemptionRate) if delta.GT(sdk.NewDecWithPrec(102, 2)) { @@ -639,11 +666,11 @@ func (k *Keeper) UpdateRedemptionRate(ctx sdk.Context, zone *types.Zone, epochRe } func (k *Keeper) OverrideRedemptionRateNoCap(ctx sdk.Context, zone *types.Zone) { - ratio, _ := k.GetRatio(ctx, zone, sdk.ZeroInt()) - k.Logger(ctx).Info("Last redemption rate", "rate", zone.LastRedemptionRate) - k.Logger(ctx).Info("Current redemption rate", "rate", zone.RedemptionRate) - k.Logger(ctx).Info("New redemption rate", "rate", ratio, "supply", k.BankKeeper.GetSupply(ctx, zone.LocalDenom).Amount, "lv", k.GetDelegatedAmount(ctx, zone).Amount) + delegationsInProcess := k.GetDelegationsInProcess(ctx, zone.ChainId) + ratio, _ := k.GetRatio(ctx, zone, delegationsInProcess) + k.Logger(ctx).Info("Forced Redemption Rate Update", "chain", zone.ChainId, "last_rate", zone.LastRedemptionRate, "current_rate", zone.RedemptionRate, "new_rate", ratio, "supply", k.BankKeeper.GetSupply(ctx, zone.LocalDenom).Amount, "lv", k.GetDelegatedAmount(ctx, zone).Amount.Add(delegationsInProcess)) + zone.LastRedemptionRate = zone.RedemptionRate zone.RedemptionRate = ratio k.SetZone(ctx, zone) } @@ -652,6 +679,7 @@ func (k *Keeper) GetRatio(ctx sdk.Context, zone *types.Zone, epochRewards sdkmat // native asset amount nativeAssetAmount := k.GetDelegatedAmount(ctx, zone).Amount nativeAssetUnbondingAmount := k.GetUnbondingAmount(ctx, zone).Amount + nativeAssetUnbonded := zone.DelegationAddress.Balance.AmountOf(zone.BaseDenom) // qAsset amount qAssetAmount := k.BankKeeper.GetSupply(ctx, zone.LocalDenom).Amount @@ -663,7 +691,7 @@ func (k *Keeper) GetRatio(ctx sdk.Context, zone *types.Zone, epochRewards sdkmat return sdk.OneDec(), true } - return sdk.NewDecFromInt(nativeAssetAmount.Add(epochRewards).Add(nativeAssetUnbondingAmount)).Quo(sdk.NewDecFromInt(qAssetAmount)), false + return sdk.NewDecFromInt(nativeAssetAmount.Add(epochRewards).Add(nativeAssetUnbondingAmount).Add(nativeAssetUnbonded)).Quo(sdk.NewDecFromInt(qAssetAmount)), false } func (k *Keeper) GetAggregateIntentOrDefault(ctx sdk.Context, zone *types.Zone) (types.ValidatorIntents, error) { @@ -717,7 +745,8 @@ func (k *Keeper) Rebalance(ctx sdk.Context, zone *types.Zone, epochNumber int64) if err != nil { return err } - rebalances := types.DetermineAllocationsForRebalancing(currentAllocations, currentLocked, currentSum, lockedSum, targetAllocations, k.Logger(ctx)) + maxCanAllocate := k.DetermineMaximumValidatorAllocations(ctx, zone) + rebalances := types.DetermineAllocationsForRebalancing(currentAllocations, currentLocked, currentSum, lockedSum, targetAllocations, maxCanAllocate, k.Logger(ctx)).RemoveDuplicates() msgs := make([]sdk.Msg, 0) for _, rebalance := range rebalances { msgs = append(msgs, &stakingtypes.MsgBeginRedelegate{DelegatorAddress: zone.DelegationAddress.Address, ValidatorSrcAddress: rebalance.Source, ValidatorDstAddress: rebalance.Target, Amount: sdk.NewCoin(zone.BaseDenom, rebalance.Amount)}) @@ -730,7 +759,7 @@ func (k *Keeper) Rebalance(ctx sdk.Context, zone *types.Zone, epochNumber int64) }) } if len(msgs) == 0 { - k.Logger(ctx).Info("No rebalancing required") + k.Logger(ctx).Debug("No rebalancing required") return nil } k.Logger(ctx).Info("Send rebalancing messages", "msgs", msgs) @@ -738,8 +767,8 @@ func (k *Keeper) Rebalance(ctx sdk.Context, zone *types.Zone, epochNumber int64) } // UnmarshalValidatorsResponse attempts to umarshal a byte slice into a QueryValidatorsResponse. -func (k *Keeper) UnmarshalValidatorsResponse(data []byte) (stakingtypes.QueryValidatorsResponse, error) { - validatorsRes := stakingtypes.QueryValidatorsResponse{} +func (k *Keeper) UnmarshalValidatorsResponse(data []byte) (lsmstakingtypes.QueryValidatorsResponse, error) { + validatorsRes := lsmstakingtypes.QueryValidatorsResponse{} if len(data) == 0 { return validatorsRes, errors.New("attempted to unmarshal zero length byte slice (8)") } @@ -763,8 +792,8 @@ func (k *Keeper) UnmarshalValidatorsRequest(data []byte) (stakingtypes.QueryVali } // UnmarshalValidator attempts to umarshal a byte slice into a Validator. -func (k *Keeper) UnmarshalValidator(data []byte) (stakingtypes.Validator, error) { - validator := stakingtypes.Validator{} +func (k *Keeper) UnmarshalValidator(data []byte) (lsmstakingtypes.Validator, error) { + validator := lsmstakingtypes.Validator{} if len(data) == 0 { return validator, errors.New("attempted to unmarshal zero length byte slice (9)") } diff --git a/x/interchainstaking/keeper/lsm.go b/x/interchainstaking/keeper/lsm.go new file mode 100644 index 000000000..d5c0d4361 --- /dev/null +++ b/x/interchainstaking/keeper/lsm.go @@ -0,0 +1,167 @@ +package keeper + +import ( + "errors" + + "cosmossdk.io/math" + + "github.com/cosmos/cosmos-sdk/store/prefix" + sdk "github.com/cosmos/cosmos-sdk/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + + "github.com/quicksilver-zone/quicksilver/utils/addressutils" + "github.com/quicksilver-zone/quicksilver/x/interchainstaking/types" +) + +// GetCap returns Cap info by zone and delegator +func (k Keeper) GetLsmCaps(ctx sdk.Context, chainID string) (*types.LsmCaps, bool) { + caps := types.LsmCaps{} + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefixLsmCaps) + bz := store.Get([]byte(chainID)) + if len(bz) == 0 { + return nil, false + } + k.cdc.MustUnmarshal(bz, &caps) + return &caps, true +} + +// SetCap store the delegator Cap +func (k Keeper) SetLsmCaps(ctx sdk.Context, chainID string, caps types.LsmCaps) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefixLsmCaps) + bz := k.cdc.MustMarshal(&caps) + store.Set([]byte(chainID), bz) +} + +// DeleteCap deletes delegator Cap +func (k Keeper) DeleteLsmCaps(ctx sdk.Context, chainID string) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefixLsmCaps) + store.Delete([]byte(chainID)) +} + +// IterateCaps iterate through Caps for a given zone +func (k Keeper) IterateLsmCaps(ctx sdk.Context, fn func(index int64, chainID string, cap types.LsmCaps) (stop bool)) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefixLsmCaps) + + iterator := sdk.KVStorePrefixIterator(store, nil) + defer iterator.Close() + + i := int64(0) + + for ; iterator.Valid(); iterator.Next() { + caps := types.LsmCaps{} + k.cdc.MustUnmarshal(iterator.Value(), &caps) + + stop := fn(i, string(iterator.Key()), caps) + + if stop { + break + } + i++ + } +} + +// AllCaps returns every Cap in the store for the specified zone +func (k Keeper) AllLsmCaps(ctx sdk.Context) map[string]types.LsmCaps { + allCaps := map[string]types.LsmCaps{} + k.IterateLsmCaps(ctx, func(_ int64, chainID string, caps types.LsmCaps) (stop bool) { + allCaps[chainID] = caps + return false + }) + return allCaps +} + +func (k Keeper) GetLiquidStakedSupply(ctx sdk.Context, zone *types.Zone) sdk.Dec { + out := sdk.ZeroDec() + for _, val := range k.GetActiveValidators(ctx, zone.ChainId) { + if val.Status == stakingtypes.BondStatusBonded { + out = out.Add(val.LiquidShares) + } + } + return out +} + +func (k Keeper) GetTotalStakedSupply(ctx sdk.Context, zone *types.Zone) math.Int { + out := sdk.ZeroInt() + for _, val := range k.GetActiveValidators(ctx, zone.ChainId) { + if val.Status == stakingtypes.BondStatusBonded { + out = out.Add(val.VotingPower) + } + } + return out +} + +func (k Keeper) CheckExceedsGlobalCap(ctx sdk.Context, zone *types.Zone, amount math.Int) bool { + caps, found := k.GetLsmCaps(ctx, zone.ChainId) + if !found { + // no caps found, permit + return false + } + + liquidSupply := k.GetLiquidStakedSupply(ctx, zone) + totalSupply := sdk.NewDecFromInt(k.GetTotalStakedSupply(ctx, zone)) + amountDec := sdk.NewDecFromInt(amount) + return liquidSupply.Add(amountDec).Quo(totalSupply).GT(caps.GlobalCap) +} + +func (k Keeper) CheckExceedsValidatorCap(ctx sdk.Context, zone *types.Zone, validator string, amount math.Int) error { + // Retrieve the caps for the given zone + caps, found := k.GetLsmCaps(ctx, zone.ChainId) + if !found { + // No cap found, permit the transaction + return nil + } + + // Retrieve the validator's information + valAddrBytes, err := addressutils.ValAddressFromBech32(validator, zone.GetValoperPrefix()) + if err != nil { + return err + } + + val, found := k.GetValidator(ctx, zone.ChainId, valAddrBytes) + if !found { + // Validator not found, throw an error + return errors.New("validator not found") + } + + // Calculate the liquid shares and tokens + amountDec := sdk.NewDecFromInt(amount) + liquidShares := val.LiquidShares.Add(amountDec) + tokens := sdk.NewDecFromInt(val.VotingPower).Add(amountDec) + + if liquidShares.Quo(tokens).GT(caps.ValidatorCap) { + return errors.New("exceeds validator cap") + } + + return nil +} + +func (k Keeper) CheckExceedsValidatorBondCap(ctx sdk.Context, zone *types.Zone, validator string, amount math.Int) error { + caps, found := k.GetLsmCaps(ctx, zone.ChainId) + if !found { + // no caps found, permit + return nil + } + + // Retrieve the validator's information + valAddrBytes, err := addressutils.ValAddressFromBech32(validator, zone.GetValoperPrefix()) + if err != nil { + return err + } + + val, found := k.GetValidator(ctx, zone.ChainId, valAddrBytes) + if !found { + // cannot find validator, do not allow to proceed. + return errors.New("validator not found") + } + + maxShares := val.ValidatorBondShares.Mul(caps.ValidatorBondCap) + + amountDec := sdk.NewDecFromInt(amount) + liquidShares := val.LiquidShares.Add(amountDec) + + if liquidShares.GT(maxShares) { + return errors.New("exceeds validator bond cap") + } + + return nil +} diff --git a/x/interchainstaking/keeper/lsm_test.go b/x/interchainstaking/keeper/lsm_test.go new file mode 100644 index 000000000..9c1ffeb0f --- /dev/null +++ b/x/interchainstaking/keeper/lsm_test.go @@ -0,0 +1,464 @@ +package keeper_test + +import ( + "cosmossdk.io/math" + + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/quicksilver-zone/quicksilver/x/interchainstaking/keeper" + "github.com/quicksilver-zone/quicksilver/x/interchainstaking/types" +) + +const BondStatusUnbonded = "BOND_STATUS_UNBONDED" + +func (suite *KeeperTestSuite) TestLsmSetGetDelete() { + suite.SetupTest() + suite.setupTestZones() + + icsKeeper := suite.GetQuicksilverApp(suite.chainA).InterchainstakingKeeper + ctx := suite.chainA.GetContext() + + caps, found := icsKeeper.GetLsmCaps(ctx, suite.chainB.ChainID) + suite.False(found) + suite.Nil(caps) + + allCaps := icsKeeper.AllLsmCaps(ctx) + suite.Equal(0, len(allCaps)) + + icsKeeper.SetLsmCaps(ctx, suite.chainB.ChainID, types.LsmCaps{ValidatorCap: sdk.NewDecWithPrec(50, 2), GlobalCap: sdk.NewDecWithPrec(25, 2), ValidatorBondCap: sdk.NewDec(500)}) + + caps, found = icsKeeper.GetLsmCaps(ctx, suite.chainB.ChainID) + suite.True(found) + suite.Equal(caps.ValidatorBondCap, sdk.NewDec(500)) + + allCaps = icsKeeper.AllLsmCaps(ctx) + suite.Equal(1, len(allCaps)) + + icsKeeper.DeleteLsmCaps(ctx, suite.chainB.ChainID) + + caps, found = icsKeeper.GetLsmCaps(ctx, suite.chainB.ChainID) + suite.False(found) + suite.Nil(caps) + + allCaps = icsKeeper.AllLsmCaps(ctx) + suite.Equal(0, len(allCaps)) +} + +func (suite *KeeperTestSuite) TestGetTotalStakedSupply() { + suite.SetupTest() + suite.setupTestZones() + tcs := []struct { + Name string + Malleate func(icsKeeper *keeper.Keeper) + Expect math.Int + }{ + { + Name: "4x 1000000 VP bonded", + Malleate: func(icsKeeper *keeper.Keeper) { + ctx := suite.chainA.GetContext() + validators := icsKeeper.GetValidators(ctx, suite.chainB.ChainID) + validators[0].VotingPower = math.NewInt(1000000) + validators[1].VotingPower = math.NewInt(1000000) + validators[2].VotingPower = math.NewInt(1000000) + validators[3].VotingPower = math.NewInt(1000000) + suite.NoError(icsKeeper.SetValidator(ctx, suite.chainB.ChainID, validators[0])) + suite.NoError(icsKeeper.SetValidator(ctx, suite.chainB.ChainID, validators[1])) + suite.NoError(icsKeeper.SetValidator(ctx, suite.chainB.ChainID, validators[2])) + suite.NoError(icsKeeper.SetValidator(ctx, suite.chainB.ChainID, validators[3])) + }, + Expect: sdk.NewInt(4000000), + }, + { + Name: "3x 1000000 VP bonded, 1x 1000000 unbonded", + Malleate: func(icsKeeper *keeper.Keeper) { + ctx := suite.chainA.GetContext() + validators := icsKeeper.GetValidators(ctx, suite.chainB.ChainID) + validators[0].VotingPower = math.NewInt(1000000) + validators[1].VotingPower = math.NewInt(1000000) + validators[2].VotingPower = math.NewInt(1000000) + validators[3].VotingPower = math.NewInt(1000000) + validators[3].Status = BondStatusUnbonded + suite.NoError(icsKeeper.SetValidator(ctx, suite.chainB.ChainID, validators[0])) + suite.NoError(icsKeeper.SetValidator(ctx, suite.chainB.ChainID, validators[1])) + suite.NoError(icsKeeper.SetValidator(ctx, suite.chainB.ChainID, validators[2])) + suite.NoError(icsKeeper.SetValidator(ctx, suite.chainB.ChainID, validators[3])) + }, + Expect: sdk.NewInt(3000000), + }, + { + Name: "different vps, total 10000000", + Malleate: func(icsKeeper *keeper.Keeper) { + ctx := suite.chainA.GetContext() + validators := icsKeeper.GetValidators(ctx, suite.chainB.ChainID) + validators[0].VotingPower = math.NewInt(5000000) + validators[1].VotingPower = math.NewInt(3000000) + validators[2].VotingPower = math.NewInt(2000000) + validators[3].VotingPower = math.NewInt(1000000) + validators[3].Status = BondStatusUnbonded + suite.NoError(icsKeeper.SetValidator(ctx, suite.chainB.ChainID, validators[0])) + suite.NoError(icsKeeper.SetValidator(ctx, suite.chainB.ChainID, validators[1])) + suite.NoError(icsKeeper.SetValidator(ctx, suite.chainB.ChainID, validators[2])) + suite.NoError(icsKeeper.SetValidator(ctx, suite.chainB.ChainID, validators[3])) + }, + Expect: sdk.NewInt(10000000), + }, + } + for _, t := range tcs { + suite.Run(t.Name, func() { + icsKeeper := suite.GetQuicksilverApp(suite.chainA).InterchainstakingKeeper + ctx := suite.chainA.GetContext() + t.Malleate(icsKeeper) + zone, found := icsKeeper.GetZone(ctx, suite.chainB.ChainID) + suite.True(found) + suite.Equal(icsKeeper.GetTotalStakedSupply(ctx, &zone), t.Expect) + }) + } +} + +func (suite *KeeperTestSuite) TestGetLiquidStakedSupply() { + tcs := []struct { + Name string + Malleate func(icsKeeper *keeper.Keeper) + Expect sdk.Dec + }{ + { + Name: "4x 1000000 VP bonded, 0 liquid", + Malleate: func(icsKeeper *keeper.Keeper) { + ctx := suite.chainA.GetContext() + validators := icsKeeper.GetValidators(ctx, suite.chainB.ChainID) + validators[0].LiquidShares = sdk.ZeroDec() + validators[1].LiquidShares = sdk.ZeroDec() + validators[2].LiquidShares = sdk.ZeroDec() + validators[3].LiquidShares = sdk.ZeroDec() + suite.NoError(icsKeeper.SetValidator(ctx, suite.chainB.ChainID, validators[0])) + suite.NoError(icsKeeper.SetValidator(ctx, suite.chainB.ChainID, validators[1])) + suite.NoError(icsKeeper.SetValidator(ctx, suite.chainB.ChainID, validators[2])) + suite.NoError(icsKeeper.SetValidator(ctx, suite.chainB.ChainID, validators[3])) + }, + Expect: sdk.ZeroDec(), + }, + { + Name: "3x 1000000 VP bonded, 1x 1000000 unbonded", + Malleate: func(icsKeeper *keeper.Keeper) { + ctx := suite.chainA.GetContext() + validators := icsKeeper.GetValidators(ctx, suite.chainB.ChainID) + validators[0].LiquidShares = sdk.ZeroDec() + validators[1].LiquidShares = sdk.NewDec(5000) + validators[2].LiquidShares = sdk.NewDec(5000) + validators[3].LiquidShares = sdk.ZeroDec() + suite.NoError(icsKeeper.SetValidator(ctx, suite.chainB.ChainID, validators[0])) + suite.NoError(icsKeeper.SetValidator(ctx, suite.chainB.ChainID, validators[1])) + suite.NoError(icsKeeper.SetValidator(ctx, suite.chainB.ChainID, validators[2])) + suite.NoError(icsKeeper.SetValidator(ctx, suite.chainB.ChainID, validators[3])) + }, + Expect: sdk.NewDec(10000), + }, + { + Name: "different vps, total 10000000", + Malleate: func(icsKeeper *keeper.Keeper) { + ctx := suite.chainA.GetContext() + validators := icsKeeper.GetValidators(ctx, suite.chainB.ChainID) + validators[0].LiquidShares = sdk.NewDec(1000) + validators[1].LiquidShares = sdk.NewDec(2000) + validators[2].LiquidShares = sdk.NewDec(3000) + validators[3].LiquidShares = sdk.NewDec(5000) + validators[3].Status = BondStatusUnbonded + suite.NoError(icsKeeper.SetValidator(ctx, suite.chainB.ChainID, validators[0])) + suite.NoError(icsKeeper.SetValidator(ctx, suite.chainB.ChainID, validators[1])) + suite.NoError(icsKeeper.SetValidator(ctx, suite.chainB.ChainID, validators[2])) + suite.NoError(icsKeeper.SetValidator(ctx, suite.chainB.ChainID, validators[3])) + }, + Expect: sdk.NewDec(6000), + }, + } + for _, t := range tcs { + suite.Run(t.Name, func() { + suite.SetupTest() + suite.setupTestZones() + icsKeeper := suite.GetQuicksilverApp(suite.chainA).InterchainstakingKeeper + ctx := suite.chainA.GetContext() + t.Malleate(icsKeeper) + zone, found := icsKeeper.GetZone(ctx, suite.chainB.ChainID) + suite.True(found) + suite.Equal(icsKeeper.GetLiquidStakedSupply(ctx, &zone), t.Expect) + }) + } +} + +func (suite *KeeperTestSuite) TestCheckExceedsGlobalCap() { + tcs := []struct { + Name string + Malleate func(icsKeeper *keeper.Keeper) + Expect bool + }{ + { + Name: "cap 5%, liquid 2% + 1; expect false", + Malleate: func(icsKeeper *keeper.Keeper) { + ctx := suite.chainA.GetContext() + validators := icsKeeper.GetValidators(ctx, suite.chainB.ChainID) + validators[0].VotingPower = math.NewInt(1000) + validators[1].VotingPower = math.NewInt(1000) + validators[2].VotingPower = math.NewInt(1000) + validators[3].VotingPower = math.NewInt(1000) + validators[0].LiquidShares = sdk.ZeroDec() + validators[1].LiquidShares = sdk.NewDec(80) + validators[2].LiquidShares = sdk.ZeroDec() + validators[3].LiquidShares = sdk.ZeroDec() + suite.NoError(icsKeeper.SetValidator(ctx, suite.chainB.ChainID, validators[0])) + suite.NoError(icsKeeper.SetValidator(ctx, suite.chainB.ChainID, validators[1])) + suite.NoError(icsKeeper.SetValidator(ctx, suite.chainB.ChainID, validators[2])) + suite.NoError(icsKeeper.SetValidator(ctx, suite.chainB.ChainID, validators[3])) + icsKeeper.SetLsmCaps(ctx, suite.chainB.ChainID, + types.LsmCaps{ + ValidatorCap: sdk.NewDecWithPrec(50, 2), + ValidatorBondCap: sdk.NewDec(500), + GlobalCap: sdk.NewDecWithPrec(5, 2), + }) + }, + Expect: false, + }, + { + Name: "cap 5%, liquid 5% + 1; expect true", + Malleate: func(icsKeeper *keeper.Keeper) { + ctx := suite.chainA.GetContext() + validators := icsKeeper.GetValidators(ctx, suite.chainB.ChainID) + validators[0].VotingPower = math.NewInt(1000) + validators[1].VotingPower = math.NewInt(1000) + validators[2].VotingPower = math.NewInt(1000) + validators[3].VotingPower = math.NewInt(1000) + validators[0].LiquidShares = sdk.ZeroDec() + validators[1].LiquidShares = sdk.NewDec(60) + validators[2].LiquidShares = sdk.NewDec(60) + validators[3].LiquidShares = sdk.NewDec(80) + suite.NoError(icsKeeper.SetValidator(ctx, suite.chainB.ChainID, validators[0])) + suite.NoError(icsKeeper.SetValidator(ctx, suite.chainB.ChainID, validators[1])) + suite.NoError(icsKeeper.SetValidator(ctx, suite.chainB.ChainID, validators[2])) + suite.NoError(icsKeeper.SetValidator(ctx, suite.chainB.ChainID, validators[3])) + icsKeeper.SetLsmCaps(ctx, suite.chainB.ChainID, + types.LsmCaps{ + ValidatorCap: sdk.NewDecWithPrec(50, 2), + ValidatorBondCap: sdk.NewDec(500), + GlobalCap: sdk.NewDecWithPrec(5, 2), + }) + }, + Expect: true, + }, + { + Name: "no cap set, expect false", + Malleate: func(icsKeeper *keeper.Keeper) { + ctx := suite.chainA.GetContext() + validators := icsKeeper.GetValidators(ctx, suite.chainB.ChainID) + validators[0].VotingPower = math.NewInt(1000) + validators[1].VotingPower = math.NewInt(1000) + validators[2].VotingPower = math.NewInt(1000) + validators[3].VotingPower = math.NewInt(1000) + validators[0].LiquidShares = sdk.ZeroDec() + validators[1].LiquidShares = sdk.NewDec(20) + validators[2].LiquidShares = sdk.NewDec(20) + validators[3].LiquidShares = sdk.NewDec(10) + suite.NoError(icsKeeper.SetValidator(ctx, suite.chainB.ChainID, validators[0])) + suite.NoError(icsKeeper.SetValidator(ctx, suite.chainB.ChainID, validators[1])) + suite.NoError(icsKeeper.SetValidator(ctx, suite.chainB.ChainID, validators[2])) + suite.NoError(icsKeeper.SetValidator(ctx, suite.chainB.ChainID, validators[3])) + }, + Expect: false, + }, + } + for _, t := range tcs { + suite.Run(t.Name, func() { + suite.SetupTest() + suite.setupTestZones() + icsKeeper := suite.GetQuicksilverApp(suite.chainA).InterchainstakingKeeper + ctx := suite.chainA.GetContext() + t.Malleate(icsKeeper) + zone, found := icsKeeper.GetZone(ctx, suite.chainB.ChainID) + suite.True(found) + suite.Equal(t.Expect, icsKeeper.CheckExceedsGlobalCap(ctx, &zone, sdk.NewInt(1))) + }) + } +} + +func (suite *KeeperTestSuite) TestCheckExceedsValidatorCap() { + tcs := []struct { + Name string + Malleate func(icsKeeper *keeper.Keeper) + ExpectErr bool + }{ + { + Name: "cap 50%, liquid 2% + 1; expect false", + Malleate: func(icsKeeper *keeper.Keeper) { + ctx := suite.chainA.GetContext() + validators := icsKeeper.GetValidators(ctx, suite.chainB.ChainID) + validators[0].VotingPower = math.NewInt(1000) + validators[1].VotingPower = math.NewInt(1000) + validators[2].VotingPower = math.NewInt(1000) + validators[3].VotingPower = math.NewInt(1000) + validators[0].LiquidShares = sdk.ZeroDec() + validators[1].LiquidShares = sdk.NewDec(20) + validators[2].LiquidShares = sdk.ZeroDec() + validators[3].LiquidShares = sdk.ZeroDec() + suite.NoError(icsKeeper.SetValidator(ctx, suite.chainB.ChainID, validators[0])) + suite.NoError(icsKeeper.SetValidator(ctx, suite.chainB.ChainID, validators[1])) + suite.NoError(icsKeeper.SetValidator(ctx, suite.chainB.ChainID, validators[2])) + suite.NoError(icsKeeper.SetValidator(ctx, suite.chainB.ChainID, validators[3])) + + icsKeeper.SetLsmCaps(ctx, suite.chainB.ChainID, + types.LsmCaps{ + ValidatorCap: sdk.NewDecWithPrec(50, 2), + ValidatorBondCap: sdk.NewDec(500), + GlobalCap: sdk.NewDecWithPrec(5, 2), + }) + }, + ExpectErr: false, + }, + { + Name: "cap 50%, liquid 60% + 1; expect true", + Malleate: func(icsKeeper *keeper.Keeper) { + ctx := suite.chainA.GetContext() + validators := icsKeeper.GetValidators(ctx, suite.chainB.ChainID) + validators[0].VotingPower = math.NewInt(1000) + validators[1].VotingPower = math.NewInt(1000) + validators[2].VotingPower = math.NewInt(1000) + validators[3].VotingPower = math.NewInt(1000) + validators[0].LiquidShares = sdk.ZeroDec() + validators[1].LiquidShares = sdk.NewDec(600) + validators[2].LiquidShares = sdk.NewDec(20) + validators[3].LiquidShares = sdk.NewDec(10) + suite.NoError(icsKeeper.SetValidator(ctx, suite.chainB.ChainID, validators[0])) + suite.NoError(icsKeeper.SetValidator(ctx, suite.chainB.ChainID, validators[1])) + suite.NoError(icsKeeper.SetValidator(ctx, suite.chainB.ChainID, validators[2])) + suite.NoError(icsKeeper.SetValidator(ctx, suite.chainB.ChainID, validators[3])) + + icsKeeper.SetLsmCaps(ctx, suite.chainB.ChainID, + types.LsmCaps{ + ValidatorCap: sdk.NewDecWithPrec(50, 2), + ValidatorBondCap: sdk.NewDec(500), + GlobalCap: sdk.NewDecWithPrec(5, 2), + }) + }, + ExpectErr: true, + }, + { + Name: "no cap set, expect false", + Malleate: func(icsKeeper *keeper.Keeper) { + ctx := suite.chainA.GetContext() + validators := icsKeeper.GetValidators(ctx, suite.chainB.ChainID) + validators[0].VotingPower = math.NewInt(1000) + validators[1].VotingPower = math.NewInt(1000) + validators[2].VotingPower = math.NewInt(1000) + validators[3].VotingPower = math.NewInt(1000) + validators[0].LiquidShares = sdk.ZeroDec() + validators[1].LiquidShares = sdk.NewDec(600) + validators[2].LiquidShares = sdk.NewDec(20) + validators[3].LiquidShares = sdk.NewDec(10) + suite.NoError(icsKeeper.SetValidator(ctx, suite.chainB.ChainID, validators[0])) + suite.NoError(icsKeeper.SetValidator(ctx, suite.chainB.ChainID, validators[1])) + suite.NoError(icsKeeper.SetValidator(ctx, suite.chainB.ChainID, validators[2])) + suite.NoError(icsKeeper.SetValidator(ctx, suite.chainB.ChainID, validators[3])) + }, + ExpectErr: false, + }, + } + for _, t := range tcs { + suite.Run(t.Name, func() { + suite.SetupTest() + suite.setupTestZones() + icsKeeper := suite.GetQuicksilverApp(suite.chainA).InterchainstakingKeeper + ctx := suite.chainA.GetContext() + t.Malleate(icsKeeper) + validators := icsKeeper.GetValidators(ctx, suite.chainB.ChainID) + zone, found := icsKeeper.GetZone(ctx, suite.chainB.ChainID) + suite.True(found) + if t.ExpectErr { + suite.Error(icsKeeper.CheckExceedsValidatorCap(ctx, &zone, validators[1].ValoperAddress, sdk.NewInt(1))) + } else { + suite.NoError(icsKeeper.CheckExceedsValidatorCap(ctx, &zone, validators[1].ValoperAddress, sdk.NewInt(1))) + } + }) + } +} + +func (suite *KeeperTestSuite) TestCheckExceedsValidatorBondCap() { + tcs := []struct { + Name string + Malleate func(icsKeeper *keeper.Keeper) + ExpectErr bool + }{ + { + Name: "valbond 5, multiplier 100, ls 400; expect false", + Malleate: func(icsKeeper *keeper.Keeper) { + ctx := suite.chainA.GetContext() + validators := icsKeeper.GetValidators(ctx, suite.chainB.ChainID) + validators[0].VotingPower = math.NewInt(1000) + validators[0].LiquidShares = sdk.NewDec(400) + validators[0].ValidatorBondShares = sdk.NewDec(5) + suite.NoError(icsKeeper.SetValidator(ctx, suite.chainB.ChainID, validators[0])) + suite.NoError(icsKeeper.SetValidator(ctx, suite.chainB.ChainID, validators[1])) + suite.NoError(icsKeeper.SetValidator(ctx, suite.chainB.ChainID, validators[2])) + suite.NoError(icsKeeper.SetValidator(ctx, suite.chainB.ChainID, validators[3])) + + icsKeeper.SetLsmCaps(ctx, suite.chainB.ChainID, + types.LsmCaps{ + ValidatorCap: sdk.NewDecWithPrec(50, 2), + ValidatorBondCap: sdk.NewDec(100), + GlobalCap: sdk.NewDecWithPrec(5, 2), + }) + }, + ExpectErr: false, + }, + { + Name: "valbond 5, multiplier 100, ls 500; expect true", + Malleate: func(icsKeeper *keeper.Keeper) { + ctx := suite.chainA.GetContext() + validators := icsKeeper.GetValidators(ctx, suite.chainB.ChainID) + validators[0].VotingPower = math.NewInt(1000) + validators[0].LiquidShares = sdk.NewDec(500) + validators[0].ValidatorBondShares = sdk.NewDec(5) + suite.NoError(icsKeeper.SetValidator(ctx, suite.chainB.ChainID, validators[0])) + suite.NoError(icsKeeper.SetValidator(ctx, suite.chainB.ChainID, validators[1])) + suite.NoError(icsKeeper.SetValidator(ctx, suite.chainB.ChainID, validators[2])) + suite.NoError(icsKeeper.SetValidator(ctx, suite.chainB.ChainID, validators[3])) + + icsKeeper.SetLsmCaps(ctx, suite.chainB.ChainID, + types.LsmCaps{ + ValidatorCap: sdk.NewDecWithPrec(50, 2), + ValidatorBondCap: sdk.NewDec(100), + GlobalCap: sdk.NewDecWithPrec(5, 2), + }) + }, + ExpectErr: true, + }, + { + Name: "no cap set, expect false", + Malleate: func(icsKeeper *keeper.Keeper) { + ctx := suite.chainA.GetContext() + validators := icsKeeper.GetValidators(ctx, suite.chainB.ChainID) + validators[0].VotingPower = math.NewInt(1000) + validators[0].LiquidShares = sdk.NewDec(500) + validators[0].ValidatorBondShares = sdk.NewDec(5) + suite.NoError(icsKeeper.SetValidator(ctx, suite.chainB.ChainID, validators[0])) + suite.NoError(icsKeeper.SetValidator(ctx, suite.chainB.ChainID, validators[1])) + suite.NoError(icsKeeper.SetValidator(ctx, suite.chainB.ChainID, validators[2])) + suite.NoError(icsKeeper.SetValidator(ctx, suite.chainB.ChainID, validators[3])) + }, + ExpectErr: false, + }, + } + for _, t := range tcs { + suite.Run(t.Name, func() { + suite.SetupTest() + suite.setupTestZones() + icsKeeper := suite.GetQuicksilverApp(suite.chainA).InterchainstakingKeeper + ctx := suite.chainA.GetContext() + t.Malleate(icsKeeper) + zone, found := icsKeeper.GetZone(ctx, suite.chainB.ChainID) + suite.True(found) + validators := icsKeeper.GetValidators(ctx, suite.chainB.ChainID) + if t.ExpectErr { + suite.Error(icsKeeper.CheckExceedsValidatorBondCap(ctx, &zone, validators[0].ValoperAddress, math.NewInt(1))) + } else { + suite.NoError(icsKeeper.CheckExceedsValidatorBondCap(ctx, &zone, validators[0].ValoperAddress, math.NewInt(1))) + } + }) + } +} diff --git a/x/interchainstaking/keeper/msg_server.go b/x/interchainstaking/keeper/msg_server.go index 6f78742b8..d9fac679b 100644 --- a/x/interchainstaking/keeper/msg_server.go +++ b/x/interchainstaking/keeper/msg_server.go @@ -22,8 +22,8 @@ type msgServer struct { // NewMsgServerImpl returns an implementation of the interchainstaking // MsgServer interface for the provided Keeper. -func NewMsgServerImpl(keeper Keeper) types.MsgServer { - return &msgServer{Keeper: &keeper} +func NewMsgServerImpl(keeper *Keeper) types.MsgServer { + return &msgServer{Keeper: keeper} } var _ types.MsgServer = msgServer{} @@ -173,11 +173,11 @@ func (k msgServer) GovReopenChannel(goCtx context.Context, msg *types.MsgGovReop } if _, found := k.GetZone(ctx, chainID); !found { - return &types.MsgGovReopenChannelResponse{}, errors.New("invalid port format; zone not found") + return nil, errors.New("invalid port format; zone not found") } if err := k.Keeper.registerInterchainAccount(ctx, msg.ConnectionId, portID); err != nil { - return &types.MsgGovReopenChannelResponse{}, err + return nil, err } ctx.EventManager().EmitEvents(sdk.Events{ @@ -201,7 +201,7 @@ func (k msgServer) GovCloseChannel(goCtx context.Context, msg *types.MsgGovClose // checking msg authority is the gov module address if k.Keeper.GetGovAuthority(ctx) != msg.Authority { - return &types.MsgGovCloseChannelResponse{}, + return nil, govtypes.ErrInvalidSigner.Wrapf( "invalid authority: expected %s, got %s", k.Keeper.GetGovAuthority(ctx), msg.Authority, @@ -210,11 +210,11 @@ func (k msgServer) GovCloseChannel(goCtx context.Context, msg *types.MsgGovClose _, capability, err := k.Keeper.IBCKeeper.ChannelKeeper.LookupModuleByChannel(ctx, msg.PortId, msg.ChannelId) if err != nil { - return &types.MsgGovCloseChannelResponse{}, err + return nil, err } if err := k.IBCKeeper.ChannelKeeper.ChanCloseInit(ctx, msg.PortId, msg.ChannelId, capability); err != nil { - return &types.MsgGovCloseChannelResponse{}, err + return nil, err } ctx.EventManager().EmitEvents(sdk.Events{ @@ -231,3 +231,50 @@ func (k msgServer) GovCloseChannel(goCtx context.Context, msg *types.MsgGovClose return &types.MsgGovCloseChannelResponse{}, nil } + +// GovSetLsmCaps set the liquid staking caps for a given chain. +func (k msgServer) GovSetLsmCaps(goCtx context.Context, msg *types.MsgGovSetLsmCaps) (*types.MsgGovSetLsmCapsResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + // checking msg authority is the gov module address + if k.Keeper.GetGovAuthority(ctx) != msg.Authority { + return nil, + govtypes.ErrInvalidSigner.Wrapf( + "invalid authority: expected %s, got %s", + k.Keeper.GetGovAuthority(ctx), msg.Authority, + ) + } + + zone, found := k.Keeper.GetZone(ctx, msg.ChainId) + if !found { + return nil, + fmt.Errorf( + "no zone found for: %s", + msg.ChainId, + ) + } + if !zone.SupportLsm() { + return nil, + fmt.Errorf( + "zone %s does not have LSM support enabled", + msg.ChainId, + ) + } + + k.SetLsmCaps(ctx, zone.ChainId, *msg.Caps) + + ctx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), + ), + sdk.NewEvent( + types.EventTypeSetLsmCaps, + sdk.NewAttribute(types.AttributeLsmValidatorCap, msg.Caps.ValidatorCap.String()), + sdk.NewAttribute(types.AttributeLsmValidatorBondCap, msg.Caps.ValidatorBondCap.String()), + sdk.NewAttribute(types.AttributeLsmGlobalCap, msg.Caps.GlobalCap.String()), + ), + }) + + return &types.MsgGovSetLsmCapsResponse{}, nil +} diff --git a/x/interchainstaking/keeper/msg_server_test.go b/x/interchainstaking/keeper/msg_server_test.go index c4bcda327..d6ecfb04d 100644 --- a/x/interchainstaking/keeper/msg_server_test.go +++ b/x/interchainstaking/keeper/msg_server_test.go @@ -289,7 +289,7 @@ func (suite *KeeperTestSuite) TestRequestRedemption() { tt.malleate() - msgSrv := icskeeper.NewMsgServerImpl(*suite.GetQuicksilverApp(suite.chainA).InterchainstakingKeeper) + msgSrv := icskeeper.NewMsgServerImpl(suite.GetQuicksilverApp(suite.chainA).InterchainstakingKeeper) res, err := msgSrv.RequestRedemption(sdk.WrapSDKContext(suite.chainA.GetContext()), &msg) if tt.expectErr != "" { @@ -339,7 +339,7 @@ func (suite *KeeperTestSuite) TestRequestRedemption() { tt.malleate() - msgSrv := icskeeper.NewMsgServerImpl(*suite.GetQuicksilverApp(suite.chainA).InterchainstakingKeeper) + msgSrv := icskeeper.NewMsgServerImpl(suite.GetQuicksilverApp(suite.chainA).InterchainstakingKeeper) res, err := msgSrv.RequestRedemption(sdk.WrapSDKContext(suite.chainA.GetContext()), &msg) if tt.expectErrLsm != "" { @@ -470,7 +470,7 @@ func (suite *KeeperTestSuite) TestSignalIntent() { } suite.NoError(err) - msgSrv := icskeeper.NewMsgServerImpl(*suite.GetQuicksilverApp(suite.chainA).InterchainstakingKeeper) + msgSrv := icskeeper.NewMsgServerImpl(suite.GetQuicksilverApp(suite.chainA).InterchainstakingKeeper) res, err := msgSrv.SignalIntent(sdk.WrapSDKContext(suite.chainA.GetContext()), msg) if tt.expectErr { suite.Error(err) @@ -570,7 +570,7 @@ func (suite *KeeperTestSuite) TestGovCloseChannel() { suite.setupTestZones() msg := tc.malleate(suite) - msgSrv := icskeeper.NewMsgServerImpl(*suite.GetQuicksilverApp(suite.chainA).InterchainstakingKeeper) + msgSrv := icskeeper.NewMsgServerImpl(suite.GetQuicksilverApp(suite.chainA).InterchainstakingKeeper) ctx := suite.chainA.GetContext() _, err := msgSrv.GovCloseChannel(ctx, msg) @@ -673,7 +673,7 @@ func (suite *KeeperTestSuite) TestGovReopenChannel() { suite.setupTestZones() msg := tc.malleate(suite) - msgSrv := icskeeper.NewMsgServerImpl(*suite.GetQuicksilverApp(suite.chainA).InterchainstakingKeeper) + msgSrv := icskeeper.NewMsgServerImpl(suite.GetQuicksilverApp(suite.chainA).InterchainstakingKeeper) ctx := suite.chainA.GetContext() _, err := msgSrv.GovReopenChannel(ctx, msg) @@ -690,3 +690,112 @@ func (suite *KeeperTestSuite) TestGovReopenChannel() { }) } } + +func (suite *KeeperTestSuite) TestSetLsmCaps() { + tests := []struct { + name string + malleate func(s *KeeperTestSuite) *icstypes.MsgGovSetLsmCaps + expectErr bool + }{ + { + "invalid authority", + func(s *KeeperTestSuite) *icstypes.MsgGovSetLsmCaps { + return &icstypes.MsgGovSetLsmCaps{ + ChainId: s.chainB.ChainID, + Caps: &icstypes.LsmCaps{ + ValidatorCap: sdk.NewDecWithPrec(50, 2), + ValidatorBondCap: sdk.NewDec(250), + GlobalCap: sdk.NewDecWithPrec(25, 2), + }, + Authority: testAddress, + } + }, + true, + }, + { + "invalid zone", + func(s *KeeperTestSuite) *icstypes.MsgGovSetLsmCaps { + return &icstypes.MsgGovSetLsmCaps{ + ChainId: "unknownzone-1", + Caps: &icstypes.LsmCaps{ + ValidatorCap: sdk.NewDecWithPrec(50, 2), + ValidatorBondCap: sdk.NewDec(250), + GlobalCap: sdk.NewDecWithPrec(25, 2), + }, + Authority: testAddress, + } + }, + true, + }, + { + "non lsm zone", + func(s *KeeperTestSuite) *icstypes.MsgGovSetLsmCaps { + zone, _ := s.GetQuicksilverApp(s.chainA).InterchainstakingKeeper.GetZone(s.chainA.GetContext(), s.chainB.ChainID) + zone.LiquidityModule = false + s.GetQuicksilverApp(s.chainA).InterchainstakingKeeper.SetZone(s.chainA.GetContext(), &zone) + + return &icstypes.MsgGovSetLsmCaps{ + ChainId: s.chainB.ChainID, + Caps: &icstypes.LsmCaps{ + ValidatorCap: sdk.NewDecWithPrec(50, 2), + ValidatorBondCap: sdk.NewDec(250), + GlobalCap: sdk.NewDecWithPrec(25, 2), + }, + Authority: testAddress, + } + }, + true, + }, + { + "valid", + func(s *KeeperTestSuite) *icstypes.MsgGovSetLsmCaps { + return &icstypes.MsgGovSetLsmCaps{ + ChainId: s.chainB.ChainID, + Caps: &icstypes.LsmCaps{ + ValidatorCap: sdk.NewDecWithPrec(50, 2), + ValidatorBondCap: sdk.NewDec(250), + GlobalCap: sdk.NewDecWithPrec(25, 2), + }, + Authority: "cosmos10d07y265gmmuvt4z0w9aw880jnsr700j6zn9kn", + } + }, + false, + }, + } + + for _, tt := range tests { + tt := tt + + suite.Run(tt.name, func() { + suite.SetupTest() + suite.setupTestZones() + + msg := tt.malleate(suite) + + msgSrv := icskeeper.NewMsgServerImpl(suite.GetQuicksilverApp(suite.chainA).InterchainstakingKeeper) + res, err := msgSrv.GovSetLsmCaps(sdk.WrapSDKContext(suite.chainA.GetContext()), msg) + if tt.expectErr { + suite.Error(err) + suite.Nil(res) + } else { + suite.NoError(err) + suite.NotNil(res) + } + + qapp := suite.GetQuicksilverApp(suite.chainA) + icsKeeper := qapp.InterchainstakingKeeper + zone, found := icsKeeper.GetZone(suite.chainA.GetContext(), suite.chainB.ChainID) + suite.True(found) + + caps, found := icsKeeper.GetLsmCaps(suite.chainA.GetContext(), zone.ChainId) + if tt.expectErr { + suite.False(found) + suite.Nil(caps) + } else { + suite.True(found) + suite.Equal(caps, msg.Caps) + + } + }) + } +} diff --git a/x/interchainstaking/keeper/receipt.go b/x/interchainstaking/keeper/receipt.go index c62bc2b20..32f16ae4d 100644 --- a/x/interchainstaking/keeper/receipt.go +++ b/x/interchainstaking/keeper/receipt.go @@ -408,9 +408,9 @@ func (k *Keeper) UserZoneReceipts(ctx sdk.Context, zone *types.Zone, addr sdk.Ac return receipts, nil } -func (k *Keeper) SetReceiptsCompleted(ctx sdk.Context, chainID string, qualifyingTime, completionTime time.Time) { +func (k *Keeper) SetReceiptsCompleted(ctx sdk.Context, chainID string, qualifyingTime, completionTime time.Time, denom string) { k.IterateZoneReceipts(ctx, chainID, func(_ int64, receiptInfo types.Receipt) (stop bool) { - if receiptInfo.FirstSeen.Before(qualifyingTime) && receiptInfo.Completed == nil { + if receiptInfo.FirstSeen.Before(qualifyingTime) && receiptInfo.Completed == nil && denom == receiptInfo.Amount[0].Denom { receiptInfo.Completed = &completionTime k.SetReceipt(ctx, receiptInfo) diff --git a/x/interchainstaking/keeper/receipt_test.go b/x/interchainstaking/keeper/receipt_test.go index a4d518b27..b7bd9739e 100644 --- a/x/interchainstaking/keeper/receipt_test.go +++ b/x/interchainstaking/keeper/receipt_test.go @@ -310,7 +310,7 @@ func (suite *KeeperTestSuite) TestReceiptStore() { suite.Equal(1, len(out)) suite.Equal(&now, out[0].Completed) - icsKeeper.SetReceiptsCompleted(ctx, zone.ChainId, now, now) + icsKeeper.SetReceiptsCompleted(ctx, zone.ChainId, now, now, zone.BaseDenom) receipt, found = icsKeeper.GetReceipt(ctx, zone.ChainId, hash3) suite.True(found) diff --git a/x/interchainstaking/keeper/redemptions.go b/x/interchainstaking/keeper/redemptions.go index 631dd4e7d..b470cff4e 100644 --- a/x/interchainstaking/keeper/redemptions.go +++ b/x/interchainstaking/keeper/redemptions.go @@ -60,8 +60,7 @@ func (k *Keeper) processRedemptionForLsm(ctx sdk.Context, zone *types.Zone, send TokenizedShareOwner: destination, }) } - // add unallocated dust. - msgs[0].Amount = msgs[0].Amount.AddAmount(outstanding) // nolint:gosec + sdkMsgs := make([]sdk.Msg, 0) for _, msg := range msgs { sdkMsgs = append(sdkMsgs, sdk.Msg(msg)) diff --git a/x/interchainstaking/keeper/validator_test.go b/x/interchainstaking/keeper/validator_test.go index fd88180a4..06f4eba1e 100644 --- a/x/interchainstaking/keeper/validator_test.go +++ b/x/interchainstaking/keeper/validator_test.go @@ -33,12 +33,14 @@ func (suite *KeeperTestSuite) TestStoreGetDeleteValidator() { count := len(app.InterchainstakingKeeper.GetValidators(ctx, zone.ChainId)) newValidator := types.Validator{ - ValoperAddress: validator.String(), - CommissionRate: sdk.NewDec(5.0), - DelegatorShares: sdk.NewDec(1000.0), - VotingPower: sdk.NewInt(1000), - Status: stakingtypes.BondStatusBonded, - Score: sdk.NewDec(0), + ValoperAddress: validator.String(), + CommissionRate: sdk.NewDec(5.0), + DelegatorShares: sdk.NewDec(1000.0), + VotingPower: sdk.NewInt(1000), + Status: stakingtypes.BondStatusBonded, + Score: sdk.NewDec(0), + LiquidShares: sdk.ZeroDec(), + ValidatorBondShares: sdk.ZeroDec(), } err = app.InterchainstakingKeeper.SetValidator(ctx, zone.ChainId, newValidator) suite.NoError(err) diff --git a/x/interchainstaking/module.go b/x/interchainstaking/module.go index 1d59e0ee2..c8dcb4a63 100644 --- a/x/interchainstaking/module.go +++ b/x/interchainstaking/module.go @@ -138,7 +138,7 @@ func (am AppModule) RegisterServices(cfg module.Configurator) { // zanicar: this is the only I can find that clearly states that MsgServer // WILL NOT expose gRPC services, and that QueryServer WILL expose gRPC // services; - types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(*am.keeper)) + types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) types.RegisterQueryServer(cfg.QueryServer(), am.keeper) } diff --git a/x/interchainstaking/types/allocation_test.go b/x/interchainstaking/types/allocation_test.go index bc09b2ced..369bc12c2 100644 --- a/x/interchainstaking/types/allocation_test.go +++ b/x/interchainstaking/types/allocation_test.go @@ -33,7 +33,7 @@ func TestValidInputs(t *testing.T) { "validator2": sdkmath.NewInt(450), } - result, err := types.DetermineAllocationsForDelegation(currentAllocations, currentSum, targetAllocations, amount) + result, err := types.DetermineAllocationsForDelegation(currentAllocations, currentSum, targetAllocations, amount, make(map[string]sdkmath.Int)) require.NoError(t, err) if !reflect.DeepEqual(result, expectedAllocations) { @@ -48,7 +48,7 @@ func TestMinimumInputs(t *testing.T) { targetAllocations := types.ValidatorIntents{} amount := sdk.Coins{sdk.NewCoin("token", sdkmath.ZeroInt())} - _, err := types.DetermineAllocationsForDelegation(currentAllocations, currentSum, targetAllocations, amount) + _, err := types.DetermineAllocationsForDelegation(currentAllocations, currentSum, targetAllocations, amount, make(map[string]sdkmath.Int)) require.Error(t, err) } @@ -70,7 +70,7 @@ func TestMaximumInputs(t *testing.T) { "validator2": sdkmath.NewInt(4500000000), } - result, err := types.DetermineAllocationsForDelegation(currentAllocations, currentSum, targetAllocations, amount) + result, err := types.DetermineAllocationsForDelegation(currentAllocations, currentSum, targetAllocations, amount, make(map[string]sdkmath.Int)) require.NoError(t, err) if !reflect.DeepEqual(result, expectedAllocations) { @@ -93,7 +93,7 @@ func TestEmptyCurrentAllocations(t *testing.T) { "validator2": sdkmath.NewInt(500), } - result, err := types.DetermineAllocationsForDelegation(currentAllocations, currentSum, targetAllocations, amount) + result, err := types.DetermineAllocationsForDelegation(currentAllocations, currentSum, targetAllocations, amount, make(map[string]sdkmath.Int)) require.NoError(t, err) if !reflect.DeepEqual(result, expectedAllocations) { @@ -111,7 +111,7 @@ func TestEmptyTargetAllocations(t *testing.T) { targetAllocations := types.ValidatorIntents{} amount := sdk.Coins{sdk.NewCoin("token", sdk.NewInt(1000))} - _, err := types.DetermineAllocationsForDelegation(currentAllocations, currentSum, targetAllocations, amount) + _, err := types.DetermineAllocationsForDelegation(currentAllocations, currentSum, targetAllocations, amount, make(map[string]sdkmath.Int)) require.Error(t, err) } @@ -133,7 +133,7 @@ func TestNonEqualTargetAllocations(t *testing.T) { "validator2": sdkmath.NewInt(710), } - result, err := types.DetermineAllocationsForDelegation(currentAllocations, currentSum, targetAllocations, amount) + result, err := types.DetermineAllocationsForDelegation(currentAllocations, currentSum, targetAllocations, amount, make(map[string]sdkmath.Int)) require.NoError(t, err) if !reflect.DeepEqual(result, expectedAllocations) { @@ -161,7 +161,7 @@ func TestValidInputsWithZeroWeight(t *testing.T) { "validator2": sdkmath.NewInt(450), } - result, err := types.DetermineAllocationsForDelegation(currentAllocations, currentSum, targetAllocations, amount) + result, err := types.DetermineAllocationsForDelegation(currentAllocations, currentSum, targetAllocations, amount, make(map[string]sdkmath.Int)) require.NoError(t, err) if !reflect.DeepEqual(result, expectedAllocations) { @@ -191,7 +191,7 @@ func TestTargetAllocationsMoreValidators(t *testing.T) { "validator4": sdkmath.NewInt(282), } - result, err := types.DetermineAllocationsForDelegation(currentAllocations, currentSum, targetAllocations, amount) + result, err := types.DetermineAllocationsForDelegation(currentAllocations, currentSum, targetAllocations, amount, make(map[string]sdkmath.Int)) require.NoError(t, err) if !reflect.DeepEqual(result, expectedAllocations) { @@ -218,7 +218,7 @@ func TestCurrentAllocationsMoreValidators(t *testing.T) { "validator2": sdkmath.NewInt(511), } - result, err := types.DetermineAllocationsForDelegation(currentAllocations, currentSum, targetAllocations, amount) + result, err := types.DetermineAllocationsForDelegation(currentAllocations, currentSum, targetAllocations, amount, make(map[string]sdkmath.Int)) require.NoError(t, err) if !reflect.DeepEqual(result, expectedAllocations) { diff --git a/x/interchainstaking/types/codec.go b/x/interchainstaking/types/codec.go index 9660f0aa9..9e2b12532 100644 --- a/x/interchainstaking/types/codec.go +++ b/x/interchainstaking/types/codec.go @@ -1,14 +1,14 @@ package types import ( - lsmstakingtypes "github.com/iqlusioninc/liquidity-staking-module/x/staking/types" - "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec/types" cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" + + lsmstakingtypes "github.com/quicksilver-zone/quicksilver/x/lsmtypes" ) var ( @@ -32,6 +32,7 @@ func RegisterInterfaces(registry types.InterfaceRegistry) { &MsgRequestRedemption{}, &MsgGovCloseChannel{}, &MsgGovReopenChannel{}, + &MsgGovSetLsmCaps{}, ) registry.RegisterImplementations( diff --git a/x/interchainstaking/types/delegation.go b/x/interchainstaking/types/delegation.go index a27bed661..00f98a19f 100644 --- a/x/interchainstaking/types/delegation.go +++ b/x/interchainstaking/types/delegation.go @@ -119,7 +119,7 @@ func (vi ValidatorIntents) Normalize() ValidatorIntents { return out.Sort() } -func DetermineAllocationsForDelegation(currentAllocations map[string]sdkmath.Int, currentSum sdkmath.Int, targetAllocations ValidatorIntents, amount sdk.Coins) (map[string]sdkmath.Int, error) { +func DetermineAllocationsForDelegation(currentAllocations map[string]sdkmath.Int, currentSum sdkmath.Int, targetAllocations ValidatorIntents, amount sdk.Coins, maxCanAllocate map[string]sdkmath.Int) (map[string]sdkmath.Int, error) { if amount.IsZero() { return make(map[string]sdkmath.Int, 0), fmt.Errorf("unable to delegate zero amount") } @@ -127,7 +127,7 @@ func DetermineAllocationsForDelegation(currentAllocations map[string]sdkmath.Int return make(map[string]sdkmath.Int, 0), fmt.Errorf("unable to process nil delegation targets") } input := amount[0].Amount - deltas, _ := CalculateAllocationDeltas(currentAllocations, map[string]bool{}, currentSum.Add(amount[0].Amount), targetAllocations) + deltas, _ := CalculateAllocationDeltas(currentAllocations, map[string]bool{}, currentSum.Add(amount[0].Amount), targetAllocations, maxCanAllocate) sum := deltas.Sum() // unequalSplit is the portion of input that should be distributed in attempt to make targets == 0 diff --git a/x/interchainstaking/types/delegation_test.go b/x/interchainstaking/types/delegation_test.go index c1b330743..ae5135d2a 100644 --- a/x/interchainstaking/types/delegation_test.go +++ b/x/interchainstaking/types/delegation_test.go @@ -186,7 +186,7 @@ func TestDetermineAllocationsForDelegation(t *testing.T) { for _, amount := range val.current { sum = sum.Add(amount) } - allocations, err := types.DetermineAllocationsForDelegation(val.current, sum, val.target, val.inAmount) + allocations, err := types.DetermineAllocationsForDelegation(val.current, sum, val.target, val.inAmount, make(map[string]sdkmath.Int)) require.NoError(t, err) require.Equal(t, len(val.expected), len(allocations)) for valoper := range val.expected { diff --git a/x/interchainstaking/types/events.go b/x/interchainstaking/types/events.go index 68016500a..d97f15d99 100644 --- a/x/interchainstaking/types/events.go +++ b/x/interchainstaking/types/events.go @@ -6,6 +6,7 @@ const ( EventTypeSetIntent = "set_intent" EventTypeCloseICA = "close_ica_channel" EventTypeReopenICA = "reopen_ica_channel" + EventTypeSetLsmCaps = "lsm_set_caps" AttributeKeyConnectionID = "connection_id" AttributeKeyChainID = "chain_id" @@ -17,5 +18,9 @@ const ( AttributeKeyPortID = "port_name" AttributeKeyUser = "user_address" + AttributeLsmValidatorCap = "lsm_validator_cap" + AttributeLsmValidatorBondCap = "lsm_validator_bond_cap" + AttributeLsmGlobalCap = "lsm_global_cap" + AttributeValueCategory = ModuleName ) diff --git a/x/interchainstaking/types/ibc_packet.go b/x/interchainstaking/types/ibc_packet.go index d62709750..50abb4d54 100644 --- a/x/interchainstaking/types/ibc_packet.go +++ b/x/interchainstaking/types/ibc_packet.go @@ -12,6 +12,7 @@ const ( MsgTypeRebalance = "rebalance" MsgTypeUnbondSend = "unbondSend" MsgTypePerformance = "perf" + MsgTypeBatch = "batch" // TransferPort is the portID for ibc transfer module. TransferPort = "transfer" ) diff --git a/x/interchainstaking/types/interchainstaking.pb.go b/x/interchainstaking/types/interchainstaking.pb.go index 195e6bb04..5319f9518 100644 --- a/x/interchainstaking/types/interchainstaking.pb.go +++ b/x/interchainstaking/types/interchainstaking.pb.go @@ -329,6 +329,45 @@ func (m *SubzoneInfo) GetBaseChainID() string { return "" } +type LsmCaps struct { + ValidatorCap github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,1,opt,name=validator_cap,json=validatorCap,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"validator_cap"` + ValidatorBondCap github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=validator_bond_cap,json=validatorBondCap,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"validator_bond_cap"` + GlobalCap github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=global_cap,json=globalCap,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"global_cap"` +} + +func (m *LsmCaps) Reset() { *m = LsmCaps{} } +func (m *LsmCaps) String() string { return proto.CompactTextString(m) } +func (*LsmCaps) ProtoMessage() {} +func (*LsmCaps) Descriptor() ([]byte, []int) { + return fileDescriptor_0d755cfd37ef9fee, []int{2} +} +func (m *LsmCaps) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *LsmCaps) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_LsmCaps.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *LsmCaps) XXX_Merge(src proto.Message) { + xxx_messageInfo_LsmCaps.Merge(m, src) +} +func (m *LsmCaps) XXX_Size() int { + return m.Size() +} +func (m *LsmCaps) XXX_DiscardUnknown() { + xxx_messageInfo_LsmCaps.DiscardUnknown(m) +} + +var xxx_messageInfo_LsmCaps proto.InternalMessageInfo + type ICAAccount struct { Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` // balance defines the different coins this balance holds. @@ -342,7 +381,7 @@ func (m *ICAAccount) Reset() { *m = ICAAccount{} } func (m *ICAAccount) String() string { return proto.CompactTextString(m) } func (*ICAAccount) ProtoMessage() {} func (*ICAAccount) Descriptor() ([]byte, []int) { - return fileDescriptor_0d755cfd37ef9fee, []int{2} + return fileDescriptor_0d755cfd37ef9fee, []int{3} } func (m *ICAAccount) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -415,7 +454,7 @@ func (m *Distribution) Reset() { *m = Distribution{} } func (m *Distribution) String() string { return proto.CompactTextString(m) } func (*Distribution) ProtoMessage() {} func (*Distribution) Descriptor() ([]byte, []int) { - return fileDescriptor_0d755cfd37ef9fee, []int{3} + return fileDescriptor_0d755cfd37ef9fee, []int{4} } func (m *Distribution) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -477,7 +516,7 @@ func (m *WithdrawalRecord) Reset() { *m = WithdrawalRecord{} } func (m *WithdrawalRecord) String() string { return proto.CompactTextString(m) } func (*WithdrawalRecord) ProtoMessage() {} func (*WithdrawalRecord) Descriptor() ([]byte, []int) { - return fileDescriptor_0d755cfd37ef9fee, []int{4} + return fileDescriptor_0d755cfd37ef9fee, []int{5} } func (m *WithdrawalRecord) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -594,7 +633,7 @@ func (m *UnbondingRecord) Reset() { *m = UnbondingRecord{} } func (m *UnbondingRecord) String() string { return proto.CompactTextString(m) } func (*UnbondingRecord) ProtoMessage() {} func (*UnbondingRecord) Descriptor() ([]byte, []int) { - return fileDescriptor_0d755cfd37ef9fee, []int{5} + return fileDescriptor_0d755cfd37ef9fee, []int{6} } func (m *UnbondingRecord) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -664,7 +703,7 @@ func (m *RedelegationRecord) Reset() { *m = RedelegationRecord{} } func (m *RedelegationRecord) String() string { return proto.CompactTextString(m) } func (*RedelegationRecord) ProtoMessage() {} func (*RedelegationRecord) Descriptor() ([]byte, []int) { - return fileDescriptor_0d755cfd37ef9fee, []int{6} + return fileDescriptor_0d755cfd37ef9fee, []int{7} } func (m *RedelegationRecord) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -745,7 +784,7 @@ func (m *TransferRecord) Reset() { *m = TransferRecord{} } func (m *TransferRecord) String() string { return proto.CompactTextString(m) } func (*TransferRecord) ProtoMessage() {} func (*TransferRecord) Descriptor() ([]byte, []int) { - return fileDescriptor_0d755cfd37ef9fee, []int{7} + return fileDescriptor_0d755cfd37ef9fee, []int{8} } func (m *TransferRecord) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -798,13 +837,17 @@ type Validator struct { Jailed bool `protobuf:"varint,7,opt,name=jailed,proto3" json:"jailed,omitempty"` Tombstoned bool `protobuf:"varint,8,opt,name=tombstoned,proto3" json:"tombstoned,omitempty"` JailedSince time.Time `protobuf:"bytes,9,opt,name=jailed_since,json=jailedSince,proto3,stdtime" json:"jailed_since"` + // Number of shares self bonded from the validator + ValidatorBondShares github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,10,opt,name=validator_bond_shares,json=validatorBondShares,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"validator_bond_shares" yaml:"validator_bond_shares"` + // Number of shares either tokenized or owned by a liquid staking provider + LiquidShares github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,11,opt,name=liquid_shares,json=liquidShares,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"liquid_shares" yaml:"liquid_shares"` } func (m *Validator) Reset() { *m = Validator{} } func (m *Validator) String() string { return proto.CompactTextString(m) } func (*Validator) ProtoMessage() {} func (*Validator) Descriptor() ([]byte, []int) { - return fileDescriptor_0d755cfd37ef9fee, []int{8} + return fileDescriptor_0d755cfd37ef9fee, []int{9} } func (m *Validator) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -877,7 +920,7 @@ func (m *DelegatorIntent) Reset() { *m = DelegatorIntent{} } func (m *DelegatorIntent) String() string { return proto.CompactTextString(m) } func (*DelegatorIntent) ProtoMessage() {} func (*DelegatorIntent) Descriptor() ([]byte, []int) { - return fileDescriptor_0d755cfd37ef9fee, []int{9} + return fileDescriptor_0d755cfd37ef9fee, []int{10} } func (m *DelegatorIntent) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -929,7 +972,7 @@ func (m *ValidatorIntent) Reset() { *m = ValidatorIntent{} } func (m *ValidatorIntent) String() string { return proto.CompactTextString(m) } func (*ValidatorIntent) ProtoMessage() {} func (*ValidatorIntent) Descriptor() ([]byte, []int) { - return fileDescriptor_0d755cfd37ef9fee, []int{10} + return fileDescriptor_0d755cfd37ef9fee, []int{11} } func (m *ValidatorIntent) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -977,7 +1020,7 @@ func (m *Delegation) Reset() { *m = Delegation{} } func (m *Delegation) String() string { return proto.CompactTextString(m) } func (*Delegation) ProtoMessage() {} func (*Delegation) Descriptor() ([]byte, []int) { - return fileDescriptor_0d755cfd37ef9fee, []int{11} + return fileDescriptor_0d755cfd37ef9fee, []int{12} } func (m *Delegation) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1043,7 +1086,7 @@ func (m *PortConnectionTuple) Reset() { *m = PortConnectionTuple{} } func (m *PortConnectionTuple) String() string { return proto.CompactTextString(m) } func (*PortConnectionTuple) ProtoMessage() {} func (*PortConnectionTuple) Descriptor() ([]byte, []int) { - return fileDescriptor_0d755cfd37ef9fee, []int{12} + return fileDescriptor_0d755cfd37ef9fee, []int{13} } func (m *PortConnectionTuple) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1099,7 +1142,7 @@ func (m *Receipt) Reset() { *m = Receipt{} } func (m *Receipt) String() string { return proto.CompactTextString(m) } func (*Receipt) ProtoMessage() {} func (*Receipt) Descriptor() ([]byte, []int) { - return fileDescriptor_0d755cfd37ef9fee, []int{13} + return fileDescriptor_0d755cfd37ef9fee, []int{14} } func (m *Receipt) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1173,6 +1216,7 @@ func (m *Receipt) GetCompleted() *time.Time { func init() { proto.RegisterType((*Zone)(nil), "quicksilver.interchainstaking.v1.Zone") proto.RegisterType((*SubzoneInfo)(nil), "quicksilver.interchainstaking.v1.SubzoneInfo") + proto.RegisterType((*LsmCaps)(nil), "quicksilver.interchainstaking.v1.LsmCaps") proto.RegisterType((*ICAAccount)(nil), "quicksilver.interchainstaking.v1.ICAAccount") proto.RegisterType((*Distribution)(nil), "quicksilver.interchainstaking.v1.Distribution") proto.RegisterType((*WithdrawalRecord)(nil), "quicksilver.interchainstaking.v1.WithdrawalRecord") @@ -1192,129 +1236,136 @@ func init() { } var fileDescriptor_0d755cfd37ef9fee = []byte{ - // 1939 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0xdd, 0x6e, 0x1b, 0xc7, - 0xf5, 0xf7, 0x52, 0x12, 0x45, 0x1e, 0x52, 0xa2, 0x34, 0x92, 0x9d, 0x95, 0x62, 0x8b, 0x0c, 0xff, - 0x49, 0xfe, 0x2c, 0x6c, 0x91, 0xa1, 0x03, 0xb4, 0x6e, 0x50, 0x14, 0x15, 0x25, 0x23, 0x11, 0x5a, - 0xab, 0xc2, 0x4a, 0x69, 0xd0, 0x04, 0xc5, 0x62, 0xb8, 0x3b, 0x22, 0xa7, 0xde, 0xdd, 0xa1, 0x67, - 0x86, 0xfa, 0xc8, 0x53, 0xe4, 0x11, 0x7a, 0x57, 0xc0, 0x28, 0x7a, 0xe5, 0xcb, 0x3e, 0x40, 0x2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xfa, 0xeb, 0x9b, 0x95, 0x5b, 0x5f, 0xae, 0x65, - 0x16, 0x95, 0xc9, 0x1e, 0xab, 0xea, 0x21, 0x99, 0x05, 0x5a, 0x87, 0x17, 0x7c, 0xcf, 0xd6, 0x6b, - 0xee, 0xe6, 0xb5, 0x17, 0x1f, 0xff, 0x27, 0x00, 0x00, 0xff, 0xff, 0xef, 0x4a, 0xe1, 0x5d, 0xfd, - 0x16, 0x00, 0x00, + // 2058 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x59, 0xdd, 0x6e, 0x1b, 0xc7, + 0x15, 0xf6, 0x52, 0x12, 0x25, 0x1e, 0x52, 0xa2, 0x34, 0x92, 0x9d, 0xb5, 0xe3, 0x88, 0x0c, 0x9b, + 0xa4, 0x2c, 0x6c, 0x91, 0x91, 0x03, 0xb4, 0x6e, 0x50, 0x14, 0xd5, 0x8f, 0x9b, 0x08, 0x8d, 0x55, + 0x61, 0xa5, 0x34, 0x68, 0x8c, 0x62, 0x31, 0xdc, 0x1d, 0x91, 0x13, 0xed, 0xee, 0xd0, 0x3b, 0x43, + 0xfd, 0xf8, 0xb2, 0x4f, 0x90, 0x47, 0xe8, 0x5d, 0x01, 0xa3, 0xe8, 0x95, 0x7b, 0xd7, 0x07, 0xc8, + 0x65, 0xe0, 0xab, 0xa2, 0x28, 0xe4, 0xc2, 0xbe, 0x13, 0xd0, 0x9b, 0x3e, 0x41, 0x31, 0x3f, 0xfb, + 0x43, 0x49, 0x31, 0x25, 0x47, 0xe9, 0x95, 0x38, 0x67, 0xce, 0xf9, 0xce, 0x99, 0x9d, 0x33, 0xe7, + 0x7c, 0x33, 0x82, 0xfb, 0x8f, 0x07, 0xd4, 0xdb, 0xe3, 0x34, 0xd8, 0x27, 0x71, 0x9b, 0x46, 0x82, + 0xc4, 0x5e, 0x0f, 0xd3, 0x88, 0x0b, 0xbc, 0x47, 0xa3, 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bb, 0xd7, 0x00, 0x76, 0x69, 0xcc, 0x85, 0xcb, 0x09, 0x89, 0xcc, 0x23, 0xf3, 0xa8, 0x32, + 0x69, 0xa9, 0x32, 0x59, 0x52, 0x76, 0xdb, 0x84, 0x44, 0x68, 0x15, 0x4a, 0x86, 0x95, 0x10, 0xff, + 0x82, 0x64, 0xc6, 0x60, 0xa4, 0x66, 0xab, 0x8f, 0xbe, 0x79, 0xb9, 0x68, 0x7d, 0xfb, 0x72, 0xd1, + 0xfa, 0xf7, 0xcb, 0x45, 0xeb, 0xeb, 0x57, 0x8b, 0xd7, 0xbe, 0x7d, 0xb5, 0x78, 0xed, 0x1f, 0xaf, + 0x16, 0xaf, 0x7d, 0xb9, 0x92, 0x5b, 0x54, 0xae, 0x7a, 0x2c, 0x3d, 0x61, 0x11, 0xc9, 0x0b, 0xda, + 0x87, 0xe7, 0xfc, 0xe7, 0x43, 0xad, 0xb9, 0x53, 0x54, 0x51, 0x7c, 0xf4, 0xbf, 0x00, 0x00, 0x00, + 0xff, 0xff, 0x6a, 0xb1, 0x4d, 0x0b, 0x27, 0x19, 0x00, 0x00, } func (m *Zone) Marshal() (dAtA []byte, err error) { @@ -1660,6 +1711,59 @@ func (m *SubzoneInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *LsmCaps) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *LsmCaps) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *LsmCaps) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.GlobalCap.Size() + i -= size + if _, err := m.GlobalCap.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintInterchainstaking(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + { + size := m.ValidatorBondCap.Size() + i -= size + if _, err := m.ValidatorBondCap.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintInterchainstaking(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size := m.ValidatorCap.Size() + i -= size + if _, err := m.ValidatorCap.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintInterchainstaking(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + func (m *ICAAccount) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -2065,6 +2169,26 @@ func (m *Validator) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + { + size := m.LiquidShares.Size() + i -= size + if _, err := m.LiquidShares.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintInterchainstaking(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x5a + { + size := m.ValidatorBondShares.Size() + i -= size + if _, err := m.ValidatorBondShares.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintInterchainstaking(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x52 n10, err10 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.JailedSince, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.JailedSince):]) if err10 != nil { return 0, err10 @@ -2544,6 +2668,21 @@ func (m *SubzoneInfo) Size() (n int) { return n } +func (m *LsmCaps) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ValidatorCap.Size() + n += 1 + l + sovInterchainstaking(uint64(l)) + l = m.ValidatorBondCap.Size() + n += 1 + l + sovInterchainstaking(uint64(l)) + l = m.GlobalCap.Size() + n += 1 + l + sovInterchainstaking(uint64(l)) + return n +} + func (m *ICAAccount) Size() (n int) { if m == nil { return 0 @@ -2747,6 +2886,10 @@ func (m *Validator) Size() (n int) { } l = github_com_gogo_protobuf_types.SizeOfStdTime(m.JailedSince) n += 1 + l + sovInterchainstaking(uint64(l)) + l = m.ValidatorBondShares.Size() + n += 1 + l + sovInterchainstaking(uint64(l)) + l = m.LiquidShares.Size() + n += 1 + l + sovInterchainstaking(uint64(l)) return n } @@ -3828,6 +3971,158 @@ func (m *SubzoneInfo) Unmarshal(dAtA []byte) error { } return nil } +func (m *LsmCaps) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowInterchainstaking + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: LsmCaps: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: LsmCaps: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorCap", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowInterchainstaking + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthInterchainstaking + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthInterchainstaking + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ValidatorCap.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorBondCap", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowInterchainstaking + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthInterchainstaking + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthInterchainstaking + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ValidatorBondCap.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GlobalCap", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowInterchainstaking + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthInterchainstaking + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthInterchainstaking + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.GlobalCap.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipInterchainstaking(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthInterchainstaking + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *ICAAccount) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -5349,6 +5644,74 @@ func (m *Validator) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorBondShares", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowInterchainstaking + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthInterchainstaking + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthInterchainstaking + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ValidatorBondShares.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LiquidShares", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowInterchainstaking + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthInterchainstaking + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthInterchainstaking + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.LiquidShares.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipInterchainstaking(dAtA[iNdEx:]) diff --git a/x/interchainstaking/types/keys.go b/x/interchainstaking/types/keys.go index bb878922e..97b373290 100644 --- a/x/interchainstaking/types/keys.go +++ b/x/interchainstaking/types/keys.go @@ -60,9 +60,8 @@ var ( KeyPrefixRemoteAddress = []byte{0x0d} KeyPrefixLocalAddress = []byte{0x0e} KeyPrefixValidatorAddrsByConsAddr = []byte{0x0f} - - // fill in missing 0d - 0f before adding 0x11! - KeyPrefixRedelegationRecord = []byte{0x10} + KeyPrefixRedelegationRecord = []byte{0x10} + KeyPrefixLsmCaps = []byte{0x11} ) // ParseStakingDelegationKey parses the KV store key for a delegation from Cosmos x/staking module, diff --git a/x/interchainstaking/types/messages.pb.go b/x/interchainstaking/types/messages.pb.go index c99306ab7..51ed31e90 100644 --- a/x/interchainstaking/types/messages.pb.go +++ b/x/interchainstaking/types/messages.pb.go @@ -72,26 +72,22 @@ func (m *MsgRequestRedemption) XXX_DiscardUnknown() { var xxx_messageInfo_MsgRequestRedemption proto.InternalMessageInfo -// MsgSignalIntent represents a message type for signalling voting intent for -// one or more validators. -type MsgSignalIntent struct { - ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty" yaml:"chain_id"` - Intents string `protobuf:"bytes,2,opt,name=intents,proto3" json:"intents,omitempty" yaml:"intents"` - FromAddress string `protobuf:"bytes,3,opt,name=from_address,json=fromAddress,proto3" json:"from_address,omitempty"` +// MsgRequestRedemptionResponse defines the MsgRequestRedemption response type. +type MsgRequestRedemptionResponse struct { } -func (m *MsgSignalIntent) Reset() { *m = MsgSignalIntent{} } -func (m *MsgSignalIntent) String() string { return proto.CompactTextString(m) } -func (*MsgSignalIntent) ProtoMessage() {} -func (*MsgSignalIntent) Descriptor() ([]byte, []int) { +func (m *MsgRequestRedemptionResponse) Reset() { *m = MsgRequestRedemptionResponse{} } +func (m *MsgRequestRedemptionResponse) String() string { return proto.CompactTextString(m) } +func (*MsgRequestRedemptionResponse) ProtoMessage() {} +func (*MsgRequestRedemptionResponse) Descriptor() ([]byte, []int) { return fileDescriptor_ee484030fa140a82, []int{1} } -func (m *MsgSignalIntent) XXX_Unmarshal(b []byte) error { +func (m *MsgRequestRedemptionResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgSignalIntent) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgRequestRedemptionResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgSignalIntent.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgRequestRedemptionResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -101,34 +97,38 @@ func (m *MsgSignalIntent) XXX_Marshal(b []byte, deterministic bool) ([]byte, err return b[:n], nil } } -func (m *MsgSignalIntent) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgSignalIntent.Merge(m, src) +func (m *MsgRequestRedemptionResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRequestRedemptionResponse.Merge(m, src) } -func (m *MsgSignalIntent) XXX_Size() int { +func (m *MsgRequestRedemptionResponse) XXX_Size() int { return m.Size() } -func (m *MsgSignalIntent) XXX_DiscardUnknown() { - xxx_messageInfo_MsgSignalIntent.DiscardUnknown(m) +func (m *MsgRequestRedemptionResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRequestRedemptionResponse.DiscardUnknown(m) } -var xxx_messageInfo_MsgSignalIntent proto.InternalMessageInfo +var xxx_messageInfo_MsgRequestRedemptionResponse proto.InternalMessageInfo -// MsgRequestRedemptionResponse defines the MsgRequestRedemption response type. -type MsgRequestRedemptionResponse struct { +// MsgSignalIntent represents a message type for signalling voting intent for +// one or more validators. +type MsgSignalIntent struct { + ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty" yaml:"chain_id"` + Intents string `protobuf:"bytes,2,opt,name=intents,proto3" json:"intents,omitempty" yaml:"intents"` + FromAddress string `protobuf:"bytes,3,opt,name=from_address,json=fromAddress,proto3" json:"from_address,omitempty"` } -func (m *MsgRequestRedemptionResponse) Reset() { *m = MsgRequestRedemptionResponse{} } -func (m *MsgRequestRedemptionResponse) String() string { return proto.CompactTextString(m) } -func (*MsgRequestRedemptionResponse) ProtoMessage() {} -func (*MsgRequestRedemptionResponse) Descriptor() ([]byte, []int) { +func (m *MsgSignalIntent) Reset() { *m = MsgSignalIntent{} } +func (m *MsgSignalIntent) String() string { return proto.CompactTextString(m) } +func (*MsgSignalIntent) ProtoMessage() {} +func (*MsgSignalIntent) Descriptor() ([]byte, []int) { return fileDescriptor_ee484030fa140a82, []int{2} } -func (m *MsgRequestRedemptionResponse) XXX_Unmarshal(b []byte) error { +func (m *MsgSignalIntent) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgRequestRedemptionResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgSignalIntent) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgRequestRedemptionResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgSignalIntent.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -138,17 +138,17 @@ func (m *MsgRequestRedemptionResponse) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } -func (m *MsgRequestRedemptionResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgRequestRedemptionResponse.Merge(m, src) +func (m *MsgSignalIntent) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSignalIntent.Merge(m, src) } -func (m *MsgRequestRedemptionResponse) XXX_Size() int { +func (m *MsgSignalIntent) XXX_Size() int { return m.Size() } -func (m *MsgRequestRedemptionResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgRequestRedemptionResponse.DiscardUnknown(m) +func (m *MsgSignalIntent) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSignalIntent.DiscardUnknown(m) } -var xxx_messageInfo_MsgRequestRedemptionResponse proto.InternalMessageInfo +var xxx_messageInfo_MsgSignalIntent proto.InternalMessageInfo // MsgSignalIntentResponse defines the MsgSignalIntent response type. type MsgSignalIntentResponse struct { @@ -189,8 +189,8 @@ var xxx_messageInfo_MsgSignalIntentResponse proto.InternalMessageInfo func init() { proto.RegisterType((*MsgRequestRedemption)(nil), "quicksilver.interchainstaking.v1.MsgRequestRedemption") - proto.RegisterType((*MsgSignalIntent)(nil), "quicksilver.interchainstaking.v1.MsgSignalIntent") proto.RegisterType((*MsgRequestRedemptionResponse)(nil), "quicksilver.interchainstaking.v1.MsgRequestRedemptionResponse") + proto.RegisterType((*MsgSignalIntent)(nil), "quicksilver.interchainstaking.v1.MsgSignalIntent") proto.RegisterType((*MsgSignalIntentResponse)(nil), "quicksilver.interchainstaking.v1.MsgSignalIntentResponse") } @@ -199,47 +199,49 @@ func init() { } var fileDescriptor_ee484030fa140a82 = []byte{ - // 630 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x94, 0x4f, 0x4f, 0xd4, 0x40, - 0x18, 0xc6, 0x77, 0x20, 0xf2, 0x67, 0x20, 0xa2, 0x85, 0x44, 0xd8, 0x90, 0x2e, 0xe9, 0x89, 0xa8, - 0xb4, 0x2c, 0x28, 0x2a, 0x0a, 0x09, 0x8b, 0x09, 0xe1, 0xc0, 0xa5, 0xdc, 0xf4, 0xb0, 0x99, 0x6d, - 0x5f, 0x87, 0x09, 0xed, 0x4c, 0xe9, 0xcc, 0x36, 0xe0, 0xd1, 0x93, 0x47, 0x13, 0xfd, 0x00, 0x7c, - 0x08, 0xe2, 0x17, 0xd0, 0x03, 0x47, 0xa2, 0x17, 0x4f, 0x1b, 0x03, 0x1e, 0x3c, 0x79, 0xe0, 0x13, - 0x98, 0xb6, 0xb3, 0x9b, 0x5d, 0x20, 0xd9, 0x75, 0xe3, 0xad, 0x9d, 0x67, 0x7e, 0xcf, 0x3c, 0xcf, - 0xce, 0xbb, 0xc5, 0xce, 0x41, 0x9d, 0x79, 0xfb, 0x92, 0x05, 0x09, 0xc4, 0x0e, 0xe3, 0x0a, 0x62, - 0x6f, 0x8f, 0x30, 0x2e, 0x15, 0xd9, 0x67, 0x9c, 0x3a, 0x49, 0xd9, 0x09, 0x41, 0x4a, 0x42, 0x41, - 0xda, 0x51, 0x2c, 0x94, 0x30, 0xe6, 0xda, 0x00, 0xfb, 0x1a, 0x60, 0x27, 0xe5, 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, 0x42, 0x15, 0x5f, 0xf4, 0x43, 0xb5, 0xf2, 0xaf, - 0x65, 0xf9, 0x9f, 0xa4, 0xf9, 0x97, 0x7a, 0xca, 0xef, 0xa5, 0x2e, 0x55, 0x4f, 0x47, 0x3e, 0x45, - 0xf8, 0xce, 0x96, 0x48, 0x5c, 0x10, 0x11, 0xf0, 0x66, 0x8f, 0xc7, 0xbd, 0x26, 0xea, 0xc0, 0x8a, - 0x6b, 0x7d, 0x61, 0xad, 0x26, 0xeb, 0x59, 0x93, 0xa7, 0x69, 0x93, 0xe5, 0x1e, 0x07, 0x28, 0xb5, - 0x69, 0x56, 0xa9, 0xbc, 0x3e, 0x3d, 0x37, 0xd1, 0xd9, 0xb9, 0x89, 0x7e, 0x9e, 0x9b, 0xe8, 0xc3, - 0x85, 0x59, 0x38, 0xbb, 0x30, 0x0b, 0x3f, 0x2e, 0xcc, 0xc2, 0xab, 0x0d, 0xca, 0xd4, 0x5e, 0xbd, - 0x66, 0x7b, 0x22, 0x6c, 0x37, 0x5e, 0x78, 0x2b, 0x38, 0x74, 0x9c, 0x74, 0x78, 0xc3, 0x29, 0xea, - 0x28, 0x02, 0x59, 0x1b, 0xca, 0xbe, 0xaf, 0xcb, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0xc9, 0xe7, - 0xa5, 0x53, 0x55, 0x06, 0x00, 0x00, + // 661 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x95, 0x4f, 0x4f, 0x13, 0x4f, + 0x18, 0xc7, 0x3b, 0x90, 0xdf, 0x0f, 0x18, 0x50, 0x74, 0x21, 0x11, 0x36, 0x64, 0x4b, 0xf6, 0x44, + 0x54, 0x76, 0x69, 0x51, 0xd4, 0x2a, 0x24, 0xb4, 0x26, 0x84, 0x44, 0x2e, 0xcb, 0x4d, 0x0f, 0xcd, + 0x74, 0xf7, 0x71, 0x99, 0xb0, 0x3b, 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xfa, 0x79, 0xac, 0xa1, 0xf7, 0x27, 0x5a, + 0xe1, 0xe8, 0x44, 0x2b, 0xfc, 0x38, 0xd1, 0x0a, 0x2f, 0x57, 0x5d, 0x2a, 0xb7, 0x9a, 0x0d, 0xc3, + 0xe6, 0x7e, 0xb7, 0xf6, 0xfc, 0x1b, 0xce, 0xa0, 0xe7, 0xb2, 0xdd, 0x0b, 0x2e, 0x92, 0x7b, 0x01, + 0x88, 0xc6, 0xff, 0xc9, 0x3f, 0xc4, 0xe2, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x7c, 0xae, 0x67, + 0xce, 0x17, 0x07, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -264,6 +266,7 @@ type MsgClient interface { // validators. GovCloseChannel(ctx context.Context, in *MsgGovCloseChannel, opts ...grpc.CallOption) (*MsgGovCloseChannelResponse, error) GovReopenChannel(ctx context.Context, in *MsgGovReopenChannel, opts ...grpc.CallOption) (*MsgGovReopenChannelResponse, error) + GovSetLsmCaps(ctx context.Context, in *MsgGovSetLsmCaps, opts ...grpc.CallOption) (*MsgGovSetLsmCapsResponse, error) } type msgClient struct { @@ -310,6 +313,15 @@ func (c *msgClient) GovReopenChannel(ctx context.Context, in *MsgGovReopenChanne return out, nil } +func (c *msgClient) GovSetLsmCaps(ctx context.Context, in *MsgGovSetLsmCaps, opts ...grpc.CallOption) (*MsgGovSetLsmCapsResponse, error) { + out := new(MsgGovSetLsmCapsResponse) + err := c.cc.Invoke(ctx, "/quicksilver.interchainstaking.v1.Msg/GovSetLsmCaps", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { // RequestRedemption defines a method for requesting burning of qAssets for @@ -322,6 +334,7 @@ type MsgServer interface { // validators. GovCloseChannel(context.Context, *MsgGovCloseChannel) (*MsgGovCloseChannelResponse, error) GovReopenChannel(context.Context, *MsgGovReopenChannel) (*MsgGovReopenChannelResponse, error) + GovSetLsmCaps(context.Context, *MsgGovSetLsmCaps) (*MsgGovSetLsmCapsResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -340,6 +353,9 @@ func (*UnimplementedMsgServer) GovCloseChannel(ctx context.Context, req *MsgGovC func (*UnimplementedMsgServer) GovReopenChannel(ctx context.Context, req *MsgGovReopenChannel) (*MsgGovReopenChannelResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GovReopenChannel not implemented") } +func (*UnimplementedMsgServer) GovSetLsmCaps(ctx context.Context, req *MsgGovSetLsmCaps) (*MsgGovSetLsmCapsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GovSetLsmCaps not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -417,6 +433,24 @@ func _Msg_GovReopenChannel_Handler(srv interface{}, ctx context.Context, dec fun return interceptor(ctx, in, info, handler) } +func _Msg_GovSetLsmCaps_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgGovSetLsmCaps) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).GovSetLsmCaps(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/quicksilver.interchainstaking.v1.Msg/GovSetLsmCaps", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).GovSetLsmCaps(ctx, req.(*MsgGovSetLsmCaps)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "quicksilver.interchainstaking.v1.Msg", HandlerType: (*MsgServer)(nil), @@ -437,6 +471,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "GovReopenChannel", Handler: _Msg_GovReopenChannel_Handler, }, + { + MethodName: "GovSetLsmCaps", + Handler: _Msg_GovSetLsmCaps_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "quicksilver/interchainstaking/v1/messages.proto", @@ -489,6 +527,29 @@ func (m *MsgRequestRedemption) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *MsgRequestRedemptionResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgRequestRedemptionResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRequestRedemptionResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + func (m *MsgSignalIntent) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -533,29 +594,6 @@ func (m *MsgSignalIntent) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *MsgRequestRedemptionResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgRequestRedemptionResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgRequestRedemptionResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - func (m *MsgSignalIntentResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -609,6 +647,15 @@ func (m *MsgRequestRedemption) Size() (n int) { return n } +func (m *MsgRequestRedemptionResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + func (m *MsgSignalIntent) Size() (n int) { if m == nil { return 0 @@ -630,15 +677,6 @@ func (m *MsgSignalIntent) Size() (n int) { return n } -func (m *MsgRequestRedemptionResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - func (m *MsgSignalIntentResponse) Size() (n int) { if m == nil { return 0 @@ -801,6 +839,56 @@ func (m *MsgRequestRedemption) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgRequestRedemptionResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMessages + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgRequestRedemptionResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRequestRedemptionResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipMessages(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthMessages + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *MsgSignalIntent) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -947,56 +1035,6 @@ func (m *MsgSignalIntent) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgRequestRedemptionResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMessages - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgRequestRedemptionResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgRequestRedemptionResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipMessages(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthMessages - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *MsgSignalIntentResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/x/interchainstaking/types/messages.pb.gw.go b/x/interchainstaking/types/messages.pb.gw.go index 6b9f90358..72c2af181 100644 --- a/x/interchainstaking/types/messages.pb.gw.go +++ b/x/interchainstaking/types/messages.pb.gw.go @@ -169,6 +169,40 @@ func local_request_Msg_GovReopenChannel_0(ctx context.Context, marshaler runtime } +func request_Msg_GovSetLsmCaps_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq MsgGovSetLsmCaps + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.GovSetLsmCaps(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Msg_GovSetLsmCaps_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq MsgGovSetLsmCaps + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.GovSetLsmCaps(ctx, &protoReq) + return msg, metadata, err + +} + // RegisterMsgHandlerServer registers the http handlers for service Msg to "mux". // UnaryRPC :call MsgServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -267,6 +301,29 @@ func RegisterMsgHandlerServer(ctx context.Context, mux *runtime.ServeMux, server }) + mux.Handle("POST", pattern_Msg_GovSetLsmCaps_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Msg_GovSetLsmCaps_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Msg_GovSetLsmCaps_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -388,6 +445,26 @@ func RegisterMsgHandlerClient(ctx context.Context, mux *runtime.ServeMux, client }) + mux.Handle("POST", pattern_Msg_GovSetLsmCaps_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Msg_GovSetLsmCaps_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Msg_GovSetLsmCaps_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -399,6 +476,8 @@ var ( pattern_Msg_GovCloseChannel_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"quicksilver", "tx", "v1", "interchainstaking", "close_channel"}, "", runtime.AssumeColonVerbOpt(true))) pattern_Msg_GovReopenChannel_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"quicksilver", "tx", "v1", "interchainstaking", "reopen_channel"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Msg_GovSetLsmCaps_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"quicksilver", "tx", "v1", "interchainstaking", "reopen_channel"}, "", runtime.AssumeColonVerbOpt(true))) ) var ( @@ -409,4 +488,6 @@ var ( forward_Msg_GovCloseChannel_0 = runtime.ForwardResponseMessage forward_Msg_GovReopenChannel_0 = runtime.ForwardResponseMessage + + forward_Msg_GovSetLsmCaps_0 = runtime.ForwardResponseMessage ) diff --git a/x/interchainstaking/types/msgs.go b/x/interchainstaking/types/msgs.go index 4436c7a3a..8288709d4 100644 --- a/x/interchainstaking/types/msgs.go +++ b/x/interchainstaking/types/msgs.go @@ -4,6 +4,7 @@ import ( "errors" "fmt" "regexp" + "strconv" "strings" "github.com/ingenuity-build/multierror" @@ -11,6 +12,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/bech32" "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" + + "github.com/quicksilver-zone/quicksilver/utils/addressutils" ) // interchainstaking message types. @@ -22,6 +25,9 @@ const ( var ( _ sdk.Msg = &MsgRequestRedemption{} _ sdk.Msg = &MsgSignalIntent{} + _ sdk.Msg = &MsgGovCloseChannel{} + _ sdk.Msg = &MsgGovReopenChannel{} + _ sdk.Msg = &MsgGovSetLsmCaps{} _ legacytx.LegacyMsg = &MsgRequestRedemption{} _ legacytx.LegacyMsg = &MsgSignalIntent{} ) @@ -42,7 +48,7 @@ func (msg MsgRequestRedemption) ValidateBasic() error { errs := make(map[string]error) // check from address - _, err := sdk.AccAddressFromBech32(msg.FromAddress) + _, err := addressutils.AccAddressFromBech32(msg.FromAddress, "") if err != nil { errs["FromAddress"] = err } @@ -145,7 +151,7 @@ func (MsgSignalIntent) Type() string { return TypeMsgSignalIntent } // ValidateBasic Implements Msg. func (msg MsgSignalIntent) ValidateBasic() error { errm := make(map[string]error) - if _, err := sdk.AccAddressFromBech32(msg.FromAddress); err != nil { + if _, err := addressutils.AccAddressFromBech32(msg.FromAddress, ""); err != nil { errm["FromAddress"] = err } @@ -194,10 +200,7 @@ func (msg MsgSignalIntent) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{fromAddress} } -// NewMsgGovCloseChannel - construct a msg to update signalled intent. -func NewMsgGovCloseChannel(channelID, portName string, fromAddress sdk.Address) *MsgGovCloseChannel { - return &MsgGovCloseChannel{ChannelId: channelID, PortId: portName, Authority: fromAddress.String()} -} +// NewMsgGovCloseChannel // GetSignBytes Implements Msg. func (msg MsgGovCloseChannel) GetSignBytes() []byte { @@ -206,12 +209,22 @@ func (msg MsgGovCloseChannel) GetSignBytes() []byte { // GetSigners Implements Msg. func (msg MsgGovCloseChannel) GetSigners() []sdk.AccAddress { - fromAddress, _ := sdk.AccAddressFromBech32(msg.Authority) + fromAddress, _ := addressutils.AccAddressFromBech32(msg.Authority, "") return []sdk.AccAddress{fromAddress} } -// check channel id is correct format. validate port name? -func (MsgGovCloseChannel) ValidateBasic() error { return nil } +func (msg MsgGovCloseChannel) ValidateBasic() error { + _, err := addressutils.AccAddressFromBech32(msg.Authority, "") + if err != nil { + return err + } + + if err := ValidatePort(msg.PortId); err != nil { + return err + } + + return ValidateChannel(msg.ChannelId) +} // NewMsgGovReopenChannel - construct a msg to update signalled intent. func NewMsgGovReopenChannel(connectionID, portName string, fromAddress sdk.Address) *MsgGovReopenChannel { @@ -225,14 +238,79 @@ func (msg MsgGovReopenChannel) GetSignBytes() []byte { // GetSigners Implements Msg. func (msg MsgGovReopenChannel) GetSigners() []sdk.AccAddress { - fromAddress, _ := sdk.AccAddressFromBech32(msg.Authority) + fromAddress, _ := addressutils.AccAddressFromBech32(msg.Authority, "") return []sdk.AccAddress{fromAddress} } -// check channel id is correct format. validate port name? +// ValidateBasic func (msg MsgGovReopenChannel) ValidateBasic() error { + _, err := addressutils.AccAddressFromBech32(msg.Authority, "") + if err != nil { + return err + } + + if err := ValidatePort(msg.PortId); err != nil { + return err + } + + return ValidateConnection(msg.ConnectionId) +} + +// MsgGovSetLsmCaps + +// GetSignBytes Implements Msg. +func (msg MsgGovSetLsmCaps) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) +} + +// GetSigners Implements Msg. +func (msg MsgGovSetLsmCaps) GetSigners() []sdk.AccAddress { + fromAddress, _ := addressutils.AccAddressFromBech32(msg.Authority, "") + return []sdk.AccAddress{fromAddress} +} + +// ValidateBasic +func (msg MsgGovSetLsmCaps) ValidateBasic() error { + _, err := addressutils.AccAddressFromBech32(msg.Authority, "") + if err != nil { + return err + } + + if len(msg.ChainId) == 0 || len(msg.ChainId) > 100 { + return errors.New("invalid chain id") + } + + return msg.Caps.Validate() +} + +// Helpers +func ValidateConnection(connectionID string) error { + if !strings.HasPrefix(connectionID, "connection-") { + return errors.New("invalid connection") + } + + _, err := strconv.ParseInt(connectionID[11:], 0, 64) + + return err +} + +func ValidateChannel(channelID string) error { + if !strings.HasPrefix(channelID, "channel-") { + return errors.New("invalid channel") + } + + _, err := strconv.ParseInt(channelID[8:], 0, 64) + + return err +} + +func ValidatePort(portID string) error { + // remove leading prefix icacontroller- if passed in msg + portID = strings.ReplaceAll(portID, "icacontroller-", "") + // validate the zone exists, and the format is valid (e.g. quickgaia-1.delegate) - parts := strings.Split(msg.PortId, ".") + parts := strings.Split(portID, ".") + if len(parts) != 2 { return errors.New("invalid port format") } @@ -241,12 +319,20 @@ func (msg MsgGovReopenChannel) ValidateBasic() error { return errors.New("invalid port format; unexpected account") } - if len(msg.ConnectionId) < 12 { - return errors.New("invalid connection string; too short") + return nil +} + +func (caps LsmCaps) Validate() error { + if caps.GlobalCap.GT(sdk.OneDec()) || caps.GlobalCap.LT(sdk.ZeroDec()) { + return errors.New("global cap must be between 0 and 1") + } + + if caps.ValidatorCap.GT(sdk.OneDec()) || caps.ValidatorCap.LT(sdk.ZeroDec()) { + return errors.New("validator cap must be between 0 and 1") } - if msg.ConnectionId[0:11] != "connection-" { - return errors.New("invalid connection string; incorrect prefix") + if caps.ValidatorBondCap.LTE(sdk.ZeroDec()) { + return errors.New("validator bond cap must be greater than 0") } return nil diff --git a/x/interchainstaking/types/msgs_test.go b/x/interchainstaking/types/msgs_test.go index db111ce75..896c5d8bf 100644 --- a/x/interchainstaking/types/msgs_test.go +++ b/x/interchainstaking/types/msgs_test.go @@ -1,6 +1,7 @@ package types_test import ( + fmt "fmt" "testing" "github.com/stretchr/testify/require" @@ -241,7 +242,7 @@ func TestMsgRequestRedemption_ValidateBasic(t *testing.T) { } } -func TestMsgReopenIntent_ValidateBasic(t *testing.T) { +func TestMsgReopen_ValidateBasic(t *testing.T) { type fields struct { PortID string ConnectionID string @@ -257,12 +258,13 @@ func TestMsgReopenIntent_ValidateBasic(t *testing.T) { "blank", fields{}, true, - "invalid port format", + "empty address string is not allowed", }, { "invalid port", fields{ - PortID: "cat", + FromAddress: addressutils.GenerateAddressForTestWithPrefix("cosmos"), + PortID: "cat", }, true, "invalid port format", @@ -270,7 +272,8 @@ func TestMsgReopenIntent_ValidateBasic(t *testing.T) { { "invalid account", fields{ - PortID: "icacontroller-osmosis-4.bad", + FromAddress: addressutils.GenerateAddressForTestWithPrefix("cosmos"), + PortID: "icacontroller-osmosis-4.bad", }, true, "invalid port format; unexpected account", @@ -278,24 +281,27 @@ func TestMsgReopenIntent_ValidateBasic(t *testing.T) { { "invalid connection; too short", fields{ + FromAddress: addressutils.GenerateAddressForTestWithPrefix("cosmos"), PortID: "icacontroller-osmosis-4.withdrawal", ConnectionID: "bad-1", }, true, - "invalid connection string; too short", + "invalid connection", }, { "invalid connection; too short", fields{ + FromAddress: addressutils.GenerateAddressForTestWithPrefix("cosmos"), PortID: "icacontroller-osmosis-4.withdrawal", ConnectionID: "longenoughbutstillbad-1", }, true, - "invalid connection string; incorrect prefix", + "invalid connection", }, { "valid", fields{ + FromAddress: addressutils.GenerateAddressForTestWithPrefix("cosmos"), PortID: "icacontroller-osmosis-4.withdrawal", ConnectionID: "connection-1", }, @@ -321,3 +327,294 @@ func TestMsgReopenIntent_ValidateBasic(t *testing.T) { }) } } + +// Given a valid connectionID starting with 'connection-', the function should return nil +func TestValidateConnection_ValidConnectionID_ReturnsNil(t *testing.T) { + connectionID := "connection-123" + + err := types.ValidateConnection(connectionID) + + require.NoError(t, err) +} + +// Given a connectionID with the minimum length of 12 characters, the function should return nil +func TestValidateConnection_MinimumLengthConnectionID_ReturnsNil(t *testing.T) { + connectionID := "connection-1" + + err := types.ValidateConnection(connectionID) + + require.NoError(t, err) +} + +// Given an empty string, the function should return an error +func TestValidateConnection_EmptyString_ReturnsError(t *testing.T) { + connectionID := "" + + err := types.ValidateConnection(connectionID) + + require.Error(t, err) +} + +// Given a connectionID starting with 'connection-' and ending with a non-numeric character, the function should return an error +func TestValidateConnection_ConnectionIDWithNonNumericCharacter_ReturnsError(t *testing.T) { + connectionID := "connection-abc" + + err := types.ValidateConnection(connectionID) + + require.Error(t, err) +} + +// Given a connectionID starting with 'connection' (without the hyphen), the function should return an error +func TestValidateConnection_ConnectionIDWithoutHyphen_ReturnsError(t *testing.T) { + connectionID := "connection123" + + err := types.ValidateConnection(connectionID) + + require.Error(t, err) +} + +// Should return nil for a valid portID in the format 'zone.account' +func TestValidatePort_ValidPortID_ReturnsNil(t *testing.T) { + portID := "quickgaia-1.delegate" + + err := types.ValidatePort(portID) + + require.Nil(t, err) +} + +// Should remove the 'icacontroller-' prefix from the portID before validation +func TestValidatePort_RemovePrefix_ReturnsNil(t *testing.T) { + portID := "icacontroller-quickgaia-1.delegate" + + err := types.ValidatePort(portID) + + require.Nil(t, err) +} + +// Should accept 'delegate', 'deposit', 'performance', and 'withdrawal' as valid account types +func TestValidatePort_ValidAccountTypes_ReturnsNil(t *testing.T) { + accountTypes := []string{"delegate", "deposit", "performance", "withdrawal"} + + for _, accountType := range accountTypes { + portID := fmt.Sprintf("quickgaia-1.%s", accountType) + + err := types.ValidatePort(portID) + + require.Nil(t, err) + } +} + +// Should return an error for an invalid portID format +func TestValidatePort_InvalidFormat_ReturnsError(t *testing.T) { + portID := "invalidformat" + + err := types.ValidatePort(portID) + + require.Error(t, err) +} + +// Should return an error for a portID with more than one dot separator +func TestValidatePort_MultipleDotSeparators_ReturnsError(t *testing.T) { + portID := "quickgaia-1.delegate.extra" + + err := types.ValidatePort(portID) + + require.Error(t, err) +} + +// Should return an error for a portID with an unexpected account type +func TestValidatePort_UnexpectedAccountType_ReturnsError(t *testing.T) { + portID := "quickgaia-1.unexpected" + + err := types.ValidatePort(portID) + + require.Error(t, err) +} + +// Given a valid channel ID starting with "channel-", the function should return no error. +func TestValidateChannel_ValidChannelID_ReturnsNoError(t *testing.T) { + channelID := "channel-123" + err := types.ValidateChannel(channelID) + require.NoError(t, err) +} + +// Given a valid channel ID starting with "channel-" and followed by a number, the function should return no error. +func TestValidateChannel_ValidChannelIDWithNumber_ReturnsNoError(t *testing.T) { + channelID := "channel-456" + err := types.ValidateChannel(channelID) + require.NoError(t, err) +} + +// Given a channel ID starting with "channel-" and followed by a number greater than 0, the function should return no error. +func TestValidateChannel_ValidChannelIDWithPositiveNumber_ReturnsNoError(t *testing.T) { + channelID := "channel-789" + err := types.ValidateChannel(channelID) + require.NoError(t, err) +} + +// Given an empty string as channel ID, the function should return an error. +func TestValidateChannel_EmptyChannelID_ReturnsError(t *testing.T) { + channelID := "" + err := types.ValidateChannel(channelID) + require.Error(t, err) +} + +// Given a channel ID that does not start with "channel-", the function should return an error. +func TestValidateChannel_ChannelIDWithoutPrefix_ReturnsError(t *testing.T) { + channelID := "invalid-channel" + err := types.ValidateChannel(channelID) + require.Error(t, err) +} + +// Given a channel ID that starts with "channel" (without the trailing "-"), the function should return an error. +func TestValidateChannel_ChannelIDWithoutTrailingDash_ReturnsError(t *testing.T) { + channelID := "channel123" + err := types.ValidateChannel(channelID) + require.Error(t, err) +} + +// test the string "channel-" +func TestValidateChannel_OnlyPrefix_ReturnsError(t *testing.T) { + channelID := "channel-" + err := types.ValidateChannel(channelID) + require.Error(t, err) +} + +func TestCloseChannelValidateBasic(t *testing.T) { + cases := []struct { + Name string + Msg types.MsgGovCloseChannel + Err string + }{ + { + Name: "valid", + Msg: types.MsgGovCloseChannel{Title: "test", Description: "test", ChannelId: "channel-1", PortId: "icacontroller-juno-1.delegate", Authority: addressutils.GenerateAddressForTestWithPrefix("quick")}, + Err: "", + }, + { + Name: "invalid channel", + Msg: types.MsgGovCloseChannel{Title: "test", Description: "test", ChannelId: "cat", PortId: "juno-1.delegate", Authority: addressutils.GenerateAddressForTestWithPrefix("quick")}, + Err: "invalid channel", + }, + { + Name: "invalid port", + Msg: types.MsgGovCloseChannel{Title: "test", Description: "test", ChannelId: "channel-1", PortId: "icacontroller-juno-1.bad", Authority: addressutils.GenerateAddressForTestWithPrefix("quick")}, + Err: "invalid port", + }, + { + Name: "invalid authority", + Msg: types.MsgGovCloseChannel{Title: "test", Description: "test", ChannelId: "channel-1", PortId: "icacontroller-juno-1.delegate", Authority: "aaa"}, + Err: "decoding bech32 failed: invalid bech32 string length 3", + }, + } + + for _, c := range cases { + err := c.Msg.ValidateBasic() + if c.Err == "" { // happy + require.NoError(t, err, c.Name) + } else { + require.ErrorContains(t, err, c.Err, c.Name) + } + } +} + +func TestReopenChannelValidateBasic(t *testing.T) { + cases := []struct { + Name string + Msg types.MsgGovReopenChannel + Err string + }{ + { + Name: "valid", + Msg: types.MsgGovReopenChannel{Title: "test", Description: "test", ConnectionId: "connection-1", PortId: "icacontroller-juno-1.delegate", Authority: addressutils.GenerateAddressForTestWithPrefix("quick")}, + Err: "", + }, + { + Name: "invalid connection", + Msg: types.MsgGovReopenChannel{Title: "test", Description: "test", ConnectionId: "cat", PortId: "juno-1.delegate", Authority: addressutils.GenerateAddressForTestWithPrefix("quick")}, + Err: "invalid connection", + }, + { + Name: "invalid port", + Msg: types.MsgGovReopenChannel{Title: "test", Description: "test", ConnectionId: "connection-1", PortId: "icacontroller-juno-1.bad", Authority: addressutils.GenerateAddressForTestWithPrefix("quick")}, + Err: "invalid port", + }, + { + Name: "invalid authority", + Msg: types.MsgGovReopenChannel{Title: "test", Description: "test", ConnectionId: "connection-1", PortId: "icacontroller-juno-1.delegate", Authority: "aaa"}, + Err: "decoding bech32 failed: invalid bech32 string length 3", + }, + } + + for _, c := range cases { + err := c.Msg.ValidateBasic() + if c.Err == "" { // happy + require.NoError(t, err, c.Name) + } else { + require.ErrorContains(t, err, c.Err, c.Name) + } + } +} + +func TestGovSetLsmCaps(t *testing.T) { + cases := []struct { + Name string + Msg types.MsgGovSetLsmCaps + Err string + }{ + { + Name: "valid", + Msg: types.MsgGovSetLsmCaps{Title: "test", Description: "test", ChainId: "chain-1", Caps: &types.LsmCaps{ValidatorCap: sdk.OneDec(), ValidatorBondCap: sdk.NewDec(250), GlobalCap: sdk.NewDecWithPrec(50, 2)}, Authority: addressutils.GenerateAddressForTestWithPrefix("quick")}, + Err: "", + }, + { + Name: "invalid empty chain id", + Msg: types.MsgGovSetLsmCaps{Title: "test", Description: "test", Caps: &types.LsmCaps{ValidatorCap: sdk.OneDec(), ValidatorBondCap: sdk.NewDec(250), GlobalCap: sdk.NewDecWithPrec(50, 2)}, Authority: addressutils.GenerateAddressForTestWithPrefix("quick")}, + Err: "invalid chain id", + }, + { + Name: "invalid bad authority", + Msg: types.MsgGovSetLsmCaps{Title: "test", Description: "test", Caps: &types.LsmCaps{ValidatorCap: sdk.OneDec(), ValidatorBondCap: sdk.NewDec(250), GlobalCap: sdk.NewDecWithPrec(50, 2)}, Authority: "raa"}, + Err: "decoding bech32 failed: invalid bech32 string length 3", + }, + { + Name: "invalid validator cap < 0", + Msg: types.MsgGovSetLsmCaps{Title: "test", Description: "test", ChainId: "chain-1", Caps: &types.LsmCaps{ValidatorCap: sdk.OneDec().Neg(), ValidatorBondCap: sdk.NewDec(250), GlobalCap: sdk.NewDecWithPrec(50, 2)}, Authority: addressutils.GenerateAddressForTestWithPrefix("quick")}, + Err: "validator cap must be between 0 and 1", + }, + { + Name: "invalid validator cap > 1", + Msg: types.MsgGovSetLsmCaps{Title: "test", Description: "test", ChainId: "chain-1", Caps: &types.LsmCaps{ValidatorCap: sdk.NewDec(250), ValidatorBondCap: sdk.NewDec(250), GlobalCap: sdk.NewDecWithPrec(50, 2)}, Authority: addressutils.GenerateAddressForTestWithPrefix("quick")}, + Err: "validator cap must be between 0 and 1", + }, + { + Name: "invalid negative bond cap", + Msg: types.MsgGovSetLsmCaps{Title: "test", Description: "test", ChainId: "chain-1", Caps: &types.LsmCaps{ValidatorCap: sdk.OneDec(), ValidatorBondCap: sdk.NewDec(250).Neg(), GlobalCap: sdk.NewDecWithPrec(50, 2)}, Authority: addressutils.GenerateAddressForTestWithPrefix("quick")}, + Err: "validator bond cap must be greater than 0", + }, + { + Name: "invalid zero bond cap", + Msg: types.MsgGovSetLsmCaps{Title: "test", Description: "test", ChainId: "chain-1", Caps: &types.LsmCaps{ValidatorCap: sdk.OneDec(), ValidatorBondCap: sdk.ZeroDec(), GlobalCap: sdk.NewDecWithPrec(50, 2)}, Authority: addressutils.GenerateAddressForTestWithPrefix("quick")}, + Err: "validator bond cap must be greater than 0", + }, + { + Name: "invalid - global cap > 1", + Msg: types.MsgGovSetLsmCaps{Title: "test", Description: "test", ChainId: "chain-1", Caps: &types.LsmCaps{ValidatorCap: sdk.OneDec(), ValidatorBondCap: sdk.NewDec(250), GlobalCap: sdk.NewDecWithPrec(50, 1)}, Authority: addressutils.GenerateAddressForTestWithPrefix("quick")}, + Err: "global cap must be between 0 and 1", + }, + { + Name: "invalid - global cap < 0", + Msg: types.MsgGovSetLsmCaps{Title: "test", Description: "test", ChainId: "chain-1", Caps: &types.LsmCaps{ValidatorCap: sdk.OneDec(), ValidatorBondCap: sdk.NewDec(250), GlobalCap: sdk.NewDecWithPrec(50, 2).Neg()}, Authority: addressutils.GenerateAddressForTestWithPrefix("quick")}, + Err: "global cap must be between 0 and 1", + }, + } + + for _, c := range cases { + err := c.Msg.ValidateBasic() + if c.Err == "" { // happy + require.NoError(t, err, c.Name) + } else { + require.ErrorContains(t, err, c.Err, c.Name) + } + } +} diff --git a/x/interchainstaking/types/proposals.pb.go b/x/interchainstaking/types/proposals.pb.go index de65e4ffd..165d22705 100644 --- a/x/interchainstaking/types/proposals.pb.go +++ b/x/interchainstaking/types/proposals.pb.go @@ -414,6 +414,83 @@ func (m *MsgGovCloseChannelResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgGovCloseChannelResponse proto.InternalMessageInfo +type MsgGovSetLsmCaps struct { + Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` + Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` + ChainId string `protobuf:"bytes,3,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty" yaml:"chain_id"` + Caps *LsmCaps `protobuf:"bytes,4,opt,name=caps,proto3" json:"caps,omitempty" yaml:"caps"` + Authority string `protobuf:"bytes,5,opt,name=authority,proto3" json:"authority,omitempty"` +} + +func (m *MsgGovSetLsmCaps) Reset() { *m = MsgGovSetLsmCaps{} } +func (m *MsgGovSetLsmCaps) String() string { return proto.CompactTextString(m) } +func (*MsgGovSetLsmCaps) ProtoMessage() {} +func (*MsgGovSetLsmCaps) Descriptor() ([]byte, []int) { + return fileDescriptor_04d034c830a7acfe, []int{9} +} +func (m *MsgGovSetLsmCaps) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgGovSetLsmCaps) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgGovSetLsmCaps.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgGovSetLsmCaps) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgGovSetLsmCaps.Merge(m, src) +} +func (m *MsgGovSetLsmCaps) XXX_Size() int { + return m.Size() +} +func (m *MsgGovSetLsmCaps) XXX_DiscardUnknown() { + xxx_messageInfo_MsgGovSetLsmCaps.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgGovSetLsmCaps proto.InternalMessageInfo + +type MsgGovSetLsmCapsResponse struct { +} + +func (m *MsgGovSetLsmCapsResponse) Reset() { *m = MsgGovSetLsmCapsResponse{} } +func (m *MsgGovSetLsmCapsResponse) String() string { return proto.CompactTextString(m) } +func (*MsgGovSetLsmCapsResponse) ProtoMessage() {} +func (*MsgGovSetLsmCapsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_04d034c830a7acfe, []int{10} +} +func (m *MsgGovSetLsmCapsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgGovSetLsmCapsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgGovSetLsmCapsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgGovSetLsmCapsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgGovSetLsmCapsResponse.Merge(m, src) +} +func (m *MsgGovSetLsmCapsResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgGovSetLsmCapsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgGovSetLsmCapsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgGovSetLsmCapsResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*RegisterZoneProposal)(nil), "quicksilver.interchainstaking.v1.RegisterZoneProposal") proto.RegisterType((*RegisterZoneProposalWithDeposit)(nil), "quicksilver.interchainstaking.v1.RegisterZoneProposalWithDeposit") @@ -424,6 +501,8 @@ func init() { proto.RegisterType((*MsgGovReopenChannelResponse)(nil), "quicksilver.interchainstaking.v1.MsgGovReopenChannelResponse") proto.RegisterType((*MsgGovCloseChannel)(nil), "quicksilver.interchainstaking.v1.MsgGovCloseChannel") proto.RegisterType((*MsgGovCloseChannelResponse)(nil), "quicksilver.interchainstaking.v1.MsgGovCloseChannelResponse") + proto.RegisterType((*MsgGovSetLsmCaps)(nil), "quicksilver.interchainstaking.v1.MsgGovSetLsmCaps") + proto.RegisterType((*MsgGovSetLsmCapsResponse)(nil), "quicksilver.interchainstaking.v1.MsgGovSetLsmCapsResponse") } func init() { @@ -431,69 +510,73 @@ func init() { } var fileDescriptor_04d034c830a7acfe = []byte{ - // 978 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x56, 0x4f, 0x6f, 0xe3, 0xc4, - 0x1b, 0x4e, 0xfa, 0x27, 0x4d, 0x26, 0xff, 0xba, 0xb3, 0xe9, 0xef, 0xe7, 0xed, 0xd2, 0x38, 0x9a, - 0xc3, 0x2a, 0x68, 0xd9, 0x84, 0x40, 0x05, 0xd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0x3f, 0x02, 0x75, 0x9b, - 0x51, 0x8a, 0xed, 0x38, 0x32, 0x89, 0xa3, 0xad, 0xc7, 0x39, 0x43, 0x2d, 0x9a, 0xeb, 0xad, 0x99, - 0x35, 0xf1, 0xee, 0xa3, 0x2b, 0x34, 0x32, 0x6a, 0x8b, 0xf8, 0xd0, 0x81, 0xfb, 0x00, 0x8c, 0x2c, - 0x8e, 0x4d, 0x07, 0x53, 0x36, 0xd1, 0x36, 0x64, 0xed, 0x4e, 0x34, 0xd7, 0x6f, 0xa8, 0xda, 0x05, - 0x87, 0x8c, 0x4a, 0x1c, 0x3c, 0x8a, 0xd7, 0xf0, 0x43, 0x50, 0xf5, 0x98, 0x6d, 0x79, 0x49, 0xd9, - 0xa6, 0x2c, 0xfb, 0x5f, 0x34, 0xd7, 0xa1, 0x2a, 0xcb, 0x90, 0xc8, 0x00, 0x32, 0x52, 0x85, 0x1f, - 0x83, 0x86, 0x65, 0xdb, 0x2c, 0xa4, 0xc2, 0xf4, 0x03, 0xfc, 0x25, 0x39, 0xd5, 0x4a, 0xb2, 0xf6, - 0x56, 0x34, 0xd7, 0x77, 0x54, 0xed, 0x55, 0x1e, 0x19, 0xf5, 0x04, 0x38, 0x92, 0x31, 0xdc, 0x03, - 0x60, 0x12, 0x7a, 0x82, 0x98, 0x1c, 0x53, 0x47, 0xdb, 0xea, 0x14, 0xbb, 0x65, 0xa3, 0x22, 0x91, - 0x63, 0x4c, 0x1d, 0xf8, 0x36, 0xd8, 0xf6, 0xc8, 0xcb, 0x90, 0x38, 0x44, 0xcc, 0xcc, 0x09, 0x73, - 0x42, 0x0f, 0x6b, 0x65, 0x99, 0xd4, 0xbc, 0xc4, 0x9f, 0x4a, 0x18, 0xde, 0x01, 0xcd, 0x09, 0xe6, - 0xdc, 0x72, 0x31, 0x37, 0x7d, 0x1c, 0x98, 0xe2, 0x54, 0xab, 0x74, 0x8a, 0xdd, 0x75, 0xa3, 0x9e, - 0xc2, 0x47, 0x38, 0x78, 0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x18, 0xc5, 0x59, 0xa0, 0x7f, 0x9a, 0x73, 0x31, 0x17, 0x33, 0x1f, 0xf3, 0x51, - 0x49, 0xde, 0x9f, 0xdf, 0xff, 0x23, 0x00, 0x00, 0xff, 0xff, 0xc5, 0x80, 0x41, 0x96, 0xc6, 0x0b, - 0x00, 0x00, + // 1044 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x57, 0xcf, 0x6f, 0x1b, 0x45, + 0x14, 0xb6, 0xf3, 0xdb, 0xcf, 0x49, 0x9c, 0x4e, 0x13, 0xd8, 0xa6, 0xc4, 0x6b, 0xcd, 0xa1, 0x4a, + 0x55, 0x6a, 0xe3, 0x12, 0x41, 0x54, 0x09, 0x89, 0x3a, 0x6d, 0x21, 0x12, 0x45, 0xd1, 0xa6, 0x80, + 0xd4, 0x1e, 0x56, 0x9b, 0xdd, 0xc1, 0x19, 0x65, 0x3d, 0xb3, 0xdd, 0x19, 0x47, 0x31, 0x7f, 0x41, + 0x0f, 0x1c, 0xb8, 0x20, 0x71, 0xcc, 0x1f, 0xc1, 0x1f, 0x81, 0x38, 0x55, 0x9c, 0x38, 0xad, 0x50, + 0x72, 0xe1, 0xca, 0x72, 0xe4, 0x82, 0x76, 0x66, 0x37, 0xde, 0xd8, 0x8b, 0x2c, 0x7e, 0x15, 0xa4, + 0xde, 0xe6, 0x7d, 0xdf, 0x7b, 0x6f, 0x66, 0xbe, 0x7d, 0xdf, 0xae, 0x0d, 0x6f, 0x3d, 0xeb, 0x53, + 0xf7, 0x48, 0x50, 0xff, 0x98, 0x84, 0x2d, 0xca, 0x24, 0x09, 0xdd, 0x43, 0x87, 0x32, 0x21, 0x9d, + 0x23, 0xca, 0xba, 0xad, 0xe3, 0x76, 0x2b, 0x08, 0x79, 0xc0, 0x85, 0xe3, 0x8b, 0x66, 0x10, 0x72, + 0xc9, 0x51, 0x23, 0x57, 0xd1, 0x1c, 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 0x65, 0x40, 0x9a, 0xdf, 0xf1, 0xb9, 0x20, 0x7f, 0x57, 0x9b, 0x2d, 0x00, 0x57, 0xb7, 0x18, 0x0a, + 0x93, 0xfb, 0x58, 0x0c, 0x39, 0x6c, 0x55, 0xd2, 0xe0, 0xe5, 0x4b, 0xf2, 0x06, 0xac, 0x8f, 0x5f, + 0xf9, 0x42, 0x91, 0x2f, 0xa7, 0x60, 0x45, 0xd3, 0xfb, 0x44, 0x7e, 0x24, 0x7a, 0x3b, 0x4e, 0x20, + 0xfe, 0xb2, 0x1e, 0x7f, 0xd6, 0xa1, 0x1f, 0xc3, 0x8c, 0xeb, 0x04, 0x42, 0xc9, 0x50, 0xbd, 0x73, + 0x73, 0xb2, 0x3d, 0xd3, 0x03, 0x76, 0x6a, 0x71, 0x64, 0x56, 0xd3, 0xb6, 0x4e, 0x20, 0xb0, 0xa5, + 0xfa, 0xfc, 0x03, 0x62, 0xad, 0x83, 0x31, 0xaa, 0x46, 0x26, 0x55, 0xe7, 0xe9, 0x77, 0x67, 0xf5, + 0xf2, 0x8b, 0xb3, 0x7a, 0xf9, 0xa7, 0xb3, 0x7a, 0xf9, 0xab, 0xf3, 0x7a, 0xe9, 0xc5, 0x79, 0xbd, + 0xf4, 0xe3, 0x79, 0xbd, 0xf4, 0xe4, 0x5e, 0x97, 0xca, 0xc3, 0xfe, 0x41, 0xd3, 0xe5, 0xbd, 0x56, + 0xee, 0x0e, 0xb7, 0xbf, 0xe0, 0x8c, 0xe4, 0x81, 0xd6, 0x49, 0xc1, 0x1f, 0x0f, 0x39, 0x08, 0x88, + 0x38, 0x98, 0x53, 0x7f, 0x35, 0xde, 0xfe, 0x3d, 0x00, 0x00, 0xff, 0xff, 0x16, 0xfd, 0xa1, 0x2f, + 0x2b, 0x0d, 0x00, 0x00, } func (m *RegisterZoneProposal) Marshal() (dAtA []byte, err error) { @@ -1095,6 +1178,92 @@ func (m *MsgGovCloseChannelResponse) MarshalToSizedBuffer(dAtA []byte) (int, err return len(dAtA) - i, nil } +func (m *MsgGovSetLsmCaps) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgGovSetLsmCaps) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgGovSetLsmCaps) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintProposals(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0x2a + } + if m.Caps != nil { + { + size, err := m.Caps.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintProposals(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + if len(m.ChainId) > 0 { + i -= len(m.ChainId) + copy(dAtA[i:], m.ChainId) + i = encodeVarintProposals(dAtA, i, uint64(len(m.ChainId))) + i-- + dAtA[i] = 0x1a + } + if len(m.Description) > 0 { + i -= len(m.Description) + copy(dAtA[i:], m.Description) + i = encodeVarintProposals(dAtA, i, uint64(len(m.Description))) + i-- + dAtA[i] = 0x12 + } + if len(m.Title) > 0 { + i -= len(m.Title) + copy(dAtA[i:], m.Title) + i = encodeVarintProposals(dAtA, i, uint64(len(m.Title))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgGovSetLsmCapsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgGovSetLsmCapsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgGovSetLsmCapsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + func encodeVarintProposals(dAtA []byte, offset int, v uint64) int { offset -= sovProposals(v) base := offset @@ -1375,6 +1544,44 @@ func (m *MsgGovCloseChannelResponse) Size() (n int) { return n } +func (m *MsgGovSetLsmCaps) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Title) + if l > 0 { + n += 1 + l + sovProposals(uint64(l)) + } + l = len(m.Description) + if l > 0 { + n += 1 + l + sovProposals(uint64(l)) + } + l = len(m.ChainId) + if l > 0 { + n += 1 + l + sovProposals(uint64(l)) + } + if m.Caps != nil { + l = m.Caps.Size() + n += 1 + l + sovProposals(uint64(l)) + } + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovProposals(uint64(l)) + } + return n +} + +func (m *MsgGovSetLsmCapsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + func sovProposals(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -3239,6 +3446,270 @@ func (m *MsgGovCloseChannelResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgGovSetLsmCaps) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProposals + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgGovSetLsmCaps: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgGovSetLsmCaps: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Title", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProposals + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthProposals + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthProposals + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Title = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProposals + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthProposals + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthProposals + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Description = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProposals + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthProposals + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthProposals + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ChainId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Caps", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProposals + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthProposals + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthProposals + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Caps == nil { + m.Caps = &LsmCaps{} + } + if err := m.Caps.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProposals + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthProposals + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthProposals + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipProposals(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthProposals + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgGovSetLsmCapsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProposals + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgGovSetLsmCapsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgGovSetLsmCapsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipProposals(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthProposals + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipProposals(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/interchainstaking/types/rebalance.go b/x/interchainstaking/types/rebalance.go index 09958a1c5..26191ffa2 100644 --- a/x/interchainstaking/types/rebalance.go +++ b/x/interchainstaking/types/rebalance.go @@ -21,6 +21,7 @@ func CalculateAllocationDeltas( locked map[string]bool, currentSum sdkmath.Int, targetAllocations ValidatorIntents, + maxCanAllocate map[string]sdkmath.Int, ) (targets, sources AllocationDeltas) { targets = make(AllocationDeltas, 0) sources = make(AllocationDeltas, 0) @@ -54,6 +55,13 @@ func CalculateAllocationDeltas( // diff between target and current allocations // positive == below target (target), negative == above target (source) delta := targetAmount.Sub(current) + max, ok := maxCanAllocate[valoper] + if !ok { + max = delta + } + if max.LT(delta) { + delta = max + } if delta.IsPositive() { targets = append(targets, &AllocationDelta{Amount: delta, ValoperAddress: valoper}) @@ -167,25 +175,42 @@ type RebalanceTarget struct { type RebalanceTargets []*RebalanceTarget // Sort RebalanceTargets deterministically. -func (t RebalanceTargets) Sort() { +func (tgts RebalanceTargets) Sort() { // sort keys by relative value of delta - sort.SliceStable(t, func(i, j int) bool { + sort.SliceStable(tgts, func(i, j int) bool { // < sorts alphabetically. - return t[i].Source < t[j].Source + return tgts[i].Source < tgts[j].Source }) // sort keys by relative value of delta - sort.SliceStable(t, func(i, j int) bool { + sort.SliceStable(tgts, func(i, j int) bool { // < sorts alphabetically. - return t[i].Target < t[j].Target + return tgts[i].Target < tgts[j].Target }) // sort keys by relative value of delta - sort.SliceStable(t, func(i, j int) bool { - return t[i].Amount.LT(t[j].Amount) + sort.SliceStable(tgts, func(i, j int) bool { + return tgts[i].Amount.LT(tgts[j].Amount) }) } +func (tgts RebalanceTargets) RemoveDuplicates() RebalanceTargets { + encountered := make(map[string]bool) + result := make(RebalanceTargets, 0) + + for _, r := range tgts { + if r.Amount.IsZero() { + continue + } + key := fmt.Sprintf("%v-%s-%s", r.Amount.String(), r.Source, r.Target) + if !encountered[key] { + encountered[key] = true + result = append(result, r) + } + } + return result +} + // DetermineAllocationsForRebalancing takes maps of current and locked delegations, and based upon the target allocations, // attempts to satisfy the target allocations in the fewest number of transformations. It returns a slice of RebalanceTargets. func DetermineAllocationsForRebalancing( @@ -194,10 +219,11 @@ func DetermineAllocationsForRebalancing( currentSum sdkmath.Int, lockedSum sdkmath.Int, targetAllocations ValidatorIntents, + maxCanAllocate map[string]sdkmath.Int, logger log.Logger, ) RebalanceTargets { out := make(RebalanceTargets, 0) - targets, sources := CalculateAllocationDeltas(currentAllocations, currentLocked, currentSum, targetAllocations) + targets, sources := CalculateAllocationDeltas(currentAllocations, currentLocked, currentSum, targetAllocations, maxCanAllocate) // rebalanceBudget = (total_delegations - locked)/2 == 50% of (total_delegations - locked) // TODO: make this 2 (max_redelegation_factor) a param. diff --git a/x/interchainstaking/types/rebalance_test.go b/x/interchainstaking/types/rebalance_test.go index 03fe54928..08c41633c 100644 --- a/x/interchainstaking/types/rebalance_test.go +++ b/x/interchainstaking/types/rebalance_test.go @@ -379,7 +379,7 @@ func TestDetermineAllocationsForRebalancing(t *testing.T) { }(tt.allocations, tt.locked) actual := types.DetermineAllocationsForRebalancing( - tt.allocations, tt.locked, currentSum, lockedSum, tt.target, nil, + tt.allocations, tt.locked, currentSum, lockedSum, tt.target, make(map[string]math.Int), nil, ) require.ElementsMatch(t, tt.expected, actual) diff --git a/x/interchainstaking/types/redemptions.go b/x/interchainstaking/types/redemptions.go index 5966d8dda..b0a815c15 100644 --- a/x/interchainstaking/types/redemptions.go +++ b/x/interchainstaking/types/redemptions.go @@ -9,7 +9,7 @@ import ( func DetermineAllocationsForUndelegation(currentAllocations map[string]math.Int, lockedAllocations map[string]bool, currentSum math.Int, targetAllocations ValidatorIntents, availablePerValidator map[string]math.Int, amount sdk.Coins) map[string]math.Int { // this is brooooken input := amount[0].Amount - underAllocated, overAllocated := CalculateAllocationDeltas(currentAllocations, lockedAllocations, currentSum /* .Sub(input) */, targetAllocations) + underAllocated, overAllocated := CalculateAllocationDeltas(currentAllocations, lockedAllocations, currentSum /* .Sub(input) */, targetAllocations, make(map[string]math.Int)) outSum := sdk.ZeroInt() outWeights := make(map[string]math.Int) diff --git a/x/lsmtypes/codec.go b/x/lsmtypes/codec.go new file mode 100644 index 000000000..09a4b86c8 --- /dev/null +++ b/x/lsmtypes/codec.go @@ -0,0 +1,54 @@ +package lsmtypes + +import ( + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/codec/types" + cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// RegisterLegacyAminoCodec registers the necessary x/distribution interfaces and concrete types +// on the provided LegacyAmino codec. These types are used for Amino JSON serialization. +func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + cdc.RegisterConcrete(&MsgWithdrawTokenizeShareRecordReward{}, "cosmos-sdk/MsgWithdrawTokenizeShareRecordReward", nil) + cdc.RegisterConcrete(&MsgWithdrawAllTokenizeShareRecordReward{}, "cosmos-sdk/MsgWithdrawAllTokenizeShareRecordReward", nil) + cdc.RegisterConcrete(&MsgValidatorBond{}, "cosmos-sdk/MsgValidatorBond", nil) + cdc.RegisterConcrete(&MsgUnbondValidator{}, "cosmos-sdk/MsgUnbondValidator", nil) + cdc.RegisterConcrete(&MsgTokenizeShares{}, "cosmos-sdk/MsgTokenizeShares", nil) + cdc.RegisterConcrete(&MsgRedeemTokensForShares{}, "cosmos-sdk/MsgRedeemTokensForShares", nil) + cdc.RegisterConcrete(&MsgTransferTokenizeShareRecord{}, "cosmos-sdk/MsgTransferTokenizeRecord", nil) + cdc.RegisterConcrete(&MsgDisableTokenizeShares{}, "cosmos-sdk/MsgDisableTokenizeShares", nil) + cdc.RegisterConcrete(&MsgEnableTokenizeShares{}, "cosmos-sdk/MsgEnableTokenizeShares", nil) +} + +func RegisterInterfaces(registry types.InterfaceRegistry) { + registry.RegisterImplementations( + (*sdk.Msg)(nil), + &MsgWithdrawTokenizeShareRecordReward{}, + &MsgWithdrawAllTokenizeShareRecordReward{}, + &MsgValidatorBond{}, + &MsgUnbondValidator{}, + &MsgTokenizeShares{}, + &MsgRedeemTokensForShares{}, + &MsgTransferTokenizeShareRecord{}, + &MsgDisableTokenizeShares{}, + &MsgEnableTokenizeShares{}, + ) +} + +var ( + amino = codec.NewLegacyAmino() + // ModuleCdc references the global x/staking module codec. Note, the codec should + // ONLY be used in certain instances of tests and for JSON encoding as Amino is + // still used for that purpose. + // + // The actual codec used for serialization should be provided to x/staking and + // defined at the application level. + ModuleCdc = codec.NewAminoCodec(amino) +) + +func init() { + RegisterLegacyAminoCodec(amino) + cryptocodec.RegisterCrypto(amino) + sdk.RegisterLegacyAminoCodec(amino) +} diff --git a/x/lsmtypes/msg.go b/x/lsmtypes/msg.go new file mode 100644 index 000000000..9a48a78c3 --- /dev/null +++ b/x/lsmtypes/msg.go @@ -0,0 +1,416 @@ +package lsmtypes + +import ( + "cosmossdk.io/errors" + + "github.com/cosmos/cosmos-sdk/codec/legacy" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" +) + +var ( + _ sdk.Msg = &MsgUnbondValidator{} + _ sdk.Msg = &MsgTokenizeShares{} + _ sdk.Msg = &MsgRedeemTokensForShares{} + _ sdk.Msg = &MsgTransferTokenizeShareRecord{} + _ sdk.Msg = &MsgDisableTokenizeShares{} + _ sdk.Msg = &MsgEnableTokenizeShares{} + _ sdk.Msg = &MsgValidatorBond{} +) + +const ( + TypeMsgUndelegate = "begin_unbonding" + TypeMsgUnbondValidator = "unbond_validator" + TypeMsgEditValidator = "edit_validator" + TypeMsgCreateValidator = "create_validator" + TypeMsgDelegate = "delegate" + TypeMsgBeginRedelegate = "begin_redelegate" + TypeMsgCancelUnbondingDelegation = "cancel_unbond" + TypeMsgTokenizeShares = "tokenize_shares" + TypeMsgRedeemTokensForShares = "redeem_tokens_for_shares" //nolint:gosec + TypeMsgTransferTokenizeShareRecord = "transfer_tokenize_share_record" + TypeMsgDisableTokenizeShares = "disable_tokenize_shares" + TypeMsgEnableTokenizeShares = "enable_tokenize_shares" //nolint:gosec + TypeMsgValidatorBond = "validator_bond" + TypeMsgWithdrawTokenizeShareRecordReward = "withdraw_tokenize_share_record_reward" + TypeMsgWithdrawAllTokenizeShareRecordReward = "withdraw_all_tokenize_share_record_reward" + + RouterKey = "lsm" + ModuleName = "lsm" +) + +// NewMsgUnbondValidator creates a new MsgUnbondValidator instance. +// +//nolint:interfacer +func NewMsgUnbondValidator(valAddr sdk.ValAddress) *MsgUnbondValidator { + return &MsgUnbondValidator{ + ValidatorAddress: valAddr.String(), + } +} + +// Route implements the sdk.Msg interface. +func (msg MsgUnbondValidator) Route() string { return RouterKey } + +// Type implements the sdk.Msg interface. +func (msg MsgUnbondValidator) Type() string { return TypeMsgUnbondValidator } + +// GetSigners implements the sdk.Msg interface. +func (msg MsgUnbondValidator) GetSigners() []sdk.AccAddress { + valAddr, err := sdk.ValAddressFromBech32(msg.ValidatorAddress) + if err != nil { + panic(err) + } + return []sdk.AccAddress{valAddr.Bytes()} +} + +// GetSignBytes implements the sdk.Msg interface. +func (msg MsgUnbondValidator) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(&msg) + return sdk.MustSortJSON(bz) +} + +// ValidateBasic implements the sdk.Msg interface. +func (msg MsgUnbondValidator) ValidateBasic() error { + if _, err := sdk.ValAddressFromBech32(msg.ValidatorAddress); err != nil { + return sdkerrors.ErrInvalidAddress.Wrapf("invalid validator address: %s", err) + } + + return nil +} + +// NewMsgTokenizeShares creates a new MsgTokenizeShares instance. +// +//nolint:interfacer +func NewMsgTokenizeShares(delAddr sdk.AccAddress, valAddr sdk.ValAddress, amount sdk.Coin, owner sdk.AccAddress) *MsgTokenizeShares { + return &MsgTokenizeShares{ + DelegatorAddress: delAddr.String(), + ValidatorAddress: valAddr.String(), + Amount: amount, + TokenizedShareOwner: owner.String(), + } +} + +// Route implements the sdk.Msg interface. +func (msg MsgTokenizeShares) Route() string { return RouterKey } + +// Type implements the sdk.Msg interface. +func (msg MsgTokenizeShares) Type() string { return TypeMsgTokenizeShares } + +// GetSigners implements the sdk.Msg interface. +func (msg MsgTokenizeShares) GetSigners() []sdk.AccAddress { + delegator, err := sdk.AccAddressFromBech32(msg.DelegatorAddress) + if err != nil { + panic(err) + } + return []sdk.AccAddress{delegator} +} + +// MsgTokenizeShares implements the sdk.Msg interface. +func (msg MsgTokenizeShares) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(&msg) + return sdk.MustSortJSON(bz) +} + +// ValidateBasic implements the sdk.Msg interface. +func (msg MsgTokenizeShares) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.DelegatorAddress); err != nil { + return sdkerrors.ErrInvalidAddress.Wrapf("invalid delegator address: %s", err) + } + if _, err := sdk.ValAddressFromBech32(msg.ValidatorAddress); err != nil { + return sdkerrors.ErrInvalidAddress.Wrapf("invalid validator address: %s", err) + } + if _, err := sdk.AccAddressFromBech32(msg.TokenizedShareOwner); err != nil { + return sdkerrors.ErrInvalidAddress.Wrapf("invalid tokenize share owner address: %s", err) + } + + if !msg.Amount.IsValid() || !msg.Amount.Amount.IsPositive() { + return errors.Wrap( + sdkerrors.ErrInvalidRequest, + "invalid shares amount", + ) + } + + return nil +} + +// NewMsgRedeemTokensForShares creates a new MsgRedeemTokensForShares instance. +// +//nolint:interfacer +func NewMsgRedeemTokensForShares(delAddr sdk.AccAddress, amount sdk.Coin) *MsgRedeemTokensForShares { + return &MsgRedeemTokensForShares{ + DelegatorAddress: delAddr.String(), + Amount: amount, + } +} + +// Route implements the sdk.Msg interface. +func (msg MsgRedeemTokensForShares) Route() string { return RouterKey } + +// Type implements the sdk.Msg interface. +func (msg MsgRedeemTokensForShares) Type() string { return TypeMsgRedeemTokensForShares } + +// GetSigners implements the sdk.Msg interface. +func (msg MsgRedeemTokensForShares) GetSigners() []sdk.AccAddress { + delegator, err := sdk.AccAddressFromBech32(msg.DelegatorAddress) + if err != nil { + panic(err) + } + return []sdk.AccAddress{delegator} +} + +// GetSignBytes implements the sdk.Msg interface. +func (msg MsgRedeemTokensForShares) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(&msg) + return sdk.MustSortJSON(bz) +} + +// ValidateBasic implements the sdk.Msg interface. +func (msg MsgRedeemTokensForShares) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.DelegatorAddress); err != nil { + return sdkerrors.ErrInvalidAddress.Wrapf("invalid delegator address: %s", err) + } + + if !msg.Amount.IsValid() || !msg.Amount.Amount.IsPositive() { + return errors.Wrap( + sdkerrors.ErrInvalidRequest, + "invalid shares amount", + ) + } + + return nil +} + +// NewMsgTransferTokenizeShareRecord creates a new MsgTransferTokenizeShareRecord instance. +// +//nolint:interfacer +func NewMsgTransferTokenizeShareRecord(recordID uint64, sender, newOwner sdk.AccAddress) *MsgTransferTokenizeShareRecord { + return &MsgTransferTokenizeShareRecord{ + TokenizeShareRecordId: recordID, + Sender: sender.String(), + NewOwner: newOwner.String(), + } +} + +// Route implements the sdk.Msg interface. +func (msg MsgTransferTokenizeShareRecord) Route() string { return RouterKey } + +// Type implements the sdk.Msg interface. +func (msg MsgTransferTokenizeShareRecord) Type() string { return TypeMsgTransferTokenizeShareRecord } + +// GetSigners implements the sdk.Msg interface. +func (msg MsgTransferTokenizeShareRecord) GetSigners() []sdk.AccAddress { + sender, err := sdk.AccAddressFromBech32(msg.Sender) + if err != nil { + panic(err) + } + return []sdk.AccAddress{sender} +} + +// GetSignBytes implements the sdk.Msg interface. +func (msg MsgTransferTokenizeShareRecord) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(&msg) + return sdk.MustSortJSON(bz) +} + +// ValidateBasic implements the sdk.Msg interface. +func (msg MsgTransferTokenizeShareRecord) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.Sender); err != nil { + return sdkerrors.ErrInvalidAddress.Wrapf("invalid sender address: %s", err) + } + if _, err := sdk.AccAddressFromBech32(msg.NewOwner); err != nil { + return sdkerrors.ErrInvalidAddress.Wrapf("invalid new owner address: %s", err) + } + + return nil +} + +// NewMsgDisableTokenizeShares creates a new MsgDisableTokenizeShares instance. +// +//nolint:interfacer +func NewMsgDisableTokenizeShares(delAddr sdk.AccAddress) *MsgDisableTokenizeShares { + return &MsgDisableTokenizeShares{ + DelegatorAddress: delAddr.String(), + } +} + +// Route implements the sdk.Msg interface. +func (msg MsgDisableTokenizeShares) Route() string { return RouterKey } + +// Type implements the sdk.Msg interface. +func (msg MsgDisableTokenizeShares) Type() string { return TypeMsgDisableTokenizeShares } + +// GetSigners implements the sdk.Msg interface. +func (msg MsgDisableTokenizeShares) GetSigners() []sdk.AccAddress { + sender, err := sdk.AccAddressFromBech32(msg.DelegatorAddress) + if err != nil { + panic(err) + } + return []sdk.AccAddress{sender} +} + +// GetSignBytes implements the sdk.Msg interface. +func (msg MsgDisableTokenizeShares) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(&msg) + return sdk.MustSortJSON(bz) +} + +// ValidateBasic implements the sdk.Msg interface. +func (msg MsgDisableTokenizeShares) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.DelegatorAddress); err != nil { + return sdkerrors.ErrInvalidAddress.Wrapf("invalid sender address: %s", err) + } + + return nil +} + +// NewMsgEnableTokenizeShares creates a new MsgEnableTokenizeShares instance. +// +//nolint:interfacer +func NewMsgEnableTokenizeShares(delAddr sdk.AccAddress) *MsgEnableTokenizeShares { + return &MsgEnableTokenizeShares{ + DelegatorAddress: delAddr.String(), + } +} + +// Route implements the sdk.Msg interface. +func (msg MsgEnableTokenizeShares) Route() string { return RouterKey } + +// Type implements the sdk.Msg interface. +func (msg MsgEnableTokenizeShares) Type() string { return TypeMsgEnableTokenizeShares } + +// GetSigners implements the sdk.Msg interface. +func (msg MsgEnableTokenizeShares) GetSigners() []sdk.AccAddress { + sender, err := sdk.AccAddressFromBech32(msg.DelegatorAddress) + if err != nil { + panic(err) + } + return []sdk.AccAddress{sender} +} + +// GetSignBytes implements the sdk.Msg interface. +func (msg MsgEnableTokenizeShares) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(&msg) + return sdk.MustSortJSON(bz) +} + +// ValidateBasic implements the sdk.Msg interface. +func (msg MsgEnableTokenizeShares) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.DelegatorAddress); err != nil { + return sdkerrors.ErrInvalidAddress.Wrapf("invalid sender address: %s", err) + } + + return nil +} + +// NewMsgValidatorBond creates a new MsgValidatorBond instance. +// +//nolint:interfacer +func NewMsgValidatorBond(delAddr sdk.AccAddress, valAddr sdk.ValAddress) *MsgValidatorBond { + return &MsgValidatorBond{ + DelegatorAddress: delAddr.String(), + ValidatorAddress: valAddr.String(), + } +} + +// Route implements the sdk.Msg interface. +func (msg MsgValidatorBond) Route() string { return RouterKey } + +// Type implements the sdk.Msg interface. +func (msg MsgValidatorBond) Type() string { return TypeMsgValidatorBond } + +// GetSigners implements the sdk.Msg interface. +func (msg MsgValidatorBond) GetSigners() []sdk.AccAddress { + delegator, err := sdk.AccAddressFromBech32(msg.DelegatorAddress) + if err != nil { + panic(err) + } + return []sdk.AccAddress{delegator} +} + +// GetSignBytes implements the sdk.Msg interface. +func (msg MsgValidatorBond) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(&msg) + return sdk.MustSortJSON(bz) +} + +// ValidateBasic implements the sdk.Msg interface. +func (msg MsgValidatorBond) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.DelegatorAddress); err != nil { + return sdkerrors.ErrInvalidAddress.Wrapf("invalid delegator address: %s", err) + } + if _, err := sdk.ValAddressFromBech32(msg.ValidatorAddress); err != nil { + return sdkerrors.ErrInvalidAddress.Wrapf("invalid validator address: %s", err) + } + + return nil +} + +func NewMsgWithdrawTokenizeShareRecordReward(ownerAddr sdk.AccAddress, recordID uint64) *MsgWithdrawTokenizeShareRecordReward { + return &MsgWithdrawTokenizeShareRecordReward{ + OwnerAddress: ownerAddr.String(), + RecordId: recordID, + } +} + +func (msg MsgWithdrawTokenizeShareRecordReward) Route() string { return ModuleName } +func (msg MsgWithdrawTokenizeShareRecordReward) Type() string { + return TypeMsgWithdrawTokenizeShareRecordReward +} + +// Return address that must sign over msg.GetSignBytes() +func (msg MsgWithdrawTokenizeShareRecordReward) GetSigners() []sdk.AccAddress { + owner, err := sdk.AccAddressFromBech32(msg.OwnerAddress) + if err != nil { + panic(err) + } + return []sdk.AccAddress{owner} +} + +// get the bytes for the message signer to sign on +func (msg MsgWithdrawTokenizeShareRecordReward) GetSignBytes() []byte { + bz := legacy.Cdc.MustMarshalJSON(&msg) + return sdk.MustSortJSON(bz) +} + +// quick validity check +func (msg MsgWithdrawTokenizeShareRecordReward) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.OwnerAddress); err != nil { + return sdkerrors.ErrInvalidAddress.Wrapf("invalid owner address: %s", err) + } + return nil +} + +func NewMsgWithdrawAllTokenizeShareRecordReward(ownerAddr sdk.AccAddress) *MsgWithdrawAllTokenizeShareRecordReward { + return &MsgWithdrawAllTokenizeShareRecordReward{ + OwnerAddress: ownerAddr.String(), + } +} + +func (msg MsgWithdrawAllTokenizeShareRecordReward) Route() string { return ModuleName } + +func (msg MsgWithdrawAllTokenizeShareRecordReward) Type() string { + return TypeMsgWithdrawAllTokenizeShareRecordReward +} + +// Return address that must sign over msg.GetSignBytes() +func (msg MsgWithdrawAllTokenizeShareRecordReward) GetSigners() []sdk.AccAddress { + owner, err := sdk.AccAddressFromBech32(msg.OwnerAddress) + if err != nil { + panic(err) + } + return []sdk.AccAddress{owner} +} + +// get the bytes for the message signer to sign on +func (msg MsgWithdrawAllTokenizeShareRecordReward) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(&msg) + return sdk.MustSortJSON(bz) +} + +// quick validity check +func (msg MsgWithdrawAllTokenizeShareRecordReward) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.OwnerAddress); err != nil { + return sdkerrors.ErrInvalidAddress.Wrapf("invalid owner address: %s", err) + } + return nil +} diff --git a/x/lsmtypes/types.pb.go b/x/lsmtypes/types.pb.go new file mode 100644 index 000000000..cf6ab3ac7 --- /dev/null +++ b/x/lsmtypes/types.pb.go @@ -0,0 +1,7855 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: quicksilver/lsm-types/v1/types.proto + +package lsmtypes + +import ( + fmt "fmt" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + types "github.com/cosmos/cosmos-sdk/types" + query "github.com/cosmos/cosmos-sdk/types/query" + _ "github.com/cosmos/cosmos-sdk/x/staking/types" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/gogo/protobuf/proto" + github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" + _ "google.golang.org/protobuf/types/known/timestamppb" + io "io" + math "math" + math_bits "math/bits" + time "time" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf +var _ = time.Kitchen + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// TokenizeShareLockStatus indicates whether the address is able to tokenize +// shares +type TokenizeShareLockStatus int32 + +const ( + // UNSPECIFIED defines an empty tokenize share lock status + TOKENIZE_SHARE_LOCK_STATUS_UNSPECIFIED TokenizeShareLockStatus = 0 + // LOCKED indicates the account is locked and cannot tokenize shares + TOKENIZE_SHARE_LOCK_STATUS_LOCKED TokenizeShareLockStatus = 1 + // UNLOCKED indicates the account is unlocked and can tokenize shares + TOKENIZE_SHARE_LOCK_STATUS_UNLOCKED TokenizeShareLockStatus = 2 + // LOCK_EXPIRING indicates the account is unable to tokenize shares, but + // will be able to tokenize shortly (after 1 unbonding period) + TOKENIZE_SHARE_LOCK_STATUS_LOCK_EXPIRING TokenizeShareLockStatus = 3 +) + +var TokenizeShareLockStatus_name = map[int32]string{ + 0: "TOKENIZE_SHARE_LOCK_STATUS_UNSPECIFIED", + 1: "TOKENIZE_SHARE_LOCK_STATUS_LOCKED", + 2: "TOKENIZE_SHARE_LOCK_STATUS_UNLOCKED", + 3: "TOKENIZE_SHARE_LOCK_STATUS_LOCK_EXPIRING", +} + +var TokenizeShareLockStatus_value = map[string]int32{ + "TOKENIZE_SHARE_LOCK_STATUS_UNSPECIFIED": 0, + "TOKENIZE_SHARE_LOCK_STATUS_LOCKED": 1, + "TOKENIZE_SHARE_LOCK_STATUS_UNLOCKED": 2, + "TOKENIZE_SHARE_LOCK_STATUS_LOCK_EXPIRING": 3, +} + +func (x TokenizeShareLockStatus) String() string { + return proto.EnumName(TokenizeShareLockStatus_name, int32(x)) +} + +func (TokenizeShareLockStatus) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_e9fece234f7a11d4, []int{0} +} + +// TokenizeShareRecordReward represents the properties of tokenize share +type TokenizeShareRecordReward struct { + RecordId uint64 `protobuf:"varint,1,opt,name=record_id,json=recordId,proto3" json:"record_id,omitempty"` + Reward github_com_cosmos_cosmos_sdk_types.DecCoins `protobuf:"bytes,2,rep,name=reward,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.DecCoins" json:"reward"` +} + +func (m *TokenizeShareRecordReward) Reset() { *m = TokenizeShareRecordReward{} } +func (m *TokenizeShareRecordReward) String() string { return proto.CompactTextString(m) } +func (*TokenizeShareRecordReward) ProtoMessage() {} +func (*TokenizeShareRecordReward) Descriptor() ([]byte, []int) { + return fileDescriptor_e9fece234f7a11d4, []int{0} +} +func (m *TokenizeShareRecordReward) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TokenizeShareRecordReward) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TokenizeShareRecordReward.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *TokenizeShareRecordReward) XXX_Merge(src proto.Message) { + xxx_messageInfo_TokenizeShareRecordReward.Merge(m, src) +} +func (m *TokenizeShareRecordReward) XXX_Size() int { + return m.Size() +} +func (m *TokenizeShareRecordReward) XXX_DiscardUnknown() { + xxx_messageInfo_TokenizeShareRecordReward.DiscardUnknown(m) +} + +var xxx_messageInfo_TokenizeShareRecordReward proto.InternalMessageInfo + +// QueryTokenizeShareRecordRewardRequest is the request type for the +// Query/TokenizeShareRecordReward RPC +// method. +type QueryTokenizeShareRecordRewardRequest struct { + OwnerAddress string `protobuf:"bytes,1,opt,name=owner_address,json=ownerAddress,proto3" json:"owner_address,omitempty" yaml:"owner_address"` +} + +func (m *QueryTokenizeShareRecordRewardRequest) Reset() { *m = QueryTokenizeShareRecordRewardRequest{} } +func (m *QueryTokenizeShareRecordRewardRequest) String() string { return proto.CompactTextString(m) } +func (*QueryTokenizeShareRecordRewardRequest) ProtoMessage() {} +func (*QueryTokenizeShareRecordRewardRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_e9fece234f7a11d4, []int{1} +} +func (m *QueryTokenizeShareRecordRewardRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTokenizeShareRecordRewardRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTokenizeShareRecordRewardRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryTokenizeShareRecordRewardRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTokenizeShareRecordRewardRequest.Merge(m, src) +} +func (m *QueryTokenizeShareRecordRewardRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryTokenizeShareRecordRewardRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTokenizeShareRecordRewardRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryTokenizeShareRecordRewardRequest proto.InternalMessageInfo + +// QueryTokenizeShareRecordRewardResponse is the response type for the +// Query/TokenizeShareRecordReward RPC method. +type QueryTokenizeShareRecordRewardResponse struct { + // rewards defines all the rewards accrued by a delegator. + Rewards []TokenizeShareRecordReward `protobuf:"bytes,1,rep,name=rewards,proto3" json:"rewards"` + // total defines the sum of all the rewards. + Total github_com_cosmos_cosmos_sdk_types.DecCoins `protobuf:"bytes,2,rep,name=total,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.DecCoins" json:"total"` +} + +func (m *QueryTokenizeShareRecordRewardResponse) Reset() { + *m = QueryTokenizeShareRecordRewardResponse{} +} +func (m *QueryTokenizeShareRecordRewardResponse) String() string { return proto.CompactTextString(m) } +func (*QueryTokenizeShareRecordRewardResponse) ProtoMessage() {} +func (*QueryTokenizeShareRecordRewardResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_e9fece234f7a11d4, []int{2} +} +func (m *QueryTokenizeShareRecordRewardResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTokenizeShareRecordRewardResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTokenizeShareRecordRewardResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryTokenizeShareRecordRewardResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTokenizeShareRecordRewardResponse.Merge(m, src) +} +func (m *QueryTokenizeShareRecordRewardResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryTokenizeShareRecordRewardResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTokenizeShareRecordRewardResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryTokenizeShareRecordRewardResponse proto.InternalMessageInfo + +func (m *QueryTokenizeShareRecordRewardResponse) GetRewards() []TokenizeShareRecordReward { + if m != nil { + return m.Rewards + } + return nil +} + +func (m *QueryTokenizeShareRecordRewardResponse) GetTotal() github_com_cosmos_cosmos_sdk_types.DecCoins { + if m != nil { + return m.Total + } + return nil +} + +// MsgWithdrawTokenizeShareRecordReward withdraws tokenize share rewards for a +// specific record +type MsgWithdrawTokenizeShareRecordReward struct { + OwnerAddress string `protobuf:"bytes,1,opt,name=owner_address,json=ownerAddress,proto3" json:"owner_address,omitempty" yaml:"owner_address"` + RecordId uint64 `protobuf:"varint,2,opt,name=record_id,json=recordId,proto3" json:"record_id,omitempty"` +} + +func (m *MsgWithdrawTokenizeShareRecordReward) Reset() { *m = MsgWithdrawTokenizeShareRecordReward{} } +func (m *MsgWithdrawTokenizeShareRecordReward) String() string { return proto.CompactTextString(m) } +func (*MsgWithdrawTokenizeShareRecordReward) ProtoMessage() {} +func (*MsgWithdrawTokenizeShareRecordReward) Descriptor() ([]byte, []int) { + return fileDescriptor_e9fece234f7a11d4, []int{3} +} +func (m *MsgWithdrawTokenizeShareRecordReward) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgWithdrawTokenizeShareRecordReward) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgWithdrawTokenizeShareRecordReward.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgWithdrawTokenizeShareRecordReward) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgWithdrawTokenizeShareRecordReward.Merge(m, src) +} +func (m *MsgWithdrawTokenizeShareRecordReward) XXX_Size() int { + return m.Size() +} +func (m *MsgWithdrawTokenizeShareRecordReward) XXX_DiscardUnknown() { + xxx_messageInfo_MsgWithdrawTokenizeShareRecordReward.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgWithdrawTokenizeShareRecordReward proto.InternalMessageInfo + +// MsgWithdrawTokenizeShareRecordReward defines the +// Msg/WithdrawTokenizeShareRecordReward response type. +type MsgWithdrawTokenizeShareRecordRewardResponse struct { +} + +func (m *MsgWithdrawTokenizeShareRecordRewardResponse) Reset() { + *m = MsgWithdrawTokenizeShareRecordRewardResponse{} +} +func (m *MsgWithdrawTokenizeShareRecordRewardResponse) String() string { + return proto.CompactTextString(m) +} +func (*MsgWithdrawTokenizeShareRecordRewardResponse) ProtoMessage() {} +func (*MsgWithdrawTokenizeShareRecordRewardResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_e9fece234f7a11d4, []int{4} +} +func (m *MsgWithdrawTokenizeShareRecordRewardResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgWithdrawTokenizeShareRecordRewardResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgWithdrawTokenizeShareRecordRewardResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgWithdrawTokenizeShareRecordRewardResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgWithdrawTokenizeShareRecordRewardResponse.Merge(m, src) +} +func (m *MsgWithdrawTokenizeShareRecordRewardResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgWithdrawTokenizeShareRecordRewardResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgWithdrawTokenizeShareRecordRewardResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgWithdrawTokenizeShareRecordRewardResponse proto.InternalMessageInfo + +// MsgWithdrawAllTokenizeShareRecordReward withdraws tokenize share rewards or +// all records owned by the designated owner +type MsgWithdrawAllTokenizeShareRecordReward struct { + OwnerAddress string `protobuf:"bytes,1,opt,name=owner_address,json=ownerAddress,proto3" json:"owner_address,omitempty" yaml:"owner_address"` +} + +func (m *MsgWithdrawAllTokenizeShareRecordReward) Reset() { + *m = MsgWithdrawAllTokenizeShareRecordReward{} +} +func (m *MsgWithdrawAllTokenizeShareRecordReward) String() string { return proto.CompactTextString(m) } +func (*MsgWithdrawAllTokenizeShareRecordReward) ProtoMessage() {} +func (*MsgWithdrawAllTokenizeShareRecordReward) Descriptor() ([]byte, []int) { + return fileDescriptor_e9fece234f7a11d4, []int{5} +} +func (m *MsgWithdrawAllTokenizeShareRecordReward) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgWithdrawAllTokenizeShareRecordReward) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgWithdrawAllTokenizeShareRecordReward.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgWithdrawAllTokenizeShareRecordReward) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgWithdrawAllTokenizeShareRecordReward.Merge(m, src) +} +func (m *MsgWithdrawAllTokenizeShareRecordReward) XXX_Size() int { + return m.Size() +} +func (m *MsgWithdrawAllTokenizeShareRecordReward) XXX_DiscardUnknown() { + xxx_messageInfo_MsgWithdrawAllTokenizeShareRecordReward.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgWithdrawAllTokenizeShareRecordReward proto.InternalMessageInfo + +// MsgWithdrawAllTokenizeShareRecordRewardResponse defines the +// Msg/WithdrawTokenizeShareRecordReward response type. +type MsgWithdrawAllTokenizeShareRecordRewardResponse struct { +} + +func (m *MsgWithdrawAllTokenizeShareRecordRewardResponse) Reset() { + *m = MsgWithdrawAllTokenizeShareRecordRewardResponse{} +} +func (m *MsgWithdrawAllTokenizeShareRecordRewardResponse) String() string { + return proto.CompactTextString(m) +} +func (*MsgWithdrawAllTokenizeShareRecordRewardResponse) ProtoMessage() {} +func (*MsgWithdrawAllTokenizeShareRecordRewardResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_e9fece234f7a11d4, []int{6} +} +func (m *MsgWithdrawAllTokenizeShareRecordRewardResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgWithdrawAllTokenizeShareRecordRewardResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgWithdrawAllTokenizeShareRecordRewardResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgWithdrawAllTokenizeShareRecordRewardResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgWithdrawAllTokenizeShareRecordRewardResponse.Merge(m, src) +} +func (m *MsgWithdrawAllTokenizeShareRecordRewardResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgWithdrawAllTokenizeShareRecordRewardResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgWithdrawAllTokenizeShareRecordRewardResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgWithdrawAllTokenizeShareRecordRewardResponse proto.InternalMessageInfo + +// QueryTokenizeShareRecordByIdRequest is request type for the +// Query/QueryTokenizeShareRecordById RPC method. +type QueryTokenizeShareRecordByIdRequest struct { + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` +} + +func (m *QueryTokenizeShareRecordByIdRequest) Reset() { *m = QueryTokenizeShareRecordByIdRequest{} } +func (m *QueryTokenizeShareRecordByIdRequest) String() string { return proto.CompactTextString(m) } +func (*QueryTokenizeShareRecordByIdRequest) ProtoMessage() {} +func (*QueryTokenizeShareRecordByIdRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_e9fece234f7a11d4, []int{7} +} +func (m *QueryTokenizeShareRecordByIdRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTokenizeShareRecordByIdRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTokenizeShareRecordByIdRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryTokenizeShareRecordByIdRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTokenizeShareRecordByIdRequest.Merge(m, src) +} +func (m *QueryTokenizeShareRecordByIdRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryTokenizeShareRecordByIdRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTokenizeShareRecordByIdRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryTokenizeShareRecordByIdRequest proto.InternalMessageInfo + +func (m *QueryTokenizeShareRecordByIdRequest) GetId() uint64 { + if m != nil { + return m.Id + } + return 0 +} + +// QueryTokenizeShareRecordByIdRequest is response type for the +// Query/QueryTokenizeShareRecordById RPC method. +type QueryTokenizeShareRecordByIdResponse struct { + Record TokenizeShareRecord `protobuf:"bytes,1,opt,name=record,proto3" json:"record"` +} + +func (m *QueryTokenizeShareRecordByIdResponse) Reset() { *m = QueryTokenizeShareRecordByIdResponse{} } +func (m *QueryTokenizeShareRecordByIdResponse) String() string { return proto.CompactTextString(m) } +func (*QueryTokenizeShareRecordByIdResponse) ProtoMessage() {} +func (*QueryTokenizeShareRecordByIdResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_e9fece234f7a11d4, []int{8} +} +func (m *QueryTokenizeShareRecordByIdResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTokenizeShareRecordByIdResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTokenizeShareRecordByIdResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryTokenizeShareRecordByIdResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTokenizeShareRecordByIdResponse.Merge(m, src) +} +func (m *QueryTokenizeShareRecordByIdResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryTokenizeShareRecordByIdResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTokenizeShareRecordByIdResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryTokenizeShareRecordByIdResponse proto.InternalMessageInfo + +func (m *QueryTokenizeShareRecordByIdResponse) GetRecord() TokenizeShareRecord { + if m != nil { + return m.Record + } + return TokenizeShareRecord{} +} + +// QueryTokenizeShareRecordByDenomRequest is request type for the +// Query/QueryTokenizeShareRecordByDenom RPC method. +type QueryTokenizeShareRecordByDenomRequest struct { + Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` +} + +func (m *QueryTokenizeShareRecordByDenomRequest) Reset() { + *m = QueryTokenizeShareRecordByDenomRequest{} +} +func (m *QueryTokenizeShareRecordByDenomRequest) String() string { return proto.CompactTextString(m) } +func (*QueryTokenizeShareRecordByDenomRequest) ProtoMessage() {} +func (*QueryTokenizeShareRecordByDenomRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_e9fece234f7a11d4, []int{9} +} +func (m *QueryTokenizeShareRecordByDenomRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTokenizeShareRecordByDenomRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTokenizeShareRecordByDenomRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryTokenizeShareRecordByDenomRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTokenizeShareRecordByDenomRequest.Merge(m, src) +} +func (m *QueryTokenizeShareRecordByDenomRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryTokenizeShareRecordByDenomRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTokenizeShareRecordByDenomRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryTokenizeShareRecordByDenomRequest proto.InternalMessageInfo + +func (m *QueryTokenizeShareRecordByDenomRequest) GetDenom() string { + if m != nil { + return m.Denom + } + return "" +} + +// QueryTokenizeShareRecordByDenomResponse is response type for the +// Query/QueryTokenizeShareRecordByDenom RPC method. +type QueryTokenizeShareRecordByDenomResponse struct { + Record TokenizeShareRecord `protobuf:"bytes,1,opt,name=record,proto3" json:"record"` +} + +func (m *QueryTokenizeShareRecordByDenomResponse) Reset() { + *m = QueryTokenizeShareRecordByDenomResponse{} +} +func (m *QueryTokenizeShareRecordByDenomResponse) String() string { return proto.CompactTextString(m) } +func (*QueryTokenizeShareRecordByDenomResponse) ProtoMessage() {} +func (*QueryTokenizeShareRecordByDenomResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_e9fece234f7a11d4, []int{10} +} +func (m *QueryTokenizeShareRecordByDenomResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTokenizeShareRecordByDenomResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTokenizeShareRecordByDenomResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryTokenizeShareRecordByDenomResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTokenizeShareRecordByDenomResponse.Merge(m, src) +} +func (m *QueryTokenizeShareRecordByDenomResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryTokenizeShareRecordByDenomResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTokenizeShareRecordByDenomResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryTokenizeShareRecordByDenomResponse proto.InternalMessageInfo + +func (m *QueryTokenizeShareRecordByDenomResponse) GetRecord() TokenizeShareRecord { + if m != nil { + return m.Record + } + return TokenizeShareRecord{} +} + +// QueryTokenizeShareRecordsOwnedRequest is request type for the +// Query/QueryTokenizeShareRecordsOwned RPC method. +type QueryTokenizeShareRecordsOwnedRequest struct { + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` +} + +func (m *QueryTokenizeShareRecordsOwnedRequest) Reset() { *m = QueryTokenizeShareRecordsOwnedRequest{} } +func (m *QueryTokenizeShareRecordsOwnedRequest) String() string { return proto.CompactTextString(m) } +func (*QueryTokenizeShareRecordsOwnedRequest) ProtoMessage() {} +func (*QueryTokenizeShareRecordsOwnedRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_e9fece234f7a11d4, []int{11} +} +func (m *QueryTokenizeShareRecordsOwnedRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTokenizeShareRecordsOwnedRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTokenizeShareRecordsOwnedRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryTokenizeShareRecordsOwnedRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTokenizeShareRecordsOwnedRequest.Merge(m, src) +} +func (m *QueryTokenizeShareRecordsOwnedRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryTokenizeShareRecordsOwnedRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTokenizeShareRecordsOwnedRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryTokenizeShareRecordsOwnedRequest proto.InternalMessageInfo + +func (m *QueryTokenizeShareRecordsOwnedRequest) GetOwner() string { + if m != nil { + return m.Owner + } + return "" +} + +// QueryTokenizeShareRecordsOwnedResponse is response type for the +// Query/QueryTokenizeShareRecordsOwned RPC method. +type QueryTokenizeShareRecordsOwnedResponse struct { + Records []TokenizeShareRecord `protobuf:"bytes,1,rep,name=records,proto3" json:"records"` +} + +func (m *QueryTokenizeShareRecordsOwnedResponse) Reset() { + *m = QueryTokenizeShareRecordsOwnedResponse{} +} +func (m *QueryTokenizeShareRecordsOwnedResponse) String() string { return proto.CompactTextString(m) } +func (*QueryTokenizeShareRecordsOwnedResponse) ProtoMessage() {} +func (*QueryTokenizeShareRecordsOwnedResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_e9fece234f7a11d4, []int{12} +} +func (m *QueryTokenizeShareRecordsOwnedResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTokenizeShareRecordsOwnedResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTokenizeShareRecordsOwnedResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryTokenizeShareRecordsOwnedResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTokenizeShareRecordsOwnedResponse.Merge(m, src) +} +func (m *QueryTokenizeShareRecordsOwnedResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryTokenizeShareRecordsOwnedResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTokenizeShareRecordsOwnedResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryTokenizeShareRecordsOwnedResponse proto.InternalMessageInfo + +func (m *QueryTokenizeShareRecordsOwnedResponse) GetRecords() []TokenizeShareRecord { + if m != nil { + return m.Records + } + return nil +} + +// QueryAllTokenizeShareRecordsRequest is request type for the +// Query/QueryAllTokenizeShareRecords RPC method. +type QueryAllTokenizeShareRecordsRequest struct { + // pagination defines an optional pagination for the request. + Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryAllTokenizeShareRecordsRequest) Reset() { *m = QueryAllTokenizeShareRecordsRequest{} } +func (m *QueryAllTokenizeShareRecordsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryAllTokenizeShareRecordsRequest) ProtoMessage() {} +func (*QueryAllTokenizeShareRecordsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_e9fece234f7a11d4, []int{13} +} +func (m *QueryAllTokenizeShareRecordsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAllTokenizeShareRecordsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAllTokenizeShareRecordsRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryAllTokenizeShareRecordsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllTokenizeShareRecordsRequest.Merge(m, src) +} +func (m *QueryAllTokenizeShareRecordsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryAllTokenizeShareRecordsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllTokenizeShareRecordsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAllTokenizeShareRecordsRequest proto.InternalMessageInfo + +func (m *QueryAllTokenizeShareRecordsRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryAllTokenizeShareRecordsResponse is response type for the +// Query/QueryAllTokenizeShareRecords RPC method. +type QueryAllTokenizeShareRecordsResponse struct { + Records []TokenizeShareRecord `protobuf:"bytes,1,rep,name=records,proto3" json:"records"` + // pagination defines the pagination in the response. + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryAllTokenizeShareRecordsResponse) Reset() { *m = QueryAllTokenizeShareRecordsResponse{} } +func (m *QueryAllTokenizeShareRecordsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryAllTokenizeShareRecordsResponse) ProtoMessage() {} +func (*QueryAllTokenizeShareRecordsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_e9fece234f7a11d4, []int{14} +} +func (m *QueryAllTokenizeShareRecordsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAllTokenizeShareRecordsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAllTokenizeShareRecordsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryAllTokenizeShareRecordsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllTokenizeShareRecordsResponse.Merge(m, src) +} +func (m *QueryAllTokenizeShareRecordsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryAllTokenizeShareRecordsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllTokenizeShareRecordsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAllTokenizeShareRecordsResponse proto.InternalMessageInfo + +func (m *QueryAllTokenizeShareRecordsResponse) GetRecords() []TokenizeShareRecord { + if m != nil { + return m.Records + } + return nil +} + +func (m *QueryAllTokenizeShareRecordsResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryLastTokenizeShareRecordIdRequest is request type for the +// Query/QueryLastTokenizeShareRecordId RPC method. +type QueryLastTokenizeShareRecordIdRequest struct { +} + +func (m *QueryLastTokenizeShareRecordIdRequest) Reset() { *m = QueryLastTokenizeShareRecordIdRequest{} } +func (m *QueryLastTokenizeShareRecordIdRequest) String() string { return proto.CompactTextString(m) } +func (*QueryLastTokenizeShareRecordIdRequest) ProtoMessage() {} +func (*QueryLastTokenizeShareRecordIdRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_e9fece234f7a11d4, []int{15} +} +func (m *QueryLastTokenizeShareRecordIdRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryLastTokenizeShareRecordIdRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryLastTokenizeShareRecordIdRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryLastTokenizeShareRecordIdRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryLastTokenizeShareRecordIdRequest.Merge(m, src) +} +func (m *QueryLastTokenizeShareRecordIdRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryLastTokenizeShareRecordIdRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryLastTokenizeShareRecordIdRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryLastTokenizeShareRecordIdRequest proto.InternalMessageInfo + +// QueryLastTokenizeShareRecordIdResponse is response type for the +// Query/QueryLastTokenizeShareRecordId RPC method. +type QueryLastTokenizeShareRecordIdResponse struct { + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` +} + +func (m *QueryLastTokenizeShareRecordIdResponse) Reset() { + *m = QueryLastTokenizeShareRecordIdResponse{} +} +func (m *QueryLastTokenizeShareRecordIdResponse) String() string { return proto.CompactTextString(m) } +func (*QueryLastTokenizeShareRecordIdResponse) ProtoMessage() {} +func (*QueryLastTokenizeShareRecordIdResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_e9fece234f7a11d4, []int{16} +} +func (m *QueryLastTokenizeShareRecordIdResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryLastTokenizeShareRecordIdResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryLastTokenizeShareRecordIdResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryLastTokenizeShareRecordIdResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryLastTokenizeShareRecordIdResponse.Merge(m, src) +} +func (m *QueryLastTokenizeShareRecordIdResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryLastTokenizeShareRecordIdResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryLastTokenizeShareRecordIdResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryLastTokenizeShareRecordIdResponse proto.InternalMessageInfo + +func (m *QueryLastTokenizeShareRecordIdResponse) GetId() uint64 { + if m != nil { + return m.Id + } + return 0 +} + +// QueryTotalTokenizeSharedAssetsRequest is request type for the +// Query/QueryTotalTokenizeSharedAssets RPC method. +type QueryTotalTokenizeSharedAssetsRequest struct { +} + +func (m *QueryTotalTokenizeSharedAssetsRequest) Reset() { *m = QueryTotalTokenizeSharedAssetsRequest{} } +func (m *QueryTotalTokenizeSharedAssetsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryTotalTokenizeSharedAssetsRequest) ProtoMessage() {} +func (*QueryTotalTokenizeSharedAssetsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_e9fece234f7a11d4, []int{17} +} +func (m *QueryTotalTokenizeSharedAssetsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTotalTokenizeSharedAssetsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTotalTokenizeSharedAssetsRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryTotalTokenizeSharedAssetsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTotalTokenizeSharedAssetsRequest.Merge(m, src) +} +func (m *QueryTotalTokenizeSharedAssetsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryTotalTokenizeSharedAssetsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTotalTokenizeSharedAssetsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryTotalTokenizeSharedAssetsRequest proto.InternalMessageInfo + +// QueryTotalTokenizeSharedAssetsResponse is response type for the +// Query/QueryTotalTokenizeSharedAssets RPC method. +type QueryTotalTokenizeSharedAssetsResponse struct { + Value types.Coin `protobuf:"bytes,1,opt,name=value,proto3" json:"value"` +} + +func (m *QueryTotalTokenizeSharedAssetsResponse) Reset() { + *m = QueryTotalTokenizeSharedAssetsResponse{} +} +func (m *QueryTotalTokenizeSharedAssetsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryTotalTokenizeSharedAssetsResponse) ProtoMessage() {} +func (*QueryTotalTokenizeSharedAssetsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_e9fece234f7a11d4, []int{18} +} +func (m *QueryTotalTokenizeSharedAssetsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTotalTokenizeSharedAssetsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTotalTokenizeSharedAssetsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryTotalTokenizeSharedAssetsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTotalTokenizeSharedAssetsResponse.Merge(m, src) +} +func (m *QueryTotalTokenizeSharedAssetsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryTotalTokenizeSharedAssetsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTotalTokenizeSharedAssetsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryTotalTokenizeSharedAssetsResponse proto.InternalMessageInfo + +func (m *QueryTotalTokenizeSharedAssetsResponse) GetValue() types.Coin { + if m != nil { + return m.Value + } + return types.Coin{} +} + +// QueryTotalLiquidStakedRequest is request type for the +// Query/QueryQueryTotalLiquidStaked RPC method. +type QueryTotalLiquidStaked struct { +} + +func (m *QueryTotalLiquidStaked) Reset() { *m = QueryTotalLiquidStaked{} } +func (m *QueryTotalLiquidStaked) String() string { return proto.CompactTextString(m) } +func (*QueryTotalLiquidStaked) ProtoMessage() {} +func (*QueryTotalLiquidStaked) Descriptor() ([]byte, []int) { + return fileDescriptor_e9fece234f7a11d4, []int{19} +} +func (m *QueryTotalLiquidStaked) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTotalLiquidStaked) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTotalLiquidStaked.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryTotalLiquidStaked) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTotalLiquidStaked.Merge(m, src) +} +func (m *QueryTotalLiquidStaked) XXX_Size() int { + return m.Size() +} +func (m *QueryTotalLiquidStaked) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTotalLiquidStaked.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryTotalLiquidStaked proto.InternalMessageInfo + +// QueryTotalLiquidStakedResponse is response type for the +// Query/QueryQueryTotalLiquidStaked RPC method. +type QueryTotalLiquidStakedResponse struct { + Tokens string `protobuf:"bytes,1,opt,name=tokens,proto3" json:"tokens,omitempty"` +} + +func (m *QueryTotalLiquidStakedResponse) Reset() { *m = QueryTotalLiquidStakedResponse{} } +func (m *QueryTotalLiquidStakedResponse) String() string { return proto.CompactTextString(m) } +func (*QueryTotalLiquidStakedResponse) ProtoMessage() {} +func (*QueryTotalLiquidStakedResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_e9fece234f7a11d4, []int{20} +} +func (m *QueryTotalLiquidStakedResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTotalLiquidStakedResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTotalLiquidStakedResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryTotalLiquidStakedResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTotalLiquidStakedResponse.Merge(m, src) +} +func (m *QueryTotalLiquidStakedResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryTotalLiquidStakedResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTotalLiquidStakedResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryTotalLiquidStakedResponse proto.InternalMessageInfo + +func (m *QueryTotalLiquidStakedResponse) GetTokens() string { + if m != nil { + return m.Tokens + } + return "" +} + +// QueryTokenizeShareLockInfo queries the tokenize share lock information +// associated with given account +type QueryTokenizeShareLockInfo struct { + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` +} + +func (m *QueryTokenizeShareLockInfo) Reset() { *m = QueryTokenizeShareLockInfo{} } +func (m *QueryTokenizeShareLockInfo) String() string { return proto.CompactTextString(m) } +func (*QueryTokenizeShareLockInfo) ProtoMessage() {} +func (*QueryTokenizeShareLockInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_e9fece234f7a11d4, []int{21} +} +func (m *QueryTokenizeShareLockInfo) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTokenizeShareLockInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTokenizeShareLockInfo.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryTokenizeShareLockInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTokenizeShareLockInfo.Merge(m, src) +} +func (m *QueryTokenizeShareLockInfo) XXX_Size() int { + return m.Size() +} +func (m *QueryTokenizeShareLockInfo) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTokenizeShareLockInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryTokenizeShareLockInfo proto.InternalMessageInfo + +func (m *QueryTokenizeShareLockInfo) GetAddress() string { + if m != nil { + return m.Address + } + return "" +} + +// QueryTokenizeShareLockInfoResponse is the response from the +// QueryTokenizeShareLockInfo query +type QueryTokenizeShareLockInfoResponse struct { + Status string `protobuf:"bytes,1,opt,name=status,proto3" json:"status,omitempty"` + ExpirationTime string `protobuf:"bytes,2,opt,name=expiration_time,json=expirationTime,proto3" json:"expiration_time,omitempty"` +} + +func (m *QueryTokenizeShareLockInfoResponse) Reset() { *m = QueryTokenizeShareLockInfoResponse{} } +func (m *QueryTokenizeShareLockInfoResponse) String() string { return proto.CompactTextString(m) } +func (*QueryTokenizeShareLockInfoResponse) ProtoMessage() {} +func (*QueryTokenizeShareLockInfoResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_e9fece234f7a11d4, []int{22} +} +func (m *QueryTokenizeShareLockInfoResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTokenizeShareLockInfoResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTokenizeShareLockInfoResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryTokenizeShareLockInfoResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTokenizeShareLockInfoResponse.Merge(m, src) +} +func (m *QueryTokenizeShareLockInfoResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryTokenizeShareLockInfoResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTokenizeShareLockInfoResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryTokenizeShareLockInfoResponse proto.InternalMessageInfo + +func (m *QueryTokenizeShareLockInfoResponse) GetStatus() string { + if m != nil { + return m.Status + } + return "" +} + +func (m *QueryTokenizeShareLockInfoResponse) GetExpirationTime() string { + if m != nil { + return m.ExpirationTime + } + return "" +} + +// TokenizeShareRecord represents a tokenized delegation +type TokenizeShareRecord struct { + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + Owner string `protobuf:"bytes,2,opt,name=owner,proto3" json:"owner,omitempty"` + ModuleAccount string `protobuf:"bytes,3,opt,name=module_account,json=moduleAccount,proto3" json:"module_account,omitempty"` + Validator string `protobuf:"bytes,4,opt,name=validator,proto3" json:"validator,omitempty"` +} + +func (m *TokenizeShareRecord) Reset() { *m = TokenizeShareRecord{} } +func (m *TokenizeShareRecord) String() string { return proto.CompactTextString(m) } +func (*TokenizeShareRecord) ProtoMessage() {} +func (*TokenizeShareRecord) Descriptor() ([]byte, []int) { + return fileDescriptor_e9fece234f7a11d4, []int{23} +} +func (m *TokenizeShareRecord) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TokenizeShareRecord) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TokenizeShareRecord.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *TokenizeShareRecord) XXX_Merge(src proto.Message) { + xxx_messageInfo_TokenizeShareRecord.Merge(m, src) +} +func (m *TokenizeShareRecord) XXX_Size() int { + return m.Size() +} +func (m *TokenizeShareRecord) XXX_DiscardUnknown() { + xxx_messageInfo_TokenizeShareRecord.DiscardUnknown(m) +} + +var xxx_messageInfo_TokenizeShareRecord proto.InternalMessageInfo + +func (m *TokenizeShareRecord) GetId() uint64 { + if m != nil { + return m.Id + } + return 0 +} + +func (m *TokenizeShareRecord) GetOwner() string { + if m != nil { + return m.Owner + } + return "" +} + +func (m *TokenizeShareRecord) GetModuleAccount() string { + if m != nil { + return m.ModuleAccount + } + return "" +} + +func (m *TokenizeShareRecord) GetValidator() string { + if m != nil { + return m.Validator + } + return "" +} + +// PendingTokenizeShareAuthorizations stores a list of addresses that have their +// tokenize share enablement in progress +type PendingTokenizeShareAuthorizations struct { + Addresses []string `protobuf:"bytes,1,rep,name=addresses,proto3" json:"addresses,omitempty"` +} + +func (m *PendingTokenizeShareAuthorizations) Reset() { *m = PendingTokenizeShareAuthorizations{} } +func (m *PendingTokenizeShareAuthorizations) String() string { return proto.CompactTextString(m) } +func (*PendingTokenizeShareAuthorizations) ProtoMessage() {} +func (*PendingTokenizeShareAuthorizations) Descriptor() ([]byte, []int) { + return fileDescriptor_e9fece234f7a11d4, []int{24} +} +func (m *PendingTokenizeShareAuthorizations) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PendingTokenizeShareAuthorizations) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_PendingTokenizeShareAuthorizations.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *PendingTokenizeShareAuthorizations) XXX_Merge(src proto.Message) { + xxx_messageInfo_PendingTokenizeShareAuthorizations.Merge(m, src) +} +func (m *PendingTokenizeShareAuthorizations) XXX_Size() int { + return m.Size() +} +func (m *PendingTokenizeShareAuthorizations) XXX_DiscardUnknown() { + xxx_messageInfo_PendingTokenizeShareAuthorizations.DiscardUnknown(m) +} + +var xxx_messageInfo_PendingTokenizeShareAuthorizations proto.InternalMessageInfo + +func (m *PendingTokenizeShareAuthorizations) GetAddresses() []string { + if m != nil { + return m.Addresses + } + return nil +} + +// MsgUnbondValidator defines a method for performing the status transition for +// a validator from bonded to unbonded +type MsgUnbondValidator struct { + ValidatorAddress string `protobuf:"bytes,1,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty" yaml:"address"` +} + +func (m *MsgUnbondValidator) Reset() { *m = MsgUnbondValidator{} } +func (m *MsgUnbondValidator) String() string { return proto.CompactTextString(m) } +func (*MsgUnbondValidator) ProtoMessage() {} +func (*MsgUnbondValidator) Descriptor() ([]byte, []int) { + return fileDescriptor_e9fece234f7a11d4, []int{25} +} +func (m *MsgUnbondValidator) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUnbondValidator) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUnbondValidator.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUnbondValidator) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUnbondValidator.Merge(m, src) +} +func (m *MsgUnbondValidator) XXX_Size() int { + return m.Size() +} +func (m *MsgUnbondValidator) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUnbondValidator.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUnbondValidator proto.InternalMessageInfo + +func (m *MsgUnbondValidator) GetValidatorAddress() string { + if m != nil { + return m.ValidatorAddress + } + return "" +} + +// MsgUnbondValidatorResponse defines the Msg/UnbondValidator response type. +type MsgUnbondValidatorResponse struct { +} + +func (m *MsgUnbondValidatorResponse) Reset() { *m = MsgUnbondValidatorResponse{} } +func (m *MsgUnbondValidatorResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUnbondValidatorResponse) ProtoMessage() {} +func (*MsgUnbondValidatorResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_e9fece234f7a11d4, []int{26} +} +func (m *MsgUnbondValidatorResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUnbondValidatorResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUnbondValidatorResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUnbondValidatorResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUnbondValidatorResponse.Merge(m, src) +} +func (m *MsgUnbondValidatorResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUnbondValidatorResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUnbondValidatorResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUnbondValidatorResponse proto.InternalMessageInfo + +// MsgTokenizeShares tokenizes a delegation +type MsgTokenizeShares struct { + DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty" yaml:"delegator_address"` + ValidatorAddress string `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty" yaml:"validator_address"` + Amount types.Coin `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount"` + TokenizedShareOwner string `protobuf:"bytes,4,opt,name=tokenized_share_owner,json=tokenizedShareOwner,proto3" json:"tokenized_share_owner,omitempty"` +} + +func (m *MsgTokenizeShares) Reset() { *m = MsgTokenizeShares{} } +func (m *MsgTokenizeShares) String() string { return proto.CompactTextString(m) } +func (*MsgTokenizeShares) ProtoMessage() {} +func (*MsgTokenizeShares) Descriptor() ([]byte, []int) { + return fileDescriptor_e9fece234f7a11d4, []int{27} +} +func (m *MsgTokenizeShares) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgTokenizeShares) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgTokenizeShares.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgTokenizeShares) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgTokenizeShares.Merge(m, src) +} +func (m *MsgTokenizeShares) XXX_Size() int { + return m.Size() +} +func (m *MsgTokenizeShares) XXX_DiscardUnknown() { + xxx_messageInfo_MsgTokenizeShares.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgTokenizeShares proto.InternalMessageInfo + +// MsgTokenizeSharesResponse defines the Msg/MsgTokenizeShares response type. +type MsgTokenizeSharesResponse struct { + Amount types.Coin `protobuf:"bytes,1,opt,name=amount,proto3" json:"amount"` +} + +func (m *MsgTokenizeSharesResponse) Reset() { *m = MsgTokenizeSharesResponse{} } +func (m *MsgTokenizeSharesResponse) String() string { return proto.CompactTextString(m) } +func (*MsgTokenizeSharesResponse) ProtoMessage() {} +func (*MsgTokenizeSharesResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_e9fece234f7a11d4, []int{28} +} +func (m *MsgTokenizeSharesResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgTokenizeSharesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgTokenizeSharesResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgTokenizeSharesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgTokenizeSharesResponse.Merge(m, src) +} +func (m *MsgTokenizeSharesResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgTokenizeSharesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgTokenizeSharesResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgTokenizeSharesResponse proto.InternalMessageInfo + +func (m *MsgTokenizeSharesResponse) GetAmount() types.Coin { + if m != nil { + return m.Amount + } + return types.Coin{} +} + +// MsgRedeemTokensForShares redeems a tokenized share back into a native +// delegation +type MsgRedeemTokensForShares struct { + DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty" yaml:"delegator_address"` + Amount types.Coin `protobuf:"bytes,2,opt,name=amount,proto3" json:"amount"` +} + +func (m *MsgRedeemTokensForShares) Reset() { *m = MsgRedeemTokensForShares{} } +func (m *MsgRedeemTokensForShares) String() string { return proto.CompactTextString(m) } +func (*MsgRedeemTokensForShares) ProtoMessage() {} +func (*MsgRedeemTokensForShares) Descriptor() ([]byte, []int) { + return fileDescriptor_e9fece234f7a11d4, []int{29} +} +func (m *MsgRedeemTokensForShares) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRedeemTokensForShares) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRedeemTokensForShares.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgRedeemTokensForShares) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRedeemTokensForShares.Merge(m, src) +} +func (m *MsgRedeemTokensForShares) XXX_Size() int { + return m.Size() +} +func (m *MsgRedeemTokensForShares) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRedeemTokensForShares.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRedeemTokensForShares proto.InternalMessageInfo + +// MsgRedeemTokensForSharesResponse defines the Msg/MsgRedeemTokensForShares +// response type. +type MsgRedeemTokensForSharesResponse struct { + Amount types.Coin `protobuf:"bytes,1,opt,name=amount,proto3" json:"amount"` +} + +func (m *MsgRedeemTokensForSharesResponse) Reset() { *m = MsgRedeemTokensForSharesResponse{} } +func (m *MsgRedeemTokensForSharesResponse) String() string { return proto.CompactTextString(m) } +func (*MsgRedeemTokensForSharesResponse) ProtoMessage() {} +func (*MsgRedeemTokensForSharesResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_e9fece234f7a11d4, []int{30} +} +func (m *MsgRedeemTokensForSharesResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRedeemTokensForSharesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRedeemTokensForSharesResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgRedeemTokensForSharesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRedeemTokensForSharesResponse.Merge(m, src) +} +func (m *MsgRedeemTokensForSharesResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgRedeemTokensForSharesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRedeemTokensForSharesResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRedeemTokensForSharesResponse proto.InternalMessageInfo + +func (m *MsgRedeemTokensForSharesResponse) GetAmount() types.Coin { + if m != nil { + return m.Amount + } + return types.Coin{} +} + +// MsgTransferTokenizeShareRecord transfer a tokenize share record +type MsgTransferTokenizeShareRecord struct { + TokenizeShareRecordId uint64 `protobuf:"varint,1,opt,name=tokenize_share_record_id,json=tokenizeShareRecordId,proto3" json:"tokenize_share_record_id,omitempty"` + Sender string `protobuf:"bytes,2,opt,name=sender,proto3" json:"sender,omitempty"` + NewOwner string `protobuf:"bytes,3,opt,name=new_owner,json=newOwner,proto3" json:"new_owner,omitempty"` +} + +func (m *MsgTransferTokenizeShareRecord) Reset() { *m = MsgTransferTokenizeShareRecord{} } +func (m *MsgTransferTokenizeShareRecord) String() string { return proto.CompactTextString(m) } +func (*MsgTransferTokenizeShareRecord) ProtoMessage() {} +func (*MsgTransferTokenizeShareRecord) Descriptor() ([]byte, []int) { + return fileDescriptor_e9fece234f7a11d4, []int{31} +} +func (m *MsgTransferTokenizeShareRecord) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgTransferTokenizeShareRecord) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgTransferTokenizeShareRecord.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgTransferTokenizeShareRecord) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgTransferTokenizeShareRecord.Merge(m, src) +} +func (m *MsgTransferTokenizeShareRecord) XXX_Size() int { + return m.Size() +} +func (m *MsgTransferTokenizeShareRecord) XXX_DiscardUnknown() { + xxx_messageInfo_MsgTransferTokenizeShareRecord.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgTransferTokenizeShareRecord proto.InternalMessageInfo + +// MsgTransferTokenizeShareRecordResponse defines the +// Msg/MsgTransferTokenizeShareRecord response type. +type MsgTransferTokenizeShareRecordResponse struct { +} + +func (m *MsgTransferTokenizeShareRecordResponse) Reset() { + *m = MsgTransferTokenizeShareRecordResponse{} +} +func (m *MsgTransferTokenizeShareRecordResponse) String() string { return proto.CompactTextString(m) } +func (*MsgTransferTokenizeShareRecordResponse) ProtoMessage() {} +func (*MsgTransferTokenizeShareRecordResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_e9fece234f7a11d4, []int{32} +} +func (m *MsgTransferTokenizeShareRecordResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgTransferTokenizeShareRecordResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgTransferTokenizeShareRecordResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgTransferTokenizeShareRecordResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgTransferTokenizeShareRecordResponse.Merge(m, src) +} +func (m *MsgTransferTokenizeShareRecordResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgTransferTokenizeShareRecordResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgTransferTokenizeShareRecordResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgTransferTokenizeShareRecordResponse proto.InternalMessageInfo + +// MsgDisableTokenizeShares prevents the tokenization of shares for a given +// address +type MsgDisableTokenizeShares struct { + DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty" yaml:"delegator_address"` +} + +func (m *MsgDisableTokenizeShares) Reset() { *m = MsgDisableTokenizeShares{} } +func (m *MsgDisableTokenizeShares) String() string { return proto.CompactTextString(m) } +func (*MsgDisableTokenizeShares) ProtoMessage() {} +func (*MsgDisableTokenizeShares) Descriptor() ([]byte, []int) { + return fileDescriptor_e9fece234f7a11d4, []int{33} +} +func (m *MsgDisableTokenizeShares) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgDisableTokenizeShares) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgDisableTokenizeShares.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgDisableTokenizeShares) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgDisableTokenizeShares.Merge(m, src) +} +func (m *MsgDisableTokenizeShares) XXX_Size() int { + return m.Size() +} +func (m *MsgDisableTokenizeShares) XXX_DiscardUnknown() { + xxx_messageInfo_MsgDisableTokenizeShares.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgDisableTokenizeShares proto.InternalMessageInfo + +// MsgDisableTokenizeSharesResponse defines the Msg/DisableTokenizeShares +// response type. +type MsgDisableTokenizeSharesResponse struct { +} + +func (m *MsgDisableTokenizeSharesResponse) Reset() { *m = MsgDisableTokenizeSharesResponse{} } +func (m *MsgDisableTokenizeSharesResponse) String() string { return proto.CompactTextString(m) } +func (*MsgDisableTokenizeSharesResponse) ProtoMessage() {} +func (*MsgDisableTokenizeSharesResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_e9fece234f7a11d4, []int{34} +} +func (m *MsgDisableTokenizeSharesResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgDisableTokenizeSharesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgDisableTokenizeSharesResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgDisableTokenizeSharesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgDisableTokenizeSharesResponse.Merge(m, src) +} +func (m *MsgDisableTokenizeSharesResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgDisableTokenizeSharesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgDisableTokenizeSharesResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgDisableTokenizeSharesResponse proto.InternalMessageInfo + +// MsgEnableTokenizeShares re-enables tokenization of shares for a given address +type MsgEnableTokenizeShares struct { + DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty" yaml:"delegator_address"` +} + +func (m *MsgEnableTokenizeShares) Reset() { *m = MsgEnableTokenizeShares{} } +func (m *MsgEnableTokenizeShares) String() string { return proto.CompactTextString(m) } +func (*MsgEnableTokenizeShares) ProtoMessage() {} +func (*MsgEnableTokenizeShares) Descriptor() ([]byte, []int) { + return fileDescriptor_e9fece234f7a11d4, []int{35} +} +func (m *MsgEnableTokenizeShares) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgEnableTokenizeShares) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgEnableTokenizeShares.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgEnableTokenizeShares) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgEnableTokenizeShares.Merge(m, src) +} +func (m *MsgEnableTokenizeShares) XXX_Size() int { + return m.Size() +} +func (m *MsgEnableTokenizeShares) XXX_DiscardUnknown() { + xxx_messageInfo_MsgEnableTokenizeShares.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgEnableTokenizeShares proto.InternalMessageInfo + +// MsgEnableTokenizeSharesResponse defines the Msg/EnableTokenizeShares response +// type. +type MsgEnableTokenizeSharesResponse struct { + CompletionTime time.Time `protobuf:"bytes,1,opt,name=completion_time,json=completionTime,proto3,stdtime" json:"completion_time"` +} + +func (m *MsgEnableTokenizeSharesResponse) Reset() { *m = MsgEnableTokenizeSharesResponse{} } +func (m *MsgEnableTokenizeSharesResponse) String() string { return proto.CompactTextString(m) } +func (*MsgEnableTokenizeSharesResponse) ProtoMessage() {} +func (*MsgEnableTokenizeSharesResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_e9fece234f7a11d4, []int{36} +} +func (m *MsgEnableTokenizeSharesResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgEnableTokenizeSharesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgEnableTokenizeSharesResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgEnableTokenizeSharesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgEnableTokenizeSharesResponse.Merge(m, src) +} +func (m *MsgEnableTokenizeSharesResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgEnableTokenizeSharesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgEnableTokenizeSharesResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgEnableTokenizeSharesResponse proto.InternalMessageInfo + +func (m *MsgEnableTokenizeSharesResponse) GetCompletionTime() time.Time { + if m != nil { + return m.CompletionTime + } + return time.Time{} +} + +// MsgValidatorBond defines a SDK message for performing validator self-bond of +// delegated coins from a delegator to a validator. +type MsgValidatorBond struct { + DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty" yaml:"delegator_address"` + ValidatorAddress string `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty" yaml:"validator_address"` +} + +func (m *MsgValidatorBond) Reset() { *m = MsgValidatorBond{} } +func (m *MsgValidatorBond) String() string { return proto.CompactTextString(m) } +func (*MsgValidatorBond) ProtoMessage() {} +func (*MsgValidatorBond) Descriptor() ([]byte, []int) { + return fileDescriptor_e9fece234f7a11d4, []int{37} +} +func (m *MsgValidatorBond) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgValidatorBond) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgValidatorBond.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgValidatorBond) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgValidatorBond.Merge(m, src) +} +func (m *MsgValidatorBond) XXX_Size() int { + return m.Size() +} +func (m *MsgValidatorBond) XXX_DiscardUnknown() { + xxx_messageInfo_MsgValidatorBond.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgValidatorBond proto.InternalMessageInfo + +// MsgValidatorBondResponse defines the Msg/ValidatorBond response type. +type MsgValidatorBondResponse struct { +} + +func (m *MsgValidatorBondResponse) Reset() { *m = MsgValidatorBondResponse{} } +func (m *MsgValidatorBondResponse) String() string { return proto.CompactTextString(m) } +func (*MsgValidatorBondResponse) ProtoMessage() {} +func (*MsgValidatorBondResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_e9fece234f7a11d4, []int{38} +} +func (m *MsgValidatorBondResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgValidatorBondResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgValidatorBondResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgValidatorBondResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgValidatorBondResponse.Merge(m, src) +} +func (m *MsgValidatorBondResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgValidatorBondResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgValidatorBondResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgValidatorBondResponse proto.InternalMessageInfo + +func init() { + proto.RegisterEnum("cosmos.staking.v1beta1.TokenizeShareLockStatus", TokenizeShareLockStatus_name, TokenizeShareLockStatus_value) + proto.RegisterType((*TokenizeShareRecordReward)(nil), "cosmos.staking.v1beta1.TokenizeShareRecordReward") + proto.RegisterType((*QueryTokenizeShareRecordRewardRequest)(nil), "cosmos.staking.v1beta1.QueryTokenizeShareRecordRewardRequest") + proto.RegisterType((*QueryTokenizeShareRecordRewardResponse)(nil), "cosmos.staking.v1beta1.QueryTokenizeShareRecordRewardResponse") + proto.RegisterType((*MsgWithdrawTokenizeShareRecordReward)(nil), "cosmos.staking.v1beta1.MsgWithdrawTokenizeShareRecordReward") + proto.RegisterType((*MsgWithdrawTokenizeShareRecordRewardResponse)(nil), "cosmos.staking.v1beta1.MsgWithdrawTokenizeShareRecordRewardResponse") + proto.RegisterType((*MsgWithdrawAllTokenizeShareRecordReward)(nil), "cosmos.staking.v1beta1.MsgWithdrawAllTokenizeShareRecordReward") + proto.RegisterType((*MsgWithdrawAllTokenizeShareRecordRewardResponse)(nil), "cosmos.staking.v1beta1.MsgWithdrawAllTokenizeShareRecordRewardResponse") + proto.RegisterType((*QueryTokenizeShareRecordByIdRequest)(nil), "cosmos.staking.v1beta1.QueryTokenizeShareRecordByIdRequest") + proto.RegisterType((*QueryTokenizeShareRecordByIdResponse)(nil), "cosmos.staking.v1beta1.QueryTokenizeShareRecordByIdResponse") + proto.RegisterType((*QueryTokenizeShareRecordByDenomRequest)(nil), "cosmos.staking.v1beta1.QueryTokenizeShareRecordByDenomRequest") + proto.RegisterType((*QueryTokenizeShareRecordByDenomResponse)(nil), "cosmos.staking.v1beta1.QueryTokenizeShareRecordByDenomResponse") + proto.RegisterType((*QueryTokenizeShareRecordsOwnedRequest)(nil), "cosmos.staking.v1beta1.QueryTokenizeShareRecordsOwnedRequest") + proto.RegisterType((*QueryTokenizeShareRecordsOwnedResponse)(nil), "cosmos.staking.v1beta1.QueryTokenizeShareRecordsOwnedResponse") + proto.RegisterType((*QueryAllTokenizeShareRecordsRequest)(nil), "cosmos.staking.v1beta1.QueryAllTokenizeShareRecordsRequest") + proto.RegisterType((*QueryAllTokenizeShareRecordsResponse)(nil), "cosmos.staking.v1beta1.QueryAllTokenizeShareRecordsResponse") + proto.RegisterType((*QueryLastTokenizeShareRecordIdRequest)(nil), "cosmos.staking.v1beta1.QueryLastTokenizeShareRecordIdRequest") + proto.RegisterType((*QueryLastTokenizeShareRecordIdResponse)(nil), "cosmos.staking.v1beta1.QueryLastTokenizeShareRecordIdResponse") + proto.RegisterType((*QueryTotalTokenizeSharedAssetsRequest)(nil), "cosmos.staking.v1beta1.QueryTotalTokenizeSharedAssetsRequest") + proto.RegisterType((*QueryTotalTokenizeSharedAssetsResponse)(nil), "cosmos.staking.v1beta1.QueryTotalTokenizeSharedAssetsResponse") + proto.RegisterType((*QueryTotalLiquidStaked)(nil), "cosmos.staking.v1beta1.QueryTotalLiquidStaked") + proto.RegisterType((*QueryTotalLiquidStakedResponse)(nil), "cosmos.staking.v1beta1.QueryTotalLiquidStakedResponse") + proto.RegisterType((*QueryTokenizeShareLockInfo)(nil), "cosmos.staking.v1beta1.QueryTokenizeShareLockInfo") + proto.RegisterType((*QueryTokenizeShareLockInfoResponse)(nil), "cosmos.staking.v1beta1.QueryTokenizeShareLockInfoResponse") + proto.RegisterType((*TokenizeShareRecord)(nil), "cosmos.staking.v1beta1.TokenizeShareRecord") + proto.RegisterType((*PendingTokenizeShareAuthorizations)(nil), "cosmos.staking.v1beta1.PendingTokenizeShareAuthorizations") + proto.RegisterType((*MsgUnbondValidator)(nil), "cosmos.staking.v1beta1.MsgUnbondValidator") + proto.RegisterType((*MsgUnbondValidatorResponse)(nil), "cosmos.staking.v1beta1.MsgUnbondValidatorResponse") + proto.RegisterType((*MsgTokenizeShares)(nil), "cosmos.staking.v1beta1.MsgTokenizeShares") + proto.RegisterType((*MsgTokenizeSharesResponse)(nil), "cosmos.staking.v1beta1.MsgTokenizeSharesResponse") + proto.RegisterType((*MsgRedeemTokensForShares)(nil), "cosmos.staking.v1beta1.MsgRedeemTokensForShares") + proto.RegisterType((*MsgRedeemTokensForSharesResponse)(nil), "cosmos.staking.v1beta1.MsgRedeemTokensForSharesResponse") + proto.RegisterType((*MsgTransferTokenizeShareRecord)(nil), "cosmos.staking.v1beta1.MsgTransferTokenizeShareRecord") + proto.RegisterType((*MsgTransferTokenizeShareRecordResponse)(nil), "cosmos.staking.v1beta1.MsgTransferTokenizeShareRecordResponse") + proto.RegisterType((*MsgDisableTokenizeShares)(nil), "cosmos.staking.v1beta1.MsgDisableTokenizeShares") + proto.RegisterType((*MsgDisableTokenizeSharesResponse)(nil), "cosmos.staking.v1beta1.MsgDisableTokenizeSharesResponse") + proto.RegisterType((*MsgEnableTokenizeShares)(nil), "cosmos.staking.v1beta1.MsgEnableTokenizeShares") + proto.RegisterType((*MsgEnableTokenizeSharesResponse)(nil), "cosmos.staking.v1beta1.MsgEnableTokenizeSharesResponse") + proto.RegisterType((*MsgValidatorBond)(nil), "cosmos.staking.v1beta1.MsgValidatorBond") + proto.RegisterType((*MsgValidatorBondResponse)(nil), "cosmos.staking.v1beta1.MsgValidatorBondResponse") +} + +func init() { + proto.RegisterFile("quicksilver/lsm-types/v1/types.proto", fileDescriptor_e9fece234f7a11d4) +} + +var fileDescriptor_e9fece234f7a11d4 = []byte{ + // 1376 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x58, 0x4f, 0x6f, 0x13, 0x47, + 0x14, 0xf7, 0x9a, 0x10, 0x92, 0x47, 0x09, 0x61, 0xa1, 0x60, 0xdc, 0xc8, 0xa6, 0x43, 0x88, 0x23, + 0xfe, 0x78, 0x95, 0x20, 0x0a, 0x42, 0xa2, 0x95, 0x4d, 0x0c, 0xb5, 0x88, 0x21, 0xac, 0x9d, 0xb6, + 0xa2, 0x07, 0x6b, 0xed, 0x1d, 0x36, 0xab, 0xec, 0xee, 0x38, 0x3b, 0xeb, 0x84, 0xf0, 0x01, 0x2a, + 0x0e, 0x3d, 0x70, 0xe4, 0x18, 0xa9, 0x17, 0x54, 0xa9, 0x97, 0x7e, 0x84, 0x9e, 0xe8, 0x8d, 0x63, + 0x4f, 0xa1, 0x0a, 0x3d, 0xf4, 0xcc, 0x27, 0xa8, 0x76, 0x66, 0x76, 0xbc, 0x4e, 0xbc, 0x09, 0x29, + 0xa4, 0xea, 0x29, 0x3b, 0x6f, 0xde, 0xbc, 0xf7, 0x7b, 0xef, 0xfd, 0xde, 0x1b, 0x4f, 0x60, 0x72, + 0xa5, 0x6b, 0xb7, 0x97, 0xa9, 0xed, 0xac, 0x62, 0x5f, 0x73, 0xa8, 0x7b, 0x25, 0x58, 0xef, 0x60, + 0xaa,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 0xbd, 0x57, 0x90, 0x94, 0x0a, 0x8c, 0xfe, 0x44, 0x99, 0x25, 0x4a, 0x71, 0x10, + 0x95, 0x07, 0x35, 0x25, 0x79, 0x12, 0x15, 0x85, 0x8b, 0x6b, 0x70, 0x78, 0xd5, 0x70, 0xba, 0x58, + 0xd4, 0xf0, 0xec, 0xc0, 0xa1, 0xce, 0x26, 0x3a, 0xcf, 0x1e, 0xd7, 0x46, 0x19, 0x38, 0xdd, 0x73, + 0x30, 0x6f, 0xaf, 0x74, 0x6d, 0xb3, 0x1e, 0x18, 0xcb, 0xd8, 0x44, 0x37, 0x20, 0x37, 0x78, 0x47, + 0xba, 0x3c, 0x0d, 0xc3, 0x41, 0x08, 0x49, 0x4c, 0x3b, 0x5d, 0xac, 0xd0, 0x17, 0x90, 0xdd, 0xc9, + 0xf8, 0x79, 0xd2, 0x5e, 0xae, 0x7a, 0x8f, 0x89, 0x9a, 0x81, 0x23, 0x7d, 0x43, 0x52, 0x8f, 0x96, + 0x08, 0x03, 0x4a, 0x3e, 0x17, 0xf7, 0x4a, 0x03, 0x23, 0xe8, 0x4a, 0xaf, 0x7c, 0xa5, 0x16, 0xe0, + 0x38, 0x7e, 0xd2, 0xb1, 0x7d, 0x56, 0xca, 0x66, 0xf8, 0x9b, 0x84, 0x51, 0x61, 0x54, 0x1f, 0xeb, + 0x89, 0x1b, 0xb6, 0x8b, 0xd1, 0x0f, 0x0a, 0x9c, 0x1c, 0x50, 0xae, 0xed, 0x45, 0xea, 0xb5, 0x73, + 0x3a, 0xd6, 0xce, 0xea, 0x05, 0x18, 0x73, 0x89, 0xd9, 0x75, 0x70, 0xd3, 0x68, 0xb7, 0x49, 0xd7, + 0x0b, 0x32, 0x87, 0xd8, 0xf6, 0x31, 0x2e, 0x2d, 0x71, 0xa1, 0x3a, 0x01, 0xa3, 0xab, 0x86, 0x63, + 0x9b, 0x46, 0x40, 0xfc, 0xcc, 0x10, 0xd3, 0xe8, 0x09, 0x18, 0xd1, 0x14,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 0x78, 0x11, 0xa6, 0x1a, 0x0f, 0xee, 0x55, 0xee, 0x57, + 0x1f, 0x55, 0x9a, 0xf5, 0xaf, 0x4b, 0x7a, 0xa5, 0x39, 0xff, 0xe0, 0xf6, 0xbd, 0x66, 0xbd, 0x51, + 0x6a, 0x2c, 0xd6, 0x9b, 0x8b, 0xf7, 0xeb, 0x0b, 0x95, 0xdb, 0xd5, 0x3b, 0xd5, 0xca, 0xdc, 0x78, + 0x4a, 0xbd, 0x00, 0x9f, 0xef, 0xa2, 0x1b, 0x7e, 0x57, 0xe6, 0xc6, 0x15, 0xb5, 0x00, 0xe7, 0x77, + 0x35, 0x29, 0x14, 0xd3, 0xea, 0x65, 0x98, 0xde, 0xc3, 0x5e, 0xb3, 0xf2, 0xdd, 0x42, 0x55, 0xaf, + 0xde, 0xbf, 0x3b, 0x7e, 0x28, 0x3b, 0xf4, 0xec, 0xa7, 0x5c, 0xaa, 0xbc, 0xf0, 0x72, 0x2b, 0xa7, + 0xbc, 0xda, 0xca, 0x29, 0xaf, 0xb7, 0x72, 0xca, 0x9f, 0x5b, 0x39, 0xe5, 0xf9, 0xdb, 0x5c, 0xea, + 0xf5, 0xdb, 0x5c, 0xea, 0x8f, 0xb7, 0xb9, 0xd4, 0xa3, 0xd9, 0xd8, 0x1b, 0x34, 0xf6, 0xaf, 0x94, + 0x2b, 0x4f, 0x89, 0x87, 0xe3, 0x02, 0xed, 0x89, 0xe6, 0x50, 0x97, 0xbd, 0x49, 0x5b, 0xc3, 0x8c, + 0x1c, 0x57, 0xff, 0x09, 0x00, 0x00, 0xff, 0xff, 0xe4, 0x7f, 0x92, 0x9f, 0x7c, 0x11, 0x00, 0x00, +} + +func (this *TokenizeShareRecordReward) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*TokenizeShareRecordReward) + if !ok { + that2, ok := that.(TokenizeShareRecordReward) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.RecordId != that1.RecordId { + return false + } + if len(this.Reward) != len(that1.Reward) { + return false + } + for i := range this.Reward { + if !this.Reward[i].Equal(&that1.Reward[i]) { + return false + } + } + return true +} +func (this *QueryTokenizeShareRecordRewardResponse) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*QueryTokenizeShareRecordRewardResponse) + if !ok { + that2, ok := that.(QueryTokenizeShareRecordRewardResponse) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if len(this.Rewards) != len(that1.Rewards) { + return false + } + for i := range this.Rewards { + if !this.Rewards[i].Equal(&that1.Rewards[i]) { + return false + } + } + if len(this.Total) != len(that1.Total) { + return false + } + for i := range this.Total { + if !this.Total[i].Equal(&that1.Total[i]) { + return false + } + } + return true +} +func (this *MsgWithdrawTokenizeShareRecordRewardResponse) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*MsgWithdrawTokenizeShareRecordRewardResponse) + if !ok { + that2, ok := that.(MsgWithdrawTokenizeShareRecordRewardResponse) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + return true +} +func (this *MsgWithdrawAllTokenizeShareRecordRewardResponse) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*MsgWithdrawAllTokenizeShareRecordRewardResponse) + if !ok { + that2, ok := that.(MsgWithdrawAllTokenizeShareRecordRewardResponse) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + return true +} +func (this *QueryTokenizeShareRecordByIdRequest) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*QueryTokenizeShareRecordByIdRequest) + if !ok { + that2, ok := that.(QueryTokenizeShareRecordByIdRequest) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Id != that1.Id { + return false + } + return true +} +func (this *QueryTokenizeShareRecordByIdResponse) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*QueryTokenizeShareRecordByIdResponse) + if !ok { + that2, ok := that.(QueryTokenizeShareRecordByIdResponse) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.Record.Equal(&that1.Record) { + return false + } + return true +} +func (this *QueryTokenizeShareRecordByDenomRequest) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*QueryTokenizeShareRecordByDenomRequest) + if !ok { + that2, ok := that.(QueryTokenizeShareRecordByDenomRequest) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Denom != that1.Denom { + return false + } + return true +} +func (this *QueryTokenizeShareRecordByDenomResponse) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*QueryTokenizeShareRecordByDenomResponse) + if !ok { + that2, ok := that.(QueryTokenizeShareRecordByDenomResponse) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.Record.Equal(&that1.Record) { + return false + } + return true +} +func (this *QueryTokenizeShareRecordsOwnedRequest) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*QueryTokenizeShareRecordsOwnedRequest) + if !ok { + that2, ok := that.(QueryTokenizeShareRecordsOwnedRequest) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Owner != that1.Owner { + return false + } + return true +} +func (this *QueryTokenizeShareRecordsOwnedResponse) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*QueryTokenizeShareRecordsOwnedResponse) + if !ok { + that2, ok := that.(QueryTokenizeShareRecordsOwnedResponse) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if len(this.Records) != len(that1.Records) { + return false + } + for i := range this.Records { + if !this.Records[i].Equal(&that1.Records[i]) { + return false + } + } + return true +} +func (this *QueryLastTokenizeShareRecordIdRequest) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*QueryLastTokenizeShareRecordIdRequest) + if !ok { + that2, ok := that.(QueryLastTokenizeShareRecordIdRequest) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + return true +} +func (this *QueryLastTokenizeShareRecordIdResponse) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*QueryLastTokenizeShareRecordIdResponse) + if !ok { + that2, ok := that.(QueryLastTokenizeShareRecordIdResponse) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Id != that1.Id { + return false + } + return true +} +func (this *QueryTotalTokenizeSharedAssetsRequest) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*QueryTotalTokenizeSharedAssetsRequest) + if !ok { + that2, ok := that.(QueryTotalTokenizeSharedAssetsRequest) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + return true +} +func (this *QueryTotalTokenizeSharedAssetsResponse) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*QueryTotalTokenizeSharedAssetsResponse) + if !ok { + that2, ok := that.(QueryTotalTokenizeSharedAssetsResponse) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.Value.Equal(&that1.Value) { + return false + } + return true +} +func (this *QueryTotalLiquidStaked) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*QueryTotalLiquidStaked) + if !ok { + that2, ok := that.(QueryTotalLiquidStaked) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + return true +} +func (this *QueryTotalLiquidStakedResponse) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*QueryTotalLiquidStakedResponse) + if !ok { + that2, ok := that.(QueryTotalLiquidStakedResponse) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Tokens != that1.Tokens { + return false + } + return true +} +func (this *QueryTokenizeShareLockInfo) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*QueryTokenizeShareLockInfo) + if !ok { + that2, ok := that.(QueryTokenizeShareLockInfo) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Address != that1.Address { + return false + } + return true +} +func (this *QueryTokenizeShareLockInfoResponse) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*QueryTokenizeShareLockInfoResponse) + if !ok { + that2, ok := that.(QueryTokenizeShareLockInfoResponse) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Status != that1.Status { + return false + } + if this.ExpirationTime != that1.ExpirationTime { + return false + } + return true +} +func (this *TokenizeShareRecord) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*TokenizeShareRecord) + if !ok { + that2, ok := that.(TokenizeShareRecord) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Id != that1.Id { + return false + } + if this.Owner != that1.Owner { + return false + } + if this.ModuleAccount != that1.ModuleAccount { + return false + } + if this.Validator != that1.Validator { + return false + } + return true +} +func (this *PendingTokenizeShareAuthorizations) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*PendingTokenizeShareAuthorizations) + if !ok { + that2, ok := that.(PendingTokenizeShareAuthorizations) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if len(this.Addresses) != len(that1.Addresses) { + return false + } + for i := range this.Addresses { + if this.Addresses[i] != that1.Addresses[i] { + return false + } + } + return true +} +func (this *MsgUnbondValidator) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*MsgUnbondValidator) + if !ok { + that2, ok := that.(MsgUnbondValidator) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.ValidatorAddress != that1.ValidatorAddress { + return false + } + return true +} +func (this *MsgUnbondValidatorResponse) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*MsgUnbondValidatorResponse) + if !ok { + that2, ok := that.(MsgUnbondValidatorResponse) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + return true +} +func (this *MsgTokenizeSharesResponse) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*MsgTokenizeSharesResponse) + if !ok { + that2, ok := that.(MsgTokenizeSharesResponse) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.Amount.Equal(&that1.Amount) { + return false + } + return true +} +func (this *MsgRedeemTokensForSharesResponse) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*MsgRedeemTokensForSharesResponse) + if !ok { + that2, ok := that.(MsgRedeemTokensForSharesResponse) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.Amount.Equal(&that1.Amount) { + return false + } + return true +} +func (this *MsgTransferTokenizeShareRecordResponse) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*MsgTransferTokenizeShareRecordResponse) + if !ok { + that2, ok := that.(MsgTransferTokenizeShareRecordResponse) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + return true +} +func (this *MsgDisableTokenizeSharesResponse) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*MsgDisableTokenizeSharesResponse) + if !ok { + that2, ok := that.(MsgDisableTokenizeSharesResponse) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + return true +} +func (this *MsgEnableTokenizeSharesResponse) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*MsgEnableTokenizeSharesResponse) + if !ok { + that2, ok := that.(MsgEnableTokenizeSharesResponse) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.CompletionTime.Equal(that1.CompletionTime) { + return false + } + return true +} +func (this *MsgValidatorBondResponse) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*MsgValidatorBondResponse) + if !ok { + that2, ok := that.(MsgValidatorBondResponse) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + return true +} +func (m *TokenizeShareRecordReward) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TokenizeShareRecordReward) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TokenizeShareRecordReward) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Reward) > 0 { + for iNdEx := len(m.Reward) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Reward[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if m.RecordId != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.RecordId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryTokenizeShareRecordRewardRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryTokenizeShareRecordRewardRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTokenizeShareRecordRewardRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.OwnerAddress) > 0 { + i -= len(m.OwnerAddress) + copy(dAtA[i:], m.OwnerAddress) + i = encodeVarintTypes(dAtA, i, uint64(len(m.OwnerAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryTokenizeShareRecordRewardResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryTokenizeShareRecordRewardResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTokenizeShareRecordRewardResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Total) > 0 { + for iNdEx := len(m.Total) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Total[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if len(m.Rewards) > 0 { + for iNdEx := len(m.Rewards) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Rewards[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *MsgWithdrawTokenizeShareRecordReward) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgWithdrawTokenizeShareRecordReward) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgWithdrawTokenizeShareRecordReward) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.RecordId != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.RecordId)) + i-- + dAtA[i] = 0x10 + } + if len(m.OwnerAddress) > 0 { + i -= len(m.OwnerAddress) + copy(dAtA[i:], m.OwnerAddress) + i = encodeVarintTypes(dAtA, i, uint64(len(m.OwnerAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgWithdrawTokenizeShareRecordRewardResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgWithdrawTokenizeShareRecordRewardResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgWithdrawTokenizeShareRecordRewardResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgWithdrawAllTokenizeShareRecordReward) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgWithdrawAllTokenizeShareRecordReward) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgWithdrawAllTokenizeShareRecordReward) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.OwnerAddress) > 0 { + i -= len(m.OwnerAddress) + copy(dAtA[i:], m.OwnerAddress) + i = encodeVarintTypes(dAtA, i, uint64(len(m.OwnerAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgWithdrawAllTokenizeShareRecordRewardResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgWithdrawAllTokenizeShareRecordRewardResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgWithdrawAllTokenizeShareRecordRewardResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryTokenizeShareRecordByIdRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryTokenizeShareRecordByIdRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTokenizeShareRecordByIdRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Id != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Id)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryTokenizeShareRecordByIdResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryTokenizeShareRecordByIdResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTokenizeShareRecordByIdResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Record.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *QueryTokenizeShareRecordByDenomRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryTokenizeShareRecordByDenomRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTokenizeShareRecordByDenomRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Denom) > 0 { + i -= len(m.Denom) + copy(dAtA[i:], m.Denom) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Denom))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryTokenizeShareRecordByDenomResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryTokenizeShareRecordByDenomResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTokenizeShareRecordByDenomResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Record.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *QueryTokenizeShareRecordsOwnedRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryTokenizeShareRecordsOwnedRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTokenizeShareRecordsOwnedRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Owner) > 0 { + i -= len(m.Owner) + copy(dAtA[i:], m.Owner) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Owner))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryTokenizeShareRecordsOwnedResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryTokenizeShareRecordsOwnedResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTokenizeShareRecordsOwnedResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Records) > 0 { + for iNdEx := len(m.Records) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Records[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QueryAllTokenizeShareRecordsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryAllTokenizeShareRecordsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAllTokenizeShareRecordsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryAllTokenizeShareRecordsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryAllTokenizeShareRecordsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAllTokenizeShareRecordsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Records) > 0 { + for iNdEx := len(m.Records) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Records[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QueryLastTokenizeShareRecordIdRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryLastTokenizeShareRecordIdRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryLastTokenizeShareRecordIdRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryLastTokenizeShareRecordIdResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryLastTokenizeShareRecordIdResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryLastTokenizeShareRecordIdResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Id != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Id)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryTotalTokenizeSharedAssetsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryTotalTokenizeSharedAssetsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTotalTokenizeSharedAssetsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryTotalTokenizeSharedAssetsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryTotalTokenizeSharedAssetsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTotalTokenizeSharedAssetsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Value.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *QueryTotalLiquidStaked) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryTotalLiquidStaked) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTotalLiquidStaked) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryTotalLiquidStakedResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryTotalLiquidStakedResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTotalLiquidStakedResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Tokens) > 0 { + i -= len(m.Tokens) + copy(dAtA[i:], m.Tokens) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Tokens))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryTokenizeShareLockInfo) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryTokenizeShareLockInfo) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTokenizeShareLockInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryTokenizeShareLockInfoResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryTokenizeShareLockInfoResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTokenizeShareLockInfoResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ExpirationTime) > 0 { + i -= len(m.ExpirationTime) + copy(dAtA[i:], m.ExpirationTime) + i = encodeVarintTypes(dAtA, i, uint64(len(m.ExpirationTime))) + i-- + dAtA[i] = 0x12 + } + if len(m.Status) > 0 { + i -= len(m.Status) + copy(dAtA[i:], m.Status) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Status))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *TokenizeShareRecord) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TokenizeShareRecord) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TokenizeShareRecord) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Validator) > 0 { + i -= len(m.Validator) + copy(dAtA[i:], m.Validator) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Validator))) + i-- + dAtA[i] = 0x22 + } + if len(m.ModuleAccount) > 0 { + i -= len(m.ModuleAccount) + copy(dAtA[i:], m.ModuleAccount) + i = encodeVarintTypes(dAtA, i, uint64(len(m.ModuleAccount))) + i-- + dAtA[i] = 0x1a + } + if len(m.Owner) > 0 { + i -= len(m.Owner) + copy(dAtA[i:], m.Owner) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Owner))) + i-- + dAtA[i] = 0x12 + } + if m.Id != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Id)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *PendingTokenizeShareAuthorizations) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PendingTokenizeShareAuthorizations) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PendingTokenizeShareAuthorizations) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Addresses) > 0 { + for iNdEx := len(m.Addresses) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Addresses[iNdEx]) + copy(dAtA[i:], m.Addresses[iNdEx]) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Addresses[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *MsgUnbondValidator) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUnbondValidator) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUnbondValidator) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ValidatorAddress) > 0 { + i -= len(m.ValidatorAddress) + copy(dAtA[i:], m.ValidatorAddress) + i = encodeVarintTypes(dAtA, i, uint64(len(m.ValidatorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUnbondValidatorResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUnbondValidatorResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUnbondValidatorResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgTokenizeShares) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgTokenizeShares) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgTokenizeShares) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.TokenizedShareOwner) > 0 { + i -= len(m.TokenizedShareOwner) + copy(dAtA[i:], m.TokenizedShareOwner) + i = encodeVarintTypes(dAtA, i, uint64(len(m.TokenizedShareOwner))) + i-- + dAtA[i] = 0x22 + } + { + size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if len(m.ValidatorAddress) > 0 { + i -= len(m.ValidatorAddress) + copy(dAtA[i:], m.ValidatorAddress) + i = encodeVarintTypes(dAtA, i, uint64(len(m.ValidatorAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.DelegatorAddress) > 0 { + i -= len(m.DelegatorAddress) + copy(dAtA[i:], m.DelegatorAddress) + i = encodeVarintTypes(dAtA, i, uint64(len(m.DelegatorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgTokenizeSharesResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgTokenizeSharesResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgTokenizeSharesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *MsgRedeemTokensForShares) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgRedeemTokensForShares) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRedeemTokensForShares) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.DelegatorAddress) > 0 { + i -= len(m.DelegatorAddress) + copy(dAtA[i:], m.DelegatorAddress) + i = encodeVarintTypes(dAtA, i, uint64(len(m.DelegatorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgRedeemTokensForSharesResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgRedeemTokensForSharesResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRedeemTokensForSharesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *MsgTransferTokenizeShareRecord) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgTransferTokenizeShareRecord) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgTransferTokenizeShareRecord) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.NewOwner) > 0 { + i -= len(m.NewOwner) + copy(dAtA[i:], m.NewOwner) + i = encodeVarintTypes(dAtA, i, uint64(len(m.NewOwner))) + i-- + dAtA[i] = 0x1a + } + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0x12 + } + if m.TokenizeShareRecordId != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.TokenizeShareRecordId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *MsgTransferTokenizeShareRecordResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgTransferTokenizeShareRecordResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgTransferTokenizeShareRecordResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgDisableTokenizeShares) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgDisableTokenizeShares) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgDisableTokenizeShares) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.DelegatorAddress) > 0 { + i -= len(m.DelegatorAddress) + copy(dAtA[i:], m.DelegatorAddress) + i = encodeVarintTypes(dAtA, i, uint64(len(m.DelegatorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgDisableTokenizeSharesResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgDisableTokenizeSharesResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgDisableTokenizeSharesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgEnableTokenizeShares) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgEnableTokenizeShares) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgEnableTokenizeShares) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.DelegatorAddress) > 0 { + i -= len(m.DelegatorAddress) + copy(dAtA[i:], m.DelegatorAddress) + i = encodeVarintTypes(dAtA, i, uint64(len(m.DelegatorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgEnableTokenizeSharesResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgEnableTokenizeSharesResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgEnableTokenizeSharesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + n10, err10 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.CompletionTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.CompletionTime):]) + if err10 != nil { + return 0, err10 + } + i -= n10 + i = encodeVarintTypes(dAtA, i, uint64(n10)) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *MsgValidatorBond) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgValidatorBond) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgValidatorBond) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ValidatorAddress) > 0 { + i -= len(m.ValidatorAddress) + copy(dAtA[i:], m.ValidatorAddress) + i = encodeVarintTypes(dAtA, i, uint64(len(m.ValidatorAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.DelegatorAddress) > 0 { + i -= len(m.DelegatorAddress) + copy(dAtA[i:], m.DelegatorAddress) + i = encodeVarintTypes(dAtA, i, uint64(len(m.DelegatorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgValidatorBondResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgValidatorBondResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgValidatorBondResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { + offset -= sovTypes(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *TokenizeShareRecordReward) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.RecordId != 0 { + n += 1 + sovTypes(uint64(m.RecordId)) + } + if len(m.Reward) > 0 { + for _, e := range m.Reward { + l = e.Size() + n += 1 + l + sovTypes(uint64(l)) + } + } + return n +} + +func (m *QueryTokenizeShareRecordRewardRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.OwnerAddress) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + return n +} + +func (m *QueryTokenizeShareRecordRewardResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Rewards) > 0 { + for _, e := range m.Rewards { + l = e.Size() + n += 1 + l + sovTypes(uint64(l)) + } + } + if len(m.Total) > 0 { + for _, e := range m.Total { + l = e.Size() + n += 1 + l + sovTypes(uint64(l)) + } + } + return n +} + +func (m *MsgWithdrawTokenizeShareRecordReward) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.OwnerAddress) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if m.RecordId != 0 { + n += 1 + sovTypes(uint64(m.RecordId)) + } + return n +} + +func (m *MsgWithdrawTokenizeShareRecordRewardResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgWithdrawAllTokenizeShareRecordReward) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.OwnerAddress) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + return n +} + +func (m *MsgWithdrawAllTokenizeShareRecordRewardResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryTokenizeShareRecordByIdRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Id != 0 { + n += 1 + sovTypes(uint64(m.Id)) + } + return n +} + +func (m *QueryTokenizeShareRecordByIdResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Record.Size() + n += 1 + l + sovTypes(uint64(l)) + return n +} + +func (m *QueryTokenizeShareRecordByDenomRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Denom) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + return n +} + +func (m *QueryTokenizeShareRecordByDenomResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Record.Size() + n += 1 + l + sovTypes(uint64(l)) + return n +} + +func (m *QueryTokenizeShareRecordsOwnedRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Owner) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + return n +} + +func (m *QueryTokenizeShareRecordsOwnedResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Records) > 0 { + for _, e := range m.Records { + l = e.Size() + n += 1 + l + sovTypes(uint64(l)) + } + } + return n +} + +func (m *QueryAllTokenizeShareRecordsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovTypes(uint64(l)) + } + return n +} + +func (m *QueryAllTokenizeShareRecordsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Records) > 0 { + for _, e := range m.Records { + l = e.Size() + n += 1 + l + sovTypes(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovTypes(uint64(l)) + } + return n +} + +func (m *QueryLastTokenizeShareRecordIdRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryLastTokenizeShareRecordIdResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Id != 0 { + n += 1 + sovTypes(uint64(m.Id)) + } + return n +} + +func (m *QueryTotalTokenizeSharedAssetsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryTotalTokenizeSharedAssetsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Value.Size() + n += 1 + l + sovTypes(uint64(l)) + return n +} + +func (m *QueryTotalLiquidStaked) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryTotalLiquidStakedResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Tokens) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + return n +} + +func (m *QueryTokenizeShareLockInfo) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + return n +} + +func (m *QueryTokenizeShareLockInfoResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Status) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.ExpirationTime) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + return n +} + +func (m *TokenizeShareRecord) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Id != 0 { + n += 1 + sovTypes(uint64(m.Id)) + } + l = len(m.Owner) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.ModuleAccount) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.Validator) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + return n +} + +func (m *PendingTokenizeShareAuthorizations) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Addresses) > 0 { + for _, s := range m.Addresses { + l = len(s) + n += 1 + l + sovTypes(uint64(l)) + } + } + return n +} + +func (m *MsgUnbondValidator) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ValidatorAddress) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + return n +} + +func (m *MsgUnbondValidatorResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgTokenizeShares) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddress) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.ValidatorAddress) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = m.Amount.Size() + n += 1 + l + sovTypes(uint64(l)) + l = len(m.TokenizedShareOwner) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + return n +} + +func (m *MsgTokenizeSharesResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Amount.Size() + n += 1 + l + sovTypes(uint64(l)) + return n +} + +func (m *MsgRedeemTokensForShares) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddress) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = m.Amount.Size() + n += 1 + l + sovTypes(uint64(l)) + return n +} + +func (m *MsgRedeemTokensForSharesResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Amount.Size() + n += 1 + l + sovTypes(uint64(l)) + return n +} + +func (m *MsgTransferTokenizeShareRecord) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.TokenizeShareRecordId != 0 { + n += 1 + sovTypes(uint64(m.TokenizeShareRecordId)) + } + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.NewOwner) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + return n +} + +func (m *MsgTransferTokenizeShareRecordResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgDisableTokenizeShares) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddress) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + return n +} + +func (m *MsgDisableTokenizeSharesResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgEnableTokenizeShares) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddress) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + return n +} + +func (m *MsgEnableTokenizeSharesResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.CompletionTime) + n += 1 + l + sovTypes(uint64(l)) + return n +} + +func (m *MsgValidatorBond) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddress) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.ValidatorAddress) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + return n +} + +func (m *MsgValidatorBondResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func sovTypes(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTypes(x uint64) (n int) { + return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *TokenizeShareRecordReward) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TokenizeShareRecordReward: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TokenizeShareRecordReward: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RecordId", wireType) + } + m.RecordId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.RecordId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Reward", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Reward = append(m.Reward, types.DecCoin{}) + if err := m.Reward[len(m.Reward)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryTokenizeShareRecordRewardRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryTokenizeShareRecordRewardRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryTokenizeShareRecordRewardRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OwnerAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OwnerAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryTokenizeShareRecordRewardResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryTokenizeShareRecordRewardResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryTokenizeShareRecordRewardResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Rewards", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Rewards = append(m.Rewards, TokenizeShareRecordReward{}) + if err := m.Rewards[len(m.Rewards)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Total", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Total = append(m.Total, types.DecCoin{}) + if err := m.Total[len(m.Total)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgWithdrawTokenizeShareRecordReward) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgWithdrawTokenizeShareRecordReward: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgWithdrawTokenizeShareRecordReward: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OwnerAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OwnerAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RecordId", wireType) + } + m.RecordId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.RecordId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgWithdrawTokenizeShareRecordRewardResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgWithdrawTokenizeShareRecordRewardResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgWithdrawTokenizeShareRecordRewardResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgWithdrawAllTokenizeShareRecordReward) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgWithdrawAllTokenizeShareRecordReward: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgWithdrawAllTokenizeShareRecordReward: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OwnerAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OwnerAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgWithdrawAllTokenizeShareRecordRewardResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgWithdrawAllTokenizeShareRecordRewardResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgWithdrawAllTokenizeShareRecordRewardResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryTokenizeShareRecordByIdRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryTokenizeShareRecordByIdRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryTokenizeShareRecordByIdRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + m.Id = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Id |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryTokenizeShareRecordByIdResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryTokenizeShareRecordByIdResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryTokenizeShareRecordByIdResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Record", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Record.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryTokenizeShareRecordByDenomRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryTokenizeShareRecordByDenomRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryTokenizeShareRecordByDenomRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Denom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryTokenizeShareRecordByDenomResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryTokenizeShareRecordByDenomResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryTokenizeShareRecordByDenomResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Record", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Record.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryTokenizeShareRecordsOwnedRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryTokenizeShareRecordsOwnedRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryTokenizeShareRecordsOwnedRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Owner = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryTokenizeShareRecordsOwnedResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryTokenizeShareRecordsOwnedResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryTokenizeShareRecordsOwnedResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Records", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Records = append(m.Records, TokenizeShareRecord{}) + if err := m.Records[len(m.Records)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryAllTokenizeShareRecordsRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryAllTokenizeShareRecordsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllTokenizeShareRecordsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryAllTokenizeShareRecordsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryAllTokenizeShareRecordsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllTokenizeShareRecordsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Records", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Records = append(m.Records, TokenizeShareRecord{}) + if err := m.Records[len(m.Records)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryLastTokenizeShareRecordIdRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryLastTokenizeShareRecordIdRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryLastTokenizeShareRecordIdRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryLastTokenizeShareRecordIdResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryLastTokenizeShareRecordIdResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryLastTokenizeShareRecordIdResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + m.Id = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Id |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryTotalTokenizeSharedAssetsRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryTotalTokenizeSharedAssetsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryTotalTokenizeSharedAssetsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryTotalTokenizeSharedAssetsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryTotalTokenizeSharedAssetsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryTotalTokenizeSharedAssetsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Value.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryTotalLiquidStaked) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryTotalLiquidStaked: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryTotalLiquidStaked: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryTotalLiquidStakedResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryTotalLiquidStakedResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryTotalLiquidStakedResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Tokens", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Tokens = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryTokenizeShareLockInfo) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryTokenizeShareLockInfo: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryTokenizeShareLockInfo: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryTokenizeShareLockInfoResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryTokenizeShareLockInfoResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryTokenizeShareLockInfoResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Status = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ExpirationTime", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ExpirationTime = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TokenizeShareRecord) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TokenizeShareRecord: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TokenizeShareRecord: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + m.Id = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Id |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Owner = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ModuleAccount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ModuleAccount = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Validator", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Validator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PendingTokenizeShareAuthorizations) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PendingTokenizeShareAuthorizations: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PendingTokenizeShareAuthorizations: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Addresses", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Addresses = append(m.Addresses, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUnbondValidator) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUnbondValidator: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUnbondValidator: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ValidatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUnbondValidatorResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUnbondValidatorResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUnbondValidatorResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgTokenizeShares) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgTokenizeShares: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgTokenizeShares: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DelegatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ValidatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TokenizedShareOwner", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TokenizedShareOwner = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgTokenizeSharesResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgTokenizeSharesResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgTokenizeSharesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgRedeemTokensForShares) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgRedeemTokensForShares: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRedeemTokensForShares: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DelegatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgRedeemTokensForSharesResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgRedeemTokensForSharesResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRedeemTokensForSharesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgTransferTokenizeShareRecord) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgTransferTokenizeShareRecord: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgTransferTokenizeShareRecord: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TokenizeShareRecordId", wireType) + } + m.TokenizeShareRecordId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TokenizeShareRecordId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NewOwner", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NewOwner = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgTransferTokenizeShareRecordResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgTransferTokenizeShareRecordResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgTransferTokenizeShareRecordResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgDisableTokenizeShares) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgDisableTokenizeShares: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgDisableTokenizeShares: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DelegatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgDisableTokenizeSharesResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgDisableTokenizeSharesResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgDisableTokenizeSharesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgEnableTokenizeShares) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgEnableTokenizeShares: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgEnableTokenizeShares: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DelegatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgEnableTokenizeSharesResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgEnableTokenizeSharesResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgEnableTokenizeSharesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CompletionTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.CompletionTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgValidatorBond) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgValidatorBond: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgValidatorBond: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DelegatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ValidatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgValidatorBondResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgValidatorBondResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgValidatorBondResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTypes(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTypes + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTypes + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTypes + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/lsmtypes/validator.go b/x/lsmtypes/validator.go new file mode 100644 index 000000000..aff9d492a --- /dev/null +++ b/x/lsmtypes/validator.go @@ -0,0 +1,32 @@ +package lsmtypes + +import ( + fmt "fmt" + + "gopkg.in/yaml.v2" + + "cosmossdk.io/errors" + + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" +) + +// String implements the Stringer interface for a Validator object. +func (v Validator) String() string { + out, _ := yaml.Marshal(v) + return string(out) +} + +func (v Validator) GetConsAddr() ([]byte, error) { + pk, ok := v.ConsensusPubkey.GetCachedValue().(cryptotypes.PubKey) + if !ok { + fmt.Println("got", pk) + return nil, errors.Wrapf(sdkerrors.ErrInvalidType, "expecting cryptotypes.PubKey, got %T", pk) + } + + return pk.Address().Bytes(), nil +} + +func (v Validator) GetCommission() sdk.Dec { return v.Commission.Rate } +func (v Validator) IsJailed() bool { return v.Jailed } diff --git a/x/lsmtypes/validator.pb.go b/x/lsmtypes/validator.pb.go new file mode 100644 index 000000000..c0a3d2ab9 --- /dev/null +++ b/x/lsmtypes/validator.pb.go @@ -0,0 +1,1282 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: quicksilver/lsm-types/v1/validator.proto + +package lsmtypes + +import ( + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + types "github.com/cosmos/cosmos-sdk/codec/types" + _ "github.com/cosmos/cosmos-sdk/types" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + query "github.com/cosmos/cosmos-sdk/types/query" + types1 "github.com/cosmos/cosmos-sdk/x/staking/types" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/gogo/protobuf/proto" + github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" + _ "google.golang.org/protobuf/types/known/timestamppb" + io "io" + math "math" + math_bits "math/bits" + time "time" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf +var _ = time.Kitchen + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// Validator defines a validator, together with the total amount of the +// Validator's bond shares and their exchange rate to coins. Slashing results in +// a decrease in the exchange rate, allowing correct calculation of future +// undelegations without iterating over delegators. When coins are delegated to +// this validator, the validator is credited with a delegation whose number of +// bond shares is based on the amount of coins delegated divided by the current +// exchange rate. Voting power can be calculated as total bonded shares +// multiplied by exchange rate. +type Validator struct { + // operator_address defines the address of the validator's operator; bech + // encoded in JSON. + OperatorAddress string `protobuf:"bytes,1,opt,name=operator_address,json=operatorAddress,proto3" json:"operator_address,omitempty" yaml:"operator_address"` + // consensus_pubkey is the consensus public key of the validator, as a + // Protobuf Any. + ConsensusPubkey *types.Any `protobuf:"bytes,2,opt,name=consensus_pubkey,json=consensusPubkey,proto3" json:"consensus_pubkey,omitempty" yaml:"consensus_pubkey"` + // jailed defined whether the validator has been jailed from bonded status or + // not. + Jailed bool `protobuf:"varint,3,opt,name=jailed,proto3" json:"jailed,omitempty"` + // status is the validator status (bonded/unbonding/unbonded). + Status types1.BondStatus `protobuf:"varint,4,opt,name=status,proto3,enum=cosmos.staking.v1beta1.BondStatus" json:"status,omitempty"` + // tokens define the delegated tokens (incl. self-delegation). + Tokens github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,5,opt,name=tokens,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"tokens"` + // delegator_shares defines total shares issued to a validator's delegators. + DelegatorShares github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,6,opt,name=delegator_shares,json=delegatorShares,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"delegator_shares" yaml:"delegator_shares"` + // description defines the description terms for the validator. + Description types1.Description `protobuf:"bytes,7,opt,name=description,proto3" json:"description"` + // unbonding_height defines, if unbonding, the height at which this validator + // has begun unbonding. + UnbondingHeight int64 `protobuf:"varint,8,opt,name=unbonding_height,json=unbondingHeight,proto3" json:"unbonding_height,omitempty" yaml:"unbonding_height"` + // unbonding_time defines, if unbonding, the min time for the validator to + // complete unbonding. + UnbondingTime time.Time `protobuf:"bytes,9,opt,name=unbonding_time,json=unbondingTime,proto3,stdtime" json:"unbonding_time" yaml:"unbonding_time"` + // commission defines the commission parameters. + Commission types1.Commission `protobuf:"bytes,10,opt,name=commission,proto3" json:"commission"` + // Deprecated: This field has been deprecated with LSM in favor of the + // validator bond + MinSelfDelegation github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,11,opt,name=min_self_delegation,json=minSelfDelegation,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"min_self_delegation" yaml:"min_self_delegation"` // Deprecated: Do not use. + // strictly positive if this validator's unbonding has been stopped by + // external modules + UnbondingOnHoldRefCount int64 `protobuf:"varint,12,opt,name=unbonding_on_hold_ref_count,json=unbondingOnHoldRefCount,proto3" json:"unbonding_on_hold_ref_count,omitempty"` + // list of unbonding ids, each uniquely identifing an unbonding of this + // validator + UnbondingIds []uint64 `protobuf:"varint,13,rep,packed,name=unbonding_ids,json=unbondingIds,proto3" json:"unbonding_ids,omitempty"` + // Number of shares self bonded from the validator + ValidatorBondShares github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,14,opt,name=validator_bond_shares,json=validatorBondShares,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"validator_bond_shares" yaml:"validator_bond_shares"` + // Number of shares either tokenized or owned by a liquid staking provider + LiquidShares github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,15,opt,name=liquid_shares,json=liquidShares,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"liquid_shares" yaml:"liquid_shares"` +} + +func (m *Validator) Reset() { *m = Validator{} } +func (*Validator) ProtoMessage() {} +func (*Validator) Descriptor() ([]byte, []int) { + return fileDescriptor_93ed251ae1dc13ed, []int{0} +} +func (m *Validator) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Validator) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Validator.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Validator) XXX_Merge(src proto.Message) { + xxx_messageInfo_Validator.Merge(m, src) +} +func (m *Validator) XXX_Size() int { + return m.Size() +} +func (m *Validator) XXX_DiscardUnknown() { + xxx_messageInfo_Validator.DiscardUnknown(m) +} + +var xxx_messageInfo_Validator proto.InternalMessageInfo + +type QueryValidatorsResponse struct { + // validators contains all the queried validators. + Validators []Validator `protobuf:"bytes,1,rep,name=validators,proto3" json:"validators"` + // pagination defines the pagination in the response. + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryValidatorsResponse) Reset() { *m = QueryValidatorsResponse{} } +func (m *QueryValidatorsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryValidatorsResponse) ProtoMessage() {} +func (*QueryValidatorsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_93ed251ae1dc13ed, []int{1} +} +func (m *QueryValidatorsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryValidatorsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryValidatorsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryValidatorsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryValidatorsResponse.Merge(m, src) +} +func (m *QueryValidatorsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryValidatorsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryValidatorsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryValidatorsResponse proto.InternalMessageInfo + +func (m *QueryValidatorsResponse) GetValidators() []Validator { + if m != nil { + return m.Validators + } + return nil +} + +func (m *QueryValidatorsResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +func init() { + proto.RegisterType((*Validator)(nil), "cosmos.lsmstaking.v1beta1.Validator") + proto.RegisterType((*QueryValidatorsResponse)(nil), "cosmos.lsmstaking.v1beta1.QueryValidatorsResponse") +} + +func init() { + proto.RegisterFile("quicksilver/lsm-types/v1/validator.proto", fileDescriptor_93ed251ae1dc13ed) +} + +var fileDescriptor_93ed251ae1dc13ed = []byte{ + // 870 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x55, 0x3f, 0x6f, 0xe4, 0x44, + 0x14, 0x5f, 0x93, 0xb0, 0x5c, 0x26, 0x7f, 0xf6, 0xf0, 0xe5, 0x88, 0xc9, 0xa1, 0xf5, 0xe2, 0x3b, + 0xc1, 0x0a, 0x29, 0xb6, 0x92, 0xeb, 0x22, 0x9a, 0xdb, 0x8b, 0x42, 0xc2, 0x49, 0x10, 0x26, 0x88, + 0x82, 0xc6, 0xf2, 0xda, 0xb3, 0xde, 0x61, 0xed, 0x19, 0xc7, 0x33, 0x8e, 0x30, 0x05, 0x05, 0x34, + 0x94, 0x57, 0x52, 0xa6, 0xe4, 0x03, 0xdc, 0x87, 0x38, 0x51, 0x5d, 0x89, 0x28, 0x16, 0x94, 0x34, + 0xd4, 0xf9, 0x04, 0x68, 0xc6, 0xe3, 0xb1, 0x59, 0x92, 0x22, 0xd5, 0xee, 0xbc, 0xf7, 0x7b, 0xbf, + 0xf7, 0x67, 0x7e, 0x9e, 0x07, 0x86, 0x67, 0x05, 0x0e, 0x67, 0x0c, 0x27, 0xe7, 0x28, 0xf7, 0x12, + 0x96, 0xee, 0xf0, 0x32, 0x43, 0xcc, 0x3b, 0xdf, 0xf5, 0xce, 0x83, 0x04, 0x47, 0x01, 0xa7, 0xb9, + 0x9b, 0xe5, 0x94, 0x53, 0xf3, 0xfd, 0x90, 0xb2, 0x94, 0x32, 0x37, 0x61, 0x29, 0xe3, 0xc1, 0x0c, + 0x93, 0xd8, 0x3d, 0xdf, 0x1d, 0x23, 0x1e, 0xec, 0x6e, 0x7f, 0x52, 0xb9, 0xbc, 0x71, 0xc0, 0x90, + 0x77, 0x56, 0xa0, 0xbc, 0xf4, 0x94, 0xcb, 0xcb, 0x82, 0x18, 0x93, 0x80, 0x63, 0x4a, 0x2a, 0x9a, + 0xed, 0x7e, 0x1b, 0x5b, 0xa3, 0x42, 0x8a, 0x6b, 0xff, 0x13, 0xe5, 0x57, 0x39, 0x34, 0xa4, 0xce, + 0x59, 0xa1, 0x54, 0x31, 0xbe, 0x3c, 0x79, 0xaa, 0xb2, 0xca, 0xb5, 0x19, 0xd3, 0x98, 0x56, 0x76, + 0xf1, 0xaf, 0x0e, 0x88, 0x29, 0x8d, 0x13, 0xe4, 0xc9, 0xd3, 0xb8, 0x98, 0x78, 0x01, 0x29, 0x95, + 0xcb, 0x5e, 0x74, 0x71, 0x9c, 0x22, 0xc6, 0x83, 0x34, 0xab, 0x00, 0xce, 0xcf, 0x00, 0xac, 0x7c, + 0x53, 0x4f, 0xc3, 0x3c, 0x04, 0xf7, 0x69, 0x86, 0x72, 0xf1, 0xdf, 0x0f, 0xa2, 0x28, 0x47, 0x8c, + 0x59, 0xc6, 0xc0, 0x18, 0xae, 0x8c, 0x1e, 0x5d, 0xcf, 0xed, 0xad, 0x32, 0x48, 0x93, 0x7d, 0x67, + 0x11, 0xe1, 0xc0, 0x5e, 0x6d, 0x7a, 0x56, 0x59, 0x4c, 0x0e, 0xee, 0x87, 0x94, 0x30, 0x44, 0x58, + 0xc1, 0xfc, 0xac, 0x18, 0xcf, 0x50, 0x69, 0xbd, 0x35, 0x30, 0x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x78, 0xdf, 0x8b, 0xe5, + 0x28, 0x07, 0x38, 0xee, 0xca, 0x6f, 0xef, 0xe9, 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x76, 0xdf, + 0x58, 0x7a, 0x3b, 0x07, 0x00, 0x00, +} + +func (m *Validator) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Validator) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Validator) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.LiquidShares.Size() + i -= size + if _, err := m.LiquidShares.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintValidator(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x7a + { + size := m.ValidatorBondShares.Size() + i -= size + if _, err := m.ValidatorBondShares.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintValidator(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x72 + if len(m.UnbondingIds) > 0 { + dAtA2 := make([]byte, len(m.UnbondingIds)*10) + var j1 int + for _, num := range m.UnbondingIds { + for num >= 1<<7 { + dAtA2[j1] = uint8(uint64(num)&0x7f | 0x80) + num >>= 7 + j1++ + } + dAtA2[j1] = uint8(num) + j1++ + } + i -= j1 + copy(dAtA[i:], dAtA2[:j1]) + i = encodeVarintValidator(dAtA, i, uint64(j1)) + i-- + dAtA[i] = 0x6a + } + if m.UnbondingOnHoldRefCount != 0 { + i = encodeVarintValidator(dAtA, i, uint64(m.UnbondingOnHoldRefCount)) + i-- + dAtA[i] = 0x60 + } + { + size := m.MinSelfDelegation.Size() + i -= size + if _, err := m.MinSelfDelegation.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintValidator(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x5a + { + size, err := m.Commission.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintValidator(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x52 + n4, err4 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.UnbondingTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.UnbondingTime):]) + if err4 != nil { + return 0, err4 + } + i -= n4 + i = encodeVarintValidator(dAtA, i, uint64(n4)) + i-- + dAtA[i] = 0x4a + if m.UnbondingHeight != 0 { + i = encodeVarintValidator(dAtA, i, uint64(m.UnbondingHeight)) + i-- + dAtA[i] = 0x40 + } + { + size, err := m.Description.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintValidator(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + { + size := m.DelegatorShares.Size() + i -= size + if _, err := m.DelegatorShares.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintValidator(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + { + size := m.Tokens.Size() + i -= size + if _, err := m.Tokens.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintValidator(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + if m.Status != 0 { + i = encodeVarintValidator(dAtA, i, uint64(m.Status)) + i-- + dAtA[i] = 0x20 + } + if m.Jailed { + i-- + if m.Jailed { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x18 + } + if m.ConsensusPubkey != nil { + { + size, err := m.ConsensusPubkey.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintValidator(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.OperatorAddress) > 0 { + i -= len(m.OperatorAddress) + copy(dAtA[i:], m.OperatorAddress) + i = encodeVarintValidator(dAtA, i, uint64(len(m.OperatorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryValidatorsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryValidatorsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryValidatorsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintValidator(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Validators) > 0 { + for iNdEx := len(m.Validators) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Validators[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintValidator(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func encodeVarintValidator(dAtA []byte, offset int, v uint64) int { + offset -= sovValidator(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Validator) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.OperatorAddress) + if l > 0 { + n += 1 + l + sovValidator(uint64(l)) + } + if m.ConsensusPubkey != nil { + l = m.ConsensusPubkey.Size() + n += 1 + l + sovValidator(uint64(l)) + } + if m.Jailed { + n += 2 + } + if m.Status != 0 { + n += 1 + sovValidator(uint64(m.Status)) + } + l = m.Tokens.Size() + n += 1 + l + sovValidator(uint64(l)) + l = m.DelegatorShares.Size() + n += 1 + l + sovValidator(uint64(l)) + l = m.Description.Size() + n += 1 + l + sovValidator(uint64(l)) + if m.UnbondingHeight != 0 { + n += 1 + sovValidator(uint64(m.UnbondingHeight)) + } + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.UnbondingTime) + n += 1 + l + sovValidator(uint64(l)) + l = m.Commission.Size() + n += 1 + l + sovValidator(uint64(l)) + l = m.MinSelfDelegation.Size() + n += 1 + l + sovValidator(uint64(l)) + if m.UnbondingOnHoldRefCount != 0 { + n += 1 + sovValidator(uint64(m.UnbondingOnHoldRefCount)) + } + if len(m.UnbondingIds) > 0 { + l = 0 + for _, e := range m.UnbondingIds { + l += sovValidator(uint64(e)) + } + n += 1 + sovValidator(uint64(l)) + l + } + l = m.ValidatorBondShares.Size() + n += 1 + l + sovValidator(uint64(l)) + l = m.LiquidShares.Size() + n += 1 + l + sovValidator(uint64(l)) + return n +} + +func (m *QueryValidatorsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Validators) > 0 { + for _, e := range m.Validators { + l = e.Size() + n += 1 + l + sovValidator(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovValidator(uint64(l)) + } + return n +} + +func sovValidator(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozValidator(x uint64) (n int) { + return sovValidator(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Validator) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowValidator + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Validator: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Validator: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OperatorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowValidator + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthValidator + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthValidator + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OperatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ConsensusPubkey", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowValidator + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthValidator + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthValidator + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ConsensusPubkey == nil { + m.ConsensusPubkey = &types.Any{} + } + if err := m.ConsensusPubkey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Jailed", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowValidator + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Jailed = bool(v != 0) + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + m.Status = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowValidator + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Status |= types1.BondStatus(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Tokens", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowValidator + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthValidator + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthValidator + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Tokens.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorShares", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowValidator + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthValidator + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthValidator + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.DelegatorShares.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowValidator + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthValidator + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthValidator + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Description.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field UnbondingHeight", wireType) + } + m.UnbondingHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowValidator + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.UnbondingHeight |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UnbondingTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowValidator + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthValidator + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthValidator + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.UnbondingTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Commission", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowValidator + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthValidator + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthValidator + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Commission.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinSelfDelegation", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowValidator + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthValidator + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthValidator + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.MinSelfDelegation.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 12: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field UnbondingOnHoldRefCount", wireType) + } + m.UnbondingOnHoldRefCount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowValidator + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.UnbondingOnHoldRefCount |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 13: + if wireType == 0 { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowValidator + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.UnbondingIds = append(m.UnbondingIds, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowValidator + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLengthValidator + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLengthValidator + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.UnbondingIds) == 0 { + m.UnbondingIds = make([]uint64, 0, elementCount) + } + for iNdEx < postIndex { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowValidator + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.UnbondingIds = append(m.UnbondingIds, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field UnbondingIds", wireType) + } + case 14: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorBondShares", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowValidator + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthValidator + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthValidator + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ValidatorBondShares.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 15: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LiquidShares", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowValidator + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthValidator + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthValidator + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.LiquidShares.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipValidator(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthValidator + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryValidatorsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowValidator + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryValidatorsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryValidatorsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Validators", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowValidator + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthValidator + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthValidator + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Validators = append(m.Validators, Validator{}) + if err := m.Validators[len(m.Validators)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowValidator + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthValidator + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthValidator + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipValidator(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthValidator + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipValidator(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowValidator + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowValidator + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowValidator + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthValidator + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupValidator + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthValidator + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthValidator = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowValidator = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupValidator = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/participationrewards/types/messages.pb.go b/x/participationrewards/types/messages.pb.go index 5596f44f0..2d7a43fa4 100644 --- a/x/participationrewards/types/messages.pb.go +++ b/x/participationrewards/types/messages.pb.go @@ -122,38 +122,38 @@ func init() { var fileDescriptor_b87e3ea017f90b50 = []byte{ // 513 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x93, 0xb1, 0x6f, 0xd3, 0x4e, - 0x14, 0xc7, 0xe3, 0xa4, 0xbf, 0xaa, 0xbf, 0x2b, 0xea, 0x70, 0x2a, 0xc8, 0x58, 0xc8, 0x8d, 0xd2, - 0x81, 0x08, 0x29, 0x36, 0x71, 0x16, 0xd4, 0x80, 0x04, 0xa5, 0xd0, 0xa9, 0x52, 0xe5, 0x32, 0x31, - 0x10, 0x5d, 0x9c, 0xe3, 0x38, 0x61, 0xfb, 0x1d, 0x77, 0x17, 0xd3, 0x32, 0x32, 0x31, 0x21, 0x24, - 0xfe, 0x81, 0xae, 0xec, 0x2c, 0xfc, 0x07, 0x8c, 0x15, 0x2c, 0x8c, 0x28, 0x01, 0x89, 0x3f, 0x03, - 0xf9, 0xec, 0x56, 0xb6, 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