Skip to content

Commit

Permalink
feat(opbot): add tx hash after refund [SLT-460] (#3375)
Browse files Browse the repository at this point in the history
* add tx hash command

* [goreleaser]

* remove fake key

* add better logging

* fix context

* [goreleaser]
  • Loading branch information
golangisfun123 authored Nov 20, 2024
1 parent f56a2bc commit ff1e9ea
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions contrib/opbot/botmd/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,10 @@ func (b *Bot) rfqRefund() *slacker.CommandDefinition {
})
if err != nil {
log.Printf("error submitting refund: %v\n", err)
_, err := ctx.Response().Reply("error submitting refund")
if err != nil {
log.Println(err)
}
return
}

Expand All @@ -331,17 +335,19 @@ func (b *Bot) rfqRefund() *slacker.CommandDefinition {
if err != nil || !status.HasTx() {
b.logger.Errorf(ctx, "error fetching quote request: %v", err)
return fmt.Errorf("error fetching quote request: %w", err)
} else if !status.HasTx() {
return fmt.Errorf("no transaction hash found yet")
}
return nil
},
retry.WithMaxAttempts(5),
retry.WithMaxAttemptTime(30*time.Second),
retry.WithMaxTotalTime(1*time.Minute),
)

if err != nil {
b.logger.Errorf(ctx.Context(), "error fetching quote request: %v", err)
_, err := ctx.Response().Reply(fmt.Sprintf("refund submitted with nonce %d", nonce))
if err != nil {
log.Println(err)
b.logger.Errorf(ctx.Context(), "error fetching quote request: %v", err)
}
return
}
Expand All @@ -351,6 +357,7 @@ func (b *Bot) rfqRefund() *slacker.CommandDefinition {
if err != nil {
log.Println(err)
}

},
}
}
Expand Down

0 comments on commit ff1e9ea

Please sign in to comment.