Skip to content

Commit

Permalink
approve again
Browse files Browse the repository at this point in the history
  • Loading branch information
AnieeG committed Jul 3, 2024
1 parent 8e64de0 commit 95119d0
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions integration-tests/ccip-tests/actions/ccip_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -397,16 +397,9 @@ func (ccipModule *CCIPCommon) ApproveTokens() error {
}
}

allowance, err := token.Allowance(ccipModule.ChainClient.GetDefaultWallet().Address(), ccipModule.Router.Address())
err := token.Approve(ccipModule.ChainClient.GetDefaultWallet(), ccipModule.Router.Address(), ApprovedAmountToRouter)
if err != nil {
return fmt.Errorf("failed to get allowance for token %s: %w", token.ContractAddress.Hex(), err)
}
if allowance.Cmp(ApprovedAmountToRouter) < 0 {
allowanceApprovalDelta := new(big.Int).Sub(ApprovedAmountToRouter, allowance)
err := token.Approve(ccipModule.ChainClient.GetDefaultWallet(), ccipModule.Router.Address(), allowanceApprovalDelta)
if err != nil {
return fmt.Errorf("failed to approve token %s: %w", token.ContractAddress.Hex(), err)
}
return fmt.Errorf("failed to approve token %s: %w", token.ContractAddress.Hex(), err)
}
if token.ContractAddress == ccipModule.FeeToken.EthAddress {
isApproved = true
Expand Down

0 comments on commit 95119d0

Please sign in to comment.