-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #362 from cosmosquad-labs/farm-module
feat: add x/farm module
- Loading branch information
Showing
71 changed files
with
19,589 additions
and
3 deletions.
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
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
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
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
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
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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
syntax = "proto3"; | ||
|
||
package squad.farm.v1beta1; | ||
|
||
import "gogoproto/gogo.proto"; | ||
import "cosmos/base/v1beta1/coin.proto"; | ||
|
||
option go_package = "github.com/cosmosquad-labs/squad/x/farm/types"; | ||
option (gogoproto.goproto_getters_all) = false; | ||
|
||
message EventCreatePrivatePlan { | ||
string creator = 1; | ||
uint64 plan_id = 2; | ||
string farming_pool_address = 3; | ||
} | ||
|
||
message EventFarm { | ||
string farmer = 1; | ||
cosmos.base.v1beta1.Coin coin = 2 [(gogoproto.nullable) = false]; | ||
repeated cosmos.base.v1beta1.Coin withdrawn_rewards = 3 | ||
[(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", (gogoproto.nullable) = false]; | ||
} | ||
|
||
message EventUnfarm { | ||
string farmer = 1; | ||
cosmos.base.v1beta1.Coin coin = 2 [(gogoproto.nullable) = false]; | ||
repeated cosmos.base.v1beta1.Coin withdrawn_rewards = 3 | ||
[(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", (gogoproto.nullable) = false]; | ||
} | ||
|
||
message EventHarvest { | ||
string farmer = 1; | ||
string denom = 2; | ||
repeated cosmos.base.v1beta1.Coin withdrawn_rewards = 3 | ||
[(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", (gogoproto.nullable) = false]; | ||
} | ||
|
||
message EventTerminatePlan { | ||
uint64 plan_id = 1; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,62 @@ | ||
syntax = "proto3"; | ||
|
||
package squad.farm.v1beta1; | ||
|
||
import "gogoproto/gogo.proto"; | ||
import "cosmos/base/v1beta1/coin.proto"; | ||
import "google/protobuf/timestamp.proto"; | ||
import "google/protobuf/duration.proto"; | ||
|
||
option go_package = "github.com/cosmosquad-labs/squad/x/farm/types"; | ||
option (gogoproto.goproto_getters_all) = false; | ||
|
||
message Params { | ||
repeated cosmos.base.v1beta1.Coin private_plan_creation_fee = 1 | ||
[(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", (gogoproto.nullable) = false]; | ||
string fee_collector = 2; | ||
uint32 max_num_private_plans = 3; | ||
google.protobuf.Duration max_block_duration = 4 [(gogoproto.stdduration) = true, (gogoproto.nullable) = false]; | ||
} | ||
|
||
message Plan { | ||
uint64 id = 1; | ||
string description = 2; | ||
string farming_pool_address = 3; | ||
string termination_address = 4; | ||
repeated RewardAllocation reward_allocations = 5 [(gogoproto.nullable) = false]; | ||
google.protobuf.Timestamp start_time = 6 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; | ||
google.protobuf.Timestamp end_time = 7 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; | ||
bool is_private = 8; | ||
bool is_terminated = 9; | ||
} | ||
|
||
message RewardAllocation { | ||
uint64 pair_id = 1; | ||
repeated cosmos.base.v1beta1.Coin rewards_per_day = 2 | ||
[(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", (gogoproto.nullable) = false]; | ||
} | ||
|
||
message Farm { | ||
string total_farming_amount = 1 | ||
[(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false]; | ||
repeated cosmos.base.v1beta1.DecCoin current_rewards = 2 | ||
[(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins", (gogoproto.nullable) = false]; | ||
repeated cosmos.base.v1beta1.DecCoin outstanding_rewards = 3 | ||
[(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins", (gogoproto.nullable) = false]; | ||
uint64 period = 4; | ||
} | ||
|
||
message Position { | ||
string farmer = 1; | ||
string denom = 2; | ||
string farming_amount = 3 | ||
[(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false]; | ||
uint64 previous_period = 4; | ||
int64 starting_block_height = 5; | ||
} | ||
|
||
message HistoricalRewards { | ||
repeated cosmos.base.v1beta1.DecCoin cumulative_unit_rewards = 1 | ||
[(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins", (gogoproto.nullable) = false]; | ||
uint32 reference_count = 2; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
syntax = "proto3"; | ||
|
||
package squad.farm.v1beta1; | ||
|
||
import "gogoproto/gogo.proto"; | ||
import "squad/farm/v1beta1/farm.proto"; | ||
import "google/protobuf/timestamp.proto"; | ||
|
||
option go_package = "github.com/cosmosquad-labs/squad/x/farm/types"; | ||
option (gogoproto.goproto_getters_all) = false; | ||
|
||
message GenesisState { | ||
Params params = 1 [(gogoproto.nullable) = false]; | ||
google.protobuf.Timestamp last_block_time = 2 [(gogoproto.stdtime) = true]; | ||
uint64 last_plan_id = 3; | ||
uint64 num_private_plans = 4; | ||
repeated Plan plans = 5 [(gogoproto.nullable) = false]; | ||
repeated FarmRecord farms = 6 [(gogoproto.nullable) = false]; | ||
repeated Position positions = 7 [(gogoproto.nullable) = false]; | ||
repeated HistoricalRewardsRecord historical_rewards = 8 [(gogoproto.nullable) = false]; | ||
} | ||
|
||
message FarmRecord { | ||
string denom = 1; | ||
Farm farm = 2 [(gogoproto.nullable) = false]; | ||
} | ||
|
||
message HistoricalRewardsRecord { | ||
string denom = 1; | ||
uint64 period = 2; | ||
HistoricalRewards historical_rewards = 3 [(gogoproto.nullable) = false]; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
syntax = "proto3"; | ||
|
||
package squad.farm.v1beta1; | ||
|
||
import "gogoproto/gogo.proto"; | ||
import "squad/farm/v1beta1/farm.proto"; | ||
import "google/protobuf/timestamp.proto"; | ||
|
||
option go_package = "github.com/cosmosquad-labs/squad/x/farm/types"; | ||
option (gogoproto.goproto_getters_all) = false; | ||
|
||
message FarmingPlanProposal { | ||
option (gogoproto.goproto_stringer) = false; | ||
string title = 1; | ||
string description = 2; | ||
repeated CreatePlanRequest create_plan_requests = 3 [(gogoproto.nullable) = false]; | ||
repeated TerminatePlanRequest terminate_plan_requests = 4 [(gogoproto.nullable) = false]; | ||
} | ||
|
||
message CreatePlanRequest { | ||
string description = 1; | ||
string farming_pool_address = 2; | ||
string termination_address = 3; | ||
repeated RewardAllocation reward_allocations = 4 [(gogoproto.nullable) = false]; | ||
google.protobuf.Timestamp start_time = 5 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; | ||
google.protobuf.Timestamp end_time = 6 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; | ||
} | ||
|
||
message TerminatePlanRequest { | ||
uint64 plan_id = 1; | ||
} |
Oops, something went wrong.