diff --git a/buidler.config.ts b/buidler.config.ts index f709573c..0b309e90 100644 --- a/buidler.config.ts +++ b/buidler.config.ts @@ -28,7 +28,7 @@ const MNEMONICS: {[network: string]: string} = { // Prevent to load scripts before compilation and typechain if (!SKIP_LOAD) { - ['misc', 'migrations', 'dev', 'full', 'scenarios'].forEach((folder) => { + ['misc', 'migrations', 'dev', 'full'].forEach((folder) => { const tasksPath = path.join(__dirname, 'tasks', folder); fs.readdirSync(tasksPath) .filter((pth) => pth.includes('.ts')) diff --git a/package.json b/package.json index 7eeaa83a..d5d355ca 100644 --- a/package.json +++ b/package.json @@ -14,8 +14,6 @@ "types-gen": "typechain --target ethers-v5 --outDir ./types './artifacts/*.json'", "test": "buidler test", "test-scenarios": "buidler test test/__setup.spec.ts test/scenario.spec.ts", - "aave:evm:dev:scenarios:basicflow": "buidler aave:basicFlow", - "aave:evm:docker:scenarios:basicflow": "npm run buidler:docker aave:basicFlow", "aave:evm:dev:migration": "buidler aave:dev", "aave:evm:full:migration": "buidler aave:full", "aave:docker:dev:migration": "npm run buidler:docker -- aave:dev", diff --git a/tasks/scenarios/basic_flow.ts b/tasks/scenarios/basic_flow.ts deleted file mode 100644 index 4697abfd..00000000 --- a/tasks/scenarios/basic_flow.ts +++ /dev/null @@ -1,66 +0,0 @@ -import {task} from '@nomiclabs/buidler/config'; -import { - getEthersSigners, - getLendingPool, - getMockedTokens, - MockTokenMap, -} from '../../helpers/contracts-helpers'; -import AaveConfig from '../../config/aave'; -import BigNumber from 'bignumber.js'; -import {LendingPool} from '../../types/LendingPool'; -import {ethers} from 'ethers'; - -task('aave:basicFlow', 'Execute protocol basic flow').setAction(async ({verify}, localBRE) => { - await localBRE.run('set-bre'); - - const [, , user1, user2] = await getEthersSigners(); - const user1Address = await user1.getAddress(); - const user2Address = await user2.getAddress(); - - const daiAmount = 10000; - const wethAmount = 1000; - const daiTokenAmount = new BigNumber(daiAmount).times(new BigNumber(10).pow(18)).toFixed(0); - const wethTokenAmount = new BigNumber(wethAmount).times(new BigNumber(10).pow(18)).toFixed(0); - - console.log('Basic Flow started\n'); - // deploy protocol - // await localBRE.run('aave:dev'); - const tokens: MockTokenMap = await getMockedTokens(AaveConfig); - if (!tokens || Object.keys(tokens).length === 0) { - throw new Error('Deploy contracts first'); - } - - // mint reserve tokens to user0 - const DAI = tokens.DAI; - await DAI.connect(user1).mint(daiTokenAmount); - const daiDepositAmount = new BigNumber('10000').times(new BigNumber(10).pow(18)).toFixed(0); - // mint WETH for user2 - const WETH = tokens.WETH; - await WETH.connect(user2).mint(wethTokenAmount); - const wethDepositAmount = new BigNumber('1000').times(new BigNumber(10).pow(18)).toFixed(0); - await WETH.connect(user1).mint(wethTokenAmount); - - // user1 deposits DAI, user2 deposits WETH - const LendingPool: LendingPool = await getLendingPool(); - - await DAI.connect(user1).approve(LendingPool.address, ethers.constants.MaxUint256); - await LendingPool.connect(user1).deposit(DAI.address, daiDepositAmount, user1Address, 0); - await WETH.connect(user2).approve(LendingPool.address, ethers.constants.MaxUint256); - await LendingPool.connect(user2).deposit(WETH.address, wethDepositAmount, user2Address, 0); - - // user1 borrows WETH token at stable rate - const wethBorrowAmount = new BigNumber('10').times(new BigNumber(10).pow(18)).toFixed(0); - await LendingPool.connect(user1).borrow(WETH.address, wethBorrowAmount, 1, 0, user1Address); - - // user1 repays debt - await WETH.connect(user1).approve(LendingPool.address, ethers.constants.MaxUint256); - await LendingPool.connect(user1).repay( - WETH.address, - ethers.constants.MaxUint256, - 1, - user1Address - ); - - // user1 withdraws collateral - await LendingPool.connect(user1).withdraw(DAI.address, ethers.constants.MaxUint256); -});