mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
WIP test erroring
This commit is contained in:
commit
bb0df73449
|
@ -270,7 +270,7 @@ export const AaveConfig: IAaveConfiguration = {
|
|||
MKR: '0x61e4CAE3DA7FD189e52a4879C7B8067D7C2Cc0FA',
|
||||
LINK: '0xAD5ce863aE3E4E9394Ab43d4ba0D80f419F61789',
|
||||
KNC: '0x3F80c39c0b96A0945f9F0E9f55d8A8891c5671A8',
|
||||
WBTC: '0x3b92f58feD223E2cB1bCe4c286BD97e42f2A12EA',
|
||||
WBTC: '0xD1B98B6607330172f1D991521145A22BCe793277',
|
||||
MANA: '0x738Dc6380157429e957d223e6333Dc385c85Fec7',
|
||||
ZRX: '0xD0d76886cF8D952ca26177EB7CfDf83bad08C00C',
|
||||
SNX: '0x7FDb81B0b8a010dd4FFc57C3fecbf145BA8Bd947',
|
||||
|
|
|
@ -258,4 +258,11 @@ export const CommonsConfig: ICommonConfiguration = {
|
|||
[eEthereumNetwork.ropsten]: '',
|
||||
[eEthereumNetwork.main]: '',
|
||||
},
|
||||
ProxyPriceProvider: {
|
||||
[eEthereumNetwork.coverage]: '',
|
||||
[eEthereumNetwork.buidlerevm]: '',
|
||||
[eEthereumNetwork.kovan]: '0x276C4793F2EE3D5Bf18C5b879529dD4270BA4814',
|
||||
[eEthereumNetwork.ropsten]: '',
|
||||
[eEthereumNetwork.main]: '',
|
||||
},
|
||||
};
|
||||
|
|
|
@ -121,21 +121,19 @@ interface ILendingPool {
|
|||
/**
|
||||
* @dev emitted when a borrower is liquidated
|
||||
* @param collateral the address of the collateral being liquidated
|
||||
* @param reserve the address of the reserve
|
||||
* @param principal the address of the reserve
|
||||
* @param user the address of the user being liquidated
|
||||
* @param purchaseAmount the total amount liquidated
|
||||
* @param liquidatedCollateralAmount the amount of collateral being liquidated
|
||||
* @param accruedBorrowInterest the amount of interest accrued by the borrower since the last action
|
||||
* @param liquidator the address of the liquidator
|
||||
* @param receiveAToken true if the liquidator wants to receive aTokens, false otherwise
|
||||
**/
|
||||
event LiquidationCall(
|
||||
address indexed collateral,
|
||||
address indexed reserve,
|
||||
address indexed principal,
|
||||
address indexed user,
|
||||
uint256 purchaseAmount,
|
||||
uint256 liquidatedCollateralAmount,
|
||||
uint256 accruedBorrowInterest,
|
||||
address liquidator,
|
||||
bool receiveAToken
|
||||
);
|
||||
|
|
|
@ -27,8 +27,8 @@
|
|||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
},
|
||||
"kovan": {
|
||||
"address": "0x20e080B395341B3b617E893c281c7E999C942276",
|
||||
"deployer": "0x85e4A467343c0dc4aDAB74Af84448D9c45D8ae6F"
|
||||
"address": "0xd7e3C4b2CE495066dE1923c268D68A844bD7Ae13",
|
||||
"deployer": "0x6b40a028d2Ab94e5f6d3793F32D326CDf724Bb1D"
|
||||
}
|
||||
},
|
||||
"LendingPoolAddressesProviderRegistry": {
|
||||
|
@ -45,8 +45,8 @@
|
|||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
},
|
||||
"kovan": {
|
||||
"address": "0x00219a2958f758122106Bb8A801AFc1B70897663",
|
||||
"deployer": "0x85e4A467343c0dc4aDAB74Af84448D9c45D8ae6F"
|
||||
"address": "0x83c7A0E78e8eee2108a87d7a6770f22BAcb68b5A",
|
||||
"deployer": "0x6b40a028d2Ab94e5f6d3793F32D326CDf724Bb1D"
|
||||
}
|
||||
},
|
||||
"FeeProvider": {
|
||||
|
@ -76,7 +76,7 @@
|
|||
"address": "0x65e0Cd5B8904A02f2e00BC6f58bf881998D54BDe"
|
||||
},
|
||||
"kovan": {
|
||||
"address": "0x50C9d3aD9399c1EEf6DDeadF8e57fF69994F552e"
|
||||
"address": "0x1339f3c1FfF00D0FD8946187fdC61F0ef0fFe786"
|
||||
}
|
||||
},
|
||||
"LendingPoolDataProvider": {
|
||||
|
@ -92,7 +92,7 @@
|
|||
"address": "0x5d12dDe3286D94E0d85F9D3B01B7099cfA0aBCf1"
|
||||
},
|
||||
"kovan": {
|
||||
"address": "0x6d1e69bB0578699dd955Eefbf23aAC65c0DA5cE7"
|
||||
"address": "0xB43CCfF1148bb5ab2104E2ee68A7c30cDEBb9A9C"
|
||||
}
|
||||
},
|
||||
"PriceOracle": {
|
||||
|
@ -171,6 +171,10 @@
|
|||
"coverage": {
|
||||
"address": "0x626FdE749F9d499d3777320CAf29484B624ab84a",
|
||||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
},
|
||||
"kovan": {
|
||||
"address": "0xc4e3d83AEd3D3c60Cf4b238F634014cE103F6fa1",
|
||||
"deployer": "0x6b40a028d2Ab94e5f6d3793F32D326CDf724Bb1D"
|
||||
}
|
||||
},
|
||||
"LendingPoolLiquidationManager": {
|
||||
|
@ -220,7 +224,7 @@
|
|||
},
|
||||
"MockFlashLoanReceiver": {
|
||||
"buidlerevm": {
|
||||
"address": "0x63387deC8C4a0F17Cf0C27Ea3476F03F6a45d3AE"
|
||||
"address": "0x5Ea694f66BD0CBd08FC7967af01b67Dcef68cC5c"
|
||||
},
|
||||
"localhost": {
|
||||
"address": "0x2B681757d757fbB80cc51c6094cEF5eE75bF55aA"
|
||||
|
@ -231,7 +235,7 @@
|
|||
},
|
||||
"WalletBalanceProvider": {
|
||||
"buidlerevm": {
|
||||
"address": "0x2B681757d757fbB80cc51c6094cEF5eE75bF55aA",
|
||||
"address": "0xd4e934C2749CA8C1618659D02E7B28B074bf4df7",
|
||||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
},
|
||||
"localhost": {
|
||||
|
@ -574,6 +578,10 @@
|
|||
},
|
||||
"coverage": {
|
||||
"address": "0x2cfcA5785261fbC88EFFDd46fCFc04c22525F9e4"
|
||||
},
|
||||
"kovan": {
|
||||
"address": "0xE4566ce19626826360f4faD941418e2849fC3685",
|
||||
"deployer": "0x6b40a028d2Ab94e5f6d3793F32D326CDf724Bb1D"
|
||||
}
|
||||
},
|
||||
"StableDebtToken": {
|
||||
|
@ -588,6 +596,10 @@
|
|||
"coverage": {
|
||||
"address": "0xB660Fdd109a95718cB9d20E3A89EE6cE342aDcB6",
|
||||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
},
|
||||
"kovan": {
|
||||
"address": "0x0043967C1Cf13c4Ff3Bc38109054D5a97C147B4A",
|
||||
"deployer": "0x6b40a028d2Ab94e5f6d3793F32D326CDf724Bb1D"
|
||||
}
|
||||
},
|
||||
"VariableDebtToken": {
|
||||
|
@ -602,6 +614,10 @@
|
|||
"coverage": {
|
||||
"address": "0x830bceA96E56DBC1F8578f75fBaC0AF16B32A07d",
|
||||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
},
|
||||
"kovan": {
|
||||
"address": "0xdF75B68c75c30D177f4Dbd47cBcb5E2E4f3cf8F9",
|
||||
"deployer": "0x6b40a028d2Ab94e5f6d3793F32D326CDf724Bb1D"
|
||||
}
|
||||
},
|
||||
"AToken": {
|
||||
|
@ -616,11 +632,15 @@
|
|||
"coverage": {
|
||||
"address": "0xA0AB1cB92A4AF81f84dCd258155B5c25D247b54E",
|
||||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
},
|
||||
"kovan": {
|
||||
"address": "0x1A23ADa7218e0a66b7368E12E379Ea88d7a68a27",
|
||||
"deployer": "0x6b40a028d2Ab94e5f6d3793F32D326CDf724Bb1D"
|
||||
}
|
||||
},
|
||||
"MockAToken": {
|
||||
"buidlerevm": {
|
||||
"address": "0xBEF0d4b9c089a5883741fC14cbA352055f35DDA2",
|
||||
"address": "0x63387deC8C4a0F17Cf0C27Ea3476F03F6a45d3AE",
|
||||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
},
|
||||
"localhost": {
|
||||
|
@ -648,7 +668,7 @@
|
|||
},
|
||||
"MockStableDebtToken": {
|
||||
"buidlerevm": {
|
||||
"address": "0xDf73fC454FA018051D4a1509e63D11530A59DE10",
|
||||
"address": "0x8280D40C9E9F04229D2435EAad6e0011309ce81B",
|
||||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
},
|
||||
"localhost": {
|
||||
|
@ -662,7 +682,7 @@
|
|||
},
|
||||
"MockVariableDebtToken": {
|
||||
"buidlerevm": {
|
||||
"address": "0x2cfcA5785261fbC88EFFDd46fCFc04c22525F9e4",
|
||||
"address": "0x2B681757d757fbB80cc51c6094cEF5eE75bF55aA",
|
||||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
},
|
||||
"localhost": {
|
||||
|
@ -676,7 +696,7 @@
|
|||
},
|
||||
"MockSwapAdapter": {
|
||||
"buidlerevm": {
|
||||
"address": "0x8280D40C9E9F04229D2435EAad6e0011309ce81B"
|
||||
"address": "0x93bB79570dFECC052e36E25cE10793A139e75f1b"
|
||||
},
|
||||
"coverage": {
|
||||
"address": "0xBEF0d4b9c089a5883741fC14cbA352055f35DDA2"
|
||||
|
@ -684,5 +704,39 @@
|
|||
"localhost": {
|
||||
"address": "0xBEF0d4b9c089a5883741fC14cbA352055f35DDA2"
|
||||
}
|
||||
},
|
||||
"MockFlashRepayAdapter": {
|
||||
"buidlerevm": {
|
||||
"address": "0xDf73fC454FA018051D4a1509e63D11530A59DE10"
|
||||
}
|
||||
},
|
||||
"MockFlashLiquiditySwapAdapter": {
|
||||
"buidlerevm": {
|
||||
"address": "0x2cfcA5785261fbC88EFFDd46fCFc04c22525F9e4"
|
||||
}
|
||||
},
|
||||
"ReserveLogic": {
|
||||
"buidlerevm": {
|
||||
"address": "0xFAe0fd738dAbc8a0426F47437322b6d026A9FD95",
|
||||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
}
|
||||
},
|
||||
"GenericLogic": {
|
||||
"buidlerevm": {
|
||||
"address": "0x6082731fdAba4761277Fb31299ebC782AD3bCf24",
|
||||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
}
|
||||
},
|
||||
"ValidationLogic": {
|
||||
"buidlerevm": {
|
||||
"address": "0x8456161947DFc1fC159A0B26c025cD2b4bba0c3e",
|
||||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
}
|
||||
},
|
||||
"LendingPoolCollateralManager": {
|
||||
"buidlerevm": {
|
||||
"address": "0xb2B548BE73010C188C083c510d255Aed74843b05",
|
||||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,6 +42,9 @@ import {
|
|||
WalletBalanceProviderFactory,
|
||||
} from '../types';
|
||||
import {withSaveAndVerify, registerContractInJsonDb, linkBytecode} from './contracts-helpers';
|
||||
import {verifyContract} from './etherscan-verification';
|
||||
import {LendingPool} from '../types/LendingPool';
|
||||
import {Artifact} from '@nomiclabs/buidler/types';
|
||||
|
||||
export const deployLendingPoolAddressesProvider = async (verify?: boolean) =>
|
||||
withSaveAndVerify(
|
||||
|
@ -75,14 +78,25 @@ export const deployReserveLogicLibrary = async (verify?: boolean) =>
|
|||
verify
|
||||
);
|
||||
|
||||
export const deployGenericLogic = async (verify?: boolean) =>
|
||||
withSaveAndVerify(
|
||||
await new GenericLogicFactory(await getFirstSigner()).deploy(),
|
||||
eContractid.GenericLogic,
|
||||
[],
|
||||
verify
|
||||
export const deployGenericLogic = async (reserveLogic: Contract, verify?: boolean) => {
|
||||
const genericLogicArtifact = await readArtifact(
|
||||
BRE.config.paths.artifacts,
|
||||
eContractid.GenericLogic
|
||||
);
|
||||
|
||||
const linkedGenericLogicByteCode = linkBytecode(genericLogicArtifact, {
|
||||
[eContractid.ReserveLogic]: reserveLogic.address,
|
||||
});
|
||||
|
||||
const genericLogicFactory = await BRE.ethers.getContractFactory(
|
||||
genericLogicArtifact.abi,
|
||||
linkedGenericLogicByteCode
|
||||
);
|
||||
|
||||
const genericLogic = await (await genericLogicFactory.deploy()).deployed();
|
||||
return withSaveAndVerify(genericLogic, eContractid.GenericLogic, [], verify);
|
||||
};
|
||||
|
||||
export const deployValidationLogic = async (
|
||||
reserveLogic: Contract,
|
||||
genericLogic: Contract,
|
||||
|
@ -112,7 +126,7 @@ export const deployAaveLibraries = async (
|
|||
verify?: boolean
|
||||
): Promise<LendingPoolLibraryAddresses> => {
|
||||
const reserveLogic = await deployReserveLogicLibrary(verify);
|
||||
const genericLogic = await deployGenericLogic(verify);
|
||||
const genericLogic = await deployGenericLogic(reserveLogic, verify);
|
||||
const validationLogic = await deployValidationLogic(reserveLogic, genericLogic, verify);
|
||||
|
||||
// Hardcoded solidity placeholders, if any library changes path this will fail.
|
||||
|
@ -133,7 +147,7 @@ export const deployAaveLibraries = async (
|
|||
};
|
||||
};
|
||||
|
||||
export const deployLendingPool = async (verify?: boolean) => {
|
||||
export const deployLendingPoolWithFactory = async (verify?: boolean) => {
|
||||
const libraries = await deployAaveLibraries(verify);
|
||||
return withSaveAndVerify(
|
||||
await new LendingPoolFactory(libraries, await getFirstSigner()).deploy(),
|
||||
|
@ -143,6 +157,74 @@ export const deployLendingPool = async (verify?: boolean) => {
|
|||
);
|
||||
};
|
||||
|
||||
const deployLibrary = async (libraryId: eContractid) => {
|
||||
const factory = await BRE.ethers.getContractFactory(libraryId);
|
||||
const library = await factory.deploy();
|
||||
await library.deployed();
|
||||
|
||||
return library;
|
||||
};
|
||||
|
||||
export const linkLibrariesToArtifact = async (artifact: Artifact) => {
|
||||
const reserveLogic = await deployLibrary(eContractid.ReserveLogic);
|
||||
|
||||
const genericLogicArtifact = await readArtifact(
|
||||
BRE.config.paths.artifacts,
|
||||
eContractid.GenericLogic
|
||||
);
|
||||
|
||||
const linkedGenericLogicByteCode = linkBytecode(genericLogicArtifact, {
|
||||
[eContractid.ReserveLogic]: reserveLogic.address,
|
||||
});
|
||||
|
||||
const genericLogicFactory = await BRE.ethers.getContractFactory(
|
||||
genericLogicArtifact.abi,
|
||||
linkedGenericLogicByteCode
|
||||
);
|
||||
|
||||
const genericLogic = await (await genericLogicFactory.deploy()).deployed();
|
||||
|
||||
const validationLogicArtifact = await readArtifact(
|
||||
BRE.config.paths.artifacts,
|
||||
eContractid.ValidationLogic
|
||||
);
|
||||
|
||||
const linkedValidationLogicByteCode = linkBytecode(validationLogicArtifact, {
|
||||
[eContractid.ReserveLogic]: reserveLogic.address,
|
||||
[eContractid.GenericLogic]: genericLogic.address,
|
||||
});
|
||||
|
||||
const validationLogicFactory = await BRE.ethers.getContractFactory(
|
||||
validationLogicArtifact.abi,
|
||||
linkedValidationLogicByteCode
|
||||
);
|
||||
|
||||
const validationLogic = await (await validationLogicFactory.deploy()).deployed();
|
||||
|
||||
const linkedBytecode = linkBytecode(artifact, {
|
||||
[eContractid.ReserveLogic]: reserveLogic.address,
|
||||
[eContractid.GenericLogic]: genericLogic.address,
|
||||
[eContractid.ValidationLogic]: validationLogic.address,
|
||||
});
|
||||
const factory = await BRE.ethers.getContractFactory(artifact.abi, linkedBytecode);
|
||||
|
||||
return factory;
|
||||
};
|
||||
|
||||
export const deployLendingPool = async (verify?: boolean) => {
|
||||
const lendingPoolArtifact = await readArtifact(
|
||||
BRE.config.paths.artifacts,
|
||||
eContractid.LendingPool
|
||||
);
|
||||
const factory = await linkLibrariesToArtifact(lendingPoolArtifact);
|
||||
const lendingPool = await factory.deploy();
|
||||
const instance = (await lendingPool.deployed()) as LendingPool;
|
||||
if (verify) {
|
||||
await verifyContract(eContractid.LendingPool, instance.address, []);
|
||||
}
|
||||
return instance;
|
||||
};
|
||||
|
||||
export const deployPriceOracle = async (verify?: boolean) =>
|
||||
withSaveAndVerify(
|
||||
await new PriceOracleFactory(await getFirstSigner()).deploy(),
|
||||
|
@ -180,6 +262,7 @@ export const deployChainlinkProxyPriceProvider = async (
|
|||
|
||||
export const deployLendingPoolCollateralManager = async (verify?: boolean) => {
|
||||
const reservesLogic = await getReserveLogic();
|
||||
console.log('ADDRESS RESERVELOGIC', reservesLogic.address);
|
||||
const libraries = {
|
||||
// See deployAaveLibraries() function
|
||||
['__$d3b4366daeb9cadc7528af6145b50b2183$__']: reservesLogic.address,
|
||||
|
@ -301,7 +384,7 @@ export const deployGenericAToken = async (
|
|||
] = [poolAddress, underlyingAssetAddress, ZERO_ADDRESS, name, symbol, incentivesController];
|
||||
return withSaveAndVerify(
|
||||
await new ATokenFactory(await getFirstSigner()).deploy(...args),
|
||||
eContractid.VariableDebtToken,
|
||||
eContractid.AToken,
|
||||
args,
|
||||
verify
|
||||
);
|
||||
|
|
|
@ -344,6 +344,7 @@ export interface ICommonConfiguration {
|
|||
ReserveAssets: iParamsPerNetwork<SymbolMap<tEthereumAddress>>;
|
||||
ReservesConfig: iMultiPoolsAssets<IReserveParams>;
|
||||
ATokenDomainSeparator: iParamsPerNetwork<string>;
|
||||
ProxyPriceProvider: iParamsPerNetwork<tEthereumAddress>;
|
||||
}
|
||||
|
||||
export interface IAaveConfiguration extends ICommonConfiguration {
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
"aave:evm:dev:migration": "buidler aave:dev",
|
||||
"aave:evm:full:migration": "buidler aave:full",
|
||||
"aave:kovan:dev:migration": "npm run buidler:kovan -- aave:dev --verify",
|
||||
"aave:kovan:full:migration": "npm run buidler:kovan -- aave:full --verify",
|
||||
"aave:kovan:full:migration": "npm run buidler:kovan -- aave:full",
|
||||
"aave:ropsten:dev:migration": "npm run buidler:ropsten -- aave:dev --verify",
|
||||
"aave:ropsten:full:migration": "npm run buidler:ropsten -- aave:full --verify",
|
||||
"aave:main:dev:migration": "npm run buidler:main -- aave:dev --verify",
|
||||
|
|
|
@ -37,4 +37,11 @@ task(
|
|||
ProviderId
|
||||
)
|
||||
);
|
||||
|
||||
//register the proxy price provider on the addressesProvider
|
||||
const proxyProvider = getParamPerNetwork(poolConfig.ProxyPriceProvider, network);
|
||||
|
||||
if (proxyProvider && proxyProvider !== '') {
|
||||
await waitForTx(await addressesProvider.setPriceOracle(proxyProvider));
|
||||
}
|
||||
});
|
||||
|
|
|
@ -24,10 +24,7 @@ task('aave:full', 'Deploy development enviroment')
|
|||
console.log('2. Deploy lending pool');
|
||||
await localBRE.run('full:deploy-lending-pool', {verify});
|
||||
|
||||
console.log('3. Deploy oracles');
|
||||
await localBRE.run('full:deploy-oracles', {verify, pool: POOL_NAME});
|
||||
|
||||
console.log('4. Initialize lending pool');
|
||||
console.log('3. Initialize lending pool');
|
||||
await localBRE.run('full:initialize-lending-pool', {verify, pool: POOL_NAME});
|
||||
|
||||
console.log('\nFinished migrations');
|
||||
|
|
|
@ -245,6 +245,7 @@ const buildTestEnv = async (deployer: Signer, secondaryWallet: Signer) => {
|
|||
|
||||
await deployWalletBalancerProvider(addressesProvider.address);
|
||||
|
||||
console.log('END');
|
||||
console.timeEnd('setup');
|
||||
};
|
||||
|
||||
|
|
|
@ -32,10 +32,17 @@ makeSuite('AToken: Permit', (testEnv: TestEnv) => {
|
|||
});
|
||||
|
||||
it('Get aDAI for tests', async () => {
|
||||
const {dai, deployer, pool} = testEnv;
|
||||
const {dai, pool, deployer, addressesProvider} = testEnv;
|
||||
const addre = await addressesProvider.getLendingPool();
|
||||
console.log('pool', pool.address, addre);
|
||||
|
||||
await dai.mint(parseEther('20000'));
|
||||
await dai.approve(pool.address, parseEther('20000'));
|
||||
|
||||
const some = await pool.getReserveData(dai.address);
|
||||
const aa = await pool.getReservesList();
|
||||
console.log('some', some);
|
||||
console.log('aa', aa);
|
||||
await pool.deposit(dai.address, parseEther('20000'), deployer.address, 0);
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user