Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Name:
FlexiblePortfolio
Compiler Version
v0.8.10+commit.fc410830
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.10; import {IERC721Receiver} from "IERC721Receiver.sol"; import {Address} from "Address.sol"; import {SafeERC20} from "SafeERC20.sol"; import {ERC20Upgradeable, IERC20Upgradeable, IERC20MetadataUpgradeable} from "ERC20Upgradeable.sol"; import {AccessControlEnumerableUpgradeable} from "AccessControlEnumerableUpgradeable.sol"; import {IERC165} from "IERC165.sol"; import {IERC20} from "IERC20.sol"; import {IERC20Metadata} from "ERC20.sol"; import {IFlexiblePortfolio} from "IFlexiblePortfolio.sol"; import {IDebtInstrument} from "IDebtInstrument.sol"; import {IERC4626} from "IERC4626.sol"; import {IProtocolConfig} from "IProtocolConfig.sol"; import {IValuationStrategy} from "IValuationStrategy.sol"; import {ITransferController} from "ITransferController.sol"; import {IDepositController} from "IDepositController.sol"; import {IWithdrawController} from "IWithdrawController.sol"; import {IFeeStrategy} from "IFeeStrategy.sol"; import {Upgradeable} from "Upgradeable.sol"; contract FlexiblePortfolio is IFlexiblePortfolio, ERC20Upgradeable, Upgradeable { using SafeERC20 for IERC20Metadata; using Address for address; uint256 internal constant YEAR = 365 days; uint256 public constant BASIS_PRECISION = 10000; bytes32 public constant MANAGER_ROLE = keccak256("MANAGER_ROLE"); bytes32 public constant CONTROLLER_ADMIN_ROLE = keccak256("CONTROLLER_ADMIN_ROLE"); IERC20Metadata public asset; uint8 internal _decimals; uint256 public endDate; uint256 public maxSize; IProtocolConfig public protocolConfig; mapping(IDebtInstrument => bool) public isInstrumentAllowed; address public managerFeeBeneficiary; uint256 public virtualTokenBalance; uint256 public lastProtocolFeeRate; uint256 public lastManagerFeeRate; uint256 public unpaidProtocolFee; uint256 public unpaidManagerFee; uint256 internal lastUpdateTime; uint256 internal highestInstrumentEndDate; IValuationStrategy public valuationStrategy; IDepositController public depositController; IWithdrawController public withdrawController; ITransferController public transferController; IFeeStrategy public feeStrategy; mapping(IDebtInstrument => mapping(uint256 => bool)) public isInstrumentAdded; event InstrumentAdded(IDebtInstrument indexed instrument, uint256 indexed instrumentId); event InstrumentFunded(IDebtInstrument indexed instrument, uint256 indexed instrumentId); event InstrumentUpdated(IDebtInstrument indexed instrument); event AllowedInstrumentChanged(IDebtInstrument indexed instrument, bool isAllowed); event InstrumentRepaid(IDebtInstrument indexed instrument, uint256 indexed instrumentId, uint256 amount); event MaxSizeChanged(uint256 newMaxSize); event ManagerFeeBeneficiaryChanged(address indexed managerFeeBeneficiary); event ValuationStrategyChanged(IValuationStrategy indexed newStrategy); event DepositControllerChanged(IDepositController indexed newController); event WithdrawControllerChanged(IWithdrawController indexed newController); event TransferControllerChanged(ITransferController indexed newController); event FeeStrategyChanged(IFeeStrategy indexed newStrategy); event FeePaid(address indexed protocolAddress, uint256 amount); function initialize( IProtocolConfig _protocolConfig, uint256 _duration, IERC20Metadata _asset, address _manager, uint256 _maxSize, Controllers calldata _controllers, IDebtInstrument[] calldata _allowedInstruments, ERC20Metadata calldata tokenMetadata ) external initializer { require(_duration > 0, "FP:Duration can't be 0"); __Upgradeable_init(_protocolConfig.protocolAdmin(), _protocolConfig.pauserAddress()); __ERC20_init(tokenMetadata.name, tokenMetadata.symbol); _grantRole(MANAGER_ROLE, _manager); _grantRole(CONTROLLER_ADMIN_ROLE, _manager); _setManagerFeeBeneficiary(_manager); protocolConfig = _protocolConfig; endDate = block.timestamp + _duration; asset = _asset; maxSize = _maxSize; _decimals = _asset.decimals(); _setDepositController(_controllers.depositController); _setWithdrawController(_controllers.withdrawController); _setTransferController(_controllers.transferController); _setFeeStrategy(_controllers.feeStrategy); valuationStrategy = _controllers.valuationStrategy; for (uint256 i; i < _allowedInstruments.length; i++) { isInstrumentAllowed[_allowedInstruments[i]] = true; } } // -- ERC20 metadata -- function decimals() public view virtual override(ERC20Upgradeable, IERC20MetadataUpgradeable) returns (uint8) { return _decimals; } // -- ERC4626 methods -- function totalAssets() public view override returns (uint256) { (uint256 _totalAssets, , ) = getTotalAssetsAndFee(); return _totalAssets; } /* @notice This contract is upgradeable and interacts with settable deposit controllers, * that may change over the contract's lifespan. As a safety measure, we recommend approving * this contract with the desired deposit amount instead of performing infinite allowance. */ function deposit(uint256 assets, address receiver) external override whenNotPaused returns (uint256) { (uint256 shares, uint256 depositFee) = depositController.onDeposit(msg.sender, assets, receiver); _executeDeposit(receiver, shares, assets, depositFee); return shares; } function mint(uint256 shares, address receiver) external whenNotPaused returns (uint256) { (uint256 assets, uint256 mintFee) = depositController.onMint(msg.sender, shares, receiver); _executeDeposit(receiver, shares, assets + mintFee, mintFee); return assets + mintFee; } function _executeDeposit( address receiver, uint256 shares, uint256 transferredAssets, uint256 actionFee ) internal { require(receiver != address(this), "FP:Wrong receiver/owner"); require(block.timestamp < endDate, "FP:End date elapsed"); require(transferredAssets >= actionFee, "FP:Fee bigger than assets"); uint256 depositedAssets = transferredAssets - actionFee; require(depositedAssets > 0 && shares > 0, "FP:Operation not allowed"); (uint256 _totalAssets, uint256 protocolFee, uint256 managerFee) = getTotalAssetsAndFee(); require(depositedAssets + _totalAssets <= maxSize, "FP:Portfolio is full"); update(); virtualTokenBalance += transferredAssets; _mint(receiver, shares); asset.safeTransferFrom(msg.sender, address(this), transferredAssets); payAllFees(actionFee, protocolFee, managerFee); emit Deposit(msg.sender, receiver, transferredAssets, shares); } function withdraw( uint256 assets, address receiver, address owner ) external whenNotPaused returns (uint256) { (uint256 shares, uint256 withdrawFee) = withdrawController.onWithdraw(msg.sender, assets, receiver, owner); _executeWithdraw(owner, receiver, shares, assets, withdrawFee); return shares; } function redeem( uint256 shares, address receiver, address owner ) external virtual whenNotPaused returns (uint256) { (uint256 assets, uint256 redeemFee) = withdrawController.onRedeem(msg.sender, shares, receiver, owner); _executeWithdraw(owner, receiver, shares, assets, redeemFee); return assets; } function _executeWithdraw( address owner, address receiver, uint256 shares, uint256 assets, uint256 actionFee ) internal { require(receiver != address(this) && owner != address(this), "FP:Wrong receiver/owner"); require(assets > 0 && shares > 0, "FP:Operation not allowed"); (uint256 protocolFee, uint256 managerFee) = getFees(); require(assets + protocolFee + managerFee + actionFee <= virtualTokenBalance, "FP:Not enough liquidity"); update(); _burnFrom(owner, msg.sender, shares); virtualTokenBalance -= assets; asset.safeTransfer(receiver, assets); payAllFees(actionFee, protocolFee, managerFee); emit Withdraw(msg.sender, receiver, owner, assets, shares); } function previewDeposit(uint256 assets) external view returns (uint256) { require(block.timestamp < endDate, "FP:End date elapsed"); return depositController.previewDeposit(assets); } function previewMint(uint256 shares) external view returns (uint256) { require(block.timestamp < endDate, "FP:End date elapsed"); return depositController.previewMint(shares); } function previewWithdraw(uint256 assets) public view returns (uint256) { return withdrawController.previewWithdraw(assets); } function previewRedeem(uint256 shares) external view virtual returns (uint256) { return withdrawController.previewRedeem(shares); } function maxDeposit(address receiver) external view returns (uint256) { if (paused() || block.timestamp >= endDate) { return 0; } if (totalAssets() >= maxSize) { return 0; } return depositController.maxDeposit(receiver); } function maxMint(address receiver) external view returns (uint256) { if (paused() || block.timestamp >= endDate) { return 0; } if (totalAssets() >= maxSize) { return 0; } return depositController.maxMint(receiver); } function maxWithdraw(address owner) external view virtual returns (uint256) { if (paused()) { return 0; } return withdrawController.maxWithdraw(owner); } function maxRedeem(address owner) external view returns (uint256) { if (paused()) { return 0; } return withdrawController.maxRedeem(owner); } function convertToAssets(uint256 sharesAmount) public view returns (uint256) { uint256 _totalSupply = totalSupply(); if (_totalSupply == 0) { return 0; } return (sharesAmount * totalAssets()) / _totalSupply; } function convertToShares(uint256 assets) public view returns (uint256) { uint256 _totalSupply = totalSupply(); if (_totalSupply == 0) { return assets; } else { uint256 _totalAssets = totalAssets(); require(_totalAssets > 0, "FP:Infinite value"); return (assets * _totalSupply) / _totalAssets; } } // -- Portfolio methods -- function allowInstrument(IDebtInstrument instrument, bool isAllowed) external onlyRole(MANAGER_ROLE) { isInstrumentAllowed[instrument] = isAllowed; emit AllowedInstrumentChanged(instrument, isAllowed); } function addInstrument(IDebtInstrument instrument, bytes calldata issueInstrumentCalldata) external onlyRole(MANAGER_ROLE) returns (uint256) { bytes memory result = _executeInstrumentFunctionCall(instrument, instrument.issueInstrumentSelector, issueInstrumentCalldata); uint256 instrumentId = abi.decode(result, (uint256)); require(instrument.asset(instrumentId) == asset, "FP:Token mismatch"); isInstrumentAdded[instrument][instrumentId] = true; emit InstrumentAdded(instrument, instrumentId); return instrumentId; } function _executeInstrumentFunctionCall( IDebtInstrument instrument, function() external returns (bytes4) functionSelector, bytes calldata functionCallData ) internal returns (bytes memory) { require(isInstrumentAllowed[instrument], "FP:Instrument not allowed"); require(functionSelector() == bytes4(functionCallData), "FP:Invalid function call"); return address(instrument).functionCall(functionCallData); } function fundInstrument(IDebtInstrument instrument, uint256 instrumentId) external onlyRole(MANAGER_ROLE) { require(isInstrumentAdded[instrument][instrumentId], "FP:Instrument not added"); (uint256 protocolFee, uint256 managerFee) = getFees(); address borrower = instrument.recipient(instrumentId); uint256 principalAmount = instrument.principal(instrumentId); instrument.start(instrumentId); uint256 instrumentEndDate = instrument.endDate(instrumentId); require(principalAmount + protocolFee + managerFee <= virtualTokenBalance, "FP:Not enough liquidity"); require(instrumentEndDate <= endDate, "FP:Instrument has bigger endDate"); updateHighestInstrumentEndDate(instrumentEndDate); update(); virtualTokenBalance -= principalAmount; payAllFees(0, protocolFee, managerFee); valuationStrategy.onInstrumentFunded(this, instrument, instrumentId); asset.safeTransfer(borrower, principalAmount); emit InstrumentFunded(instrument, instrumentId); } function updateInstrument(IDebtInstrument instrument, bytes calldata updateInstrumentCalldata) external onlyRole(MANAGER_ROLE) { _executeInstrumentFunctionCall(instrument, instrument.updateInstrumentSelector, updateInstrumentCalldata); emit InstrumentUpdated(instrument); } function updateHighestInstrumentEndDate(uint256 instrumentEndDate) internal { if (instrumentEndDate > highestInstrumentEndDate) { highestInstrumentEndDate = instrumentEndDate; } } function cancelInstrument(IDebtInstrument instrument, uint256 instrumentId) external onlyRole(MANAGER_ROLE) { instrument.cancel(instrumentId); valuationStrategy.onInstrumentUpdated(this, instrument, instrumentId); } function markInstrumentAsDefaulted(IDebtInstrument instrument, uint256 instrumentId) external onlyRole(MANAGER_ROLE) { instrument.markAsDefaulted(instrumentId); valuationStrategy.onInstrumentUpdated(this, instrument, instrumentId); } function repay( IDebtInstrument instrument, uint256 instrumentId, uint256 assets ) external whenNotPaused { require(assets > 0, "FP:Amount can't be 0"); require(instrument.recipient(instrumentId) == msg.sender, "FP:Wrong recipient"); require(isInstrumentAdded[instrument][instrumentId], "FP:Instrument not added"); (uint256 protocolFee, uint256 managerFee) = getFees(); instrument.repay(instrumentId, assets); valuationStrategy.onInstrumentUpdated(this, instrument, instrumentId); update(); virtualTokenBalance += assets; asset.safeTransferFrom(msg.sender, address(this), assets); payAllFees(0, protocolFee, managerFee); emit InstrumentRepaid(instrument, instrumentId, assets); } function liquidAssets() public view returns (uint256) { (uint256 protocolFee, uint256 managerFee) = getFees(); uint256 dueFees = protocolFee + managerFee; return virtualTokenBalance > dueFees ? virtualTokenBalance - dueFees : 0; } function updateAndPayFee() external whenNotPaused { (uint256 protocolFee, uint256 managerFee) = getFees(); update(); payAllFees(0, protocolFee, managerFee); } function update() internal { lastUpdateTime = block.timestamp; lastProtocolFeeRate = protocolConfig.protocolFeeRate(); lastManagerFeeRate = feeStrategy.managerFeeRate(); } function payAllFees( uint256 managerActionFee, uint256 protocolFee, uint256 managerContinuousFee ) internal { // Caller must have already checked that the action fee is payable. // A managerActionFee must always be paid first before any other fee. assert(virtualTokenBalance >= managerActionFee); virtualTokenBalance -= managerActionFee; emit FeePaid(managerFeeBeneficiary, managerActionFee); uint256 paidProtocolFee; (unpaidProtocolFee, paidProtocolFee) = splitUnpaidAndPaidFee(protocolFee); virtualTokenBalance -= paidProtocolFee; address protocolTreasury = protocolConfig.protocolTreasury(); emit FeePaid(protocolTreasury, paidProtocolFee); uint256 paidManagerContinuousFee; (unpaidManagerFee, paidManagerContinuousFee) = splitUnpaidAndPaidFee(managerContinuousFee); virtualTokenBalance -= paidManagerContinuousFee; emit FeePaid(managerFeeBeneficiary, paidManagerContinuousFee); asset.safeTransfer(protocolTreasury, paidProtocolFee); asset.safeTransfer(managerFeeBeneficiary, managerActionFee + paidManagerContinuousFee); } function splitUnpaidAndPaidFee(uint256 fee) private view returns (uint256, uint256) { uint256 unpaidFee; uint256 paidFee; if (virtualTokenBalance < fee) { unpaidFee = fee - virtualTokenBalance; paidFee = virtualTokenBalance; } else { unpaidFee = 0; paidFee = fee; } return (unpaidFee, paidFee); } function getFees() public view returns (uint256 protocolFee, uint256 managerFee) { (, protocolFee, managerFee) = getTotalAssetsAndFee(); return (protocolFee, managerFee); } function getTotalAssetsAndFee() internal view returns ( uint256 _totalAssets, uint256 protocolFee, uint256 managerFee ) { _totalAssets = virtualTokenBalance + valuationStrategy.calculateValue(this); uint256 unpaidFees = unpaidProtocolFee + unpaidManagerFee; protocolFee = unpaidProtocolFee; managerFee = unpaidManagerFee; if (_totalAssets <= unpaidFees) { return (0, protocolFee, managerFee); } _totalAssets -= unpaidFees; // lastUpdateTime can only be updated to block.timestamp in this contract, // so this should always be true (assuming a monotone clock and no reordering). assert(block.timestamp >= lastUpdateTime); uint256 timeAdjustedTotalAssets = _totalAssets * (block.timestamp - lastUpdateTime); uint256 accruedProtocolFee = (timeAdjustedTotalAssets * lastProtocolFeeRate) / YEAR / BASIS_PRECISION; uint256 accruedManagerFee = (timeAdjustedTotalAssets * lastManagerFeeRate) / YEAR / BASIS_PRECISION; uint256 accruedFees = accruedProtocolFee + accruedManagerFee; protocolFee += accruedProtocolFee; managerFee += accruedManagerFee; if (_totalAssets <= accruedFees) { return (0, protocolFee, managerFee); } _totalAssets -= accruedFees; return (_totalAssets, protocolFee, managerFee); } // -- Setters -- function setWithdrawController(IWithdrawController _withdrawController) external onlyRole(CONTROLLER_ADMIN_ROLE) { require(_withdrawController != withdrawController, "FP:Value has to be different"); _setWithdrawController(_withdrawController); } function _setWithdrawController(IWithdrawController _withdrawController) private { withdrawController = _withdrawController; emit WithdrawControllerChanged(_withdrawController); } function setDepositController(IDepositController _depositController) external onlyRole(CONTROLLER_ADMIN_ROLE) { require(_depositController != depositController, "FP:Value has to be different"); _setDepositController(_depositController); } function _setDepositController(IDepositController _depositController) private { depositController = _depositController; emit DepositControllerChanged(_depositController); } function setTransferController(ITransferController _transferController) external onlyRole(CONTROLLER_ADMIN_ROLE) { require(_transferController != transferController, "FP:Value has to be different"); _setTransferController(_transferController); } function _setTransferController(ITransferController _transferController) internal { transferController = _transferController; emit TransferControllerChanged(_transferController); } function setFeeStrategy(IFeeStrategy _feeStrategy) external onlyRole(CONTROLLER_ADMIN_ROLE) { require(_feeStrategy != feeStrategy, "FP:Value has to be different"); _setFeeStrategy(_feeStrategy); } function _setFeeStrategy(IFeeStrategy _feeStrategy) internal { feeStrategy = _feeStrategy; emit FeeStrategyChanged(_feeStrategy); } function setValuationStrategy(IValuationStrategy _valuationStrategy) external onlyRole(CONTROLLER_ADMIN_ROLE) { require(_valuationStrategy != valuationStrategy, "FP:Value has to be different"); valuationStrategy = _valuationStrategy; emit ValuationStrategyChanged(_valuationStrategy); } function setMaxSize(uint256 _maxSize) external onlyRole(MANAGER_ROLE) { require(_maxSize != maxSize, "FP:Value has to be different"); maxSize = _maxSize; emit MaxSizeChanged(_maxSize); } function setEndDate(uint256 newEndDate) external onlyRole(MANAGER_ROLE) { require(endDate > block.timestamp, "FP:End date elapsed"); require( newEndDate < endDate && newEndDate > highestInstrumentEndDate && newEndDate > block.timestamp, "FP:New endDate too big" ); endDate = newEndDate; } function setManagerFeeBeneficiary(address newManagerFeeBeneficiary) external onlyRole(MANAGER_ROLE) { require(managerFeeBeneficiary != newManagerFeeBeneficiary, "FP:Value has to be different"); _setManagerFeeBeneficiary(newManagerFeeBeneficiary); } function _setManagerFeeBeneficiary(address newManagerFeeBeneficiary) internal { managerFeeBeneficiary = newManagerFeeBeneficiary; emit ManagerFeeBeneficiaryChanged(newManagerFeeBeneficiary); } // -- ERC721 methods -- function onERC721Received( address, address, uint256, bytes calldata ) external pure returns (bytes4) { return IERC721Receiver.onERC721Received.selector; } // -- EIP165 -- function supportsInterface(bytes4 interfaceID) public view override(AccessControlEnumerableUpgradeable, IERC165) returns (bool) { return (interfaceID == type(IERC165).interfaceId || interfaceID == type(IERC20).interfaceId || interfaceID == ERC20Upgradeable.name.selector || interfaceID == ERC20Upgradeable.symbol.selector || interfaceID == ERC20Upgradeable.decimals.selector || interfaceID == type(IERC4626).interfaceId) || super.supportsInterface(interfaceID); } // -- ERC20 methods -- function _approve( address owner, address spender, uint256 amount ) internal override whenNotPaused { super._approve(owner, spender, amount); } function _transfer( address sender, address recipient, uint256 amount ) internal override whenNotPaused { require(ITransferController(transferController).canTransfer(sender, recipient, amount), "FP:Operation not allowed"); super._transfer(sender, recipient, amount); } function _burnFrom( address owner, address spender, uint256 shares ) internal { if (spender != owner) { uint256 allowed = allowance(owner, msg.sender); require(allowed >= shares, "ERC20: decreased allowance below zero"); _approve(owner, msg.sender, allowed - shares); } _burn(owner, shares); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol) pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library 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 assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// 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 v4.4.1 (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "IERC20.sol"; import "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)); } } /** * @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 v4.4.1 (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20Upgradeable { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.0; import "IERC20Upgradeable.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20MetadataUpgradeable is IERC20Upgradeable { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Address.sol) pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (proxy/utils/Initializable.sol) pragma solidity ^0.8.0; import "AddressUpgradeable.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To initialize the implementation contract, you can either invoke the * initializer manually, or you can include a constructor to automatically mark it as initialized when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() initializer {} * ``` * ==== */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. */ bool private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Modifier to protect an initializer function from being invoked twice. */ modifier initializer() { // If the contract is initializing we ignore whether _initialized is set in order to support multiple // inheritance patterns, but we only do this in the context of a constructor, because in other contexts the // contract may have been reentered. require(_initializing ? _isConstructor() : !_initialized, "Initializable: contract is already initialized"); bool isTopLevelCall = !_initializing; if (isTopLevelCall) { _initializing = true; _initialized = true; } _; if (isTopLevelCall) { _initializing = false; } } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} modifier, directly or indirectly. */ modifier onlyInitializing() { require(_initializing, "Initializable: contract is not initializing"); _; } function _isConstructor() private view returns (bool) { return !AddressUpgradeable.isContract(address(this)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; import "Initializable.sol"; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract ContextUpgradeable is Initializable { function __Context_init() internal onlyInitializing { __Context_init_unchained(); } function __Context_init_unchained() internal onlyInitializing { } function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/ERC20.sol) pragma solidity ^0.8.0; import "IERC20Upgradeable.sol"; import "IERC20MetadataUpgradeable.sol"; import "ContextUpgradeable.sol"; import "Initializable.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin Contracts guidelines: functions revert * instead returning `false` on failure. This behavior is nonetheless * conventional and does not conflict with the expectations of ERC20 * applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20Upgradeable is Initializable, ContextUpgradeable, IERC20Upgradeable, IERC20MetadataUpgradeable { mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ function __ERC20_init(string memory name_, string memory symbol_) internal onlyInitializing { __Context_init_unchained(); __ERC20_init_unchained(name_, symbol_); } function __ERC20_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overridden; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom( address sender, address recipient, uint256 amount ) public virtual override returns (bool) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); unchecked { _approve(sender, _msgSender(), currentAllowance - amount); } return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(_msgSender(), spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `sender` to `recipient`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer( address sender, address recipient, uint256 amount ) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance"); unchecked { _balances[sender] = senderBalance - amount; } _balances[recipient] += amount; emit Transfer(sender, recipient, amount); _afterTokenTransfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); _afterTokenTransfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); unchecked { _balances[account] = accountBalance - amount; } _totalSupply -= amount; emit Transfer(account, address(0), amount); _afterTokenTransfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve( address owner, address spender, uint256 amount ) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * has been transferred to `to`. * - when `from` is zero, `amount` tokens have been minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens have been burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 amount ) internal virtual {} uint256[45] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol) pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControlUpgradeable { /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControlEnumerable.sol) pragma solidity ^0.8.0; import "IAccessControlUpgradeable.sol"; /** * @dev External interface of AccessControlEnumerable declared to support ERC165 detection. */ interface IAccessControlEnumerableUpgradeable is IAccessControlUpgradeable { /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) external view returns (address); /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) external view returns (uint256); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library StringsUpgradeable { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165Upgradeable { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "IERC165Upgradeable.sol"; import "Initializable.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable { function __ERC165_init() internal onlyInitializing { __ERC165_init_unchained(); } function __ERC165_init_unchained() internal onlyInitializing { } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165Upgradeable).interfaceId; } uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/AccessControl.sol) pragma solidity ^0.8.0; import "IAccessControlUpgradeable.sol"; import "ContextUpgradeable.sol"; import "StringsUpgradeable.sol"; import "ERC165Upgradeable.sol"; import "Initializable.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight version that doesn't allow enumerating role * members except through off-chain means by accessing the contract event logs. Some * applications may benefit from on-chain enumerability, for those cases see * {AccessControlEnumerable}. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ``` * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ``` * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. */ abstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable { function __AccessControl_init() internal onlyInitializing { __Context_init_unchained(); __ERC165_init_unchained(); __AccessControl_init_unchained(); } function __AccessControl_init_unchained() internal onlyInitializing { } struct RoleData { mapping(address => bool) members; bytes32 adminRole; } mapping(bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with a standardized message including the required role. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ * * _Available since v4.1._ */ modifier onlyRole(bytes32 role) { _checkRole(role, _msgSender()); _; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControlUpgradeable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view override returns (bool) { return _roles[role].members[account]; } /** * @dev Revert with a standard message if `account` is missing `role`. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ */ function _checkRole(bytes32 role, address account) internal view { if (!hasRole(role, account)) { revert( string( abi.encodePacked( "AccessControl: account ", StringsUpgradeable.toHexString(uint160(account), 20), " is missing role ", StringsUpgradeable.toHexString(uint256(role), 32) ) ) ); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view override returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been revoked `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) public virtual override { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== * * NOTE: This function is deprecated in favor of {_grantRole}. */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { bytes32 previousAdminRole = getRoleAdmin(role); _roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Grants `role` to `account`. * * Internal function without access restriction. */ function _grantRole(bytes32 role, address account) internal virtual { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); } } /** * @dev Revokes `role` from `account`. * * Internal function without access restriction. */ function _revokeRole(bytes32 role, address account) internal virtual { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } uint256[49] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/structs/EnumerableSet.sol) pragma solidity ^0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. */ library EnumerableSetUpgradeable { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping(bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; if (lastIndex != toDeleteIndex) { bytes32 lastvalue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastvalue; // Update the index for the moved value set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex } // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { return set._values[index]; } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function _values(Set storage set) private view returns (bytes32[] memory) { return set._values; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(Bytes32Set storage set) internal view returns (bytes32[] memory) { return _values(set._inner); } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(AddressSet storage set) internal view returns (address[] memory) { bytes32[] memory store = _values(set._inner); address[] memory result; assembly { result := store } return result; } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values on the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(UintSet storage set) internal view returns (uint256[] memory) { bytes32[] memory store = _values(set._inner); uint256[] memory result; assembly { result := store } return result; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/AccessControlEnumerable.sol) pragma solidity ^0.8.0; import "IAccessControlEnumerableUpgradeable.sol"; import "AccessControlUpgradeable.sol"; import "EnumerableSetUpgradeable.sol"; import "Initializable.sol"; /** * @dev Extension of {AccessControl} that allows enumerating the members of each role. */ abstract contract AccessControlEnumerableUpgradeable is Initializable, IAccessControlEnumerableUpgradeable, AccessControlUpgradeable { function __AccessControlEnumerable_init() internal onlyInitializing { __Context_init_unchained(); __ERC165_init_unchained(); __AccessControl_init_unchained(); __AccessControlEnumerable_init_unchained(); } function __AccessControlEnumerable_init_unchained() internal onlyInitializing { } using EnumerableSetUpgradeable for EnumerableSetUpgradeable.AddressSet; mapping(bytes32 => EnumerableSetUpgradeable.AddressSet) private _roleMembers; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControlEnumerableUpgradeable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) public view override returns (address) { return _roleMembers[role].at(index); } /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) public view override returns (uint256) { return _roleMembers[role].length(); } /** * @dev Overload {_grantRole} to track enumerable memberships */ function _grantRole(bytes32 role, address account) internal virtual override { super._grantRole(role, account); _roleMembers[role].add(account); } /** * @dev Overload {_revokeRole} to track enumerable memberships */ function _revokeRole(bytes32 role, address account) internal virtual override { super._revokeRole(role, account); _roleMembers[role].remove(account); } uint256[49] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.0; import "IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.0; import "IERC20.sol"; import "IERC20Metadata.sol"; import "Context.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin Contracts guidelines: functions revert * instead returning `false` on failure. This behavior is nonetheless * conventional and does not conflict with the expectations of ERC20 * applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20, IERC20Metadata { mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overridden; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `to` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address to, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _transfer(owner, to, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on * `transferFrom`. This is semantically equivalent to an infinite approval. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _approve(owner, spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * NOTE: Does not update the allowance if the current allowance * is the maximum `uint256`. * * Requirements: * * - `from` and `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. * - the caller must have allowance for ``from``'s tokens of at least * `amount`. */ function transferFrom( address from, address to, uint256 amount ) public virtual override returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, amount); _transfer(from, to, amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, allowance(owner, spender) + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { address owner = _msgSender(); uint256 currentAllowance = allowance(owner, spender); require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(owner, spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `sender` to `recipient`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. */ function _transfer( address from, address to, uint256 amount ) internal virtual { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(from, to, amount); uint256 fromBalance = _balances[from]; require(fromBalance >= amount, "ERC20: transfer amount exceeds balance"); unchecked { _balances[from] = fromBalance - amount; } _balances[to] += amount; emit Transfer(from, to, amount); _afterTokenTransfer(from, to, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); _afterTokenTransfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); unchecked { _balances[account] = accountBalance - amount; } _totalSupply -= amount; emit Transfer(account, address(0), amount); _afterTokenTransfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve( address owner, address spender, uint256 amount ) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Updates `owner` s allowance for `spender` based on spent `amount`. * * Does not update the allowance amount in case of infinite allowance. * Revert if not enough allowance is available. * * Might emit an {Approval} event. */ function _spendAllowance( address owner, address spender, uint256 amount ) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { require(currentAllowance >= amount, "ERC20: insufficient allowance"); unchecked { _approve(owner, spender, currentAllowance - amount); } } } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * has been transferred to `to`. * - when `from` is zero, `amount` tokens have been minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens have been burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 amount ) internal virtual {} }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.10; interface IProtocolConfig { function protocolFeeRate() external view returns (uint256); function protocolAdmin() external view returns (address); function protocolTreasury() external view returns (address); function pauserAddress() external view returns (address); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "IERC165Upgradeable.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721Upgradeable is IERC165Upgradeable { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.10; import {IERC721Upgradeable} from "IERC721Upgradeable.sol"; import {IERC20Metadata} from "ERC20.sol"; interface IFinancialInstrument is IERC721Upgradeable { function principal(uint256 instrumentId) external view returns (uint256); function asset(uint256 instrumentId) external view returns (IERC20Metadata); function recipient(uint256 instrumentId) external view returns (address); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.10; import {IFinancialInstrument} from "IFinancialInstrument.sol"; interface IDebtInstrument is IFinancialInstrument { function endDate(uint256 instrumentId) external view returns (uint256); function repay(uint256 instrumentId, uint256 amount) external returns (uint256 principalRepaid, uint256 interestRepaid); function start(uint256 instrumentId) external; function cancel(uint256 instrumentId) external; function markAsDefaulted(uint256 instrumentId) external; function issueInstrumentSelector() external pure returns (bytes4); function updateInstrumentSelector() external pure returns (bytes4); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.10; interface IDepositController { function onDeposit( address sender, uint256 amount, address receiver ) external returns (uint256, uint256); function onMint( address sender, uint256 amount, address receiver ) external returns (uint256, uint256); function previewDeposit(uint256 assets) external view returns (uint256 shares); function previewMint(uint256 shares) external view returns (uint256 assets); function maxDeposit(address sender) external view returns (uint256 assets); function maxMint(address sender) external view returns (uint256 shares); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.10; interface IWithdrawController { function maxWithdraw(address owner) external view returns (uint256 assets); function maxRedeem(address owner) external view returns (uint256 shares); function onWithdraw( address sender, uint256 amount, address receiver, address owner ) external returns (uint256 shares, uint256 fee); function onRedeem( address sender, uint256 shares, address receiver, address owner ) external returns (uint256 assets, uint256 fee); function previewWithdraw(uint256 assets) external view returns (uint256 shares); function previewRedeem(uint256 shares) external view returns (uint256 assets); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.10; import {IDebtInstrument} from "IDebtInstrument.sol"; import {IFlexiblePortfolio} from "IFlexiblePortfolio.sol"; interface IValuationStrategy { function onInstrumentFunded( IFlexiblePortfolio portfolio, IDebtInstrument instrument, uint256 instrumentId ) external; function onInstrumentUpdated( IFlexiblePortfolio portfolio, IDebtInstrument instrument, uint256 instrumentId ) external; function calculateValue(IFlexiblePortfolio portfolio) external view returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.10; interface ITransferController { function canTransfer( address sender, address recipient, uint256 amount ) external view returns (bool); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.10; interface IFeeStrategy { function managerFeeRate() external view returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.10; import {IERC20Metadata} from "ERC20.sol"; import {IERC20Upgradeable, IERC20MetadataUpgradeable} from "IERC20MetadataUpgradeable.sol"; interface IERC4626 is IERC20Upgradeable, IERC20MetadataUpgradeable { event Deposit(address indexed sender, address indexed owner, uint256 assets, uint256 shares); event Withdraw(address indexed sender, address indexed receiver, address indexed owner, uint256 assets, uint256 shares); function asset() external view returns (IERC20Metadata asset); function totalAssets() external view returns (uint256 totalManagedAssets); function convertToShares(uint256 assets) external view returns (uint256 shares); function convertToAssets(uint256 shares) external view returns (uint256 assets); function deposit(uint256 assets, address receiver) external returns (uint256 shares); function maxWithdraw(address owner) external view returns (uint256); function previewWithdraw(uint256 assets) external view returns (uint256); function withdraw( uint256 assets, address receiver, address owner ) external returns (uint256); function maxRedeem(address owner) external view returns (uint256); function maxDeposit(address receiver) external view returns (uint256); function maxMint(address receiver) external view returns (uint256); function previewMint(uint256 shares) external view returns (uint256); function previewRedeem(uint256 shares) external view returns (uint256); function previewDeposit(uint256 assets) external view returns (uint256 shares); function redeem( uint256 shares, address receiver, address owner ) external returns (uint256 assets); function mint(uint256 shares, address receiver) external returns (uint256 assets); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.10; import {IProtocolConfig} from "IProtocolConfig.sol"; import {IERC4626} from "IERC4626.sol"; import {IDepositController} from "IDepositController.sol"; import {IWithdrawController} from "IWithdrawController.sol"; import {ITransferController} from "ITransferController.sol"; import {IERC165} from "IERC165.sol"; interface IPortfolio is IERC4626, IERC165 { function maxSize() external view returns (uint256); function liquidAssets() external view returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.10; import {IERC20Metadata} from "ERC20.sol"; import {IProtocolConfig} from "IProtocolConfig.sol"; import {IDebtInstrument} from "IDebtInstrument.sol"; import {IDepositController} from "IDepositController.sol"; import {IWithdrawController} from "IWithdrawController.sol"; import {IValuationStrategy} from "IValuationStrategy.sol"; import {ITransferController} from "ITransferController.sol"; import {IFeeStrategy} from "IFeeStrategy.sol"; import {IPortfolio} from "IPortfolio.sol"; interface IFlexiblePortfolio is IPortfolio { struct ERC20Metadata { string name; string symbol; } struct Controllers { IDepositController depositController; IWithdrawController withdrawController; ITransferController transferController; IValuationStrategy valuationStrategy; IFeeStrategy feeStrategy; } function initialize( IProtocolConfig _protocolConfig, uint256 _duration, IERC20Metadata _asset, address _manager, uint256 _maxSize, Controllers calldata _controllers, IDebtInstrument[] calldata _allowedInstruments, ERC20Metadata calldata tokenMetadata ) external; function fundInstrument(IDebtInstrument loans, uint256 instrumentId) external; function repay( IDebtInstrument loans, uint256 instrumentId, uint256 amount ) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol) pragma solidity ^0.8.0; /** * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified * proxy whose upgrades are fully controlled by the current implementation. */ interface IERC1822Proxiable { /** * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation * address. * * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this * function revert if invoked through a proxy. */ function proxiableUUID() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol) pragma solidity ^0.8.0; /** * @dev This is the interface that {BeaconProxy} expects of its beacon. */ interface IBeacon { /** * @dev Must return an address that can be used as a delegate call target. * * {BeaconProxy} will check that this address is a contract. */ function implementation() external view returns (address); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol) pragma solidity ^0.8.0; /** * @dev Library for reading and writing primitive types to specific storage slots. * * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. * This library helps with reading and writing to such slots without the need for inline assembly. * * The functions in this library return Slot structs that contain a `value` member that can be used to read or write. * * Example usage to set ERC1967 implementation slot: * ``` * contract ERC1967 { * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; * * function _getImplementation() internal view returns (address) { * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; * } * * function _setImplementation(address newImplementation) internal { * require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` * * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._ */ library StorageSlot { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } /** * @dev Returns an `AddressSlot` with member `value` located at `slot`. */ function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) { assembly { r.slot := slot } } /** * @dev Returns an `BooleanSlot` with member `value` located at `slot`. */ function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { assembly { r.slot := slot } } /** * @dev Returns an `Bytes32Slot` with member `value` located at `slot`. */ function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { assembly { r.slot := slot } } /** * @dev Returns an `Uint256Slot` with member `value` located at `slot`. */ function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { assembly { r.slot := slot } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol) pragma solidity ^0.8.2; import "IBeacon.sol"; import "draft-IERC1822.sol"; import "Address.sol"; import "StorageSlot.sol"; /** * @dev This abstract contract provides getters and event emitting update functions for * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots. * * _Available since v4.1._ * * @custom:oz-upgrades-unsafe-allow delegatecall */ abstract contract ERC1967Upgrade { // This is the keccak-256 hash of "eip1967.proxy.rollback" subtracted by 1 bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143; /** * @dev Storage slot with the address of the current implementation. * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; /** * @dev Emitted when the implementation is upgraded. */ event Upgraded(address indexed implementation); /** * @dev Returns the current implementation address. */ function _getImplementation() internal view returns (address) { return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; } /** * @dev Stores a new address in the EIP1967 implementation slot. */ function _setImplementation(address newImplementation) private { require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; } /** * @dev Perform implementation upgrade * * Emits an {Upgraded} event. */ function _upgradeTo(address newImplementation) internal { _setImplementation(newImplementation); emit Upgraded(newImplementation); } /** * @dev Perform implementation upgrade with additional setup call. * * Emits an {Upgraded} event. */ function _upgradeToAndCall( address newImplementation, bytes memory data, bool forceCall ) internal { _upgradeTo(newImplementation); if (data.length > 0 || forceCall) { Address.functionDelegateCall(newImplementation, data); } } /** * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call. * * Emits an {Upgraded} event. */ function _upgradeToAndCallUUPS( address newImplementation, bytes memory data, bool forceCall ) internal { // Upgrades from old implementations will perform a rollback test. This test requires the new // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing // this special case will break upgrade paths from old UUPS implementation to new ones. if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) { _setImplementation(newImplementation); } else { try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) { require(slot == _IMPLEMENTATION_SLOT, "ERC1967Upgrade: unsupported proxiableUUID"); } catch { revert("ERC1967Upgrade: new implementation is not UUPS"); } _upgradeToAndCall(newImplementation, data, forceCall); } } /** * @dev Storage slot with the admin of the contract. * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103; /** * @dev Emitted when the admin account has changed. */ event AdminChanged(address previousAdmin, address newAdmin); /** * @dev Returns the current admin. */ function _getAdmin() internal view returns (address) { return StorageSlot.getAddressSlot(_ADMIN_SLOT).value; } /** * @dev Stores a new address in the EIP1967 admin slot. */ function _setAdmin(address newAdmin) private { require(newAdmin != address(0), "ERC1967: new admin is the zero address"); StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin; } /** * @dev Changes the admin of the proxy. * * Emits an {AdminChanged} event. */ function _changeAdmin(address newAdmin) internal { emit AdminChanged(_getAdmin(), newAdmin); _setAdmin(newAdmin); } /** * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy. * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor. */ bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50; /** * @dev Emitted when the beacon is upgraded. */ event BeaconUpgraded(address indexed beacon); /** * @dev Returns the current beacon. */ function _getBeacon() internal view returns (address) { return StorageSlot.getAddressSlot(_BEACON_SLOT).value; } /** * @dev Stores a new beacon in the EIP1967 beacon slot. */ function _setBeacon(address newBeacon) private { require(Address.isContract(newBeacon), "ERC1967: new beacon is not a contract"); require( Address.isContract(IBeacon(newBeacon).implementation()), "ERC1967: beacon implementation is not a contract" ); StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon; } /** * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that). * * Emits a {BeaconUpgraded} event. */ function _upgradeBeaconToAndCall( address newBeacon, bytes memory data, bool forceCall ) internal { _setBeacon(newBeacon); emit BeaconUpgraded(newBeacon); if (data.length > 0 || forceCall) { Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (proxy/utils/UUPSUpgradeable.sol) pragma solidity ^0.8.0; import "draft-IERC1822.sol"; import "ERC1967Upgrade.sol"; /** * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy. * * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing * `UUPSUpgradeable` with a custom implementation of upgrades. * * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism. * * _Available since v4.1._ */ abstract contract UUPSUpgradeable is IERC1822Proxiable, ERC1967Upgrade { /// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment address private immutable __self = address(this); /** * @dev Check that the execution is being performed through a delegatecall call and that the execution context is * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to * fail. */ modifier onlyProxy() { require(address(this) != __self, "Function must be called through delegatecall"); require(_getImplementation() == __self, "Function must be called through active proxy"); _; } /** * @dev Check that the execution is not being performed through a delegate call. This allows a function to be * callable on the implementing contract but not through proxies. */ modifier notDelegated() { require(address(this) == __self, "UUPSUpgradeable: must not be called through delegatecall"); _; } /** * @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the * implementation. It is used to validate that the this implementation remains valid after an upgrade. * * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier. */ function proxiableUUID() external view virtual override notDelegated returns (bytes32) { return _IMPLEMENTATION_SLOT; } /** * @dev Upgrade the implementation of the proxy to `newImplementation`. * * Calls {_authorizeUpgrade}. * * Emits an {Upgraded} event. */ function upgradeTo(address newImplementation) external virtual onlyProxy { _authorizeUpgrade(newImplementation); _upgradeToAndCallUUPS(newImplementation, new bytes(0), false); } /** * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call * encoded in `data`. * * Calls {_authorizeUpgrade}. * * Emits an {Upgraded} event. */ function upgradeToAndCall(address newImplementation, bytes memory data) external payable virtual onlyProxy { _authorizeUpgrade(newImplementation); _upgradeToAndCallUUPS(newImplementation, data, true); } /** * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by * {upgradeTo} and {upgradeToAndCall}. * * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}. * * ```solidity * function _authorizeUpgrade(address) internal override onlyOwner {} * ``` */ function _authorizeUpgrade(address newImplementation) internal virtual; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (security/Pausable.sol) pragma solidity ^0.8.0; import "ContextUpgradeable.sol"; import "Initializable.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract PausableUpgradeable is Initializable, ContextUpgradeable { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ function __Pausable_init() internal onlyInitializing { __Context_init_unchained(); __Pausable_init_unchained(); } function __Pausable_init_unchained() internal onlyInitializing { _paused = false; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { require(!paused(), "Pausable: paused"); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { require(paused(), "Pausable: not paused"); _; } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } uint256[49] private __gap; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.10; import {AccessControlEnumerableUpgradeable} from "AccessControlEnumerableUpgradeable.sol"; import {UUPSUpgradeable} from "UUPSUpgradeable.sol"; import {PausableUpgradeable} from "PausableUpgradeable.sol"; abstract contract Upgradeable is AccessControlEnumerableUpgradeable, UUPSUpgradeable, PausableUpgradeable { bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE"); constructor() initializer {} function __Upgradeable_init(address admin, address pauser) internal onlyInitializing { AccessControlEnumerableUpgradeable.__AccessControlEnumerable_init(); __Pausable_init(); _grantRole(DEFAULT_ADMIN_ROLE, admin); _grantRole(PAUSER_ROLE, pauser); } function _authorizeUpgrade(address) internal override onlyRole(DEFAULT_ADMIN_ROLE) {} function pause() external onlyRole(PAUSER_ROLE) { super._pause(); } function unpause() external onlyRole(PAUSER_ROLE) { super._unpause(); } }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"previousAdmin","type":"address"},{"indexed":false,"internalType":"address","name":"newAdmin","type":"address"}],"name":"AdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract IDebtInstrument","name":"instrument","type":"address"},{"indexed":false,"internalType":"bool","name":"isAllowed","type":"bool"}],"name":"AllowedInstrumentChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"beacon","type":"address"}],"name":"BeaconUpgraded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"assets","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract IDepositController","name":"newController","type":"address"}],"name":"DepositControllerChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"protocolAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"FeePaid","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract IFeeStrategy","name":"newStrategy","type":"address"}],"name":"FeeStrategyChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract IDebtInstrument","name":"instrument","type":"address"},{"indexed":true,"internalType":"uint256","name":"instrumentId","type":"uint256"}],"name":"InstrumentAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract IDebtInstrument","name":"instrument","type":"address"},{"indexed":true,"internalType":"uint256","name":"instrumentId","type":"uint256"}],"name":"InstrumentFunded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract IDebtInstrument","name":"instrument","type":"address"},{"indexed":true,"internalType":"uint256","name":"instrumentId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"InstrumentRepaid","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract IDebtInstrument","name":"instrument","type":"address"}],"name":"InstrumentUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"managerFeeBeneficiary","type":"address"}],"name":"ManagerFeeBeneficiaryChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newMaxSize","type":"uint256"}],"name":"MaxSizeChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract ITransferController","name":"newController","type":"address"}],"name":"TransferControllerChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"implementation","type":"address"}],"name":"Upgraded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract IValuationStrategy","name":"newStrategy","type":"address"}],"name":"ValuationStrategyChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"assets","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"Withdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract IWithdrawController","name":"newController","type":"address"}],"name":"WithdrawControllerChanged","type":"event"},{"inputs":[],"name":"BASIS_PRECISION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"CONTROLLER_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MANAGER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PAUSER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IDebtInstrument","name":"instrument","type":"address"},{"internalType":"bytes","name":"issueInstrumentCalldata","type":"bytes"}],"name":"addInstrument","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IDebtInstrument","name":"instrument","type":"address"},{"internalType":"bool","name":"isAllowed","type":"bool"}],"name":"allowInstrument","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"asset","outputs":[{"internalType":"contract IERC20Metadata","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IDebtInstrument","name":"instrument","type":"address"},{"internalType":"uint256","name":"instrumentId","type":"uint256"}],"name":"cancelInstrument","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"sharesAmount","type":"uint256"}],"name":"convertToAssets","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"name":"convertToShares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"assets","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"}],"name":"deposit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"depositController","outputs":[{"internalType":"contract IDepositController","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"endDate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeStrategy","outputs":[{"internalType":"contract IFeeStrategy","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IDebtInstrument","name":"instrument","type":"address"},{"internalType":"uint256","name":"instrumentId","type":"uint256"}],"name":"fundInstrument","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getFees","outputs":[{"internalType":"uint256","name":"protocolFee","type":"uint256"},{"internalType":"uint256","name":"managerFee","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getRoleMember","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMemberCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IProtocolConfig","name":"_protocolConfig","type":"address"},{"internalType":"uint256","name":"_duration","type":"uint256"},{"internalType":"contract IERC20Metadata","name":"_asset","type":"address"},{"internalType":"address","name":"_manager","type":"address"},{"internalType":"uint256","name":"_maxSize","type":"uint256"},{"components":[{"internalType":"contract IDepositController","name":"depositController","type":"address"},{"internalType":"contract IWithdrawController","name":"withdrawController","type":"address"},{"internalType":"contract ITransferController","name":"transferController","type":"address"},{"internalType":"contract IValuationStrategy","name":"valuationStrategy","type":"address"},{"internalType":"contract IFeeStrategy","name":"feeStrategy","type":"address"}],"internalType":"struct IFlexiblePortfolio.Controllers","name":"_controllers","type":"tuple"},{"internalType":"contract IDebtInstrument[]","name":"_allowedInstruments","type":"address[]"},{"components":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"}],"internalType":"struct IFlexiblePortfolio.ERC20Metadata","name":"tokenMetadata","type":"tuple"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IDebtInstrument","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"isInstrumentAdded","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IDebtInstrument","name":"","type":"address"}],"name":"isInstrumentAllowed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastManagerFeeRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastProtocolFeeRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"liquidAssets","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"managerFeeBeneficiary","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IDebtInstrument","name":"instrument","type":"address"},{"internalType":"uint256","name":"instrumentId","type":"uint256"}],"name":"markInstrumentAsDefaulted","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"maxDeposit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"maxMint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"maxRedeem","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxSize","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"maxWithdraw","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"shares","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"}],"name":"mint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"name":"previewDeposit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"name":"previewMint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"name":"previewRedeem","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"name":"previewWithdraw","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"protocolConfig","outputs":[{"internalType":"contract IProtocolConfig","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"proxiableUUID","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"shares","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"address","name":"owner","type":"address"}],"name":"redeem","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IDebtInstrument","name":"instrument","type":"address"},{"internalType":"uint256","name":"instrumentId","type":"uint256"},{"internalType":"uint256","name":"assets","type":"uint256"}],"name":"repay","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IDepositController","name":"_depositController","type":"address"}],"name":"setDepositController","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newEndDate","type":"uint256"}],"name":"setEndDate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IFeeStrategy","name":"_feeStrategy","type":"address"}],"name":"setFeeStrategy","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newManagerFeeBeneficiary","type":"address"}],"name":"setManagerFeeBeneficiary","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_maxSize","type":"uint256"}],"name":"setMaxSize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract ITransferController","name":"_transferController","type":"address"}],"name":"setTransferController","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IValuationStrategy","name":"_valuationStrategy","type":"address"}],"name":"setValuationStrategy","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IWithdrawController","name":"_withdrawController","type":"address"}],"name":"setWithdrawController","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceID","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalAssets","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"transferController","outputs":[{"internalType":"contract ITransferController","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpaidManagerFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unpaidProtocolFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"updateAndPayFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IDebtInstrument","name":"instrument","type":"address"},{"internalType":"bytes","name":"updateInstrumentCalldata","type":"bytes"}],"name":"updateInstrument","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"}],"name":"upgradeTo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"upgradeToAndCall","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"valuationStrategy","outputs":[{"internalType":"contract IValuationStrategy","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"virtualTokenBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"assets","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"address","name":"owner","type":"address"}],"name":"withdraw","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawController","outputs":[{"internalType":"contract IWithdrawController","name":"","type":"address"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
60a0604052306080523480156200001557600080fd5b50600054610100900460ff16620000335760005460ff16156200003d565b6200003d620000e2565b620000a55760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840160405180910390fd5b600054610100900460ff16158015620000c8576000805461ffff19166101011790555b8015620000db576000805461ff00191690555b5062000106565b6000620000fa306200010060201b62002f411760201c565b15905090565b3b151590565b608051615bd16200013e600039600081816112e50152818161132501528181611570015281816115b001526116b90152615bd16000f3fe6080604052600436106104895760003560e01c80638cd2e0c711610255578063ba08765211610144578063d905777e116100c1578063ec87621c11610085578063ec87621c14610e4b578063ec8f265f14610e6d578063ef8b30f714610e8d578063f5efbb4f14610ead578063f7532d5f14610ece578063ffc339c614610eef57600080fd5b8063d905777e14610d84578063db8d55f114610da4578063dd62ed3e14610dce578063e492cdce14610e14578063e63ab1e914610e2957600080fd5b8063c63d75b611610108578063c63d75b614610ce4578063c6e6f59214610d04578063ca15c87314610d24578063ce96cb7714610d44578063d547741f14610d6457600080fd5b8063ba08765214610c56578063bc2cea1f14610c76578063bf63054814610c96578063c107318714610cb6578063c24a0f8b14610ccd57600080fd5b80639e082d43116101d2578063ac0e6d4611610196578063ac0e6d4614610bbf578063b0f7c08614610bd6578063b3d7f6b914610bf6578063b460af9414610c16578063b8b2f95514610c3657600080fd5b80639e082d4314610b295780639e5602fa14610b4a578063a217fddf14610b6a578063a457c2d714610b7f578063a9059cbb14610b9f57600080fd5b806395d89b411161021957806395d89b4114610a81578063960137cc14610a965780639944d10a14610ab65780639a422b7814610af25780639b18d96614610b0957600080fd5b80638cd2e0c7146109e05780639010d07c14610a0057806391d1485414610a20578063949b22ae14610a4057806394bf804d14610a6157600080fd5b8063395093511161037c57806366330a59116102f95780637f72c2d8116102bd5780637f72c2d814610932578063816e117c1461095257806382ef25fd146109725780638456cb591461098957806386aa0c4a1461099e57806386afe40b146109bf57600080fd5b806366330a59146108865780636c3d4e03146108a75780636e553f65146108bc57806370a08231146108dc578063736e7ef31461091257600080fd5b80634cdad506116103405780634cdad506146108065780634f1ef28614610826578063527f346a1461083957806352d1902d146108595780635c975abb1461086e57600080fd5b806339509351146107795780633f4ba83a14610799578063402d267d146107ae57806349edd0c7146107ce5780634bb4193c146107e457600080fd5b806323b872dd1161040a578063313ce567116103ce578063313ce567146106b357806336568abe146106e05780633659cfe6146107005780633784f0001461072057806338d52e0f1461074057600080fd5b806323b872dd14610615578063248a9ca3146106355780632565b159146106655780632dd95f691461067c5780632f2ff15d1461069357600080fd5b80630a28a477116104515780630a28a47714610548578063150b7a021461056857806318160ddd146105ad578063203e3ce7146105c257806320ea51c3146105e457600080fd5b806301e1d1141461048e57806301ffc9a7146104b657806306fdde03146104e657806307a2d13a14610508578063095ea7b314610528575b600080fd5b34801561049a57600080fd5b506104a3610f0f565b6040519081526020015b60405180910390f35b3480156104c257600080fd5b506104d66104d1366004615079565b610f23565b60405190151581526020016104ad565b3480156104f257600080fd5b506104fb610fd5565b6040516104ad91906150c2565b34801561051457600080fd5b506104a36105233660046150f5565b611067565b34801561053457600080fd5b506104d6610543366004615123565b6110a7565b34801561055457600080fd5b506104a36105633660046150f5565b6110bd565b34801561057457600080fd5b50610594610583366004615198565b630a85bd0160e11b95945050505050565b6040516001600160e01b031990911681526020016104ad565b3480156105b957600080fd5b506035546104a3565b3480156105ce57600080fd5b506105e26105dd36600461520b565b61112d565b005b3480156105f057600080fd5b506104d66105ff36600461520b565b6101316020526000908152604090205460ff1681565b34801561062157600080fd5b506104d6610630366004615228565b61118b565b34801561064157600080fd5b506104a36106503660046150f5565b60009081526097602052604090206001015490565b34801561067157600080fd5b506104a361012f5481565b34801561068857600080fd5b506104a36101355481565b34801561069f57600080fd5b506105e26106ae366004615269565b611235565b3480156106bf57600080fd5b5061012d54600160a01b900460ff1660405160ff90911681526020016104ad565b3480156106ec57600080fd5b506105e26106fb366004615269565b611260565b34801561070c57600080fd5b506105e261071b36600461520b565b6112da565b34801561072c57600080fd5b506105e261073b3660046150f5565b6113ba565b34801561074c57600080fd5b5061012d54610761906001600160a01b031681565b6040516001600160a01b0390911681526020016104ad565b34801561078557600080fd5b506104d6610794366004615123565b611460565b3480156107a557600080fd5b506105e261149c565b3480156107ba57600080fd5b506104a36107c936600461520b565b6114bd565b3480156107da57600080fd5b506104a361271081565b3480156107f057600080fd5b506104a3600080516020615b7c83398151915281565b34801561081257600080fd5b506104a36108213660046150f5565b611532565b6105e26108343660046152af565b611565565b34801561084557600080fd5b506105e2610854366004615381565b611632565b34801561086557600080fd5b506104a36116ac565b34801561087a57600080fd5b5060fb5460ff166104d6565b34801561089257600080fd5b5061013a54610761906001600160a01b031681565b3480156108b357600080fd5b506105e261175f565b3480156108c857600080fd5b506104a36108d7366004615269565b6117a5565b3480156108e857600080fd5b506104a36108f736600461520b565b6001600160a01b031660009081526033602052604090205490565b34801561091e57600080fd5b506105e261092d366004615123565b611869565b34801561093e57600080fd5b506105e261094d3660046153af565b611949565b34801561095e57600080fd5b506105e261096d3660046150f5565b6119b7565b34801561097e57600080fd5b506104a36101375481565b34801561099557600080fd5b506105e2611a30565b3480156109aa57600080fd5b5061013b54610761906001600160a01b031681565b3480156109cb57600080fd5b5061013c54610761906001600160a01b031681565b3480156109ec57600080fd5b506105e26109fb366004615404565b611a51565b348015610a0c57600080fd5b50610761610a1b366004615439565b611d59565b348015610a2c57600080fd5b506104d6610a3b366004615269565b611d71565b348015610a4c57600080fd5b5061013e54610761906001600160a01b031681565b348015610a6d57600080fd5b506104a3610a7c366004615269565b611d9c565b348015610a8d57600080fd5b506104fb611e75565b348015610aa257600080fd5b506105e2610ab1366004615123565b611e84565b348015610ac257600080fd5b506104d6610ad1366004615123565b61013f60209081526000928352604080842090915290825290205460ff1681565b348015610afe57600080fd5b506104a36101345481565b348015610b1557600080fd5b506105e2610b2436600461520b565b61226c565b348015610b3557600080fd5b5061013d54610761906001600160a01b031681565b348015610b5657600080fd5b506105e2610b6536600461520b565b6122bd565b348015610b7657600080fd5b506104a3600081565b348015610b8b57600080fd5b506104d6610b9a366004615123565b612351565b348015610bab57600080fd5b506104d6610bba366004615123565b6123ac565b348015610bcb57600080fd5b506104a36101335481565b348015610be257600080fd5b506105e2610bf136600461520b565b6123b9565b348015610c0257600080fd5b506104a3610c113660046150f5565b61240a565b348015610c2257600080fd5b506104a3610c3136600461545b565b612460565b348015610c4257600080fd5b506104a3610c513660046153af565b61252e565b348015610c6257600080fd5b506104a3610c7136600461545b565b61269d565b348015610c8257600080fd5b506105e2610c9136600461520b565b612762565b348015610ca257600080fd5b506105e2610cb13660046154f4565b6127b3565b348015610cc257600080fd5b506104a36101365481565b348015610cd957600080fd5b506104a361012e5481565b348015610cf057600080fd5b506104a3610cff36600461520b565b612c1c565b348015610d1057600080fd5b506104a3610d1f3660046150f5565b612c91565b348015610d3057600080fd5b506104a3610d3f3660046150f5565b612d1e565b348015610d5057600080fd5b506104a3610d5f36600461520b565b612d35565b348015610d7057600080fd5b506105e2610d7f366004615269565b612d83565b348015610d9057600080fd5b506104a3610d9f36600461520b565b612da9565b348015610db057600080fd5b50610db9612df7565b604080519283526020830191909152016104ad565b348015610dda57600080fd5b506104a3610de93660046155c7565b6001600160a01b03918216600090815260346020908152604080832093909416825291909152205490565b348015610e2057600080fd5b506104a3612e0c565b348015610e3557600080fd5b506104a3600080516020615b3583398151915281565b348015610e5757600080fd5b506104a3600080516020615b1583398151915281565b348015610e7957600080fd5b506105e2610e88366004615123565b612e54565b348015610e9957600080fd5b506104a3610ea83660046150f5565b612e9a565b348015610eb957600080fd5b5061013054610761906001600160a01b031681565b348015610eda57600080fd5b5061013254610761906001600160a01b031681565b348015610efb57600080fd5b506105e2610f0a36600461520b565b612ef0565b600080610f1a612f47565b50909392505050565b60006001600160e01b031982166301ffc9a760e01b1480610f5457506001600160e01b031982166336372b0760e01b145b80610f6f57506001600160e01b031982166306fdde0360e01b145b80610f8a57506001600160e01b031982166395d89b4160e01b145b80610fa557506001600160e01b0319821663313ce56760e01b145b80610fc057506001600160e01b0319821663043eff2d60e51b145b80610fcf5750610fcf826130e7565b92915050565b606060368054610fe4906155f5565b80601f0160208091040260200160405190810160405280929190818152602001828054611010906155f5565b801561105d5780601f106110325761010080835404028352916020019161105d565b820191906000526020600020905b81548152906001019060200180831161104057829003601f168201915b5050505050905090565b60008061107360355490565b9050806110835750600092915050565b8061108c610f0f565b6110969085615640565b6110a0919061565f565b9392505050565b60006110b433848461310c565b50600192915050565b61013c54604051630a28a47760e01b8152600481018390526000916001600160a01b031690630a28a477906024015b602060405180830381865afa158015611109573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fcf9190615681565b600080516020615b7c833981519152611146813361313a565b61013b546001600160a01b038381169116141561117e5760405162461bcd60e51b81526004016111759061569a565b60405180910390fd5b6111878261319e565b5050565b60006111988484846131e9565b6001600160a01b03841660009081526034602090815260408083203384529091529020548281101561121d5760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b6064820152608401611175565b61122a853385840361310c565b506001949350505050565b600082815260976020526040902060010154611251813361313a565b61125b83836132a9565b505050565b6001600160a01b03811633146112d05760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401611175565b61118782826132cb565b306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614156113235760405162461bcd60e51b8152600401611175906156d1565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661136c600080516020615af5833981519152546001600160a01b031690565b6001600160a01b0316146113925760405162461bcd60e51b81526004016111759061571d565b61139b816132ed565b604080516000808252602082019092526113b7918391906132f9565b50565b600080516020615b158339815191526113d3813361313a565b4261012e54116113f55760405162461bcd60e51b815260040161117590615769565b61012e548210801561140957506101395482115b801561141457504282115b6114595760405162461bcd60e51b815260206004820152601660248201527546503a4e657720656e644461746520746f6f2062696760501b6044820152606401611175565b5061012e55565b3360008181526034602090815260408083206001600160a01b038716845290915281205490916110b4918590611497908690615796565b61310c565b600080516020615b358339815191526114b5813361313a565b6113b7613464565b60006114cb60fb5460ff1690565b806114d9575061012e544210155b156114e657506000919050565b61012f546114f2610f0f565b106114ff57506000919050565b61013b5460405163402d267d60e01b81526001600160a01b0384811660048301529091169063402d267d906024016110ec565b61013c5460405163266d6a8360e11b8152600481018390526000916001600160a01b031690634cdad506906024016110ec565b306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614156115ae5760405162461bcd60e51b8152600401611175906156d1565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166115f7600080516020615af5833981519152546001600160a01b031690565b6001600160a01b03161461161d5760405162461bcd60e51b81526004016111759061571d565b611626826132ed565b611187828260016132f9565b600080516020615b1583398151915261164b813361313a565b6001600160a01b03831660008181526101316020908152604091829020805460ff191686151590811790915591519182527ff8cf255ebd621cf205dad476bf0d4fcd5f8f07f29e214e7e1b9bc05e148f962f910160405180910390a2505050565b6000306001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461174c5760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c00000000000000006064820152608401611175565b50600080516020615af583398151915290565b60fb5460ff16156117825760405162461bcd60e51b8152600401611175906157ae565b60008061178d612df7565b915091506117996134f7565b611187600083836135e3565b60006117b360fb5460ff1690565b156117d05760405162461bcd60e51b8152600401611175906157ae565b61013b546040516372db078560e11b8152336004820152602481018590526001600160a01b038481166044830152600092839291169063e5b60f0a9060640160408051808303816000875af115801561182d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061185191906157d8565b91509150611861848387846137f5565b509392505050565b600080516020615b15833981519152611882813361313a565b6040516340e58ee560e01b8152600481018390526001600160a01b038416906340e58ee5906024015b600060405180830381600087803b1580156118c557600080fd5b505af11580156118d9573d6000803e3d6000fd5b505061013a546040516351faf67f60e11b81526001600160a01b03909116925063a3f5ecfe9150611912903090879087906004016157fc565b600060405180830381600087803b15801561192c57600080fd5b505af1158015611940573d6000803e3d6000fd5b50505050505050565b600080516020615b15833981519152611962813361313a565b61197c84856001600160a01b0316633ff35f7a86866139fb565b506040516001600160a01b038516907f2e18aef13edc81f6faee62e1aa4c095c75dd2f438f7bc921e53798ddb501c9cc90600090a250505050565b600080516020615b158339815191526119d0813361313a565b61012f548214156119f35760405162461bcd60e51b81526004016111759061569a565b61012f8290556040518281527f1696b1614dceaf3357feaee97503be9c87f818f9a44aab42625f950675c2c67f9060200160405180910390a15050565b600080516020615b35833981519152611a49813361313a565b6113b7613b7d565b60fb5460ff1615611a745760405162461bcd60e51b8152600401611175906157ae565b60008111611abb5760405162461bcd60e51b8152602060048201526014602482015273046503a416d6f756e742063616e277420626520360641b6044820152606401611175565b60405163be5e5c1b60e01b81526004810183905233906001600160a01b0385169063be5e5c1b90602401602060405180830381865afa158015611b02573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b269190615820565b6001600160a01b031614611b715760405162461bcd60e51b815260206004820152601260248201527111940e95dc9bdb99c81c9958da5c1a595b9d60721b6044820152606401611175565b6001600160a01b038316600090815261013f6020908152604080832085845290915290205460ff16611bdf5760405162461bcd60e51b815260206004820152601760248201527611940e925b9cdd1c9d5b595b9d081b9bdd081859191959604a1b6044820152606401611175565b600080611bea612df7565b60405163d8aed14560e01b8152600481018790526024810186905291935091506001600160a01b0386169063d8aed1459060440160408051808303816000875af1158015611c3c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c6091906157d8565b505061013a546040516351faf67f60e11b81526001600160a01b039091169063a3f5ecfe90611c97903090899089906004016157fc565b600060405180830381600087803b158015611cb157600080fd5b505af1158015611cc5573d6000803e3d6000fd5b50505050611cd16134f7565b826101336000828254611ce49190615796565b909155505061012d54611d02906001600160a01b0316333086613bd5565b611d0e600083836135e3565b83856001600160a01b03167f874192b07a05592084193e0817f2b3ef896d2835ca93a77a0cba0d1af97a51d085604051611d4a91815260200190565b60405180910390a35050505050565b600082815260c9602052604081206110a09083613c33565b60009182526097602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6000611daa60fb5460ff1690565b15611dc75760405162461bcd60e51b8152600401611175906157ae565b61013b5460405163cd50ae6f60e01b8152336004820152602481018590526001600160a01b038481166044830152600092839291169063cd50ae6f9060640160408051808303816000875af1158015611e24573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e4891906157d8565b9092509050611e628486611e5c8486615796565b846137f5565b611e6c8183615796565b95945050505050565b606060378054610fe4906155f5565b600080516020615b15833981519152611e9d813361313a565b6001600160a01b038316600090815261013f6020908152604080832085845290915290205460ff16611f0b5760405162461bcd60e51b815260206004820152601760248201527611940e925b9cdd1c9d5b595b9d081b9bdd081859191959604a1b6044820152606401611175565b600080611f16612df7565b60405163be5e5c1b60e01b81526004810187905291935091506000906001600160a01b0387169063be5e5c1b90602401602060405180830381865afa158015611f63573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f879190615820565b6040516314f2949360e01b8152600481018790529091506000906001600160a01b038816906314f2949390602401602060405180830381865afa158015611fd2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ff69190615681565b6040516395805dad60e01b8152600481018890529091506001600160a01b038816906395805dad90602401600060405180830381600087803b15801561203b57600080fd5b505af115801561204f573d6000803e3d6000fd5b5050604051634cac5b4b60e01b815260048101899052600092506001600160a01b038a169150634cac5b4b90602401602060405180830381865afa15801561209b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120bf9190615681565b61013354909150846120d18785615796565b6120db9190615796565b11156121235760405162461bcd60e51b815260206004820152601760248201527646503a4e6f7420656e6f756768206c697175696469747960481b6044820152606401611175565b61012e548111156121765760405162461bcd60e51b815260206004820181905260248201527f46503a496e737472756d656e74206861732062696767657220656e64446174656044820152606401611175565b61217f81613c3f565b6121876134f7565b81610133600082825461219a919061583d565b909155506121ac9050600086866135e3565b61013a5460405163d6cdfcad60e01b81526001600160a01b039091169063d6cdfcad906121e19030908c908c906004016157fc565b600060405180830381600087803b1580156121fb57600080fd5b505af115801561220f573d6000803e3d6000fd5b505061012d5461222c92506001600160a01b031690508484613c50565b60405187906001600160a01b038a16907f9d7087e04e7d74650aeda7c049237923252c52a7ad2732a97a2a3f2a97f49a1990600090a35050505050505050565b600080516020615b15833981519152612285813361313a565b610132546001600160a01b03838116911614156122b45760405162461bcd60e51b81526004016111759061569a565b61118782613c80565b600080516020615b7c8339815191526122d6813361313a565b61013a546001600160a01b03838116911614156123055760405162461bcd60e51b81526004016111759061569a565b61013a80546001600160a01b0319166001600160a01b0384169081179091556040517ff36ab311deb0233025ceb486e5c01a2428794f934e1bbb582be1f40ed95678f990600090a25050565b3360009081526034602090815260408083206001600160a01b0386168452909152812054828110156123955760405162461bcd60e51b815260040161117590615854565b6123a2338585840361310c565b5060019392505050565b60006110b43384846131e9565b600080516020615b7c8339815191526123d2813361313a565b61013c546001600160a01b03838116911614156124015760405162461bcd60e51b81526004016111759061569a565b61118782613ccb565b600061012e54421061242e5760405162461bcd60e51b815260040161117590615769565b61013b5460405163b3d7f6b960e01b8152600481018490526001600160a01b039091169063b3d7f6b9906024016110ec565b600061246e60fb5460ff1690565b1561248b5760405162461bcd60e51b8152600401611175906157ae565b61013c546040516364a0366360e01b8152336004820152602481018690526001600160a01b038581166044830152848116606483015260009283929116906364a036639060840160408051808303816000875af11580156124f0573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061251491906157d8565b915091506125258486848985613d16565b50949350505050565b6000600080516020615b15833981519152612549813361313a565b600061256586876001600160a01b03166352c963c388886139fb565b905060008180602001905181019061257d9190615681565b61012d54604051638ea06f8160e01b8152600481018390529192506001600160a01b039081169190891690638ea06f8190602401602060405180830381865afa1580156125ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125f29190615820565b6001600160a01b03161461263c5760405162461bcd60e51b815260206004820152601160248201527008ca074a8ded6cadc40dad2e6dac2e8c6d607b1b6044820152606401611175565b6001600160a01b038716600081815261013f60209081526040808320858452909152808220805460ff19166001179055518392917ff1034132e5379b5206b4f4b64dc7485b712138905f7b9dff440646bac5687eb291a39695505050505050565b60006126ab60fb5460ff1690565b156126c85760405162461bcd60e51b8152600401611175906157ae565b61013c5460405163d34cf33560e01b8152336004820152602481018690526001600160a01b0385811660448301528481166064830152600092839291169063d34cf3359060840160408051808303816000875af115801561272d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061275191906157d8565b915091506125258486888585613d16565b600080516020615b7c83398151915261277b813361313a565b61013e546001600160a01b03838116911614156127aa5760405162461bcd60e51b81526004016111759061569a565b61118782613ec8565b600054610100900460ff166127ce5760005460ff16156127d2565b303b155b6128355760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401611175565b600054610100900460ff16158015612857576000805461ffff19166101011790555b600089116128a05760405162461bcd60e51b8152602060048201526016602482015275046503a4475726174696f6e2063616e277420626520360541b6044820152606401611175565b61296c8a6001600160a01b031663420f68616040518163ffffffff1660e01b8152600401602060405180830381865afa1580156128e1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129059190615820565b8b6001600160a01b031663f7fb869b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612943573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129679190615820565b613f13565b6129f56129798380615899565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506129bb925050506020850185615899565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250613f6d92505050565b612a0d600080516020615b15833981519152886132a9565b612a25600080516020615b7c833981519152886132a9565b612a2e87613c80565b61013080546001600160a01b0319166001600160a01b038c16179055612a548942615796565b61012e5561012d80546001600160a01b0319166001600160a01b038a1690811790915561012f8790556040805163313ce56760e01b8152905163313ce567916004808201926020929091908290030181865afa158015612ab8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612adc91906158e0565b61012d805460ff92909216600160a01b0260ff60a01b19909216919091179055612b11612b0c602087018761520b565b61319e565b612b29612b24604087016020880161520b565b613ccb565b612b41612b3c606087016040880161520b565b613fa6565b612b59612b5460a087016080880161520b565b613ec8565b612b69608086016060870161520b565b61013a80546001600160a01b0319166001600160a01b039290921691909117905560005b83811015612bfd5760016101316000878785818110612bae57612bae615903565b9050602002016020810190612bc3919061520b565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580612bf581615919565b915050612b8d565b508015612c10576000805461ff00191690555b50505050505050505050565b6000612c2a60fb5460ff1690565b80612c38575061012e544210155b15612c4557506000919050565b61012f54612c51610f0f565b10612c5e57506000919050565b61013b5460405163631ebadb60e11b81526001600160a01b0384811660048301529091169063c63d75b6906024016110ec565b600080612c9d60355490565b905080612cab575090919050565b6000612cb5610f0f565b905060008111612cfb5760405162461bcd60e51b815260206004820152601160248201527046503a496e66696e6974652076616c756560781b6044820152606401611175565b80612d068386615640565b612d10919061565f565b949350505050565b50919050565b600081815260c960205260408120610fcf90613ff1565b6000612d4360fb5460ff1690565b15612d5057506000919050565b61013c5460405163ce96cb7760e01b81526001600160a01b0384811660048301529091169063ce96cb77906024016110ec565b600082815260976020526040902060010154612d9f813361313a565b61125b83836132cb565b6000612db760fb5460ff1690565b15612dc457506000919050565b61013c54604051636c82bbbf60e11b81526001600160a01b0384811660048301529091169063d905777e906024016110ec565b600080612e02612f47565b9094909350915050565b6000806000612e19612df7565b90925090506000612e2a8284615796565b9050806101335411612e3d576000612e4c565b8061013354612e4c919061583d565b935050505090565b600080516020615b15833981519152612e6d813361313a565b60405163543a181160e11b8152600481018390526001600160a01b0384169063a8743022906024016118ab565b600061012e544210612ebe5760405162461bcd60e51b815260040161117590615769565b61013b5460405163ef8b30f760e01b8152600481018490526001600160a01b039091169063ef8b30f7906024016110ec565b600080516020615b7c833981519152612f09813361313a565b61013d546001600160a01b0383811691161415612f385760405162461bcd60e51b81526004016111759061569a565b61118782613fa6565b3b151590565b61013a546040516357bcd95360e11b8152306004820152600091829182916001600160a01b03169063af79b2a690602401602060405180830381865afa158015612f95573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fb99190615681565b61013354612fc79190615796565b925060006101375461013654612fdd9190615796565b9050610136549250610137549150808411612ffc576000935050909192565b613006818561583d565b93506101385442101561301b5761301b615934565b6000610138544261302c919061583d565b6130369086615640565b905060006127106301e1338061013454846130519190615640565b61305b919061565f565b613065919061565f565b905060006127106301e1338061013554856130809190615640565b61308a919061565f565b613094919061565f565b905060006130a28284615796565b90506130ae8388615796565b96506130ba8287615796565b95508088116130d157600097505050505050909192565b6130db818961583d565b97505050505050909192565b60006001600160e01b03198216635a05180f60e01b1480610fcf5750610fcf82613ffb565b60fb5460ff161561312f5760405162461bcd60e51b8152600401611175906157ae565b61125b838383614030565b6131448282611d71565b6111875761315c816001600160a01b03166014614154565b613167836020614154565b60405160200161317892919061594a565b60408051601f198184030181529082905262461bcd60e51b8252611175916004016150c2565b61013b80546001600160a01b0319166001600160a01b0383169081179091556040517f018be14c714b75a62c21e130c709ef781133dda00729e11ba9aca9d0e6747f2290600090a250565b60fb5460ff161561320c5760405162461bcd60e51b8152600401611175906157ae565b61013d546040516372331c7360e11b81526001600160a01b039091169063e46638e690613241908690869086906004016157fc565b602060405180830381865afa15801561325e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061328291906159bf565b61329e5760405162461bcd60e51b8152600401611175906159dc565b61125b8383836142f0565b6132b382826144be565b600082815260c96020526040902061125b9082614544565b6132d58282614559565b600082815260c96020526040902061125b90826145c0565b6000611187813361313a565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff161561332c5761125b836145d5565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015613386575060408051601f3d908101601f1916820190925261338391810190615681565b60015b6133e95760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b6064820152608401611175565b600080516020615af583398151915281146134585760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b6064820152608401611175565b5061125b838383614671565b60fb5460ff166134ad5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401611175565b60fb805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b4261013855610130546040805162b1f0b160e71b815290516001600160a01b03909216916358f85880916004808201926020929091908290030181865afa158015613546573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061356a9190615681565b6101345561013e54604080516327d8cdfb60e21b815290516001600160a01b0390921691639f6337ec916004808201926020929091908290030181865afa1580156135b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135dd9190615681565b61013555565b826101335410156135f6576135f6615934565b826101336000828254613609919061583d565b9091555050610132546040518481526001600160a01b03909116907f075a2720282fdf622141dae0b048ef90a21a7e57c134c76912d19d006b3b3f6f9060200160405180910390a2600061365c83614696565b610136919091556101338054919250829160009061367b90849061583d565b9091555050610130546040805163803db96d60e01b815290516000926001600160a01b03169163803db96d9160048083019260209291908290030181865afa1580156136cb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136ef9190615820565b9050806001600160a01b03167f075a2720282fdf622141dae0b048ef90a21a7e57c134c76912d19d006b3b3f6f8360405161372c91815260200190565b60405180910390a2600061373f84614696565b610137919091556101338054919250829160009061375e90849061583d565b9091555050610132546040518281526001600160a01b03909116907f075a2720282fdf622141dae0b048ef90a21a7e57c134c76912d19d006b3b3f6f9060200160405180910390a261012d546137be906001600160a01b03168385613c50565b610132546137ed906001600160a01b03166137d98389615796565b61012d546001600160a01b03169190613c50565b505050505050565b6001600160a01b0384163014156138485760405162461bcd60e51b815260206004820152601760248201527623281d2bb937b733903932b1b2b4bb32b917b7bbb732b960491b6044820152606401611175565b61012e54421061386a5760405162461bcd60e51b815260040161117590615769565b808210156138ba5760405162461bcd60e51b815260206004820152601960248201527f46503a46656520626967676572207468616e20617373657473000000000000006044820152606401611175565b60006138c6828461583d565b90506000811180156138d85750600084115b6138f45760405162461bcd60e51b8152600401611175906159dc565b6000806000613901612f47565b92509250925061012f5483856139179190615796565b111561395c5760405162461bcd60e51b815260206004820152601460248201527311940e941bdc9d199bdb1a5bc81a5cc8199d5b1b60621b6044820152606401611175565b6139646134f7565b8561013360008282546139779190615796565b90915550613987905088886146cc565b61012d546139a0906001600160a01b0316333089613bd5565b6139ab8583836135e3565b60408051878152602081018990526001600160a01b038a169133917fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d7910160405180910390a35050505050505050565b6001600160a01b0385166000908152610131602052604090205460609060ff16613a675760405162461bcd60e51b815260206004820152601960248201527f46503a496e737472756d656e74206e6f7420616c6c6f776564000000000000006044820152606401611175565b613a718284615a13565b6001600160e01b03191685856040518163ffffffff1660e01b81526004016020604051808303816000875af1158015613aae573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613ad29190615a43565b6001600160e01b03191614613b295760405162461bcd60e51b815260206004820152601860248201527f46503a496e76616c69642066756e6374696f6e2063616c6c00000000000000006044820152606401611175565b613b7383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250506001600160a01b038a16929150506147ab565b9695505050505050565b60fb5460ff1615613ba05760405162461bcd60e51b8152600401611175906157ae565b60fb805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586134da3390565b613c2d846323b872dd60e01b858585604051602401613bf6939291906157fc565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526147ed565b50505050565b60006110a083836148bf565b610139548111156113b75761013955565b6040516001600160a01b03831660248201526044810182905261125b90849063a9059cbb60e01b90606401613bf6565b61013280546001600160a01b0319166001600160a01b0383169081179091556040517fbbc61907feddb73f1c072a4b6dadd1e04e05c389fcf6fcc1888908dca119123b90600090a250565b61013c80546001600160a01b0319166001600160a01b0383169081179091556040517f36630f6b0e59bf42cd06c5bf86594f8a30d2e8435357a7a1b01908ca6e47286090600090a250565b6001600160a01b0384163014801590613d3857506001600160a01b0385163014155b613d7e5760405162461bcd60e51b815260206004820152601760248201527623281d2bb937b733903932b1b2b4bb32b917b7bbb732b960491b6044820152606401611175565b600082118015613d8e5750600083115b613daa5760405162461bcd60e51b8152600401611175906159dc565b600080613db5612df7565b6101335491935091508382613dca8588615796565b613dd49190615796565b613dde9190615796565b1115613e265760405162461bcd60e51b815260206004820152601760248201527646503a4e6f7420656e6f756768206c697175696469747960481b6044820152606401611175565b613e2e6134f7565b613e398733876148e9565b836101336000828254613e4c919061583d565b909155505061012d54613e69906001600160a01b03168786613c50565b613e748383836135e3565b60408051858152602081018790526001600160a01b03808a16929089169133917ffbde797d201c681b91056529119e0b02407c7bb96a4a2c75c01fc9667232c8db910160405180910390a450505050505050565b61013e80546001600160a01b0319166001600160a01b0383169081179091556040517f41f2dcecb53645bb58cfe08bfb1f3c2c21045fc82efd81c92a7b16db5e454aac90600090a250565b600054610100900460ff16613f3a5760405162461bcd60e51b815260040161117590615a60565b613f42614961565b613f4a6149aa565b613f556000836132a9565b611187600080516020615b35833981519152826132a9565b600054610100900460ff16613f945760405162461bcd60e51b815260040161117590615a60565b613f9c6149e1565b6111878282614a08565b61013d80546001600160a01b0319166001600160a01b0383169081179091556040517f10d437923d74978fa15eb65ab36d9b44221448a3d871afd3ea2177b9d25884ac90600090a250565b6000610fcf825490565b60006001600160e01b03198216637965db0b60e01b1480610fcf57506301ffc9a760e01b6001600160e01b0319831614610fcf565b6001600160a01b0383166140925760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401611175565b6001600160a01b0382166140f35760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401611175565b6001600160a01b0383811660008181526034602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b60606000614163836002615640565b61416e906002615796565b67ffffffffffffffff81111561418657614186615299565b6040519080825280601f01601f1916602001820160405280156141b0576020820181803683370190505b509050600360fc1b816000815181106141cb576141cb615903565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106141fa576141fa615903565b60200101906001600160f81b031916908160001a905350600061421e846002615640565b614229906001615796565b90505b60018111156142a1576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061425d5761425d615903565b1a60f81b82828151811061427357614273615903565b60200101906001600160f81b031916908160001a90535060049490941c9361429a81615aab565b905061422c565b5083156110a05760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401611175565b6001600160a01b0383166143545760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401611175565b6001600160a01b0382166143b65760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401611175565b6001600160a01b0383166000908152603360205260409020548181101561442e5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401611175565b6001600160a01b03808516600090815260336020526040808220858503905591851681529081208054849290614465908490615796565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516144b191815260200190565b60405180910390a3613c2d565b6144c88282611d71565b6111875760008281526097602090815260408083206001600160a01b03851684529091529020805460ff191660011790556145003390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60006110a0836001600160a01b038416614a56565b6145638282611d71565b156111875760008281526097602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60006110a0836001600160a01b038416614aa5565b6001600160a01b0381163b6146425760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401611175565b600080516020615af583398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b61467a83614b98565b6000825111806146875750805b1561125b57613c2d8383614bd8565b600080600080846101335410156146c257610133546146b5908661583d565b9150610133549050612e02565b5060009492505050565b6001600160a01b0382166147225760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401611175565b80603560008282546147349190615796565b90915550506001600160a01b03821660009081526033602052604081208054839290614761908490615796565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b60606110a083836040518060400160405280601e81526020017f416464726573733a206c6f772d6c6576656c2063616c6c206661696c65640000815250614bfd565b6000614842826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316614bfd9092919063ffffffff16565b80519091501561125b578080602001905181019061486091906159bf565b61125b5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401611175565b60008260000182815481106148d6576148d6615903565b9060005260206000200154905092915050565b826001600160a01b0316826001600160a01b031614614957576001600160a01b0383166000908152603460209081526040808320338452909152902054818110156149465760405162461bcd60e51b815260040161117590615854565b6149558433611497858561583d565b505b61125b8382614c0c565b600054610100900460ff166149885760405162461bcd60e51b815260040161117590615a60565b6149906149e1565b6149986149e1565b6149a06149e1565b6149a86149e1565b565b600054610100900460ff166149d15760405162461bcd60e51b815260040161117590615a60565b6149d96149e1565b6149a8614d5a565b600054610100900460ff166149a85760405162461bcd60e51b815260040161117590615a60565b600054610100900460ff16614a2f5760405162461bcd60e51b815260040161117590615a60565b8151614a42906036906020850190614fca565b50805161125b906037906020840190614fca565b6000818152600183016020526040812054614a9d57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610fcf565b506000610fcf565b60008181526001830160205260408120548015614b8e576000614ac960018361583d565b8554909150600090614add9060019061583d565b9050818114614b42576000866000018281548110614afd57614afd615903565b9060005260206000200154905080876000018481548110614b2057614b20615903565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080614b5357614b53615ac2565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610fcf565b6000915050610fcf565b614ba1816145d5565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606110a08383604051806060016040528060278152602001615b5560279139614d8d565b6060612d108484600085614e60565b6001600160a01b038216614c6c5760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401611175565b6001600160a01b03821660009081526033602052604090205481811015614ce05760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401611175565b6001600160a01b0383166000908152603360205260408120838303905560358054849290614d0f90849061583d565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a3505050565b600054610100900460ff16614d815760405162461bcd60e51b815260040161117590615a60565b60fb805460ff19169055565b60606001600160a01b0384163b614df55760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401611175565b600080856001600160a01b031685604051614e109190615ad8565b600060405180830381855af49150503d8060008114614e4b576040519150601f19603f3d011682016040523d82523d6000602084013e614e50565b606091505b5091509150613b73828286614f91565b606082471015614ec15760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401611175565b6001600160a01b0385163b614f185760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401611175565b600080866001600160a01b03168587604051614f349190615ad8565b60006040518083038185875af1925050503d8060008114614f71576040519150601f19603f3d011682016040523d82523d6000602084013e614f76565b606091505b5091509150614f86828286614f91565b979650505050505050565b60608315614fa05750816110a0565b825115614fb05782518084602001fd5b8160405162461bcd60e51b815260040161117591906150c2565b828054614fd6906155f5565b90600052602060002090601f016020900481019282614ff8576000855561503e565b82601f1061501157805160ff191683800117855561503e565b8280016001018555821561503e579182015b8281111561503e578251825591602001919060010190615023565b5061504a92915061504e565b5090565b5b8082111561504a576000815560010161504f565b6001600160e01b0319811681146113b757600080fd5b60006020828403121561508b57600080fd5b81356110a081615063565b60005b838110156150b1578181015183820152602001615099565b83811115613c2d5750506000910152565b60208152600082518060208401526150e1816040850160208701615096565b601f01601f19169190910160400192915050565b60006020828403121561510757600080fd5b5035919050565b6001600160a01b03811681146113b757600080fd5b6000806040838503121561513657600080fd5b82356151418161510e565b946020939093013593505050565b60008083601f84011261516157600080fd5b50813567ffffffffffffffff81111561517957600080fd5b60208301915083602082850101111561519157600080fd5b9250929050565b6000806000806000608086880312156151b057600080fd5b85356151bb8161510e565b945060208601356151cb8161510e565b935060408601359250606086013567ffffffffffffffff8111156151ee57600080fd5b6151fa8882890161514f565b969995985093965092949392505050565b60006020828403121561521d57600080fd5b81356110a08161510e565b60008060006060848603121561523d57600080fd5b83356152488161510e565b925060208401356152588161510e565b929592945050506040919091013590565b6000806040838503121561527c57600080fd5b82359150602083013561528e8161510e565b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b600080604083850312156152c257600080fd5b82356152cd8161510e565b9150602083013567ffffffffffffffff808211156152ea57600080fd5b818501915085601f8301126152fe57600080fd5b81358181111561531057615310615299565b604051601f8201601f19908116603f0116810190838211818310171561533857615338615299565b8160405282815288602084870101111561535157600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b80151581146113b757600080fd5b6000806040838503121561539457600080fd5b823561539f8161510e565b9150602083013561528e81615373565b6000806000604084860312156153c457600080fd5b83356153cf8161510e565b9250602084013567ffffffffffffffff8111156153eb57600080fd5b6153f78682870161514f565b9497909650939450505050565b60008060006060848603121561541957600080fd5b83356154248161510e565b95602085013595506040909401359392505050565b6000806040838503121561544c57600080fd5b50508035926020909101359150565b60008060006060848603121561547057600080fd5b8335925060208401356154828161510e565b915060408401356154928161510e565b809150509250925092565b60008083601f8401126154af57600080fd5b50813567ffffffffffffffff8111156154c757600080fd5b6020830191508360208260051b850101111561519157600080fd5b600060408284031215612d1857600080fd5b6000806000806000806000806000898b0361018081121561551457600080fd5b8a3561551f8161510e565b995060208b0135985060408b01356155368161510e565b975060608b01356155468161510e565b965060808b0135955060a0609f198201121561556157600080fd5b5060a08a0193506101408a013567ffffffffffffffff8082111561558457600080fd5b6155908d838e0161549d565b90955093506101608c01359150808211156155aa57600080fd5b506155b78c828d016154e2565b9150509295985092959850929598565b600080604083850312156155da57600080fd5b82356155e58161510e565b9150602083013561528e8161510e565b600181811c9082168061560957607f821691505b60208210811415612d1857634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600081600019048311821515161561565a5761565a61562a565b500290565b60008261567c57634e487b7160e01b600052601260045260246000fd5b500490565b60006020828403121561569357600080fd5b5051919050565b6020808252601c908201527f46503a56616c75652068617320746f20626520646966666572656e7400000000604082015260600190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b60208082526013908201527211940e915b990819185d1948195b185c1cd959606a1b604082015260600190565b600082198211156157a9576157a961562a565b500190565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b600080604083850312156157eb57600080fd5b505080516020909101519092909150565b6001600160a01b039384168152919092166020820152604081019190915260600190565b60006020828403121561583257600080fd5b81516110a08161510e565b60008282101561584f5761584f61562a565b500390565b60208082526025908201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604082015264207a65726f60d81b606082015260800190565b6000808335601e198436030181126158b057600080fd5b83018035915067ffffffffffffffff8211156158cb57600080fd5b60200191503681900382131561519157600080fd5b6000602082840312156158f257600080fd5b815160ff811681146110a057600080fd5b634e487b7160e01b600052603260045260246000fd5b600060001982141561592d5761592d61562a565b5060010190565b634e487b7160e01b600052600160045260246000fd5b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351615982816017850160208801615096565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516159b3816028840160208801615096565b01602801949350505050565b6000602082840312156159d157600080fd5b81516110a081615373565b60208082526018908201527f46503a4f7065726174696f6e206e6f7420616c6c6f7765640000000000000000604082015260600190565b6001600160e01b03198135818116916004851015615a3b5780818660040360031b1b83161692505b505092915050565b600060208284031215615a5557600080fd5b81516110a081615063565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b600081615aba57615aba61562a565b506000190190565b634e487b7160e01b600052603160045260246000fd5b60008251615aea818460208701615096565b919091019291505056fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b0865d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c65649027349758afcb3649adbc1f090fcd4eb9187cfbbd22483c7d103367d7b50173a26469706673582212206b27e134327a0a2dd4b3070434cf375302ed92650eb90c84f3a48f44176c469664736f6c634300080a0033
Deployed Bytecode
0x6080604052600436106104895760003560e01c80638cd2e0c711610255578063ba08765211610144578063d905777e116100c1578063ec87621c11610085578063ec87621c14610e4b578063ec8f265f14610e6d578063ef8b30f714610e8d578063f5efbb4f14610ead578063f7532d5f14610ece578063ffc339c614610eef57600080fd5b8063d905777e14610d84578063db8d55f114610da4578063dd62ed3e14610dce578063e492cdce14610e14578063e63ab1e914610e2957600080fd5b8063c63d75b611610108578063c63d75b614610ce4578063c6e6f59214610d04578063ca15c87314610d24578063ce96cb7714610d44578063d547741f14610d6457600080fd5b8063ba08765214610c56578063bc2cea1f14610c76578063bf63054814610c96578063c107318714610cb6578063c24a0f8b14610ccd57600080fd5b80639e082d43116101d2578063ac0e6d4611610196578063ac0e6d4614610bbf578063b0f7c08614610bd6578063b3d7f6b914610bf6578063b460af9414610c16578063b8b2f95514610c3657600080fd5b80639e082d4314610b295780639e5602fa14610b4a578063a217fddf14610b6a578063a457c2d714610b7f578063a9059cbb14610b9f57600080fd5b806395d89b411161021957806395d89b4114610a81578063960137cc14610a965780639944d10a14610ab65780639a422b7814610af25780639b18d96614610b0957600080fd5b80638cd2e0c7146109e05780639010d07c14610a0057806391d1485414610a20578063949b22ae14610a4057806394bf804d14610a6157600080fd5b8063395093511161037c57806366330a59116102f95780637f72c2d8116102bd5780637f72c2d814610932578063816e117c1461095257806382ef25fd146109725780638456cb591461098957806386aa0c4a1461099e57806386afe40b146109bf57600080fd5b806366330a59146108865780636c3d4e03146108a75780636e553f65146108bc57806370a08231146108dc578063736e7ef31461091257600080fd5b80634cdad506116103405780634cdad506146108065780634f1ef28614610826578063527f346a1461083957806352d1902d146108595780635c975abb1461086e57600080fd5b806339509351146107795780633f4ba83a14610799578063402d267d146107ae57806349edd0c7146107ce5780634bb4193c146107e457600080fd5b806323b872dd1161040a578063313ce567116103ce578063313ce567146106b357806336568abe146106e05780633659cfe6146107005780633784f0001461072057806338d52e0f1461074057600080fd5b806323b872dd14610615578063248a9ca3146106355780632565b159146106655780632dd95f691461067c5780632f2ff15d1461069357600080fd5b80630a28a477116104515780630a28a47714610548578063150b7a021461056857806318160ddd146105ad578063203e3ce7146105c257806320ea51c3146105e457600080fd5b806301e1d1141461048e57806301ffc9a7146104b657806306fdde03146104e657806307a2d13a14610508578063095ea7b314610528575b600080fd5b34801561049a57600080fd5b506104a3610f0f565b6040519081526020015b60405180910390f35b3480156104c257600080fd5b506104d66104d1366004615079565b610f23565b60405190151581526020016104ad565b3480156104f257600080fd5b506104fb610fd5565b6040516104ad91906150c2565b34801561051457600080fd5b506104a36105233660046150f5565b611067565b34801561053457600080fd5b506104d6610543366004615123565b6110a7565b34801561055457600080fd5b506104a36105633660046150f5565b6110bd565b34801561057457600080fd5b50610594610583366004615198565b630a85bd0160e11b95945050505050565b6040516001600160e01b031990911681526020016104ad565b3480156105b957600080fd5b506035546104a3565b3480156105ce57600080fd5b506105e26105dd36600461520b565b61112d565b005b3480156105f057600080fd5b506104d66105ff36600461520b565b6101316020526000908152604090205460ff1681565b34801561062157600080fd5b506104d6610630366004615228565b61118b565b34801561064157600080fd5b506104a36106503660046150f5565b60009081526097602052604090206001015490565b34801561067157600080fd5b506104a361012f5481565b34801561068857600080fd5b506104a36101355481565b34801561069f57600080fd5b506105e26106ae366004615269565b611235565b3480156106bf57600080fd5b5061012d54600160a01b900460ff1660405160ff90911681526020016104ad565b3480156106ec57600080fd5b506105e26106fb366004615269565b611260565b34801561070c57600080fd5b506105e261071b36600461520b565b6112da565b34801561072c57600080fd5b506105e261073b3660046150f5565b6113ba565b34801561074c57600080fd5b5061012d54610761906001600160a01b031681565b6040516001600160a01b0390911681526020016104ad565b34801561078557600080fd5b506104d6610794366004615123565b611460565b3480156107a557600080fd5b506105e261149c565b3480156107ba57600080fd5b506104a36107c936600461520b565b6114bd565b3480156107da57600080fd5b506104a361271081565b3480156107f057600080fd5b506104a3600080516020615b7c83398151915281565b34801561081257600080fd5b506104a36108213660046150f5565b611532565b6105e26108343660046152af565b611565565b34801561084557600080fd5b506105e2610854366004615381565b611632565b34801561086557600080fd5b506104a36116ac565b34801561087a57600080fd5b5060fb5460ff166104d6565b34801561089257600080fd5b5061013a54610761906001600160a01b031681565b3480156108b357600080fd5b506105e261175f565b3480156108c857600080fd5b506104a36108d7366004615269565b6117a5565b3480156108e857600080fd5b506104a36108f736600461520b565b6001600160a01b031660009081526033602052604090205490565b34801561091e57600080fd5b506105e261092d366004615123565b611869565b34801561093e57600080fd5b506105e261094d3660046153af565b611949565b34801561095e57600080fd5b506105e261096d3660046150f5565b6119b7565b34801561097e57600080fd5b506104a36101375481565b34801561099557600080fd5b506105e2611a30565b3480156109aa57600080fd5b5061013b54610761906001600160a01b031681565b3480156109cb57600080fd5b5061013c54610761906001600160a01b031681565b3480156109ec57600080fd5b506105e26109fb366004615404565b611a51565b348015610a0c57600080fd5b50610761610a1b366004615439565b611d59565b348015610a2c57600080fd5b506104d6610a3b366004615269565b611d71565b348015610a4c57600080fd5b5061013e54610761906001600160a01b031681565b348015610a6d57600080fd5b506104a3610a7c366004615269565b611d9c565b348015610a8d57600080fd5b506104fb611e75565b348015610aa257600080fd5b506105e2610ab1366004615123565b611e84565b348015610ac257600080fd5b506104d6610ad1366004615123565b61013f60209081526000928352604080842090915290825290205460ff1681565b348015610afe57600080fd5b506104a36101345481565b348015610b1557600080fd5b506105e2610b2436600461520b565b61226c565b348015610b3557600080fd5b5061013d54610761906001600160a01b031681565b348015610b5657600080fd5b506105e2610b6536600461520b565b6122bd565b348015610b7657600080fd5b506104a3600081565b348015610b8b57600080fd5b506104d6610b9a366004615123565b612351565b348015610bab57600080fd5b506104d6610bba366004615123565b6123ac565b348015610bcb57600080fd5b506104a36101335481565b348015610be257600080fd5b506105e2610bf136600461520b565b6123b9565b348015610c0257600080fd5b506104a3610c113660046150f5565b61240a565b348015610c2257600080fd5b506104a3610c3136600461545b565b612460565b348015610c4257600080fd5b506104a3610c513660046153af565b61252e565b348015610c6257600080fd5b506104a3610c7136600461545b565b61269d565b348015610c8257600080fd5b506105e2610c9136600461520b565b612762565b348015610ca257600080fd5b506105e2610cb13660046154f4565b6127b3565b348015610cc257600080fd5b506104a36101365481565b348015610cd957600080fd5b506104a361012e5481565b348015610cf057600080fd5b506104a3610cff36600461520b565b612c1c565b348015610d1057600080fd5b506104a3610d1f3660046150f5565b612c91565b348015610d3057600080fd5b506104a3610d3f3660046150f5565b612d1e565b348015610d5057600080fd5b506104a3610d5f36600461520b565b612d35565b348015610d7057600080fd5b506105e2610d7f366004615269565b612d83565b348015610d9057600080fd5b506104a3610d9f36600461520b565b612da9565b348015610db057600080fd5b50610db9612df7565b604080519283526020830191909152016104ad565b348015610dda57600080fd5b506104a3610de93660046155c7565b6001600160a01b03918216600090815260346020908152604080832093909416825291909152205490565b348015610e2057600080fd5b506104a3612e0c565b348015610e3557600080fd5b506104a3600080516020615b3583398151915281565b348015610e5757600080fd5b506104a3600080516020615b1583398151915281565b348015610e7957600080fd5b506105e2610e88366004615123565b612e54565b348015610e9957600080fd5b506104a3610ea83660046150f5565b612e9a565b348015610eb957600080fd5b5061013054610761906001600160a01b031681565b348015610eda57600080fd5b5061013254610761906001600160a01b031681565b348015610efb57600080fd5b506105e2610f0a36600461520b565b612ef0565b600080610f1a612f47565b50909392505050565b60006001600160e01b031982166301ffc9a760e01b1480610f5457506001600160e01b031982166336372b0760e01b145b80610f6f57506001600160e01b031982166306fdde0360e01b145b80610f8a57506001600160e01b031982166395d89b4160e01b145b80610fa557506001600160e01b0319821663313ce56760e01b145b80610fc057506001600160e01b0319821663043eff2d60e51b145b80610fcf5750610fcf826130e7565b92915050565b606060368054610fe4906155f5565b80601f0160208091040260200160405190810160405280929190818152602001828054611010906155f5565b801561105d5780601f106110325761010080835404028352916020019161105d565b820191906000526020600020905b81548152906001019060200180831161104057829003601f168201915b5050505050905090565b60008061107360355490565b9050806110835750600092915050565b8061108c610f0f565b6110969085615640565b6110a0919061565f565b9392505050565b60006110b433848461310c565b50600192915050565b61013c54604051630a28a47760e01b8152600481018390526000916001600160a01b031690630a28a477906024015b602060405180830381865afa158015611109573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fcf9190615681565b600080516020615b7c833981519152611146813361313a565b61013b546001600160a01b038381169116141561117e5760405162461bcd60e51b81526004016111759061569a565b60405180910390fd5b6111878261319e565b5050565b60006111988484846131e9565b6001600160a01b03841660009081526034602090815260408083203384529091529020548281101561121d5760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b6064820152608401611175565b61122a853385840361310c565b506001949350505050565b600082815260976020526040902060010154611251813361313a565b61125b83836132a9565b505050565b6001600160a01b03811633146112d05760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401611175565b61118782826132cb565b306001600160a01b037f0000000000000000000000005c6b0d8070ddc0a6a85c460819c3a91c628070ec1614156113235760405162461bcd60e51b8152600401611175906156d1565b7f0000000000000000000000005c6b0d8070ddc0a6a85c460819c3a91c628070ec6001600160a01b031661136c600080516020615af5833981519152546001600160a01b031690565b6001600160a01b0316146113925760405162461bcd60e51b81526004016111759061571d565b61139b816132ed565b604080516000808252602082019092526113b7918391906132f9565b50565b600080516020615b158339815191526113d3813361313a565b4261012e54116113f55760405162461bcd60e51b815260040161117590615769565b61012e548210801561140957506101395482115b801561141457504282115b6114595760405162461bcd60e51b815260206004820152601660248201527546503a4e657720656e644461746520746f6f2062696760501b6044820152606401611175565b5061012e55565b3360008181526034602090815260408083206001600160a01b038716845290915281205490916110b4918590611497908690615796565b61310c565b600080516020615b358339815191526114b5813361313a565b6113b7613464565b60006114cb60fb5460ff1690565b806114d9575061012e544210155b156114e657506000919050565b61012f546114f2610f0f565b106114ff57506000919050565b61013b5460405163402d267d60e01b81526001600160a01b0384811660048301529091169063402d267d906024016110ec565b61013c5460405163266d6a8360e11b8152600481018390526000916001600160a01b031690634cdad506906024016110ec565b306001600160a01b037f0000000000000000000000005c6b0d8070ddc0a6a85c460819c3a91c628070ec1614156115ae5760405162461bcd60e51b8152600401611175906156d1565b7f0000000000000000000000005c6b0d8070ddc0a6a85c460819c3a91c628070ec6001600160a01b03166115f7600080516020615af5833981519152546001600160a01b031690565b6001600160a01b03161461161d5760405162461bcd60e51b81526004016111759061571d565b611626826132ed565b611187828260016132f9565b600080516020615b1583398151915261164b813361313a565b6001600160a01b03831660008181526101316020908152604091829020805460ff191686151590811790915591519182527ff8cf255ebd621cf205dad476bf0d4fcd5f8f07f29e214e7e1b9bc05e148f962f910160405180910390a2505050565b6000306001600160a01b037f0000000000000000000000005c6b0d8070ddc0a6a85c460819c3a91c628070ec161461174c5760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c00000000000000006064820152608401611175565b50600080516020615af583398151915290565b60fb5460ff16156117825760405162461bcd60e51b8152600401611175906157ae565b60008061178d612df7565b915091506117996134f7565b611187600083836135e3565b60006117b360fb5460ff1690565b156117d05760405162461bcd60e51b8152600401611175906157ae565b61013b546040516372db078560e11b8152336004820152602481018590526001600160a01b038481166044830152600092839291169063e5b60f0a9060640160408051808303816000875af115801561182d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061185191906157d8565b91509150611861848387846137f5565b509392505050565b600080516020615b15833981519152611882813361313a565b6040516340e58ee560e01b8152600481018390526001600160a01b038416906340e58ee5906024015b600060405180830381600087803b1580156118c557600080fd5b505af11580156118d9573d6000803e3d6000fd5b505061013a546040516351faf67f60e11b81526001600160a01b03909116925063a3f5ecfe9150611912903090879087906004016157fc565b600060405180830381600087803b15801561192c57600080fd5b505af1158015611940573d6000803e3d6000fd5b50505050505050565b600080516020615b15833981519152611962813361313a565b61197c84856001600160a01b0316633ff35f7a86866139fb565b506040516001600160a01b038516907f2e18aef13edc81f6faee62e1aa4c095c75dd2f438f7bc921e53798ddb501c9cc90600090a250505050565b600080516020615b158339815191526119d0813361313a565b61012f548214156119f35760405162461bcd60e51b81526004016111759061569a565b61012f8290556040518281527f1696b1614dceaf3357feaee97503be9c87f818f9a44aab42625f950675c2c67f9060200160405180910390a15050565b600080516020615b35833981519152611a49813361313a565b6113b7613b7d565b60fb5460ff1615611a745760405162461bcd60e51b8152600401611175906157ae565b60008111611abb5760405162461bcd60e51b8152602060048201526014602482015273046503a416d6f756e742063616e277420626520360641b6044820152606401611175565b60405163be5e5c1b60e01b81526004810183905233906001600160a01b0385169063be5e5c1b90602401602060405180830381865afa158015611b02573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b269190615820565b6001600160a01b031614611b715760405162461bcd60e51b815260206004820152601260248201527111940e95dc9bdb99c81c9958da5c1a595b9d60721b6044820152606401611175565b6001600160a01b038316600090815261013f6020908152604080832085845290915290205460ff16611bdf5760405162461bcd60e51b815260206004820152601760248201527611940e925b9cdd1c9d5b595b9d081b9bdd081859191959604a1b6044820152606401611175565b600080611bea612df7565b60405163d8aed14560e01b8152600481018790526024810186905291935091506001600160a01b0386169063d8aed1459060440160408051808303816000875af1158015611c3c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c6091906157d8565b505061013a546040516351faf67f60e11b81526001600160a01b039091169063a3f5ecfe90611c97903090899089906004016157fc565b600060405180830381600087803b158015611cb157600080fd5b505af1158015611cc5573d6000803e3d6000fd5b50505050611cd16134f7565b826101336000828254611ce49190615796565b909155505061012d54611d02906001600160a01b0316333086613bd5565b611d0e600083836135e3565b83856001600160a01b03167f874192b07a05592084193e0817f2b3ef896d2835ca93a77a0cba0d1af97a51d085604051611d4a91815260200190565b60405180910390a35050505050565b600082815260c9602052604081206110a09083613c33565b60009182526097602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6000611daa60fb5460ff1690565b15611dc75760405162461bcd60e51b8152600401611175906157ae565b61013b5460405163cd50ae6f60e01b8152336004820152602481018590526001600160a01b038481166044830152600092839291169063cd50ae6f9060640160408051808303816000875af1158015611e24573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e4891906157d8565b9092509050611e628486611e5c8486615796565b846137f5565b611e6c8183615796565b95945050505050565b606060378054610fe4906155f5565b600080516020615b15833981519152611e9d813361313a565b6001600160a01b038316600090815261013f6020908152604080832085845290915290205460ff16611f0b5760405162461bcd60e51b815260206004820152601760248201527611940e925b9cdd1c9d5b595b9d081b9bdd081859191959604a1b6044820152606401611175565b600080611f16612df7565b60405163be5e5c1b60e01b81526004810187905291935091506000906001600160a01b0387169063be5e5c1b90602401602060405180830381865afa158015611f63573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f879190615820565b6040516314f2949360e01b8152600481018790529091506000906001600160a01b038816906314f2949390602401602060405180830381865afa158015611fd2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ff69190615681565b6040516395805dad60e01b8152600481018890529091506001600160a01b038816906395805dad90602401600060405180830381600087803b15801561203b57600080fd5b505af115801561204f573d6000803e3d6000fd5b5050604051634cac5b4b60e01b815260048101899052600092506001600160a01b038a169150634cac5b4b90602401602060405180830381865afa15801561209b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120bf9190615681565b61013354909150846120d18785615796565b6120db9190615796565b11156121235760405162461bcd60e51b815260206004820152601760248201527646503a4e6f7420656e6f756768206c697175696469747960481b6044820152606401611175565b61012e548111156121765760405162461bcd60e51b815260206004820181905260248201527f46503a496e737472756d656e74206861732062696767657220656e64446174656044820152606401611175565b61217f81613c3f565b6121876134f7565b81610133600082825461219a919061583d565b909155506121ac9050600086866135e3565b61013a5460405163d6cdfcad60e01b81526001600160a01b039091169063d6cdfcad906121e19030908c908c906004016157fc565b600060405180830381600087803b1580156121fb57600080fd5b505af115801561220f573d6000803e3d6000fd5b505061012d5461222c92506001600160a01b031690508484613c50565b60405187906001600160a01b038a16907f9d7087e04e7d74650aeda7c049237923252c52a7ad2732a97a2a3f2a97f49a1990600090a35050505050505050565b600080516020615b15833981519152612285813361313a565b610132546001600160a01b03838116911614156122b45760405162461bcd60e51b81526004016111759061569a565b61118782613c80565b600080516020615b7c8339815191526122d6813361313a565b61013a546001600160a01b03838116911614156123055760405162461bcd60e51b81526004016111759061569a565b61013a80546001600160a01b0319166001600160a01b0384169081179091556040517ff36ab311deb0233025ceb486e5c01a2428794f934e1bbb582be1f40ed95678f990600090a25050565b3360009081526034602090815260408083206001600160a01b0386168452909152812054828110156123955760405162461bcd60e51b815260040161117590615854565b6123a2338585840361310c565b5060019392505050565b60006110b43384846131e9565b600080516020615b7c8339815191526123d2813361313a565b61013c546001600160a01b03838116911614156124015760405162461bcd60e51b81526004016111759061569a565b61118782613ccb565b600061012e54421061242e5760405162461bcd60e51b815260040161117590615769565b61013b5460405163b3d7f6b960e01b8152600481018490526001600160a01b039091169063b3d7f6b9906024016110ec565b600061246e60fb5460ff1690565b1561248b5760405162461bcd60e51b8152600401611175906157ae565b61013c546040516364a0366360e01b8152336004820152602481018690526001600160a01b038581166044830152848116606483015260009283929116906364a036639060840160408051808303816000875af11580156124f0573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061251491906157d8565b915091506125258486848985613d16565b50949350505050565b6000600080516020615b15833981519152612549813361313a565b600061256586876001600160a01b03166352c963c388886139fb565b905060008180602001905181019061257d9190615681565b61012d54604051638ea06f8160e01b8152600481018390529192506001600160a01b039081169190891690638ea06f8190602401602060405180830381865afa1580156125ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125f29190615820565b6001600160a01b03161461263c5760405162461bcd60e51b815260206004820152601160248201527008ca074a8ded6cadc40dad2e6dac2e8c6d607b1b6044820152606401611175565b6001600160a01b038716600081815261013f60209081526040808320858452909152808220805460ff19166001179055518392917ff1034132e5379b5206b4f4b64dc7485b712138905f7b9dff440646bac5687eb291a39695505050505050565b60006126ab60fb5460ff1690565b156126c85760405162461bcd60e51b8152600401611175906157ae565b61013c5460405163d34cf33560e01b8152336004820152602481018690526001600160a01b0385811660448301528481166064830152600092839291169063d34cf3359060840160408051808303816000875af115801561272d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061275191906157d8565b915091506125258486888585613d16565b600080516020615b7c83398151915261277b813361313a565b61013e546001600160a01b03838116911614156127aa5760405162461bcd60e51b81526004016111759061569a565b61118782613ec8565b600054610100900460ff166127ce5760005460ff16156127d2565b303b155b6128355760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401611175565b600054610100900460ff16158015612857576000805461ffff19166101011790555b600089116128a05760405162461bcd60e51b8152602060048201526016602482015275046503a4475726174696f6e2063616e277420626520360541b6044820152606401611175565b61296c8a6001600160a01b031663420f68616040518163ffffffff1660e01b8152600401602060405180830381865afa1580156128e1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129059190615820565b8b6001600160a01b031663f7fb869b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612943573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129679190615820565b613f13565b6129f56129798380615899565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506129bb925050506020850185615899565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250613f6d92505050565b612a0d600080516020615b15833981519152886132a9565b612a25600080516020615b7c833981519152886132a9565b612a2e87613c80565b61013080546001600160a01b0319166001600160a01b038c16179055612a548942615796565b61012e5561012d80546001600160a01b0319166001600160a01b038a1690811790915561012f8790556040805163313ce56760e01b8152905163313ce567916004808201926020929091908290030181865afa158015612ab8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612adc91906158e0565b61012d805460ff92909216600160a01b0260ff60a01b19909216919091179055612b11612b0c602087018761520b565b61319e565b612b29612b24604087016020880161520b565b613ccb565b612b41612b3c606087016040880161520b565b613fa6565b612b59612b5460a087016080880161520b565b613ec8565b612b69608086016060870161520b565b61013a80546001600160a01b0319166001600160a01b039290921691909117905560005b83811015612bfd5760016101316000878785818110612bae57612bae615903565b9050602002016020810190612bc3919061520b565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580612bf581615919565b915050612b8d565b508015612c10576000805461ff00191690555b50505050505050505050565b6000612c2a60fb5460ff1690565b80612c38575061012e544210155b15612c4557506000919050565b61012f54612c51610f0f565b10612c5e57506000919050565b61013b5460405163631ebadb60e11b81526001600160a01b0384811660048301529091169063c63d75b6906024016110ec565b600080612c9d60355490565b905080612cab575090919050565b6000612cb5610f0f565b905060008111612cfb5760405162461bcd60e51b815260206004820152601160248201527046503a496e66696e6974652076616c756560781b6044820152606401611175565b80612d068386615640565b612d10919061565f565b949350505050565b50919050565b600081815260c960205260408120610fcf90613ff1565b6000612d4360fb5460ff1690565b15612d5057506000919050565b61013c5460405163ce96cb7760e01b81526001600160a01b0384811660048301529091169063ce96cb77906024016110ec565b600082815260976020526040902060010154612d9f813361313a565b61125b83836132cb565b6000612db760fb5460ff1690565b15612dc457506000919050565b61013c54604051636c82bbbf60e11b81526001600160a01b0384811660048301529091169063d905777e906024016110ec565b600080612e02612f47565b9094909350915050565b6000806000612e19612df7565b90925090506000612e2a8284615796565b9050806101335411612e3d576000612e4c565b8061013354612e4c919061583d565b935050505090565b600080516020615b15833981519152612e6d813361313a565b60405163543a181160e11b8152600481018390526001600160a01b0384169063a8743022906024016118ab565b600061012e544210612ebe5760405162461bcd60e51b815260040161117590615769565b61013b5460405163ef8b30f760e01b8152600481018490526001600160a01b039091169063ef8b30f7906024016110ec565b600080516020615b7c833981519152612f09813361313a565b61013d546001600160a01b0383811691161415612f385760405162461bcd60e51b81526004016111759061569a565b61118782613fa6565b3b151590565b61013a546040516357bcd95360e11b8152306004820152600091829182916001600160a01b03169063af79b2a690602401602060405180830381865afa158015612f95573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fb99190615681565b61013354612fc79190615796565b925060006101375461013654612fdd9190615796565b9050610136549250610137549150808411612ffc576000935050909192565b613006818561583d565b93506101385442101561301b5761301b615934565b6000610138544261302c919061583d565b6130369086615640565b905060006127106301e1338061013454846130519190615640565b61305b919061565f565b613065919061565f565b905060006127106301e1338061013554856130809190615640565b61308a919061565f565b613094919061565f565b905060006130a28284615796565b90506130ae8388615796565b96506130ba8287615796565b95508088116130d157600097505050505050909192565b6130db818961583d565b97505050505050909192565b60006001600160e01b03198216635a05180f60e01b1480610fcf5750610fcf82613ffb565b60fb5460ff161561312f5760405162461bcd60e51b8152600401611175906157ae565b61125b838383614030565b6131448282611d71565b6111875761315c816001600160a01b03166014614154565b613167836020614154565b60405160200161317892919061594a565b60408051601f198184030181529082905262461bcd60e51b8252611175916004016150c2565b61013b80546001600160a01b0319166001600160a01b0383169081179091556040517f018be14c714b75a62c21e130c709ef781133dda00729e11ba9aca9d0e6747f2290600090a250565b60fb5460ff161561320c5760405162461bcd60e51b8152600401611175906157ae565b61013d546040516372331c7360e11b81526001600160a01b039091169063e46638e690613241908690869086906004016157fc565b602060405180830381865afa15801561325e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061328291906159bf565b61329e5760405162461bcd60e51b8152600401611175906159dc565b61125b8383836142f0565b6132b382826144be565b600082815260c96020526040902061125b9082614544565b6132d58282614559565b600082815260c96020526040902061125b90826145c0565b6000611187813361313a565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff161561332c5761125b836145d5565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015613386575060408051601f3d908101601f1916820190925261338391810190615681565b60015b6133e95760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b6064820152608401611175565b600080516020615af583398151915281146134585760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b6064820152608401611175565b5061125b838383614671565b60fb5460ff166134ad5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401611175565b60fb805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b4261013855610130546040805162b1f0b160e71b815290516001600160a01b03909216916358f85880916004808201926020929091908290030181865afa158015613546573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061356a9190615681565b6101345561013e54604080516327d8cdfb60e21b815290516001600160a01b0390921691639f6337ec916004808201926020929091908290030181865afa1580156135b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135dd9190615681565b61013555565b826101335410156135f6576135f6615934565b826101336000828254613609919061583d565b9091555050610132546040518481526001600160a01b03909116907f075a2720282fdf622141dae0b048ef90a21a7e57c134c76912d19d006b3b3f6f9060200160405180910390a2600061365c83614696565b610136919091556101338054919250829160009061367b90849061583d565b9091555050610130546040805163803db96d60e01b815290516000926001600160a01b03169163803db96d9160048083019260209291908290030181865afa1580156136cb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136ef9190615820565b9050806001600160a01b03167f075a2720282fdf622141dae0b048ef90a21a7e57c134c76912d19d006b3b3f6f8360405161372c91815260200190565b60405180910390a2600061373f84614696565b610137919091556101338054919250829160009061375e90849061583d565b9091555050610132546040518281526001600160a01b03909116907f075a2720282fdf622141dae0b048ef90a21a7e57c134c76912d19d006b3b3f6f9060200160405180910390a261012d546137be906001600160a01b03168385613c50565b610132546137ed906001600160a01b03166137d98389615796565b61012d546001600160a01b03169190613c50565b505050505050565b6001600160a01b0384163014156138485760405162461bcd60e51b815260206004820152601760248201527623281d2bb937b733903932b1b2b4bb32b917b7bbb732b960491b6044820152606401611175565b61012e54421061386a5760405162461bcd60e51b815260040161117590615769565b808210156138ba5760405162461bcd60e51b815260206004820152601960248201527f46503a46656520626967676572207468616e20617373657473000000000000006044820152606401611175565b60006138c6828461583d565b90506000811180156138d85750600084115b6138f45760405162461bcd60e51b8152600401611175906159dc565b6000806000613901612f47565b92509250925061012f5483856139179190615796565b111561395c5760405162461bcd60e51b815260206004820152601460248201527311940e941bdc9d199bdb1a5bc81a5cc8199d5b1b60621b6044820152606401611175565b6139646134f7565b8561013360008282546139779190615796565b90915550613987905088886146cc565b61012d546139a0906001600160a01b0316333089613bd5565b6139ab8583836135e3565b60408051878152602081018990526001600160a01b038a169133917fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d7910160405180910390a35050505050505050565b6001600160a01b0385166000908152610131602052604090205460609060ff16613a675760405162461bcd60e51b815260206004820152601960248201527f46503a496e737472756d656e74206e6f7420616c6c6f776564000000000000006044820152606401611175565b613a718284615a13565b6001600160e01b03191685856040518163ffffffff1660e01b81526004016020604051808303816000875af1158015613aae573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613ad29190615a43565b6001600160e01b03191614613b295760405162461bcd60e51b815260206004820152601860248201527f46503a496e76616c69642066756e6374696f6e2063616c6c00000000000000006044820152606401611175565b613b7383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250506001600160a01b038a16929150506147ab565b9695505050505050565b60fb5460ff1615613ba05760405162461bcd60e51b8152600401611175906157ae565b60fb805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586134da3390565b613c2d846323b872dd60e01b858585604051602401613bf6939291906157fc565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526147ed565b50505050565b60006110a083836148bf565b610139548111156113b75761013955565b6040516001600160a01b03831660248201526044810182905261125b90849063a9059cbb60e01b90606401613bf6565b61013280546001600160a01b0319166001600160a01b0383169081179091556040517fbbc61907feddb73f1c072a4b6dadd1e04e05c389fcf6fcc1888908dca119123b90600090a250565b61013c80546001600160a01b0319166001600160a01b0383169081179091556040517f36630f6b0e59bf42cd06c5bf86594f8a30d2e8435357a7a1b01908ca6e47286090600090a250565b6001600160a01b0384163014801590613d3857506001600160a01b0385163014155b613d7e5760405162461bcd60e51b815260206004820152601760248201527623281d2bb937b733903932b1b2b4bb32b917b7bbb732b960491b6044820152606401611175565b600082118015613d8e5750600083115b613daa5760405162461bcd60e51b8152600401611175906159dc565b600080613db5612df7565b6101335491935091508382613dca8588615796565b613dd49190615796565b613dde9190615796565b1115613e265760405162461bcd60e51b815260206004820152601760248201527646503a4e6f7420656e6f756768206c697175696469747960481b6044820152606401611175565b613e2e6134f7565b613e398733876148e9565b836101336000828254613e4c919061583d565b909155505061012d54613e69906001600160a01b03168786613c50565b613e748383836135e3565b60408051858152602081018790526001600160a01b03808a16929089169133917ffbde797d201c681b91056529119e0b02407c7bb96a4a2c75c01fc9667232c8db910160405180910390a450505050505050565b61013e80546001600160a01b0319166001600160a01b0383169081179091556040517f41f2dcecb53645bb58cfe08bfb1f3c2c21045fc82efd81c92a7b16db5e454aac90600090a250565b600054610100900460ff16613f3a5760405162461bcd60e51b815260040161117590615a60565b613f42614961565b613f4a6149aa565b613f556000836132a9565b611187600080516020615b35833981519152826132a9565b600054610100900460ff16613f945760405162461bcd60e51b815260040161117590615a60565b613f9c6149e1565b6111878282614a08565b61013d80546001600160a01b0319166001600160a01b0383169081179091556040517f10d437923d74978fa15eb65ab36d9b44221448a3d871afd3ea2177b9d25884ac90600090a250565b6000610fcf825490565b60006001600160e01b03198216637965db0b60e01b1480610fcf57506301ffc9a760e01b6001600160e01b0319831614610fcf565b6001600160a01b0383166140925760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401611175565b6001600160a01b0382166140f35760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401611175565b6001600160a01b0383811660008181526034602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b60606000614163836002615640565b61416e906002615796565b67ffffffffffffffff81111561418657614186615299565b6040519080825280601f01601f1916602001820160405280156141b0576020820181803683370190505b509050600360fc1b816000815181106141cb576141cb615903565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106141fa576141fa615903565b60200101906001600160f81b031916908160001a905350600061421e846002615640565b614229906001615796565b90505b60018111156142a1576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061425d5761425d615903565b1a60f81b82828151811061427357614273615903565b60200101906001600160f81b031916908160001a90535060049490941c9361429a81615aab565b905061422c565b5083156110a05760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401611175565b6001600160a01b0383166143545760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401611175565b6001600160a01b0382166143b65760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401611175565b6001600160a01b0383166000908152603360205260409020548181101561442e5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401611175565b6001600160a01b03808516600090815260336020526040808220858503905591851681529081208054849290614465908490615796565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516144b191815260200190565b60405180910390a3613c2d565b6144c88282611d71565b6111875760008281526097602090815260408083206001600160a01b03851684529091529020805460ff191660011790556145003390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60006110a0836001600160a01b038416614a56565b6145638282611d71565b156111875760008281526097602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60006110a0836001600160a01b038416614aa5565b6001600160a01b0381163b6146425760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401611175565b600080516020615af583398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b61467a83614b98565b6000825111806146875750805b1561125b57613c2d8383614bd8565b600080600080846101335410156146c257610133546146b5908661583d565b9150610133549050612e02565b5060009492505050565b6001600160a01b0382166147225760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401611175565b80603560008282546147349190615796565b90915550506001600160a01b03821660009081526033602052604081208054839290614761908490615796565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b60606110a083836040518060400160405280601e81526020017f416464726573733a206c6f772d6c6576656c2063616c6c206661696c65640000815250614bfd565b6000614842826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316614bfd9092919063ffffffff16565b80519091501561125b578080602001905181019061486091906159bf565b61125b5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401611175565b60008260000182815481106148d6576148d6615903565b9060005260206000200154905092915050565b826001600160a01b0316826001600160a01b031614614957576001600160a01b0383166000908152603460209081526040808320338452909152902054818110156149465760405162461bcd60e51b815260040161117590615854565b6149558433611497858561583d565b505b61125b8382614c0c565b600054610100900460ff166149885760405162461bcd60e51b815260040161117590615a60565b6149906149e1565b6149986149e1565b6149a06149e1565b6149a86149e1565b565b600054610100900460ff166149d15760405162461bcd60e51b815260040161117590615a60565b6149d96149e1565b6149a8614d5a565b600054610100900460ff166149a85760405162461bcd60e51b815260040161117590615a60565b600054610100900460ff16614a2f5760405162461bcd60e51b815260040161117590615a60565b8151614a42906036906020850190614fca565b50805161125b906037906020840190614fca565b6000818152600183016020526040812054614a9d57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610fcf565b506000610fcf565b60008181526001830160205260408120548015614b8e576000614ac960018361583d565b8554909150600090614add9060019061583d565b9050818114614b42576000866000018281548110614afd57614afd615903565b9060005260206000200154905080876000018481548110614b2057614b20615903565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080614b5357614b53615ac2565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610fcf565b6000915050610fcf565b614ba1816145d5565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606110a08383604051806060016040528060278152602001615b5560279139614d8d565b6060612d108484600085614e60565b6001600160a01b038216614c6c5760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401611175565b6001600160a01b03821660009081526033602052604090205481811015614ce05760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401611175565b6001600160a01b0383166000908152603360205260408120838303905560358054849290614d0f90849061583d565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a3505050565b600054610100900460ff16614d815760405162461bcd60e51b815260040161117590615a60565b60fb805460ff19169055565b60606001600160a01b0384163b614df55760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401611175565b600080856001600160a01b031685604051614e109190615ad8565b600060405180830381855af49150503d8060008114614e4b576040519150601f19603f3d011682016040523d82523d6000602084013e614e50565b606091505b5091509150613b73828286614f91565b606082471015614ec15760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401611175565b6001600160a01b0385163b614f185760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401611175565b600080866001600160a01b03168587604051614f349190615ad8565b60006040518083038185875af1925050503d8060008114614f71576040519150601f19603f3d011682016040523d82523d6000602084013e614f76565b606091505b5091509150614f86828286614f91565b979650505050505050565b60608315614fa05750816110a0565b825115614fb05782518084602001fd5b8160405162461bcd60e51b815260040161117591906150c2565b828054614fd6906155f5565b90600052602060002090601f016020900481019282614ff8576000855561503e565b82601f1061501157805160ff191683800117855561503e565b8280016001018555821561503e579182015b8281111561503e578251825591602001919060010190615023565b5061504a92915061504e565b5090565b5b8082111561504a576000815560010161504f565b6001600160e01b0319811681146113b757600080fd5b60006020828403121561508b57600080fd5b81356110a081615063565b60005b838110156150b1578181015183820152602001615099565b83811115613c2d5750506000910152565b60208152600082518060208401526150e1816040850160208701615096565b601f01601f19169190910160400192915050565b60006020828403121561510757600080fd5b5035919050565b6001600160a01b03811681146113b757600080fd5b6000806040838503121561513657600080fd5b82356151418161510e565b946020939093013593505050565b60008083601f84011261516157600080fd5b50813567ffffffffffffffff81111561517957600080fd5b60208301915083602082850101111561519157600080fd5b9250929050565b6000806000806000608086880312156151b057600080fd5b85356151bb8161510e565b945060208601356151cb8161510e565b935060408601359250606086013567ffffffffffffffff8111156151ee57600080fd5b6151fa8882890161514f565b969995985093965092949392505050565b60006020828403121561521d57600080fd5b81356110a08161510e565b60008060006060848603121561523d57600080fd5b83356152488161510e565b925060208401356152588161510e565b929592945050506040919091013590565b6000806040838503121561527c57600080fd5b82359150602083013561528e8161510e565b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b600080604083850312156152c257600080fd5b82356152cd8161510e565b9150602083013567ffffffffffffffff808211156152ea57600080fd5b818501915085601f8301126152fe57600080fd5b81358181111561531057615310615299565b604051601f8201601f19908116603f0116810190838211818310171561533857615338615299565b8160405282815288602084870101111561535157600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b80151581146113b757600080fd5b6000806040838503121561539457600080fd5b823561539f8161510e565b9150602083013561528e81615373565b6000806000604084860312156153c457600080fd5b83356153cf8161510e565b9250602084013567ffffffffffffffff8111156153eb57600080fd5b6153f78682870161514f565b9497909650939450505050565b60008060006060848603121561541957600080fd5b83356154248161510e565b95602085013595506040909401359392505050565b6000806040838503121561544c57600080fd5b50508035926020909101359150565b60008060006060848603121561547057600080fd5b8335925060208401356154828161510e565b915060408401356154928161510e565b809150509250925092565b60008083601f8401126154af57600080fd5b50813567ffffffffffffffff8111156154c757600080fd5b6020830191508360208260051b850101111561519157600080fd5b600060408284031215612d1857600080fd5b6000806000806000806000806000898b0361018081121561551457600080fd5b8a3561551f8161510e565b995060208b0135985060408b01356155368161510e565b975060608b01356155468161510e565b965060808b0135955060a0609f198201121561556157600080fd5b5060a08a0193506101408a013567ffffffffffffffff8082111561558457600080fd5b6155908d838e0161549d565b90955093506101608c01359150808211156155aa57600080fd5b506155b78c828d016154e2565b9150509295985092959850929598565b600080604083850312156155da57600080fd5b82356155e58161510e565b9150602083013561528e8161510e565b600181811c9082168061560957607f821691505b60208210811415612d1857634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600081600019048311821515161561565a5761565a61562a565b500290565b60008261567c57634e487b7160e01b600052601260045260246000fd5b500490565b60006020828403121561569357600080fd5b5051919050565b6020808252601c908201527f46503a56616c75652068617320746f20626520646966666572656e7400000000604082015260600190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b60208082526013908201527211940e915b990819185d1948195b185c1cd959606a1b604082015260600190565b600082198211156157a9576157a961562a565b500190565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b600080604083850312156157eb57600080fd5b505080516020909101519092909150565b6001600160a01b039384168152919092166020820152604081019190915260600190565b60006020828403121561583257600080fd5b81516110a08161510e565b60008282101561584f5761584f61562a565b500390565b60208082526025908201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604082015264207a65726f60d81b606082015260800190565b6000808335601e198436030181126158b057600080fd5b83018035915067ffffffffffffffff8211156158cb57600080fd5b60200191503681900382131561519157600080fd5b6000602082840312156158f257600080fd5b815160ff811681146110a057600080fd5b634e487b7160e01b600052603260045260246000fd5b600060001982141561592d5761592d61562a565b5060010190565b634e487b7160e01b600052600160045260246000fd5b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351615982816017850160208801615096565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516159b3816028840160208801615096565b01602801949350505050565b6000602082840312156159d157600080fd5b81516110a081615373565b60208082526018908201527f46503a4f7065726174696f6e206e6f7420616c6c6f7765640000000000000000604082015260600190565b6001600160e01b03198135818116916004851015615a3b5780818660040360031b1b83161692505b505092915050565b600060208284031215615a5557600080fd5b81516110a081615063565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b600081615aba57615aba61562a565b506000190190565b634e487b7160e01b600052603160045260246000fd5b60008251615aea818460208701615096565b919091019291505056fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b0865d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c65649027349758afcb3649adbc1f090fcd4eb9187cfbbd22483c7d103367d7b50173a26469706673582212206b27e134327a0a2dd4b3070434cf375302ed92650eb90c84f3a48f44176c469664736f6c634300080a0033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 34 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.