-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: ecocredit direct buy/sell proto definitions #560
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
3b3f88f
feat: credit store proto definition
aaronc ac8425a
fix proto file
aaronc e3f8d01
change CancelSellOrder to UpdatedSellOrder and add AllowAskDenom
aaronc eb028be
update comments
aaronc 70a1604
updates
aaronc eb529b8
Merge branch 'master' into aaronc/505-credit-store
aaronc 0724312
add bid price
aaronc b9b528f
Merge remote-tracking branch 'origin/aaronc/505-credit-store' into aa…
aaronc b777446
Update proto/regen/ecocredit/v1alpha1/tx.proto
aaronc 9b68043
rename dont_auto_retire to disable_auto_retire
aaronc e9e74f4
Merge remote-tracking branch 'origin/aaronc/505-credit-store' into aa…
aaronc ad1a770
Update proto/regen/ecocredit/v1alpha1/tx.proto
aaronc fb94770
address review comments
aaronc bee78fb
Merge branch 'master' into aaronc/505-credit-store
aaronc 324f66c
Merge remote-tracking branch 'origin/aaronc/505-credit-store' into aa…
aaronc File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ package regen.ecocredit.v1alpha1; | |
|
||
import "gogoproto/gogo.proto"; | ||
import "google/protobuf/timestamp.proto"; | ||
import "cosmos/base/v1beta1/coin.proto"; | ||
|
||
option go_package = "github.com/regen-network/regen-ledger/x/ecocredit"; | ||
|
||
|
@@ -39,6 +40,18 @@ service Msg { | |
|
||
// UpdateClassMetadata updates the credit class metadata | ||
rpc UpdateClassMetadata(MsgUpdateClassMetadata) returns (MsgUpdateClassMetadataResponse); | ||
|
||
// Sell creates new sell orders. | ||
rpc Sell(MsgSell) returns (MsgSellResponse); | ||
clevinson marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
// UpdateSellOrders updates existing sell orders. | ||
rpc UpdateSellOrders(MsgUpdateSellOrders) returns (MsgUpdateSellOrdersResponse); | ||
|
||
// BuyDirect creates buy orders directly against sell orders. | ||
rpc BuyDirect (MsgBuyDirect) returns (MsgBuyDirectResponse); | ||
clevinson marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
// AllowAskDenom is a governance operation which authorizes a new ask denom to be used in sell orders | ||
rpc AllowAskDenom (MsgAllowAskDenom) returns (MsgAllowAskDenomResponse); | ||
blushi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
// MsgCreateClass is the Msg/CreateClass request type. | ||
|
@@ -274,4 +287,143 @@ message MsgUpdateClassMetadata { | |
} | ||
|
||
// MsgUpdateClassMetadataResponse is the MsgUpdateClassMetadata response type. | ||
message MsgUpdateClassMetadataResponse {} | ||
message MsgUpdateClassMetadataResponse {} | ||
|
||
// MsgSell is the Msg/Sell request type. | ||
message MsgSell { | ||
|
||
// owner is the address of the owner of the credits being sold. | ||
string owner = 1; | ||
|
||
// orders are the sell orders being created. | ||
repeated Order orders = 2; | ||
|
||
// Order is the content of a new sell order. | ||
message Order { | ||
|
||
// batch_denom is the credit batch being sold. | ||
string batch_denom = 1; | ||
|
||
// quantity is the quantity of credits being sold from this batch. If it is | ||
// less then the balance of credits the owner has available at the time this | ||
// sell order is matched, the quantity will be adjusted downwards to the | ||
// owner's balance. However, if the balance of credits is less than this | ||
// quantity at the time the sell order is created, the operation will fail. | ||
string quantity = 2; | ||
|
||
// ask_price is the price the seller is asking for each unit of the | ||
// batch_denom. Each credit unit of the batch will be sold for at least the | ||
// ask_price or more. | ||
cosmos.base.v1beta1.Coin ask_price = 3; | ||
|
||
// disable_auto_retire disables auto-retirement of credits which allows a | ||
// buyer to disable auto-retirement in their buy order enabling them to | ||
// resell the credits to another buyer. | ||
bool disable_auto_retire = 4; | ||
} | ||
aaronc marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
// MsgSellResponse is the Msg/Sell response type. | ||
message MsgSellResponse { | ||
|
||
// sell_order_ids are the sell order IDs of the newly created sell orders. | ||
repeated uint64 sell_order_ids = 1; | ||
} | ||
|
||
// MsgUpdateSellOrders is the Msg/UpdateSellOrders request type. | ||
message MsgUpdateSellOrders { | ||
|
||
// owner is the owner of the sell orders. | ||
string owner = 1; | ||
|
||
// updates are updates to existing sell orders. | ||
repeated Update updates = 2; | ||
|
||
// Update is an update to an existing sell order. | ||
message Update { | ||
|
||
// sell_order_id is the ID of an existing sell order. | ||
uint64 sell_order_id = 1; | ||
|
||
// new_quantity is the updated quantity of credits available to sell, if it | ||
// is set to zero then the order is cancelled. | ||
string new_quantity = 2; | ||
|
||
// new_ask_price is the new ask price for this sell order | ||
cosmos.base.v1beta1.Coin new_ask_price = 3; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do we need a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not necessarily, but it doesn't hurt |
||
|
||
// disable_auto_retire updates the disable_auto_retire field in the sell order. | ||
bool disable_auto_retire = 4; | ||
} | ||
} | ||
|
||
// MsgUpdateSellOrdersResponse is the Msg/UpdateSellOrders response type. | ||
message MsgUpdateSellOrdersResponse {} | ||
aaronc marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
// MsgBuyDirect is the Msg/BuyDirect request type. | ||
message MsgBuyDirect { | ||
|
||
// buyer is the address of the credit buyer. | ||
string buyer = 1; | ||
|
||
// orders are the new buy orders. | ||
repeated Order orders = 2; | ||
|
||
// Order is a direct buy order. | ||
message Order { | ||
|
||
// sell_order_id is the sell order ID against which the buyer is trying to buy. | ||
uint64 sell_order_id = 1; | ||
|
||
// quantity is the quantity of credits to buy. If the quantity of credits | ||
// available is less than this amount the order will be partially filled | ||
// unless disable_partial_fill is true. | ||
string quantity = 2; | ||
aaronc marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
// bid price is the bid price for this buy order. A credit unit will be | ||
// settled at a purchase price that is no more than the bid price. The | ||
// buy order will fail if the buyer does not have enough funds available | ||
// to complete the purchase. | ||
cosmos.base.v1beta1.Coin bid_price = 3; | ||
|
||
// disable_auto_retire allows auto-retirement to be disabled. If it is set to true | ||
// the credits will not auto-retire and can be resold assuming that the | ||
// corresponding sell order has auto-retirement disabled. If the sell order | ||
// hasn't disabled auto-retirement and the buy order tries to disable it, | ||
// that buy order will fail. | ||
bool disable_auto_retire = 4; | ||
|
||
// disable_partial_fill disables the default behavior of partially filling | ||
// buy orders if the requested quantity is not available. | ||
bool disable_partial_fill = 5; | ||
} | ||
} | ||
|
||
// MsgBuyDirectResponse is the Msg/BuyDirect response type. | ||
message MsgBuyDirectResponse { | ||
|
||
// buy_order_ids are the buy order IDs of the newly created buy orders. Buy | ||
// orders may not settle instantaneously, but rather in batches at specified | ||
// batch epoch times. | ||
repeated uint64 buy_order_ids = 1; | ||
clevinson marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
|
||
// MsgAllowAskDenom is the Msg/AllowAskDenom request type. | ||
message MsgAllowAskDenom { | ||
// root_address is the address of the governance account which can authorize ask denoms | ||
string root_address = 1; | ||
clevinson marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
// denom is the denom to allow (ex. ibc/GLKHDSG423SGS) | ||
string denom = 2; | ||
|
||
// display_denom is the denom to display to the user and is informational | ||
string display_denom = 3; | ||
|
||
// exponent is the exponent that relates the denom to the display_denom and is | ||
// informational | ||
uint32 exponent = 4; | ||
} | ||
|
||
// MsgAllowAskDenomResponse is the Msg/AllowAskDenom response type. | ||
message MsgAllowAskDenomResponse {} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's improve all msg comments by describing a valid or error condition.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added comments for error conditions I'm aware of in the relevant places I can think of. But if you have specific suggestions for improving this that would be appeciated.