Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions docs/static/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79879,9 +79879,11 @@ definitions:
MsgUpdateParamsResponse defines the Msg/UpdateParams response type.

Since: cosmos-sdk 0.47
side.btcbridge.MsgWithdrawResponse:
side.btcbridge.MsgWithdrawToBitcoinResponse:
type: object
description: MsgWithdrawResponse defines the Msg/Withdraw response type.
description: >-
MsgWithdrawToBitcoinResponse defines the Msg/WithdrawToBitcoin response
type.
side.btcbridge.Params:
type: object
properties:
Expand Down
12 changes: 6 additions & 6 deletions proto/side/btcbridge/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ service Msg {
rpc SubmitDepositTransaction (MsgSubmitDepositTransaction) returns (MsgSubmitDepositTransactionResponse);
// SubmitWithdrawalTransaction submits bitcoin transaction to the side chain.
rpc SubmitWithdrawTransaction (MsgSubmitWithdrawTransaction) returns (MsgSubmitWithdrawTransactionResponse);
// Withdraw withdraws the asset from the side chain.
rpc Withdraw (MsgWithdraw) returns (MsgWithdrawResponse);
// WithdrawToBitcoin withdraws the asset to bitcoin.
rpc WithdrawToBitcoin (MsgWithdrawToBitcoin) returns (MsgWithdrawToBitcoinResponse);
// SubmitWithdrawStatus submits the status of the withdraw transaction.
rpc SubmitWithdrawStatus (MsgSubmitWithdrawStatus) returns (MsgSubmitWithdrawStatusResponse);
// UpdateParams defines a governance operation for updating the x/btcbridge module
Expand Down Expand Up @@ -80,15 +80,15 @@ message MsgSubmitWithdrawTransaction {
message MsgSubmitWithdrawTransactionResponse {
}

// MsgWithdraw defines the Msg/Withdraw request type.
message MsgWithdraw {
// MsgWithdrawToBitcoin defines the Msg/WithdrawToBitcoin request type.
message MsgWithdrawToBitcoin {
string sender = 1;
// withdraw amount in satoshi, etc: 100000000sat = 1btc
string amount = 2;
}

// MsgWithdrawResponse defines the Msg/Withdraw response type.
message MsgWithdrawResponse {
// MsgWithdrawToBitcoinResponse defines the Msg/WithdrawToBitcoin response type.
message MsgWithdrawToBitcoinResponse {
}

// MsgUpdateParams is the Msg/UpdateParams request type.
Expand Down
8 changes: 4 additions & 4 deletions x/btcbridge/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func GetTxCmd() *cobra.Command {
}

cmd.AddCommand(CmdSubmitBlocks())
cmd.AddCommand(CmdWithdraw())
cmd.AddCommand(CmdWithdrawToBitcoin())

return cmd
}
Expand Down Expand Up @@ -73,8 +73,8 @@ func CmdSubmitBlocks() *cobra.Command {
return cmd
}

// Withdraw
func CmdWithdraw() *cobra.Command {
// Withdraw To Bitcoin
func CmdWithdrawToBitcoin() *cobra.Command {
cmd := &cobra.Command{
Use: "withdraw [amount]",
Short: "Withdraw asset to the given sender",
Expand All @@ -90,7 +90,7 @@ func CmdWithdraw() *cobra.Command {
return fmt.Errorf("invalid amount")
}

msg := types.NewMsgWithdraw(
msg := types.NewMsgWithdrawToBitcoin(
clientCtx.GetFromAddress().String(),
args[0],
)
Expand Down
4 changes: 2 additions & 2 deletions x/btcbridge/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func (m msgServer) SubmitWithdrawTransaction(goCtx context.Context, msg *types.M
return &types.MsgSubmitWithdrawTransactionResponse{}, nil
}

func (m msgServer) Withdraw(goCtx context.Context, msg *types.MsgWithdraw) (*types.MsgWithdrawResponse, error) {
func (m msgServer) WithdrawToBitcoin(goCtx context.Context, msg *types.MsgWithdrawToBitcoin) (*types.MsgWithdrawToBitcoinResponse, error) {
if err := msg.ValidateBasic(); err != nil {
return nil, err
}
Expand Down Expand Up @@ -151,7 +151,7 @@ func (m msgServer) Withdraw(goCtx context.Context, msg *types.MsgWithdraw) (*typ
sdk.NewAttribute("amount", msg.Amount),
)

return &types.MsgWithdrawResponse{}, nil
return &types.MsgWithdrawToBitcoinResponse{}, nil
}

func (m msgServer) SubmitWithdrawStatus(goCtx context.Context, msg *types.MsgSubmitWithdrawStatus) (*types.MsgSubmitWithdrawStatusResponse, error) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,40 +5,40 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
)

const TypeMsgWithdraw = "withdraw"
const TypeMsgWithdrawToBitcoin = "withdraw_to_bitcoin"

func NewMsgWithdraw(
func NewMsgWithdrawToBitcoin(
sender string,
amount string,
) *MsgWithdraw {
return &MsgWithdraw{
) *MsgWithdrawToBitcoin {
return &MsgWithdrawToBitcoin{
Sender: sender,
Amount: amount,
}
}

func (msg *MsgWithdraw) Route() string {
func (msg *MsgWithdrawToBitcoin) Route() string {
return RouterKey
}

func (msg *MsgWithdraw) Type() string {
return TypeMsgWithdraw
func (msg *MsgWithdrawToBitcoin) Type() string {
return TypeMsgWithdrawToBitcoin
}

func (msg *MsgWithdraw) GetSigners() []sdk.AccAddress {
func (msg *MsgWithdrawToBitcoin) GetSigners() []sdk.AccAddress {
Sender, err := sdk.AccAddressFromBech32(msg.Sender)
if err != nil {
panic(err)
}
return []sdk.AccAddress{Sender}
}

func (msg *MsgWithdraw) GetSignBytes() []byte {
func (msg *MsgWithdrawToBitcoin) GetSignBytes() []byte {
bz := ModuleCdc.MustMarshalJSON(msg)
return sdk.MustSortJSON(bz)
}

func (msg *MsgWithdraw) ValidateBasic() error {
func (msg *MsgWithdrawToBitcoin) ValidateBasic() error {
_, err := sdk.AccAddressFromBech32(msg.Sender)
if err != nil {
return sdkerrors.Wrapf(err, "invalid Sender address (%s)", err)
Expand Down
Loading