Skip to content

Commit

Permalink
feat(x/ecocredit): add buy/sell expiration
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanchristo committed Jan 3, 2022
1 parent 17331c0 commit 8a1bfd2
Show file tree
Hide file tree
Showing 17 changed files with 1,085 additions and 362 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,12 @@ require (
github.com/tendermint/go-amino v0.16.0 // indirect
github.com/zondax/hid v0.9.0 // indirect
go.etcd.io/bbolt v1.3.5 // indirect
golang.org/x/crypto v0.0.0-20211202192323-5770296d904e // indirect
golang.org/x/crypto v0.0.0-20211209193657-4570a0811e8b // indirect
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2 // indirect
golang.org/x/sys v0.0.0-20210903071746-97244b99971b // indirect
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 // indirect
golang.org/x/text v0.3.7 // indirect
google.golang.org/genproto v0.0.0-20211203200212-54befc351ae9 // indirect
google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa // indirect
google.golang.org/grpc v1.40.0 // indirect
google.golang.org/protobuf v1.27.1 // indirect
gopkg.in/ini.v1 v1.63.2 // indirect
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1134,8 +1134,8 @@ golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9/go.mod h1:jdWPYTVW3xRLrWP
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8=
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20211202192323-5770296d904e h1:MUP6MR3rJ7Gk9LEia0LP2ytiH6MuCfs7qYz+47jGdD8=
golang.org/x/crypto v0.0.0-20211202192323-5770296d904e/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.0.0-20211209193657-4570a0811e8b h1:QAqMVf3pSa6eeTsuklijukjXBlj7Es2QQplab+/RbQ4=
golang.org/x/crypto v0.0.0-20211209193657-4570a0811e8b/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
Expand Down Expand Up @@ -1544,8 +1544,8 @@ google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6D
google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A=
google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0=
google.golang.org/genproto v0.0.0-20211203200212-54befc351ae9 h1:fU3FNfL/oBU2D5DvGqiuyVqqn40DdxvaTFHq7aivA3k=
google.golang.org/genproto v0.0.0-20211203200212-54befc351ae9/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa h1:I0YcKz0I7OAhddo7ya8kMnvprhcWM045PmkBdMO9zN0=
google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
google.golang.org/grpc v1.33.2 h1:EQyQC3sa8M+p6Ulc8yy9SWSS2GVwyRc83gAbG8lrl4o=
google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
Expand Down
14 changes: 14 additions & 0 deletions proto/regen/ecocredit/v1alpha2/events.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ syntax = "proto3";

package regen.ecocredit.v1alpha2;

import "gogoproto/gogo.proto";
import "cosmos/base/v1beta1/coin.proto";
import "google/protobuf/timestamp.proto";

option go_package = "github.com/regen-network/regen-ledger/x/ecocredit";

Expand Down Expand Up @@ -147,6 +149,10 @@ message EventSell {
// buyer to disable auto-retirement in their buy order enabling them to
// resell the credits to another buyer.
bool disable_auto_retire = 5;

// expiration is the optional timestamp when the sell order expires. When the
// expiration time is reached, the sell order is removed from state.
google.protobuf.Timestamp expiration = 6 [ (gogoproto.stdtime) = true ];
}

// EventUpdateSellOrder is an event emitted when a sell order is updated.
Expand All @@ -170,6 +176,10 @@ message EventUpdateSellOrder {

// disable_auto_retire updates the disable_auto_retire field in the sell order.
bool disable_auto_retire = 6;

// new_expiration is the optional timestamp when the sell order expires. When the
// expiration time is reached, the sell order is removed from state.
google.protobuf.Timestamp new_expiration = 7 [ (gogoproto.stdtime) = true ];
}

// EventBuyOrderCreated is an event emitted when a buy order is created.
Expand Down Expand Up @@ -202,6 +212,10 @@ message EventBuyOrderCreated {
// disable_partial_fill disables the default behavior of partially filling
// buy orders if the requested quantity is not available.
bool disable_partial_fill = 6;

// expiration is the optional timestamp when the buy order expires. When the
// expiration time is reached, the buy order is removed from state.
google.protobuf.Timestamp expiration = 7 [ (gogoproto.stdtime) = true ];
}

// EventBuyOrderFilled is an event emitted when a buy order is filled.
Expand Down
12 changes: 12 additions & 0 deletions proto/regen/ecocredit/v1alpha2/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,10 @@ message MsgSell {
// buyer to disable auto-retirement in their buy order enabling them to
// resell the credits to another buyer.
bool disable_auto_retire = 4;

// expiration is the optional timestamp when the sell order expires. When the
// expiration time is reached, the sell order is removed from state.
google.protobuf.Timestamp expiration = 5 [ (gogoproto.stdtime) = true ];
}
}

Expand Down Expand Up @@ -415,6 +419,10 @@ message MsgUpdateSellOrders {

// disable_auto_retire updates the disable_auto_retire field in the sell order.
bool disable_auto_retire = 4;

// new_expiration is the optional timestamp when the sell order expires. When the
// expiration time is reached, the sell order is removed from state.
google.protobuf.Timestamp new_expiration = 5 [ (gogoproto.stdtime) = true ];
}
}

Expand Down Expand Up @@ -475,6 +483,10 @@ message MsgBuy {
// disable_partial_fill disables the default behavior of partially filling
// buy orders if the requested quantity is not available.
bool disable_partial_fill = 5;

// expiration is the optional timestamp when the buy order expires. When the
// expiration time is reached, the buy order is removed from state.
google.protobuf.Timestamp expiration = 6 [ (gogoproto.stdtime) = true ];
}
}

Expand Down
8 changes: 8 additions & 0 deletions proto/regen/ecocredit/v1alpha2/types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,10 @@ message SellOrder {
// buyer to disable auto-retirement in their buy order enabling them to
// resell the credits to another buyer.
bool disable_auto_retire = 6;

// expiration is the optional timestamp when the sell order expires. When the
// expiration time is reached, the sell order is removed from state.
google.protobuf.Timestamp expiration = 7 [ (gogoproto.stdtime) = true ];
}

// BuyOrder represents the information for a buy order.
Expand Down Expand Up @@ -209,6 +213,10 @@ message BuyOrder {
// disable_partial_fill disables the default behavior of partially filling
// buy orders if the requested quantity is not available.
bool disable_partial_fill = 7;

// expiration is the optional timestamp when the buy order expires. When the
// expiration time is reached, the buy order is removed from state.
google.protobuf.Timestamp expiration = 8 [ (gogoproto.stdtime) = true ];
}

// AskDenom represents the information for an ask denom.
Expand Down
Loading

0 comments on commit 8a1bfd2

Please sign in to comment.