diff --git a/package.json b/package.json index 1263a84..54e5610 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "clean": "rm -rf ./lib ./esm", "commit": "npx cz", "postbuild": "npm test && node ./scripts/checkCircularDeps.js", - "pull:protos": "bash ./scripts/pull_protos.sh v1.17.0", + "pull:protos": "bash ./scripts/pull_protos.sh v1.18.0-rc3", "clean:protos": "rm -rf third_party/proto && rm -rf src/proto", "prepare": "npm run build && husky install", "tsc:esm": "tsc --module es2015 --outDir esm", @@ -132,4 +132,4 @@ "path": "./node_modules/cz-conventional-changelog" } } -} +} \ No newline at end of file diff --git a/src/types/message-types.ts b/src/types/message-types.ts index ef37ac4..552916f 100644 --- a/src/types/message-types.ts +++ b/src/types/message-types.ts @@ -48,6 +48,17 @@ import { MsgTransferRequest, MsgWithdrawRequest, } from '../proto/provenance/marker/v1/tx_pb'; +import { + MsgCommitFundsRequest, + MsgCreatePaymentRequest, + MsgAcceptPaymentRequest, + MsgRejectPaymentRequest, + MsgRejectPaymentsRequest, + MsgCancelPaymentsRequest, + MsgCreateAskRequest, + MsgCreateBidRequest, + MsgCancelOrderRequest, +} from '../proto/provenance/exchange/v1/tx_pb'; import { MsgSetWithdrawAddress, MsgWithdrawDelegatorReward, @@ -115,7 +126,6 @@ import { PubKey } from '../proto/cosmos/crypto/secp256k1/keys_pb'; import { ExecuteMsg } from './schema/ats-smart-contract/execute_msg'; import { ExecuteMsg as DigitalCurrencyConsortiumExecuteMsg } from './schema/digital-currency-consortium/execute_msg'; -import { CoinAsObject } from './layout'; export type SupportedMessageTypeNames = | 'cosmos.authz.v1beta1.MsgGrant' @@ -206,7 +216,17 @@ export type SupportedMessageTypeNames = | 'provenance.metadata.v1.MsgWriteSessionRequest' | 'provenance.name.v1.MsgBindNameRequest' | 'provenance.name.v1.MsgDeleteNameRequest' - | 'tendermint.abci.Evidence'; + | 'tendermint.abci.Evidence' + // Provenance Exchange + | 'provenance.exchange.v1.MsgCommitFundsRequest' + | 'provenance.exchange.v1.MsgCreatePaymentRequest' + | 'provenance.exchange.v1.MsgAcceptPaymentRequest' + | 'provenance.exchange.v1.MsgRejectPaymentRequest' + | 'provenance.exchange.v1.MsgRejectPaymentsRequest' + | 'provenance.exchange.v1.MsgCancelPaymentsRequest' + | 'provenance.exchange.v1.MsgCreateAskRequest' + | 'provenance.exchange.v1.MsgCreateBidRequest' + | 'provenance.exchange.v1.MsgCancelOrderRequest'; export type ReadableMessageNames = | 'MsgGrant' @@ -297,7 +317,17 @@ export type ReadableMessageNames = | 'MsgWriteSessionRequest' | 'MsgBindNameRequest' | 'MsgDeleteNameRequest' - | 'Evidence'; + | 'Evidence' + // Provenance Exchange + | 'MsgCommitFundsRequest' + | 'MsgCreatePaymentRequest' + | 'MsgAcceptPaymentRequest' + | 'MsgRejectPaymentRequest' + | 'MsgRejectPaymentsRequest' + | 'MsgCancelPaymentsRequest' + | 'MsgCreateAskRequest' + | 'MsgCreateBidRequest' + | 'MsgCancelOrderRequest'; export const TYPE_NAMES_READABLE_MAP: { [key in ReadableMessageNames]: SupportedMessageTypeNames; @@ -406,8 +436,29 @@ export const TYPE_NAMES_READABLE_MAP: { MsgBindNameRequest: 'provenance.name.v1.MsgBindNameRequest', MsgDeleteNameRequest: 'provenance.name.v1.MsgDeleteNameRequest', Evidence: 'tendermint.abci.Evidence', + // Provenance Exchange + MsgCommitFundsRequest: 'provenance.exchange.v1.MsgCommitFundsRequest', + MsgCreatePaymentRequest: 'provenance.exchange.v1.MsgCreatePaymentRequest', + MsgAcceptPaymentRequest: 'provenance.exchange.v1.MsgAcceptPaymentRequest', + MsgRejectPaymentRequest: 'provenance.exchange.v1.MsgRejectPaymentRequest', + MsgRejectPaymentsRequest: 'provenance.exchange.v1.MsgRejectPaymentsRequest', + MsgCancelPaymentsRequest: 'provenance.exchange.v1.MsgCancelPaymentsRequest', + MsgCreateAskRequest: 'provenance.exchange.v1.MsgCreateAskRequest', + MsgCreateBidRequest: 'provenance.exchange.v1.MsgCreateBidRequest', + MsgCancelOrderRequest: 'provenance.exchange.v1.MsgCancelOrderRequest', }; +// Provenance Exchange +export type MsgCommitFundsRequestDisplay = MsgCommitFundsRequest.AsObject; +export type MsgCreatePaymentRequestDisplay = MsgCreatePaymentRequest.AsObject; +export type MsgAcceptPaymentRequestDisplay = MsgAcceptPaymentRequest.AsObject; +export type MsgRejectPaymentRequestDisplay = MsgRejectPaymentRequest.AsObject; +export type MsgRejectPaymentsRequestDisplay = MsgRejectPaymentsRequest.AsObject; +export type MsgCancelPaymentsRequestDisplay = MsgCancelPaymentsRequest.AsObject; +export type MsgCreateAskRequestDisplay = MsgCreateAskRequest.AsObject; +export type MsgCreateBidRequestDisplay = MsgCreateBidRequest.AsObject; +export type MsgCancelOrderRequestDisplay = MsgCancelOrderRequest.AsObject; + export type MsgSendDisplay = MsgSend.AsObject; export type MsgVerifyInvariantDisplay = MsgVerifyInvariant.AsObject; export type MsgSetWithdrawAddressDisplay = MsgSetWithdrawAddress.AsObject; @@ -594,4 +645,14 @@ export const MESSAGE_PROTOS: { [key in SupportedMessageTypeNames]: typeof Messag 'provenance.name.v1.MsgBindNameRequest': MsgBindNameRequest, 'provenance.name.v1.MsgDeleteNameRequest': MsgDeleteNameRequest, 'tendermint.abci.Evidence': Evidence, + // Provenance Exchange + 'provenance.exchange.v1.MsgCommitFundsRequest': MsgCommitFundsRequest, + 'provenance.exchange.v1.MsgCreatePaymentRequest': MsgCreatePaymentRequest, + 'provenance.exchange.v1.MsgAcceptPaymentRequest': MsgAcceptPaymentRequest, + 'provenance.exchange.v1.MsgRejectPaymentRequest': MsgRejectPaymentRequest, + 'provenance.exchange.v1.MsgRejectPaymentsRequest': MsgRejectPaymentsRequest, + 'provenance.exchange.v1.MsgCancelPaymentsRequest': MsgCancelPaymentsRequest, + 'provenance.exchange.v1.MsgCreateAskRequest': MsgCreateAskRequest, + 'provenance.exchange.v1.MsgCreateBidRequest': MsgCreateBidRequest, + 'provenance.exchange.v1.MsgCancelOrderRequest': MsgCancelOrderRequest, }; diff --git a/third_party/proto/provenance/exchange/v1/commitments.proto b/third_party/proto/provenance/exchange/v1/commitments.proto new file mode 100644 index 0000000..7899c2d --- /dev/null +++ b/third_party/proto/provenance/exchange/v1/commitments.proto @@ -0,0 +1,52 @@ +syntax = "proto3"; +package provenance.exchange.v1; + +option go_package = "github.com/provenance-io/provenance/x/exchange"; + +option java_package = "io.provenance.exchange.v1"; +option java_multiple_files = true; + +import "cosmos/base/v1beta1/coin.proto"; +import "cosmos_proto/cosmos.proto"; +import "gogoproto/gogo.proto"; + +// Commitment contains information on committed funds. +message Commitment { + // account is the bech32 address string with the committed funds. + string account = 1; + // 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"]; +} + +// AccountAmount associates an account with a coins amount. +message AccountAmount { + option (gogoproto.goproto_stringer) = false; + // 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"]; +} + +// MarketAmount associates a market with a coins amount. +message MarketAmount { + option (gogoproto.goproto_stringer) = false; + // 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"]; +} + +// NetAssetPrice is an association of assets and price used to record the value of things. +// It is related to the NetAssetValue message from the x/marker module, and is therefore often referred to as "a NAV". +message NetAssetPrice { + option (gogoproto.goproto_stringer) = false; + // assets is the volume and denom that has been bought or sold. + cosmos.base.v1beta1.Coin assets = 1 [(gogoproto.nullable) = false]; + // price is what was paid for the assets. + cosmos.base.v1beta1.Coin price = 2 [(gogoproto.nullable) = false]; +} \ No newline at end of file diff --git a/third_party/proto/provenance/exchange/v1/events.proto b/third_party/proto/provenance/exchange/v1/events.proto index 3839b76..eaabc0b 100644 --- a/third_party/proto/provenance/exchange/v1/events.proto +++ b/third_party/proto/provenance/exchange/v1/events.proto @@ -77,6 +77,30 @@ message EventOrderExternalIDUpdated { string external_id = 3; } +// EventFundsCommitted is an event emitted when funds are committed to a market. +message EventFundsCommitted { + // account is the bech32 address string of the account. + string account = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // market_id is the numerical identifier of the market. + uint32 market_id = 2; + // amount is the coins string of the newly committed funds. + string amount = 3; + // tag is the string provided in the message causing this event. + string tag = 4; +} + +// EventCommitmentReleased is an event emitted when funds are released from their commitment. +message EventCommitmentReleased { + // account is the bech32 address string of the account. + string account = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // market_id is the numerical identifier of the market. + uint32 market_id = 2; + // amount is the coins string of the funds that were released from commitment. + string amount = 3; + // tag is the string provided in the message causing this event. + string tag = 4; +} + // EventMarketWithdraw is an event emitted when a withdrawal of a market's collected fees is made. message EventMarketWithdraw { // market_id is the numerical identifier of the market. @@ -98,7 +122,9 @@ message EventMarketDetailsUpdated { } // EventMarketEnabled is an event emitted when a market is enabled. +// Deprecated: This event is no longer used. It is replaced with EventMarketOrdersEnabled. message EventMarketEnabled { + option deprecated = true; // market_id is the numerical identifier of the market. uint32 market_id = 1; // updated_by is the account that enabled the market. @@ -106,13 +132,31 @@ message EventMarketEnabled { } // EventMarketDisabled is an event emitted when a market is disabled. +// Deprecated: This event is no longer used. It is replaced with EventMarketOrdersDisabled. message EventMarketDisabled { + option deprecated = true; // market_id is the numerical identifier of the market. uint32 market_id = 1; // updated_by is the account that disabled the market. string updated_by = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; } +// EventMarketOrdersEnabled is an event emitted when a market enables order creation. +message EventMarketOrdersEnabled { + // market_id is the numerical identifier of the market. + uint32 market_id = 1; + // updated_by is the account that updated the accepting_orders option. + string updated_by = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; +} + +// EventMarketOrdersEnabled is an event emitted when a market disables order creation. +message EventMarketOrdersDisabled { + // market_id is the numerical identifier of the market. + uint32 market_id = 1; + // updated_by is the account that updated the accepting_orders option. + string updated_by = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; +} + // EventMarketUserSettleEnabled is an event emitted when a market's user_settle option is enabled. message EventMarketUserSettleEnabled { // market_id is the numerical identifier of the market. @@ -129,6 +173,31 @@ message EventMarketUserSettleDisabled { string updated_by = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; } +// EventMarketCommitmentsEnabled is an event emitted when a market's accepting_commitments option is enabled. +message EventMarketCommitmentsEnabled { + // market_id is the numerical identifier of the market. + uint32 market_id = 1; + // updated_by is the account that updated the accepting_commitments option. + string updated_by = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; +} + +// EventMarketCommitmentsDisabled is an event emitted when a market's accepting_commitments option is disabled. +message EventMarketCommitmentsDisabled { + // market_id is the numerical identifier of the market. + uint32 market_id = 1; + // updated_by is the account that updated the accepting_commitments option. + string updated_by = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; +} + +// EventMarketIntermediaryDenomUpdated is an event emitted when a market updates its +// commitment_settlement_intermediary_denom field. +message EventMarketIntermediaryDenomUpdated { + // market_id is the numerical identifier of the market. + uint32 market_id = 1; + // updated_by is the account that updated the intermediary denom. + string updated_by = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; +} + // EventMarketPermissionsUpdated is an event emitted when a market's permissions are updated. message EventMarketPermissionsUpdated { // market_id is the numerical identifier of the market. @@ -158,4 +227,68 @@ message EventMarketFeesUpdated { } // EventParamsUpdated is an event emitted when the exchange module's params have been updated. -message EventParamsUpdated {} \ No newline at end of file +message EventParamsUpdated {} + +// EventPaymentCreated is an event emitted when a payment is created. +message EventPaymentCreated { + // source is the account that created the Payment. + string source = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // source_amount is the coins amount string of the funds that the source will pay (to the target). + string source_amount = 2; + // target is the account that can accept the Payment. + string target = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // target_amount is the coins amount string of the funds that the target will pay (to the source). + string target_amount = 4; + // external_id is used along with the source to uniquely identify this Payment. + string external_id = 5; +} + +// EventPaymentUpdated is an event emitted when a payment is updated. +message EventPaymentUpdated { + // source is the account that updated (and previously created) the Payment. + string source = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // source_amount is the coins amount string of the funds that the source will pay (to the target). + string source_amount = 2; + // old_target is the account that used to be able to accept the Payment (but not any more). + string old_target = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // new_target is the account that is now able to accept the Payment. + string new_target = 4 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // target_amount is the coins amount string of the funds that the target will pay (to the source). + string target_amount = 5; + // external_id is used along with the source to uniquely identify this Payment. + string external_id = 6; +} + +// EventPaymentAccepted is an event emitted when a payment is accepted. +message EventPaymentAccepted { + // source is the account that created the Payment. + string source = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // source_amount is the coins amount string of the funds that the source will pay (to the target). + string source_amount = 2; + // target is the account that accepted the Payment. + string target = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // target_amount is the coins amount string of the funds that the target will pay (to the source). + string target_amount = 4; + // external_id is used along with the source to uniquely identify this Payment. + string external_id = 5; +} + +// EventPaymentRejected is an event emitted when a payment is rejected (by the target). +message EventPaymentRejected { + // source is the account that created the Payment. + string source = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // target is the account that rejected the Payment. + string target = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // external_id is used along with the source to uniquely identify this Payment. + string external_id = 3; +} + +// EventPaymentCancelled is an event emitted when a payment is cancelled (by the source). +message EventPaymentCancelled { + // source is the account that cancelled (and created) the Payment. + string source = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // target is the account that could have accepted the Payment. + string target = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // external_id is used along with the source to uniquely identify this Payment. + string external_id = 3; +} diff --git a/third_party/proto/provenance/exchange/v1/genesis.proto b/third_party/proto/provenance/exchange/v1/genesis.proto index 3ccf87d..bc1633d 100644 --- a/third_party/proto/provenance/exchange/v1/genesis.proto +++ b/third_party/proto/provenance/exchange/v1/genesis.proto @@ -7,9 +7,11 @@ option java_package = "io.provenance.exchange.v1"; option java_multiple_files = true; import "gogoproto/gogo.proto"; +import "provenance/exchange/v1/commitments.proto"; import "provenance/exchange/v1/market.proto"; import "provenance/exchange/v1/orders.proto"; import "provenance/exchange/v1/params.proto"; +import "provenance/exchange/v1/payments.proto"; // GenesisState is the data that should be loaded into the exchange module during genesis. message GenesisState { @@ -30,4 +32,10 @@ message GenesisState { // last_order_id is the value of the last order id created. uint64 last_order_id = 5; + + // commitments are all of the commitments to create at genesis. + repeated Commitment commitments = 6 [(gogoproto.nullable) = false]; + + // payments are all the payments to create at genesis. + repeated Payment payments = 7 [(gogoproto.nullable) = false]; } \ No newline at end of file diff --git a/third_party/proto/provenance/exchange/v1/market.proto b/third_party/proto/provenance/exchange/v1/market.proto index 7628526..d1ffd6f 100644 --- a/third_party/proto/provenance/exchange/v1/market.proto +++ b/third_party/proto/provenance/exchange/v1/market.proto @@ -55,37 +55,47 @@ message Market { uint32 market_id = 1; // market_details is some information about this market. MarketDetails market_details = 2 [(gogoproto.nullable) = false]; + // fee_create_ask_flat is the flat fee charged for creating an ask order. // Each coin entry is a separate option. When an ask is created, one of these must be paid. // If empty, no fee is required to create an ask order. repeated cosmos.base.v1beta1.Coin fee_create_ask_flat = 3 [(gogoproto.nullable) = false]; + // fee_create_bid_flat is the flat fee charged for creating a bid order. // Each coin entry is a separate option. When a bid is created, one of these must be paid. // If empty, no fee is required to create a bid order. repeated cosmos.base.v1beta1.Coin fee_create_bid_flat = 4 [(gogoproto.nullable) = false]; + // fee_seller_settlement_flat is the flat fee charged to the seller during settlement. // Each coin entry is a separate option. // When an ask is settled, the seller will pay the amount in the denom that matches the price they received. repeated cosmos.base.v1beta1.Coin fee_seller_settlement_flat = 5 [(gogoproto.nullable) = false]; + // fee_seller_settlement_ratios is the fee to charge a seller during settlement based on the price they are receiving. // The price and fee denoms must be equal for each entry, and only one entry for any given denom is allowed. repeated FeeRatio fee_seller_settlement_ratios = 6 [(gogoproto.nullable) = false]; + // fee_buyer_settlement_flat is the flat fee charged to the buyer during settlement. // Each coin entry is a separate option. // When a bid is created, the settlement fees provided must contain one of these. repeated cosmos.base.v1beta1.Coin fee_buyer_settlement_flat = 7 [(gogoproto.nullable) = false]; + // fee_buyer_settlement_ratios is the fee to charge a buyer during settlement based on the price they are spending. // The price and fee denoms do not have to equal. Multiple entries for any given price or fee denom are allowed, but // each price denom to fee denom pair can only have one entry. repeated FeeRatio fee_buyer_settlement_ratios = 8 [(gogoproto.nullable) = false]; + // accepting_orders is whether this market is allowing orders to be created for it. bool accepting_orders = 9; + // allow_user_settlement is whether this market allows users to initiate their own settlements. // For example, the FillBids and FillAsks endpoints are available if and only if this is true. // The MarketSettle endpoint is only available to market actors regardless of the value of this field. bool allow_user_settlement = 10; + // access_grants is the list of addresses and permissions granted for this market. repeated AccessGrant access_grants = 11 [(gogoproto.nullable) = false]; + // req_attr_create_ask is a list of attributes required on an account for it to be allowed to create an ask order. // An account must have all of these attributes in order to create an ask order in this market. // If the list is empty, any account can create ask orders in this market. @@ -93,6 +103,7 @@ message Market { // An entry that starts with "*." will match any attributes that end with the rest of it. // E.g. "*.b.a" will match all of "c.b.a", "x.b.a", and "e.d.c.b.a"; but not "b.a", "xb.a", "b.x.a", or "c.b.a.x". repeated string req_attr_create_ask = 12; + // req_attr_create_ask is a list of attributes required on an account for it to be allowed to create a bid order. // An account must have all of these attributes in order to create a bid order in this market. // If the list is empty, any account can create bid orders in this market. @@ -100,6 +111,40 @@ message Market { // An entry that starts with "*." will match any attributes that end with the rest of it. // E.g. "*.b.a" will match all of "c.b.a", "x.b.a", and "e.d.c.b.a"; but not "b.a", "xb.a", "c.b.x.a", or "c.b.a.x". repeated string req_attr_create_bid = 13; + + // accepting_commitments is whether the market is allowing users to commit funds to it. + bool accepting_commitments = 14; + + // fee_create_commitment_flat is the flat fee charged for creating a commitment. + // Each coin entry is a separate option. When a commitment is created, one of these must be paid. + // If empty, no fee is required to create a commitment. + repeated cosmos.base.v1beta1.Coin fee_create_commitment_flat = 15 [(gogoproto.nullable) = false]; + + // commitment_settlement_bips is the fraction of a commitment settlement that will be paid to the exchange. + // It is represented in basis points (1/100th of 1%, e.g. 0.0001) and is limited to 0 to 10,000 inclusive. + // During a commitment settlement, the inputs are summed and NAVs are used to convert that total to the + // intermediary denom, then to the fee denom. That is then multiplied by this value to get the fee amount + // that will be transferred out of the market's account into the exchange for that settlement. + // + // Summing the inputs effectively doubles the value of the settlement from what what is usually thought of + // as the value of a trade. That should be taken into account when setting this value. + // E.g. if two accounts are trading 10apples for 100grapes, the inputs total will be 10apples,100grapes + // (which might then be converted to USD then nhash before applying this ratio); Usually, though, the value + // of that trade would be viewed as either just 10apples or just 100grapes. + uint32 commitment_settlement_bips = 16; + + // intermediary_denom is the denom that funds get converted to (before being converted to the chain's fee denom) + // when calculating the fees that are paid to the exchange. NAVs are used for this conversion and actions will fail + // if a NAV is needed but not available. + string intermediary_denom = 17; + + // req_attr_create_commitment is a list of attributes required on an account for it to be allowed to create a + // commitment. An account must have all of these attributes in order to create a commitment in this market. + // If the list is empty, any account can create commitments in this market. + // + // An entry that starts with "*." will match any attributes that end with the rest of it. + // E.g. "*.b.a" will match all of "c.b.a", "x.b.a", and "e.d.c.b.a"; but not "b.a", "xb.a", "c.b.x.a", or "c.b.a.x". + repeated string req_attr_create_commitment = 18; } // FeeRatio defines a ratio of price amount to fee amount. @@ -138,4 +183,4 @@ enum Permission { PERMISSION_PERMISSIONS = 6 [(gogoproto.enumvalue_customname) = "permissions"]; // PERMISSION_ATTRIBUTES is the ability to use the MarketManageReqAttrs Tx endpoint. PERMISSION_ATTRIBUTES = 7 [(gogoproto.enumvalue_customname) = "attributes"]; -} \ No newline at end of file +} diff --git a/third_party/proto/provenance/exchange/v1/params.proto b/third_party/proto/provenance/exchange/v1/params.proto index 73fb396..2ed72b6 100644 --- a/third_party/proto/provenance/exchange/v1/params.proto +++ b/third_party/proto/provenance/exchange/v1/params.proto @@ -7,6 +7,7 @@ option java_package = "io.provenance.exchange.v1"; option java_multiple_files = true; import "gogoproto/gogo.proto"; +import "cosmos/base/v1beta1/coin.proto"; // Params is a representation of the exchange module parameters. message Params { @@ -16,6 +17,14 @@ message Params { uint32 default_split = 1; // denom_splits are the denom-specific amounts the exchange receives. repeated DenomSplit denom_splits = 2 [(gogoproto.nullable) = false]; + // 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]; + // 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]; } // DenomSplit associates a coin denomination with an amount the exchange receives for that denom. diff --git a/third_party/proto/provenance/exchange/v1/payments.proto b/third_party/proto/provenance/exchange/v1/payments.proto new file mode 100644 index 0000000..4dcf790 --- /dev/null +++ b/third_party/proto/provenance/exchange/v1/payments.proto @@ -0,0 +1,43 @@ +syntax = "proto3"; +package provenance.exchange.v1; + +option go_package = "github.com/provenance-io/provenance/x/exchange"; + +option java_package = "io.provenance.exchange.v1"; +option java_multiple_files = true; + +import "cosmos/base/v1beta1/coin.proto"; +import "cosmos_proto/cosmos.proto"; +import "gogoproto/gogo.proto"; + +// Payment represents one account's desire to trade funds with another account. +message Payment { + option (gogoproto.goproto_stringer) = false; + + // source is the account that created this Payment. It is considered the owner of the payment. + string source = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // 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"]; + // 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"]; + // 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. + // A source can have two payments with two different external ids. + // Two different sources can each have a payment with the same external id. + // But a source cannot have two different payments each with the same external id. + // + // An external id can be reused by a source once the payment is accepted, rejected, or cancelled. + // + // The external id is limited to 100 bytes. An empty string is a valid external id. + string external_id = 5; +} \ No newline at end of file diff --git a/third_party/proto/provenance/exchange/v1/query.proto b/third_party/proto/provenance/exchange/v1/query.proto index 22eeb4b..0935aaf 100644 --- a/third_party/proto/provenance/exchange/v1/query.proto +++ b/third_party/proto/provenance/exchange/v1/query.proto @@ -11,9 +11,11 @@ import "cosmos/base/query/v1beta1/pagination.proto"; import "cosmos/base/v1beta1/coin.proto"; import "google/api/annotations.proto"; import "gogoproto/gogo.proto"; +import "provenance/exchange/v1/commitments.proto"; import "provenance/exchange/v1/market.proto"; import "provenance/exchange/v1/orders.proto"; import "provenance/exchange/v1/params.proto"; +import "provenance/exchange/v1/payments.proto"; import "provenance/exchange/v1/tx.proto"; // Query is the service for exchange module's query endpoints. @@ -59,6 +61,29 @@ service Query { option (google.api.http).get = "/provenance/exchange/v1/orders"; } + // GetCommitment gets the funds in an account that are committed to the market. + rpc GetCommitment(QueryGetCommitmentRequest) returns (QueryGetCommitmentResponse) { + option (google.api.http).get = "/provenance/exchange/v1/market/{market_id}/commitment/{account}"; + } + + // GetAccountCommitments gets all the funds in an account that are committed to any market. + rpc GetAccountCommitments(QueryGetAccountCommitmentsRequest) returns (QueryGetAccountCommitmentsResponse) { + option (google.api.http).get = "/provenance/exchange/v1/commitments/account/{account}"; + } + + // GetMarketCommitments gets all the funds committed to a market from any account. + rpc GetMarketCommitments(QueryGetMarketCommitmentsRequest) returns (QueryGetMarketCommitmentsResponse) { + option (google.api.http) = { + get: "/provenance/exchange/v1/commitments/market/{market_id}" + additional_bindings: {get: "/provenance/exchange/v1/market/{market_id}/commitments"} + }; + } + + // GetAllCommitments gets all fund committed to any market from any account. + rpc GetAllCommitments(QueryGetAllCommitmentsRequest) returns (QueryGetAllCommitmentsResponse) { + option (google.api.http).get = "/provenance/exchange/v1/commitments"; + } + // GetMarket returns all the information and details about a market. rpc GetMarket(QueryGetMarketRequest) returns (QueryGetMarketResponse) { option (google.api.http).get = "/provenance/exchange/v1/market/{market_id}"; @@ -74,6 +99,12 @@ service Query { option (google.api.http).get = "/provenance/exchange/v1/params"; } + // CommitmentSettlementFeeCalc calculates the fees a market will pay for a commitment settlement using current NAVs. + rpc CommitmentSettlementFeeCalc(QueryCommitmentSettlementFeeCalcRequest) + returns (QueryCommitmentSettlementFeeCalcResponse) { + option (google.api.http).get = "/provenance/exchange/v1/fees/commitment_settlement"; + } + // ValidateCreateMarket checks the provided MsgGovCreateMarketResponse and returns any errors it might have. rpc ValidateCreateMarket(QueryValidateCreateMarketRequest) returns (QueryValidateCreateMarketResponse) { option (google.api.http).get = "/provenance/exchange/v1/validate/create_market"; @@ -91,6 +122,35 @@ service Query { rpc ValidateManageFees(QueryValidateManageFeesRequest) returns (QueryValidateManageFeesResponse) { option (google.api.http).get = "/provenance/exchange/v1/validate/manage_fees"; } + + // GetPayment gets a single specific payment. + rpc GetPayment(QueryGetPaymentRequest) returns (QueryGetPaymentResponse) { + option (google.api.http) = { + get: "/provenance/exchange/v1/payment" + additional_bindings: {get: "/provenance/exchange/v1/payment/{source}"} + additional_bindings: {get: "/provenance/exchange/v1/payment/{source}/{external_id}"} + }; + } + + // GetPaymentsWithSource gets all payments with a specific source account. + rpc GetPaymentsWithSource(QueryGetPaymentsWithSourceRequest) returns (QueryGetPaymentsWithSourceResponse) { + option (google.api.http).get = "/provenance/exchange/v1/payments/source/{source}"; + } + + // GetPaymentsWithTarget gets all payments with a specific target account. + rpc GetPaymentsWithTarget(QueryGetPaymentsWithTargetRequest) returns (QueryGetPaymentsWithTargetResponse) { + option (google.api.http).get = "/provenance/exchange/v1/payments/target/{target}"; + } + + // GetAllPayments gets all payments. + rpc GetAllPayments(QueryGetAllPaymentsRequest) returns (QueryGetAllPaymentsResponse) { + option (google.api.http).get = "/provenance/exchange/v1/payments"; + } + + // PaymentFeeCalc calculates the fees that must be paid for creating or accepting a specific payment. + rpc PaymentFeeCalc(QueryPaymentFeeCalcRequest) returns (QueryPaymentFeeCalcResponse) { + option (google.api.http).get = "/provenance/exchange/v1/fees/payment"; + } } // QueryOrderFeeCalcRequest is a request message for the OrderFeeCalc query. @@ -230,6 +290,66 @@ message QueryGetAllOrdersResponse { cosmos.base.query.v1beta1.PageResponse pagination = 99; } +// QueryGetCommitmentRequest is a request message for the GetCommitment query. +message QueryGetCommitmentRequest { + // account is the bech32 address string of the account in the commitment. + string account = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // market_id is the numeric identifier of the market in the commitment. + uint32 market_id = 2; +} + +// 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"]; +} + +// QueryGetAccountCommitmentsRequest is a request message for the GetAccountCommitments query. +message QueryGetAccountCommitmentsRequest { + // account is the bech32 address string of the account with the commitments. + string account = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; +} + +// QueryGetAccountCommitmentsResponse is a response message for the GetAccountCommitments query. +message QueryGetAccountCommitmentsResponse { + // commitments is the amounts committed from the account to the any market. + repeated MarketAmount commitments = 1; +} + +// QueryGetMarketCommitmentsRequest is a request message for the GetMarketCommitments query. +message QueryGetMarketCommitmentsRequest { + // market_id is the numeric identifier of the market with the commitment. + uint32 market_id = 1; + + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 99; +} + +// QueryGetMarketCommitmentsResponse is a response message for the GetMarketCommitments query. +message QueryGetMarketCommitmentsResponse { + // commitments is the amounts committed to the market from any account. + repeated AccountAmount commitments = 1; + + // pagination is the resulting pagination parameters. + cosmos.base.query.v1beta1.PageResponse pagination = 99; +} + +// QueryGetAllCommitmentsRequest is a request message for the GetAllCommitments query. +message QueryGetAllCommitmentsRequest { + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 99; +} + +// QueryGetAllCommitmentsResponse is a response message for the GetAllCommitments query. +message QueryGetAllCommitmentsResponse { + // commitments is the requested commitment information. + repeated Commitment commitments = 1; + + // pagination is the resulting pagination parameters. + cosmos.base.query.v1beta1.PageResponse pagination = 99; +} + // QueryGetMarketRequest is a request message for the GetMarket query. message QueryGetMarketRequest { // market_id is the id of the market to look up. @@ -268,6 +388,35 @@ message QueryParamsResponse { Params params = 1; } +// QueryCommitmentSettlementFeeCalcRequest is a request message for the CommitmentSettlementFeeCalc query. +message QueryCommitmentSettlementFeeCalcRequest { + // settlement is a market's commitment settlement request message. + // If no inputs are provided, only the to_fee_nav field will be populated in the response. + MsgMarketCommitmentSettleRequest settlement = 1; + // include_breakdown_fields controls the fields that are populated in the response. + // If false, only the exchange_fees field is populated. + // If true, all of the fields are populated as possible. + // If the settlement does not have any inputs, this field defaults to true. + bool include_breakdown_fields = 2; +} + +// 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"]; + // 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"]; + // 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"]; + // 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. + NetAssetPrice to_fee_nav = 5; +} + // QueryValidateCreateMarketRequest is a request message for the ValidateCreateMarket query. message QueryValidateCreateMarketRequest { // create_market_request is the request to run validation on. @@ -315,3 +464,84 @@ message QueryValidateManageFeesResponse { // period (assuming it passes). bool gov_prop_will_pass = 2; } + +// QueryGetPaymentRequest is a request message for the GetPayment query. +message QueryGetPaymentRequest { + // source is the source account of the payment to get. + string source = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // external_id is the external id of the payment to get. + string external_id = 2; +} + +// QueryGetPaymentResponse is a response message for the GetPayment query. +message QueryGetPaymentResponse { + // payment is the info on the requested payment. + Payment payment = 1; +} + +// QueryGetPaymentsWithSourceRequest is a request message for the GetPaymentsWithSource query. +message QueryGetPaymentsWithSourceRequest { + // source is the source account of the payments to get. + string source = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 99; +} + +// QueryGetPaymentsWithSourceResponse is a response message for the GetPaymentsWithSource query. +message QueryGetPaymentsWithSourceResponse { + // payments is all the payments with the requested source. + repeated Payment payments = 1; + + // pagination is the resulting pagination parameters. + cosmos.base.query.v1beta1.PageResponse pagination = 99; +} + +// QueryGetPaymentsWithTargetRequest is a request message for the GetPaymentsWithTarget query. +message QueryGetPaymentsWithTargetRequest { + // target is the target account of the payments to get. + string target = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 99; +} + +// QueryGetPaymentsWithTargetResponse is a response message for the GetPaymentsWithTarget query. +message QueryGetPaymentsWithTargetResponse { + // payments is all the payments with the requested target. + repeated Payment payments = 1; + + // pagination is the resulting pagination parameters. + cosmos.base.query.v1beta1.PageResponse pagination = 99; +} + +// QueryGetAllPaymentsRequest is a request message for the GetAllPayments query. +message QueryGetAllPaymentsRequest { + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 99; +} + +// QueryGetAllPaymentsResponse is a response message for the GetAllPayments query. +message QueryGetAllPaymentsResponse { + // payments is all the payments on this page of results. + repeated Payment payments = 1; + + // pagination is the resulting pagination parameters. + cosmos.base.query.v1beta1.PageResponse pagination = 99; +} + +// QueryPaymentFeeCalcRequest is a request message for the PaymentFeeCalc query. +message QueryPaymentFeeCalcRequest { + // payment is the details of the payment to create or accept. + Payment payment = 1 [(gogoproto.nullable) = false]; +} + +// 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"]; + // 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"]; +} diff --git a/third_party/proto/provenance/exchange/v1/tx.proto b/third_party/proto/provenance/exchange/v1/tx.proto index d5a18ba..26f5d0e 100644 --- a/third_party/proto/provenance/exchange/v1/tx.proto +++ b/third_party/proto/provenance/exchange/v1/tx.proto @@ -10,9 +10,11 @@ import "cosmos/base/v1beta1/coin.proto"; import "cosmos/msg/v1/msg.proto"; import "cosmos_proto/cosmos.proto"; import "gogoproto/gogo.proto"; +import "provenance/exchange/v1/commitments.proto"; import "provenance/exchange/v1/market.proto"; import "provenance/exchange/v1/orders.proto"; import "provenance/exchange/v1/params.proto"; +import "provenance/exchange/v1/payments.proto"; // Msg is the service for exchange module's tx endpoints. service Msg { @@ -22,6 +24,9 @@ service Msg { // CreateBid creates a bid order (to buy something you want). rpc CreateBid(MsgCreateBidRequest) returns (MsgCreateBidResponse); + // CommitFunds marks funds in an account as manageable by a market. + rpc CommitFunds(MsgCommitFundsRequest) returns (MsgCommitFundsResponse); + // CancelOrder cancels an order. rpc CancelOrder(MsgCancelOrderRequest) returns (MsgCancelOrderResponse); @@ -34,6 +39,12 @@ service Msg { // MarketSettle is a market endpoint to trigger the settlement of orders. rpc MarketSettle(MsgMarketSettleRequest) returns (MsgMarketSettleResponse); + // MarketCommitmentSettle is a market endpoint to transfer committed funds. + rpc MarketCommitmentSettle(MsgMarketCommitmentSettleRequest) returns (MsgMarketCommitmentSettleResponse); + + // MarketReleaseCommitments is a market endpoint return control of funds back to the account owner(s). + rpc MarketReleaseCommitments(MsgMarketReleaseCommitmentsRequest) returns (MsgMarketReleaseCommitmentsResponse); + // MarketSetOrderExternalID updates an order's external id field. rpc MarketSetOrderExternalID(MsgMarketSetOrderExternalIDRequest) returns (MsgMarketSetOrderExternalIDResponse); @@ -44,23 +55,60 @@ service Msg { rpc MarketUpdateDetails(MsgMarketUpdateDetailsRequest) returns (MsgMarketUpdateDetailsResponse); // MarketUpdateEnabled is a market endpoint to update whether its accepting orders. - rpc MarketUpdateEnabled(MsgMarketUpdateEnabledRequest) returns (MsgMarketUpdateEnabledResponse); + // Deprecated: This endpoint is no longer usable. It is replaced by MarketUpdateAcceptingOrders. + rpc MarketUpdateEnabled(MsgMarketUpdateEnabledRequest) returns (MsgMarketUpdateEnabledResponse) { + option deprecated = true; + }; + + // MarketUpdateAcceptingOrders is a market endpoint to update whether its accepting orders. + rpc MarketUpdateAcceptingOrders(MsgMarketUpdateAcceptingOrdersRequest) + returns (MsgMarketUpdateAcceptingOrdersResponse); // MarketUpdateUserSettle is a market endpoint to update whether it allows user-initiated settlement. rpc MarketUpdateUserSettle(MsgMarketUpdateUserSettleRequest) returns (MsgMarketUpdateUserSettleResponse); + // MarketUpdateAcceptingCommitments is a market endpoint to update whether it accepts commitments. + rpc MarketUpdateAcceptingCommitments(MsgMarketUpdateAcceptingCommitmentsRequest) + returns (MsgMarketUpdateAcceptingCommitmentsResponse); + + // MarketUpdateIntermediaryDenom sets a market's intermediary denom. + rpc MarketUpdateIntermediaryDenom(MsgMarketUpdateIntermediaryDenomRequest) + returns (MsgMarketUpdateIntermediaryDenomResponse); + // MarketManagePermissions is a market endpoint to manage a market's user permissions. rpc MarketManagePermissions(MsgMarketManagePermissionsRequest) returns (MsgMarketManagePermissionsResponse); // MarketManageReqAttrs is a market endpoint to manage the attributes required to interact with it. rpc MarketManageReqAttrs(MsgMarketManageReqAttrsRequest) returns (MsgMarketManageReqAttrsResponse); + // CreatePayment creates a payment to facilitate a trade between two accounts. + rpc CreatePayment(MsgCreatePaymentRequest) returns (MsgCreatePaymentResponse); + + // AcceptPayment is used by a target to accept a payment. + rpc AcceptPayment(MsgAcceptPaymentRequest) returns (MsgAcceptPaymentResponse); + + // RejectPayment can be used by a target to reject a payment. + rpc RejectPayment(MsgRejectPaymentRequest) returns (MsgRejectPaymentResponse); + + // RejectPayments can be used by a target to reject all payments from one or more sources. + rpc RejectPayments(MsgRejectPaymentsRequest) returns (MsgRejectPaymentsResponse); + + // CancelPayments can be used by a source to cancel one or more payments. + rpc CancelPayments(MsgCancelPaymentsRequest) returns (MsgCancelPaymentsResponse); + + // ChangePaymentTarget can be used by a source to change the target in one of their payments. + rpc ChangePaymentTarget(MsgChangePaymentTargetRequest) returns (MsgChangePaymentTargetResponse); + // GovCreateMarket is a governance proposal endpoint for creating a market. rpc GovCreateMarket(MsgGovCreateMarketRequest) returns (MsgGovCreateMarketResponse); // GovManageFees is a governance proposal endpoint for updating a market's fees. rpc GovManageFees(MsgGovManageFeesRequest) returns (MsgGovManageFeesResponse); + // GovCloseMarket is a governance proposal endpoint that will disable order and commitment creation, + // cancel all orders, and release all commitments. + rpc GovCloseMarket(MsgGovCloseMarketRequest) returns (MsgGovCloseMarketResponse); + // GovUpdateParams is a governance proposal endpoint for updating the exchange module's params. rpc GovUpdateParams(MsgGovUpdateParamsRequest) returns (MsgGovUpdateParamsResponse); } @@ -97,11 +145,31 @@ message MsgCreateBidResponse { uint64 order_id = 1; } +// MsgCommitFundsRequest is a request message for the CommitFunds endpoint. +message MsgCommitFundsRequest { + option (cosmos.msg.v1.signer) = "account"; + + // account is the address of the account with the funds being committed. + string account = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // market_id is the numerical identifier of the market the funds will be committed to. + uint32 market_id = 2; + // amount is the funds being committed to the market. + repeated cosmos.base.v1beta1.Coin amount = 3 + [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; + // creation_fee is the fee that is being paid to create this commitment. + cosmos.base.v1beta1.Coin creation_fee = 4; + // event_tag is a string that is included in the funds-committed event. Max length is 100 characters. + string event_tag = 5; +} + +// MsgCommitFundsResponse is a response message for the CommitFunds endpoint. +message MsgCommitFundsResponse {} + // MsgCancelOrderRequest is a request message for the CancelOrder endpoint. message MsgCancelOrderRequest { option (cosmos.msg.v1.signer) = "signer"; - // signer is the account requesting the order cancelation. + // signer is the account requesting the order cancellation. // It must be either the order owner (e.g. the buyer or seller), the governance module account address, or an account // with cancel permission with the market that the order is in. string signer = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; @@ -169,7 +237,7 @@ message MsgMarketSettleRequest { // admin is the account with "settle" permission requesting this settlement. string admin = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - // market_id is the numerical identifier of the market to update required attributes for. + // market_id is the numerical identifier of the market requesting this settlement. uint32 market_id = 2; // ask_order_ids are the ask orders being filled. @@ -185,13 +253,56 @@ message MsgMarketSettleRequest { // MsgMarketSettleResponse is a response message for the MarketSettle endpoint. message MsgMarketSettleResponse {} +// MsgMarketCommitmentSettleRequest is a request message for the MarketCommitmentSettle endpoint. +message MsgMarketCommitmentSettleRequest { + option (cosmos.msg.v1.signer) = "admin"; + + // admin is the account with "settle" permission requesting this settlement. + string admin = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // market_id is the numerical identifier of the market requesting this settlement. + uint32 market_id = 2; + + // inputs defines where the funds are coming from. All of these funds must be already committed to the market. + repeated AccountAmount inputs = 3 [(gogoproto.nullable) = false]; + // outputs defines how the funds are to be distributed. These funds will be re-committed in the destination accounts. + repeated AccountAmount outputs = 4 [(gogoproto.nullable) = false]; + // fees is the funds that the market is collecting as part of this settlement. + // All of these funds must be already committed to the market. + repeated AccountAmount fees = 5 [(gogoproto.nullable) = false]; + // navs are any NAV info that should be updated at the beginning of this settlement. + repeated NetAssetPrice navs = 6 [(gogoproto.nullable) = false]; + // event_tag is a string that is included in the funds-committed/released events. Max length is 100 characters. + string event_tag = 7; +} + +// MsgMarketCommitmentSettleResponse is a response message for the MarketCommitmentSettle endpoint. +message MsgMarketCommitmentSettleResponse {} + +// MsgMarketReleaseCommitmentsRequest is a request message for the MarketReleaseCommitments endpoint. +message MsgMarketReleaseCommitmentsRequest { + option (cosmos.msg.v1.signer) = "admin"; + + // admin is the account with "cancel" permission requesting this release. + string admin = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // market_id is the numerical identifier of the market releasing these funds. + uint32 market_id = 2; + // to_release is the funds that are to be released. + // An entry with a zero amount indicates that all committed funds for that account should be released. + repeated AccountAmount to_release = 3 [(gogoproto.nullable) = false]; + // event_tag is a string that is included in the funds-released events. Max length is 100 characters. + string event_tag = 4; +} + +// MsgMarketReleaseCommitmentsResponse is a response message for the MarketReleaseCommitments endpoint. +message MsgMarketReleaseCommitmentsResponse {} + // MsgMarketSetOrderExternalIDRequest is a request message for the MarketSetOrderExternalID endpoint. message MsgMarketSetOrderExternalIDRequest { option (cosmos.msg.v1.signer) = "admin"; // admin is the account with "set_ids" permission requesting this settlement. string admin = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - // market_id is the numerical identifier of the market to update required attributes for. + // market_id is the numerical identifier of the market with the orders to update. uint32 market_id = 2; // order_id is the numerical identifier of the order to update. @@ -229,7 +340,7 @@ message MsgMarketUpdateDetailsRequest { // admin is the account with "update" permission requesting this change. string admin = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - // market_id is the numerical identifier of the market to update required attributes for. + // market_id is the numerical identifier of the market to update details for. uint32 market_id = 2; // market_details is some information about this market. @@ -240,20 +351,44 @@ message MsgMarketUpdateDetailsRequest { message MsgMarketUpdateDetailsResponse {} // MsgMarketUpdateEnabledRequest is a request message for the MarketUpdateEnabled endpoint. +// Deprecated: This endpoint is no longer usable. It is replaced by MarketUpdateAcceptingOrders. message MsgMarketUpdateEnabledRequest { + option deprecated = true; + option (cosmos.msg.v1.signer) = "admin"; + + // admin is the account with "update" permission requesting this change. + // Deprecated: This endpoint is no longer usable. It is replaced by MarketUpdateAcceptingOrders. + string admin = 1 [(cosmos_proto.scalar) = "cosmos.AddressString", deprecated = true]; + // market_id is the numerical identifier of the market to enable or disable. + // Deprecated: This endpoint is no longer usable. It is replaced by MarketUpdateAcceptingOrders. + uint32 market_id = 2 [deprecated = true]; + + // accepting_orders is whether this market is allowing orders to be created for it. + // Deprecated: This endpoint is no longer usable. It is replaced by MarketUpdateAcceptingOrders. + bool accepting_orders = 3 [deprecated = true]; +} + +// MsgMarketUpdateEnabledResponse is a response message for the MarketUpdateEnabled endpoint. +// Deprecated: This endpoint is no longer usable. It is replaced by MarketUpdateAcceptingOrders. +message MsgMarketUpdateEnabledResponse { + option deprecated = true; +} + +// MsgMarketUpdateAcceptingOrdersRequest is a request message for the MarketUpdateAcceptingOrders endpoint. +message MsgMarketUpdateAcceptingOrdersRequest { option (cosmos.msg.v1.signer) = "admin"; // admin is the account with "update" permission requesting this change. string admin = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - // market_id is the numerical identifier of the market to update required attributes for. + // market_id is the numerical identifier of the market to enable or disable. uint32 market_id = 2; // accepting_orders is whether this market is allowing orders to be created for it. bool accepting_orders = 3; } -// MsgMarketUpdateEnabledResponse is a response message for the MarketUpdateEnabled endpoint. -message MsgMarketUpdateEnabledResponse {} +// MsgMarketUpdateAcceptingOrdersResponse is a response message for the MarketUpdateAcceptingOrders endpoint. +message MsgMarketUpdateAcceptingOrdersResponse {} // MsgMarketUpdateUserSettleRequest is a request message for the MarketUpdateUserSettle endpoint. message MsgMarketUpdateUserSettleRequest { @@ -261,25 +396,59 @@ message MsgMarketUpdateUserSettleRequest { // admin is the account with "update" permission requesting this change. string admin = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - // market_id is the numerical identifier of the market to update required attributes for. + // market_id is the numerical identifier of the market to enable or disable user-settlement for. uint32 market_id = 2; // allow_user_settlement is whether this market allows users to initiate their own settlements. // For example, the FillBids and FillAsks endpoints are available if and only if this is true. - // The MarketSettle endpoint is only available to market actors regardless of the value of this field. + // The MarketSettle endpoint is available (only to market actors) regardless of the value of this field. bool allow_user_settlement = 3; } // MsgMarketUpdateUserSettleResponse is a response message for the MarketUpdateUserSettle endpoint. message MsgMarketUpdateUserSettleResponse {} +// MsgMarketUpdateAcceptingCommitmentsRequest is a request message for the MarketUpdateAcceptingCommitments endpoint. +message MsgMarketUpdateAcceptingCommitmentsRequest { + option (cosmos.msg.v1.signer) = "admin"; + + // admin is the account with "update" permission requesting this change. + string admin = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // market_id is the numerical identifier of the market to enable or disable commitments for. + uint32 market_id = 2; + + // accepting_commitments is whether this market allows users to commit funds to it. + // For example, the CommitFunds endpoint is available if and only if this is true. + // The MarketCommitmentSettle endpoint is available (only to market actors) regardless of the value of this field. + bool accepting_commitments = 3; +} + +// MsgMarketUpdateAcceptingCommitmentsResponse is a response message for the MarketUpdateAcceptingCommitments endpoint. +message MsgMarketUpdateAcceptingCommitmentsResponse {} + +// MsgMarketUpdateIntermediaryDenomRequest is a request message for the MarketUpdateIntermediaryDenom endpoint. +message MsgMarketUpdateIntermediaryDenomRequest { + option (cosmos.msg.v1.signer) = "admin"; + + // admin is the account with "update" permission requesting this change. + string admin = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // market_id is the numerical identifier of the market changing the intermediary denom. + uint32 market_id = 2; + + // intermediary_denom is the new intermediary denom for this market to use. + string intermediary_denom = 3; +} + +// MsgMarketUpdateIntermediaryDenomResponse is a response message for the MarketUpdateIntermediaryDenom endpoint. +message MsgMarketUpdateIntermediaryDenomResponse {} + // MsgMarketManagePermissionsRequest is a request message for the MarketManagePermissions endpoint. message MsgMarketManagePermissionsRequest { option (cosmos.msg.v1.signer) = "admin"; // admin is the account with "permissions" permission requesting this change. string admin = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - // market_id is the numerical identifier of the market to update required attributes for. + // market_id is the numerical identifier of the market to manage permissions for. uint32 market_id = 2; // revoke_all are addresses that should have all their permissions revoked. @@ -310,11 +479,93 @@ message MsgMarketManageReqAttrsRequest { repeated string create_bid_to_add = 5; // create_bid_to_remove are the attributes that should no longer be required to create a bid order. repeated string create_bid_to_remove = 6; + // create_commitment_to_add are the attributes that should now also be required to create a commitment. + repeated string create_commitment_to_add = 7; + // create_commitment_to_remove are the attributes that should no longer be required to create a commitment. + repeated string create_commitment_to_remove = 8; } // MsgMarketManageReqAttrsResponse is a response message for the MarketManageReqAttrs endpoint. message MsgMarketManageReqAttrsResponse {} +// MsgCreatePaymentRequest is a request message for the CreatePayment endpoint. +message MsgCreatePaymentRequest { + option (cosmos.msg.v1.signer) = "payment.source"; + + // payment is the details of the payment to create. + Payment payment = 1 [(gogoproto.nullable) = false]; +} + +// MsgCreatePaymentResponse is a response message for the CreatePayment endpoint. +message MsgCreatePaymentResponse {} + +// MsgAcceptPaymentRequest is a request message for the AcceptPayment endpoint. +message MsgAcceptPaymentRequest { + option (cosmos.msg.v1.signer) = "payment.target"; + + // payment is the details of the payment to accept. + Payment payment = 1 [(gogoproto.nullable) = false]; +} + +// MsgAcceptPaymentResponse is a response message for the AcceptPayment endpoint. +message MsgAcceptPaymentResponse {} + +// MsgRejectPaymentRequest is a request message for the RejectPayment endpoint. +message MsgRejectPaymentRequest { + option (cosmos.msg.v1.signer) = "target"; + + // target is the target account of the payment to reject. + string target = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // source is the source account of the payment to reject. + string source = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // external_id is the external id of the payment to reject. + string external_id = 3; +} + +// MsgRejectPaymentResponse is a response message for the RejectPayment endpoint. +message MsgRejectPaymentResponse {} + +// MsgRejectPaymentsRequest is a request message for the RejectPayments endpoint. +message MsgRejectPaymentsRequest { + option (cosmos.msg.v1.signer) = "target"; + + // target is the account that wishes to reject some payments. + string target = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // sources is the source accounts of the payments to reject. + repeated string sources = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; +} + +// MsgRejectPaymentsResponse is a response message for the RejectPayments endpoint. +message MsgRejectPaymentsResponse {} + +// MsgCancelPaymentsRequest is a request message for the CancelPayments endpoint. +message MsgCancelPaymentsRequest { + option (cosmos.msg.v1.signer) = "source"; + + // source is the account that wishes to cancel some of their payments. + string source = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // external_ids is all of the external ids of the payments to cancel. + repeated string external_ids = 2; +} + +// MsgCancelPaymentsResponse is a response message for the CancelPayments endpoint. +message MsgCancelPaymentsResponse {} + +// MsgChangePaymentTargetRequest is a request message for the ChangePaymentTarget endpoint. +message MsgChangePaymentTargetRequest { + option (cosmos.msg.v1.signer) = "source"; + + // source is the account that wishes to update the target of one of their payments. + string source = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // external_id is the external id of the payment to update. + string external_id = 2; + // new_target is the new target account of the payment. + string new_target = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; +} + +// MsgChangePaymentTargetResponse is a response message for the ChangePaymentTarget endpoint. +message MsgChangePaymentTargetResponse {} + // MsgGovCreateMarketRequest is a request message for the GovCreateMarket endpoint. message MsgGovCreateMarketRequest { option (cosmos.msg.v1.signer) = "authority"; @@ -369,11 +620,36 @@ message MsgGovManageFeesRequest { repeated FeeRatio add_fee_buyer_settlement_ratios = 13 [(gogoproto.nullable) = false]; // remove_fee_buyer_settlement_ratios are the buyer settlement fee ratios to remove. repeated FeeRatio remove_fee_buyer_settlement_ratios = 14 [(gogoproto.nullable) = false]; + + // add_fee_create_commitment_flat are the create-commitment flat fee options to add. + repeated cosmos.base.v1beta1.Coin add_fee_create_commitment_flat = 15 [(gogoproto.nullable) = false]; + // remove_fee_create_commitment_flat are the create-commitment flat fee options to remove. + repeated cosmos.base.v1beta1.Coin remove_fee_create_commitment_flat = 16 [(gogoproto.nullable) = false]; + + // set_fee_commitment_settlement_bips is the new fee_commitment_settlement_bips for the market. + // It is ignored if it is zero. To set it to zero set unset_fee_commitment_settlement_bips to true. + uint32 set_fee_commitment_settlement_bips = 17; + // unset_fee_commitment_settlement_bips, if true, sets the fee_commitment_settlement_bips to zero. + // If false, it is ignored. + bool unset_fee_commitment_settlement_bips = 18; } // MsgGovManageFeesResponse is a response message for the GovManageFees endpoint. message MsgGovManageFeesResponse {} +// MsgGovCloseMarketRequest is a request message for the GovCloseMarket endpoint. +message MsgGovCloseMarketRequest { + option (cosmos.msg.v1.signer) = "authority"; + + // authority must be the governance module account. + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // market_id is the numerical identifier of the market to close. + uint32 market_id = 2; +} + +// MsgGovCloseMarketResponse is a response message for the GovCloseMarket endpoint. +message MsgGovCloseMarketResponse {} + // MsgGovUpdateParamsRequest is a request message for the GovUpdateParams endpoint. message MsgGovUpdateParamsRequest { option (cosmos.msg.v1.signer) = "authority"; diff --git a/third_party/proto/provenance/ibcratelimit/v1/event.proto b/third_party/proto/provenance/ibcratelimit/v1/event.proto new file mode 100644 index 0000000..5d147e6 --- /dev/null +++ b/third_party/proto/provenance/ibcratelimit/v1/event.proto @@ -0,0 +1,28 @@ +syntax = "proto3"; +package provenance.ibcratelimit.v1; + +option go_package = "github.com/provenance-io/provenance/x/ibcratelimit"; + +option java_package = "io.provenance.ibcratelimit.v1"; +option java_multiple_files = true; + +// EventAckRevertFailure is emitted when an Ack revert fails +message EventAckRevertFailure { + // module is the name of the module that emitted it. + string module = 1; + // packet is the packet received on acknowledgement. + string packet = 2; + // ack is the packet's inner acknowledgement message. + string ack = 3; +} + +// EventTimeoutRevertFailure is emitted when a Timeout revert fails +message EventTimeoutRevertFailure { + // module is the name of the module that emitted it. + string module = 1; + // packet is the packet received on timeout. + string packet = 2; +} + +// EventParamsUpdated is an event emitted when the ibcratelimit module's params have been updated. +message EventParamsUpdated {} \ No newline at end of file diff --git a/third_party/proto/provenance/ibcratelimit/v1/genesis.proto b/third_party/proto/provenance/ibcratelimit/v1/genesis.proto new file mode 100644 index 0000000..c705c12 --- /dev/null +++ b/third_party/proto/provenance/ibcratelimit/v1/genesis.proto @@ -0,0 +1,15 @@ +syntax = "proto3"; +package provenance.ibcratelimit.v1; + +import "gogoproto/gogo.proto"; +import "provenance/ibcratelimit/v1/params.proto"; + +option go_package = "github.com/provenance-io/provenance/x/ibcratelimit"; +option java_package = "io.provenance.ibcratelimit.v1"; +option java_multiple_files = true; + +// GenesisState defines the ibcratelimit module's genesis state. +message GenesisState { + // params are all the parameters of the module. + Params params = 1 [(gogoproto.nullable) = false]; +} diff --git a/third_party/proto/provenance/ibcratelimit/v1/params.proto b/third_party/proto/provenance/ibcratelimit/v1/params.proto new file mode 100644 index 0000000..995fea1 --- /dev/null +++ b/third_party/proto/provenance/ibcratelimit/v1/params.proto @@ -0,0 +1,14 @@ +syntax = "proto3"; +package provenance.ibcratelimit.v1; + +import "gogoproto/gogo.proto"; + +option go_package = "github.com/provenance-io/provenance/x/ibcratelimit"; +option java_package = "io.provenance.ibcratelimit.v1"; +option java_multiple_files = true; + +// Params defines the parameters for the ibcratelimit module. +message Params { + // contract_address is the address of the rate limiter contract. + string contract_address = 1 [(gogoproto.moretags) = "yaml:\"contract_address\""]; +} diff --git a/third_party/proto/provenance/ibcratelimit/v1/query.proto b/third_party/proto/provenance/ibcratelimit/v1/query.proto new file mode 100644 index 0000000..c679da6 --- /dev/null +++ b/third_party/proto/provenance/ibcratelimit/v1/query.proto @@ -0,0 +1,28 @@ +syntax = "proto3"; +package provenance.ibcratelimit.v1; + +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; +import "provenance/ibcratelimit/v1/params.proto"; + +option go_package = "github.com/provenance-io/provenance/x/ibcratelimit"; +option java_package = "io.provenance.ibcratelimit.v1"; +option java_multiple_files = true; + +// Query defines the gRPC querier service. +service Query { + // Params defines a gRPC query method that returns the ibcratelimit module's + // parameters. + rpc Params(ParamsRequest) returns (ParamsResponse) { + option (google.api.http).get = "/provenance/ibcratelimit/v1/params"; + } +} + +// ParamsRequest is the request type for the Query/Params RPC method. +message ParamsRequest {} + +// ParamsResponse is the response type for the Query/Params RPC method. +message ParamsResponse { + // params defines the parameters of the module. + Params params = 1 [(gogoproto.nullable) = false]; +} diff --git a/third_party/proto/provenance/ibcratelimit/v1/tx.proto b/third_party/proto/provenance/ibcratelimit/v1/tx.proto new file mode 100644 index 0000000..e410d41 --- /dev/null +++ b/third_party/proto/provenance/ibcratelimit/v1/tx.proto @@ -0,0 +1,32 @@ +syntax = "proto3"; +package provenance.ibcratelimit.v1; + +option go_package = "github.com/provenance-io/provenance/x/ibcratelimit"; + +option java_package = "io.provenance.ibcratelimit.v1"; +option java_multiple_files = true; + +import "gogoproto/gogo.proto"; +import "cosmos_proto/cosmos.proto"; +import "cosmos/msg/v1/msg.proto"; +import "provenance/ibcratelimit/v1/params.proto"; + +// Msg is the service for ibcratelimit module's tx endpoints. +service Msg { + // GovUpdateParams is a governance proposal endpoint for updating the exchange module's params. + rpc GovUpdateParams(MsgGovUpdateParamsRequest) returns (MsgGovUpdateParamsResponse); +} + +// MsgGovUpdateParamsRequest is a request message for the GovUpdateParams endpoint. +message MsgGovUpdateParamsRequest { + option (cosmos.msg.v1.signer) = "authority"; + + // authority should be the governance module account address. + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + // params are the new param values to set + Params params = 2 [(gogoproto.nullable) = false]; +} + +// MsgGovUpdateParamsResponse is a response message for the GovUpdateParams endpoint. +message MsgGovUpdateParamsResponse {} diff --git a/third_party/proto/provenance/marker/v1/accessgrant.proto b/third_party/proto/provenance/marker/v1/accessgrant.proto index 4ab7904..ae0ae85 100644 --- a/third_party/proto/provenance/marker/v1/accessgrant.proto +++ b/third_party/proto/provenance/marker/v1/accessgrant.proto @@ -26,21 +26,30 @@ message AccessGrant { enum Access { // ACCESS_UNSPECIFIED defines a no-op vote option. ACCESS_UNSPECIFIED = 0 [(gogoproto.enumvalue_customname) = "Unknown"]; - // ACCESS_MINT is the ability to increase the supply of a marker + // ACCESS_MINT is the ability to increase the supply of a marker. ACCESS_MINT = 1 [(gogoproto.enumvalue_customname) = "Mint"]; // ACCESS_BURN is the ability to decrease the supply of the marker using coin held by the marker. ACCESS_BURN = 2 [(gogoproto.enumvalue_customname) = "Burn"]; - // ACCESS_DEPOSIT is the ability to set a marker reference to this marker in the metadata/scopes module + // ACCESS_DEPOSIT is the ability to transfer funds from another account to this marker account + // or to set a reference to this marker in the metadata/scopes module. ACCESS_DEPOSIT = 3 [(gogoproto.enumvalue_customname) = "Deposit"]; - // ACCESS_WITHDRAW is the ability to remove marker references to this marker in from metadata/scopes or - // transfer coin from this marker account to another account. + // ACCESS_WITHDRAW is the ability to transfer funds from this marker account to another account + // or to remove a reference to this marker in the metadata/scopes module. ACCESS_WITHDRAW = 4 [(gogoproto.enumvalue_customname) = "Withdraw"]; - // ACCESS_DELETE is the ability to move a proposed, finalized or active marker into the cancelled state. This - // access also allows cancelled markers to be marked for deletion + // ACCESS_DELETE is the ability to move a proposed, finalized or active marker into the cancelled state. + // This access also allows cancelled markers to be marked for deletion. ACCESS_DELETE = 5 [(gogoproto.enumvalue_customname) = "Delete"]; // ACCESS_ADMIN is the ability to add access grants for accounts to the list of marker permissions. + // This access also gives the ability to update the marker's denom metadata. ACCESS_ADMIN = 6 [(gogoproto.enumvalue_customname) = "Admin"]; - // ACCESS_TRANSFER is the ability to invoke a send operation using the marker module to facilitate exchange. + // ACCESS_TRANSFER is the ability to manage transfer settings and broker transfers of the marker. + // Accounts with this access can: + // - Update the marker's required attributes. + // - Update the send-deny list. + // - Use the transfer or bank send endpoints to move marker funds out of their own account. // This access right is only supported on RESTRICTED markers. ACCESS_TRANSFER = 7 [(gogoproto.enumvalue_customname) = "Transfer"]; + // ACCESS_FORCE_TRANSFER is the ability to transfer restricted coins from a 3rd-party account without their signature. + // This access right is only supported on RESTRICTED markers and only has meaning when allow_forced_transfer is true. + ACCESS_FORCE_TRANSFER = 8 [(gogoproto.enumvalue_customname) = "ForceTransfer"]; } \ No newline at end of file diff --git a/third_party/proto/provenance/marker/v1/tx.proto b/third_party/proto/provenance/marker/v1/tx.proto index cad727b..f249866 100644 --- a/third_party/proto/provenance/marker/v1/tx.proto +++ b/third_party/proto/provenance/marker/v1/tx.proto @@ -96,8 +96,9 @@ message MsgAddMarkerRequest { bool allow_governance_control = 9; bool allow_forced_transfer = 10; repeated string required_attributes = 11; - uint64 usd_cents = 12; + uint64 usd_cents = 12 [deprecated = true]; uint64 volume = 13; + uint64 usd_mills = 14; } // MsgAddMarkerResponse defines the Msg/AddMarker response type @@ -229,8 +230,9 @@ message MsgAddFinalizeActivateMarkerRequest { bool allow_governance_control = 8; bool allow_forced_transfer = 9; repeated string required_attributes = 10; - uint64 usd_cents = 11; + uint64 usd_cents = 11 [deprecated = true]; uint64 volume = 12; + uint64 usd_mills = 13; } // MsgAddFinalizeActivateMarkerResponse defines the Msg/AddFinalizeActivateMarker response type diff --git a/third_party/proto/provenance/metadata/v1/events.proto b/third_party/proto/provenance/metadata/v1/events.proto index 7d8366f..6e487e0 100644 --- a/third_party/proto/provenance/metadata/v1/events.proto +++ b/third_party/proto/provenance/metadata/v1/events.proto @@ -175,3 +175,10 @@ message EventOSLocatorDeleted { // owner is the owner in the object store locator that was deleted. string owner = 1; } + +// EventSetNetAssetValue event emitted when Net Asset Value for a scope is update or added +message EventSetNetAssetValue { + string scope_id = 1; + string price = 2; + string source = 3; +} \ No newline at end of file diff --git a/third_party/proto/provenance/metadata/v1/genesis.proto b/third_party/proto/provenance/metadata/v1/genesis.proto index e037c3b..3f6a280 100644 --- a/third_party/proto/provenance/metadata/v1/genesis.proto +++ b/third_party/proto/provenance/metadata/v1/genesis.proto @@ -31,4 +31,19 @@ message GenesisState { OSLocatorParams o_s_locator_params = 8 [(gogoproto.nullable) = false]; repeated ObjectStoreLocator object_store_locators = 9 [(gogoproto.nullable) = false]; + + // Net asset values assigned to scopes + repeated MarkerNetAssetValues net_asset_values = 10 [(gogoproto.nullable) = false]; +} + +// MarkerNetAssetValues defines the net asset values for a scope +message MarkerNetAssetValues { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + // address defines the scope address + string address = 1; + + // net_asset_values that are assigned to scope + repeated NetAssetValue net_asset_values = 2 [(gogoproto.nullable) = false]; } diff --git a/third_party/proto/provenance/metadata/v1/query.proto b/third_party/proto/provenance/metadata/v1/query.proto index e39a44d..8d4ae49 100644 --- a/third_party/proto/provenance/metadata/v1/query.proto +++ b/third_party/proto/provenance/metadata/v1/query.proto @@ -242,6 +242,11 @@ service Query { rpc AccountData(AccountDataRequest) returns (AccountDataResponse) { option (google.api.http).get = "/provenance/metadata/v1/accountdata/{metadata_addr}"; } + + // ScopeNetAssetValues returns net asset values for scope + rpc ScopeNetAssetValues(QueryScopeNetAssetValuesRequest) returns (QueryScopeNetAssetValuesResponse) { + option (google.api.http).get = "/provenance/metadata/v1/netassetvalues/{id}"; + } } // QueryParamsRequest is the request type for the Query/Params RPC method. @@ -847,3 +852,15 @@ message AccountDataResponse { // The accountdata for the requested metadata address. string value = 1; } + +// QueryNetAssetValuesRequest is the request type for the Query/NetAssetValues method. +message QueryScopeNetAssetValuesRequest { + // scopeid metadata address + string id = 1; +} + +// QueryNetAssetValuesRequest is the response type for the Query/NetAssetValues method. +message QueryScopeNetAssetValuesResponse { + // net asset values for scope + repeated NetAssetValue net_asset_values = 1 [(gogoproto.nullable) = false]; +} \ No newline at end of file diff --git a/third_party/proto/provenance/metadata/v1/scope.proto b/third_party/proto/provenance/metadata/v1/scope.proto index 8791a4a..ac1d0f5 100644 --- a/third_party/proto/provenance/metadata/v1/scope.proto +++ b/third_party/proto/provenance/metadata/v1/scope.proto @@ -6,6 +6,7 @@ option go_package = "github.com/provenance-io/provenance/x/metadata/types"; option java_package = "io.provenance.metadata.v1"; option java_multiple_files = true; +import "cosmos/base/v1beta1/coin.proto"; import "gogoproto/gogo.proto"; import "google/protobuf/timestamp.proto"; import "google/protobuf/descriptor.proto"; @@ -252,3 +253,11 @@ message AuditFields { // an optional message associated with the creation/update event string message = 6 [(gogoproto.moretags) = "yaml:\"message,omitempty\""]; } + +// NetAssetValue defines a scope's net asset value +message NetAssetValue { + // price is the complete value of the asset's volume + cosmos.base.v1beta1.Coin price = 1 [(gogoproto.nullable) = false]; + // updated_block_height is the block height of last update + uint64 updated_block_height = 2; +} diff --git a/third_party/proto/provenance/metadata/v1/tx.proto b/third_party/proto/provenance/metadata/v1/tx.proto index b660f78..3219903 100644 --- a/third_party/proto/provenance/metadata/v1/tx.proto +++ b/third_party/proto/provenance/metadata/v1/tx.proto @@ -82,6 +82,9 @@ service Msg { // SetAccountData associates some basic data with a metadata address. // Currently, only scope ids are supported. rpc SetAccountData(MsgSetAccountDataRequest) returns (MsgSetAccountDataResponse); + + // AddNetAssetValues set the net asset value for a scope + rpc AddNetAssetValues(MsgAddNetAssetValuesRequest) returns (MsgAddNetAssetValuesResponse); } // MsgWriteScopeRequest is the request type for the Msg/WriteScope RPC method. @@ -107,6 +110,9 @@ message MsgWriteScopeRequest { // If there is a value in scope.specification_id that is different from the one created from this uuid, an error is // returned. string spec_uuid = 4 [(gogoproto.moretags) = "yaml:\"spec_uuid\""]; + + // usd_mills value of scope in usd mills (1234 = $1.234) used for net asset value + uint64 usd_mills = 5; } // MsgWriteScopeResponse is the response type for the Msg/WriteScope RPC method. @@ -649,3 +655,17 @@ message MsgP8eMemorializeContractResponse { SessionIdInfo session_id_info = 2 [(gogoproto.moretags) = "yaml:\"session_id_info\""]; repeated RecordIdInfo record_id_infos = 3 [(gogoproto.moretags) = "yaml:\"record_id_infos\""]; } + +// MsgAddNetAssetValuesRequest defines the Msg/AddNetAssetValues request type +message MsgAddNetAssetValuesRequest { + option (gogoproto.equal) = false; + option (gogoproto.goproto_stringer) = true; + option (gogoproto.goproto_getters) = false; + + string scope_id = 1; + repeated string signers = 2; + repeated NetAssetValue net_asset_values = 3 [(gogoproto.nullable) = false]; +} + +// MsgAddNetAssetValuesResponse defines the Msg/AddNetAssetValue response type +message MsgAddNetAssetValuesResponse {} \ No newline at end of file diff --git a/third_party/proto/provenance/msgfees/v1/msgfees.proto b/third_party/proto/provenance/msgfees/v1/msgfees.proto index 91076df..485a5cf 100644 --- a/third_party/proto/provenance/msgfees/v1/msgfees.proto +++ b/third_party/proto/provenance/msgfees/v1/msgfees.proto @@ -12,11 +12,19 @@ option java_multiple_files = true; message Params { option (gogoproto.equal) = false; option (gogoproto.goproto_stringer) = true; - // constant used to calculate fees when gas fees shares denom with msg fee + // floor_gas_price is the constant used to calculate fees when gas fees shares denom with msg fee. + // + // Conversions: + // - x nhash/usd-mil = 1,000,000/x usd/hash + // - y usd/hash = 1,000,000/y nhash/usd-mil + // + // Examples: + // - 40,000,000 nhash/usd-mil = 1,000,000/40,000,000 usd/hash = $0.025/hash, + // - $0.040/hash = 1,000,000/0.040 nhash/usd-mil = 25,000,000 nhash/usd-mil cosmos.base.v1beta1.Coin floor_gas_price = 2 [(gogoproto.nullable) = false]; - // total nhash per usd mil for converting usd to nhash + // nhash_per_usd_mil is the total nhash per usd mil for converting usd to nhash. uint64 nhash_per_usd_mil = 3; - // conversion fee denom is the denom usd is converted to + // conversion_fee_denom is the denom usd is converted to. string conversion_fee_denom = 4; }