Skip to content

Commit

Permalink
withdrawal api
Browse files Browse the repository at this point in the history
  • Loading branch information
trajan0x committed Jun 29, 2024
1 parent a17db24 commit 484a9a3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
13 changes: 7 additions & 6 deletions services/rfq/relayer/relapi/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package relapi
import (
"encoding/json"
"fmt"
"github.com/ethereum/go-ethereum/accounts/abi"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/core/types"
"github.com/synapsecns/sanguine/ethergo/submitter"
Expand Down Expand Up @@ -171,12 +172,12 @@ func (h *Handler) Withdraw(c *gin.Context) {

if chain.IsGasToken(req.TokenAddress) {

Check failure on line 173 in services/rfq/relayer/relapi/handler.go

View workflow job for this annotation

GitHub Actions / Lint (services/rfq)

`if chain.IsGasToken(req.TokenAddress)` has complex nested blocks (complexity: 5) (nestif)
nonce, err = h.submitter.SubmitTransaction(c, big.NewInt(int64(req.ChainID)), func(transactor *bind.TransactOpts) (tx *types.Transaction, err error) {
tx = types.NewTx(&types.LegacyTx{
// covers l2s, etc
Gas: 500_000,
To: &req.To,
Value: value,
})
bc := bind.NewBoundContract(req.To, abi.ABI{}, h.chains[req.ChainID].Client, h.chains[req.ChainID].Client, h.chains[req.ChainID].Client)
if transactor.GasPrice != nil {
transactor.Value = value
// nolint: wrapcheck
return bc.Transfer(transactor)
}

return transactor.Signer(h.submitter.Address(), tx)

Check failure on line 182 in services/rfq/relayer/relapi/handler.go

View workflow job for this annotation

GitHub Actions / Lint (services/rfq)

error returned from external package is unwrapped: sig: field Signer github.com/ethereum/go-ethereum/accounts/abi/bind.SignerFn (wrapcheck)

Check warning on line 182 in services/rfq/relayer/relapi/handler.go

View check run for this annotation

Codecov / codecov/patch

services/rfq/relayer/relapi/handler.go#L182

Added line #L182 was not covered by tests
})
Expand Down
2 changes: 2 additions & 0 deletions services/rfq/relayer/relapi/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ func (c *RelayerClientSuite) TestEthWithdraw() {

return nil
})
c.Require().NoError(err)
}

func (c *RelayerClientSuite) TestERC20Withdraw() {
Expand Down Expand Up @@ -271,4 +272,5 @@ func (c *RelayerClientSuite) TestERC20Withdraw() {

return nil
})
c.Require().NoError(err)
}

0 comments on commit 484a9a3

Please sign in to comment.