Skip to content

Commit

Permalink
fix: revert reduntant method
Browse files Browse the repository at this point in the history
  • Loading branch information
notanatol committed Mar 11, 2024
1 parent e98efa8 commit e70abdd
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 39 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/beekeeper.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,6 @@ jobs:
- name: Test pingpong
id: pingpong
run: timeout ${TIMEOUT} bash -c 'until beekeeper check --cluster-name local-dns --checks ci-pingpong; do echo "waiting for pingpong..."; sleep .3; done'
- name: Test withdraw
id: withdraw
run: timeout ${TIMEOUT} bash -c 'until beekeeper check --cluster-name local-dns --checks ci-withdraw; do echo "waiting for withdraw..."; sleep .3; done'
- name: Test fullconnectivity
id: fullconnectivity
run: timeout ${TIMEOUT} bash -c 'until beekeeper check --cluster-name local-dns --checks=ci-full-connectivity; do echo "waiting for full connectivity..."; sleep .3; done'
Expand Down Expand Up @@ -165,6 +162,9 @@ jobs:
- name: Test staking
id: stake
run: timeout ${TIMEOUT} beekeeper check --cluster-name local-dns --checks ci-stake
- name: Test withdraw
id: withdraw
run: timeout ${TIMEOUT} bash -c 'until beekeeper check --cluster-name local-dns --checks ci-withdraw; do echo "waiting for withdraw..."; sleep .3; done'
- name: Test redundancy
id: redundancy
run: timeout ${TIMEOUT} beekeeper check --cluster-name local-dns --checks ci-redundancy
Expand Down
8 changes: 4 additions & 4 deletions pkg/api/wallet.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ type walletResponse struct {
WalletAddress common.Address `json:"walletAddress"` // the address of the bee wallet
}

type walletTxResponse struct {
TransactionHash common.Hash `json:"transactionHash"`
}

func (s *Service) walletHandler(w http.ResponseWriter, r *http.Request) {
logger := s.logger.WithName("get_wallet").Build()

Expand Down Expand Up @@ -59,6 +55,10 @@ func (s *Service) walletHandler(w http.ResponseWriter, r *http.Request) {
})
}

type walletTxResponse struct {
TransactionHash common.Hash `json:"transactionHash"`
}

func (s *Service) walletWithdrawHandler(w http.ResponseWriter, r *http.Request) {
logger := s.logger.WithName("post_wallet_withdraw").Build()

Expand Down
24 changes: 0 additions & 24 deletions pkg/settlement/swap/erc20/erc20.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ var (
type Service interface {
BalanceOf(ctx context.Context, address common.Address) (*big.Int, error)
Transfer(ctx context.Context, address common.Address, value *big.Int) (common.Hash, error)
Withdraw(ctx context.Context, address common.Address, value *big.Int) (common.Hash, error)
}

type erc20Service struct {
Expand Down Expand Up @@ -92,26 +91,3 @@ func (c *erc20Service) Transfer(ctx context.Context, address common.Address, val

return txHash, nil
}

func (c *erc20Service) Withdraw(ctx context.Context, address common.Address, value *big.Int) (common.Hash, error) {
callData, err := erc20ABI.Pack("transfer", c.address, value)
if err != nil {
return common.Hash{}, err
}

request := &transaction.TxRequest{
To: &address,
Data: callData,
GasPrice: sctx.GetGasPrice(ctx),
GasLimit: sctx.GetGasLimitWithDefault(ctx, 300_000),
Value: big.NewInt(0),
Description: "token withdrawal",
}

txHash, err := c.transactionService.Send(ctx, request, transaction.DefaultTipBoostPercent)
if err != nil {
return common.Hash{}, err
}

return txHash, nil
}
8 changes: 0 additions & 8 deletions pkg/settlement/swap/erc20/mock/erc20.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (
type Service struct {
balanceOfFunc func(ctx context.Context, address common.Address) (*big.Int, error)
transferFunc func(ctx context.Context, address common.Address, value *big.Int) (common.Hash, error)
withdrawFunc func(ctx context.Context, address common.Address, value *big.Int) (common.Hash, error)
}

func WithBalanceOfFunc(f func(ctx context.Context, address common.Address) (*big.Int, error)) Option {
Expand Down Expand Up @@ -53,13 +52,6 @@ func (s *Service) Transfer(ctx context.Context, address common.Address, value *b
return common.Hash{}, errors.New("Error")
}

func (s *Service) Withdraw(ctx context.Context, address common.Address, value *big.Int) (common.Hash, error) {
if s.transferFunc != nil {
return s.withdrawFunc(ctx, address, value)
}
return common.Hash{}, errors.New("Error")
}

// Option is the option passed to the mock Chequebook service
type Option interface {
apply(*Service)
Expand Down

0 comments on commit e70abdd

Please sign in to comment.