Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
SyntheticToken
Compiler Version
v0.8.9+commit.e5eed63a
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; import "./dependencies/openzeppelin-upgradeable/proxy/utils/Initializable.sol"; import "./interfaces/IPool.sol"; import "./interfaces/IManageable.sol"; import "./lib/WadRayMath.sol"; import "./storage/SyntheticTokenStorage.sol"; error SenderIsNotGovernor(); error SenderCanNotBurn(); error SenderCanNotMint(); error SenderCanNotSeize(); error SyntheticIsInactive(); error NameIsNull(); error SymbolIsNull(); error DecimalsIsNull(); error PoolRegistryIsNull(); error DecreasedAllowanceBelowZero(); error AmountExceedsAllowance(); error ApproveFromTheZeroAddress(); error ApproveToTheZeroAddress(); error BurnFromTheZeroAddress(); error BurnAmountExceedsBalance(); error MintToTheZeroAddress(); error SurpassMaxBridgingSupply(); error SurpassMaxSynthSupply(); error TransferFromTheZeroAddress(); error TransferToTheZeroAddress(); error TransferAmountExceedsBalance(); error NewValueIsSameAsCurrent(); error AddressIsNull(); /** * @title Synthetic Token contract */ contract SyntheticToken is Initializable, SyntheticTokenStorageV1 { using WadRayMath for uint256; string public constant VERSION = "1.3.0"; /// @notice Emitted when active flag is updated event SyntheticTokenActiveUpdated(bool newActive); /// @notice Emitted when max total supply is updated event MaxTotalSupplyUpdated(uint256 oldMaxTotalSupply, uint256 newMaxTotalSupply); /// @notice Emitted when max bridged-in supply is updated event MaxBridgedInSupplyUpdated(uint256 oldMaxBridgedInSupply, uint256 newMaxBridgedInSupply); /// @notice Emitted when max bridged-out supply is updated event MaxBridgedOutSupplyUpdated(uint256 oldMaxBridgedOutSupply, uint256 newMaxBridgedOutSupply); /// @notice Emitted when proxyOFT is updated event ProxyOFTUpdated(IProxyOFT oldProxyOFT, IProxyOFT newProxyOFT); /** * @notice Throws if caller isn't the governor */ modifier onlyGovernor() { if (msg.sender != poolRegistry.governor()) revert SenderIsNotGovernor(); _; } /** * @dev Throws if sender can't burn */ modifier onlyIfCanBurn() { if (!_isMsgSenderProxyOFT() && !_isMsgSenderPool() && !_isMsgSenderDebtToken()) revert SenderCanNotBurn(); _; } /** * @dev Throws if sender can't mint */ modifier onlyIfCanMint() { if (!_isMsgSenderProxyOFT() && !_isMsgSenderPool() && !_isMsgSenderDebtToken()) revert SenderCanNotMint(); _; } /** * @dev Throws if sender can't seize */ modifier onlyIfCanSeize() { if (!_isMsgSenderPool() && !_isMsgSenderDebtToken()) revert SenderCanNotSeize(); _; } /** * @dev Throws if synthetic token isn't enabled */ modifier onlyIfSyntheticTokenIsActive() { if (!isActive) revert SyntheticIsInactive(); _; } constructor() { _disableInitializers(); } function initialize( string calldata name_, string calldata symbol_, uint8 decimals_, IPoolRegistry poolRegistry_ ) external initializer { if (bytes(name_).length == 0) revert NameIsNull(); if (bytes(symbol_).length == 0) revert SymbolIsNull(); if (decimals_ == 0) revert DecimalsIsNull(); if (address(poolRegistry_) == address(0)) revert PoolRegistryIsNull(); poolRegistry = poolRegistry_; name = name_; symbol = symbol_; decimals = decimals_; isActive = true; maxTotalSupply = type(uint256).max; } /** * @notice Set `amount` as the allowance of `spender` over the caller's tokens */ function approve(address spender_, uint256 amount_) external override returns (bool) { _approve(msg.sender, spender_, amount_); return true; } /** * @notice Get net bridged-in circulating supply * @dev The supply is calculated using `MAX(totalBridgedIn - totalBridgedOut, 0)` */ function bridgedInSupply() public view returns (uint256 _supply) { uint256 _totalBridgedIn = totalBridgedIn; uint256 _totalBridgedOut = totalBridgedOut; if (_totalBridgedIn > _totalBridgedOut) { return _totalBridgedIn - _totalBridgedOut; } } /** * @notice Get net bridged-out circulating supply * @dev The supply is calculated using `MAX(totalBridgedOut - totalBridgedIn, 0)` */ function bridgedOutSupply() public view returns (uint256 _supply) { uint256 _totalBridgedIn = totalBridgedIn; uint256 _totalBridgedOut = totalBridgedOut; if (_totalBridgedOut > _totalBridgedIn) { return _totalBridgedOut - _totalBridgedIn; } } /** * @notice Burn synthetic token * @param from_ The account to burn from * @param amount_ The amount to burn */ function burn(address from_, uint256 amount_) external override onlyIfCanBurn { _burn(from_, amount_); } /** * @notice Atomically decrease the allowance granted to `spender` by the caller */ function decreaseAllowance(address spender_, uint256 subtractedValue_) external returns (bool) { uint256 _currentAllowance = allowance[msg.sender][spender_]; if (_currentAllowance < subtractedValue_) revert DecreasedAllowanceBelowZero(); unchecked { _approve(msg.sender, spender_, _currentAllowance - subtractedValue_); } return true; } /** * @notice Atomically increase the allowance granted to `spender` by the caller */ function increaseAllowance(address spender_, uint256 addedValue_) external returns (bool) { _approve(msg.sender, spender_, allowance[msg.sender][spender_] + addedValue_); return true; } /** * @notice Mint synthetic token * @param to_ The account to mint to * @param amount_ The amount to mint */ function mint(address to_, uint256 amount_) external override onlyIfCanMint { _mint(to_, amount_); } /** * @notice Seize synthetic tokens * @dev Same as _transfer * @param to_ The account to seize from * @param to_ The beneficiary account * @param amount_ The amount to seize */ function seize(address from_, address to_, uint256 amount_) external override onlyIfCanSeize { _transfer(from_, to_, amount_); } /// @inheritdoc IERC20 function transfer(address recipient_, uint256 amount_) external override returns (bool) { _transfer(msg.sender, recipient_, amount_); return true; } /// @inheritdoc IERC20 function transferFrom(address sender_, address recipient_, uint256 amount_) external override returns (bool) { uint256 _currentAllowance = allowance[sender_][msg.sender]; if (_currentAllowance != type(uint256).max) { if (_currentAllowance < amount_) revert AmountExceedsAllowance(); unchecked { _approve(sender_, msg.sender, _currentAllowance - amount_); } } _transfer(sender_, recipient_, amount_); return true; } /** * @notice Set `amount` as the allowance of `spender` over the `owner` s tokens */ function _approve(address owner_, address spender_, uint256 amount_) private { if (owner_ == address(0)) revert ApproveFromTheZeroAddress(); if (spender_ == address(0)) revert ApproveToTheZeroAddress(); allowance[owner_][spender_] = amount_; emit Approval(owner_, spender_, amount_); } /** * @notice Destroy `amount` tokens from `account`, reducing the * total supply */ function _burn(address account_, uint256 amount_) private { if (account_ == address(0)) revert BurnFromTheZeroAddress(); if (_isMsgSenderProxyOFT()) { totalBridgedOut += amount_; if (bridgedOutSupply() > maxBridgedOutSupply) revert SurpassMaxBridgingSupply(); } uint256 _currentBalance = balanceOf[account_]; if (_currentBalance < amount_) revert BurnAmountExceedsBalance(); unchecked { balanceOf[account_] = _currentBalance - amount_; totalSupply -= amount_; } emit Transfer(account_, address(0), amount_); } /** * @dev Check if the sender is proxyOFT */ function _isMsgSenderProxyOFT() private view returns (bool) { return msg.sender == address(proxyOFT); } /** * @notice Check if the sender is a valid DebtToken contract */ function _isMsgSenderDebtToken() private view returns (bool) { IPool _pool = IManageable(msg.sender).pool(); return poolRegistry.isPoolRegistered(address(_pool)) && _pool.doesDebtTokenExist(IDebtToken(msg.sender)) && IDebtToken(msg.sender).syntheticToken() == this; } /** * @notice Check if the sender is a valid Pool contract */ function _isMsgSenderPool() private view returns (bool) { return poolRegistry.isPoolRegistered(msg.sender) && IPool(msg.sender).doesSyntheticTokenExist(this); } /** * @notice Create `amount` tokens and assigns them to `account`, increasing * the total supply */ function _mint(address account_, uint256 amount_) private onlyIfSyntheticTokenIsActive { if (account_ == address(0)) revert MintToTheZeroAddress(); if (_isMsgSenderProxyOFT()) { totalBridgedIn += amount_; if (bridgedInSupply() > maxBridgedInSupply) revert SurpassMaxBridgingSupply(); } totalSupply += amount_; if (totalSupply > maxTotalSupply) revert SurpassMaxSynthSupply(); balanceOf[account_] += amount_; emit Transfer(address(0), account_, amount_); } /** * @notice Move `amount` of tokens from `sender` to `recipient` */ function _transfer(address sender_, address recipient_, uint256 amount_) private { if (sender_ == address(0)) revert TransferFromTheZeroAddress(); if (recipient_ == address(0)) revert TransferToTheZeroAddress(); uint256 senderBalance = balanceOf[sender_]; if (senderBalance < amount_) revert TransferAmountExceedsBalance(); unchecked { balanceOf[sender_] = senderBalance - amount_; balanceOf[recipient_] += amount_; } emit Transfer(sender_, recipient_, amount_); } /** * @notice Enable/Disable Synthetic Token */ function toggleIsActive() external override onlyGovernor { bool _newIsActive = !isActive; emit SyntheticTokenActiveUpdated(_newIsActive); isActive = _newIsActive; } /** * @notice Update max total supply * @param newMaxTotalSupply_ The new max total supply */ function updateMaxTotalSupply(uint256 newMaxTotalSupply_) external override onlyGovernor { uint256 _currentMaxTotalSupply = maxTotalSupply; if (newMaxTotalSupply_ == _currentMaxTotalSupply) revert NewValueIsSameAsCurrent(); emit MaxTotalSupplyUpdated(_currentMaxTotalSupply, newMaxTotalSupply_); maxTotalSupply = newMaxTotalSupply_; } /** * @notice Update max bridged-in supply */ function updateMaxBridgedInSupply(uint256 maxBridgedInSupply_) external onlyGovernor { uint256 _currentMaxBridgedInBalance = maxBridgedInSupply; if (maxBridgedInSupply_ == _currentMaxBridgedInBalance) revert NewValueIsSameAsCurrent(); emit MaxBridgedInSupplyUpdated(_currentMaxBridgedInBalance, maxBridgedInSupply_); maxBridgedInSupply = maxBridgedInSupply_; } /** * @notice Update max bridged-out supply */ function updateMaxBridgedOutSupply(uint256 maxBridgedOutSupply_) external onlyGovernor { uint256 _currentMaxBridgedOutBalance = maxBridgedOutSupply; if (maxBridgedOutSupply_ == _currentMaxBridgedOutBalance) revert NewValueIsSameAsCurrent(); emit MaxBridgedOutSupplyUpdated(_currentMaxBridgedOutBalance, maxBridgedOutSupply_); maxBridgedOutSupply = maxBridgedOutSupply_; } /** * @notice Update proxyOFT * @param newProxyOFT_ Address of new ProxyOFT */ function updateProxyOFT(IProxyOFT newProxyOFT_) external override onlyGovernor { if (address(newProxyOFT_) == address(0)) revert AddressIsNull(); IProxyOFT _currentProxyOFT = proxyOFT; if (newProxyOFT_ == _currentProxyOFT) revert NewValueIsSameAsCurrent(); emit ProxyOFTUpdated(_currentProxyOFT, newProxyOFT_); proxyOFT = newProxyOFT_; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.2; import "../../../../../openzeppelin-upgradeable/utils/introspection/IERC165Upgradeable.sol"; /** * @dev Interface of the IOFT core standard */ interface IOFTCoreUpgradeable is IERC165Upgradeable { /** * @dev estimate send token `_tokenId` to (`_dstChainId`, `_toAddress`) * _dstChainId - L0 defined chain id to send tokens too * _toAddress - dynamic bytes array which contains the address to whom you are sending tokens to on the dstChain * _amount - amount of the tokens to transfer * _useZro - indicates to use zro to pay L0 fees * _adapterParam - flexible bytes array to indicate messaging adapter services in L0 */ function estimateSendFee( uint16 _dstChainId, bytes calldata _toAddress, uint _amount, bool _useZro, bytes calldata _adapterParams ) external view returns (uint nativeFee, uint zroFee); /** * @dev send `_amount` amount of token to (`_dstChainId`, `_toAddress`) from `_from` * `_from` the owner of token * `_dstChainId` the destination chain identifier * `_toAddress` can be any size depending on the `dstChainId`. * `_amount` the quantity of tokens in wei * `_refundAddress` the address LayerZero refunds if too much message fee is sent * `_zroPaymentAddress` set to address(0x0) if not paying in ZRO (LayerZero Token) * `_adapterParams` is a flexible bytes array to indicate messaging adapter services */ function sendFrom( address _from, uint16 _dstChainId, bytes calldata _toAddress, uint _amount, address payable _refundAddress, address _zroPaymentAddress, bytes calldata _adapterParams ) external payable; /** * @dev returns the circulating amount of tokens on current chain */ function circulatingSupply() external view returns (uint); /** * @dev returns the address of the ERC20 token */ function token() external view returns (address); /** * @dev Emitted when `_amount` tokens are moved from the `_sender` to (`_dstChainId`, `_toAddress`) * `_nonce` is the outbound nonce */ event SendToChain(uint16 indexed _dstChainId, address indexed _from, bytes _toAddress, uint _amount); /** * @dev Emitted when `_amount` tokens are received from `_srcChainId` into the `_toAddress` on the local chain. * `_nonce` is the inbound nonce. */ event ReceiveFromChain(uint16 indexed _srcChainId, address indexed _to, uint _amount); event SetUseCustomAdapterParams(bool _useCustomAdapterParams); }
// SPDX-License-Identifier: MIT pragma solidity >=0.5.0; import "../IOFTCoreUpgradeable.sol"; /** * @dev Interface of the composable OFT core standard */ interface IComposableOFTCoreUpgradeable is IOFTCoreUpgradeable { function estimateSendAndCallFee( uint16 _dstChainId, bytes calldata _toAddress, uint _amount, bytes calldata _payload, uint64 _dstGasForCall, bool _useZro, bytes calldata _adapterParams ) external view returns (uint nativeFee, uint zroFee); function sendAndCall( address _from, uint16 _dstChainId, bytes calldata _toAddress, uint _amount, bytes calldata _payload, uint64 _dstGasForCall, address payable _refundAddress, address _zroPaymentAddress, bytes calldata _adapterParams ) external payable; function retryOFTReceived( uint16 _srcChainId, bytes calldata _srcAddress, uint64 _nonce, bytes calldata _from, address _to, uint _amount, bytes calldata _payload ) external; event CallOFTReceivedFailure( uint16 indexed _srcChainId, bytes _srcAddress, uint64 _nonce, bytes _from, address indexed _to, uint _amount, bytes _payload, bytes _reason ); event CallOFTReceivedSuccess(uint16 indexed _srcChainId, bytes _srcAddress, uint64 _nonce, bytes32 _hash); event RetryOFTReceivedSuccess(bytes32 _messageHash); event NonContractAddress(address _address); }
// SPDX-License-Identifier: MIT pragma solidity >=0.5.0; interface IOFTReceiverUpgradeable { /** * @dev Called by the OFT contract when tokens are received from source chain. * @param _srcChainId The chain id of the source chain. * @param _srcAddress The address of the OFT token contract on the source chain. * @param _nonce The nonce of the transaction on the source chain. * @param _from The address of the account who calls the sendAndCall() on the source chain. * @param _amount The amount of tokens to transfer. * @param _payload Additional data with no specified format. */ function onOFTReceived( uint16 _srcChainId, bytes calldata _srcAddress, uint64 _nonce, bytes calldata _from, uint _amount, bytes calldata _payload ) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.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] * ``` * 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. Equivalent to `reinitializer(1)`. */ modifier initializer() { bool isTopLevelCall = _setInitializedVersion(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. * * `initializer` is equivalent to `reinitializer(1)`, so 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. * * 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. */ modifier reinitializer(uint8 version) { bool isTopLevelCall = _setInitializedVersion(version); if (isTopLevelCall) { _initializing = true; } _; if (isTopLevelCall) { _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. */ function _disableInitializers() internal virtual { _setInitializedVersion(type(uint8).max); } function _setInitializedVersion(uint8 version) private returns (bool) { // If the contract is initializing we ignore whether _initialized is set in order to support multiple // inheritance patterns, but we only do this in the context of a constructor, and for the lowest level // of initializers, because in other contexts the contract may have been reentered. if (_initializing) { require( version == 1 && !AddressUpgradeable.isContract(address(this)), "Initializable: contract is already initialized" ); return false; } else { require(_initialized < version, "Initializable: contract is already initialized"); _initialized = version; return true; } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.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 * ==== * * [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://diligence.consensys.net/posts/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.5.11/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 functionCall(target, data, "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"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(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) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason 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 { // 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 assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165Upgradeable { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT 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: MIT pragma solidity ^0.8.0; import "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.9; import "./IStargateRouter.sol"; interface IStargateComposer { function swap( uint16 _dstChainId, uint256 _srcPoolId, uint256 _dstPoolId, address payable _refundAddress, uint256 _amountLD, uint256 _minAmountLD, IStargateRouter.lzTxObj memory _lzTxParams, bytes calldata _to, bytes calldata _payload ) external payable; function factory() external view returns (address); function stargateBridge() external view returns (address); function stargateRouter() external view returns (IStargateRouter); function quoteLayerZeroFee( uint16 _dstChainId, uint8 _functionType, bytes calldata _toAddress, bytes calldata _transferAndCallPayload, IStargateRouter.lzTxObj memory _lzTxParams ) external view returns (uint256, uint256); function peers(uint16 _chainId) external view returns (address); }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.9; interface IStargateReceiver { function sgReceive( uint16 _chainId, bytes memory _srcAddress, uint256 _nonce, address _token, uint256 amountLD, bytes memory payload ) external; }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.9; interface IStargateRouter { struct lzTxObj { uint256 dstGasForCall; uint256 dstNativeAmount; bytes dstNativeAddr; } function addLiquidity(uint256 _poolId, uint256 _amountLD, address _to) external; function swap( uint16 _dstChainId, uint256 _srcPoolId, uint256 _dstPoolId, address payable _refundAddress, uint256 _amountLD, uint256 _minAmountLD, lzTxObj memory _lzTxParams, bytes calldata _to, bytes calldata _payload ) external payable; function redeemRemote( uint16 _dstChainId, uint256 _srcPoolId, uint256 _dstPoolId, address payable _refundAddress, uint256 _amountLP, uint256 _minAmountLD, bytes calldata _to, lzTxObj memory _lzTxParams ) external payable; function instantRedeemLocal(uint16 _srcPoolId, uint256 _amountLP, address _to) external returns (uint256); function redeemLocal( uint16 _dstChainId, uint256 _srcPoolId, uint256 _dstPoolId, address payable _refundAddress, uint256 _amountLP, bytes calldata _to, lzTxObj memory _lzTxParams ) external payable; function sendCredits( uint16 _dstChainId, uint256 _srcPoolId, uint256 _dstPoolId, address payable _refundAddress ) external payable; function quoteLayerZeroFee( uint16 _dstChainId, uint8 _functionType, bytes calldata _toAddress, bytes calldata _transferAndCallPayload, lzTxObj memory _lzTxParams ) external view returns (uint256, uint256); function clearCachedSwap(uint16 _srcChainId, bytes calldata _srcAddress, uint256 _nonce) external; function factory() external view returns (address); function bridge() external view returns (address); function cachedSwapLookup( uint16 _chainId_, bytes calldata _srcAddress, uint256 _nonce ) external view returns (address token, uint256 amountLD, address to, bytes memory payload); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; import "../dependencies/@layerzerolabs/solidity-examples/contracts-upgradeable/token/oft/composable/IOFTReceiverUpgradeable.sol"; import "../dependencies/stargate-protocol/interfaces/IStargateReceiver.sol"; import "../dependencies/stargate-protocol/interfaces/IStargateRouter.sol"; import "../dependencies/stargate-protocol/interfaces/IStargateComposer.sol"; import "./IProxyOFT.sol"; interface ICrossChainDispatcher is IStargateReceiver, IOFTReceiverUpgradeable { function crossChainDispatcherOf(uint16 chainId_) external view returns (address); function triggerFlashRepaySwap( uint256 id_, address payable account_, address tokenIn_, address tokenOut_, uint256 amountIn_, uint256 amountOutMin_, bytes calldata lzArgs_ ) external payable; function triggerLeverageSwap( uint256 id_, address payable account_, address tokenIn_, address tokenOut_, uint256 amountIn_, uint256 amountOutMin, bytes calldata lzArgs_ ) external payable; function isBridgingActive() external view returns (bool); function flashRepayCallbackTxGasLimit() external view returns (uint64); function flashRepaySwapTxGasLimit() external view returns (uint64); function leverageCallbackTxGasLimit() external view returns (uint64); function leverageSwapTxGasLimit() external view returns (uint64); function lzBaseGasLimit() external view returns (uint256); function stargateComposer() external view returns (IStargateComposer); function stargateSlippage() external view returns (uint256); function stargatePoolIdOf(address token_) external view returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; import "../dependencies/openzeppelin/token/ERC20/extensions/IERC20Metadata.sol"; import "./ISyntheticToken.sol"; interface IDebtToken is IERC20Metadata { function lastTimestampAccrued() external view returns (uint256); function isActive() external view returns (bool); function syntheticToken() external view returns (ISyntheticToken); function accrueInterest() external; function debtIndex() external returns (uint256 debtIndex_); function burn(address from_, uint256 amount_) external; function issue(uint256 amount_, address to_) external returns (uint256 _issued, uint256 _fee); function flashIssue(address to_, uint256 amount_) external returns (uint256 _issued, uint256 _fee); function mint(address to_, uint256 amount_) external; function repay(address onBehalfOf_, uint256 amount_) external returns (uint256 _repaid, uint256 _fee); function repayAll(address onBehalfOf_) external returns (uint256 _repaid, uint256 _fee); function quoteIssueIn(uint256 amountToIssue_) external view returns (uint256 _amount, uint256 _fee); function quoteIssueOut(uint256 amount_) external view returns (uint256 _amountToIssue, uint256 _fee); function quoteRepayIn(uint256 amountToRepay_) external view returns (uint256 _amount, uint256 _fee); function quoteRepayOut(uint256 amount_) external view returns (uint256 _amountToRepay, uint256 _fee); function updateMaxTotalSupply(uint256 newMaxTotalSupply_) external; function updateInterestRate(uint256 newInterestRate_) external; function maxTotalSupply() external view returns (uint256); function interestRate() external view returns (uint256); function interestRatePerSecond() external view returns (uint256); function toggleIsActive() external; }
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; import "../dependencies/openzeppelin/token/ERC20/extensions/IERC20Metadata.sol"; interface IDepositToken is IERC20Metadata { function underlying() external view returns (IERC20); function collateralFactor() external view returns (uint256); function unlockedBalanceOf(address account_) external view returns (uint256); function lockedBalanceOf(address account_) external view returns (uint256); function flashWithdraw(address account_, uint256 amount_) external returns (uint256 _withdrawn, uint256 _fee); function deposit(uint256 amount_, address onBehalfOf_) external returns (uint256 _deposited, uint256 _fee); function quoteDepositIn(uint256 amountToDeposit_) external view returns (uint256 _amount, uint256 _fee); function quoteDepositOut(uint256 amount_) external view returns (uint256 _amountToDeposit, uint256 _fee); function quoteWithdrawIn(uint256 amountToWithdraw_) external view returns (uint256 _amount, uint256 _fee); function quoteWithdrawOut(uint256 amount_) external view returns (uint256 _amountToWithdraw, uint256 _fee); function withdraw(uint256 amount_, address to_) external returns (uint256 _withdrawn, uint256 _fee); function seize(address from_, address to_, uint256 amount_) external; function updateCollateralFactor(uint128 newCollateralFactor_) external; function isActive() external view returns (bool); function toggleIsActive() external; function maxTotalSupply() external view returns (uint256); function updateMaxTotalSupply(uint256 newMaxTotalSupply_) external; function withdrawFrom(address from_, uint256 amount_) external returns (uint256 _withdrawn, uint256 _fee); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; /** * @notice FeeProvider interface */ interface IFeeProvider { struct LiquidationFees { uint128 liquidatorIncentive; uint128 protocolFee; } function defaultSwapFee() external view returns (uint256); function depositFee() external view returns (uint256); function issueFee() external view returns (uint256); function liquidationFees() external view returns (uint128 liquidatorIncentive, uint128 protocolFee); function repayFee() external view returns (uint256); function swapFeeFor(address account_) external view returns (uint256); function withdrawFee() external view returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; /** * @notice Governable interface */ interface IGovernable { function governor() external view returns (address _governor); function transferGovernorship(address _proposedGovernor) external; }
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; import "./IPool.sol"; /** * @notice Manageable interface */ interface IManageable { function pool() external view returns (IPool _pool); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; interface IPauseable { function paused() external view returns (bool); function everythingStopped() external view returns (bool); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; import "./IDepositToken.sol"; import "./IDebtToken.sol"; import "./ITreasury.sol"; import "./IRewardsDistributor.sol"; import "./IPoolRegistry.sol"; import "./IFeeProvider.sol"; import "./ISmartFarmingManager.sol"; import "./external/ISwapper.sol"; import "../interfaces/IFeeProvider.sol"; /** * @notice Pool interface */ interface IPool is IPauseable, IGovernable { function debtFloorInUsd() external view returns (uint256); function feeCollector() external view returns (address); function feeProvider() external view returns (IFeeProvider); function maxLiquidable() external view returns (uint256); function doesSyntheticTokenExist(ISyntheticToken syntheticToken_) external view returns (bool); function doesDebtTokenExist(IDebtToken debtToken_) external view returns (bool); function doesDepositTokenExist(IDepositToken depositToken_) external view returns (bool); function depositTokenOf(IERC20 underlying_) external view returns (IDepositToken); function debtTokenOf(ISyntheticToken syntheticToken_) external view returns (IDebtToken); function getDepositTokens() external view returns (address[] memory); function getDebtTokens() external view returns (address[] memory); function getRewardsDistributors() external view returns (address[] memory); function debtOf(address account_) external view returns (uint256 _debtInUsd); function depositOf(address account_) external view returns (uint256 _depositInUsd, uint256 _issuableLimitInUsd); function debtPositionOf( address account_ ) external view returns ( bool _isHealthy, uint256 _depositInUsd, uint256 _debtInUsd, uint256 _issuableLimitInUsd, uint256 _issuableInUsd ); function liquidate( ISyntheticToken syntheticToken_, address account_, uint256 amountToRepay_, IDepositToken depositToken_ ) external returns (uint256 _totalSeized, uint256 _toLiquidator, uint256 _fee); function quoteLiquidateIn( ISyntheticToken syntheticToken_, uint256 totalToSeized_, IDepositToken depositToken_ ) external view returns (uint256 _amountToRepay, uint256 _toLiquidator, uint256 _fee); function quoteLiquidateMax( ISyntheticToken syntheticToken_, address account_, IDepositToken depositToken_ ) external view returns (uint256 _maxAmountToRepay); function quoteLiquidateOut( ISyntheticToken syntheticToken_, uint256 amountToRepay_, IDepositToken depositToken_ ) external view returns (uint256 _totalSeized, uint256 _toLiquidator, uint256 _fee); function quoteSwapIn( ISyntheticToken syntheticTokenIn_, ISyntheticToken syntheticTokenOut_, uint256 amountOut_ ) external view returns (uint256 _amountIn, uint256 _fee); function quoteSwapOut( ISyntheticToken syntheticTokenIn_, ISyntheticToken syntheticTokenOut_, uint256 amountIn_ ) external view returns (uint256 _amountOut, uint256 _fee); function swap( ISyntheticToken syntheticTokenIn_, ISyntheticToken syntheticTokenOut_, uint256 amountIn_ ) external returns (uint256 _amountOut, uint256 _fee); function treasury() external view returns (ITreasury); function masterOracle() external view returns (IMasterOracle); function poolRegistry() external view returns (IPoolRegistry); function addToDepositTokensOfAccount(address account_) external; function removeFromDepositTokensOfAccount(address account_) external; function addToDebtTokensOfAccount(address account_) external; function removeFromDebtTokensOfAccount(address account_) external; function getDepositTokensOfAccount(address account_) external view returns (address[] memory); function getDebtTokensOfAccount(address account_) external view returns (address[] memory); function isSwapActive() external view returns (bool); function smartFarmingManager() external view returns (ISmartFarmingManager); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; import "./external/IMasterOracle.sol"; import "./IPauseable.sol"; import "./IGovernable.sol"; import "./ISyntheticToken.sol"; import "./external/ISwapper.sol"; import "./IQuoter.sol"; import "./ICrossChainDispatcher.sol"; interface IPoolRegistry is IPauseable, IGovernable { function feeCollector() external view returns (address); function isPoolRegistered(address pool_) external view returns (bool); function nativeTokenGateway() external view returns (address); function getPools() external view returns (address[] memory); function registerPool(address pool_) external; function unregisterPool(address pool_) external; function masterOracle() external view returns (IMasterOracle); function updateFeeCollector(address newFeeCollector_) external; function idOfPool(address pool_) external view returns (uint256); function nextPoolId() external view returns (uint256); function swapper() external view returns (ISwapper); function quoter() external view returns (IQuoter); function crossChainDispatcher() external view returns (ICrossChainDispatcher); function doesSyntheticTokenExist(ISyntheticToken syntheticToken_) external view returns (bool _exists); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; import "../dependencies/@layerzerolabs/solidity-examples/contracts-upgradeable/token/oft/composable/IComposableOFTCoreUpgradeable.sol"; interface IProxyOFT is IComposableOFTCoreUpgradeable { function getProxyOFTOf(uint16 chainId_) external view returns (address _proxyOFT); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; import "./IPoolRegistry.sol"; import "./IProxyOFT.sol"; interface IQuoter { function quoteCrossChainFlashRepayNativeFee( IProxyOFT proxyOFT_, bytes calldata lzArgs_ ) external view returns (uint256 _nativeFee); function quoteCrossChainLeverageNativeFee( IProxyOFT proxyOFT_, bytes calldata lzArgs_ ) external view returns (uint256 _nativeFee); function quoteLeverageCallbackNativeFee(uint16 dstChainId_) external view returns (uint256 _callbackTxNativeFee); function quoteFlashRepayCallbackNativeFee(uint16 dstChainId_) external view returns (uint256 _callbackTxNativeFee); function getFlashRepaySwapAndCallbackLzArgs( uint16 srcChainId_, uint16 dstChainId_ ) external view returns (bytes memory lzArgs_); function getLeverageSwapAndCallbackLzArgs( uint16 srcChainId_, uint16 dstChainId_ ) external view returns (bytes memory lzArgs_); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; import "../dependencies/openzeppelin/token/ERC20/IERC20.sol"; /** * @notice Reward Distributor interface */ interface IRewardsDistributor { function rewardToken() external view returns (IERC20); function tokenSpeeds(IERC20 token_) external view returns (uint256); function tokensAccruedOf(address account_) external view returns (uint256); function updateBeforeMintOrBurn(IERC20 token_, address account_) external; function updateBeforeTransfer(IERC20 token_, address from_, address to_) external; function claimable(address account_) external view returns (uint256 _claimable); function claimable(address account_, IERC20 token_) external view returns (uint256 _claimable); function claimRewards(address account_) external; function claimRewards(address account_, IERC20[] memory tokens_) external; function claimRewards(address[] memory accounts_, IERC20[] memory tokens_) external; function updateTokenSpeed(IERC20 token_, uint256 newSpeed_) external; function updateTokenSpeeds(IERC20[] calldata tokens_, uint256[] calldata speeds_) external; function tokens(uint256) external view returns (IERC20); function tokenStates(IERC20) external view returns (uint224 index, uint32 timestamp); function accountIndexOf(IERC20, address) external view returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; import "./IManageable.sol"; import "./IDepositToken.sol"; import "./IDebtToken.sol"; /** * @notice SmartFarmingManager interface */ interface ISmartFarmingManager { function flashRepay( ISyntheticToken syntheticToken_, IDepositToken depositToken_, uint256 withdrawAmount_, uint256 repayAmountMin_ ) external returns (uint256 _withdrawn, uint256 _repaid); function crossChainFlashRepay( ISyntheticToken syntheticToken_, IDepositToken depositToken_, uint256 withdrawAmount_, IERC20 bridgeToken_, uint256 bridgeTokenAmountMin_, uint256 swapAmountOutMin_, uint256 repayAmountMin_, bytes calldata lzArgs_ ) external payable; function crossChainLeverage( IERC20 tokenIn_, IDepositToken depositToken_, ISyntheticToken syntheticToken_, uint256 amountIn_, uint256 leverage_, uint256 swapAmountOutMin_, uint256 depositAmountMin_, bytes calldata lzArgs_ ) external payable; function crossChainLeverageCallback(uint256 id_, uint256 swapAmountOut_) external returns (uint256 _deposited); function crossChainFlashRepayCallback(uint256 id_, uint256 swapAmountOut_) external returns (uint256 _repaid); function leverage( IERC20 tokenIn_, IDepositToken depositToken_, ISyntheticToken syntheticToken_, uint256 amountIn_, uint256 leverage_, uint256 depositAmountMin_ ) external returns (uint256 _deposited, uint256 _issued); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; import "../dependencies/openzeppelin/token/ERC20/extensions/IERC20Metadata.sol"; import "./IDebtToken.sol"; import "./IPoolRegistry.sol"; import "../interfaces/IProxyOFT.sol"; interface ISyntheticToken is IERC20Metadata { function isActive() external view returns (bool); function mint(address to_, uint256 amount_) external; function burn(address from_, uint256 amount) external; function poolRegistry() external view returns (IPoolRegistry); function toggleIsActive() external; function seize(address from_, address to_, uint256 amount_) external; function updateMaxTotalSupply(uint256 newMaxTotalSupply_) external; function updateProxyOFT(IProxyOFT newProxyOFT_) external; function maxTotalSupply() external view returns (uint256); function proxyOFT() external view returns (IProxyOFT); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; interface ITreasury { function pull(address to_, uint256 amount_) external; function migrateTo(address newTreasury_) external; }
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; interface IMasterOracle { function quoteTokenToUsd(address _asset, uint256 _amount) external view returns (uint256 _amountInUsd); function quoteUsdToToken(address _asset, uint256 _amountInUsd) external view returns (uint256 _amount); function quote(address _assetIn, address _assetOut, uint256 _amountIn) external view returns (uint256 _amountOut); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; interface ISwapper { function swapExactInput( address tokenIn_, address tokenOut_, uint256 amountIn_, uint256 amountOutMin_, address receiver_ ) external returns (uint256 _amountOut); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; /** * @title Math library * @dev Provides mul and div function for wads (decimal numbers with 18 digits precision) and rays (decimals with 27 digits) * @dev Based on https://github.com/dapphub/ds-math/blob/master/src/math.sol */ library WadRayMath { uint256 internal constant WAD = 1e18; uint256 internal constant HALF_WAD = WAD / 2; uint256 internal constant RAY = 1e27; uint256 internal constant HALF_RAY = RAY / 2; uint256 internal constant WAD_RAY_RATIO = 1e9; /** * @dev Multiplies two wad, rounding half up to the nearest wad * @param a Wad * @param b Wad * @return The result of a*b, in wad */ function wadMul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0 || b == 0) { return 0; } return (a * b + HALF_WAD) / WAD; } /** * @dev Divides two wad, rounding half up to the nearest wad * @param a Wad * @param b Wad * @return The result of a/b, in wad */ function wadDiv(uint256 a, uint256 b) internal pure returns (uint256) { return (a * WAD + b / 2) / b; } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; import "../interfaces/ISyntheticToken.sol"; abstract contract SyntheticTokenStorageV1 is ISyntheticToken { /** * @notice The name of the token */ string public override name; /** * @notice The symbol of the token */ string public override symbol; /** * @dev The amount of tokens owned by `account` */ mapping(address => uint256) public override balanceOf; /** * @dev The remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom} */ mapping(address => mapping(address => uint256)) public override allowance; /** * @dev Amount of tokens in existence */ uint256 public override totalSupply; /** * @notice The supply cap */ uint256 public override maxTotalSupply; /** * @dev The Pool Registry */ IPoolRegistry public override poolRegistry; /** * @notice If true, disables msAsset minting globally */ bool public override isActive; /** * @notice The decimals of the token */ uint8 public override decimals; /** * @notice The ProxyOFT contract */ IProxyOFT public override proxyOFT; /** * @notice Track amount received cross-chain */ uint256 public totalBridgedIn; /** * @notice Track amount sent cross-chain */ uint256 public totalBridgedOut; /** * @notice Maximum allowed bridged-in (mint-related) supply */ uint256 public maxBridgedInSupply; /** * @notice Maximum allowed bridged-out (burn-related) supply */ uint256 public maxBridgedOutSupply; }
{ "evmVersion": "london", "libraries": {}, "metadata": { "bytecodeHash": "ipfs", "useLiteralContent": true }, "optimizer": { "enabled": true, "runs": 200 }, "remappings": [], "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AddressIsNull","type":"error"},{"inputs":[],"name":"AmountExceedsAllowance","type":"error"},{"inputs":[],"name":"ApproveFromTheZeroAddress","type":"error"},{"inputs":[],"name":"ApproveToTheZeroAddress","type":"error"},{"inputs":[],"name":"BurnAmountExceedsBalance","type":"error"},{"inputs":[],"name":"BurnFromTheZeroAddress","type":"error"},{"inputs":[],"name":"DecimalsIsNull","type":"error"},{"inputs":[],"name":"DecreasedAllowanceBelowZero","type":"error"},{"inputs":[],"name":"MintToTheZeroAddress","type":"error"},{"inputs":[],"name":"NameIsNull","type":"error"},{"inputs":[],"name":"NewValueIsSameAsCurrent","type":"error"},{"inputs":[],"name":"PoolRegistryIsNull","type":"error"},{"inputs":[],"name":"SenderCanNotBurn","type":"error"},{"inputs":[],"name":"SenderCanNotMint","type":"error"},{"inputs":[],"name":"SenderCanNotSeize","type":"error"},{"inputs":[],"name":"SenderIsNotGovernor","type":"error"},{"inputs":[],"name":"SurpassMaxBridgingSupply","type":"error"},{"inputs":[],"name":"SurpassMaxSynthSupply","type":"error"},{"inputs":[],"name":"SymbolIsNull","type":"error"},{"inputs":[],"name":"SyntheticIsInactive","type":"error"},{"inputs":[],"name":"TransferAmountExceedsBalance","type":"error"},{"inputs":[],"name":"TransferFromTheZeroAddress","type":"error"},{"inputs":[],"name":"TransferToTheZeroAddress","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldMaxBridgedInSupply","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newMaxBridgedInSupply","type":"uint256"}],"name":"MaxBridgedInSupplyUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldMaxBridgedOutSupply","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newMaxBridgedOutSupply","type":"uint256"}],"name":"MaxBridgedOutSupplyUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldMaxTotalSupply","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newMaxTotalSupply","type":"uint256"}],"name":"MaxTotalSupplyUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract IProxyOFT","name":"oldProxyOFT","type":"address"},{"indexed":false,"internalType":"contract IProxyOFT","name":"newProxyOFT","type":"address"}],"name":"ProxyOFTUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"newActive","type":"bool"}],"name":"SyntheticTokenActiveUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"VERSION","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender_","type":"address"},{"internalType":"uint256","name":"amount_","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bridgedInSupply","outputs":[{"internalType":"uint256","name":"_supply","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bridgedOutSupply","outputs":[{"internalType":"uint256","name":"_supply","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from_","type":"address"},{"internalType":"uint256","name":"amount_","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender_","type":"address"},{"internalType":"uint256","name":"subtractedValue_","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"spender_","type":"address"},{"internalType":"uint256","name":"addedValue_","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"name_","type":"string"},{"internalType":"string","name":"symbol_","type":"string"},{"internalType":"uint8","name":"decimals_","type":"uint8"},{"internalType":"contract IPoolRegistry","name":"poolRegistry_","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"isActive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxBridgedInSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxBridgedOutSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxTotalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to_","type":"address"},{"internalType":"uint256","name":"amount_","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"poolRegistry","outputs":[{"internalType":"contract IPoolRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"proxyOFT","outputs":[{"internalType":"contract IProxyOFT","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from_","type":"address"},{"internalType":"address","name":"to_","type":"address"},{"internalType":"uint256","name":"amount_","type":"uint256"}],"name":"seize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"toggleIsActive","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"totalBridgedIn","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalBridgedOut","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient_","type":"address"},{"internalType":"uint256","name":"amount_","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender_","type":"address"},{"internalType":"address","name":"recipient_","type":"address"},{"internalType":"uint256","name":"amount_","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"maxBridgedInSupply_","type":"uint256"}],"name":"updateMaxBridgedInSupply","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"maxBridgedOutSupply_","type":"uint256"}],"name":"updateMaxBridgedOutSupply","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newMaxTotalSupply_","type":"uint256"}],"name":"updateMaxTotalSupply","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IProxyOFT","name":"newProxyOFT_","type":"address"}],"name":"updateProxyOFT","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60806040523480156200001157600080fd5b506200001c62000022565b62000152565b6200002e60ff62000031565b50565b60008054610100900460ff1615620000ca578160ff1660011480156200006a575062000068306200014360201b62000e991760201c565b155b620000c25760405162461bcd60e51b815260206004820152602e602482015260008051602062001bab83398151915260448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b506000919050565b60005460ff808416911610620001295760405162461bcd60e51b815260206004820152602e602482015260008051602062001bab83398151915260448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401620000b9565b506000805460ff191660ff92909216919091179055600190565b6001600160a01b03163b151590565b611a4980620001626000396000f3fe608060405234801561001057600080fd5b50600436106101e55760003560e01c80639163dd5f1161010f578063cbfa94de116100a2578063dd20d4f411610071578063dd20d4f4146103e7578063dd62ed3e146103fa578063de7ea79d14610425578063ffa1ad741461043857600080fd5b8063cbfa94de146103bb578063cd2e9866146103ce578063d2593329146103d7578063d2f09685146103df57600080fd5b8063a457c2d7116100de578063a457c2d71461036f578063a9059cbb14610382578063afcff50f14610395578063b2a02ff1146103a857600080fd5b80639163dd5f1461033957806393a04f131461034157806395d89b41146103545780639dc29fac1461035c57600080fd5b80632ab4d05211610187578063395093511161015657806339509351146102c857806340c10f19146102db5780636d1bb8f7146102ee57806370a082311461031957600080fd5b80632ab4d052146102875780632bb42183146102905780632f068bf114610299578063313ce567146102a257600080fd5b806318160ddd116101c357806318160ddd146102405780631ac571dd1461025757806322f3e2d41461026057806323b872dd1461027457600080fd5b806306fdde03146101ea578063095ea7b314610208578063172f50a41461022b575b600080fd5b6101f261045c565b6040516101ff91906116d2565b60405180910390f35b61021b61021636600461173f565b6104ea565b60405190151581526020016101ff565b61023e61023936600461176b565b610500565b005b61024960055481565b6040519081526020016101ff565b610249600b5481565b60075461021b90600160a01b900460ff1681565b61021b610282366004611784565b61061a565b61024960065481565b61024960095481565b610249600c5481565b6007546102b690600160a81b900460ff1681565b60405160ff90911681526020016101ff565b61021b6102d636600461173f565b61068b565b61023e6102e936600461173f565b6106c7565b600854610301906001600160a01b031681565b6040516001600160a01b0390911681526020016101ff565b6102496103273660046117c5565b60036020526000908152604090205481565b610249610724565b61023e61034f36600461176b565b61074c565b6101f2610866565b61023e61036a36600461173f565b610873565b61021b61037d36600461173f565b6108cc565b61021b61039036600461173f565b610928565b600754610301906001600160a01b031681565b61023e6103b6366004611784565b610935565b61023e6103c93660046117c5565b61097c565b610249600a5481565b61023e610af1565b610249610c09565b61023e6103f536600461176b565b610c25565b6102496104083660046117e9565b600460209081526000928352604080842090915290825290205481565b61023e61043336600461186b565b610d3f565b6101f2604051806040016040528060058152602001640312e332e360dc1b81525081565b6001805461046990611906565b80601f016020809104026020016040519081016040528092919081815260200182805461049590611906565b80156104e25780601f106104b7576101008083540402835291602001916104e2565b820191906000526020600020905b8154815290600101906020018083116104c557829003601f168201915b505050505081565b60006104f7338484610ea8565b50600192915050565b600760009054906101000a90046001600160a01b03166001600160a01b0316630c340a246040518163ffffffff1660e01b815260040160206040518083038186803b15801561054e57600080fd5b505afa158015610562573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105869190611941565b6001600160a01b0316336001600160a01b0316146105b757604051634b98449160e11b815260040160405180910390fd5b600654818114156105db57604051630333a68160e41b815260040160405180910390fd5b60408051828152602081018490527fc58cd6132bb46df23d468939c03dd023b74b509aaa6b04c39d5a6461c65963bd910160405180910390a150600655565b6001600160a01b038316600090815260046020908152604080832033845290915281205460001981146106755782811015610668576040516303814af160e61b815260040160405180910390fd5b6106758533858403610ea8565b610680858585610f58565b506001949350505050565b3360008181526004602090815260408083206001600160a01b038716845290915281205490916104f79185906106c2908690611974565b610ea8565b6008546001600160a01b031633141580156106e757506106e561104e565b155b80156106f857506106f6611144565b155b156107165760405163168504c160e21b815260040160405180910390fd5b6107208282611348565b5050565b600954600a54600091908082111561074757610740818361198c565b9250505090565b505090565b600760009054906101000a90046001600160a01b03166001600160a01b0316630c340a246040518163ffffffff1660e01b815260040160206040518083038186803b15801561079a57600080fd5b505afa1580156107ae573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107d29190611941565b6001600160a01b0316336001600160a01b03161461080357604051634b98449160e11b815260040160405180910390fd5b600b548181141561082757604051630333a68160e41b815260040160405180910390fd5b60408051828152602081018490527feacf40fa755daf182276c22cc2ad53893a50e8d3d4c73132308548febf636764910160405180910390a150600b55565b6002805461046990611906565b6008546001600160a01b03163314158015610893575061089161104e565b155b80156108a457506108a2611144565b155b156108c25760405163848003b560e01b815260040160405180910390fd5b610720828261149b565b3360009081526004602090815260408083206001600160a01b0386168452909152812054828110156109115760405163189dd6af60e31b815260040160405180910390fd5b61091e3385858403610ea8565b5060019392505050565b60006104f7338484610f58565b61093d61104e565b15801561094f575061094d611144565b155b1561096c576040516249987f60e01b815260040160405180910390fd5b610977838383610f58565b505050565b600760009054906101000a90046001600160a01b03166001600160a01b0316630c340a246040518163ffffffff1660e01b815260040160206040518083038186803b1580156109ca57600080fd5b505afa1580156109de573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a029190611941565b6001600160a01b0316336001600160a01b031614610a3357604051634b98449160e11b815260040160405180910390fd5b6001600160a01b038116610a5a5760405163fb7566d760e01b815260040160405180910390fd5b6008546001600160a01b03908116908216811415610a8b57604051630333a68160e41b815260040160405180910390fd5b604080516001600160a01b038084168252841660208201527fef71fdb6fc3b4bdacae0b7871edf00279c204dc041134e4304cf93935cf07af7910160405180910390a150600880546001600160a01b0319166001600160a01b0392909216919091179055565b600760009054906101000a90046001600160a01b03166001600160a01b0316630c340a246040518163ffffffff1660e01b815260040160206040518083038186803b158015610b3f57600080fd5b505afa158015610b53573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b779190611941565b6001600160a01b0316336001600160a01b031614610ba857604051634b98449160e11b815260040160405180910390fd5b600754604051600160a01b90910460ff1615808252907f79e35d0afb37464963b458a448d257d695a4dc4406dc45df01e4c7b38e2732cb9060200160405180910390a160078054911515600160a01b0260ff60a01b19909216919091179055565b600954600a54600091908181111561074757610740828261198c565b600760009054906101000a90046001600160a01b03166001600160a01b0316630c340a246040518163ffffffff1660e01b815260040160206040518083038186803b158015610c7357600080fd5b505afa158015610c87573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cab9190611941565b6001600160a01b0316336001600160a01b031614610cdc57604051634b98449160e11b815260040160405180910390fd5b600c5481811415610d0057604051630333a68160e41b815260040160405180910390fd5b60408051828152602081018490527ff0d21a56ee8d766c9055580b458227594b5f2d86aa9087573908bea9dc4ca3d6910160405180910390a150600c55565b6000610d4b60016115a8565b90508015610d63576000805461ff0019166101001790555b85610d8157604051636e83f50760e01b815260040160405180910390fd5b83610d9f576040516330507cff60e11b815260040160405180910390fd5b60ff8316610dc057604051634dc4784160e11b815260040160405180910390fd5b6001600160a01b038216610de757604051637cb62f2b60e11b815260040160405180910390fd5b600780546001600160a01b0319166001600160a01b038416179055610e0e60018888611639565b50610e1b60028686611639565b506007805460ff60a01b1960ff8616600160a81b021661ffff60a01b1990911617600160a01b1790556000196006558015610e90576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050505050565b6001600160a01b03163b151590565b6001600160a01b038316610ecf576040516356fdae6560e11b815260040160405180910390fd5b6001600160a01b038216610ef65760405163b2fa1ef360e01b815260040160405180910390fd5b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b6001600160a01b038316610f7f57604051630240531760e41b815260040160405180910390fd5b6001600160a01b038216610fa65760405163671d1add60e11b815260040160405180910390fd5b6001600160a01b03831660009081526003602052604090205481811015610fe057604051635dd58b8b60e01b815260040160405180910390fd5b6001600160a01b0380851660008181526003602052604080822086860390559286168082529083902080548601905591517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906110409086815260200190565b60405180910390a350505050565b60075460405163c673bdaf60e01b81523360048201526000916001600160a01b03169063c673bdaf9060240160206040518083038186803b15801561109257600080fd5b505afa1580156110a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110ca91906119a3565b801561113f5750604051631a0dd00b60e01b81523060048201523390631a0dd00b9060240160206040518083038186803b15801561110757600080fd5b505afa15801561111b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061113f91906119a3565b905090565b600080336001600160a01b03166316f0115b6040518163ffffffff1660e01b815260040160206040518083038186803b15801561118057600080fd5b505afa158015611194573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111b89190611941565b60075460405163c673bdaf60e01b81526001600160a01b03808416600483015292935091169063c673bdaf9060240160206040518083038186803b1580156111ff57600080fd5b505afa158015611213573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061123791906119a3565b80156112b557506040516308a00b1f60e31b81523360048201526001600160a01b0382169063450058f89060240160206040518083038186803b15801561127d57600080fd5b505afa158015611291573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112b591906119a3565b80156113425750306001600160a01b0316336001600160a01b0316638230ecd66040518163ffffffff1660e01b815260040160206040518083038186803b1580156112ff57600080fd5b505afa158015611313573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113379190611941565b6001600160a01b0316145b91505090565b600754600160a01b900460ff16611372576040516303127d9160e31b815260040160405180910390fd5b6001600160a01b0382166113995760405163c96c2a0b60e01b815260040160405180910390fd5b6008546001600160a01b03163314156113ed5780600960008282546113be9190611974565b9091555050600b546113ce610724565b11156113ed57604051639da48d2560e01b815260040160405180910390fd5b80600560008282546113ff9190611974565b90915550506006546005541115611429576040516309e0f0fd60e31b815260040160405180910390fd5b6001600160a01b03821660009081526003602052604081208054839290611451908490611974565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b6001600160a01b0382166114c2576040516304fca6bd60e41b815260040160405180910390fd5b6008546001600160a01b03163314156115165780600a60008282546114e79190611974565b9091555050600c546114f7610c09565b111561151657604051639da48d2560e01b815260040160405180910390fd5b6001600160a01b0382166000908152600360205260409020548181101561155057604051630bba337f60e11b815260040160405180910390fd5b6001600160a01b03831660008181526003602090815260408083208686039055600580548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9101610f4b565b60008054610100900460ff16156115f8578160ff1660011480156115cb5750303b155b6115f05760405162461bcd60e51b81526004016115e7906119c5565b60405180910390fd5b506000919050565b60005460ff80841691161061161f5760405162461bcd60e51b81526004016115e7906119c5565b506000805460ff191660ff92909216919091179055600190565b82805461164590611906565b90600052602060002090601f01602090048101928261166757600085556116ad565b82601f106116805782800160ff198235161785556116ad565b828001600101855582156116ad579182015b828111156116ad578235825591602001919060010190611692565b506116b99291506116bd565b5090565b5b808211156116b957600081556001016116be565b600060208083528351808285015260005b818110156116ff578581018301518582016040015282016116e3565b81811115611711576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461173c57600080fd5b50565b6000806040838503121561175257600080fd5b823561175d81611727565b946020939093013593505050565b60006020828403121561177d57600080fd5b5035919050565b60008060006060848603121561179957600080fd5b83356117a481611727565b925060208401356117b481611727565b929592945050506040919091013590565b6000602082840312156117d757600080fd5b81356117e281611727565b9392505050565b600080604083850312156117fc57600080fd5b823561180781611727565b9150602083013561181781611727565b809150509250929050565b60008083601f84011261183457600080fd5b50813567ffffffffffffffff81111561184c57600080fd5b60208301915083602082850101111561186457600080fd5b9250929050565b6000806000806000806080878903121561188457600080fd5b863567ffffffffffffffff8082111561189c57600080fd5b6118a88a838b01611822565b909850965060208901359150808211156118c157600080fd5b506118ce89828a01611822565b909550935050604087013560ff811681146118e857600080fd5b915060608701356118f881611727565b809150509295509295509295565b600181811c9082168061191a57607f821691505b6020821081141561193b57634e487b7160e01b600052602260045260246000fd5b50919050565b60006020828403121561195357600080fd5b81516117e281611727565b634e487b7160e01b600052601160045260246000fd5b600082198211156119875761198761195e565b500190565b60008282101561199e5761199e61195e565b500390565b6000602082840312156119b557600080fd5b815180151581146117e257600080fd5b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b60608201526080019056fea2646970667358221220fe2c5d87e3cfd2a2e82c7d947314d83b4e5c872ba97d2e5a9732e508636f4a0a64736f6c63430008090033496e697469616c697a61626c653a20636f6e747261637420697320616c726561
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106101e55760003560e01c80639163dd5f1161010f578063cbfa94de116100a2578063dd20d4f411610071578063dd20d4f4146103e7578063dd62ed3e146103fa578063de7ea79d14610425578063ffa1ad741461043857600080fd5b8063cbfa94de146103bb578063cd2e9866146103ce578063d2593329146103d7578063d2f09685146103df57600080fd5b8063a457c2d7116100de578063a457c2d71461036f578063a9059cbb14610382578063afcff50f14610395578063b2a02ff1146103a857600080fd5b80639163dd5f1461033957806393a04f131461034157806395d89b41146103545780639dc29fac1461035c57600080fd5b80632ab4d05211610187578063395093511161015657806339509351146102c857806340c10f19146102db5780636d1bb8f7146102ee57806370a082311461031957600080fd5b80632ab4d052146102875780632bb42183146102905780632f068bf114610299578063313ce567146102a257600080fd5b806318160ddd116101c357806318160ddd146102405780631ac571dd1461025757806322f3e2d41461026057806323b872dd1461027457600080fd5b806306fdde03146101ea578063095ea7b314610208578063172f50a41461022b575b600080fd5b6101f261045c565b6040516101ff91906116d2565b60405180910390f35b61021b61021636600461173f565b6104ea565b60405190151581526020016101ff565b61023e61023936600461176b565b610500565b005b61024960055481565b6040519081526020016101ff565b610249600b5481565b60075461021b90600160a01b900460ff1681565b61021b610282366004611784565b61061a565b61024960065481565b61024960095481565b610249600c5481565b6007546102b690600160a81b900460ff1681565b60405160ff90911681526020016101ff565b61021b6102d636600461173f565b61068b565b61023e6102e936600461173f565b6106c7565b600854610301906001600160a01b031681565b6040516001600160a01b0390911681526020016101ff565b6102496103273660046117c5565b60036020526000908152604090205481565b610249610724565b61023e61034f36600461176b565b61074c565b6101f2610866565b61023e61036a36600461173f565b610873565b61021b61037d36600461173f565b6108cc565b61021b61039036600461173f565b610928565b600754610301906001600160a01b031681565b61023e6103b6366004611784565b610935565b61023e6103c93660046117c5565b61097c565b610249600a5481565b61023e610af1565b610249610c09565b61023e6103f536600461176b565b610c25565b6102496104083660046117e9565b600460209081526000928352604080842090915290825290205481565b61023e61043336600461186b565b610d3f565b6101f2604051806040016040528060058152602001640312e332e360dc1b81525081565b6001805461046990611906565b80601f016020809104026020016040519081016040528092919081815260200182805461049590611906565b80156104e25780601f106104b7576101008083540402835291602001916104e2565b820191906000526020600020905b8154815290600101906020018083116104c557829003601f168201915b505050505081565b60006104f7338484610ea8565b50600192915050565b600760009054906101000a90046001600160a01b03166001600160a01b0316630c340a246040518163ffffffff1660e01b815260040160206040518083038186803b15801561054e57600080fd5b505afa158015610562573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105869190611941565b6001600160a01b0316336001600160a01b0316146105b757604051634b98449160e11b815260040160405180910390fd5b600654818114156105db57604051630333a68160e41b815260040160405180910390fd5b60408051828152602081018490527fc58cd6132bb46df23d468939c03dd023b74b509aaa6b04c39d5a6461c65963bd910160405180910390a150600655565b6001600160a01b038316600090815260046020908152604080832033845290915281205460001981146106755782811015610668576040516303814af160e61b815260040160405180910390fd5b6106758533858403610ea8565b610680858585610f58565b506001949350505050565b3360008181526004602090815260408083206001600160a01b038716845290915281205490916104f79185906106c2908690611974565b610ea8565b6008546001600160a01b031633141580156106e757506106e561104e565b155b80156106f857506106f6611144565b155b156107165760405163168504c160e21b815260040160405180910390fd5b6107208282611348565b5050565b600954600a54600091908082111561074757610740818361198c565b9250505090565b505090565b600760009054906101000a90046001600160a01b03166001600160a01b0316630c340a246040518163ffffffff1660e01b815260040160206040518083038186803b15801561079a57600080fd5b505afa1580156107ae573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107d29190611941565b6001600160a01b0316336001600160a01b03161461080357604051634b98449160e11b815260040160405180910390fd5b600b548181141561082757604051630333a68160e41b815260040160405180910390fd5b60408051828152602081018490527feacf40fa755daf182276c22cc2ad53893a50e8d3d4c73132308548febf636764910160405180910390a150600b55565b6002805461046990611906565b6008546001600160a01b03163314158015610893575061089161104e565b155b80156108a457506108a2611144565b155b156108c25760405163848003b560e01b815260040160405180910390fd5b610720828261149b565b3360009081526004602090815260408083206001600160a01b0386168452909152812054828110156109115760405163189dd6af60e31b815260040160405180910390fd5b61091e3385858403610ea8565b5060019392505050565b60006104f7338484610f58565b61093d61104e565b15801561094f575061094d611144565b155b1561096c576040516249987f60e01b815260040160405180910390fd5b610977838383610f58565b505050565b600760009054906101000a90046001600160a01b03166001600160a01b0316630c340a246040518163ffffffff1660e01b815260040160206040518083038186803b1580156109ca57600080fd5b505afa1580156109de573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a029190611941565b6001600160a01b0316336001600160a01b031614610a3357604051634b98449160e11b815260040160405180910390fd5b6001600160a01b038116610a5a5760405163fb7566d760e01b815260040160405180910390fd5b6008546001600160a01b03908116908216811415610a8b57604051630333a68160e41b815260040160405180910390fd5b604080516001600160a01b038084168252841660208201527fef71fdb6fc3b4bdacae0b7871edf00279c204dc041134e4304cf93935cf07af7910160405180910390a150600880546001600160a01b0319166001600160a01b0392909216919091179055565b600760009054906101000a90046001600160a01b03166001600160a01b0316630c340a246040518163ffffffff1660e01b815260040160206040518083038186803b158015610b3f57600080fd5b505afa158015610b53573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b779190611941565b6001600160a01b0316336001600160a01b031614610ba857604051634b98449160e11b815260040160405180910390fd5b600754604051600160a01b90910460ff1615808252907f79e35d0afb37464963b458a448d257d695a4dc4406dc45df01e4c7b38e2732cb9060200160405180910390a160078054911515600160a01b0260ff60a01b19909216919091179055565b600954600a54600091908181111561074757610740828261198c565b600760009054906101000a90046001600160a01b03166001600160a01b0316630c340a246040518163ffffffff1660e01b815260040160206040518083038186803b158015610c7357600080fd5b505afa158015610c87573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cab9190611941565b6001600160a01b0316336001600160a01b031614610cdc57604051634b98449160e11b815260040160405180910390fd5b600c5481811415610d0057604051630333a68160e41b815260040160405180910390fd5b60408051828152602081018490527ff0d21a56ee8d766c9055580b458227594b5f2d86aa9087573908bea9dc4ca3d6910160405180910390a150600c55565b6000610d4b60016115a8565b90508015610d63576000805461ff0019166101001790555b85610d8157604051636e83f50760e01b815260040160405180910390fd5b83610d9f576040516330507cff60e11b815260040160405180910390fd5b60ff8316610dc057604051634dc4784160e11b815260040160405180910390fd5b6001600160a01b038216610de757604051637cb62f2b60e11b815260040160405180910390fd5b600780546001600160a01b0319166001600160a01b038416179055610e0e60018888611639565b50610e1b60028686611639565b506007805460ff60a01b1960ff8616600160a81b021661ffff60a01b1990911617600160a01b1790556000196006558015610e90576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050505050565b6001600160a01b03163b151590565b6001600160a01b038316610ecf576040516356fdae6560e11b815260040160405180910390fd5b6001600160a01b038216610ef65760405163b2fa1ef360e01b815260040160405180910390fd5b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b6001600160a01b038316610f7f57604051630240531760e41b815260040160405180910390fd5b6001600160a01b038216610fa65760405163671d1add60e11b815260040160405180910390fd5b6001600160a01b03831660009081526003602052604090205481811015610fe057604051635dd58b8b60e01b815260040160405180910390fd5b6001600160a01b0380851660008181526003602052604080822086860390559286168082529083902080548601905591517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906110409086815260200190565b60405180910390a350505050565b60075460405163c673bdaf60e01b81523360048201526000916001600160a01b03169063c673bdaf9060240160206040518083038186803b15801561109257600080fd5b505afa1580156110a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110ca91906119a3565b801561113f5750604051631a0dd00b60e01b81523060048201523390631a0dd00b9060240160206040518083038186803b15801561110757600080fd5b505afa15801561111b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061113f91906119a3565b905090565b600080336001600160a01b03166316f0115b6040518163ffffffff1660e01b815260040160206040518083038186803b15801561118057600080fd5b505afa158015611194573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111b89190611941565b60075460405163c673bdaf60e01b81526001600160a01b03808416600483015292935091169063c673bdaf9060240160206040518083038186803b1580156111ff57600080fd5b505afa158015611213573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061123791906119a3565b80156112b557506040516308a00b1f60e31b81523360048201526001600160a01b0382169063450058f89060240160206040518083038186803b15801561127d57600080fd5b505afa158015611291573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112b591906119a3565b80156113425750306001600160a01b0316336001600160a01b0316638230ecd66040518163ffffffff1660e01b815260040160206040518083038186803b1580156112ff57600080fd5b505afa158015611313573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113379190611941565b6001600160a01b0316145b91505090565b600754600160a01b900460ff16611372576040516303127d9160e31b815260040160405180910390fd5b6001600160a01b0382166113995760405163c96c2a0b60e01b815260040160405180910390fd5b6008546001600160a01b03163314156113ed5780600960008282546113be9190611974565b9091555050600b546113ce610724565b11156113ed57604051639da48d2560e01b815260040160405180910390fd5b80600560008282546113ff9190611974565b90915550506006546005541115611429576040516309e0f0fd60e31b815260040160405180910390fd5b6001600160a01b03821660009081526003602052604081208054839290611451908490611974565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b6001600160a01b0382166114c2576040516304fca6bd60e41b815260040160405180910390fd5b6008546001600160a01b03163314156115165780600a60008282546114e79190611974565b9091555050600c546114f7610c09565b111561151657604051639da48d2560e01b815260040160405180910390fd5b6001600160a01b0382166000908152600360205260409020548181101561155057604051630bba337f60e11b815260040160405180910390fd5b6001600160a01b03831660008181526003602090815260408083208686039055600580548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9101610f4b565b60008054610100900460ff16156115f8578160ff1660011480156115cb5750303b155b6115f05760405162461bcd60e51b81526004016115e7906119c5565b60405180910390fd5b506000919050565b60005460ff80841691161061161f5760405162461bcd60e51b81526004016115e7906119c5565b506000805460ff191660ff92909216919091179055600190565b82805461164590611906565b90600052602060002090601f01602090048101928261166757600085556116ad565b82601f106116805782800160ff198235161785556116ad565b828001600101855582156116ad579182015b828111156116ad578235825591602001919060010190611692565b506116b99291506116bd565b5090565b5b808211156116b957600081556001016116be565b600060208083528351808285015260005b818110156116ff578581018301518582016040015282016116e3565b81811115611711576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461173c57600080fd5b50565b6000806040838503121561175257600080fd5b823561175d81611727565b946020939093013593505050565b60006020828403121561177d57600080fd5b5035919050565b60008060006060848603121561179957600080fd5b83356117a481611727565b925060208401356117b481611727565b929592945050506040919091013590565b6000602082840312156117d757600080fd5b81356117e281611727565b9392505050565b600080604083850312156117fc57600080fd5b823561180781611727565b9150602083013561181781611727565b809150509250929050565b60008083601f84011261183457600080fd5b50813567ffffffffffffffff81111561184c57600080fd5b60208301915083602082850101111561186457600080fd5b9250929050565b6000806000806000806080878903121561188457600080fd5b863567ffffffffffffffff8082111561189c57600080fd5b6118a88a838b01611822565b909850965060208901359150808211156118c157600080fd5b506118ce89828a01611822565b909550935050604087013560ff811681146118e857600080fd5b915060608701356118f881611727565b809150509295509295509295565b600181811c9082168061191a57607f821691505b6020821081141561193b57634e487b7160e01b600052602260045260246000fd5b50919050565b60006020828403121561195357600080fd5b81516117e281611727565b634e487b7160e01b600052601160045260246000fd5b600082198211156119875761198761195e565b500190565b60008282101561199e5761199e61195e565b500390565b6000602082840312156119b557600080fd5b815180151581146117e257600080fd5b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b60608201526080019056fea2646970667358221220fe2c5d87e3cfd2a2e82c7d947314d83b4e5c872ba97d2e5a9732e508636f4a0a64736f6c63430008090033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
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.