mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
Merge branch 'master' into feat/permissioned-market
This commit is contained in:
commit
1ff6665aea
.github/workflows
contracts
adapters
dependencies/openzeppelin/contracts
interfaces
misc
mocks/swap
helpers
configuration.tsconstants.tscontracts-deployments.tscontracts-getters.tscontracts-helpers.tsdefender-utils.tsinit-helpers.tsmisc-utils.tstypes.ts
markets
aave-arc
aave
amm
avalanche
matic
xdai
tasks
deployments
dev
full
helpers
migrations
verifications
test-suites
4
.github/workflows/node.js.yml
vendored
4
.github/workflows/node.js.yml
vendored
|
@ -40,10 +40,6 @@ jobs:
|
|||
run: npm run amm:fork:main
|
||||
env:
|
||||
ALCHEMY_KEY: ${{ secrets.ALCHEMY_KEY }}
|
||||
- name: Aave deployment at Kovan fork
|
||||
run: npm run aave:fork:kovan
|
||||
env:
|
||||
ALCHEMY_KEY: ${{ secrets.ALCHEMY_KEY }}
|
||||
# - name: Coverage
|
||||
# run: npm run coverage
|
||||
# - uses: codecov/codecov-action@v1
|
||||
|
|
122
contracts/adapters/BaseParaSwapAdapter.sol
Normal file
122
contracts/adapters/BaseParaSwapAdapter.sol
Normal file
|
@ -0,0 +1,122 @@
|
|||
// SPDX-License-Identifier: agpl-3.0
|
||||
pragma solidity 0.6.12;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
import {SafeMath} from '../dependencies/openzeppelin/contracts/SafeMath.sol';
|
||||
import {IERC20} from '../dependencies/openzeppelin/contracts/IERC20.sol';
|
||||
import {IERC20Detailed} from '../dependencies/openzeppelin/contracts/IERC20Detailed.sol';
|
||||
import {SafeERC20} from '../dependencies/openzeppelin/contracts/SafeERC20.sol';
|
||||
import {Ownable} from '../dependencies/openzeppelin/contracts/Ownable.sol';
|
||||
import {ILendingPoolAddressesProvider} from '../interfaces/ILendingPoolAddressesProvider.sol';
|
||||
import {DataTypes} from '../protocol/libraries/types/DataTypes.sol';
|
||||
import {IPriceOracleGetter} from '../interfaces/IPriceOracleGetter.sol';
|
||||
import {IERC20WithPermit} from '../interfaces/IERC20WithPermit.sol';
|
||||
import {FlashLoanReceiverBase} from '../flashloan/base/FlashLoanReceiverBase.sol';
|
||||
|
||||
/**
|
||||
* @title BaseParaSwapAdapter
|
||||
* @notice Utility functions for adapters using ParaSwap
|
||||
* @author Jason Raymond Bell
|
||||
*/
|
||||
abstract contract BaseParaSwapAdapter is FlashLoanReceiverBase, Ownable {
|
||||
using SafeMath for uint256;
|
||||
using SafeERC20 for IERC20;
|
||||
using SafeERC20 for IERC20Detailed;
|
||||
using SafeERC20 for IERC20WithPermit;
|
||||
|
||||
struct PermitSignature {
|
||||
uint256 amount;
|
||||
uint256 deadline;
|
||||
uint8 v;
|
||||
bytes32 r;
|
||||
bytes32 s;
|
||||
}
|
||||
|
||||
// Max slippage percent allowed
|
||||
uint256 public constant MAX_SLIPPAGE_PERCENT = 3000; // 30%
|
||||
|
||||
IPriceOracleGetter public immutable ORACLE;
|
||||
|
||||
event Swapped(address indexed fromAsset, address indexed toAsset, uint256 fromAmount, uint256 receivedAmount);
|
||||
|
||||
constructor(
|
||||
ILendingPoolAddressesProvider addressesProvider
|
||||
) public FlashLoanReceiverBase(addressesProvider) {
|
||||
ORACLE = IPriceOracleGetter(addressesProvider.getPriceOracle());
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Get the price of the asset from the oracle denominated in eth
|
||||
* @param asset address
|
||||
* @return eth price for the asset
|
||||
*/
|
||||
function _getPrice(address asset) internal view returns (uint256) {
|
||||
return ORACLE.getAssetPrice(asset);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Get the decimals of an asset
|
||||
* @return number of decimals of the asset
|
||||
*/
|
||||
function _getDecimals(IERC20Detailed asset) internal view returns (uint8) {
|
||||
uint8 decimals = asset.decimals();
|
||||
// Ensure 10**decimals won't overflow a uint256
|
||||
require(decimals <= 77, 'TOO_MANY_DECIMALS_ON_TOKEN');
|
||||
return decimals;
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Get the aToken associated to the asset
|
||||
* @return address of the aToken
|
||||
*/
|
||||
function _getReserveData(address asset) internal view returns (DataTypes.ReserveData memory) {
|
||||
return LENDING_POOL.getReserveData(asset);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Pull the ATokens from the user
|
||||
* @param reserve address of the asset
|
||||
* @param reserveAToken address of the aToken of the reserve
|
||||
* @param user address
|
||||
* @param amount of tokens to be transferred to the contract
|
||||
* @param permitSignature struct containing the permit signature
|
||||
*/
|
||||
function _pullATokenAndWithdraw(
|
||||
address reserve,
|
||||
IERC20WithPermit reserveAToken,
|
||||
address user,
|
||||
uint256 amount,
|
||||
PermitSignature memory permitSignature
|
||||
) internal {
|
||||
// If deadline is set to zero, assume there is no signature for permit
|
||||
if (permitSignature.deadline != 0) {
|
||||
reserveAToken.permit(
|
||||
user,
|
||||
address(this),
|
||||
permitSignature.amount,
|
||||
permitSignature.deadline,
|
||||
permitSignature.v,
|
||||
permitSignature.r,
|
||||
permitSignature.s
|
||||
);
|
||||
}
|
||||
|
||||
// transfer from user to adapter
|
||||
reserveAToken.safeTransferFrom(user, address(this), amount);
|
||||
|
||||
// withdraw reserve
|
||||
require(
|
||||
LENDING_POOL.withdraw(reserve, amount, address(this)) == amount,
|
||||
'UNEXPECTED_AMOUNT_WITHDRAWN'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Emergency rescue for token stucked on this contract, as failsafe mechanism
|
||||
* - Funds should never remain in this contract more time than during transactions
|
||||
* - Only callable by the owner
|
||||
*/
|
||||
function rescueTokens(IERC20 token) external onlyOwner {
|
||||
token.safeTransfer(owner(), token.balanceOf(address(this)));
|
||||
}
|
||||
}
|
109
contracts/adapters/BaseParaSwapSellAdapter.sol
Normal file
109
contracts/adapters/BaseParaSwapSellAdapter.sol
Normal file
|
@ -0,0 +1,109 @@
|
|||
// SPDX-License-Identifier: agpl-3.0
|
||||
pragma solidity 0.6.12;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
import {BaseParaSwapAdapter} from './BaseParaSwapAdapter.sol';
|
||||
import {PercentageMath} from '../protocol/libraries/math/PercentageMath.sol';
|
||||
import {IParaSwapAugustus} from '../interfaces/IParaSwapAugustus.sol';
|
||||
import {IParaSwapAugustusRegistry} from '../interfaces/IParaSwapAugustusRegistry.sol';
|
||||
import {ILendingPoolAddressesProvider} from '../interfaces/ILendingPoolAddressesProvider.sol';
|
||||
import {IERC20Detailed} from '../dependencies/openzeppelin/contracts/IERC20Detailed.sol';
|
||||
|
||||
/**
|
||||
* @title BaseParaSwapSellAdapter
|
||||
* @notice Implements the logic for selling tokens on ParaSwap
|
||||
* @author Jason Raymond Bell
|
||||
*/
|
||||
abstract contract BaseParaSwapSellAdapter is BaseParaSwapAdapter {
|
||||
using PercentageMath for uint256;
|
||||
|
||||
IParaSwapAugustusRegistry public immutable AUGUSTUS_REGISTRY;
|
||||
|
||||
constructor(
|
||||
ILendingPoolAddressesProvider addressesProvider,
|
||||
IParaSwapAugustusRegistry augustusRegistry
|
||||
) public BaseParaSwapAdapter(addressesProvider) {
|
||||
// Do something on Augustus registry to check the right contract was passed
|
||||
require(!augustusRegistry.isValidAugustus(address(0)));
|
||||
AUGUSTUS_REGISTRY = augustusRegistry;
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Swaps a token for another using ParaSwap
|
||||
* @param fromAmountOffset Offset of fromAmount in Augustus calldata if it should be overwritten, otherwise 0
|
||||
* @param swapCalldata Calldata for ParaSwap's AugustusSwapper contract
|
||||
* @param augustus Address of ParaSwap's AugustusSwapper contract
|
||||
* @param assetToSwapFrom Address of the asset to be swapped from
|
||||
* @param assetToSwapTo Address of the asset to be swapped to
|
||||
* @param amountToSwap Amount to be swapped
|
||||
* @param minAmountToReceive Minimum amount to be received from the swap
|
||||
* @return amountReceived The amount received from the swap
|
||||
*/
|
||||
function _sellOnParaSwap(
|
||||
uint256 fromAmountOffset,
|
||||
bytes memory swapCalldata,
|
||||
IParaSwapAugustus augustus,
|
||||
IERC20Detailed assetToSwapFrom,
|
||||
IERC20Detailed assetToSwapTo,
|
||||
uint256 amountToSwap,
|
||||
uint256 minAmountToReceive
|
||||
) internal returns (uint256 amountReceived) {
|
||||
require(AUGUSTUS_REGISTRY.isValidAugustus(address(augustus)), 'INVALID_AUGUSTUS');
|
||||
|
||||
{
|
||||
uint256 fromAssetDecimals = _getDecimals(assetToSwapFrom);
|
||||
uint256 toAssetDecimals = _getDecimals(assetToSwapTo);
|
||||
|
||||
uint256 fromAssetPrice = _getPrice(address(assetToSwapFrom));
|
||||
uint256 toAssetPrice = _getPrice(address(assetToSwapTo));
|
||||
|
||||
uint256 expectedMinAmountOut =
|
||||
amountToSwap
|
||||
.mul(fromAssetPrice.mul(10**toAssetDecimals))
|
||||
.div(toAssetPrice.mul(10**fromAssetDecimals))
|
||||
.percentMul(PercentageMath.PERCENTAGE_FACTOR - MAX_SLIPPAGE_PERCENT);
|
||||
|
||||
require(expectedMinAmountOut <= minAmountToReceive, 'MIN_AMOUNT_EXCEEDS_MAX_SLIPPAGE');
|
||||
}
|
||||
|
||||
uint256 balanceBeforeAssetFrom = assetToSwapFrom.balanceOf(address(this));
|
||||
require(balanceBeforeAssetFrom >= amountToSwap, 'INSUFFICIENT_BALANCE_BEFORE_SWAP');
|
||||
uint256 balanceBeforeAssetTo = assetToSwapTo.balanceOf(address(this));
|
||||
|
||||
address tokenTransferProxy = augustus.getTokenTransferProxy();
|
||||
assetToSwapFrom.safeApprove(tokenTransferProxy, 0);
|
||||
assetToSwapFrom.safeApprove(tokenTransferProxy, amountToSwap);
|
||||
|
||||
if (fromAmountOffset != 0) {
|
||||
// Ensure 256 bit (32 bytes) fromAmount value is within bounds of the
|
||||
// calldata, not overlapping with the first 4 bytes (function selector).
|
||||
require(fromAmountOffset >= 4 &&
|
||||
fromAmountOffset <= swapCalldata.length.sub(32),
|
||||
'FROM_AMOUNT_OFFSET_OUT_OF_RANGE');
|
||||
// Overwrite the fromAmount with the correct amount for the swap.
|
||||
// In memory, swapCalldata consists of a 256 bit length field, followed by
|
||||
// the actual bytes data, that is why 32 is added to the byte offset.
|
||||
assembly {
|
||||
mstore(add(swapCalldata, add(fromAmountOffset, 32)), amountToSwap)
|
||||
}
|
||||
}
|
||||
(bool success,) = address(augustus).call(swapCalldata);
|
||||
if (!success) {
|
||||
// Copy revert reason from call
|
||||
assembly {
|
||||
returndatacopy(0, 0, returndatasize())
|
||||
revert(0, returndatasize())
|
||||
}
|
||||
}
|
||||
require(assetToSwapFrom.balanceOf(address(this)) == balanceBeforeAssetFrom - amountToSwap, 'WRONG_BALANCE_AFTER_SWAP');
|
||||
amountReceived = assetToSwapTo.balanceOf(address(this)).sub(balanceBeforeAssetTo);
|
||||
require(amountReceived >= minAmountToReceive, 'INSUFFICIENT_AMOUNT_RECEIVED');
|
||||
|
||||
emit Swapped(
|
||||
address(assetToSwapFrom),
|
||||
address(assetToSwapTo),
|
||||
amountToSwap,
|
||||
amountReceived
|
||||
);
|
||||
}
|
||||
}
|
210
contracts/adapters/ParaSwapLiquiditySwapAdapter.sol
Normal file
210
contracts/adapters/ParaSwapLiquiditySwapAdapter.sol
Normal file
|
@ -0,0 +1,210 @@
|
|||
// SPDX-License-Identifier: agpl-3.0
|
||||
pragma solidity 0.6.12;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
import {BaseParaSwapSellAdapter} from './BaseParaSwapSellAdapter.sol';
|
||||
import {ILendingPoolAddressesProvider} from '../interfaces/ILendingPoolAddressesProvider.sol';
|
||||
import {IParaSwapAugustusRegistry} from '../interfaces/IParaSwapAugustusRegistry.sol';
|
||||
import {IERC20Detailed} from '../dependencies/openzeppelin/contracts/IERC20Detailed.sol';
|
||||
import {IERC20WithPermit} from '../interfaces/IERC20WithPermit.sol';
|
||||
import {IParaSwapAugustus} from '../interfaces/IParaSwapAugustus.sol';
|
||||
import {ReentrancyGuard} from '../dependencies/openzeppelin/contracts/ReentrancyGuard.sol';
|
||||
|
||||
/**
|
||||
* @title ParaSwapLiquiditySwapAdapter
|
||||
* @notice Adapter to swap liquidity using ParaSwap.
|
||||
* @author Jason Raymond Bell
|
||||
*/
|
||||
contract ParaSwapLiquiditySwapAdapter is BaseParaSwapSellAdapter, ReentrancyGuard {
|
||||
constructor(
|
||||
ILendingPoolAddressesProvider addressesProvider,
|
||||
IParaSwapAugustusRegistry augustusRegistry
|
||||
) public BaseParaSwapSellAdapter(addressesProvider, augustusRegistry) {
|
||||
// This is only required to initialize BaseParaSwapSellAdapter
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Swaps the received reserve amount from the flash loan into the asset specified in the params.
|
||||
* The received funds from the swap are then deposited into the protocol on behalf of the user.
|
||||
* The user should give this contract allowance to pull the ATokens in order to withdraw the underlying asset and repay the flash loan.
|
||||
* @param assets Address of the underlying asset to be swapped from
|
||||
* @param amounts Amount of the flash loan i.e. maximum amount to swap
|
||||
* @param premiums Fee of the flash loan
|
||||
* @param initiator Account that initiated the flash loan
|
||||
* @param params Additional variadic field to include extra params. Expected parameters:
|
||||
* address assetToSwapTo Address of the underlying asset to be swapped to and deposited
|
||||
* uint256 minAmountToReceive Min amount to be received from the swap
|
||||
* uint256 swapAllBalanceOffset Set to offset of fromAmount in Augustus calldata if wanting to swap all balance, otherwise 0
|
||||
* bytes swapCalldata Calldata for ParaSwap's AugustusSwapper contract
|
||||
* address augustus Address of ParaSwap's AugustusSwapper contract
|
||||
* PermitSignature permitParams Struct containing the permit signatures, set to all zeroes if not used
|
||||
*/
|
||||
function executeOperation(
|
||||
address[] calldata assets,
|
||||
uint256[] calldata amounts,
|
||||
uint256[] calldata premiums,
|
||||
address initiator,
|
||||
bytes calldata params
|
||||
) external override nonReentrant returns (bool) {
|
||||
require(msg.sender == address(LENDING_POOL), 'CALLER_MUST_BE_LENDING_POOL');
|
||||
require(
|
||||
assets.length == 1 && amounts.length == 1 && premiums.length == 1,
|
||||
'FLASHLOAN_MULTIPLE_ASSETS_NOT_SUPPORTED'
|
||||
);
|
||||
|
||||
uint256 flashLoanAmount = amounts[0];
|
||||
uint256 premium = premiums[0];
|
||||
address initiatorLocal = initiator;
|
||||
IERC20Detailed assetToSwapFrom = IERC20Detailed(assets[0]);
|
||||
(
|
||||
IERC20Detailed assetToSwapTo,
|
||||
uint256 minAmountToReceive,
|
||||
uint256 swapAllBalanceOffset,
|
||||
bytes memory swapCalldata,
|
||||
IParaSwapAugustus augustus,
|
||||
PermitSignature memory permitParams
|
||||
) = abi.decode(params, (
|
||||
IERC20Detailed,
|
||||
uint256,
|
||||
uint256,
|
||||
bytes,
|
||||
IParaSwapAugustus,
|
||||
PermitSignature
|
||||
));
|
||||
|
||||
_swapLiquidity(
|
||||
swapAllBalanceOffset,
|
||||
swapCalldata,
|
||||
augustus,
|
||||
permitParams,
|
||||
flashLoanAmount,
|
||||
premium,
|
||||
initiatorLocal,
|
||||
assetToSwapFrom,
|
||||
assetToSwapTo,
|
||||
minAmountToReceive
|
||||
);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Swaps an amount of an asset to another and deposits the new asset amount on behalf of the user without using a flash loan.
|
||||
* This method can be used when the temporary transfer of the collateral asset to this contract does not affect the user position.
|
||||
* The user should give this contract allowance to pull the ATokens in order to withdraw the underlying asset and perform the swap.
|
||||
* @param assetToSwapFrom Address of the underlying asset to be swapped from
|
||||
* @param assetToSwapTo Address of the underlying asset to be swapped to and deposited
|
||||
* @param amountToSwap Amount to be swapped, or maximum amount when swapping all balance
|
||||
* @param minAmountToReceive Minimum amount to be received from the swap
|
||||
* @param swapAllBalanceOffset Set to offset of fromAmount in Augustus calldata if wanting to swap all balance, otherwise 0
|
||||
* @param swapCalldata Calldata for ParaSwap's AugustusSwapper contract
|
||||
* @param augustus Address of ParaSwap's AugustusSwapper contract
|
||||
* @param permitParams Struct containing the permit signatures, set to all zeroes if not used
|
||||
*/
|
||||
function swapAndDeposit(
|
||||
IERC20Detailed assetToSwapFrom,
|
||||
IERC20Detailed assetToSwapTo,
|
||||
uint256 amountToSwap,
|
||||
uint256 minAmountToReceive,
|
||||
uint256 swapAllBalanceOffset,
|
||||
bytes calldata swapCalldata,
|
||||
IParaSwapAugustus augustus,
|
||||
PermitSignature calldata permitParams
|
||||
) external nonReentrant {
|
||||
IERC20WithPermit aToken =
|
||||
IERC20WithPermit(_getReserveData(address(assetToSwapFrom)).aTokenAddress);
|
||||
|
||||
if (swapAllBalanceOffset != 0) {
|
||||
uint256 balance = aToken.balanceOf(msg.sender);
|
||||
require(balance <= amountToSwap, 'INSUFFICIENT_AMOUNT_TO_SWAP');
|
||||
amountToSwap = balance;
|
||||
}
|
||||
|
||||
_pullATokenAndWithdraw(
|
||||
address(assetToSwapFrom),
|
||||
aToken,
|
||||
msg.sender,
|
||||
amountToSwap,
|
||||
permitParams
|
||||
);
|
||||
|
||||
uint256 amountReceived = _sellOnParaSwap(
|
||||
swapAllBalanceOffset,
|
||||
swapCalldata,
|
||||
augustus,
|
||||
assetToSwapFrom,
|
||||
assetToSwapTo,
|
||||
amountToSwap,
|
||||
minAmountToReceive
|
||||
);
|
||||
|
||||
assetToSwapTo.safeApprove(address(LENDING_POOL), 0);
|
||||
assetToSwapTo.safeApprove(address(LENDING_POOL), amountReceived);
|
||||
LENDING_POOL.deposit(address(assetToSwapTo), amountReceived, msg.sender, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Swaps an amount of an asset to another and deposits the funds on behalf of the initiator.
|
||||
* @param swapAllBalanceOffset Set to offset of fromAmount in Augustus calldata if wanting to swap all balance, otherwise 0
|
||||
* @param swapCalldata Calldata for ParaSwap's AugustusSwapper contract
|
||||
* @param augustus Address of ParaSwap's AugustusSwapper contract
|
||||
* @param permitParams Struct containing the permit signatures, set to all zeroes if not used
|
||||
* @param flashLoanAmount Amount of the flash loan i.e. maximum amount to swap
|
||||
* @param premium Fee of the flash loan
|
||||
* @param initiator Account that initiated the flash loan
|
||||
* @param assetToSwapFrom Address of the underyling asset to be swapped from
|
||||
* @param assetToSwapTo Address of the underlying asset to be swapped to and deposited
|
||||
* @param minAmountToReceive Min amount to be received from the swap
|
||||
*/
|
||||
function _swapLiquidity (
|
||||
uint256 swapAllBalanceOffset,
|
||||
bytes memory swapCalldata,
|
||||
IParaSwapAugustus augustus,
|
||||
PermitSignature memory permitParams,
|
||||
uint256 flashLoanAmount,
|
||||
uint256 premium,
|
||||
address initiator,
|
||||
IERC20Detailed assetToSwapFrom,
|
||||
IERC20Detailed assetToSwapTo,
|
||||
uint256 minAmountToReceive
|
||||
) internal {
|
||||
IERC20WithPermit aToken =
|
||||
IERC20WithPermit(_getReserveData(address(assetToSwapFrom)).aTokenAddress);
|
||||
uint256 amountToSwap = flashLoanAmount;
|
||||
|
||||
uint256 balance = aToken.balanceOf(initiator);
|
||||
if (swapAllBalanceOffset != 0) {
|
||||
uint256 balanceToSwap = balance.sub(premium);
|
||||
require(balanceToSwap <= amountToSwap, 'INSUFFICIENT_AMOUNT_TO_SWAP');
|
||||
amountToSwap = balanceToSwap;
|
||||
} else {
|
||||
require(balance >= amountToSwap.add(premium), 'INSUFFICIENT_ATOKEN_BALANCE');
|
||||
}
|
||||
|
||||
uint256 amountReceived = _sellOnParaSwap(
|
||||
swapAllBalanceOffset,
|
||||
swapCalldata,
|
||||
augustus,
|
||||
assetToSwapFrom,
|
||||
assetToSwapTo,
|
||||
amountToSwap,
|
||||
minAmountToReceive
|
||||
);
|
||||
|
||||
assetToSwapTo.safeApprove(address(LENDING_POOL), 0);
|
||||
assetToSwapTo.safeApprove(address(LENDING_POOL), amountReceived);
|
||||
LENDING_POOL.deposit(address(assetToSwapTo), amountReceived, initiator, 0);
|
||||
|
||||
_pullATokenAndWithdraw(
|
||||
address(assetToSwapFrom),
|
||||
aToken,
|
||||
initiator,
|
||||
amountToSwap.add(premium),
|
||||
permitParams
|
||||
);
|
||||
|
||||
// Repay flash loan
|
||||
assetToSwapFrom.safeApprove(address(LENDING_POOL), 0);
|
||||
assetToSwapFrom.safeApprove(address(LENDING_POOL), flashLoanAmount.add(premium));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
// SPDX-License-Identifier: MIT
|
||||
|
||||
pragma solidity >=0.6.0 <0.8.0;
|
||||
|
||||
/**
|
||||
* @dev Contract module that helps prevent reentrant calls to a function.
|
||||
*
|
||||
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
|
||||
* available, which can be applied to functions to make sure there are no nested
|
||||
* (reentrant) calls to them.
|
||||
*
|
||||
* Note that because there is a single `nonReentrant` guard, functions marked as
|
||||
* `nonReentrant` may not call one another. This can be worked around by making
|
||||
* those functions `private`, and then adding `external` `nonReentrant` entry
|
||||
* points to them.
|
||||
*
|
||||
* TIP: If you would like to learn more about reentrancy and alternative ways
|
||||
* to protect against it, check out our blog post
|
||||
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
|
||||
*/
|
||||
abstract contract ReentrancyGuard {
|
||||
// Booleans are more expensive than uint256 or any type that takes up a full
|
||||
// word because each write operation emits an extra SLOAD to first read the
|
||||
// slot's contents, replace the bits taken up by the boolean, and then write
|
||||
// back. This is the compiler's defense against contract upgrades and
|
||||
// pointer aliasing, and it cannot be disabled.
|
||||
|
||||
// The values being non-zero value makes deployment a bit more expensive,
|
||||
// but in exchange the refund on every call to nonReentrant will be lower in
|
||||
// amount. Since refunds are capped to a percentage of the total
|
||||
// transaction's gas, it is best to keep them low in cases like this one, to
|
||||
// increase the likelihood of the full refund coming into effect.
|
||||
uint256 private constant _NOT_ENTERED = 1;
|
||||
uint256 private constant _ENTERED = 2;
|
||||
|
||||
uint256 private _status;
|
||||
|
||||
constructor () internal {
|
||||
_status = _NOT_ENTERED;
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Prevents a contract from calling itself, directly or indirectly.
|
||||
* Calling a `nonReentrant` function from another `nonReentrant`
|
||||
* function is not supported. It is possible to prevent this from happening
|
||||
* by making the `nonReentrant` function external, and make it call a
|
||||
* `private` function that does the actual work.
|
||||
*/
|
||||
modifier nonReentrant() {
|
||||
// On the first call to nonReentrant, _notEntered will be true
|
||||
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
|
||||
|
||||
// Any calls to nonReentrant after this point will fail
|
||||
_status = _ENTERED;
|
||||
|
||||
_;
|
||||
|
||||
// By storing the original value once again, a refund is triggered (see
|
||||
// https://eips.ethereum.org/EIPS/eip-2200)
|
||||
_status = _NOT_ENTERED;
|
||||
}
|
||||
}
|
|
@ -30,6 +30,21 @@ interface IAaveIncentivesController {
|
|||
uint256
|
||||
);
|
||||
|
||||
/*
|
||||
* LEGACY **************************
|
||||
* @dev Returns the configuration of the distribution for a certain asset
|
||||
* @param asset The address of the reference asset of the distribution
|
||||
* @return The asset index, the emission per second and the last updated timestamp
|
||||
**/
|
||||
function assets(address asset)
|
||||
external
|
||||
view
|
||||
returns (
|
||||
uint128,
|
||||
uint128,
|
||||
uint256
|
||||
);
|
||||
|
||||
/**
|
||||
* @dev Whitelists an address to claim the rewards on behalf of another address
|
||||
* @param user The address of the user
|
||||
|
|
7
contracts/interfaces/IParaSwapAugustus.sol
Normal file
7
contracts/interfaces/IParaSwapAugustus.sol
Normal file
|
@ -0,0 +1,7 @@
|
|||
// SPDX-License-Identifier: agpl-3.0
|
||||
pragma solidity 0.6.12;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
interface IParaSwapAugustus {
|
||||
function getTokenTransferProxy() external view returns (address);
|
||||
}
|
7
contracts/interfaces/IParaSwapAugustusRegistry.sol
Normal file
7
contracts/interfaces/IParaSwapAugustusRegistry.sol
Normal file
|
@ -0,0 +1,7 @@
|
|||
// SPDX-License-Identifier: agpl-3.0
|
||||
pragma solidity 0.6.12;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
interface IParaSwapAugustusRegistry {
|
||||
function isValidAugustus(address augustus) external view returns (bool);
|
||||
}
|
|
@ -18,29 +18,34 @@ import {SafeERC20} from '../dependencies/openzeppelin/contracts/SafeERC20.sol';
|
|||
contract AaveOracle is IPriceOracleGetter, Ownable {
|
||||
using SafeERC20 for IERC20;
|
||||
|
||||
event WethSet(address indexed weth);
|
||||
event BaseCurrencySet(address indexed baseCurrency, uint256 baseCurrencyUnit);
|
||||
event AssetSourceUpdated(address indexed asset, address indexed source);
|
||||
event FallbackOracleUpdated(address indexed fallbackOracle);
|
||||
|
||||
mapping(address => IChainlinkAggregator) private assetsSources;
|
||||
IPriceOracleGetter private _fallbackOracle;
|
||||
address public immutable WETH;
|
||||
address public immutable BASE_CURRENCY;
|
||||
uint256 public immutable BASE_CURRENCY_UNIT;
|
||||
|
||||
/// @notice Constructor
|
||||
/// @param assets The addresses of the assets
|
||||
/// @param sources The address of the source of each asset
|
||||
/// @param fallbackOracle The address of the fallback oracle to use if the data of an
|
||||
/// aggregator is not consistent
|
||||
/// @param baseCurrency the base currency used for the price quotes. If USD is used, base currency is 0x0
|
||||
/// @param baseCurrencyUnit the unit of the base currency
|
||||
constructor(
|
||||
address[] memory assets,
|
||||
address[] memory sources,
|
||||
address fallbackOracle,
|
||||
address weth
|
||||
address baseCurrency,
|
||||
uint256 baseCurrencyUnit
|
||||
) public {
|
||||
_setFallbackOracle(fallbackOracle);
|
||||
_setAssetsSources(assets, sources);
|
||||
WETH = weth;
|
||||
emit WethSet(weth);
|
||||
BASE_CURRENCY = baseCurrency;
|
||||
BASE_CURRENCY_UNIT = baseCurrencyUnit;
|
||||
emit BaseCurrencySet(baseCurrency, baseCurrencyUnit);
|
||||
}
|
||||
|
||||
/// @notice External function called by the Aave governance to set or replace sources of assets
|
||||
|
@ -83,8 +88,8 @@ contract AaveOracle is IPriceOracleGetter, Ownable {
|
|||
function getAssetPrice(address asset) public view override returns (uint256) {
|
||||
IChainlinkAggregator source = assetsSources[asset];
|
||||
|
||||
if (asset == WETH) {
|
||||
return 1 ether;
|
||||
if (asset == BASE_CURRENCY) {
|
||||
return BASE_CURRENCY_UNIT;
|
||||
} else if (address(source) == address(0)) {
|
||||
return _fallbackOracle.getAssetPrice(asset);
|
||||
} else {
|
||||
|
|
|
@ -25,7 +25,7 @@ contract UiPoolDataProvider is IUiPoolDataProvider {
|
|||
using UserConfiguration for DataTypes.UserConfigurationMap;
|
||||
|
||||
address public constant MOCK_USD_ADDRESS = 0x10F7Fc1F91Ba351f9C629c5947AD69bD03C05b96;
|
||||
IAaveIncentivesController public immutable incentivesController;
|
||||
IAaveIncentivesController public immutable override incentivesController;
|
||||
IPriceOracleGetter public immutable oracle;
|
||||
|
||||
constructor(IAaveIncentivesController _incentivesController, IPriceOracleGetter _oracle) public {
|
||||
|
@ -51,6 +51,185 @@ contract UiPoolDataProvider is IUiPoolDataProvider {
|
|||
);
|
||||
}
|
||||
|
||||
function getReservesList(ILendingPoolAddressesProvider provider)
|
||||
public
|
||||
view
|
||||
override
|
||||
returns (address[] memory)
|
||||
{
|
||||
ILendingPool lendingPool = ILendingPool(provider.getLendingPool());
|
||||
return lendingPool.getReservesList();
|
||||
}
|
||||
|
||||
function getSimpleReservesData(ILendingPoolAddressesProvider provider)
|
||||
public
|
||||
view
|
||||
override
|
||||
returns (
|
||||
AggregatedReserveData[] memory,
|
||||
uint256,
|
||||
uint256
|
||||
)
|
||||
{
|
||||
ILendingPool lendingPool = ILendingPool(provider.getLendingPool());
|
||||
address[] memory reserves = lendingPool.getReservesList();
|
||||
AggregatedReserveData[] memory reservesData = new AggregatedReserveData[](reserves.length);
|
||||
|
||||
for (uint256 i = 0; i < reserves.length; i++) {
|
||||
AggregatedReserveData memory reserveData = reservesData[i];
|
||||
reserveData.underlyingAsset = reserves[i];
|
||||
|
||||
// reserve current state
|
||||
DataTypes.ReserveData memory baseData =
|
||||
lendingPool.getReserveData(reserveData.underlyingAsset);
|
||||
reserveData.liquidityIndex = baseData.liquidityIndex;
|
||||
reserveData.variableBorrowIndex = baseData.variableBorrowIndex;
|
||||
reserveData.liquidityRate = baseData.currentLiquidityRate;
|
||||
reserveData.variableBorrowRate = baseData.currentVariableBorrowRate;
|
||||
reserveData.stableBorrowRate = baseData.currentStableBorrowRate;
|
||||
reserveData.lastUpdateTimestamp = baseData.lastUpdateTimestamp;
|
||||
reserveData.aTokenAddress = baseData.aTokenAddress;
|
||||
reserveData.stableDebtTokenAddress = baseData.stableDebtTokenAddress;
|
||||
reserveData.variableDebtTokenAddress = baseData.variableDebtTokenAddress;
|
||||
reserveData.interestRateStrategyAddress = baseData.interestRateStrategyAddress;
|
||||
reserveData.priceInEth = oracle.getAssetPrice(reserveData.underlyingAsset);
|
||||
|
||||
reserveData.availableLiquidity = IERC20Detailed(reserveData.underlyingAsset).balanceOf(
|
||||
reserveData.aTokenAddress
|
||||
);
|
||||
(
|
||||
reserveData.totalPrincipalStableDebt,
|
||||
,
|
||||
reserveData.averageStableRate,
|
||||
reserveData.stableDebtLastUpdateTimestamp
|
||||
) = IStableDebtToken(reserveData.stableDebtTokenAddress).getSupplyData();
|
||||
reserveData.totalScaledVariableDebt = IVariableDebtToken(reserveData.variableDebtTokenAddress)
|
||||
.scaledTotalSupply();
|
||||
|
||||
// reserve configuration
|
||||
|
||||
// we're getting this info from the aToken, because some of assets can be not compliant with ETC20Detailed
|
||||
reserveData.symbol = IERC20Detailed(reserveData.underlyingAsset).symbol();
|
||||
reserveData.name = '';
|
||||
|
||||
(
|
||||
reserveData.baseLTVasCollateral,
|
||||
reserveData.reserveLiquidationThreshold,
|
||||
reserveData.reserveLiquidationBonus,
|
||||
reserveData.decimals,
|
||||
reserveData.reserveFactor
|
||||
) = baseData.configuration.getParamsMemory();
|
||||
(
|
||||
reserveData.isActive,
|
||||
reserveData.isFrozen,
|
||||
reserveData.borrowingEnabled,
|
||||
reserveData.stableBorrowRateEnabled
|
||||
) = baseData.configuration.getFlagsMemory();
|
||||
reserveData.usageAsCollateralEnabled = reserveData.baseLTVasCollateral != 0;
|
||||
(
|
||||
reserveData.variableRateSlope1,
|
||||
reserveData.variableRateSlope2,
|
||||
reserveData.stableRateSlope1,
|
||||
reserveData.stableRateSlope2
|
||||
) = getInterestRateStrategySlopes(
|
||||
DefaultReserveInterestRateStrategy(reserveData.interestRateStrategyAddress)
|
||||
);
|
||||
|
||||
// incentives
|
||||
if (address(0) != address(incentivesController)) {
|
||||
(
|
||||
reserveData.aTokenIncentivesIndex,
|
||||
reserveData.aEmissionPerSecond,
|
||||
reserveData.aIncentivesLastUpdateTimestamp
|
||||
) = incentivesController.getAssetData(reserveData.aTokenAddress);
|
||||
|
||||
(
|
||||
reserveData.sTokenIncentivesIndex,
|
||||
reserveData.sEmissionPerSecond,
|
||||
reserveData.sIncentivesLastUpdateTimestamp
|
||||
) = incentivesController.getAssetData(reserveData.stableDebtTokenAddress);
|
||||
|
||||
(
|
||||
reserveData.vTokenIncentivesIndex,
|
||||
reserveData.vEmissionPerSecond,
|
||||
reserveData.vIncentivesLastUpdateTimestamp
|
||||
) = incentivesController.getAssetData(reserveData.variableDebtTokenAddress);
|
||||
}
|
||||
}
|
||||
|
||||
uint256 emissionEndTimestamp;
|
||||
if (address(0) != address(incentivesController)) {
|
||||
emissionEndTimestamp = incentivesController.DISTRIBUTION_END();
|
||||
}
|
||||
|
||||
return (reservesData, oracle.getAssetPrice(MOCK_USD_ADDRESS), emissionEndTimestamp);
|
||||
}
|
||||
|
||||
function getUserReservesData(ILendingPoolAddressesProvider provider, address user)
|
||||
external
|
||||
view
|
||||
override
|
||||
returns (UserReserveData[] memory, uint256)
|
||||
{
|
||||
ILendingPool lendingPool = ILendingPool(provider.getLendingPool());
|
||||
address[] memory reserves = lendingPool.getReservesList();
|
||||
DataTypes.UserConfigurationMap memory userConfig = lendingPool.getUserConfiguration(user);
|
||||
|
||||
UserReserveData[] memory userReservesData =
|
||||
new UserReserveData[](user != address(0) ? reserves.length : 0);
|
||||
|
||||
for (uint256 i = 0; i < reserves.length; i++) {
|
||||
DataTypes.ReserveData memory baseData = lendingPool.getReserveData(reserves[i]);
|
||||
// incentives
|
||||
if (address(0) != address(incentivesController)) {
|
||||
userReservesData[i].aTokenincentivesUserIndex = incentivesController.getUserAssetData(
|
||||
user,
|
||||
baseData.aTokenAddress
|
||||
);
|
||||
userReservesData[i].vTokenincentivesUserIndex = incentivesController.getUserAssetData(
|
||||
user,
|
||||
baseData.variableDebtTokenAddress
|
||||
);
|
||||
userReservesData[i].sTokenincentivesUserIndex = incentivesController.getUserAssetData(
|
||||
user,
|
||||
baseData.stableDebtTokenAddress
|
||||
);
|
||||
}
|
||||
// user reserve data
|
||||
userReservesData[i].underlyingAsset = reserves[i];
|
||||
userReservesData[i].scaledATokenBalance = IAToken(baseData.aTokenAddress).scaledBalanceOf(
|
||||
user
|
||||
);
|
||||
userReservesData[i].usageAsCollateralEnabledOnUser = userConfig.isUsingAsCollateral(i);
|
||||
|
||||
if (userConfig.isBorrowing(i)) {
|
||||
userReservesData[i].scaledVariableDebt = IVariableDebtToken(
|
||||
baseData
|
||||
.variableDebtTokenAddress
|
||||
)
|
||||
.scaledBalanceOf(user);
|
||||
userReservesData[i].principalStableDebt = IStableDebtToken(baseData.stableDebtTokenAddress)
|
||||
.principalBalanceOf(user);
|
||||
if (userReservesData[i].principalStableDebt != 0) {
|
||||
userReservesData[i].stableBorrowRate = IStableDebtToken(baseData.stableDebtTokenAddress)
|
||||
.getUserStableRate(user);
|
||||
userReservesData[i].stableBorrowLastUpdateTimestamp = IStableDebtToken(
|
||||
baseData
|
||||
.stableDebtTokenAddress
|
||||
)
|
||||
.getUserLastUpdated(user);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint256 userUnclaimedRewards;
|
||||
if (address(0) != address(incentivesController)) {
|
||||
userUnclaimedRewards = incentivesController.getUserUnclaimedRewards(user);
|
||||
}
|
||||
|
||||
return (userReservesData, userUnclaimedRewards);
|
||||
}
|
||||
|
||||
function getReservesData(ILendingPoolAddressesProvider provider, address user)
|
||||
external
|
||||
view
|
||||
|
@ -104,7 +283,7 @@ contract UiPoolDataProvider is IUiPoolDataProvider {
|
|||
// reserve configuration
|
||||
|
||||
// we're getting this info from the aToken, because some of assets can be not compliant with ETC20Detailed
|
||||
reserveData.symbol = IERC20Detailed(reserveData.aTokenAddress).symbol();
|
||||
reserveData.symbol = IERC20Detailed(reserveData.underlyingAsset).symbol();
|
||||
reserveData.name = '';
|
||||
|
||||
(
|
||||
|
@ -136,14 +315,14 @@ contract UiPoolDataProvider is IUiPoolDataProvider {
|
|||
reserveData.aTokenIncentivesIndex,
|
||||
reserveData.aEmissionPerSecond,
|
||||
reserveData.aIncentivesLastUpdateTimestamp
|
||||
) = incentivesController.getAssetData(reserveData.aTokenAddress);
|
||||
|
||||
) = incentivesController.getAssetData(reserveData.aTokenAddress);
|
||||
|
||||
(
|
||||
reserveData.sTokenIncentivesIndex,
|
||||
reserveData.sEmissionPerSecond,
|
||||
reserveData.sIncentivesLastUpdateTimestamp
|
||||
) = incentivesController.getAssetData(reserveData.stableDebtTokenAddress);
|
||||
|
||||
|
||||
(
|
||||
reserveData.vTokenIncentivesIndex,
|
||||
reserveData.vEmissionPerSecond,
|
||||
|
@ -200,12 +379,12 @@ contract UiPoolDataProvider is IUiPoolDataProvider {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
IncentivesControllerData memory incentivesControllerData;
|
||||
|
||||
if (address(0) != address(incentivesController)) {
|
||||
if (user != address(0)) {
|
||||
incentivesControllerData.userUnclaimedRewards = incentivesController.getUserUnclaimedRewards(user);
|
||||
incentivesControllerData.userUnclaimedRewards = incentivesController
|
||||
.getUserUnclaimedRewards(user);
|
||||
}
|
||||
incentivesControllerData.emissionEndTimestamp = incentivesController.DISTRIBUTION_END();
|
||||
}
|
||||
|
|
|
@ -73,7 +73,31 @@ interface IUiPoolDataProvider {
|
|||
uint256 emissionEndTimestamp;
|
||||
}
|
||||
|
||||
function getReservesList(ILendingPoolAddressesProvider provider)
|
||||
external
|
||||
view
|
||||
returns (address[] memory);
|
||||
|
||||
function incentivesController() external view returns (IAaveIncentivesController);
|
||||
|
||||
function getSimpleReservesData(ILendingPoolAddressesProvider provider)
|
||||
external
|
||||
view
|
||||
returns (
|
||||
AggregatedReserveData[] memory,
|
||||
uint256, // usd price eth
|
||||
uint256 // emission end timestamp
|
||||
);
|
||||
|
||||
function getUserReservesData(ILendingPoolAddressesProvider provider, address user)
|
||||
external
|
||||
view
|
||||
returns (
|
||||
UserReserveData[] memory,
|
||||
uint256 // user unclaimed rewards
|
||||
);
|
||||
|
||||
// generic method with full data
|
||||
function getReservesData(ILendingPoolAddressesProvider provider, address user)
|
||||
external
|
||||
view
|
||||
|
|
59
contracts/mocks/swap/MockParaSwapAugustus.sol
Normal file
59
contracts/mocks/swap/MockParaSwapAugustus.sol
Normal file
|
@ -0,0 +1,59 @@
|
|||
// SPDX-License-Identifier: agpl-3.0
|
||||
pragma solidity 0.6.12;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
import {IParaSwapAugustus} from '../../interfaces/IParaSwapAugustus.sol';
|
||||
import {MockParaSwapTokenTransferProxy} from './MockParaSwapTokenTransferProxy.sol';
|
||||
import {IERC20} from '../../dependencies/openzeppelin/contracts/IERC20.sol';
|
||||
import {MintableERC20} from '../tokens/MintableERC20.sol';
|
||||
|
||||
contract MockParaSwapAugustus is IParaSwapAugustus {
|
||||
MockParaSwapTokenTransferProxy immutable TOKEN_TRANSFER_PROXY;
|
||||
bool _expectingSwap;
|
||||
address _expectedFromToken;
|
||||
address _expectedToToken;
|
||||
uint256 _expectedFromAmountMin;
|
||||
uint256 _expectedFromAmountMax;
|
||||
uint256 _receivedAmount;
|
||||
|
||||
constructor() public {
|
||||
TOKEN_TRANSFER_PROXY = new MockParaSwapTokenTransferProxy();
|
||||
}
|
||||
|
||||
function getTokenTransferProxy() external view override returns (address) {
|
||||
return address(TOKEN_TRANSFER_PROXY);
|
||||
}
|
||||
|
||||
function expectSwap(
|
||||
address fromToken,
|
||||
address toToken,
|
||||
uint256 fromAmountMin,
|
||||
uint256 fromAmountMax,
|
||||
uint256 receivedAmount
|
||||
) external {
|
||||
_expectingSwap = true;
|
||||
_expectedFromToken = fromToken;
|
||||
_expectedToToken = toToken;
|
||||
_expectedFromAmountMin = fromAmountMin;
|
||||
_expectedFromAmountMax = fromAmountMax;
|
||||
_receivedAmount = receivedAmount;
|
||||
}
|
||||
|
||||
function swap(
|
||||
address fromToken,
|
||||
address toToken,
|
||||
uint256 fromAmount,
|
||||
uint256 toAmount
|
||||
) external returns (uint256) {
|
||||
require(_expectingSwap, 'Not expecting swap');
|
||||
require(fromToken == _expectedFromToken, 'Unexpected from token');
|
||||
require(toToken == _expectedToToken, 'Unexpected to token');
|
||||
require(fromAmount >= _expectedFromAmountMin && fromAmount <= _expectedFromAmountMax, 'From amount out of range');
|
||||
require(_receivedAmount >= toAmount, 'Received amount of tokens are less than expected');
|
||||
TOKEN_TRANSFER_PROXY.transferFrom(fromToken, msg.sender, address(this), fromAmount);
|
||||
MintableERC20(toToken).mint(_receivedAmount);
|
||||
IERC20(toToken).transfer(msg.sender, _receivedAmount);
|
||||
_expectingSwap = false;
|
||||
return _receivedAmount;
|
||||
}
|
||||
}
|
17
contracts/mocks/swap/MockParaSwapAugustusRegistry.sol
Normal file
17
contracts/mocks/swap/MockParaSwapAugustusRegistry.sol
Normal file
|
@ -0,0 +1,17 @@
|
|||
// SPDX-License-Identifier: agpl-3.0
|
||||
pragma solidity 0.6.12;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
import {IParaSwapAugustusRegistry} from '../../interfaces/IParaSwapAugustusRegistry.sol';
|
||||
|
||||
contract MockParaSwapAugustusRegistry is IParaSwapAugustusRegistry {
|
||||
address immutable AUGUSTUS;
|
||||
|
||||
constructor(address augustus) public {
|
||||
AUGUSTUS = augustus;
|
||||
}
|
||||
|
||||
function isValidAugustus(address augustus) external view override returns (bool) {
|
||||
return augustus == AUGUSTUS;
|
||||
}
|
||||
}
|
17
contracts/mocks/swap/MockParaSwapTokenTransferProxy.sol
Normal file
17
contracts/mocks/swap/MockParaSwapTokenTransferProxy.sol
Normal file
|
@ -0,0 +1,17 @@
|
|||
// SPDX-License-Identifier: agpl-3.0
|
||||
pragma solidity 0.6.12;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
import {Ownable} from '../../dependencies/openzeppelin/contracts/Ownable.sol';
|
||||
import {IERC20} from '../../dependencies/openzeppelin/contracts/IERC20.sol';
|
||||
|
||||
contract MockParaSwapTokenTransferProxy is Ownable {
|
||||
function transferFrom(
|
||||
address token,
|
||||
address from,
|
||||
address to,
|
||||
uint256 amount
|
||||
) external onlyOwner {
|
||||
IERC20(token).transferFrom(from, to, amount);
|
||||
}
|
||||
}
|
|
@ -3,7 +3,13 @@ import fs from 'fs';
|
|||
import { HardhatUserConfig } from 'hardhat/types';
|
||||
// @ts-ignore
|
||||
import { accounts } from './test-wallets.js';
|
||||
import { eEthereumNetwork, eNetwork, ePolygonNetwork, eXDaiNetwork } from './helpers/types';
|
||||
import {
|
||||
eAvalancheNetwork,
|
||||
eEthereumNetwork,
|
||||
eNetwork,
|
||||
ePolygonNetwork,
|
||||
eXDaiNetwork,
|
||||
} from './helpers/types';
|
||||
import { BUIDLEREVM_CHAINID, COVERAGE_CHAINID } from './helpers/buidler-constants';
|
||||
import {
|
||||
NETWORKS_RPC_URL,
|
||||
|
@ -24,12 +30,13 @@ import 'solidity-coverage';
|
|||
import { fork } from 'child_process';
|
||||
|
||||
const SKIP_LOAD = process.env.SKIP_LOAD === 'true';
|
||||
const DEFAULT_BLOCK_GAS_LIMIT = 12450000;
|
||||
const DEFAULT_BLOCK_GAS_LIMIT = 8000000;
|
||||
const DEFAULT_GAS_MUL = 5;
|
||||
const HARDFORK = 'istanbul';
|
||||
const ETHERSCAN_KEY = process.env.ETHERSCAN_KEY || '';
|
||||
const MNEMONIC_PATH = "m/44'/60'/0'/0";
|
||||
const MNEMONIC = process.env.MNEMONIC || '';
|
||||
const UNLIMITED_BYTECODE_SIZE = process.env.UNLIMITED_BYTECODE_SIZE === 'true';
|
||||
|
||||
// Prevent to load scripts before compilation and typechain
|
||||
if (!SKIP_LOAD) {
|
||||
|
@ -95,15 +102,18 @@ const buidlerConfig: HardhatUserConfig = {
|
|||
kovan: getCommonNetworkConfig(eEthereumNetwork.kovan, 42),
|
||||
ropsten: getCommonNetworkConfig(eEthereumNetwork.ropsten, 3),
|
||||
main: getCommonNetworkConfig(eEthereumNetwork.main, 1),
|
||||
tenderlyMain: getCommonNetworkConfig(eEthereumNetwork.tenderlyMain, 3030),
|
||||
tenderly: getCommonNetworkConfig(eEthereumNetwork.tenderly, 3030),
|
||||
matic: getCommonNetworkConfig(ePolygonNetwork.matic, 137),
|
||||
mumbai: getCommonNetworkConfig(ePolygonNetwork.mumbai, 80001),
|
||||
xdai: getCommonNetworkConfig(eXDaiNetwork.xdai, 100),
|
||||
avalanche: getCommonNetworkConfig(eAvalancheNetwork.avalanche, 43114),
|
||||
fuji: getCommonNetworkConfig(eAvalancheNetwork.fuji, 43113),
|
||||
hardhat: {
|
||||
hardfork: 'berlin',
|
||||
blockGasLimit: DEFAULT_BLOCK_GAS_LIMIT,
|
||||
gas: DEFAULT_BLOCK_GAS_LIMIT,
|
||||
gasPrice: 8000000000,
|
||||
allowUnlimitedContractSize: UNLIMITED_BYTECODE_SIZE,
|
||||
chainId: BUIDLEREVM_CHAINID,
|
||||
throwOnTransactionFailures: true,
|
||||
throwOnCallFailures: true,
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
// @ts-ignore
|
||||
import { HardhatNetworkForkingUserConfig, HardhatUserConfig } from 'hardhat/types';
|
||||
import {
|
||||
eAvalancheNetwork,
|
||||
eEthereumNetwork,
|
||||
ePolygonNetwork,
|
||||
eXDaiNetwork,
|
||||
|
@ -45,10 +46,15 @@ export const NETWORKS_RPC_URL: iParamsPerNetwork<string> = {
|
|||
[eEthereumNetwork.coverage]: 'http://localhost:8555',
|
||||
[eEthereumNetwork.hardhat]: 'http://localhost:8545',
|
||||
[eEthereumNetwork.buidlerevm]: 'http://localhost:8545',
|
||||
[eEthereumNetwork.tenderlyMain]: `https://rpc.tenderly.co/fork/${TENDERLY_FORK_ID}`,
|
||||
[eEthereumNetwork.tenderly]: `https://rpc.tenderly.co/fork/`,
|
||||
[ePolygonNetwork.mumbai]: 'https://rpc-mumbai.maticvigil.com',
|
||||
[ePolygonNetwork.matic]: 'https://rpc-mainnet.matic.network',
|
||||
[ePolygonNetwork.matic]:
|
||||
// 'https://rpc-mainnet.maticvigil.com/v1/e616b9ddc7598ffae92629f8145614d55094c722',
|
||||
'https://polygon-mainnet.g.alchemy.com/v2/6NUmfWDZw6lC3RPAphj0p_2vm7ElOn2U',
|
||||
// [ePolygonNetwork.matic]: 'https://rpc-mainnet.matic.network',
|
||||
[eXDaiNetwork.xdai]: 'https://rpc.xdaichain.com/',
|
||||
[eAvalancheNetwork.avalanche]: 'https://api.avax.network/ext/bc/C/rpc',
|
||||
[eAvalancheNetwork.fuji]: 'https://api.avax-test.network/ext/bc/C/rpc',
|
||||
};
|
||||
|
||||
export const NETWORKS_DEFAULT_GAS: iParamsPerNetwork<number> = {
|
||||
|
@ -58,10 +64,12 @@ export const NETWORKS_DEFAULT_GAS: iParamsPerNetwork<number> = {
|
|||
[eEthereumNetwork.coverage]: 65 * GWEI,
|
||||
[eEthereumNetwork.hardhat]: 65 * GWEI,
|
||||
[eEthereumNetwork.buidlerevm]: 65 * GWEI,
|
||||
[eEthereumNetwork.tenderlyMain]: 0.01 * GWEI,
|
||||
[eEthereumNetwork.tenderly]: 1 * GWEI,
|
||||
[ePolygonNetwork.mumbai]: 1 * GWEI,
|
||||
[ePolygonNetwork.matic]: 1 * GWEI,
|
||||
[eXDaiNetwork.xdai]: 1 * GWEI,
|
||||
[eAvalancheNetwork.avalanche]: 225 * GWEI,
|
||||
[eAvalancheNetwork.fuji]: 85 * GWEI,
|
||||
};
|
||||
|
||||
export const BLOCK_TO_FORK: iParamsPerNetwork<number | undefined> = {
|
||||
|
@ -71,8 +79,10 @@ export const BLOCK_TO_FORK: iParamsPerNetwork<number | undefined> = {
|
|||
[eEthereumNetwork.coverage]: undefined,
|
||||
[eEthereumNetwork.hardhat]: undefined,
|
||||
[eEthereumNetwork.buidlerevm]: undefined,
|
||||
[eEthereumNetwork.tenderlyMain]: 12406069,
|
||||
[eEthereumNetwork.tenderly]: undefined,
|
||||
[ePolygonNetwork.mumbai]: undefined,
|
||||
[ePolygonNetwork.matic]: undefined,
|
||||
[eXDaiNetwork.xdai]: undefined,
|
||||
[eAvalancheNetwork.avalanche]: undefined,
|
||||
[eAvalancheNetwork.fuji]: undefined,
|
||||
};
|
||||
|
|
|
@ -3,14 +3,16 @@ import {
|
|||
iMultiPoolsAssets,
|
||||
IReserveParams,
|
||||
PoolConfiguration,
|
||||
ICommonConfiguration,
|
||||
eNetwork,
|
||||
IBaseConfiguration,
|
||||
} from './types';
|
||||
import { getEthersSignersAddresses, getParamPerPool } from './contracts-helpers';
|
||||
import AaveConfig from '../markets/aave';
|
||||
import AaveArcConfig from '../markets/aave-arc';
|
||||
import MaticConfig from '../markets/matic';
|
||||
import AvalancheConfig from '../markets/avalanche';
|
||||
import AmmConfig from '../markets/amm';
|
||||
|
||||
import { CommonsConfig } from '../markets/aave/commons';
|
||||
import { DRE, filterMapBy } from './misc-utils';
|
||||
import { tEthereumAddress } from './types';
|
||||
|
@ -22,7 +24,8 @@ export enum ConfigNames {
|
|||
Aave = 'Aave',
|
||||
Matic = 'Matic',
|
||||
Amm = 'Amm',
|
||||
Arc = 'Arc'
|
||||
Arc = 'Arc',
|
||||
Avalanche = 'Avalanche'
|
||||
}
|
||||
|
||||
export const loadPoolConfig = (configName: ConfigNames): PoolConfiguration => {
|
||||
|
@ -33,12 +36,18 @@ export const loadPoolConfig = (configName: ConfigNames): PoolConfiguration => {
|
|||
return MaticConfig;
|
||||
case ConfigNames.Amm:
|
||||
return AmmConfig;
|
||||
case ConfigNames.Avalanche:
|
||||
return AvalancheConfig;
|
||||
case ConfigNames.Commons:
|
||||
return CommonsConfig;
|
||||
case ConfigNames.Arc:
|
||||
return AaveArcConfig;
|
||||
default:
|
||||
throw new Error(`Unsupported pool configuration: ${Object.values(ConfigNames)}`);
|
||||
throw new Error(
|
||||
`Unsupported pool configuration: ${configName} is not one of the supported configs ${Object.values(
|
||||
ConfigNames
|
||||
)}`
|
||||
);
|
||||
}
|
||||
};
|
||||
// ----------------
|
||||
|
@ -58,14 +67,17 @@ export const getReservesConfigByPool = (pool: AavePools): iMultiPoolsAssets<IRes
|
|||
...MaticConfig.ReservesConfig,
|
||||
},
|
||||
[AavePools.arc]: {
|
||||
...AaveArcConfig.ReservesConfig
|
||||
...AaveArcConfig.ReservesConfig,
|
||||
},
|
||||
[AavePools.avalanche]: {
|
||||
...AvalancheConfig.ReservesConfig,
|
||||
}
|
||||
},
|
||||
pool
|
||||
);
|
||||
|
||||
export const getGenesisPoolAdmin = async (
|
||||
config: ICommonConfiguration
|
||||
config: IBaseConfiguration
|
||||
): Promise<tEthereumAddress> => {
|
||||
const currentNetwork = process.env.FORK ? process.env.FORK : DRE.network.name;
|
||||
const targetAddress = getParamPerNetwork(config.PoolAdmin, <eNetwork>currentNetwork);
|
||||
|
@ -77,9 +89,7 @@ export const getGenesisPoolAdmin = async (
|
|||
return addressList[addressIndex];
|
||||
};
|
||||
|
||||
export const getEmergencyAdmin = async (
|
||||
config: ICommonConfiguration
|
||||
): Promise<tEthereumAddress> => {
|
||||
export const getEmergencyAdmin = async (config: IBaseConfiguration): Promise<tEthereumAddress> => {
|
||||
const currentNetwork = process.env.FORK ? process.env.FORK : DRE.network.name;
|
||||
const targetAddress = getParamPerNetwork(config.EmergencyAdmin, <eNetwork>currentNetwork);
|
||||
if (targetAddress) {
|
||||
|
@ -90,19 +100,17 @@ export const getEmergencyAdmin = async (
|
|||
return addressList[addressIndex];
|
||||
};
|
||||
|
||||
export const getTreasuryAddress = async (
|
||||
config: ICommonConfiguration
|
||||
): Promise<tEthereumAddress> => {
|
||||
export const getTreasuryAddress = async (config: IBaseConfiguration): Promise<tEthereumAddress> => {
|
||||
const currentNetwork = process.env.FORK ? process.env.FORK : DRE.network.name;
|
||||
return getParamPerNetwork(config.ReserveFactorTreasuryAddress, <eNetwork>currentNetwork);
|
||||
};
|
||||
|
||||
export const getATokenDomainSeparatorPerNetwork = (
|
||||
network: eNetwork,
|
||||
config: ICommonConfiguration
|
||||
config: IBaseConfiguration
|
||||
): tEthereumAddress => getParamPerNetwork<tEthereumAddress>(config.ATokenDomainSeparator, network);
|
||||
|
||||
export const getWethAddress = async (config: ICommonConfiguration) => {
|
||||
export const getWethAddress = async (config: IBaseConfiguration) => {
|
||||
const currentNetwork = process.env.FORK ? process.env.FORK : DRE.network.name;
|
||||
const wethAddress = getParamPerNetwork(config.WETH, <eNetwork>currentNetwork);
|
||||
if (wethAddress) {
|
||||
|
@ -115,7 +123,7 @@ export const getWethAddress = async (config: ICommonConfiguration) => {
|
|||
return weth.address;
|
||||
};
|
||||
|
||||
export const getWrappedNativeTokenAddress = async (config: ICommonConfiguration) => {
|
||||
export const getWrappedNativeTokenAddress = async (config: IBaseConfiguration) => {
|
||||
const currentNetwork = process.env.MAINNET_FORK === 'true' ? 'main' : DRE.network.name;
|
||||
const wethAddress = getParamPerNetwork(config.WrappedNativeToken, <eNetwork>currentNetwork);
|
||||
if (wethAddress) {
|
||||
|
@ -128,7 +136,7 @@ export const getWrappedNativeTokenAddress = async (config: ICommonConfiguration)
|
|||
return weth.address;
|
||||
};
|
||||
|
||||
export const getLendingRateOracles = (poolConfig: ICommonConfiguration) => {
|
||||
export const getLendingRateOracles = (poolConfig: IBaseConfiguration) => {
|
||||
const {
|
||||
ProtocolGlobalParams: { UsdAddress },
|
||||
LendingRateOracleRatesCommon,
|
||||
|
@ -140,3 +148,15 @@ export const getLendingRateOracles = (poolConfig: ICommonConfiguration) => {
|
|||
Object.keys(ReserveAssets[network]).includes(key)
|
||||
);
|
||||
};
|
||||
|
||||
export const getQuoteCurrency = async (config: IBaseConfiguration) => {
|
||||
switch (config.OracleQuoteCurrency) {
|
||||
case 'ETH':
|
||||
case 'WETH':
|
||||
return getWethAddress(config);
|
||||
case 'USD':
|
||||
return config.ProtocolGlobalParams.UsdAddress;
|
||||
default:
|
||||
throw `Quote ${config.OracleQuoteCurrency} currency not set. Add a new case to getQuoteCurrency switch`;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import BigNumber from 'bignumber.js';
|
||||
import { eEthereumNetwork } from './types';
|
||||
|
||||
// ----------------
|
||||
// MATH
|
||||
|
@ -12,6 +13,7 @@ export const RAY = new BigNumber(10).exponentiatedBy(27).toFixed();
|
|||
export const HALF_RAY = new BigNumber(RAY).multipliedBy(0.5).toFixed();
|
||||
export const WAD_RAY_RATIO = Math.pow(10, 9).toString();
|
||||
export const oneEther = new BigNumber(Math.pow(10, 18));
|
||||
export const oneUsd = new BigNumber(Math.pow(10, 8));
|
||||
export const oneRay = new BigNumber(Math.pow(10, 27));
|
||||
export const MAX_UINT_AMOUNT =
|
||||
'115792089237316195423570985008687907853269984665640564039457584007913129639935';
|
||||
|
@ -30,6 +32,7 @@ export const USD_ADDRESS = '0x10F7Fc1F91Ba351f9C629c5947AD69bD03C05b96';
|
|||
export const AAVE_REFERRAL = '0';
|
||||
|
||||
export const MOCK_CHAINLINK_AGGREGATORS_PRICES = {
|
||||
// Update to USD-based price feeds
|
||||
AAVE: oneEther.multipliedBy('0.003620948469').toFixed(),
|
||||
BAT: oneEther.multipliedBy('0.00137893825230').toFixed(),
|
||||
BUSD: oneEther.multipliedBy('0.00736484').toFixed(),
|
||||
|
@ -69,5 +72,6 @@ export const MOCK_CHAINLINK_AGGREGATORS_PRICES = {
|
|||
WMATIC: oneEther.multipliedBy('0.003620948469').toFixed(),
|
||||
STAKE: oneEther.multipliedBy('0.003620948469').toFixed(),
|
||||
xSUSHI: oneEther.multipliedBy('0.00913428586').toFixed(),
|
||||
WAVAX: oneEther.multipliedBy('0.006051936629').toFixed(),
|
||||
USD: '5848466240000000',
|
||||
};
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { Contract } from 'ethers';
|
||||
import { DRE } from './misc-utils';
|
||||
import { DRE, notFalsyOrZeroAddress } from './misc-utils';
|
||||
import {
|
||||
tEthereumAddress,
|
||||
eContractid,
|
||||
|
@ -13,9 +13,8 @@ import {
|
|||
} from './types';
|
||||
import { MintableERC20 } from '../types/MintableERC20';
|
||||
import { MockContract } from 'ethereum-waffle';
|
||||
import { getReservesConfigByPool } from './configuration';
|
||||
import { ConfigNames, getReservesConfigByPool, loadPoolConfig } from './configuration';
|
||||
import { getFirstSigner } from './contracts-getters';
|
||||
import { ZERO_ADDRESS } from './constants';
|
||||
import {
|
||||
AaveProtocolDataProviderFactory,
|
||||
ATokenFactory,
|
||||
|
@ -35,9 +34,12 @@ import {
|
|||
MockAggregatorFactory,
|
||||
MockATokenFactory,
|
||||
MockFlashLoanReceiverFactory,
|
||||
MockParaSwapAugustusFactory,
|
||||
MockParaSwapAugustusRegistryFactory,
|
||||
MockStableDebtTokenFactory,
|
||||
MockVariableDebtTokenFactory,
|
||||
MockUniswapV2Router02Factory,
|
||||
ParaSwapLiquiditySwapAdapterFactory,
|
||||
PriceOracleFactory,
|
||||
ReserveLogicFactory,
|
||||
SelfdestructTransferFactory,
|
||||
|
@ -61,6 +63,7 @@ import {
|
|||
insertContractAddressInDb,
|
||||
deployContract,
|
||||
verifyContract,
|
||||
getOptionalParamAddressPerNetwork,
|
||||
} from './contracts-helpers';
|
||||
import { StableAndVariableTokensHelperFactory } from '../types/StableAndVariableTokensHelperFactory';
|
||||
import { MintableDelegationERC20 } from '../types/MintableDelegationERC20';
|
||||
|
@ -68,6 +71,7 @@ import { readArtifact as buidlerReadArtifact } from '@nomiclabs/buidler/plugins'
|
|||
import { HardhatRuntimeEnvironment } from 'hardhat/types';
|
||||
import { LendingPoolLibraryAddresses } from '../types/LendingPoolFactory';
|
||||
import { UiPoolDataProvider } from '../types';
|
||||
import { eNetwork } from './types';
|
||||
|
||||
export const deployUiPoolDataProvider = async (
|
||||
[incentivesController, aaveOracle]: [tEthereumAddress, tEthereumAddress],
|
||||
|
@ -238,7 +242,7 @@ export const deployMockAggregator = async (price: tStringTokenSmallUnits, verify
|
|||
);
|
||||
|
||||
export const deployAaveOracle = async (
|
||||
args: [tEthereumAddress[], tEthereumAddress[], tEthereumAddress, tEthereumAddress],
|
||||
args: [tEthereumAddress[], tEthereumAddress[], tEthereumAddress, tEthereumAddress, string],
|
||||
verify?: boolean
|
||||
) =>
|
||||
withSaveAndVerify(
|
||||
|
@ -384,16 +388,16 @@ export const deployStableDebtTokenByType = async (type: string) => {
|
|||
}
|
||||
}
|
||||
|
||||
export const deployVariableDebtTokenByType = async (type: string) => {
|
||||
export const deployVariableDebtTokenByType = async (type: string, verify?: boolean) => {
|
||||
|
||||
//if no instance type is provided, deploying the generic one by default
|
||||
if(!type) {
|
||||
return deployGenericVariableDebtToken();;
|
||||
return deployGenericVariableDebtToken(verify);
|
||||
}
|
||||
|
||||
switch(type) {
|
||||
case eContractid.VariableDebtToken:
|
||||
return deployGenericVariableDebtToken();
|
||||
return deployGenericVariableDebtToken(verify);
|
||||
case eContractid.PermissionedVariableDebtToken:
|
||||
return deployPermissionedVariableDebtToken();
|
||||
default:
|
||||
|
@ -419,20 +423,20 @@ export const deployPermissionedVariableDebtToken = async () =>
|
|||
false
|
||||
);
|
||||
|
||||
export const deployGenericStableDebtToken = async () =>
|
||||
export const deployGenericStableDebtToken = async (verify?: boolean) =>
|
||||
withSaveAndVerify(
|
||||
await new StableDebtTokenFactory(await getFirstSigner()).deploy(),
|
||||
eContractid.StableDebtToken,
|
||||
[],
|
||||
false
|
||||
verify
|
||||
);
|
||||
|
||||
export const deployGenericVariableDebtToken = async () =>
|
||||
export const deployGenericVariableDebtToken = async (verify?: boolean) =>
|
||||
withSaveAndVerify(
|
||||
await new VariableDebtTokenFactory(await getFirstSigner()).deploy(),
|
||||
eContractid.VariableDebtToken,
|
||||
[],
|
||||
false
|
||||
verify
|
||||
);
|
||||
|
||||
export const deployGenericAToken = async (
|
||||
|
@ -714,3 +718,102 @@ export const deployFlashLiquidationAdapter = async (
|
|||
args,
|
||||
verify
|
||||
);
|
||||
|
||||
export const chooseATokenDeployment = (id: eContractid) => {
|
||||
switch (id) {
|
||||
case eContractid.AToken:
|
||||
return deployGenericATokenImpl;
|
||||
case eContractid.DelegationAwareAToken:
|
||||
return deployDelegationAwareATokenImpl;
|
||||
default:
|
||||
throw Error(`Missing aToken implementation deployment script for: ${id}`);
|
||||
}
|
||||
};
|
||||
|
||||
export const deployATokenImplementations = async (
|
||||
pool: ConfigNames,
|
||||
reservesConfig: { [key: string]: IReserveParams },
|
||||
verify = false
|
||||
) => {
|
||||
const poolConfig = loadPoolConfig(pool);
|
||||
const network = <eNetwork>DRE.network.name;
|
||||
|
||||
// Obtain the different AToken implementations of all reserves inside the Market config
|
||||
const aTokenImplementations = [
|
||||
...Object.entries(reservesConfig).reduce<Set<eContractid>>((acc, [, entry]) => {
|
||||
acc.add(entry.aTokenImpl);
|
||||
return acc;
|
||||
}, new Set<eContractid>()),
|
||||
];
|
||||
|
||||
for (let x = 0; x < aTokenImplementations.length; x++) {
|
||||
const aTokenAddress = getOptionalParamAddressPerNetwork(
|
||||
poolConfig[aTokenImplementations[x].toString()],
|
||||
network
|
||||
);
|
||||
if (!notFalsyOrZeroAddress(aTokenAddress)) {
|
||||
const deployImplementationMethod = chooseATokenDeployment(aTokenImplementations[x]);
|
||||
console.log(`Deploying implementation`, aTokenImplementations[x]);
|
||||
await deployImplementationMethod(verify);
|
||||
}
|
||||
}
|
||||
|
||||
// Debt tokens, for now all Market configs follows same implementations
|
||||
const genericStableDebtTokenAddress = getOptionalParamAddressPerNetwork(
|
||||
poolConfig.StableDebtTokenImplementation,
|
||||
network
|
||||
);
|
||||
const geneticVariableDebtTokenAddress = getOptionalParamAddressPerNetwork(
|
||||
poolConfig.VariableDebtTokenImplementation,
|
||||
network
|
||||
);
|
||||
|
||||
if (!notFalsyOrZeroAddress(genericStableDebtTokenAddress)) {
|
||||
await deployGenericStableDebtToken(verify);
|
||||
}
|
||||
if (!notFalsyOrZeroAddress(geneticVariableDebtTokenAddress)) {
|
||||
await deployGenericVariableDebtToken(verify);
|
||||
}
|
||||
};
|
||||
|
||||
export const deployRateStrategy = async (
|
||||
strategyName: string,
|
||||
args: [tEthereumAddress, string, string, string, string, string, string],
|
||||
verify: boolean
|
||||
): Promise<tEthereumAddress> => {
|
||||
switch (strategyName) {
|
||||
default:
|
||||
return await (
|
||||
await deployDefaultReserveInterestRateStrategy(args, verify)
|
||||
).address;
|
||||
}
|
||||
};
|
||||
export const deployMockParaSwapAugustus = async (verify?: boolean) =>
|
||||
withSaveAndVerify(
|
||||
await new MockParaSwapAugustusFactory(await getFirstSigner()).deploy(),
|
||||
eContractid.MockParaSwapAugustus,
|
||||
[],
|
||||
verify
|
||||
);
|
||||
|
||||
export const deployMockParaSwapAugustusRegistry = async (
|
||||
args: [tEthereumAddress],
|
||||
verify?: boolean
|
||||
) =>
|
||||
withSaveAndVerify(
|
||||
await new MockParaSwapAugustusRegistryFactory(await getFirstSigner()).deploy(...args),
|
||||
eContractid.MockParaSwapAugustusRegistry,
|
||||
args,
|
||||
verify
|
||||
);
|
||||
|
||||
export const deployParaSwapLiquiditySwapAdapter = async (
|
||||
args: [tEthereumAddress, tEthereumAddress],
|
||||
verify?: boolean
|
||||
) =>
|
||||
withSaveAndVerify(
|
||||
await new ParaSwapLiquiditySwapAdapterFactory(await getFirstSigner()).deploy(...args),
|
||||
eContractid.ParaSwapLiquiditySwapAdapter,
|
||||
args,
|
||||
verify
|
||||
);
|
||||
|
|
|
@ -18,6 +18,9 @@ import {
|
|||
MockStableDebtTokenFactory,
|
||||
MockVariableDebtTokenFactory,
|
||||
MockUniswapV2Router02Factory,
|
||||
MockParaSwapAugustusFactory,
|
||||
MockParaSwapAugustusRegistryFactory,
|
||||
ParaSwapLiquiditySwapAdapterFactory,
|
||||
PriceOracleFactory,
|
||||
ReserveLogicFactory,
|
||||
SelfdestructTransferFactory,
|
||||
|
@ -35,7 +38,7 @@ import {
|
|||
} from '../types';
|
||||
import { IERC20DetailedFactory } from '../types/IERC20DetailedFactory';
|
||||
import { getEthersSigners, MockTokenMap } from './contracts-helpers';
|
||||
import { DRE, getDb, notFalsyOrZeroAddress } from './misc-utils';
|
||||
import { DRE, getDb, notFalsyOrZeroAddress, omit } from './misc-utils';
|
||||
import { eContractid, PoolConfiguration, tEthereumAddress, TokenContractId } from './types';
|
||||
|
||||
export const getFirstSigner = async () => (await getEthersSigners())[0];
|
||||
|
@ -186,15 +189,30 @@ export const getAllMockedTokens = async () => {
|
|||
return tokens;
|
||||
};
|
||||
|
||||
export const getQuoteCurrencies = (oracleQuoteCurrency: string): string[] => {
|
||||
switch (oracleQuoteCurrency) {
|
||||
case 'USD':
|
||||
return ['USD'];
|
||||
case 'ETH':
|
||||
case 'WETH':
|
||||
default:
|
||||
return ['ETH', 'WETH'];
|
||||
}
|
||||
};
|
||||
|
||||
export const getPairsTokenAggregator = (
|
||||
allAssetsAddresses: {
|
||||
[tokenSymbol: string]: tEthereumAddress;
|
||||
},
|
||||
aggregatorsAddresses: { [tokenSymbol: string]: tEthereumAddress }
|
||||
aggregatorsAddresses: { [tokenSymbol: string]: tEthereumAddress },
|
||||
oracleQuoteCurrency: string
|
||||
): [string[], string[]] => {
|
||||
const { ETH, WETH, ...assetsAddressesWithoutEth } = allAssetsAddresses;
|
||||
const assetsWithoutQuoteCurrency = omit(
|
||||
allAssetsAddresses,
|
||||
getQuoteCurrencies(oracleQuoteCurrency)
|
||||
);
|
||||
|
||||
const pairs = Object.entries(assetsAddressesWithoutEth).map(([tokenSymbol, tokenAddress]) => {
|
||||
const pairs = Object.entries(assetsWithoutQuoteCurrency).map(([tokenSymbol, tokenAddress]) => {
|
||||
//if (true/*tokenSymbol !== 'WETH' && tokenSymbol !== 'ETH' && tokenSymbol !== 'LpWETH'*/) {
|
||||
const aggregatorAddressIndex = Object.keys(aggregatorsAddresses).findIndex(
|
||||
(value) => value === tokenSymbol
|
||||
|
@ -422,3 +440,30 @@ export const getPermissionManager = async (address?: tEthereumAddress) =>
|
|||
).address,
|
||||
await getFirstSigner()
|
||||
);
|
||||
|
||||
export const getMockParaSwapAugustus = async (address?: tEthereumAddress) =>
|
||||
await MockParaSwapAugustusFactory.connect(
|
||||
address ||
|
||||
(
|
||||
await getDb().get(`${eContractid.MockParaSwapAugustus}.${DRE.network.name}`).value()
|
||||
).address,
|
||||
await getFirstSigner()
|
||||
);
|
||||
|
||||
export const getMockParaSwapAugustusRegistry = async (address?: tEthereumAddress) =>
|
||||
await MockParaSwapAugustusRegistryFactory.connect(
|
||||
address ||
|
||||
(
|
||||
await getDb().get(`${eContractid.MockParaSwapAugustusRegistry}.${DRE.network.name}`).value()
|
||||
).address,
|
||||
await getFirstSigner()
|
||||
);
|
||||
|
||||
export const getParaSwapLiquiditySwapAdapter = async (address?: tEthereumAddress) =>
|
||||
await ParaSwapLiquiditySwapAdapterFactory.connect(
|
||||
address ||
|
||||
(
|
||||
await getDb().get(`${eContractid.ParaSwapLiquiditySwapAdapter}.${DRE.network.name}`).value()
|
||||
).address,
|
||||
await getFirstSigner()
|
||||
);
|
||||
|
|
|
@ -2,7 +2,7 @@ import { Contract, Signer, utils, ethers, BigNumberish } from 'ethers';
|
|||
import { signTypedData_v4 } from 'eth-sig-util';
|
||||
import { fromRpcSig, ECDSASignature } from 'ethereumjs-util';
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { getDb, DRE, waitForTx } from './misc-utils';
|
||||
import { getDb, DRE, waitForTx, notFalsyOrZeroAddress } from './misc-utils';
|
||||
import {
|
||||
tEthereumAddress,
|
||||
eContractid,
|
||||
|
@ -14,10 +14,11 @@ import {
|
|||
ePolygonNetwork,
|
||||
eXDaiNetwork,
|
||||
eNetwork,
|
||||
iParamsPerNetworkAll,
|
||||
iEthereumParamsPerNetwork,
|
||||
iPolygonParamsPerNetwork,
|
||||
iXDaiParamsPerNetwork,
|
||||
iAvalancheParamsPerNetwork,
|
||||
eAvalancheNetwork,
|
||||
} from './types';
|
||||
import { MintableERC20 } from '../types/MintableERC20';
|
||||
import { Artifact } from 'hardhat/types';
|
||||
|
@ -26,6 +27,8 @@ import { verifyEtherscanContract } from './etherscan-verification';
|
|||
import { getFirstSigner, getIErc20Detailed } from './contracts-getters';
|
||||
import { usingTenderly, verifyAtTenderly } from './tenderly-utils';
|
||||
import { usingPolygon, verifyAtPolygon } from './polygon-utils';
|
||||
import { ConfigNames, loadPoolConfig } from './configuration';
|
||||
import { ZERO_ADDRESS } from './constants';
|
||||
import { getDefenderRelaySigner, usingDefender } from './defender-utils';
|
||||
|
||||
export type MockTokenMap = { [symbol: string]: MintableERC20 };
|
||||
|
@ -142,16 +145,11 @@ export const linkBytecode = (artifact: BuidlerArtifact | Artifact, libraries: an
|
|||
};
|
||||
|
||||
export const getParamPerNetwork = <T>(param: iParamsPerNetwork<T>, network: eNetwork) => {
|
||||
const {
|
||||
main,
|
||||
ropsten,
|
||||
kovan,
|
||||
coverage,
|
||||
buidlerevm,
|
||||
tenderlyMain,
|
||||
} = param as iEthereumParamsPerNetwork<T>;
|
||||
const { main, ropsten, kovan, coverage, buidlerevm, tenderly } =
|
||||
param as iEthereumParamsPerNetwork<T>;
|
||||
const { matic, mumbai } = param as iPolygonParamsPerNetwork<T>;
|
||||
const { xdai } = param as iXDaiParamsPerNetwork<T>;
|
||||
const { avalanche, fuji } = param as iAvalancheParamsPerNetwork<T>;
|
||||
if (process.env.FORK) {
|
||||
return param[process.env.FORK as eNetwork] as T;
|
||||
}
|
||||
|
@ -169,18 +167,32 @@ export const getParamPerNetwork = <T>(param: iParamsPerNetwork<T>, network: eNet
|
|||
return ropsten;
|
||||
case eEthereumNetwork.main:
|
||||
return main;
|
||||
case eEthereumNetwork.tenderlyMain:
|
||||
return tenderlyMain;
|
||||
case eEthereumNetwork.tenderly:
|
||||
return tenderly;
|
||||
case ePolygonNetwork.matic:
|
||||
return matic;
|
||||
case ePolygonNetwork.mumbai:
|
||||
return mumbai;
|
||||
case eXDaiNetwork.xdai:
|
||||
return xdai;
|
||||
case eAvalancheNetwork.avalanche:
|
||||
return avalanche;
|
||||
case eAvalancheNetwork.fuji:
|
||||
return fuji;
|
||||
}
|
||||
};
|
||||
|
||||
export const getParamPerPool = <T>({ proto, amm, matic, arc }: iParamsPerPool<T>, pool: AavePools) => {
|
||||
export const getOptionalParamAddressPerNetwork = (
|
||||
param: iParamsPerNetwork<tEthereumAddress> | undefined | null,
|
||||
network: eNetwork
|
||||
) => {
|
||||
if (!param) {
|
||||
return ZERO_ADDRESS;
|
||||
}
|
||||
return getParamPerNetwork(param, network);
|
||||
};
|
||||
|
||||
export const getParamPerPool = <T>({ proto, amm, matic, arc, avalanche }: iParamsPerPool<T>, pool: AavePools) => {
|
||||
switch (pool) {
|
||||
case AavePools.proto:
|
||||
return proto;
|
||||
|
@ -190,6 +202,8 @@ export const getParamPerPool = <T>({ proto, amm, matic, arc }: iParamsPerPool<T>
|
|||
return matic;
|
||||
case AavePools.arc:
|
||||
return arc;
|
||||
case AavePools.avalanche:
|
||||
return avalanche;
|
||||
default:
|
||||
return proto;
|
||||
}
|
||||
|
@ -329,6 +343,38 @@ export const buildFlashLiquidationAdapterParams = (
|
|||
);
|
||||
};
|
||||
|
||||
export const buildParaSwapLiquiditySwapParams = (
|
||||
assetToSwapTo: tEthereumAddress,
|
||||
minAmountToReceive: BigNumberish,
|
||||
swapAllBalanceOffset: BigNumberish,
|
||||
swapCalldata: string | Buffer,
|
||||
augustus: tEthereumAddress,
|
||||
permitAmount: BigNumberish,
|
||||
deadline: BigNumberish,
|
||||
v: BigNumberish,
|
||||
r: string | Buffer,
|
||||
s: string | Buffer
|
||||
) => {
|
||||
return ethers.utils.defaultAbiCoder.encode(
|
||||
[
|
||||
'address',
|
||||
'uint256',
|
||||
'uint256',
|
||||
'bytes',
|
||||
'address',
|
||||
'tuple(uint256,uint256,uint8,bytes32,bytes32)',
|
||||
],
|
||||
[
|
||||
assetToSwapTo,
|
||||
minAmountToReceive,
|
||||
swapAllBalanceOffset,
|
||||
swapCalldata,
|
||||
augustus,
|
||||
[permitAmount, deadline, v, r, s],
|
||||
]
|
||||
);
|
||||
};
|
||||
|
||||
export const verifyContract = async (
|
||||
id: string,
|
||||
instance: Contract,
|
||||
|
@ -344,3 +390,23 @@ export const verifyContract = async (
|
|||
}
|
||||
return instance;
|
||||
};
|
||||
|
||||
export const getContractAddressWithJsonFallback = async (
|
||||
id: string,
|
||||
pool: ConfigNames
|
||||
): Promise<tEthereumAddress> => {
|
||||
const poolConfig = loadPoolConfig(pool);
|
||||
const network = <eNetwork>DRE.network.name;
|
||||
const db = getDb();
|
||||
|
||||
const contractAtMarketConfig = getOptionalParamAddressPerNetwork(poolConfig[id], network);
|
||||
if (notFalsyOrZeroAddress(contractAtMarketConfig)) {
|
||||
return contractAtMarketConfig;
|
||||
}
|
||||
|
||||
const contractAtDb = await getDb().get(`${id}.${DRE.network.name}`).value();
|
||||
if (contractAtDb?.address) {
|
||||
return contractAtDb.address as tEthereumAddress;
|
||||
}
|
||||
throw Error(`Missing contract address ${id} at Market config and JSON local db`);
|
||||
};
|
||||
|
|
|
@ -18,7 +18,7 @@ export const getDefenderRelaySigner = async () => {
|
|||
const credentials = { apiKey: DEFENDER_API_KEY, apiSecret: DEFENDER_SECRET_KEY };
|
||||
|
||||
defenderSigner = new DefenderRelaySigner(credentials, new DefenderRelayProvider(credentials), {
|
||||
speed: 'fastest',
|
||||
gasPrice: 120000000000
|
||||
});
|
||||
|
||||
const defenderAddress = await defenderSigner.getAddress();
|
||||
|
|
|
@ -1,24 +1,18 @@
|
|||
import {
|
||||
eContractid,
|
||||
eEthereumNetwork,
|
||||
eNetwork,
|
||||
iMultiPoolsAssets,
|
||||
IReserveParams,
|
||||
tEthereumAddress,
|
||||
} from './types';
|
||||
import { AaveProtocolDataProvider } from '../types/AaveProtocolDataProvider';
|
||||
import { chunk, DRE, getDb, waitForTx } from './misc-utils';
|
||||
import { chunk, getDb, waitForTx } from './misc-utils';
|
||||
import {
|
||||
getAaveProtocolDataProvider,
|
||||
getAToken,
|
||||
getATokensAndRatesHelper,
|
||||
getFirstSigner,
|
||||
getLendingPoolAddressesProvider,
|
||||
getLendingPoolConfiguratorProxy,
|
||||
getStableAndVariableTokensHelper,
|
||||
} from './contracts-getters';
|
||||
import { rawInsertContractAddressInDb } from './contracts-helpers';
|
||||
import { BigNumber, BigNumberish, Signer } from 'ethers';
|
||||
import {
|
||||
deployDefaultReserveInterestRateStrategy,
|
||||
deployDelegationAwareAToken,
|
||||
|
@ -30,21 +24,28 @@ import {
|
|||
deployVariableDebtToken,
|
||||
deployVariableDebtTokenByType,
|
||||
} from './contracts-deployments';
|
||||
import { BigNumber, BigNumberish } from 'ethers';
|
||||
import { ConfigNames } from './configuration';
|
||||
import { deployRateStrategy } from './contracts-deployments';
|
||||
|
||||
|
||||
import { ZERO_ADDRESS } from './constants';
|
||||
import { isZeroAddress } from 'ethereumjs-util';
|
||||
import { DefaultReserveInterestRateStrategy, DelegationAwareAToken } from '../types';
|
||||
import { config } from 'process';
|
||||
|
||||
import {getContractAddressWithJsonFallback,
|
||||
rawInsertContractAddressInDb,
|
||||
} from './contracts-helpers';
|
||||
|
||||
export const chooseATokenDeployment = (id: eContractid) => {
|
||||
switch (id) {
|
||||
case eContractid.AToken:
|
||||
return deployGenericAToken;
|
||||
case eContractid.DelegationAwareAToken:
|
||||
return deployDelegationAwareAToken;
|
||||
default:
|
||||
throw Error(`Missing aToken deployment script for: ${id}`);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export const initReservesByHelper = async (
|
||||
reservesParams: iMultiPoolsAssets<IReserveParams>,
|
||||
|
@ -56,18 +57,17 @@ export const initReservesByHelper = async (
|
|||
admin: tEthereumAddress,
|
||||
treasuryAddress: tEthereumAddress,
|
||||
incentivesController: tEthereumAddress,
|
||||
poolName: ConfigNames,
|
||||
verify: boolean
|
||||
): Promise<BigNumber> => {
|
||||
) => {
|
||||
let gasUsage = BigNumber.from('0');
|
||||
|
||||
const addressProvider = await getLendingPoolAddressesProvider();
|
||||
|
||||
// CHUNK CONFIGURATION
|
||||
const initChunks = 4;
|
||||
const initChunks = 1;
|
||||
|
||||
// Initialize variables for future reserves initialization
|
||||
let reserveTokens: string[] = [];
|
||||
let reserveInitDecimals: string[] = [];
|
||||
let reserveSymbols: string[] = [];
|
||||
|
||||
let initInputParams: {
|
||||
|
@ -128,36 +128,18 @@ export const initReservesByHelper = async (
|
|||
variableDebtTokensAddresses.set(name, implAddress);
|
||||
}));
|
||||
|
||||
console.log("Debt tokens deployed, ", stableDebtTokensAddresses, variableDebtTokensAddresses);
|
||||
|
||||
const aTokenImplementation = await deployGenericATokenImpl(verify);
|
||||
aTokenImplementationAddress = aTokenImplementation.address;
|
||||
rawInsertContractAddressInDb(`aTokenImpl`, aTokenImplementationAddress);
|
||||
|
||||
const delegatedAwareReserves = Object.entries(reservesParams).filter(
|
||||
([_, { aTokenImpl }]) => aTokenImpl === eContractid.DelegationAwareAToken
|
||||
) as [string, IReserveParams][];
|
||||
|
||||
if (delegatedAwareReserves.length > 0) {
|
||||
const delegationAwareATokenImplementation = await deployDelegationAwareATokenImpl(verify);
|
||||
delegationAwareATokenImplementationAddress = delegationAwareATokenImplementation.address;
|
||||
rawInsertContractAddressInDb(
|
||||
`delegationAwareATokenImpl`,
|
||||
delegationAwareATokenImplementationAddress
|
||||
);
|
||||
}
|
||||
|
||||
const reserves = Object.entries(reservesParams).filter(
|
||||
([_, { aTokenImpl }]) =>
|
||||
aTokenImpl === eContractid.DelegationAwareAToken || aTokenImpl === eContractid.AToken
|
||||
) as [string, IReserveParams][];
|
||||
const reserves = Object.entries(reservesParams);
|
||||
|
||||
for (let [symbol, params] of reserves) {
|
||||
if (!tokenAddresses[symbol]) {
|
||||
console.log(`- Skipping init of ${symbol} due token address is not set at markets config`);
|
||||
continue;
|
||||
}
|
||||
const { strategy, aTokenImpl, reserveDecimals } = params;
|
||||
const { strategy } = params;
|
||||
const {
|
||||
optimalUtilizationRate,
|
||||
baseVariableBorrowRate,
|
||||
|
@ -177,30 +159,24 @@ export const initReservesByHelper = async (
|
|||
stableRateSlope1,
|
||||
stableRateSlope2,
|
||||
];
|
||||
strategyAddresses[strategy.name] = (
|
||||
await deployDefaultReserveInterestRateStrategy(rateStrategies[strategy.name], verify)
|
||||
).address;
|
||||
strategyAddresses[strategy.name] = await deployRateStrategy(
|
||||
strategy.name,
|
||||
rateStrategies[strategy.name],
|
||||
verify
|
||||
);
|
||||
|
||||
// This causes the last strategy to be printed twice, once under "DefaultReserveInterestRateStrategy"
|
||||
// and once under the actual `strategyASSET` key.
|
||||
rawInsertContractAddressInDb(strategy.name, strategyAddresses[strategy.name]);
|
||||
}
|
||||
strategyAddressPerAsset[symbol] = strategyAddresses[strategy.name];
|
||||
console.log('Strategy address for asset %s: %s', symbol, strategyAddressPerAsset[symbol]);
|
||||
|
||||
if (aTokenImpl === eContractid.AToken) {
|
||||
aTokenType[symbol] = 'generic';
|
||||
} else if (aTokenImpl === eContractid.DelegationAwareAToken) {
|
||||
aTokenType[symbol] = 'delegation aware';
|
||||
}
|
||||
|
||||
reserveInitDecimals.push(reserveDecimals);
|
||||
reserveTokens.push(tokenAddresses[symbol]);
|
||||
// Prepare input parameters
|
||||
reserveSymbols.push(symbol);
|
||||
}
|
||||
|
||||
for (let i = 0; i < reserveSymbols.length; i++) {
|
||||
|
||||
const symbol = reserveSymbols[i];
|
||||
const strategy = reservesParams[symbol].strategy;
|
||||
|
||||
const stableDebtImpl = reservesParams[symbol].stableDebtTokenImpl ?? eContractid.StableDebtToken;
|
||||
const variableDebtTokenImpl = reservesParams[symbol].variableDebtTokenImpl ?? eContractid.VariableDebtToken;
|
||||
|
@ -220,21 +196,21 @@ export const initReservesByHelper = async (
|
|||
}
|
||||
|
||||
initInputParams.push({
|
||||
aTokenImpl: aTokenToUse,
|
||||
aTokenImpl: await getContractAddressWithJsonFallback(reservesParams[symbol].aTokenImpl, poolName),
|
||||
stableDebtTokenImpl:stableDebtAddress,
|
||||
variableDebtTokenImpl: variableDebtAddress,
|
||||
underlyingAssetDecimals: reserveInitDecimals[i],
|
||||
interestRateStrategyAddress: strategyAddressPerAsset[symbol],
|
||||
underlyingAsset: reserveTokens[i],
|
||||
underlyingAssetDecimals: reservesParams[symbol].reserveDecimals,
|
||||
interestRateStrategyAddress: strategyAddresses[strategy.name],
|
||||
underlyingAsset: tokenAddresses[symbol],
|
||||
treasury: treasuryAddress,
|
||||
incentivesController,
|
||||
underlyingAssetName: reserveSymbols[i],
|
||||
aTokenName: `${aTokenNamePrefix} ${reserveSymbols[i]}`,
|
||||
aTokenSymbol: `a${symbolPrefix}${reserveSymbols[i]}`,
|
||||
variableDebtTokenName: `${variableDebtTokenNamePrefix} ${symbolPrefix}${reserveSymbols[i]}`,
|
||||
variableDebtTokenSymbol: `variableDebt${symbolPrefix}${reserveSymbols[i]}`,
|
||||
stableDebtTokenName: `${stableDebtTokenNamePrefix} ${reserveSymbols[i]}`,
|
||||
stableDebtTokenSymbol: `stableDebt${symbolPrefix}${reserveSymbols[i]}`,
|
||||
incentivesController: incentivesController,
|
||||
underlyingAssetName: symbol,
|
||||
aTokenName: `${aTokenNamePrefix} ${symbol}`,
|
||||
aTokenSymbol: `a${symbolPrefix}${symbol}`,
|
||||
variableDebtTokenName: `${variableDebtTokenNamePrefix} ${symbolPrefix}${symbol}`,
|
||||
variableDebtTokenSymbol: `variableDebt${symbolPrefix}${symbol}`,
|
||||
stableDebtTokenName: `${stableDebtTokenNamePrefix} ${symbol}`,
|
||||
stableDebtTokenSymbol: `stableDebt${symbolPrefix}${symbol}`,
|
||||
params: '0x10',
|
||||
});
|
||||
}
|
||||
|
@ -244,7 +220,6 @@ export const initReservesByHelper = async (
|
|||
const chunkedInitInputParams = chunk(initInputParams, initChunks);
|
||||
|
||||
const configurator = await getLendingPoolConfiguratorProxy();
|
||||
//await waitForTx(await addressProvider.setPoolAdmin(admin));
|
||||
|
||||
console.log(`- Reserves initialization in ${chunkedInitInputParams.length} txs`);
|
||||
for (let chunkIndex = 0; chunkIndex < chunkedInitInputParams.length; chunkIndex++) {
|
||||
|
@ -254,10 +229,7 @@ export const initReservesByHelper = async (
|
|||
|
||||
console.log(` - Reserve ready for: ${chunkedSymbols[chunkIndex].join(', ')}`);
|
||||
console.log(' * gasUsed', tx3.gasUsed.toString());
|
||||
//gasUsage = gasUsage.add(tx3.gasUsed);
|
||||
}
|
||||
|
||||
return gasUsage; // Deprecated
|
||||
};
|
||||
|
||||
export const getPairsTokenAggregator = (
|
||||
|
@ -273,10 +245,9 @@ export const getPairsTokenAggregator = (
|
|||
const aggregatorAddressIndex = Object.keys(aggregatorsAddresses).findIndex(
|
||||
(value) => value === tokenSymbol
|
||||
);
|
||||
const [, aggregatorAddress] = (Object.entries(aggregatorsAddresses) as [
|
||||
string,
|
||||
tEthereumAddress
|
||||
][])[aggregatorAddressIndex];
|
||||
const [, aggregatorAddress] = (
|
||||
Object.entries(aggregatorsAddresses) as [string, tEthereumAddress][]
|
||||
)[aggregatorAddressIndex];
|
||||
return [tokenAddress, aggregatorAddress];
|
||||
}
|
||||
}) as [string, string][];
|
||||
|
@ -368,9 +339,7 @@ export const configureReservesByHelper = async (
|
|||
console.log(`- Configure reserves in ${chunkedInputParams.length} txs`);
|
||||
for (let chunkIndex = 0; chunkIndex < chunkedInputParams.length; chunkIndex++) {
|
||||
await waitForTx(
|
||||
await atokenAndRatesDeployer.configureReserves(chunkedInputParams[chunkIndex], {
|
||||
gasLimit: 12000000,
|
||||
})
|
||||
await atokenAndRatesDeployer.configureReserves(chunkedInputParams[chunkIndex])
|
||||
);
|
||||
console.log(` - Init for: ${chunkedSymbols[chunkIndex].join(', ')}`);
|
||||
}
|
||||
|
|
|
@ -9,6 +9,8 @@ import { BuidlerRuntimeEnvironment } from '@nomiclabs/buidler/types';
|
|||
import { tEthereumAddress } from './types';
|
||||
import { isAddress } from 'ethers/lib/utils';
|
||||
import { isZeroAddress } from 'ethereumjs-util';
|
||||
import { SignerWithAddress } from '../test-suites/test-aave/helpers/make-suite';
|
||||
import { usingTenderly } from './tenderly-utils';
|
||||
|
||||
export const toWad = (value: string | number) => new BigNumber(value).times(WAD).toFixed();
|
||||
|
||||
|
@ -116,6 +118,27 @@ export const notFalsyOrZeroAddress = (address: tEthereumAddress | null | undefin
|
|||
return isAddress(address) && !isZeroAddress(address);
|
||||
};
|
||||
|
||||
export const impersonateAddress = async (address: tEthereumAddress): Promise<SignerWithAddress> => {
|
||||
if (!usingTenderly()) {
|
||||
await (DRE as HardhatRuntimeEnvironment).network.provider.request({
|
||||
method: 'hardhat_impersonateAccount',
|
||||
params: [address],
|
||||
});
|
||||
}
|
||||
const signer = await DRE.ethers.provider.getSigner(address);
|
||||
|
||||
return {
|
||||
signer,
|
||||
address,
|
||||
};
|
||||
};
|
||||
|
||||
export const omit = <T, U extends keyof T>(obj: T, keys: U[]): Omit<T, U> =>
|
||||
(Object.keys(obj) as U[]).reduce(
|
||||
(acc, curr) => (keys.includes(curr) ? acc : { ...acc, [curr]: obj[curr] }),
|
||||
{} as Omit<T, U>
|
||||
);
|
||||
|
||||
export const impersonateAccountsHardhat = async (accounts: string[]) => {
|
||||
if (process.env.TENDERLY === 'true') {
|
||||
return;
|
||||
|
|
|
@ -4,7 +4,7 @@ export interface SymbolMap<T> {
|
|||
[symbol: string]: T;
|
||||
}
|
||||
|
||||
export type eNetwork = eEthereumNetwork | ePolygonNetwork | eXDaiNetwork;
|
||||
export type eNetwork = eEthereumNetwork | ePolygonNetwork | eXDaiNetwork | eAvalancheNetwork;
|
||||
|
||||
export enum eEthereumNetwork {
|
||||
buidlerevm = 'buidlerevm',
|
||||
|
@ -13,7 +13,7 @@ export enum eEthereumNetwork {
|
|||
main = 'main',
|
||||
coverage = 'coverage',
|
||||
hardhat = 'hardhat',
|
||||
tenderlyMain = 'tenderlyMain',
|
||||
tenderly = 'tenderly',
|
||||
}
|
||||
|
||||
export enum ePolygonNetwork {
|
||||
|
@ -25,6 +25,11 @@ export enum eXDaiNetwork {
|
|||
xdai = 'xdai',
|
||||
}
|
||||
|
||||
export enum eAvalancheNetwork {
|
||||
avalanche = 'avalanche',
|
||||
fuji = 'fuji',
|
||||
}
|
||||
|
||||
export enum EthereumNetworkNames {
|
||||
kovan = 'kovan',
|
||||
ropsten = 'ropsten',
|
||||
|
@ -32,13 +37,16 @@ export enum EthereumNetworkNames {
|
|||
matic = 'matic',
|
||||
mumbai = 'mumbai',
|
||||
xdai = 'xdai',
|
||||
avalanche = 'avalanche',
|
||||
fuji = 'fuji',
|
||||
}
|
||||
|
||||
export enum AavePools {
|
||||
proto = 'proto',
|
||||
matic = 'matic',
|
||||
amm = 'amm',
|
||||
arc = 'arc'
|
||||
arc = 'arc',
|
||||
avalanche = 'avalanche',
|
||||
}
|
||||
|
||||
export enum eContractid {
|
||||
|
@ -92,7 +100,10 @@ export enum eContractid {
|
|||
PermissionedStableDebtToken = 'PermissionedStableDebtToken',
|
||||
PermissionedVariableDebtToken = 'PermissionedVariableDebtToken',
|
||||
PermissionedLendingPool = 'PermissionedLendingPool',
|
||||
PermissionedWETHGateway = 'PermissionedWETHGateway'
|
||||
PermissionedWETHGateway = 'PermissionedWETHGateway',
|
||||
MockParaSwapAugustus = 'MockParaSwapAugustus',
|
||||
MockParaSwapAugustusRegistry = 'MockParaSwapAugustusRegistry',
|
||||
ParaSwapLiquiditySwapAdapter = 'ParaSwapLiquiditySwapAdapter',
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -245,6 +256,7 @@ export interface iAssetBase<T> {
|
|||
WMATIC: T;
|
||||
STAKE: T;
|
||||
xSUSHI: T;
|
||||
WAVAX: T;
|
||||
}
|
||||
|
||||
export type iAssetsWithoutETH<T> = Omit<iAssetBase<T>, 'ETH'>;
|
||||
|
@ -316,6 +328,11 @@ export type iXDAIPoolAssets<T> = Pick<
|
|||
'DAI' | 'USDC' | 'USDT' | 'WBTC' | 'WETH' | 'STAKE'
|
||||
>;
|
||||
|
||||
export type iAvalanchePoolAssets<T> = Pick<
|
||||
iAssetsWithoutUSD<T>,
|
||||
'WETH' | 'DAI' | 'USDT' | 'AAVE' | 'WBTC' | 'WAVAX' | 'USDC'
|
||||
>;
|
||||
|
||||
export type iMultiPoolsAssets<T> = iAssetCommon<T> | iAavePoolAssets<T>;
|
||||
|
||||
export type iAavePoolTokens<T> = Omit<iAavePoolAssets<T>, 'ETH'>;
|
||||
|
@ -363,6 +380,7 @@ export enum TokenContractId {
|
|||
WMATIC = 'WMATIC',
|
||||
STAKE = 'STAKE',
|
||||
xSUSHI = 'xSUSHI',
|
||||
WAVAX = 'WAVAX',
|
||||
}
|
||||
|
||||
export interface IReserveParams extends IReserveBorrowParams, IReserveCollateralParams {
|
||||
|
@ -407,7 +425,8 @@ export interface IMarketRates {
|
|||
export type iParamsPerNetwork<T> =
|
||||
| iEthereumParamsPerNetwork<T>
|
||||
| iPolygonParamsPerNetwork<T>
|
||||
| iXDaiParamsPerNetwork<T>;
|
||||
| iXDaiParamsPerNetwork<T>
|
||||
| iAvalancheParamsPerNetwork<T>;
|
||||
|
||||
export interface iParamsPerNetworkAll<T>
|
||||
extends iEthereumParamsPerNetwork<T>,
|
||||
|
@ -421,7 +440,7 @@ export interface iEthereumParamsPerNetwork<T> {
|
|||
[eEthereumNetwork.ropsten]: T;
|
||||
[eEthereumNetwork.main]: T;
|
||||
[eEthereumNetwork.hardhat]: T;
|
||||
[eEthereumNetwork.tenderlyMain]: T;
|
||||
[eEthereumNetwork.tenderly]: T;
|
||||
}
|
||||
|
||||
export interface iPolygonParamsPerNetwork<T> {
|
||||
|
@ -433,11 +452,17 @@ export interface iXDaiParamsPerNetwork<T> {
|
|||
[eXDaiNetwork.xdai]: T;
|
||||
}
|
||||
|
||||
export interface iAvalancheParamsPerNetwork<T> {
|
||||
[eAvalancheNetwork.avalanche]: T;
|
||||
[eAvalancheNetwork.fuji]: T;
|
||||
}
|
||||
|
||||
export interface iParamsPerPool<T> {
|
||||
[AavePools.proto]: T;
|
||||
[AavePools.matic]: T;
|
||||
[AavePools.amm]: T;
|
||||
[AavePools.arc]: T;
|
||||
[AavePools.avalanche]: T;
|
||||
}
|
||||
|
||||
export interface iBasicDistributionParams {
|
||||
|
@ -476,7 +501,7 @@ export interface ILendingRate {
|
|||
borrowRate: string;
|
||||
}
|
||||
|
||||
export interface ICommonConfiguration {
|
||||
export interface IBaseConfiguration {
|
||||
MarketId: string;
|
||||
LendingPoolImpl?: eContractid;
|
||||
ATokenNamePrefix: string;
|
||||
|
@ -485,7 +510,6 @@ export interface ICommonConfiguration {
|
|||
SymbolPrefix: string;
|
||||
ProviderId: number;
|
||||
ProtocolGlobalParams: IProtocolGlobalConfig;
|
||||
Mocks: IMocksConfig;
|
||||
ProviderRegistry: iParamsPerNetwork<tEthereumAddress | undefined>;
|
||||
ProviderRegistryOwner: iParamsPerNetwork<tEthereumAddress | undefined>;
|
||||
LendingPoolCollateralManager: iParamsPerNetwork<tEthereumAddress>;
|
||||
|
@ -501,14 +525,22 @@ export interface ICommonConfiguration {
|
|||
PoolAdminIndex: number;
|
||||
EmergencyAdmin: iParamsPerNetwork<tEthereumAddress | undefined>;
|
||||
EmergencyAdminIndex: number;
|
||||
ReserveAssets: iParamsPerNetwork<SymbolMap<tEthereumAddress>>;
|
||||
ReservesConfig: iMultiPoolsAssets<IReserveParams>;
|
||||
ATokenDomainSeparator: iParamsPerNetwork<string>;
|
||||
WETH: iParamsPerNetwork<tEthereumAddress>;
|
||||
WrappedNativeToken: iParamsPerNetwork<tEthereumAddress>;
|
||||
WethGateway: iParamsPerNetwork<tEthereumAddress>;
|
||||
ReserveFactorTreasuryAddress: iParamsPerNetwork<tEthereumAddress>;
|
||||
IncentivesController: iParamsPerNetwork<tEthereumAddress>;
|
||||
StableDebtTokenImplementation?: iParamsPerNetwork<tEthereumAddress>;
|
||||
VariableDebtTokenImplementation?: iParamsPerNetwork<tEthereumAddress>;
|
||||
ReserveAssets: iParamsPerNetwork<SymbolMap<tEthereumAddress>>;
|
||||
OracleQuoteCurrency: string;
|
||||
OracleQuoteUnit: string;
|
||||
}
|
||||
|
||||
export interface ICommonConfiguration extends IBaseConfiguration {
|
||||
ReservesConfig: iMultiPoolsAssets<IReserveParams>;
|
||||
Mocks: IMocksConfig;
|
||||
}
|
||||
|
||||
export interface IAaveConfiguration extends ICommonConfiguration {
|
||||
|
@ -530,6 +562,10 @@ export interface IXDAIConfiguration extends ICommonConfiguration {
|
|||
ReservesConfig: iXDAIPoolAssets<IReserveParams>;
|
||||
}
|
||||
|
||||
export interface IAvalancheConfiguration extends ICommonConfiguration {
|
||||
ReservesConfig: iAvalanchePoolAssets<IReserveParams>;
|
||||
}
|
||||
|
||||
export interface ITokenAddress {
|
||||
[token: string]: tEthereumAddress;
|
||||
}
|
||||
|
|
|
@ -7,12 +7,14 @@ import { ICommonConfiguration, eEthereumNetwork } from '../../helpers/types';
|
|||
// ----------------
|
||||
|
||||
export const CommonsConfig: ICommonConfiguration = {
|
||||
MarketId: 'AavePro',
|
||||
ATokenNamePrefix: 'Aave Pro market',
|
||||
StableDebtTokenNamePrefix: 'Aave Pro stable debt ',
|
||||
VariableDebtTokenNamePrefix: 'Aave Pro variable debt ',
|
||||
MarketId: 'AaveArc',
|
||||
ATokenNamePrefix: 'Aave Arc market',
|
||||
StableDebtTokenNamePrefix: 'Aave Arc stable debt ',
|
||||
VariableDebtTokenNamePrefix: 'Aave Arc variable debt ',
|
||||
SymbolPrefix: '',
|
||||
ProviderId: 0, // Overridden in index.ts
|
||||
OracleQuoteCurrency: 'ETH',
|
||||
OracleQuoteUnit: oneEther.toString(),
|
||||
ProtocolGlobalParams: {
|
||||
TokenDistributorPercentageBase: '10000',
|
||||
MockUsdPriceInWei: '5848466240000000',
|
||||
|
@ -59,7 +61,7 @@ export const CommonsConfig: ICommonConfiguration = {
|
|||
[eEthereumNetwork.kovan]: undefined,
|
||||
[eEthereumNetwork.ropsten]: undefined,
|
||||
[eEthereumNetwork.main]: undefined,
|
||||
[eEthereumNetwork.tenderlyMain]: undefined,
|
||||
[eEthereumNetwork.tenderly]: undefined,
|
||||
},
|
||||
PoolAdminIndex: 0,
|
||||
EmergencyAdmin: {
|
||||
|
@ -69,7 +71,7 @@ export const CommonsConfig: ICommonConfiguration = {
|
|||
[eEthereumNetwork.kovan]: undefined,
|
||||
[eEthereumNetwork.ropsten]: undefined,
|
||||
[eEthereumNetwork.main]: undefined,
|
||||
[eEthereumNetwork.tenderlyMain]: undefined,
|
||||
[eEthereumNetwork.tenderly]: undefined,
|
||||
},
|
||||
EmergencyAdminIndex: 1,
|
||||
ProviderRegistry: {
|
||||
|
@ -79,7 +81,7 @@ export const CommonsConfig: ICommonConfiguration = {
|
|||
[eEthereumNetwork.coverage]: '',
|
||||
[eEthereumNetwork.hardhat]: '',
|
||||
[eEthereumNetwork.buidlerevm]: '',
|
||||
[eEthereumNetwork.tenderlyMain]: '0x52D306e36E3B6B02c153d0266ff0f85d18BCD413',
|
||||
[eEthereumNetwork.tenderly]: '0x52D306e36E3B6B02c153d0266ff0f85d18BCD413',
|
||||
},
|
||||
ProviderRegistryOwner: {
|
||||
[eEthereumNetwork.kovan]: '0x85e4A467343c0dc4aDAB74Af84448D9c45D8ae6F',
|
||||
|
@ -88,7 +90,7 @@ export const CommonsConfig: ICommonConfiguration = {
|
|||
[eEthereumNetwork.coverage]: '',
|
||||
[eEthereumNetwork.hardhat]: '',
|
||||
[eEthereumNetwork.buidlerevm]: '',
|
||||
[eEthereumNetwork.tenderlyMain]: '0xbd723fc4f1d737dcfc48a07fe7336766d34cad5f',
|
||||
[eEthereumNetwork.tenderly]: '0xbd723fc4f1d737dcfc48a07fe7336766d34cad5f',
|
||||
},
|
||||
LendingRateOracle: {
|
||||
[eEthereumNetwork.coverage]: '',
|
||||
|
@ -97,7 +99,7 @@ export const CommonsConfig: ICommonConfiguration = {
|
|||
[eEthereumNetwork.kovan]: '',//'0xdCde9Bb6a49e37fA433990832AB541AE2d4FEB4a',
|
||||
[eEthereumNetwork.ropsten]: '0x05dcca805a6562c1bdd0423768754acb6993241b',
|
||||
[eEthereumNetwork.main]: '',//'0x8A32f49FFbA88aba6EFF96F45D8BD1D4b3f35c7D',
|
||||
[eEthereumNetwork.tenderlyMain]: '0x8A32f49FFbA88aba6EFF96F45D8BD1D4b3f35c7D',
|
||||
[eEthereumNetwork.tenderly]: '0x8A32f49FFbA88aba6EFF96F45D8BD1D4b3f35c7D',
|
||||
},
|
||||
LendingPoolCollateralManager: {
|
||||
[eEthereumNetwork.coverage]: '',
|
||||
|
@ -106,7 +108,7 @@ export const CommonsConfig: ICommonConfiguration = {
|
|||
[eEthereumNetwork.kovan]: '0x9269b6453d0d75370c4c85e5a42977a53efdb72a',
|
||||
[eEthereumNetwork.ropsten]: '',
|
||||
[eEthereumNetwork.main]: '0xbd4765210d4167CE2A5b87280D9E8Ee316D5EC7C',
|
||||
[eEthereumNetwork.tenderlyMain]: '0xbd4765210d4167CE2A5b87280D9E8Ee316D5EC7C',
|
||||
[eEthereumNetwork.tenderly]: '0xbd4765210d4167CE2A5b87280D9E8Ee316D5EC7C',
|
||||
},
|
||||
LendingPoolConfigurator: {
|
||||
[eEthereumNetwork.coverage]: '',
|
||||
|
@ -115,7 +117,7 @@ export const CommonsConfig: ICommonConfiguration = {
|
|||
[eEthereumNetwork.kovan]: '',
|
||||
[eEthereumNetwork.ropsten]: '',
|
||||
[eEthereumNetwork.main]: '',
|
||||
[eEthereumNetwork.tenderlyMain]: '',
|
||||
[eEthereumNetwork.tenderly]: '',
|
||||
},
|
||||
LendingPool: {
|
||||
[eEthereumNetwork.coverage]: '',
|
||||
|
@ -124,7 +126,7 @@ export const CommonsConfig: ICommonConfiguration = {
|
|||
[eEthereumNetwork.kovan]: '',
|
||||
[eEthereumNetwork.ropsten]: '',
|
||||
[eEthereumNetwork.main]: '',
|
||||
[eEthereumNetwork.tenderlyMain]: '',
|
||||
[eEthereumNetwork.tenderly]: '',
|
||||
},
|
||||
WethGateway: {
|
||||
[eEthereumNetwork.coverage]: '',
|
||||
|
@ -133,7 +135,7 @@ export const CommonsConfig: ICommonConfiguration = {
|
|||
[eEthereumNetwork.kovan]: '0xf99b8E67a0E044734B01EC4586D1c88C9a869718',
|
||||
[eEthereumNetwork.ropsten]: '',
|
||||
[eEthereumNetwork.main]: '',
|
||||
[eEthereumNetwork.tenderlyMain]: '',
|
||||
[eEthereumNetwork.tenderly]: '',
|
||||
},
|
||||
TokenDistributor: {
|
||||
[eEthereumNetwork.coverage]: '',
|
||||
|
@ -142,7 +144,7 @@ export const CommonsConfig: ICommonConfiguration = {
|
|||
[eEthereumNetwork.kovan]: '0x971efe90088f21dc6a36f610ffed77fc19710708',
|
||||
[eEthereumNetwork.ropsten]: '0xeba2ea67942b8250d870b12750b594696d02fc9c',
|
||||
[eEthereumNetwork.main]: '0xe3d9988f676457123c5fd01297605efdd0cba1ae',
|
||||
[eEthereumNetwork.tenderlyMain]: '0xe3d9988f676457123c5fd01297605efdd0cba1ae',
|
||||
[eEthereumNetwork.tenderly]: '0xe3d9988f676457123c5fd01297605efdd0cba1ae',
|
||||
},
|
||||
AaveOracle: {
|
||||
[eEthereumNetwork.coverage]: '',
|
||||
|
@ -151,7 +153,7 @@ export const CommonsConfig: ICommonConfiguration = {
|
|||
[eEthereumNetwork.kovan]: '',//'0xB8bE51E6563BB312Cbb2aa26e352516c25c26ac1',
|
||||
[eEthereumNetwork.ropsten]: ZERO_ADDRESS,
|
||||
[eEthereumNetwork.main]: '',//'0xA50ba011c48153De246E5192C8f9258A2ba79Ca9',
|
||||
[eEthereumNetwork.tenderlyMain]: '0xA50ba011c48153De246E5192C8f9258A2ba79Ca9',
|
||||
[eEthereumNetwork.tenderly]: '0xA50ba011c48153De246E5192C8f9258A2ba79Ca9',
|
||||
},
|
||||
FallbackOracle: {
|
||||
[eEthereumNetwork.coverage]: '',
|
||||
|
@ -160,7 +162,7 @@ export const CommonsConfig: ICommonConfiguration = {
|
|||
[eEthereumNetwork.kovan]: '0x50913E8E1c650E790F8a1E741FF9B1B1bB251dfe',
|
||||
[eEthereumNetwork.ropsten]: '0xAD1a978cdbb8175b2eaeC47B01404f8AEC5f4F0d',
|
||||
[eEthereumNetwork.main]: ZERO_ADDRESS,
|
||||
[eEthereumNetwork.tenderlyMain]: ZERO_ADDRESS,
|
||||
[eEthereumNetwork.tenderly]: ZERO_ADDRESS,
|
||||
},
|
||||
ChainlinkAggregator: {
|
||||
[eEthereumNetwork.coverage]: {},
|
||||
|
@ -232,7 +234,7 @@ export const CommonsConfig: ICommonConfiguration = {
|
|||
ZRX: '0x2Da4983a622a8498bb1a21FaE9D8F6C664939962',
|
||||
USD: '0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419',
|
||||
},
|
||||
[eEthereumNetwork.tenderlyMain]: {
|
||||
[eEthereumNetwork.tenderly]: {
|
||||
AAVE: '0x6Df09E975c830ECae5bd4eD9d90f3A95a4f88012',
|
||||
BAT: '0x0d16d4528239e9ee52fa531af613AcdB23D88c94',
|
||||
BUSD: '0x614715d2Af89E6EC99A233818275142cE88d1Cfd',
|
||||
|
@ -262,7 +264,7 @@ export const CommonsConfig: ICommonConfiguration = {
|
|||
[eEthereumNetwork.main]: {},
|
||||
[eEthereumNetwork.kovan]: {},
|
||||
[eEthereumNetwork.ropsten]: {},
|
||||
[eEthereumNetwork.tenderlyMain]: {},
|
||||
[eEthereumNetwork.tenderly]: {},
|
||||
},
|
||||
ReservesConfig: {},
|
||||
ATokenDomainSeparator: {
|
||||
|
@ -275,7 +277,7 @@ export const CommonsConfig: ICommonConfiguration = {
|
|||
[eEthereumNetwork.kovan]: '',
|
||||
[eEthereumNetwork.ropsten]: '',
|
||||
[eEthereumNetwork.main]: '',
|
||||
[eEthereumNetwork.tenderlyMain]: '',
|
||||
[eEthereumNetwork.tenderly]: '',
|
||||
},
|
||||
WETH: {
|
||||
[eEthereumNetwork.coverage]: '', // deployed in local evm
|
||||
|
@ -284,7 +286,7 @@ export const CommonsConfig: ICommonConfiguration = {
|
|||
[eEthereumNetwork.kovan]: '0xd0a1e359811322d97991e03f863a0c30c2cf029c',
|
||||
[eEthereumNetwork.ropsten]: '0xc778417e063141139fce010982780140aa0cd5ab',
|
||||
[eEthereumNetwork.main]: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
||||
[eEthereumNetwork.tenderlyMain]: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
||||
[eEthereumNetwork.tenderly]: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
||||
},
|
||||
ReserveFactorTreasuryAddress: {
|
||||
[eEthereumNetwork.coverage]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c',
|
||||
|
@ -293,7 +295,7 @@ export const CommonsConfig: ICommonConfiguration = {
|
|||
[eEthereumNetwork.kovan]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c',
|
||||
[eEthereumNetwork.ropsten]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c',
|
||||
[eEthereumNetwork.main]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c',
|
||||
[eEthereumNetwork.tenderlyMain]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c',
|
||||
[eEthereumNetwork.tenderly]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c',
|
||||
},
|
||||
WrappedNativeToken: {
|
||||
[eEthereumNetwork.coverage]: '', // deployed in local evm
|
||||
|
@ -302,7 +304,7 @@ export const CommonsConfig: ICommonConfiguration = {
|
|||
[eEthereumNetwork.kovan]: '0xd0a1e359811322d97991e03f863a0c30c2cf029c',
|
||||
[eEthereumNetwork.ropsten]: '0xc778417e063141139fce010982780140aa0cd5ab',
|
||||
[eEthereumNetwork.main]: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
||||
[eEthereumNetwork.tenderlyMain]: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
||||
[eEthereumNetwork.tenderly]: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
||||
},
|
||||
IncentivesController: {
|
||||
[eEthereumNetwork.coverage]: ZERO_ADDRESS,
|
||||
|
@ -311,6 +313,6 @@ export const CommonsConfig: ICommonConfiguration = {
|
|||
[eEthereumNetwork.kovan]: ZERO_ADDRESS,
|
||||
[eEthereumNetwork.ropsten]: ZERO_ADDRESS,
|
||||
[eEthereumNetwork.main]: ZERO_ADDRESS,
|
||||
[eEthereumNetwork.tenderlyMain]: ZERO_ADDRESS,
|
||||
[eEthereumNetwork.tenderly]: ZERO_ADDRESS,
|
||||
},
|
||||
};
|
||||
|
|
|
@ -46,7 +46,7 @@ export const AaveArcConfig: IAaveArcConfiguration = {
|
|||
WETH: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
|
||||
AAVE: '0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9',
|
||||
},
|
||||
[eEthereumNetwork.tenderlyMain]: {
|
||||
[eEthereumNetwork.tenderly]: {
|
||||
USDC: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
|
||||
WBTC: '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599',
|
||||
WETH: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
import BigNumber from 'bignumber.js';
|
||||
import {
|
||||
oneEther,
|
||||
oneRay,
|
||||
RAY,
|
||||
ZERO_ADDRESS,
|
||||
MOCK_CHAINLINK_AGGREGATORS_PRICES,
|
||||
oneEther,
|
||||
} from '../../helpers/constants';
|
||||
import { ICommonConfiguration, eEthereumNetwork } from '../../helpers/types';
|
||||
|
||||
|
@ -19,6 +17,8 @@ export const CommonsConfig: ICommonConfiguration = {
|
|||
VariableDebtTokenNamePrefix: 'Aave variable debt bearing',
|
||||
SymbolPrefix: '',
|
||||
ProviderId: 0, // Overriden in index.ts
|
||||
OracleQuoteCurrency: 'ETH',
|
||||
OracleQuoteUnit: oneEther.toString(),
|
||||
ProtocolGlobalParams: {
|
||||
TokenDistributorPercentageBase: '10000',
|
||||
MockUsdPriceInWei: '5848466240000000',
|
||||
|
@ -113,7 +113,7 @@ export const CommonsConfig: ICommonConfiguration = {
|
|||
[eEthereumNetwork.kovan]: undefined,
|
||||
[eEthereumNetwork.ropsten]: undefined,
|
||||
[eEthereumNetwork.main]: undefined,
|
||||
[eEthereumNetwork.tenderlyMain]: undefined,
|
||||
[eEthereumNetwork.tenderly]: undefined,
|
||||
},
|
||||
PoolAdminIndex: 0,
|
||||
EmergencyAdmin: {
|
||||
|
@ -123,7 +123,7 @@ export const CommonsConfig: ICommonConfiguration = {
|
|||
[eEthereumNetwork.kovan]: undefined,
|
||||
[eEthereumNetwork.ropsten]: undefined,
|
||||
[eEthereumNetwork.main]: undefined,
|
||||
[eEthereumNetwork.tenderlyMain]: undefined,
|
||||
[eEthereumNetwork.tenderly]: undefined,
|
||||
},
|
||||
EmergencyAdminIndex: 1,
|
||||
ProviderRegistry: {
|
||||
|
@ -133,7 +133,7 @@ export const CommonsConfig: ICommonConfiguration = {
|
|||
[eEthereumNetwork.coverage]: '',
|
||||
[eEthereumNetwork.hardhat]: '',
|
||||
[eEthereumNetwork.buidlerevm]: '',
|
||||
[eEthereumNetwork.tenderlyMain]: '0x52D306e36E3B6B02c153d0266ff0f85d18BCD413',
|
||||
[eEthereumNetwork.tenderly]: '0x52D306e36E3B6B02c153d0266ff0f85d18BCD413',
|
||||
},
|
||||
ProviderRegistryOwner: {
|
||||
[eEthereumNetwork.kovan]: '0x85e4A467343c0dc4aDAB74Af84448D9c45D8ae6F',
|
||||
|
@ -142,7 +142,7 @@ export const CommonsConfig: ICommonConfiguration = {
|
|||
[eEthereumNetwork.coverage]: '',
|
||||
[eEthereumNetwork.hardhat]: '',
|
||||
[eEthereumNetwork.buidlerevm]: '',
|
||||
[eEthereumNetwork.tenderlyMain]: '0xB9062896ec3A615a4e4444DF183F0531a77218AE',
|
||||
[eEthereumNetwork.tenderly]: '0xB9062896ec3A615a4e4444DF183F0531a77218AE',
|
||||
},
|
||||
LendingRateOracle: {
|
||||
[eEthereumNetwork.coverage]: '',
|
||||
|
@ -151,7 +151,7 @@ export const CommonsConfig: ICommonConfiguration = {
|
|||
[eEthereumNetwork.kovan]: '', //'0xdCde9Bb6a49e37fA433990832AB541AE2d4FEB4a',
|
||||
[eEthereumNetwork.ropsten]: '0x05dcca805a6562c1bdd0423768754acb6993241b',
|
||||
[eEthereumNetwork.main]: '', //'0x8A32f49FFbA88aba6EFF96F45D8BD1D4b3f35c7D',
|
||||
[eEthereumNetwork.tenderlyMain]: '0x8A32f49FFbA88aba6EFF96F45D8BD1D4b3f35c7D',
|
||||
[eEthereumNetwork.tenderly]: '0x8A32f49FFbA88aba6EFF96F45D8BD1D4b3f35c7D',
|
||||
},
|
||||
LendingPoolCollateralManager: {
|
||||
[eEthereumNetwork.coverage]: '',
|
||||
|
@ -160,7 +160,7 @@ export const CommonsConfig: ICommonConfiguration = {
|
|||
[eEthereumNetwork.kovan]: '0x9269b6453d0d75370c4c85e5a42977a53efdb72a',
|
||||
[eEthereumNetwork.ropsten]: '',
|
||||
[eEthereumNetwork.main]: '0xbd4765210d4167CE2A5b87280D9E8Ee316D5EC7C',
|
||||
[eEthereumNetwork.tenderlyMain]: '0xbd4765210d4167CE2A5b87280D9E8Ee316D5EC7C',
|
||||
[eEthereumNetwork.tenderly]: '0xbd4765210d4167CE2A5b87280D9E8Ee316D5EC7C',
|
||||
},
|
||||
LendingPoolConfigurator: {
|
||||
[eEthereumNetwork.coverage]: '',
|
||||
|
@ -169,7 +169,7 @@ export const CommonsConfig: ICommonConfiguration = {
|
|||
[eEthereumNetwork.kovan]: '',
|
||||
[eEthereumNetwork.ropsten]: '',
|
||||
[eEthereumNetwork.main]: '',
|
||||
[eEthereumNetwork.tenderlyMain]: '',
|
||||
[eEthereumNetwork.tenderly]: '',
|
||||
},
|
||||
LendingPool: {
|
||||
[eEthereumNetwork.coverage]: '',
|
||||
|
@ -178,7 +178,7 @@ export const CommonsConfig: ICommonConfiguration = {
|
|||
[eEthereumNetwork.kovan]: '',
|
||||
[eEthereumNetwork.ropsten]: '',
|
||||
[eEthereumNetwork.main]: '',
|
||||
[eEthereumNetwork.tenderlyMain]: '',
|
||||
[eEthereumNetwork.tenderly]: '',
|
||||
},
|
||||
WethGateway: {
|
||||
[eEthereumNetwork.coverage]: '',
|
||||
|
@ -187,7 +187,7 @@ export const CommonsConfig: ICommonConfiguration = {
|
|||
[eEthereumNetwork.kovan]: '',
|
||||
[eEthereumNetwork.ropsten]: '',
|
||||
[eEthereumNetwork.main]: '',
|
||||
[eEthereumNetwork.tenderlyMain]: '',
|
||||
[eEthereumNetwork.tenderly]: '',
|
||||
},
|
||||
TokenDistributor: {
|
||||
[eEthereumNetwork.coverage]: '',
|
||||
|
@ -196,7 +196,7 @@ export const CommonsConfig: ICommonConfiguration = {
|
|||
[eEthereumNetwork.kovan]: '0x971efe90088f21dc6a36f610ffed77fc19710708',
|
||||
[eEthereumNetwork.ropsten]: '0xeba2ea67942b8250d870b12750b594696d02fc9c',
|
||||
[eEthereumNetwork.main]: '0xe3d9988f676457123c5fd01297605efdd0cba1ae',
|
||||
[eEthereumNetwork.tenderlyMain]: '0xe3d9988f676457123c5fd01297605efdd0cba1ae',
|
||||
[eEthereumNetwork.tenderly]: '0xe3d9988f676457123c5fd01297605efdd0cba1ae',
|
||||
},
|
||||
AaveOracle: {
|
||||
[eEthereumNetwork.coverage]: '',
|
||||
|
@ -205,7 +205,7 @@ export const CommonsConfig: ICommonConfiguration = {
|
|||
[eEthereumNetwork.kovan]: '', //'0xB8bE51E6563BB312Cbb2aa26e352516c25c26ac1',
|
||||
[eEthereumNetwork.ropsten]: ZERO_ADDRESS,
|
||||
[eEthereumNetwork.main]: '', //'0xA50ba011c48153De246E5192C8f9258A2ba79Ca9',
|
||||
[eEthereumNetwork.tenderlyMain]: '0xA50ba011c48153De246E5192C8f9258A2ba79Ca9',
|
||||
[eEthereumNetwork.tenderly]: '0xA50ba011c48153De246E5192C8f9258A2ba79Ca9',
|
||||
},
|
||||
FallbackOracle: {
|
||||
[eEthereumNetwork.coverage]: '',
|
||||
|
@ -214,7 +214,7 @@ export const CommonsConfig: ICommonConfiguration = {
|
|||
[eEthereumNetwork.kovan]: '0x50913E8E1c650E790F8a1E741FF9B1B1bB251dfe',
|
||||
[eEthereumNetwork.ropsten]: '0xAD1a978cdbb8175b2eaeC47B01404f8AEC5f4F0d',
|
||||
[eEthereumNetwork.main]: ZERO_ADDRESS,
|
||||
[eEthereumNetwork.tenderlyMain]: ZERO_ADDRESS,
|
||||
[eEthereumNetwork.tenderly]: ZERO_ADDRESS,
|
||||
},
|
||||
ChainlinkAggregator: {
|
||||
[eEthereumNetwork.coverage]: {},
|
||||
|
@ -287,7 +287,7 @@ export const CommonsConfig: ICommonConfiguration = {
|
|||
USD: '0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419',
|
||||
xSUSHI: '0x9b26214bEC078E68a394AaEbfbffF406Ce14893F',
|
||||
},
|
||||
[eEthereumNetwork.tenderlyMain]: {
|
||||
[eEthereumNetwork.tenderly]: {
|
||||
AAVE: '0x6Df09E975c830ECae5bd4eD9d90f3A95a4f88012',
|
||||
BAT: '0x0d16d4528239e9ee52fa531af613AcdB23D88c94',
|
||||
BUSD: '0x614715d2Af89E6EC99A233818275142cE88d1Cfd',
|
||||
|
@ -318,7 +318,7 @@ export const CommonsConfig: ICommonConfiguration = {
|
|||
[eEthereumNetwork.main]: {},
|
||||
[eEthereumNetwork.kovan]: {},
|
||||
[eEthereumNetwork.ropsten]: {},
|
||||
[eEthereumNetwork.tenderlyMain]: {},
|
||||
[eEthereumNetwork.tenderly]: {},
|
||||
},
|
||||
ReservesConfig: {},
|
||||
ATokenDomainSeparator: {
|
||||
|
@ -331,7 +331,7 @@ export const CommonsConfig: ICommonConfiguration = {
|
|||
[eEthereumNetwork.kovan]: '',
|
||||
[eEthereumNetwork.ropsten]: '',
|
||||
[eEthereumNetwork.main]: '',
|
||||
[eEthereumNetwork.tenderlyMain]: '',
|
||||
[eEthereumNetwork.tenderly]: '',
|
||||
},
|
||||
WETH: {
|
||||
[eEthereumNetwork.coverage]: '', // deployed in local evm
|
||||
|
@ -340,7 +340,7 @@ export const CommonsConfig: ICommonConfiguration = {
|
|||
[eEthereumNetwork.kovan]: '0xd0a1e359811322d97991e03f863a0c30c2cf029c',
|
||||
[eEthereumNetwork.ropsten]: '0xc778417e063141139fce010982780140aa0cd5ab',
|
||||
[eEthereumNetwork.main]: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
||||
[eEthereumNetwork.tenderlyMain]: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
||||
[eEthereumNetwork.tenderly]: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
||||
},
|
||||
WrappedNativeToken: {
|
||||
[eEthereumNetwork.coverage]: '', // deployed in local evm
|
||||
|
@ -349,7 +349,7 @@ export const CommonsConfig: ICommonConfiguration = {
|
|||
[eEthereumNetwork.kovan]: '0xd0a1e359811322d97991e03f863a0c30c2cf029c',
|
||||
[eEthereumNetwork.ropsten]: '0xc778417e063141139fce010982780140aa0cd5ab',
|
||||
[eEthereumNetwork.main]: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
||||
[eEthereumNetwork.tenderlyMain]: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
||||
[eEthereumNetwork.tenderly]: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
||||
},
|
||||
ReserveFactorTreasuryAddress: {
|
||||
[eEthereumNetwork.coverage]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c',
|
||||
|
@ -358,7 +358,7 @@ export const CommonsConfig: ICommonConfiguration = {
|
|||
[eEthereumNetwork.kovan]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c',
|
||||
[eEthereumNetwork.ropsten]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c',
|
||||
[eEthereumNetwork.main]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c',
|
||||
[eEthereumNetwork.tenderlyMain]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c',
|
||||
[eEthereumNetwork.tenderly]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c',
|
||||
},
|
||||
IncentivesController: {
|
||||
[eEthereumNetwork.coverage]: ZERO_ADDRESS,
|
||||
|
@ -367,6 +367,6 @@ export const CommonsConfig: ICommonConfiguration = {
|
|||
[eEthereumNetwork.kovan]: ZERO_ADDRESS,
|
||||
[eEthereumNetwork.ropsten]: ZERO_ADDRESS,
|
||||
[eEthereumNetwork.main]: ZERO_ADDRESS,
|
||||
[eEthereumNetwork.tenderlyMain]: ZERO_ADDRESS,
|
||||
[eEthereumNetwork.tenderly]: ZERO_ADDRESS,
|
||||
},
|
||||
};
|
||||
|
|
|
@ -128,7 +128,7 @@ export const AaveConfig: IAaveConfiguration = {
|
|||
ZRX: '0xE41d2489571d322189246DaFA5ebDe1F4699F498',
|
||||
xSUSHI: '0x8798249c2E607446EfB7Ad49eC89dD1865Ff4272',
|
||||
},
|
||||
[eEthereumNetwork.tenderlyMain]: {
|
||||
[eEthereumNetwork.tenderly]: {
|
||||
AAVE: '0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9',
|
||||
BAT: '0x0d8775f648430679a709e98d2b0cb6250d2887ef',
|
||||
BUSD: '0x4Fabb145d64652a948d72533023f6E7A623C7C53',
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { eContractid, IReserveParams } from '../../helpers/types';
|
||||
|
||||
import {
|
||||
import {
|
||||
rateStrategyStableOne,
|
||||
rateStrategyStableTwo,
|
||||
rateStrategyStableThree,
|
||||
|
@ -21,7 +21,7 @@ export const strategyBUSD: IReserveParams = {
|
|||
stableBorrowRateEnabled: false,
|
||||
reserveDecimals: '18',
|
||||
aTokenImpl: eContractid.AToken,
|
||||
reserveFactor: '1000'
|
||||
reserveFactor: '1000',
|
||||
};
|
||||
|
||||
export const strategyDAI: IReserveParams = {
|
||||
|
@ -33,7 +33,7 @@ export const strategyDAI: IReserveParams = {
|
|||
stableBorrowRateEnabled: true,
|
||||
reserveDecimals: '18',
|
||||
aTokenImpl: eContractid.AToken,
|
||||
reserveFactor: '1000'
|
||||
reserveFactor: '1000',
|
||||
};
|
||||
|
||||
export const strategySUSD: IReserveParams = {
|
||||
|
@ -45,7 +45,7 @@ export const strategySUSD: IReserveParams = {
|
|||
stableBorrowRateEnabled: false,
|
||||
reserveDecimals: '18',
|
||||
aTokenImpl: eContractid.AToken,
|
||||
reserveFactor: '2000'
|
||||
reserveFactor: '2000',
|
||||
};
|
||||
|
||||
export const strategyTUSD: IReserveParams = {
|
||||
|
@ -57,7 +57,7 @@ export const strategyTUSD: IReserveParams = {
|
|||
stableBorrowRateEnabled: true,
|
||||
reserveDecimals: '18',
|
||||
aTokenImpl: eContractid.AToken,
|
||||
reserveFactor: '1000'
|
||||
reserveFactor: '1000',
|
||||
};
|
||||
|
||||
export const strategyUSDC: IReserveParams = {
|
||||
|
@ -69,19 +69,19 @@ export const strategyUSDC: IReserveParams = {
|
|||
stableBorrowRateEnabled: true,
|
||||
reserveDecimals: '6',
|
||||
aTokenImpl: eContractid.AToken,
|
||||
reserveFactor: '1000'
|
||||
reserveFactor: '1000',
|
||||
};
|
||||
|
||||
export const strategyUSDT: IReserveParams = {
|
||||
strategy: rateStrategyStableThree,
|
||||
baseLTVAsCollateral: '8000',
|
||||
liquidationThreshold: '8500',
|
||||
liquidationBonus: '10500',
|
||||
baseLTVAsCollateral: '0',
|
||||
liquidationThreshold: '0',
|
||||
liquidationBonus: '0',
|
||||
borrowingEnabled: true,
|
||||
stableBorrowRateEnabled: true,
|
||||
reserveDecimals: '6',
|
||||
aTokenImpl: eContractid.AToken,
|
||||
reserveFactor: '1000'
|
||||
reserveFactor: '1000',
|
||||
};
|
||||
|
||||
export const strategyAAVE: IReserveParams = {
|
||||
|
@ -93,7 +93,7 @@ export const strategyAAVE: IReserveParams = {
|
|||
stableBorrowRateEnabled: false,
|
||||
reserveDecimals: '18',
|
||||
aTokenImpl: eContractid.AToken,
|
||||
reserveFactor: '0'
|
||||
reserveFactor: '0',
|
||||
};
|
||||
|
||||
export const strategyBAT: IReserveParams = {
|
||||
|
@ -105,7 +105,7 @@ export const strategyBAT: IReserveParams = {
|
|||
stableBorrowRateEnabled: true,
|
||||
reserveDecimals: '18',
|
||||
aTokenImpl: eContractid.AToken,
|
||||
reserveFactor: '2000'
|
||||
reserveFactor: '2000',
|
||||
};
|
||||
|
||||
export const strategyENJ: IReserveParams = {
|
||||
|
@ -117,7 +117,7 @@ export const strategyENJ: IReserveParams = {
|
|||
stableBorrowRateEnabled: true,
|
||||
reserveDecimals: '18',
|
||||
aTokenImpl: eContractid.AToken,
|
||||
reserveFactor: '2000'
|
||||
reserveFactor: '2000',
|
||||
};
|
||||
|
||||
export const strategyWETH: IReserveParams = {
|
||||
|
@ -129,7 +129,7 @@ export const strategyWETH: IReserveParams = {
|
|||
stableBorrowRateEnabled: true,
|
||||
reserveDecimals: '18',
|
||||
aTokenImpl: eContractid.AToken,
|
||||
reserveFactor: '1000'
|
||||
reserveFactor: '1000',
|
||||
};
|
||||
|
||||
export const strategyKNC: IReserveParams = {
|
||||
|
@ -141,7 +141,7 @@ export const strategyKNC: IReserveParams = {
|
|||
stableBorrowRateEnabled: true,
|
||||
reserveDecimals: '18',
|
||||
aTokenImpl: eContractid.AToken,
|
||||
reserveFactor: '2000'
|
||||
reserveFactor: '2000',
|
||||
};
|
||||
|
||||
export const strategyLINK: IReserveParams = {
|
||||
|
@ -153,7 +153,7 @@ export const strategyLINK: IReserveParams = {
|
|||
stableBorrowRateEnabled: true,
|
||||
reserveDecimals: '18',
|
||||
aTokenImpl: eContractid.AToken,
|
||||
reserveFactor: '2000'
|
||||
reserveFactor: '2000',
|
||||
};
|
||||
|
||||
export const strategyMANA: IReserveParams = {
|
||||
|
@ -165,7 +165,7 @@ export const strategyMANA: IReserveParams = {
|
|||
stableBorrowRateEnabled: true,
|
||||
reserveDecimals: '18',
|
||||
aTokenImpl: eContractid.AToken,
|
||||
reserveFactor: '3500'
|
||||
reserveFactor: '3500',
|
||||
};
|
||||
|
||||
export const strategyMKR: IReserveParams = {
|
||||
|
@ -177,7 +177,7 @@ export const strategyMKR: IReserveParams = {
|
|||
stableBorrowRateEnabled: true,
|
||||
reserveDecimals: '18',
|
||||
aTokenImpl: eContractid.AToken,
|
||||
reserveFactor: '2000'
|
||||
reserveFactor: '2000',
|
||||
};
|
||||
|
||||
export const strategyREN: IReserveParams = {
|
||||
|
@ -189,7 +189,7 @@ export const strategyREN: IReserveParams = {
|
|||
stableBorrowRateEnabled: true,
|
||||
reserveDecimals: '18',
|
||||
aTokenImpl: eContractid.AToken,
|
||||
reserveFactor: '2000'
|
||||
reserveFactor: '2000',
|
||||
};
|
||||
|
||||
export const strategySNX: IReserveParams = {
|
||||
|
@ -201,7 +201,7 @@ export const strategySNX: IReserveParams = {
|
|||
stableBorrowRateEnabled: false,
|
||||
reserveDecimals: '18',
|
||||
aTokenImpl: eContractid.AToken,
|
||||
reserveFactor: '3500'
|
||||
reserveFactor: '3500',
|
||||
};
|
||||
|
||||
// Invalid borrow rates in params currently, replaced with snx params
|
||||
|
@ -214,7 +214,7 @@ export const strategyUNI: IReserveParams = {
|
|||
stableBorrowRateEnabled: false,
|
||||
reserveDecimals: '18',
|
||||
aTokenImpl: eContractid.DelegationAwareAToken,
|
||||
reserveFactor: '2000'
|
||||
reserveFactor: '2000',
|
||||
};
|
||||
|
||||
export const strategyWBTC: IReserveParams = {
|
||||
|
@ -226,7 +226,7 @@ export const strategyWBTC: IReserveParams = {
|
|||
stableBorrowRateEnabled: true,
|
||||
reserveDecimals: '8',
|
||||
aTokenImpl: eContractid.AToken,
|
||||
reserveFactor: '2000'
|
||||
reserveFactor: '2000',
|
||||
};
|
||||
|
||||
export const strategyYFI: IReserveParams = {
|
||||
|
@ -238,7 +238,7 @@ export const strategyYFI: IReserveParams = {
|
|||
stableBorrowRateEnabled: true,
|
||||
reserveDecimals: '18',
|
||||
aTokenImpl: eContractid.AToken,
|
||||
reserveFactor: '2000'
|
||||
reserveFactor: '2000',
|
||||
};
|
||||
|
||||
export const strategyZRX: IReserveParams = {
|
||||
|
@ -250,7 +250,7 @@ export const strategyZRX: IReserveParams = {
|
|||
stableBorrowRateEnabled: true,
|
||||
reserveDecimals: '18',
|
||||
aTokenImpl: eContractid.AToken,
|
||||
reserveFactor: '2000'
|
||||
reserveFactor: '2000',
|
||||
};
|
||||
|
||||
export const strategyXSUSHI: IReserveParams = {
|
||||
|
@ -263,4 +263,4 @@ export const strategyXSUSHI: IReserveParams = {
|
|||
reserveDecimals: '18',
|
||||
aTokenImpl: eContractid.AToken,
|
||||
reserveFactor: '3500',
|
||||
};
|
||||
};
|
||||
|
|
|
@ -5,6 +5,7 @@ import {
|
|||
RAY,
|
||||
ZERO_ADDRESS,
|
||||
MOCK_CHAINLINK_AGGREGATORS_PRICES,
|
||||
oneUsd,
|
||||
} from '../../helpers/constants';
|
||||
import { ICommonConfiguration, eEthereumNetwork } from '../../helpers/types';
|
||||
|
||||
|
@ -19,6 +20,8 @@ export const CommonsConfig: ICommonConfiguration = {
|
|||
VariableDebtTokenNamePrefix: 'Aave AMM Market variable debt',
|
||||
SymbolPrefix: 'Amm',
|
||||
ProviderId: 0, // Overriden in index.ts
|
||||
OracleQuoteCurrency: 'ETH',
|
||||
OracleQuoteUnit: oneEther.toString(),
|
||||
ProtocolGlobalParams: {
|
||||
TokenDistributorPercentageBase: '10000',
|
||||
MockUsdPriceInWei: '5848466240000000',
|
||||
|
@ -116,7 +119,7 @@ export const CommonsConfig: ICommonConfiguration = {
|
|||
[eEthereumNetwork.kovan]: undefined,
|
||||
[eEthereumNetwork.ropsten]: undefined,
|
||||
[eEthereumNetwork.main]: undefined,
|
||||
[eEthereumNetwork.tenderlyMain]: undefined,
|
||||
[eEthereumNetwork.tenderly]: undefined,
|
||||
},
|
||||
PoolAdminIndex: 0,
|
||||
EmergencyAdmin: {
|
||||
|
@ -126,7 +129,7 @@ export const CommonsConfig: ICommonConfiguration = {
|
|||
[eEthereumNetwork.kovan]: undefined,
|
||||
[eEthereumNetwork.ropsten]: undefined,
|
||||
[eEthereumNetwork.main]: undefined,
|
||||
[eEthereumNetwork.tenderlyMain]: undefined,
|
||||
[eEthereumNetwork.tenderly]: undefined,
|
||||
},
|
||||
EmergencyAdminIndex: 1,
|
||||
ProviderRegistry: {
|
||||
|
@ -136,7 +139,7 @@ export const CommonsConfig: ICommonConfiguration = {
|
|||
[eEthereumNetwork.coverage]: '',
|
||||
[eEthereumNetwork.hardhat]: '',
|
||||
[eEthereumNetwork.buidlerevm]: '',
|
||||
[eEthereumNetwork.tenderlyMain]: '0x52D306e36E3B6B02c153d0266ff0f85d18BCD413',
|
||||
[eEthereumNetwork.tenderly]: '0x52D306e36E3B6B02c153d0266ff0f85d18BCD413',
|
||||
},
|
||||
ProviderRegistryOwner: {
|
||||
[eEthereumNetwork.kovan]: '0x85e4A467343c0dc4aDAB74Af84448D9c45D8ae6F',
|
||||
|
@ -145,7 +148,7 @@ export const CommonsConfig: ICommonConfiguration = {
|
|||
[eEthereumNetwork.coverage]: '',
|
||||
[eEthereumNetwork.hardhat]: '',
|
||||
[eEthereumNetwork.buidlerevm]: '',
|
||||
[eEthereumNetwork.tenderlyMain]: '0xB9062896ec3A615a4e4444DF183F0531a77218AE',
|
||||
[eEthereumNetwork.tenderly]: '0xB9062896ec3A615a4e4444DF183F0531a77218AE',
|
||||
},
|
||||
LendingRateOracle: {
|
||||
[eEthereumNetwork.coverage]: '',
|
||||
|
@ -154,7 +157,7 @@ export const CommonsConfig: ICommonConfiguration = {
|
|||
[eEthereumNetwork.kovan]: '0xd00Bd28FAdDa9d5658D1D4e0c151973146C7A533', //'0xE48F95873855bfd97BF89572DDf5cBC44D9c545b'
|
||||
[eEthereumNetwork.ropsten]: '0x05dcca805a6562c1bdd0423768754acb6993241b',
|
||||
[eEthereumNetwork.main]: '', //'0x8A32f49FFbA88aba6EFF96F45D8BD1D4b3f35c7D', // Need to re-deploy because of onlyOwner
|
||||
[eEthereumNetwork.tenderlyMain]: '0x8A32f49FFbA88aba6EFF96F45D8BD1D4b3f35c7D',
|
||||
[eEthereumNetwork.tenderly]: '0x8A32f49FFbA88aba6EFF96F45D8BD1D4b3f35c7D',
|
||||
},
|
||||
LendingPoolCollateralManager: {
|
||||
[eEthereumNetwork.coverage]: '',
|
||||
|
@ -163,7 +166,7 @@ export const CommonsConfig: ICommonConfiguration = {
|
|||
[eEthereumNetwork.kovan]: '0x9269b6453d0d75370c4c85e5a42977a53efdb72a',
|
||||
[eEthereumNetwork.ropsten]: '',
|
||||
[eEthereumNetwork.main]: '0xbd4765210d4167CE2A5b87280D9E8Ee316D5EC7C',
|
||||
[eEthereumNetwork.tenderlyMain]: '0xbd4765210d4167CE2A5b87280D9E8Ee316D5EC7C',
|
||||
[eEthereumNetwork.tenderly]: '0xbd4765210d4167CE2A5b87280D9E8Ee316D5EC7C',
|
||||
},
|
||||
LendingPoolConfigurator: {
|
||||
[eEthereumNetwork.coverage]: '',
|
||||
|
@ -172,7 +175,7 @@ export const CommonsConfig: ICommonConfiguration = {
|
|||
[eEthereumNetwork.kovan]: '0x36eB31800aa67a9c50df1d56EE01981A6E14Cce5',
|
||||
[eEthereumNetwork.ropsten]: '',
|
||||
[eEthereumNetwork.main]: '',
|
||||
[eEthereumNetwork.tenderlyMain]: '',
|
||||
[eEthereumNetwork.tenderly]: '',
|
||||
},
|
||||
LendingPool: {
|
||||
[eEthereumNetwork.coverage]: '',
|
||||
|
@ -181,7 +184,7 @@ export const CommonsConfig: ICommonConfiguration = {
|
|||
[eEthereumNetwork.kovan]: '0x78142De7a1930412E9e50dEB3b80dB284c2dFa3A',
|
||||
[eEthereumNetwork.ropsten]: '',
|
||||
[eEthereumNetwork.main]: '',
|
||||
[eEthereumNetwork.tenderlyMain]: '',
|
||||
[eEthereumNetwork.tenderly]: '',
|
||||
},
|
||||
WethGateway: {
|
||||
[eEthereumNetwork.coverage]: '',
|
||||
|
@ -190,7 +193,7 @@ export const CommonsConfig: ICommonConfiguration = {
|
|||
[eEthereumNetwork.kovan]: '0x1c4A1cC35A477aa1cF35DF671d93ACc04d8131E0',
|
||||
[eEthereumNetwork.ropsten]: '',
|
||||
[eEthereumNetwork.main]: '',
|
||||
[eEthereumNetwork.tenderlyMain]: '',
|
||||
[eEthereumNetwork.tenderly]: '',
|
||||
},
|
||||
TokenDistributor: {
|
||||
[eEthereumNetwork.coverage]: '',
|
||||
|
@ -199,7 +202,7 @@ export const CommonsConfig: ICommonConfiguration = {
|
|||
[eEthereumNetwork.kovan]: '0x971efe90088f21dc6a36f610ffed77fc19710708',
|
||||
[eEthereumNetwork.ropsten]: '0xeba2ea67942b8250d870b12750b594696d02fc9c',
|
||||
[eEthereumNetwork.main]: '0xe3d9988f676457123c5fd01297605efdd0cba1ae',
|
||||
[eEthereumNetwork.tenderlyMain]: '0xe3d9988f676457123c5fd01297605efdd0cba1ae',
|
||||
[eEthereumNetwork.tenderly]: '0xe3d9988f676457123c5fd01297605efdd0cba1ae',
|
||||
},
|
||||
AaveOracle: {
|
||||
[eEthereumNetwork.coverage]: '',
|
||||
|
@ -208,7 +211,7 @@ export const CommonsConfig: ICommonConfiguration = {
|
|||
[eEthereumNetwork.kovan]: '0x8fb777d67e9945e2c01936e319057f9d41d559e6', // Need to re-deploy because of onlyOwner
|
||||
[eEthereumNetwork.ropsten]: ZERO_ADDRESS,
|
||||
[eEthereumNetwork.main]: '', //'0xA50ba011c48153De246E5192C8f9258A2ba79Ca9', // Need to re-deploy because of onlyOwner
|
||||
[eEthereumNetwork.tenderlyMain]: '0xA50ba011c48153De246E5192C8f9258A2ba79Ca9',
|
||||
[eEthereumNetwork.tenderly]: '0xA50ba011c48153De246E5192C8f9258A2ba79Ca9',
|
||||
},
|
||||
FallbackOracle: {
|
||||
[eEthereumNetwork.coverage]: '',
|
||||
|
@ -217,7 +220,7 @@ export const CommonsConfig: ICommonConfiguration = {
|
|||
[eEthereumNetwork.kovan]: '0x50913E8E1c650E790F8a1E741FF9B1B1bB251dfe',
|
||||
[eEthereumNetwork.ropsten]: '0xAD1a978cdbb8175b2eaeC47B01404f8AEC5f4F0d',
|
||||
[eEthereumNetwork.main]: ZERO_ADDRESS,
|
||||
[eEthereumNetwork.tenderlyMain]: ZERO_ADDRESS,
|
||||
[eEthereumNetwork.tenderly]: ZERO_ADDRESS,
|
||||
},
|
||||
ChainlinkAggregator: {
|
||||
[eEthereumNetwork.coverage]: {},
|
||||
|
@ -270,7 +273,7 @@ export const CommonsConfig: ICommonConfiguration = {
|
|||
BptBALWETH: '0x2e4e78936b100be6Ef85BCEf7FB25bC770B02B85',
|
||||
USD: '0x9326BFA02ADD2366b30bacB125260Af641031331',
|
||||
},
|
||||
[eEthereumNetwork.tenderlyMain]: {
|
||||
[eEthereumNetwork.tenderly]: {
|
||||
USDT: '0xEe9F2375b4bdF6387aa8265dD4FB8F16512A1d46',
|
||||
WBTC: '0xdeb288F737066589598e9214E782fa5A8eD689e8',
|
||||
USDC: '0x986b5E1e1755e3C2440e960477f25201B0a8bbD4',
|
||||
|
@ -301,7 +304,7 @@ export const CommonsConfig: ICommonConfiguration = {
|
|||
[eEthereumNetwork.main]: {},
|
||||
[eEthereumNetwork.kovan]: {},
|
||||
[eEthereumNetwork.ropsten]: {},
|
||||
[eEthereumNetwork.tenderlyMain]: {},
|
||||
[eEthereumNetwork.tenderly]: {},
|
||||
},
|
||||
ReservesConfig: {},
|
||||
ATokenDomainSeparator: {
|
||||
|
@ -314,7 +317,7 @@ export const CommonsConfig: ICommonConfiguration = {
|
|||
[eEthereumNetwork.kovan]: '',
|
||||
[eEthereumNetwork.ropsten]: '',
|
||||
[eEthereumNetwork.main]: '',
|
||||
[eEthereumNetwork.tenderlyMain]: '',
|
||||
[eEthereumNetwork.tenderly]: '',
|
||||
},
|
||||
WETH: {
|
||||
[eEthereumNetwork.coverage]: '', // deployed in local evm
|
||||
|
@ -323,7 +326,7 @@ export const CommonsConfig: ICommonConfiguration = {
|
|||
[eEthereumNetwork.kovan]: '0xd0a1e359811322d97991e03f863a0c30c2cf029c',
|
||||
[eEthereumNetwork.ropsten]: '0xc778417e063141139fce010982780140aa0cd5ab',
|
||||
[eEthereumNetwork.main]: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
||||
[eEthereumNetwork.tenderlyMain]: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
||||
[eEthereumNetwork.tenderly]: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
||||
},
|
||||
WrappedNativeToken: {
|
||||
[eEthereumNetwork.coverage]: '', // deployed in local evm
|
||||
|
@ -332,7 +335,7 @@ export const CommonsConfig: ICommonConfiguration = {
|
|||
[eEthereumNetwork.kovan]: '0xd0a1e359811322d97991e03f863a0c30c2cf029c',
|
||||
[eEthereumNetwork.ropsten]: '0xc778417e063141139fce010982780140aa0cd5ab',
|
||||
[eEthereumNetwork.main]: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
||||
[eEthereumNetwork.tenderlyMain]: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
||||
[eEthereumNetwork.tenderly]: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
||||
},
|
||||
ReserveFactorTreasuryAddress: {
|
||||
[eEthereumNetwork.coverage]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c',
|
||||
|
@ -341,7 +344,7 @@ export const CommonsConfig: ICommonConfiguration = {
|
|||
[eEthereumNetwork.kovan]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c',
|
||||
[eEthereumNetwork.ropsten]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c',
|
||||
[eEthereumNetwork.main]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c',
|
||||
[eEthereumNetwork.tenderlyMain]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c',
|
||||
[eEthereumNetwork.tenderly]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c',
|
||||
},
|
||||
IncentivesController: {
|
||||
[eEthereumNetwork.coverage]: ZERO_ADDRESS,
|
||||
|
@ -350,6 +353,6 @@ export const CommonsConfig: ICommonConfiguration = {
|
|||
[eEthereumNetwork.kovan]: ZERO_ADDRESS,
|
||||
[eEthereumNetwork.ropsten]: ZERO_ADDRESS,
|
||||
[eEthereumNetwork.main]: ZERO_ADDRESS,
|
||||
[eEthereumNetwork.tenderlyMain]: ZERO_ADDRESS,
|
||||
[eEthereumNetwork.tenderly]: ZERO_ADDRESS,
|
||||
},
|
||||
};
|
||||
|
|
|
@ -83,8 +83,7 @@ export const AmmConfig: IAmmConfiguration = {
|
|||
BptWBTCWETH: '0x110569E3261bC0934dA637b019f6f1b6F50ec574',
|
||||
BptBALWETH: '0xad01D8e0Fa9EAA8Fe76dA30CFb1BCe12707aE6c5',
|
||||
},
|
||||
[eEthereumNetwork.ropsten]: {
|
||||
},
|
||||
[eEthereumNetwork.ropsten]: {},
|
||||
[eEthereumNetwork.main]: {
|
||||
DAI: '0x6B175474E89094C44Da98b954EedeAC495271d0F',
|
||||
USDC: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
|
||||
|
@ -108,7 +107,7 @@ export const AmmConfig: IAmmConfiguration = {
|
|||
BptWBTCWETH: '0x1efF8aF5D577060BA4ac8A29A13525bb0Ee2A3D5',
|
||||
BptBALWETH: '0x59A19D8c652FA0284f44113D0ff9aBa70bd46fB4',
|
||||
},
|
||||
[eEthereumNetwork.tenderlyMain]: {
|
||||
[eEthereumNetwork.tenderly]: {
|
||||
DAI: '0x6B175474E89094C44Da98b954EedeAC495271d0F',
|
||||
USDC: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
|
||||
USDT: '0xdAC17F958D2ee523a2206206994597C13D831ec7',
|
||||
|
|
165
markets/avalanche/commons.ts
Normal file
165
markets/avalanche/commons.ts
Normal file
|
@ -0,0 +1,165 @@
|
|||
import BigNumber from 'bignumber.js';
|
||||
import {
|
||||
oneEther,
|
||||
oneRay,
|
||||
RAY,
|
||||
ZERO_ADDRESS,
|
||||
MOCK_CHAINLINK_AGGREGATORS_PRICES,
|
||||
oneUsd,
|
||||
} from '../../helpers/constants';
|
||||
import { ICommonConfiguration, eAvalancheNetwork } from '../../helpers/types';
|
||||
|
||||
// ----------------
|
||||
// PROTOCOL GLOBAL PARAMS
|
||||
// ----------------
|
||||
|
||||
export const CommonsConfig: ICommonConfiguration = {
|
||||
MarketId: 'Commons',
|
||||
ATokenNamePrefix: 'Aave Avalanche Market',
|
||||
StableDebtTokenNamePrefix: 'Aave Avalanche Market stable debt',
|
||||
VariableDebtTokenNamePrefix: 'Aave Avalanche Market variable debt',
|
||||
SymbolPrefix: 'v',
|
||||
ProviderId: 0, // Overriden in index.ts
|
||||
OracleQuoteCurrency: 'USD',
|
||||
OracleQuoteUnit: oneUsd.toString(),
|
||||
ProtocolGlobalParams: {
|
||||
TokenDistributorPercentageBase: '10000',
|
||||
MockUsdPriceInWei: '5848466240000000',
|
||||
UsdAddress: '0x10F7Fc1F91Ba351f9C629c5947AD69bD03C05b96', // TODO: what is this?
|
||||
NilAddress: '0x0000000000000000000000000000000000000000',
|
||||
OneAddress: '0x0000000000000000000000000000000000000001',
|
||||
AaveReferral: '0',
|
||||
},
|
||||
|
||||
// ----------------
|
||||
// COMMON PROTOCOL PARAMS ACROSS POOLS AND NETWORKS
|
||||
// ----------------
|
||||
|
||||
Mocks: {
|
||||
AllAssetsInitialPrices: {
|
||||
...MOCK_CHAINLINK_AGGREGATORS_PRICES,
|
||||
},
|
||||
},
|
||||
// TODO: reorg alphabetically, checking the reason of tests failing
|
||||
LendingRateOracleRatesCommon: {
|
||||
WETH: {
|
||||
borrowRate: oneRay.multipliedBy(0.03).toFixed(),
|
||||
},
|
||||
DAI: {
|
||||
borrowRate: oneRay.multipliedBy(0.039).toFixed(),
|
||||
},
|
||||
USDC: {
|
||||
borrowRate: oneRay.multipliedBy(0.039).toFixed(),
|
||||
},
|
||||
USDT: {
|
||||
borrowRate: oneRay.multipliedBy(0.035).toFixed(),
|
||||
},
|
||||
AAVE: {
|
||||
borrowRate: oneRay.multipliedBy(0.03).toFixed(),
|
||||
},
|
||||
WBTC: {
|
||||
borrowRate: oneRay.multipliedBy(0.03).toFixed(),
|
||||
},
|
||||
WAVAX: {
|
||||
borrowRate: oneRay.multipliedBy(0.05).toFixed(), // TODO: fix borrowRate?
|
||||
},
|
||||
},
|
||||
// ----------------
|
||||
// COMMON PROTOCOL ADDRESSES ACROSS POOLS
|
||||
// ----------------
|
||||
|
||||
// If PoolAdmin/emergencyAdmin is set, will take priority over PoolAdminIndex/emergencyAdminIndex
|
||||
PoolAdmin: {
|
||||
[eAvalancheNetwork.avalanche]: undefined,
|
||||
[eAvalancheNetwork.fuji]: undefined,
|
||||
},
|
||||
PoolAdminIndex: 0,
|
||||
EmergencyAdminIndex: 0,
|
||||
EmergencyAdmin: {
|
||||
[eAvalancheNetwork.avalanche]: undefined,
|
||||
[eAvalancheNetwork.fuji]: undefined,
|
||||
},
|
||||
ProviderRegistry: {
|
||||
[eAvalancheNetwork.avalanche]: '',
|
||||
[eAvalancheNetwork.fuji]: '0x06eC0BDC3997EE32Cb5B66a1B9C11d92e2C27Aab',
|
||||
},
|
||||
ProviderRegistryOwner: {
|
||||
[eAvalancheNetwork.avalanche]: '',
|
||||
[eAvalancheNetwork.fuji]: '0x1128d177BdaA74Ae68EB06e693f4CbA6BF427a5e',
|
||||
},
|
||||
LendingRateOracle: {
|
||||
[eAvalancheNetwork.avalanche]: '',
|
||||
[eAvalancheNetwork.fuji]: '0xEbBD998B7Dc2a8E675F0859d907c8Fa6027aBc7b',
|
||||
},
|
||||
LendingPoolCollateralManager: {
|
||||
[eAvalancheNetwork.avalanche]: '',
|
||||
[eAvalancheNetwork.fuji]: '0x6242bE2fB5591FA1e81a99e6DD55Ff667fa82a71',
|
||||
},
|
||||
LendingPoolConfigurator: {
|
||||
[eAvalancheNetwork.avalanche]: '',
|
||||
[eAvalancheNetwork.fuji]: '',
|
||||
},
|
||||
LendingPool: {
|
||||
[eAvalancheNetwork.avalanche]: '',
|
||||
[eAvalancheNetwork.fuji]: '0x5f3968A2E41C95A95329333d44AB989de6c43f8E',
|
||||
},
|
||||
WethGateway: {
|
||||
[eAvalancheNetwork.avalanche]: '',
|
||||
[eAvalancheNetwork.fuji]: '0x62AF6258d26838f33BADFbb33cf1De8FaB8EB19f',
|
||||
},
|
||||
TokenDistributor: {
|
||||
[eAvalancheNetwork.avalanche]: '',
|
||||
[eAvalancheNetwork.fuji]: '',
|
||||
},
|
||||
AaveOracle: {
|
||||
[eAvalancheNetwork.avalanche]: '',
|
||||
[eAvalancheNetwork.fuji]: '0xD217DdD9f0Af84644dEFe84a0b634621D4617a29',
|
||||
},
|
||||
FallbackOracle: {
|
||||
[eAvalancheNetwork.avalanche]: ZERO_ADDRESS,
|
||||
[eAvalancheNetwork.fuji]: ZERO_ADDRESS,
|
||||
},
|
||||
ChainlinkAggregator: {
|
||||
[eAvalancheNetwork.avalanche]: {
|
||||
WETH: '0x976B3D034E162d8bD72D6b9C989d545b839003b0',
|
||||
DAI: '0x51D7180edA2260cc4F6e4EebB82FEF5c3c2B8300',
|
||||
USDC: '0xF096872672F44d6EBA71458D74fe67F9a77a23B9',
|
||||
USDT: '0xEBE676ee90Fe1112671f19b6B7459bC678B67e8a',
|
||||
AAVE: '0x3CA13391E9fb38a75330fb28f8cc2eB3D9ceceED',
|
||||
WBTC: '0x2779D32d5166BAaa2B2b658333bA7e6Ec0C65743',
|
||||
WAVAX: '0x0A77230d17318075983913bC2145DB16C7366156',
|
||||
},
|
||||
[eAvalancheNetwork.fuji]: {
|
||||
WETH: '0x86d67c3D38D2bCeE722E601025C25a575021c6EA',
|
||||
USDT: '0x7898AcCC83587C3C55116c5230C17a6Cd9C71bad',
|
||||
WBTC: '0x31CF013A08c6Ac228C94551d535d5BAfE19c602a',
|
||||
WAVAX: '0x5498BB86BC934c8D34FDA08E81D444153d0D06aD',
|
||||
USD: '0x86d67c3D38D2bCeE722E601025C25a575021c6EA',
|
||||
},
|
||||
},
|
||||
ReserveAssets: {
|
||||
[eAvalancheNetwork.avalanche]: {},
|
||||
[eAvalancheNetwork.fuji]: {},
|
||||
},
|
||||
ReservesConfig: {},
|
||||
ATokenDomainSeparator: {
|
||||
[eAvalancheNetwork.avalanche]: '',
|
||||
[eAvalancheNetwork.fuji]: '',
|
||||
},
|
||||
WETH: {
|
||||
[eAvalancheNetwork.avalanche]: '',
|
||||
[eAvalancheNetwork.fuji]: '',
|
||||
},
|
||||
WrappedNativeToken: {
|
||||
[eAvalancheNetwork.avalanche]: '0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7', // Official WAVAX
|
||||
[eAvalancheNetwork.fuji]: '0xd00ae08403B9bbb9124bB305C09058E32C39A48c', // Official WAVAX
|
||||
},
|
||||
ReserveFactorTreasuryAddress: {
|
||||
[eAvalancheNetwork.avalanche]: '0x467b92aF281d14cB6809913AD016a607b5ba8A36',
|
||||
[eAvalancheNetwork.fuji]: '0xB45F5C501A22288dfdb897e5f73E189597e09288', // Self-controlled EOA for testing
|
||||
},
|
||||
IncentivesController: {
|
||||
[eAvalancheNetwork.avalanche]: '0x01D83Fe6A10D2f2B7AF17034343746188272cAc9',
|
||||
[eAvalancheNetwork.fuji]: '0xa1EF206fb9a8D8186157FC817fCddcC47727ED55',
|
||||
},
|
||||
};
|
52
markets/avalanche/index.ts
Normal file
52
markets/avalanche/index.ts
Normal file
|
@ -0,0 +1,52 @@
|
|||
import { eAvalancheNetwork, IAvalancheConfiguration } from '../../helpers/types';
|
||||
|
||||
import { CommonsConfig } from './commons';
|
||||
import {
|
||||
strategyWETH,
|
||||
strategyDAI,
|
||||
strategyUSDC,
|
||||
strategyUSDT,
|
||||
strategyAAVE,
|
||||
strategyWBTC,
|
||||
strategyWAVAX,
|
||||
} from './reservesConfigs';
|
||||
|
||||
// ----------------
|
||||
// POOL--SPECIFIC PARAMS
|
||||
// ----------------
|
||||
|
||||
export const AvalancheConfig: IAvalancheConfiguration = {
|
||||
...CommonsConfig,
|
||||
MarketId: 'Avalanche market',
|
||||
ProviderId: 4,
|
||||
ReservesConfig: {
|
||||
WETH: strategyWETH,
|
||||
DAI: strategyDAI,
|
||||
USDT: strategyUSDT,
|
||||
USDC: strategyUSDC,
|
||||
AAVE: strategyAAVE,
|
||||
WBTC: strategyWBTC,
|
||||
WAVAX: strategyWAVAX,
|
||||
},
|
||||
ReserveAssets: {
|
||||
[eAvalancheNetwork.avalanche]: {
|
||||
WETH: '0x49d5c2bdffac6ce2bfdb6640f4f80f226bc10bab',
|
||||
DAI: '0xd586e7f844cea2f87f50152665bcbc2c279d8d70',
|
||||
USDT: '0xc7198437980c041c805a1edcba50c1ce5db95118',
|
||||
USDC: '0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664',
|
||||
AAVE: '0x63a72806098bd3d9520cc43356dd78afe5d386d9',
|
||||
WBTC: '0x50b7545627a5162f82a992c33b87adc75187b218',
|
||||
WAVAX: '0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7',
|
||||
},
|
||||
[eAvalancheNetwork.fuji]: {
|
||||
WETH: '0x9668f5f55f2712Dd2dfa316256609b516292D554', // MintableERC20 token
|
||||
DAI: '0x51BC2DfB9D12d9dB50C855A5330fBA0faF761D15',
|
||||
USDT: '0x02823f9B469960Bb3b1de0B3746D4b95B7E35543', // MintableERC20 token
|
||||
AAVE: '0x47183584aCbc1C45608d7B61cce1C562Ee180E7e',
|
||||
WBTC: '0x9C1DCacB57ADa1E9e2D3a8280B7cfC7EB936186F', // MintableERC20 token
|
||||
WAVAX: '0xd00ae08403B9bbb9124bB305C09058E32C39A48c', // Official WAVAX
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export default AvalancheConfig;
|
23
markets/avalanche/rateStrategies.ts
Normal file
23
markets/avalanche/rateStrategies.ts
Normal file
|
@ -0,0 +1,23 @@
|
|||
import BigNumber from 'bignumber.js';
|
||||
import { oneRay } from '../../helpers/constants';
|
||||
import { IInterestRateStrategyParams } from '../../helpers/types';
|
||||
|
||||
export const rateStrategyVolatileOne: IInterestRateStrategyParams = {
|
||||
name: 'rateStrategyVolatileOne',
|
||||
optimalUtilizationRate: new BigNumber(0.45).multipliedBy(oneRay).toFixed(),
|
||||
baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(),
|
||||
variableRateSlope1: new BigNumber(0.07).multipliedBy(oneRay).toFixed(),
|
||||
variableRateSlope2: new BigNumber(3).multipliedBy(oneRay).toFixed(),
|
||||
stableRateSlope1: '0',
|
||||
stableRateSlope2: '0',
|
||||
};
|
||||
|
||||
export const rateStrategyStableOne: IInterestRateStrategyParams = {
|
||||
name: 'rateStrategyStableOne',
|
||||
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(),
|
||||
stableRateSlope1: new BigNumber(0.02).multipliedBy(oneRay).toFixed(),
|
||||
stableRateSlope2: new BigNumber(0.75).multipliedBy(oneRay).toFixed(),
|
||||
};
|
87
markets/avalanche/reservesConfigs.ts
Normal file
87
markets/avalanche/reservesConfigs.ts
Normal file
|
@ -0,0 +1,87 @@
|
|||
import { eContractid, IReserveParams } from '../../helpers/types';
|
||||
|
||||
import { rateStrategyStableOne, rateStrategyVolatileOne } from './rateStrategies';
|
||||
|
||||
export const strategyWAVAX: IReserveParams = {
|
||||
strategy: rateStrategyVolatileOne,
|
||||
baseLTVAsCollateral: '5000',
|
||||
liquidationThreshold: '6500',
|
||||
liquidationBonus: '11000',
|
||||
borrowingEnabled: true,
|
||||
stableBorrowRateEnabled: false,
|
||||
reserveDecimals: '18',
|
||||
aTokenImpl: eContractid.AToken,
|
||||
reserveFactor: '1500',
|
||||
};
|
||||
|
||||
export const strategyWETH: IReserveParams = {
|
||||
strategy: rateStrategyVolatileOne,
|
||||
baseLTVAsCollateral: '8000',
|
||||
liquidationThreshold: '8250',
|
||||
liquidationBonus: '10500',
|
||||
borrowingEnabled: true,
|
||||
stableBorrowRateEnabled: false,
|
||||
reserveDecimals: '18',
|
||||
aTokenImpl: eContractid.AToken,
|
||||
reserveFactor: '1000',
|
||||
};
|
||||
|
||||
export const strategyWBTC: IReserveParams = {
|
||||
strategy: rateStrategyVolatileOne,
|
||||
baseLTVAsCollateral: '6000',
|
||||
liquidationThreshold: '7500',
|
||||
liquidationBonus: '10500',
|
||||
borrowingEnabled: true,
|
||||
stableBorrowRateEnabled: false,
|
||||
reserveDecimals: '8',
|
||||
aTokenImpl: eContractid.AToken,
|
||||
reserveFactor: '1000',
|
||||
};
|
||||
|
||||
export const strategyAAVE: IReserveParams = {
|
||||
strategy: rateStrategyVolatileOne,
|
||||
baseLTVAsCollateral: '4000',
|
||||
liquidationThreshold: '6500',
|
||||
liquidationBonus: '11000',
|
||||
borrowingEnabled: false,
|
||||
stableBorrowRateEnabled: false,
|
||||
reserveDecimals: '18',
|
||||
aTokenImpl: eContractid.AToken,
|
||||
reserveFactor: '2000',
|
||||
};
|
||||
|
||||
export const strategyDAI: IReserveParams = {
|
||||
strategy: rateStrategyStableOne,
|
||||
baseLTVAsCollateral: '7500',
|
||||
liquidationThreshold: '8000',
|
||||
liquidationBonus: '10500',
|
||||
borrowingEnabled: true,
|
||||
stableBorrowRateEnabled: false,
|
||||
reserveDecimals: '18',
|
||||
aTokenImpl: eContractid.AToken,
|
||||
reserveFactor: '1000',
|
||||
};
|
||||
|
||||
export const strategyUSDT: IReserveParams = {
|
||||
strategy: rateStrategyStableOne,
|
||||
baseLTVAsCollateral: '0',
|
||||
liquidationThreshold: '0',
|
||||
liquidationBonus: '0',
|
||||
borrowingEnabled: true,
|
||||
stableBorrowRateEnabled: false,
|
||||
reserveDecimals: '6',
|
||||
aTokenImpl: eContractid.AToken,
|
||||
reserveFactor: '1000',
|
||||
};
|
||||
|
||||
export const strategyUSDC: IReserveParams = {
|
||||
strategy: rateStrategyStableOne,
|
||||
baseLTVAsCollateral: '7500',
|
||||
liquidationThreshold: '8000',
|
||||
liquidationBonus: '10500',
|
||||
borrowingEnabled: true,
|
||||
stableBorrowRateEnabled: false,
|
||||
reserveDecimals: '6',
|
||||
aTokenImpl: eContractid.AToken,
|
||||
reserveFactor: '1000',
|
||||
};
|
|
@ -19,6 +19,8 @@ export const CommonsConfig: ICommonConfiguration = {
|
|||
VariableDebtTokenNamePrefix: 'Aave Matic Market variable debt',
|
||||
SymbolPrefix: 'm',
|
||||
ProviderId: 0, // Overriden in index.ts
|
||||
OracleQuoteCurrency: 'ETH',
|
||||
OracleQuoteUnit: oneEther.toString(),
|
||||
ProtocolGlobalParams: {
|
||||
TokenDistributorPercentageBase: '10000',
|
||||
MockUsdPriceInWei: '5848466240000000',
|
||||
|
@ -85,20 +87,20 @@ export const CommonsConfig: ICommonConfiguration = {
|
|||
[ePolygonNetwork.matic]: '',
|
||||
},
|
||||
ProviderRegistry: {
|
||||
[ePolygonNetwork.mumbai]: ZERO_ADDRESS,
|
||||
[ePolygonNetwork.mumbai]: '0xE6ef11C967898F9525D550014FDEdCFAB63536B5',
|
||||
[ePolygonNetwork.matic]: '0x3ac4e9aa29940770aeC38fe853a4bbabb2dA9C19',
|
||||
},
|
||||
ProviderRegistryOwner: {
|
||||
[ePolygonNetwork.mumbai]: '',
|
||||
[ePolygonNetwork.mumbai]: '0x943E44157dC0302a5CEb172374d1749018a00994',
|
||||
[ePolygonNetwork.matic]: '0xD7D86236d6c463521920fCC50A9CB56f8C8Bf008',
|
||||
},
|
||||
LendingRateOracle: {
|
||||
[ePolygonNetwork.mumbai]: '',
|
||||
[ePolygonNetwork.mumbai]: '0xC661e1445F9a8E5FD3C3dbCa0A0A2e8CBc79725D',
|
||||
[ePolygonNetwork.matic]: '0x17F73aEaD876CC4059089ff815EDA37052960dFB',
|
||||
},
|
||||
LendingPoolCollateralManager: {
|
||||
[ePolygonNetwork.mumbai]: '',
|
||||
[ePolygonNetwork.matic]: '',
|
||||
[ePolygonNetwork.mumbai]: '0x2A7004B21c49253ca8DF923406Fed9a02AA86Ba0',
|
||||
[ePolygonNetwork.matic]: '0xA39599424642D9fD35e475EF802EddF798dc555B',
|
||||
},
|
||||
TokenDistributor: {
|
||||
[ePolygonNetwork.mumbai]: '',
|
||||
|
@ -110,7 +112,7 @@ export const CommonsConfig: ICommonConfiguration = {
|
|||
},
|
||||
AaveOracle: {
|
||||
[ePolygonNetwork.mumbai]: '',
|
||||
[ePolygonNetwork.matic]: '0x0229F777B0fAb107F9591a41d5F02E4e98dB6f2d',
|
||||
[ePolygonNetwork.matic]: '',
|
||||
},
|
||||
FallbackOracle: {
|
||||
[ePolygonNetwork.mumbai]: ZERO_ADDRESS,
|
||||
|
@ -132,6 +134,7 @@ export const CommonsConfig: ICommonConfiguration = {
|
|||
USDT: ZERO_ADDRESS,
|
||||
WBTC: ZERO_ADDRESS,
|
||||
WMATIC: ZERO_ADDRESS,
|
||||
USD: ZERO_ADDRESS,
|
||||
},
|
||||
},
|
||||
ReserveAssets: {
|
||||
|
@ -148,7 +151,7 @@ export const CommonsConfig: ICommonConfiguration = {
|
|||
[ePolygonNetwork.matic]: '0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619',
|
||||
},
|
||||
WrappedNativeToken: {
|
||||
[ePolygonNetwork.mumbai]: ZERO_ADDRESS,
|
||||
[ePolygonNetwork.mumbai]: '0x9c3C9283D3e44854697Cd22D3Faa240Cfb032889',
|
||||
[ePolygonNetwork.matic]: '0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270',
|
||||
},
|
||||
ReserveFactorTreasuryAddress: {
|
||||
|
@ -156,7 +159,7 @@ export const CommonsConfig: ICommonConfiguration = {
|
|||
[ePolygonNetwork.matic]: '0x7734280A4337F37Fbf4651073Db7c28C80B339e9',
|
||||
},
|
||||
IncentivesController: {
|
||||
[ePolygonNetwork.mumbai]: ZERO_ADDRESS,
|
||||
[ePolygonNetwork.mumbai]: '0xd41aE58e803Edf4304334acCE4DC4Ec34a63C644',
|
||||
[ePolygonNetwork.matic]: '0x357D51124f59836DeD84c8a1730D72B749d8BC23',
|
||||
},
|
||||
};
|
||||
|
|
|
@ -18,7 +18,7 @@ import {
|
|||
export const MaticConfig: IMaticConfiguration = {
|
||||
...CommonsConfig,
|
||||
MarketId: 'Matic Market',
|
||||
ProviderId: 3, // Unknown?
|
||||
ProviderId: 3,
|
||||
ReservesConfig: {
|
||||
DAI: strategyDAI,
|
||||
USDC: strategyUSDC,
|
||||
|
@ -40,11 +40,11 @@ export const MaticConfig: IMaticConfiguration = {
|
|||
},
|
||||
[ePolygonNetwork.mumbai]: {
|
||||
// Mock tokens with a simple "mint" external function, except wmatic
|
||||
DAI: '0x13b3fda609C1eeb23b4F4b69257840760dCa6C4a',
|
||||
USDC: '0x52b63223994433FdE2F1350Ba69Dfd2779f06ABA',
|
||||
USDT: '0xB3abd1912F586fDFFa13606882c28E27913853d2',
|
||||
WBTC: '0x393E3512d45a956A628124665672312ea86930Ba',
|
||||
WETH: '0x53CDb16B8C031B779e996406546614E5F05BC4Bf',
|
||||
DAI: '0x001B3B4d0F3714Ca98ba10F6042DaEbF0B1B7b6F',
|
||||
USDC: '0x2058A9D7613eEE744279e3856Ef0eAda5FCbaA7e',
|
||||
USDT: '0xBD21A10F619BE90d6066c941b04e340841F1F989',
|
||||
WBTC: '0x0d787a4a1548f673ed375445535a6c7A1EE56180',
|
||||
WETH: '0x3C68CE8504087f89c640D02d133646d98e64ddd9',
|
||||
WMATIC: '0x9c3C9283D3e44854697Cd22D3Faa240Cfb032889',
|
||||
},
|
||||
},
|
||||
|
|
|
@ -19,6 +19,7 @@ export const CommonsConfig: ICommonConfiguration = {
|
|||
VariableDebtTokenNamePrefix: 'Aave XDAI Market variable debt',
|
||||
SymbolPrefix: 'm',
|
||||
ProviderId: 0, // Overriden in index.ts
|
||||
OracleQuoteCurrency: 'ETH',
|
||||
ProtocolGlobalParams: {
|
||||
TokenDistributorPercentageBase: '10000',
|
||||
MockUsdPriceInWei: '5848466240000000',
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
"hardhat:docker": "hardhat --network hardhatevm_docker",
|
||||
"hardhat:mumbai": "hardhat --network mumbai",
|
||||
"hardhat:matic": "hardhat --network matic",
|
||||
"hardhat:fuji": "hardhat --network fuji",
|
||||
"hardhat:avalanche": "hardhat --network avalanche",
|
||||
"compile": "SKIP_LOAD=true hardhat compile",
|
||||
"console:fork": "FORK=main hardhat console",
|
||||
"test": "npm run compile && TS_NODE_TRANSPILE_ONLY=1 hardhat test ./test-suites/test-aave/*.spec.ts",
|
||||
|
@ -30,12 +32,15 @@
|
|||
"aave:kovan:full:migration": "npm run compile && npm run hardhat:kovan -- aave:mainnet --skip-registry",
|
||||
"matic:mumbai:full:migration": "npm run compile && npm run hardhat:mumbai sidechain:mainnet -- --pool Matic --skip-registry",
|
||||
"matic:matic:full:migration": "npm run compile && npm run hardhat:matic sidechain:mainnet -- --pool Matic --skip-registry",
|
||||
"avalanche:fuji:full:migration": "npm run compile && npm run hardhat:fuji avalanche:mainnet -- --pool Avalanche",
|
||||
"amm:kovan:full:migration": "npm run compile && npm run hardhat:kovan -- amm:mainnet --skip-registry",
|
||||
"aave:docker:full:migration:add-registry": "npm run compile && npm run hardhat:docker -- aave:mainnet",
|
||||
"aave:kovan:full:migration:add-registry": "npm run compile && npm run hardhat:kovan -- aave:mainnet",
|
||||
"matic:mumbai:full:migration:add-registry": "npm run compile && npm run hardhat:mumbai sidechain:mainnet -- --pool Matic",
|
||||
"matic:matic:full:migration:add-registry": "npm run compile && npm run hardhat:matic sidechain:mainnet -- --pool Matic",
|
||||
"amm:kovan:full:migration:add-registry": "npm run compile && npm run hardhat:kovan -- amm:mainnet",
|
||||
"avalanche:fuji:full:migration:add-registry": "npm run compile && npm run hardhat:fuji avalanche:mainnet -- --pool Avalanche",
|
||||
"avalanche:mainnet:full:migration:add-registry": "npm run compile && npm run hardhat:avalanche avalanche:mainnet -- --pool Avalanche",
|
||||
"aave:docker:add-market-to-registry-from-config": "npm run compile && npm run hardhat:docker -- add-market-to-registry --pool Aave",
|
||||
"aave:kovan:add-market-to-registry-from-config": "npm run compile && npm run hardhat:kovan -- add-market-to-registry --pool Aave",
|
||||
"matic:mumbai:add-market-to-registry-from-config": "npm run compile && npm run hardhat:mumbai add-market-to-registry --pool Matic",
|
||||
|
@ -73,13 +78,16 @@
|
|||
"main:deployUIProvider": "hardhat --network main deploy-UiPoolDataProvider --verify",
|
||||
"matic:deployUIProvider": "hardhat --network matic deploy-UiPoolDataProvider",
|
||||
"mumbai:deployUIProvider": "hardhat --network mumbai deploy-UiPoolDataProvider",
|
||||
"fuji:deployUIProvider": "hardhat --network fuji deploy-UiPoolDataProvider",
|
||||
"dev:deployUniswapRepayAdapter": "hardhat --network kovan deploy-UniswapRepayAdapter --provider 0x88757f2f99175387aB4C6a4b3067c77A695b0349 --router 0xfcd87315f0e4067070ade8682fcdbc3006631441 --weth 0xd0a1e359811322d97991e03f863a0c30c2cf029c",
|
||||
"dev:UniswapLiquiditySwapAdapter": "hardhat --network kovan deploy-UniswapLiquiditySwapAdapter --provider 0x88757f2f99175387aB4C6a4b3067c77A695b0349 --router 0xfcd87315f0e4067070ade8682fcdbc3006631441 --weth 0xd0a1e359811322d97991e03f863a0c30c2cf029c",
|
||||
"main:deployUniswapRepayAdapter": "hardhat --network main deploy-UniswapRepayAdapter --provider 0xB53C1a33016B2DC2fF3653530bfF1848a515c8c5 --router 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D --weth 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
|
||||
"main:UniswapLiquiditySwapAdapter": "hardhat --network main deploy-UniswapLiquiditySwapAdapter --provider 0xB53C1a33016B2DC2fF3653530bfF1848a515c8c5 --router 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D --weth 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
|
||||
"main:ParaSwapLiquiditySwapAdapter": "hardhat --network main deploy-ParaSwapLiquiditySwapAdapter --provider 0xB53C1a33016B2DC2fF3653530bfF1848a515c8c5 --augustusRegistry 0xa68bEA62Dc4034A689AA0F58A76681433caCa663",
|
||||
"kovan:verify": "npm run hardhat:kovan verify:general -- --all --pool Aave",
|
||||
"ropsten:verify": "npm run hardhat:ropsten verify:general -- --all --pool Aave",
|
||||
"mainnet:verify": "npm run hardhat:main verify:general -- --all --pool Aave",
|
||||
"mainnet:verify:arc": "npm run hardhat:main verify:general -- --all --pool Arc",
|
||||
"matic:mumbai:verify": "npm run hardhat:mumbai verify:general -- --all --pool Matic",
|
||||
"matic:mainnet:verify": "npm run hardhat:matic verify:general -- --all --pool Matic",
|
||||
"matic:mumbai:verify:tokens": "npm run hardhat:mumbai verify:tokens -- --pool Matic",
|
||||
|
|
|
@ -40,7 +40,7 @@ task('add-market-to-registry', 'Adds address provider to registry')
|
|||
) {
|
||||
console.log('- Deploying a new Address Providers Registry:');
|
||||
|
||||
await DRE.run('full:deploy-address-provider-registry', { pool, verify });
|
||||
await DRE.run('full:deploy-address-provider-registry', { verify, pool });
|
||||
|
||||
providerRegistryAddress = (await getLendingPoolAddressesProviderRegistry()).address;
|
||||
providerRegistryOwner = await (await getFirstSigner()).getAddress();
|
||||
|
|
36
tasks/deployments/deploy-ParaSwapLiquiditySwapAdapter.ts
Normal file
36
tasks/deployments/deploy-ParaSwapLiquiditySwapAdapter.ts
Normal file
|
@ -0,0 +1,36 @@
|
|||
import { task } from 'hardhat/config';
|
||||
|
||||
import { ParaSwapLiquiditySwapAdapterFactory } from '../../types';
|
||||
import { verifyContract } from '../../helpers/contracts-helpers';
|
||||
import { getFirstSigner } from '../../helpers/contracts-getters';
|
||||
import { eContractid } from '../../helpers/types';
|
||||
|
||||
const CONTRACT_NAME = 'ParaSwapLiquiditySwapAdapter';
|
||||
|
||||
task(`deploy-${CONTRACT_NAME}`, `Deploys the ${CONTRACT_NAME} contract`)
|
||||
.addParam('provider', 'Address of the LendingPoolAddressesProvider')
|
||||
.addParam('augustusRegistry', 'Address of ParaSwap AugustusRegistry')
|
||||
.addFlag('verify', `Verify ${CONTRACT_NAME} contract via Etherscan API.`)
|
||||
.setAction(async ({ provider, augustusRegistry, verify }, localBRE) => {
|
||||
await localBRE.run('set-DRE');
|
||||
|
||||
if (!localBRE.network.config.chainId) {
|
||||
throw new Error('INVALID_CHAIN_ID');
|
||||
}
|
||||
|
||||
console.log(`\n- ${CONTRACT_NAME} deployment`);
|
||||
const adapter = await new ParaSwapLiquiditySwapAdapterFactory(
|
||||
await getFirstSigner()
|
||||
).deploy(provider, augustusRegistry);
|
||||
await adapter.deployTransaction.wait();
|
||||
console.log(`${CONTRACT_NAME}.address`, adapter.address);
|
||||
|
||||
if (verify) {
|
||||
await verifyContract(eContractid.ParaSwapLiquiditySwapAdapter, adapter, [
|
||||
provider,
|
||||
augustusRegistry,
|
||||
]);
|
||||
}
|
||||
|
||||
console.log(`\tFinished ${CONTRACT_NAME} deployment`);
|
||||
});
|
|
@ -1,5 +1,11 @@
|
|||
import { task } from 'hardhat/config';
|
||||
import { eContractid, eEthereumNetwork, eNetwork, ePolygonNetwork } from '../../helpers/types';
|
||||
import {
|
||||
eAvalancheNetwork,
|
||||
eContractid,
|
||||
eEthereumNetwork,
|
||||
eNetwork,
|
||||
ePolygonNetwork,
|
||||
} from '../../helpers/types';
|
||||
import { deployUiPoolDataProvider } from '../../helpers/contracts-deployments';
|
||||
import { exit } from 'process';
|
||||
|
||||
|
@ -31,6 +37,14 @@ task(`deploy-${eContractid.UiPoolDataProvider}`, `Deploys the UiPoolDataProvider
|
|||
incentivesController: '0xd41aE58e803Edf4304334acCE4DC4Ec34a63C644',
|
||||
aaveOracle: '0xC365C653f7229894F93994CD0b30947Ab69Ff1D5',
|
||||
},
|
||||
[eAvalancheNetwork.fuji]: {
|
||||
incentivesController: '0xa1EF206fb9a8D8186157FC817fCddcC47727ED55',
|
||||
aaveOracle: '0xD217DdD9f0Af84644dEFe84a0b634621D4617a29',
|
||||
},
|
||||
[eAvalancheNetwork.avalanche]: {
|
||||
incentivesController: '0x01D83Fe6A10D2f2B7AF17034343746188272cAc9',
|
||||
aaveOracle: '0xdC336Cd4769f4cC7E9d726DA53e6d3fC710cEB89',
|
||||
},
|
||||
};
|
||||
const supportedNetworks = Object.keys(addressesByNetwork);
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import { task } from 'hardhat/config';
|
||||
import {
|
||||
deployATokenImplementations,
|
||||
deployATokensAndRatesHelper,
|
||||
deployLendingPool,
|
||||
deployLendingPoolConfigurator,
|
||||
|
@ -13,13 +14,15 @@ import {
|
|||
getLendingPoolConfiguratorProxy,
|
||||
} from '../../helpers/contracts-getters';
|
||||
import { insertContractAddressInDb } from '../../helpers/contracts-helpers';
|
||||
import { ConfigNames, loadPoolConfig } from '../../helpers/configuration';
|
||||
|
||||
task('dev:deploy-lending-pool', 'Deploy lending pool for dev enviroment')
|
||||
.addFlag('verify', 'Verify contracts at Etherscan')
|
||||
.setAction(async ({ verify }, localBRE) => {
|
||||
.addParam('pool', `Pool name to retrieve configuration, supported: ${Object.values(ConfigNames)}`)
|
||||
.setAction(async ({ verify, pool }, localBRE) => {
|
||||
await localBRE.run('set-DRE');
|
||||
|
||||
const addressesProvider = await getLendingPoolAddressesProvider();
|
||||
const poolConfig = loadPoolConfig(pool);
|
||||
|
||||
const lendingPoolImpl = await deployLendingPool(verify);
|
||||
|
||||
|
@ -55,4 +58,5 @@ task('dev:deploy-lending-pool', 'Deploy lending pool for dev enviroment')
|
|||
[lendingPoolProxy.address, addressesProvider.address, lendingPoolConfiguratorProxy.address],
|
||||
verify
|
||||
);
|
||||
await deployATokenImplementations(pool, poolConfig.ReservesConfig, verify);
|
||||
});
|
||||
|
|
|
@ -12,14 +12,14 @@ import {
|
|||
import { ICommonConfiguration, iAssetBase, TokenContractId } from '../../helpers/types';
|
||||
import { waitForTx } from '../../helpers/misc-utils';
|
||||
import { getAllAggregatorsAddresses, getAllTokenAddresses } from '../../helpers/mock-helpers';
|
||||
import { ConfigNames, loadPoolConfig, getWethAddress } from '../../helpers/configuration';
|
||||
import { ConfigNames, loadPoolConfig, getQuoteCurrency } from '../../helpers/configuration';
|
||||
import {
|
||||
getAllMockedTokens,
|
||||
getLendingPoolAddressesProvider,
|
||||
getPairsTokenAggregator,
|
||||
} from '../../helpers/contracts-getters';
|
||||
|
||||
task('dev:deploy-oracles', 'Deploy oracles for dev enviroment')
|
||||
task('dev:deploy-oracles', 'Deploy oracles for dev environment')
|
||||
.addFlag('verify', 'Verify contracts at Etherscan')
|
||||
.addParam('pool', `Pool name to retrieve configuration, supported: ${Object.values(ConfigNames)}`)
|
||||
.setAction(async ({ verify, pool }, localBRE) => {
|
||||
|
@ -29,6 +29,8 @@ task('dev:deploy-oracles', 'Deploy oracles for dev enviroment')
|
|||
Mocks: { AllAssetsInitialPrices },
|
||||
ProtocolGlobalParams: { UsdAddress, MockUsdPriceInWei },
|
||||
LendingRateOracleRatesCommon,
|
||||
OracleQuoteCurrency,
|
||||
OracleQuoteUnit,
|
||||
} = poolConfig as ICommonConfiguration;
|
||||
|
||||
const defaultTokenList = {
|
||||
|
@ -54,11 +56,18 @@ task('dev:deploy-oracles', 'Deploy oracles for dev enviroment')
|
|||
|
||||
const [tokens, aggregators] = getPairsTokenAggregator(
|
||||
allTokenAddresses,
|
||||
allAggregatorsAddresses
|
||||
allAggregatorsAddresses,
|
||||
OracleQuoteCurrency
|
||||
);
|
||||
|
||||
await deployAaveOracle(
|
||||
[tokens, aggregators, fallbackOracle.address, await getWethAddress(poolConfig)],
|
||||
[
|
||||
tokens,
|
||||
aggregators,
|
||||
fallbackOracle.address,
|
||||
await getQuoteCurrency(poolConfig),
|
||||
OracleQuoteUnit,
|
||||
],
|
||||
verify
|
||||
);
|
||||
await waitForTx(await addressesProvider.setPriceOracle(fallbackOracle.address));
|
||||
|
|
|
@ -40,6 +40,7 @@ task('dev:initialize-lending-pool', 'Initialize lending pool configuration.')
|
|||
VariableDebtTokenNamePrefix,
|
||||
SymbolPrefix,
|
||||
WethGateway,
|
||||
ReservesConfig,
|
||||
} = poolConfig;
|
||||
const mockTokens = await getAllMockedTokens();
|
||||
const allTokenAddresses = getAllTokenAddresses(mockTokens);
|
||||
|
@ -52,14 +53,12 @@ task('dev:initialize-lending-pool', 'Initialize lending pool configuration.')
|
|||
|
||||
const testHelpers = await deployAaveProtocolDataProvider(addressesProvider.address, verify);
|
||||
|
||||
const reservesParams = getReservesConfigByPool(AavePools.proto);
|
||||
|
||||
const admin = await addressesProvider.getPoolAdmin();
|
||||
|
||||
const treasuryAddress = await getTreasuryAddress(poolConfig);
|
||||
|
||||
await initReservesByHelper(
|
||||
reservesParams,
|
||||
ReservesConfig,
|
||||
protoPoolReservesAddresses,
|
||||
ATokenNamePrefix,
|
||||
StableDebtTokenNamePrefix,
|
||||
|
@ -68,9 +67,10 @@ task('dev:initialize-lending-pool', 'Initialize lending pool configuration.')
|
|||
admin,
|
||||
treasuryAddress,
|
||||
ZERO_ADDRESS,
|
||||
pool,
|
||||
verify
|
||||
);
|
||||
await configureReservesByHelper(reservesParams, protoPoolReservesAddresses, testHelpers, admin);
|
||||
await configureReservesByHelper(ReservesConfig, protoPoolReservesAddresses, testHelpers, admin);
|
||||
|
||||
const collateralManager = await deployLendingPoolCollateralManager(verify);
|
||||
await waitForTx(
|
||||
|
|
|
@ -11,11 +11,14 @@ task('full:deploy-address-provider-registry', 'Deploy address provider registry'
|
|||
.addFlag('verify', 'Verify contracts at Etherscan')
|
||||
.addParam('pool', `Pool name to retrieve configuration, supported: ${Object.values(ConfigNames)}`)
|
||||
.setAction(async ({ verify, pool }, DRE) => {
|
||||
console.log('prior dre');
|
||||
await DRE.run('set-DRE');
|
||||
const poolConfig = loadPoolConfig(pool);
|
||||
const network = <eNetwork>DRE.network.name;
|
||||
const signer = await getFirstSigner();
|
||||
|
||||
console.log('Deployer:', await signer.getAddress(), formatEther(await signer.getBalance()));
|
||||
|
||||
const providerRegistryAddress = getParamPerNetwork(poolConfig.ProviderRegistry, network);
|
||||
|
||||
console.log('Signer', await signer.getAddress());
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { task } from 'hardhat/config';
|
||||
import { getParamPerNetwork, insertContractAddressInDb } from '../../helpers/contracts-helpers';
|
||||
import {
|
||||
deployATokenImplementations,
|
||||
deployATokensAndRatesHelper,
|
||||
deployLendingPool,
|
||||
deployLendingPoolConfigurator,
|
||||
|
@ -14,7 +15,12 @@ import {
|
|||
getLendingPoolConfiguratorProxy,
|
||||
} from '../../helpers/contracts-getters';
|
||||
import { HardhatRuntimeEnvironment } from 'hardhat/types';
|
||||
import { loadPoolConfig, ConfigNames } from '../../helpers/configuration';
|
||||
import {
|
||||
loadPoolConfig,
|
||||
ConfigNames,
|
||||
getGenesisPoolAdmin,
|
||||
getEmergencyAdmin,
|
||||
} from '../../helpers/configuration';
|
||||
|
||||
task('full:deploy-lending-pool', 'Deploy lending pool for dev environment')
|
||||
.addFlag('verify', 'Verify contracts at Etherscan')
|
||||
|
@ -69,6 +75,10 @@ task('full:deploy-lending-pool', 'Deploy lending pool for dev environment')
|
|||
eContractid.LendingPoolConfigurator,
|
||||
lendingPoolConfiguratorProxy.address
|
||||
);
|
||||
const admin = await DRE.ethers.getSigner(await getEmergencyAdmin(poolConfig));
|
||||
// Pause market during deployment
|
||||
await waitForTx(await lendingPoolConfiguratorProxy.connect(admin).setPoolPause(true));
|
||||
|
||||
// Deploy deployment helpers
|
||||
await deployStableAndVariableTokensHelper(
|
||||
[lendingPoolProxy.address, addressesProvider.address],
|
||||
|
@ -78,11 +88,12 @@ task('full:deploy-lending-pool', 'Deploy lending pool for dev environment')
|
|||
[lendingPoolProxy.address, addressesProvider.address, lendingPoolConfiguratorProxy.address],
|
||||
verify
|
||||
);
|
||||
await deployATokenImplementations(pool, poolConfig.ReservesConfig, verify);
|
||||
} catch (error) {
|
||||
if (DRE.network.name.includes('tenderly')) {
|
||||
const transactionLink = `https://dashboard.tenderly.co/${DRE.config.tenderly.username}/${
|
||||
DRE.config.tenderly.project
|
||||
}/fork/${DRE.tenderlyNetwork.getFork()}/simulation/${DRE.tenderlyNetwork.getHead()}`;
|
||||
}/fork/${DRE.tenderly.network().getFork()}/simulation/${DRE.tenderly.network().getHead()}`;
|
||||
console.error('Check tx error:', transactionLink);
|
||||
}
|
||||
throw error;
|
||||
|
|
|
@ -7,9 +7,9 @@ import { waitForTx, notFalsyOrZeroAddress } from '../../helpers/misc-utils';
|
|||
import {
|
||||
ConfigNames,
|
||||
loadPoolConfig,
|
||||
getWethAddress,
|
||||
getGenesisPoolAdmin,
|
||||
getLendingRateOracles,
|
||||
getQuoteCurrency,
|
||||
} from '../../helpers/configuration';
|
||||
import {
|
||||
getAaveOracle,
|
||||
|
@ -46,16 +46,27 @@ task('full:deploy-oracles', 'Deploy oracles for dev enviroment')
|
|||
...reserveAssets,
|
||||
USD: UsdAddress,
|
||||
};
|
||||
const [tokens, aggregators] = getPairsTokenAggregator(tokensToWatch, chainlinkAggregators);
|
||||
const [tokens, aggregators] = getPairsTokenAggregator(
|
||||
tokensToWatch,
|
||||
chainlinkAggregators,
|
||||
poolConfig.OracleQuoteCurrency
|
||||
);
|
||||
|
||||
let aaveOracle: AaveOracle;
|
||||
let lendingRateOracle: LendingRateOracle;
|
||||
|
||||
if (notFalsyOrZeroAddress(aaveOracleAddress)) {
|
||||
aaveOracle = await await getAaveOracle(aaveOracleAddress);
|
||||
await waitForTx(await aaveOracle.setAssetSources(tokens, aggregators));
|
||||
} else {
|
||||
aaveOracle = await deployAaveOracle(
|
||||
[tokens, aggregators, fallbackOracleAddress, await getWethAddress(poolConfig)],
|
||||
[
|
||||
tokens,
|
||||
aggregators,
|
||||
fallbackOracleAddress,
|
||||
await getQuoteCurrency(poolConfig),
|
||||
poolConfig.OracleQuoteUnit,
|
||||
],
|
||||
verify
|
||||
);
|
||||
await waitForTx(await aaveOracle.setAssetSources(tokens, aggregators));
|
||||
|
@ -74,7 +85,7 @@ task('full:deploy-oracles', 'Deploy oracles for dev enviroment')
|
|||
);
|
||||
}
|
||||
|
||||
console.log('Aave Oracle: %s', lendingRateOracle.address);
|
||||
console.log('Aave Oracle: %s', aaveOracle.address);
|
||||
console.log('Lending Rate Oracle: %s', lendingRateOracle.address);
|
||||
|
||||
// Register the proxy price provider on the addressesProvider
|
||||
|
@ -84,7 +95,7 @@ task('full:deploy-oracles', 'Deploy oracles for dev enviroment')
|
|||
if (DRE.network.name.includes('tenderly')) {
|
||||
const transactionLink = `https://dashboard.tenderly.co/${DRE.config.tenderly.username}/${
|
||||
DRE.config.tenderly.project
|
||||
}/fork/${DRE.tenderlyNetwork.getFork()}/simulation/${DRE.tenderlyNetwork.getHead()}`;
|
||||
}/fork/${DRE.tenderly.network().getFork()}/simulation/${DRE.tenderly.network().getHead()}`;
|
||||
console.error('Check tx error:', transactionLink);
|
||||
}
|
||||
throw error;
|
||||
|
|
|
@ -3,8 +3,8 @@ import { getParamPerNetwork } from '../../helpers/contracts-helpers';
|
|||
import {
|
||||
deployLendingPoolCollateralManager,
|
||||
deployWalletBalancerProvider,
|
||||
deployWETHGateway,
|
||||
authorizeWETHGateway,
|
||||
deployUiPoolDataProvider,
|
||||
} from '../../helpers/contracts-deployments';
|
||||
import {
|
||||
loadPoolConfig,
|
||||
|
@ -50,6 +50,8 @@ task('full:initialize-lending-pool', 'Initialize lending pool configuration.')
|
|||
const testHelpers = await getAaveProtocolDataProvider();
|
||||
|
||||
const admin = await addressesProvider.getPoolAdmin();
|
||||
const oracle = await addressesProvider.getPriceOracle();
|
||||
|
||||
if (!reserveAssets) {
|
||||
throw 'Reserve assets is undefined. Check ReserveAssets configuration at config directory';
|
||||
}
|
||||
|
@ -66,6 +68,7 @@ task('full:initialize-lending-pool', 'Initialize lending pool configuration.')
|
|||
admin,
|
||||
treasuryAddress,
|
||||
incentivesController,
|
||||
pool,
|
||||
verify
|
||||
);
|
||||
await configureReservesByHelper(ReservesConfig, reserveAssets, testHelpers, admin);
|
||||
|
@ -102,6 +105,12 @@ task('full:initialize-lending-pool', 'Initialize lending pool configuration.')
|
|||
|
||||
await deployWalletBalancerProvider(verify);
|
||||
|
||||
const uiPoolDataProvider = await deployUiPoolDataProvider(
|
||||
[incentivesController, oracle],
|
||||
verify
|
||||
);
|
||||
console.log('UiPoolDataProvider deployed at:', uiPoolDataProvider.address);
|
||||
|
||||
const lendingPoolAddress = await addressesProvider.getLendingPool();
|
||||
|
||||
let gateWay = getParamPerNetwork(WethGateway, network);
|
||||
|
|
|
@ -3,9 +3,9 @@ import { eEthereumNetwork } from '../../helpers/types';
|
|||
import { getTreasuryAddress } from '../../helpers/configuration';
|
||||
import * as marketConfigs from '../../markets/aave';
|
||||
import * as reserveConfigs from '../../markets/aave/reservesConfigs';
|
||||
import { chooseATokenDeployment } from '../../helpers/init-helpers';
|
||||
import { getLendingPoolAddressesProvider } from './../../helpers/contracts-getters';
|
||||
import {
|
||||
chooseATokenDeployment,
|
||||
deployDefaultReserveInterestRateStrategy,
|
||||
deployStableDebtToken,
|
||||
deployVariableDebtToken,
|
||||
|
@ -47,18 +47,7 @@ WRONG RESERVE ASSET SETUP:
|
|||
LENDING_POOL_ADDRESS_PROVIDER[network]
|
||||
);
|
||||
const poolAddress = await addressProvider.getLendingPool();
|
||||
const treasuryAddress = await getTreasuryAddress(marketConfigs.AaveConfig);
|
||||
const aToken = await deployCustomAToken(
|
||||
[
|
||||
poolAddress,
|
||||
reserveAssetAddress,
|
||||
treasuryAddress,
|
||||
ZERO_ADDRESS, // Incentives Controller
|
||||
`Aave interest bearing ${symbol}`,
|
||||
`a${symbol}`,
|
||||
],
|
||||
verify
|
||||
);
|
||||
const aToken = await deployCustomAToken(verify);
|
||||
const stableDebt = await deployStableDebtToken(
|
||||
[
|
||||
poolAddress,
|
||||
|
|
|
@ -24,7 +24,7 @@ task('aave:dev', 'Deploy development enviroment')
|
|||
await localBRE.run('dev:deploy-address-provider', { verify });
|
||||
|
||||
console.log('3. Deploy lending pool');
|
||||
await localBRE.run('dev:deploy-lending-pool', { verify });
|
||||
await localBRE.run('dev:deploy-lending-pool', { verify, pool: POOL_NAME });
|
||||
|
||||
console.log('4. Deploy oracles');
|
||||
await localBRE.run('dev:deploy-oracles', { verify, pool: POOL_NAME });
|
||||
|
|
60
tasks/migrations/avalanche.mainnet.ts
Normal file
60
tasks/migrations/avalanche.mainnet.ts
Normal file
|
@ -0,0 +1,60 @@
|
|||
import { task } from 'hardhat/config';
|
||||
import { checkVerification } from '../../helpers/etherscan-verification';
|
||||
import { ConfigNames } from '../../helpers/configuration';
|
||||
import { printContracts } from '../../helpers/misc-utils';
|
||||
import { usingTenderly } from '../../helpers/tenderly-utils';
|
||||
|
||||
task('avalanche:mainnet', 'Deploy market at avalanche')
|
||||
.addParam('pool', `Market pool configuration, one of ${Object.keys(ConfigNames)}`)
|
||||
.addFlag('verify', 'Verify contracts at Etherscan')
|
||||
.addFlag('skipRegistry', 'Skip addresses provider registration at Addresses Provider Registry')
|
||||
.setAction(async ({ verify, pool, skipRegistry }, DRE) => {
|
||||
const POOL_NAME = pool;
|
||||
await DRE.run('set-DRE');
|
||||
|
||||
// Prevent loss of gas verifying all the needed ENVs for Etherscan verification
|
||||
if (verify) {
|
||||
checkVerification();
|
||||
}
|
||||
|
||||
console.log('Migration started\n');
|
||||
|
||||
console.log('0. Deploy address provider registry');
|
||||
await DRE.run('full:deploy-address-provider-registry', { pool: POOL_NAME });
|
||||
|
||||
console.log('1. Deploy address provider');
|
||||
await DRE.run('full:deploy-address-provider', { pool: POOL_NAME, skipRegistry });
|
||||
|
||||
console.log('2. Deploy lending pool');
|
||||
await DRE.run('full:deploy-lending-pool', { pool: POOL_NAME });
|
||||
|
||||
console.log('3. Deploy oracles');
|
||||
await DRE.run('full:deploy-oracles', { pool: POOL_NAME });
|
||||
|
||||
console.log('4. Deploy Data Provider');
|
||||
await DRE.run('full:data-provider', { pool: POOL_NAME });
|
||||
console.log('5. Deploy WETH Gateway');
|
||||
await DRE.run('full-deploy-weth-gateway', { pool: POOL_NAME });
|
||||
|
||||
console.log('6. Initialize lending pool');
|
||||
await DRE.run('full:initialize-lending-pool', { pool: POOL_NAME });
|
||||
|
||||
if (verify) {
|
||||
printContracts();
|
||||
console.log('7. Veryfing contracts');
|
||||
await DRE.run('verify:general', { all: true, pool: POOL_NAME });
|
||||
|
||||
console.log('8. Veryfing aTokens and debtTokens');
|
||||
await DRE.run('verify:tokens', { pool: POOL_NAME });
|
||||
}
|
||||
|
||||
if (usingTenderly()) {
|
||||
const postDeployHead = DRE.tenderlyNetwork.getHead();
|
||||
const postDeployFork = DRE.tenderlyNetwork.getFork();
|
||||
console.log('Tenderly Info');
|
||||
console.log('- Head', postDeployHead);
|
||||
console.log('- Fork', postDeployFork);
|
||||
}
|
||||
console.log('\nFinished migrations');
|
||||
printContracts();
|
||||
});
|
|
@ -1,11 +1,9 @@
|
|||
import { error } from 'console';
|
||||
import { zeroAddress } from 'ethereumjs-util';
|
||||
import { task } from 'hardhat/config';
|
||||
import {
|
||||
loadPoolConfig,
|
||||
ConfigNames,
|
||||
getWethAddress,
|
||||
getTreasuryAddress,
|
||||
getWrappedNativeTokenAddress,
|
||||
} from '../../helpers/configuration';
|
||||
import { ZERO_ADDRESS } from '../../helpers/constants';
|
||||
import {
|
||||
|
@ -22,6 +20,7 @@ import {
|
|||
getProxy,
|
||||
getWalletProvider,
|
||||
getWETHGateway,
|
||||
getPermissionedWETHGateway,
|
||||
} from '../../helpers/contracts-getters';
|
||||
import { verifyContract, getParamPerNetwork } from '../../helpers/contracts-helpers';
|
||||
import { notFalsyOrZeroAddress } from '../../helpers/misc-utils';
|
||||
|
@ -53,7 +52,8 @@ task('verify:general', 'Verify contracts at Etherscan')
|
|||
: await getLendingPoolAddressesProviderRegistry();
|
||||
const lendingPoolAddress = await addressesProvider.getLendingPool();
|
||||
const lendingPoolConfiguratorAddress = await addressesProvider.getLendingPoolConfigurator(); //getLendingPoolConfiguratorProxy();
|
||||
const lendingPoolCollateralManagerAddress = await addressesProvider.getLendingPoolCollateralManager();
|
||||
const lendingPoolCollateralManagerAddress =
|
||||
await addressesProvider.getLendingPoolCollateralManager();
|
||||
|
||||
const lendingPoolProxy = await getProxy(lendingPoolAddress);
|
||||
const lendingPoolConfiguratorProxy = await getProxy(lendingPoolConfiguratorAddress);
|
||||
|
@ -87,10 +87,13 @@ task('verify:general', 'Verify contracts at Etherscan')
|
|||
const walletProvider = await getWalletProvider();
|
||||
|
||||
const wethGatewayAddress = getParamPerNetwork(WethGateway, network);
|
||||
|
||||
const wethGateway = notFalsyOrZeroAddress(wethGatewayAddress)
|
||||
? await getWETHGateway(wethGatewayAddress)
|
||||
: await getWETHGateway();
|
||||
|
||||
/*
|
||||
const permissionedWethGateway = await getPermissionedWETHGateway();
|
||||
*/
|
||||
// Address Provider
|
||||
console.log('\n- Verifying address provider...\n');
|
||||
await verifyContract(eContractid.LendingPoolAddressesProvider, addressesProvider, [MarketId]);
|
||||
|
@ -132,7 +135,7 @@ task('verify:general', 'Verify contracts at Etherscan')
|
|||
// WETHGateway
|
||||
console.log('\n- Verifying WETHGateway...\n');
|
||||
await verifyContract(eContractid.WETHGateway, wethGateway, [
|
||||
await getWethAddress(poolConfig),
|
||||
await getWrappedNativeTokenAddress(poolConfig),
|
||||
]);
|
||||
}
|
||||
// Lending Pool proxy
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
import { task } from 'hardhat/config';
|
||||
import {
|
||||
loadPoolConfig,
|
||||
ConfigNames,
|
||||
getWethAddress,
|
||||
getTreasuryAddress,
|
||||
} from '../../helpers/configuration';
|
||||
import { loadPoolConfig, ConfigNames, getTreasuryAddress } from '../../helpers/configuration';
|
||||
import { ZERO_ADDRESS } from '../../helpers/constants';
|
||||
import {
|
||||
getAddressById,
|
||||
|
|
|
@ -13,7 +13,6 @@ import {
|
|||
deployLendingPoolConfigurator,
|
||||
deployLendingPool,
|
||||
deployPriceOracle,
|
||||
deployAaveOracle,
|
||||
deployLendingPoolCollateralManager,
|
||||
deployMockFlashLoanReceiver,
|
||||
deployWalletBalancerProvider,
|
||||
|
@ -27,9 +26,13 @@ import {
|
|||
deployUniswapLiquiditySwapAdapter,
|
||||
deployUniswapRepayAdapter,
|
||||
deployFlashLiquidationAdapter,
|
||||
deployMockParaSwapAugustus,
|
||||
deployMockParaSwapAugustusRegistry,
|
||||
deployParaSwapLiquiditySwapAdapter,
|
||||
authorizeWETHGateway,
|
||||
deployATokenImplementations,
|
||||
deployAaveOracle,
|
||||
} from '../../helpers/contracts-deployments';
|
||||
import { eEthereumNetwork } from '../../helpers/types';
|
||||
import { Signer } from 'ethers';
|
||||
import { TokenContractId, eContractid, tEthereumAddress, AavePools } from '../../helpers/types';
|
||||
import { MintableERC20 } from '../../types/MintableERC20';
|
||||
|
@ -49,7 +52,7 @@ import {
|
|||
import { DRE, waitForTx } from '../../helpers/misc-utils';
|
||||
import { initReservesByHelper, configureReservesByHelper } from '../../helpers/init-helpers';
|
||||
import AaveConfig from '../../markets/aave';
|
||||
import { ZERO_ADDRESS } from '../../helpers/constants';
|
||||
import { oneEther, ZERO_ADDRESS } from '../../helpers/constants';
|
||||
import {
|
||||
getLendingPool,
|
||||
getLendingPoolConfiguratorProxy,
|
||||
|
@ -60,7 +63,6 @@ import { WETH9Mocked } from '../../types/WETH9Mocked';
|
|||
const MOCK_USD_PRICE_IN_WEI = AaveConfig.ProtocolGlobalParams.MockUsdPriceInWei;
|
||||
const ALL_ASSETS_INITIAL_PRICES = AaveConfig.Mocks.AllAssetsInitialPrices;
|
||||
const USD_ADDRESS = AaveConfig.ProtocolGlobalParams.UsdAddress;
|
||||
const MOCK_CHAINLINK_AGGREGATORS_PRICES = AaveConfig.Mocks.AllAssetsInitialPrices;
|
||||
const LENDING_RATE_ORACLE_RATES_COMMON = AaveConfig.LendingRateOracleRatesCommon;
|
||||
|
||||
const deployAllMockTokens = async (deployer: Signer) => {
|
||||
|
@ -96,9 +98,13 @@ const deployAllMockTokens = async (deployer: Signer) => {
|
|||
const buildTestEnv = async (deployer: Signer, secondaryWallet: Signer) => {
|
||||
console.time('setup');
|
||||
const aaveAdmin = await deployer.getAddress();
|
||||
const config = loadPoolConfig(ConfigNames.Aave);
|
||||
|
||||
const mockTokens = await deployAllMockTokens(deployer);
|
||||
console.log('Deployed mocks');
|
||||
const mockTokens: {
|
||||
[symbol: string]: MockContract | MintableERC20 | WETH9Mocked;
|
||||
} = {
|
||||
...(await deployAllMockTokens(deployer)),
|
||||
};
|
||||
const addressesProvider = await deployLendingPoolAddressesProvider(AaveConfig.MarketId);
|
||||
await waitForTx(await addressesProvider.setPoolAdmin(aaveAdmin));
|
||||
|
||||
|
@ -191,12 +197,12 @@ const buildTestEnv = async (deployer: Signer, secondaryWallet: Signer) => {
|
|||
USD: USD_ADDRESS,
|
||||
STAKE: mockTokens.STAKE.address,
|
||||
xSUSHI: mockTokens.xSUSHI.address,
|
||||
WAVAX: mockTokens.WAVAX.address,
|
||||
},
|
||||
fallbackOracle
|
||||
);
|
||||
|
||||
const mockAggregators = await deployAllMockAggregators(MOCK_CHAINLINK_AGGREGATORS_PRICES);
|
||||
console.log('Mock aggs deployed');
|
||||
const mockAggregators = await deployAllMockAggregators(ALL_ASSETS_INITIAL_PRICES);
|
||||
const allTokenAddresses = Object.entries(mockTokens).reduce(
|
||||
(accum: { [tokenSymbol: string]: tEthereumAddress }, [tokenSymbol, tokenContract]) => ({
|
||||
...accum,
|
||||
|
@ -212,9 +218,19 @@ const buildTestEnv = async (deployer: Signer, secondaryWallet: Signer) => {
|
|||
{}
|
||||
);
|
||||
|
||||
const [tokens, aggregators] = getPairsTokenAggregator(allTokenAddresses, allAggregatorsAddresses);
|
||||
const [tokens, aggregators] = getPairsTokenAggregator(
|
||||
allTokenAddresses,
|
||||
allAggregatorsAddresses,
|
||||
config.OracleQuoteCurrency
|
||||
);
|
||||
|
||||
await deployAaveOracle([tokens, aggregators, fallbackOracle.address, mockTokens.WETH.address]);
|
||||
await deployAaveOracle([
|
||||
tokens,
|
||||
aggregators,
|
||||
fallbackOracle.address,
|
||||
mockTokens.WETH.address,
|
||||
oneEther.toString(),
|
||||
]);
|
||||
await waitForTx(await addressesProvider.setPriceOracle(fallbackOracle.address));
|
||||
|
||||
const lendingRateOracle = await deployLendingRateOracle();
|
||||
|
@ -231,23 +247,19 @@ const buildTestEnv = async (deployer: Signer, secondaryWallet: Signer) => {
|
|||
aaveAdmin
|
||||
);
|
||||
|
||||
const reservesParams = getReservesConfigByPool(AavePools.proto);
|
||||
// Reserve params from AAVE pool + mocked tokens
|
||||
const reservesParams = {
|
||||
...config.ReservesConfig,
|
||||
};
|
||||
|
||||
const testHelpers = await deployAaveProtocolDataProvider(addressesProvider.address);
|
||||
|
||||
await insertContractAddressInDb(eContractid.AaveProtocolDataProvider, testHelpers.address);
|
||||
await deployATokenImplementations(ConfigNames.Aave, reservesParams, false);
|
||||
|
||||
const admin = await deployer.getAddress();
|
||||
|
||||
console.log('Initialize configuration');
|
||||
|
||||
const config = loadPoolConfig(ConfigNames.Aave);
|
||||
|
||||
const {
|
||||
ATokenNamePrefix,
|
||||
StableDebtTokenNamePrefix,
|
||||
VariableDebtTokenNamePrefix,
|
||||
SymbolPrefix,
|
||||
} = config;
|
||||
const { ATokenNamePrefix, StableDebtTokenNamePrefix, VariableDebtTokenNamePrefix, SymbolPrefix } =
|
||||
config;
|
||||
const treasuryAddress = await getTreasuryAddress(config);
|
||||
|
||||
await initReservesByHelper(
|
||||
|
@ -260,6 +272,7 @@ const buildTestEnv = async (deployer: Signer, secondaryWallet: Signer) => {
|
|||
admin,
|
||||
treasuryAddress,
|
||||
ZERO_ADDRESS,
|
||||
ConfigNames.Aave,
|
||||
false
|
||||
);
|
||||
|
||||
|
@ -283,6 +296,12 @@ const buildTestEnv = async (deployer: Signer, secondaryWallet: Signer) => {
|
|||
await deployUniswapRepayAdapter(adapterParams);
|
||||
await deployFlashLiquidationAdapter(adapterParams);
|
||||
|
||||
const augustus = await deployMockParaSwapAugustus();
|
||||
|
||||
const augustusRegistry = await deployMockParaSwapAugustusRegistry([augustus.address]);
|
||||
|
||||
await deployParaSwapLiquiditySwapAdapter([addressesProvider.address, augustusRegistry.address]);
|
||||
|
||||
await deployWalletBalancerProvider();
|
||||
|
||||
const gateWay = await deployWETHGateway([mockTokens.WETH.address]);
|
||||
|
@ -297,7 +316,7 @@ before(async () => {
|
|||
const FORK = process.env.FORK;
|
||||
|
||||
if (FORK) {
|
||||
await rawBRE.run('aave:mainnet');
|
||||
await rawBRE.run('aave:mainnet', { skipRegistry: true });
|
||||
} else {
|
||||
console.log('-> Deploying test environment...');
|
||||
await buildTestEnv(deployer, secondaryWallet);
|
||||
|
|
|
@ -14,6 +14,7 @@ import {
|
|||
getUniswapLiquiditySwapAdapter,
|
||||
getUniswapRepayAdapter,
|
||||
getFlashLiquidationAdapter,
|
||||
getParaSwapLiquiditySwapAdapter,
|
||||
} from '../../../helpers/contracts-getters';
|
||||
import { eEthereumNetwork, eNetwork, tEthereumAddress } from '../../../helpers/types';
|
||||
import { LendingPool } from '../../../types/LendingPool';
|
||||
|
@ -32,6 +33,7 @@ import { LendingPoolAddressesProviderRegistry } from '../../../types/LendingPool
|
|||
import { getEthersSigners } from '../../../helpers/contracts-helpers';
|
||||
import { UniswapLiquiditySwapAdapter } from '../../../types/UniswapLiquiditySwapAdapter';
|
||||
import { UniswapRepayAdapter } from '../../../types/UniswapRepayAdapter';
|
||||
import { ParaSwapLiquiditySwapAdapter } from '../../../types/ParaSwapLiquiditySwapAdapter';
|
||||
import { getParamPerNetwork } from '../../../helpers/contracts-helpers';
|
||||
import { WETH9Mocked } from '../../../types/WETH9Mocked';
|
||||
import { WETHGateway } from '../../../types/WETHGateway';
|
||||
|
@ -68,6 +70,7 @@ export interface TestEnv {
|
|||
registry: LendingPoolAddressesProviderRegistry;
|
||||
wethGateway: WETHGateway;
|
||||
flashLiquidationAdapter: FlashLiquidationAdapter;
|
||||
paraswapLiquiditySwapAdapter: ParaSwapLiquiditySwapAdapter;
|
||||
}
|
||||
|
||||
let buidlerevmSnapshotId: string = '0x1';
|
||||
|
@ -92,6 +95,7 @@ const testEnv: TestEnv = {
|
|||
uniswapLiquiditySwapAdapter: {} as UniswapLiquiditySwapAdapter,
|
||||
uniswapRepayAdapter: {} as UniswapRepayAdapter,
|
||||
flashLiquidationAdapter: {} as FlashLiquidationAdapter,
|
||||
paraswapLiquiditySwapAdapter: {} as ParaSwapLiquiditySwapAdapter,
|
||||
registry: {} as LendingPoolAddressesProviderRegistry,
|
||||
wethGateway: {} as WETHGateway,
|
||||
} as TestEnv;
|
||||
|
@ -158,6 +162,8 @@ export async function initializeMakeSuite() {
|
|||
testEnv.uniswapLiquiditySwapAdapter = await getUniswapLiquiditySwapAdapter();
|
||||
testEnv.uniswapRepayAdapter = await getUniswapRepayAdapter();
|
||||
testEnv.flashLiquidationAdapter = await getFlashLiquidationAdapter();
|
||||
|
||||
testEnv.paraswapLiquiditySwapAdapter = await getParaSwapLiquiditySwapAdapter();
|
||||
}
|
||||
|
||||
const setSnapshot = async () => {
|
||||
|
|
2393
test-suites/test-aave/paraswapAdapters.liquiditySwap.spec.ts
Normal file
2393
test-suites/test-aave/paraswapAdapters.liquiditySwap.spec.ts
Normal file
File diff suppressed because it is too large
Load Diff
|
@ -198,7 +198,7 @@ makeSuite('Uniswap adapters', (testEnv: TestEnv) => {
|
|||
|
||||
it('should revert if not valid addresses provider', async () => {
|
||||
const { weth } = testEnv;
|
||||
expect(
|
||||
await expect(
|
||||
deployFlashLiquidationAdapter([
|
||||
mockUniswapRouter.address,
|
||||
mockUniswapRouter.address,
|
||||
|
|
|
@ -50,7 +50,7 @@ makeSuite('Uniswap adapters', (testEnv: TestEnv) => {
|
|||
|
||||
it('should revert if not valid addresses provider', async () => {
|
||||
const { weth } = testEnv;
|
||||
expect(
|
||||
await expect(
|
||||
deployUniswapLiquiditySwapAdapter([
|
||||
mockUniswapRouter.address,
|
||||
mockUniswapRouter.address,
|
||||
|
@ -196,6 +196,7 @@ makeSuite('Uniswap adapters', (testEnv: TestEnv) => {
|
|||
.div(
|
||||
new BigNumber(daiPrice.toString()).times(new BigNumber(10).pow(collateralDecimals))
|
||||
)
|
||||
.div(new BigNumber(10).pow(principalDecimals))
|
||||
.toFixed(0)
|
||||
);
|
||||
|
||||
|
@ -318,6 +319,7 @@ makeSuite('Uniswap adapters', (testEnv: TestEnv) => {
|
|||
.div(
|
||||
new BigNumber(daiPrice.toString()).times(new BigNumber(10).pow(collateralDecimals))
|
||||
)
|
||||
.div(new BigNumber(10).pow(principalDecimals))
|
||||
.toFixed(0)
|
||||
);
|
||||
|
||||
|
@ -871,6 +873,7 @@ makeSuite('Uniswap adapters', (testEnv: TestEnv) => {
|
|||
.div(
|
||||
new BigNumber(daiPrice.toString()).times(new BigNumber(10).pow(collateralDecimals))
|
||||
)
|
||||
.div(new BigNumber(10).pow(principalDecimals))
|
||||
.toFixed(0)
|
||||
);
|
||||
|
||||
|
@ -1493,6 +1496,7 @@ makeSuite('Uniswap adapters', (testEnv: TestEnv) => {
|
|||
.div(
|
||||
new BigNumber(daiPrice.toString()).times(new BigNumber(10).pow(collateralDecimals))
|
||||
)
|
||||
.div(new BigNumber(10).pow(principalDecimals))
|
||||
.toFixed(0)
|
||||
);
|
||||
|
||||
|
@ -1601,6 +1605,7 @@ makeSuite('Uniswap adapters', (testEnv: TestEnv) => {
|
|||
.div(
|
||||
new BigNumber(daiPrice.toString()).times(new BigNumber(10).pow(collateralDecimals))
|
||||
)
|
||||
.div(new BigNumber(10).pow(principalDecimals))
|
||||
.toFixed(0)
|
||||
);
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ makeSuite('Uniswap adapters', (testEnv: TestEnv) => {
|
|||
|
||||
it('should revert if not valid addresses provider', async () => {
|
||||
const { weth } = testEnv;
|
||||
expect(
|
||||
await expect(
|
||||
deployUniswapRepayAdapter([
|
||||
mockUniswapRouter.address,
|
||||
mockUniswapRouter.address,
|
||||
|
|
|
@ -13,7 +13,6 @@ import {
|
|||
deployLendingPoolConfigurator,
|
||||
deployLendingPool,
|
||||
deployPriceOracle,
|
||||
deployAaveOracle,
|
||||
deployLendingPoolCollateralManager,
|
||||
deployMockFlashLoanReceiver,
|
||||
deployWalletBalancerProvider,
|
||||
|
@ -28,6 +27,8 @@ import {
|
|||
deployUniswapRepayAdapter,
|
||||
deployFlashLiquidationAdapter,
|
||||
authorizeWETHGateway,
|
||||
deployATokenImplementations,
|
||||
deployAaveOracle,
|
||||
} from '../../helpers/contracts-deployments';
|
||||
import { Signer } from 'ethers';
|
||||
import { TokenContractId, eContractid, tEthereumAddress, AavePools } from '../../helpers/types';
|
||||
|
@ -48,7 +49,7 @@ import {
|
|||
import { DRE, waitForTx } from '../../helpers/misc-utils';
|
||||
import { initReservesByHelper, configureReservesByHelper } from '../../helpers/init-helpers';
|
||||
import AmmConfig from '../../markets/amm';
|
||||
import { ZERO_ADDRESS } from '../../helpers/constants';
|
||||
import { oneEther, ZERO_ADDRESS } from '../../helpers/constants';
|
||||
import {
|
||||
getLendingPool,
|
||||
getLendingPoolConfiguratorProxy,
|
||||
|
@ -95,6 +96,14 @@ const deployAllMockTokens = async (deployer: Signer) => {
|
|||
const buildTestEnv = async (deployer: Signer, secondaryWallet: Signer) => {
|
||||
console.time('setup');
|
||||
const aaveAdmin = await deployer.getAddress();
|
||||
const config = loadPoolConfig(ConfigNames.Amm);
|
||||
const {
|
||||
ATokenNamePrefix,
|
||||
StableDebtTokenNamePrefix,
|
||||
VariableDebtTokenNamePrefix,
|
||||
SymbolPrefix,
|
||||
ReservesConfig,
|
||||
} = config;
|
||||
|
||||
const mockTokens = await deployAllMockTokens(deployer);
|
||||
|
||||
|
@ -189,6 +198,7 @@ const buildTestEnv = async (deployer: Signer, secondaryWallet: Signer) => {
|
|||
WMATIC: mockTokens.WMATIC.address,
|
||||
USD: USD_ADDRESS,
|
||||
STAKE: mockTokens.STAKE.address,
|
||||
xSUSHI: ZERO_ADDRESS,
|
||||
},
|
||||
fallbackOracle
|
||||
);
|
||||
|
@ -210,9 +220,19 @@ const buildTestEnv = async (deployer: Signer, secondaryWallet: Signer) => {
|
|||
{}
|
||||
);
|
||||
|
||||
const [tokens, aggregators] = getPairsTokenAggregator(allTokenAddresses, allAggregatorsAddresses);
|
||||
const [tokens, aggregators] = getPairsTokenAggregator(
|
||||
allTokenAddresses,
|
||||
allAggregatorsAddresses,
|
||||
config.OracleQuoteCurrency
|
||||
);
|
||||
|
||||
await deployAaveOracle([tokens, aggregators, fallbackOracle.address, mockTokens.WETH.address]);
|
||||
await deployAaveOracle([
|
||||
tokens,
|
||||
aggregators,
|
||||
fallbackOracle.address,
|
||||
mockTokens.WETH.address,
|
||||
oneEther.toString(),
|
||||
]);
|
||||
await waitForTx(await addressesProvider.setPriceOracle(fallbackOracle.address));
|
||||
|
||||
const lendingRateOracle = await deployLendingRateOracle();
|
||||
|
@ -228,8 +248,7 @@ const buildTestEnv = async (deployer: Signer, secondaryWallet: Signer) => {
|
|||
lendingRateOracle,
|
||||
aaveAdmin
|
||||
);
|
||||
|
||||
const reservesParams = getReservesConfigByPool(AavePools.amm);
|
||||
await deployATokenImplementations(ConfigNames.Amm, ReservesConfig);
|
||||
|
||||
const testHelpers = await deployAaveProtocolDataProvider(addressesProvider.address);
|
||||
|
||||
|
@ -238,18 +257,10 @@ const buildTestEnv = async (deployer: Signer, secondaryWallet: Signer) => {
|
|||
|
||||
console.log('Initialize configuration');
|
||||
|
||||
const config = loadPoolConfig(ConfigNames.Amm);
|
||||
|
||||
const {
|
||||
ATokenNamePrefix,
|
||||
StableDebtTokenNamePrefix,
|
||||
VariableDebtTokenNamePrefix,
|
||||
SymbolPrefix,
|
||||
} = config;
|
||||
const treasuryAddress = await getTreasuryAddress(config);
|
||||
|
||||
await initReservesByHelper(
|
||||
reservesParams,
|
||||
ReservesConfig,
|
||||
allReservesAddresses,
|
||||
ATokenNamePrefix,
|
||||
StableDebtTokenNamePrefix,
|
||||
|
@ -258,9 +269,10 @@ const buildTestEnv = async (deployer: Signer, secondaryWallet: Signer) => {
|
|||
admin,
|
||||
treasuryAddress,
|
||||
ZERO_ADDRESS,
|
||||
ConfigNames.Amm,
|
||||
false
|
||||
);
|
||||
await configureReservesByHelper(reservesParams, allReservesAddresses, testHelpers, admin);
|
||||
await configureReservesByHelper(ReservesConfig, allReservesAddresses, testHelpers, admin);
|
||||
|
||||
const collateralManager = await deployLendingPoolCollateralManager();
|
||||
await waitForTx(
|
||||
|
@ -294,7 +306,7 @@ before(async () => {
|
|||
const FORK = process.env.FORK;
|
||||
|
||||
if (FORK) {
|
||||
await rawBRE.run('amm:mainnet');
|
||||
await rawBRE.run('amm:mainnet', { skipRegistry: true });
|
||||
} else {
|
||||
console.log('-> Deploying test environment...');
|
||||
await buildTestEnv(deployer, secondaryWallet);
|
||||
|
|
Loading…
Reference in New Issue
Block a user