mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
unified interface of stable, variable debt tokens and aTokens
This commit is contained in:
parent
1dd92aed67
commit
3575d58ff4
|
@ -2,7 +2,7 @@
|
||||||
pragma solidity ^0.6.8;
|
pragma solidity ^0.6.8;
|
||||||
|
|
||||||
import {IncentivizedERC20} from './IncentivizedERC20.sol';
|
import {IncentivizedERC20} from './IncentivizedERC20.sol';
|
||||||
import {LendingPool} from '../lendingpool/LendingPool.sol';
|
import {ILendingPool} from '../interfaces/ILendingPool.sol';
|
||||||
import {WadRayMath} from '../libraries/math/WadRayMath.sol';
|
import {WadRayMath} from '../libraries/math/WadRayMath.sol';
|
||||||
import {Errors} from '../libraries/helpers/Errors.sol';
|
import {Errors} from '../libraries/helpers/Errors.sol';
|
||||||
import {VersionedInitializable} from '../libraries/aave-upgradeability/VersionedInitializable.sol';
|
import {VersionedInitializable} from '../libraries/aave-upgradeability/VersionedInitializable.sol';
|
||||||
|
@ -32,7 +32,7 @@ contract AToken is VersionedInitializable, IncentivizedERC20, IAToken {
|
||||||
uint256 public constant ATOKEN_REVISION = 0x1;
|
uint256 public constant ATOKEN_REVISION = 0x1;
|
||||||
address public immutable UNDERLYING_ASSET_ADDRESS;
|
address public immutable UNDERLYING_ASSET_ADDRESS;
|
||||||
address public immutable RESERVE_TREASURY_ADDRESS;
|
address public immutable RESERVE_TREASURY_ADDRESS;
|
||||||
LendingPool public immutable POOL;
|
ILendingPool public immutable POOL;
|
||||||
|
|
||||||
/// @dev owner => next valid nonce to submit with permit()
|
/// @dev owner => next valid nonce to submit with permit()
|
||||||
mapping(address => uint256) public _nonces;
|
mapping(address => uint256) public _nonces;
|
||||||
|
@ -45,7 +45,7 @@ contract AToken is VersionedInitializable, IncentivizedERC20, IAToken {
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
LendingPool pool,
|
ILendingPool pool,
|
||||||
address underlyingAssetAddress,
|
address underlyingAssetAddress,
|
||||||
address reserveTreasuryAddress,
|
address reserveTreasuryAddress,
|
||||||
string memory tokenName,
|
string memory tokenName,
|
||||||
|
|
|
@ -43,7 +43,7 @@ contract VariableDebtToken is DebtTokenBase, IVariableDebtToken {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return scaledBalance.rayMul(POOL.getReserveNormalizedVariableDebt(UNDERLYING_ASSET));
|
return scaledBalance.rayMul(POOL.getReserveNormalizedVariableDebt(UNDERLYING_ASSET_ADDRESS));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -102,7 +102,8 @@ contract VariableDebtToken is DebtTokenBase, IVariableDebtToken {
|
||||||
* @return the total supply
|
* @return the total supply
|
||||||
**/
|
**/
|
||||||
function totalSupply() public virtual override view returns (uint256) {
|
function totalSupply() public virtual override view returns (uint256) {
|
||||||
return super.totalSupply().rayMul(POOL.getReserveNormalizedVariableDebt(UNDERLYING_ASSET));
|
return
|
||||||
|
super.totalSupply().rayMul(POOL.getReserveNormalizedVariableDebt(UNDERLYING_ASSET_ADDRESS));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -15,8 +15,8 @@ import {Errors} from '../../libraries/helpers/Errors.sol';
|
||||||
*/
|
*/
|
||||||
|
|
||||||
abstract contract DebtTokenBase is IncentivizedERC20, VersionedInitializable {
|
abstract contract DebtTokenBase is IncentivizedERC20, VersionedInitializable {
|
||||||
address internal immutable UNDERLYING_ASSET;
|
address public immutable UNDERLYING_ASSET_ADDRESS;
|
||||||
ILendingPool internal immutable POOL;
|
ILendingPool public immutable POOL;
|
||||||
mapping(address => uint256) internal _usersData;
|
mapping(address => uint256) internal _usersData;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -39,7 +39,7 @@ abstract contract DebtTokenBase is IncentivizedERC20, VersionedInitializable {
|
||||||
address incentivesController
|
address incentivesController
|
||||||
) public IncentivizedERC20(name, symbol, 18, incentivesController) {
|
) public IncentivizedERC20(name, symbol, 18, incentivesController) {
|
||||||
POOL = ILendingPool(pool);
|
POOL = ILendingPool(pool);
|
||||||
UNDERLYING_ASSET = underlyingAssetAddress;
|
UNDERLYING_ASSET_ADDRESS = underlyingAssetAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -58,10 +58,6 @@ abstract contract DebtTokenBase is IncentivizedERC20, VersionedInitializable {
|
||||||
_setDecimals(decimals);
|
_setDecimals(decimals);
|
||||||
}
|
}
|
||||||
|
|
||||||
function underlyingAssetAddress() public view returns (address) {
|
|
||||||
return UNDERLYING_ASSET;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev Being non transferrable, the debt token does not implement any of the
|
* @dev Being non transferrable, the debt token does not implement any of the
|
||||||
* standard ERC20 functions for transfer and allowance.
|
* standard ERC20 functions for transfer and allowance.
|
||||||
|
|
|
@ -231,7 +231,7 @@
|
||||||
},
|
},
|
||||||
"WalletBalanceProvider": {
|
"WalletBalanceProvider": {
|
||||||
"buidlerevm": {
|
"buidlerevm": {
|
||||||
"address": "0xC6bA6049F86d528698B5924B8fC2FE7289D38578",
|
"address": "0x2cfcA5785261fbC88EFFDd46fCFc04c22525F9e4",
|
||||||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||||
},
|
},
|
||||||
"localhost": {
|
"localhost": {
|
||||||
|
@ -620,7 +620,7 @@
|
||||||
},
|
},
|
||||||
"MockAToken": {
|
"MockAToken": {
|
||||||
"buidlerevm": {
|
"buidlerevm": {
|
||||||
"address": "0x3b050AFb4ac4ACE646b31fF3639C1CD43aC31460",
|
"address": "0x392E5355a0e88Bd394F717227c752670fb3a8020",
|
||||||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||||
},
|
},
|
||||||
"localhost": {
|
"localhost": {
|
||||||
|
@ -648,7 +648,7 @@
|
||||||
},
|
},
|
||||||
"MockStableDebtToken": {
|
"MockStableDebtToken": {
|
||||||
"buidlerevm": {
|
"buidlerevm": {
|
||||||
"address": "0xEBAB67ee3ef604D5c250A53b4b8fcbBC6ec3007C",
|
"address": "0x3b050AFb4ac4ACE646b31fF3639C1CD43aC31460",
|
||||||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||||
},
|
},
|
||||||
"localhost": {
|
"localhost": {
|
||||||
|
@ -662,7 +662,7 @@
|
||||||
},
|
},
|
||||||
"MockVariableDebtToken": {
|
"MockVariableDebtToken": {
|
||||||
"buidlerevm": {
|
"buidlerevm": {
|
||||||
"address": "0xBE36BE5680244Ae1A6F983E4A6f6E1c142cdAbe3",
|
"address": "0xEBAB67ee3ef604D5c250A53b4b8fcbBC6ec3007C",
|
||||||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||||
},
|
},
|
||||||
"localhost": {
|
"localhost": {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user