Fixed tests with new prefixes

This commit is contained in:
Zer0dot 2021-02-19 15:50:13 -05:00
parent 5965ef09d4
commit ebc147866f
17 changed files with 368 additions and 347 deletions

View File

@ -95,7 +95,7 @@ const buildTestEnv = async (deployer: Signer, secondaryWallet: Signer) => {
const aaveAdmin = await deployer.getAddress();
const mockTokens = await deployAllMockTokens(deployer);
console.log("Deployed mocks");
const addressesProvider = await deployLendingPoolAddressesProvider(AaveConfig.MarketId);
await waitForTx(await addressesProvider.setPoolAdmin(aaveAdmin));
@ -165,33 +165,33 @@ const buildTestEnv = async (deployer: Signer, secondaryWallet: Signer) => {
REN: mockTokens.REN.address,
UNI: mockTokens.UNI.address,
ENJ: mockTokens.ENJ.address,
LpDAI: mockTokens.LpDAI.address,
LpUSDC: mockTokens.LpUSDC.address,
LpUSDT: mockTokens.LpUSDT.address,
LpWBTC: mockTokens.LpWBTC.address,
LpWETH: mockTokens.LpWETH.address,
LpUniDAIWETH: mockTokens.LpUniDAIWETH.address,
LpUniWBTCWETH: mockTokens.LpUniWBTCWETH.address,
LpUniAAVEWETH: mockTokens.LpUniAAVEWETH.address,
LpUniBATWETH: mockTokens.LpUniBATWETH.address,
LpUniUSDCDAI: mockTokens.LpUniUSDCDAI.address,
LpUniCRVWETH: mockTokens.LpUniCRVWETH.address,
LpUniLINKWETH: mockTokens.LpUniLINKWETH.address,
LpUniMKRWETH: mockTokens.LpUniMKRWETH.address,
LpUniRENWETH: mockTokens.LpUniRENWETH.address,
LpUniSNXWETH: mockTokens.LpUniSNXWETH.address,
LpUniUNIWETH: mockTokens.LpUniUNIWETH.address,
LpUniUSDCWETH: mockTokens.LpUniUSDCWETH.address,
LpUniWBTCUSDC: mockTokens.LpUniWBTCUSDC.address,
LpUniYFIWETH: mockTokens.LpUniYFIWETH.address,
LpBalWBTCWETH: mockTokens.LpBalWBTCWETH.address,
// DAI: mockTokens.LpDAI.address,
// USDC: mockTokens.LpUSDC.address,
// USDT: mockTokens.LpUSDT.address,
// WBTC: mockTokens.LpWBTC.address,
// WETH: mockTokens.LpWETH.address,
UniDAIWETH: mockTokens.UniDAIWETH.address,
UniWBTCWETH: mockTokens.UniWBTCWETH.address,
UniAAVEWETH: mockTokens.UniAAVEWETH.address,
UniBATWETH: mockTokens.UniBATWETH.address,
UniUSDCDAI: mockTokens.UniUSDCDAI.address,
UniCRVWETH: mockTokens.UniCRVWETH.address,
UniLINKWETH: mockTokens.UniLINKWETH.address,
UniMKRWETH: mockTokens.UniMKRWETH.address,
UniRENWETH: mockTokens.UniRENWETH.address,
UniSNXWETH: mockTokens.UniSNXWETH.address,
UniUNIWETH: mockTokens.UniUNIWETH.address,
UniUSDCWETH: mockTokens.UniUSDCWETH.address,
UniWBTCUSDC: mockTokens.UniWBTCUSDC.address,
UniYFIWETH: mockTokens.UniYFIWETH.address,
BptWBTCWETH: mockTokens.BptWBTCWETH.address,
USD: USD_ADDRESS,
},
fallbackOracle
);
const mockAggregators = await deployAllMockAggregators(MOCK_CHAINLINK_AGGREGATORS_PRICES);
console.log("Mock aggs deployed");
const allTokenAddresses = Object.entries(mockTokens).reduce(
(accum: { [tokenSymbol: string]: tEthereumAddress }, [tokenSymbol, tokenContract]) => ({
...accum,
@ -237,16 +237,27 @@ const buildTestEnv = async (deployer: Signer, secondaryWallet: Signer) => {
const config = loadPoolConfig(ConfigNames.Aave);
const {
ATokenNamePrefix,
StableDebtTokenNamePrefix,
VariableDebtTokenNamePrefix,
SymbolPrefix,
} = config;
const treasuryAddress = await getTreasuryAddress(config);
await initReservesByHelper(
reservesParams,
allReservesAddresses,
ATokenNamePrefix,
StableDebtTokenNamePrefix,
VariableDebtTokenNamePrefix,
SymbolPrefix,
admin,
treasuryAddress,
ZERO_ADDRESS,
false
);
await configureReservesByHelper(reservesParams, allReservesAddresses, testHelpers, admin);
const collateralManager = await deployLendingPoolCollateralManager();

View File

@ -66,7 +66,7 @@ const deployAllMockTokens = async (deployer: Signer) => {
const lpConfigData = getReservesConfigByPool(AavePools.lp);
for (const tokenSymbol of Object.keys(TokenContractId)) {
if (tokenSymbol === 'LpWETH') {
if (tokenSymbol === 'WETH') {
tokens[tokenSymbol] = await deployWETHMocked();
await registerContractInJsonDb('WETH', tokens[tokenSymbol]);
continue;
@ -165,26 +165,26 @@ const buildTestEnv = async (deployer: Signer, secondaryWallet: Signer) => {
REN: mockTokens.REN.address,
UNI: mockTokens.UNI.address,
ENJ: mockTokens.ENJ.address,
LpDAI: mockTokens.LpDAI.address,
LpUSDC: mockTokens.LpUSDC.address,
LpUSDT: mockTokens.LpUSDT.address,
LpWBTC: mockTokens.LpWBTC.address,
LpWETH: mockTokens.LpWETH.address,
LpUniDAIWETH: mockTokens.LpUniDAIWETH.address,
LpUniWBTCWETH: mockTokens.LpUniWBTCWETH.address,
LpUniAAVEWETH: mockTokens.LpUniAAVEWETH.address,
LpUniBATWETH: mockTokens.LpUniBATWETH.address,
LpUniUSDCDAI: mockTokens.LpUniUSDCDAI.address,
LpUniCRVWETH: mockTokens.LpUniCRVWETH.address,
LpUniLINKWETH: mockTokens.LpUniLINKWETH.address,
LpUniMKRWETH: mockTokens.LpUniMKRWETH.address,
LpUniRENWETH: mockTokens.LpUniRENWETH.address,
LpUniSNXWETH: mockTokens.LpUniSNXWETH.address,
LpUniUNIWETH: mockTokens.LpUniUNIWETH.address,
LpUniUSDCWETH: mockTokens.LpUniUSDCWETH.address,
LpUniWBTCUSDC: mockTokens.LpUniWBTCUSDC.address,
LpUniYFIWETH: mockTokens.LpUniYFIWETH.address,
LpBalWBTCWETH: mockTokens.LpBalWBTCWETH.address,
// DAI: mockTokens.LpDAI.address,
// USDC: mockTokens.LpUSDC.address,
// USDT: mockTokens.LpUSDT.address,
// WBTC: mockTokens.LpWBTC.address,
// WETH: mockTokens.LpWETH.address,
UniDAIWETH: mockTokens.UniDAIWETH.address,
UniWBTCWETH: mockTokens.UniWBTCWETH.address,
UniAAVEWETH: mockTokens.UniAAVEWETH.address,
UniBATWETH: mockTokens.UniBATWETH.address,
UniUSDCDAI: mockTokens.UniUSDCDAI.address,
UniCRVWETH: mockTokens.UniCRVWETH.address,
UniLINKWETH: mockTokens.UniLINKWETH.address,
UniMKRWETH: mockTokens.UniMKRWETH.address,
UniRENWETH: mockTokens.UniRENWETH.address,
UniSNXWETH: mockTokens.UniSNXWETH.address,
UniUNIWETH: mockTokens.UniUNIWETH.address,
UniUSDCWETH: mockTokens.UniUSDCWETH.address,
UniWBTCUSDC: mockTokens.UniWBTCUSDC.address,
UniYFIWETH: mockTokens.UniYFIWETH.address,
BptWBTCWETH: mockTokens.BptWBTCWETH.address,
USD: USD_ADDRESS,
},
fallbackOracle
@ -236,12 +236,22 @@ const buildTestEnv = async (deployer: Signer, secondaryWallet: Signer) => {
console.log('Initialize configuration');
const config = loadPoolConfig(ConfigNames.Lp);
const {
ATokenNamePrefix,
StableDebtTokenNamePrefix,
VariableDebtTokenNamePrefix,
SymbolPrefix,
} = config;
const treasuryAddress = await getTreasuryAddress(config);
await initReservesByHelper(
reservesParams,
allReservesAddresses,
ATokenNamePrefix,
StableDebtTokenNamePrefix,
VariableDebtTokenNamePrefix,
SymbolPrefix,
admin,
treasuryAddress,
ZERO_ADDRESS,
@ -269,7 +279,7 @@ const buildTestEnv = async (deployer: Signer, secondaryWallet: Signer) => {
await deployWalletBalancerProvider();
await deployWETHGateway([mockTokens.LpWETH.address, lendingPoolAddress]);
await deployWETHGateway([mockTokens.WETH.address, lendingPoolAddress]);
console.timeEnd('setup');
};

View File

@ -33,7 +33,7 @@ makeSuite('AToken: Transfer', (testEnv: TestEnv) => {
const name = await aDai.name();
expect(name).to.be.equal('Aave interest bearing LpDAI');
expect(name).to.be.equal('Aave AMM Market DAI');
const fromBalance = await aDai.balanceOf(users[0].address);
const toBalance = await aDai.balanceOf(users[1].address);

View File

@ -128,15 +128,15 @@ export async function initializeMakeSuite() {
testEnv.helpersContract = await getAaveProtocolDataProvider();
const allTokens = await testEnv.helpersContract.getAllATokens();
const aDaiAddress = allTokens.find((aToken) => aToken.symbol === 'aLpDAI')?.tokenAddress;
const aDaiAddress = allTokens.find((aToken) => aToken.symbol === 'aAmmDAI')?.tokenAddress;
const aWEthAddress = allTokens.find((aToken) => aToken.symbol === 'aLpWETH')?.tokenAddress;
const aWEthAddress = allTokens.find((aToken) => aToken.symbol === 'aAmmWETH')?.tokenAddress;
const reservesTokens = await testEnv.helpersContract.getAllReservesTokens();
const daiAddress = reservesTokens.find((token) => token.symbol === 'LpDAI')?.tokenAddress;
const usdcAddress = reservesTokens.find((token) => token.symbol === 'LpUSDC')?.tokenAddress;
const aaveAddress = reservesTokens.find((token) => token.symbol === 'LpUniAAVEWETH')?.tokenAddress;
const daiAddress = reservesTokens.find((token) => token.symbol === 'DAI')?.tokenAddress;
const usdcAddress = reservesTokens.find((token) => token.symbol === 'USDC')?.tokenAddress;
const aaveAddress = reservesTokens.find((token) => token.symbol === 'UniAAVEWETH')?.tokenAddress;
const wethAddress = reservesTokens.find((token) => token.symbol === 'WETH')?.tokenAddress;
if (!aDaiAddress || !aWEthAddress) {

View File

@ -3,12 +3,12 @@
"description": "Test cases for the deposit function.",
"stories": [
{
"description": "User 0 deposits 1000 LPDAI, user 1 deposits 1 WETH as collateral and tries to borrow 100 LPDAI with rate mode NONE (revert expected)",
"description": "User 0 deposits 1000 DAI, user 1 deposits 1 WETH as collateral and tries to borrow 100 DAI with rate mode NONE (revert expected)",
"actions": [
{
"name": "mint",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "1000",
"user": "0"
},
@ -17,7 +17,7 @@
{
"name": "approve",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"user": "0"
},
"expected": "success"
@ -25,7 +25,7 @@
{
"name": "deposit",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "1000",
"user": "0"
},
@ -60,7 +60,7 @@
{
"name": "borrow",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "100",
"borrowRateMode": "none",
"user": "1"
@ -71,12 +71,12 @@
]
},
{
"description": "User 0 deposits 1000 LPDAI, user 1 deposits 1 WETH as collateral and tries to borrow 100 LPDAI with an invalid rate mode (revert expected)",
"description": "User 0 deposits 1000 DAI, user 1 deposits 1 WETH as collateral and tries to borrow 100 DAI with an invalid rate mode (revert expected)",
"actions": [
{
"name": "mint",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "1000",
"user": "0"
},
@ -85,7 +85,7 @@
{
"name": "approve",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"user": "0"
},
"expected": "success"
@ -93,7 +93,7 @@
{
"name": "deposit",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "1000",
"user": "0"
},
@ -128,7 +128,7 @@
{
"name": "borrow",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "100",
"borrowRateMode": "invalid",
"user": "1"

View File

@ -3,12 +3,12 @@
"description": "Test cases for the borrow function, stable mode.",
"stories": [
{
"description": "User 0 deposits 1000 LPDAI, user 1 deposits 1 WETH as collateral and tries to borrow 100 LPDAI at stable rate (revert expected)",
"description": "User 0 deposits 1000 DAI, user 1 deposits 1 WETH as collateral and tries to borrow 100 DAI at stable rate (revert expected)",
"actions": [
{
"name": "mint",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "1000",
"user": "0"
},
@ -17,7 +17,7 @@
{
"name": "approve",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"user": "0"
},
"expected": "success"
@ -25,7 +25,7 @@
{
"name": "deposit",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "1000",
"user": "0"
},
@ -61,7 +61,7 @@
{
"name": "borrow",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "100",
"borrowRateMode": "stable",
"user": "1",
@ -72,12 +72,12 @@
]
},
{
"description": "User 1 tries to borrow the rest of the LPDAI liquidity (revert expected)",
"description": "User 1 tries to borrow the rest of the DAI liquidity (revert expected)",
"actions": [
{
"name": "borrow",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "900",
"borrowRateMode": "stable",
"user": "1"
@ -88,12 +88,12 @@
]
},
{
"description": "User 1 tries to borrow 100 LPDAI at variable",
"description": "User 1 tries to borrow 100 DAI at variable",
"actions": [
{
"name": "borrow",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "100",
"borrowRateMode": "variable",
"user": "1"
@ -103,12 +103,12 @@
]
},
{
"description": "User 1 tries to borrow the rest of the LPDAI liquidity at stable (revert expected)",
"description": "User 1 tries to borrow the rest of the DAI liquidity at stable (revert expected)",
"actions": [
{
"name": "borrow",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "900",
"borrowRateMode": "stable",
"user": "1"
@ -119,13 +119,13 @@
]
},
{
"description": "User 1 repays half of the LPDAI borrow at stable after one year (revert expected)",
"description": "User 1 repays half of the DAI borrow at stable after one year (revert expected)",
"actions": [
{
"name": "mint",
"description": "Mint 10 LPDAI to cover the interest",
"description": "Mint 10 DAI to cover the interest",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "10",
"user": "1"
},
@ -134,7 +134,7 @@
{
"name": "approve",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"user": "1"
},
"expected": "success"
@ -142,7 +142,7 @@
{
"name": "repay",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "50",
"user": "1",
"onBehalfOf": "1",
@ -153,12 +153,12 @@
]
},
{
"description": "User 1 repays half of the variable LPDAI borrow after one year",
"description": "User 1 repays half of the variable DAI borrow after one year",
"actions": [
{
"name": "repay",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "50",
"user": "1",
"onBehalfOf": "1",
@ -169,13 +169,13 @@
]
},
{
"description": "User 1 repays the rest of the LPDAI borrow at stable after one year (revert expected)",
"description": "User 1 repays the rest of the DAI borrow at stable after one year (revert expected)",
"actions": [
{
"name": "mint",
"description": "Mint 15 LPDAI to cover the interest",
"description": "Mint 15 DAI to cover the interest",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "15",
"user": "1"
},
@ -184,7 +184,7 @@
{
"name": "approve",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"user": "1"
},
"expected": "success"
@ -192,7 +192,7 @@
{
"name": "repay",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "-1",
"user": "1",
"onBehalfOf": "1",
@ -203,12 +203,12 @@
]
},
{
"description": "User 1 repays the rest of the LPDAI borrow after one year at variable",
"description": "User 1 repays the rest of the DAI borrow after one year at variable",
"actions": [
{
"name": "repay",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "-1",
"user": "1",
"onBehalfOf": "1",
@ -219,12 +219,12 @@
]
},
{
"description": "User 0 withdraws the deposited LPDAI plus interest",
"description": "User 0 withdraws the deposited DAI plus interest",
"actions": [
{
"name": "withdraw",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "-1",
"user": "0"
},
@ -233,12 +233,12 @@
]
},
{
"description": "User 1 deposits 1000 LPDAI, user 2 tries to borrow 1000 LPDAI at a stable rate without any collateral (revert expected) User 1 withdrawws",
"description": "User 1 deposits 1000 DAI, user 2 tries to borrow 1000 DAI at a stable rate without any collateral (revert expected) User 1 withdrawws",
"actions": [
{
"name": "mint",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "1000",
"user": "1"
},
@ -247,7 +247,7 @@
{
"name": "approve",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"user": "1"
},
"expected": "success"
@ -255,7 +255,7 @@
{
"name": "deposit",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "1000",
"user": "1"
},
@ -264,7 +264,7 @@
{
"name": "borrow",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "1000",
"borrowRateMode": "stable",
"user": "2"
@ -275,7 +275,7 @@
{
"name": "withdraw",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "1000",
"user": "1"
},
@ -284,12 +284,12 @@
]
},
{
"description": "User 0 deposits 1000 LPDAI, user 1,2,3,4 deposit 1 WETH each and borrow 100 LPDAI at stable rate (revert expected) user 0 withdraws",
"description": "User 0 deposits 1000 DAI, user 1,2,3,4 deposit 1 WETH each and borrow 100 DAI at stable rate (revert expected) user 0 withdraws",
"actions": [
{
"name": "mint",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "1000",
"user": "0"
},
@ -298,7 +298,7 @@
{
"name": "approve",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"user": "0"
},
"expected": "success"
@ -306,7 +306,7 @@
{
"name": "deposit",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "1000",
"user": "0"
},
@ -341,7 +341,7 @@
{
"name": "borrow",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "100",
"borrowRateMode": "stable",
"user": "1",
@ -378,7 +378,7 @@
{
"name": "borrow",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "100",
"borrowRateMode": "stable",
"user": "2",
@ -415,7 +415,7 @@
{
"name": "borrow",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "100",
"borrowRateMode": "stable",
"user": "3",
@ -452,7 +452,7 @@
{
"name": "borrow",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "100",
"borrowRateMode": "stable",
"user": "4",
@ -462,9 +462,9 @@
},
{
"name": "mint",
"description": "Mint 15 LPDAI to cover the interest",
"description": "Mint 15 DAI to cover the interest",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "15",
"user": "1"
},
@ -473,7 +473,7 @@
{
"name": "approve",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"user": "1"
},
"expected": "success"
@ -481,7 +481,7 @@
{
"name": "repay",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "-1",
"user": "1",
"onBehalfOf": "1",
@ -491,9 +491,9 @@
},
{
"name": "mint",
"description": "Mint 20 LPDAI to cover the interest",
"description": "Mint 20 DAI to cover the interest",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "20",
"user": "2"
},
@ -502,7 +502,7 @@
{
"name": "approve",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"user": "2"
},
"expected": "success"
@ -510,7 +510,7 @@
{
"name": "repay",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "-1",
"user": "2",
"onBehalfOf": "2",
@ -520,9 +520,9 @@
},
{
"name": "mint",
"description": "Mint 30 LPDAI to cover the interest",
"description": "Mint 30 DAI to cover the interest",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "30",
"user": "3"
},
@ -531,7 +531,7 @@
{
"name": "approve",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"user": "3"
},
"expected": "success"
@ -539,7 +539,7 @@
{
"name": "repay",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "-1",
"user": "3",
"onBehalfOf": "3",
@ -549,9 +549,9 @@
},
{
"name": "mint",
"description": "Mint 30 LPDAI to cover the interest",
"description": "Mint 30 DAI to cover the interest",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "30",
"user": "4"
},
@ -560,7 +560,7 @@
{
"name": "approve",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"user": "4"
},
"expected": "success"
@ -568,7 +568,7 @@
{
"name": "repay",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "-1",
"user": "4",
"onBehalfOf": "4",
@ -579,7 +579,7 @@
{
"name": "withdraw",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "-1",
"user": "0"
},
@ -588,12 +588,12 @@
]
},
{
"description": "User 0 deposits 1000 LPDAI, user 1 deposits 2 WETH and borrow 100 LPDAI at stable rate first (revert expected), then 100 LPDAI at variable rate twice, repays everything. User 0 withdraws",
"description": "User 0 deposits 1000 DAI, user 1 deposits 2 WETH and borrow 100 DAI at stable rate first (revert expected), then 100 DAI at variable rate twice, repays everything. User 0 withdraws",
"actions": [
{
"name": "mint",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "1000",
"user": "0"
},
@ -602,7 +602,7 @@
{
"name": "approve",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"user": "0"
},
"expected": "success"
@ -610,7 +610,7 @@
{
"name": "deposit",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "1000",
"user": "0"
},
@ -645,7 +645,7 @@
{
"name": "borrow",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "100",
"borrowRateMode": "stable",
"user": "1",
@ -656,7 +656,7 @@
{
"name": "borrow",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "100",
"borrowRateMode": "variable",
"user": "1",
@ -667,7 +667,7 @@
{
"name": "borrow",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "100",
"borrowRateMode": "variable",
"user": "1",
@ -677,9 +677,9 @@
},
{
"name": "mint",
"description": "Mint 50 LPDAI to cover the interest",
"description": "Mint 50 DAI to cover the interest",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "50",
"user": "1"
},
@ -688,7 +688,7 @@
{
"name": "approve",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"user": "1"
},
"expected": "success"
@ -696,7 +696,7 @@
{
"name": "repay",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "-1",
"user": "1",
"onBehalfOf": "1",
@ -707,7 +707,7 @@
{
"name": "repay",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "-1",
"user": "1",
"onBehalfOf": "1",
@ -718,7 +718,7 @@
{
"name": "withdraw",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "-1",
"user": "0"
},

View File

@ -3,12 +3,12 @@
"description": "Test cases for the borrow function, variable mode.",
"stories": [
{
"description": "User 2 deposits 1 LPDAI to account for rounding errors",
"description": "User 2 deposits 1 DAI to account for rounding errors",
"actions": [
{
"name": "mint",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "1",
"user": "2"
},
@ -17,7 +17,7 @@
{
"name": "approve",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"user": "2"
},
"expected": "success"
@ -25,7 +25,7 @@
{
"name": "deposit",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "1",
"user": "2"
},
@ -34,12 +34,12 @@
]
},
{
"description": "User 0 deposits 1000 LPDAI, user 1 deposits 1 WETH as collateral and borrows 100 LPDAI at variable rate",
"description": "User 0 deposits 1000 DAI, user 1 deposits 1 WETH as collateral and borrows 100 DAI at variable rate",
"actions": [
{
"name": "mint",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "1000",
"user": "0"
},
@ -48,7 +48,7 @@
{
"name": "approve",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"user": "0"
},
"expected": "success"
@ -56,7 +56,7 @@
{
"name": "deposit",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "1000",
"user": "0"
},
@ -91,7 +91,7 @@
{
"name": "borrow",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "100",
"borrowRateMode": "variable",
"user": "1",
@ -102,12 +102,12 @@
]
},
{
"description": "User 1 tries to borrow the rest of the LPDAI liquidity (revert expected)",
"description": "User 1 tries to borrow the rest of the DAI liquidity (revert expected)",
"actions": [
{
"name": "borrow",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "900",
"borrowRateMode": "variable",
"user": "1"
@ -118,12 +118,12 @@
]
},
{
"description": "User 1 tries to repay 0 LPDAI (revert expected)",
"description": "User 1 tries to repay 0 DAI (revert expected)",
"actions": [
{
"name": "repay",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "0",
"user": "1",
"onBehalfOf": "1"
@ -134,12 +134,12 @@
]
},
{
"description": "User 1 repays a small amount of LPDAI, enough to cover a small part of the interest",
"description": "User 1 repays a small amount of DAI, enough to cover a small part of the interest",
"actions": [
{
"name": "approve",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"user": "1"
},
"expected": "success"
@ -147,7 +147,7 @@
{
"name": "repay",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "1.25",
"user": "1",
"onBehalfOf": "1",
@ -158,13 +158,13 @@
]
},
{
"description": "User 1 repays the LPDAI borrow after one year",
"description": "User 1 repays the DAI borrow after one year",
"actions": [
{
"name": "mint",
"description": "Mint 10 LPDAI to cover the interest",
"description": "Mint 10 DAI to cover the interest",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "10",
"user": "1"
},
@ -173,7 +173,7 @@
{
"name": "repay",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "-1",
"user": "1",
"onBehalfOf": "1",
@ -184,12 +184,12 @@
]
},
{
"description": "User 0 withdraws the deposited LPDAI plus interest",
"description": "User 0 withdraws the deposited DAI plus interest",
"actions": [
{
"name": "withdraw",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "-1",
"user": "0"
},
@ -243,7 +243,7 @@
]
},
{
"description": "User 0 deposits 1 WETH, user 1 deposits 100 LPUNILINKWETH as collateral and borrows 0.5 WETH at variable rate",
"description": "User 0 deposits 1 WETH, user 1 deposits 100 UNILINKWETH as collateral and borrows 0.5 WETH at variable rate",
"actions": [
{
"name": "mint",
@ -274,7 +274,7 @@
{
"name": "mint",
"args": {
"reserve": "LPUNILINKWETH",
"reserve": "UNILINKWETH",
"amount": "100",
"user": "1"
},
@ -283,7 +283,7 @@
{
"name": "approve",
"args": {
"reserve": "LPUNILINKWETH",
"reserve": "UNILINKWETH",
"user": "1"
},
"expected": "success"
@ -292,7 +292,7 @@
{
"name": "deposit",
"args": {
"reserve": "LPUNILINKWETH",
"reserve": "UNILINKWETH",
"amount": "100",
"user": "1"
},
@ -431,7 +431,7 @@
{
"name": "withdraw",
"args": {
"reserve": "LPUNILINKWETH",
"reserve": "UNILINKWETH",
"amount": "-1",
"user": "1"
},
@ -441,12 +441,12 @@
},
{
"description": "User 2 deposits 1 LPUSDC to account for rounding errors",
"description": "User 2 deposits 1 USDC to account for rounding errors",
"actions": [
{
"name": "mint",
"args": {
"reserve": "LPUSDC",
"reserve": "USDC",
"amount": "1",
"user": "2"
},
@ -455,7 +455,7 @@
{
"name": "approve",
"args": {
"reserve": "LPUSDC",
"reserve": "USDC",
"user": "2"
},
"expected": "success"
@ -463,7 +463,7 @@
{
"name": "deposit",
"args": {
"reserve": "LPUSDC",
"reserve": "USDC",
"amount": "1",
"user": "2"
},
@ -472,12 +472,12 @@
]
},
{
"description": "User 0 deposits 1000 LPUSDC, user 1 deposits 1 WETH as collateral and borrows 100 LPUSDC at variable rate",
"description": "User 0 deposits 1000 USDC, user 1 deposits 1 WETH as collateral and borrows 100 USDC at variable rate",
"actions": [
{
"name": "mint",
"args": {
"reserve": "LPUSDC",
"reserve": "USDC",
"amount": "1000",
"user": "0"
},
@ -486,7 +486,7 @@
{
"name": "approve",
"args": {
"reserve": "LPUSDC",
"reserve": "USDC",
"user": "0"
},
"expected": "success"
@ -494,7 +494,7 @@
{
"name": "deposit",
"args": {
"reserve": "LPUSDC",
"reserve": "USDC",
"amount": "1000",
"user": "0"
},
@ -529,7 +529,7 @@
{
"name": "borrow",
"args": {
"reserve": "LPUSDC",
"reserve": "USDC",
"amount": "100",
"borrowRateMode": "variable",
"user": "1",
@ -540,12 +540,12 @@
]
},
{
"description": "User 1 tries to borrow the rest of the LPUSDC liquidity (revert expected)",
"description": "User 1 tries to borrow the rest of the USDC liquidity (revert expected)",
"actions": [
{
"name": "borrow",
"args": {
"reserve": "LPUSDC",
"reserve": "USDC",
"amount": "900",
"borrowRateMode": "variable",
"user": "1"
@ -556,13 +556,13 @@
]
},
{
"description": "User 1 repays the LPUSDC borrow after one year",
"description": "User 1 repays the USDC borrow after one year",
"actions": [
{
"name": "mint",
"description": "Mint 10 LPUSDC to cover the interest",
"description": "Mint 10 USDC to cover the interest",
"args": {
"reserve": "LPUSDC",
"reserve": "USDC",
"amount": "10",
"user": "1"
},
@ -571,7 +571,7 @@
{
"name": "approve",
"args": {
"reserve": "LPUSDC",
"reserve": "USDC",
"user": "1"
},
"expected": "success"
@ -579,7 +579,7 @@
{
"name": "repay",
"args": {
"reserve": "LPUSDC",
"reserve": "USDC",
"amount": "-1",
"user": "1",
"onBehalfOf": "1",
@ -590,12 +590,12 @@
]
},
{
"description": "User 0 withdraws the deposited LPUSDC plus interest",
"description": "User 0 withdraws the deposited USDC plus interest",
"actions": [
{
"name": "withdraw",
"args": {
"reserve": "LPUSDC",
"reserve": "USDC",
"amount": "-1",
"user": "0"
},
@ -618,12 +618,12 @@
]
},
{
"description": "User 1 deposits 1000 LPDAI, user 3 tries to borrow 1000 LPDAI without any collateral (revert expected)",
"description": "User 1 deposits 1000 DAI, user 3 tries to borrow 1000 DAI without any collateral (revert expected)",
"actions": [
{
"name": "mint",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "1000",
"user": "1"
},
@ -632,7 +632,7 @@
{
"name": "approve",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"user": "1"
},
"expected": "success"
@ -640,7 +640,7 @@
{
"name": "deposit",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "1000",
"user": "1"
},
@ -649,7 +649,7 @@
{
"name": "borrow",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "1000",
"borrowRateMode": "variable",
"user": "3"
@ -660,7 +660,7 @@
]
},
{
"description": "user 3 deposits 0.1 WETH collateral to borrow 100 LPDAI; 0.1 WETH is not enough to borrow 100 LPDAI (revert expected)",
"description": "user 3 deposits 0.1 WETH collateral to borrow 100 DAI; 0.1 WETH is not enough to borrow 100 DAI (revert expected)",
"actions": [
{
"name": "mint",
@ -691,7 +691,7 @@
{
"name": "borrow",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "100",
"borrowRateMode": "variable",
"user": "3"
@ -716,12 +716,12 @@
]
},
{
"description": "User 1 deposits 1000 LPUSDC, user 3 tries to borrow 1000 LPUSDC without any collateral (revert expected)",
"description": "User 1 deposits 1000 USDC, user 3 tries to borrow 1000 USDC without any collateral (revert expected)",
"actions": [
{
"name": "mint",
"args": {
"reserve": "LPUSDC",
"reserve": "USDC",
"amount": "1000",
"user": "1"
},
@ -730,7 +730,7 @@
{
"name": "approve",
"args": {
"reserve": "LPUSDC",
"reserve": "USDC",
"user": "1"
},
"expected": "success"
@ -738,7 +738,7 @@
{
"name": "deposit",
"args": {
"reserve": "LPUSDC",
"reserve": "USDC",
"amount": "1000",
"user": "1"
},
@ -747,7 +747,7 @@
{
"name": "borrow",
"args": {
"reserve": "LPUSDC",
"reserve": "USDC",
"amount": "1000",
"borrowRateMode": "variable",
"user": "3"
@ -758,7 +758,7 @@
]
},
{
"description": "user 3 deposits 0.1 WETH collateral to borrow 100 LPUSDC; 0.1 WETH is not enough to borrow 100 LPUSDC (revert expected)",
"description": "user 3 deposits 0.1 WETH collateral to borrow 100 USDC; 0.1 WETH is not enough to borrow 100 USDC (revert expected)",
"actions": [
{
"name": "mint",
@ -789,7 +789,7 @@
{
"name": "borrow",
"args": {
"reserve": "LPUSDC",
"reserve": "USDC",
"amount": "100",
"borrowRateMode": "variable",
"user": "3"
@ -814,12 +814,12 @@
]
},
{
"description": "User 0 deposits 1000 LPDAI, user 6 deposits 2 WETH and borrow 100 LPDAI at variable rate first, then 100 LPDAI at stable rate (revert expected), then 100 LPDAI at variable again, repays everything. User 0 withdraws",
"description": "User 0 deposits 1000 DAI, user 6 deposits 2 WETH and borrow 100 DAI at variable rate first, then 100 DAI at stable rate (revert expected), then 100 DAI at variable again, repays everything. User 0 withdraws",
"actions": [
{
"name": "mint",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "1000",
"user": "0"
},
@ -828,7 +828,7 @@
{
"name": "approve",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"user": "0"
},
"expected": "success"
@ -836,7 +836,7 @@
{
"name": "deposit",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "1000",
"user": "0"
},
@ -871,7 +871,7 @@
{
"name": "borrow",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "100",
"borrowRateMode": "variable",
"user": "6",
@ -882,7 +882,7 @@
{
"name": "borrow",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "100",
"borrowRateMode": "stable",
"user": "6",
@ -893,7 +893,7 @@
{
"name": "borrow",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "100",
"borrowRateMode": "variable",
"user": "6",
@ -903,9 +903,9 @@
},
{
"name": "mint",
"description": "Mint 50 LPDAI to cover the interest",
"description": "Mint 50 DAI to cover the interest",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "50",
"user": "6"
},
@ -914,7 +914,7 @@
{
"name": "approve",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"user": "6"
},
"expected": "success"
@ -922,7 +922,7 @@
{
"name": "repay",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "-1",
"user": "6",
"onBehalfOf": "6",
@ -933,7 +933,7 @@
{
"name": "repay",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "-1",
"user": "6",
"onBehalfOf": "6",
@ -944,7 +944,7 @@
{
"name": "withdraw",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "-1",
"user": "0"
},

View File

@ -3,7 +3,7 @@
"description": "Test cases for the credit delegation related functions.",
"stories": [
{
"description": "User 3 deposits 1000 WETH. User 0 deposits 1000 LPDAI, user 0 delegates borrowing of 1 WETH on variable to user 4, user 4 borrows 1 WETH variable on behalf of user 0",
"description": "User 3 deposits 1000 WETH. User 0 deposits 1000 DAI, user 0 delegates borrowing of 1 WETH on variable to user 4, user 4 borrows 1 WETH variable on behalf of user 0",
"actions": [
{
"name": "mint",
@ -34,7 +34,7 @@
{
"name": "mint",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "1000",
"user": "0"
},
@ -43,7 +43,7 @@
{
"name": "approve",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"user": "0"
},
"expected": "success"
@ -51,7 +51,7 @@
{
"name": "deposit",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "1000",
"user": "0"
},

View File

@ -3,12 +3,12 @@
"description": "Test cases for the deposit function.",
"stories": [
{
"description": "User 0 Deposits 1000 LPDAI in an empty reserve",
"description": "User 0 Deposits 1000 DAI in an empty reserve",
"actions": [
{
"name": "mint",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "1000",
"user": "0"
},
@ -17,7 +17,7 @@
{
"name": "approve",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"user": "0"
},
"expected": "success"
@ -25,7 +25,7 @@
{
"name": "deposit",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "1000",
"user": "0"
},
@ -34,12 +34,12 @@
]
},
{
"description": "User 1 deposits 1000 LPDAI after user 0",
"description": "User 1 deposits 1000 DAI after user 0",
"actions": [
{
"name": "mint",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "1000",
"user": "1"
},
@ -48,7 +48,7 @@
{
"name": "approve",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"user": "1"
},
"expected": "success"
@ -56,7 +56,7 @@
{
"name": "deposit",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "1000",
"user": "1"
},
@ -65,12 +65,12 @@
]
},
{
"description": "User 0 deposits 1000 LPUSDC in an empty reserve",
"description": "User 0 deposits 1000 USDC in an empty reserve",
"actions": [
{
"name": "mint",
"args": {
"reserve": "LPUSDC",
"reserve": "USDC",
"amount": "1000",
"user": "0"
},
@ -79,7 +79,7 @@
{
"name": "approve",
"args": {
"reserve": "LPUSDC",
"reserve": "USDC",
"user": "0"
},
"expected": "success"
@ -87,7 +87,7 @@
{
"name": "deposit",
"args": {
"reserve": "LPUSDC",
"reserve": "USDC",
"amount": "1000",
"user": "0"
},
@ -96,12 +96,12 @@
]
},
{
"description": "User 1 deposits 1000 LPUSDC after user 0",
"description": "User 1 deposits 1000 USDC after user 0",
"actions": [
{
"name": "mint",
"args": {
"reserve": "LPUSDC",
"reserve": "USDC",
"amount": "1000",
"user": "1"
},
@ -110,7 +110,7 @@
{
"name": "approve",
"args": {
"reserve": "LPUSDC",
"reserve": "USDC",
"user": "1"
},
"expected": "success"
@ -118,7 +118,7 @@
{
"name": "deposit",
"args": {
"reserve": "LPUSDC",
"reserve": "USDC",
"amount": "1000",
"user": "1"
},
@ -214,12 +214,12 @@
]
},
{
"description": "User 1 deposits 0 LPDAI",
"description": "User 1 deposits 0 DAI",
"actions": [
{
"name": "deposit",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "0",
"user": "1"
},
@ -229,12 +229,12 @@
]
},
{
"description": "User 1 deposits 100 LPDAI on behalf of user 2, user 2 tries to borrow 0.1 WETH",
"description": "User 1 deposits 100 DAI on behalf of user 2, user 2 tries to borrow 0.1 WETH",
"actions": [
{
"name": "mint",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "100",
"user": "1"
},
@ -243,7 +243,7 @@
{
"name": "deposit",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "100",
"user": "1",
"onBehalfOf": "2"

View File

@ -8,7 +8,7 @@
{
"name": "rebalanceStableBorrowRate",
"args": {
"reserve": "LPUSDC",
"reserve": "USDC",
"user": "0",
"target": "1"
},
@ -18,12 +18,12 @@
]
},
{
"description": "User 0 deposits 1000 LPUSDC, user 1 deposits 7 WETH, borrows 250 LPUSDC at a variable rate, user 0 rebalances user 1 (revert expected)",
"description": "User 0 deposits 1000 USDC, user 1 deposits 7 WETH, borrows 250 USDC at a variable rate, user 0 rebalances user 1 (revert expected)",
"actions": [
{
"name": "mint",
"args": {
"reserve": "LPUSDC",
"reserve": "USDC",
"amount": "1000",
"user": "0"
},
@ -32,7 +32,7 @@
{
"name": "approve",
"args": {
"reserve": "LPUSDC",
"reserve": "USDC",
"user": "0"
},
"expected": "success"
@ -40,7 +40,7 @@
{
"name": "deposit",
"args": {
"reserve": "LPUSDC",
"reserve": "USDC",
"amount": "1000",
"user": "0"
},
@ -75,7 +75,7 @@
{
"name": "borrow",
"args": {
"reserve": "LPUSDC",
"reserve": "USDC",
"amount": "250",
"borrowRateMode": "variable",
"user": "1"
@ -85,7 +85,7 @@
{
"name": "rebalanceStableBorrowRate",
"args": {
"reserve": "LPUSDC",
"reserve": "USDC",
"user": "0",
"target": "1"
},
@ -100,7 +100,7 @@
{
"name": "borrow",
"args": {
"reserve": "LPUSDC",
"reserve": "USDC",
"amount": "200",
"borrowRateMode": "variable",
"user": "1"
@ -110,7 +110,7 @@
{
"name": "rebalanceStableBorrowRate",
"args": {
"reserve": "LPUSDC",
"reserve": "USDC",
"user": "0",
"target": "1"
},
@ -125,7 +125,7 @@
{
"name": "borrow",
"args": {
"reserve": "LPUSDC",
"reserve": "USDC",
"amount": "200",
"borrowRateMode": "variable",
"user": "1"
@ -135,7 +135,7 @@
{
"name": "rebalanceStableBorrowRate",
"args": {
"reserve": "LPUSDC",
"reserve": "USDC",
"user": "0",
"target": "1"
},
@ -150,7 +150,7 @@
{
"name": "borrow",
"args": {
"reserve": "LPUSDC",
"reserve": "USDC",
"amount": "280",
"borrowRateMode": "variable",
"user": "1"
@ -160,7 +160,7 @@
{
"name": "rebalanceStableBorrowRate",
"args": {
"reserve": "LPUSDC",
"reserve": "USDC",
"user": "0",
"target": "1"
},
@ -171,12 +171,12 @@
},
{
"description": "User 1 borrows the remaining LPUSDC (usage ratio = 100%) at variable. User 0 rebalances user 1, fails since there are no stable borrows (revert expected)",
"description": "User 1 borrows the remaining USDC (usage ratio = 100%) at variable. User 0 rebalances user 1, fails since there are no stable borrows (revert expected)",
"actions": [
{
"name": "borrow",
"args": {
"reserve": "LPUSDC",
"reserve": "USDC",
"amount": "20",
"borrowRateMode": "variable",
"user": "1"
@ -186,7 +186,7 @@
{
"name": "rebalanceStableBorrowRate",
"args": {
"reserve": "LPUSDC",
"reserve": "USDC",
"user": "0",
"target": "1"
},

View File

@ -3,12 +3,12 @@
"description": "Test cases for the setUserUseReserveAsCollateral() function.",
"stories": [
{
"description": "User 0 Deposits 1000 LPDAI, disables LPDAI as collateral",
"description": "User 0 Deposits 1000 DAI, disables DAI as collateral",
"actions": [
{
"name": "mint",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "1000",
"user": "0"
},
@ -17,7 +17,7 @@
{
"name": "approve",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"user": "0"
},
"expected": "success"
@ -25,7 +25,7 @@
{
"name": "deposit",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "1000",
"user": "0"
},
@ -34,7 +34,7 @@
{
"name": "setUseAsCollateral",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"user": "0",
"useAsCollateral": "false"
},
@ -43,7 +43,7 @@
]
},
{
"description": "User 1 Deposits 2 WETH, disables WETH as collateral, borrows 400 LPDAI (revert expected)",
"description": "User 1 Deposits 2 WETH, disables WETH as collateral, borrows 400 DAI (revert expected)",
"actions": [
{
"name": "mint",
@ -83,7 +83,7 @@
{
"name": "borrow",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "400",
"borrowRateMode": "variable",
"user": "1"
@ -94,7 +94,7 @@
]
},
{
"description": "User 1 enables WETH as collateral, borrows 400 LPDAI",
"description": "User 1 enables WETH as collateral, borrows 400 DAI",
"actions": [
{
"name": "setUseAsCollateral",
@ -108,7 +108,7 @@
{
"name": "borrow",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "400",
"borrowRateMode": "variable",
"user": "1"
@ -133,12 +133,12 @@
]
},
{
"description": "User 1 Deposits 10 LPUNILINKWETH, disables WETH as collateral. Should revert as 10 LPUNILINKWETH are not enough to cover the debt (revert expected)",
"description": "User 1 Deposits 10 UNILINKWETH, disables WETH as collateral. Should revert as 10 UNILINKWETH are not enough to cover the debt (revert expected)",
"actions": [
{
"name": "mint",
"args": {
"reserve": "LPUNILINKWETH",
"reserve": "UNILINKWETH",
"amount": "10",
"user": "1"
},
@ -147,7 +147,7 @@
{
"name": "approve",
"args": {
"reserve": "LPUNILINKWETH",
"reserve": "UNILINKWETH",
"user": "1"
},
"expected": "success"
@ -155,7 +155,7 @@
{
"name": "deposit",
"args": {
"reserve": "LPUNILINKWETH",
"reserve": "UNILINKWETH",
"amount": "10",
"user": "1"
},
@ -173,12 +173,12 @@
]
},
{
"description": "User 1 Deposits 640 more LPUNILINKWETH (enough to cover the LPDAI debt), disables WETH as collateral",
"description": "User 1 Deposits 640 more UNILINKWETH (enough to cover the DAI debt), disables WETH as collateral",
"actions": [
{
"name": "mint",
"args": {
"reserve": "LPUNILINKWETH",
"reserve": "UNILINKWETH",
"amount": "640",
"user": "1"
},
@ -187,7 +187,7 @@
{
"name": "deposit",
"args": {
"reserve": "LPUNILINKWETH",
"reserve": "UNILINKWETH",
"amount": "640",
"user": "1"
},
@ -205,12 +205,12 @@
]
},
{
"description": "User 1 disables LPUNILINKWETH as collateral (revert expected)",
"description": "User 1 disables UNILINKWETH as collateral (revert expected)",
"actions": [
{
"name": "setUseAsCollateral",
"args": {
"reserve": "LPUNILINKWETH",
"reserve": "UNILINKWETH",
"user": "1",
"useAsCollateral": "false"
},

View File

@ -8,7 +8,7 @@
{
"name": "swapBorrowRateMode",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"user": "1",
"borrowRateMode": "variable"
},
@ -23,7 +23,7 @@
{
"name": "swapBorrowRateMode",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"user": "1",
"borrowRateMode": "stable"
},
@ -33,12 +33,12 @@
]
},
{
"description": "User 0 deposits 1000 LPDAI, user 1 deposits 2 WETH as collateral, borrows 100 LPDAI at variable rate and swaps to stable after one year, fails because stable borrowing is disabled (revert expected)",
"description": "User 0 deposits 1000 DAI, user 1 deposits 2 WETH as collateral, borrows 100 DAI at variable rate and swaps to stable after one year, fails because stable borrowing is disabled (revert expected)",
"actions": [
{
"name": "mint",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "1000",
"user": "0"
},
@ -47,7 +47,7 @@
{
"name": "approve",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"user": "0"
},
"expected": "success"
@ -55,7 +55,7 @@
{
"name": "deposit",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "1000",
"user": "0"
},
@ -90,7 +90,7 @@
{
"name": "borrow",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "100",
"borrowRateMode": "variable",
"user": "1",
@ -101,7 +101,7 @@
{
"name": "swapBorrowRateMode",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"user": "1",
"borrowRateMode": "variable"
},
@ -110,12 +110,12 @@
]
},
{
"description": "User 1 borrows another 100 LPDAI at stable (revert expected), and swaps back to variable after one year (revert expected), repays the loan",
"description": "User 1 borrows another 100 DAI at stable (revert expected), and swaps back to variable after one year (revert expected), repays the loan",
"actions": [
{
"name": "borrow",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "100",
"borrowRateMode": "stable",
"user": "1",
@ -126,7 +126,7 @@
{
"name": "swapBorrowRateMode",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"user": "1",
"borrowRateMode": "stable"
},
@ -134,9 +134,9 @@
},
{
"name": "mint",
"description": "Mint 50 LPDAI to cover the interest",
"description": "Mint 50 DAI to cover the interest",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "50",
"user": "1"
},
@ -145,7 +145,7 @@
{
"name": "approve",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"user": "1"
},
"expected": "success"
@ -153,7 +153,7 @@
{
"name": "repay",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "-1",
"user": "1",
"onBehalfOf": "1",
@ -164,12 +164,12 @@
]
},
{
"description": "User 1 borrows another 100 LPDAI at variable, and tries to swap to stable after one year (revert expected), repays the loan",
"description": "User 1 borrows another 100 DAI at variable, and tries to swap to stable after one year (revert expected), repays the loan",
"actions": [
{
"name": "borrow",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "100",
"borrowRateMode": "variable",
"user": "1",
@ -180,7 +180,7 @@
{
"name": "swapBorrowRateMode",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"user": "1",
"borrowRateMode": "stable"
},
@ -188,9 +188,9 @@
},
{
"name": "mint",
"description": "Mint 50 LPDAI to cover the interest",
"description": "Mint 50 DAI to cover the interest",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "50",
"user": "1"
},
@ -199,7 +199,7 @@
{
"name": "approve",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"user": "1"
},
"expected": "success"
@ -207,7 +207,7 @@
{
"name": "repay",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "-1",
"user": "1",
"onBehalfOf": "1",

View File

@ -3,12 +3,12 @@
"description": "Redeem function.",
"stories": [
{
"description": "Users 0 Deposits 1000 LPDAI and tries to redeem 0 LPDAI (revert expected)",
"description": "Users 0 Deposits 1000 DAI and tries to redeem 0 DAI (revert expected)",
"actions": [
{
"name": "mint",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "1000",
"user": "0"
},
@ -17,7 +17,7 @@
{
"name": "approve",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"user": "0"
},
"expected": "success"
@ -25,7 +25,7 @@
{
"name": "deposit",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "1000",
"user": "0"
},
@ -35,7 +35,7 @@
{
"name": "withdraw",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "0",
"user": "0"
},
@ -45,12 +45,12 @@
]
},
{
"description": "Users 0 tries to redeem 1100 LPDAI from the 1000 LPDAI deposited (revert expected)",
"description": "Users 0 tries to redeem 1100 DAI from the 1000 DAI deposited (revert expected)",
"actions": [
{
"name": "withdraw",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "1100",
"user": "0"
},
@ -60,7 +60,7 @@
]
},
{
"description": "Users 1 deposits 1 WETH, borrows 100 LPDAI stable (revert expected), redeems the 1 WETH deposited",
"description": "Users 1 deposits 1 WETH, borrows 100 DAI stable (revert expected), redeems the 1 WETH deposited",
"actions": [
{
"name": "mint",
@ -91,7 +91,7 @@
{
"name": "borrow",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "100",
"user": "1",
"borrowRateMode": "stable"
@ -110,7 +110,7 @@
]
},
{
"description": "Users 1 deposits 1 WETH, borrows 100 LPDAI at variable rate, tries to redeem the 1 WETH deposited (revert expected)",
"description": "Users 1 deposits 1 WETH, borrows 100 DAI at variable rate, tries to redeem the 1 WETH deposited (revert expected)",
"actions": [
{
"name": "mint",
@ -141,7 +141,7 @@
{
"name": "borrow",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "100",
"user": "1",
"borrowRateMode": "variable"

View File

@ -3,12 +3,12 @@
"description": "withdraw function.",
"stories": [
{
"description": "User 0 Deposits 1000 LPDAI in an empty reserve",
"description": "User 0 Deposits 1000 DAI in an empty reserve",
"actions": [
{
"name": "mint",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "1000",
"user": "0"
},
@ -17,7 +17,7 @@
{
"name": "approve",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"user": "0"
},
"expected": "success"
@ -25,7 +25,7 @@
{
"name": "deposit",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "1000",
"user": "0"
},
@ -34,12 +34,12 @@
]
},
{
"description": "User 0 withdraws half of the deposited LPDAI",
"description": "User 0 withdraws half of the deposited DAI",
"actions": [
{
"name": "withdraw",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "500",
"user": "0"
},
@ -48,12 +48,12 @@
]
},
{
"description": "User 0 withdraws remaining half of the deposited LPDAI",
"description": "User 0 withdraws remaining half of the deposited DAI",
"actions": [
{
"name": "withdraw",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "-1",
"user": "0"
},
@ -62,12 +62,12 @@
]
},
{
"description": "User 0 Deposits 1000 LPUSDC in an empty reserve",
"description": "User 0 Deposits 1000 USDC in an empty reserve",
"actions": [
{
"name": "mint",
"args": {
"reserve": "LPUSDC",
"reserve": "USDC",
"amount": "1000",
"user": "0"
},
@ -76,7 +76,7 @@
{
"name": "approve",
"args": {
"reserve": "LPUSDC",
"reserve": "USDC",
"user": "0"
},
"expected": "success"
@ -84,7 +84,7 @@
{
"name": "deposit",
"args": {
"reserve": "LPUSDC",
"reserve": "USDC",
"amount": "1000",
"user": "0"
},
@ -93,12 +93,12 @@
]
},
{
"description": "User 0 withdraws half of the deposited LPUSDC",
"description": "User 0 withdraws half of the deposited USDC",
"actions": [
{
"name": "withdraw",
"args": {
"reserve": "LPUSDC",
"reserve": "USDC",
"amount": "500",
"user": "0"
},
@ -107,12 +107,12 @@
]
},
{
"description": "User 0 withdraws remaining half of the deposited LPUSDC",
"description": "User 0 withdraws remaining half of the deposited USDC",
"actions": [
{
"name": "withdraw",
"args": {
"reserve": "LPUSDC",
"reserve": "USDC",
"amount": "-1",
"user": "0"
},
@ -180,12 +180,12 @@
]
},
{
"description": "Users 0 and 1 Deposit 1000 LPDAI, both withdraw",
"description": "Users 0 and 1 Deposit 1000 DAI, both withdraw",
"actions": [
{
"name": "mint",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "1000",
"user": "1"
},
@ -194,7 +194,7 @@
{
"name": "approve",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"user": "1"
},
"expected": "success"
@ -202,7 +202,7 @@
{
"name": "deposit",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "1000",
"user": "0"
},
@ -211,7 +211,7 @@
{
"name": "deposit",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "1000",
"user": "1"
},
@ -220,7 +220,7 @@
{
"name": "withdraw",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "-1",
"user": "0"
},
@ -229,7 +229,7 @@
{
"name": "withdraw",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "-1",
"user": "1"
},
@ -238,12 +238,12 @@
]
},
{
"description": "Users 0 deposits 1000 LPDAI, user 1 Deposit 1000 LPUSDC and 1 WETH, borrows 100 LPDAI at stable rate (revert expected). User 1 tries to withdraw all the LPUSDC",
"description": "Users 0 deposits 1000 DAI, user 1 Deposit 1000 USDC and 1 WETH, borrows 100 DAI at stable rate (revert expected). User 1 tries to withdraw all the USDC",
"actions": [
{
"name": "deposit",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "1000",
"user": "0"
},
@ -252,7 +252,7 @@
{
"name": "mint",
"args": {
"reserve": "LPUSDC",
"reserve": "USDC",
"amount": "1000",
"user": "1"
},
@ -261,7 +261,7 @@
{
"name": "approve",
"args": {
"reserve": "LPUSDC",
"reserve": "USDC",
"user": "1"
},
"expected": "success"
@ -269,7 +269,7 @@
{
"name": "deposit",
"args": {
"reserve": "LPUSDC",
"reserve": "USDC",
"amount": "1000",
"user": "1"
},
@ -304,7 +304,7 @@
{
"name": "borrow",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "100",
"user": "1",
"borrowRateMode": "stable"
@ -314,7 +314,7 @@
{
"name": "withdraw",
"args": {
"reserve": "LPUSDC",
"reserve": "USDC",
"amount": "-1",
"user": "1"
},
@ -323,12 +323,12 @@
]
},
{
"description": "Users 0 deposits 1000 LPDAI, user 1 Deposit 1000 LPUSDC and 1 WETH, borrows 100 LPDAI at variable rate. User 1 tries to withdraw all the LPUSDC",
"description": "Users 0 deposits 1000 DAI, user 1 Deposit 1000 USDC and 1 WETH, borrows 100 DAI at variable rate. User 1 tries to withdraw all the USDC",
"actions": [
{
"name": "mint",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "1000",
"user": "0"
},
@ -337,7 +337,7 @@
{
"name": "deposit",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "1000",
"user": "0"
},
@ -346,7 +346,7 @@
{
"name": "mint",
"args": {
"reserve": "LPUSDC",
"reserve": "USDC",
"amount": "10000",
"user": "1"
},
@ -355,7 +355,7 @@
{
"name": "approve",
"args": {
"reserve": "LPUSDC",
"reserve": "USDC",
"user": "1"
},
"expected": "success"
@ -363,7 +363,7 @@
{
"name": "deposit",
"args": {
"reserve": "LPUSDC",
"reserve": "USDC",
"amount": "1000",
"user": "1"
},
@ -398,7 +398,7 @@
{
"name": "borrow",
"args": {
"reserve": "LPDAI",
"reserve": "DAI",
"amount": "100",
"user": "1",
"borrowRateMode": "variable"
@ -408,7 +408,7 @@
{
"name": "withdraw",
"args": {
"reserve": "LPUSDC",
"reserve": "USDC",
"amount": "-1",
"user": "1"
},

View File

@ -1238,9 +1238,9 @@ export const calcExpectedInterestRates = (
const { reservesParams } = configuration;
// Fixes WETH - LpWETH mock token symbol mismatch
if(reserveSymbol === 'WETH') {
reserveSymbol = 'LpWETH';
}
// if(reserveSymbol === 'WETH') {
// reserveSymbol = 'LpWETH';
// }
const reserveIndex = Object.keys(reservesParams).findIndex((value) => value === reserveSymbol);
const [, reserveConfiguration] = (Object.entries(reservesParams) as [string, IReserveParams][])[
reserveIndex

View File

@ -29,7 +29,7 @@ makeSuite('Stable debt token tests', (testEnv: TestEnv) => {
const name = await stableDebtContract.name();
expect(name).to.be.equal('Aave stable debt bearing LpDAI');
expect(name).to.be.equal('Aave AMM Market stable debt DAI');
await expect(stableDebtContract.burn(deployer.address, '1')).to.be.revertedWith(
CT_CALLER_MUST_BE_LENDING_POOL
);

View File

@ -32,24 +32,24 @@ makeSuite('Upgradeability', (testEnv: TestEnv) => {
dai.address,
ZERO_ADDRESS,
ZERO_ADDRESS,
'Aave Interest bearing LpDAI updated',
'aUniDAI',
'Aave AMM Market DAI updated',
'aAmmDAI',
]);
const stableDebtTokenInstance = await deployMockStableDebtToken([
pool.address,
dai.address,
ZERO_ADDRESS,
'Aave stable debt bearing LpDAI updated',
'stableDebtUniDAI',
'Aave AMM Market stable debt DAI updated',
'stableDebtAmmDAI',
]);
const variableDebtTokenInstance = await deployMockVariableDebtToken([
pool.address,
dai.address,
ZERO_ADDRESS,
'Aave variable debt bearing LpDAI updated',
'variableDebtUniDAI',
'Aave AMM Market variable debt DAI updated',
'variableDebtAmmDAI',
]);
newATokenAddress = aTokenInstance.address;
@ -108,7 +108,7 @@ makeSuite('Upgradeability', (testEnv: TestEnv) => {
const tokenName = await aDai.name();
expect(tokenName).to.be.eq('Aave Interest bearing LpDAI updated', 'Invalid token name');
expect(tokenName).to.be.eq('Aave AMM Market DAI updated', 'Invalid token name');
});
it('Tries to update the DAI Stable debt token implementation with a different address than the lendingPoolManager', async () => {
@ -168,7 +168,7 @@ makeSuite('Upgradeability', (testEnv: TestEnv) => {
const tokenName = await debtToken.name();
expect(tokenName).to.be.eq('Aave stable debt bearing LpDAI updated', 'Invalid token name');
expect(tokenName).to.be.eq('Aave AMM Market stable debt DAI updated', 'Invalid token name');
});
it('Tries to update the DAI variable debt token implementation with a different address than the lendingPoolManager', async () => {
@ -229,6 +229,6 @@ makeSuite('Upgradeability', (testEnv: TestEnv) => {
const tokenName = await debtToken.name();
expect(tokenName).to.be.eq('Aave variable debt bearing LpDAI updated', 'Invalid token name');
expect(tokenName).to.be.eq('Aave AMM Market variable debt DAI updated', 'Invalid token name');
});
});