Skip to content

Commit

Permalink
Merge branch 'release/v1.8.0-lsm' of https://github.com/irisnet/irismod
Browse files Browse the repository at this point in the history
… into feature/add-token-balance
  • Loading branch information
dreamer-zq committed Apr 18, 2024
2 parents be1d6dd + 9cacc3f commit e05a870
Show file tree
Hide file tree
Showing 9 changed files with 316 additions and 316 deletions.
411 changes: 206 additions & 205 deletions api/irismod/token/v1/tx.pulsar.go

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions modules/token/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func GetCmdIssueToken() *cobra.Command {
return err
}

var prompt = "The token issuance transaction will consume extra fee"
prompt := "The token issuance transaction will consume extra fee"

generateOnly, err := cmd.Flags().GetBool(flags.FlagGenerateOnly)
if err != nil {
Expand Down Expand Up @@ -237,16 +237,16 @@ func GetCmdMintToken() *cobra.Command {
}

msg := &v1.MsgMintToken{
Coin: coin,
To: addr,
Owner: owner,
Coin: coin,
Receiver: addr,
Owner: owner,
}

if err := msg.ValidateBasic(); err != nil {
return err
}

var prompt = "The token minting transaction will consume extra fee"
prompt := "The token minting transaction will consume extra fee"

generateOnly, err := cmd.Flags().GetBool(flags.FlagGenerateOnly)
if err != nil {
Expand Down Expand Up @@ -400,9 +400,9 @@ func GetCmdSwapFeeToken() *cobra.Command {
}

msg := &v1.MsgSwapFeeToken{
FeePaid: coin,
Recipient: toAddr,
Sender: sender,
FeePaid: coin,
Receiver: toAddr,
Sender: sender,
}

if err := msg.ValidateBasic(); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion modules/token/keeper/legacy_msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func (m legacyMsgServer) MintToken(goCtx context.Context, msg *v1beta1.MsgMintTo
}
_, err = m.server.MintToken(goCtx, &v1.MsgMintToken{
Coin: coin,
To: msg.To,
Receiver: msg.To,
Owner: msg.Owner,
})
return &v1beta1.MsgMintTokenResponse{}, err
Expand Down
12 changes: 6 additions & 6 deletions modules/token/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ func (m msgServer) MintToken(

var recipient sdk.AccAddress

if len(msg.To) != 0 {
recipient, err = sdk.AccAddressFromBech32(msg.To)
if len(msg.Receiver) != 0 {
recipient, err = sdk.AccAddressFromBech32(msg.Receiver)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -216,13 +216,13 @@ func (m msgServer) SwapFeeToken(
}

var recipient sdk.AccAddress
if len(msg.Recipient) > 0 {
recipient, err = sdk.AccAddressFromBech32(msg.Recipient)
if len(msg.Receiver) > 0 {
recipient, err = sdk.AccAddressFromBech32(msg.Receiver)
if err != nil {
return nil, err
}

if m.k.blockedAddrs[msg.Recipient] {
if m.k.blockedAddrs[msg.Receiver] {
return nil, errorsmod.Wrapf(
sdkerrors.ErrUnauthorized,
"%s is a module account",
Expand All @@ -241,7 +241,7 @@ func (m msgServer) SwapFeeToken(
sdk.NewEvent(
types.EventTypeSwapFeeToken,
sdk.NewAttribute(types.AttributeKeySender, msg.Sender),
sdk.NewAttribute(types.AttributeKeyRecipient, msg.Recipient),
sdk.NewAttribute(types.AttributeKeyRecipient, msg.Receiver),
sdk.NewAttribute(types.AttributeKeyFeePaid, feePaid.String()),
sdk.NewAttribute(types.AttributeKeyFeeGot, feeGot.String()),
),
Expand Down
2 changes: 1 addition & 1 deletion modules/token/simulation/operations.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ func SimulateMintToken(
Denom: token.GetMinUnit(),
Amount: sdkmath.NewIntWithDecimal(100, int(token.GetScale())),
},
To: simToAccount.Address.String(),
Receiver: simToAccount.Address.String(),
Owner: token.GetOwner().String(),
}

Expand Down
8 changes: 4 additions & 4 deletions modules/token/types/v1/msgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,8 @@ func (msg MsgMintToken) ValidateBasic() error {
}

// check the reception
if len(msg.To) > 0 {
if _, err := sdk.AccAddressFromBech32(msg.To); err != nil {
if len(msg.Receiver) > 0 {
if _, err := sdk.AccAddressFromBech32(msg.Receiver); err != nil {
return errorsmod.Wrapf(
sdkerrors.ErrInvalidAddress,
"invalid mint reception address (%s)",
Expand Down Expand Up @@ -328,8 +328,8 @@ func (msg MsgSwapFeeToken) ValidateBasic() error {
return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid sender address (%s)", err)
}

if len(msg.Recipient) != 0 {
if _, err := sdk.AccAddressFromBech32(msg.Recipient); err != nil {
if len(msg.Receiver) != 0 {
if _, err := sdk.AccAddressFromBech32(msg.Receiver); err != nil {
return errorsmod.Wrapf(
sdkerrors.ErrInvalidAddress,
"invalid recipient address (%s)",
Expand Down
6 changes: 3 additions & 3 deletions modules/token/types/v1/msgs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ func TestMsgEditTokenRoute(t *testing.T) {
func TestMsgEditTokenGetSignBytes(t *testing.T) {
mintable := tokentypes.False

var msg = MsgEditToken{
msg := MsgEditToken{
Name: "BTC TOKEN",
Owner: sdk.AccAddress(tmhash.SumTruncated([]byte("owner"))).String(),
Symbol: "btc",
Expand Down Expand Up @@ -193,8 +193,8 @@ func TestMsgMintTokenValidateBasic(t *testing.T) {
Denom: td.minUnit,
Amount: sdkmath.NewIntFromUint64(td.amount),
},
To: td.to,
Owner: td.owner,
Receiver: td.to,
Owner: td.owner,
}
if td.expectPass {
require.Nil(t, msg.ValidateBasic(), "test: %v", td.msg)
Expand Down
171 changes: 85 additions & 86 deletions modules/token/types/v1/tx.pb.go

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions proto/irismod/token/v1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ message MsgMintToken {
option (cosmos.msg.v1.signer) = "owner";

cosmos.base.v1beta1.Coin coin = 1 [ (gogoproto.nullable) = false ];
string to = 2;
string receiver = 2;
string owner = 3 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
}

Expand All @@ -123,7 +123,7 @@ message MsgSwapFeeToken {
option (cosmos.msg.v1.signer) = "sender";

cosmos.base.v1beta1.Coin fee_paid = 1 [ (gogoproto.nullable) = false ];
string recipient = 2;
string receiver = 2;
string sender = 3 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
}

Expand Down

0 comments on commit e05a870

Please sign in to comment.