diff --git a/plugins/airdrop/client/cli/tx.go b/plugins/airdrop/client/cli/tx.go index 23796f1c0..866bab107 100644 --- a/plugins/airdrop/client/cli/tx.go +++ b/plugins/airdrop/client/cli/tx.go @@ -26,7 +26,6 @@ import ( const ( flagAmount = "amount" - flagTokenIndex = "token-index" flagTokenSymbol = "token-symbol" flagRecipient = "recipient" ) @@ -42,10 +41,9 @@ func GetApprovalCmd(cdc *codec.Codec) *cobra.Command { WithAccountDecoder(authcmd.GetAccountDecoder(cdc)) amount := viper.GetInt64(flagAmount) - tokenIndex := viper.GetInt64(flagTokenIndex) tokenSymbol := viper.GetString(flagTokenSymbol) recipient := viper.GetString(flagRecipient) - msg := airdrop.NewAirdropApprovalMsg(uint64(tokenIndex), tokenSymbol, uint64(amount), common.HexToAddress(recipient).Hex()) + msg := airdrop.NewAirdropApprovalMsg(tokenSymbol, uint64(amount), common.HexToAddress(recipient).Hex()) sdkErr := msg.ValidateBasic() if sdkErr != nil { @@ -55,7 +53,6 @@ func GetApprovalCmd(cdc *codec.Codec) *cobra.Command { }, } - cmd.Flags().Int64(flagTokenIndex, 0, "owner token index") cmd.Flags().String(flagTokenSymbol, "", "owner token symbol") cmd.Flags().Int64(flagAmount, 0, "amount of token") cmd.Flags().String(flagRecipient, "", "bsc recipient address") diff --git a/plugins/airdrop/msg.go b/plugins/airdrop/msg.go index b57a78886..4d932da67 100644 --- a/plugins/airdrop/msg.go +++ b/plugins/airdrop/msg.go @@ -16,21 +16,19 @@ const ( var _ sdk.Msg = AirdropApproval{} -func NewAirdropApprovalMsg(tokenIndex uint64, tokenSymbol string, amount uint64, recipient string) AirdropApproval { +func NewAirdropApprovalMsg(tokenSymbol string, amount uint64, recipient string) AirdropApproval { return AirdropApproval{ - TokenIndex: tokenIndex, TokenSymbol: tokenSymbol, Amount: amount, Recipient: recipient, } } -func newAirDropApprovalSignData(tokenIndex uint64, tokenSymbol string, amount uint64, recipient string) airDropApprovalSignData { +func newAirDropApprovalSignData(tokenSymbol string, amount uint64, recipient string) airDropApprovalSignData { var tokenSymbolBytes [32]byte copy(tokenSymbolBytes[:], []byte(tokenSymbol)) return airDropApprovalSignData{ - TokenIndex: hex.EncodeToString(big.NewInt(int64(tokenIndex)).FillBytes(make([]byte, 32))), TokenSymbol: hex.EncodeToString(tokenSymbolBytes[:]), Amount: hex.EncodeToString(big.NewInt(int64(amount)).FillBytes(make([]byte, 32))), Recipient: recipient, @@ -38,14 +36,12 @@ func newAirDropApprovalSignData(tokenIndex uint64, tokenSymbol string, amount ui } type airDropApprovalSignData struct { - TokenIndex string `json:"token_index"` // hex string(32 bytes) TokenSymbol string `json:"token_symbol"` // hex string(32 bytes) Amount string `json:"amount"` // hex string(32 bytes) Recipient string `json:"recipient"` // eth address(20 bytes) } type AirdropApproval struct { - TokenIndex uint64 `json:"token_index"` TokenSymbol string `json:"token_symbol"` Amount uint64 `json:"amount"` Recipient string `json:"recipient"` // eth address @@ -58,7 +54,7 @@ func (msg AirdropApproval) GetInvolvedAddresses() []sdk.AccAddress { // GetSignBytes implements types.Msg. func (msg AirdropApproval) GetSignBytes() []byte { - b, err := json.Marshal(newAirDropApprovalSignData(msg.TokenIndex, msg.TokenSymbol, msg.Amount, msg.Recipient)) + b, err := json.Marshal(newAirDropApprovalSignData(msg.TokenSymbol, msg.Amount, msg.Recipient)) if err != nil { panic(err) }