Skip to content

Commit

Permalink
[1760]: Update all the Coins fields in the protos to match the same o…
Browse files Browse the repository at this point in the history
…ptions the sdk uses.
  • Loading branch information
SpicyLemon committed May 6, 2024
1 parent 8df46bd commit 98bf7a0
Show file tree
Hide file tree
Showing 38 changed files with 1,486 additions and 1,229 deletions.
17 changes: 13 additions & 4 deletions proto/cosmos/quarantine/v1beta1/events.proto
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
syntax = "proto3";
package cosmos.quarantine.v1beta1;

import "amino/amino.proto";
import "cosmos/base/v1beta1/coin.proto";
import "cosmos_proto/cosmos.proto";
import "gogoproto/gogo.proto";
Expand All @@ -20,13 +21,21 @@ message EventOptOut {
// EventFundsQuarantined is an event emitted when funds are quarantined.
message EventFundsQuarantined {
string to_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
repeated cosmos.base.v1beta1.Coin coins = 2
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"];
repeated cosmos.base.v1beta1.Coin coins = 2 [
(gogoproto.nullable) = false,
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins",
(amino.dont_omitempty) = true,
(amino.encoding) = "legacy_coins"
];
}

// EventFundsReleased is an event emitted when quarantined funds are accepted and released.
message EventFundsReleased {
string to_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
repeated cosmos.base.v1beta1.Coin coins = 2
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"];
repeated cosmos.base.v1beta1.Coin coins = 2 [
(gogoproto.nullable) = false,
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins",
(amino.dont_omitempty) = true,
(amino.encoding) = "legacy_coins"
];
}
17 changes: 13 additions & 4 deletions proto/cosmos/quarantine/v1beta1/quarantine.proto
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
syntax = "proto3";
package cosmos.quarantine.v1beta1;

import "amino/amino.proto";
import "cosmos/base/v1beta1/coin.proto";
import "cosmos_proto/cosmos.proto";
import "gogoproto/gogo.proto";
Expand All @@ -14,8 +15,12 @@ message QuarantinedFunds {
// unaccepted_from_addresses are the senders that have not been part of an accept yet for these coins.
repeated string unaccepted_from_addresses = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// coins is the amount currently in quarantined for the two addresses.
repeated cosmos.base.v1beta1.Coin coins = 3
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"];
repeated cosmos.base.v1beta1.Coin coins = 3 [
(gogoproto.nullable) = false,
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins",
(amino.dont_omitempty) = true,
(amino.encoding) = "legacy_coins"
];
// declined is true if these funds were previously declined.
bool declined = 4;
}
Expand Down Expand Up @@ -61,8 +66,12 @@ message QuarantineRecord {
// accepted_from_addresses are the senders that have already been part of an accept for these coins.
repeated bytes accepted_from_addresses = 2 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"];
// coins is the amount that has been quarantined.
repeated cosmos.base.v1beta1.Coin coins = 3
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"];
repeated cosmos.base.v1beta1.Coin coins = 3 [
(gogoproto.nullable) = false,
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins",
(amino.dont_omitempty) = true,
(amino.encoding) = "legacy_coins"
];
// declined is whether these funds have been declined.
bool declined = 4;
}
Expand Down
9 changes: 7 additions & 2 deletions proto/cosmos/quarantine/v1beta1/tx.proto
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
syntax = "proto3";
package cosmos.quarantine.v1beta1;

import "amino/amino.proto";
import "cosmos/base/query/v1beta1/pagination.proto";
import "cosmos/base/v1beta1/coin.proto";
import "cosmos/msg/v1/msg.proto";
Expand Down Expand Up @@ -69,8 +70,12 @@ message MsgAccept {
// MsgAcceptResponse defines the Msg/Accept response type.
message MsgAcceptResponse {
// funds_released is the amount that was quarantined but has now been released and sent to the requester.
repeated cosmos.base.v1beta1.Coin funds_released = 1
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"];
repeated cosmos.base.v1beta1.Coin funds_released = 1 [
(gogoproto.nullable) = false,
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins",
(amino.dont_omitempty) = true,
(amino.encoding) = "legacy_coins"
];
}

// MsgDecline represents a message for declining quarantined funds.
Expand Down
17 changes: 13 additions & 4 deletions proto/cosmos/sanction/v1beta1/sanction.proto
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
syntax = "proto3";
package cosmos.sanction.v1beta1;

import "amino/amino.proto";
import "cosmos/base/v1beta1/coin.proto";
import "cosmos_proto/cosmos.proto";
import "gogoproto/gogo.proto";
Expand All @@ -13,15 +14,23 @@ message Params {
// If this is zero, immediate sanctioning is not available.
// Otherwise, if a sanction governance proposal is issued with a deposit at least this large, a temporary sanction
// will be immediately issued that will expire when voting ends on the governance proposal.
repeated cosmos.base.v1beta1.Coin immediate_sanction_min_deposit = 1
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"];
repeated cosmos.base.v1beta1.Coin immediate_sanction_min_deposit = 1 [
(gogoproto.nullable) = false,
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins",
(amino.dont_omitempty) = true,
(amino.encoding) = "legacy_coins"
];

// immediate_unsanction_min_deposit is the minimum deposit for an unsanction to happen immediately.
// If this is zero, immediate unsanctioning is not available.
// Otherwise, if an unsanction governance proposal is issued with a deposit at least this large, a temporary
// unsanction will be immediately issued that will expire when voting ends on the governance proposal.
repeated cosmos.base.v1beta1.Coin immediate_unsanction_min_deposit = 2
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"];
repeated cosmos.base.v1beta1.Coin immediate_unsanction_min_deposit = 2 [
(gogoproto.nullable) = false,
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins",
(amino.dont_omitempty) = true,
(amino.encoding) = "legacy_coins"
];
}

// TemporaryEntry defines the information involved in a temporary sanction or unsanction.
Expand Down
25 changes: 19 additions & 6 deletions proto/provenance/exchange/v1/commitments.proto
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ option go_package = "github.com/provenance-io/provenance/x/exchange";
option java_package = "io.provenance.exchange.v1";
option java_multiple_files = true;

import "amino/amino.proto";
import "cosmos/base/v1beta1/coin.proto";
import "cosmos_proto/cosmos.proto";
import "gogoproto/gogo.proto";
Expand All @@ -17,8 +18,12 @@ message Commitment {
// market_id is the numeric identifier of the market the funds are committed to.
uint32 market_id = 2;
// amount is the funds that have been committed by the account to the market.
repeated cosmos.base.v1beta1.Coin amount = 3
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"];
repeated cosmos.base.v1beta1.Coin amount = 3 [
(gogoproto.nullable) = false,
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins",
(amino.dont_omitempty) = true,
(amino.encoding) = "legacy_coins"
];
}

// AccountAmount associates an account with a coins amount.
Expand All @@ -27,8 +32,12 @@ message AccountAmount {
// account is the bech32 address string of the account associated with the amount.
string account = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// amount is the funds associated with the address.
repeated cosmos.base.v1beta1.Coin amount = 2
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"];
repeated cosmos.base.v1beta1.Coin amount = 2 [
(gogoproto.nullable) = false,
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins",
(amino.dont_omitempty) = true,
(amino.encoding) = "legacy_coins"
];
}

// MarketAmount associates a market with a coins amount.
Expand All @@ -37,8 +46,12 @@ message MarketAmount {
// market_id is the numeric identifier the amount has been committed to.
uint32 market_id = 1;
// amount is the funds associated with the address.
repeated cosmos.base.v1beta1.Coin amount = 2
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"];
repeated cosmos.base.v1beta1.Coin amount = 2 [
(gogoproto.nullable) = false,
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins",
(amino.dont_omitempty) = true,
(amino.encoding) = "legacy_coins"
];
}

// NetAssetPrice is an association of assets and price used to record the value of things.
Expand Down
9 changes: 7 additions & 2 deletions proto/provenance/exchange/v1/orders.proto
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ option go_package = "github.com/provenance-io/provenance/x/exchange";
option java_package = "io.provenance.exchange.v1";
option java_multiple_files = true;

import "amino/amino.proto";
import "cosmos/base/v1beta1/coin.proto";
import "cosmos/msg/v1/msg.proto";
import "cosmos_proto/cosmos.proto";
Expand Down Expand Up @@ -70,8 +71,12 @@ message BidOrder {
cosmos.base.v1beta1.Coin price = 4 [(gogoproto.nullable) = false];
// buyer_settlement_fees are the fees (both flat and proportional) that the buyer will pay (in addition to the price)
// when the order is settled. A hold is placed on this until the order is filled or cancelled.
repeated cosmos.base.v1beta1.Coin buyer_settlement_fees = 5
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"];
repeated cosmos.base.v1beta1.Coin buyer_settlement_fees = 5 [
(gogoproto.nullable) = false,
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins",
(amino.dont_omitempty) = true,
(amino.encoding) = "legacy_coins"
];
// allow_partial should be true if partial fulfillment of this order should be allowed, and should be false if the
// order must be either filled in full or not filled at all.
bool allow_partial = 6;
Expand Down
9 changes: 6 additions & 3 deletions proto/provenance/exchange/v1/params.proto
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ option go_package = "github.com/provenance-io/provenance/x/exchange";
option java_package = "io.provenance.exchange.v1";
option java_multiple_files = true;

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

Expand All @@ -16,15 +17,17 @@ message Params {
// E.g. 100 = 1%. Min = 0, Max = 10000.
uint32 default_split = 1;
// denom_splits are the denom-specific amounts the exchange receives.
repeated DenomSplit denom_splits = 2 [(gogoproto.nullable) = false];
repeated DenomSplit denom_splits = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true];
// fee_create_payment_flat is the flat fee options for creating a payment.
// If the source amount is not zero then one of these fee entries is required to create the payment.
// This field is currently limited to zero or one entries.
repeated cosmos.base.v1beta1.Coin fee_create_payment_flat = 3 [(gogoproto.nullable) = false];
repeated cosmos.base.v1beta1.Coin fee_create_payment_flat = 3
[(gogoproto.nullable) = false, (amino.dont_omitempty) = true];
// fee_accept_payment_flat is the flat fee options for accepting a payment.
// If the target amount is not zero then one of these fee entries is required to accept the payment.
// This field is currently limited to zero or one entries.
repeated cosmos.base.v1beta1.Coin fee_accept_payment_flat = 4 [(gogoproto.nullable) = false];
repeated cosmos.base.v1beta1.Coin fee_accept_payment_flat = 4
[(gogoproto.nullable) = false, (amino.dont_omitempty) = true];
}

// DenomSplit associates a coin denomination with an amount the exchange receives for that denom.
Expand Down
17 changes: 13 additions & 4 deletions proto/provenance/exchange/v1/payments.proto
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ option go_package = "github.com/provenance-io/provenance/x/exchange";
option java_package = "io.provenance.exchange.v1";
option java_multiple_files = true;

import "amino/amino.proto";
import "cosmos/base/v1beta1/coin.proto";
import "cosmos_proto/cosmos.proto";
import "gogoproto/gogo.proto";
Expand All @@ -19,16 +20,24 @@ message Payment {
// source_amount is the funds that the source is will pay the target in exchange for the target_amount.
// A hold will be placed on this amount in the source account until this Payment is accepted, rejected or cancelled.
// If the source_amount is zero, this Payment can be considered a "payment request."
repeated cosmos.base.v1beta1.Coin source_amount = 2
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"];
repeated cosmos.base.v1beta1.Coin source_amount = 2 [
(gogoproto.nullable) = false,
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins",
(amino.dont_omitempty) = true,
(amino.encoding) = "legacy_coins"
];
// target is the account that can accept this Payment.
// The target is the only thing allowed to change in a payment.
// I.e. it can be empty initially and updated later as needed.
string target = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// target_amount is the funds that the target will pay the source in exchange for the source_amount.
// If the target_amount is zero, this Payment can be considered a "peer-to-peer (P2P) payment."
repeated cosmos.base.v1beta1.Coin target_amount = 4
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"];
repeated cosmos.base.v1beta1.Coin target_amount = 4 [
(gogoproto.nullable) = false,
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins",
(amino.dont_omitempty) = true,
(amino.encoding) = "legacy_coins"
];
// external_id is used along with the source to uniquely identify this Payment.
//
// A source can only have one Payment with any given external id.
Expand Down
49 changes: 37 additions & 12 deletions proto/provenance/exchange/v1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ option go_package = "github.com/provenance-io/provenance/x/exchange";
option java_package = "io.provenance.exchange.v1";
option java_multiple_files = true;

import "amino/amino.proto";
import "cosmos_proto/cosmos.proto";
import "cosmos/base/query/v1beta1/pagination.proto";
import "cosmos/base/v1beta1/coin.proto";
Expand Down Expand Up @@ -301,8 +302,12 @@ message QueryGetCommitmentRequest {
// QueryGetCommitmentResponse is a response message for the GetCommitment query.
message QueryGetCommitmentResponse {
// amount is the total funds committed to the market by the account.
repeated cosmos.base.v1beta1.Coin amount = 1
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"];
repeated cosmos.base.v1beta1.Coin amount = 1 [
(gogoproto.nullable) = false,
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins",
(amino.dont_omitempty) = true,
(amino.encoding) = "legacy_coins"
];
}

// QueryGetAccountCommitmentsRequest is a request message for the GetAccountCommitments query.
Expand Down Expand Up @@ -403,14 +408,26 @@ message QueryCommitmentSettlementFeeCalcRequest {
// QueryCommitmentSettlementFeeCalcResponse is a response message for the CommitmentSettlementFeeCalc query.
message QueryCommitmentSettlementFeeCalcResponse {
// exchange_fees is the total that the exchange would currently pay for the provided settlement.
repeated cosmos.base.v1beta1.Coin exchange_fees = 1
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"];
repeated cosmos.base.v1beta1.Coin exchange_fees = 1 [
(gogoproto.nullable) = false,
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins",
(amino.dont_omitempty) = true,
(amino.encoding) = "legacy_coins"
];
// input_total is the sum of all the inputs in the provided settlement.
repeated cosmos.base.v1beta1.Coin input_total = 2
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"];
repeated cosmos.base.v1beta1.Coin input_total = 2 [
(gogoproto.nullable) = false,
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins",
(amino.dont_omitempty) = true,
(amino.encoding) = "legacy_coins"
];
// converted_total is the input_total converted to a single intermediary denom or left as the fee denom.
repeated cosmos.base.v1beta1.Coin converted_total = 3
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"];
repeated cosmos.base.v1beta1.Coin converted_total = 3 [
(gogoproto.nullable) = false,
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins",
(amino.dont_omitempty) = true,
(amino.encoding) = "legacy_coins"
];
// conversion_navs are the NAVs used to convert the input_total to the converted_total.
repeated NetAssetPrice conversion_navs = 4 [(gogoproto.nullable) = false];
// to_fee_nav is the NAV used to convert the converted_total into the fee denom.
Expand Down Expand Up @@ -539,9 +556,17 @@ message QueryPaymentFeeCalcRequest {
// QueryPaymentFeeCalcResponse is a response message for the PaymentFeeCalc query.
message QueryPaymentFeeCalcResponse {
// fee_create is the fee required to create the provided payment.
repeated cosmos.base.v1beta1.Coin fee_create = 1
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"];
repeated cosmos.base.v1beta1.Coin fee_create = 1 [
(gogoproto.nullable) = false,
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins",
(amino.dont_omitempty) = true,
(amino.encoding) = "legacy_coins"
];
// fee_accept is the fee required to accept the provided payment.
repeated cosmos.base.v1beta1.Coin fee_accept = 2
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"];
repeated cosmos.base.v1beta1.Coin fee_accept = 2 [
(gogoproto.nullable) = false,
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins",
(amino.dont_omitempty) = true,
(amino.encoding) = "legacy_coins"
];
}
Loading

0 comments on commit 98bf7a0

Please sign in to comment.