Skip to content

Commit

Permalink
refactor: Add pool to the state of x/foundation (#693)
Browse files Browse the repository at this point in the history
* Add Pool to proto

* Add Pool to state

* Update CHANGELOG.md
  • Loading branch information
0Tech committed Oct 5, 2022
1 parent c8314f7 commit 954dec7
Show file tree
Hide file tree
Showing 19 changed files with 584 additions and 215 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (x/wasm) [\#661](https://github.com/line/lbm-sdk/pull/661) x/wasm refactoring - detaching the custom wasm proto part of lbm-sdk. (apply changes of [\#625](https://github.com/line/lbm-sdk/pull/625) and [\#655](https://github.com/line/lbm-sdk/pull/655))
* (refactor) [\#685](https://github.com/line/lbm-sdk/pull/685) remove x/foundation UpdateValidatorAuthsProposal
* (x/foundation) [\#686](https://github.com/line/lbm-sdk/pull/686) remove `Minthreshold` and `MinPercentage` from x/foundation config
* (x/foundation) [\#693](https://github.com/line/lbm-sdk/pull/693) add pool to the state of x/foundation

### Bug Fixes
* (x/wasm) [\#453](https://github.com/line/lbm-sdk/pull/453) modify wasm grpc query api path
Expand Down
2 changes: 1 addition & 1 deletion client/docs/statik/statik.go

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions client/docs/swagger-ui/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37003,10 +37003,11 @@ paths:
amount:
type: string
description: >-
Coin defines a token with a denomination and an amount.
DecCoin defines a token with a denomination and a decimal
amount.


NOTE: The amount field is an Int which implements the custom
NOTE: The amount field is an Dec which implements the custom
method

signatures required by gogoproto.
Expand Down Expand Up @@ -69982,9 +69983,9 @@ definitions:
amount:
type: string
description: |-
Coin defines a token with a denomination and an amount.
DecCoin defines a token with a denomination and a decimal amount.

NOTE: The amount field is an Int which implements the custom method
NOTE: The amount field is an Dec which implements the custom method
signatures required by gogoproto.
description: |-
QueryTreasuryResponse is the response type for the
Expand Down
19 changes: 18 additions & 1 deletion docs/core/proto-docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -1108,6 +1108,7 @@
- [Member](#lbm.foundation.v1.Member)
- [Params](#lbm.foundation.v1.Params)
- [PercentageDecisionPolicy](#lbm.foundation.v1.PercentageDecisionPolicy)
- [Pool](#lbm.foundation.v1.Pool)
- [Proposal](#lbm.foundation.v1.Proposal)
- [TallyResult](#lbm.foundation.v1.TallyResult)
- [ThresholdDecisionPolicy](#lbm.foundation.v1.ThresholdDecisionPolicy)
Expand Down Expand Up @@ -16859,6 +16860,21 @@ PercentageDecisionPolicy implements the DecisionPolicy interface



<a name="lbm.foundation.v1.Pool"></a>

### Pool
Pool is used for tracking treasury.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `treasury` | [cosmos.base.v1beta1.DecCoin](#cosmos.base.v1beta1.DecCoin) | repeated | |






<a name="lbm.foundation.v1.Proposal"></a>

### Proposal
Expand Down Expand Up @@ -17249,6 +17265,7 @@ GenesisState defines the foundation module's genesis state.
| `proposals` | [Proposal](#lbm.foundation.v1.Proposal) | repeated | proposals is the list of proposals. |
| `votes` | [Vote](#lbm.foundation.v1.Vote) | repeated | votes is the list of votes. |
| `authorizations` | [GrantAuthorization](#lbm.foundation.v1.GrantAuthorization) | repeated | grants |
| `pool` | [Pool](#lbm.foundation.v1.Pool) | | pool |



Expand Down Expand Up @@ -17542,7 +17559,7 @@ Query/Treasury RPC method.

| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | |
| `amount` | [cosmos.base.v1beta1.DecCoin](#cosmos.base.v1beta1.DecCoin) | repeated | |



Expand Down
7 changes: 7 additions & 0 deletions proto/lbm/foundation/v1/foundation.proto
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import "gogoproto/gogo.proto";
import "google/protobuf/duration.proto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/any.proto";
import "cosmos/base/v1beta1/coin.proto";
import "cosmos_proto/cosmos.proto";

// Params defines the parameters for the foundation module.
Expand Down Expand Up @@ -261,3 +262,9 @@ message Vote {
// submit_time is the timestamp when the vote was submitted.
google.protobuf.Timestamp submit_time = 5 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true];
}

// Pool is used for tracking treasury.
message Pool {
repeated cosmos.base.v1beta1.DecCoin treasury = 1
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/line/lbm-sdk/types.DecCoins"];
}
3 changes: 3 additions & 0 deletions proto/lbm/foundation/v1/genesis.proto
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ message GenesisState {

// grants
repeated GrantAuthorization authorizations = 7 [(gogoproto.nullable) = false];

// pool
Pool pool = 8 [(gogoproto.nullable) = false];
}

// GrantAuthorization defines authorization grant to grantee via route.
Expand Down
4 changes: 2 additions & 2 deletions proto/lbm/foundation/v1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ message QueryTreasuryRequest {}
// QueryTreasuryResponse is the response type for the
// Query/Treasury RPC method.
message QueryTreasuryResponse {
repeated cosmos.base.v1beta1.Coin amount = 1
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/line/lbm-sdk/types.Coins"];
repeated cosmos.base.v1beta1.DecCoin amount = 1
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/line/lbm-sdk/types.DecCoins"];
}

// QueryFoundationInfoRequest is the Query/FoundationInfo request type.
Expand Down
8 changes: 8 additions & 0 deletions x/foundation/foundation.go
Original file line number Diff line number Diff line change
Expand Up @@ -425,3 +425,11 @@ func SetAuthorization(a Authorization) (*codectypes.Any, error) {
}
return any, nil
}

func (p Pool) ValidateBasic() error {
if err := p.Treasury.Validate(); err != nil {
return err
}

return nil
}
Loading

0 comments on commit 954dec7

Please sign in to comment.