Skip to content

Commit

Permalink
refactor: CustomGetSigners for MsgSwapOrder
Browse files Browse the repository at this point in the history
  • Loading branch information
poorphd committed Jul 3, 2024
1 parent 868b183 commit 61f8492
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ import (
ibctesting "github.com/cosmos/ibc-go/v8/testing"
ibctestingtypes "github.com/cosmos/ibc-go/v8/testing/types"

coinswapv1 "github.com/Canto-Network/Canto/v7/api/canto/coinswap/v1"
erc20v1 "github.com/Canto-Network/Canto/v7/api/canto/erc20/v1"
evmv1 "github.com/evmos/ethermint/api/ethermint/evm/v1"
ethante "github.com/evmos/ethermint/app/ante"
Expand Down Expand Up @@ -314,6 +315,7 @@ func NewCanto(
// evm/MsgEthereumTx, erc20/MsgConvertERC20
signingOptions.DefineCustomGetSigners(protov2.MessageName(&evmv1.MsgEthereumTx{}), evmtypes.GetSignersFromMsgEthereumTxV2)
signingOptions.DefineCustomGetSigners(protov2.MessageName(&erc20v1.MsgConvertERC20{}), erc20types.GetSignersFromMsgConvertERC20V2)
signingOptions.DefineCustomGetSigners(protov2.MessageName(&coinswapv1.MsgSwapOrder{}), coinswaptypes.GetSignersFromMsgSwapOrderV2)

interfaceRegistry, _ := types.NewInterfaceRegistryWithOptions(types.InterfaceRegistryOptions{
ProtoFiles: proto.HybridResolver,
Expand Down
14 changes: 14 additions & 0 deletions x/coinswap/types/msgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ package types

import (
sdkmath "cosmossdk.io/math"
coinswapv1 "github.com/Canto-Network/Canto/v7/api/canto/coinswap/v1"
sdk "github.com/cosmos/cosmos-sdk/types"
protov2 "google.golang.org/protobuf/proto"
)

var (
Expand Down Expand Up @@ -72,3 +74,15 @@ func NewMsgRemoveLiquidity(
Sender: sender,
}
}

func GetSignersFromMsgSwapOrderV2(msg protov2.Message) ([][]byte, error) {
msgv2, ok := msg.(*coinswapv1.MsgSwapOrder)
if !ok {
return nil, nil
}

signers := [][]byte{}
signers = append(signers, []byte(msgv2.Input.Address))

return signers, nil
}

0 comments on commit 61f8492

Please sign in to comment.