diff --git a/contrib/opbot/botmd/commands.go b/contrib/opbot/botmd/commands.go index 623431565a..c5466cfe69 100644 --- a/contrib/opbot/botmd/commands.go +++ b/contrib/opbot/botmd/commands.go @@ -21,6 +21,7 @@ import ( "github.com/slack-go/slack" "github.com/slack-io/slacker" "github.com/synapsecns/sanguine/contrib/opbot/signoz" + "github.com/synapsecns/sanguine/core" "github.com/synapsecns/sanguine/core/retry" "github.com/synapsecns/sanguine/ethergo/chaindata" "github.com/synapsecns/sanguine/ethergo/client" @@ -343,8 +344,15 @@ func (b *Bot) rfqRefund() *slacker.CommandDefinition { } return } - - isRelayed, err := fastBridgeContractDest.BridgeRelays(nil, [32]byte(common.Hex2Bytes(rawRequest.TxID))) + txBz, err := core.BytesToArray(common.Hex2Bytes(rawRequest.TxID)) + if err != nil { + _, err := ctx.Response().Reply("error converting tx id") + if err != nil { + log.Println(err) + } + return + } + isRelayed, err := fastBridgeContractDest.BridgeRelays(nil, txBz) if err != nil { _, err := ctx.Response().Reply("error fetching bridge relays") if err != nil { diff --git a/core/bytes.go b/core/bytes.go index ee25375e62..adca7464b3 100644 --- a/core/bytes.go +++ b/core/bytes.go @@ -25,3 +25,11 @@ func BytesToJSONString(bz []byte) (string, error) { return string(formattedJSON), nil } +func BytesToArray(bz []byte) ([32]byte, error) { + var bytes [32]byte + if len(bz) != 32 { + return bytes, fmt.Errorf("invalid length of bytes: %d", len(bz)) + } + copy(bytes[:], bz) + return bytes, nil +}