Skip to content

Commit 1833a94

Browse files
authored
refactor: replace"vested" terminology with "locked" (#205)
## Description This PR updates the `x/liquidvesting` module to replace the "vested" terminology with "locked" instead. This is to make it clearer that we are representing *vesting* (i.e. not yet vested, still locked) tokens rather than vested (i.e. which have completed the vesting period, unlocked) tokens. Depends-On: #204 <!-- Add a description of the changes that this PR introduces and the files that are the most critical to review. --> --- ### Author Checklist *All items are required. Please add a note to the item if the item is not applicable and please add links to any relevant follow up issues.* I have... - [ ] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] added `!` to the type prefix if API or client breaking change - [ ] targeted the correct branch (see [PR Targeting](https://github.com/milkyway-labs/milkyway/blob/master/CONTRIBUTING.md#pr-targeting)) - [ ] provided a link to the relevant issue or specification - [ ] followed the guidelines for [building modules](https://docs.cosmos.network/v0.44/building-modules/intro.html) - [ ] included the necessary unit and integration [tests](https://github.com/milkyway-labs/milkyway/blob/master/CONTRIBUTING.md#testing) - [ ] added a changelog entry to `CHANGELOG.md` - [ ] included comments for [documenting Go code](https://blog.golang.org/godoc) - [ ] updated the relevant documentation or specification - [ ] reviewed "Files changed" and left comments if necessary - [ ] confirmed all CI checks have passed ### Reviewers Checklist *All items are required. Please add a note if the item is not applicable and please add your handle next to the items reviewed if you only reviewed selected items.* I have... - [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] confirmed `!` in the type prefix if API or client breaking change - [ ] confirmed all author checklist items have been addressed - [ ] reviewed state machine logic - [ ] reviewed API design and naming - [ ] reviewed documentation is accurate - [ ] reviewed tests and test coverage - [ ] manually tested (if applicable)
1 parent 2e14fc1 commit 1833a94

35 files changed

+573
-573
lines changed

Diff for: proto/milkyway/liquidvesting/v1/messages.proto

+24-24
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ option go_package = "github.com/milkyway-labs/milkyway/x/liquidvesting/types";
1414
service Msg {
1515
option (cosmos.msg.v1.service) = true;
1616

17-
// MintVestedRepresentation defines the operation to mint a user's staked
18-
// vested tokens representation that can be used in the liquid vesting module.
19-
rpc MintVestedRepresentation(MsgMintVestedRepresentation)
20-
returns (MsgMintVestedRepresentationResponse);
17+
// MintLockedRepresentation defines the operation to mint a user's staked
18+
// locked tokens representation that can be used in the liquid vesting module.
19+
rpc MintLockedRepresentation(MsgMintLockedRepresentation)
20+
returns (MsgMintLockedRepresentationResponse);
2121

22-
// BurnVestedRepresentation defines the operation to burn a user's staked
23-
// vested tokens representation.
24-
rpc BurnVestedRepresentation(MsgBurnVestedRepresentation)
25-
returns (MsgBurnVestedRepresentationResponse);
22+
// BurnLockedRepresentation defines the operation to burn a user's staked
23+
// locked tokens representation.
24+
rpc BurnLockedRepresentation(MsgBurnLockedRepresentation)
25+
returns (MsgBurnLockedRepresentationResponse);
2626

2727
// WithdrawInsuranceFund defines the operation to withdraw an amount
2828
// of tokens from the user's insurance fund.
@@ -39,13 +39,13 @@ service Msg {
3939
rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse);
4040
}
4141

42-
// MsgMintVestedRepresentation defines the message structure for the
43-
// MintVestedRepresentation gRPC service method. It allows an authorized
44-
// account to mint a user's staked vested tokens representation that can be
42+
// MsgMintLockedRepresentation defines the message structure for the
43+
// MintLockedRepresentation gRPC service method. It allows an authorized
44+
// account to mint a user's staked locked tokens representation that can be
4545
// used in the liquid vesting module.
46-
message MsgMintVestedRepresentation {
46+
message MsgMintLockedRepresentation {
4747
option (cosmos.msg.v1.signer) = "sender";
48-
option (amino.name) = "milkyway/MsgMintVestedRepresentation";
48+
option (amino.name) = "milkyway/MsgMintLockedRepresentation";
4949

5050
// User that want to trigger the tokens mint.
5151
string sender = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
@@ -61,16 +61,16 @@ message MsgMintVestedRepresentation {
6161
];
6262
}
6363

64-
// MsgMintVestedRepresentationResponse is the return value of
65-
// MsgMintVestedRepresentation.
66-
message MsgMintVestedRepresentationResponse {}
64+
// MsgMintLockedRepresentationResponse is the return value of
65+
// MsgMintLockedRepresentation.
66+
message MsgMintLockedRepresentationResponse {}
6767

68-
// MsgBurnVestedRepresentation defines the message structure for the
69-
// BurnVestedRepresentation gRPC service method. It allows an authorized
70-
// account to burn a user's staked vested tokens representation.
71-
message MsgBurnVestedRepresentation {
68+
// MsgBurnLockedRepresentation defines the message structure for the
69+
// BurnLockedRepresentation gRPC service method. It allows an authorized
70+
// account to burn a user's staked locked tokens representation.
71+
message MsgBurnLockedRepresentation {
7272
option (cosmos.msg.v1.signer) = "sender";
73-
option (amino.name) = "milkyway/MsgBurnVestedRepresentation";
73+
option (amino.name) = "milkyway/MsgBurnLockedRepresentation";
7474

7575
// User that want to trigger the tokens burn.
7676
string sender = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
@@ -86,9 +86,9 @@ message MsgBurnVestedRepresentation {
8686
];
8787
}
8888

89-
// MsgBurnVestedRepresentationResponse is the return value of
90-
// MsgBurnVestedRepresentation.
91-
message MsgBurnVestedRepresentationResponse {}
89+
// MsgBurnLockedRepresentationResponse is the return value of
90+
// MsgBurnLockedRepresentation.
91+
message MsgBurnLockedRepresentationResponse {}
9292

9393
// MsgWithdrawInsuranceFund defines the message structure for the
9494
// WithdrawInsuranceFund gRPC service method.

Diff for: proto/milkyway/liquidvesting/v1/models.proto

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ message UserInsuranceFund {
1919
}
2020

2121
// BurnCoins is a struct that contains the information about the coins to burn
22-
// once the unbonding period of the vested representation tokens ends.
22+
// once the unbonding period of the locked representation tokens ends.
2323
message BurnCoins {
2424
option (gogoproto.equal) = false;
2525
option (gogoproto.goproto_getters) = false;

Diff for: proto/milkyway/liquidvesting/v1/params.proto

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,22 @@ option go_package = "github.com/milkyway-labs/milkyway/x/liquidvesting/types";
99
// Params defines the parameters for the module.
1010
message Params {
1111
// This value represents the percentage that needs to be sent to the
12-
// insurance fund in order to restake a certain amount of vested tokens.
12+
// insurance fund in order to restake a certain amount of locked tokens.
1313
// For example, if this value is 2%, a user must send 2 tokens to
14-
// the insurance fund to restake 100 vested tokens
14+
// the insurance fund to restake 100 locked tokens
1515
string insurance_percentage = 1 [
1616
(cosmos_proto.scalar) = "cosmos.Dec",
1717
(gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
1818
(gogoproto.nullable) = false
1919
];
2020

2121
// This value represents the list of users who are authorized to execute the
22-
// MsgBurnVestedRepresentation.
22+
// MsgBurnLockedRepresentation.
2323
repeated string burners = 2
2424
[ (cosmos_proto.scalar) = "cosmos.AddressString" ];
2525

2626
// This value represents the list of users who are authorized to execute the
27-
// MsgMintVestedRepresentation.
27+
// MsgMintLockedRepresentation.
2828
repeated string minters = 3
2929
[ (cosmos_proto.scalar) = "cosmos.AddressString" ];
3030

Diff for: x/liquidvesting/autocli.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -57,21 +57,21 @@ func (a AppModule) AutoCLIOptions() *autocliv1.ModuleOptions {
5757
Service: liquidvestingv1.Msg_ServiceDesc.ServiceName,
5858
RpcCommandOptions: []*autocliv1.RpcCommandOptions{
5959
{
60-
RpcMethod: "MintVestedRepresentation",
61-
Use: "mint-vested-representation [sender] [receiver] [amount]",
62-
Short: "Mint an user's staked vested tokens representation",
63-
Example: fmt.Sprintf(`$ %s tx liquidvesting mint-vested-representation init1... init1... 1000umilk`, version.AppName),
60+
RpcMethod: "MintLockedRepresentation",
61+
Use: "mint-locked-representation [sender] [receiver] [amount]",
62+
Short: "Mint an user's staked locked tokens representation",
63+
Example: fmt.Sprintf(`$ %s tx liquidvesting mint-locked-representation init1... init1... 1000umilk`, version.AppName),
6464
PositionalArgs: []*autocliv1.PositionalArgDescriptor{
6565
{ProtoField: "sender"},
6666
{ProtoField: "receiver"},
6767
{ProtoField: "amount"},
6868
},
6969
},
7070
{
71-
RpcMethod: "BurnVestedRepresentation",
72-
Use: "burn-vested-representation [sender] [user] [amount]",
73-
Short: "Burns an user's staked vested tokens representation",
74-
Example: fmt.Sprintf(`$ %s tx liquidvesting burn-vested-representation init1... init1... 1000vestd/umilk`, version.AppName),
71+
RpcMethod: "BurnLockedRepresentation",
72+
Use: "burn-locked-representation [sender] [user] [amount]",
73+
Short: "Burns an user's staked locked tokens representation",
74+
Example: fmt.Sprintf(`$ %s tx liquidvesting burn-locked-representation init1... init1... 1000vestd/umilk`, version.AppName),
7575
PositionalArgs: []*autocliv1.PositionalArgDescriptor{
7676
{ProtoField: "sender"},
7777
{ProtoField: "user"},

Diff for: x/liquidvesting/keeper/alias_functions.go

+18-18
Original file line numberDiff line numberDiff line change
@@ -20,53 +20,53 @@ func (k *Keeper) GetAllUsersInsuranceFundsEntries(ctx sdk.Context) ([]types.User
2020
return usersInsuranceFundState, err
2121
}
2222

23-
// GetAllUserRestakedVestedRepresentations returns all restaked coins that are vested
23+
// GetAllUserRestakedLockedRepresentations returns all restaked coins that are locked
2424
// representation tokens for the provided user.
25-
func (k *Keeper) GetAllUserRestakedVestedRepresentations(ctx context.Context, userAddress string) (sdk.DecCoins, error) {
25+
func (k *Keeper) GetAllUserRestakedLockedRepresentations(ctx context.Context, userAddress string) (sdk.DecCoins, error) {
2626
restakedCoins, err := k.restakingKeeper.GetAllUserRestakedCoins(ctx, userAddress)
2727
if err != nil {
2828
return nil, err
2929
}
3030

31-
vestedRepresentations := sdk.NewDecCoins()
31+
lockedRepresentations := sdk.NewDecCoins()
3232
for _, coin := range restakedCoins {
33-
if types.IsVestedRepresentationDenom(coin.Denom) {
34-
vestedRepresentations = vestedRepresentations.Add(coin)
33+
if types.IsLockedRepresentationDenom(coin.Denom) {
34+
lockedRepresentations = lockedRepresentations.Add(coin)
3535
}
3636
}
3737

38-
return vestedRepresentations, nil
38+
return lockedRepresentations, nil
3939
}
4040

41-
// GetAllUserUnbondingVestedRepresentations returns all the vested representation
41+
// GetAllUserUnbondingLockedRepresentations returns all the locked representation
4242
// tokens that are currently unbonding for the provided user.
43-
func (k *Keeper) GetAllUserUnbondingVestedRepresentations(ctx context.Context, userAddress string) sdk.Coins {
44-
vestedRepresentations := sdk.NewCoins()
43+
func (k *Keeper) GetAllUserUnbondingLockedRepresentations(ctx context.Context, userAddress string) sdk.Coins {
44+
lockedRepresentations := sdk.NewCoins()
4545

4646
userUndelegations := k.restakingKeeper.GetAllUserUnbondingDelegations(ctx, userAddress)
4747
for _, undelegation := range userUndelegations {
4848
for _, entry := range undelegation.Entries {
4949
for _, coin := range entry.Balance {
50-
if types.IsVestedRepresentationDenom(coin.Denom) {
51-
vestedRepresentations = vestedRepresentations.Add(coin)
50+
if types.IsLockedRepresentationDenom(coin.Denom) {
51+
lockedRepresentations = lockedRepresentations.Add(coin)
5252
}
5353
}
5454
}
5555
}
5656

57-
return vestedRepresentations
57+
return lockedRepresentations
5858
}
5959

60-
// GetAllUserActiveVestedRepresentations gets all the vested representation tokens
60+
// GetAllUserActiveLockedRepresentations gets all the locked representation tokens
6161
// that are restaked or are currently unbonding for the provided user.
62-
func (k *Keeper) GetAllUserActiveVestedRepresentations(ctx context.Context, userAddress string) (sdk.DecCoins, error) {
63-
restakedCoins, err := k.GetAllUserRestakedVestedRepresentations(ctx, userAddress)
62+
func (k *Keeper) GetAllUserActiveLockedRepresentations(ctx context.Context, userAddress string) (sdk.DecCoins, error) {
63+
restakedCoins, err := k.GetAllUserRestakedLockedRepresentations(ctx, userAddress)
6464
if err != nil {
6565
return nil, err
6666
}
6767

68-
// Get the vested representation tokens that are currently unbonding
69-
userUnbondingVestedRepresentations := k.GetAllUserUnbondingVestedRepresentations(ctx, userAddress)
68+
// Get the locked representation tokens that are currently unbonding
69+
userUnbondingLockedRepresentations := k.GetAllUserUnbondingLockedRepresentations(ctx, userAddress)
7070

71-
return restakedCoins.Add(sdk.NewDecCoinsFromCoins(userUnbondingVestedRepresentations...)...), nil
71+
return restakedCoins.Add(sdk.NewDecCoinsFromCoins(userUnbondingLockedRepresentations...)...), nil
7272
}

0 commit comments

Comments
 (0)