mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
Optimized aToken - turned pool and underlying asset address into immutables
This commit is contained in:
parent
50bb9d39b0
commit
49bca9febb
|
@ -166,35 +166,13 @@ contract LendingPoolConfigurator is VersionedInitializable {
|
|||
/**
|
||||
* @dev initializes a reserve
|
||||
* @param _reserve the address of the reserve to be initialized
|
||||
* @param _aTokenInstance the name of the aToken contract
|
||||
* @param _stableDebtTokenAddress the address of the stable debt token contract
|
||||
* @param _variableDebtTokenAddress the address of the variable debt token contract
|
||||
* @param _underlyingAssetDecimals the decimals of the reserve underlying asset
|
||||
* @param _interestRateStrategyAddress the address of the interest rate strategy contract for this reserve
|
||||
**/
|
||||
function initReserve(
|
||||
address _reserve,
|
||||
uint8 _underlyingAssetDecimals,
|
||||
address _aTokenInstance,
|
||||
address _interestRateStrategyAddress,
|
||||
address _stableDebtTokenAddress,
|
||||
address _variableDebtTokenAddress
|
||||
) external onlyLendingPoolManager {
|
||||
initReserveWithData(
|
||||
_reserve,
|
||||
_aTokenInstance,
|
||||
_stableDebtTokenAddress,
|
||||
_variableDebtTokenAddress,
|
||||
_underlyingAssetDecimals,
|
||||
_interestRateStrategyAddress
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev initializes a reserve using aTokenData provided externally (useful if the underlying ERC20 contract doesn't expose name or decimals)
|
||||
* @param _reserve the address of the reserve to be initialized
|
||||
* @param _aTokenInstance the name of the aToken contract
|
||||
* @param _underlyingAssetDecimals the decimals of the reserve underlying asset
|
||||
* @param _interestRateStrategyAddress the address of the interest rate strategy contract for this reserve
|
||||
**/
|
||||
function initReserveWithData(
|
||||
address _reserve,
|
||||
address _aTokenInstance,
|
||||
address _stableDebtTokenAddress,
|
||||
|
@ -206,9 +184,7 @@ contract LendingPoolConfigurator is VersionedInitializable {
|
|||
InitializableAdminUpgradeabilityProxy aTokenProxy = new InitializableAdminUpgradeabilityProxy();
|
||||
|
||||
bytes memory params = abi.encodeWithSignature(
|
||||
'initialize(address,address,uint8,string,string)',
|
||||
address(poolAddressesProvider),
|
||||
_reserve,
|
||||
'initialize(uint8,string,string)',
|
||||
_underlyingAssetDecimals,
|
||||
IERC20Detailed(_aTokenInstance).name(),
|
||||
IERC20Detailed(_aTokenInstance).symbol()
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
pragma solidity ^0.6.8;
|
||||
|
||||
import {ERC20} from './ERC20.sol';
|
||||
import {LendingPoolAddressesProvider} from '../configuration/LendingPoolAddressesProvider.sol';
|
||||
import {LendingPool} from '../lendingpool/LendingPool.sol';
|
||||
import {WadRayMath} from '../libraries/WadRayMath.sol';
|
||||
import {UniversalERC20} from '../libraries/UniversalERC20.sol';
|
||||
|
@ -121,15 +120,14 @@ contract AToken is VersionedInitializable, ERC20 {
|
|||
|
||||
event InterestRedirectionAllowanceChanged(address indexed _from, address indexed _to);
|
||||
|
||||
address public underlyingAssetAddress;
|
||||
address public immutable underlyingAssetAddress;
|
||||
|
||||
mapping(address => uint256) private userIndexes;
|
||||
mapping(address => address) private interestRedirectionAddresses;
|
||||
mapping(address => uint256) private redirectedBalances;
|
||||
mapping(address => address) private interestRedirectionAllowances;
|
||||
|
||||
LendingPoolAddressesProvider private addressesProvider;
|
||||
LendingPool private pool;
|
||||
LendingPool private immutable pool;
|
||||
|
||||
uint256 public constant ATOKEN_REVISION = 0x1;
|
||||
|
||||
|
@ -143,18 +141,21 @@ contract AToken is VersionedInitializable, ERC20 {
|
|||
_;
|
||||
}
|
||||
|
||||
constructor(string memory _tokenName, string memory _tokenSymbol)
|
||||
public
|
||||
ERC20(_tokenName, _tokenSymbol)
|
||||
{}
|
||||
constructor(
|
||||
LendingPool _pool,
|
||||
address _underlyingAssetAddress,
|
||||
string memory _tokenName,
|
||||
string memory _tokenSymbol
|
||||
) public ERC20(_tokenName, _tokenSymbol) {
|
||||
pool = _pool;
|
||||
underlyingAssetAddress = _underlyingAssetAddress;
|
||||
}
|
||||
|
||||
function getRevision() internal override pure returns (uint256) {
|
||||
return ATOKEN_REVISION;
|
||||
}
|
||||
|
||||
function initialize(
|
||||
LendingPoolAddressesProvider _addressesProvider,
|
||||
address _underlyingAsset,
|
||||
uint8 _underlyingAssetDecimals,
|
||||
string calldata _tokenName,
|
||||
string calldata _tokenSymbol
|
||||
|
@ -162,9 +163,6 @@ contract AToken is VersionedInitializable, ERC20 {
|
|||
_name = _tokenName;
|
||||
_symbol = _tokenSymbol;
|
||||
_setupDecimals(_underlyingAssetDecimals);
|
||||
addressesProvider = _addressesProvider;
|
||||
pool = LendingPool(payable(addressesProvider.getLendingPool()));
|
||||
underlyingAssetAddress = _underlyingAsset;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -454,16 +452,22 @@ contract AToken is VersionedInitializable, ERC20 {
|
|||
uint256
|
||||
)
|
||||
{
|
||||
uint256 previousPrincipalBalance = super.balanceOf(_user);
|
||||
//calculate the accrued interest since the last accumulation
|
||||
uint256 balanceIncrease = balanceOf(_user).sub(previousPrincipalBalance);
|
||||
//mints an amount of tokens equivalent to the amount accumulated
|
||||
_mint(_user, balanceIncrease);
|
||||
uint256 currBalance = balanceOf(_user);
|
||||
uint256 balanceIncrease = 0;
|
||||
uint256 previousBalance = 0;
|
||||
|
||||
if (currBalance != 0) {
|
||||
previousBalance = super.balanceOf(_user);
|
||||
//calculate the accrued interest since the last accumulation
|
||||
balanceIncrease = currBalance.sub(previousBalance);
|
||||
//mints an amount of tokens equivalent to the amount accumulated
|
||||
_mint(_user, balanceIncrease);
|
||||
}
|
||||
//updates the user index
|
||||
uint256 index = userIndexes[_user] = pool.getReserveNormalizedIncome(underlyingAssetAddress);
|
||||
return (
|
||||
previousPrincipalBalance,
|
||||
previousPrincipalBalance.add(balanceIncrease),
|
||||
previousBalance,
|
||||
currBalance,
|
||||
balanceIncrease,
|
||||
index
|
||||
);
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
},
|
||||
"localhost": {
|
||||
"address": "0x7AC94fC704557bFBB6E743c797C45b3384b95bB6",
|
||||
"address": "0x147A4B84ff4AB1ABb753da1DC86b84D90899A021",
|
||||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
}
|
||||
},
|
||||
|
@ -15,7 +15,7 @@
|
|||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
},
|
||||
"localhost": {
|
||||
"address": "0x9e3C887092123acf59a1819e78a95B37e46BC886",
|
||||
"address": "0x3672a553BDF3f9c335104943B1Ab3C59a3EF7050",
|
||||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
}
|
||||
},
|
||||
|
@ -25,7 +25,7 @@
|
|||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
},
|
||||
"localhost": {
|
||||
"address": "0xe9ECaCA2FAe7ecCB11242B393E545F293E33096f",
|
||||
"address": "0x11df1AF606b85226Ab9a8B1FDa90395298e7494F",
|
||||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
}
|
||||
},
|
||||
|
@ -34,7 +34,7 @@
|
|||
"address": "0x852e3718A320aD93Ad8692E8D663d247e4c1b400"
|
||||
},
|
||||
"localhost": {
|
||||
"address": "0xFC16126DBD017331464103385809E4113A61Fe3A"
|
||||
"address": "0x680e96F1C955007F4e03eF95e3842086f0cd7516"
|
||||
}
|
||||
},
|
||||
"LendingPoolParametersProvider": {
|
||||
|
@ -52,7 +52,7 @@
|
|||
"address": "0xA10958a24032283FbE2D23cedf264d6eC9411CBA"
|
||||
},
|
||||
"localhost": {
|
||||
"address": "0xC6627778273999AeF86ab786d3f6088e9C60F535"
|
||||
"address": "0x18B81F8cb5D303D08338134B677e70d6bc58AEaB"
|
||||
}
|
||||
},
|
||||
"LendingPoolDataProvider": {
|
||||
|
@ -65,7 +65,7 @@
|
|||
"address": "0x2C4603396dE2F08642354A3A102760827FfFe113"
|
||||
},
|
||||
"localhost": {
|
||||
"address": "0x6Ad44DDbF6564F0abc078340e11100d44406dD12"
|
||||
"address": "0x071720423B44c851112D8F867df5ed08339A738c"
|
||||
}
|
||||
},
|
||||
"PriceOracle": {
|
||||
|
@ -74,7 +74,7 @@
|
|||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
},
|
||||
"localhost": {
|
||||
"address": "0x372AED51F78c3CaB8b632986b689888caf25Ffa5",
|
||||
"address": "0x273D60904A8DBa3Ae6B20505c59902644124fF0E",
|
||||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
}
|
||||
},
|
||||
|
@ -84,7 +84,7 @@
|
|||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
},
|
||||
"localhost": {
|
||||
"address": "0xea0ddFACb2c3392b8DCD3B827534496b585aAcc7",
|
||||
"address": "0x95e262CAb9d868799F12C2D4030483fA54415a3d",
|
||||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
}
|
||||
},
|
||||
|
@ -94,7 +94,7 @@
|
|||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
},
|
||||
"localhost": {
|
||||
"address": "0xD859214080050ddC8745c2A6dF41439Bb851D5Bc",
|
||||
"address": "0x292eb99ddca578F7c9Db6719B44B1a5721387Ad6",
|
||||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
}
|
||||
},
|
||||
|
@ -104,17 +104,17 @@
|
|||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
},
|
||||
"localhost": {
|
||||
"address": "0x4a8527a3657a358B956571EEf857Fe5A8567A378",
|
||||
"address": "0x5eD7553Dc8a0D541130020f9965Ea951cAC1b573",
|
||||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
}
|
||||
},
|
||||
"DefaultReserveInterestRateStrategy": {
|
||||
"buidlerevm": {
|
||||
"address": "0x63b9792E7A95e3aa037255E8cAa0Dfd76f7383e7",
|
||||
"address": "0x09d728F76D543DB1925f7d1Fd8823e4e82700F99",
|
||||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
},
|
||||
"localhost": {
|
||||
"address": "0x52EF9F7d7dc2EFF6D691080204Adae9002b9AE67",
|
||||
"address": "0x0983e14968474E44aE2Db3814DFd6c41688DDA12",
|
||||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
}
|
||||
},
|
||||
|
@ -146,37 +146,37 @@
|
|||
},
|
||||
"TokenDistributor": {
|
||||
"buidlerevm": {
|
||||
"address": "0x1bb3d8FA7bDa74Af0D64d348a2545E7570863fA8"
|
||||
"address": "0x03A6802eF9060a8E1f0e56Bafc9C9AB1A26a1f06"
|
||||
},
|
||||
"localhost": {
|
||||
"address": "0xf2923EBa2C4AF250D93e8201Bc20a0096B3A8f89"
|
||||
"address": "0xB220Bf2c59d990FBC0aE67F3a2723f5b5a713202"
|
||||
}
|
||||
},
|
||||
"InitializableAdminUpgradeabilityProxy": {
|
||||
"buidlerevm": {
|
||||
"address": "0x1bb3d8FA7bDa74Af0D64d348a2545E7570863fA8",
|
||||
"address": "0x03A6802eF9060a8E1f0e56Bafc9C9AB1A26a1f06",
|
||||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
},
|
||||
"localhost": {
|
||||
"address": "0xf2923EBa2C4AF250D93e8201Bc20a0096B3A8f89",
|
||||
"address": "0xB220Bf2c59d990FBC0aE67F3a2723f5b5a713202",
|
||||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
}
|
||||
},
|
||||
"MockFlashLoanReceiver": {
|
||||
"buidlerevm": {
|
||||
"address": "0xC5f7aC6895DcB76877E71db756433fB0E0478FEB"
|
||||
"address": "0x9D37fB22EA7d655f12E68DABBf6B6585A00774C3"
|
||||
},
|
||||
"localhost": {
|
||||
"address": "0x9D72c382e918491A463157Ea3e7633FE0F26F83d"
|
||||
"address": "0xc486732FA6A9e7aFBc13D2226845DC37C5ec0476"
|
||||
}
|
||||
},
|
||||
"WalletBalanceProvider": {
|
||||
"buidlerevm": {
|
||||
"address": "0x51fa472EB89c046484B037B6125CF843C9d41b44",
|
||||
"address": "0x2005823e074313cd644035557bF4FFa0ca0Bddff",
|
||||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
},
|
||||
"localhost": {
|
||||
"address": "0xF1BbafE2063F81038079cCdC2E8e5100693B109b",
|
||||
"address": "0x263Db66558DDDaD8C2B0e01fd291F227a3Fe212b",
|
||||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
}
|
||||
},
|
||||
|
@ -186,7 +186,7 @@
|
|||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
},
|
||||
"localhost": {
|
||||
"address": "0x07FcFF7B7953ff64969B3c4C8E7c386fC7Efaa55",
|
||||
"address": "0x3bAF7C82FcD0AA4E0eB9eB84900805F97CdB3e02",
|
||||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
}
|
||||
},
|
||||
|
@ -196,7 +196,7 @@
|
|||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
},
|
||||
"localhost": {
|
||||
"address": "0x921d5f671e5892e43a292Fa1A5BCA3B4F6E62aE9",
|
||||
"address": "0x0158B479b096452e929efdce37d9d36a1703E092",
|
||||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
}
|
||||
},
|
||||
|
@ -206,7 +206,7 @@
|
|||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
},
|
||||
"localhost": {
|
||||
"address": "0x30d4f0D334822B2887C280A9540959e1dBdD340c",
|
||||
"address": "0x08054EdDc690165Ea3C83DB71c3be1f4287B66cE",
|
||||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
}
|
||||
},
|
||||
|
@ -216,7 +216,7 @@
|
|||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
},
|
||||
"localhost": {
|
||||
"address": "0x62b9F2345e060F6B81bA677Eb1cCC39Ec47d162f",
|
||||
"address": "0xEaC39f548f170681799f52201636f98241506b25",
|
||||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
}
|
||||
},
|
||||
|
@ -226,7 +226,7 @@
|
|||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
},
|
||||
"localhost": {
|
||||
"address": "0x18287eAe938cf3C2024A460C4759E9E081729FB2",
|
||||
"address": "0x690f32e5CB1A8613f19b0eA886Dc1b861fc46581",
|
||||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
}
|
||||
},
|
||||
|
@ -236,7 +236,7 @@
|
|||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
},
|
||||
"localhost": {
|
||||
"address": "0x6C12CB1315d28904AE67aaf4d21F1247e0Caf1E7",
|
||||
"address": "0xCF6566a2CDe18a7BA1852A24E20906804D6455F6",
|
||||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
}
|
||||
},
|
||||
|
@ -246,7 +246,7 @@
|
|||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
},
|
||||
"localhost": {
|
||||
"address": "0xf400aDA5C432462a380ae49ee9A84FE3F21B188d",
|
||||
"address": "0x874C1B4201E6D97e6A5E4410ca7dCB8bDFE3d257",
|
||||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
}
|
||||
},
|
||||
|
@ -256,7 +256,7 @@
|
|||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
},
|
||||
"localhost": {
|
||||
"address": "0x1e3b37AA176ec7d5ae1A36e093A9f849742563F4",
|
||||
"address": "0x7E0F9675f10a9725245858c098d30cB763A2a040",
|
||||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
}
|
||||
},
|
||||
|
@ -266,7 +266,7 @@
|
|||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
},
|
||||
"localhost": {
|
||||
"address": "0xfDdff7952ab54f34FBE3E421b4DB1E8B0cf673Df",
|
||||
"address": "0x0Bd4069eF735Db440F4D1D4B24c001D7B417037E",
|
||||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
}
|
||||
},
|
||||
|
@ -276,7 +276,7 @@
|
|||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
},
|
||||
"localhost": {
|
||||
"address": "0x378a425415BC1099820005E93448D877A5e02793",
|
||||
"address": "0xA79F0417aA29836bBBa7D4ee06D7BaBc4930BC4f",
|
||||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
}
|
||||
},
|
||||
|
@ -286,7 +286,7 @@
|
|||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
},
|
||||
"localhost": {
|
||||
"address": "0x2361fAEcc05E4e50D85c22E253bafD6B62f91F7A",
|
||||
"address": "0x5559372F41261bdBf6E9067796a427D2D514bf85",
|
||||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
}
|
||||
},
|
||||
|
@ -296,7 +296,7 @@
|
|||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
},
|
||||
"localhost": {
|
||||
"address": "0x1Bf05105664fA2eA4af77E88e637189d76e6283f",
|
||||
"address": "0x227B215F961B75be343fE751494e300c6a300d53",
|
||||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
}
|
||||
},
|
||||
|
@ -306,7 +306,7 @@
|
|||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
},
|
||||
"localhost": {
|
||||
"address": "0x529D91657646F22e348c1B9870d0C0D88ED1151A",
|
||||
"address": "0x38B2C97074727B078241Dc72d57DE34dF8ECfC9C",
|
||||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
}
|
||||
},
|
||||
|
@ -316,7 +316,7 @@
|
|||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
},
|
||||
"localhost": {
|
||||
"address": "0x21a26892Ad0ee4b429BB768BaAF4A7fB623d91C7",
|
||||
"address": "0x20e04C71b81a2C818a1a62EefBD94bbC9B302E29",
|
||||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
}
|
||||
},
|
||||
|
@ -326,7 +326,7 @@
|
|||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
},
|
||||
"localhost": {
|
||||
"address": "0x269615E7bA0C64666F8d7586dE868aD55EDD8577",
|
||||
"address": "0x4e8eDb229774D6d975689F7F910C889cb3Ca9c39",
|
||||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
}
|
||||
},
|
||||
|
@ -336,7 +336,7 @@
|
|||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
},
|
||||
"localhost": {
|
||||
"address": "0xc9b9B169eA13aB77079F62c5D2f038f50746A4cD",
|
||||
"address": "0xBEd64c6Ca683EF92595Bf32C37f7f7B23cC8B417",
|
||||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
}
|
||||
},
|
||||
|
@ -346,7 +346,7 @@
|
|||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
},
|
||||
"localhost": {
|
||||
"address": "0x2102f3e30ab514e35561C9499f49c3079957f407",
|
||||
"address": "0x8d274866817928093002cc52aBc48c6EAb3B5Aea",
|
||||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
}
|
||||
},
|
||||
|
@ -356,7 +356,7 @@
|
|||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
},
|
||||
"localhost": {
|
||||
"address": "0x87985DF0bf4c392F4114554fcCfC9Ef713463965",
|
||||
"address": "0x10bee3F9993F918Da27360D32C552E327FC3C5E0",
|
||||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
}
|
||||
},
|
||||
|
@ -366,7 +366,7 @@
|
|||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
},
|
||||
"localhost": {
|
||||
"address": "0xf20d0172C4F801762a1Fed1F969fF143BAf6740A",
|
||||
"address": "0x1581aD6aaDCd767B447881E14021a7b764C67fE4",
|
||||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
}
|
||||
},
|
||||
|
@ -376,7 +376,7 @@
|
|||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
},
|
||||
"localhost": {
|
||||
"address": "0x9707728C9D0C48a83fDA8eEaF39b104EDcFC4f4A",
|
||||
"address": "0x72579C72d3Aaa35f3DBdbDd35573daDc5f77666b",
|
||||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
}
|
||||
},
|
||||
|
@ -386,7 +386,7 @@
|
|||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
},
|
||||
"localhost": {
|
||||
"address": "0x078522E6413f005DA503EA2c72e161C54D27a5ec",
|
||||
"address": "0x9F48a96f72043aE76CD0f9b035E38215396eFb5B",
|
||||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
}
|
||||
},
|
||||
|
@ -396,7 +396,7 @@
|
|||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
},
|
||||
"localhost": {
|
||||
"address": "0xFF8862c67087C7474e44693a017411E1783A6b50",
|
||||
"address": "0xb9781A7f001aa3e2Bb056B79a3bDbeEf2BA0C344",
|
||||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
}
|
||||
},
|
||||
|
@ -406,35 +406,45 @@
|
|||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
},
|
||||
"localhost": {
|
||||
"address": "0x7AC94fC704557bFBB6E743c797C45b3384b95bB6",
|
||||
"address": "0x147A4B84ff4AB1ABb753da1DC86b84D90899A021",
|
||||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
}
|
||||
},
|
||||
"AaveProtocolTestHelpers": {
|
||||
"buidlerevm": {
|
||||
"address": "0x4b2c297ba5be42610994974b9543D56B864CA011"
|
||||
"address": "0x850Fae11E1313e6C23Db7c2410Ec0985d9Ea325A"
|
||||
},
|
||||
"localhost": {
|
||||
"address": "0x49CC1e6749f45e3BaB945B96c0d6723a606BDcDa"
|
||||
"address": "0x3717c045414269985A69b5eF256bB87C77ef6C6e"
|
||||
}
|
||||
},
|
||||
"StableDebtToken": {
|
||||
"buidlerevm": {
|
||||
"address": "0xc783bfC59158E888dA3E9c7768aaDC7a58ee7809",
|
||||
"address": "0xb2B548BE73010C188C083c510d255Aed74843b05",
|
||||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
},
|
||||
"localhost": {
|
||||
"address": "0x34dB38AC79A5e23F6Ff6711098979Ca3159b80d7",
|
||||
"address": "0x58bDC18EC8Aba196F01e8488e7A87F1A5128D4B1",
|
||||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
}
|
||||
},
|
||||
"VariableDebtToken": {
|
||||
"buidlerevm": {
|
||||
"address": "0xBdFE372Bb5a0db801A1a17796EC5cfF2F30A714C",
|
||||
"address": "0x5Ea694f66BD0CBd08FC7967af01b67Dcef68cC5c",
|
||||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
},
|
||||
"localhost": {
|
||||
"address": "0x7BCb706a6C9cA7F9e51199d3d87A6A92b9cc05b4",
|
||||
"address": "0xF835f4edBa9d08FE5E49923b8a86a7C08FB5978C",
|
||||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
}
|
||||
},
|
||||
"AToken": {
|
||||
"localhost": {
|
||||
"address": "0x96AFa17ef7cf813BaD59f395830bE4EaB2e64BF4",
|
||||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
},
|
||||
"buidlerevm": {
|
||||
"address": "0xd4e934C2749CA8C1618659D02E7B28B074bf4df7",
|
||||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -283,10 +283,12 @@ export const deployVariableDebtToken = async ([
|
|||
};
|
||||
|
||||
export const deployGenericAToken = async ([
|
||||
poolAddress,
|
||||
underlyingAssetAddress,
|
||||
name,
|
||||
symbol
|
||||
]: [string, string]) => {
|
||||
const token = await deployContract<AToken>(eContractid.AToken, [name, symbol]);
|
||||
]: [ tEthereumAddress, tEthereumAddress, string, string]) => {
|
||||
const token = await deployContract<AToken>(eContractid.AToken, [poolAddress, underlyingAssetAddress, name, symbol]);
|
||||
|
||||
return token;
|
||||
};
|
||||
|
|
|
@ -241,6 +241,8 @@ const initReserves = async (
|
|||
]);
|
||||
|
||||
const aToken = await deployGenericAToken([
|
||||
lendingPool.address,
|
||||
tokenAddress,
|
||||
`Aave interest bearing ${assetSymbol}`,
|
||||
`a${assetSymbol}`
|
||||
]);
|
||||
|
@ -254,7 +256,7 @@ const initReserves = async (
|
|||
}
|
||||
}
|
||||
|
||||
await lendingPoolConfigurator.initReserveWithData(
|
||||
await lendingPoolConfigurator.initReserve(
|
||||
tokenAddress,
|
||||
aToken.address,
|
||||
stableDebtToken.address,
|
||||
|
|
18
types/AToken.d.ts
vendored
18
types/AToken.d.ts
vendored
|
@ -57,13 +57,11 @@ interface ATokenInterface extends Interface {
|
|||
}>;
|
||||
|
||||
initialize: TypedFunctionDescription<{
|
||||
encode([
|
||||
_addressesProvider,
|
||||
_underlyingAsset,
|
||||
_underlyingAssetDecimals,
|
||||
_tokenName,
|
||||
_tokenSymbol
|
||||
]: [string, string, BigNumberish, string, string]): string;
|
||||
encode([_underlyingAssetDecimals, _tokenName, _tokenSymbol]: [
|
||||
BigNumberish,
|
||||
string,
|
||||
string
|
||||
]): string;
|
||||
}>;
|
||||
|
||||
isTransferAllowed: TypedFunctionDescription<{
|
||||
|
@ -271,8 +269,6 @@ export class AToken extends Contract {
|
|||
): Promise<ContractTransaction>;
|
||||
|
||||
initialize(
|
||||
_addressesProvider: string,
|
||||
_underlyingAsset: string,
|
||||
_underlyingAssetDecimals: BigNumberish,
|
||||
_tokenName: string,
|
||||
_tokenSymbol: string,
|
||||
|
@ -386,8 +382,6 @@ export class AToken extends Contract {
|
|||
): Promise<ContractTransaction>;
|
||||
|
||||
initialize(
|
||||
_addressesProvider: string,
|
||||
_underlyingAsset: string,
|
||||
_underlyingAssetDecimals: BigNumberish,
|
||||
_tokenName: string,
|
||||
_tokenSymbol: string,
|
||||
|
@ -553,8 +547,6 @@ export class AToken extends Contract {
|
|||
): Promise<BigNumber>;
|
||||
|
||||
initialize(
|
||||
_addressesProvider: string,
|
||||
_underlyingAsset: string,
|
||||
_underlyingAssetDecimals: BigNumberish,
|
||||
_tokenName: string,
|
||||
_tokenSymbol: string
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
40
types/LendingPoolConfigurator.d.ts
vendored
40
types/LendingPoolConfigurator.d.ts
vendored
|
@ -56,17 +56,6 @@ interface LendingPoolConfiguratorInterface extends Interface {
|
|||
}>;
|
||||
|
||||
initReserve: TypedFunctionDescription<{
|
||||
encode([
|
||||
_reserve,
|
||||
_underlyingAssetDecimals,
|
||||
_aTokenInstance,
|
||||
_interestRateStrategyAddress,
|
||||
_stableDebtTokenAddress,
|
||||
_variableDebtTokenAddress
|
||||
]: [string, BigNumberish, string, string, string, string]): string;
|
||||
}>;
|
||||
|
||||
initReserveWithData: TypedFunctionDescription<{
|
||||
encode([
|
||||
_reserve,
|
||||
_aTokenInstance,
|
||||
|
@ -260,16 +249,6 @@ export class LendingPoolConfigurator extends Contract {
|
|||
): Promise<ContractTransaction>;
|
||||
|
||||
initReserve(
|
||||
_reserve: string,
|
||||
_underlyingAssetDecimals: BigNumberish,
|
||||
_aTokenInstance: string,
|
||||
_interestRateStrategyAddress: string,
|
||||
_stableDebtTokenAddress: string,
|
||||
_variableDebtTokenAddress: string,
|
||||
overrides?: TransactionOverrides
|
||||
): Promise<ContractTransaction>;
|
||||
|
||||
initReserveWithData(
|
||||
_reserve: string,
|
||||
_aTokenInstance: string,
|
||||
_stableDebtTokenAddress: string,
|
||||
|
@ -376,16 +355,6 @@ export class LendingPoolConfigurator extends Contract {
|
|||
): Promise<ContractTransaction>;
|
||||
|
||||
initReserve(
|
||||
_reserve: string,
|
||||
_underlyingAssetDecimals: BigNumberish,
|
||||
_aTokenInstance: string,
|
||||
_interestRateStrategyAddress: string,
|
||||
_stableDebtTokenAddress: string,
|
||||
_variableDebtTokenAddress: string,
|
||||
overrides?: TransactionOverrides
|
||||
): Promise<ContractTransaction>;
|
||||
|
||||
initReserveWithData(
|
||||
_reserve: string,
|
||||
_aTokenInstance: string,
|
||||
_stableDebtTokenAddress: string,
|
||||
|
@ -521,15 +490,6 @@ export class LendingPoolConfigurator extends Contract {
|
|||
freezeReserve(_reserve: string): Promise<BigNumber>;
|
||||
|
||||
initReserve(
|
||||
_reserve: string,
|
||||
_underlyingAssetDecimals: BigNumberish,
|
||||
_aTokenInstance: string,
|
||||
_interestRateStrategyAddress: string,
|
||||
_stableDebtTokenAddress: string,
|
||||
_variableDebtTokenAddress: string
|
||||
): Promise<BigNumber>;
|
||||
|
||||
initReserveWithData(
|
||||
_reserve: string,
|
||||
_aTokenInstance: string,
|
||||
_stableDebtTokenAddress: string,
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -134,4 +134,4 @@ const _abi = [
|
|||
];
|
||||
|
||||
const _bytecode =
|
||||
"0x608060405234801561001057600080fd5b506040516109863803806109868339818101604052602081101561003357600080fd5b5051600080546001600160a01b039092166001600160a01b0319909216919091179055610921806100656000396000f3fe6080604052600436106100385760003560e01c80639e3c930914610083578063b59b28ef1461014f578063f7888aec146102d35761007e565b3661007e5761004633610320565b61007c576040805162461bcd60e51b8152602060048201526002602482015261191960f11b604482015290519081900360640190fd5b005b600080fd5b34801561008f57600080fd5b506100b6600480360360208110156100a657600080fd5b50356001600160a01b031661035c565b604051808060200180602001838103835285818151815260200191508051906020019060200280838360005b838110156100fa5781810151838201526020016100e2565b50505050905001838103825284818151815260200191508051906020019060200280838360005b83811015610139578181015183820152602001610121565b5050505090500194505050505060405180910390f35b34801561015b57600080fd5b506102836004803603604081101561017257600080fd5b81019060208101813564010000000081111561018d57600080fd5b82018360208201111561019f57600080fd5b803590602001918460208302840111640100000000831117156101c157600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929594936020810193503591505064010000000081111561021157600080fd5b82018360208201111561022357600080fd5b8035906020019184602083028401116401000000008311171561024557600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295506106a0945050505050565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156102bf5781810151838201526020016102a7565b505050509050019250505060405180910390f35b3480156102df57600080fd5b5061030e600480360360408110156102f657600080fd5b506001600160a01b038135811691602001351661081c565b60408051918252519081900360200190f35b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081811480159061035457508115155b949350505050565b60608060008060009054906101000a90046001600160a01b03166001600160a01b0316630261bf8b6040518163ffffffff1660e01b815260040160206040518083038186803b1580156103ae57600080fd5b505afa1580156103c2573d6000803e3d6000fd5b505050506040513d60208110156103d857600080fd5b505160408051630240bc6b60e21b815290519192506060916001600160a01b03841691630902f1ac916004808301926000929190829003018186803b15801561042057600080fd5b505afa158015610434573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052602081101561045d57600080fd5b810190808051604051939291908464010000000082111561047d57600080fd5b90830190602082018581111561049257600080fd5b82518660208202830111640100000000821117156104af57600080fd5b82525081516020918201928201910280838360005b838110156104dc5781810151838201526020016104c4565b5050505090500160405250505090506060815167ffffffffffffffff8111801561050557600080fd5b5060405190808252806020026020018201604052801561052f578160200160208202803683370190505b50905060005b8251811015610694576000846001600160a01b0316633e15014185848151811061055b57fe5b60200260200101516040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b031681526020019150506101406040518083038186803b1580156105aa57600080fd5b505afa1580156105be573d6000803e3d6000fd5b505050506040513d6101408110156105d557600080fd5b5061010001519050806106025760008383815181106105f057fe5b6020026020010181815250505061068c565b61062784838151811061061157fe5b60200260200101516001600160a01b03166108c6565b15610666576106498885848151811061063c57fe5b602002602001015161081c565b83838151811061065557fe5b60200260200101818152505061068a565b876001600160a01b03163183838151811061067d57fe5b6020026020010181815250505b505b600101610535565b50909350915050915091565b606080825184510267ffffffffffffffff811180156106be57600080fd5b506040519080825280602002602001820160405280156106e8578160200160208202803683370190505b50905060005b84518110156108125760005b845181101561080957600085518302905061071a86838151811061061157fe5b1561075c5786838151811061072b57fe5b60200260200101516001600160a01b031631848383018151811061074b57fe5b602002602001018181525050610800565b61078186838151811061076b57fe5b60200260200101516001600160a01b0316610320565b6107c2576040805162461bcd60e51b815260206004820152600d60248201526c24a72b20a624a22faa27a5a2a760991b604482015290519081900360640190fd5b6107e58784815181106107d157fe5b602002602001015187848151811061063c57fe5b84838301815181106107f357fe5b6020026020010181815250505b506001016106fa565b506001016106ee565b5090505b92915050565b6000610830826001600160a01b0316610320565b156108be57816001600160a01b03166370a08231846040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200191505060206040518083038186803b15801561088b57600080fd5b505afa15801561089f573d6000803e3d6000fd5b505050506040513d60208110156108b557600080fd5b50519050610816565b506000610816565b6001600160a01b03811673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1491905056fea2646970667358221220d229125c06b4ff7a1d89687eb3ef25a0713d63f804aa352026fdaa83b6d4b49864736f6c63430006080033";
|
||||
"0x608060405234801561001057600080fd5b506040516109863803806109868339818101604052602081101561003357600080fd5b5051600080546001600160a01b039092166001600160a01b0319909216919091179055610921806100656000396000f3fe6080604052600436106100385760003560e01c80639e3c930914610083578063b59b28ef1461014f578063f7888aec146102d35761007e565b3661007e5761004633610320565b61007c576040805162461bcd60e51b8152602060048201526002602482015261191960f11b604482015290519081900360640190fd5b005b600080fd5b34801561008f57600080fd5b506100b6600480360360208110156100a657600080fd5b50356001600160a01b031661035c565b604051808060200180602001838103835285818151815260200191508051906020019060200280838360005b838110156100fa5781810151838201526020016100e2565b50505050905001838103825284818151815260200191508051906020019060200280838360005b83811015610139578181015183820152602001610121565b5050505090500194505050505060405180910390f35b34801561015b57600080fd5b506102836004803603604081101561017257600080fd5b81019060208101813564010000000081111561018d57600080fd5b82018360208201111561019f57600080fd5b803590602001918460208302840111640100000000831117156101c157600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929594936020810193503591505064010000000081111561021157600080fd5b82018360208201111561022357600080fd5b8035906020019184602083028401116401000000008311171561024557600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295506106a0945050505050565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156102bf5781810151838201526020016102a7565b505050509050019250505060405180910390f35b3480156102df57600080fd5b5061030e600480360360408110156102f657600080fd5b506001600160a01b038135811691602001351661081c565b60408051918252519081900360200190f35b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081811480159061035457508115155b949350505050565b60608060008060009054906101000a90046001600160a01b03166001600160a01b0316630261bf8b6040518163ffffffff1660e01b815260040160206040518083038186803b1580156103ae57600080fd5b505afa1580156103c2573d6000803e3d6000fd5b505050506040513d60208110156103d857600080fd5b505160408051630240bc6b60e21b815290519192506060916001600160a01b03841691630902f1ac916004808301926000929190829003018186803b15801561042057600080fd5b505afa158015610434573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052602081101561045d57600080fd5b810190808051604051939291908464010000000082111561047d57600080fd5b90830190602082018581111561049257600080fd5b82518660208202830111640100000000821117156104af57600080fd5b82525081516020918201928201910280838360005b838110156104dc5781810151838201526020016104c4565b5050505090500160405250505090506060815167ffffffffffffffff8111801561050557600080fd5b5060405190808252806020026020018201604052801561052f578160200160208202803683370190505b50905060005b8251811015610694576000846001600160a01b0316633e15014185848151811061055b57fe5b60200260200101516040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b031681526020019150506101406040518083038186803b1580156105aa57600080fd5b505afa1580156105be573d6000803e3d6000fd5b505050506040513d6101408110156105d557600080fd5b5061010001519050806106025760008383815181106105f057fe5b6020026020010181815250505061068c565b61062784838151811061061157fe5b60200260200101516001600160a01b03166108c6565b15610666576106498885848151811061063c57fe5b602002602001015161081c565b83838151811061065557fe5b60200260200101818152505061068a565b876001600160a01b03163183838151811061067d57fe5b6020026020010181815250505b505b600101610535565b50909350915050915091565b606080825184510267ffffffffffffffff811180156106be57600080fd5b506040519080825280602002602001820160405280156106e8578160200160208202803683370190505b50905060005b84518110156108125760005b845181101561080957600085518302905061071a86838151811061061157fe5b1561075c5786838151811061072b57fe5b60200260200101516001600160a01b031631848383018151811061074b57fe5b602002602001018181525050610800565b61078186838151811061076b57fe5b60200260200101516001600160a01b0316610320565b6107c2576040805162461bcd60e51b815260206004820152600d60248201526c24a72b20a624a22faa27a5a2a760991b604482015290519081900360640190fd5b6107e58784815181106107d157fe5b602002602001015187848151811061063c57fe5b84838301815181106107f357fe5b6020026020010181815250505b506001016106fa565b506001016106ee565b5090505b92915050565b6000610830826001600160a01b0316610320565b156108be57816001600160a01b03166370a08231846040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200191505060206040518083038186803b15801561088b57600080fd5b505afa15801561089f573d6000803e3d6000fd5b505050506040513d60208110156108b557600080fd5b50519050610816565b506000610816565b6001600160a01b03811673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1491905056fea2646970667358221220f6e812f417b9657175e5e8c275a14453160d361a47ca250ee1f3ab3850c68b8e64736f6c63430006080033";
|
||||
|
|
Loading…
Reference in New Issue
Block a user