fix: reset USDT logic (#7219)
This commit is contained in:
parent
bb79c73416
commit
3e67982bb4
@ -146,6 +146,26 @@ describe('Permit2', () => {
|
||||
cy.contains('Swap success!')
|
||||
cy.get(getTestSelector('popups')).contains('Swapped')
|
||||
})
|
||||
|
||||
it('swaps USDT with existing permit, and existing and sufficient token approval', () => {
|
||||
cy.hardhat().then(async (hardhat) => {
|
||||
await hardhat.fund(hardhat.wallet, CurrencyAmount.fromRawAmount(USDT, 2e6))
|
||||
await hardhat.mine()
|
||||
await hardhat.approval.setTokenAllowanceForPermit2({ owner: hardhat.wallet, token: USDT }, 1e6)
|
||||
await hardhat.mine()
|
||||
await hardhat.approval.setPermit2Allowance({ owner: hardhat.wallet, token: USDT })
|
||||
await hardhat.mine()
|
||||
})
|
||||
setupInputs(USDT, USDC_MAINNET)
|
||||
cy.get('#swap-currency-input .token-amount-input').clear().type('1')
|
||||
initiateSwap()
|
||||
|
||||
// Verify transaction
|
||||
cy.wait('@eth_sendRawTransaction')
|
||||
cy.hardhat().then((hardhat) => hardhat.mine())
|
||||
cy.contains('Swap success!')
|
||||
cy.get(getTestSelector('popups')).contains('Swapped')
|
||||
})
|
||||
})
|
||||
|
||||
it('swaps when user has already approved token and permit2', () => {
|
||||
|
@ -97,6 +97,7 @@ function useConfirmModalState({
|
||||
// See the `approve` function here: https://etherscan.io/address/0xdAC17F958D2ee523a2206206994597C13D831ec7#code
|
||||
if (
|
||||
allowance.state === AllowanceState.REQUIRED &&
|
||||
allowance.needsSetupApproval &&
|
||||
allowance.token.equals(USDT_MAINNET) &&
|
||||
allowance.allowedAmount.greaterThan(0)
|
||||
) {
|
||||
|
Loading…
Reference in New Issue
Block a user