mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
Merge branch 'master' of gitlab.com:aave-tech/protocol-v2 into 155-use-the-delegationawareatoken-for-the-uni-deployment
This commit is contained in:
commit
2231452bac
|
@ -31,9 +31,10 @@ contract ATokensAndRatesHelper is Ownable {
|
||||||
function initDeployment(
|
function initDeployment(
|
||||||
address[] calldata tokens,
|
address[] calldata tokens,
|
||||||
string[] calldata symbols,
|
string[] calldata symbols,
|
||||||
uint256[5][] calldata rates,
|
uint256[6][] calldata rates,
|
||||||
address incentivesController
|
address incentivesController
|
||||||
) external onlyOwner {
|
) external onlyOwner {
|
||||||
|
|
||||||
require(tokens.length == symbols.length, 't Arrays not same length');
|
require(tokens.length == symbols.length, 't Arrays not same length');
|
||||||
require(rates.length == symbols.length, 'r Arrays not same length');
|
require(rates.length == symbols.length, 'r Arrays not same length');
|
||||||
for (uint256 i = 0; i < tokens.length; i++) {
|
for (uint256 i = 0; i < tokens.length; i++) {
|
||||||
|
@ -55,7 +56,8 @@ contract ATokensAndRatesHelper is Ownable {
|
||||||
rates[i][1],
|
rates[i][1],
|
||||||
rates[i][2],
|
rates[i][2],
|
||||||
rates[i][3],
|
rates[i][3],
|
||||||
rates[i][4]
|
rates[i][4],
|
||||||
|
rates[i][5]
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
|
@ -23,7 +23,7 @@ contract DefaultReserveInterestRateStrategy is IReserveInterestRateStrategy {
|
||||||
* @dev this constant represents the utilization rate at which the pool aims to obtain most competitive borrow rates
|
* @dev this constant represents the utilization rate at which the pool aims to obtain most competitive borrow rates
|
||||||
* expressed in ray
|
* expressed in ray
|
||||||
**/
|
**/
|
||||||
uint256 public constant OPTIMAL_UTILIZATION_RATE = 0.8 * 1e27;
|
uint256 public immutable OPTIMAL_UTILIZATION_RATE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev this constant represents the excess utilization rate above the optimal. It's always equal to
|
* @dev this constant represents the excess utilization rate above the optimal. It's always equal to
|
||||||
|
@ -31,7 +31,7 @@ contract DefaultReserveInterestRateStrategy is IReserveInterestRateStrategy {
|
||||||
* expressed in ray
|
* expressed in ray
|
||||||
**/
|
**/
|
||||||
|
|
||||||
uint256 public constant EXCESS_UTILIZATION_RATE = 0.2 * 1e27;
|
uint256 public immutable EXCESS_UTILIZATION_RATE;
|
||||||
|
|
||||||
LendingPoolAddressesProvider public immutable addressesProvider;
|
LendingPoolAddressesProvider public immutable addressesProvider;
|
||||||
|
|
||||||
|
@ -52,12 +52,16 @@ contract DefaultReserveInterestRateStrategy is IReserveInterestRateStrategy {
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
LendingPoolAddressesProvider provider,
|
LendingPoolAddressesProvider provider,
|
||||||
|
uint256 optimalUtilizationRate,
|
||||||
uint256 baseVariableBorrowRate,
|
uint256 baseVariableBorrowRate,
|
||||||
uint256 variableRateSlope1,
|
uint256 variableRateSlope1,
|
||||||
uint256 variableRateSlope2,
|
uint256 variableRateSlope2,
|
||||||
uint256 stableRateSlope1,
|
uint256 stableRateSlope1,
|
||||||
uint256 stableRateSlope2
|
uint256 stableRateSlope2
|
||||||
) public {
|
) public {
|
||||||
|
|
||||||
|
OPTIMAL_UTILIZATION_RATE = optimalUtilizationRate;
|
||||||
|
EXCESS_UTILIZATION_RATE = WadRayMath.ray().sub(optimalUtilizationRate);
|
||||||
addressesProvider = provider;
|
addressesProvider = provider;
|
||||||
_baseVariableBorrowRate = baseVariableBorrowRate;
|
_baseVariableBorrowRate = baseVariableBorrowRate;
|
||||||
_variableRateSlope1 = variableRateSlope1;
|
_variableRateSlope1 = variableRateSlope1;
|
||||||
|
|
|
@ -10,7 +10,6 @@ import {ReserveConfiguration} from '../libraries/configuration/ReserveConfigurat
|
||||||
import {UserConfiguration} from '../libraries/configuration/UserConfiguration.sol';
|
import {UserConfiguration} from '../libraries/configuration/UserConfiguration.sol';
|
||||||
import {IStableDebtToken} from '../tokenization/interfaces/IStableDebtToken.sol';
|
import {IStableDebtToken} from '../tokenization/interfaces/IStableDebtToken.sol';
|
||||||
import {IVariableDebtToken} from '../tokenization/interfaces/IVariableDebtToken.sol';
|
import {IVariableDebtToken} from '../tokenization/interfaces/IVariableDebtToken.sol';
|
||||||
import 'hardhat/console.sol';
|
|
||||||
|
|
||||||
contract AaveProtocolDataProvider {
|
contract AaveProtocolDataProvider {
|
||||||
using ReserveConfiguration for ReserveConfiguration.Map;
|
using ReserveConfiguration for ReserveConfiguration.Map;
|
||||||
|
|
|
@ -16,7 +16,6 @@ export const MAX_UINT_AMOUNT =
|
||||||
export const ONE_YEAR = '31536000';
|
export const ONE_YEAR = '31536000';
|
||||||
export const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000';
|
export const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000';
|
||||||
export const ONE_ADDRESS = '0x0000000000000000000000000000000000000001';
|
export const ONE_ADDRESS = '0x0000000000000000000000000000000000000001';
|
||||||
|
|
||||||
// ----------------
|
// ----------------
|
||||||
// PROTOCOL GLOBAL PARAMS
|
// PROTOCOL GLOBAL PARAMS
|
||||||
// ----------------
|
// ----------------
|
||||||
|
|
|
@ -64,6 +64,7 @@ export const initReservesByHelper = async (
|
||||||
BigNumberish,
|
BigNumberish,
|
||||||
BigNumberish,
|
BigNumberish,
|
||||||
BigNumberish,
|
BigNumberish,
|
||||||
|
BigNumberish,
|
||||||
BigNumberish
|
BigNumberish
|
||||||
][] = [];
|
][] = [];
|
||||||
const reservesDecimals: string[] = [];
|
const reservesDecimals: string[] = [];
|
||||||
|
@ -86,6 +87,7 @@ export const initReservesByHelper = async (
|
||||||
const [
|
const [
|
||||||
,
|
,
|
||||||
{
|
{
|
||||||
|
optimalUtilizationRate,
|
||||||
baseVariableBorrowRate,
|
baseVariableBorrowRate,
|
||||||
variableRateSlope1,
|
variableRateSlope1,
|
||||||
variableRateSlope2,
|
variableRateSlope2,
|
||||||
|
@ -97,6 +99,7 @@ export const initReservesByHelper = async (
|
||||||
tokens.push(tokenAddress);
|
tokens.push(tokenAddress);
|
||||||
symbols.push(assetSymbol);
|
symbols.push(assetSymbol);
|
||||||
strategyRates.push([
|
strategyRates.push([
|
||||||
|
optimalUtilizationRate,
|
||||||
baseVariableBorrowRate,
|
baseVariableBorrowRate,
|
||||||
variableRateSlope1,
|
variableRateSlope1,
|
||||||
variableRateSlope2,
|
variableRateSlope2,
|
||||||
|
|
|
@ -263,6 +263,7 @@ export enum TokenContractId {
|
||||||
export interface IReserveParams extends IReserveBorrowParams, IReserveCollateralParams {}
|
export interface IReserveParams extends IReserveBorrowParams, IReserveCollateralParams {}
|
||||||
|
|
||||||
export interface IReserveBorrowParams {
|
export interface IReserveBorrowParams {
|
||||||
|
optimalUtilizationRate: string;
|
||||||
baseVariableBorrowRate: string;
|
baseVariableBorrowRate: string;
|
||||||
variableRateSlope1: string;
|
variableRateSlope1: string;
|
||||||
variableRateSlope2: string;
|
variableRateSlope2: string;
|
||||||
|
@ -321,12 +322,8 @@ export enum EthereumNetwork {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IProtocolGlobalConfig {
|
export interface IProtocolGlobalConfig {
|
||||||
OptimalUtilizationRate: BigNumber;
|
|
||||||
ExcessUtilizationRate: BigNumber;
|
|
||||||
ApprovalAmountLendingPoolCore: string;
|
|
||||||
TokenDistributorPercentageBase: string;
|
TokenDistributorPercentageBase: string;
|
||||||
MockUsdPriceInWei: string;
|
MockUsdPriceInWei: string;
|
||||||
EthereumAddress: tEthereumAddress;
|
|
||||||
UsdAddress: tEthereumAddress;
|
UsdAddress: tEthereumAddress;
|
||||||
NilAddress: tEthereumAddress;
|
NilAddress: tEthereumAddress;
|
||||||
OneAddress: tEthereumAddress;
|
OneAddress: tEthereumAddress;
|
||||||
|
|
|
@ -33,12 +33,8 @@ export const CommonsConfig: ICommonConfiguration = {
|
||||||
ConfigName: 'Commons',
|
ConfigName: 'Commons',
|
||||||
ProviderId: 0,
|
ProviderId: 0,
|
||||||
ProtocolGlobalParams: {
|
ProtocolGlobalParams: {
|
||||||
OptimalUtilizationRate: new BigNumber(0.8).times(RAY),
|
|
||||||
ExcessUtilizationRate: new BigNumber(0.2).times(RAY),
|
|
||||||
ApprovalAmountLendingPoolCore: '1000000000000000000000000000',
|
|
||||||
TokenDistributorPercentageBase: '10000',
|
TokenDistributorPercentageBase: '10000',
|
||||||
MockUsdPriceInWei: '5848466240000000',
|
MockUsdPriceInWei: '5848466240000000',
|
||||||
EthereumAddress: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE',
|
|
||||||
UsdAddress: '0x10F7Fc1F91Ba351f9C629c5947AD69bD03C05b96',
|
UsdAddress: '0x10F7Fc1F91Ba351f9C629c5947AD69bD03C05b96',
|
||||||
NilAddress: '0x0000000000000000000000000000000000000000',
|
NilAddress: '0x0000000000000000000000000000000000000000',
|
||||||
OneAddress: '0x0000000000000000000000000000000000000001',
|
OneAddress: '0x0000000000000000000000000000000000000001',
|
||||||
|
|
|
@ -3,6 +3,7 @@ import {oneRay} from '../../helpers/constants';
|
||||||
import {IReserveParams} from '../../helpers/types';
|
import {IReserveParams} from '../../helpers/types';
|
||||||
|
|
||||||
export const strategyBase: IReserveParams = {
|
export const strategyBase: IReserveParams = {
|
||||||
|
optimalUtilizationRate: new BigNumber(0.8).multipliedBy(oneRay).toFixed(),
|
||||||
baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(),
|
baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(),
|
||||||
variableRateSlope1: new BigNumber(0.07).multipliedBy(oneRay).toFixed(),
|
variableRateSlope1: new BigNumber(0.07).multipliedBy(oneRay).toFixed(),
|
||||||
variableRateSlope2: new BigNumber(3).multipliedBy(oneRay).toFixed(),
|
variableRateSlope2: new BigNumber(3).multipliedBy(oneRay).toFixed(),
|
||||||
|
@ -17,6 +18,7 @@ export const strategyBase: IReserveParams = {
|
||||||
};
|
};
|
||||||
|
|
||||||
export const stablecoinStrategyBase: IReserveParams = {
|
export const stablecoinStrategyBase: IReserveParams = {
|
||||||
|
optimalUtilizationRate: new BigNumber(0.8).multipliedBy(oneRay).toFixed(),
|
||||||
baseVariableBorrowRate: new BigNumber(0.01).multipliedBy(oneRay).toFixed(),
|
baseVariableBorrowRate: new BigNumber(0.01).multipliedBy(oneRay).toFixed(),
|
||||||
variableRateSlope1: new BigNumber(0.07).multipliedBy(oneRay).toFixed(),
|
variableRateSlope1: new BigNumber(0.07).multipliedBy(oneRay).toFixed(),
|
||||||
variableRateSlope2: new BigNumber(1.5).multipliedBy(oneRay).toFixed(),
|
variableRateSlope2: new BigNumber(1.5).multipliedBy(oneRay).toFixed(),
|
||||||
|
@ -31,6 +33,7 @@ export const stablecoinStrategyBase: IReserveParams = {
|
||||||
};
|
};
|
||||||
|
|
||||||
export const stablecoinStrategyCentralized: IReserveParams = {
|
export const stablecoinStrategyCentralized: IReserveParams = {
|
||||||
|
optimalUtilizationRate: new BigNumber(0.8).multipliedBy(oneRay).toFixed(),
|
||||||
baseVariableBorrowRate: new BigNumber(0.01).multipliedBy(oneRay).toFixed(),
|
baseVariableBorrowRate: new BigNumber(0.01).multipliedBy(oneRay).toFixed(),
|
||||||
variableRateSlope1: new BigNumber(0.07).multipliedBy(oneRay).toFixed(),
|
variableRateSlope1: new BigNumber(0.07).multipliedBy(oneRay).toFixed(),
|
||||||
variableRateSlope2: new BigNumber(0.6).multipliedBy(oneRay).toFixed(),
|
variableRateSlope2: new BigNumber(0.6).multipliedBy(oneRay).toFixed(),
|
||||||
|
@ -117,6 +120,7 @@ export const strategyREN: IReserveParams = {
|
||||||
};
|
};
|
||||||
|
|
||||||
export const stablecoinStrategySUSD: IReserveParams = {
|
export const stablecoinStrategySUSD: IReserveParams = {
|
||||||
|
optimalUtilizationRate: new BigNumber(0.8).multipliedBy(oneRay).toFixed(),
|
||||||
baseVariableBorrowRate: new BigNumber(0.01).multipliedBy(oneRay).toFixed(),
|
baseVariableBorrowRate: new BigNumber(0.01).multipliedBy(oneRay).toFixed(),
|
||||||
variableRateSlope1: new BigNumber(0.04).multipliedBy(oneRay).toFixed(),
|
variableRateSlope1: new BigNumber(0.04).multipliedBy(oneRay).toFixed(),
|
||||||
variableRateSlope2: new BigNumber(1).multipliedBy(oneRay).toFixed(),
|
variableRateSlope2: new BigNumber(1).multipliedBy(oneRay).toFixed(),
|
||||||
|
@ -174,6 +178,7 @@ export const stablecoinStrategyUSDT: IReserveParams = {
|
||||||
};
|
};
|
||||||
|
|
||||||
export const strategyWBTC: IReserveParams = {
|
export const strategyWBTC: IReserveParams = {
|
||||||
|
optimalUtilizationRate: new BigNumber(0.8).multipliedBy(oneRay).toFixed(),
|
||||||
baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(),
|
baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(),
|
||||||
variableRateSlope1: new BigNumber(0.08).multipliedBy(oneRay).toFixed(),
|
variableRateSlope1: new BigNumber(0.08).multipliedBy(oneRay).toFixed(),
|
||||||
variableRateSlope2: new BigNumber(0.5).multipliedBy(oneRay).toFixed(),
|
variableRateSlope2: new BigNumber(0.5).multipliedBy(oneRay).toFixed(),
|
||||||
|
@ -188,6 +193,7 @@ export const strategyWBTC: IReserveParams = {
|
||||||
};
|
};
|
||||||
|
|
||||||
export const strategyWETH: IReserveParams = {
|
export const strategyWETH: IReserveParams = {
|
||||||
|
optimalUtilizationRate: new BigNumber(0.8).multipliedBy(oneRay).toFixed(),
|
||||||
baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(),
|
baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(),
|
||||||
variableRateSlope1: new BigNumber(0.08).multipliedBy(oneRay).toFixed(),
|
variableRateSlope1: new BigNumber(0.08).multipliedBy(oneRay).toFixed(),
|
||||||
variableRateSlope2: new BigNumber(1).multipliedBy(oneRay).toFixed(),
|
variableRateSlope2: new BigNumber(1).multipliedBy(oneRay).toFixed(),
|
||||||
|
|
4898
package-lock.json
generated
4898
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
|
@ -1,4 +1,4 @@
|
||||||
import {MAX_UINT_AMOUNT, ZERO_ADDRESS} from '../helpers/constants';
|
import {APPROVAL_AMOUNT_LENDING_POOL, MAX_UINT_AMOUNT, ZERO_ADDRESS} from '../helpers/constants';
|
||||||
import {convertToCurrencyDecimals} from '../helpers/contracts-helpers';
|
import {convertToCurrencyDecimals} from '../helpers/contracts-helpers';
|
||||||
import {expect} from 'chai';
|
import {expect} from 'chai';
|
||||||
import {ethers} from 'ethers';
|
import {ethers} from 'ethers';
|
||||||
|
@ -6,8 +6,6 @@ import {RateMode, ProtocolErrors} from '../helpers/types';
|
||||||
import {makeSuite, TestEnv} from './helpers/make-suite';
|
import {makeSuite, TestEnv} from './helpers/make-suite';
|
||||||
import {CommonsConfig} from '../markets/aave/commons';
|
import {CommonsConfig} from '../markets/aave/commons';
|
||||||
|
|
||||||
const APPROVAL_AMOUNT_LENDING_POOL =
|
|
||||||
CommonsConfig.ProtocolGlobalParams.ApprovalAmountLendingPoolCore;
|
|
||||||
const AAVE_REFERRAL = CommonsConfig.ProtocolGlobalParams.AaveReferral;
|
const AAVE_REFERRAL = CommonsConfig.ProtocolGlobalParams.AaveReferral;
|
||||||
|
|
||||||
makeSuite('AToken: Transfer', (testEnv: TestEnv) => {
|
makeSuite('AToken: Transfer', (testEnv: TestEnv) => {
|
||||||
|
|
|
@ -1,11 +1,7 @@
|
||||||
import {TestEnv, makeSuite} from './helpers/make-suite';
|
import {TestEnv, makeSuite} from './helpers/make-suite';
|
||||||
import {RAY} from '../helpers/constants';
|
import {APPROVAL_AMOUNT_LENDING_POOL, RAY} from '../helpers/constants';
|
||||||
import {convertToCurrencyDecimals} from '../helpers/contracts-helpers';
|
import {convertToCurrencyDecimals} from '../helpers/contracts-helpers';
|
||||||
import {ProtocolErrors} from '../helpers/types';
|
import {ProtocolErrors} from '../helpers/types';
|
||||||
import {CommonsConfig} from '../markets/aave/commons';
|
|
||||||
|
|
||||||
const APPROVAL_AMOUNT_LENDING_POOL =
|
|
||||||
CommonsConfig.ProtocolGlobalParams.ApprovalAmountLendingPoolCore;
|
|
||||||
|
|
||||||
const {expect} = require('chai');
|
const {expect} = require('chai');
|
||||||
|
|
||||||
|
|
|
@ -1,16 +1,12 @@
|
||||||
import BigNumber from 'bignumber.js';
|
import BigNumber from 'bignumber.js';
|
||||||
|
|
||||||
import {DRE} from '../helpers/misc-utils';
|
import {DRE} from '../helpers/misc-utils';
|
||||||
import {oneEther} from '../helpers/constants';
|
import {APPROVAL_AMOUNT_LENDING_POOL, oneEther} from '../helpers/constants';
|
||||||
import {convertToCurrencyDecimals} from '../helpers/contracts-helpers';
|
import {convertToCurrencyDecimals} from '../helpers/contracts-helpers';
|
||||||
import {makeSuite} from './helpers/make-suite';
|
import {makeSuite} from './helpers/make-suite';
|
||||||
import {ProtocolErrors, RateMode} from '../helpers/types';
|
import {ProtocolErrors, RateMode} from '../helpers/types';
|
||||||
import {calcExpectedVariableDebtTokenBalance} from './helpers/utils/calculations';
|
import {calcExpectedVariableDebtTokenBalance} from './helpers/utils/calculations';
|
||||||
import {getUserData, getReserveData} from './helpers/utils/helpers';
|
import {getUserData, getReserveData} from './helpers/utils/helpers';
|
||||||
import {CommonsConfig} from '../markets/aave/commons';
|
|
||||||
|
|
||||||
const APPROVAL_AMOUNT_LENDING_POOL =
|
|
||||||
CommonsConfig.ProtocolGlobalParams.ApprovalAmountLendingPoolCore;
|
|
||||||
|
|
||||||
const chai = require('chai');
|
const chai = require('chai');
|
||||||
const {expect} = chai;
|
const {expect} = chai;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import BigNumber from 'bignumber.js';
|
import BigNumber from 'bignumber.js';
|
||||||
|
|
||||||
import {DRE, increaseTime} from '../helpers/misc-utils';
|
import {DRE, increaseTime} from '../helpers/misc-utils';
|
||||||
import {oneEther} from '../helpers/constants';
|
import {APPROVAL_AMOUNT_LENDING_POOL, oneEther} from '../helpers/constants';
|
||||||
import {convertToCurrencyDecimals} from '../helpers/contracts-helpers';
|
import {convertToCurrencyDecimals} from '../helpers/contracts-helpers';
|
||||||
import {makeSuite} from './helpers/make-suite';
|
import {makeSuite} from './helpers/make-suite';
|
||||||
import {ProtocolErrors, RateMode} from '../helpers/types';
|
import {ProtocolErrors, RateMode} from '../helpers/types';
|
||||||
|
@ -9,8 +9,6 @@ import {calcExpectedStableDebtTokenBalance} from './helpers/utils/calculations';
|
||||||
import {getUserData} from './helpers/utils/helpers';
|
import {getUserData} from './helpers/utils/helpers';
|
||||||
import {CommonsConfig} from '../markets/aave/commons';
|
import {CommonsConfig} from '../markets/aave/commons';
|
||||||
|
|
||||||
const APPROVAL_AMOUNT_LENDING_POOL =
|
|
||||||
CommonsConfig.ProtocolGlobalParams.ApprovalAmountLendingPoolCore;
|
|
||||||
import {parseEther} from 'ethers/lib/utils';
|
import {parseEther} from 'ethers/lib/utils';
|
||||||
|
|
||||||
const chai = require('chai');
|
const chai = require('chai');
|
||||||
|
|
Loading…
Reference in New Issue
Block a user