diff --git a/.circleci/config.yml b/.circleci/config.yml index 650736c9..089a422c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -384,11 +384,11 @@ workflows: - e2e: name: e2e-base dir: '8453-andromeda' - parallelism: 2 + parallelism: 3 - e2e: name: e2e-arbitrum dir: '42161-main' - parallelism: 2 + parallelism: 3 - e2e: name: e2e-mainnet dir: '1-main' diff --git a/liquidity/components/RepayModal/RepayModal.tsx b/liquidity/components/RepayModal/RepayModal.tsx index 0ec73895..bd1eceff 100644 --- a/liquidity/components/RepayModal/RepayModal.tsx +++ b/liquidity/components/RepayModal/RepayModal.tsx @@ -40,16 +40,11 @@ export function RepayModal({ onClose }: { onClose: () => void }) { const { data: systemToken } = useSystemToken(); const { data: systemTokenBalance } = useTokenBalance(systemToken?.address); - const availableCollateral = - systemTokenBalance && liquidityPosition - ? systemTokenBalance.add(liquidityPosition.availableSystemToken) - : undefined; - const { exec: execRepay, settle: settleRepay } = useRepay({ accountId: params.accountId, collateralTypeAddress: collateralType?.tokenAddress, debtChange, - availableUSDCollateral: availableCollateral, + availableUSDCollateral: liquidityPosition ? liquidityPosition.availableSystemToken : undefined, balance: systemTokenBalance, }); @@ -57,7 +52,7 @@ export function RepayModal({ onClose }: { onClose: () => void }) { accountId: params.accountId, collateralTypeAddress: collateralType?.tokenAddress, debtChange, - availableUSDCollateral: availableCollateral, + availableUSDCollateral: liquidityPosition ? liquidityPosition.availableSystemToken : undefined, }); const toast = useToast({ isClosable: true, duration: 9000 }); @@ -66,7 +61,9 @@ export function RepayModal({ onClose }: { onClose: () => void }) { const { data: SpotMarketProxy } = useSpotMarketProxy(); const errorParser = useContractErrorParser(); - const amountToDeposit = debtChange.abs().sub(availableCollateral || 0); + const amountToDeposit = debtChange + .abs() + .sub(liquidityPosition ? liquidityPosition.availableSystemToken : 0); const { data: synthTokens } = useSynthTokens(); const wrapperToken = React.useMemo(() => { diff --git a/liquidity/cypress/cypress/e2e/42161-main/USDC_Repay.e2e.js b/liquidity/cypress/cypress/e2e/42161-main/USDC_Repay.e2e.js index 84d95e83..9ec67480 100644 --- a/liquidity/cypress/cypress/e2e/42161-main/USDC_Repay.e2e.js +++ b/liquidity/cypress/cypress/e2e/42161-main/USDC_Repay.e2e.js @@ -10,7 +10,7 @@ describe(__filename, () => { cy.task('startAnvil', { chainId: Cypress.env('chainId'), forkUrl: `https://arbitrum-mainnet.infura.io/v3/${Cypress.env('INFURA_KEY')}`, - block: '271813668', + block: '285187379', }).then(() => cy.log('Anvil started')); cy.on('window:before:load', (win) => { @@ -24,10 +24,6 @@ describe(__filename, () => { afterEach(() => cy.task('stopAnvil').then(() => cy.log('Anvil stopped'))); it(__filename, () => { - cy.setEthBalance({ balance: 100 }); - cy.borrowUsd({ symbol: 'USDC', amount: 10, poolId: 1 }); - cy.getSystemToken({ amount: 500 }); - cy.visit( `?${makeSearch({ page: 'position', @@ -42,7 +38,7 @@ describe(__filename, () => { .should('exist') .and('include.text', 'Max'); - cy.get('[data-cy="repay amount input"]').type('5'); + cy.contains('[data-cy="current debt amount"] span', 'Max').click(); cy.get('[data-cy="repay submit"]').should('be.enabled'); cy.get('[data-cy="repay submit"]').click(); @@ -52,7 +48,7 @@ describe(__filename, () => { .and('include.text', 'Manage Debt') .and('include.text', 'Approve USDx transfer') .and('include.text', 'Repay') - .and('include.text', 'Repay 5 USDx'); + .and('include.text', 'Repay 1.2 USDx'); cy.get('[data-cy="repay confirm button"]').should('include.text', 'Execute Transaction'); cy.get('[data-cy="repay confirm button"]').click(); diff --git a/liquidity/cypress/cypress/e2e/42161-main/WETH_Repay.e2e.js b/liquidity/cypress/cypress/e2e/42161-main/WETH_Repay.e2e.js index 55a43bfc..a5837ce5 100644 --- a/liquidity/cypress/cypress/e2e/42161-main/WETH_Repay.e2e.js +++ b/liquidity/cypress/cypress/e2e/42161-main/WETH_Repay.e2e.js @@ -3,14 +3,14 @@ import { makeSearch } from '@snx-v3/useParams'; describe(__filename, () => { Cypress.env('chainId', '42161'); Cypress.env('preset', 'main'); - Cypress.env('walletAddress', '0xc3Cf311e04c1f8C74eCF6a795Ae760dc6312F345'); - Cypress.env('accountId', '58655818123'); + Cypress.env('walletAddress', '0xD41908f92e29387bABc3861d76B9504d7F18bF4E'); + Cypress.env('accountId', '557271071589'); beforeEach(() => { cy.task('startAnvil', { chainId: Cypress.env('chainId'), forkUrl: `https://arbitrum-mainnet.infura.io/v3/${Cypress.env('INFURA_KEY')}`, - block: '271813668', + block: '285255179', }).then(() => cy.log('Anvil started')); cy.on('window:before:load', (win) => { @@ -24,13 +24,6 @@ describe(__filename, () => { afterEach(() => cy.task('stopAnvil').then(() => cy.log('Anvil stopped'))); it(__filename, () => { - cy.setEthBalance({ balance: 100 }); - cy.approveCollateral({ symbol: 'WETH', spender: 'CoreProxy' }); - cy.wrapEth({ amount: 20 }); - cy.depositCollateral({ symbol: 'WETH', amount: 10 }); - cy.delegateCollateral({ symbol: 'WETH', amount: 10, poolId: 1 }); - cy.borrowUsd({ symbol: 'WETH', amount: 100, poolId: 1 }); - cy.visit( `?${makeSearch({ page: 'position',