Source Code
Overview
MNT Balance
MNT Value
$0.00View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Cross-Chain Transactions
Loading...
Loading
Contract Name:
RiskManager
Compiler Version
v0.8.19+commit.7dd6d404
Optimization Enabled:
Yes with 200 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: None
pragma solidity ^0.8.19;
import {IRiskManager} from '../interfaces/risk_manager/IRiskManager.sol';
import {ILendingPool} from '../interfaces/lending_pool/ILendingPool.sol';
import '../common/library/InitErrors.sol';
import '../common/library/UncheckedIncrement.sol';
import {Initializable} from '@openzeppelin-contracts-upgradeable/proxy/utils/Initializable.sol';
import {SafeCast} from '@openzeppelin-contracts/utils/math/SafeCast.sol';
import {UnderACM} from '../common/UnderACM.sol';
contract RiskManager is IRiskManager, UnderACM, Initializable {
using UncheckedIncrement for uint;
using SafeCast for uint;
using SafeCast for uint128;
using SafeCast for int;
// constants
bytes32 private constant GUARDIAN = keccak256('guardian');
// immutables
address public immutable CORE; // core address
// storages
mapping(uint16 => mapping(address => DebtCeilingInfo)) private __modeDebtCeilingInfos;
// modifiers
modifier onlyGuardian() {
ACM.checkRole(GUARDIAN, msg.sender);
_;
}
modifier onlyCore() {
_require(msg.sender == CORE, Errors.NOT_INIT_CORE);
_;
}
// constructor
constructor(address _core, address _acm) UnderACM(_acm) {
CORE = _core;
_disableInitializers();
}
// initializer
/// @dev initialize contract
function initialize() external initializer {}
// functions
/// @inheritdoc IRiskManager
function getModeDebtShares(uint16 _mode, address _pool) external view returns (uint) {
return __modeDebtCeilingInfos[_mode][_pool].debtShares;
}
/// @inheritdoc IRiskManager
function getModeDebtAmtCurrent(uint16 _mode, address _pool) external returns (uint) {
return ILendingPool(_pool).debtShareToAmtCurrent(__modeDebtCeilingInfos[_mode][_pool].debtShares);
}
/// @inheritdoc IRiskManager
function getModeDebtAmtStored(uint16 _mode, address _pool) external view returns (uint) {
return ILendingPool(_pool).debtShareToAmtStored(__modeDebtCeilingInfos[_mode][_pool].debtShares);
}
/// @inheritdoc IRiskManager
function getModeDebtCeilingAmt(uint16 _mode, address _pool) external view returns (uint) {
return __modeDebtCeilingInfos[_mode][_pool].ceilAmt;
}
/// @inheritdoc IRiskManager
function updateModeDebtShares(uint16 _mode, address _pool, int _deltaShares) external onlyCore {
DebtCeilingInfo memory debtCeilingInfo = __modeDebtCeilingInfos[_mode][_pool];
uint newDebtShares = (debtCeilingInfo.debtShares.toInt256() + _deltaShares).toUint256();
if (_deltaShares > 0) {
uint currentDebt = ILendingPool(_pool).debtShareToAmtCurrent(newDebtShares);
_require(currentDebt <= debtCeilingInfo.ceilAmt, Errors.DEBT_CEILING_EXCEEDED);
}
__modeDebtCeilingInfos[_mode][_pool].debtShares = newDebtShares.toUint128();
}
/// @inheritdoc IRiskManager
function setModeDebtCeilingInfo(uint16 _mode, address[] calldata _pools, uint128[] calldata _ceilAmts)
external
onlyGuardian
{
_require(_pools.length == _ceilAmts.length, Errors.ARRAY_LENGTH_MISMATCHED);
for (uint i; i < _pools.length; i = i.uinc()) {
__modeDebtCeilingInfos[_mode][_pools[i]].ceilAmt = _ceilAmts[i];
emit SetModeDebtCeilingInfo(_mode, _pools[i], _ceilAmts[i]);
}
}
}// SPDX-License-Identifier: None
pragma solidity ^0.8.19;
import {IAccessControlManager} from '../interfaces/common/IAccessControlManager.sol';
abstract contract UnderACM {
// immutables
IAccessControlManager public immutable ACM; // access control manager
// constructor
constructor(address _acm) {
ACM = IAccessControlManager(_acm);
}
}// SPDX-License-Identifier: GPL-3.0-or-later
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
pragma solidity >=0.7.1 <0.9.0;
// solhint-disable
/**
* @dev Reverts if `condition` is false, with a revert reason containing `errorCode`. Only codes up to 999 are
* supported.
* Uses the default 'INC' prefix for the error code
*/
function _require(bool condition, uint errorCode) pure {
if (!condition) _revert(errorCode);
}
/**
* @dev Reverts if `condition` is false, with a revert reason containing `errorCode`. Only codes up to 999 are
* supported.
*/
function _require(bool condition, uint errorCode, bytes3 prefix) pure {
if (!condition) _revert(errorCode, prefix);
}
/**
* @dev Reverts with a revert reason containing `errorCode`. Only codes up to 999 are supported.
* Uses the default 'INC' prefix for the error code
*/
function _revert(uint errorCode) pure {
_revert(errorCode, 0x494e43); // This is the raw byte representation of "INC"
}
/**
* @dev Reverts with a revert reason containing `errorCode`. Only codes up to 999 are supported.
*/
function _revert(uint errorCode, bytes3 prefix) pure {
uint prefixUint = uint(uint24(prefix));
// We're going to dynamically create a revert string based on the error code, with the following format:
// 'INC#{errorCode}'
// where the code is left-padded with zeroes to three digits (so they range from 000 to 999).
//
// We don't have revert strings embedded in the contract to save bytecode size: it takes much less space to store a
// number (8 to 16 bits) than the individual string characters.
//
// The dynamic string creation algorithm that follows could be implemented in Solidity, but assembly allows for a
// much denser implementation, again saving bytecode size. Given this function unconditionally reverts, this is a
// safe place to rely on it without worrying about how its usage might affect e.g. memory contents.
assembly {
// First, we need to compute the ASCII representation of the error code. We assume that it is in the 0-999
// range, so we only need to convert three digits. To convert the digits to ASCII, we add 0x30, the value for
// the '0' character.
let units := add(mod(errorCode, 10), 0x30)
errorCode := div(errorCode, 10)
let tenths := add(mod(errorCode, 10), 0x30)
errorCode := div(errorCode, 10)
let hundreds := add(mod(errorCode, 10), 0x30)
// With the individual characters, we can now construct the full string.
// We first append the '#' character (0x23) to the prefix. In the case of 'INC', it results in 0x42414c23 ('INC#')
// Then, we shift this by 24 (to provide space for the 3 bytes of the error code), and add the
// characters to it, each shifted by a multiple of 8.
// The revert reason is then shifted left by 200 bits (256 minus the length of the string, 7 characters * 8 bits
// per character = 56) to locate it in the most significant part of the 256 slot (the beginning of a byte
// array).
let formattedPrefix := shl(24, add(0x23, shl(8, prefixUint)))
let revertReason := shl(200, add(formattedPrefix, add(add(units, shl(8, tenths)), shl(16, hundreds))))
// We can now encode the reason in memory, which can be safely overwritten as we're about to revert. The encoded
// message will have the following layout:
// [ revert reason identifier ] [ string location offset ] [ string length ] [ string contents ]
// The Solidity revert reason identifier is 0x08c739a0, the function selector of the Error(string) function. We
// also write zeroes to the next 28 bytes of memory, but those are about to be overwritten.
mstore(0x0, 0x08c379a000000000000000000000000000000000000000000000000000000000)
// Next is the offset to the location of the string, which will be placed immediately after (20 bytes away).
mstore(0x04, 0x0000000000000000000000000000000000000000000000000000000000000020)
// The string length is fixed: 7 characters.
mstore(0x24, 7)
// Finally, the string itself is stored.
mstore(0x44, revertReason)
// Even if the string is only 7 bytes long, we need to return a full 32 byte slot containing it. The length of
// the encoded message is therefore 4 + 32 + 32 + 32 = 100.
revert(0, 100)
}
}
library Errors {
// Common
uint internal constant ZERO_VALUE = 100;
uint internal constant NOT_INIT_CORE = 101;
uint internal constant SLIPPAGE_CONTROL = 102;
uint internal constant CALL_FAILED = 103;
uint internal constant NOT_OWNER = 104;
uint internal constant NOT_WNATIVE = 105;
uint internal constant ALREADY_SET = 106;
uint internal constant NOT_WHITELISTED = 107;
// Input
uint internal constant ARRAY_LENGTH_MISMATCHED = 200;
uint internal constant INPUT_TOO_LOW = 201;
uint internal constant INPUT_TOO_HIGH = 202;
uint internal constant INVALID_INPUT = 203;
uint internal constant INVALID_TOKEN_IN = 204;
uint internal constant INVALID_TOKEN_OUT = 205;
uint internal constant NOT_SORTED_OR_DUPLICATED_INPUT = 206;
// Core
uint internal constant POSITION_NOT_HEALTHY = 300;
uint internal constant POSITION_NOT_FOUND = 301;
uint internal constant LOCKED_MULTICALL = 302;
uint internal constant POSITION_HEALTHY = 303;
uint internal constant INVALID_HEALTH_AFTER_LIQUIDATION = 304;
uint internal constant FLASH_PAUSED = 305;
uint internal constant INVALID_FLASHLOAN = 306;
uint internal constant NOT_AUTHORIZED = 307;
uint internal constant INVALID_CALLBACK_ADDRESS = 308;
// Lending Pool
uint internal constant MINT_PAUSED = 400;
uint internal constant REDEEM_PAUSED = 401;
uint internal constant BORROW_PAUSED = 402;
uint internal constant REPAY_PAUSED = 403;
uint internal constant NOT_ENOUGH_CASH = 404;
uint internal constant INVALID_AMOUNT_TO_REPAY = 405;
uint internal constant SUPPLY_CAP_REACHED = 406;
uint internal constant BORROW_CAP_REACHED = 407;
// Config
uint internal constant INVALID_MODE = 500;
uint internal constant TOKEN_NOT_WHITELISTED = 501;
uint internal constant INVALID_FACTOR = 502;
// Position Manager
uint internal constant COLLATERALIZE_PAUSED = 600;
uint internal constant DECOLLATERALIZE_PAUSED = 601;
uint internal constant MAX_COLLATERAL_COUNT_REACHED = 602;
uint internal constant NOT_CONTAIN = 603;
uint internal constant ALREADY_COLLATERALIZED = 604;
// Oracle
uint internal constant NO_VALID_SOURCE = 700;
uint internal constant TOO_MUCH_DEVIATION = 701;
uint internal constant MAX_PRICE_DEVIATION_TOO_LOW = 702;
uint internal constant NO_PRICE_ID = 703;
uint internal constant PYTH_CONFIG_NOT_SET = 704;
uint internal constant DATAFEED_ID_NOT_SET = 705;
uint internal constant MAX_STALETIME_NOT_SET = 706;
uint internal constant MAX_STALETIME_EXCEEDED = 707;
uint internal constant PRIMARY_SOURCE_NOT_SET = 708;
// Risk Manager
uint internal constant DEBT_CEILING_EXCEEDED = 800;
// Misc
uint internal constant UNIMPLEMENTED = 999;
}// SPDX-License-Identifier: None
pragma solidity ^0.8.19;
library UncheckedIncrement {
function uinc(uint self) internal pure returns (uint) {
unchecked {
return self + 1;
}
}
}// SPDX-License-Identifier: None
pragma solidity ^0.8.19;
/// @title Access Control Manager Interface
interface IAccessControlManager {
/// @dev check the role of the user, revert against an unauthorized user.
/// @param _role keccak256 hash of role name
/// @param _user user address to check for the role
function checkRole(bytes32 _role, address _user) external;
}// SPDX-License-Identifier: None
pragma solidity ^0.8.19;
/// @title Lending Pool Interface
/// @notice rebase token is not supported
interface ILendingPool {
event SetIrm(address _irm);
event SetReserveFactor_e18(uint _reserveFactor_e18);
event SetTreasury(address _treasury);
/// @dev get core address
function core() external view returns (address core);
/// @dev get the interest rate model address
function irm() external view returns (address model);
/// @dev get the reserve factor in 1e18 (1e18 = 100%)
function reserveFactor_e18() external view returns (uint factor_e18);
/// @dev get the pool's underlying token
function underlyingToken() external view returns (address token);
/// @notice total assets = cash + total debts
function totalAssets() external view returns (uint amt);
/// @dev get the pool total debt (underlying token)
function totalDebt() external view returns (uint debt);
/// @dev get the pool total debt shares
function totalDebtShares() external view returns (uint shares);
/// @dev calaculate the debt share from debt amount (without interest accrual)
/// @param _amt the amount of debt
/// @return shares amount of debt shares (rounded up)
function debtAmtToShareStored(uint _amt) external view returns (uint shares);
/// @dev calaculate the debt share from debt amount (with interest accrual)
/// @param _amt the amount of debt
/// @return shares current amount of debt shares (rounded up)
function debtAmtToShareCurrent(uint _amt) external returns (uint shares);
/// @dev calculate the corresponding debt amount from debt share (without interest accrual)
/// @param _shares the amount of debt shares
/// @return amt corresponding debt amount (rounded up)
function debtShareToAmtStored(uint _shares) external view returns (uint amt);
/// @notice this is NOT a view function
/// @dev calculate the corresponding debt amount from debt share (with interest accrual)
/// @param _shares the amount of debt shares
/// @return amt corresponding current debt amount (rounded up)
function debtShareToAmtCurrent(uint _shares) external returns (uint amt);
/// @dev get current supply rate per sec in 1e18
function getSupplyRate_e18() external view returns (uint supplyRate_e18);
/// @dev get current borrow rate per sec in 1e18
function getBorrowRate_e18() external view returns (uint borrowRate_e18);
/// @dev get the pool total cash (underlying token)
function cash() external view returns (uint amt);
/// @dev get the latest timestamp of interest accrual
/// @return lastAccruedTime last accrued time unix timestamp
function lastAccruedTime() external view returns (uint lastAccruedTime);
/// @dev get the treasury address
function treasury() external view returns (address treasury);
/// @notice only core can call this function
/// @dev mint shares to the receiver from the transfered assets
/// @param _receiver address to receive shares
/// @return mintShares amount of shares minted
function mint(address _receiver) external returns (uint mintShares);
/// @notice only core can call this function
/// @dev burn shares and send the underlying assets to the receiver
/// @param _receiver address to receive the underlying tokens
/// @return amt amount of underlying assets transferred
function burn(address _receiver) external returns (uint amt);
/// @notice only core can call this function
/// @dev borrow the asset from the lending pool
/// @param _receiver address to receive the borrowed asset
/// @param _amt amount of asset to borrow
/// @return debtShares debt shares amount recorded from borrowing
function borrow(address _receiver, uint _amt) external returns (uint debtShares);
/// @notice only core can call this function
/// @dev repay the borrowed assets
/// @param _shares the amount of debt shares to repay
/// @return amt assets amount used for repay
function repay(uint _shares) external returns (uint amt);
/// @dev accrue interest from the last accrual
function accrueInterest() external;
/// @dev get the share amounts from underlying asset amt
/// @param _amt the amount of asset to convert to shares
/// @return shares amount of shares (rounded down)
function toShares(uint _amt) external view returns (uint shares);
/// @dev get the asset amount from shares
/// @param _shares the amount of shares to convert to underlying asset amt
/// @return amt amount of underlying asset (rounded down)
function toAmt(uint _shares) external view returns (uint amt);
/// @dev get the share amounts from underlying asset amt (with interest accrual)
/// @param _amt the amount of asset to convert to shares
/// @return shares current amount of shares (rounded down)
function toSharesCurrent(uint _amt) external returns (uint shares);
/// @dev get the asset amount from shares (with interest accrual)
/// @param _shares the amount of shares to convert to underlying asset amt
/// @return amt current amount of underlying asset (rounded down)
function toAmtCurrent(uint _shares) external returns (uint amt);
/// @dev set the interest rate model
/// @param _irm new interest rate model address
function setIrm(address _irm) external;
/// @dev set the pool's reserve factor in 1e18
/// @param _reserveFactor_e18 new reserver factor in 1e18
function setReserveFactor_e18(uint _reserveFactor_e18) external;
/// @dev set the pool's treasury address
/// @param _treasury new treasury address
function setTreasury(address _treasury) external;
}// SPDX-License-Identifier: None
pragma solidity ^0.8.19;
/// @title Risk Manager Interface
interface IRiskManager {
event SetModeDebtCeilingInfo(uint16 indexed mode, address indexed pool, uint amt);
struct DebtCeilingInfo {
uint128 ceilAmt; // debt celing amount
uint128 debtShares; // current total token debt shares of the mode
}
/// @notice only core can call this function
/// @dev update debt shares
/// @param _mode mode id
/// @param _pool pool address
/// @param _shares debt shares (can be negative)
function updateModeDebtShares(uint16 _mode, address _pool, int _shares) external;
/// @dev set mode's borrow cap amount
/// @param _mode mode id
/// @param _pools borrow token pool ist
/// @param _amts debt ceiling amount list
function setModeDebtCeilingInfo(uint16 _mode, address[] calldata _pools, uint128[] calldata _amts) external;
/// @dev get mode's debt ceiling amount
/// @param _mode mode id
/// @param _pool pool address
/// @return debt ceiling amt
function getModeDebtCeilingAmt(uint16 _mode, address _pool) external view returns (uint);
/// @dev get debt shares
/// @param _mode mode id
/// @param _pool pool address
/// @return debt shares
function getModeDebtShares(uint16 _mode, address _pool) external view returns (uint);
/// @notice this is NOT a view function
/// @dev get current debt amount (with interest accrual)
/// @param _mode mode id
/// @param _pool pool address
/// @return current debt amount
function getModeDebtAmtCurrent(uint16 _mode, address _pool) external returns (uint);
/// @dev get stored debt amount (without interest accrual)
/// @param _mode mode id
/// @param _pool pool address
/// @return debt amount
function getModeDebtAmtStored(uint16 _mode, address _pool) external view returns (uint);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)
pragma solidity ^0.8.2;
import "../../utils/AddressUpgradeable.sol";
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
* behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
* external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
* function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
*
* The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
* reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
* case an upgrade adds a module that needs to be initialized.
*
* For example:
*
* [.hljs-theme-light.nopadding]
* ```solidity
* contract MyToken is ERC20Upgradeable {
* function initialize() initializer public {
* __ERC20_init("MyToken", "MTK");
* }
* }
*
* contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
* function initializeV2() reinitializer(2) public {
* __ERC20Permit_init("MyToken");
* }
* }
* ```
*
* TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
* possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
*
* CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
* that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
*
* [CAUTION]
* ====
* Avoid leaving a contract uninitialized.
*
* An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
* contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
* the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
*
* [.hljs-theme-light.nopadding]
* ```
* /// @custom:oz-upgrades-unsafe-allow constructor
* constructor() {
* _disableInitializers();
* }
* ```
* ====
*/
abstract contract Initializable {
/**
* @dev Indicates that the contract has been initialized.
* @custom:oz-retyped-from bool
*/
uint8 private _initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool private _initializing;
/**
* @dev Triggered when the contract has been initialized or reinitialized.
*/
event Initialized(uint8 version);
/**
* @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
* `onlyInitializing` functions can be used to initialize parent contracts.
*
* Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a
* constructor.
*
* Emits an {Initialized} event.
*/
modifier initializer() {
bool isTopLevelCall = !_initializing;
require(
(isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
"Initializable: contract is already initialized"
);
_initialized = 1;
if (isTopLevelCall) {
_initializing = true;
}
_;
if (isTopLevelCall) {
_initializing = false;
emit Initialized(1);
}
}
/**
* @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
* contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
* used to initialize parent contracts.
*
* A reinitializer may be used after the original initialization step. This is essential to configure modules that
* are added through upgrades and that require initialization.
*
* When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
* cannot be nested. If one is invoked in the context of another, execution will revert.
*
* Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
* a contract, executing them in the right order is up to the developer or operator.
*
* WARNING: setting the version to 255 will prevent any future reinitialization.
*
* Emits an {Initialized} event.
*/
modifier reinitializer(uint8 version) {
require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
_initialized = version;
_initializing = true;
_;
_initializing = false;
emit Initialized(version);
}
/**
* @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
* {initializer} and {reinitializer} modifiers, directly or indirectly.
*/
modifier onlyInitializing() {
require(_initializing, "Initializable: contract is not initializing");
_;
}
/**
* @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
* Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
* to any version. It is recommended to use this to lock implementation contracts that are designed to be called
* through proxies.
*
* Emits an {Initialized} event the first time it is successfully executed.
*/
function _disableInitializers() internal virtual {
require(!_initializing, "Initializable: contract is initializing");
if (_initialized != type(uint8).max) {
_initialized = type(uint8).max;
emit Initialized(type(uint8).max);
}
}
/**
* @dev Returns the highest version that has been initialized. See {reinitializer}.
*/
function _getInitializedVersion() internal view returns (uint8) {
return _initialized;
}
/**
* @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
*/
function _isInitializing() internal view returns (bool) {
return _initializing;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library AddressUpgradeable {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
*
* Furthermore, `isContract` will also return true if the target contract within
* the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
* which only has an effect at the end of a transaction.
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SafeCast.sol)
// This file was procedurally generated from scripts/generate/templates/SafeCast.js.
pragma solidity ^0.8.0;
/**
* @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow
* checks.
*
* Downcasting from uint256/int256 in Solidity does not revert on overflow. This can
* easily result in undesired exploitation or bugs, since developers usually
* assume that overflows raise errors. `SafeCast` restores this intuition by
* reverting the transaction when such an operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*
* Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing
* all math on `uint256` and `int256` and then downcasting.
*/
library SafeCast {
/**
* @dev Returns the downcasted uint248 from uint256, reverting on
* overflow (when the input is greater than largest uint248).
*
* Counterpart to Solidity's `uint248` operator.
*
* Requirements:
*
* - input must fit into 248 bits
*
* _Available since v4.7._
*/
function toUint248(uint256 value) internal pure returns (uint248) {
require(value <= type(uint248).max, "SafeCast: value doesn't fit in 248 bits");
return uint248(value);
}
/**
* @dev Returns the downcasted uint240 from uint256, reverting on
* overflow (when the input is greater than largest uint240).
*
* Counterpart to Solidity's `uint240` operator.
*
* Requirements:
*
* - input must fit into 240 bits
*
* _Available since v4.7._
*/
function toUint240(uint256 value) internal pure returns (uint240) {
require(value <= type(uint240).max, "SafeCast: value doesn't fit in 240 bits");
return uint240(value);
}
/**
* @dev Returns the downcasted uint232 from uint256, reverting on
* overflow (when the input is greater than largest uint232).
*
* Counterpart to Solidity's `uint232` operator.
*
* Requirements:
*
* - input must fit into 232 bits
*
* _Available since v4.7._
*/
function toUint232(uint256 value) internal pure returns (uint232) {
require(value <= type(uint232).max, "SafeCast: value doesn't fit in 232 bits");
return uint232(value);
}
/**
* @dev Returns the downcasted uint224 from uint256, reverting on
* overflow (when the input is greater than largest uint224).
*
* Counterpart to Solidity's `uint224` operator.
*
* Requirements:
*
* - input must fit into 224 bits
*
* _Available since v4.2._
*/
function toUint224(uint256 value) internal pure returns (uint224) {
require(value <= type(uint224).max, "SafeCast: value doesn't fit in 224 bits");
return uint224(value);
}
/**
* @dev Returns the downcasted uint216 from uint256, reverting on
* overflow (when the input is greater than largest uint216).
*
* Counterpart to Solidity's `uint216` operator.
*
* Requirements:
*
* - input must fit into 216 bits
*
* _Available since v4.7._
*/
function toUint216(uint256 value) internal pure returns (uint216) {
require(value <= type(uint216).max, "SafeCast: value doesn't fit in 216 bits");
return uint216(value);
}
/**
* @dev Returns the downcasted uint208 from uint256, reverting on
* overflow (when the input is greater than largest uint208).
*
* Counterpart to Solidity's `uint208` operator.
*
* Requirements:
*
* - input must fit into 208 bits
*
* _Available since v4.7._
*/
function toUint208(uint256 value) internal pure returns (uint208) {
require(value <= type(uint208).max, "SafeCast: value doesn't fit in 208 bits");
return uint208(value);
}
/**
* @dev Returns the downcasted uint200 from uint256, reverting on
* overflow (when the input is greater than largest uint200).
*
* Counterpart to Solidity's `uint200` operator.
*
* Requirements:
*
* - input must fit into 200 bits
*
* _Available since v4.7._
*/
function toUint200(uint256 value) internal pure returns (uint200) {
require(value <= type(uint200).max, "SafeCast: value doesn't fit in 200 bits");
return uint200(value);
}
/**
* @dev Returns the downcasted uint192 from uint256, reverting on
* overflow (when the input is greater than largest uint192).
*
* Counterpart to Solidity's `uint192` operator.
*
* Requirements:
*
* - input must fit into 192 bits
*
* _Available since v4.7._
*/
function toUint192(uint256 value) internal pure returns (uint192) {
require(value <= type(uint192).max, "SafeCast: value doesn't fit in 192 bits");
return uint192(value);
}
/**
* @dev Returns the downcasted uint184 from uint256, reverting on
* overflow (when the input is greater than largest uint184).
*
* Counterpart to Solidity's `uint184` operator.
*
* Requirements:
*
* - input must fit into 184 bits
*
* _Available since v4.7._
*/
function toUint184(uint256 value) internal pure returns (uint184) {
require(value <= type(uint184).max, "SafeCast: value doesn't fit in 184 bits");
return uint184(value);
}
/**
* @dev Returns the downcasted uint176 from uint256, reverting on
* overflow (when the input is greater than largest uint176).
*
* Counterpart to Solidity's `uint176` operator.
*
* Requirements:
*
* - input must fit into 176 bits
*
* _Available since v4.7._
*/
function toUint176(uint256 value) internal pure returns (uint176) {
require(value <= type(uint176).max, "SafeCast: value doesn't fit in 176 bits");
return uint176(value);
}
/**
* @dev Returns the downcasted uint168 from uint256, reverting on
* overflow (when the input is greater than largest uint168).
*
* Counterpart to Solidity's `uint168` operator.
*
* Requirements:
*
* - input must fit into 168 bits
*
* _Available since v4.7._
*/
function toUint168(uint256 value) internal pure returns (uint168) {
require(value <= type(uint168).max, "SafeCast: value doesn't fit in 168 bits");
return uint168(value);
}
/**
* @dev Returns the downcasted uint160 from uint256, reverting on
* overflow (when the input is greater than largest uint160).
*
* Counterpart to Solidity's `uint160` operator.
*
* Requirements:
*
* - input must fit into 160 bits
*
* _Available since v4.7._
*/
function toUint160(uint256 value) internal pure returns (uint160) {
require(value <= type(uint160).max, "SafeCast: value doesn't fit in 160 bits");
return uint160(value);
}
/**
* @dev Returns the downcasted uint152 from uint256, reverting on
* overflow (when the input is greater than largest uint152).
*
* Counterpart to Solidity's `uint152` operator.
*
* Requirements:
*
* - input must fit into 152 bits
*
* _Available since v4.7._
*/
function toUint152(uint256 value) internal pure returns (uint152) {
require(value <= type(uint152).max, "SafeCast: value doesn't fit in 152 bits");
return uint152(value);
}
/**
* @dev Returns the downcasted uint144 from uint256, reverting on
* overflow (when the input is greater than largest uint144).
*
* Counterpart to Solidity's `uint144` operator.
*
* Requirements:
*
* - input must fit into 144 bits
*
* _Available since v4.7._
*/
function toUint144(uint256 value) internal pure returns (uint144) {
require(value <= type(uint144).max, "SafeCast: value doesn't fit in 144 bits");
return uint144(value);
}
/**
* @dev Returns the downcasted uint136 from uint256, reverting on
* overflow (when the input is greater than largest uint136).
*
* Counterpart to Solidity's `uint136` operator.
*
* Requirements:
*
* - input must fit into 136 bits
*
* _Available since v4.7._
*/
function toUint136(uint256 value) internal pure returns (uint136) {
require(value <= type(uint136).max, "SafeCast: value doesn't fit in 136 bits");
return uint136(value);
}
/**
* @dev Returns the downcasted uint128 from uint256, reverting on
* overflow (when the input is greater than largest uint128).
*
* Counterpart to Solidity's `uint128` operator.
*
* Requirements:
*
* - input must fit into 128 bits
*
* _Available since v2.5._
*/
function toUint128(uint256 value) internal pure returns (uint128) {
require(value <= type(uint128).max, "SafeCast: value doesn't fit in 128 bits");
return uint128(value);
}
/**
* @dev Returns the downcasted uint120 from uint256, reverting on
* overflow (when the input is greater than largest uint120).
*
* Counterpart to Solidity's `uint120` operator.
*
* Requirements:
*
* - input must fit into 120 bits
*
* _Available since v4.7._
*/
function toUint120(uint256 value) internal pure returns (uint120) {
require(value <= type(uint120).max, "SafeCast: value doesn't fit in 120 bits");
return uint120(value);
}
/**
* @dev Returns the downcasted uint112 from uint256, reverting on
* overflow (when the input is greater than largest uint112).
*
* Counterpart to Solidity's `uint112` operator.
*
* Requirements:
*
* - input must fit into 112 bits
*
* _Available since v4.7._
*/
function toUint112(uint256 value) internal pure returns (uint112) {
require(value <= type(uint112).max, "SafeCast: value doesn't fit in 112 bits");
return uint112(value);
}
/**
* @dev Returns the downcasted uint104 from uint256, reverting on
* overflow (when the input is greater than largest uint104).
*
* Counterpart to Solidity's `uint104` operator.
*
* Requirements:
*
* - input must fit into 104 bits
*
* _Available since v4.7._
*/
function toUint104(uint256 value) internal pure returns (uint104) {
require(value <= type(uint104).max, "SafeCast: value doesn't fit in 104 bits");
return uint104(value);
}
/**
* @dev Returns the downcasted uint96 from uint256, reverting on
* overflow (when the input is greater than largest uint96).
*
* Counterpart to Solidity's `uint96` operator.
*
* Requirements:
*
* - input must fit into 96 bits
*
* _Available since v4.2._
*/
function toUint96(uint256 value) internal pure returns (uint96) {
require(value <= type(uint96).max, "SafeCast: value doesn't fit in 96 bits");
return uint96(value);
}
/**
* @dev Returns the downcasted uint88 from uint256, reverting on
* overflow (when the input is greater than largest uint88).
*
* Counterpart to Solidity's `uint88` operator.
*
* Requirements:
*
* - input must fit into 88 bits
*
* _Available since v4.7._
*/
function toUint88(uint256 value) internal pure returns (uint88) {
require(value <= type(uint88).max, "SafeCast: value doesn't fit in 88 bits");
return uint88(value);
}
/**
* @dev Returns the downcasted uint80 from uint256, reverting on
* overflow (when the input is greater than largest uint80).
*
* Counterpart to Solidity's `uint80` operator.
*
* Requirements:
*
* - input must fit into 80 bits
*
* _Available since v4.7._
*/
function toUint80(uint256 value) internal pure returns (uint80) {
require(value <= type(uint80).max, "SafeCast: value doesn't fit in 80 bits");
return uint80(value);
}
/**
* @dev Returns the downcasted uint72 from uint256, reverting on
* overflow (when the input is greater than largest uint72).
*
* Counterpart to Solidity's `uint72` operator.
*
* Requirements:
*
* - input must fit into 72 bits
*
* _Available since v4.7._
*/
function toUint72(uint256 value) internal pure returns (uint72) {
require(value <= type(uint72).max, "SafeCast: value doesn't fit in 72 bits");
return uint72(value);
}
/**
* @dev Returns the downcasted uint64 from uint256, reverting on
* overflow (when the input is greater than largest uint64).
*
* Counterpart to Solidity's `uint64` operator.
*
* Requirements:
*
* - input must fit into 64 bits
*
* _Available since v2.5._
*/
function toUint64(uint256 value) internal pure returns (uint64) {
require(value <= type(uint64).max, "SafeCast: value doesn't fit in 64 bits");
return uint64(value);
}
/**
* @dev Returns the downcasted uint56 from uint256, reverting on
* overflow (when the input is greater than largest uint56).
*
* Counterpart to Solidity's `uint56` operator.
*
* Requirements:
*
* - input must fit into 56 bits
*
* _Available since v4.7._
*/
function toUint56(uint256 value) internal pure returns (uint56) {
require(value <= type(uint56).max, "SafeCast: value doesn't fit in 56 bits");
return uint56(value);
}
/**
* @dev Returns the downcasted uint48 from uint256, reverting on
* overflow (when the input is greater than largest uint48).
*
* Counterpart to Solidity's `uint48` operator.
*
* Requirements:
*
* - input must fit into 48 bits
*
* _Available since v4.7._
*/
function toUint48(uint256 value) internal pure returns (uint48) {
require(value <= type(uint48).max, "SafeCast: value doesn't fit in 48 bits");
return uint48(value);
}
/**
* @dev Returns the downcasted uint40 from uint256, reverting on
* overflow (when the input is greater than largest uint40).
*
* Counterpart to Solidity's `uint40` operator.
*
* Requirements:
*
* - input must fit into 40 bits
*
* _Available since v4.7._
*/
function toUint40(uint256 value) internal pure returns (uint40) {
require(value <= type(uint40).max, "SafeCast: value doesn't fit in 40 bits");
return uint40(value);
}
/**
* @dev Returns the downcasted uint32 from uint256, reverting on
* overflow (when the input is greater than largest uint32).
*
* Counterpart to Solidity's `uint32` operator.
*
* Requirements:
*
* - input must fit into 32 bits
*
* _Available since v2.5._
*/
function toUint32(uint256 value) internal pure returns (uint32) {
require(value <= type(uint32).max, "SafeCast: value doesn't fit in 32 bits");
return uint32(value);
}
/**
* @dev Returns the downcasted uint24 from uint256, reverting on
* overflow (when the input is greater than largest uint24).
*
* Counterpart to Solidity's `uint24` operator.
*
* Requirements:
*
* - input must fit into 24 bits
*
* _Available since v4.7._
*/
function toUint24(uint256 value) internal pure returns (uint24) {
require(value <= type(uint24).max, "SafeCast: value doesn't fit in 24 bits");
return uint24(value);
}
/**
* @dev Returns the downcasted uint16 from uint256, reverting on
* overflow (when the input is greater than largest uint16).
*
* Counterpart to Solidity's `uint16` operator.
*
* Requirements:
*
* - input must fit into 16 bits
*
* _Available since v2.5._
*/
function toUint16(uint256 value) internal pure returns (uint16) {
require(value <= type(uint16).max, "SafeCast: value doesn't fit in 16 bits");
return uint16(value);
}
/**
* @dev Returns the downcasted uint8 from uint256, reverting on
* overflow (when the input is greater than largest uint8).
*
* Counterpart to Solidity's `uint8` operator.
*
* Requirements:
*
* - input must fit into 8 bits
*
* _Available since v2.5._
*/
function toUint8(uint256 value) internal pure returns (uint8) {
require(value <= type(uint8).max, "SafeCast: value doesn't fit in 8 bits");
return uint8(value);
}
/**
* @dev Converts a signed int256 into an unsigned uint256.
*
* Requirements:
*
* - input must be greater than or equal to 0.
*
* _Available since v3.0._
*/
function toUint256(int256 value) internal pure returns (uint256) {
require(value >= 0, "SafeCast: value must be positive");
return uint256(value);
}
/**
* @dev Returns the downcasted int248 from int256, reverting on
* overflow (when the input is less than smallest int248 or
* greater than largest int248).
*
* Counterpart to Solidity's `int248` operator.
*
* Requirements:
*
* - input must fit into 248 bits
*
* _Available since v4.7._
*/
function toInt248(int256 value) internal pure returns (int248 downcasted) {
downcasted = int248(value);
require(downcasted == value, "SafeCast: value doesn't fit in 248 bits");
}
/**
* @dev Returns the downcasted int240 from int256, reverting on
* overflow (when the input is less than smallest int240 or
* greater than largest int240).
*
* Counterpart to Solidity's `int240` operator.
*
* Requirements:
*
* - input must fit into 240 bits
*
* _Available since v4.7._
*/
function toInt240(int256 value) internal pure returns (int240 downcasted) {
downcasted = int240(value);
require(downcasted == value, "SafeCast: value doesn't fit in 240 bits");
}
/**
* @dev Returns the downcasted int232 from int256, reverting on
* overflow (when the input is less than smallest int232 or
* greater than largest int232).
*
* Counterpart to Solidity's `int232` operator.
*
* Requirements:
*
* - input must fit into 232 bits
*
* _Available since v4.7._
*/
function toInt232(int256 value) internal pure returns (int232 downcasted) {
downcasted = int232(value);
require(downcasted == value, "SafeCast: value doesn't fit in 232 bits");
}
/**
* @dev Returns the downcasted int224 from int256, reverting on
* overflow (when the input is less than smallest int224 or
* greater than largest int224).
*
* Counterpart to Solidity's `int224` operator.
*
* Requirements:
*
* - input must fit into 224 bits
*
* _Available since v4.7._
*/
function toInt224(int256 value) internal pure returns (int224 downcasted) {
downcasted = int224(value);
require(downcasted == value, "SafeCast: value doesn't fit in 224 bits");
}
/**
* @dev Returns the downcasted int216 from int256, reverting on
* overflow (when the input is less than smallest int216 or
* greater than largest int216).
*
* Counterpart to Solidity's `int216` operator.
*
* Requirements:
*
* - input must fit into 216 bits
*
* _Available since v4.7._
*/
function toInt216(int256 value) internal pure returns (int216 downcasted) {
downcasted = int216(value);
require(downcasted == value, "SafeCast: value doesn't fit in 216 bits");
}
/**
* @dev Returns the downcasted int208 from int256, reverting on
* overflow (when the input is less than smallest int208 or
* greater than largest int208).
*
* Counterpart to Solidity's `int208` operator.
*
* Requirements:
*
* - input must fit into 208 bits
*
* _Available since v4.7._
*/
function toInt208(int256 value) internal pure returns (int208 downcasted) {
downcasted = int208(value);
require(downcasted == value, "SafeCast: value doesn't fit in 208 bits");
}
/**
* @dev Returns the downcasted int200 from int256, reverting on
* overflow (when the input is less than smallest int200 or
* greater than largest int200).
*
* Counterpart to Solidity's `int200` operator.
*
* Requirements:
*
* - input must fit into 200 bits
*
* _Available since v4.7._
*/
function toInt200(int256 value) internal pure returns (int200 downcasted) {
downcasted = int200(value);
require(downcasted == value, "SafeCast: value doesn't fit in 200 bits");
}
/**
* @dev Returns the downcasted int192 from int256, reverting on
* overflow (when the input is less than smallest int192 or
* greater than largest int192).
*
* Counterpart to Solidity's `int192` operator.
*
* Requirements:
*
* - input must fit into 192 bits
*
* _Available since v4.7._
*/
function toInt192(int256 value) internal pure returns (int192 downcasted) {
downcasted = int192(value);
require(downcasted == value, "SafeCast: value doesn't fit in 192 bits");
}
/**
* @dev Returns the downcasted int184 from int256, reverting on
* overflow (when the input is less than smallest int184 or
* greater than largest int184).
*
* Counterpart to Solidity's `int184` operator.
*
* Requirements:
*
* - input must fit into 184 bits
*
* _Available since v4.7._
*/
function toInt184(int256 value) internal pure returns (int184 downcasted) {
downcasted = int184(value);
require(downcasted == value, "SafeCast: value doesn't fit in 184 bits");
}
/**
* @dev Returns the downcasted int176 from int256, reverting on
* overflow (when the input is less than smallest int176 or
* greater than largest int176).
*
* Counterpart to Solidity's `int176` operator.
*
* Requirements:
*
* - input must fit into 176 bits
*
* _Available since v4.7._
*/
function toInt176(int256 value) internal pure returns (int176 downcasted) {
downcasted = int176(value);
require(downcasted == value, "SafeCast: value doesn't fit in 176 bits");
}
/**
* @dev Returns the downcasted int168 from int256, reverting on
* overflow (when the input is less than smallest int168 or
* greater than largest int168).
*
* Counterpart to Solidity's `int168` operator.
*
* Requirements:
*
* - input must fit into 168 bits
*
* _Available since v4.7._
*/
function toInt168(int256 value) internal pure returns (int168 downcasted) {
downcasted = int168(value);
require(downcasted == value, "SafeCast: value doesn't fit in 168 bits");
}
/**
* @dev Returns the downcasted int160 from int256, reverting on
* overflow (when the input is less than smallest int160 or
* greater than largest int160).
*
* Counterpart to Solidity's `int160` operator.
*
* Requirements:
*
* - input must fit into 160 bits
*
* _Available since v4.7._
*/
function toInt160(int256 value) internal pure returns (int160 downcasted) {
downcasted = int160(value);
require(downcasted == value, "SafeCast: value doesn't fit in 160 bits");
}
/**
* @dev Returns the downcasted int152 from int256, reverting on
* overflow (when the input is less than smallest int152 or
* greater than largest int152).
*
* Counterpart to Solidity's `int152` operator.
*
* Requirements:
*
* - input must fit into 152 bits
*
* _Available since v4.7._
*/
function toInt152(int256 value) internal pure returns (int152 downcasted) {
downcasted = int152(value);
require(downcasted == value, "SafeCast: value doesn't fit in 152 bits");
}
/**
* @dev Returns the downcasted int144 from int256, reverting on
* overflow (when the input is less than smallest int144 or
* greater than largest int144).
*
* Counterpart to Solidity's `int144` operator.
*
* Requirements:
*
* - input must fit into 144 bits
*
* _Available since v4.7._
*/
function toInt144(int256 value) internal pure returns (int144 downcasted) {
downcasted = int144(value);
require(downcasted == value, "SafeCast: value doesn't fit in 144 bits");
}
/**
* @dev Returns the downcasted int136 from int256, reverting on
* overflow (when the input is less than smallest int136 or
* greater than largest int136).
*
* Counterpart to Solidity's `int136` operator.
*
* Requirements:
*
* - input must fit into 136 bits
*
* _Available since v4.7._
*/
function toInt136(int256 value) internal pure returns (int136 downcasted) {
downcasted = int136(value);
require(downcasted == value, "SafeCast: value doesn't fit in 136 bits");
}
/**
* @dev Returns the downcasted int128 from int256, reverting on
* overflow (when the input is less than smallest int128 or
* greater than largest int128).
*
* Counterpart to Solidity's `int128` operator.
*
* Requirements:
*
* - input must fit into 128 bits
*
* _Available since v3.1._
*/
function toInt128(int256 value) internal pure returns (int128 downcasted) {
downcasted = int128(value);
require(downcasted == value, "SafeCast: value doesn't fit in 128 bits");
}
/**
* @dev Returns the downcasted int120 from int256, reverting on
* overflow (when the input is less than smallest int120 or
* greater than largest int120).
*
* Counterpart to Solidity's `int120` operator.
*
* Requirements:
*
* - input must fit into 120 bits
*
* _Available since v4.7._
*/
function toInt120(int256 value) internal pure returns (int120 downcasted) {
downcasted = int120(value);
require(downcasted == value, "SafeCast: value doesn't fit in 120 bits");
}
/**
* @dev Returns the downcasted int112 from int256, reverting on
* overflow (when the input is less than smallest int112 or
* greater than largest int112).
*
* Counterpart to Solidity's `int112` operator.
*
* Requirements:
*
* - input must fit into 112 bits
*
* _Available since v4.7._
*/
function toInt112(int256 value) internal pure returns (int112 downcasted) {
downcasted = int112(value);
require(downcasted == value, "SafeCast: value doesn't fit in 112 bits");
}
/**
* @dev Returns the downcasted int104 from int256, reverting on
* overflow (when the input is less than smallest int104 or
* greater than largest int104).
*
* Counterpart to Solidity's `int104` operator.
*
* Requirements:
*
* - input must fit into 104 bits
*
* _Available since v4.7._
*/
function toInt104(int256 value) internal pure returns (int104 downcasted) {
downcasted = int104(value);
require(downcasted == value, "SafeCast: value doesn't fit in 104 bits");
}
/**
* @dev Returns the downcasted int96 from int256, reverting on
* overflow (when the input is less than smallest int96 or
* greater than largest int96).
*
* Counterpart to Solidity's `int96` operator.
*
* Requirements:
*
* - input must fit into 96 bits
*
* _Available since v4.7._
*/
function toInt96(int256 value) internal pure returns (int96 downcasted) {
downcasted = int96(value);
require(downcasted == value, "SafeCast: value doesn't fit in 96 bits");
}
/**
* @dev Returns the downcasted int88 from int256, reverting on
* overflow (when the input is less than smallest int88 or
* greater than largest int88).
*
* Counterpart to Solidity's `int88` operator.
*
* Requirements:
*
* - input must fit into 88 bits
*
* _Available since v4.7._
*/
function toInt88(int256 value) internal pure returns (int88 downcasted) {
downcasted = int88(value);
require(downcasted == value, "SafeCast: value doesn't fit in 88 bits");
}
/**
* @dev Returns the downcasted int80 from int256, reverting on
* overflow (when the input is less than smallest int80 or
* greater than largest int80).
*
* Counterpart to Solidity's `int80` operator.
*
* Requirements:
*
* - input must fit into 80 bits
*
* _Available since v4.7._
*/
function toInt80(int256 value) internal pure returns (int80 downcasted) {
downcasted = int80(value);
require(downcasted == value, "SafeCast: value doesn't fit in 80 bits");
}
/**
* @dev Returns the downcasted int72 from int256, reverting on
* overflow (when the input is less than smallest int72 or
* greater than largest int72).
*
* Counterpart to Solidity's `int72` operator.
*
* Requirements:
*
* - input must fit into 72 bits
*
* _Available since v4.7._
*/
function toInt72(int256 value) internal pure returns (int72 downcasted) {
downcasted = int72(value);
require(downcasted == value, "SafeCast: value doesn't fit in 72 bits");
}
/**
* @dev Returns the downcasted int64 from int256, reverting on
* overflow (when the input is less than smallest int64 or
* greater than largest int64).
*
* Counterpart to Solidity's `int64` operator.
*
* Requirements:
*
* - input must fit into 64 bits
*
* _Available since v3.1._
*/
function toInt64(int256 value) internal pure returns (int64 downcasted) {
downcasted = int64(value);
require(downcasted == value, "SafeCast: value doesn't fit in 64 bits");
}
/**
* @dev Returns the downcasted int56 from int256, reverting on
* overflow (when the input is less than smallest int56 or
* greater than largest int56).
*
* Counterpart to Solidity's `int56` operator.
*
* Requirements:
*
* - input must fit into 56 bits
*
* _Available since v4.7._
*/
function toInt56(int256 value) internal pure returns (int56 downcasted) {
downcasted = int56(value);
require(downcasted == value, "SafeCast: value doesn't fit in 56 bits");
}
/**
* @dev Returns the downcasted int48 from int256, reverting on
* overflow (when the input is less than smallest int48 or
* greater than largest int48).
*
* Counterpart to Solidity's `int48` operator.
*
* Requirements:
*
* - input must fit into 48 bits
*
* _Available since v4.7._
*/
function toInt48(int256 value) internal pure returns (int48 downcasted) {
downcasted = int48(value);
require(downcasted == value, "SafeCast: value doesn't fit in 48 bits");
}
/**
* @dev Returns the downcasted int40 from int256, reverting on
* overflow (when the input is less than smallest int40 or
* greater than largest int40).
*
* Counterpart to Solidity's `int40` operator.
*
* Requirements:
*
* - input must fit into 40 bits
*
* _Available since v4.7._
*/
function toInt40(int256 value) internal pure returns (int40 downcasted) {
downcasted = int40(value);
require(downcasted == value, "SafeCast: value doesn't fit in 40 bits");
}
/**
* @dev Returns the downcasted int32 from int256, reverting on
* overflow (when the input is less than smallest int32 or
* greater than largest int32).
*
* Counterpart to Solidity's `int32` operator.
*
* Requirements:
*
* - input must fit into 32 bits
*
* _Available since v3.1._
*/
function toInt32(int256 value) internal pure returns (int32 downcasted) {
downcasted = int32(value);
require(downcasted == value, "SafeCast: value doesn't fit in 32 bits");
}
/**
* @dev Returns the downcasted int24 from int256, reverting on
* overflow (when the input is less than smallest int24 or
* greater than largest int24).
*
* Counterpart to Solidity's `int24` operator.
*
* Requirements:
*
* - input must fit into 24 bits
*
* _Available since v4.7._
*/
function toInt24(int256 value) internal pure returns (int24 downcasted) {
downcasted = int24(value);
require(downcasted == value, "SafeCast: value doesn't fit in 24 bits");
}
/**
* @dev Returns the downcasted int16 from int256, reverting on
* overflow (when the input is less than smallest int16 or
* greater than largest int16).
*
* Counterpart to Solidity's `int16` operator.
*
* Requirements:
*
* - input must fit into 16 bits
*
* _Available since v3.1._
*/
function toInt16(int256 value) internal pure returns (int16 downcasted) {
downcasted = int16(value);
require(downcasted == value, "SafeCast: value doesn't fit in 16 bits");
}
/**
* @dev Returns the downcasted int8 from int256, reverting on
* overflow (when the input is less than smallest int8 or
* greater than largest int8).
*
* Counterpart to Solidity's `int8` operator.
*
* Requirements:
*
* - input must fit into 8 bits
*
* _Available since v3.1._
*/
function toInt8(int256 value) internal pure returns (int8 downcasted) {
downcasted = int8(value);
require(downcasted == value, "SafeCast: value doesn't fit in 8 bits");
}
/**
* @dev Converts an unsigned uint256 into a signed int256.
*
* Requirements:
*
* - input must be less than or equal to maxInt256.
*
* _Available since v3.0._
*/
function toInt256(uint256 value) internal pure returns (int256) {
// Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive
require(value <= uint256(type(int256).max), "SafeCast: value doesn't fit in an int256");
return int256(value);
}
}{
"evmVersion": "paris",
"libraries": {},
"metadata": {
"appendCBOR": true,
"bytecodeHash": "ipfs",
"useLiteralContent": false
},
"optimizer": {
"enabled": true,
"runs": 200
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"remappings": [
"@forge-std/=lib/forge-std/src/",
"@openzeppelin-contracts/=lib/openzeppelin-contracts/contracts/",
"@openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/",
"ds-test/=lib/forge-std/lib/ds-test/src/",
"erc4626-tests/=lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/",
"forge-std/=lib/forge-std/src/",
"openzeppelin-contracts copy/=lib/openzeppelin-contracts copy/",
"openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/",
"openzeppelin-contracts/=lib/openzeppelin-contracts/",
"openzeppelin/=lib/openzeppelin-contracts-upgradeable/contracts/"
]
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"_core","type":"address"},{"internalType":"address","name":"_acm","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint16","name":"mode","type":"uint16"},{"indexed":true,"internalType":"address","name":"pool","type":"address"},{"indexed":false,"internalType":"uint256","name":"amt","type":"uint256"}],"name":"SetModeDebtCeilingInfo","type":"event"},{"inputs":[],"name":"ACM","outputs":[{"internalType":"contract IAccessControlManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"CORE","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_mode","type":"uint16"},{"internalType":"address","name":"_pool","type":"address"}],"name":"getModeDebtAmtCurrent","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_mode","type":"uint16"},{"internalType":"address","name":"_pool","type":"address"}],"name":"getModeDebtAmtStored","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_mode","type":"uint16"},{"internalType":"address","name":"_pool","type":"address"}],"name":"getModeDebtCeilingAmt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_mode","type":"uint16"},{"internalType":"address","name":"_pool","type":"address"}],"name":"getModeDebtShares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_mode","type":"uint16"},{"internalType":"address[]","name":"_pools","type":"address[]"},{"internalType":"uint128[]","name":"_ceilAmts","type":"uint128[]"}],"name":"setModeDebtCeilingInfo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_mode","type":"uint16"},{"internalType":"address","name":"_pool","type":"address"},{"internalType":"int256","name":"_deltaShares","type":"int256"}],"name":"updateModeDebtShares","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
60c060405234801561001057600080fd5b50604051610d1a380380610d1a83398101604081905261002f9161012c565b6001600160a01b03808216608052821660a05261004a610051565b505061015f565b600054610100900460ff16156100bd5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff9081161461010e576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b80516001600160a01b038116811461012757600080fd5b919050565b6000806040838503121561013f57600080fd5b61014883610110565b915061015660208401610110565b90509250929050565b60805160a051610b886101926000396000818161010801526103b00152600081816101c3015261056d0152610b886000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c80639f03e8e5116100665780639f03e8e51461014c578063d314e28f14610198578063ec0621da146101ab578063f9b80da1146101be578063fe00b2c6146101e557600080fd5b806358786477146100985780636421b755146100f05780636b6c0774146101035780638129fc1c14610142575b600080fd5b6100dd6100a636600461096d565b61ffff821660009081526001602090815260408083206001600160a01b03851684529091529020546001600160801b031692915050565b6040519081526020015b60405180910390f35b6100dd6100fe36600461096d565b6101f8565b61012a7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100e7565b61014a610294565b005b6100dd61015a36600461096d565b61ffff9190911660009081526001602090815260408083206001600160a01b039490941683529290522054600160801b90046001600160801b031690565b61014a6101a63660046109a0565b6103a2565b61014a6101b9366004610a28565b610532565b61012a7f000000000000000000000000000000000000000000000000000000000000000081565b6100dd6101f336600461096d565b610734565b61ffff821660009081526001602090815260408083206001600160a01b03851680855292528083205490516318ddac3960e11b8152600160801b9091046001600160801b031660048201526331bb587290602401602060405180830381865afa158015610269573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061028d9190610aa9565b9392505050565b600054610100900460ff16158080156102b45750600054600160ff909116105b806102ce5750303b1580156102ce575060005460ff166001145b6103365760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b6000805460ff191660011790558015610359576000805461ff0019166101001790555b801561039f576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50565b6103d8336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161460656107a7565b61ffff831660009081526001602090815260408083206001600160a01b038616845282528083208151808301909252546001600160801b038082168352600160801b909104169181018290529190610444908490610435906107b9565b61043f9190610ac2565b610827565b905060008313156104dd576040516331a86fe160e01b8152600481018290526000906001600160a01b038616906331a86fe1906024016020604051808303816000875af1158015610499573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104bd9190610aa9565b90506104db83600001516001600160801b03168211156103206107a7565b505b6104e681610879565b61ffff90951660009081526001602090815260408083206001600160a01b0390971683529590529390932080546001600160801b03958616600160801b02951694909417909355505050565b6040516312d9a6ad60e01b81527f8fbcb4375b910093bcf636b6b2f26b26eda2a29ef5a8ee7de44b5743c3bf9a2860048201523360248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906312d9a6ad90604401600060405180830381600087803b1580156105b957600080fd5b505af11580156105cd573d6000803e3d6000fd5b506105df9250505083821460c86107a7565b60005b8381101561072c578282828181106105fc576105fc610af8565b90506020020160208101906106119190610b0e565b61ffff871660009081526001602052604081209087878581811061063757610637610af8565b905060200201602081019061064c9190610b37565b6001600160a01b03168152602081019190915260400160002080546fffffffffffffffffffffffffffffffff19166001600160801b039290921691909117905584848281811061069e5761069e610af8565b90506020020160208101906106b39190610b37565b6001600160a01b03168661ffff167fbb30d2c4291a916fb449c0bfec8820ca2f36265e71365dfe6d4661f03961ff108585858181106106f4576106f4610af8565b90506020020160208101906107099190610b0e565b6040516001600160801b03909116815260200160405180910390a36001016105e2565b505050505050565b61ffff821660009081526001602090815260408083206001600160a01b03851680855292528083205490516331a86fe160e01b8152600160801b9091046001600160801b031660048201526331a86fe1906024016020604051808303816000875af1158015610269573d6000803e3d6000fd5b816107b5576107b5816108e2565b5050565b60006001600160ff1b038211156108235760405162461bcd60e51b815260206004820152602860248201527f53616665436173743a2076616c756520646f65736e27742066697420696e2061604482015267371034b73a191a9b60c11b606482015260840161032d565b5090565b6000808212156108235760405162461bcd60e51b815260206004820181905260248201527f53616665436173743a2076616c7565206d75737420626520706f736974697665604482015260640161032d565b60006001600160801b038211156108235760405162461bcd60e51b815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e20316044820152663238206269747360c81b606482015260840161032d565b62461bcd60e51b600090815260206004526007602452600a808304818106603090810160081b83860601918390049283060160101b0166494e43230000300160c81b604481905261039f9262494e4360e81b9162494e4391606490fd5b803561ffff8116811461095157600080fd5b919050565b80356001600160a01b038116811461095157600080fd5b6000806040838503121561098057600080fd5b6109898361093f565b915061099760208401610956565b90509250929050565b6000806000606084860312156109b557600080fd5b6109be8461093f565b92506109cc60208501610956565b9150604084013590509250925092565b60008083601f8401126109ee57600080fd5b50813567ffffffffffffffff811115610a0657600080fd5b6020830191508360208260051b8501011115610a2157600080fd5b9250929050565b600080600080600060608688031215610a4057600080fd5b610a498661093f565b9450602086013567ffffffffffffffff80821115610a6657600080fd5b610a7289838a016109dc565b90965094506040880135915080821115610a8b57600080fd5b50610a98888289016109dc565b969995985093965092949392505050565b600060208284031215610abb57600080fd5b5051919050565b8082018281126000831280158216821582161715610af057634e487b7160e01b600052601160045260246000fd5b505092915050565b634e487b7160e01b600052603260045260246000fd5b600060208284031215610b2057600080fd5b81356001600160801b038116811461028d57600080fd5b600060208284031215610b4957600080fd5b61028d8261095656fea2646970667358221220f25674dbb31ed462178a63fbc1b25f7ea01d3483cc0ef1c0e9f897f2be4ce34e64736f6c63430008130033000000000000000000000000972bcb0284cca0152527c4f70f8f689852bcafc5000000000000000000000000ce3292ca5abbdfa1db02142a67cffc708530675a
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100935760003560e01c80639f03e8e5116100665780639f03e8e51461014c578063d314e28f14610198578063ec0621da146101ab578063f9b80da1146101be578063fe00b2c6146101e557600080fd5b806358786477146100985780636421b755146100f05780636b6c0774146101035780638129fc1c14610142575b600080fd5b6100dd6100a636600461096d565b61ffff821660009081526001602090815260408083206001600160a01b03851684529091529020546001600160801b031692915050565b6040519081526020015b60405180910390f35b6100dd6100fe36600461096d565b6101f8565b61012a7f000000000000000000000000972bcb0284cca0152527c4f70f8f689852bcafc581565b6040516001600160a01b0390911681526020016100e7565b61014a610294565b005b6100dd61015a36600461096d565b61ffff9190911660009081526001602090815260408083206001600160a01b039490941683529290522054600160801b90046001600160801b031690565b61014a6101a63660046109a0565b6103a2565b61014a6101b9366004610a28565b610532565b61012a7f000000000000000000000000ce3292ca5abbdfa1db02142a67cffc708530675a81565b6100dd6101f336600461096d565b610734565b61ffff821660009081526001602090815260408083206001600160a01b03851680855292528083205490516318ddac3960e11b8152600160801b9091046001600160801b031660048201526331bb587290602401602060405180830381865afa158015610269573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061028d9190610aa9565b9392505050565b600054610100900460ff16158080156102b45750600054600160ff909116105b806102ce5750303b1580156102ce575060005460ff166001145b6103365760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b6000805460ff191660011790558015610359576000805461ff0019166101001790555b801561039f576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50565b6103d8336001600160a01b037f000000000000000000000000972bcb0284cca0152527c4f70f8f689852bcafc5161460656107a7565b61ffff831660009081526001602090815260408083206001600160a01b038616845282528083208151808301909252546001600160801b038082168352600160801b909104169181018290529190610444908490610435906107b9565b61043f9190610ac2565b610827565b905060008313156104dd576040516331a86fe160e01b8152600481018290526000906001600160a01b038616906331a86fe1906024016020604051808303816000875af1158015610499573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104bd9190610aa9565b90506104db83600001516001600160801b03168211156103206107a7565b505b6104e681610879565b61ffff90951660009081526001602090815260408083206001600160a01b0390971683529590529390932080546001600160801b03958616600160801b02951694909417909355505050565b6040516312d9a6ad60e01b81527f8fbcb4375b910093bcf636b6b2f26b26eda2a29ef5a8ee7de44b5743c3bf9a2860048201523360248201527f000000000000000000000000ce3292ca5abbdfa1db02142a67cffc708530675a6001600160a01b0316906312d9a6ad90604401600060405180830381600087803b1580156105b957600080fd5b505af11580156105cd573d6000803e3d6000fd5b506105df9250505083821460c86107a7565b60005b8381101561072c578282828181106105fc576105fc610af8565b90506020020160208101906106119190610b0e565b61ffff871660009081526001602052604081209087878581811061063757610637610af8565b905060200201602081019061064c9190610b37565b6001600160a01b03168152602081019190915260400160002080546fffffffffffffffffffffffffffffffff19166001600160801b039290921691909117905584848281811061069e5761069e610af8565b90506020020160208101906106b39190610b37565b6001600160a01b03168661ffff167fbb30d2c4291a916fb449c0bfec8820ca2f36265e71365dfe6d4661f03961ff108585858181106106f4576106f4610af8565b90506020020160208101906107099190610b0e565b6040516001600160801b03909116815260200160405180910390a36001016105e2565b505050505050565b61ffff821660009081526001602090815260408083206001600160a01b03851680855292528083205490516331a86fe160e01b8152600160801b9091046001600160801b031660048201526331a86fe1906024016020604051808303816000875af1158015610269573d6000803e3d6000fd5b816107b5576107b5816108e2565b5050565b60006001600160ff1b038211156108235760405162461bcd60e51b815260206004820152602860248201527f53616665436173743a2076616c756520646f65736e27742066697420696e2061604482015267371034b73a191a9b60c11b606482015260840161032d565b5090565b6000808212156108235760405162461bcd60e51b815260206004820181905260248201527f53616665436173743a2076616c7565206d75737420626520706f736974697665604482015260640161032d565b60006001600160801b038211156108235760405162461bcd60e51b815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e20316044820152663238206269747360c81b606482015260840161032d565b62461bcd60e51b600090815260206004526007602452600a808304818106603090810160081b83860601918390049283060160101b0166494e43230000300160c81b604481905261039f9262494e4360e81b9162494e4391606490fd5b803561ffff8116811461095157600080fd5b919050565b80356001600160a01b038116811461095157600080fd5b6000806040838503121561098057600080fd5b6109898361093f565b915061099760208401610956565b90509250929050565b6000806000606084860312156109b557600080fd5b6109be8461093f565b92506109cc60208501610956565b9150604084013590509250925092565b60008083601f8401126109ee57600080fd5b50813567ffffffffffffffff811115610a0657600080fd5b6020830191508360208260051b8501011115610a2157600080fd5b9250929050565b600080600080600060608688031215610a4057600080fd5b610a498661093f565b9450602086013567ffffffffffffffff80821115610a6657600080fd5b610a7289838a016109dc565b90965094506040880135915080821115610a8b57600080fd5b50610a98888289016109dc565b969995985093965092949392505050565b600060208284031215610abb57600080fd5b5051919050565b8082018281126000831280158216821582161715610af057634e487b7160e01b600052601160045260246000fd5b505092915050565b634e487b7160e01b600052603260045260246000fd5b600060208284031215610b2057600080fd5b81356001600160801b038116811461028d57600080fd5b600060208284031215610b4957600080fd5b61028d8261095656fea2646970667358221220f25674dbb31ed462178a63fbc1b25f7ea01d3483cc0ef1c0e9f897f2be4ce34e64736f6c63430008130033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000972bcb0284cca0152527c4f70f8f689852bcafc5000000000000000000000000ce3292ca5abbdfa1db02142a67cffc708530675a
-----Decoded View---------------
Arg [0] : _core (address): 0x972BcB0284cca0152527c4f70f8F689852bCAFc5
Arg [1] : _acm (address): 0xCE3292cA5AbbdFA1Db02142A67CFFc708530675a
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000972bcb0284cca0152527c4f70f8f689852bcafc5
Arg [1] : 000000000000000000000000ce3292ca5abbdfa1db02142a67cffc708530675a
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in MNT
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.