mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
Added mock debt tokens for test
This commit is contained in:
parent
4a4073f1a9
commit
3247fb8784
19
contracts/mocks/upgradeability/MockStableDebtToken.sol
Normal file
19
contracts/mocks/upgradeability/MockStableDebtToken.sol
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
pragma solidity ^0.6.8;
|
||||||
|
|
||||||
|
import {StableDebtToken} from '../../tokenization/StableDebtToken.sol';
|
||||||
|
import {LendingPool} from '../../lendingpool/LendingPool.sol';
|
||||||
|
import '@nomiclabs/buidler/console.sol';
|
||||||
|
|
||||||
|
contract MockStableDebtToken is StableDebtToken {
|
||||||
|
constructor(
|
||||||
|
address _pool,
|
||||||
|
address _underlyingAssetAddress,
|
||||||
|
string memory _tokenName,
|
||||||
|
string memory _tokenSymbol
|
||||||
|
) public StableDebtToken(_pool, _underlyingAssetAddress, _tokenName, _tokenSymbol) {}
|
||||||
|
|
||||||
|
function getRevision() internal override pure returns (uint256) {
|
||||||
|
return 0x2;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
19
contracts/mocks/upgradeability/MockVariableDebtToken.sol
Normal file
19
contracts/mocks/upgradeability/MockVariableDebtToken.sol
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
pragma solidity ^0.6.8;
|
||||||
|
|
||||||
|
import {VariableDebtToken} from '../../tokenization/VariableDebtToken.sol';
|
||||||
|
import {LendingPool} from '../../lendingpool/LendingPool.sol';
|
||||||
|
import '@nomiclabs/buidler/console.sol';
|
||||||
|
|
||||||
|
contract MockVariableDebtToken is VariableDebtToken {
|
||||||
|
constructor(
|
||||||
|
address _pool,
|
||||||
|
address _underlyingAssetAddress,
|
||||||
|
string memory _tokenName,
|
||||||
|
string memory _tokenSymbol
|
||||||
|
) public VariableDebtToken(_pool, _underlyingAssetAddress, _tokenName, _tokenSymbol) {}
|
||||||
|
|
||||||
|
function getRevision() internal override pure returns (uint256) {
|
||||||
|
return 0x2;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -68,16 +68,18 @@ contract StableDebtToken is IStableDebtToken, DebtTokenBase {
|
||||||
uint256 _balanceIncrease
|
uint256 _balanceIncrease
|
||||||
);
|
);
|
||||||
|
|
||||||
constructor(address _pool, address _underlyingAsset)
|
constructor(
|
||||||
public
|
address _pool,
|
||||||
DebtTokenBase(_pool, _underlyingAsset)
|
address _underlyingAsset,
|
||||||
{}
|
string memory _name,
|
||||||
|
string memory _symbol
|
||||||
|
) public DebtTokenBase(_pool, _underlyingAsset, _name, _symbol) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev gets the revision of the stable debt token implementation
|
* @dev gets the revision of the stable debt token implementation
|
||||||
* @return the debt token implementation revision
|
* @return the debt token implementation revision
|
||||||
**/
|
**/
|
||||||
function getRevision() internal override pure returns(uint256) {
|
function getRevision() internal virtual override pure returns (uint256) {
|
||||||
return DEBT_TOKEN_REVISION;
|
return DEBT_TOKEN_REVISION;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,20 +60,21 @@ contract VariableDebtToken is DebtTokenBase, IVariableDebtToken {
|
||||||
uint256 _index
|
uint256 _index
|
||||||
);
|
);
|
||||||
|
|
||||||
constructor(address _pool, address _underlyingAsset)
|
constructor(
|
||||||
public
|
address _pool,
|
||||||
DebtTokenBase(_pool, _underlyingAsset)
|
address _underlyingAsset,
|
||||||
{}
|
string memory _name,
|
||||||
|
string memory _symbol
|
||||||
|
) public DebtTokenBase(_pool, _underlyingAsset, _name, _symbol) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev gets the revision of the stable debt token implementation
|
* @dev gets the revision of the stable debt token implementation
|
||||||
* @return the debt token implementation revision
|
* @return the debt token implementation revision
|
||||||
**/
|
**/
|
||||||
function getRevision() internal virtual override pure returns(uint256) {
|
function getRevision() internal virtual override pure returns (uint256) {
|
||||||
return DEBT_TOKEN_REVISION;
|
return DEBT_TOKEN_REVISION;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev calculates the accumulated debt balance of the user
|
* @dev calculates the accumulated debt balance of the user
|
||||||
* @return the debt balance of the user
|
* @return the debt balance of the user
|
||||||
|
|
|
@ -6,7 +6,9 @@ import {SafeMath} from '@openzeppelin/contracts/math/SafeMath.sol';
|
||||||
import {Address} from '@openzeppelin/contracts/utils/Address.sol';
|
import {Address} from '@openzeppelin/contracts/utils/Address.sol';
|
||||||
import {ILendingPoolAddressesProvider} from '../../interfaces/ILendingPoolAddressesProvider.sol';
|
import {ILendingPoolAddressesProvider} from '../../interfaces/ILendingPoolAddressesProvider.sol';
|
||||||
import {LendingPool} from '../../lendingpool/LendingPool.sol';
|
import {LendingPool} from '../../lendingpool/LendingPool.sol';
|
||||||
import {VersionedInitializable} from '../../libraries/openzeppelin-upgradeability/VersionedInitializable.sol';
|
import {
|
||||||
|
VersionedInitializable
|
||||||
|
} from '../../libraries/openzeppelin-upgradeability/VersionedInitializable.sol';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title contract DebtTokenBase
|
* @title contract DebtTokenBase
|
||||||
|
@ -36,10 +38,18 @@ abstract contract DebtTokenBase is IERC20, VersionedInitializable {
|
||||||
_;
|
_;
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(address _pool, address _underlyingAssetAddress) public {
|
constructor(
|
||||||
|
address _pool,
|
||||||
|
address _underlyingAssetAddress,
|
||||||
|
string memory _name,
|
||||||
|
string memory _symbol
|
||||||
|
) public {
|
||||||
pool = LendingPool(payable(_pool));
|
pool = LendingPool(payable(_pool));
|
||||||
underlyingAssetAddress = _underlyingAssetAddress;
|
underlyingAssetAddress = _underlyingAssetAddress;
|
||||||
|
name = _name;
|
||||||
|
symbol = _symbol;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev initializes the debt token.
|
* @dev initializes the debt token.
|
||||||
* @param _name the name of the token
|
* @param _name the name of the token
|
||||||
|
|
|
@ -256,13 +256,14 @@ export const deployDefaultReserveInterestRateStrategy = async ([
|
||||||
export const deployStableDebtToken = async ([
|
export const deployStableDebtToken = async ([
|
||||||
name,
|
name,
|
||||||
symbol,
|
symbol,
|
||||||
decimals,
|
|
||||||
underlyingAsset,
|
underlyingAsset,
|
||||||
poolAddress,
|
poolAddress,
|
||||||
]: [string, string, string, tEthereumAddress, tEthereumAddress]) => {
|
]: [string, string, string, tEthereumAddress, tEthereumAddress]) => {
|
||||||
const token = await deployContract<StableDebtToken>(eContractid.StableDebtToken, [
|
const token = await deployContract<StableDebtToken>(eContractid.StableDebtToken, [
|
||||||
poolAddress,
|
poolAddress,
|
||||||
underlyingAsset,
|
underlyingAsset,
|
||||||
|
name,
|
||||||
|
symbol
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return token;
|
return token;
|
||||||
|
@ -271,13 +272,14 @@ export const deployStableDebtToken = async ([
|
||||||
export const deployVariableDebtToken = async ([
|
export const deployVariableDebtToken = async ([
|
||||||
name,
|
name,
|
||||||
symbol,
|
symbol,
|
||||||
decimals,
|
|
||||||
underlyingAsset,
|
underlyingAsset,
|
||||||
poolAddress,
|
poolAddress,
|
||||||
]: [string, string, string, tEthereumAddress, tEthereumAddress]) => {
|
]: [string, string, string, tEthereumAddress, tEthereumAddress]) => {
|
||||||
const token = await deployContract<VariableDebtToken>(eContractid.VariableDebtToken, [
|
const token = await deployContract<VariableDebtToken>(eContractid.VariableDebtToken, [
|
||||||
poolAddress,
|
poolAddress,
|
||||||
underlyingAsset,
|
underlyingAsset,
|
||||||
|
name,
|
||||||
|
symbol
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return token;
|
return token;
|
||||||
|
|
|
@ -224,7 +224,6 @@ const initReserves = async (
|
||||||
const stableDebtToken = await deployStableDebtToken([
|
const stableDebtToken = await deployStableDebtToken([
|
||||||
`Aave stable debt bearing ${assetSymbol === "WETH" ? "ETH" : assetSymbol}`,
|
`Aave stable debt bearing ${assetSymbol === "WETH" ? "ETH" : assetSymbol}`,
|
||||||
`stableDebt${assetSymbol === "WETH" ? "ETH" : assetSymbol}`,
|
`stableDebt${assetSymbol === "WETH" ? "ETH" : assetSymbol}`,
|
||||||
reserveDecimals,
|
|
||||||
tokenAddress,
|
tokenAddress,
|
||||||
lendingPool.address,
|
lendingPool.address,
|
||||||
]);
|
]);
|
||||||
|
@ -232,7 +231,6 @@ const initReserves = async (
|
||||||
const variableDebtToken = await deployVariableDebtToken([
|
const variableDebtToken = await deployVariableDebtToken([
|
||||||
`Aave variable debt bearing ${assetSymbol === "WETH" ? "ETH" : assetSymbol}`,
|
`Aave variable debt bearing ${assetSymbol === "WETH" ? "ETH" : assetSymbol}`,
|
||||||
`variableDebt${assetSymbol === "WETH" ? "ETH" : assetSymbol}`,
|
`variableDebt${assetSymbol === "WETH" ? "ETH" : assetSymbol}`,
|
||||||
reserveDecimals,
|
|
||||||
tokenAddress,
|
tokenAddress,
|
||||||
lendingPool.address,
|
lendingPool.address,
|
||||||
]);
|
]);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user