Skip to content

Commit

Permalink
fix(opbot): use submitter get tx status [SLT-158] (#3134)
Browse files Browse the repository at this point in the history
* use experimental logger to debug

* fix lint

* [goreleaser]

* use submitter instead of client

* [goreleaser]

* [goreleaser]
  • Loading branch information
golangisfun123 authored Sep 23, 2024
1 parent faf9387 commit 8c702c7
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions contrib/opbot/botmd/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"github.com/synapsecns/sanguine/core/retry"
"github.com/synapsecns/sanguine/ethergo/chaindata"
"github.com/synapsecns/sanguine/ethergo/client"
"github.com/synapsecns/sanguine/ethergo/submitter"
rfqClient "github.com/synapsecns/sanguine/services/rfq/api/client"
"github.com/synapsecns/sanguine/services/rfq/contracts/fastbridge"
"github.com/synapsecns/sanguine/services/rfq/relayer/relapi"
Expand Down Expand Up @@ -347,17 +348,12 @@ func (b *Bot) rfqRefund() *slacker.CommandDefinition {
return
}

var txHash *relapi.TxHashByNonceResponse
var status submitter.SubmissionStatus

Check warning on line 351 in contrib/opbot/botmd/commands.go

View check run for this annotation

Codecov / codecov/patch

contrib/opbot/botmd/commands.go#L351

Added line #L351 was not covered by tests
err = retry.WithBackoff(
ctx.Context(),
func(ctx context.Context) error {
txHash, err = relClient.GetTxHashByNonce(
ctx,
&relapi.GetTxByNonceRequest{
ChainID: rawRequest.OriginChainID,
Nonce: nonce,
})
if err != nil {
status, err = b.submitter.GetSubmissionStatus(ctx, big.NewInt(int64(rawRequest.OriginChainID)), nonce)
if err != nil || !status.HasTx() {

Check warning on line 356 in contrib/opbot/botmd/commands.go

View check run for this annotation

Codecov / codecov/patch

contrib/opbot/botmd/commands.go#L355-L356

Added lines #L355 - L356 were not covered by tests
b.logger.Errorf(ctx, "error fetching quote request: %v", err)
return fmt.Errorf("error fetching quote request: %w", err)
}
Expand All @@ -373,7 +369,7 @@ func (b *Bot) rfqRefund() *slacker.CommandDefinition {
return
}

_, err = ctx.Response().Reply(fmt.Sprintf("refund submitted: %s", toExplorerSlackLink(txHash.Hash)))
_, err = ctx.Response().Reply(fmt.Sprintf("refund submitted: %s", toExplorerSlackLink(status.TxHash().String())))

Check warning on line 372 in contrib/opbot/botmd/commands.go

View check run for this annotation

Codecov / codecov/patch

contrib/opbot/botmd/commands.go#L372

Added line #L372 was not covered by tests
if err != nil {
log.Println(err)
}
Expand Down

0 comments on commit 8c702c7

Please sign in to comment.