mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
removed buidler task
This commit is contained in:
parent
9530dd115d
commit
a3e1ae3268
|
@ -28,7 +28,7 @@ const MNEMONICS: {[network: string]: string} = {
|
||||||
|
|
||||||
// Prevent to load scripts before compilation and typechain
|
// Prevent to load scripts before compilation and typechain
|
||||||
if (!SKIP_LOAD) {
|
if (!SKIP_LOAD) {
|
||||||
['misc', 'migrations', 'dev', 'full', 'scenarios'].forEach((folder) => {
|
['misc', 'migrations', 'dev', 'full'].forEach((folder) => {
|
||||||
const tasksPath = path.join(__dirname, 'tasks', folder);
|
const tasksPath = path.join(__dirname, 'tasks', folder);
|
||||||
fs.readdirSync(tasksPath)
|
fs.readdirSync(tasksPath)
|
||||||
.filter((pth) => pth.includes('.ts'))
|
.filter((pth) => pth.includes('.ts'))
|
||||||
|
|
|
@ -14,8 +14,6 @@
|
||||||
"types-gen": "typechain --target ethers-v5 --outDir ./types './artifacts/*.json'",
|
"types-gen": "typechain --target ethers-v5 --outDir ./types './artifacts/*.json'",
|
||||||
"test": "buidler test",
|
"test": "buidler test",
|
||||||
"test-scenarios": "buidler test test/__setup.spec.ts test/scenario.spec.ts",
|
"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:dev:migration": "buidler aave:dev",
|
||||||
"aave:evm:full:migration": "buidler aave:full",
|
"aave:evm:full:migration": "buidler aave:full",
|
||||||
"aave:docker:dev:migration": "npm run buidler:docker -- aave:dev",
|
"aave:docker:dev:migration": "npm run buidler:docker -- aave:dev",
|
||||||
|
|
|
@ -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);
|
|
||||||
});
|
|
Loading…
Reference in New Issue
Block a user