Replaced "Uniswap" market name & references with "Lp"

This commit is contained in:
Zer0dot 2021-02-08 11:05:10 -05:00
parent e5274928cc
commit 655f9751f7
28 changed files with 191 additions and 189 deletions

View File

@ -8,7 +8,7 @@ import {
} from './types';
import { getParamPerPool } from './contracts-helpers';
import AaveConfig from '../markets/aave';
import UniswapConfig from '../markets/uniswap';
import LpConfig from '../markets/lp';
import { CommonsConfig } from '../markets/aave/commons';
import { DRE, filterMapBy } from './misc-utils';
import { tEthereumAddress } from './types';
@ -18,15 +18,15 @@ import { deployWETHMocked } from './contracts-deployments';
export enum ConfigNames {
Commons = 'Commons',
Aave = 'Aave',
Uniswap = 'Uniswap',
Lp = 'Lp',
}
export const loadPoolConfig = (configName: ConfigNames): PoolConfiguration => {
switch (configName) {
case ConfigNames.Aave:
return AaveConfig;
case ConfigNames.Uniswap:
return UniswapConfig;
case ConfigNames.Lp:
return LpConfig;
case ConfigNames.Commons:
return CommonsConfig;
default:
@ -44,8 +44,8 @@ export const getReservesConfigByPool = (pool: AavePools): iMultiPoolsAssets<IRes
[AavePools.proto]: {
...AaveConfig.ReservesConfig,
},
[AavePools.uniswap]: {
...UniswapConfig.ReservesConfig,
[AavePools.lp]: {
...LpConfig.ReservesConfig,
},
},
pool

View File

@ -159,12 +159,12 @@ export const getParamPerNetwork = <T>(
}
};
export const getParamPerPool = <T>({ proto, uniswap }: iParamsPerPool<T>, pool: AavePools) => {
export const getParamPerPool = <T>({ proto, lp }: iParamsPerPool<T>, pool: AavePools) => {
switch (pool) {
case AavePools.proto:
return proto;
case AavePools.uniswap:
return uniswap;
case AavePools.lp:
return lp;
default:
return proto;
}

View File

@ -22,7 +22,7 @@ export enum EthereumNetworkNames {
export enum AavePools {
proto = 'proto',
uniswap = 'uniswap',
lp = 'lp',
}
export enum eContractid {
@ -254,7 +254,7 @@ export type iAavePoolAssets<T> = Pick<
| 'ENJ'
>;
export type iUniswapPoolAssets<T> = Pick<
export type iLpPoolAssets<T> = Pick<
iAssetsWithoutUSD<T>,
| 'UniDAI'
| 'UniUSDC'
@ -364,7 +364,7 @@ export interface iParamsPerNetwork<T> {
export interface iParamsPerPool<T> {
[AavePools.proto]: T;
[AavePools.uniswap]: T;
[AavePools.lp]: T;
}
export interface iBasicDistributionParams {
@ -440,8 +440,8 @@ export interface IAaveConfiguration extends ICommonConfiguration {
ReservesConfig: iAavePoolAssets<IReserveParams>;
}
export interface IUniswapConfiguration extends ICommonConfiguration {
ReservesConfig: iUniswapPoolAssets<IReserveParams>;
export interface ILpConfiguration extends ICommonConfiguration {
ReservesConfig: iLpPoolAssets<IReserveParams>;
}
export interface ITokenAddress {
[token: string]: tEthereumAddress;

View File

@ -1,5 +1,5 @@
import { oneRay, ZERO_ADDRESS } from '../../helpers/constants';
import { IUniswapConfiguration, EthereumNetwork, eEthereumNetwork } from '../../helpers/types';
import { ILpConfiguration, EthereumNetwork, eEthereumNetwork } from '../../helpers/types';
import { CommonsConfig } from './commons';
import {
@ -28,9 +28,9 @@ import {
// POOL--SPECIFIC PARAMS
// ----------------
export const UniswapConfig: IUniswapConfiguration = {
export const lpConfig: ILpConfiguration = {
...CommonsConfig,
MarketId: 'Uniswap V2 market',
MarketId: 'Aave LP market',
ProviderId: 2,
ReservesConfig: {
UniWETH: strategyWETH,
@ -100,4 +100,4 @@ export const UniswapConfig: IUniswapConfiguration = {
},
};
export default UniswapConfig;
export default lpConfig;

View File

@ -57,7 +57,7 @@ export const strategyUSDC: IReserveParams = {
optimalUtilizationRate: new BigNumber(0.8).multipliedBy(oneRay).toFixed(),
baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(),
variableRateSlope1: new BigNumber(0.04).multipliedBy(oneRay).toFixed(),
variableRateSlope2: new BigNumber(0.75).multipliedBy(oneRay).toFixed(),
variableRateSlope2: new BigNumber(0.60).multipliedBy(oneRay).toFixed(),
stableRateSlope1: new BigNumber(0.02).multipliedBy(oneRay).toFixed(),
stableRateSlope2: new BigNumber(0.60).multipliedBy(oneRay).toFixed(),
baseLTVAsCollateral: '8000',

3
package-lock.json generated
View File

@ -8136,7 +8136,8 @@
"integrity": "sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA=",
"dev": true,
"requires": {
"color-name": "1.1.3"
"map-visit": "^1.0.0",
"object-visit": "^1.0.0"
}
},
"color-convert": {

View File

@ -18,6 +18,7 @@
"console:fork": "MAINNET_FORK=true hardhat console",
"test": "TS_NODE_TRANSPILE_ONLY=1 hardhat test ./test-suites/test-aave/*.spec.ts",
"test-lp": "TS_NODE_TRANSPILE_ONLY=1 hardhat test ./test-suites/test-lp/*.spec.ts",
"test-lp-scenarios": "TS_NODE_TRANSPILE_ONLY=1 hardhat test ./test-suites/test-lp/__setup.spec.ts test-suites/test-lp/scenario.spec.ts",
"test-scenarios": "npx hardhat test test-suites/test-aave/__setup.spec.ts test-suites/test-aave/scenario.spec.ts",
"test-repay-with-collateral": "hardhat test test-suites/test-aave/__setup.spec.ts test-suites/test-aave/repay-with-collateral.spec.ts",
"test-liquidate-with-collateral": "hardhat test test-suites/test-aave/__setup.spec.ts test-suites/test-aave/flash-liquidation-with-collateral.spec.ts",

View File

@ -6,10 +6,10 @@ import {EthereumNetworkNames} from '../../helpers/types';
import {printContracts} from '../../helpers/misc-utils';
import {totalGas} from '../../helpers/gas-tracker';
task('uniswap:mainnet', 'Deploy development enviroment')
task('lp:mainnet', 'Deploy development enviroment')
.addFlag('verify', 'Verify contracts at Etherscan')
.setAction(async ({verify}, DRE) => {
const POOL_NAME = ConfigNames.Uniswap;
const POOL_NAME = ConfigNames.Lp;
const network = <EthereumNetworkNames>DRE.network.name;
await DRE.run('set-DRE');

View File

@ -45,7 +45,7 @@ import {
} from '../../helpers/oracles-helpers';
import { DRE, waitForTx } from '../../helpers/misc-utils';
import { initReservesByHelper, configureReservesByHelper } from '../../helpers/init-helpers';
import UniswapConfig from '../../markets/uniswap';
import LpConfig from '../../markets/lp';
import { ZERO_ADDRESS } from '../../helpers/constants';
import {
getLendingPool,
@ -54,26 +54,26 @@ import {
} from '../../helpers/contracts-getters';
import { WETH9Mocked } from '../../types/WETH9Mocked';
const MOCK_USD_PRICE_IN_WEI = UniswapConfig.ProtocolGlobalParams.MockUsdPriceInWei;
const ALL_ASSETS_INITIAL_PRICES = UniswapConfig.Mocks.AllAssetsInitialPrices;
const USD_ADDRESS = UniswapConfig.ProtocolGlobalParams.UsdAddress;
const MOCK_CHAINLINK_AGGREGATORS_PRICES = UniswapConfig.Mocks.AllAssetsInitialPrices;
const LENDING_RATE_ORACLE_RATES_COMMON = UniswapConfig.LendingRateOracleRatesCommon;
const MOCK_USD_PRICE_IN_WEI = LpConfig.ProtocolGlobalParams.MockUsdPriceInWei;
const ALL_ASSETS_INITIAL_PRICES = LpConfig.Mocks.AllAssetsInitialPrices;
const USD_ADDRESS = LpConfig.ProtocolGlobalParams.UsdAddress;
const MOCK_CHAINLINK_AGGREGATORS_PRICES = LpConfig.Mocks.AllAssetsInitialPrices;
const LENDING_RATE_ORACLE_RATES_COMMON = LpConfig.LendingRateOracleRatesCommon;
const deployAllMockTokens = async (deployer: Signer) => {
const tokens: { [symbol: string]: MockContract | MintableERC20 | WETH9Mocked } = {};
const uniswapConfigData = getReservesConfigByPool(AavePools.uniswap);
const lpConfigData = getReservesConfigByPool(AavePools.lp);
for (const tokenSymbol of Object.keys(TokenContractId)) {
if (tokenSymbol === 'UniWETH') {
tokens[tokenSymbol] = await deployWETHMocked();
await registerContractInJsonDb(tokenSymbol.toUpperCase(), tokens[tokenSymbol]);
await registerContractInJsonDb('WETH', tokens[tokenSymbol]);
continue;
}
let decimals = 18;
let configData = (<any>uniswapConfigData)[tokenSymbol];
let configData = (<any>lpConfigData)[tokenSymbol];
if (!configData) {
decimals = 18;
@ -96,7 +96,7 @@ const buildTestEnv = async (deployer: Signer, secondaryWallet: Signer) => {
const mockTokens = await deployAllMockTokens(deployer);
const addressesProvider = await deployLendingPoolAddressesProvider(UniswapConfig.MarketId);
const addressesProvider = await deployLendingPoolAddressesProvider(LpConfig.MarketId);
await waitForTx(await addressesProvider.setPoolAdmin(aaveAdmin));
//setting users[1] as emergency admin, which is in position 2 in the DRE addresses list
@ -225,7 +225,7 @@ const buildTestEnv = async (deployer: Signer, secondaryWallet: Signer) => {
aaveAdmin
);
const reservesParams = getReservesConfigByPool(AavePools.uniswap);
const reservesParams = getReservesConfigByPool(AavePools.lp);
const testHelpers = await deployAaveProtocolDataProvider(addressesProvider.address);
@ -234,7 +234,7 @@ const buildTestEnv = async (deployer: Signer, secondaryWallet: Signer) => {
console.log('Initialize configuration');
const config = loadPoolConfig(ConfigNames.Uniswap);
const config = loadPoolConfig(ConfigNames.Lp);
const treasuryAddress = await getTreasuryAddress(config);
@ -279,7 +279,7 @@ before(async () => {
const MAINNET_FORK = process.env.MAINNET_FORK === 'true';
if (MAINNET_FORK) {
await rawBRE.run('uniswap:mainnet');
await rawBRE.run('lp:mainnet');
} else {
console.log('-> Deploying test environment...');
await buildTestEnv(deployer, secondaryWallet);

View File

@ -4,7 +4,7 @@ import { expect } from 'chai';
import { ethers } from 'ethers';
import { RateMode, ProtocolErrors } from '../../helpers/types';
import { makeSuite, TestEnv } from './helpers/make-suite';
import { CommonsConfig } from '../../markets/uniswap/commons';
import { CommonsConfig } from '../../markets/lp/commons';
const AAVE_REFERRAL = CommonsConfig.ProtocolGlobalParams.AaveReferral;

View File

@ -2,7 +2,7 @@ import { TestEnv, makeSuite } from './helpers/make-suite';
import { APPROVAL_AMOUNT_LENDING_POOL, RAY } from '../../helpers/constants';
import { convertToCurrencyDecimals } from '../../helpers/contracts-helpers';
import { ProtocolErrors } from '../../helpers/types';
import { strategyWETH } from '../../markets/uniswap/reservesConfigs';
import { strategyWETH } from '../../markets/lp/reservesConfigs';
const { expect } = require('chai');

View File

@ -20,7 +20,7 @@ import {
import { DelegationAwareATokenFactory } from '../../types';
import { DelegationAwareAToken } from '../../types/DelegationAwareAToken';
import { MintableDelegationERC20 } from '../../types/MintableDelegationERC20';
import UniswapConfig from '../../markets/uniswap';
import LpConfig from '../../markets/lp';
const { parseEther } = ethers.utils;
@ -35,7 +35,7 @@ makeSuite('AToken: underlying delegation', (testEnv: TestEnv) => {
delegationERC20 = await deployMintableDelegationERC20(['DEL', 'DEL', '18']);
delegationAToken = await deployDelegationAwareAToken(
[pool.address, delegationERC20.address, await getTreasuryAddress(UniswapConfig), ZERO_ADDRESS, 'aDEL', 'aDEL'],
[pool.address, delegationERC20.address, await getTreasuryAddress(LpConfig), ZERO_ADDRESS, 'aDEL', 'aDEL'],
false
);

View File

@ -36,7 +36,7 @@ import { getParamPerNetwork } from '../../../helpers/contracts-helpers';
import { WETH9Mocked } from '../../../types/WETH9Mocked';
import { WETHGateway } from '../../../types/WETHGateway';
import { solidity } from 'ethereum-waffle';
import { UniswapConfig } from '../../../markets/uniswap';
import { lpConfig } from '../../../markets/lp';
import { FlashLiquidationAdapter } from '../../../types';
import { HardhatRuntimeEnvironment } from 'hardhat/types';
import { usingTenderly } from '../../../helpers/tenderly-utils';
@ -118,7 +118,7 @@ export async function initializeMakeSuite() {
if (process.env.MAINNET_FORK === 'true') {
testEnv.registry = await getLendingPoolAddressesProviderRegistry(
getParamPerNetwork(UniswapConfig.ProviderRegistry, eEthereumNetwork.main)
getParamPerNetwork(lpConfig.ProviderRegistry, eEthereumNetwork.main)
);
} else {
testEnv.registry = await getLendingPoolAddressesProviderRegistry();

View File

@ -3,7 +3,7 @@
"description": "Test cases for the deposit function.",
"stories": [
{
"description": "User 0 deposits 1000 UNIDAI, user 1 deposits 1 UNIWETH as collateral and tries to borrow 100 UNIDAI with rate mode NONE (revert expected)",
"description": "User 0 deposits 1000 UNIDAI, user 1 deposits 1 WETH as collateral and tries to borrow 100 UNIDAI with rate mode NONE (revert expected)",
"actions": [
{
"name": "mint",
@ -34,7 +34,7 @@
{
"name": "mint",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"amount": "1",
"user": "1"
},
@ -43,7 +43,7 @@
{
"name": "approve",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"user": "1"
},
"expected": "success"
@ -51,7 +51,7 @@
{
"name": "deposit",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"amount": "1",
"user": "1"
},
@ -71,7 +71,7 @@
]
},
{
"description": "User 0 deposits 1000 UNIDAI, user 1 deposits 1 UNIWETH as collateral and tries to borrow 100 UNIDAI with an invalid rate mode (revert expected)",
"description": "User 0 deposits 1000 UNIDAI, user 1 deposits 1 WETH as collateral and tries to borrow 100 UNIDAI with an invalid rate mode (revert expected)",
"actions": [
{
"name": "mint",
@ -102,7 +102,7 @@
{
"name": "mint",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"amount": "1",
"user": "1"
},
@ -111,7 +111,7 @@
{
"name": "approve",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"user": "1"
},
"expected": "success"
@ -119,7 +119,7 @@
{
"name": "deposit",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"amount": "1",
"user": "1"
},

View File

@ -3,7 +3,7 @@
"description": "Test cases for the borrow function, stable mode.",
"stories": [
{
"description": "User 0 deposits 1000 UNIDAI, user 1 deposits 1 UNIWETH as collateral and borrows 100 UNIDAI at stable rate",
"description": "User 0 deposits 1000 UNIDAI, user 1 deposits 1 WETH as collateral and borrows 100 UNIDAI at stable rate",
"actions": [
{
"name": "mint",
@ -34,7 +34,7 @@
{
"name": "mint",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"amount": "1",
"user": "1"
},
@ -43,7 +43,7 @@
{
"name": "approve",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"user": "1"
},
"expected": "success"
@ -51,7 +51,7 @@
{
"name": "deposit",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"amount": "1",
"user": "1"
@ -221,7 +221,7 @@
]
},
{
"description": "User 0 deposits 1000 UNIDAI, user 1,2,3,4 deposit 1 UNIWETH each and borrow 100 UNIDAI at stable rate. Everything is repaid, user 0 withdraws",
"description": "User 0 deposits 1000 UNIDAI, user 1,2,3,4 deposit 1 WETH each and borrow 100 UNIDAI at stable rate. Everything is repaid, user 0 withdraws",
"actions": [
{
"name": "mint",
@ -252,7 +252,7 @@
{
"name": "mint",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"amount": "1",
"user": "1"
},
@ -261,7 +261,7 @@
{
"name": "approve",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"user": "1"
},
"expected": "success"
@ -269,7 +269,7 @@
{
"name": "deposit",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"amount": "1",
"user": "1"
},
@ -289,7 +289,7 @@
{
"name": "mint",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"amount": "1",
"user": "2"
},
@ -298,7 +298,7 @@
{
"name": "approve",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"user": "2"
},
"expected": "success"
@ -306,7 +306,7 @@
{
"name": "deposit",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"amount": "1",
"user": "2"
},
@ -326,7 +326,7 @@
{
"name": "mint",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"amount": "1",
"user": "3"
},
@ -335,7 +335,7 @@
{
"name": "approve",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"user": "3"
},
"expected": "success"
@ -343,7 +343,7 @@
{
"name": "deposit",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"amount": "1",
"user": "3"
},
@ -363,7 +363,7 @@
{
"name": "mint",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"amount": "1",
"user": "4"
},
@ -372,7 +372,7 @@
{
"name": "approve",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"user": "4"
},
"expected": "success"
@ -380,7 +380,7 @@
{
"name": "deposit",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"amount": "1",
"user": "4"
},
@ -525,7 +525,7 @@
]
},
{
"description": "User 0 deposits 1000 UNIDAI, user 1 deposits 2 UNIWETH and borrow 100 UNIDAI at stable rate first, then 100 UNIDAI at variable rate, repays everything. User 0 withdraws",
"description": "User 0 deposits 1000 UNIDAI, user 1 deposits 2 WETH and borrow 100 UNIDAI at stable rate first, then 100 UNIDAI at variable rate, repays everything. User 0 withdraws",
"actions": [
{
"name": "mint",
@ -556,7 +556,7 @@
{
"name": "mint",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"amount": "2",
"user": "1"
},
@ -565,7 +565,7 @@
{
"name": "approve",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"user": "1"
},
"expected": "success"
@ -573,7 +573,7 @@
{
"name": "deposit",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"amount": "2",
"user": "1"
},

View File

@ -34,7 +34,7 @@
]
},
{
"description": "User 0 deposits 1000 UNIDAI, user 1 deposits 1 UNIWETH as collateral and borrows 100 UNIDAI at variable rate",
"description": "User 0 deposits 1000 UNIDAI, user 1 deposits 1 WETH as collateral and borrows 100 UNIDAI at variable rate",
"actions": [
{
"name": "mint",
@ -65,7 +65,7 @@
{
"name": "mint",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"amount": "1",
"user": "1"
},
@ -74,7 +74,7 @@
{
"name": "approve",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"user": "1"
},
"expected": "success"
@ -82,7 +82,7 @@
{
"name": "deposit",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"amount": "1",
"user": "1"
},
@ -203,7 +203,7 @@
{
"name": "withdraw",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"amount": "-1",
"user": "1"
},
@ -212,12 +212,12 @@
]
},
{
"description": "User 2 deposits a small amount of UNIWETH to account for rounding errors",
"description": "User 2 deposits a small amount of WETH to account for rounding errors",
"actions": [
{
"name": "mint",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"amount": "0.001",
"user": "2"
},
@ -226,7 +226,7 @@
{
"name": "approve",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"user": "2"
},
"expected": "success"
@ -234,7 +234,7 @@
{
"name": "deposit",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"amount": "0.001",
"user": "2"
},
@ -243,12 +243,12 @@
]
},
{
"description": "User 0 deposits 1 UNIWETH, user 1 deposits 100 UNILINKWETH 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",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"amount": "1",
"user": "0"
},
@ -257,7 +257,7 @@
{
"name": "approve",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"user": "0"
},
"expected": "success"
@ -265,7 +265,7 @@
{
"name": "deposit",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"amount": "1",
"user": "0"
},
@ -301,7 +301,7 @@
{
"name": "borrow",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"amount": "0.5",
"borrowRateMode": "variable",
"user": "1",
@ -317,7 +317,7 @@
{
"name": "repay",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"amount": "0",
"user": "1",
"onBehalfOf": "1",
@ -334,7 +334,7 @@
{
"name": "repay",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"amount": "-1",
"user": "2",
"borrowRateMode": "variable",
@ -346,12 +346,12 @@
]
},
{
"description": "User 3 repays a small amount of UNIWETH on behalf of user 1",
"description": "User 3 repays a small amount of WETH on behalf of user 1",
"actions": [
{
"name": "mint",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"amount": "1",
"user": "3"
},
@ -360,7 +360,7 @@
{
"name": "approve",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"user": "3"
},
"expected": "success"
@ -368,7 +368,7 @@
{
"name": "repay",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"amount": "0.2",
"user": "3",
"borrowRateMode": "variable",
@ -379,12 +379,12 @@
]
},
{
"description": "User 1 repays the UNIWETH borrow after one year",
"description": "User 1 repays the WETH borrow after one year",
"actions": [
{
"name": "mint",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"amount": "1",
"user": "2"
},
@ -393,7 +393,7 @@
{
"name": "approve",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"user": "2"
},
"expected": "success"
@ -401,7 +401,7 @@
{
"name": "repay",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"amount": "-1",
"borrowRateMode": "variable",
"user": "1",
@ -412,12 +412,12 @@
]
},
{
"description": "User 0 withdraws the deposited UNIWETH plus interest",
"description": "User 0 withdraws the deposited WETH plus interest",
"actions": [
{
"name": "withdraw",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"amount": "-1",
"user": "0"
},
@ -472,7 +472,7 @@
]
},
{
"description": "User 0 deposits 1000 UNIUSDC, user 1 deposits 1 UNIWETH as collateral and borrows 100 UNIUSDC at variable rate",
"description": "User 0 deposits 1000 UNIUSDC, user 1 deposits 1 WETH as collateral and borrows 100 UNIUSDC at variable rate",
"actions": [
{
"name": "mint",
@ -503,7 +503,7 @@
{
"name": "mint",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"amount": "1",
"user": "1"
},
@ -512,7 +512,7 @@
{
"name": "approve",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"user": "1"
},
"expected": "success"
@ -520,7 +520,7 @@
{
"name": "deposit",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"amount": "1",
"user": "1"
},
@ -609,7 +609,7 @@
{
"name": "withdraw",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"amount": "-1",
"user": "1"
},
@ -665,7 +665,7 @@
{
"name": "mint",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"amount": "0.1",
"user": "1"
},
@ -674,7 +674,7 @@
{
"name": "approve",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"user": "1"
},
"expected": "success"
@ -682,7 +682,7 @@
{
"name": "deposit",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"amount": "0.1",
"user": "3"
},
@ -707,7 +707,7 @@
{
"name": "withdraw",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"amount": "-1",
"user": "3"
},
@ -763,7 +763,7 @@
{
"name": "mint",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"amount": "1",
"user": "3"
},
@ -772,7 +772,7 @@
{
"name": "approve",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"user": "1"
},
"expected": "success"
@ -780,7 +780,7 @@
{
"name": "deposit",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"amount": "0.1",
"user": "3"
},
@ -805,7 +805,7 @@
{
"name": "withdraw",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"amount": "-1",
"user": "3"
},
@ -814,7 +814,7 @@
]
},
{
"description": "User 0 deposits 1000 UNIDAI, user 6 deposits 2 UNIWETH and borrow 100 UNIDAI at variable rate first, then 100 UNIDAI at stable rate, repays everything. User 0 withdraws",
"description": "User 0 deposits 1000 UNIDAI, user 6 deposits 2 WETH and borrow 100 UNIDAI at variable rate first, then 100 UNIDAI at stable rate, repays everything. User 0 withdraws",
"actions": [
{
"name": "mint",
@ -845,7 +845,7 @@
{
"name": "mint",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"amount": "2",
"user": "6"
},
@ -854,7 +854,7 @@
{
"name": "approve",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"user": "6"
},
"expected": "success"
@ -862,7 +862,7 @@
{
"name": "deposit",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"amount": "2",
"user": "6"
},

View File

@ -3,12 +3,12 @@
"description": "Test cases for the credit delegation related functions.",
"stories": [
{
"description": "User 3 deposits 1000 UNIWETH. User 0 deposits 1000 UNIDAI, user 0 delegates borrowing of 1 UNIWETH on variable to user 4, user 4 borrows 1 UNIWETH variable on behalf of user 0",
"description": "User 3 deposits 1000 WETH. User 0 deposits 1000 UNIDAI, 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",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"amount": "1000",
"user": "3"
},
@ -17,7 +17,7 @@
{
"name": "approve",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"user": "3"
},
"expected": "success"
@ -25,7 +25,7 @@
{
"name": "deposit",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"amount": "1000",
"user": "3"
},
@ -60,7 +60,7 @@
{
"name": "delegateBorrowAllowance",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"amount": "2",
"user": "0",
"borrowRateMode": "variable",
@ -71,7 +71,7 @@
{
"name": "borrow",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"amount": "1",
"user": "4",
"onBehalfOf": "0",
@ -82,12 +82,12 @@
]
},
{
"description": "User 4 trying to borrow 1 UNIWETH stable on behalf of user 0, revert expected",
"description": "User 4 trying to borrow 1 WETH stable on behalf of user 0, revert expected",
"actions": [
{
"name": "borrow",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"amount": "1",
"user": "4",
"onBehalfOf": "0",
@ -99,12 +99,12 @@
]
},
{
"description": "User 0 delegates borrowing of 1 UNIWETH to user 4, user 4 borrows 3 UNIWETH variable on behalf of user 0, revert expected",
"description": "User 0 delegates borrowing of 1 WETH to user 4, user 4 borrows 3 WETH variable on behalf of user 0, revert expected",
"actions": [
{
"name": "delegateBorrowAllowance",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"amount": "1",
"user": "0",
"borrowRateMode": "variable",
@ -115,7 +115,7 @@
{
"name": "borrow",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"amount": "3",
"user": "4",
"onBehalfOf": "0",
@ -127,12 +127,12 @@
]
},
{
"description": "User 0 delegates borrowing of 1 UNIWETH on stable to user 2, user 2 borrows 1 UNIWETH stable on behalf of user 0",
"description": "User 0 delegates borrowing of 1 WETH on stable to user 2, user 2 borrows 1 WETH stable on behalf of user 0",
"actions": [
{
"name": "delegateBorrowAllowance",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"amount": "1",
"user": "0",
"borrowRateMode": "stable",
@ -143,7 +143,7 @@
{
"name": "borrow",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"amount": "1",
"user": "2",
"onBehalfOf": "0",

View File

@ -127,12 +127,12 @@
]
},
{
"description": "User 0 deposits 1 UNIWETH in an empty reserve",
"description": "User 0 deposits 1 WETH in an empty reserve",
"actions": [
{
"name": "mint",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"amount": "1",
"user": "0"
},
@ -141,7 +141,7 @@
{
"name": "approve",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"user": "0"
},
"expected": "success"
@ -149,7 +149,7 @@
{
"name": "deposit",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"amount": "1",
"user": "0"
},
@ -158,12 +158,12 @@
]
},
{
"description": "User 1 deposits 1 UNIWETH after user 0",
"description": "User 1 deposits 1 WETH after user 0",
"actions": [
{
"name": "mint",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"amount": "1",
"user": "1"
},
@ -173,7 +173,7 @@
{
"name": "approve",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"user": "1"
},
"expected": "success"
@ -181,7 +181,7 @@
{
"name": "deposit",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"amount": "1",
"user": "1"
},
@ -190,12 +190,12 @@
]
},
{
"description": "User 1 deposits 0 UNIWETH (revert expected)",
"description": "User 1 deposits 0 WETH (revert expected)",
"actions": [
{
"name": "mint",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"amount": "1",
"user": "0"
},
@ -204,7 +204,7 @@
{
"name": "deposit",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"amount": "0",
"user": "1"
},
@ -229,7 +229,7 @@
]
},
{
"description": "User 1 deposits 100 UNIDAI on behalf of user 2, user 2 tries to borrow 0.1 UNIWETH",
"description": "User 1 deposits 100 UNIDAI on behalf of user 2, user 2 tries to borrow 0.1 WETH",
"actions": [
{
"name": "mint",
@ -253,7 +253,7 @@
{
"name": "borrow",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"amount": "0.1",
"borrowRateMode": "variable",
"user": "2"

View File

@ -18,7 +18,7 @@
]
},
{
"description": "User 0 deposits 1000 UNIUSDC, user 1 deposits 7 UNIWETH, borrows 250 UNIUSDC at a stable rate, user 0 rebalances user 1 (revert expected)",
"description": "User 0 deposits 1000 UNIUSDC, user 1 deposits 7 WETH, borrows 250 UNIUSDC at a stable rate, user 0 rebalances user 1 (revert expected)",
"actions": [
{
"name": "mint",
@ -49,7 +49,7 @@
{
"name": "mint",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"amount": "7",
"user": "1"
},
@ -58,7 +58,7 @@
{
"name": "approve",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"user": "1"
},
"expected": "success"
@ -66,7 +66,7 @@
{
"name": "deposit",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"amount": "7",
"user": "1"
},

View File

@ -43,12 +43,12 @@
]
},
{
"description": "User 1 Deposits 2 UNIWETH, disables UNIWETH as collateral, borrows 400 UNIDAI (revert expected)",
"description": "User 1 Deposits 2 WETH, disables WETH as collateral, borrows 400 UNIDAI (revert expected)",
"actions": [
{
"name": "mint",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"amount": "2",
"user": "1"
},
@ -57,7 +57,7 @@
{
"name": "approve",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"user": "1"
},
"expected": "success"
@ -65,7 +65,7 @@
{
"name": "deposit",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"amount": "2",
"user": "1"
},
@ -74,7 +74,7 @@
{
"name": "setUseAsCollateral",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"user": "1",
"useAsCollateral": "false"
},
@ -94,12 +94,12 @@
]
},
{
"description": "User 1 enables UNIWETH as collateral, borrows 400 UNIDAI",
"description": "User 1 enables WETH as collateral, borrows 400 UNIDAI",
"actions": [
{
"name": "setUseAsCollateral",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"user": "1",
"useAsCollateral": "true"
},
@ -118,12 +118,12 @@
]
},
{
"description": "User 1 disables UNIWETH as collateral (revert expected)",
"description": "User 1 disables WETH as collateral (revert expected)",
"actions": [
{
"name": "setUseAsCollateral",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"user": "1",
"useAsCollateral": "false"
},
@ -133,7 +133,7 @@
]
},
{
"description": "User 1 Deposits 10 UNILINKWETH, disables UNIWETH as collateral. Should revert as 10 UNILINKWETH 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",
@ -164,7 +164,7 @@
{
"name": "setUseAsCollateral",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"user": "1",
"useAsCollateral": "false"
},
@ -173,7 +173,7 @@
]
},
{
"description": "User 1 Deposits 640 more UNILINKWETH (enough to cover the UNIDAI debt), disables UNIWETH as collateral",
"description": "User 1 Deposits 640 more UNILINKWETH (enough to cover the UNIDAI debt), disables WETH as collateral",
"actions": [
{
"name": "mint",
@ -196,7 +196,7 @@
{
"name": "setUseAsCollateral",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"user": "1",
"useAsCollateral": "false"
},
@ -219,12 +219,12 @@
]
},
{
"description": "User 1 reenables UNIWETH as collateral",
"description": "User 1 reenables WETH as collateral",
"actions": [
{
"name": "setUseAsCollateral",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"user": "1",
"useAsCollateral": "true"
},

View File

@ -64,7 +64,7 @@
{
"name": "mint",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"amount": "2",
"user": "1"
},
@ -73,7 +73,7 @@
{
"name": "approve",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"user": "1"
},
"expected": "success"
@ -81,7 +81,7 @@
{
"name": "deposit",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"amount": "2",
"user": "1"
},

View File

@ -60,12 +60,12 @@
]
},
{
"description": "Users 1 deposits 1 UNIWETH, borrows 100 UNIDAI, tries to redeem the 1 UNIWETH deposited (revert expected)",
"description": "Users 1 deposits 1 WETH, borrows 100 UNIDAI, tries to redeem the 1 WETH deposited (revert expected)",
"actions": [
{
"name": "mint",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"amount": "1",
"user": "1"
},
@ -74,7 +74,7 @@
{
"name": "approve",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"user": "1"
},
"expected": "success"
@ -82,7 +82,7 @@
{
"name": "deposit",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"amount": "1",
"user": "1"
},
@ -101,7 +101,7 @@
{
"name": "withdraw",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"amount": "-1",
"user": "1"
},

View File

@ -121,12 +121,12 @@
]
},
{
"description": "User 0 Deposits 1 UNIWETH in an empty reserve",
"description": "User 0 Deposits 1 WETH in an empty reserve",
"actions": [
{
"name": "mint",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"amount": "1",
"user": "0"
},
@ -135,7 +135,7 @@
{
"name": "approve",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"user": "0"
},
"expected": "success"
@ -143,7 +143,7 @@
{
"name": "deposit",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"amount": "1",
"user": "0"
},
@ -152,12 +152,12 @@
]
},
{
"description": "User 0 withdraws half of the deposited UNIWETH",
"description": "User 0 withdraws half of the deposited WETH",
"actions": [
{
"name": "withdraw",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"amount": "0.5",
"user": "0"
},
@ -171,7 +171,7 @@
{
"name": "withdraw",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"amount": "-1",
"user": "0"
},
@ -238,7 +238,7 @@
]
},
{
"description": "Users 0 deposits 1000 UNIDAI, user 1 Deposit 1000 UNIUSDC and 1 UNIWETH, borrows 100 UNIDAI. User 1 tries to withdraw all the UNIUSDC",
"description": "Users 0 deposits 1000 UNIDAI, user 1 Deposit 1000 UNIUSDC and 1 WETH, borrows 100 UNIDAI. User 1 tries to withdraw all the UNIUSDC",
"actions": [
{
"name": "deposit",
@ -278,7 +278,7 @@
{
"name": "mint",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"amount": "1",
"user": "1"
},
@ -287,7 +287,7 @@
{
"name": "approve",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"user": "1"
},
"expected": "success"
@ -295,7 +295,7 @@
{
"name": "deposit",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"amount": "1",
"user": "1"
},
@ -323,12 +323,12 @@
]
},
{
"description": "Users 1 tries to withdraw 0.05 UNIWETH, which does not bring the HF below 1",
"description": "Users 1 tries to withdraw 0.05 WETH, which does not bring the HF below 1",
"actions": [
{
"name": "withdraw",
"args": {
"reserve": "UNIWETH",
"reserve": "WETH",
"amount": "0.05",
"user": "1"
},

View File

@ -2,7 +2,7 @@ import BigNumber from 'bignumber.js';
import { ONE_YEAR, RAY, MAX_UINT_AMOUNT, PERCENTAGE_FACTOR } from '../../../../helpers/constants';
import {
IReserveParams,
iUniswapPoolAssets,
iLpPoolAssets,
RateMode,
tEthereumAddress,
} from '../../../../helpers/types';
@ -12,7 +12,7 @@ import { ReserveData, UserReserveData } from './interfaces';
export const strToBN = (amount: string): BigNumber => new BigNumber(amount);
interface Configuration {
reservesParams: iUniswapPoolAssets<IReserveParams>;
reservesParams: iLpPoolAssets<IReserveParams>;
}
export const configuration: Configuration = <Configuration>{};

View File

@ -7,7 +7,7 @@ import { makeSuite } from './helpers/make-suite';
import { ProtocolErrors, RateMode } from '../../helpers/types';
import { calcExpectedStableDebtTokenBalance } from './helpers/utils/calculations';
import { getUserData } from './helpers/utils/helpers';
import { CommonsConfig } from '../../markets/uniswap/commons';
import { CommonsConfig } from '../../markets/lp/commons';
import { parseEther } from 'ethers/lib/utils';

View File

@ -5,7 +5,7 @@ import fs from 'fs';
import BigNumber from 'bignumber.js';
import { makeSuite } from './helpers/make-suite';
import { getReservesConfigByPool } from '../../helpers/configuration';
import { AavePools, iUniswapPoolAssets, IReserveParams } from '../../helpers/types';
import { AavePools, iLpPoolAssets, IReserveParams } from '../../helpers/types';
import { executeStory } from './helpers/scenario-engine';
const scenarioFolder = './test/helpers/scenarios/';
@ -24,8 +24,8 @@ fs.readdirSync(scenarioFolder).forEach((file) => {
actionsConfiguration.skipIntegrityCheck = false; //set this to true to execute solidity-coverage
calculationsConfiguration.reservesParams = <iUniswapPoolAssets<IReserveParams>>(
getReservesConfigByPool(AavePools.uniswap)
calculationsConfiguration.reservesParams = <iLpPoolAssets<IReserveParams>>(
getReservesConfigByPool(AavePools.lp)
);
});
after('Reset', () => {

View File

@ -4,7 +4,7 @@ import { configuration as calculationsConfiguration } from './helpers/utils/calc
import BigNumber from 'bignumber.js';
import { makeSuite } from './helpers/make-suite';
import { getReservesConfigByPool } from '../../helpers/configuration';
import { AavePools, iUniswapPoolAssets, IReserveParams } from '../../helpers/types';
import { AavePools, iLpPoolAssets, IReserveParams } from '../../helpers/types';
import { executeStory } from './helpers/scenario-engine';
makeSuite('Subgraph scenario tests', async (testEnv) => {
@ -18,8 +18,8 @@ makeSuite('Subgraph scenario tests', async (testEnv) => {
actionsConfiguration.skipIntegrityCheck = false; //set this to true to execute solidity-coverage
calculationsConfiguration.reservesParams = <iUniswapPoolAssets<IReserveParams>>(
getReservesConfigByPool(AavePools.uniswap)
calculationsConfiguration.reservesParams = <iLpPoolAssets<IReserveParams>>(
getReservesConfigByPool(AavePools.lp)
);
});
after('Reset', () => {