Source Code
| Transaction Hash |
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Cross-Chain Transactions
Loading...
Loading
Contract Name:
DefaultReserveInterestRateStrategy
Compiler Version
v0.8.24+commit.e11b9ed9
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: BUSL-1.1
/* ———————————————————————————————————————————————————————————————————————————————— *
* _____ ______ ______ __ __ __ __ ______ __ __ *
* /\ __-. /\__ _\ /\ == \ /\ \ /\ "-.\ \ /\ \ /\__ _\ /\ \_\ \ *
* \ \ \/\ \ \/_/\ \/ \ \ __< \ \ \ \ \ \-. \ \ \ \ \/_/\ \/ \ \____ \ *
* \ \____- \ \_\ \ \_\ \_\ \ \_\ \ \_\\"\_\ \ \_\ \ \_\ \/\_____\ *
* \/____/ \/_/ \/_/ /_/ \/_/ \/_/ \/_/ \/_/ \/_/ \/_____/ *
* *
* ————————————————————————————————— dtrinity.org ————————————————————————————————— *
* *
* ▲ *
* ▲ ▲ *
* *
* ———————————————————————————————————————————————————————————————————————————————— *
* dTRINITY Protocol: https://github.com/dtrinity *
* ———————————————————————————————————————————————————————————————————————————————— */
pragma solidity ^0.8.10;
import {IERC20} from "../../dependencies/openzeppelin/contracts/IERC20.sol";
import {WadRayMath} from "../libraries/math/WadRayMath.sol";
import {PercentageMath} from "../libraries/math/PercentageMath.sol";
import {DataTypes} from "../libraries/types/DataTypes.sol";
import {Errors} from "../libraries/helpers/Errors.sol";
import {IDefaultInterestRateStrategy} from "../../interfaces/IDefaultInterestRateStrategy.sol";
import {IReserveInterestRateStrategy} from "../../interfaces/IReserveInterestRateStrategy.sol";
import {IPoolAddressesProvider} from "../../interfaces/IPoolAddressesProvider.sol";
/**
* @title DefaultReserveInterestRateStrategy contract
* @author Aave
* @notice Implements the calculation of the interest rates depending on the reserve state
* @dev The model of interest rate is based on 2 slopes, one before the `OPTIMAL_USAGE_RATIO`
* point of usage and another from that one to 100%.
* - An instance of this same contract, can't be used across different Aave markets, due to the caching
* of the PoolAddressesProvider
*/
contract DefaultReserveInterestRateStrategy is IDefaultInterestRateStrategy {
using WadRayMath for uint256;
using PercentageMath for uint256;
/// @inheritdoc IDefaultInterestRateStrategy
uint256 public immutable OPTIMAL_USAGE_RATIO;
/// @inheritdoc IDefaultInterestRateStrategy
uint256 public immutable OPTIMAL_STABLE_TO_TOTAL_DEBT_RATIO;
/// @inheritdoc IDefaultInterestRateStrategy
uint256 public immutable MAX_EXCESS_USAGE_RATIO;
/// @inheritdoc IDefaultInterestRateStrategy
uint256 public immutable MAX_EXCESS_STABLE_TO_TOTAL_DEBT_RATIO;
IPoolAddressesProvider public immutable ADDRESSES_PROVIDER;
// Base variable borrow rate when usage rate = 0. Expressed in ray
uint256 internal immutable _baseVariableBorrowRate;
// Slope of the variable interest curve when usage ratio > 0 and <= OPTIMAL_USAGE_RATIO. Expressed in ray
uint256 internal immutable _variableRateSlope1;
// Slope of the variable interest curve when usage ratio > OPTIMAL_USAGE_RATIO. Expressed in ray
uint256 internal immutable _variableRateSlope2;
// Slope of the stable interest curve when usage ratio > 0 and <= OPTIMAL_USAGE_RATIO. Expressed in ray
uint256 internal immutable _stableRateSlope1;
// Slope of the stable interest curve when usage ratio > OPTIMAL_USAGE_RATIO. Expressed in ray
uint256 internal immutable _stableRateSlope2;
// Premium on top of `_variableRateSlope1` for base stable borrowing rate
uint256 internal immutable _baseStableRateOffset;
// Additional premium applied to stable rate when stable debt surpass `OPTIMAL_STABLE_TO_TOTAL_DEBT_RATIO`
uint256 internal immutable _stableRateExcessOffset;
/**
* @dev Constructor.
* @param provider The address of the PoolAddressesProvider contract
* @param optimalUsageRatio The optimal usage ratio
* @param baseVariableBorrowRate The base variable borrow rate
* @param variableRateSlope1 The variable rate slope below optimal usage ratio
* @param variableRateSlope2 The variable rate slope above optimal usage ratio
* @param stableRateSlope1 The stable rate slope below optimal usage ratio
* @param stableRateSlope2 The stable rate slope above optimal usage ratio
* @param baseStableRateOffset The premium on top of variable rate for base stable borrowing rate
* @param stableRateExcessOffset The premium on top of stable rate when there stable debt surpass the threshold
* @param optimalStableToTotalDebtRatio The optimal stable debt to total debt ratio of the reserve
*/
constructor(
IPoolAddressesProvider provider,
uint256 optimalUsageRatio,
uint256 baseVariableBorrowRate,
uint256 variableRateSlope1,
uint256 variableRateSlope2,
uint256 stableRateSlope1,
uint256 stableRateSlope2,
uint256 baseStableRateOffset,
uint256 stableRateExcessOffset,
uint256 optimalStableToTotalDebtRatio
) {
require(
WadRayMath.RAY >= optimalUsageRatio,
Errors.INVALID_OPTIMAL_USAGE_RATIO
);
require(
WadRayMath.RAY >= optimalStableToTotalDebtRatio,
Errors.INVALID_OPTIMAL_STABLE_TO_TOTAL_DEBT_RATIO
);
OPTIMAL_USAGE_RATIO = optimalUsageRatio;
MAX_EXCESS_USAGE_RATIO = WadRayMath.RAY - optimalUsageRatio;
OPTIMAL_STABLE_TO_TOTAL_DEBT_RATIO = optimalStableToTotalDebtRatio;
MAX_EXCESS_STABLE_TO_TOTAL_DEBT_RATIO =
WadRayMath.RAY -
optimalStableToTotalDebtRatio;
ADDRESSES_PROVIDER = provider;
_baseVariableBorrowRate = baseVariableBorrowRate;
_variableRateSlope1 = variableRateSlope1;
_variableRateSlope2 = variableRateSlope2;
_stableRateSlope1 = stableRateSlope1;
_stableRateSlope2 = stableRateSlope2;
_baseStableRateOffset = baseStableRateOffset;
_stableRateExcessOffset = stableRateExcessOffset;
}
/// @inheritdoc IDefaultInterestRateStrategy
function getVariableRateSlope1() external view returns (uint256) {
return _variableRateSlope1;
}
/// @inheritdoc IDefaultInterestRateStrategy
function getVariableRateSlope2() external view returns (uint256) {
return _variableRateSlope2;
}
/// @inheritdoc IDefaultInterestRateStrategy
function getStableRateSlope1() external view returns (uint256) {
return _stableRateSlope1;
}
/// @inheritdoc IDefaultInterestRateStrategy
function getStableRateSlope2() external view returns (uint256) {
return _stableRateSlope2;
}
/// @inheritdoc IDefaultInterestRateStrategy
function getStableRateExcessOffset() external view returns (uint256) {
return _stableRateExcessOffset;
}
/// @inheritdoc IDefaultInterestRateStrategy
function getBaseStableBorrowRate() public view returns (uint256) {
return _variableRateSlope1 + _baseStableRateOffset;
}
/// @inheritdoc IDefaultInterestRateStrategy
function getBaseVariableBorrowRate()
external
view
override
returns (uint256)
{
return _baseVariableBorrowRate;
}
/// @inheritdoc IDefaultInterestRateStrategy
function getMaxVariableBorrowRate()
external
view
override
returns (uint256)
{
return
_baseVariableBorrowRate + _variableRateSlope1 + _variableRateSlope2;
}
struct CalcInterestRatesLocalVars {
uint256 availableLiquidity;
uint256 totalDebt;
uint256 currentVariableBorrowRate;
uint256 currentStableBorrowRate;
uint256 currentLiquidityRate;
uint256 borrowUsageRatio;
uint256 supplyUsageRatio;
uint256 stableToTotalDebtRatio;
uint256 availableLiquidityPlusDebt;
}
/// @inheritdoc IReserveInterestRateStrategy
function calculateInterestRates(
DataTypes.CalculateInterestRatesParams memory params
) public view override returns (uint256, uint256, uint256) {
CalcInterestRatesLocalVars memory vars;
vars.totalDebt = params.totalStableDebt + params.totalVariableDebt;
vars.currentLiquidityRate = 0;
vars.currentVariableBorrowRate = _baseVariableBorrowRate;
vars.currentStableBorrowRate = getBaseStableBorrowRate();
if (vars.totalDebt != 0) {
vars.stableToTotalDebtRatio = params.totalStableDebt.rayDiv(
vars.totalDebt
);
vars.availableLiquidity =
IERC20(params.reserve).balanceOf(params.aToken) +
params.liquidityAdded -
params.liquidityTaken;
vars.availableLiquidityPlusDebt =
vars.availableLiquidity +
vars.totalDebt;
vars.borrowUsageRatio = vars.totalDebt.rayDiv(
vars.availableLiquidityPlusDebt
);
vars.supplyUsageRatio = vars.totalDebt.rayDiv(
vars.availableLiquidityPlusDebt + params.unbacked
);
}
if (vars.borrowUsageRatio > OPTIMAL_USAGE_RATIO) {
uint256 excessBorrowUsageRatio = (vars.borrowUsageRatio -
OPTIMAL_USAGE_RATIO).rayDiv(MAX_EXCESS_USAGE_RATIO);
vars.currentStableBorrowRate +=
_stableRateSlope1 +
_stableRateSlope2.rayMul(excessBorrowUsageRatio);
vars.currentVariableBorrowRate +=
_variableRateSlope1 +
_variableRateSlope2.rayMul(excessBorrowUsageRatio);
} else {
vars.currentStableBorrowRate += _stableRateSlope1
.rayMul(vars.borrowUsageRatio)
.rayDiv(OPTIMAL_USAGE_RATIO);
vars.currentVariableBorrowRate += _variableRateSlope1
.rayMul(vars.borrowUsageRatio)
.rayDiv(OPTIMAL_USAGE_RATIO);
}
if (vars.stableToTotalDebtRatio > OPTIMAL_STABLE_TO_TOTAL_DEBT_RATIO) {
uint256 excessStableDebtRatio = (vars.stableToTotalDebtRatio -
OPTIMAL_STABLE_TO_TOTAL_DEBT_RATIO).rayDiv(
MAX_EXCESS_STABLE_TO_TOTAL_DEBT_RATIO
);
vars.currentStableBorrowRate += _stableRateExcessOffset.rayMul(
excessStableDebtRatio
);
}
vars.currentLiquidityRate = _getOverallBorrowRate(
params.totalStableDebt,
params.totalVariableDebt,
vars.currentVariableBorrowRate,
params.averageStableBorrowRate
).rayMul(vars.supplyUsageRatio).percentMul(
PercentageMath.PERCENTAGE_FACTOR - params.reserveFactor
);
return (
vars.currentLiquidityRate,
vars.currentStableBorrowRate,
vars.currentVariableBorrowRate
);
}
/**
* @dev Calculates the overall borrow rate as the weighted average between the total variable debt and total stable
* debt
* @param totalStableDebt The total borrowed from the reserve at a stable rate
* @param totalVariableDebt The total borrowed from the reserve at a variable rate
* @param currentVariableBorrowRate The current variable borrow rate of the reserve
* @param currentAverageStableBorrowRate The current weighted average of all the stable rate loans
* @return The weighted averaged borrow rate
*/
function _getOverallBorrowRate(
uint256 totalStableDebt,
uint256 totalVariableDebt,
uint256 currentVariableBorrowRate,
uint256 currentAverageStableBorrowRate
) internal pure returns (uint256) {
uint256 totalDebt = totalStableDebt + totalVariableDebt;
if (totalDebt == 0) return 0;
uint256 weightedVariableRate = totalVariableDebt.wadToRay().rayMul(
currentVariableBorrowRate
);
uint256 weightedStableRate = totalStableDebt.wadToRay().rayMul(
currentAverageStableBorrowRate
);
uint256 overallBorrowRate = (weightedVariableRate + weightedStableRate)
.rayDiv(totalDebt.wadToRay());
return overallBorrowRate;
}
}// SPDX-License-Identifier: AGPL-3.0
/* ———————————————————————————————————————————————————————————————————————————————— *
* _____ ______ ______ __ __ __ __ ______ __ __ *
* /\ __-. /\__ _\ /\ == \ /\ \ /\ "-.\ \ /\ \ /\__ _\ /\ \_\ \ *
* \ \ \/\ \ \/_/\ \/ \ \ __< \ \ \ \ \ \-. \ \ \ \ \/_/\ \/ \ \____ \ *
* \ \____- \ \_\ \ \_\ \_\ \ \_\ \ \_\\"\_\ \ \_\ \ \_\ \/\_____\ *
* \/____/ \/_/ \/_/ /_/ \/_/ \/_/ \/_/ \/_/ \/_/ \/_____/ *
* *
* ————————————————————————————————— dtrinity.org ————————————————————————————————— *
* *
* ▲ *
* ▲ ▲ *
* *
* ———————————————————————————————————————————————————————————————————————————————— *
* dTRINITY Protocol: https://github.com/dtrinity *
* ———————————————————————————————————————————————————————————————————————————————— */
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(
address recipient,
uint256 amount
) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(
address owner,
address spender
) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}// SPDX-License-Identifier: AGPL-3.0
/* ———————————————————————————————————————————————————————————————————————————————— *
* _____ ______ ______ __ __ __ __ ______ __ __ *
* /\ __-. /\__ _\ /\ == \ /\ \ /\ "-.\ \ /\ \ /\__ _\ /\ \_\ \ *
* \ \ \/\ \ \/_/\ \/ \ \ __< \ \ \ \ \ \-. \ \ \ \ \/_/\ \/ \ \____ \ *
* \ \____- \ \_\ \ \_\ \_\ \ \_\ \ \_\\"\_\ \ \_\ \ \_\ \/\_____\ *
* \/____/ \/_/ \/_/ /_/ \/_/ \/_/ \/_/ \/_/ \/_/ \/_____/ *
* *
* ————————————————————————————————— dtrinity.org ————————————————————————————————— *
* *
* ▲ *
* ▲ ▲ *
* *
* ———————————————————————————————————————————————————————————————————————————————— *
* dTRINITY Protocol: https://github.com/dtrinity *
* ———————————————————————————————————————————————————————————————————————————————— */
pragma solidity ^0.8.0;
import {IReserveInterestRateStrategy} from "./IReserveInterestRateStrategy.sol";
import {IPoolAddressesProvider} from "./IPoolAddressesProvider.sol";
/**
* @title IDefaultInterestRateStrategy
* @author Aave
* @notice Defines the basic interface of the DefaultReserveInterestRateStrategy
*/
interface IDefaultInterestRateStrategy is IReserveInterestRateStrategy {
/**
* @notice Returns the usage ratio at which the pool aims to obtain most competitive borrow rates.
* @return The optimal usage ratio, expressed in ray.
*/
function OPTIMAL_USAGE_RATIO() external view returns (uint256);
/**
* @notice Returns the optimal stable to total debt ratio of the reserve.
* @return The optimal stable to total debt ratio, expressed in ray.
*/
function OPTIMAL_STABLE_TO_TOTAL_DEBT_RATIO()
external
view
returns (uint256);
/**
* @notice Returns the excess usage ratio above the optimal.
* @dev It's always equal to 1-optimal usage ratio (added as constant for gas optimizations)
* @return The max excess usage ratio, expressed in ray.
*/
function MAX_EXCESS_USAGE_RATIO() external view returns (uint256);
/**
* @notice Returns the excess stable debt ratio above the optimal.
* @dev It's always equal to 1-optimal stable to total debt ratio (added as constant for gas optimizations)
* @return The max excess stable to total debt ratio, expressed in ray.
*/
function MAX_EXCESS_STABLE_TO_TOTAL_DEBT_RATIO()
external
view
returns (uint256);
/**
* @notice Returns the address of the PoolAddressesProvider
* @return The address of the PoolAddressesProvider contract
*/
function ADDRESSES_PROVIDER()
external
view
returns (IPoolAddressesProvider);
/**
* @notice Returns the variable rate slope below optimal usage ratio
* @dev It's the variable rate when usage ratio > 0 and <= OPTIMAL_USAGE_RATIO
* @return The variable rate slope, expressed in ray
*/
function getVariableRateSlope1() external view returns (uint256);
/**
* @notice Returns the variable rate slope above optimal usage ratio
* @dev It's the variable rate when usage ratio > OPTIMAL_USAGE_RATIO
* @return The variable rate slope, expressed in ray
*/
function getVariableRateSlope2() external view returns (uint256);
/**
* @notice Returns the stable rate slope below optimal usage ratio
* @dev It's the stable rate when usage ratio > 0 and <= OPTIMAL_USAGE_RATIO
* @return The stable rate slope, expressed in ray
*/
function getStableRateSlope1() external view returns (uint256);
/**
* @notice Returns the stable rate slope above optimal usage ratio
* @dev It's the variable rate when usage ratio > OPTIMAL_USAGE_RATIO
* @return The stable rate slope, expressed in ray
*/
function getStableRateSlope2() external view returns (uint256);
/**
* @notice Returns the stable rate excess offset
* @dev It's an additional premium applied to the stable when stable debt > OPTIMAL_STABLE_TO_TOTAL_DEBT_RATIO
* @return The stable rate excess offset, expressed in ray
*/
function getStableRateExcessOffset() external view returns (uint256);
/**
* @notice Returns the base stable borrow rate
* @return The base stable borrow rate, expressed in ray
*/
function getBaseStableBorrowRate() external view returns (uint256);
/**
* @notice Returns the base variable borrow rate
* @return The base variable borrow rate, expressed in ray
*/
function getBaseVariableBorrowRate() external view returns (uint256);
/**
* @notice Returns the maximum variable borrow rate
* @return The maximum variable borrow rate, expressed in ray
*/
function getMaxVariableBorrowRate() external view returns (uint256);
}// SPDX-License-Identifier: AGPL-3.0
/* ———————————————————————————————————————————————————————————————————————————————— *
* _____ ______ ______ __ __ __ __ ______ __ __ *
* /\ __-. /\__ _\ /\ == \ /\ \ /\ "-.\ \ /\ \ /\__ _\ /\ \_\ \ *
* \ \ \/\ \ \/_/\ \/ \ \ __< \ \ \ \ \ \-. \ \ \ \ \/_/\ \/ \ \____ \ *
* \ \____- \ \_\ \ \_\ \_\ \ \_\ \ \_\\"\_\ \ \_\ \ \_\ \/\_____\ *
* \/____/ \/_/ \/_/ /_/ \/_/ \/_/ \/_/ \/_/ \/_/ \/_____/ *
* *
* ————————————————————————————————— dtrinity.org ————————————————————————————————— *
* *
* ▲ *
* ▲ ▲ *
* *
* ———————————————————————————————————————————————————————————————————————————————— *
* dTRINITY Protocol: https://github.com/dtrinity *
* ———————————————————————————————————————————————————————————————————————————————— */
pragma solidity ^0.8.0;
/**
* @title IPoolAddressesProvider
* @author Aave
* @notice Defines the basic interface for a Pool Addresses Provider.
*/
interface IPoolAddressesProvider {
/**
* @dev Emitted when the market identifier is updated.
* @param oldMarketId The old id of the market
* @param newMarketId The new id of the market
*/
event MarketIdSet(string indexed oldMarketId, string indexed newMarketId);
/**
* @dev Emitted when the pool is updated.
* @param oldAddress The old address of the Pool
* @param newAddress The new address of the Pool
*/
event PoolUpdated(address indexed oldAddress, address indexed newAddress);
/**
* @dev Emitted when the pool configurator is updated.
* @param oldAddress The old address of the PoolConfigurator
* @param newAddress The new address of the PoolConfigurator
*/
event PoolConfiguratorUpdated(
address indexed oldAddress,
address indexed newAddress
);
/**
* @dev Emitted when the price oracle is updated.
* @param oldAddress The old address of the PriceOracle
* @param newAddress The new address of the PriceOracle
*/
event PriceOracleUpdated(
address indexed oldAddress,
address indexed newAddress
);
/**
* @dev Emitted when the ACL manager is updated.
* @param oldAddress The old address of the ACLManager
* @param newAddress The new address of the ACLManager
*/
event ACLManagerUpdated(
address indexed oldAddress,
address indexed newAddress
);
/**
* @dev Emitted when the ACL admin is updated.
* @param oldAddress The old address of the ACLAdmin
* @param newAddress The new address of the ACLAdmin
*/
event ACLAdminUpdated(
address indexed oldAddress,
address indexed newAddress
);
/**
* @dev Emitted when the price oracle sentinel is updated.
* @param oldAddress The old address of the PriceOracleSentinel
* @param newAddress The new address of the PriceOracleSentinel
*/
event PriceOracleSentinelUpdated(
address indexed oldAddress,
address indexed newAddress
);
/**
* @dev Emitted when the pool data provider is updated.
* @param oldAddress The old address of the PoolDataProvider
* @param newAddress The new address of the PoolDataProvider
*/
event PoolDataProviderUpdated(
address indexed oldAddress,
address indexed newAddress
);
/**
* @dev Emitted when a new proxy is created.
* @param id The identifier of the proxy
* @param proxyAddress The address of the created proxy contract
* @param implementationAddress The address of the implementation contract
*/
event ProxyCreated(
bytes32 indexed id,
address indexed proxyAddress,
address indexed implementationAddress
);
/**
* @dev Emitted when a new non-proxied contract address is registered.
* @param id The identifier of the contract
* @param oldAddress The address of the old contract
* @param newAddress The address of the new contract
*/
event AddressSet(
bytes32 indexed id,
address indexed oldAddress,
address indexed newAddress
);
/**
* @dev Emitted when the implementation of the proxy registered with id is updated
* @param id The identifier of the contract
* @param proxyAddress The address of the proxy contract
* @param oldImplementationAddress The address of the old implementation contract
* @param newImplementationAddress The address of the new implementation contract
*/
event AddressSetAsProxy(
bytes32 indexed id,
address indexed proxyAddress,
address oldImplementationAddress,
address indexed newImplementationAddress
);
/**
* @notice Returns the id of the Aave market to which this contract points to.
* @return The market id
*/
function getMarketId() external view returns (string memory);
/**
* @notice Associates an id with a specific PoolAddressesProvider.
* @dev This can be used to create an onchain registry of PoolAddressesProviders to
* identify and validate multiple Aave markets.
* @param newMarketId The market id
*/
function setMarketId(string calldata newMarketId) external;
/**
* @notice Returns an address by its identifier.
* @dev The returned address might be an EOA or a contract, potentially proxied
* @dev It returns ZERO if there is no registered address with the given id
* @param id The id
* @return The address of the registered for the specified id
*/
function getAddressFromID(bytes32 id) external view returns (address);
/**
* @notice General function to update the implementation of a proxy registered with
* certain `id`. If there is no proxy registered, it will instantiate one and
* set as implementation the `newImplementationAddress`.
* @dev IMPORTANT Use this function carefully, only for ids that don't have an explicit
* setter function, in order to avoid unexpected consequences
* @param id The id
* @param newImplementationAddress The address of the new implementation
*/
function setAddressAsProxy(
bytes32 id,
address newImplementationAddress
) external;
/**
* @notice Sets an address for an id replacing the address saved in the addresses map.
* @dev IMPORTANT Use this function carefully, as it will do a hard replacement
* @param id The id
* @param newAddress The address to set
*/
function setAddress(bytes32 id, address newAddress) external;
/**
* @notice Returns the address of the Pool proxy.
* @return The Pool proxy address
*/
function getPool() external view returns (address);
/**
* @notice Updates the implementation of the Pool, or creates a proxy
* setting the new `pool` implementation when the function is called for the first time.
* @param newPoolImpl The new Pool implementation
*/
function setPoolImpl(address newPoolImpl) external;
/**
* @notice Returns the address of the PoolConfigurator proxy.
* @return The PoolConfigurator proxy address
*/
function getPoolConfigurator() external view returns (address);
/**
* @notice Updates the implementation of the PoolConfigurator, or creates a proxy
* setting the new `PoolConfigurator` implementation when the function is called for the first time.
* @param newPoolConfiguratorImpl The new PoolConfigurator implementation
*/
function setPoolConfiguratorImpl(address newPoolConfiguratorImpl) external;
/**
* @notice Returns the address of the price oracle.
* @return The address of the PriceOracle
*/
function getPriceOracle() external view returns (address);
/**
* @notice Updates the address of the price oracle.
* @param newPriceOracle The address of the new PriceOracle
*/
function setPriceOracle(address newPriceOracle) external;
/**
* @notice Returns the address of the ACL manager.
* @return The address of the ACLManager
*/
function getACLManager() external view returns (address);
/**
* @notice Updates the address of the ACL manager.
* @param newAclManager The address of the new ACLManager
*/
function setACLManager(address newAclManager) external;
/**
* @notice Returns the address of the ACL admin.
* @return The address of the ACL admin
*/
function getACLAdmin() external view returns (address);
/**
* @notice Updates the address of the ACL admin.
* @param newAclAdmin The address of the new ACL admin
*/
function setACLAdmin(address newAclAdmin) external;
/**
* @notice Returns the address of the price oracle sentinel.
* @return The address of the PriceOracleSentinel
*/
function getPriceOracleSentinel() external view returns (address);
/**
* @notice Updates the address of the price oracle sentinel.
* @param newPriceOracleSentinel The address of the new PriceOracleSentinel
*/
function setPriceOracleSentinel(address newPriceOracleSentinel) external;
/**
* @notice Returns the address of the data provider.
* @return The address of the DataProvider
*/
function getPoolDataProvider() external view returns (address);
/**
* @notice Updates the address of the data provider.
* @param newDataProvider The address of the new DataProvider
*/
function setPoolDataProvider(address newDataProvider) external;
}// SPDX-License-Identifier: AGPL-3.0
/* ———————————————————————————————————————————————————————————————————————————————— *
* _____ ______ ______ __ __ __ __ ______ __ __ *
* /\ __-. /\__ _\ /\ == \ /\ \ /\ "-.\ \ /\ \ /\__ _\ /\ \_\ \ *
* \ \ \/\ \ \/_/\ \/ \ \ __< \ \ \ \ \ \-. \ \ \ \ \/_/\ \/ \ \____ \ *
* \ \____- \ \_\ \ \_\ \_\ \ \_\ \ \_\\"\_\ \ \_\ \ \_\ \/\_____\ *
* \/____/ \/_/ \/_/ /_/ \/_/ \/_/ \/_/ \/_/ \/_/ \/_____/ *
* *
* ————————————————————————————————— dtrinity.org ————————————————————————————————— *
* *
* ▲ *
* ▲ ▲ *
* *
* ———————————————————————————————————————————————————————————————————————————————— *
* dTRINITY Protocol: https://github.com/dtrinity *
* ———————————————————————————————————————————————————————————————————————————————— */
pragma solidity ^0.8.0;
import {DataTypes} from "../protocol/libraries/types/DataTypes.sol";
/**
* @title IReserveInterestRateStrategy
* @author Aave
* @notice Interface for the calculation of the interest rates
*/
interface IReserveInterestRateStrategy {
/**
* @notice Calculates the interest rates depending on the reserve's state and configurations
* @param params The parameters needed to calculate interest rates
* @return liquidityRate The liquidity rate expressed in rays
* @return stableBorrowRate The stable borrow rate expressed in rays
* @return variableBorrowRate The variable borrow rate expressed in rays
*/
function calculateInterestRates(
DataTypes.CalculateInterestRatesParams memory params
) external view returns (uint256, uint256, uint256);
}// SPDX-License-Identifier: BUSL-1.1
/* ———————————————————————————————————————————————————————————————————————————————— *
* _____ ______ ______ __ __ __ __ ______ __ __ *
* /\ __-. /\__ _\ /\ == \ /\ \ /\ "-.\ \ /\ \ /\__ _\ /\ \_\ \ *
* \ \ \/\ \ \/_/\ \/ \ \ __< \ \ \ \ \ \-. \ \ \ \ \/_/\ \/ \ \____ \ *
* \ \____- \ \_\ \ \_\ \_\ \ \_\ \ \_\\"\_\ \ \_\ \ \_\ \/\_____\ *
* \/____/ \/_/ \/_/ /_/ \/_/ \/_/ \/_/ \/_/ \/_/ \/_____/ *
* *
* ————————————————————————————————— dtrinity.org ————————————————————————————————— *
* *
* ▲ *
* ▲ ▲ *
* *
* ———————————————————————————————————————————————————————————————————————————————— *
* dTRINITY Protocol: https://github.com/dtrinity *
* ———————————————————————————————————————————————————————————————————————————————— */
pragma solidity ^0.8.0;
/**
* @title Errors library
* @author Aave
* @notice Defines the error messages emitted by the different contracts of the Aave protocol
*/
library Errors {
string public constant CALLER_NOT_POOL_ADMIN = "1"; // 'The caller of the function is not a pool admin'
string public constant CALLER_NOT_EMERGENCY_ADMIN = "2"; // 'The caller of the function is not an emergency admin'
string public constant CALLER_NOT_POOL_OR_EMERGENCY_ADMIN = "3"; // 'The caller of the function is not a pool or emergency admin'
string public constant CALLER_NOT_RISK_OR_POOL_ADMIN = "4"; // 'The caller of the function is not a risk or pool admin'
string public constant CALLER_NOT_ASSET_LISTING_OR_POOL_ADMIN = "5"; // 'The caller of the function is not an asset listing or pool admin'
string public constant CALLER_NOT_BRIDGE = "6"; // 'The caller of the function is not a bridge'
string public constant ADDRESSES_PROVIDER_NOT_REGISTERED = "7"; // 'Pool addresses provider is not registered'
string public constant INVALID_ADDRESSES_PROVIDER_ID = "8"; // 'Invalid id for the pool addresses provider'
string public constant NOT_CONTRACT = "9"; // 'Address is not a contract'
string public constant CALLER_NOT_POOL_CONFIGURATOR = "10"; // 'The caller of the function is not the pool configurator'
string public constant CALLER_NOT_ATOKEN = "11"; // 'The caller of the function is not an AToken'
string public constant INVALID_ADDRESSES_PROVIDER = "12"; // 'The address of the pool addresses provider is invalid'
string public constant INVALID_FLASHLOAN_EXECUTOR_RETURN = "13"; // 'Invalid return value of the flashloan executor function'
string public constant RESERVE_ALREADY_ADDED = "14"; // 'Reserve has already been added to reserve list'
string public constant NO_MORE_RESERVES_ALLOWED = "15"; // 'Maximum amount of reserves in the pool reached'
string public constant EMODE_CATEGORY_RESERVED = "16"; // 'Zero eMode category is reserved for volatile heterogeneous assets'
string public constant INVALID_EMODE_CATEGORY_ASSIGNMENT = "17"; // 'Invalid eMode category assignment to asset'
string public constant RESERVE_LIQUIDITY_NOT_ZERO = "18"; // 'The liquidity of the reserve needs to be 0'
string public constant FLASHLOAN_PREMIUM_INVALID = "19"; // 'Invalid flashloan premium'
string public constant INVALID_RESERVE_PARAMS = "20"; // 'Invalid risk parameters for the reserve'
string public constant INVALID_EMODE_CATEGORY_PARAMS = "21"; // 'Invalid risk parameters for the eMode category'
string public constant BRIDGE_PROTOCOL_FEE_INVALID = "22"; // 'Invalid bridge protocol fee'
string public constant CALLER_MUST_BE_POOL = "23"; // 'The caller of this function must be a pool'
string public constant INVALID_MINT_AMOUNT = "24"; // 'Invalid amount to mint'
string public constant INVALID_BURN_AMOUNT = "25"; // 'Invalid amount to burn'
string public constant INVALID_AMOUNT = "26"; // 'Amount must be greater than 0'
string public constant RESERVE_INACTIVE = "27"; // 'Action requires an active reserve'
string public constant RESERVE_FROZEN = "28"; // 'Action cannot be performed because the reserve is frozen'
string public constant RESERVE_PAUSED = "29"; // 'Action cannot be performed because the reserve is paused'
string public constant BORROWING_NOT_ENABLED = "30"; // 'Borrowing is not enabled'
string public constant STABLE_BORROWING_NOT_ENABLED = "31"; // 'Stable borrowing is not enabled'
string public constant NOT_ENOUGH_AVAILABLE_USER_BALANCE = "32"; // 'User cannot withdraw more than the available balance'
string public constant INVALID_INTEREST_RATE_MODE_SELECTED = "33"; // 'Invalid interest rate mode selected'
string public constant COLLATERAL_BALANCE_IS_ZERO = "34"; // 'The collateral balance is 0'
string public constant HEALTH_FACTOR_LOWER_THAN_LIQUIDATION_THRESHOLD =
"35"; // 'Health factor is lesser than the liquidation threshold'
string public constant COLLATERAL_CANNOT_COVER_NEW_BORROW = "36"; // 'There is not enough collateral to cover a new borrow'
string public constant COLLATERAL_SAME_AS_BORROWING_CURRENCY = "37"; // 'Collateral is (mostly) the same currency that is being borrowed'
string public constant AMOUNT_BIGGER_THAN_MAX_LOAN_SIZE_STABLE = "38"; // 'The requested amount is greater than the max loan size in stable rate mode'
string public constant NO_DEBT_OF_SELECTED_TYPE = "39"; // 'For repayment of a specific type of debt, the user needs to have debt that type'
string public constant NO_EXPLICIT_AMOUNT_TO_REPAY_ON_BEHALF = "40"; // 'To repay on behalf of a user an explicit amount to repay is needed'
string public constant NO_OUTSTANDING_STABLE_DEBT = "41"; // 'User does not have outstanding stable rate debt on this reserve'
string public constant NO_OUTSTANDING_VARIABLE_DEBT = "42"; // 'User does not have outstanding variable rate debt on this reserve'
string public constant UNDERLYING_BALANCE_ZERO = "43"; // 'The underlying balance needs to be greater than 0'
string public constant INTEREST_RATE_REBALANCE_CONDITIONS_NOT_MET = "44"; // 'Interest rate rebalance conditions were not met'
string public constant HEALTH_FACTOR_NOT_BELOW_THRESHOLD = "45"; // 'Health factor is not below the threshold'
string public constant COLLATERAL_CANNOT_BE_LIQUIDATED = "46"; // 'The collateral chosen cannot be liquidated'
string public constant SPECIFIED_CURRENCY_NOT_BORROWED_BY_USER = "47"; // 'User did not borrow the specified currency'
string public constant INCONSISTENT_FLASHLOAN_PARAMS = "49"; // 'Inconsistent flashloan parameters'
string public constant BORROW_CAP_EXCEEDED = "50"; // 'Borrow cap is exceeded'
string public constant SUPPLY_CAP_EXCEEDED = "51"; // 'Supply cap is exceeded'
string public constant UNBACKED_MINT_CAP_EXCEEDED = "52"; // 'Unbacked mint cap is exceeded'
string public constant DEBT_CEILING_EXCEEDED = "53"; // 'Debt ceiling is exceeded'
string public constant UNDERLYING_CLAIMABLE_RIGHTS_NOT_ZERO = "54"; // 'Claimable rights over underlying not zero (aToken supply or accruedToTreasury)'
string public constant STABLE_DEBT_NOT_ZERO = "55"; // 'Stable debt supply is not zero'
string public constant VARIABLE_DEBT_SUPPLY_NOT_ZERO = "56"; // 'Variable debt supply is not zero'
string public constant LTV_VALIDATION_FAILED = "57"; // 'Ltv validation failed'
string public constant INCONSISTENT_EMODE_CATEGORY = "58"; // 'Inconsistent eMode category'
string public constant PRICE_ORACLE_SENTINEL_CHECK_FAILED = "59"; // 'Price oracle sentinel validation failed'
string public constant ASSET_NOT_BORROWABLE_IN_ISOLATION = "60"; // 'Asset is not borrowable in isolation mode'
string public constant RESERVE_ALREADY_INITIALIZED = "61"; // 'Reserve has already been initialized'
string public constant USER_IN_ISOLATION_MODE_OR_LTV_ZERO = "62"; // 'User is in isolation mode or ltv is zero'
string public constant INVALID_LTV = "63"; // 'Invalid ltv parameter for the reserve'
string public constant INVALID_LIQ_THRESHOLD = "64"; // 'Invalid liquidity threshold parameter for the reserve'
string public constant INVALID_LIQ_BONUS = "65"; // 'Invalid liquidity bonus parameter for the reserve'
string public constant INVALID_DECIMALS = "66"; // 'Invalid decimals parameter of the underlying asset of the reserve'
string public constant INVALID_RESERVE_FACTOR = "67"; // 'Invalid reserve factor parameter for the reserve'
string public constant INVALID_BORROW_CAP = "68"; // 'Invalid borrow cap for the reserve'
string public constant INVALID_SUPPLY_CAP = "69"; // 'Invalid supply cap for the reserve'
string public constant INVALID_LIQUIDATION_PROTOCOL_FEE = "70"; // 'Invalid liquidation protocol fee for the reserve'
string public constant INVALID_EMODE_CATEGORY = "71"; // 'Invalid eMode category for the reserve'
string public constant INVALID_UNBACKED_MINT_CAP = "72"; // 'Invalid unbacked mint cap for the reserve'
string public constant INVALID_DEBT_CEILING = "73"; // 'Invalid debt ceiling for the reserve
string public constant INVALID_RESERVE_INDEX = "74"; // 'Invalid reserve index'
string public constant ACL_ADMIN_CANNOT_BE_ZERO = "75"; // 'ACL admin cannot be set to the zero address'
string public constant INCONSISTENT_PARAMS_LENGTH = "76"; // 'Array parameters that should be equal length are not'
string public constant ZERO_ADDRESS_NOT_VALID = "77"; // 'Zero address not valid'
string public constant INVALID_EXPIRATION = "78"; // 'Invalid expiration'
string public constant INVALID_SIGNATURE = "79"; // 'Invalid signature'
string public constant OPERATION_NOT_SUPPORTED = "80"; // 'Operation not supported'
string public constant DEBT_CEILING_NOT_ZERO = "81"; // 'Debt ceiling is not zero'
string public constant ASSET_NOT_LISTED = "82"; // 'Asset is not listed'
string public constant INVALID_OPTIMAL_USAGE_RATIO = "83"; // 'Invalid optimal usage ratio'
string public constant INVALID_OPTIMAL_STABLE_TO_TOTAL_DEBT_RATIO = "84"; // 'Invalid optimal stable to total debt ratio'
string public constant UNDERLYING_CANNOT_BE_RESCUED = "85"; // 'The underlying asset cannot be rescued'
string public constant ADDRESSES_PROVIDER_ALREADY_ADDED = "86"; // 'Reserve has already been added to reserve list'
string public constant POOL_ADDRESSES_DO_NOT_MATCH = "87"; // 'The token implementation pool address and the pool address provided by the initializing pool do not match'
string public constant STABLE_BORROWING_ENABLED = "88"; // 'Stable borrowing is enabled'
string public constant SILOED_BORROWING_VIOLATION = "89"; // 'User is trying to borrow multiple assets including a siloed one'
string public constant RESERVE_DEBT_NOT_ZERO = "90"; // the total debt of the reserve needs to be 0
string public constant FLASHLOAN_DISABLED = "91"; // FlashLoaning for this asset is disabled
}// SPDX-License-Identifier: BUSL-1.1
/* ———————————————————————————————————————————————————————————————————————————————— *
* _____ ______ ______ __ __ __ __ ______ __ __ *
* /\ __-. /\__ _\ /\ == \ /\ \ /\ "-.\ \ /\ \ /\__ _\ /\ \_\ \ *
* \ \ \/\ \ \/_/\ \/ \ \ __< \ \ \ \ \ \-. \ \ \ \ \/_/\ \/ \ \____ \ *
* \ \____- \ \_\ \ \_\ \_\ \ \_\ \ \_\\"\_\ \ \_\ \ \_\ \/\_____\ *
* \/____/ \/_/ \/_/ /_/ \/_/ \/_/ \/_/ \/_/ \/_/ \/_____/ *
* *
* ————————————————————————————————— dtrinity.org ————————————————————————————————— *
* *
* ▲ *
* ▲ ▲ *
* *
* ———————————————————————————————————————————————————————————————————————————————— *
* dTRINITY Protocol: https://github.com/dtrinity *
* ———————————————————————————————————————————————————————————————————————————————— */
pragma solidity ^0.8.0;
/**
* @title PercentageMath library
* @author Aave
* @notice Provides functions to perform percentage calculations
* @dev Percentages are defined by default with 2 decimals of precision (100.00). The precision is indicated by PERCENTAGE_FACTOR
* @dev Operations are rounded. If a value is >=.5, will be rounded up, otherwise rounded down.
*/
library PercentageMath {
// Maximum percentage factor (100.00%)
uint256 internal constant PERCENTAGE_FACTOR = 1e4;
// Half percentage factor (50.00%)
uint256 internal constant HALF_PERCENTAGE_FACTOR = 0.5e4;
/**
* @notice Executes a percentage multiplication
* @dev assembly optimized for improved gas savings, see https://twitter.com/transmissions11/status/1451131036377571328
* @param value The value of which the percentage needs to be calculated
* @param percentage The percentage of the value to be calculated
* @return result value percentmul percentage
*/
function percentMul(
uint256 value,
uint256 percentage
) internal pure returns (uint256 result) {
// to avoid overflow, value <= (type(uint256).max - HALF_PERCENTAGE_FACTOR) / percentage
assembly {
if iszero(
or(
iszero(percentage),
iszero(
gt(
value,
div(sub(not(0), HALF_PERCENTAGE_FACTOR), percentage)
)
)
)
) {
revert(0, 0)
}
result := div(
add(mul(value, percentage), HALF_PERCENTAGE_FACTOR),
PERCENTAGE_FACTOR
)
}
}
/**
* @notice Executes a percentage division
* @dev assembly optimized for improved gas savings, see https://twitter.com/transmissions11/status/1451131036377571328
* @param value The value of which the percentage needs to be calculated
* @param percentage The percentage of the value to be calculated
* @return result value percentdiv percentage
*/
function percentDiv(
uint256 value,
uint256 percentage
) internal pure returns (uint256 result) {
// to avoid overflow, value <= (type(uint256).max - halfPercentage) / PERCENTAGE_FACTOR
assembly {
if or(
iszero(percentage),
iszero(
iszero(
gt(
value,
div(
sub(not(0), div(percentage, 2)),
PERCENTAGE_FACTOR
)
)
)
)
) {
revert(0, 0)
}
result := div(
add(mul(value, PERCENTAGE_FACTOR), div(percentage, 2)),
percentage
)
}
}
}// SPDX-License-Identifier: BUSL-1.1
/* ———————————————————————————————————————————————————————————————————————————————— *
* _____ ______ ______ __ __ __ __ ______ __ __ *
* /\ __-. /\__ _\ /\ == \ /\ \ /\ "-.\ \ /\ \ /\__ _\ /\ \_\ \ *
* \ \ \/\ \ \/_/\ \/ \ \ __< \ \ \ \ \ \-. \ \ \ \ \/_/\ \/ \ \____ \ *
* \ \____- \ \_\ \ \_\ \_\ \ \_\ \ \_\\"\_\ \ \_\ \ \_\ \/\_____\ *
* \/____/ \/_/ \/_/ /_/ \/_/ \/_/ \/_/ \/_/ \/_/ \/_____/ *
* *
* ————————————————————————————————— dtrinity.org ————————————————————————————————— *
* *
* ▲ *
* ▲ ▲ *
* *
* ———————————————————————————————————————————————————————————————————————————————— *
* dTRINITY Protocol: https://github.com/dtrinity *
* ———————————————————————————————————————————————————————————————————————————————— */
pragma solidity ^0.8.0;
/**
* @title WadRayMath library
* @author Aave
* @notice Provides functions to perform calculations with Wad and Ray units
* @dev Provides mul and div function for wads (decimal numbers with 18 digits of precision) and rays (decimal numbers
* with 27 digits of precision)
* @dev Operations are rounded. If a value is >=.5, will be rounded up, otherwise rounded down.
*/
library WadRayMath {
// HALF_WAD and HALF_RAY expressed with extended notation as constant with operations are not supported in Yul assembly
uint256 internal constant WAD = 1e18;
uint256 internal constant HALF_WAD = 0.5e18;
uint256 internal constant RAY = 1e27;
uint256 internal constant HALF_RAY = 0.5e27;
uint256 internal constant WAD_RAY_RATIO = 1e9;
/**
* @dev Multiplies two wad, rounding half up to the nearest wad
* @dev assembly optimized for improved gas savings, see https://twitter.com/transmissions11/status/1451131036377571328
* @param a Wad
* @param b Wad
* @return c = a*b, in wad
*/
function wadMul(uint256 a, uint256 b) internal pure returns (uint256 c) {
// to avoid overflow, a <= (type(uint256).max - HALF_WAD) / b
assembly {
if iszero(
or(iszero(b), iszero(gt(a, div(sub(not(0), HALF_WAD), b))))
) {
revert(0, 0)
}
c := div(add(mul(a, b), HALF_WAD), WAD)
}
}
/**
* @dev Divides two wad, rounding half up to the nearest wad
* @dev assembly optimized for improved gas savings, see https://twitter.com/transmissions11/status/1451131036377571328
* @param a Wad
* @param b Wad
* @return c = a/b, in wad
*/
function wadDiv(uint256 a, uint256 b) internal pure returns (uint256 c) {
// to avoid overflow, a <= (type(uint256).max - halfB) / WAD
assembly {
if or(
iszero(b),
iszero(iszero(gt(a, div(sub(not(0), div(b, 2)), WAD))))
) {
revert(0, 0)
}
c := div(add(mul(a, WAD), div(b, 2)), b)
}
}
/**
* @notice Multiplies two ray, rounding half up to the nearest ray
* @dev assembly optimized for improved gas savings, see https://twitter.com/transmissions11/status/1451131036377571328
* @param a Ray
* @param b Ray
* @return c = a raymul b
*/
function rayMul(uint256 a, uint256 b) internal pure returns (uint256 c) {
// to avoid overflow, a <= (type(uint256).max - HALF_RAY) / b
assembly {
if iszero(
or(iszero(b), iszero(gt(a, div(sub(not(0), HALF_RAY), b))))
) {
revert(0, 0)
}
c := div(add(mul(a, b), HALF_RAY), RAY)
}
}
/**
* @notice Divides two ray, rounding half up to the nearest ray
* @dev assembly optimized for improved gas savings, see https://twitter.com/transmissions11/status/1451131036377571328
* @param a Ray
* @param b Ray
* @return c = a raydiv b
*/
function rayDiv(uint256 a, uint256 b) internal pure returns (uint256 c) {
// to avoid overflow, a <= (type(uint256).max - halfB) / RAY
assembly {
if or(
iszero(b),
iszero(iszero(gt(a, div(sub(not(0), div(b, 2)), RAY))))
) {
revert(0, 0)
}
c := div(add(mul(a, RAY), div(b, 2)), b)
}
}
/**
* @dev Casts ray down to wad
* @dev assembly optimized for improved gas savings, see https://twitter.com/transmissions11/status/1451131036377571328
* @param a Ray
* @return b = a converted to wad, rounded half up to the nearest wad
*/
function rayToWad(uint256 a) internal pure returns (uint256 b) {
assembly {
b := div(a, WAD_RAY_RATIO)
let remainder := mod(a, WAD_RAY_RATIO)
if iszero(lt(remainder, div(WAD_RAY_RATIO, 2))) {
b := add(b, 1)
}
}
}
/**
* @dev Converts wad up to ray
* @dev assembly optimized for improved gas savings, see https://twitter.com/transmissions11/status/1451131036377571328
* @param a Wad
* @return b = a converted in ray
*/
function wadToRay(uint256 a) internal pure returns (uint256 b) {
// to avoid overflow, b/WAD_RAY_RATIO == a
assembly {
b := mul(a, WAD_RAY_RATIO)
if iszero(eq(div(b, WAD_RAY_RATIO), a)) {
revert(0, 0)
}
}
}
}// SPDX-License-Identifier: BUSL-1.1
/* ———————————————————————————————————————————————————————————————————————————————— *
* _____ ______ ______ __ __ __ __ ______ __ __ *
* /\ __-. /\__ _\ /\ == \ /\ \ /\ "-.\ \ /\ \ /\__ _\ /\ \_\ \ *
* \ \ \/\ \ \/_/\ \/ \ \ __< \ \ \ \ \ \-. \ \ \ \ \/_/\ \/ \ \____ \ *
* \ \____- \ \_\ \ \_\ \_\ \ \_\ \ \_\\"\_\ \ \_\ \ \_\ \/\_____\ *
* \/____/ \/_/ \/_/ /_/ \/_/ \/_/ \/_/ \/_/ \/_/ \/_____/ *
* *
* ————————————————————————————————— dtrinity.org ————————————————————————————————— *
* *
* ▲ *
* ▲ ▲ *
* *
* ———————————————————————————————————————————————————————————————————————————————— *
* dTRINITY Protocol: https://github.com/dtrinity *
* ———————————————————————————————————————————————————————————————————————————————— */
pragma solidity ^0.8.0;
library DataTypes {
struct ReserveData {
//stores the reserve configuration
ReserveConfigurationMap configuration;
//the liquidity index. Expressed in ray
uint128 liquidityIndex;
//the current supply rate. Expressed in ray
uint128 currentLiquidityRate;
//variable borrow index. Expressed in ray
uint128 variableBorrowIndex;
//the current variable borrow rate. Expressed in ray
uint128 currentVariableBorrowRate;
//the current stable borrow rate. Expressed in ray
uint128 currentStableBorrowRate;
//timestamp of last update
uint40 lastUpdateTimestamp;
//the id of the reserve. Represents the position in the list of the active reserves
uint16 id;
//aToken address
address aTokenAddress;
//stableDebtToken address
address stableDebtTokenAddress;
//variableDebtToken address
address variableDebtTokenAddress;
//address of the interest rate strategy
address interestRateStrategyAddress;
//the current treasury balance, scaled
uint128 accruedToTreasury;
//the outstanding unbacked aTokens minted through the bridging feature
uint128 unbacked;
//the outstanding debt borrowed against this asset in isolation mode
uint128 isolationModeTotalDebt;
}
struct ReserveConfigurationMap {
//bit 0-15: LTV
//bit 16-31: Liq. threshold
//bit 32-47: Liq. bonus
//bit 48-55: Decimals
//bit 56: reserve is active
//bit 57: reserve is frozen
//bit 58: borrowing is enabled
//bit 59: stable rate borrowing enabled
//bit 60: asset is paused
//bit 61: borrowing in isolation mode is enabled
//bit 62: siloed borrowing enabled
//bit 63: flashloaning enabled
//bit 64-79: reserve factor
//bit 80-115 borrow cap in whole tokens, borrowCap == 0 => no cap
//bit 116-151 supply cap in whole tokens, supplyCap == 0 => no cap
//bit 152-167 liquidation protocol fee
//bit 168-175 eMode category
//bit 176-211 unbacked mint cap in whole tokens, unbackedMintCap == 0 => minting disabled
//bit 212-251 debt ceiling for isolation mode with (ReserveConfiguration::DEBT_CEILING_DECIMALS) decimals
//bit 252-255 unused
uint256 data;
}
struct UserConfigurationMap {
/**
* @dev Bitmap of the users collaterals and borrows. It is divided in pairs of bits, one pair per asset.
* The first bit indicates if an asset is used as collateral by the user, the second whether an
* asset is borrowed by the user.
*/
uint256 data;
}
struct EModeCategory {
// each eMode category has a custom ltv and liquidation threshold
uint16 ltv;
uint16 liquidationThreshold;
uint16 liquidationBonus;
// each eMode category may or may not have a custom oracle to override the individual assets price oracles
address priceSource;
string label;
}
enum InterestRateMode {
NONE,
STABLE,
VARIABLE
}
struct ReserveCache {
uint256 currScaledVariableDebt;
uint256 nextScaledVariableDebt;
uint256 currPrincipalStableDebt;
uint256 currAvgStableBorrowRate;
uint256 currTotalStableDebt;
uint256 nextAvgStableBorrowRate;
uint256 nextTotalStableDebt;
uint256 currLiquidityIndex;
uint256 nextLiquidityIndex;
uint256 currVariableBorrowIndex;
uint256 nextVariableBorrowIndex;
uint256 currLiquidityRate;
uint256 currVariableBorrowRate;
uint256 reserveFactor;
ReserveConfigurationMap reserveConfiguration;
address aTokenAddress;
address stableDebtTokenAddress;
address variableDebtTokenAddress;
uint40 reserveLastUpdateTimestamp;
uint40 stableDebtLastUpdateTimestamp;
}
struct ExecuteLiquidationCallParams {
uint256 reservesCount;
uint256 debtToCover;
address collateralAsset;
address debtAsset;
address user;
bool receiveAToken;
address priceOracle;
uint8 userEModeCategory;
address priceOracleSentinel;
}
struct ExecuteSupplyParams {
address asset;
uint256 amount;
address onBehalfOf;
uint16 referralCode;
}
struct ExecuteBorrowParams {
address asset;
address user;
address onBehalfOf;
uint256 amount;
InterestRateMode interestRateMode;
uint16 referralCode;
bool releaseUnderlying;
uint256 maxStableRateBorrowSizePercent;
uint256 reservesCount;
address oracle;
uint8 userEModeCategory;
address priceOracleSentinel;
}
struct ExecuteRepayParams {
address asset;
uint256 amount;
InterestRateMode interestRateMode;
address onBehalfOf;
bool useATokens;
}
struct ExecuteWithdrawParams {
address asset;
uint256 amount;
address to;
uint256 reservesCount;
address oracle;
uint8 userEModeCategory;
}
struct ExecuteSetUserEModeParams {
uint256 reservesCount;
address oracle;
uint8 categoryId;
}
struct FinalizeTransferParams {
address asset;
address from;
address to;
uint256 amount;
uint256 balanceFromBefore;
uint256 balanceToBefore;
uint256 reservesCount;
address oracle;
uint8 fromEModeCategory;
}
struct FlashloanParams {
address receiverAddress;
address[] assets;
uint256[] amounts;
uint256[] interestRateModes;
address onBehalfOf;
bytes params;
uint16 referralCode;
uint256 flashLoanPremiumToProtocol;
uint256 flashLoanPremiumTotal;
uint256 maxStableRateBorrowSizePercent;
uint256 reservesCount;
address addressesProvider;
uint8 userEModeCategory;
bool isAuthorizedFlashBorrower;
}
struct FlashloanSimpleParams {
address receiverAddress;
address asset;
uint256 amount;
bytes params;
uint16 referralCode;
uint256 flashLoanPremiumToProtocol;
uint256 flashLoanPremiumTotal;
}
struct FlashLoanRepaymentParams {
uint256 amount;
uint256 totalPremium;
uint256 flashLoanPremiumToProtocol;
address asset;
address receiverAddress;
uint16 referralCode;
}
struct CalculateUserAccountDataParams {
UserConfigurationMap userConfig;
uint256 reservesCount;
address user;
address oracle;
uint8 userEModeCategory;
}
struct ValidateBorrowParams {
ReserveCache reserveCache;
UserConfigurationMap userConfig;
address asset;
address userAddress;
uint256 amount;
InterestRateMode interestRateMode;
uint256 maxStableLoanPercent;
uint256 reservesCount;
address oracle;
uint8 userEModeCategory;
address priceOracleSentinel;
bool isolationModeActive;
address isolationModeCollateralAddress;
uint256 isolationModeDebtCeiling;
}
struct ValidateLiquidationCallParams {
ReserveCache debtReserveCache;
uint256 totalDebt;
uint256 healthFactor;
address priceOracleSentinel;
}
struct CalculateInterestRatesParams {
uint256 unbacked;
uint256 liquidityAdded;
uint256 liquidityTaken;
uint256 totalStableDebt;
uint256 totalVariableDebt;
uint256 averageStableBorrowRate;
uint256 reserveFactor;
address reserve;
address aToken;
}
struct InitReserveParams {
address asset;
address aTokenAddress;
address stableDebtAddress;
address variableDebtAddress;
address interestRateStrategyAddress;
uint16 reservesCount;
uint16 maxNumberReserves;
}
}{
"evmVersion": "paris",
"metadata": {
"bytecodeHash": "ipfs",
"useLiteralContent": true
},
"optimizer": {
"enabled": true,
"runs": 200
},
"remappings": [],
"viaIR": true,
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"contract IPoolAddressesProvider","name":"provider","type":"address"},{"internalType":"uint256","name":"optimalUsageRatio","type":"uint256"},{"internalType":"uint256","name":"baseVariableBorrowRate","type":"uint256"},{"internalType":"uint256","name":"variableRateSlope1","type":"uint256"},{"internalType":"uint256","name":"variableRateSlope2","type":"uint256"},{"internalType":"uint256","name":"stableRateSlope1","type":"uint256"},{"internalType":"uint256","name":"stableRateSlope2","type":"uint256"},{"internalType":"uint256","name":"baseStableRateOffset","type":"uint256"},{"internalType":"uint256","name":"stableRateExcessOffset","type":"uint256"},{"internalType":"uint256","name":"optimalStableToTotalDebtRatio","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ADDRESSES_PROVIDER","outputs":[{"internalType":"contract IPoolAddressesProvider","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_EXCESS_STABLE_TO_TOTAL_DEBT_RATIO","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_EXCESS_USAGE_RATIO","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"OPTIMAL_STABLE_TO_TOTAL_DEBT_RATIO","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"OPTIMAL_USAGE_RATIO","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"unbacked","type":"uint256"},{"internalType":"uint256","name":"liquidityAdded","type":"uint256"},{"internalType":"uint256","name":"liquidityTaken","type":"uint256"},{"internalType":"uint256","name":"totalStableDebt","type":"uint256"},{"internalType":"uint256","name":"totalVariableDebt","type":"uint256"},{"internalType":"uint256","name":"averageStableBorrowRate","type":"uint256"},{"internalType":"uint256","name":"reserveFactor","type":"uint256"},{"internalType":"address","name":"reserve","type":"address"},{"internalType":"address","name":"aToken","type":"address"}],"internalType":"struct DataTypes.CalculateInterestRatesParams","name":"params","type":"tuple"}],"name":"calculateInterestRates","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getBaseStableBorrowRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getBaseVariableBorrowRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getMaxVariableBorrowRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getStableRateExcessOffset","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getStableRateSlope1","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getStableRateSlope2","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getVariableRateSlope1","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getVariableRateSlope2","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]Contract Creation Code
6102003461021757610e6038819003601f8101601f191683016001600160401b0381118482101761021c5783928291604052833961014092839181010312610217578051916001600160a01b038316830361021757602082015190604083015190606084015190608085015160a08601519160c08701519360e088015195610100998a8a015198610120809b01516b033b2e3c9fd0803ce8000000916100be6100a6610232565b6002815261383360f01b602082015282851015610251565b6100e16100c9610232565b60028152610e0d60f21b602082015283851015610251565b8060805282038281116102015760c0528060a05281039081116102015760e0528a52885281526101609182526101809283526101a09384526101c09485526101e095865260405196610ba798896102b98a3960805189818161020a01526106a6015260a05189818161024501526107c6015260c05189818161043201526106eb015260e05189818161054101526108390152518861010d0152518781816101cf0152818161027b015261064f0152518681816101590152818161029c01528181610798015281816108da0152610a3e0152518581816102c60152818161050601526107720152518481816104cb0152818161074301526108ac015251838181610194015261071d01525182610a5f01525181818161049001526108600152f35b634e487b7160e01b600052601160045260246000fd5b600080fd5b634e487b7160e01b600052604160045260246000fd5b60408051919082016001600160401b0381118382101761021c57604052565b156102595750565b6040519062461bcd60e51b82528160208060048301528251908160248401526000935b82851061029f575050604492506000838284010152601f80199101168101030190fd5b848101820151868601604401529381019385935061027c56fe6080604052600436101561001257600080fd5b60003560e01c80630542975c146100f75780630b3429a2146100f257806314e32da4146100ed57806334762ca5146100e857806354c365c6146100e35780636fb92589146100de57806380031e37146100d9578063a5898709146100d4578063a9c622f8146100cf578063acd78686146100ca578063bc626908146100c5578063d5cd7391146100c0578063f4202409146100bb5763fe5fd698146100b657600080fd5b610529565b6104ee565b6104b3565b610478565b610455565b61041a565b610384565b610268565b61022d565b6101f2565b6101b7565b61017c565b610141565b3461013c57600036600319011261013c576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b600080fd5b3461013c57600036600319011261013c5760206040517f00000000000000000000000000000000000000000000000000000000000000008152f35b3461013c57600036600319011261013c5760206040517f00000000000000000000000000000000000000000000000000000000000000008152f35b3461013c57600036600319011261013c5760206040517f00000000000000000000000000000000000000000000000000000000000000008152f35b3461013c57600036600319011261013c5760206040517f00000000000000000000000000000000000000000000000000000000000000008152f35b3461013c57600036600319011261013c5760206040517f00000000000000000000000000000000000000000000000000000000000000008152f35b3461013c57600036600319011261013c577f00000000000000000000000000000000000000000000000000000000000000007f000000000000000000000000000000000000000000000000000000000000000081018091116102f9577f000000000000000000000000000000000000000000000000000000000000000081018091116102f957602090604051908152f35b610564565b90601f8019910116810190811067ffffffffffffffff82111761032057604052565b634e487b7160e01b600052604160045260246000fd5b60405190610120820182811067ffffffffffffffff82111761032057604052565b60e435906001600160a01b038216820361013c57565b61010435906001600160a01b038216820361013c57565b3461013c5761012036600319011261013c576104166103f96103a4610336565b6004358152602435602082015260443560408201526064356060820152608435608082015260a43560a082015260c43560c08201526103e1610357565b60e08201526103ee61036d565b610100820152610616565b604080519384526020840192909252908201529081906060820190565b0390f35b3461013c57600036600319011261013c5760206040517f00000000000000000000000000000000000000000000000000000000000000008152f35b3461013c57600036600319011261013c576020610470610a3c565b604051908152f35b3461013c57600036600319011261013c5760206040517f00000000000000000000000000000000000000000000000000000000000000008152f35b3461013c57600036600319011261013c5760206040517f00000000000000000000000000000000000000000000000000000000000000008152f35b3461013c57600036600319011261013c5760206040517f00000000000000000000000000000000000000000000000000000000000000008152f35b3461013c57600036600319011261013c5760206040517f00000000000000000000000000000000000000000000000000000000000000008152f35b634e487b7160e01b600052601160045260246000fd5b919082018092116102f957565b60405190610120820182811067ffffffffffffffff82111761032057604052816101006000918281528260208201528260408201528260608201528260808201528260a08201528260c08201528260e08201520152565b9081602091031261013c575190565b6040513d6000823e3d90fd5b906127109182039182116102f957565b919082039182116102f957565b9061061f610587565b9060608301928351610637608083019182519061057a565b916020850192835260808501946000865260408101967f00000000000000000000000000000000000000000000000000000000000000008852610678610a3c565b9460608301958652805180610905575b505061080a8260c06108016108189782958d60a061081299018c81517f0000000000000000000000000000000000000000000000000000000000000000908181116000146108945750610767916107106106e9610796936107bc9651610609565b7f000000000000000000000000000000000000000000000000000000000000000090610a8a565b9061076e610767610741847f0000000000000000000000000000000000000000000000000000000000000000610ab0565b7f000000000000000000000000000000000000000000000000000000000000000061057a565b825161057a565b90527f0000000000000000000000000000000000000000000000000000000000000000610ab0565b7f000000000000000000000000000000000000000000000000000000000000000061057a565b90525b60e08501517f000000000000000000000000000000000000000000000000000000000000000090818111610824575b50505190518d519060a08a015192610aec565b91015190610ab0565b9201516105f9565b90610b3f565b80935251925191929190565b61085e61083761088b9361088493610609565b7f000000000000000000000000000000000000000000000000000000000000000090610a8a565b7f0000000000000000000000000000000000000000000000000000000000000000610ab0565b8c5161057a565b8b5238806107ee565b6108fe93610767936108d5610767856108d06108d0967f0000000000000000000000000000000000000000000000000000000000000000610ab0565b610a8a565b9052517f0000000000000000000000000000000000000000000000000000000000000000610ab0565b90526107bf565b9261091583946109789451610a8a565b60e082015261093f61093361093360e088015160018060a01b031690565b6001600160a01b031690565b610100868101516040516370a0823160e01b81526001600160a01b03909116600482015294909391602091869190829081906024820190565b03915afa908115610a375761081897610812966109f861080a966109f2610801956109d46109c98e60406109c060c09f9c60c09d600091610a08575b5060208401519061057a565b91015190610609565b808b5282519061057a565b80938a015251916109e58184610a8a565b60a08a01528c519061057a565b90610a8a565b8486015295509750505092610688565b610a2a915060203d602011610a30575b610a2281836102fe565b8101906105de565b386109b4565b503d610a18565b6105ed565b7f00000000000000000000000000000000000000000000000000000000000000007f000000000000000000000000000000000000000000000000000000000000000081018091116102f95790565b8160011c906b033b2e3c9fd0803ce80000009081831904811184151761013c5702010490565b816b019d971e4fe8401e7400000019048111158215171561013c576b033b2e3c9fd0803ce800000091026b019d971e4fe8401e74000000010490565b9192818301938484116102f9578415610b3557610b17610b1291610b12610b1d95610b5d565b610ab0565b93610b5d565b81018091116102f9576109f2610b3292610b5d565b90565b5050505050600090565b8161138819048111158215171561013c576127109102611388010490565b90633b9aca00918281029283040361013c5756fea26469706673582212206351fea1048cba3f13116cf6146b8c1460325647b254dd8e4fea92a1dfea73f564736f6c63430008180033000000000000000000000000d9c622d64342b5faceef4d366b974aef6dcb338d00000000000000000000000000000000000000000295be96e640669720000000000000000000000000000000000000000000000000295be96e64066972000000000000000000000000000000000000000000000000295be96e64066972000000000000000000000000000000000000000000000000a56fa5b99019a5c800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
Deployed Bytecode
0x6080604052600436101561001257600080fd5b60003560e01c80630542975c146100f75780630b3429a2146100f257806314e32da4146100ed57806334762ca5146100e857806354c365c6146100e35780636fb92589146100de57806380031e37146100d9578063a5898709146100d4578063a9c622f8146100cf578063acd78686146100ca578063bc626908146100c5578063d5cd7391146100c0578063f4202409146100bb5763fe5fd698146100b657600080fd5b610529565b6104ee565b6104b3565b610478565b610455565b61041a565b610384565b610268565b61022d565b6101f2565b6101b7565b61017c565b610141565b3461013c57600036600319011261013c576040517f000000000000000000000000d9c622d64342b5faceef4d366b974aef6dcb338d6001600160a01b03168152602090f35b600080fd5b3461013c57600036600319011261013c5760206040517f000000000000000000000000000000000000000000295be96e640669720000008152f35b3461013c57600036600319011261013c5760206040517f00000000000000000000000000000000000000000000000000000000000000008152f35b3461013c57600036600319011261013c5760206040517f000000000000000000000000000000000000000000295be96e640669720000008152f35b3461013c57600036600319011261013c5760206040517f00000000000000000000000000000000000000000295be96e6406697200000008152f35b3461013c57600036600319011261013c5760206040517f00000000000000000000000000000000000000000000000000000000000000008152f35b3461013c57600036600319011261013c577f000000000000000000000000000000000000000000295be96e640669720000007f000000000000000000000000000000000000000000295be96e6406697200000081018091116102f9577f000000000000000000000000000000000000000000a56fa5b99019a5c800000081018091116102f957602090604051908152f35b610564565b90601f8019910116810190811067ffffffffffffffff82111761032057604052565b634e487b7160e01b600052604160045260246000fd5b60405190610120820182811067ffffffffffffffff82111761032057604052565b60e435906001600160a01b038216820361013c57565b61010435906001600160a01b038216820361013c57565b3461013c5761012036600319011261013c576104166103f96103a4610336565b6004358152602435602082015260443560408201526064356060820152608435608082015260a43560a082015260c43560c08201526103e1610357565b60e08201526103ee61036d565b610100820152610616565b604080519384526020840192909252908201529081906060820190565b0390f35b3461013c57600036600319011261013c5760206040517f000000000000000000000000000000000000000000a56fa5b99019a5c80000008152f35b3461013c57600036600319011261013c576020610470610a3c565b604051908152f35b3461013c57600036600319011261013c5760206040517f00000000000000000000000000000000000000000000000000000000000000008152f35b3461013c57600036600319011261013c5760206040517f00000000000000000000000000000000000000000000000000000000000000008152f35b3461013c57600036600319011261013c5760206040517f000000000000000000000000000000000000000000a56fa5b99019a5c80000008152f35b3461013c57600036600319011261013c5760206040517f0000000000000000000000000000000000000000033b2e3c9fd0803ce80000008152f35b634e487b7160e01b600052601160045260246000fd5b919082018092116102f957565b60405190610120820182811067ffffffffffffffff82111761032057604052816101006000918281528260208201528260408201528260608201528260808201528260a08201528260c08201528260e08201520152565b9081602091031261013c575190565b6040513d6000823e3d90fd5b906127109182039182116102f957565b919082039182116102f957565b9061061f610587565b9060608301928351610637608083019182519061057a565b916020850192835260808501946000865260408101967f000000000000000000000000000000000000000000295be96e640669720000008852610678610a3c565b9460608301958652805180610905575b505061080a8260c06108016108189782958d60a061081299018c81517f00000000000000000000000000000000000000000295be96e640669720000000908181116000146108945750610767916107106106e9610796936107bc9651610609565b7f000000000000000000000000000000000000000000a56fa5b99019a5c800000090610a8a565b9061076e610767610741847f0000000000000000000000000000000000000000000000000000000000000000610ab0565b7f000000000000000000000000000000000000000000000000000000000000000061057a565b825161057a565b90527f000000000000000000000000000000000000000000a56fa5b99019a5c8000000610ab0565b7f000000000000000000000000000000000000000000295be96e6406697200000061057a565b90525b60e08501517f000000000000000000000000000000000000000000000000000000000000000090818111610824575b50505190518d519060a08a015192610aec565b91015190610ab0565b9201516105f9565b90610b3f565b80935251925191929190565b61085e61083761088b9361088493610609565b7f0000000000000000000000000000000000000000033b2e3c9fd0803ce800000090610a8a565b7f0000000000000000000000000000000000000000000000000000000000000000610ab0565b8c5161057a565b8b5238806107ee565b6108fe93610767936108d5610767856108d06108d0967f0000000000000000000000000000000000000000000000000000000000000000610ab0565b610a8a565b9052517f000000000000000000000000000000000000000000295be96e64066972000000610ab0565b90526107bf565b9261091583946109789451610a8a565b60e082015261093f61093361093360e088015160018060a01b031690565b6001600160a01b031690565b610100868101516040516370a0823160e01b81526001600160a01b03909116600482015294909391602091869190829081906024820190565b03915afa908115610a375761081897610812966109f861080a966109f2610801956109d46109c98e60406109c060c09f9c60c09d600091610a08575b5060208401519061057a565b91015190610609565b808b5282519061057a565b80938a015251916109e58184610a8a565b60a08a01528c519061057a565b90610a8a565b8486015295509750505092610688565b610a2a915060203d602011610a30575b610a2281836102fe565b8101906105de565b386109b4565b503d610a18565b6105ed565b7f000000000000000000000000000000000000000000295be96e640669720000007f000000000000000000000000000000000000000000000000000000000000000081018091116102f95790565b8160011c906b033b2e3c9fd0803ce80000009081831904811184151761013c5702010490565b816b019d971e4fe8401e7400000019048111158215171561013c576b033b2e3c9fd0803ce800000091026b019d971e4fe8401e74000000010490565b9192818301938484116102f9578415610b3557610b17610b1291610b12610b1d95610b5d565b610ab0565b93610b5d565b81018091116102f9576109f2610b3292610b5d565b90565b5050505050600090565b8161138819048111158215171561013c576127109102611388010490565b90633b9aca00918281029283040361013c5756fea26469706673582212206351fea1048cba3f13116cf6146b8c1460325647b254dd8e4fea92a1dfea73f564736f6c63430008180033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000d9c622d64342b5faceef4d366b974aef6dcb338d00000000000000000000000000000000000000000295be96e640669720000000000000000000000000000000000000000000000000295be96e64066972000000000000000000000000000000000000000000000000295be96e64066972000000000000000000000000000000000000000000000000a56fa5b99019a5c800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
-----Decoded View---------------
Arg [0] : provider (address): 0xD9C622d64342B5FaCeef4d366B974AEf6dCB338D
Arg [1] : optimalUsageRatio (uint256): 800000000000000000000000000
Arg [2] : baseVariableBorrowRate (uint256): 50000000000000000000000000
Arg [3] : variableRateSlope1 (uint256): 50000000000000000000000000
Arg [4] : variableRateSlope2 (uint256): 200000000000000000000000000
Arg [5] : stableRateSlope1 (uint256): 0
Arg [6] : stableRateSlope2 (uint256): 0
Arg [7] : baseStableRateOffset (uint256): 0
Arg [8] : stableRateExcessOffset (uint256): 0
Arg [9] : optimalStableToTotalDebtRatio (uint256): 0
-----Encoded View---------------
10 Constructor Arguments found :
Arg [0] : 000000000000000000000000d9c622d64342b5faceef4d366b974aef6dcb338d
Arg [1] : 00000000000000000000000000000000000000000295be96e640669720000000
Arg [2] : 000000000000000000000000000000000000000000295be96e64066972000000
Arg [3] : 000000000000000000000000000000000000000000295be96e64066972000000
Arg [4] : 000000000000000000000000000000000000000000a56fa5b99019a5c8000000
Arg [5] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [6] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [7] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [8] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [9] : 0000000000000000000000000000000000000000000000000000000000000000
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in FRAX
0
Multichain Portfolio | 35 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.