diff --git a/config/aave.ts b/config/aave.ts index 3c8923c2..526af196 100644 --- a/config/aave.ts +++ b/config/aave.ts @@ -15,7 +15,7 @@ export const AaveConfig: IAaveConfiguration = { ReserveSymbols: [ 'WETH', 'DAI', - 'LEND', + 'AAVE', 'TUSD', 'BAT', 'USDC', @@ -97,7 +97,7 @@ export const AaveConfig: IAaveConfiguration = { stableBorrowRateEnabled: false, reserveDecimals: '18', }, - LEND: { + AAVE: { baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(), variableRateSlope1: new BigNumber(0.08).multipliedBy(oneRay).toFixed(), variableRateSlope2: new BigNumber(0.5).multipliedBy(oneRay).toFixed(), @@ -264,7 +264,7 @@ export const AaveConfig: IAaveConfiguration = { USDC: '0xe22da380ee6B445bb8273C81944ADEB6E8450422', USDT: '0x13512979ADE267AB5100878E2e0f485B568328a4', SUSD: '0xD868790F57B39C9B2B51b12de046975f986675f9', - LEND: '0x690eAcA024935Aaff9B14b9FF9e9C8757a281f3C', + AAVE: '0xB597cd8D3217ea6477232F9217fa70837ff667Af', BAT: '0x2d12186Fbb9f9a8C28B3FfdD4c42920f8539D738', REP: '0x260071C8D61DAf730758f8BD0d6370353956AE0E', MKR: '0x61e4CAE3DA7FD189e52a4879C7B8067D7C2Cc0FA', @@ -283,7 +283,7 @@ export const AaveConfig: IAaveConfiguration = { USDC: '0x851dEf71f0e6A903375C1e536Bd9ff1684BAD802', USDT: '0xB404c51BBC10dcBE948077F18a4B8E553D160084', SUSD: '0xc374eB17f665914c714Ac4cdC8AF3a3474228cc5', - LEND: '0xB47F338EC1e3857BB188E63569aeBAB036EE67c6', + AAVE: '', BAT: '0x85B24b3517E3aC7bf72a14516160541A60cFF19d', REP: '0xBeb13523503d35F9b3708ca577CdCCAdbFB236bD', MKR: '0x2eA9df3bABe04451c9C3B06a2c844587c59d9C37', @@ -302,7 +302,7 @@ export const AaveConfig: IAaveConfiguration = { USDC: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', USDT: '0xdac17f958d2ee523a2206206994597c13d831ec7', SUSD: '0x57ab1ec28d129707052df4df418d58a2d46d5f51', - LEND: '0x80fB784B7eD66730e8b1DBd9820aFD29931aab03', + AAVE: '0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9', BAT: '0x0d8775f648430679a709e98d2b0cb6250d2887ef', REP: '0x1985365e9f78359a9B6AD760e32412f4a445E862', MKR: '0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2', diff --git a/config/commons.ts b/config/commons.ts index 71c60c66..210d4af8 100644 --- a/config/commons.ts +++ b/config/commons.ts @@ -6,7 +6,7 @@ const MOCK_CHAINLINK_AGGREGATORS_PRICES = { DAI: oneEther.multipliedBy('0.00369068412860').toFixed(), TUSD: oneEther.multipliedBy('0.00364714136416').toFixed(), USDC: oneEther.multipliedBy('0.00367714136416').toFixed(), - LEND: oneEther.multipliedBy('0.00003620948469').toFixed(), + AAVE: oneEther.multipliedBy('0.003620948469').toFixed(), BAT: oneEther.multipliedBy('0.00137893825230').toFixed(), USDT: oneEther.multipliedBy('0.00369068412860').toFixed(), SUSD: oneEther.multipliedBy('0.00364714136416').toFixed(), @@ -83,7 +83,7 @@ export const CommonsConfig: ICommonConfiguration = { BAT: { borrowRate: oneRay.multipliedBy(0.03).toFixed(), }, - LEND: { + AAVE: { borrowRate: oneRay.multipliedBy(0.03).toFixed(), }, LINK: { @@ -171,7 +171,7 @@ export const CommonsConfig: ICommonConfiguration = { USDC: '0x672c1C0d1130912D83664011E7960a42E8cA05D5', USDT: '0xCC833A6522721B3252e7578c5BCAF65738B75Fc3', SUSD: '0xa353F8b083F7575cfec443b5ad585D42f652E9F7', - LEND: '0xdce38940264dfbc01ad1486c21764948e511947e', + AAVE: '0xd04647B7CB523bb9f26730E9B6dE1174db7591Ad', BAT: '0x2c8d01771CCDca47c103194C5860dbEA2fE61626', REP: '0x09F4A94F44c29d4967C761bBdB89f5bD3E2c09E6', MKR: '0x14D7714eC44F44ECD0098B39e642b246fB2c38D0', @@ -196,7 +196,7 @@ export const CommonsConfig: ICommonConfiguration = { USDC: '0xe1480303dde539e2c241bdc527649f37c9cbef7d', USDT: '0xc08fe0c4d97ccda6b40649c6da621761b628c288', SUSD: '0xe054b4aee7ac7645642dd52f1c892ff0128c98f0', - LEND: '0xf7b4834fe443d1E04D757b4b089b35F5A90F2847', + AAVE: '', BAT: '0xafd8186c962daf599f171b8600f3e19af7b52c92', REP: '0xa949ee9ba80c0f381481f2eab538bc5547a5ac67', MKR: '0x811B1f727F8F4aE899774B568d2e72916D91F392', @@ -221,7 +221,7 @@ export const CommonsConfig: ICommonConfiguration = { USDC: '0xdE54467873c3BCAA76421061036053e371721708', USDT: '0xa874fe207DF445ff19E7482C746C4D3fD0CB9AcE', SUSD: '0x6d626Ff97f0E89F6f983dE425dc5B24A18DE26Ea', - LEND: '0x1EeaF25f2ECbcAf204ECADc8Db7B0db9DA845327', + AAVE: '0x6Df09E975c830ECae5bd4eD9d90f3A95a4f88012', BAT: '0x9b4e2579895efa2b4765063310Dc4109a7641129', REP: '0xb8b513d9cf440C1b6f5C7142120d611C94fC220c', MKR: '0xda3d675d50ff6c555973c4f0424964e1f6a4e7d3', diff --git a/deployed-contracts.json b/deployed-contracts.json index a2173231..5e232bff 100644 --- a/deployed-contracts.json +++ b/deployed-contracts.json @@ -163,26 +163,25 @@ }, "ReserveLogic": { "buidlerevm": { - "address": "0x78Ee8Fb9fE5abD5e347Fc94c2fb85596d1f60e3c", + "address": "0xFAe0fd738dAbc8a0426F47437322b6d026A9FD95", "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" } }, "GenericLogic": { "buidlerevm": { - "address": "0x920d847fE49E54C19047ba8bc236C45A8068Bca7", + "address": "0x6082731fdAba4761277Fb31299ebC782AD3bCf24", "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" } }, "ValidationLogic": { "buidlerevm": { - "address": "0xA4765Ff72A9F3CfE73089bb2c3a41B838DF71574", + "address": "0x8456161947DFc1fC159A0B26c025cD2b4bba0c3e", "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" } }, "LendingPool": { "buidlerevm": { - "address": "0x35c1419Da7cf0Ff885B8Ef8EA9242FEF6800c99b", - "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" + "address": "0xD9273d497eDBC967F39d419461CfcF382a0A822e" } }, "LendingPoolConfigurator": { @@ -198,7 +197,7 @@ }, "ATokensAndRatesHelper": { "buidlerevm": { - "address": "0x920d847fE49E54C19047ba8bc236C45A8068Bca7", + "address": "0x06bA8d8af0dF898D0712DffFb0f862cC51AF45c2", "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" } }, @@ -265,5 +264,11 @@ "address": "0x920d847fE49E54C19047ba8bc236C45A8068Bca7", "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" } + }, + "AAVE": { + "buidlerevm": { + "address": "0x8858eeB3DfffA017D4BCE9801D340D36Cf895CCf", + "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" + } } -} +} \ No newline at end of file diff --git a/helpers/types.ts b/helpers/types.ts index 7c4da1f4..45fbfa12 100644 --- a/helpers/types.ts +++ b/helpers/types.ts @@ -171,7 +171,7 @@ export interface iAssetBase { USDC: T; USDT: T; SUSD: T; - LEND: T; + AAVE: T; BAT: T; REP: T; MKR: T; @@ -204,7 +204,7 @@ export type iAavePoolAssets = Pick< | 'USDC' | 'USDT' | 'SUSD' - | 'LEND' + | 'AAVE' | 'BAT' | 'REP' | 'MKR' @@ -245,7 +245,7 @@ export type iAssetAggregatorBase = iAssetsWithoutETH; export enum TokenContractId { DAI = 'DAI', - LEND = 'LEND', + AAVE = 'AAVE', TUSD = 'TUSD', BAT = 'BAT', WETH = 'WETH', diff --git a/package.json b/package.json index 931b1186..3b7c82bb 100644 --- a/package.json +++ b/package.json @@ -34,6 +34,7 @@ "uniswap:main:full:migration": "npm run buidler:main -- uniswap:full --verify", "test-repay-with-collateral": "buidler test test/__setup.spec.ts test/repay-with-collateral.spec.ts", "test-liquidate-with-collateral": "buidler test test/__setup.spec.ts test/flash-liquidation-with-collateral.spec.ts", + "test-liquidate-underlying": "buidler test test/__setup.spec.ts test/liquidation-underlying.spec.ts", "test-transfers": "buidler test test/__setup.spec.ts test/atoken-transfer.spec.ts", "test-flash": "buidler test test/__setup.spec.ts test/flashloan.spec.ts", "test-liquidate": "buidler test test/__setup.spec.ts test/liquidation-atoken.spec.ts", diff --git a/test/__setup.spec.ts b/test/__setup.spec.ts index 4e6f24f8..c77abb47 100644 --- a/test/__setup.spec.ts +++ b/test/__setup.spec.ts @@ -136,7 +136,7 @@ const buildTestEnv = async (deployer: Signer, secondaryWallet: Signer) => { USDC: mockTokens.USDC.address, USDT: mockTokens.USDT.address, SUSD: mockTokens.SUSD.address, - LEND: mockTokens.LEND.address, + AAVE: mockTokens.AAVE.address, BAT: mockTokens.BAT.address, REP: mockTokens.REP.address, MKR: mockTokens.MKR.address, diff --git a/test/helpers/make-suite.ts b/test/helpers/make-suite.ts index 62eb1e39..07a7532a 100644 --- a/test/helpers/make-suite.ts +++ b/test/helpers/make-suite.ts @@ -44,7 +44,7 @@ export interface TestEnv { dai: MintableERC20; aDai: AToken; usdc: MintableERC20; - lend: MintableERC20; + aave: MintableERC20; addressesProvider: LendingPoolAddressesProvider; registry: LendingPoolAddressesProviderRegistry; } @@ -68,7 +68,7 @@ const testEnv: TestEnv = { dai: {} as MintableERC20, aDai: {} as AToken, usdc: {} as MintableERC20, - lend: {} as MintableERC20, + aave: {} as MintableERC20, addressesProvider: {} as LendingPoolAddressesProvider, registry: {} as LendingPoolAddressesProviderRegistry, } as TestEnv; @@ -107,14 +107,14 @@ export async function initializeMakeSuite() { const daiAddress = reservesTokens.find((token) => token.symbol === 'DAI')?.tokenAddress; const usdcAddress = reservesTokens.find((token) => token.symbol === 'USDC')?.tokenAddress; - const lendAddress = reservesTokens.find((token) => token.symbol === 'LEND')?.tokenAddress; + const aaveAddress = reservesTokens.find((token) => token.symbol === 'AAVE')?.tokenAddress; const wethAddress = reservesTokens.find((token) => token.symbol === 'WETH')?.tokenAddress; if (!aDaiAddress || !aWEthAddress) { console.log(`atoken-modifiers.spec: aTokens not correctly initialized`); process.exit(1); } - if (!daiAddress || !usdcAddress || !lendAddress || !wethAddress) { + if (!daiAddress || !usdcAddress || !aaveAddress || !wethAddress) { console.log(`atoken-modifiers.spec: USDC or DAI not correctly initialized`); process.exit(1); } @@ -124,7 +124,7 @@ export async function initializeMakeSuite() { testEnv.dai = await getMintableErc20(daiAddress); testEnv.usdc = await getMintableErc20(usdcAddress); - testEnv.lend = await getMintableErc20(lendAddress); + testEnv.aave = await getMintableErc20(aaveAddress); testEnv.weth = await getMintableErc20(wethAddress); } diff --git a/test/helpers/scenarios/set-use-as-collateral.json b/test/helpers/scenarios/set-use-as-collateral.json index 871a78b9..e38e8438 100644 --- a/test/helpers/scenarios/set-use-as-collateral.json +++ b/test/helpers/scenarios/set-use-as-collateral.json @@ -136,13 +136,13 @@ ] }, { - "description": "User 1 Deposits 1000 LEND, disables WETH as collateral. Should revert as 1000 LEND are not enough to cover the debt (revert expected)", + "description": "User 1 Deposits 1000 AAVE, disables WETH as collateral. Should revert as 1000 AAVE are not enough to cover the debt (revert expected)", "actions": [ { "name": "mint", "args": { - "reserve": "LEND", - "amount": "1000", + "reserve": "AAVE", + "amount": "10", "user": "1" }, "expected": "success" @@ -150,7 +150,7 @@ { "name": "approve", "args": { - "reserve": "LEND", + "reserve": "AAVE", "user": "1" }, "expected": "success" @@ -158,9 +158,9 @@ { "name": "deposit", "args": { - "reserve": "LEND", + "reserve": "AAVE", - "amount": "1000", + "amount": "10", "user": "1" }, "expected": "success" @@ -178,13 +178,13 @@ ] }, { - "description": "User 1 Deposits 64000 more LEND (enough to cover the DAI debt), disables WETH as collateral", + "description": "User 1 Deposits 640 more AAVE (enough to cover the DAI debt), disables WETH as collateral", "actions": [ { "name": "mint", "args": { - "reserve": "LEND", - "amount": "64000", + "reserve": "AAVE", + "amount": "640", "user": "1" }, "expected": "success" @@ -192,9 +192,9 @@ { "name": "deposit", "args": { - "reserve": "LEND", + "reserve": "AAVE", - "amount": "64000", + "amount": "640", "user": "1" }, "expected": "success" @@ -212,12 +212,12 @@ ] }, { - "description": "User 1 disables LEND as collateral (revert expected)", + "description": "User 1 disables AAVE as collateral (revert expected)", "actions": [ { "name": "setUseAsCollateral", "args": { - "reserve": "LEND", + "reserve": "AAVE", "user": "1", "useAsCollateral": "false" diff --git a/test/liquidation-underlying.spec.ts b/test/liquidation-underlying.spec.ts index 1bba749d..3a735e79 100644 --- a/test/liquidation-underlying.spec.ts +++ b/test/liquidation-underlying.spec.ts @@ -380,25 +380,25 @@ makeSuite('LendingPool liquidation - liquidator receiving the underlying asset', ); }); - it('User 4 deposits 1000 LEND - drops HF, liquidates the LEND, which results on a lower amount being liquidated', async () => { - const {lend, usdc, users, pool, oracle, helpersContract} = testEnv; + it('User 4 deposits 10 AAVE - drops HF, liquidates the AAVE, which results on a lower amount being liquidated', async () => { + const {aave, usdc, users, pool, oracle, helpersContract} = testEnv; const depositor = users[3]; const borrower = users[4]; const liquidator = users[5]; - //mints LEND to borrower - await lend.connect(borrower.signer).mint(await convertToCurrencyDecimals(lend.address, '1000')); + //mints AAVE to borrower + await aave.connect(borrower.signer).mint(await convertToCurrencyDecimals(aave.address, '10')); //approve protocol to access the borrower wallet - await lend.connect(borrower.signer).approve(pool.address, APPROVAL_AMOUNT_LENDING_POOL); + await aave.connect(borrower.signer).approve(pool.address, APPROVAL_AMOUNT_LENDING_POOL); - //borrower deposits 1000 LEND - const amountLENDtoDeposit = await convertToCurrencyDecimals(lend.address, '1000'); + //borrower deposits 10 AAVE + const amountToDeposit = await convertToCurrencyDecimals(aave.address, '10'); await pool .connect(borrower.signer) - .deposit(lend.address, amountLENDtoDeposit, borrower.address, '0'); + .deposit(aave.address, amountToDeposit, borrower.address, '0'); const usdcPrice = await oracle.getAssetPrice(usdc.address); //drops HF below 1 @@ -421,19 +421,19 @@ makeSuite('LendingPool liquidation - liquidator receiving the underlying asset', ); const usdcReserveDataBefore = await helpersContract.getReserveData(usdc.address); - const lendReserveDataBefore = await helpersContract.getReserveData(lend.address); + const aaveReserveDataBefore = await helpersContract.getReserveData(aave.address); const amountToLiquidate = new BigNumber(userReserveDataBefore.currentStableDebt.toString()) .div(2) .decimalPlaces(0, BigNumber.ROUND_DOWN) .toFixed(0); - const collateralPrice = await oracle.getAssetPrice(lend.address); + const collateralPrice = await oracle.getAssetPrice(aave.address); const principalPrice = await oracle.getAssetPrice(usdc.address); await pool .connect(liquidator.signer) - .liquidationCall(lend.address, usdc.address, borrower.address, amountToLiquidate, false); + .liquidationCall(aave.address, usdc.address, borrower.address, amountToLiquidate, false); const userReserveDataAfter = await helpersContract.getUserReserveData( usdc.address, @@ -443,17 +443,17 @@ makeSuite('LendingPool liquidation - liquidator receiving the underlying asset', const userGlobalDataAfter = await pool.getUserAccountData(borrower.address); const usdcReserveDataAfter = await helpersContract.getReserveData(usdc.address); - const lendReserveDataAfter = await helpersContract.getReserveData(lend.address); + const aaveReserveDataAfter = await helpersContract.getReserveData(aave.address); - const lendConfiguration = await helpersContract.getReserveConfigurationData(lend.address); - const collateralDecimals = lendConfiguration.decimals.toString(); - const liquidationBonus = lendConfiguration.liquidationBonus.toString(); + const aaveConfiguration = await helpersContract.getReserveConfigurationData(aave.address); + const collateralDecimals = aaveConfiguration.decimals.toString(); + const liquidationBonus = aaveConfiguration.liquidationBonus.toString(); const principalDecimals = ( await helpersContract.getReserveConfigurationData(usdc.address) ).decimals.toString(); - const expectedCollateralLiquidated = oneEther.multipliedBy('1000'); + const expectedCollateralLiquidated = oneEther.multipliedBy('10'); const expectedPrincipal = new BigNumber(collateralPrice.toString()) .times(expectedCollateralLiquidated) @@ -484,8 +484,8 @@ makeSuite('LendingPool liquidation - liquidator receiving the underlying asset', 'Invalid principal available liquidity' ); - expect(lendReserveDataAfter.availableLiquidity.toString()).to.be.bignumber.almostEqual( - new BigNumber(lendReserveDataBefore.availableLiquidity.toString()) + expect(aaveReserveDataAfter.availableLiquidity.toString()).to.be.bignumber.almostEqual( + new BigNumber(aaveReserveDataBefore.availableLiquidity.toString()) .minus(expectedCollateralLiquidated) .toFixed(0), 'Invalid collateral available liquidity' diff --git a/test/pausable-functions.spec.ts b/test/pausable-functions.spec.ts index 9c7f6473..633065e5 100644 --- a/test/pausable-functions.spec.ts +++ b/test/pausable-functions.spec.ts @@ -274,7 +274,7 @@ makeSuite('Pausable Pool', (testEnv: TestEnv) => { await configurator.setPoolPause(true); // Do liquidation - expect( + await expect( pool.liquidationCall(weth.address, usdc.address, borrower.address, amountToLiquidate, true) ).revertedWith(LP_IS_PAUSED); diff --git a/test/token-distributor.spec.ts b/test/token-distributor.spec.ts index fc8c822b..b4fabc19 100644 --- a/test/token-distributor.spec.ts +++ b/test/token-distributor.spec.ts @@ -126,7 +126,7 @@ // .toFixed() // ); // } else { -// // 1 ether received from "burning" DAI and 264 LEND wei received from the 34% of the 777 LEND amount sent to the token distributor +// // 1 ether received from "burning" DAI and 264 AAVE wei received from the 34% of the 777 AAVE amount sent to the token distributor // expect(recipientBurnBalanceAfter).to.be.equal('1000000000000000264'); // } // } @@ -177,7 +177,7 @@ // new BigNumber(ethBalancesBefore.receivers[index]).plus(ethAmountToReceiver).toFixed() // ); // } else { -// // 1 ether received from "burning" DAI, 1 ether from ETH and 264 LEND wei received from the 34% of the 777 LEND amount sent to the token distributor +// // 1 ether received from "burning" DAI, 1 ether from ETH and 264 AAVE wei received from the 34% of the 777 AAVE amount sent to the token distributor // expect(recipientBurnBalanceAfter).to.be.equal('2000000000000000264'); // } // } @@ -248,9 +248,9 @@ // // ); // // }); -// // it('Mints and transfers LEND to the TokenDistributor', async () => { +// // it('Mints and transfers AAVE to the TokenDistributor', async () => { // // await testAndExecMintAndTransferTokens( -// // _tokenInstances.LEND, +// // _tokenInstances.AAVE, // // _lendDistributionParams.amountToDistribute, // // _depositorAddress, // // _tokenDistributorInstance.address @@ -259,8 +259,8 @@ // // it('distribute() for the receivers', async () => { // // await testAndExecDistributeToken( -// // [_tokenInstances.DAI, _tokenInstances.LEND], -// // _tokenInstances.LEND, +// // [_tokenInstances.DAI, _tokenInstances.AAVE], +// // _tokenInstances.AAVE, // // _tokenDistributorInstance, // // [_daiDistributionParams, _lendDistributionParams] // // ); @@ -269,7 +269,7 @@ // // it('Distributes the ETH to the receivers', async () => { // // await testAndExecDistributeEth( // // _tokenDistributorInstance, -// // _tokenInstances.LEND, +// // _tokenInstances.AAVE, // // _ethDistributionParams, // // _web3 // // );