Skip to content

Commit

Permalink
refactor: add UpdateParams to x/foundation (#729)
Browse files Browse the repository at this point in the history
* Update comments in tx.proto

* Remove UpdateFoundationParamsProposal

Replace the proposal into the corresponding msg.

* Remove old logics and add stubs

* Implement MsgUpdateParams

* Implement UpdateParams

* Implement cli

* Update name of the corresponding event

* Update CHANGELOG.md
  • Loading branch information
0Tech authored Oct 19, 2022
1 parent 77fc5ce commit 392277a
Show file tree
Hide file tree
Showing 21 changed files with 948 additions and 873 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (x/bank) [\#716](https://github.com/line/lbm-sdk/pull/716) remove useless DenomMetadata key function
* (x/foundation) [\#704](https://github.com/line/lbm-sdk/pull/704) update x/foundation params
* (x/wasm) [\#695](https://github.com/line/lbm-sdk/pull/695) fix to prevent external filesystem dependency of simulation
* (x/foundation) [\#729](https://github.com/line/lbm-sdk/pull/729) add UpdateParams to x/foundation

### Bug Fixes
* (x/wasm) [\#453](https://github.com/line/lbm-sdk/pull/453) modify wasm grpc query api path
Expand Down
94 changes: 52 additions & 42 deletions docs/core/proto-docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -1114,7 +1114,6 @@
- [Proposal](#lbm.foundation.v1.Proposal)
- [TallyResult](#lbm.foundation.v1.TallyResult)
- [ThresholdDecisionPolicy](#lbm.foundation.v1.ThresholdDecisionPolicy)
- [UpdateFoundationParamsProposal](#lbm.foundation.v1.UpdateFoundationParamsProposal)
- [Vote](#lbm.foundation.v1.Vote)

- [ProposalExecutorResult](#lbm.foundation.v1.ProposalExecutorResult)
Expand All @@ -1130,8 +1129,8 @@
- [EventRevoke](#lbm.foundation.v1.EventRevoke)
- [EventSubmitProposal](#lbm.foundation.v1.EventSubmitProposal)
- [EventUpdateDecisionPolicy](#lbm.foundation.v1.EventUpdateDecisionPolicy)
- [EventUpdateFoundationParams](#lbm.foundation.v1.EventUpdateFoundationParams)
- [EventUpdateMembers](#lbm.foundation.v1.EventUpdateMembers)
- [EventUpdateParams](#lbm.foundation.v1.EventUpdateParams)
- [EventVote](#lbm.foundation.v1.EventVote)
- [EventWithdrawFromTreasury](#lbm.foundation.v1.EventWithdrawFromTreasury)
- [EventWithdrawProposal](#lbm.foundation.v1.EventWithdrawProposal)
Expand Down Expand Up @@ -1187,6 +1186,8 @@
- [MsgUpdateDecisionPolicyResponse](#lbm.foundation.v1.MsgUpdateDecisionPolicyResponse)
- [MsgUpdateMembers](#lbm.foundation.v1.MsgUpdateMembers)
- [MsgUpdateMembersResponse](#lbm.foundation.v1.MsgUpdateMembersResponse)
- [MsgUpdateParams](#lbm.foundation.v1.MsgUpdateParams)
- [MsgUpdateParamsResponse](#lbm.foundation.v1.MsgUpdateParamsResponse)
- [MsgVote](#lbm.foundation.v1.MsgVote)
- [MsgVoteResponse](#lbm.foundation.v1.MsgVoteResponse)
- [MsgWithdrawFromTreasury](#lbm.foundation.v1.MsgWithdrawFromTreasury)
Expand Down Expand Up @@ -16986,25 +16987,6 @@ satisfies the two following conditions:



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

### UpdateFoundationParamsProposal
UpdateFoundationParamsProposal details a proposal to update params of foundation module.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `title` | [string](#string) | | |
| `description` | [string](#string) | | |
| `params` | [Params](#lbm.foundation.v1.Params) | | params defines the x/foundation parameters to update.

Note: All parameters must be supplied. |






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

### Vote
Expand Down Expand Up @@ -17212,30 +17194,30 @@ EventUpdateDecisionPolicy is an event emitted when the decision policy have been



<a name="lbm.foundation.v1.EventUpdateFoundationParams"></a>
<a name="lbm.foundation.v1.EventUpdateMembers"></a>

### EventUpdateFoundationParams
EventUpdateFoundationParams is emitted after updating foundation parameters.
### EventUpdateMembers
EventUpdateMembers is an event emitted when the members have been updated.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `params` | [Params](#lbm.foundation.v1.Params) | | |
| `member_updates` | [MemberRequest](#lbm.foundation.v1.MemberRequest) | repeated | |






<a name="lbm.foundation.v1.EventUpdateMembers"></a>
<a name="lbm.foundation.v1.EventUpdateParams"></a>

### EventUpdateMembers
EventUpdateMembers is an event emitted when the members have been updated.
### EventUpdateParams
EventUpdateParams is emitted after updating foundation parameters.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `member_updates` | [MemberRequest](#lbm.foundation.v1.MemberRequest) | repeated | |
| `params` | [Params](#lbm.foundation.v1.Params) | | |



Expand Down Expand Up @@ -17775,7 +17757,7 @@ MsgExecResponse is the Msg/Exec request type.
<a name="lbm.foundation.v1.MsgFundTreasury"></a>

### MsgFundTreasury
MsgFundTreasury represents a message to fund the treasury.
MsgFundTreasury is the Msg/FundTreasury request type.


| Field | Type | Label | Description |
Expand All @@ -17791,7 +17773,7 @@ MsgFundTreasury represents a message to fund the treasury.
<a name="lbm.foundation.v1.MsgFundTreasuryResponse"></a>

### MsgFundTreasuryResponse
MsgFundTreasuryResponse defines the Msg/FundTreasury response type.
MsgFundTreasuryResponse is the Msg/FundTreasury response type.



Expand All @@ -17801,7 +17783,7 @@ MsgFundTreasuryResponse defines the Msg/FundTreasury response type.
<a name="lbm.foundation.v1.MsgGovMint"></a>

### MsgGovMint
MsgGovMint represents a message to mint coins to the treasury.
MsgGovMint is the Msg/GovMint request type.


| Field | Type | Label | Description |
Expand All @@ -17817,7 +17799,7 @@ MsgGovMint represents a message to mint coins to the treasury.
<a name="lbm.foundation.v1.MsgGovMintResponse"></a>

### MsgGovMintResponse
MsgGovMintResponse defines the Msg/GovMint response type.
MsgGovMintResponse is the Msg/GovMint response type.



Expand All @@ -17827,7 +17809,7 @@ MsgGovMintResponse defines the Msg/GovMint response type.
<a name="lbm.foundation.v1.MsgGrant"></a>

### MsgGrant
MsgGrant is a request type for Grant method. It declares authorization to the grantee
MsgGrant is the Msg/Grant request type.
on behalf of the foundation.


Expand All @@ -17845,7 +17827,7 @@ on behalf of the foundation.
<a name="lbm.foundation.v1.MsgGrantResponse"></a>

### MsgGrantResponse
MsgGrantResponse defines the Msg/MsgGrant response type.
MsgGrantResponse is the Msg/MsgGrant response type.



Expand Down Expand Up @@ -17880,8 +17862,7 @@ MsgLeaveFoundationResponse is the Msg/LeaveFoundation response type.
<a name="lbm.foundation.v1.MsgRevoke"></a>

### MsgRevoke
MsgRevoke revokes any authorization with the provided sdk.Msg type
to the grantee on behalf of the foundation.
MsgRevoke is the Msg/Revoke request type.


| Field | Type | Label | Description |
Expand All @@ -17898,7 +17879,7 @@ to the grantee on behalf of the foundation.
<a name="lbm.foundation.v1.MsgRevokeResponse"></a>

### MsgRevokeResponse
MsgRevokeResponse defines the Msg/MsgRevokeResponse response type.
MsgRevokeResponse is the Msg/MsgRevokeResponse response type.



Expand Down Expand Up @@ -17990,6 +17971,34 @@ MsgUpdateMembersResponse is the Msg/UpdateMembers response type.



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

### MsgUpdateParams
MsgUpdateParams is the Msg/UpdateParams request type.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `authority` | [string](#string) | | authority is the address of the operator account. |
| `params` | [Params](#lbm.foundation.v1.Params) | | params defines the x/foundation parameters to update.

NOTE: All parameters must be supplied. |






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

### MsgUpdateParamsResponse
MsgUpdateParamsResponse is the Msg/UpdateParams response type.






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

### MsgVote
Expand Down Expand Up @@ -18022,7 +18031,7 @@ MsgVoteResponse is the Msg/Vote response type.
<a name="lbm.foundation.v1.MsgWithdrawFromTreasury"></a>

### MsgWithdrawFromTreasury
MsgWithdrawFromTreasury represents a message to withdraw coins from the treasury.
MsgWithdrawFromTreasury is the Msg/WithdrawFromTreasury request type.


| Field | Type | Label | Description |
Expand All @@ -18039,7 +18048,7 @@ MsgWithdrawFromTreasury represents a message to withdraw coins from the treasury
<a name="lbm.foundation.v1.MsgWithdrawFromTreasuryResponse"></a>

### MsgWithdrawFromTreasuryResponse
MsgWithdrawFromTreasuryResponse defines the Msg/WithdrawFromTreasury response type.
MsgWithdrawFromTreasuryResponse is the Msg/WithdrawFromTreasury response type.



Expand Down Expand Up @@ -18097,6 +18106,7 @@ Msg defines the foundation Msg service.

| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint |
| ----------- | ------------ | ------------- | ------------| ------- | -------- |
| `UpdateParams` | [MsgUpdateParams](#lbm.foundation.v1.MsgUpdateParams) | [MsgUpdateParamsResponse](#lbm.foundation.v1.MsgUpdateParamsResponse) | UpdateParams defines an operation for updating the x/foundation module parameters. | |
| `FundTreasury` | [MsgFundTreasury](#lbm.foundation.v1.MsgFundTreasury) | [MsgFundTreasuryResponse](#lbm.foundation.v1.MsgFundTreasuryResponse) | FundTreasury defines a method to fund the treasury. | |
| `WithdrawFromTreasury` | [MsgWithdrawFromTreasury](#lbm.foundation.v1.MsgWithdrawFromTreasury) | [MsgWithdrawFromTreasuryResponse](#lbm.foundation.v1.MsgWithdrawFromTreasuryResponse) | WithdrawFromTreasury defines a method to withdraw coins from the treasury. | |
| `UpdateMembers` | [MsgUpdateMembers](#lbm.foundation.v1.MsgUpdateMembers) | [MsgUpdateMembersResponse](#lbm.foundation.v1.MsgUpdateMembersResponse) | UpdateMembers updates the foundation members. | |
Expand All @@ -18106,8 +18116,8 @@ Msg defines the foundation Msg service.
| `Vote` | [MsgVote](#lbm.foundation.v1.MsgVote) | [MsgVoteResponse](#lbm.foundation.v1.MsgVoteResponse) | Vote allows a voter to vote on a proposal. | |
| `Exec` | [MsgExec](#lbm.foundation.v1.MsgExec) | [MsgExecResponse](#lbm.foundation.v1.MsgExecResponse) | Exec executes a proposal. | |
| `LeaveFoundation` | [MsgLeaveFoundation](#lbm.foundation.v1.MsgLeaveFoundation) | [MsgLeaveFoundationResponse](#lbm.foundation.v1.MsgLeaveFoundationResponse) | LeaveFoundation allows a member to leave the foundation. | |
| `Grant` | [MsgGrant](#lbm.foundation.v1.MsgGrant) | [MsgGrantResponse](#lbm.foundation.v1.MsgGrantResponse) | Grant grants the provided authorization to the grantee with authority of the foundation. If there is already a grant for the given (granter, grantee, Authorization) tuple, then the grant will be overwritten. | |
| `Revoke` | [MsgRevoke](#lbm.foundation.v1.MsgRevoke) | [MsgRevokeResponse](#lbm.foundation.v1.MsgRevokeResponse) | Revoke revokes any authorization corresponding to the provided method name on the granter that has been granted to the grantee. | |
| `Grant` | [MsgGrant](#lbm.foundation.v1.MsgGrant) | [MsgGrantResponse](#lbm.foundation.v1.MsgGrantResponse) | Grant grants the provided authorization to the grantee with authority of the foundation. If there is already a grant for the given (grantee, Authorization) tuple, then the grant will be overwritten. | |
| `Revoke` | [MsgRevoke](#lbm.foundation.v1.MsgRevoke) | [MsgRevokeResponse](#lbm.foundation.v1.MsgRevokeResponse) | Revoke revokes any authorization corresponding to the provided method name that has been granted to the grantee. | |
| `GovMint` | [MsgGovMint](#lbm.foundation.v1.MsgGovMint) | [MsgGovMintResponse](#lbm.foundation.v1.MsgGovMintResponse) | GovMint defines a gov mint coins to the treasury. | |

<!-- end services -->
Expand Down
4 changes: 2 additions & 2 deletions proto/lbm/foundation/v1/event.proto
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import "cosmos_proto/cosmos.proto";
import "cosmos/base/v1beta1/coin.proto";
import "lbm/foundation/v1/foundation.proto";

// EventUpdateFoundationParams is emitted after updating foundation parameters.
message EventUpdateFoundationParams {
// EventUpdateParams is emitted after updating foundation parameters.
message EventUpdateParams {
Params params = 1 [(gogoproto.nullable) = false];
}

Expand Down
15 changes: 0 additions & 15 deletions proto/lbm/foundation/v1/foundation.proto
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,6 @@ message Params {
repeated string censored_msg_type_urls = 2;
}

// UpdateFoundationParamsProposal details a proposal to update params of foundation module.
message UpdateFoundationParamsProposal {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;
option (gogoproto.goproto_stringer) = false;

string title = 1;
string description = 2;

// params defines the x/foundation parameters to update.
//
// Note: All parameters must be supplied.
Params params = 3 [(gogoproto.nullable) = false];
}

// Member represents a foundation member with an account address and metadata.
message Member {
// address is the member's account address.
Expand Down
45 changes: 31 additions & 14 deletions proto/lbm/foundation/v1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ option (gogoproto.goproto_getters_all) = false;

// Msg defines the foundation Msg service.
service Msg {
// UpdateParams defines an operation for updating the x/foundation module
// parameters.
rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse);

// FundTreasury defines a method to fund the treasury.
rpc FundTreasury(MsgFundTreasury) returns (MsgFundTreasuryResponse);

Expand Down Expand Up @@ -44,36 +48,50 @@ service Msg {

// Grant grants the provided authorization to the grantee with authority of
// the foundation. If there is already a grant for the given
// (granter, grantee, Authorization) tuple, then the grant will be overwritten.
// (grantee, Authorization) tuple, then the grant will be overwritten.
rpc Grant(MsgGrant) returns (MsgGrantResponse);

// Revoke revokes any authorization corresponding to the provided method name on the
// granter that has been granted to the grantee.
// Revoke revokes any authorization corresponding to the provided method name
// that has been granted to the grantee.
rpc Revoke(MsgRevoke) returns (MsgRevokeResponse);

// GovMint defines a gov mint coins to the treasury.
rpc GovMint(MsgGovMint) returns (MsgGovMintResponse);
}

// MsgFundTreasury represents a message to fund the treasury.
// MsgUpdateParams is the Msg/UpdateParams request type.
message MsgUpdateParams {
// authority is the address of the operator account.
string authority = 1;

// params defines the x/foundation parameters to update.
//
// NOTE: All parameters must be supplied.
Params params = 2 [(gogoproto.nullable) = false];
}

// MsgUpdateParamsResponse is the Msg/UpdateParams response type.
message MsgUpdateParamsResponse {}

// MsgFundTreasury is the Msg/FundTreasury request type.
message MsgFundTreasury {
string from = 1;
repeated cosmos.base.v1beta1.Coin amount = 2
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/line/lbm-sdk/types.Coins"];
}

// MsgFundTreasuryResponse defines the Msg/FundTreasury response type.
// MsgFundTreasuryResponse is the Msg/FundTreasury response type.
message MsgFundTreasuryResponse {}

// MsgWithdrawFromTreasury represents a message to withdraw coins from the treasury.
// MsgWithdrawFromTreasury is the Msg/WithdrawFromTreasury request type.
message MsgWithdrawFromTreasury {
string operator = 1;
string to = 2;
repeated cosmos.base.v1beta1.Coin amount = 3
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/line/lbm-sdk/types.Coins"];
}

// MsgWithdrawFromTreasuryResponse defines the Msg/WithdrawFromTreasury response type.
// MsgWithdrawFromTreasuryResponse is the Msg/WithdrawFromTreasury response type.
message MsgWithdrawFromTreasuryResponse {}

// MsgUpdateMembers is the Msg/UpdateMembers request type.
Expand Down Expand Up @@ -193,7 +211,7 @@ message MsgLeaveFoundation {
// MsgLeaveFoundationResponse is the Msg/LeaveFoundation response type.
message MsgLeaveFoundationResponse {}

// MsgGrant is a request type for Grant method. It declares authorization to the grantee
// MsgGrant is the Msg/Grant request type.
// on behalf of the foundation.
message MsgGrant {
string operator = 1;
Expand All @@ -203,26 +221,25 @@ message MsgGrant {
[(cosmos_proto.accepts_interface) = "github.com/line/lbm-sdk/x/foundation.Authorization"];
}

// MsgGrantResponse defines the Msg/MsgGrant response type.
// MsgGrantResponse is the Msg/MsgGrant response type.
message MsgGrantResponse {}

// MsgRevoke revokes any authorization with the provided sdk.Msg type
// to the grantee on behalf of the foundation.
// MsgRevoke is the Msg/Revoke request type.
message MsgRevoke {
string operator = 1;
string grantee = 2;
string msg_type_url = 3;
}

// MsgRevokeResponse defines the Msg/MsgRevokeResponse response type.
// MsgRevokeResponse is the Msg/MsgRevokeResponse response type.
message MsgRevokeResponse {}

// MsgGovMint represents a message to mint coins to the treasury.
// MsgGovMint is the Msg/GovMint request type.
message MsgGovMint {
string operator = 1;
repeated cosmos.base.v1beta1.Coin amount = 2
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/line/lbm-sdk/types.Coins"];
}

// MsgGovMintResponse defines the Msg/GovMint response type.
// MsgGovMintResponse is the Msg/GovMint response type.
message MsgGovMintResponse {}
Loading

0 comments on commit 392277a

Please sign in to comment.