diff --git a/packages/cosmic-proto/proto/stride/epochs/genesis.proto b/packages/cosmic-proto/proto/stride/epochs/genesis.proto new file mode 100755 index 00000000000..14fc7718c73 --- /dev/null +++ b/packages/cosmic-proto/proto/stride/epochs/genesis.proto @@ -0,0 +1,36 @@ +syntax = "proto3"; +package stride.epochs; + +import "gogoproto/gogo.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "github.com/Stride-Labs/stride/v25/x/epochs/types"; + +message EpochInfo { + string identifier = 1; + google.protobuf.Timestamp start_time = 2 [ + (gogoproto.stdtime) = true, + (gogoproto.nullable) = false, + (gogoproto.moretags) = "yaml:\"start_time\"" + ]; + google.protobuf.Duration duration = 3 [ + (gogoproto.nullable) = false, + (gogoproto.stdduration) = true, + (gogoproto.jsontag) = "duration,omitempty", + (gogoproto.moretags) = "yaml:\"duration\"" + ]; + int64 current_epoch = 4; + google.protobuf.Timestamp current_epoch_start_time = 5 [ + (gogoproto.stdtime) = true, + (gogoproto.nullable) = false, + (gogoproto.moretags) = "yaml:\"current_epoch_start_time\"" + ]; + bool epoch_counting_started = 6; + int64 current_epoch_start_height = 7; +} + +// GenesisState defines the epochs module's genesis state. +message GenesisState { + repeated EpochInfo epochs = 1 [ (gogoproto.nullable) = false ]; +} \ No newline at end of file diff --git a/packages/cosmic-proto/proto/stride/epochs/query.proto b/packages/cosmic-proto/proto/stride/epochs/query.proto new file mode 100644 index 00000000000..272e3498256 --- /dev/null +++ b/packages/cosmic-proto/proto/stride/epochs/query.proto @@ -0,0 +1,74 @@ +syntax = "proto3"; +package stride.epochs; + +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; +import "cosmos/base/query/v1beta1/pagination.proto"; +import "stride/epochs/genesis.proto"; + +option go_package = "github.com/Stride-Labs/stride/v25/x/epochs/types"; + +// Query defines the gRPC querier service. +service Query { + // EpochInfos provide running epochInfos + rpc EpochInfos(QueryEpochsInfoRequest) returns (QueryEpochsInfoResponse) { + option (google.api.http).get = "/Stridelabs/stride/epochs"; + } + // CurrentEpoch provide current epoch of specified identifier + rpc CurrentEpoch(QueryCurrentEpochRequest) + returns (QueryCurrentEpochResponse) { + option (google.api.http).get = "/Stridelabs/stride/epochs/current_epoch"; + } + // CurrentEpoch provide current epoch of specified identifier + rpc EpochInfo(QueryEpochInfoRequest) returns (QueryEpochInfoResponse) { + option (google.api.http).get = "/Stridelabs/stride/epochs/epoch_info"; + } +} + +message QueryEpochsInfoRequest { + cosmos.base.query.v1beta1.PageRequest pagination = 1; +} + +message QueryEpochsInfoResponse { + repeated EpochInfo epochs = 1 [ (gogoproto.nullable) = false ]; + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +message QueryCurrentEpochRequest { string identifier = 1; } +message QueryCurrentEpochResponse { int64 current_epoch = 1; } + +message QueryEpochInfoRequest { string identifier = 1; } +message QueryEpochInfoResponse { + EpochInfo epoch = 1 [ (gogoproto.nullable) = false ]; +} + +// syntax = "proto3"; +// package stride.epochs; + +// import "gogoproto/gogo.proto"; +// import "google/api/annotations.proto"; +// import "cosmos/base/query/v1beta1/pagination.proto"; +// import "epochs/params.proto"; +// // this line is used by starport scaffolding # 1 + +// option go_package = "github.com/Stride-Labs/stride/v25/x/epochs/types"; + +// // Query defines the gRPC querier service. +// service Query { +// // Parameters queries the parameters of the module. +// rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { +// option (google.api.http).get = "/Stridelabs/stride/epochs/params"; +// } +// // this line is used by starport scaffolding # 2 +// } + +// // QueryParamsRequest is request type for the Query/Params RPC method. +// message QueryParamsRequest {} + +// // QueryParamsResponse is response type for the Query/Params RPC method. +// message QueryParamsResponse { +// // params holds all the parameters of this module. +// Params params = 1 [(gogoproto.nullable) = false]; +// } + +// // this line is used by starport scaffolding # 3 diff --git a/packages/cosmic-proto/proto/stride/records/callbacks.proto b/packages/cosmic-proto/proto/stride/records/callbacks.proto new file mode 100644 index 00000000000..0a1e8981575 --- /dev/null +++ b/packages/cosmic-proto/proto/stride/records/callbacks.proto @@ -0,0 +1,10 @@ +syntax = "proto3"; +package stride.records; + +import "stride/records/records.proto"; + +option go_package = "github.com/Stride-Labs/stride/v25/x/records/types"; + +message TransferCallback { uint64 deposit_record_id = 1; } + +message TransferLSMTokenCallback { LSMTokenDeposit deposit = 1; } diff --git a/packages/cosmic-proto/proto/stride/records/genesis.proto b/packages/cosmic-proto/proto/stride/records/genesis.proto new file mode 100644 index 00000000000..4662fb94893 --- /dev/null +++ b/packages/cosmic-proto/proto/stride/records/genesis.proto @@ -0,0 +1,24 @@ +syntax = "proto3"; +package stride.records; + +import "stride/records/params.proto"; +import "stride/records/records.proto"; +import "gogoproto/gogo.proto"; + +option go_package = "github.com/Stride-Labs/stride/v25/x/records/types"; + +// GenesisState defines the records module's genesis state. +message GenesisState { + Params params = 1 [ (gogoproto.nullable) = false ]; + string port_id = 2; + repeated UserRedemptionRecord user_redemption_record_list = 3 + [ (gogoproto.nullable) = false ]; + uint64 user_redemption_record_count = 4; + repeated EpochUnbondingRecord epoch_unbonding_record_list = 5 + [ (gogoproto.nullable) = false ]; + repeated DepositRecord deposit_record_list = 7 + [ (gogoproto.nullable) = false ]; + uint64 deposit_record_count = 8; + repeated LSMTokenDeposit lsm_token_deposit_list = 9 + [ (gogoproto.nullable) = false ]; +} diff --git a/packages/cosmic-proto/proto/stride/records/params.proto b/packages/cosmic-proto/proto/stride/records/params.proto new file mode 100644 index 00000000000..147d05f0321 --- /dev/null +++ b/packages/cosmic-proto/proto/stride/records/params.proto @@ -0,0 +1,7 @@ +syntax = "proto3"; +package stride.records; + +option go_package = "github.com/Stride-Labs/stride/v25/x/records/types"; + +// Params defines the parameters for the module. +message Params {} \ No newline at end of file diff --git a/packages/cosmic-proto/proto/stride/records/query.proto b/packages/cosmic-proto/proto/stride/records/query.proto new file mode 100644 index 00000000000..716decb6b77 --- /dev/null +++ b/packages/cosmic-proto/proto/stride/records/query.proto @@ -0,0 +1,185 @@ +syntax = "proto3"; +package stride.records; + +import "stride/records/records.proto"; +import "stride/records/params.proto"; + +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; +import "cosmos/base/query/v1beta1/pagination.proto"; + +option go_package = "github.com/Stride-Labs/stride/v25/x/records/types"; + +// Query defines the gRPC querier service. +service Query { + // Parameters queries the parameters of the module. + rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/StrideLabs/stride/records/params"; + } + // Queries a UserRedemptionRecord by id. + rpc UserRedemptionRecord(QueryGetUserRedemptionRecordRequest) + returns (QueryGetUserRedemptionRecordResponse) { + option (google.api.http).get = + "/Stride-Labs/stride/records/user_redemption_record/{id}"; + } + + // Queries a list of UserRedemptionRecord items. + rpc UserRedemptionRecordAll(QueryAllUserRedemptionRecordRequest) + returns (QueryAllUserRedemptionRecordResponse) { + option (google.api.http).get = + "/Stride-Labs/stride/records/user_redemption_record"; + } + + // Queries a list of UserRedemptionRecord items by chainId / userId pair. + rpc UserRedemptionRecordForUser(QueryAllUserRedemptionRecordForUserRequest) + returns (QueryAllUserRedemptionRecordForUserResponse) { + option (google.api.http).get = + "/Stride-Labs/stride/records/user_redemption_record_for_user/" + "{chain_id}/{day}/{address}/{limit}"; + } + + // Queries a EpochUnbondingRecord by id. + rpc EpochUnbondingRecord(QueryGetEpochUnbondingRecordRequest) + returns (QueryGetEpochUnbondingRecordResponse) { + option (google.api.http).get = + "/Stride-Labs/stride/records/epoch_unbonding_record/{epoch_number}"; + } + + // Queries a list of EpochUnbondingRecord items. + rpc EpochUnbondingRecordAll(QueryAllEpochUnbondingRecordRequest) + returns (QueryAllEpochUnbondingRecordResponse) { + option (google.api.http).get = + "/Stride-Labs/stride/records/epoch_unbonding_record"; + } + + // Queries a DepositRecord by id. + rpc DepositRecord(QueryGetDepositRecordRequest) + returns (QueryGetDepositRecordResponse) { + option (google.api.http).get = + "/Stride-Labs/stride/records/deposit_record/{id}"; + } + + // Queries a list of DepositRecord items. + rpc DepositRecordAll(QueryAllDepositRecordRequest) + returns (QueryAllDepositRecordResponse) { + option (google.api.http).get = "/Stride-Labs/stride/records/deposit_record"; + } + + // Queries a list of DepositRecord items for a given host zone + rpc DepositRecordByHost(QueryDepositRecordByHostRequest) + returns (QueryDepositRecordByHostResponse) { + option (google.api.http).get = "/Stride-Labs/stride/records/" + "deposit_record_by_host_zone/{host_zone_id}"; + } + + // Queries the existing LSMTokenDeposits for one specific deposit + rpc LSMDeposit(QueryLSMDepositRequest) returns (QueryLSMDepositResponse) { + option (google.api.http).get = + "/Stride-Labs/stride/stakeibc/lsm_deposit/{chain_id}/{denom}"; + } + + // Queries the existing LSMTokenDeposits for all which match filters + // intended use: + // ...stakeibc/lsm_deposits?chain_id=X&validator_address=Y&status=Z + rpc LSMDeposits(QueryLSMDepositsRequest) returns (QueryLSMDepositsResponse) { + option (google.api.http).get = "/Stride-Labs/stride/stakeibc/lsm_deposits"; + } +} + +// QueryParamsRequest is request type for the Query/Params RPC method. +message QueryParamsRequest {} + +// QueryParamsResponse is response type for the Query/Params RPC method. +message QueryParamsResponse { + // params holds all the parameters of this module. + Params params = 1 [ (gogoproto.nullable) = false ]; +} + +message QueryGetDepositRecordRequest { uint64 id = 1; } + +message QueryGetDepositRecordResponse { + DepositRecord deposit_record = 1 [ (gogoproto.nullable) = false ]; +} + +message QueryAllDepositRecordRequest { + cosmos.base.query.v1beta1.PageRequest pagination = 1; +} + +message QueryAllDepositRecordResponse { + repeated DepositRecord deposit_record = 1 [ (gogoproto.nullable) = false ]; + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +message QueryDepositRecordByHostRequest { string host_zone_id = 1; } + +message QueryDepositRecordByHostResponse { + repeated DepositRecord deposit_record = 1 [ (gogoproto.nullable) = false ]; +} + +message QueryGetUserRedemptionRecordRequest { string id = 1; } + +message QueryGetUserRedemptionRecordResponse { + UserRedemptionRecord user_redemption_record = 1 + [ (gogoproto.nullable) = false ]; +} + +message QueryAllUserRedemptionRecordRequest { + cosmos.base.query.v1beta1.PageRequest pagination = 1; +} + +message QueryAllUserRedemptionRecordResponse { + repeated UserRedemptionRecord user_redemption_record = 1 + [ (gogoproto.nullable) = false ]; + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// Query UserRedemptionRecords by chainId / userId pair +message QueryAllUserRedemptionRecordForUserRequest { + string chain_id = 1; + uint64 day = 2; + string address = 3; + uint64 limit = 4; + cosmos.base.query.v1beta1.PageRequest pagination = 5; +} + +message QueryAllUserRedemptionRecordForUserResponse { + repeated UserRedemptionRecord user_redemption_record = 1 + [ (gogoproto.nullable) = false ]; + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +message QueryGetEpochUnbondingRecordRequest { uint64 epoch_number = 1; } + +message QueryGetEpochUnbondingRecordResponse { + EpochUnbondingRecord epoch_unbonding_record = 1 + [ (gogoproto.nullable) = false ]; +} + +message QueryAllEpochUnbondingRecordRequest { + cosmos.base.query.v1beta1.PageRequest pagination = 1; +} + +message QueryAllEpochUnbondingRecordResponse { + repeated EpochUnbondingRecord epoch_unbonding_record = 1 + [ (gogoproto.nullable) = false ]; + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +message QueryLSMDepositRequest { + string chain_id = 1; + string denom = 2; +} + +message QueryLSMDepositResponse { + LSMTokenDeposit deposit = 1 [ (gogoproto.nullable) = false ]; +} + +message QueryLSMDepositsRequest { + string chain_id = 1; + string validator_address = 2; + string status = 3; +} + +message QueryLSMDepositsResponse { + repeated LSMTokenDeposit deposits = 1 [ (gogoproto.nullable) = false ]; +} diff --git a/packages/cosmic-proto/proto/stride/records/records.proto b/packages/cosmic-proto/proto/stride/records/records.proto new file mode 100644 index 00000000000..501aa19ce81 --- /dev/null +++ b/packages/cosmic-proto/proto/stride/records/records.proto @@ -0,0 +1,129 @@ +syntax = "proto3"; +package stride.records; + +import "cosmos/base/v1beta1/coin.proto"; +import "gogoproto/gogo.proto"; + +option go_package = "github.com/Stride-Labs/stride/v25/x/records/types"; + +message UserRedemptionRecord { + string id = 1; // {chain_id}.{epoch}.{receiver} + string receiver = 3; + string native_token_amount = 4 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; + string denom = 5; + string host_zone_id = 6; + uint64 epoch_number = 7; + bool claim_is_pending = 8; + reserved 2; + string st_token_amount = 9 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; +} + +message DepositRecord { + uint64 id = 1; + string amount = 2 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; + string denom = 3; + string host_zone_id = 4; + enum Status { + // in transfer queue to be sent to the delegation ICA + TRANSFER_QUEUE = 0; + // transfer in progress (IBC packet sent, ack not received) + TRANSFER_IN_PROGRESS = 2; + // in staking queue on delegation ICA + DELEGATION_QUEUE = 1; + // staking in progress (ICA packet sent, ack not received) + DELEGATION_IN_PROGRESS = 3; + } + enum Source { + STRIDE = 0; + WITHDRAWAL_ICA = 1; + } + Status status = 6; + uint64 deposit_epoch_number = 7; + Source source = 8; + uint64 delegation_txs_in_progress = 9; + + reserved 5; +} + +message HostZoneUnbonding { + enum Status { + // tokens bonded on delegate account + UNBONDING_QUEUE = 0; + // unbonding ICA has been submitted + UNBONDING_IN_PROGRESS = 3; + // unbonding ICA failed for at least one batch and need to be retried + UNBONDING_RETRY_QUEUE = 5; + // unbonding completed on delegate account + EXIT_TRANSFER_QUEUE = 1; + // redemption sweep has been submitted + EXIT_TRANSFER_IN_PROGRESS = 4; + // transfer success + CLAIMABLE = 2; + } + string st_token_amount = 1 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; + string native_token_amount = 2 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; + string st_tokens_to_burn = 8 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; + string native_tokens_to_unbond = 9 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; + string claimable_native_tokens = 10 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; + uint64 undelegation_txs_in_progress = 11; + string denom = 3; + string host_zone_id = 4; + uint64 unbonding_time = 5; + Status status = 6; + repeated string user_redemption_records = 7; +} + +message EpochUnbondingRecord { + uint64 epoch_number = 1; + repeated HostZoneUnbonding host_zone_unbondings = 3; + reserved 2; +} + +message LSMTokenDeposit { + enum Status { + DEPOSIT_PENDING = 0; + TRANSFER_QUEUE = 1; + TRANSFER_IN_PROGRESS = 2; + TRANSFER_FAILED = 3; + DETOKENIZATION_QUEUE = 4; + DETOKENIZATION_IN_PROGRESS = 5; + DETOKENIZATION_FAILED = 6; + } + + string deposit_id = 1; + string chain_id = 2; + string denom = 3; + string ibc_denom = 4; + string staker_address = 5; + string validator_address = 6; + string amount = 7 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; + cosmos.base.v1beta1.Coin st_token = 8 [ (gogoproto.nullable) = false ]; + Status status = 9; +} diff --git a/packages/cosmic-proto/proto/stride/stakedym/genesis.proto b/packages/cosmic-proto/proto/stride/stakedym/genesis.proto new file mode 100644 index 00000000000..d3593688dc9 --- /dev/null +++ b/packages/cosmic-proto/proto/stride/stakedym/genesis.proto @@ -0,0 +1,37 @@ +syntax = "proto3"; +package stride.stakedym; + +import "gogoproto/gogo.proto"; +import "stride/stakedym/stakedym.proto"; + +option go_package = "github.com/Stride-Labs/stride/v25/x/stakedym/types"; + +// Params defines the stakedym module parameters. +message Params {} + +// TransferInProgressRecordIds stores record IDs for delegation records +// that have a transfer in progress +message TransferInProgressRecordIds { + string channel_id = 1; + uint64 sequence = 2; + uint64 record_id = 3; +} + +// GenesisState defines the stakedym module's genesis state. +message GenesisState { + Params params = 1 [ + (gogoproto.moretags) = "yaml:\"params\"", + (gogoproto.nullable) = false + ]; + + HostZone host_zone = 2 [ (gogoproto.nullable) = false ]; + repeated DelegationRecord delegation_records = 3 + [ (gogoproto.nullable) = false ]; + repeated UnbondingRecord unbonding_records = 4 + [ (gogoproto.nullable) = false ]; + repeated RedemptionRecord redemption_records = 5 + [ (gogoproto.nullable) = false ]; + repeated SlashRecord slash_records = 6 [ (gogoproto.nullable) = false ]; + repeated TransferInProgressRecordIds transfer_in_progress_record_ids = 7 + [ (gogoproto.nullable) = false ]; +} \ No newline at end of file diff --git a/packages/cosmic-proto/proto/stride/stakedym/query.proto b/packages/cosmic-proto/proto/stride/stakedym/query.proto new file mode 100644 index 00000000000..b31509b03fc --- /dev/null +++ b/packages/cosmic-proto/proto/stride/stakedym/query.proto @@ -0,0 +1,118 @@ + +syntax = "proto3"; +package stride.stakedym; + +import "stride/stakedym/stakedym.proto"; +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; +import "cosmos/base/query/v1beta1/pagination.proto"; + +option go_package = "github.com/Stride-Labs/stride/v25/x/stakedym/types"; + +// Query defines the gRPC querier service. +service Query { + // Queries the host zone struct + rpc HostZone(QueryHostZoneRequest) returns (QueryHostZoneResponse) { + option (google.api.http).get = "/Stride-Labs/stride/stakedym/host_zone"; + } + + // Queries the delegation records with an optional to include archived records + // Ex: + // - /delegation_records + // - /delegation_records?include_archived=true + rpc DelegationRecords(QueryDelegationRecordsRequest) + returns (QueryDelegationRecordsResponse) { + option (google.api.http).get = + "/Stride-Labs/stride/stakedym/delegation_records"; + } + + // Queries the unbonding records with an optional to include archived records + // Ex: + // - /unbonding_records + // - /unbonding_records?include_archived=true + rpc UnbondingRecords(QueryUnbondingRecordsRequest) + returns (QueryUnbondingRecordsResponse) { + option (google.api.http).get = + "/Stride-Labs/stride/stakedym/unbonding_records"; + } + + // Queries a single user redemption record + rpc RedemptionRecord(QueryRedemptionRecordRequest) + returns (QueryRedemptionRecordResponse) { + option (google.api.http).get = + "/Stride-Labs/stride/stakedym/redemption_record/{unbonding_record_id}/" + "{address}"; + } + + // Queries all redemption records with optional filters + // Ex: + // - /redemption_records + // - /redemption_records?address=strideXXX + // - /redemption_records?unbonding_record_id=100 + rpc RedemptionRecords(QueryRedemptionRecordsRequest) + returns (QueryRedemptionRecordsResponse) { + option (google.api.http).get = + "/Stride-Labs/stride/stakedym/redemption_records"; + } + + // Queries slash records + rpc SlashRecords(QuerySlashRecordsRequest) + returns (QuerySlashRecordsResponse) { + option (google.api.http).get = "/Stride-Labs/stride/stakedym/slash_records"; + } +} + +// Host Zone +message QueryHostZoneRequest {}; +message QueryHostZoneResponse { HostZone host_zone = 1; } + +// All Delegation Records +message QueryDelegationRecordsRequest { bool include_archived = 1; }; +message QueryDelegationRecordsResponse { + repeated DelegationRecord delegation_records = 1 + [ (gogoproto.nullable) = false ]; +} + +// All Unbonding Records +message QueryUnbondingRecordsRequest { bool include_archived = 1; }; +message QueryUnbondingRecordsResponse { + repeated UnbondingRecord unbonding_records = 1 + [ (gogoproto.nullable) = false ]; +} + +// Single Redemption Record +message QueryRedemptionRecordRequest { + uint64 unbonding_record_id = 1; + string address = 2; +}; +message QueryRedemptionRecordResponse { + RedemptionRecordResponse redemption_record_response = 1; +} + +// All Redemption Records +message QueryRedemptionRecordsRequest { + string address = 1; + uint64 unbonding_record_id = 2; + cosmos.base.query.v1beta1.PageRequest pagination = 3; +}; +message QueryRedemptionRecordsResponse { + repeated RedemptionRecordResponse redemption_record_responses = 1 + [ (gogoproto.nullable) = false ]; + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// All Slash Records +message QuerySlashRecordsRequest {}; +message QuerySlashRecordsResponse { + repeated SlashRecord slash_records = 1 [ (gogoproto.nullable) = false ]; +} + +// Data structure for frontend to consume +message RedemptionRecordResponse { + // Redemption record + RedemptionRecord redemption_record = 1; + + // The Unix timestamp (in seconds) at which the unbonding for the UR + // associated with this RR completes + uint64 unbonding_completion_time_seconds = 2; +} \ No newline at end of file diff --git a/packages/cosmic-proto/proto/stride/stakedym/stakedym.proto b/packages/cosmic-proto/proto/stride/stakedym/stakedym.proto new file mode 100644 index 00000000000..89eef2e119e --- /dev/null +++ b/packages/cosmic-proto/proto/stride/stakedym/stakedym.proto @@ -0,0 +1,208 @@ +syntax = "proto3"; +package stride.stakedym; + +import "cosmos_proto/cosmos.proto"; +import "gogoproto/gogo.proto"; + +option go_package = "github.com/Stride-Labs/stride/v25/x/stakedym/types"; + +message HostZone { + // Chain ID + string chain_id = 1; + // Native token denom on the host zone (e.g. adym) + string native_token_denom = 2; + // IBC denom of the native token as it lives on stride (e.g. ibc/...) + string native_token_ibc_denom = 3; + // Transfer channel ID from stride to the host zone + string transfer_channel_id = 4; + + // Operator controlled delegation address on the host zone + string delegation_address = 5 + [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + // Operator controlled reward address on the host zone + string reward_address = 6 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + // Deposit address on stride + string deposit_address = 7 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + // Redemption address on stride + string redemption_address = 8 + [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + // Claim address on stride + string claim_address = 9 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + // operator address set by safe, on stride + string operator_address_on_stride = 10 + [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + // admin address set upon host zone creation, on stride + string safe_address_on_stride = 11 + [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + + // Previous redemption rate + string last_redemption_rate = 12 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + // Current redemption rate + string redemption_rate = 13 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + // Min outer redemption rate - adjusted by governance + string min_redemption_rate = 14 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + // Max outer redemption rate - adjusted by governance + string max_redemption_rate = 15 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + // Min inner redemption rate - adjusted by controller + string min_inner_redemption_rate = 16 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + // Max inner redemption rate - adjusted by controller + string max_inner_redemption_rate = 17 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + + // Total delegated balance on the host zone delegation account + string delegated_balance = 18 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; + + // The undelegation period for Dymension in days + uint64 unbonding_period_seconds = 19; + // Indicates whether the host zone has been halted + bool halted = 20; +} + +// Status fields for a delegation record +// Note: There is an important assumption here that tokens in the deposit +// account should not be tracked by these records. The record is created as soon +// as the tokens leave stride +// Additionally, the GetActiveDelegationRecords query filters for records that +// are either TRANSFER_IN_PROGERSS or DELEGATION_QUEUE. If a new active status +// is added, the keeper must be modified +enum DelegationRecordStatus { + option (gogoproto.goproto_enum_prefix) = false; + + // TRANSFER_IN_PROGRESS indicates the native tokens are being sent from the + // deposit account to the delegation account + TRANSFER_IN_PROGRESS = 0; + // TRANSFER_FAILED indicates that the transfer either timed out or was an ack + // failure + TRANSFER_FAILED = 1; + // DELEGATION_QUEUE indicates the tokens have landed on the host zone and are + // ready to be delegated + DELEGATION_QUEUE = 2; + // DELEGATION_COMPLETE indicates the delegation has been completed + DELEGATION_COMPLETE = 3; +} + +// Status fields for an unbonding record +enum UnbondingRecordStatus { + option (gogoproto.goproto_enum_prefix) = false; + + // ACCUMULATING_REDEMPTIONS indicates redemptions are still being accumulated + // on this record + ACCUMULATING_REDEMPTIONS = 0; + // UNBONDING_QUEUE indicates the unbond amount for this epoch has been froze + // and the tokens are ready to be unbonded on the host zone + UNBONDING_QUEUE = 1; + // UNBONDING_IN_PROGRESS indicates the unbonding is currently in progress on + // the host zone + UNBONDING_IN_PROGRESS = 2; + // UNBONDED indicates the unbonding is finished on the host zone and the + // tokens are still in the delegation account + UNBONDED = 3; + // CLAIMABLE indicates the unbonded tokens have been swept to stride and are + // ready to be distributed to users + CLAIMABLE = 4; + // CLAIMED indicates the full unbonding cycle has been completed + CLAIMED = 5; +} + +// DelegationRecords track the aggregate liquid stakes and delegations +// for a given epoch +// Note: There is an important assumption here that tokens in the deposit +// account should not be tracked by these records. The record is created as soon +// as the tokens leave stride +message DelegationRecord { + // Deposit record unique ID + uint64 id = 1; + // The amount of native tokens that should be delegated + string native_amount = 2 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; + // The status indicating the point in the delegation's lifecycle + DelegationRecordStatus status = 3; + // The tx hash of the delegation on the host zone + string tx_hash = 4; +} + +// UnbondingRecords track the aggregate unbondings across an epoch +message UnbondingRecord { + // Unbonding record ID + uint64 id = 1; + // The status indicating the point in the delegation's lifecycle + UnbondingRecordStatus status = 2; + // The amount of stTokens that were redeemed + string st_token_amount = 3 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; + // The corresponding amount of native tokens that should be unbonded + string native_amount = 4 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; + // The Unix timestamp (in seconds) at which the unbonding completes + uint64 unbonding_completion_time_seconds = 5; + // The tx hash of the undelegation on the host zone + string undelegation_tx_hash = 6; + // The tx hash of the unbonded token sweep on the host zone + string unbonded_token_sweep_tx_hash = 7; +} + +// RedemptionRecords track an individual user's redemption claims +message RedemptionRecord { + // Unbonding record ID + uint64 unbonding_record_id = 1; + // Redeemer + string redeemer = 2; + // The amount of stTokens that were redeemed + string st_token_amount = 3 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; + // The corresponding amount of native tokens that should be unbonded + string native_amount = 4 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; +} + +// SlashRecords log adjustments to the delegated balance +message SlashRecord { + // The slash record monotonically increasing ID + uint64 id = 1; + // The Unix timestamp (in seconds) when the slash adjustment was processed on + // stride + uint64 time = 2; + // The delta by which the total delegated amount changed from slash + string native_amount = 3 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; + // The address (or addresses) of the validator that was slashed + string validator_address = 4; +} \ No newline at end of file diff --git a/packages/cosmic-proto/proto/stride/stakedym/tx.proto b/packages/cosmic-proto/proto/stride/stakedym/tx.proto new file mode 100644 index 00000000000..6f65c423700 --- /dev/null +++ b/packages/cosmic-proto/proto/stride/stakedym/tx.proto @@ -0,0 +1,236 @@ + +syntax = "proto3"; +package stride.stakedym; + +import "cosmos/msg/v1/msg.proto"; +import "amino/amino.proto"; +import "gogoproto/gogo.proto"; +import "cosmos/base/v1beta1/coin.proto"; +import "cosmos_proto/cosmos.proto"; +import "stride/stakedym/stakedym.proto"; + +option go_package = "github.com/Stride-Labs/stride/v25/x/stakedym/types"; + +enum OverwritableRecordType { + option (gogoproto.goproto_enum_prefix) = false; + + RECORD_TYPE_DELEGATION = 0; + RECORD_TYPE_UNBONDING = 1; + RECORD_TYPE_REDEMPTION = 2; +} + +// Msg defines the Msg service. +service Msg { + // User transaction to liquid stake native tokens into stTokens + rpc LiquidStake(MsgLiquidStake) returns (MsgLiquidStakeResponse); + + // User transaction to redeem stake stTokens into native tokens + rpc RedeemStake(MsgRedeemStake) returns (MsgRedeemStakeResponse); + + // Operator transaction to confirm a delegation was submitted + // on the host chain + rpc ConfirmDelegation(MsgConfirmDelegation) + returns (MsgConfirmDelegationResponse); + + // Operator transaction to confirm an undelegation was submitted + // on the host chain + rpc ConfirmUndelegation(MsgConfirmUndelegation) + returns (MsgConfirmUndelegationResponse); + + // Operator transaction to confirm unbonded tokens were transferred back to + // stride + rpc ConfirmUnbondedTokenSweep(MsgConfirmUnbondedTokenSweep) + returns (MsgConfirmUnbondedTokenSweepResponse); + + // Operator transaction to adjust the delegated balance after a validator was + // slashed + rpc AdjustDelegatedBalance(MsgAdjustDelegatedBalance) + returns (MsgAdjustDelegatedBalanceResponse); + + // Adjusts the inner redemption rate bounds on the host zone + rpc UpdateInnerRedemptionRateBounds(MsgUpdateInnerRedemptionRateBounds) + returns (MsgUpdateInnerRedemptionRateBoundsResponse); + + // Unhalts the host zone if redemption rates were exceeded + rpc ResumeHostZone(MsgResumeHostZone) returns (MsgResumeHostZoneResponse); + + // Trigger updating the redemption rate + rpc RefreshRedemptionRate(MsgRefreshRedemptionRate) + returns (MsgRefreshRedemptionRateResponse); + + // Overwrites a delegation record + rpc OverwriteDelegationRecord(MsgOverwriteDelegationRecord) + returns (MsgOverwriteDelegationRecordResponse); + + // Overwrites a unbonding record + rpc OverwriteUnbondingRecord(MsgOverwriteUnbondingRecord) + returns (MsgOverwriteUnbondingRecordResponse); + + // Overwrites a redemption record + rpc OverwriteRedemptionRecord(MsgOverwriteRedemptionRecord) + returns (MsgOverwriteRedemptionRecordResponse); + + // Sets the operator address + rpc SetOperatorAddress(MsgSetOperatorAddress) + returns (MsgSetOperatorAddressResponse); +} + +// LiquidStake +message MsgLiquidStake { + option (cosmos.msg.v1.signer) = "staker"; + option (amino.name) = "stakedym/MsgLiquidStake"; + + string staker = 1; + string native_amount = 2 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; +} +message MsgLiquidStakeResponse { + cosmos.base.v1beta1.Coin st_token = 1 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; +} + +// RedeemStake +message MsgRedeemStake { + option (cosmos.msg.v1.signer) = "redeemer"; + option (amino.name) = "stakedym/MsgRedeemStake"; + + string redeemer = 1; + string st_token_amount = 2 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; +} +message MsgRedeemStakeResponse { + cosmos.base.v1beta1.Coin native_token = 1 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; +} + +// ConfirmDelegation +message MsgConfirmDelegation { + option (cosmos.msg.v1.signer) = "operator"; + option (amino.name) = "stakedym/MsgConfirmDelegation"; + + string operator = 1; + uint64 record_id = 2; + string tx_hash = 3; +} +message MsgConfirmDelegationResponse {} + +// ConfirmUndelegation +message MsgConfirmUndelegation { + option (cosmos.msg.v1.signer) = "operator"; + option (amino.name) = "stakedym/MsgConfirmUndelegation"; + + string operator = 1; + uint64 record_id = 2; + string tx_hash = 3; +} +message MsgConfirmUndelegationResponse {} + +// ConfirmUnbondedTokenSweep +message MsgConfirmUnbondedTokenSweep { + option (cosmos.msg.v1.signer) = "operator"; + option (amino.name) = "stakedym/MsgConfirmUnbondedTokenSweep"; + + string operator = 1; + uint64 record_id = 2; + string tx_hash = 3; +} +message MsgConfirmUnbondedTokenSweepResponse {} + +// AdjustDelegatedBalance +message MsgAdjustDelegatedBalance { + option (cosmos.msg.v1.signer) = "operator"; + option (amino.name) = "stakedym/MsgAdjustDelegatedBalance"; + + string operator = 1; + string delegation_offset = 2 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; + string validator_address = 3; +} +message MsgAdjustDelegatedBalanceResponse {} + +// UpdateInnerRedemptionRate +message MsgUpdateInnerRedemptionRateBounds { + option (cosmos.msg.v1.signer) = "creator"; + option (amino.name) = "stakedym/MsgUpdateRedemptionRateBounds"; + + string creator = 1; + string min_inner_redemption_rate = 2 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + string max_inner_redemption_rate = 3 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; +} +message MsgUpdateInnerRedemptionRateBoundsResponse {} + +// ResumeHostZone +message MsgResumeHostZone { + option (cosmos.msg.v1.signer) = "creator"; + option (amino.name) = "stakedym/MsgResumeHostZone"; + + string creator = 1; +} +message MsgResumeHostZoneResponse {} + +// RefreshRedemptionRate +message MsgRefreshRedemptionRate { + option (cosmos.msg.v1.signer) = "creator"; + option (amino.name) = "stakedym/MsgRefreshRedemptionRate"; + + string creator = 1; +} +message MsgRefreshRedemptionRateResponse {} + +// OverwriteDelegationRecord +message MsgOverwriteDelegationRecord { + option (cosmos.msg.v1.signer) = "creator"; + option (amino.name) = "stakedym/MsgOverwriteDelegationRecord"; + + string creator = 1; + DelegationRecord delegation_record = 2; +} +message MsgOverwriteDelegationRecordResponse {} + +// OverwriteUnbondingRecord +message MsgOverwriteUnbondingRecord { + option (cosmos.msg.v1.signer) = "creator"; + option (amino.name) = "stakedym/MsgOverwriteUnbondingRecord"; + + string creator = 1; + UnbondingRecord unbonding_record = 2; +} +message MsgOverwriteUnbondingRecordResponse {} + +// OverwriteRedemptionRecord +message MsgOverwriteRedemptionRecord { + option (cosmos.msg.v1.signer) = "creator"; + option (amino.name) = "stakedym/MsgOverwriteRedemptionRecord"; + + string creator = 1; + RedemptionRecord redemption_record = 2; +} +message MsgOverwriteRedemptionRecordResponse {} + +// SetOperatorAddress +message MsgSetOperatorAddress { + option (cosmos.msg.v1.signer) = "signer"; + option (amino.name) = "stakedym/MsgSetOperatorAddress"; + + string signer = 1; + string operator = 2; +} +message MsgSetOperatorAddressResponse {} diff --git a/packages/cosmic-proto/proto/stride/stakeibc/README.md b/packages/cosmic-proto/proto/stride/stakeibc/README.md new file mode 100755 index 00000000000..6ab06a4a5a5 --- /dev/null +++ b/packages/cosmic-proto/proto/stride/stakeibc/README.md @@ -0,0 +1,5 @@ +Some of the data structures used in this module were inspired by Quicksilver. + +Specifically, we used their modeling of interchain accounts and zones (although the implementation has since diverged) for the following data structures +- Icaaccount +- HostZone diff --git a/packages/cosmic-proto/proto/stride/stakeibc/address_unbonding.proto b/packages/cosmic-proto/proto/stride/stakeibc/address_unbonding.proto new file mode 100644 index 00000000000..2790f813c01 --- /dev/null +++ b/packages/cosmic-proto/proto/stride/stakeibc/address_unbonding.proto @@ -0,0 +1,19 @@ +syntax = "proto3"; +package stride.stakeibc; + +import "gogoproto/gogo.proto"; + +option go_package = "github.com/Stride-Labs/stride/v25/x/stakeibc/types"; + +message AddressUnbonding { + string address = 1; + string receiver = 2; + string unbonding_estimated_time = 3; + string amount = 4 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; + string denom = 5; + bool claim_is_pending = 8; + uint64 epoch_number = 9; +} \ No newline at end of file diff --git a/packages/cosmic-proto/proto/stride/stakeibc/callbacks.proto b/packages/cosmic-proto/proto/stride/stakeibc/callbacks.proto new file mode 100644 index 00000000000..9d9e32edd34 --- /dev/null +++ b/packages/cosmic-proto/proto/stride/stakeibc/callbacks.proto @@ -0,0 +1,101 @@ +syntax = "proto3"; +package stride.stakeibc; +import "gogoproto/gogo.proto"; +import "cosmos/base/v1beta1/coin.proto"; +import "stride/records/records.proto"; +import "stride/stakeibc/host_zone.proto"; +import "stride/stakeibc/validator.proto"; +import "stride/stakeibc/ica_account.proto"; + +option go_package = "github.com/Stride-Labs/stride/v25/x/stakeibc/types"; + +message SplitDelegation { + string validator = 1; + string amount = 2 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; +} + +message SplitUndelegation { + string validator = 1; + string native_token_amount = 2 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; +} + +message DelegateCallback { + string host_zone_id = 1; + uint64 deposit_record_id = 2; + repeated SplitDelegation split_delegations = 3; +} + +message ClaimCallback { + string user_redemption_record_id = 1; + string chain_id = 2; + uint64 epoch_number = 3; +} + +message ReinvestCallback { + cosmos.base.v1beta1.Coin reinvest_amount = 1 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coin" + ]; + string host_zone_id = 3; +} + +message UndelegateCallback { + string host_zone_id = 1; + repeated SplitUndelegation split_undelegations = 2; + repeated uint64 epoch_unbonding_record_ids = 3; +} + +message RedemptionCallback { + string host_zone_id = 1; + repeated uint64 epoch_unbonding_record_ids = 2; +} + +message Rebalancing { + string src_validator = 1; + string dst_validator = 2; + string amt = 3 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; +} + +message RebalanceCallback { + string host_zone_id = 1; + repeated Rebalancing rebalancings = 2; +} + +message DetokenizeSharesCallback { records.LSMTokenDeposit deposit = 1; } + +message LSMLiquidStake { + records.LSMTokenDeposit deposit = 1; + HostZone host_zone = 2; + Validator validator = 3; +} + +message ValidatorSharesToTokensQueryCallback { + LSMLiquidStake lsm_liquid_stake = 1; +} + +message DelegatorSharesQueryCallback { + // Validator delegation at the time the query is submitted + string initial_validator_delegation = 1 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; +} + +message CommunityPoolBalanceQueryCallback { + ICAAccountType ica_type = 1; + string denom = 2; +} + +message TradeRouteCallback { + string reward_denom = 1; + string host_denom = 2; +} diff --git a/packages/cosmic-proto/proto/stride/stakeibc/epoch_tracker.proto b/packages/cosmic-proto/proto/stride/stakeibc/epoch_tracker.proto new file mode 100755 index 00000000000..e38db55a7d3 --- /dev/null +++ b/packages/cosmic-proto/proto/stride/stakeibc/epoch_tracker.proto @@ -0,0 +1,11 @@ +syntax = "proto3"; +package stride.stakeibc; + +option go_package = "github.com/Stride-Labs/stride/v25/x/stakeibc/types"; + +message EpochTracker { + string epoch_identifier = 1; + uint64 epoch_number = 2; + uint64 next_epoch_start_time = 3; + uint64 duration = 4; +} diff --git a/packages/cosmic-proto/proto/stride/stakeibc/genesis.proto b/packages/cosmic-proto/proto/stride/stakeibc/genesis.proto new file mode 100644 index 00000000000..b4875bbbb58 --- /dev/null +++ b/packages/cosmic-proto/proto/stride/stakeibc/genesis.proto @@ -0,0 +1,21 @@ +syntax = "proto3"; +package stride.stakeibc; + +import "gogoproto/gogo.proto"; +import "stride/stakeibc/params.proto"; +import "stride/stakeibc/host_zone.proto"; +import "stride/stakeibc/epoch_tracker.proto"; +import "stride/stakeibc/trade_route.proto"; + +option go_package = "github.com/Stride-Labs/stride/v25/x/stakeibc/types"; + +// GenesisState defines the stakeibc module's genesis state. +message GenesisState { + Params params = 1 [ (gogoproto.nullable) = false ]; + string port_id = 2; + repeated HostZone host_zone_list = 5 [ (gogoproto.nullable) = false ]; + repeated EpochTracker epoch_tracker_list = 10 + [ (gogoproto.nullable) = false ]; + repeated TradeRoute trade_routes = 12 [ (gogoproto.nullable) = false ]; + reserved 3, 4, 6, 9, 11; +} diff --git a/packages/cosmic-proto/proto/stride/stakeibc/gov.proto b/packages/cosmic-proto/proto/stride/stakeibc/gov.proto new file mode 100644 index 00000000000..c4328308435 --- /dev/null +++ b/packages/cosmic-proto/proto/stride/stakeibc/gov.proto @@ -0,0 +1,29 @@ +syntax = "proto3"; +package stride.stakeibc; +import "gogoproto/gogo.proto"; +import "stride/stakeibc/validator.proto"; +option go_package = "github.com/Stride-Labs/stride/v25/x/stakeibc/types"; + +message AddValidatorsProposal { + option (gogoproto.equal) = true; + option (gogoproto.goproto_getters) = false; + option (gogoproto.goproto_stringer) = false; + + string title = 1; + string description = 2; + string host_zone = 3; + repeated Validator validators = 4; + string deposit = 5 [ (gogoproto.moretags) = "yaml:\"deposit\"" ]; +} + +message ToggleLSMProposal { + option (gogoproto.equal) = true; + option (gogoproto.goproto_getters) = false; + option (gogoproto.goproto_stringer) = false; + + string title = 1; + string description = 2; + string host_zone = 3; + bool enabled = 4; + string deposit = 5 [ (gogoproto.moretags) = "yaml:\"deposit\"" ]; +} \ No newline at end of file diff --git a/packages/cosmic-proto/proto/stride/stakeibc/host_zone.proto b/packages/cosmic-proto/proto/stride/stakeibc/host_zone.proto new file mode 100644 index 00000000000..174859edc75 --- /dev/null +++ b/packages/cosmic-proto/proto/stride/stakeibc/host_zone.proto @@ -0,0 +1,140 @@ +syntax = "proto3"; +package stride.stakeibc; + +import "stride/stakeibc/validator.proto"; +import "gogoproto/gogo.proto"; +import "cosmos_proto/cosmos.proto"; + +option go_package = "github.com/Stride-Labs/stride/v25/x/stakeibc/types"; + +// CommunityPoolRebate stores the size of the community pool liquid stake +// (denominated in stTokens) and the rebate rate as a decimal +message CommunityPoolRebate { + // Rebate percentage as a decimal (e.g. 0.2 for 20%) + string rebate_rate = 1 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + // Number of stTokens received from the community pool liquid stake + string liquid_staked_st_token_amount = 2 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; +} + +// Core data structure to track liquid staking zones +message HostZone { + // Chain ID of the host zone + string chain_id = 1; + // Bech32 prefix of host zone's address + string bech32prefix = 17; + // ConnectionID from Stride to the host zone (ID is on the stride side) + string connection_id = 2; + // Transfer Channel ID from Stride to the host zone (ID is on the stride side) + string transfer_channel_id = 12; + // ibc denom of the host zone's native token on stride + string ibc_denom = 8; + // native denom on host zone + string host_denom = 9; + // The unbonding period in days (e.g. 21) + uint64 unbonding_period = 26; + // List of validators that are delegated to + repeated Validator validators = 3; + // Address that custodies native tokens during a liquid stake + string deposit_address = 18 + [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + // ICA Address on the host zone responsible for collecting rewards + string withdrawal_ica_address = 22 + [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + // ICA Address on the host zone responsible for commission + string fee_ica_address = 23 + [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + // ICA Address on the host zone responsible for staking and unstaking + string delegation_ica_address = 24 + [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + // ICA Address that receives unstaked tokens after they've finished unbonding + string redemption_ica_address = 25 + [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + // ICA Address that receives tokens from a community pool to liquid stake or + // redeem In the case of a liquid stake, the community pool deposits native + // tokens In the case of a redemption, the community pool deposits stTokens + string community_pool_deposit_ica_address = 30 + [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + // ICA Address that distributes tokens back to the community pool during a + // community pool liquid stake or redeem In the case of a liquid stake, the + // return address sends back stTokens In the case of a redemption, the return + // address sends back native tokens + string community_pool_return_ica_address = 31 + [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + // Module account on Stride that receives native tokens from the deposit ICA + // and liquid stakes them + string community_pool_stake_holding_address = 32 + [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + // Module account on Stride that receives stTokens from the deposit ICA and + // redeems them + string community_pool_redeem_holding_address = 33 + [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + // Optional community pool address to send tokens to after a community pool + // liquid stake or redemption If this address is empty, the tokens are sent to + // the main community pool + string community_pool_treasury_address = 35 + [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + // The total delegated balance on the host zone + string total_delegations = 13 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; + // The redemption rate from the previous epoch + string last_redemption_rate = 10 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + // The current redemption rate + string redemption_rate = 11 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + // The min outer redemption rate bound - controlled only be governance + // The min inner bound cannot exceed this bound + string min_redemption_rate = 20 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + // The max outer redemption rate bound - controlled only be governance + // The max inner bound cannot exceed this bound + string max_redemption_rate = 21 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + // The min minner redemption rate bound - controlled by the admin + // If the redemption rate exceeds this bound, the host zone is halted + string min_inner_redemption_rate = 28 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + // The max minner redemption rate bound - controlled by the admin + // If the redemption rate exceeds this bound, the host zone is halted + string max_inner_redemption_rate = 29 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + // The max number of messages that can be sent in a delegation + // or undelegation ICA tx + uint64 max_messages_per_ica_tx = 36; + // Indicates whether redemptions are allowed through this module + bool redemptions_enabled = 37; + // An optional fee rebate + // If there is no rebate for the host zone, this will be nil + CommunityPoolRebate community_pool_rebate = 34; + // A boolean indicating whether the chain has LSM enabled + bool lsm_liquid_stake_enabled = 27; + // A boolean indicating whether the chain is currently halted + bool halted = 19; + reserved 4, 5, 6, 7, 14, 15, 16; +} diff --git a/packages/cosmic-proto/proto/stride/stakeibc/ica_account.proto b/packages/cosmic-proto/proto/stride/stakeibc/ica_account.proto new file mode 100644 index 00000000000..bf228433c87 --- /dev/null +++ b/packages/cosmic-proto/proto/stride/stakeibc/ica_account.proto @@ -0,0 +1,22 @@ +syntax = "proto3"; +package stride.stakeibc; + +option go_package = "github.com/Stride-Labs/stride/v25/x/stakeibc/types"; + +enum ICAAccountType { + DELEGATION = 0; + FEE = 1; + WITHDRAWAL = 2; + REDEMPTION = 3; + COMMUNITY_POOL_DEPOSIT = 4; + COMMUNITY_POOL_RETURN = 5; + CONVERTER_UNWIND = 6; + CONVERTER_TRADE = 7; +} + +message ICAAccount { + string chain_id = 1; + ICAAccountType type = 2; + string connection_id = 3; + string address = 4; +} diff --git a/packages/cosmic-proto/proto/stride/stakeibc/packet.proto b/packages/cosmic-proto/proto/stride/stakeibc/packet.proto new file mode 100755 index 00000000000..1d69c4bf398 --- /dev/null +++ b/packages/cosmic-proto/proto/stride/stakeibc/packet.proto @@ -0,0 +1,17 @@ +syntax = "proto3"; +package stride.stakeibc; + +// this line is used by starport scaffolding # proto/packet/import + +option go_package = "github.com/Stride-Labs/stride/v25/x/stakeibc/types"; + +message StakeibcPacketData { + oneof packet { + NoData no_data = 1; + // this line is used by starport scaffolding # ibc/packet/proto/field + } +} + +message NoData {} + +// this line is used by starport scaffolding # ibc/packet/proto/message \ No newline at end of file diff --git a/packages/cosmic-proto/proto/stride/stakeibc/params.proto b/packages/cosmic-proto/proto/stride/stakeibc/params.proto new file mode 100755 index 00000000000..f2aa7281e12 --- /dev/null +++ b/packages/cosmic-proto/proto/stride/stakeibc/params.proto @@ -0,0 +1,32 @@ +syntax = "proto3"; +package stride.stakeibc; + +import "gogoproto/gogo.proto"; + +option go_package = "github.com/Stride-Labs/stride/v25/x/stakeibc/types"; + +// Params defines the parameters for the module. +// next id: 20 +message Params { + option (gogoproto.goproto_stringer) = false; + + // define epoch lengths, in stride_epochs + uint64 rewards_interval = 1; + uint64 delegate_interval = 6; + uint64 deposit_interval = 2; + uint64 redemption_rate_interval = 3; + uint64 stride_commission = 4; + uint64 reinvest_interval = 7; + uint64 ica_timeout_nanos = 9; + uint64 buffer_size = 10; + uint64 ibc_timeout_blocks = 11; + uint64 fee_transfer_timeout_nanos = 12; + uint64 max_stake_ica_calls_per_epoch = 13; + uint64 default_min_redemption_rate_threshold = 14; + uint64 default_max_redemption_rate_threshold = 15; + uint64 ibc_transfer_timeout_nanos = 16; + uint64 validator_slash_query_threshold = 19; + uint64 validator_weight_cap = 20; + + reserved 8, 17, 18; +} \ No newline at end of file diff --git a/packages/cosmic-proto/proto/stride/stakeibc/query.proto b/packages/cosmic-proto/proto/stride/stakeibc/query.proto new file mode 100644 index 00000000000..501555fde25 --- /dev/null +++ b/packages/cosmic-proto/proto/stride/stakeibc/query.proto @@ -0,0 +1,161 @@ +syntax = "proto3"; +package stride.stakeibc; + +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; +import "cosmos/base/query/v1beta1/pagination.proto"; +import "stride/stakeibc/params.proto"; +import "stride/stakeibc/validator.proto"; +import "stride/stakeibc/host_zone.proto"; +import "stride/stakeibc/epoch_tracker.proto"; +import "stride/stakeibc/address_unbonding.proto"; +import "stride/stakeibc/trade_route.proto"; + +option go_package = "github.com/Stride-Labs/stride/v25/x/stakeibc/types"; + +// Query defines the gRPC querier service. +service Query { + // Parameters queries the parameters of the module. + rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/Stridelabs/stride/stakeibc/params"; + } + // Queries a Validator by host zone. + rpc Validators(QueryGetValidatorsRequest) + returns (QueryGetValidatorsResponse) { + option (google.api.http).get = + "/Stride-Labs/stride/stakeibc/validators/{chain_id}"; + } + // Queries a HostZone by id. + rpc HostZone(QueryGetHostZoneRequest) returns (QueryGetHostZoneResponse) { + option (google.api.http).get = + "/Stride-Labs/stride/stakeibc/host_zone/{chain_id}"; + } + + // Queries a list of HostZone items. + rpc HostZoneAll(QueryAllHostZoneRequest) returns (QueryAllHostZoneResponse) { + option (google.api.http).get = "/Stride-Labs/stride/stakeibc/host_zone"; + } + + // Queries a list of ModuleAddress items. + rpc ModuleAddress(QueryModuleAddressRequest) + returns (QueryModuleAddressResponse) { + option (google.api.http).get = + "/Stride-Labs/stride/stakeibc/module_address/{name}"; + } + // QueryInterchainAccountFromAddress returns the interchain account for given + // owner address on a given connection pair + rpc InterchainAccountFromAddress(QueryInterchainAccountFromAddressRequest) + returns (QueryInterchainAccountFromAddressResponse); + + // Queries a EpochTracker by index. + rpc EpochTracker(QueryGetEpochTrackerRequest) + returns (QueryGetEpochTrackerResponse) { + option (google.api.http).get = + "/Stride-Labs/stride/stakeibc/epoch_tracker/{epoch_identifier}"; + } + + // Queries a list of EpochTracker items. + rpc EpochTrackerAll(QueryAllEpochTrackerRequest) + returns (QueryAllEpochTrackerResponse) { + option (google.api.http).get = "/Stride-Labs/stride/stakeibc/epoch_tracker"; + } + + // Queries the next packet sequence for one for a given channel + rpc NextPacketSequence(QueryGetNextPacketSequenceRequest) + returns (QueryGetNextPacketSequenceResponse) { + option (google.api.http).get = + "/Stride-Labs/stride/stakeibc/next_packet_sequence/{channel_id}/" + "{port_id}"; + } + + // Queries an address's unbondings + rpc AddressUnbondings(QueryAddressUnbondings) + returns (QueryAddressUnbondingsResponse) { + option (google.api.http).get = + "/Stride-Labs/stride/stakeibc/unbondings/{address}"; + } + + // Queries all trade routes + rpc AllTradeRoutes(QueryAllTradeRoutes) + returns (QueryAllTradeRoutesResponse) { + option (google.api.http).get = "/Stride-Labs/stride/stakeibc/trade_routes"; + } +} + +// QueryInterchainAccountFromAddressRequest is the request type for the +// Query/InterchainAccountAddress RPC +message QueryInterchainAccountFromAddressRequest { + string owner = 1; + string connection_id = 2 [ (gogoproto.moretags) = "yaml:\"connection_id\"" ]; +} + +// QueryInterchainAccountFromAddressResponse the response type for the +// Query/InterchainAccountAddress RPC +message QueryInterchainAccountFromAddressResponse { + string interchain_account_address = 1 + [ (gogoproto.moretags) = "yaml:\"interchain_account_address\"" ]; +} + +// QueryParamsRequest is request type for the Query/Params RPC method. +message QueryParamsRequest {} + +// QueryParamsResponse is response type for the Query/Params RPC method. +message QueryParamsResponse { + // params holds all the parameters of this module. + Params params = 1 [ (gogoproto.nullable) = false ]; +} + +message QueryGetValidatorsRequest { string chain_id = 1; } + +message QueryGetValidatorsResponse { repeated Validator validators = 1; } + +message QueryGetHostZoneRequest { string chain_id = 1; } + +message QueryGetHostZoneResponse { + HostZone host_zone = 1 [ (gogoproto.nullable) = false ]; +} + +message QueryAllHostZoneRequest { + cosmos.base.query.v1beta1.PageRequest pagination = 1; +} + +message QueryAllHostZoneResponse { + repeated HostZone host_zone = 1 [ (gogoproto.nullable) = false ]; + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +message QueryModuleAddressRequest { string name = 1; } + +message QueryModuleAddressResponse { string addr = 1; } + +message QueryGetEpochTrackerRequest { string epoch_identifier = 1; } + +message QueryGetEpochTrackerResponse { + EpochTracker epoch_tracker = 1 [ (gogoproto.nullable) = false ]; +} + +message QueryAllEpochTrackerRequest {} + +message QueryAllEpochTrackerResponse { + repeated EpochTracker epoch_tracker = 1 [ (gogoproto.nullable) = false ]; +} + +message QueryGetNextPacketSequenceRequest { + string channel_id = 1; + string port_id = 2; +} + +message QueryGetNextPacketSequenceResponse { uint64 sequence = 1; } + +message QueryAddressUnbondings { string address = 1; } + +message QueryAddressUnbondingsResponse { + repeated AddressUnbonding address_unbondings = 1 + [ (gogoproto.nullable) = false ]; +} + +message QueryAllTradeRoutes {}; + +message QueryAllTradeRoutesResponse { + repeated TradeRoute trade_routes = 1 [ (gogoproto.nullable) = false ]; +} diff --git a/packages/cosmic-proto/proto/stride/stakeibc/trade_route.proto b/packages/cosmic-proto/proto/stride/stakeibc/trade_route.proto new file mode 100644 index 00000000000..7b542f80db7 --- /dev/null +++ b/packages/cosmic-proto/proto/stride/stakeibc/trade_route.proto @@ -0,0 +1,106 @@ +syntax = "proto3"; +package stride.stakeibc; + +import "gogoproto/gogo.proto"; +import "stride/stakeibc/ica_account.proto"; +import "cosmos_proto/cosmos.proto"; + +option go_package = "github.com/Stride-Labs/stride/v25/x/stakeibc/types"; + +// Deprecated, this configuration is no longer needed since swaps +// are executed off-chain via authz +// +// Stores pool information needed to execute the swap along a trade route +message TradeConfig { + option deprecated = true; + + // Currently Osmosis is the only trade chain so this is an osmosis pool id + uint64 pool_id = 1; + + // Spot price in the pool to convert the reward denom to the host denom + // output_tokens = swap_price * input tokens + // This value may be slightly stale as it is updated by an ICQ + string swap_price = 2 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + // unix time in seconds that the price was last updated + uint64 price_update_timestamp = 3; + + // Threshold defining the percentage of tokens that could be lost in the trade + // This captures both the loss from slippage and from a stale price on stride + // 0.05 means the output from the trade can be no less than a 5% deviation + // from the current value + string max_allowed_swap_loss_rate = 4 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + + // min and max set boundaries of reward denom on trade chain we will swap + // min also decides when reward token transfers are worth it (transfer fees) + string min_swap_amount = 5 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; + string max_swap_amount = 6 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; +} + +// TradeRoute represents a round trip including info on transfer and how to do +// the swap. It makes the assumption that the reward token is always foreign to +// the host so therefore the first two hops are to unwind the ibc denom enroute +// to the trade chain and the last hop is the return so funds start/end in the +// withdrawl ICA on hostZone +// The structure is key'd on reward denom and host denom in their native forms +// (i.e. reward_denom_on_reward_zone and host_denom_on_host_zone) +message TradeRoute { + // ibc denom for the reward on the host zone + string reward_denom_on_host_zone = 1; + // should be the native denom for the reward chain + string reward_denom_on_reward_zone = 2; + // ibc denom of the reward on the trade chain, input to the swap + string reward_denom_on_trade_zone = 3; + // ibc of the host denom on the trade chain, output from the swap + string host_denom_on_trade_zone = 4; + // should be the same as the native host denom on the host chain + string host_denom_on_host_zone = 5; + + // ICAAccount on the host zone with the reward tokens + // This is the same as the host zone withdrawal ICA account + ICAAccount host_account = 6 [ (gogoproto.nullable) = false ]; + // ICAAccount on the reward zone that is acts as the intermediate + // receiver of the transfer from host zone to trade zone + ICAAccount reward_account = 7 [ (gogoproto.nullable) = false ]; + // ICAAccount responsible for executing the swap of reward + // tokens for host tokens + ICAAccount trade_account = 8 [ (gogoproto.nullable) = false ]; + + // Channel responsible for the transfer of reward tokens from the host + // zone to the reward zone. This is the channel ID on the host zone side + string host_to_reward_channel_id = 9; + // Channel responsible for the transfer of reward tokens from the reward + // zone to the trade zone. This is the channel ID on the reward zone side + string reward_to_trade_channel_id = 10; + // Channel responsible for the transfer of host tokens from the trade + // zone, back to the host zone. This is the channel ID on the trade zone side + string trade_to_host_channel_id = 11; + + // Minimum amount of reward token that must be accumulated before + // the tokens are transferred to the trade ICA + string min_transfer_amount = 13 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; + + // Deprecated, the trades are now executed off-chain via authz + // so the trade configuration is no longer needed + // + // specifies the configuration needed to execute the swap + // such as pool_id, slippage, min trade amount, etc. + TradeConfig trade_config = 12 + [ deprecated = true, (gogoproto.nullable) = false ]; +} diff --git a/packages/cosmic-proto/proto/stride/stakeibc/tx.proto b/packages/cosmic-proto/proto/stride/stakeibc/tx.proto new file mode 100644 index 00000000000..398fcc7ac17 --- /dev/null +++ b/packages/cosmic-proto/proto/stride/stakeibc/tx.proto @@ -0,0 +1,428 @@ +syntax = "proto3"; +package stride.stakeibc; + +import "stride/stakeibc/validator.proto"; + +option go_package = "github.com/Stride-Labs/stride/v25/x/stakeibc/types"; +import "gogoproto/gogo.proto"; +import "cosmos_proto/cosmos.proto"; +import "cosmos/base/v1beta1/coin.proto"; +import "cosmos/msg/v1/msg.proto"; +import "amino/amino.proto"; + +// Msg defines the Msg service. +service Msg { + rpc LiquidStake(MsgLiquidStake) returns (MsgLiquidStakeResponse); + rpc LSMLiquidStake(MsgLSMLiquidStake) returns (MsgLSMLiquidStakeResponse); + rpc RedeemStake(MsgRedeemStake) returns (MsgRedeemStakeResponse); + rpc RegisterHostZone(MsgRegisterHostZone) + returns (MsgRegisterHostZoneResponse); + rpc ClaimUndelegatedTokens(MsgClaimUndelegatedTokens) + returns (MsgClaimUndelegatedTokensResponse); + rpc RebalanceValidators(MsgRebalanceValidators) + returns (MsgRebalanceValidatorsResponse); + rpc AddValidators(MsgAddValidators) returns (MsgAddValidatorsResponse); + rpc ChangeValidatorWeight(MsgChangeValidatorWeights) + returns (MsgChangeValidatorWeightsResponse); + rpc DeleteValidator(MsgDeleteValidator) returns (MsgDeleteValidatorResponse); + rpc RestoreInterchainAccount(MsgRestoreInterchainAccount) + returns (MsgRestoreInterchainAccountResponse); + rpc CloseDelegationChannel(MsgCloseDelegationChannel) + returns (MsgCloseDelegationChannelResponse); + rpc UpdateValidatorSharesExchRate(MsgUpdateValidatorSharesExchRate) + returns (MsgUpdateValidatorSharesExchRateResponse); + rpc CalibrateDelegation(MsgCalibrateDelegation) + returns (MsgCalibrateDelegationResponse); + rpc ClearBalance(MsgClearBalance) returns (MsgClearBalanceResponse); + rpc UpdateInnerRedemptionRateBounds(MsgUpdateInnerRedemptionRateBounds) + returns (MsgUpdateInnerRedemptionRateBoundsResponse); + rpc ResumeHostZone(MsgResumeHostZone) returns (MsgResumeHostZoneResponse); + rpc CreateTradeRoute(MsgCreateTradeRoute) + returns (MsgCreateTradeRouteResponse); + rpc DeleteTradeRoute(MsgDeleteTradeRoute) + returns (MsgDeleteTradeRouteResponse); + rpc UpdateTradeRoute(MsgUpdateTradeRoute) + returns (MsgUpdateTradeRouteResponse); + rpc SetCommunityPoolRebate(MsgSetCommunityPoolRebate) + returns (MsgSetCommunityPoolRebateResponse); + rpc ToggleTradeController(MsgToggleTradeController) + returns (MsgToggleTradeControllerResponse); + rpc UpdateHostZoneParams(MsgUpdateHostZoneParams) + returns (MsgUpdateHostZoneParamsResponse); +} + +message MsgUpdateInnerRedemptionRateBounds { + string creator = 1; + string chain_id = 2; + string min_inner_redemption_rate = 3 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + string max_inner_redemption_rate = 4 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; +} + +message MsgUpdateInnerRedemptionRateBoundsResponse {} + +message MsgLiquidStake { + string creator = 1; + string amount = 2 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; + string host_denom = 3; +} +message MsgLiquidStakeResponse { + cosmos.base.v1beta1.Coin st_token = 1 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; +} + +message MsgLSMLiquidStake { + string creator = 1; + string amount = 2 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; + string lsm_token_ibc_denom = 3; +} +message MsgLSMLiquidStakeResponse { bool transaction_complete = 1; } + +message MsgClearBalance { + string creator = 1; + string chain_id = 2; + string amount = 3 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; + string channel = 4; +} +message MsgClearBalanceResponse {} + +message MsgRedeemStake { + string creator = 1; + string amount = 2 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; + string host_zone = 3; + string receiver = 4; +} +message MsgRedeemStakeResponse {} + +// next: 15 +message MsgRegisterHostZone { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + string connection_id = 2 [ (gogoproto.moretags) = "yaml:\"connection_id\"" ]; + string bech32prefix = 12; + string host_denom = 4 [ (gogoproto.moretags) = "yaml:\"host_denom\"" ]; + string ibc_denom = 5 [ (gogoproto.moretags) = "yaml:\"ibc_denom\"" ]; + string creator = 6; + string transfer_channel_id = 10 + [ (gogoproto.moretags) = "yaml:\"transfer_channel_id\"" ]; + uint64 unbonding_period = 11 + [ (gogoproto.moretags) = "yaml:\"unbonding_period\"" ]; + string min_redemption_rate = 13 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + string max_redemption_rate = 14 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + bool lsm_liquid_stake_enabled = 15; + string community_pool_treasury_address = 16; + uint64 max_messages_per_ica_tx = 17; +} +message MsgRegisterHostZoneResponse {} + +message MsgClaimUndelegatedTokens { + string creator = 1; + // UserUnbondingRecords are keyed on {chain_id}.{epoch}.{receiver} + string host_zone_id = 2; + uint64 epoch = 3; + string receiver = 5; + reserved 4; +} +message MsgClaimUndelegatedTokensResponse {} + +message MsgRebalanceValidators { + string creator = 1; + string host_zone = 2; + uint64 num_rebalance = 3; +} +message MsgRebalanceValidatorsResponse {} + +message MsgAddValidators { + string creator = 1; + string host_zone = 2; + repeated Validator validators = 3; +} +message MsgAddValidatorsResponse {} + +message ValidatorWeight { + string address = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + uint64 weight = 2; +} +message MsgChangeValidatorWeights { + string creator = 1; + string host_zone = 2; + repeated ValidatorWeight validator_weights = 3; +} +message MsgChangeValidatorWeightsResponse {} + +message MsgDeleteValidator { + string creator = 1; + string host_zone = 2; + string val_addr = 3 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; +} +message MsgDeleteValidatorResponse {} + +message MsgRestoreInterchainAccount { + string creator = 1; + string chain_id = 2; + string connection_id = 3; + string account_owner = 4; +} +message MsgRestoreInterchainAccountResponse {} + +message MsgCloseDelegationChannel { + string creator = 1; + string chain_id = 2; +} +message MsgCloseDelegationChannelResponse {} + +message MsgUpdateValidatorSharesExchRate { + string creator = 1; + string chain_id = 2; + string valoper = 3; +} +message MsgUpdateValidatorSharesExchRateResponse {} + +message MsgCalibrateDelegation { + string creator = 1; + string chain_id = 2; + string valoper = 3; +} +message MsgCalibrateDelegationResponse {} + +message MsgResumeHostZone { + string creator = 1; + string chain_id = 2; +} +message MsgResumeHostZoneResponse {} + +// Creates a new trade route +message MsgCreateTradeRoute { + option (cosmos.msg.v1.signer) = "authority"; + option (amino.name) = "stride/x/stakeibc/MsgCreateTradeRoute"; + + // authority is the address that controls the module (defaults to x/gov unless + // overwritten). + string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + + // The chain ID of the host zone + string host_chain_id = 2; + + // Connection IDs between stride and the other zones + string stride_to_reward_connection_id = 3; + string stride_to_trade_connection_id = 4; + + // Transfer channels between the host, reward, and trade zones + string host_to_reward_transfer_channel_id = 5; + string reward_to_trade_transfer_channel_id = 6; + string trade_to_host_transfer_channel_id = 7; + + // ibc denom for the reward token on the host zone (e.g. ibc/usdc on dYdX) + string reward_denom_on_host = 8; + // native denom of reward token on the reward zone (e.g. usdc on Noble) + string reward_denom_on_reward = 9; + // ibc denom of the reward token on the trade zone (e.g. ibc/usdc on Osmosis) + string reward_denom_on_trade = 10; + // ibc denom of the host's token on the trade zone (e.g. ibc/dydx on Osmosis) + string host_denom_on_trade = 11; + // the host zone's native denom (e.g. dydx on dYdX) + string host_denom_on_host = 12; + + // Deprecated, the trades are now executed off-chain via authz + // + // The osmosis pool ID + uint64 pool_id = 13 [ deprecated = true ]; + + // Deprecated, the trades are now executed off-chain via authz + // + // Threshold defining the percentage of tokens that could be lost in the trade + // This captures both the loss from slippage and from a stale price on stride + // "0.05" means the output from the trade can be no less than a 5% deviation + // from the current value + string max_allowed_swap_loss_rate = 14 [ deprecated = true ]; + + // Deprecated, the trades are now executed off-chain via authz + // + // minimum amount of reward tokens to initate a swap + // if not provided, defaults to 0 + string min_swap_amount = 15 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; + // Deprecated, the trades are now executed off-chain via authz + // + // maximum amount of reward tokens in a single swap + // if not provided, defaults to 10e24 + string max_swap_amount = 16 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; + + // Minimum amount of reward token that must be accumulated before + // the tokens are transferred to the trade ICA + string min_transfer_amount = 17 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; +} +message MsgCreateTradeRouteResponse {} + +// Deletes a trade route +message MsgDeleteTradeRoute { + option (cosmos.msg.v1.signer) = "authority"; + option (amino.name) = "stride/x/stakeibc/MsgDeleteTradeRoute"; + + // authority is the address that controls the module (defaults to x/gov unless + // overwritten). + string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + + // The reward denom of the route in it's native form (e.g. usdc) + string reward_denom = 2; + // The host zone's denom in it's native form (e.g. dydx) + string host_denom = 3; +} +message MsgDeleteTradeRouteResponse {} + +// Updates the config of a trade route +message MsgUpdateTradeRoute { + option (cosmos.msg.v1.signer) = "authority"; + option (amino.name) = "stride/x/stakeibc/MsgUpdateTradeRoute"; + + // authority is the address that controls the module (defaults to x/gov unless + // overwritten). + string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + + // The reward denom of the route in it's native form (e.g. usdc) + string reward_denom = 2; + // The host zone's denom in it's native form (e.g. dydx) + string host_denom = 3; + + // Deprecated, the trades are now executed off-chain via authz + // + // The osmosis pool ID + uint64 pool_id = 4 [ deprecated = true ]; + + // Deprecated, the trades are now executed off-chain via authz + // + // Threshold defining the percentage of tokens that could be lost in the trade + // This captures both the loss from slippage and from a stale price on stride + // "0.05" means the output from the trade can be no less than a 5% deviation + // from the current value + string max_allowed_swap_loss_rate = 5 [ deprecated = true ]; + + // Deprecated, the trades are now executed off-chain via authz + // + // minimum amount of reward tokens to initate a swap + // if not provided, defaults to 0 + string min_swap_amount = 6 [ + deprecated = true, + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; + // Deprecated, the trades are now executed off-chain via authz + // + // maximum amount of reward tokens in a single swap + // if not provided, defaults to 10e24 + string max_swap_amount = 7 [ + deprecated = true, + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; + + // Minimum amount of reward token that must be accumulated before + // the tokens are transferred to the trade ICA + string min_transfer_amount = 17 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; +} +message MsgUpdateTradeRouteResponse {} + +// Registers or updates a community pool rebate by specifying the amount liquid +// staked +message MsgSetCommunityPoolRebate { + option (cosmos.msg.v1.signer) = "creator"; + option (amino.name) = "stride/x/stakeibc/MsgSetCommunityPoolRebate"; + + // Message signer (admin only) + string creator = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + // Chain id of the chain whose community pool has a liquid staking rebate + // arrangement with stride + string chain_id = 2; + // Rebate percentage represented as a decimal (e.g. 0.2 for 20%) + string rebate_rate = 3 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + // Number of stTokens recieved by the community pool after liquid staking + string liquid_staked_st_token_amount = 4 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; +} +message MsgSetCommunityPoolRebateResponse {} + +enum AuthzPermissionChange { + // Grant the address trade permissions + GRANT = 0; + // Revoke trade permissions from the address + REVOKE = 1; +} + +// Grants or revokes trade permissions to a given address via authz +message MsgToggleTradeController { + option (cosmos.msg.v1.signer) = "creator"; + option (amino.name) = "stride/x/stakeibc/MsgToggleTradeController"; + + // Message signer (admin only) + string creator = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + // Chain ID of the trade account + string chain_id = 2; + // Permission change (either grant or revoke) + AuthzPermissionChange permission_change = 3; + // Address of trade operator + string address = 4; + // Option to grant/revoke the legacy osmosis swap message + bool legacy = 5; +} +message MsgToggleTradeControllerResponse {} + +// Updates host zone params +message MsgUpdateHostZoneParams { + option (cosmos.msg.v1.signer) = "authority"; + option (amino.name) = "stride/x/stakeibc/MsgUpdateHostZoneParams"; + + // authority is the address that controls the module (defaults to x/gov unless + // overwritten). + string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + // Chain ID of the host zone + string chain_id = 2; + // Max messages that can be sent in a single ICA message + uint64 max_messages_per_ica_tx = 3; +} +message MsgUpdateHostZoneParamsResponse {} \ No newline at end of file diff --git a/packages/cosmic-proto/proto/stride/stakeibc/validator.proto b/packages/cosmic-proto/proto/stride/stakeibc/validator.proto new file mode 100644 index 00000000000..4eb4202ba51 --- /dev/null +++ b/packages/cosmic-proto/proto/stride/stakeibc/validator.proto @@ -0,0 +1,31 @@ +syntax = "proto3"; +package stride.stakeibc; +import "cosmos_proto/cosmos.proto"; +import "gogoproto/gogo.proto"; +option go_package = "github.com/Stride-Labs/stride/v25/x/stakeibc/types"; + +message Validator { + string name = 1; + string address = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + uint64 weight = 6; + string delegation = 5 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; + string slash_query_progress_tracker = 9 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; + string slash_query_checkpoint = 12 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; + string shares_to_tokens_rate = 10 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + int64 delegation_changes_in_progress = 11; + bool slash_query_in_progress = 13; + reserved 3, 4, 7, 8; +} diff --git a/packages/cosmic-proto/proto/stride/staketia/genesis.proto b/packages/cosmic-proto/proto/stride/staketia/genesis.proto new file mode 100644 index 00000000000..2fbc6f330bc --- /dev/null +++ b/packages/cosmic-proto/proto/stride/staketia/genesis.proto @@ -0,0 +1,37 @@ +syntax = "proto3"; +package stride.staketia; + +import "gogoproto/gogo.proto"; +import "stride/staketia/staketia.proto"; + +option go_package = "github.com/Stride-Labs/stride/v25/x/staketia/types"; + +// Params defines the staketia module parameters. +message Params {} + +// TransferInProgressRecordIds stores record IDs for delegation records +// that have a transfer in progress +message TransferInProgressRecordIds { + string channel_id = 1; + uint64 sequence = 2; + uint64 record_id = 3; +} + +// GenesisState defines the staketia module's genesis state. +message GenesisState { + Params params = 1 [ + (gogoproto.moretags) = "yaml:\"params\"", + (gogoproto.nullable) = false + ]; + + HostZone host_zone = 2 [ (gogoproto.nullable) = false ]; + repeated DelegationRecord delegation_records = 3 + [ (gogoproto.nullable) = false ]; + repeated UnbondingRecord unbonding_records = 4 + [ (gogoproto.nullable) = false ]; + repeated RedemptionRecord redemption_records = 5 + [ (gogoproto.nullable) = false ]; + repeated SlashRecord slash_records = 6 [ (gogoproto.nullable) = false ]; + repeated TransferInProgressRecordIds transfer_in_progress_record_ids = 7 + [ (gogoproto.nullable) = false ]; +} \ No newline at end of file diff --git a/packages/cosmic-proto/proto/stride/staketia/query.proto b/packages/cosmic-proto/proto/stride/staketia/query.proto new file mode 100644 index 00000000000..0e9bd8dc294 --- /dev/null +++ b/packages/cosmic-proto/proto/stride/staketia/query.proto @@ -0,0 +1,118 @@ + +syntax = "proto3"; +package stride.staketia; + +import "stride/staketia/staketia.proto"; +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; +import "cosmos/base/query/v1beta1/pagination.proto"; + +option go_package = "github.com/Stride-Labs/stride/v25/x/staketia/types"; + +// Query defines the gRPC querier service. +service Query { + // Queries the host zone struct + rpc HostZone(QueryHostZoneRequest) returns (QueryHostZoneResponse) { + option (google.api.http).get = "/Stride-Labs/stride/staketia/host_zone"; + } + + // Queries the delegation records with an optional to include archived records + // Ex: + // - /delegation_records + // - /delegation_records?include_archived=true + rpc DelegationRecords(QueryDelegationRecordsRequest) + returns (QueryDelegationRecordsResponse) { + option (google.api.http).get = + "/Stride-Labs/stride/staketia/delegation_records"; + } + + // Queries the unbonding records with an optional to include archived records + // Ex: + // - /unbonding_records + // - /unbonding_records?include_archived=true + rpc UnbondingRecords(QueryUnbondingRecordsRequest) + returns (QueryUnbondingRecordsResponse) { + option (google.api.http).get = + "/Stride-Labs/stride/staketia/unbonding_records"; + } + + // Queries a single user redemption record + rpc RedemptionRecord(QueryRedemptionRecordRequest) + returns (QueryRedemptionRecordResponse) { + option (google.api.http).get = + "/Stride-Labs/stride/staketia/redemption_record/{unbonding_record_id}/" + "{address}"; + } + + // Queries all redemption records with optional filters + // Ex: + // - /redemption_records + // - /redemption_records?address=strideXXX + // - /redemption_records?unbonding_record_id=100 + rpc RedemptionRecords(QueryRedemptionRecordsRequest) + returns (QueryRedemptionRecordsResponse) { + option (google.api.http).get = + "/Stride-Labs/stride/staketia/redemption_records"; + } + + // Queries slash records + rpc SlashRecords(QuerySlashRecordsRequest) + returns (QuerySlashRecordsResponse) { + option (google.api.http).get = "/Stride-Labs/stride/staketia/slash_records"; + } +} + +// Host Zone +message QueryHostZoneRequest {}; +message QueryHostZoneResponse { HostZone host_zone = 1; } + +// All Delegation Records +message QueryDelegationRecordsRequest { bool include_archived = 1; }; +message QueryDelegationRecordsResponse { + repeated DelegationRecord delegation_records = 1 + [ (gogoproto.nullable) = false ]; +} + +// All Unbonding Records +message QueryUnbondingRecordsRequest { bool include_archived = 1; }; +message QueryUnbondingRecordsResponse { + repeated UnbondingRecord unbonding_records = 1 + [ (gogoproto.nullable) = false ]; +} + +// Single Redemption Record +message QueryRedemptionRecordRequest { + uint64 unbonding_record_id = 1; + string address = 2; +}; +message QueryRedemptionRecordResponse { + RedemptionRecordResponse redemption_record_response = 1; +} + +// All Redemption Records +message QueryRedemptionRecordsRequest { + string address = 1; + uint64 unbonding_record_id = 2; + cosmos.base.query.v1beta1.PageRequest pagination = 3; +}; +message QueryRedemptionRecordsResponse { + repeated RedemptionRecordResponse redemption_record_responses = 1 + [ (gogoproto.nullable) = false ]; + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// All Slash Records +message QuerySlashRecordsRequest {}; +message QuerySlashRecordsResponse { + repeated SlashRecord slash_records = 1 [ (gogoproto.nullable) = false ]; +} + +// Data structure for frontend to consume +message RedemptionRecordResponse { + // Redemption record + RedemptionRecord redemption_record = 1; + + // The Unix timestamp (in seconds) at which the unbonding for the UR + // associated with this RR completes + uint64 unbonding_completion_time_seconds = 2; +} \ No newline at end of file diff --git a/packages/cosmic-proto/proto/stride/staketia/staketia.proto b/packages/cosmic-proto/proto/stride/staketia/staketia.proto new file mode 100644 index 00000000000..f8699d9f787 --- /dev/null +++ b/packages/cosmic-proto/proto/stride/staketia/staketia.proto @@ -0,0 +1,173 @@ +syntax = "proto3"; +package stride.staketia; + +import "cosmos_proto/cosmos.proto"; +import "gogoproto/gogo.proto"; + +option go_package = "github.com/Stride-Labs/stride/v25/x/staketia/types"; + +message HostZone { + // Chain ID + string chain_id = 1; + // Native token denom on the host zone (e.g. utia) + string native_token_denom = 2; + // IBC denom of the native token as it lives on stride (e.g. ibc/...) + string native_token_ibc_denom = 3; + // Transfer channel ID from stride to the host zone + string transfer_channel_id = 4; + + // Operator controlled delegation address on the host zone + string delegation_address = 5 + [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + // Operator controlled reward address on the host zone + string reward_address = 6 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + // Deposit address on stride + string deposit_address = 7 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + // Redemption address on stride + string redemption_address = 8 + [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + // Claim address on stride + string claim_address = 9 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + // operator address set by safe, on stride + string operator_address_on_stride = 10 + [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + // admin address set upon host zone creation, on stride + string safe_address_on_stride = 11 + [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + + // Total delegated balance on the host zone delegation account + string remaining_delegated_balance = 18 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; + + // The undelegation period for Celestia in days + uint64 unbonding_period_seconds = 19; + // Indicates whether the host zone has been halted + bool halted = 20; + + reserved 13; +} + +// Status fields for a delegation record +// Note: There is an important assumption here that tokens in the deposit +// account should not be tracked by these records. The record is created as soon +// as the tokens leave stride +// Additionally, the GetActiveDelegationRecords query filters for records that +// are either TRANSFER_IN_PROGERSS or DELEGATION_QUEUE. If a new active status +// is added, the keeper must be modified +enum DelegationRecordStatus { + option (gogoproto.goproto_enum_prefix) = false; + + // TRANSFER_IN_PROGRESS indicates the native tokens are being sent from the + // deposit account to the delegation account + TRANSFER_IN_PROGRESS = 0; + // TRANSFER_FAILED indicates that the transfer either timed out or was an ack + // failure + TRANSFER_FAILED = 1; + // DELEGATION_QUEUE indicates the tokens have landed on the host zone and are + // ready to be delegated + DELEGATION_QUEUE = 2; + // DELEGATION_COMPLETE indicates the delegation has been completed + DELEGATION_COMPLETE = 3; +} + +// Status fields for an unbonding record +enum UnbondingRecordStatus { + option (gogoproto.goproto_enum_prefix) = false; + + // ACCUMULATING_REDEMPTIONS indicates redemptions are still being accumulated + // on this record + ACCUMULATING_REDEMPTIONS = 0; + // UNBONDING_QUEUE indicates the unbond amount for this epoch has been froze + // and the tokens are ready to be unbonded on the host zone + UNBONDING_QUEUE = 1; + // UNBONDING_IN_PROGRESS indicates the unbonding is currently in progress on + // the host zone + UNBONDING_IN_PROGRESS = 2; + // UNBONDED indicates the unbonding is finished on the host zone and the + // tokens are still in the delegation account + UNBONDED = 3; + // CLAIMABLE indicates the unbonded tokens have been swept to stride and are + // ready to be distributed to users + CLAIMABLE = 4; + // CLAIMED indicates the full unbonding cycle has been completed + CLAIMED = 5; +} + +// DelegationRecords track the aggregate liquid stakes and delegations +// for a given epoch +// Note: There is an important assumption here that tokens in the deposit +// account should not be tracked by these records. The record is created as soon +// as the tokens leave stride +message DelegationRecord { + // Deposit record unique ID + uint64 id = 1; + // The amount of native tokens that should be delegated + string native_amount = 2 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; + // The status indicating the point in the delegation's lifecycle + DelegationRecordStatus status = 3; + // The tx hash of the delegation on the host zone + string tx_hash = 4; +} + +// UnbondingRecords track the aggregate unbondings across an epoch +message UnbondingRecord { + // Unbonding record ID + uint64 id = 1; + // The status indicating the point in the delegation's lifecycle + UnbondingRecordStatus status = 2; + // The amount of stTokens that were redeemed + string st_token_amount = 3 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; + // The corresponding amount of native tokens that should be unbonded + string native_amount = 4 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; + // The Unix timestamp (in seconds) at which the unbonding completes + uint64 unbonding_completion_time_seconds = 5; + // The tx hash of the undelegation on the host zone + string undelegation_tx_hash = 6; + // The tx hash of the unbonded token sweep on the host zone + string unbonded_token_sweep_tx_hash = 7; +} + +// RedemptionRecords track an individual user's redemption claims +message RedemptionRecord { + // Unbonding record ID + uint64 unbonding_record_id = 1; + // Redeemer + string redeemer = 2; + // The amount of stTokens that were redeemed + string st_token_amount = 3 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; + // The corresponding amount of native tokens that should be unbonded + string native_amount = 4 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; +} + +// SlashRecords log adjustments to the delegated balance +message SlashRecord { + // The slash record monotonically increasing ID + uint64 id = 1; + // The Unix timestamp (in seconds) when the slash adjustment was processed on + // stride + uint64 time = 2; + // The delta by which the total delegated amount changed from slash + string native_amount = 3 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; + // The address (or addresses) of the validator that was slashed + string validator_address = 4; +} \ No newline at end of file diff --git a/packages/cosmic-proto/proto/stride/staketia/tx.proto b/packages/cosmic-proto/proto/stride/staketia/tx.proto new file mode 100644 index 00000000000..182f9d07f93 --- /dev/null +++ b/packages/cosmic-proto/proto/stride/staketia/tx.proto @@ -0,0 +1,243 @@ + +syntax = "proto3"; +package stride.staketia; + +import "cosmos/msg/v1/msg.proto"; +import "amino/amino.proto"; +import "gogoproto/gogo.proto"; +import "cosmos/base/v1beta1/coin.proto"; +import "cosmos_proto/cosmos.proto"; +import "stride/staketia/staketia.proto"; + +option go_package = "github.com/Stride-Labs/stride/v25/x/staketia/types"; + +enum OverwritableRecordType { + option (gogoproto.goproto_enum_prefix) = false; + + RECORD_TYPE_DELEGATION = 0; + RECORD_TYPE_UNBONDING = 1; + RECORD_TYPE_REDEMPTION = 2; +} + +// Msg defines the Msg service. +service Msg { + // User transaction to liquid stake native tokens into stTokens + rpc LiquidStake(MsgLiquidStake) returns (MsgLiquidStakeResponse); + + // User transaction to redeem stake stTokens into native tokens + rpc RedeemStake(MsgRedeemStake) returns (MsgRedeemStakeResponse); + + // Operator transaction to confirm a delegation was submitted + // on the host chain + rpc ConfirmDelegation(MsgConfirmDelegation) + returns (MsgConfirmDelegationResponse); + + // Operator transaction to confirm an undelegation was submitted + // on the host chain + rpc ConfirmUndelegation(MsgConfirmUndelegation) + returns (MsgConfirmUndelegationResponse); + + // Operator transaction to confirm unbonded tokens were transferred back to + // stride + rpc ConfirmUnbondedTokenSweep(MsgConfirmUnbondedTokenSweep) + returns (MsgConfirmUnbondedTokenSweepResponse); + + // Operator transaction to adjust the delegated balance after a validator was + // slashed + rpc AdjustDelegatedBalance(MsgAdjustDelegatedBalance) + returns (MsgAdjustDelegatedBalanceResponse); + + // Adjusts the inner redemption rate bounds on the host zone + rpc UpdateInnerRedemptionRateBounds(MsgUpdateInnerRedemptionRateBounds) + returns (MsgUpdateInnerRedemptionRateBoundsResponse); + + // Unhalts the host zone if redemption rates were exceeded + rpc ResumeHostZone(MsgResumeHostZone) returns (MsgResumeHostZoneResponse); + + // Trigger updating the redemption rate + rpc RefreshRedemptionRate(MsgRefreshRedemptionRate) + returns (MsgRefreshRedemptionRateResponse); + + // Overwrites a delegation record + rpc OverwriteDelegationRecord(MsgOverwriteDelegationRecord) + returns (MsgOverwriteDelegationRecordResponse); + + // Overwrites a unbonding record + rpc OverwriteUnbondingRecord(MsgOverwriteUnbondingRecord) + returns (MsgOverwriteUnbondingRecordResponse); + + // Overwrites a redemption record + rpc OverwriteRedemptionRecord(MsgOverwriteRedemptionRecord) + returns (MsgOverwriteRedemptionRecordResponse); + + // Sets the operator address + rpc SetOperatorAddress(MsgSetOperatorAddress) + returns (MsgSetOperatorAddressResponse); +} + +// Deprecated: Liquid stakes should be handled in stakeibc +// LiquidStake +message MsgLiquidStake { + option (cosmos.msg.v1.signer) = "staker"; + option (amino.name) = "staketia/MsgLiquidStake"; + option deprecated = true; + + string staker = 1; + string native_amount = 2 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; +} +message MsgLiquidStakeResponse { + option deprecated = true; + + cosmos.base.v1beta1.Coin st_token = 1 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; +} + +// RedeemStake +message MsgRedeemStake { + option (cosmos.msg.v1.signer) = "redeemer"; + option (amino.name) = "staketia/MsgRedeemStake"; + + string redeemer = 1; + string st_token_amount = 2 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; + // The receiver field is a celestia address + // It is only used in the case where the redemption spills over to stakeibc + string receiver = 3; +} +message MsgRedeemStakeResponse { + cosmos.base.v1beta1.Coin native_token = 1 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; +} + +// ConfirmDelegation +message MsgConfirmDelegation { + option (cosmos.msg.v1.signer) = "operator"; + option (amino.name) = "staketia/MsgConfirmDelegation"; + + string operator = 1; + uint64 record_id = 2; + string tx_hash = 3; +} +message MsgConfirmDelegationResponse {} + +// ConfirmUndelegation +message MsgConfirmUndelegation { + option (cosmos.msg.v1.signer) = "operator"; + option (amino.name) = "staketia/MsgConfirmUndelegation"; + + string operator = 1; + uint64 record_id = 2; + string tx_hash = 3; +} +message MsgConfirmUndelegationResponse {} + +// ConfirmUnbondedTokenSweep +message MsgConfirmUnbondedTokenSweep { + option (cosmos.msg.v1.signer) = "operator"; + option (amino.name) = "staketia/MsgConfirmUnbondedTokenSweep"; + + string operator = 1; + uint64 record_id = 2; + string tx_hash = 3; +} +message MsgConfirmUnbondedTokenSweepResponse {} + +// AdjustDelegatedBalance +message MsgAdjustDelegatedBalance { + option (cosmos.msg.v1.signer) = "operator"; + option (amino.name) = "staketia/MsgAdjustDelegatedBalance"; + + string operator = 1; + string delegation_offset = 2 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; + string validator_address = 3; +} +message MsgAdjustDelegatedBalanceResponse {} + +// UpdateInnerRedemptionRate +message MsgUpdateInnerRedemptionRateBounds { + option (cosmos.msg.v1.signer) = "creator"; + option (amino.name) = "staketia/MsgUpdateRedemptionRateBounds"; + + string creator = 1; + string min_inner_redemption_rate = 2 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + string max_inner_redemption_rate = 3 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; +} +message MsgUpdateInnerRedemptionRateBoundsResponse {} + +// ResumeHostZone +message MsgResumeHostZone { + option (cosmos.msg.v1.signer) = "creator"; + option (amino.name) = "staketia/MsgResumeHostZone"; + + string creator = 1; +} +message MsgResumeHostZoneResponse {} + +// RefreshRedemptionRate +message MsgRefreshRedemptionRate { + option (cosmos.msg.v1.signer) = "creator"; + option (amino.name) = "staketia/MsgRefreshRedemptionRate"; + + string creator = 1; +} +message MsgRefreshRedemptionRateResponse {} + +// OverwriteDelegationRecord +message MsgOverwriteDelegationRecord { + option (cosmos.msg.v1.signer) = "creator"; + option (amino.name) = "staketia/MsgOverwriteDelegationRecord"; + + string creator = 1; + DelegationRecord delegation_record = 2; +} +message MsgOverwriteDelegationRecordResponse {} + +// OverwriteUnbondingRecord +message MsgOverwriteUnbondingRecord { + option (cosmos.msg.v1.signer) = "creator"; + option (amino.name) = "staketia/MsgOverwriteUnbondingRecord"; + + string creator = 1; + UnbondingRecord unbonding_record = 2; +} +message MsgOverwriteUnbondingRecordResponse {} + +// OverwriteRedemptionRecord +message MsgOverwriteRedemptionRecord { + option (cosmos.msg.v1.signer) = "creator"; + option (amino.name) = "staketia/MsgOverwriteRedemptionRecord"; + + string creator = 1; + RedemptionRecord redemption_record = 2; +} +message MsgOverwriteRedemptionRecordResponse {} + +// SetOperatorAddress +message MsgSetOperatorAddress { + option (cosmos.msg.v1.signer) = "signer"; + option (amino.name) = "staketia/MsgSetOperatorAddress"; + + string signer = 1; + string operator = 2; +} +message MsgSetOperatorAddressResponse {}