More Info
Private Name Tags
ContractCreator
Latest 25 internal transactions (View All)
Advanced mode:
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
21337635 | 6 hrs ago | 5.01982299 ETH | ||||
21336692 | 10 hrs ago | 6.01420258 ETH | ||||
21336582 | 10 hrs ago | 0.06855235 ETH | ||||
21336229 | 11 hrs ago | 0.02091444 ETH | ||||
21335956 | 12 hrs ago | 6.01343092 ETH | ||||
21335309 | 14 hrs ago | 6.01291836 ETH | ||||
21334587 | 17 hrs ago | 6.01217427 ETH | ||||
21334574 | 17 hrs ago | 7.01734642 ETH | ||||
21334565 | 17 hrs ago | 7.01882155 ETH | ||||
21334275 | 18 hrs ago | 0.05740057 ETH | ||||
21334035 | 18 hrs ago | 6.01325244 ETH | ||||
21333627 | 20 hrs ago | 0.5263974 ETH | ||||
21333197 | 21 hrs ago | 0.07539409 ETH | ||||
21331901 | 26 hrs ago | 15.60753459 ETH | ||||
21331541 | 27 hrs ago | 0.42431089 ETH | ||||
21331480 | 27 hrs ago | 0.60736038 ETH | ||||
21330035 | 32 hrs ago | 60.29775719 ETH | ||||
21329588 | 33 hrs ago | 7.45769019 ETH | ||||
21329021 | 35 hrs ago | 0.10115614 ETH | ||||
21328776 | 36 hrs ago | 0.13191332 ETH | ||||
21328527 | 37 hrs ago | 6.0124486 ETH | ||||
21327791 | 39 hrs ago | 6.01210301 ETH | ||||
21327526 | 40 hrs ago | 0.02738578 ETH | ||||
21327241 | 41 hrs ago | 6.01249213 ETH | ||||
21326654 | 43 hrs ago | 6.01160683 ETH |
Loading...
Loading
Contract Name:
Pool
Compiler Version
v0.8.18+commit.87f61d96
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.18; import "@openzeppelin/contracts-v4/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts-v4/security/ReentrancyGuard.sol"; import "../../abstract/MasterAwareV2.sol"; import "../../interfaces/IMCR.sol"; import "../../interfaces/IRamm.sol"; import "../../interfaces/INXMToken.sol"; import "../../interfaces/ILegacyPool.sol"; import "../../interfaces/IPool.sol"; import "../../interfaces/IPriceFeedOracle.sol"; import "../../interfaces/ISwapOperator.sol"; import "../../libraries/Math.sol"; import "../../libraries/SafeUintCast.sol"; contract Pool is IPool, MasterAwareV2, ReentrancyGuard { using SafeERC20 for IERC20; using SafeUintCast for uint; /* storage */ Asset[] public assets; mapping(address => SwapDetails) public swapDetails; // parameters IPriceFeedOracle public override priceFeedOracle; address public swapOperator; // SwapOperator assets uint32 public assetsInSwapOperatorBitmap; uint public assetInSwapOperator; /* constants */ address constant public ETH = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE; uint public constant MCR_RATIO_DECIMALS = 4; uint internal constant MAX_SLIPPAGE_DENOMINATOR = 10000; INXMToken public immutable nxmToken; /* events */ event Payout(address indexed to, address indexed assetAddress, uint amount); event DepositReturned(address indexed to, uint amount); /* logic */ modifier onlySwapOperator { require(msg.sender == swapOperator, "Pool: Not swapOperator"); _; } modifier onlyRamm { require(msg.sender == internalContracts[uint(ID.RA)], "Pool: Not Ramm"); _; } /* ========== CONSTRUCTOR ========== */ constructor ( address _master, address _priceOracle, address _swapOperator, address _nxmTokenAddress, address _previousPool ) { master = INXMMaster(_master); nxmToken = INXMToken(_nxmTokenAddress); swapOperator = _swapOperator; ILegacyPool previousPool = ILegacyPool(_previousPool); // copy over assets and swap details ILegacyPool.Asset[] memory previousAssets = previousPool.getAssets(); for (uint i = 0; i < previousAssets.length; i++) { address assetAddress = previousAssets[i].assetAddress; assets.push( Asset( previousAssets[i].assetAddress, previousAssets[i].isCoverAsset, previousAssets[i].isAbandoned ) ); if (assetAddress != ETH) { ILegacyPool.SwapDetails memory previousSwapDetails = previousPool.getAssetSwapDetails(assetAddress); swapDetails[assetAddress] = SwapDetails( previousSwapDetails.minAmount, previousSwapDetails.maxAmount, previousSwapDetails.lastSwapTime, previousSwapDetails.maxSlippageRatio ); } } _setPriceFeedOracle(IPriceFeedOracle(_priceOracle)); } receive() external payable {} /* ========== ASSET RELATED VIEW FUNCTIONS ========== */ function getAssetValueInEth(address assetAddress, uint assetAmountInSwapOperator) internal view returns (uint) { uint assetBalance = assetAmountInSwapOperator; if (assetAddress.code.length != 0) { try IERC20(assetAddress).balanceOf(address(this)) returns (uint balance) { assetBalance += balance; } catch { // If balanceOf reverts consider it 0 } } // If the assetBalance is 0 skip the oracle call to save gas if (assetBalance == 0) { return 0; } return priceFeedOracle.getEthForAsset(assetAddress, assetBalance); } /// /// @dev Calculates total value of all pool assets in ether /// function getPoolValueInEth() public override view returns (uint) { uint total = address(this).balance; uint assetCount = assets.length; uint _assetsInSwapOperatorBitmap = assetsInSwapOperatorBitmap; for (uint i = 0; i < assetCount; i++) { Asset memory asset = assets[i]; if (asset.isAbandoned) { continue; } uint assetAmountInSwapOperator = isAssetInSwapOperator(i, _assetsInSwapOperatorBitmap) ? assetInSwapOperator : 0; // check if the asset is ETH and skip the oracle call if (i == 0) { total += assetAmountInSwapOperator; continue; } total += getAssetValueInEth(asset.assetAddress, assetAmountInSwapOperator); } return total; } function getAsset(uint assetId) external override view returns (Asset memory) { require(assetId < assets.length, "Pool: Invalid asset id"); return assets[assetId]; } function getAssets() external override view returns (Asset[] memory) { return assets; } function getAssetSwapDetails(address assetAddress) external view returns (SwapDetails memory) { return swapDetails[assetAddress]; } function getAssetId(address assetAddress) public view returns (uint) { uint assetCount = assets.length; for (uint i = 0; i < assetCount; i++) { if (assets[i].assetAddress == assetAddress) { return i; } } revert AssetNotFound(); } function isAssetInSwapOperator(uint _assetId, uint _assetsInSwapOperatorBitmap) internal pure returns (bool) { if ( // there are assets in the swap operator _assetsInSwapOperatorBitmap != 0 && // asset id is not in the swap operator assets ((1 << _assetId) & _assetsInSwapOperatorBitmap == 0) ) { return false; } return true; } /* ========== ASSET RELATED MUTATIVE FUNCTIONS ========== */ function addAsset( address assetAddress, bool isCoverAsset, uint _min, uint _max, uint _maxSlippageRatio ) external onlyGovernance { require(assetAddress != address(0), "Pool: Asset is zero address"); require(_max >= _min, "Pool: max < min"); require(_maxSlippageRatio <= MAX_SLIPPAGE_DENOMINATOR, "Pool: Max slippage ratio > 1"); (Aggregator aggregator,) = priceFeedOracle.assets(assetAddress); require(address(aggregator) != address(0), "Pool: PriceFeedOracle lacks aggregator for asset"); // Check whether the new asset already exists as a cover asset uint assetCount = assets.length; for (uint i = 0; i < assetCount; i++) { require(assetAddress != assets[i].assetAddress, "Pool: Asset exists"); } assets.push( Asset( assetAddress, isCoverAsset, false // is abandoned ) ); // Set the swap details swapDetails[assetAddress] = SwapDetails( _min.toUint104(), _max.toUint104(), 0, // last swap time _maxSlippageRatio.toUint16() ); } function setAssetDetails( uint assetId, bool isCoverAsset, bool isAbandoned ) external onlyGovernance { require(assets.length > assetId, "Pool: Asset does not exist"); assets[assetId].isCoverAsset = isCoverAsset; assets[assetId].isAbandoned = isAbandoned; } function setSwapDetails( address assetAddress, uint _min, uint _max, uint _maxSlippageRatio ) external onlyGovernance { require(_min <= _max, "Pool: min > max"); require(_maxSlippageRatio <= MAX_SLIPPAGE_DENOMINATOR, "Pool: Max slippage ratio > 1"); uint assetCount = assets.length; for (uint i = 0; i < assetCount; i++) { if (assetAddress != assets[i].assetAddress) { continue; } swapDetails[assetAddress].minAmount = _min.toUint104(); swapDetails[assetAddress].maxAmount = _max.toUint104(); swapDetails[assetAddress].maxSlippageRatio = _maxSlippageRatio.toUint16(); return; } revert AssetNotFound(); } function transferAsset( address assetAddress, address payable destination, uint amount ) external onlyGovernance nonReentrant { require(swapDetails[assetAddress].maxAmount == 0, "Pool: Max not zero"); require(destination != address(0), "Pool: Dest zero"); IERC20 token = IERC20(assetAddress); uint balance = token.balanceOf(address(this)); uint transferableAmount = amount > balance ? balance : amount; token.safeTransfer(destination, transferableAmount); } /* ========== SWAPOPERATOR RELATED MUTATIVE FUNCTIONS ========== */ function transferAssetToSwapOperator( address assetAddress, uint amount ) public override onlySwapOperator nonReentrant whenNotPaused { if (assetAddress == ETH) { (bool ok, /* data */) = swapOperator.call{value: amount}(""); require(ok, "Pool: ETH transfer failed"); return; } IERC20 token = IERC20(assetAddress); token.safeTransfer(swapOperator, amount); } function setSwapDetailsLastSwapTime( address assetAddress, uint32 lastSwapTime ) public override onlySwapOperator whenNotPaused { swapDetails[assetAddress].lastSwapTime = lastSwapTime; } function setSwapAssetAmount(address assetAddress, uint value) external onlySwapOperator whenNotPaused { uint assetId = getAssetId(assetAddress); assetInSwapOperator = value; if (value > 0) { if (assetsInSwapOperatorBitmap != 0) { revert OrderInProgress(); } assetsInSwapOperatorBitmap = uint32(1 << assetId); } else { assetsInSwapOperatorBitmap = 0; } } /* ========== CLAIMS RELATED MUTATIVE FUNCTIONS ========== */ /// @dev Executes a payout /// @param assetId Index of the cover asset /// @param payoutAddress Send funds to this address /// @param amount Amount to send /// @param ethDepositAmount Deposit amount to send /// function sendPayout( uint assetId, address payable payoutAddress, uint amount, uint ethDepositAmount ) external override onlyInternal nonReentrant { Asset memory asset = assets[assetId]; if (asset.assetAddress == ETH) { // solhint-disable-next-line avoid-low-level-calls (bool transferSucceeded, /* data */) = payoutAddress.call{value: amount}(""); require(transferSucceeded, "Pool: ETH transfer failed"); } else { IERC20(asset.assetAddress).safeTransfer(payoutAddress, amount); } if (ethDepositAmount > 0) { // solhint-disable-next-line avoid-low-level-calls (bool transferSucceeded, /* data */) = payoutAddress.call{value: ethDepositAmount}(""); require(transferSucceeded, "Pool: ETH transfer failed"); emit DepositReturned(payoutAddress, ethDepositAmount); } emit Payout(payoutAddress, asset.assetAddress, amount); mcr().updateMCRInternal(true); } /* ========== TOKEN RELATED MUTATIVE FUNCTIONS ========== */ /// @dev Sends ETH to a member in exchange for NXM tokens. /// @param member Member address /// @param amount Amount of ETH to send /// function sendEth(address member, uint amount) external override onlyRamm nonReentrant { (bool transferSucceeded, /* data */) = member.call{value: amount}(""); require(transferSucceeded, "Pool: ETH transfer failed"); } function calculateMCRRatio( uint totalAssetValue, uint mcrEth ) public override pure returns (uint) { return totalAssetValue * (10 ** MCR_RATIO_DECIMALS) / mcrEth; } /* ========== TOKEN RELATED VIEW FUNCTIONS ========== */ /// Uses internal price for calculating the token price in ETH /// It's being used in Cover and IndividualClaims /// Returns the internal NXM price in a given asset. /// /// @dev The pool contract is not a proxy and its address will change as we upgrade it. /// @dev You may want TokenController.getTokenPrice() for a stable address since it's a proxy. /// /// @param assetId Index of the cover asset. /// function getInternalTokenPriceInAsset(uint assetId) public view override returns (uint tokenPrice) { require(assetId < assets.length, "Pool: Unknown cover asset"); address assetAddress = assets[assetId].assetAddress; uint tokenInternalPrice = ramm().getInternalPrice(); return priceFeedOracle.getAssetForEth(assetAddress, tokenInternalPrice); } /// Uses internal price for calculating the token price in ETH and updates TWAP /// It's being used in Cover /// Returns the internal NXM price in a given asset. /// /// @dev The pool contract is not a proxy and its address will change as we upgrade it. /// @dev You may want TokenController.getTokenPrice() for a stable address since it's a proxy. /// /// @param assetId Index of the cover asset. /// function getInternalTokenPriceInAssetAndUpdateTwap(uint assetId) public override returns (uint tokenPrice) { require(assetId < assets.length, "Pool: Unknown cover asset"); address assetAddress = assets[assetId].assetAddress; uint tokenInternalPrice = ramm().getInternalPriceAndUpdateTwap(); return priceFeedOracle.getAssetForEth(assetAddress, tokenInternalPrice); } /// [deprecated] Returns spot NXM price in ETH from ramm contract. /// /// @dev The pool contract is not a proxy and its address will change as we upgrade it. /// @dev You may want TokenController.getTokenPrice() for a stable address since it's a proxy. /// function getTokenPrice() public override view returns (uint tokenPrice) { (, tokenPrice) = ramm().getSpotPrices(); return tokenPrice; } function getMCRRatio() public override view returns (uint) { uint totalAssetValue = getPoolValueInEth(); uint mcrEth = mcr().getMCR(); return calculateMCRRatio(totalAssetValue, mcrEth); } /* ========== POOL UPGRADE RELATED MUTATIVE FUNCTIONS ========== */ // Revert if any of the asset functions revert while not being marked for getting abandoned. // Otherwise, continue without reverting while the marked asset will remain stuck in the // previous pool contract. function upgradeCapitalPool(address payable newPoolAddress) external override onlyMaster nonReentrant { // transfer ETH (bool ok, /* data */) = newPoolAddress.call{value: address(this).balance}(""); require(ok, "Pool: Transfer failed"); uint assetCount = assets.length; // start from 1 (0 is ETH) for (uint i = 1; i < assetCount; i++) { if (assets[i].isAbandoned) { continue; } IERC20 asset = IERC20(assets[i].assetAddress); uint balance = asset.balanceOf(address(this)); asset.safeTransfer(newPoolAddress, balance); } } function _setPriceFeedOracle(IPriceFeedOracle _priceFeedOracle) internal { uint assetCount = assets.length; // start from 1 (0 is ETH and doesn't need an oracle) for (uint i = 1; i < assetCount; i++) { (Aggregator aggregator,) = _priceFeedOracle.assets(assets[i].assetAddress); require(address(aggregator) != address(0), "Pool: PriceFeedOracle lacks aggregator for asset"); } priceFeedOracle = _priceFeedOracle; } function updateUintParameters(bytes8 /* code */, uint /* value */) external view onlyGovernance { revert UnknownParameter(); } function updateAddressParameters(bytes8 code, address value) external onlyGovernance { if (code == "SWP_OP") { if (swapOperator != address(0)) { require(!ISwapOperator(swapOperator).orderInProgress(), 'Pool: Cancel all swaps before changing swapOperator'); } swapOperator = value; return; } if (code == "PRC_FEED") { _setPriceFeedOracle(IPriceFeedOracle(value)); return; } revert UnknownParameter(); } /* ========== DEPENDENCIES ========== */ function mcr() internal view returns (IMCR) { return IMCR(internalContracts[uint(ID.MC)]); } function ramm() internal view returns (IRamm) { return IRamm(internalContracts[uint(ID.RA)]); } /** * @dev Update dependent contract address * @dev Implements MasterAware interface function */ function changeDependentContractAddress() public { internalContracts[uint(ID.MC)] = master.getLatestAddress("MC"); internalContracts[uint(ID.RA)] = master.getLatestAddress("RA"); // needed for onlyMember modifier internalContracts[uint(ID.MR)] = master.getLatestAddress("MR"); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @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); /** * @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 `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, 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 `from` to `to` 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 from, address to, uint256 amount ) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/draft-IERC20Permit.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20 token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @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 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) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(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 /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.18; import "../interfaces/INXMMaster.sol"; import "../interfaces/IMasterAwareV2.sol"; import "../interfaces/IMemberRoles.sol"; abstract contract MasterAwareV2 is IMasterAwareV2 { INXMMaster public master; mapping(uint => address payable) public internalContracts; modifier onlyMember { require( IMemberRoles(internalContracts[uint(ID.MR)]).checkRole( msg.sender, uint(IMemberRoles.Role.Member) ), "Caller is not a member" ); _; } modifier onlyAdvisoryBoard { require( IMemberRoles(internalContracts[uint(ID.MR)]).checkRole( msg.sender, uint(IMemberRoles.Role.AdvisoryBoard) ), "Caller is not an advisory board member" ); _; } modifier onlyInternal { require(master.isInternal(msg.sender), "Caller is not an internal contract"); _; } modifier onlyMaster { if (address(master) != address(0)) { require(address(master) == msg.sender, "Not master"); } _; } modifier onlyGovernance { require( master.checkIsAuthToGoverned(msg.sender), "Caller is not authorized to govern" ); _; } modifier onlyEmergencyAdmin { require( msg.sender == master.emergencyAdmin(), "Caller is not emergency admin" ); _; } modifier whenPaused { require(master.isPause(), "System is not paused"); _; } modifier whenNotPaused { require(!master.isPause(), "System is paused"); _; } function getInternalContractAddress(ID id) internal view returns (address payable) { return internalContracts[uint(id)]; } function changeMasterAddress(address masterAddress) public onlyMaster { master = INXMMaster(masterAddress); } }
// SPDX-License-Identifier: LGPL-3.0-or-later pragma solidity ^0.8.18; import "@openzeppelin/contracts-v4/token/ERC20/IERC20.sol"; /// @title Gnosis Protocol v2 Order Library /// @author Gnosis Developers library GPv2Order { /// @dev The complete data for a Gnosis Protocol order. This struct contains /// all order parameters that are signed for submitting to GP. struct Data { IERC20 sellToken; IERC20 buyToken; address receiver; uint256 sellAmount; uint256 buyAmount; uint32 validTo; bytes32 appData; uint256 feeAmount; bytes32 kind; bool partiallyFillable; bytes32 sellTokenBalance; bytes32 buyTokenBalance; } /// @dev The order EIP-712 type hash for the [`GPv2Order.Data`] struct. /// /// This value is pre-computed from the following expression: /// ``` /// keccak256( /// "Order(" + /// "address sellToken," + /// "address buyToken," + /// "address receiver," + /// "uint256 sellAmount," + /// "uint256 buyAmount," + /// "uint32 validTo," + /// "bytes32 appData," + /// "uint256 feeAmount," + /// "string kind," + /// "bool partiallyFillable" + /// "string sellTokenBalance" + /// "string buyTokenBalance" + /// ")" /// ) /// ``` bytes32 internal constant TYPE_HASH = hex"d5a25ba2e97094ad7d83dc28a6572da797d6b3e7fc6663bd93efb789fc17e489"; /// @dev The marker value for a sell order for computing the order struct /// hash. This allows the EIP-712 compatible wallets to display a /// descriptive string for the order kind (instead of 0 or 1). /// /// This value is pre-computed from the following expression: /// ``` /// keccak256("sell") /// ``` bytes32 internal constant KIND_SELL = hex"f3b277728b3fee749481eb3e0b3b48980dbbab78658fc419025cb16eee346775"; /// @dev The OrderKind marker value for a buy order for computing the order /// struct hash. /// /// This value is pre-computed from the following expression: /// ``` /// keccak256("buy") /// ``` bytes32 internal constant KIND_BUY = hex"6ed88e868af0a1983e3886d5f3e95a2fafbd6c3450bc229e27342283dc429ccc"; /// @dev The TokenBalance marker value for using direct ERC20 balances for /// computing the order struct hash. /// /// This value is pre-computed from the following expression: /// ``` /// keccak256("erc20") /// ``` bytes32 internal constant BALANCE_ERC20 = hex"5a28e9363bb942b639270062aa6bb295f434bcdfc42c97267bf003f272060dc9"; /// @dev The TokenBalance marker value for using Balancer Vault external /// balances (in order to re-use Vault ERC20 approvals) for computing the /// order struct hash. /// /// This value is pre-computed from the following expression: /// ``` /// keccak256("external") /// ``` bytes32 internal constant BALANCE_EXTERNAL = hex"abee3b73373acd583a130924aad6dc38cfdc44ba0555ba94ce2ff63980ea0632"; /// @dev The TokenBalance marker value for using Balancer Vault internal /// balances for computing the order struct hash. /// /// This value is pre-computed from the following expression: /// ``` /// keccak256("internal") /// ``` bytes32 internal constant BALANCE_INTERNAL = hex"4ac99ace14ee0a5ef932dc609df0943ab7ac16b7583634612f8dc35a4289a6ce"; /// @dev Marker address used to indicate that the receiver of the trade /// proceeds should the owner of the order. /// /// This is chosen to be `address(0)` for gas efficiency as it is expected /// to be the most common case. address internal constant RECEIVER_SAME_AS_OWNER = address(0); /// @dev The byte length of an order unique identifier. uint256 internal constant UID_LENGTH = 56; /// @dev Returns the actual receiver for an order. This function checks /// whether or not the [`receiver`] field uses the marker value to indicate /// it is the same as the order owner. /// /// @return receiver The actual receiver of trade proceeds. function actualReceiver(Data memory order, address owner) internal pure returns (address receiver) { if (order.receiver == RECEIVER_SAME_AS_OWNER) { receiver = owner; } else { receiver = order.receiver; } } /// @dev Return the EIP-712 signing hash for the specified order. /// /// @param order The order to compute the EIP-712 signing hash for. /// @param domainSeparator The EIP-712 domain separator to use. /// @return orderDigest The 32 byte EIP-712 struct hash. function hash(Data memory order, bytes32 domainSeparator) internal pure returns (bytes32 orderDigest) { bytes32 structHash; // NOTE: Compute the EIP-712 order struct hash in place. As suggested // in the EIP proposal, noting that the order struct has 10 fields, and // including the type hash `(12 + 1) * 32 = 416` bytes to hash. // <https://github.com/ethereum/EIPs/blob/master/EIPS/eip-712.md#rationale-for-encodedata> // solhint-disable-next-line no-inline-assembly assembly { let dataStart := sub(order, 32) let temp := mload(dataStart) mstore(dataStart, TYPE_HASH) structHash := keccak256(dataStart, 416) mstore(dataStart, temp) } // NOTE: Now that we have the struct hash, compute the EIP-712 signing // hash using scratch memory past the free memory pointer. The signing // hash is computed from `"\x19\x01" || domainSeparator || structHash`. // <https://docs.soliditylang.org/en/v0.7.6/internals/layout_in_memory.html#layout-in-memory> // <https://github.com/ethereum/EIPs/blob/master/EIPS/eip-712.md#specification> // solhint-disable-next-line no-inline-assembly assembly { let freeMemoryPointer := mload(0x40) mstore(freeMemoryPointer, "\x19\x01") mstore(add(freeMemoryPointer, 2), domainSeparator) mstore(add(freeMemoryPointer, 34), structHash) orderDigest := keccak256(freeMemoryPointer, 66) } } /// @dev Packs order UID parameters into the specified memory location. The /// result is equivalent to `abi.encodePacked(...)` with the difference that /// it allows re-using the memory for packing the order UID. /// /// This function reverts if the order UID buffer is not the correct size. /// /// @param orderUid The buffer pack the order UID parameters into. /// @param orderDigest The EIP-712 struct digest derived from the order /// parameters. /// @param owner The address of the user who owns this order. /// @param validTo The epoch time at which the order will stop being valid. function packOrderUidParams( bytes memory orderUid, bytes32 orderDigest, address owner, uint32 validTo ) internal pure { require(orderUid.length == UID_LENGTH, "GPv2: uid buffer overflow"); // NOTE: Write the order UID to the allocated memory buffer. The order // parameters are written to memory in **reverse order** as memory // operations write 32-bytes at a time and we want to use a packed // encoding. This means, for example, that after writing the value of // `owner` to bytes `20:52`, writing the `orderDigest` to bytes `0:32` // will **overwrite** bytes `20:32`. This is desirable as addresses are // only 20 bytes and `20:32` should be `0`s: // // | 1111111111222222222233333333334444444444555555 // byte | 01234567890123456789012345678901234567890123456789012345 // -------+--------------------------------------------------------- // field | [.........orderDigest..........][......owner.......][vT] // -------+--------------------------------------------------------- // mstore | [000000000000000000000000000.vT] // | [00000000000.......owner.......] // | [.........orderDigest..........] // // Additionally, since Solidity `bytes memory` are length prefixed, // 32 needs to be added to all the offsets. // // solhint-disable-next-line no-inline-assembly assembly { mstore(add(orderUid, 56), validTo) mstore(add(orderUid, 52), owner) mstore(add(orderUid, 32), orderDigest) } } /// @dev Extracts specific order information from the standardized unique /// order id of the protocol. /// /// @param orderUid The unique identifier used to represent an order in /// the protocol. This uid is the packed concatenation of the order digest, /// the validTo order parameter and the address of the user who created the /// order. It is used by the user to interface with the contract directly, /// and not by calls that are triggered by the solvers. /// @return orderDigest The EIP-712 signing digest derived from the order /// parameters. /// @return owner The address of the user who owns this order. /// @return validTo The epoch time at which the order will stop being valid. function extractOrderUidParams(bytes calldata orderUid) internal pure returns ( bytes32 orderDigest, address owner, uint32 validTo ) { require(orderUid.length == UID_LENGTH, "GPv2: invalid uid"); // Use assembly to efficiently decode packed calldata. // solhint-disable-next-line no-inline-assembly assembly { orderDigest := calldataload(orderUid.offset) owner := shr(96, calldataload(add(orderUid.offset, 32))) validTo := shr(224, calldataload(add(orderUid.offset, 52))) } } }
// SPDX-License-Identifier: GPL-3.0-only pragma solidity >=0.5.0; interface IEnzymeFundValueCalculatorRouter { function calcGrossShareValue(address _vaultProxy) external returns (address denominationAsset_, uint256 grossShareValue_); function calcNetShareValue(address _vaultProxy) external returns (address denominationAsset_, uint256 netShareValue_); }
// SPDX-License-Identifier: GPL-3.0-only pragma solidity >=0.5.0; import "./IERC20Detailed.sol"; interface ICowSettlement { struct GPv2TradeData { uint256 sellTokenIndex; uint256 buyTokenIndex; address receiver; uint256 sellAmount; uint256 buyAmount; uint32 validTo; bytes32 appData; uint256 feeAmount; uint256 flags; uint256 executedAmount; bytes signature; } struct GPv2InteractionData { address target; uint256 value; bytes callData; } function setPreSignature(bytes calldata orderUid, bool signed) external; function invalidateOrder(bytes calldata orderUid) external; function filledAmount(bytes calldata orderUid) external view returns (uint256); function vaultRelayer() external view returns (address); function domainSeparator() external view returns (bytes32); function settle( IERC20Detailed[] calldata tokens, uint256[] calldata clearingPrices, GPv2TradeData[] calldata trades, GPv2InteractionData[][3] calldata interactions ) external; function preSignature(bytes memory) external returns (uint); }
// SPDX-License-Identifier: GPL-3.0-only pragma solidity >=0.5.0; interface IERC20Detailed { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); function decimals() external view returns (uint8); function symbol() external view returns (string memory); }
// SPDX-License-Identifier: GPL-3.0-only pragma solidity >=0.5.0; import "./IPriceFeedOracle.sol"; interface ILegacyPool { struct SwapDetails { uint104 minAmount; uint104 maxAmount; uint32 lastSwapTime; // 2 decimals of precision. 0.01% -> 0.0001 -> 1e14 uint16 maxSlippageRatio; } struct Asset { address assetAddress; bool isCoverAsset; bool isAbandoned; } function getAsset(uint assetId) external view returns (Asset memory); function getAssets() external view returns (Asset[] memory); function buyNXM(uint minTokensOut) external payable; function sellNXM(uint tokenAmount, uint minEthOut) external; function sellNXMTokens(uint tokenAmount) external returns (bool); function transferAssetToSwapOperator(address asset, uint amount) external; function setSwapDetailsLastSwapTime(address asset, uint32 lastSwapTime) external; function getAssetSwapDetails(address assetAddress) external view returns (SwapDetails memory); function getNXMForEth(uint ethAmount) external view returns (uint); function sendPayout(uint assetIndex, address payable payoutAddress, uint amount) external; function upgradeCapitalPool(address payable newPoolAddress) external; function priceFeedOracle() external view returns (IPriceFeedOracle); function getPoolValueInEth() external view returns (uint); function getEthForNXM(uint nxmAmount) external view returns (uint ethAmount); function calculateEthForNXM(uint nxmAmount, uint currentTotalAssetValue, uint mcrEth) external pure returns (uint); function calculateMCRRatio(uint totalAssetValue, uint mcrEth) external pure returns (uint); function calculateTokenSpotPrice(uint totalAssetValue, uint mcrEth) external pure returns (uint tokenPrice); function getTokenPriceInAsset(uint assetId) external view returns (uint tokenPrice); function getTokenPrice() external view returns (uint tokenPrice); function getMCRRatio() external view returns (uint); function setSwapValue(uint value) external; }
// SPDX-License-Identifier: GPL-3.0-only pragma solidity >=0.5.0; interface IMasterAwareV2 { // TODO: if you update this enum, update lib/constants.js as well enum ID { TC, // TokenController.sol P1, // Pool.sol MR, // MemberRoles.sol MC, // MCR.sol CO, // Cover.sol SP, // StakingProducts.sol PS, // LegacyPooledStaking.sol GV, // Governance.sol GW, // LegacyGateway.sol - removed CL, // CoverMigrator.sol - removed AS, // Assessment.sol CI, // IndividualClaims.sol - Claims for Individuals CG, // YieldTokenIncidents.sol - Claims for Groups RA, // Ramm.sol ST, // SafeTracker.sol CP // CoverProducts.sol } function changeMasterAddress(address masterAddress) external; function changeDependentContractAddress() external; function internalContracts(uint) external view returns (address payable); }
// SPDX-License-Identifier: GPL-3.0-only pragma solidity >=0.5.0; interface IMCR { function updateMCRInternal(bool forceUpdate) external; function getMCR() external view returns (uint); function mcr() external view returns (uint80); function desiredMCR() external view returns (uint80); function lastUpdateTime() external view returns (uint32); function maxMCRIncrement() external view returns (uint16); function gearingFactor() external view returns (uint24); function minUpdateTime() external view returns (uint16); }
// SPDX-License-Identifier: GPL-3.0-only pragma solidity >=0.5.0; interface IMemberRoles { enum Role {Unassigned, AdvisoryBoard, Member, Owner} function join(address _userAddress, uint nonce, bytes calldata signature) external payable; function switchMembership(address _newAddress) external; function switchMembershipAndAssets( address newAddress, uint[] calldata coverIds, uint[] calldata stakingTokenIds ) external; function switchMembershipOf(address member, address _newAddress) external; function totalRoles() external view returns (uint256); function changeAuthorized(uint _roleId, address _newAuthorized) external; function setKycAuthAddress(address _add) external; function members(uint _memberRoleId) external view returns (uint, address[] memory memberArray); function numberOfMembers(uint _memberRoleId) external view returns (uint); function authorized(uint _memberRoleId) external view returns (address); function roles(address _memberAddress) external view returns (uint[] memory); function checkRole(address _memberAddress, uint _roleId) external view returns (bool); function getMemberLengthForAllRoles() external view returns (uint[] memory totalMembers); function memberAtIndex(uint _memberRoleId, uint index) external view returns (address, bool); function membersLength(uint _memberRoleId) external view returns (uint); event MemberRole(uint256 indexed roleId, bytes32 roleName, string roleDescription); event MemberJoined(address indexed newMember, uint indexed nonce); event switchedMembership(address indexed previousMember, address indexed newMember, uint timeStamp); event MembershipWithdrawn(address indexed member, uint timestamp); }
// SPDX-License-Identifier: GPL-3.0-only pragma solidity >=0.5.0; interface INXMMaster { function tokenAddress() external view returns (address); function owner() external view returns (address); function emergencyAdmin() external view returns (address); function masterInitialized() external view returns (bool); function isInternal(address _add) external view returns (bool); function isPause() external view returns (bool check); function isMember(address _add) external view returns (bool); function checkIsAuthToGoverned(address _add) external view returns (bool); function getLatestAddress(bytes2 _contractName) external view returns (address payable contractAddress); function contractAddresses(bytes2 code) external view returns (address payable); function upgradeMultipleContracts( bytes2[] calldata _contractCodes, address payable[] calldata newAddresses ) external; function removeContracts(bytes2[] calldata contractCodesToRemove) external; function addNewInternalContracts( bytes2[] calldata _contractCodes, address payable[] calldata newAddresses, uint[] calldata _types ) external; function updateOwnerParameters(bytes8 code, address payable val) external; }
// SPDX-License-Identifier: GPL-3.0-only pragma solidity >=0.5.0; interface INXMToken { function burn(uint256 amount) external returns (bool); function burnFrom(address from, uint256 value) external returns (bool); function operatorTransfer(address from, uint256 value) external returns (bool); function mint(address account, uint256 amount) external; function isLockedForMV(address member) external view returns (uint); function whiteListed(address member) external view returns (bool); function addToWhiteList(address _member) external returns (bool); function removeFromWhiteList(address _member) external returns (bool); function changeOperator(address _newOperator) external returns (bool); function lockForMemberVote(address _of, uint _days) external; /** * @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: GPL-3.0-only pragma solidity >=0.5.0; import "./IPriceFeedOracle.sol"; struct SwapDetails { uint104 minAmount; uint104 maxAmount; uint32 lastSwapTime; // 2 decimals of precision. 0.01% -> 0.0001 -> 1e14 uint16 maxSlippageRatio; } struct Asset { address assetAddress; bool isCoverAsset; bool isAbandoned; } interface IPool { error RevertedWithoutReason(uint index); error AssetNotFound(); error UnknownParameter(); error OrderInProgress(); function swapOperator() external view returns (address); function getAsset(uint assetId) external view returns (Asset memory); function getAssets() external view returns (Asset[] memory); function transferAssetToSwapOperator(address asset, uint amount) external; function setSwapDetailsLastSwapTime(address asset, uint32 lastSwapTime) external; function getAssetSwapDetails(address assetAddress) external view returns (SwapDetails memory); function sendPayout(uint assetIndex, address payable payoutAddress, uint amount, uint ethDepositAmount) external; function sendEth(address payoutAddress, uint amount) external; function upgradeCapitalPool(address payable newPoolAddress) external; function priceFeedOracle() external view returns (IPriceFeedOracle); function getPoolValueInEth() external view returns (uint); function calculateMCRRatio(uint totalAssetValue, uint mcrEth) external pure returns (uint); function getInternalTokenPriceInAsset(uint assetId) external view returns (uint tokenPrice); function getInternalTokenPriceInAssetAndUpdateTwap(uint assetId) external returns (uint tokenPrice); function getTokenPrice() external view returns (uint tokenPrice); function getMCRRatio() external view returns (uint); function setSwapAssetAmount(address assetAddress, uint value) external; }
// SPDX-License-Identifier: GPL-3.0-only pragma solidity >=0.5.0; interface Aggregator { function decimals() external view returns (uint8); function latestAnswer() external view returns (int); } interface IPriceFeedOracle { struct OracleAsset { Aggregator aggregator; uint8 decimals; } function ETH() external view returns (address); function assets(address) external view returns (Aggregator, uint8); function getAssetToEthRate(address asset) external view returns (uint); function getAssetForEth(address asset, uint ethIn) external view returns (uint); function getEthForAsset(address asset, uint amount) external view returns (uint); }
// SPDX-License-Identifier: GPL-3.0-only pragma solidity >=0.5.0; import "./IPool.sol"; import "./INXMToken.sol"; import "./ITokenController.sol"; interface IRamm { // storage structs struct Slot0 { uint128 nxmReserveA; uint128 nxmReserveB; } struct Slot1 { uint128 ethReserve; uint88 budget; uint32 updatedAt; bool swapPaused; // emergency pause } struct Observation { uint32 timestamp; uint112 priceCumulativeAbove; uint112 priceCumulativeBelow; } // memory structs struct State { uint nxmA; uint nxmB; uint eth; uint budget; uint ratchetSpeedB; uint timestamp; } struct Context { uint capital; uint supply; uint mcr; } struct CumulativePriceCalculationProps { uint previousEthReserve; uint currentEthReserve; uint previousNxmA; uint currentNxmA; uint previousNxmB; uint currentNxmB; uint previousTimestamp; uint observationTimestamp; } struct CumulativePriceCalculationTimes { uint secondsUntilBVAbove; uint secondsUntilBVBelow; uint timeElapsed; uint bvTimeBelow; uint bvTimeAbove; uint ratchetTimeAbove; uint ratchetTimeBelow; } /* ========== VIEWS ========== */ function getReserves() external view returns ( uint ethReserve, uint nxmA, uint nxmB, uint remainingBudget ); function getSpotPrices() external view returns (uint spotPriceA, uint spotPriceB); function getBookValue() external view returns (uint bookValue); function getInternalPrice() external view returns (uint internalPrice); /* ==== MUTATIVE FUNCTIONS ==== */ function updateTwap() external; function getInternalPriceAndUpdateTwap() external returns (uint internalPrice); function swap(uint nxmIn, uint minAmountOut, uint deadline) external payable returns (uint amountOut); function removeBudget() external; function setEmergencySwapPause(bool _swapPaused) external; /* ========== EVENTS AND ERRORS ========== */ event EthSwappedForNxm(address indexed member, uint ethIn, uint nxmOut); event NxmSwappedForEth(address indexed member, uint nxmIn, uint ethOut); event ObservationUpdated(uint32 timestamp, uint112 priceCumulativeAbove, uint112 priceCumulativeBelow); event BudgetRemoved(); event SwapPauseConfigured(bool paused); event EthInjected(uint value); event EthExtracted(uint value); // Pause error SystemPaused(); error SwapPaused(); // Input error OneInputOnly(); error OneInputRequired(); // Expiry error SwapExpired(uint deadline, uint blockTimestamp); // Insufficient amount out error InsufficientAmountOut(uint amountOut, uint minAmountOut); // Buffer Zone error NoSwapsInBufferZone(); // ETH Transfer error EthTransferFailed(); // Circuit breakers error EthCircuitBreakerHit(); error NxmCircuitBreakerHit(); }
// SPDX-License-Identifier: GPL-3.0-only pragma solidity >=0.5.0; import "../external/cow/GPv2Order.sol"; import "../external/enzyme/IEnzymeFundValueCalculatorRouter.sol"; import "./ICowSettlement.sol"; import "./INXMMaster.sol"; import "./IPool.sol"; import "./IWeth.sol"; interface ISwapOperator { enum SwapOperationType { EthToAsset, AssetToEth, AssetToAsset } /* ========== VIEWS ========== */ function getDigest(GPv2Order.Data calldata order) external view returns (bytes32); function getUID(GPv2Order.Data calldata order) external view returns (bytes memory); function orderInProgress() external view returns (bool); function currentOrderUID() external view returns (bytes memory); /* ========== IMMUTABLES ========== */ function cowSettlement() external view returns (ICowSettlement); function cowVaultRelayer() external view returns (address); function master() external view returns (INXMMaster); function swapController() external view returns (address); function weth() external view returns (IWeth); function domainSeparator() external view returns (bytes32); function enzymeV4VaultProxyAddress() external view returns (address); function enzymeFundValueCalculatorRouter() external view returns (IEnzymeFundValueCalculatorRouter); function minPoolEth() external view returns (uint); /* ==== MUTATIVE FUNCTIONS ==== */ function placeOrder(GPv2Order.Data calldata order, bytes calldata orderUID) external; function closeOrder(GPv2Order.Data calldata order) external; function swapEnzymeVaultShareForETH(uint amountIn, uint amountOutMin) external; function swapETHForEnzymeVaultShare(uint amountIn, uint amountOutMin) external; function recoverAsset(address assetAddress, address receiver) external; function requestAsset(address asset, uint amount) external; function transferRequestedAsset(address requestedAsset, uint requestedAmount) external; /* ========== EVENTS AND ERRORS ========== */ event OrderPlaced(GPv2Order.Data order); event OrderClosed(GPv2Order.Data order, uint filledAmount); event Swapped(address indexed fromAsset, address indexed toAsset, uint amountIn, uint amountOut); event TransferredToSafe(address asset, uint amount); // Swap Order error OrderInProgress(bytes currentOrderUID); error NoOrderInPlace(); error OrderUidMismatch(bytes providedOrderUID, bytes expectedOrderUID); error UnsupportedTokenBalance(string kind); error InvalidReceiver(address validReceiver); error TokenDisabled(address token); error AmountOutTooLow(uint amountOut, uint minAmount); error InvalidTokenAddress(string token); error InvalidDenominationAsset(address invalidAsset, address validAsset); // Valid To error BelowMinValidTo(uint minValidTo); error AboveMaxValidTo(uint maxValidTo); // Balance error InvalidBalance(uint tokenBalance, uint limit); error InvalidPostSwapBalance(uint postSwapBalance, uint limit); // Access Controls error OnlyController(); // Transfer error TransferFailed(address to, uint value, address token); // Cool down error InsufficientTimeBetweenSwaps(uint minValidSwapTime); // Fee error AboveMaxFee(uint feeInEth, uint maxFee); }
// SPDX-License-Identifier: GPL-3.0-only pragma solidity >=0.5.0; import "./INXMToken.sol"; interface ITokenController { struct StakingPoolNXMBalances { uint128 rewards; uint128 deposits; } struct CoverInfo { uint16 claimCount; bool hasOpenClaim; bool hasAcceptedClaim; uint96 requestedPayoutAmount; // note: still 128 bits available here, can be used later } struct StakingPoolOwnershipOffer { address proposedManager; uint96 deadline; } struct WithdrawAssessment { bool stake; bool rewards; } /// @notice The stake deposit / rewards in a staking pool that will be withdrawn. /// @dev Call StakingViewer.getToken to get tokenId / trancheId information /// @param tokenId The ID of the token stake deposit / rewards that will be withrawn. /// @param trancheIds An array of tranche IDs representing the tranches where the stake was deposited. struct StakingPoolDeposit { uint tokenId; uint[] trancheIds; } /// @notice Represents the rewards distributed to a staking pool manager. /// @dev Call StakingViewer.getManagerTokenRewardsByAddr to get poolId / trancheId information /// @param poolId The ID of the pool managed by the manager. /// @param trancheIds An array of tranche IDs representing the tranches where the manager rewards were distributed. struct StakingPoolManagerReward { uint poolId; uint[] trancheIds; } /* ========== VIEWS ========== */ function token() external view returns (INXMToken); function coverInfo(uint id) external view returns ( uint16 claimCount, bool hasOpenClaim, bool hasAcceptedClaim, uint96 requestedPayoutAmount ); function getLockReasons(address _of) external view returns (bytes32[] memory reasons); function totalSupply() external view returns (uint); function totalBalanceOf(address _of) external view returns (uint amount); function totalBalanceOfWithoutDelegations(address _of) external view returns (uint amount); function getTokenPrice() external view returns (uint tokenPrice); function getPendingRewards(address member) external view returns (uint); function tokensLocked(address _of, bytes32 _reason) external view returns (uint256 amount); function getWithdrawableCoverNotes( address coverOwner ) external view returns ( uint[] memory coverIds, bytes32[] memory lockReasons, uint withdrawableAmount ); function getStakingPoolManager(uint poolId) external view returns (address manager); function getManagerStakingPools(address manager) external view returns (uint[] memory poolIds); function isStakingPoolManager(address member) external view returns (bool); function getStakingPoolOwnershipOffer(uint poolId) external view returns (address proposedManager, uint deadline); function stakingPoolNXMBalances(uint poolId) external view returns (uint128 rewards, uint128 deposits); /* ========== MUTATIVE FUNCTIONS ========== */ function withdrawCoverNote( address _of, uint[] calldata _coverIds, uint[] calldata _indexes ) external; function changeOperator(address _newOperator) external; function operatorTransfer(address _from, address _to, uint _value) external returns (bool); function burnFrom(address _of, uint amount) external returns (bool); function addToWhitelist(address _member) external; function removeFromWhitelist(address _member) external; function mint(address _member, uint _amount) external; function lockForMemberVote(address _of, uint _days) external; function withdrawClaimAssessmentTokens(address[] calldata users) external; function transferStakingPoolsOwnership(address from, address to) external; function assignStakingPoolManager(uint poolId, address manager) external; function createStakingPoolOwnershipOffer(uint poolId, address proposedManager, uint deadline) external; function acceptStakingPoolOwnershipOffer(uint poolId) external; function cancelStakingPoolOwnershipOffer(uint poolId) external; function mintStakingPoolNXMRewards(uint amount, uint poolId) external; function burnStakingPoolNXMRewards(uint amount, uint poolId) external; function depositStakedNXM(address from, uint amount, uint poolId) external; function withdrawNXMStakeAndRewards(address to, uint stakeToWithdraw, uint rewardsToWithdraw, uint poolId) external; function burnStakedNXM(uint amount, uint poolId) external; }
// SPDX-License-Identifier: GPL-3.0-only pragma solidity >=0.5.0; interface IWeth { function deposit() external payable; function withdraw(uint256 wad) external; function approve(address spender, uint256 value) external; function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); }
// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.18; /** * @dev Simple library that defines min, max and babylonian sqrt functions */ library Math { function min(uint a, uint b) internal pure returns (uint) { return a < b ? a : b; } function max(uint a, uint b) internal pure returns (uint) { return a > b ? a : b; } function sum(uint[] memory items) internal pure returns (uint) { uint count = items.length; uint total; for (uint i = 0; i < count; i++) { total += items[i]; } return total; } function divRound(uint a, uint b) internal pure returns (uint) { return (a + b / 2) / b; } function divCeil(uint a, uint b) internal pure returns (uint) { return (a + b - 1) / b; } function roundUp(uint a, uint b) internal pure returns (uint) { return divCeil(a, b) * b; } // babylonian method function sqrt(uint y) internal pure returns (uint) { if (y > 3) { uint z = y; uint x = y / 2 + 1; while (x < z) { z = x; x = (y / x + x) / 2; } return z; } if (y != 0) { return 1; } return 0; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.18; /** * @dev Wrappers over Solidity's uintXX casting operators with added overflow * checks. * * Downcasting from uint256 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. */ library SafeUintCast { /** * @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 */ function toUint248(uint256 value) internal pure returns (uint248) { require(value < 2**248, "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 */ function toUint240(uint256 value) internal pure returns (uint240) { require(value < 2**240, "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 */ function toUint232(uint256 value) internal pure returns (uint232) { require(value < 2**232, "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 */ function toUint224(uint256 value) internal pure returns (uint224) { require(value < 2**224, "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 */ function toUint216(uint256 value) internal pure returns (uint216) { require(value < 2**216, "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 */ function toUint208(uint256 value) internal pure returns (uint208) { require(value < 2**208, "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 */ function toUint200(uint256 value) internal pure returns (uint200) { require(value < 2**200, "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 */ function toUint192(uint256 value) internal pure returns (uint192) { require(value < 2**192, "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 */ function toUint184(uint256 value) internal pure returns (uint184) { require(value < 2**184, "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 */ function toUint176(uint256 value) internal pure returns (uint176) { require(value < 2**176, "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 */ function toUint168(uint256 value) internal pure returns (uint168) { require(value < 2**168, "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 */ function toUint160(uint256 value) internal pure returns (uint160) { require(value < 2**160, "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 */ function toUint152(uint256 value) internal pure returns (uint152) { require(value < 2**152, "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 */ function toUint144(uint256 value) internal pure returns (uint144) { require(value < 2**144, "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 */ function toUint136(uint256 value) internal pure returns (uint136) { require(value < 2**136, "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 */ function toUint128(uint256 value) internal pure returns (uint128) { require(value < 2**128, "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 */ function toUint120(uint256 value) internal pure returns (uint120) { require(value < 2**120, "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 */ function toUint112(uint256 value) internal pure returns (uint112) { require(value < 2**112, "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 */ function toUint104(uint256 value) internal pure returns (uint104) { require(value < 2**104, "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 `uint104` operator. * * Requirements: * * - input must fit into 96 bits */ function toUint96(uint256 value) internal pure returns (uint96) { require(value < 2**96, "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 `uint104` operator. * * Requirements: * * - input must fit into 88 bits */ function toUint88(uint256 value) internal pure returns (uint88) { require(value < 2**88, "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 `uint104` operator. * * Requirements: * * - input must fit into 80 bits */ function toUint80(uint256 value) internal pure returns (uint80) { require(value < 2**80, "SafeCast: value doesn\'t fit in 80 bits"); return uint80(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 */ function toUint64(uint256 value) internal pure returns (uint64) { require(value < 2**64, "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 */ function toUint56(uint256 value) internal pure returns (uint56) { require(value < 2**56, "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 */ function toUint48(uint256 value) internal pure returns (uint48) { require(value < 2**48, "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 */ function toUint40(uint256 value) internal pure returns (uint40) { require(value < 2**40, "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 */ function toUint32(uint256 value) internal pure returns (uint32) { require(value < 2**32, "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 */ function toUint24(uint256 value) internal pure returns (uint24) { require(value < 2**24, "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 */ function toUint16(uint256 value) internal pure returns (uint16) { require(value < 2**16, "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. */ function toUint8(uint256 value) internal pure returns (uint8) { require(value < 2**8, "SafeCast: value doesn\'t fit in 8 bits"); return uint8(value); } }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_master","type":"address"},{"internalType":"address","name":"_priceOracle","type":"address"},{"internalType":"address","name":"_swapOperator","type":"address"},{"internalType":"address","name":"_nxmTokenAddress","type":"address"},{"internalType":"address","name":"_previousPool","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AssetNotFound","type":"error"},{"inputs":[],"name":"OrderInProgress","type":"error"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"RevertedWithoutReason","type":"error"},{"inputs":[],"name":"UnknownParameter","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"DepositReturned","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"address","name":"assetAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Payout","type":"event"},{"inputs":[],"name":"ETH","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MCR_RATIO_DECIMALS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"assetAddress","type":"address"},{"internalType":"bool","name":"isCoverAsset","type":"bool"},{"internalType":"uint256","name":"_min","type":"uint256"},{"internalType":"uint256","name":"_max","type":"uint256"},{"internalType":"uint256","name":"_maxSlippageRatio","type":"uint256"}],"name":"addAsset","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"assetInSwapOperator","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"assets","outputs":[{"internalType":"address","name":"assetAddress","type":"address"},{"internalType":"bool","name":"isCoverAsset","type":"bool"},{"internalType":"bool","name":"isAbandoned","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"assetsInSwapOperatorBitmap","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"totalAssetValue","type":"uint256"},{"internalType":"uint256","name":"mcrEth","type":"uint256"}],"name":"calculateMCRRatio","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"changeDependentContractAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"masterAddress","type":"address"}],"name":"changeMasterAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"assetId","type":"uint256"}],"name":"getAsset","outputs":[{"components":[{"internalType":"address","name":"assetAddress","type":"address"},{"internalType":"bool","name":"isCoverAsset","type":"bool"},{"internalType":"bool","name":"isAbandoned","type":"bool"}],"internalType":"struct Asset","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"assetAddress","type":"address"}],"name":"getAssetId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"assetAddress","type":"address"}],"name":"getAssetSwapDetails","outputs":[{"components":[{"internalType":"uint104","name":"minAmount","type":"uint104"},{"internalType":"uint104","name":"maxAmount","type":"uint104"},{"internalType":"uint32","name":"lastSwapTime","type":"uint32"},{"internalType":"uint16","name":"maxSlippageRatio","type":"uint16"}],"internalType":"struct SwapDetails","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAssets","outputs":[{"components":[{"internalType":"address","name":"assetAddress","type":"address"},{"internalType":"bool","name":"isCoverAsset","type":"bool"},{"internalType":"bool","name":"isAbandoned","type":"bool"}],"internalType":"struct Asset[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"assetId","type":"uint256"}],"name":"getInternalTokenPriceInAsset","outputs":[{"internalType":"uint256","name":"tokenPrice","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"assetId","type":"uint256"}],"name":"getInternalTokenPriceInAssetAndUpdateTwap","outputs":[{"internalType":"uint256","name":"tokenPrice","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getMCRRatio","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPoolValueInEth","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTokenPrice","outputs":[{"internalType":"uint256","name":"tokenPrice","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"internalContracts","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"master","outputs":[{"internalType":"contract INXMMaster","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nxmToken","outputs":[{"internalType":"contract INXMToken","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"priceFeedOracle","outputs":[{"internalType":"contract IPriceFeedOracle","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"member","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"sendEth","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"assetId","type":"uint256"},{"internalType":"address payable","name":"payoutAddress","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"ethDepositAmount","type":"uint256"}],"name":"sendPayout","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"assetId","type":"uint256"},{"internalType":"bool","name":"isCoverAsset","type":"bool"},{"internalType":"bool","name":"isAbandoned","type":"bool"}],"name":"setAssetDetails","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"assetAddress","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"setSwapAssetAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"assetAddress","type":"address"},{"internalType":"uint256","name":"_min","type":"uint256"},{"internalType":"uint256","name":"_max","type":"uint256"},{"internalType":"uint256","name":"_maxSlippageRatio","type":"uint256"}],"name":"setSwapDetails","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"assetAddress","type":"address"},{"internalType":"uint32","name":"lastSwapTime","type":"uint32"}],"name":"setSwapDetailsLastSwapTime","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"swapDetails","outputs":[{"internalType":"uint104","name":"minAmount","type":"uint104"},{"internalType":"uint104","name":"maxAmount","type":"uint104"},{"internalType":"uint32","name":"lastSwapTime","type":"uint32"},{"internalType":"uint16","name":"maxSlippageRatio","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"swapOperator","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"assetAddress","type":"address"},{"internalType":"address payable","name":"destination","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferAsset","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"assetAddress","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferAssetToSwapOperator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes8","name":"code","type":"bytes8"},{"internalType":"address","name":"value","type":"address"}],"name":"updateAddressParameters","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes8","name":"","type":"bytes8"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"updateUintParameters","outputs":[],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address payable","name":"newPoolAddress","type":"address"}],"name":"upgradeCapitalPool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
60a06040523480156200001157600080fd5b5060405162003ccf38038062003ccf8339810160408190526200003491620004fa565b6001600255600080546001600160a01b038088166001600160a01b031992831617835584811660805260068054878316931692909217909155604080516319f92b0b60e21b815290518493928416916367e4ac2c91600480830192869291908290030181865afa158015620000ad573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052620000d7919081019062000604565b905060005b81518110156200036b576000828281518110620000fd57620000fd62000702565b6020026020010151600001519050600360405180606001604052808585815181106200012d576200012d62000702565b6020026020010151600001516001600160a01b031681526020018585815181106200015c576200015c62000702565b6020026020010151602001511515815260200185858151811062000184576200018462000702565b602090810291909101810151604090810151151590925283546001810185556000948552938190208351940180549184015193909201511515600160a81b0260ff60a81b19931515600160a01b026001600160a81b03199092166001600160a01b03958616179190911792909216919091179055811673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee146200035557604051631b53826160e11b81526001600160a01b038281166004830152600091908616906336a704c290602401608060405180830381865afa15801562000260573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000286919062000730565b6040805160808101825282516001600160681b03908116825260208085015182168184019081528486015163ffffffff90811685870190815260609788015161ffff9081169887019889526001600160a01b038b16600090815260049095529690932094518554925193519751909616600160f01b026001600160f01b0397909116600160d01b02969096166001600160d01b039284166d0100000000000000000000000000026001600160d01b03199092169590931694909417939093179290921691909117919091179055505b50806200036281620007ca565b915050620000dc565b50620003778662000384565b5050505050505062000836565b60035460015b81811015620004bd576000836001600160a01b031663f11b818860038481548110620003ba57620003ba62000702565b60009182526020909120015460405160e083901b6001600160e01b03191681526001600160a01b0390911660048201526024016040805180830381865afa1580156200040a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620004309190620007f2565b5090506001600160a01b038116620004a75760405162461bcd60e51b815260206004820152603060248201527f506f6f6c3a205072696365466565644f7261636c65206c61636b73206167677260448201526f1959d85d1bdc88199bdc88185cdcd95d60821b606482015260840160405180910390fd5b5080620004b481620007ca565b9150506200038a565b5050600580546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b0381168114620004f757600080fd5b50565b600080600080600060a086880312156200051357600080fd5b85516200052081620004e1565b60208701519095506200053381620004e1565b60408701519094506200054681620004e1565b60608701519093506200055981620004e1565b60808701519092506200056c81620004e1565b809150509295509295909350565b634e487b7160e01b600052604160045260246000fd5b604051606081016001600160401b0381118282101715620005b557620005b56200057a565b60405290565b604051601f8201601f191681016001600160401b0381118282101715620005e657620005e66200057a565b604052919050565b80518015158114620005ff57600080fd5b919050565b600060208083850312156200061857600080fd5b82516001600160401b03808211156200063057600080fd5b818501915085601f8301126200064557600080fd5b8151818111156200065a576200065a6200057a565b6200066a848260051b01620005bb565b818152848101925060609182028401850191888311156200068a57600080fd5b938501935b82851015620006f65780858a031215620006a95760008081fd5b620006b362000590565b8551620006c081620004e1565b8152620006cf868801620005ee565b878201526040620006e2818801620005ee565b90820152845293840193928501926200068f565b50979650505050505050565b634e487b7160e01b600052603260045260246000fd5b80516001600160681b0381168114620005ff57600080fd5b6000608082840312156200074357600080fd5b604051608081016001600160401b03811182821017156200076857620007686200057a565b604052620007768362000718565b8152620007866020840162000718565b6020820152604083015163ffffffff81168114620007a357600080fd5b6040820152606083015161ffff81168114620007be57600080fd5b60608201529392505050565b600060018201620007eb57634e487b7160e01b600052601160045260246000fd5b5060010190565b600080604083850312156200080657600080fd5b82516200081381620004e1565b602084015190925060ff811681146200082b57600080fd5b809150509250929050565b60805161347d620008526000396000610754015261347d6000f3fe6080604052600436106102085760003560e01c80639dd86e0f11610118578063d6abe642116100a0578063eac8f5b81161006f578063eac8f5b814610776578063eb962360146107a3578063ebb0aa48146107d9578063ee97f7f3146107f9578063fac197881461081957600080fd5b8063d6abe642146106c9578063e24ba594146106e9578063e470965a14610709578063e967eb1a1461074257600080fd5b8063b9ab9927116100e7578063b9ab992714610602578063c78557dd14610622578063cf35bdd014610642578063d100a30d14610689578063d46655f4146106a957600080fd5b80639dd86e0f1461050b578063a278bd4d1461052b578063ad4cc43e1461054b578063b2182ea91461056b57600080fd5b80634b94f50e1161019b57806367e4ac2c1161016a57806367e4ac2c1461045457806369f36c32146104765780636f2c0e151461048b57806370310cb7146104c35780638322fff2146104e357600080fd5b80634b94f50e146103df578063501b4615146103f45780635e7327ed1461041457806366fd551d1461043457600080fd5b806336a704c2116101d757806336a704c214610293578063439e2e451461038a5780634779be08146103aa57806349dcbc5e146103bf57600080fd5b806304fa850c146102145780630ea9c984146102365780632f04d7981461024b57806332102ba71461027357600080fd5b3661020f57005b600080fd5b34801561022057600080fd5b5061023461022f366004612d2b565b61082f565b005b34801561024257600080fd5b506102346109da565b34801561025757600080fd5b50610260610bf1565b6040519081526020015b60405180910390f35b34801561027f57600080fd5b5061023461028e366004612d65565b610cf1565b34801561029f57600080fd5b5061033b6102ae366004612db6565b604080516080810182526000808252602082018190529181018290526060810191909152506001600160a01b0316600090815260046020908152604091829020825160808101845290546001600160681b038082168352600160681b82041692820192909252600160d01b820463ffffffff1692810192909252600160f01b900461ffff16606082015290565b60405161026a919060006080820190506001600160681b038084511683528060208501511660208401525063ffffffff604084015116604083015261ffff606084015116606083015292915050565b34801561039657600080fd5b506102346103a5366004612dd3565b611106565b3480156103b657600080fd5b50610260600481565b3480156103cb57600080fd5b506102346103da366004612d2b565b611309565b3480156103eb57600080fd5b50610260611413565b34801561040057600080fd5b5061023461040f366004612d2b565b611483565b34801561042057600080fd5b5061023461042f366004612e14565b6115c3565b34801561044057600080fd5b5061023461044f366004612db6565b6116bc565b34801561046057600080fd5b506104696118cf565b60405161026a9190612e56565b34801561048257600080fd5b50610260611957565b34801561049757600080fd5b506006546104ab906001600160a01b031681565b6040516001600160a01b03909116815260200161026a565b3480156104cf57600080fd5b506102606104de366004612ec5565b6119e2565b3480156104ef57600080fd5b506104ab73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee81565b34801561051757600080fd5b50610234610526366004612f04565b611a0c565b34801561053757600080fd5b50610234610546366004612f20565b611aad565b34801561055757600080fd5b50610234610566366004612f5d565b611e24565b34801561057757600080fd5b506105c8610586366004612db6565b6004602052600090815260409020546001600160681b0380821691600160681b810490911690600160d01b810463ffffffff1690600160f01b900461ffff1684565b604080516001600160681b03958616815294909316602085015263ffffffff9091169183019190915261ffff16606082015260800161026a565b34801561060e57600080fd5b506005546104ab906001600160a01b031681565b34801561062e57600080fd5b5061026061063d366004612f89565b612001565b34801561064e57600080fd5b5061066261065d366004612f89565b612164565b604080516001600160a01b039094168452911515602084015215159082015260600161026a565b34801561069557600080fd5b506102346106a4366004612fa2565b6121a3565b3480156106b557600080fd5b506102346106c4366004612db6565b6122f2565b3480156106d557600080fd5b506102606106e4366004612db6565b61236c565b3480156106f557600080fd5b50610234610704366004612fe4565b6123e6565b34801561071557600080fd5b5060065461072d90600160a01b900463ffffffff1681565b60405163ffffffff909116815260200161026a565b34801561074e57600080fd5b506104ab7f000000000000000000000000000000000000000000000000000000000000000081565b34801561078257600080fd5b50610796610791366004612f89565b612638565b60405161026a919061301f565b3480156107af57600080fd5b506104ab6107be366004612f89565b6001602052600090815260409020546001600160a01b031681565b3480156107e557600080fd5b506102606107f4366004612f89565b612702565b34801561080557600080fd5b506000546104ab906001600160a01b031681565b34801561082557600080fd5b5061026060075481565b6006546001600160a01b031633146108625760405162461bcd60e51b81526004016108599061304d565b60405180910390fd5b60028054036108835760405162461bcd60e51b81526004016108599061307d565b6002805560005460408051600162f6c75960e01b0319815290516001600160a01b039092169163ff0938a7916004808201926020929091908290030181865afa1580156108d4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108f891906130b4565b156109155760405162461bcd60e51b8152600401610859906130d1565b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeed196001600160a01b038316016109b3576006546040516000916001600160a01b03169083908381818185875af1925050503d8060008114610987576040519150601f19603f3d011682016040523d82523d6000602084013e61098c565b606091505b50509050806109ad5760405162461bcd60e51b8152600401610859906130fb565b506109d1565b60065482906109cf906001600160a01b038084169116846127c4565b505b50506001600255565b6000546040516227050b60e31b8152614d4360f01b60048201526001600160a01b0390911690630138285890602401602060405180830381865afa158015610a26573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a4a9190613132565b6003600090815260016020527f7dfe757ecd65cbd7922a9c0161e935dd7fdbcc0e999689c7d31633896b1fc60b80546001600160a01b039384166001600160a01b0319909116179055546040516227050b60e31b815261524160f01b6004820152911690630138285890602401602060405180830381865afa158015610ad4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610af89190613132565b600d600090815260016020527f86b3fa87ee245373978e0d2d334dbde866c9b8b039036b87c5eb2fd89bcb6bab80546001600160a01b039384166001600160a01b0319909116179055546040516227050b60e31b81526126a960f11b6004820152911690630138285890602401602060405180830381865afa158015610b82573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ba69190613132565b600260005260016020527fd9d16d34ffb15ba3a3d852f0d403e2ce1d691fb54de27ac87cd2f993f3ec330f80546001600160a01b0319166001600160a01b0392909216919091179055565b6003546006546000914791600160a01b900463ffffffff16835b82811015610ce857600060038281548110610c2857610c2861314f565b60009182526020918290206040805160608101825291909201546001600160a01b038116825260ff600160a01b82048116151594830194909452600160a81b900490921615801591830191909152909150610c835750610cd6565b6000610c8f8385612816565b610c9a576000610c9e565b6007545b905082600003610cbb57610cb2818761317b565b95505050610cd6565b8151610cc79082612840565b610cd1908761317b565b955050505b80610ce08161318e565b915050610c0b565b50919392505050565b600054604051632c1a733d60e11b81523360048201526001600160a01b0390911690635834e67a90602401602060405180830381865afa158015610d39573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d5d91906130b4565b610d795760405162461bcd60e51b8152600401610859906131a7565b6001600160a01b038516610dcf5760405162461bcd60e51b815260206004820152601b60248201527f506f6f6c3a204173736574206973207a65726f206164647265737300000000006044820152606401610859565b82821015610e115760405162461bcd60e51b815260206004820152600f60248201526e2837b7b61d1036b0bc101e1036b4b760891b6044820152606401610859565b612710811115610e635760405162461bcd60e51b815260206004820152601c60248201527f506f6f6c3a204d617820736c69707061676520726174696f203e2031000000006044820152606401610859565b600554604051631e23703160e31b81526001600160a01b038781166004830152600092169063f11b8188906024016040805180830381865afa158015610ead573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ed191906131e9565b5090506001600160a01b038116610efa5760405162461bcd60e51b81526004016108599061321e565b60035460005b81811015610f895760038181548110610f1b57610f1b61314f565b6000918252602090912001546001600160a01b0390811690891603610f775760405162461bcd60e51b8152602060048201526012602482015271506f6f6c3a2041737365742065786973747360701b6044820152606401610859565b80610f818161318e565b915050610f00565b50604080516060810182526001600160a01b03808a16825288151560208301908152600083850181815260038054600181018255925293517fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b9091018054925194511515600160a81b0260ff60a81b19951515600160a01b026001600160a81b0319909416929094169190911791909117929092161790558051608081019091528061103487612929565b6001600160681b0316815260200161104b86612929565b6001600160681b031681526000602082015260400161106985612992565b61ffff9081169091526001600160a01b03909816600090815260046020908152604091829020835181549285015193850151606090950151909b16600160f01b026001600160f01b0363ffffffff909516600160d01b02949094166001600160d01b036001600160681b03948516600160681b026001600160d01b031990941694909c169390931791909117999099161717909655505050505050565b600054604051632c1a733d60e11b81523360048201526001600160a01b0390911690635834e67a90602401602060405180830381865afa15801561114e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061117291906130b4565b61118e5760405162461bcd60e51b8152600401610859906131a7565b60028054036111af5760405162461bcd60e51b81526004016108599061307d565b600280556001600160a01b038316600090815260046020526040902054600160681b90046001600160681b03161561121e5760405162461bcd60e51b8152602060048201526012602482015271506f6f6c3a204d6178206e6f74207a65726f60701b6044820152606401610859565b6001600160a01b0382166112665760405162461bcd60e51b815260206004820152600f60248201526e506f6f6c3a2044657374207a65726f60881b6044820152606401610859565b6040516370a0823160e01b815230600482015283906000906001600160a01b038316906370a0823190602401602060405180830381865afa1580156112af573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112d3919061326e565b905060008184116112e457836112e6565b815b90506112fc6001600160a01b03841686836127c4565b5050600160025550505050565b600d60005260016020527f86b3fa87ee245373978e0d2d334dbde866c9b8b039036b87c5eb2fd89bcb6bab546001600160a01b0316331461137d5760405162461bcd60e51b815260206004820152600e60248201526d506f6f6c3a204e6f742052616d6d60901b6044820152606401610859565b600280540361139e5760405162461bcd60e51b81526004016108599061307d565b600280556040516000906001600160a01b0384169083908381818185875af1925050503d80600081146113ed576040519150601f19603f3d011682016040523d82523d6000602084013e6113f2565b606091505b50509050806109cf5760405162461bcd60e51b8152600401610859906130fb565b600061141d6129f5565b6001600160a01b031663dd8cf9636040518163ffffffff1660e01b81526004016040805180830381865afa158015611459573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061147d9190613287565b92915050565b6006546001600160a01b031633146114ad5760405162461bcd60e51b81526004016108599061304d565b60008054906101000a90046001600160a01b03166001600160a01b031663ff0938a76040518163ffffffff1660e01b8152600401602060405180830381865afa1580156114fe573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061152291906130b4565b1561153f5760405162461bcd60e51b8152600401610859906130d1565b600061154a8361236c565b6007839055905081156115ad57600654600160a01b900463ffffffff161561158557604051636037020160e11b815260040160405180910390fd5b6006805463ffffffff6001841b16600160a01b0263ffffffff60a01b19909116179055505050565b6006805463ffffffff60a01b191690555b505050565b6006546001600160a01b031633146115ed5760405162461bcd60e51b81526004016108599061304d565b60008054906101000a90046001600160a01b03166001600160a01b031663ff0938a76040518163ffffffff1660e01b8152600401602060405180830381865afa15801561163e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061166291906130b4565b1561167f5760405162461bcd60e51b8152600401610859906130d1565b6001600160a01b039091166000908152600460205260409020805463ffffffff909216600160d01b0263ffffffff60d01b19909216919091179055565b6000546001600160a01b031615611714576000546001600160a01b031633146117145760405162461bcd60e51b815260206004820152600a6024820152692737ba1036b0b9ba32b960b11b6044820152606401610859565b60028054036117355760405162461bcd60e51b81526004016108599061307d565b600280556040516000906001600160a01b0383169047908381818185875af1925050503d8060008114611784576040519150601f19603f3d011682016040523d82523d6000602084013e611789565b606091505b50509050806117d25760405162461bcd60e51b8152602060048201526015602482015274141bdbdb0e88151c985b9cd9995c8819985a5b1959605a1b6044820152606401610859565b60035460015b818110156118c457600381815481106117f3576117f361314f565b600091825260209091200154600160a81b900460ff166118b2576000600382815481106118225761182261314f565b60009182526020822001546040516370a0823160e01b81523060048201526001600160a01b03909116925082906370a0823190602401602060405180830381865afa158015611875573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611899919061326e565b90506118af6001600160a01b03831687836127c4565b50505b806118bc8161318e565b9150506117d8565b505060016002555050565b60606003805480602002602001604051908101604052809291908181526020016000905b8282101561194e57600084815260209081902060408051606081018252918501546001600160a01b038116835260ff600160a01b82048116151584860152600160a81b909104161515908201528252600190920191016118f3565b50505050905090565b600080611962610bf1565b9050600061196e612a1c565b6001600160a01b03166344936b106040518163ffffffff1660e01b8152600401602060405180830381865afa1580156119ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119cf919061326e565b90506119db82826119e2565b9250505090565b6000816119f16004600a61338f565b6119fb908561339b565b611a0591906133b2565b9392505050565b600054604051632c1a733d60e11b81523360048201526001600160a01b0390911690635834e67a90602401602060405180830381865afa158015611a54573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a7891906130b4565b611a945760405162461bcd60e51b8152600401610859906131a7565b604051630686182560e11b815260040160405180910390fd5b6000546040516323c5b10760e21b81523360048201526001600160a01b0390911690638f16c41c90602401602060405180830381865afa158015611af5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b1991906130b4565b611b705760405162461bcd60e51b815260206004820152602260248201527f43616c6c6572206973206e6f7420616e20696e7465726e616c20636f6e74726160448201526118dd60f21b6064820152608401610859565b6002805403611b915760405162461bcd60e51b81526004016108599061307d565b60028081905550600060038581548110611bad57611bad61314f565b60009182526020918290206040805160608101825292909101546001600160a01b03811680845260ff600160a01b83048116151595850195909552600160a81b909104909316151590820152915073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeed1901611c8f576000846001600160a01b03168460405160006040518083038185875af1925050503d8060008114611c63576040519150601f19603f3d011682016040523d82523d6000602084013e611c68565b606091505b5050905080611c895760405162461bcd60e51b8152600401610859906130fb565b50611ca5565b8051611ca5906001600160a01b031685856127c4565b8115611d63576000846001600160a01b03168360405160006040518083038185875af1925050503d8060008114611cf8576040519150601f19603f3d011682016040523d82523d6000602084013e611cfd565b606091505b5050905080611d1e5760405162461bcd60e51b8152600401610859906130fb565b846001600160a01b03167fa09244c122a83074363635dc89ce0098166c2f74827960ff64a7c8e6ad1c57a284604051611d5991815260200190565b60405180910390a2505b80600001516001600160a01b0316846001600160a01b03167febe7adb4feddf2afa5de463169fdc706254a55c9cf2b930ac84bb49e28cfe6bb85604051611dac91815260200190565b60405180910390a3611dbc612a1c565b604051631b2622ff60e11b8152600160048201526001600160a01b03919091169063364c45fe90602401600060405180830381600087803b158015611e0057600080fd5b505af1158015611e14573d6000803e3d6000fd5b5050600160025550505050505050565b600054604051632c1a733d60e11b81523360048201526001600160a01b0390911690635834e67a90602401602060405180830381865afa158015611e6c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e9091906130b4565b611eac5760405162461bcd60e51b8152600401610859906131a7565b6001600160c01b031982166505357505f4f560d41b03611fd8576006546001600160a01b031615611fb757600660009054906101000a90046001600160a01b03166001600160a01b03166341e007516040518163ffffffff1660e01b8152600401602060405180830381865afa158015611f2a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f4e91906130b4565b15611fb75760405162461bcd60e51b815260206004820152603360248201527f506f6f6c3a2043616e63656c20616c6c207377617073206265666f726520636860448201527230b733b4b7339039bbb0b827b832b930ba37b960691b6064820152608401610859565b600680546001600160a01b0383166001600160a01b03199091161790555050565b6001600160c01b0319821667141490d7d191515160c21b03611a9457611ffd81612a28565b5050565b60035460009082106120515760405162461bcd60e51b8152602060048201526019602482015278141bdbdb0e88155b9adb9bdddb8818dbdd995c88185cdcd95d603a1b6044820152606401610859565b6000600383815481106120665761206661314f565b60009182526020822001546001600160a01b031691506120846129f5565b6001600160a01b031663e00256646040518163ffffffff1660e01b8152600401602060405180830381865afa1580156120c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120e5919061326e565b600554604051632ae2073360e11b81526001600160a01b038581166004830152602482018490529293509116906355c40e6690604401602060405180830381865afa158015612138573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061215c919061326e565b949350505050565b6003818154811061217457600080fd5b6000918252602090912001546001600160a01b038116915060ff600160a01b8204811691600160a81b90041683565b600054604051632c1a733d60e11b81523360048201526001600160a01b0390911690635834e67a90602401602060405180830381865afa1580156121eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061220f91906130b4565b61222b5760405162461bcd60e51b8152600401610859906131a7565b600354831061227c5760405162461bcd60e51b815260206004820152601a60248201527f506f6f6c3a20417373657420646f6573206e6f742065786973740000000000006044820152606401610859565b81600384815481106122905761229061314f565b9060005260206000200160000160146101000a81548160ff02191690831515021790555080600384815481106122c8576122c861314f565b60009182526020909120018054911515600160a81b0260ff60a81b19909216919091179055505050565b6000546001600160a01b03161561234a576000546001600160a01b0316331461234a5760405162461bcd60e51b815260206004820152600a6024820152692737ba1036b0b9ba32b960b11b6044820152606401610859565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b600354600090815b818110156123cc57836001600160a01b0316600382815481106123995761239961314f565b6000918252602090912001546001600160a01b0316036123ba579392505050565b806123c48161318e565b915050612374565b5060405163470cbf4760e01b815260040160405180910390fd5b600054604051632c1a733d60e11b81523360048201526001600160a01b0390911690635834e67a90602401602060405180830381865afa15801561242e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061245291906130b4565b61246e5760405162461bcd60e51b8152600401610859906131a7565b818311156124b05760405162461bcd60e51b815260206004820152600f60248201526e0a0deded87440dad2dc407c40dac2f608b1b6044820152606401610859565b6127108111156125025760405162461bcd60e51b815260206004820152601c60248201527f506f6f6c3a204d617820736c69707061676520726174696f203e2031000000006044820152606401610859565b60035460005b818110156123cc57600381815481106125235761252361314f565b6000918252602090912001546001600160a01b03908116908716036126205761254b85612929565b6001600160a01b038716600090815260046020526040902080546cffffffffffffffffffffffffff19166001600160681b039290921691909117905561259084612929565b6001600160a01b038716600090815260046020526040902080546001600160681b0392909216600160681b026cffffffffffffffffffffffffff60681b199092169190911790556125e083612992565b6001600160a01b0387166000908152600460205260409020805461ffff92909216600160f01b026001600160f01b03909216919091179055506126329050565b8061262a8161318e565b915050612508565b50505050565b6040805160608101825260008082526020820181905291810191909152600354821061269f5760405162461bcd60e51b8152602060048201526016602482015275141bdbdb0e88125b9d985b1a5908185cdcd95d081a5960521b6044820152606401610859565b600382815481106126b2576126b261314f565b60009182526020918290206040805160608101825291909201546001600160a01b038116825260ff600160a01b82048116151594830194909452600160a81b900490921615159082015292915050565b60035460009082106127525760405162461bcd60e51b8152602060048201526019602482015278141bdbdb0e88155b9adb9bdddb8818dbdd995c88185cdcd95d603a1b6044820152606401610859565b6000600383815481106127675761276761314f565b60009182526020822001546001600160a01b031691506127856129f5565b6001600160a01b03166318d458346040518163ffffffff1660e01b81526004016020604051808303816000875af11580156120c1573d6000803e3d6000fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526115be908490612b2d565b6000811580159061282a57506001831b8216155b156128375750600061147d565b50600192915050565b6000816001600160a01b0384163b156128c6576040516370a0823160e01b81523060048201526001600160a01b038516906370a0823190602401602060405180830381865afa9250505080156128b3575060408051601f3d908101601f191682019092526128b09181019061326e565b60015b156128c6576128c2818361317b565b9150505b806000036128d857600091505061147d565b600554604051635dffa72d60e11b81526001600160a01b038681166004830152602482018490529091169063bbff4e5a90604401602060405180830381865afa158015612138573d6000803e3d6000fd5b6000600160681b821061298e5760405162461bcd60e51b815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e20316044820152663034206269747360c81b6064820152608401610859565b5090565b600062010000821061298e5760405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203160448201526536206269747360d01b6064820152608401610859565b6000600181600d5b81526020810191909152604001600020546001600160a01b0316919050565b600060018160036129fd565b60035460015b81811015612b09576000836001600160a01b031663f11b818860038481548110612a5a57612a5a61314f565b60009182526020909120015460405160e083901b6001600160e01b03191681526001600160a01b0390911660048201526024016040805180830381865afa158015612aa9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612acd91906131e9565b5090506001600160a01b038116612af65760405162461bcd60e51b81526004016108599061321e565b5080612b018161318e565b915050612a2e565b5050600580546001600160a01b0319166001600160a01b0392909216919091179055565b6000612b82826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612bff9092919063ffffffff16565b8051909150156115be5780806020019051810190612ba091906130b4565b6115be5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610859565b606061215c8484600085856001600160a01b0385163b612c615760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610859565b600080866001600160a01b03168587604051612c7d91906133f8565b60006040518083038185875af1925050503d8060008114612cba576040519150601f19603f3d011682016040523d82523d6000602084013e612cbf565b606091505b5091509150612ccf828286612cda565b979650505050505050565b60608315612ce9575081611a05565b825115612cf95782518084602001fd5b8160405162461bcd60e51b81526004016108599190613414565b6001600160a01b0381168114612d2857600080fd5b50565b60008060408385031215612d3e57600080fd5b8235612d4981612d13565b946020939093013593505050565b8015158114612d2857600080fd5b600080600080600060a08688031215612d7d57600080fd5b8535612d8881612d13565b94506020860135612d9881612d57565b94979496505050506040830135926060810135926080909101359150565b600060208284031215612dc857600080fd5b8135611a0581612d13565b600080600060608486031215612de857600080fd5b8335612df381612d13565b92506020840135612e0381612d13565b929592945050506040919091013590565b60008060408385031215612e2757600080fd5b8235612e3281612d13565b9150602083013563ffffffff81168114612e4b57600080fd5b809150509250929050565b6020808252825182820181905260009190848201906040850190845b81811015612eb957612ea683855180516001600160a01b031682526020808201511515908301526040908101511515910152565b9284019260609290920191600101612e72565b50909695505050505050565b60008060408385031215612ed857600080fd5b50508035926020909101359150565b80356001600160c01b031981168114612eff57600080fd5b919050565b60008060408385031215612f1757600080fd5b612d4983612ee7565b60008060008060808587031215612f3657600080fd5b843593506020850135612f4881612d13565b93969395505050506040820135916060013590565b60008060408385031215612f7057600080fd5b612f7983612ee7565b91506020830135612e4b81612d13565b600060208284031215612f9b57600080fd5b5035919050565b600080600060608486031215612fb757600080fd5b833592506020840135612fc981612d57565b91506040840135612fd981612d57565b809150509250925092565b60008060008060808587031215612ffa57600080fd5b843561300581612d13565b966020860135965060408601359560600135945092505050565b81516001600160a01b031681526020808301511515908201526040808301511515908201526060810161147d565b6020808252601690820152752837b7b61d102737ba1039bbb0b827b832b930ba37b960511b604082015260600190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b6000602082840312156130c657600080fd5b8151611a0581612d57565b60208082526010908201526f14de5cdd195b481a5cc81c185d5cd95960821b604082015260600190565b60208082526019908201527f506f6f6c3a20455448207472616e73666572206661696c656400000000000000604082015260600190565b60006020828403121561314457600080fd5b8151611a0581612d13565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b8082018082111561147d5761147d613165565b6000600182016131a0576131a0613165565b5060010190565b60208082526022908201527f43616c6c6572206973206e6f7420617574686f72697a656420746f20676f7665604082015261393760f11b606082015260800190565b600080604083850312156131fc57600080fd5b825161320781612d13565b602084015190925060ff81168114612e4b57600080fd5b60208082526030908201527f506f6f6c3a205072696365466565644f7261636c65206c61636b73206167677260408201526f1959d85d1bdc88199bdc88185cdcd95d60821b606082015260800190565b60006020828403121561328057600080fd5b5051919050565b6000806040838503121561329a57600080fd5b505080516020909101519092909150565b600181815b808511156132e65781600019048211156132cc576132cc613165565b808516156132d957918102915b93841c93908002906132b0565b509250929050565b6000826132fd5750600161147d565b8161330a5750600061147d565b8160018114613320576002811461332a57613346565b600191505061147d565b60ff84111561333b5761333b613165565b50506001821b61147d565b5060208310610133831016604e8410600b8410161715613369575081810a61147d565b61337383836132ab565b806000190482111561338757613387613165565b029392505050565b6000611a0583836132ee565b808202811582820484141761147d5761147d613165565b6000826133cf57634e487b7160e01b600052601260045260246000fd5b500490565b60005b838110156133ef5781810151838201526020016133d7565b50506000910152565b6000825161340a8184602087016133d4565b9190910192915050565b60208152600082518060208401526134338160408501602087016133d4565b601f01601f1916919091016040019291505056fea264697066735822122053bd32b80661874714ca4f33e088383db954c9fc274092f17e4da830afa5ad6964736f6c6343000812003300000000000000000000000001bfd82675dbcc7762c84019ca518e701c0cd07e000000000000000000000000cafea210b662b19bbd1692873a46be324a482672000000000000000000000000cafeaed98d7fce8f355c03c9f3507b90a974f37e000000000000000000000000d7c49cee7e9188cca6ad8ff264c1da2e69d4cf3b000000000000000000000000cafeabed7e0653afe9674a3ad862b78db3f36e60
Deployed Bytecode
0x6080604052600436106102085760003560e01c80639dd86e0f11610118578063d6abe642116100a0578063eac8f5b81161006f578063eac8f5b814610776578063eb962360146107a3578063ebb0aa48146107d9578063ee97f7f3146107f9578063fac197881461081957600080fd5b8063d6abe642146106c9578063e24ba594146106e9578063e470965a14610709578063e967eb1a1461074257600080fd5b8063b9ab9927116100e7578063b9ab992714610602578063c78557dd14610622578063cf35bdd014610642578063d100a30d14610689578063d46655f4146106a957600080fd5b80639dd86e0f1461050b578063a278bd4d1461052b578063ad4cc43e1461054b578063b2182ea91461056b57600080fd5b80634b94f50e1161019b57806367e4ac2c1161016a57806367e4ac2c1461045457806369f36c32146104765780636f2c0e151461048b57806370310cb7146104c35780638322fff2146104e357600080fd5b80634b94f50e146103df578063501b4615146103f45780635e7327ed1461041457806366fd551d1461043457600080fd5b806336a704c2116101d757806336a704c214610293578063439e2e451461038a5780634779be08146103aa57806349dcbc5e146103bf57600080fd5b806304fa850c146102145780630ea9c984146102365780632f04d7981461024b57806332102ba71461027357600080fd5b3661020f57005b600080fd5b34801561022057600080fd5b5061023461022f366004612d2b565b61082f565b005b34801561024257600080fd5b506102346109da565b34801561025757600080fd5b50610260610bf1565b6040519081526020015b60405180910390f35b34801561027f57600080fd5b5061023461028e366004612d65565b610cf1565b34801561029f57600080fd5b5061033b6102ae366004612db6565b604080516080810182526000808252602082018190529181018290526060810191909152506001600160a01b0316600090815260046020908152604091829020825160808101845290546001600160681b038082168352600160681b82041692820192909252600160d01b820463ffffffff1692810192909252600160f01b900461ffff16606082015290565b60405161026a919060006080820190506001600160681b038084511683528060208501511660208401525063ffffffff604084015116604083015261ffff606084015116606083015292915050565b34801561039657600080fd5b506102346103a5366004612dd3565b611106565b3480156103b657600080fd5b50610260600481565b3480156103cb57600080fd5b506102346103da366004612d2b565b611309565b3480156103eb57600080fd5b50610260611413565b34801561040057600080fd5b5061023461040f366004612d2b565b611483565b34801561042057600080fd5b5061023461042f366004612e14565b6115c3565b34801561044057600080fd5b5061023461044f366004612db6565b6116bc565b34801561046057600080fd5b506104696118cf565b60405161026a9190612e56565b34801561048257600080fd5b50610260611957565b34801561049757600080fd5b506006546104ab906001600160a01b031681565b6040516001600160a01b03909116815260200161026a565b3480156104cf57600080fd5b506102606104de366004612ec5565b6119e2565b3480156104ef57600080fd5b506104ab73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee81565b34801561051757600080fd5b50610234610526366004612f04565b611a0c565b34801561053757600080fd5b50610234610546366004612f20565b611aad565b34801561055757600080fd5b50610234610566366004612f5d565b611e24565b34801561057757600080fd5b506105c8610586366004612db6565b6004602052600090815260409020546001600160681b0380821691600160681b810490911690600160d01b810463ffffffff1690600160f01b900461ffff1684565b604080516001600160681b03958616815294909316602085015263ffffffff9091169183019190915261ffff16606082015260800161026a565b34801561060e57600080fd5b506005546104ab906001600160a01b031681565b34801561062e57600080fd5b5061026061063d366004612f89565b612001565b34801561064e57600080fd5b5061066261065d366004612f89565b612164565b604080516001600160a01b039094168452911515602084015215159082015260600161026a565b34801561069557600080fd5b506102346106a4366004612fa2565b6121a3565b3480156106b557600080fd5b506102346106c4366004612db6565b6122f2565b3480156106d557600080fd5b506102606106e4366004612db6565b61236c565b3480156106f557600080fd5b50610234610704366004612fe4565b6123e6565b34801561071557600080fd5b5060065461072d90600160a01b900463ffffffff1681565b60405163ffffffff909116815260200161026a565b34801561074e57600080fd5b506104ab7f000000000000000000000000d7c49cee7e9188cca6ad8ff264c1da2e69d4cf3b81565b34801561078257600080fd5b50610796610791366004612f89565b612638565b60405161026a919061301f565b3480156107af57600080fd5b506104ab6107be366004612f89565b6001602052600090815260409020546001600160a01b031681565b3480156107e557600080fd5b506102606107f4366004612f89565b612702565b34801561080557600080fd5b506000546104ab906001600160a01b031681565b34801561082557600080fd5b5061026060075481565b6006546001600160a01b031633146108625760405162461bcd60e51b81526004016108599061304d565b60405180910390fd5b60028054036108835760405162461bcd60e51b81526004016108599061307d565b6002805560005460408051600162f6c75960e01b0319815290516001600160a01b039092169163ff0938a7916004808201926020929091908290030181865afa1580156108d4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108f891906130b4565b156109155760405162461bcd60e51b8152600401610859906130d1565b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeed196001600160a01b038316016109b3576006546040516000916001600160a01b03169083908381818185875af1925050503d8060008114610987576040519150601f19603f3d011682016040523d82523d6000602084013e61098c565b606091505b50509050806109ad5760405162461bcd60e51b8152600401610859906130fb565b506109d1565b60065482906109cf906001600160a01b038084169116846127c4565b505b50506001600255565b6000546040516227050b60e31b8152614d4360f01b60048201526001600160a01b0390911690630138285890602401602060405180830381865afa158015610a26573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a4a9190613132565b6003600090815260016020527f7dfe757ecd65cbd7922a9c0161e935dd7fdbcc0e999689c7d31633896b1fc60b80546001600160a01b039384166001600160a01b0319909116179055546040516227050b60e31b815261524160f01b6004820152911690630138285890602401602060405180830381865afa158015610ad4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610af89190613132565b600d600090815260016020527f86b3fa87ee245373978e0d2d334dbde866c9b8b039036b87c5eb2fd89bcb6bab80546001600160a01b039384166001600160a01b0319909116179055546040516227050b60e31b81526126a960f11b6004820152911690630138285890602401602060405180830381865afa158015610b82573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ba69190613132565b600260005260016020527fd9d16d34ffb15ba3a3d852f0d403e2ce1d691fb54de27ac87cd2f993f3ec330f80546001600160a01b0319166001600160a01b0392909216919091179055565b6003546006546000914791600160a01b900463ffffffff16835b82811015610ce857600060038281548110610c2857610c2861314f565b60009182526020918290206040805160608101825291909201546001600160a01b038116825260ff600160a01b82048116151594830194909452600160a81b900490921615801591830191909152909150610c835750610cd6565b6000610c8f8385612816565b610c9a576000610c9e565b6007545b905082600003610cbb57610cb2818761317b565b95505050610cd6565b8151610cc79082612840565b610cd1908761317b565b955050505b80610ce08161318e565b915050610c0b565b50919392505050565b600054604051632c1a733d60e11b81523360048201526001600160a01b0390911690635834e67a90602401602060405180830381865afa158015610d39573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d5d91906130b4565b610d795760405162461bcd60e51b8152600401610859906131a7565b6001600160a01b038516610dcf5760405162461bcd60e51b815260206004820152601b60248201527f506f6f6c3a204173736574206973207a65726f206164647265737300000000006044820152606401610859565b82821015610e115760405162461bcd60e51b815260206004820152600f60248201526e2837b7b61d1036b0bc101e1036b4b760891b6044820152606401610859565b612710811115610e635760405162461bcd60e51b815260206004820152601c60248201527f506f6f6c3a204d617820736c69707061676520726174696f203e2031000000006044820152606401610859565b600554604051631e23703160e31b81526001600160a01b038781166004830152600092169063f11b8188906024016040805180830381865afa158015610ead573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ed191906131e9565b5090506001600160a01b038116610efa5760405162461bcd60e51b81526004016108599061321e565b60035460005b81811015610f895760038181548110610f1b57610f1b61314f565b6000918252602090912001546001600160a01b0390811690891603610f775760405162461bcd60e51b8152602060048201526012602482015271506f6f6c3a2041737365742065786973747360701b6044820152606401610859565b80610f818161318e565b915050610f00565b50604080516060810182526001600160a01b03808a16825288151560208301908152600083850181815260038054600181018255925293517fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b9091018054925194511515600160a81b0260ff60a81b19951515600160a01b026001600160a81b0319909416929094169190911791909117929092161790558051608081019091528061103487612929565b6001600160681b0316815260200161104b86612929565b6001600160681b031681526000602082015260400161106985612992565b61ffff9081169091526001600160a01b03909816600090815260046020908152604091829020835181549285015193850151606090950151909b16600160f01b026001600160f01b0363ffffffff909516600160d01b02949094166001600160d01b036001600160681b03948516600160681b026001600160d01b031990941694909c169390931791909117999099161717909655505050505050565b600054604051632c1a733d60e11b81523360048201526001600160a01b0390911690635834e67a90602401602060405180830381865afa15801561114e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061117291906130b4565b61118e5760405162461bcd60e51b8152600401610859906131a7565b60028054036111af5760405162461bcd60e51b81526004016108599061307d565b600280556001600160a01b038316600090815260046020526040902054600160681b90046001600160681b03161561121e5760405162461bcd60e51b8152602060048201526012602482015271506f6f6c3a204d6178206e6f74207a65726f60701b6044820152606401610859565b6001600160a01b0382166112665760405162461bcd60e51b815260206004820152600f60248201526e506f6f6c3a2044657374207a65726f60881b6044820152606401610859565b6040516370a0823160e01b815230600482015283906000906001600160a01b038316906370a0823190602401602060405180830381865afa1580156112af573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112d3919061326e565b905060008184116112e457836112e6565b815b90506112fc6001600160a01b03841686836127c4565b5050600160025550505050565b600d60005260016020527f86b3fa87ee245373978e0d2d334dbde866c9b8b039036b87c5eb2fd89bcb6bab546001600160a01b0316331461137d5760405162461bcd60e51b815260206004820152600e60248201526d506f6f6c3a204e6f742052616d6d60901b6044820152606401610859565b600280540361139e5760405162461bcd60e51b81526004016108599061307d565b600280556040516000906001600160a01b0384169083908381818185875af1925050503d80600081146113ed576040519150601f19603f3d011682016040523d82523d6000602084013e6113f2565b606091505b50509050806109cf5760405162461bcd60e51b8152600401610859906130fb565b600061141d6129f5565b6001600160a01b031663dd8cf9636040518163ffffffff1660e01b81526004016040805180830381865afa158015611459573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061147d9190613287565b92915050565b6006546001600160a01b031633146114ad5760405162461bcd60e51b81526004016108599061304d565b60008054906101000a90046001600160a01b03166001600160a01b031663ff0938a76040518163ffffffff1660e01b8152600401602060405180830381865afa1580156114fe573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061152291906130b4565b1561153f5760405162461bcd60e51b8152600401610859906130d1565b600061154a8361236c565b6007839055905081156115ad57600654600160a01b900463ffffffff161561158557604051636037020160e11b815260040160405180910390fd5b6006805463ffffffff6001841b16600160a01b0263ffffffff60a01b19909116179055505050565b6006805463ffffffff60a01b191690555b505050565b6006546001600160a01b031633146115ed5760405162461bcd60e51b81526004016108599061304d565b60008054906101000a90046001600160a01b03166001600160a01b031663ff0938a76040518163ffffffff1660e01b8152600401602060405180830381865afa15801561163e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061166291906130b4565b1561167f5760405162461bcd60e51b8152600401610859906130d1565b6001600160a01b039091166000908152600460205260409020805463ffffffff909216600160d01b0263ffffffff60d01b19909216919091179055565b6000546001600160a01b031615611714576000546001600160a01b031633146117145760405162461bcd60e51b815260206004820152600a6024820152692737ba1036b0b9ba32b960b11b6044820152606401610859565b60028054036117355760405162461bcd60e51b81526004016108599061307d565b600280556040516000906001600160a01b0383169047908381818185875af1925050503d8060008114611784576040519150601f19603f3d011682016040523d82523d6000602084013e611789565b606091505b50509050806117d25760405162461bcd60e51b8152602060048201526015602482015274141bdbdb0e88151c985b9cd9995c8819985a5b1959605a1b6044820152606401610859565b60035460015b818110156118c457600381815481106117f3576117f361314f565b600091825260209091200154600160a81b900460ff166118b2576000600382815481106118225761182261314f565b60009182526020822001546040516370a0823160e01b81523060048201526001600160a01b03909116925082906370a0823190602401602060405180830381865afa158015611875573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611899919061326e565b90506118af6001600160a01b03831687836127c4565b50505b806118bc8161318e565b9150506117d8565b505060016002555050565b60606003805480602002602001604051908101604052809291908181526020016000905b8282101561194e57600084815260209081902060408051606081018252918501546001600160a01b038116835260ff600160a01b82048116151584860152600160a81b909104161515908201528252600190920191016118f3565b50505050905090565b600080611962610bf1565b9050600061196e612a1c565b6001600160a01b03166344936b106040518163ffffffff1660e01b8152600401602060405180830381865afa1580156119ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119cf919061326e565b90506119db82826119e2565b9250505090565b6000816119f16004600a61338f565b6119fb908561339b565b611a0591906133b2565b9392505050565b600054604051632c1a733d60e11b81523360048201526001600160a01b0390911690635834e67a90602401602060405180830381865afa158015611a54573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a7891906130b4565b611a945760405162461bcd60e51b8152600401610859906131a7565b604051630686182560e11b815260040160405180910390fd5b6000546040516323c5b10760e21b81523360048201526001600160a01b0390911690638f16c41c90602401602060405180830381865afa158015611af5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b1991906130b4565b611b705760405162461bcd60e51b815260206004820152602260248201527f43616c6c6572206973206e6f7420616e20696e7465726e616c20636f6e74726160448201526118dd60f21b6064820152608401610859565b6002805403611b915760405162461bcd60e51b81526004016108599061307d565b60028081905550600060038581548110611bad57611bad61314f565b60009182526020918290206040805160608101825292909101546001600160a01b03811680845260ff600160a01b83048116151595850195909552600160a81b909104909316151590820152915073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeed1901611c8f576000846001600160a01b03168460405160006040518083038185875af1925050503d8060008114611c63576040519150601f19603f3d011682016040523d82523d6000602084013e611c68565b606091505b5050905080611c895760405162461bcd60e51b8152600401610859906130fb565b50611ca5565b8051611ca5906001600160a01b031685856127c4565b8115611d63576000846001600160a01b03168360405160006040518083038185875af1925050503d8060008114611cf8576040519150601f19603f3d011682016040523d82523d6000602084013e611cfd565b606091505b5050905080611d1e5760405162461bcd60e51b8152600401610859906130fb565b846001600160a01b03167fa09244c122a83074363635dc89ce0098166c2f74827960ff64a7c8e6ad1c57a284604051611d5991815260200190565b60405180910390a2505b80600001516001600160a01b0316846001600160a01b03167febe7adb4feddf2afa5de463169fdc706254a55c9cf2b930ac84bb49e28cfe6bb85604051611dac91815260200190565b60405180910390a3611dbc612a1c565b604051631b2622ff60e11b8152600160048201526001600160a01b03919091169063364c45fe90602401600060405180830381600087803b158015611e0057600080fd5b505af1158015611e14573d6000803e3d6000fd5b5050600160025550505050505050565b600054604051632c1a733d60e11b81523360048201526001600160a01b0390911690635834e67a90602401602060405180830381865afa158015611e6c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e9091906130b4565b611eac5760405162461bcd60e51b8152600401610859906131a7565b6001600160c01b031982166505357505f4f560d41b03611fd8576006546001600160a01b031615611fb757600660009054906101000a90046001600160a01b03166001600160a01b03166341e007516040518163ffffffff1660e01b8152600401602060405180830381865afa158015611f2a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f4e91906130b4565b15611fb75760405162461bcd60e51b815260206004820152603360248201527f506f6f6c3a2043616e63656c20616c6c207377617073206265666f726520636860448201527230b733b4b7339039bbb0b827b832b930ba37b960691b6064820152608401610859565b600680546001600160a01b0383166001600160a01b03199091161790555050565b6001600160c01b0319821667141490d7d191515160c21b03611a9457611ffd81612a28565b5050565b60035460009082106120515760405162461bcd60e51b8152602060048201526019602482015278141bdbdb0e88155b9adb9bdddb8818dbdd995c88185cdcd95d603a1b6044820152606401610859565b6000600383815481106120665761206661314f565b60009182526020822001546001600160a01b031691506120846129f5565b6001600160a01b031663e00256646040518163ffffffff1660e01b8152600401602060405180830381865afa1580156120c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120e5919061326e565b600554604051632ae2073360e11b81526001600160a01b038581166004830152602482018490529293509116906355c40e6690604401602060405180830381865afa158015612138573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061215c919061326e565b949350505050565b6003818154811061217457600080fd5b6000918252602090912001546001600160a01b038116915060ff600160a01b8204811691600160a81b90041683565b600054604051632c1a733d60e11b81523360048201526001600160a01b0390911690635834e67a90602401602060405180830381865afa1580156121eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061220f91906130b4565b61222b5760405162461bcd60e51b8152600401610859906131a7565b600354831061227c5760405162461bcd60e51b815260206004820152601a60248201527f506f6f6c3a20417373657420646f6573206e6f742065786973740000000000006044820152606401610859565b81600384815481106122905761229061314f565b9060005260206000200160000160146101000a81548160ff02191690831515021790555080600384815481106122c8576122c861314f565b60009182526020909120018054911515600160a81b0260ff60a81b19909216919091179055505050565b6000546001600160a01b03161561234a576000546001600160a01b0316331461234a5760405162461bcd60e51b815260206004820152600a6024820152692737ba1036b0b9ba32b960b11b6044820152606401610859565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b600354600090815b818110156123cc57836001600160a01b0316600382815481106123995761239961314f565b6000918252602090912001546001600160a01b0316036123ba579392505050565b806123c48161318e565b915050612374565b5060405163470cbf4760e01b815260040160405180910390fd5b600054604051632c1a733d60e11b81523360048201526001600160a01b0390911690635834e67a90602401602060405180830381865afa15801561242e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061245291906130b4565b61246e5760405162461bcd60e51b8152600401610859906131a7565b818311156124b05760405162461bcd60e51b815260206004820152600f60248201526e0a0deded87440dad2dc407c40dac2f608b1b6044820152606401610859565b6127108111156125025760405162461bcd60e51b815260206004820152601c60248201527f506f6f6c3a204d617820736c69707061676520726174696f203e2031000000006044820152606401610859565b60035460005b818110156123cc57600381815481106125235761252361314f565b6000918252602090912001546001600160a01b03908116908716036126205761254b85612929565b6001600160a01b038716600090815260046020526040902080546cffffffffffffffffffffffffff19166001600160681b039290921691909117905561259084612929565b6001600160a01b038716600090815260046020526040902080546001600160681b0392909216600160681b026cffffffffffffffffffffffffff60681b199092169190911790556125e083612992565b6001600160a01b0387166000908152600460205260409020805461ffff92909216600160f01b026001600160f01b03909216919091179055506126329050565b8061262a8161318e565b915050612508565b50505050565b6040805160608101825260008082526020820181905291810191909152600354821061269f5760405162461bcd60e51b8152602060048201526016602482015275141bdbdb0e88125b9d985b1a5908185cdcd95d081a5960521b6044820152606401610859565b600382815481106126b2576126b261314f565b60009182526020918290206040805160608101825291909201546001600160a01b038116825260ff600160a01b82048116151594830194909452600160a81b900490921615159082015292915050565b60035460009082106127525760405162461bcd60e51b8152602060048201526019602482015278141bdbdb0e88155b9adb9bdddb8818dbdd995c88185cdcd95d603a1b6044820152606401610859565b6000600383815481106127675761276761314f565b60009182526020822001546001600160a01b031691506127856129f5565b6001600160a01b03166318d458346040518163ffffffff1660e01b81526004016020604051808303816000875af11580156120c1573d6000803e3d6000fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526115be908490612b2d565b6000811580159061282a57506001831b8216155b156128375750600061147d565b50600192915050565b6000816001600160a01b0384163b156128c6576040516370a0823160e01b81523060048201526001600160a01b038516906370a0823190602401602060405180830381865afa9250505080156128b3575060408051601f3d908101601f191682019092526128b09181019061326e565b60015b156128c6576128c2818361317b565b9150505b806000036128d857600091505061147d565b600554604051635dffa72d60e11b81526001600160a01b038681166004830152602482018490529091169063bbff4e5a90604401602060405180830381865afa158015612138573d6000803e3d6000fd5b6000600160681b821061298e5760405162461bcd60e51b815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e20316044820152663034206269747360c81b6064820152608401610859565b5090565b600062010000821061298e5760405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203160448201526536206269747360d01b6064820152608401610859565b6000600181600d5b81526020810191909152604001600020546001600160a01b0316919050565b600060018160036129fd565b60035460015b81811015612b09576000836001600160a01b031663f11b818860038481548110612a5a57612a5a61314f565b60009182526020909120015460405160e083901b6001600160e01b03191681526001600160a01b0390911660048201526024016040805180830381865afa158015612aa9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612acd91906131e9565b5090506001600160a01b038116612af65760405162461bcd60e51b81526004016108599061321e565b5080612b018161318e565b915050612a2e565b5050600580546001600160a01b0319166001600160a01b0392909216919091179055565b6000612b82826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612bff9092919063ffffffff16565b8051909150156115be5780806020019051810190612ba091906130b4565b6115be5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610859565b606061215c8484600085856001600160a01b0385163b612c615760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610859565b600080866001600160a01b03168587604051612c7d91906133f8565b60006040518083038185875af1925050503d8060008114612cba576040519150601f19603f3d011682016040523d82523d6000602084013e612cbf565b606091505b5091509150612ccf828286612cda565b979650505050505050565b60608315612ce9575081611a05565b825115612cf95782518084602001fd5b8160405162461bcd60e51b81526004016108599190613414565b6001600160a01b0381168114612d2857600080fd5b50565b60008060408385031215612d3e57600080fd5b8235612d4981612d13565b946020939093013593505050565b8015158114612d2857600080fd5b600080600080600060a08688031215612d7d57600080fd5b8535612d8881612d13565b94506020860135612d9881612d57565b94979496505050506040830135926060810135926080909101359150565b600060208284031215612dc857600080fd5b8135611a0581612d13565b600080600060608486031215612de857600080fd5b8335612df381612d13565b92506020840135612e0381612d13565b929592945050506040919091013590565b60008060408385031215612e2757600080fd5b8235612e3281612d13565b9150602083013563ffffffff81168114612e4b57600080fd5b809150509250929050565b6020808252825182820181905260009190848201906040850190845b81811015612eb957612ea683855180516001600160a01b031682526020808201511515908301526040908101511515910152565b9284019260609290920191600101612e72565b50909695505050505050565b60008060408385031215612ed857600080fd5b50508035926020909101359150565b80356001600160c01b031981168114612eff57600080fd5b919050565b60008060408385031215612f1757600080fd5b612d4983612ee7565b60008060008060808587031215612f3657600080fd5b843593506020850135612f4881612d13565b93969395505050506040820135916060013590565b60008060408385031215612f7057600080fd5b612f7983612ee7565b91506020830135612e4b81612d13565b600060208284031215612f9b57600080fd5b5035919050565b600080600060608486031215612fb757600080fd5b833592506020840135612fc981612d57565b91506040840135612fd981612d57565b809150509250925092565b60008060008060808587031215612ffa57600080fd5b843561300581612d13565b966020860135965060408601359560600135945092505050565b81516001600160a01b031681526020808301511515908201526040808301511515908201526060810161147d565b6020808252601690820152752837b7b61d102737ba1039bbb0b827b832b930ba37b960511b604082015260600190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b6000602082840312156130c657600080fd5b8151611a0581612d57565b60208082526010908201526f14de5cdd195b481a5cc81c185d5cd95960821b604082015260600190565b60208082526019908201527f506f6f6c3a20455448207472616e73666572206661696c656400000000000000604082015260600190565b60006020828403121561314457600080fd5b8151611a0581612d13565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b8082018082111561147d5761147d613165565b6000600182016131a0576131a0613165565b5060010190565b60208082526022908201527f43616c6c6572206973206e6f7420617574686f72697a656420746f20676f7665604082015261393760f11b606082015260800190565b600080604083850312156131fc57600080fd5b825161320781612d13565b602084015190925060ff81168114612e4b57600080fd5b60208082526030908201527f506f6f6c3a205072696365466565644f7261636c65206c61636b73206167677260408201526f1959d85d1bdc88199bdc88185cdcd95d60821b606082015260800190565b60006020828403121561328057600080fd5b5051919050565b6000806040838503121561329a57600080fd5b505080516020909101519092909150565b600181815b808511156132e65781600019048211156132cc576132cc613165565b808516156132d957918102915b93841c93908002906132b0565b509250929050565b6000826132fd5750600161147d565b8161330a5750600061147d565b8160018114613320576002811461332a57613346565b600191505061147d565b60ff84111561333b5761333b613165565b50506001821b61147d565b5060208310610133831016604e8410600b8410161715613369575081810a61147d565b61337383836132ab565b806000190482111561338757613387613165565b029392505050565b6000611a0583836132ee565b808202811582820484141761147d5761147d613165565b6000826133cf57634e487b7160e01b600052601260045260246000fd5b500490565b60005b838110156133ef5781810151838201526020016133d7565b50506000910152565b6000825161340a8184602087016133d4565b9190910192915050565b60208152600082518060208401526134338160408501602087016133d4565b601f01601f1916919091016040019291505056fea264697066735822122053bd32b80661874714ca4f33e088383db954c9fc274092f17e4da830afa5ad6964736f6c63430008120033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000001bfd82675dbcc7762c84019ca518e701c0cd07e000000000000000000000000cafea210b662b19bbd1692873a46be324a482672000000000000000000000000cafeaed98d7fce8f355c03c9f3507b90a974f37e000000000000000000000000d7c49cee7e9188cca6ad8ff264c1da2e69d4cf3b000000000000000000000000cafeabed7e0653afe9674a3ad862b78db3f36e60
-----Decoded View---------------
Arg [0] : _master (address): 0x01BFd82675DBCc7762C84019cA518e701C0cD07e
Arg [1] : _priceOracle (address): 0xcafea210B662b19bbd1692873A46be324a482672
Arg [2] : _swapOperator (address): 0xcafeaed98d7Fce8F355C03c9F3507B90a974f37e
Arg [3] : _nxmTokenAddress (address): 0xd7c49CEE7E9188cCa6AD8FF264C1DA2e69D4Cf3B
Arg [4] : _previousPool (address): 0xcafeaBED7e0653aFe9674A3ad862b78DB3F36e60
-----Encoded View---------------
5 Constructor Arguments found :
Arg [0] : 00000000000000000000000001bfd82675dbcc7762c84019ca518e701c0cd07e
Arg [1] : 000000000000000000000000cafea210b662b19bbd1692873a46be324a482672
Arg [2] : 000000000000000000000000cafeaed98d7fce8f355c03c9f3507b90a974f37e
Arg [3] : 000000000000000000000000d7c49cee7e9188cca6ad8ff264c1da2e69d4cf3b
Arg [4] : 000000000000000000000000cafeabed7e0653afe9674a3ad862b78db3f36e60
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|---|---|---|---|---|
ETH | 56.79% | $3,788.11 | 29,723.7497 | $112,596,833.63 | |
ETH | 28.70% | $4,259.42 | 13,358.3402 | $56,898,781.4 | |
ETH | Ether (ETH) | 13.99% | $3,795.75 | 7,309.7631 | $27,746,069.02 |
ETH | 0.26% | $0.998328 | 518,169.4016 | $517,303.02 | |
ETH | 0.25% | $0.999594 | 490,858.3328 | $490,659.04 | |
ETH | <0.01% | $97,111 | 0.0232 | $2,257.24 | |
BSC | <0.01% | $1.86 | 5,874.897 | $10,951.13 |
Loading...
Loading
[ Download: CSV Export ]
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.