Skip to content

Commit

Permalink
Merge pull request #58 from provenance-io/aj/update-protos-to-1.17.0
Browse files Browse the repository at this point in the history
feat(protos and package.json): Update protos to v1.17.0
  • Loading branch information
webbushka authored Nov 14, 2023
2 parents d1435cd + ef527bb commit 4902d88
Show file tree
Hide file tree
Showing 28 changed files with 1,889 additions and 25 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.16.0",
"pull:protos": "bash ./scripts/pull_protos.sh v1.17.0",
"clean:protos": "rm -rf third_party/proto && rm -rf src/proto",
"prepare": "npm run build && husky install",
"tsc:esm": "tsc --module es2015 --outDir esm",
Expand Down
31 changes: 31 additions & 0 deletions third_party/proto/ibc/applications/transfer/v1/authz.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
syntax = "proto3";

package ibc.applications.transfer.v1;

option go_package = "github.com/cosmos/ibc-go/v6/modules/apps/transfer/types";

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

// Allocation defines the spend limit for a particular port and channel
message Allocation {
// the port on which the packet will be sent
string source_port = 1 [(gogoproto.moretags) = "yaml:\"source_port\""];
// the channel by which the packet will be sent
string source_channel = 2 [(gogoproto.moretags) = "yaml:\"source_channel\""];
// spend limitation on the channel
repeated cosmos.base.v1beta1.Coin spend_limit = 3
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"];
// allow list of receivers, an empty allow list permits any receiver address
repeated string allow_list = 4;
}

// TransferAuthorization allows the grantee to spend up to spend_limit coins from
// the granter's account for ibc transfer on a specific channel
message TransferAuthorization {
option (cosmos_proto.implements_interface) = "Authorization";

// port and channel amounts
repeated Allocation allocations = 1 [(gogoproto.nullable) = false];
}
161 changes: 161 additions & 0 deletions third_party/proto/provenance/exchange/v1/events.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
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_proto/cosmos.proto";

// EventOrderCreated is an event emitted when an order is created.
message EventOrderCreated {
// order_id is the numerical identifier of the order created.
uint64 order_id = 1;
// order_type is the type of order, e.g. "ask" or "bid".
string order_type = 2;
// market_id is the numerical identifier of the market.
uint32 market_id = 3;
// external_id is the order's external id.
string external_id = 4;
}

// EventOrderCancelled is an event emitted when an order is cancelled.
message EventOrderCancelled {
// order_id is the numerical identifier of the order cancelled.
uint64 order_id = 1;
// cancelled_by is the account that triggered the cancellation of the order.
string cancelled_by = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// market_id is the numerical identifier of the market.
uint32 market_id = 3;
// external_id is the order's external id.
string external_id = 4;
}

// EventOrderFilled is an event emitted when an order has been filled in full.
// This event is also used for orders that were previously partially filled, but have now been filled in full.
message EventOrderFilled {
// order_id is the numerical identifier of the order filled.
uint64 order_id = 1;
// assets is the coins amount string of assets bought/sold for this order.
string assets = 2;
// price is the coins amount string of the price payed/received for this order.
string price = 3;
// fees is the coins amount string of settlement fees paid with this order.
string fees = 4;
// market_id is the numerical identifier of the market.
uint32 market_id = 5;
// external_id is the order's external id.
string external_id = 6;
}

// EventOrderPartiallyFilled is an event emitted when an order filled in part and still has more left to fill.
message EventOrderPartiallyFilled {
// order_id is the numerical identifier of the order partially filled.
uint64 order_id = 1;
// assets is the coins amount string of assets that were filled and removed from the order.
string assets = 2;
// price is the coins amount string of the price payed/received for this order.
// For ask orders, this might be more than the amount that was removed from the order's price.
string price = 3;
// fees is the coins amount string of settlement fees paid with this partial order.
// For ask orders, this might be more than the amount that was removed from the order's settlement fees.
string fees = 4;
// market_id is the numerical identifier of the market.
uint32 market_id = 5;
// external_id is the order's external id.
string external_id = 6;
}

// EventOrderExternalIDUpdated is an event emitted when an order's external id is updated.
message EventOrderExternalIDUpdated {
// order_id is the numerical identifier of the order partially filled.
uint64 order_id = 1;
// market_id is the numerical identifier of the market.
uint32 market_id = 2;
// external_id is the order's new external id.
string external_id = 3;
}

// 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.
uint32 market_id = 1;
// amount is the coins amount string of funds withdrawn from the market account.
string amount = 2;
// destination is the account that received the funds.
string destination = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// withdrawn_by is the account that requested the withdrawal.
string withdrawn_by = 4 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}

// EventMarketDetailsUpdated is an event emitted when a market's details are updated.
message EventMarketDetailsUpdated {
// market_id is the numerical identifier of the market.
uint32 market_id = 1;
// updated_by is the account that updated the details.
string updated_by = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}

// EventMarketEnabled is an event emitted when a market is enabled.
message EventMarketEnabled {
// market_id is the numerical identifier of the market.
uint32 market_id = 1;
// updated_by is the account that enabled the market.
string updated_by = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}

// EventMarketDisabled is an event emitted when a market is disabled.
message EventMarketDisabled {
// 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"];
}

// 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.
uint32 market_id = 1;
// updated_by is the account that updated the user_settle option.
string updated_by = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}

// EventMarketUserSettleDisabled is an event emitted when a market's user_settle option is disabled.
message EventMarketUserSettleDisabled {
// market_id is the numerical identifier of the market.
uint32 market_id = 1;
// updated_by is the account that updated the user_settle option.
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.
uint32 market_id = 1;
// updated_by is the account that updated the permissions.
string updated_by = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}

// EventMarketReqAttrUpdated is an event emitted when a market's required attributes are updated.
message EventMarketReqAttrUpdated {
// market_id is the numerical identifier of the market.
uint32 market_id = 1;
// updated_by is the account that updated the required attributes.
string updated_by = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}

// EventMarketCreated is an event emitted when a market has been created.
message EventMarketCreated {
// market_id is the numerical identifier of the market.
uint32 market_id = 1;
}

// EventMarketFeesUpdated is an event emitted when a market's fees have been updated.
message EventMarketFeesUpdated {
// market_id is the numerical identifier of the market.
uint32 market_id = 1;
}

// EventParamsUpdated is an event emitted when the exchange module's params have been updated.
message EventParamsUpdated {}
33 changes: 33 additions & 0 deletions third_party/proto/provenance/exchange/v1/genesis.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
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 "gogoproto/gogo.proto";
import "provenance/exchange/v1/market.proto";
import "provenance/exchange/v1/orders.proto";
import "provenance/exchange/v1/params.proto";

// GenesisState is the data that should be loaded into the exchange module during genesis.
message GenesisState {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;

// params defines all the parameters of the exchange module.
Params params = 1;

// markets are all of the markets to create at genesis.
repeated Market markets = 2 [(gogoproto.nullable) = false];

// orders are all the orders to create at genesis.
repeated Order orders = 3 [(gogoproto.nullable) = false];

// last_market_id is the value of the last auto-selected market id.
uint32 last_market_id = 4;

// last_order_id is the value of the last order id created.
uint64 last_order_id = 5;
}
141 changes: 141 additions & 0 deletions third_party/proto/provenance/exchange/v1/market.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
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/auth/v1beta1/auth.proto";
import "cosmos/base/v1beta1/coin.proto";
import "cosmos_proto/cosmos.proto";
import "gogoproto/gogo.proto";

// MarketAccount is an account type for use with the accounts module to hold some basic information about a market.
message MarketAccount {
option (gogoproto.goproto_getters) = false;
option (gogoproto.goproto_stringer) = false;

// base_account is the base cosmos account information.
cosmos.auth.v1beta1.BaseAccount base_account = 1 [(gogoproto.embed) = true];

// market_id is the numerical identifier for this market.
uint32 market_id = 2;
// market_details is some human-consumable information about this market.
MarketDetails market_details = 3 [(gogoproto.nullable) = false];
}

// MarketDetails contains information about a market.
message MarketDetails {
option (gogoproto.equal) = true;

// name is a moniker that people can use to refer to this market.
string name = 1;
// description extra information about this market. The field is meant to be human-readable.
string description = 2;
// website_url is a url people can use to get to this market, or at least get more information about this market.
string website_url = 3;
// icon_uri is a uri for an icon to associate with this market.
string icon_uri = 4;
}

// MarketBrief is a message containing brief, superficial information about a market.
message MarketBrief {
// market_id is the numerical identifier for this market.
uint32 market_id = 1;
// market_address is the bech32 address string of this market's account.
string market_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// market_details is some information about this market.
MarketDetails market_details = 3 [(gogoproto.nullable) = false];
}

// Market contains all information about a market.
message Market {
// market_id is the numerical identifier for this 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.
//
// 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.
//
// 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;
}

// FeeRatio defines a ratio of price amount to fee amount.
// For an order to be valid, its price must be evenly divisible by a FeeRatio's price.
message FeeRatio {
option (gogoproto.goproto_stringer) = false;
// price is the unit the order price is divided by to get how much of the fee should apply.
cosmos.base.v1beta1.Coin price = 1 [(gogoproto.nullable) = false];
// fee is the amount to charge per price unit.
cosmos.base.v1beta1.Coin fee = 2 [(gogoproto.nullable) = false];
}

// AddrPermissions associates an address with a list of permissions available for that address.
message AccessGrant {
// address is the address that these permissions apply to.
string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// allowed is the list of permissions available for the address.
repeated Permission permissions = 2;
}

// Permission defines the different types of permission that can be given to an account for a market.
enum Permission {
// PERMISSION_UNSPECIFIED is the zero-value Permission; it is an error to use it.
PERMISSION_UNSPECIFIED = 0 [(gogoproto.enumvalue_customname) = "unspecified"];
// PERMISSION_SETTLE is the ability to use the Settle Tx endpoint on behalf of a market.
PERMISSION_SETTLE = 1 [(gogoproto.enumvalue_customname) = "settle"];
// PERMISSION_SET_IDS is the ability to use the SetOrderExternalID Tx endpoint on behalf of a market.
PERMISSION_SET_IDS = 2 [(gogoproto.enumvalue_customname) = "set_ids"];
// PERMISSION_CANCEL is the ability to use the Cancel Tx endpoint on behalf of a market.
PERMISSION_CANCEL = 3 [(gogoproto.enumvalue_customname) = "cancel"];
// PERMISSION_WITHDRAW is the ability to use the MarketWithdraw Tx endpoint.
PERMISSION_WITHDRAW = 4 [(gogoproto.enumvalue_customname) = "withdraw"];
// PERMISSION_UPDATE is the ability to use the MarketUpdate* Tx endpoints.
PERMISSION_UPDATE = 5 [(gogoproto.enumvalue_customname) = "update"];
// PERMISSION_PERMISSIONS is the ability to use the MarketManagePermissions Tx endpoint.
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"];
}
Loading

0 comments on commit 4902d88

Please sign in to comment.