Skip to content

Commit

Permalink
feat: refactored with repay bundle changes
Browse files Browse the repository at this point in the history
  • Loading branch information
JoaquinBattilana committed Nov 27, 2023
2 parents 564a01f + f807bb0 commit d3fbff5
Show file tree
Hide file tree
Showing 31 changed files with 1,800 additions and 440 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build-test-deploy-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ jobs:
- ethereum
- base
- gho
- gnosis
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/build-test-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ jobs:
- ethereum
- gho
- base
- gnosis
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test-deploy-fork.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ jobs:
- ethereum
- base
- gho
- gnosis
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2

Expand Down
15 changes: 15 additions & 0 deletions cypress/configs/v3-markets/gnosis-v3-smoke.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { defineConfig } from 'cypress';

import { defaultConfig } from '../base.cypress';

const folder = `./cypress/e2e/1-v3-markets/7-gnosis-v3-market/`;

export default defineConfig({
...defaultConfig,
e2e: {
specPattern: [
folder + '0-assets/usdc.gnosis-v3.cy.ts',
folder + '0-assets/sdai.gnosis-v3.cy.ts',
],
},
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
import assets from '../../../../fixtures/assets.json';
import constants from '../../../../fixtures/constans.json';
import { skipState } from '../../../../support/steps/common';
import { configEnvWithTenderlyGnosisFork } from '../../../../support/steps/configuration.steps';
import { borrow, repay, supply, withdraw } from '../../../../support/steps/main.steps';
import { dashboardAssetValuesVerification } from '../../../../support/steps/verification.steps';

const testData = {
depositBaseAmount: {
asset: assets.gnosisV3Market.xDAI,
amount: 9000,
hasApproval: true,
},
testCases: {
borrow: [
{
asset: assets.gnosisV3Market.USDC,
amount: 50,
apyType: constants.borrowAPYType.default,
hasApproval: true,
},
],
deposit: {
asset: assets.gnosisV3Market.USDC,
amount: 10.1,
hasApproval: false,
},
repay: [
{
asset: assets.gnosisV3Market.USDC,
apyType: constants.apyType.variable,
amount: 2,
hasApproval: true,
repayOption: constants.repayType.default,
},
{
asset: assets.gnosisV3Market.USDC,
apyType: constants.apyType.variable,
repayableAsset: assets.gnosisV3Market.aUSDC,
amount: 2,
hasApproval: true,
repayOption: constants.repayType.default,
},
],
withdraw: {
asset: assets.gnosisV3Market.USDC,
isCollateral: true,
amount: 1,
hasApproval: true,
},
},
verifications: {
finalDashboard: [
{
type: constants.dashboardTypes.deposit,
assetName: assets.gnosisV3Market.USDC.shortName,
amount: 7.0,
collateralType: constants.collateralType.isCollateral,
isCollateral: true,
},
{
type: constants.dashboardTypes.borrow,
assetName: assets.gnosisV3Market.USDC.shortName,
amount: 46.0,
apyType: constants.borrowAPYType.variable,
},
],
},
};

describe('USDC INTEGRATION SPEC, GNOSIS V3 MARKET', () => {
const skipTestState = skipState(false);
configEnvWithTenderlyGnosisFork({ v3: true });

supply(testData.depositBaseAmount, skipTestState, true);
testData.testCases.borrow.forEach((borrowCase) => {
borrow(borrowCase, skipTestState, true);
});
supply(testData.testCases.deposit, skipTestState, true);
testData.testCases.repay.forEach((repayCase) => {
repay(repayCase, skipTestState, false);
});
withdraw(testData.testCases.withdraw, skipTestState, false);
dashboardAssetValuesVerification(testData.verifications.finalDashboard, skipTestState);
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
import assets from '../../../../fixtures/assets.json';
import constants from '../../../../fixtures/constans.json';
import { skipState } from '../../../../support/steps/common';
import { configEnvWithTenderlyGnosisFork } from '../../../../support/steps/configuration.steps';
import {
borrow,
changeCollateral,
changeCollateralNegative,
repay,
supply,
withdraw,
} from '../../../../support/steps/main.steps';
import {
borrowsUnavailable,
dashboardAssetValuesVerification,
} from '../../../../support/steps/verification.steps';

const testData = {
testCases: {
deposit: {
asset: assets.gnosisV3Market.xDAI,
amount: 500,
hasApproval: true,
},
collateral: {
switchOff: {
asset: assets.gnosisV3Market.xDAI,
isCollateralType: true,
hasApproval: true,
},
switchOn: {
asset: assets.gnosisV3Market.xDAI,
isCollateralType: false,
hasApproval: true,
},
switchNegative: {
asset: assets.gnosisV3Market.xDAI,
isCollateralType: true,
},
},
borrow: [
{
asset: assets.gnosisV3Market.xDAI,
amount: 100,
apyType: constants.borrowAPYType.default,
hasApproval: false,
},
],
withdraw: [
{
asset: assets.gnosisV3Market.xDAI,
isCollateral: true,
amount: 50,
hasApproval: false,
},
],
repay: [
{
asset: assets.gnosisV3Market.xDAI,
apyType: constants.apyType.variable,
amount: 10,
hasApproval: true,
repayOption: constants.repayType.default,
},
{
asset: assets.gnosisV3Market.xDAI,
apyType: constants.apyType.variable,
repayableAsset: assets.gnosisV3Market.aWXDAI,
amount: 10,
hasApproval: false,
repayOption: constants.repayType.default,
},
],
},
verifications: {
finalDashboard: [
{
type: constants.dashboardTypes.deposit,
assetName: assets.gnosisV3Market.xDAI.shortName,
amount: 450,
collateralType: constants.collateralType.isCollateral,
isCollateral: true,
},
{
type: constants.dashboardTypes.borrow,
assetName: assets.gnosisV3Market.xDAI.shortName,
amount: 90,
apyType: constants.borrowAPYType.variable,
},
],
},
};

describe('xDAI INTEGRATION SPEC, GNOSIS V3 MARKET', () => {
const skipTestState = skipState(false);
configEnvWithTenderlyGnosisFork({ v3: true });

supply(testData.testCases.deposit, skipTestState, true);
describe('Check Collateral switching', () => {
changeCollateral(testData.testCases.collateral.switchOff, skipTestState, false);
borrowsUnavailable(skipTestState);
changeCollateral(testData.testCases.collateral.switchOn, skipTestState, false);
});
testData.testCases.borrow.forEach((borrowCase) => {
borrow(borrowCase, skipTestState, true);
});
changeCollateralNegative(testData.testCases.collateral.switchNegative, skipTestState, false);
testData.testCases.withdraw.forEach((withdrawCase) => {
withdraw(withdrawCase, skipTestState, false);
});
testData.testCases.repay.forEach((repayCase) => {
repay(repayCase, skipTestState, false);
});
dashboardAssetValuesVerification(testData.verifications.finalDashboard, skipTestState);
});
22 changes: 0 additions & 22 deletions cypress/e2e/2-settings/stake-abpt.cy.ts

This file was deleted.

20 changes: 10 additions & 10 deletions cypress/e2e/3-stake-governance/stake.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import { skipState } from '../../support/steps/common';
import { configEnvWithTenderlyMainnetFork } from '../../support/steps/configuration.steps';
import {
activateCooldown,
stake,
reCallCooldown,
claimReward,
reCallCooldown,
reStake,
stake,
} from '../../support/steps/stake.steps';

const testCases = [
Expand All @@ -18,14 +18,14 @@ const testCases = [
tabValue: 'aave',
changeApproval: true,
},
{
asset: assets.staking.ABPT,
amount: 5,
checkAmount: '5.00',
checkAmountFinal: '10.00',
tabValue: 'bpt',
changeApproval: false,
},
// {
// asset: assets.staking.ABPT,
// amount: 5,
// checkAmount: '5.00',
// checkAmountFinal: '10.00',
// tabValue: 'bpt',
// changeApproval: false,
// },
];

testCases.forEach(
Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/4-gho-ethereum/fixtures/gho.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"collateral": false,
"wrapped": false,
"apy": {
"min": 2.13,
"max": 3.05
"min": 3.38,
"max": 4.83
}
}
6 changes: 4 additions & 2 deletions cypress/e2e/5-widgets/switch-tool.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,13 @@ const switchByTool = ({
}).should('be.visible', { timeout: 10000 });
});
it(`Set amount`, () => {
cy.wait(2000); //there is no way to know when real max amount will upload by UI
if (isMaxAmount) {
cy.wait(2000); //there is no way to know when real max amount will upload by UI
cy.get('[data-cy=Modal]').find('button:contains("Max")').click();
} else {
cy.get('[data-cy=Modal] input[aria-label="amount input"]').first().type(amount.toString());
cy.get('[data-cy=Modal] input[aria-label="amount input"]')
.first()
.type(amount.toString(), { force: true });
}
cy.get('[data-cy=Modal]').as('Modal');
cy.get('@Modal').find(`#switch-slippage-selector-button`).click();
Expand Down
26 changes: 26 additions & 0 deletions cypress/fixtures/assets.json
Original file line number Diff line number Diff line change
Expand Up @@ -1055,5 +1055,31 @@
"collateral": true,
"wrapped": false
}
},
"gnosisV3Market": {
"xDAI": {
"fullName": "xDAI",
"shortName": "xDAI",
"collateral": true,
"wrapped": false
},
"aWXDAI": {
"fullName": "aWXDAI",
"shortName": "aWXDAI",
"collateral": true,
"wrapped": false
},
"USDC": {
"fullName": "USDC",
"shortName": "USDC",
"collateral": true,
"wrapped": false
},
"aUSDC": {
"fullName": "aUSDC",
"shortName": "aUSDC",
"collateral": true,
"wrapped": false
}
}
}
4 changes: 4 additions & 0 deletions cypress/support/steps/configuration.steps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,10 @@ export const configEnvWithTenderlyAEthereumV3Fork = createConfigWithTenderlyFork
ChainId.mainnet,
'fork_proto_mainnet_v3'
);
export const configEnvWithTenderlyGnosisFork = createConfigWithTenderlyFork(
ChainId.xdai,
'fork_proto_gnosis_v3'
);
export const configEnvWithTenderlyGoerliGhoFork = createConfigWithTenderlyFork(
ChainId.goerli,
'fork_proto_goerli_gho_v3'
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
"test:coverage": "jest --coverage"
},
"dependencies": {
"@aave/contract-helpers": "1.21.0",
"@aave/math-utils": "^1.21.0",
"@aave/contract-helpers": "1.21.1",
"@aave/math-utils": "1.21.1",
"@bgd-labs/aave-address-book": "^2.10.0",
"@emotion/cache": "11.10.3",
"@emotion/react": "11.10.4",
Expand Down Expand Up @@ -81,7 +81,7 @@
"react-cookie-consent": "^8.0.1",
"react-dom": "latest",
"react-infinite-scroller": "^1.2.6",
"react-markdown": "^8.0.3",
"react-markdown": "^8.0.7",
"react-number-format": "^4.9.1",
"reflect-metadata": "^0.1.13",
"remark-gfm": "^3.0.1",
Expand Down
1 change: 1 addition & 0 deletions public/icons/tokens/fxs.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit d3fbff5

Please sign in to comment.