ERC-20
Overview
Max Total Supply
580,427.815705 TFUND
Holders
2
Total Transfers
-
Market
Onchain Market Cap
$0.00
Circulating Supply Market Cap
-
Other Info
Token Contract (WITH 6 Decimals)
Loading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
Contract Name:
FundVault
Compiler Version
v0.8.19+commit.7dd6d404
Optimization Enabled:
Yes with 200 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; import "openzeppelin-contracts/security/Pausable.sol"; import "openzeppelin-contracts/security/ReentrancyGuard.sol"; import "openzeppelin-contracts/token/ERC20/extensions/ERC4626.sol"; import "./ChainlinkAccessor.sol"; import "./interfaces/IBaseVault.sol"; import "./interfaces/IFundVault.sol"; import "./interfaces/IKycManager.sol"; import "./utils/AdminOperatorRoles.sol"; import "./utils/BytesQueue.sol"; import "./utils/ERC1404.sol"; /** * Represents a fund vault with offchain NAV and onchain assets for liquidity. * * Roles: * - Investors who can subscribe/redeem the fund * - Operators who manage day-to-day operations * - Admins who can handle operator tasks but also set economic parameters * * ## Operator Workflow * - Call {requestAdvanceEpoch} after each NAV report is published to update {_latestOffchainNAV} * - Call {requestRedemptionQueue} after assets have been deposited back into the vault to process queued redemptions * - Call {transferToTreasury} after deposits to move offchain */ contract FundVault is ERC4626, ReentrancyGuard, Pausable, ChainlinkAccessor, AdminOperatorRoles, ERC1404, IFundVault { using Math for uint256; using BytesQueue for BytesQueue.BytesDeque; BytesQueue.BytesDeque _redemptionQueue; uint256 public _latestOffchainNAV; uint256 private constant BPS_UNIT = 10000; uint256 public _minTxFee; uint256 public _onchainFee; uint256 public _offchainFee; uint256 public _epoch; address public _feeReceiver; address public _treasury; IBaseVault public _baseVault; IKycManager public _kycManager; mapping(address => bool) public _initialDeposit; mapping(address => mapping(uint256 => uint256)) _depositAmount; // account => [epoch => amount] mapping(address => mapping(uint256 => uint256)) _withdrawAmount; // account => [epoch => amount] //////////////////////////////////////////////////////////// // Init //////////////////////////////////////////////////////////// constructor( IERC20 asset, address operator, address feeReceiver, address treasury, IBaseVault baseVault, IKycManager kycManager, address chainlinkToken, address chainlinkOracle, ChainlinkParameters memory chainlinkParams ) ERC4626(asset) ERC20("Cogito TFUND", "TFUND") { _grantRole(DEFAULT_ADMIN_ROLE, msg.sender); _grantRole(OPERATOR_ROLE, operator); _feeReceiver = feeReceiver; _treasury = treasury; _baseVault = baseVault; _kycManager = kycManager; _minTxFee = 25 * 10 ** decimals(); // 25USDC super.init(chainlinkParams, chainlinkToken, chainlinkOracle); } //////////////////////////////////////////////////////////// // Admin functions: Setting addresses //////////////////////////////////////////////////////////// function setFeeReceiver(address feeReceiver) external onlyAdmin { _feeReceiver = feeReceiver; emit SetFeeReceiver(feeReceiver); } function setTreasury(address newAddress) external onlyAdmin { _treasury = newAddress; emit SetTreasury(newAddress); } function setBaseVault(address baseVault) external onlyAdmin { _baseVault = IBaseVault(baseVault); emit SetBaseVault(baseVault); } function setKycManager(address kycManager) external onlyAdmin { _kycManager = IKycManager(kycManager); emit SetKycManager(kycManager); } //////////////////////////////////////////////////////////// // Admin/Operator functions //////////////////////////////////////////////////////////// function pause() external onlyAdminOrOperator { _pause(); } function unpause() external onlyAdminOrOperator { _unpause(); } /** * Call after each NAV update has been published, in order to update {_latestOffchainNAV}. * @notice Do not call more than once per day, since {_getServiceFee} calculates daily fees. * @dev Handled in {_advanceEpoch} */ function requestAdvanceEpoch() external onlyAdminOrOperator { bytes32 requestId = super._requestTotalOffchainNAV(_msgSender(), 0, Action.ADVANCE_EPOCH, decimals()); emit RequestAdvanceEpoch(msg.sender, requestId); } /** * Call after sufficient assets have been returned to the vault to process redemptions. * @dev Handled in {_processRedemptionQueue} */ function requestRedemptionQueue() external onlyAdminOrOperator { if (_redemptionQueue.empty()) { revert RedemptionQueueEmpty(); } bytes32 requestId = super._requestTotalOffchainNAV(_msgSender(), 0, Action.REDEMPTION_QUEUE, decimals()); emit RequestRedemptionQueue(msg.sender, requestId); } /** * Sweeps all asset to {_treasury}, keeping only the `targetReservesLevel` of assets */ function transferExcessReservesToTreasury() external onlyAdminOrOperator { uint256 amount = excessReserves(); if (amount == 0) { revert NoExcessReserves(); } transferToTreasury(asset(), amount); } /** * Transfers any underlying assets to {_treasury}. */ function transferToTreasury(address underlying, uint256 amount) public onlyAdminOrOperator { if (_treasury == address(0)) { revert InvalidAddress(_treasury); } if (underlying == asset() && amount > vaultNetAssets()) { revert InsufficientBalance(vaultNetAssets(), amount); } SafeERC20.safeTransfer(IERC20(underlying), _treasury, amount); emit TransferToTreasury(_treasury, asset(), amount); } /** * Sets the minimum transaction fee */ function setMinTxFee(uint256 newValue) external onlyAdminOrOperator { _minTxFee = newValue; emit SetMinTxFee(newValue); } /** * Sends the accumulated onchain service fee to {_feeReceiver} */ function claimOnchainServiceFee(uint256 amount) external onlyAdminOrOperator { if (_feeReceiver == address(0)) { revert InvalidAddress(_feeReceiver); } if (amount > _onchainFee) { amount = _onchainFee; } _onchainFee -= amount; SafeERC20.safeTransfer(IERC20(asset()), _feeReceiver, amount); emit ClaimOnchainServiceFee(msg.sender, _feeReceiver, amount); } /** * Sends the accumulated offchain service fee to {_feeReceiver} */ function claimOffchainServiceFee(uint256 amount) external onlyAdminOrOperator { if (_feeReceiver == address(0)) { revert InvalidAddress(_feeReceiver); } if (amount > _offchainFee) { amount = _offchainFee; } _offchainFee -= amount; SafeERC20.safeTransfer(IERC20(asset()), _feeReceiver, amount); emit ClaimOffchainServiceFee(msg.sender, _feeReceiver, amount); } /** * Set the users as already deposited. */ function bulkSetInitialDeposit(address[] calldata _investors) external onlyAdminOrOperator { for (uint256 i = 0; i < _investors.length; i++) { _initialDeposit[_investors[i]] = true; } } //////////////////////////////////////////////////////////// // Chainlink //////////////////////////////////////////////////////////// /** * Handler for Chainlink requests. Always contains the latest NAV data. * Processes deposits and redemptions, or updates epoch data */ function fulfill(bytes32 requestId, uint256 latestOffchainNAV) external recordChainlinkFulfillment(requestId) { _latestOffchainNAV = latestOffchainNAV; (address investor, uint256 amount, Action action) = super.getRequestData(requestId); if (action == Action.DEPOSIT) { _processDeposit(investor, amount, requestId); } else if (action == Action.REDEEM) { _processRedemption(investor, amount, requestId); } else if (action == Action.REDEMPTION_QUEUE) { _processRedemptionQueue(requestId); } else if (action == Action.ADVANCE_EPOCH) { _advanceEpoch(requestId); } emit Fulfill(investor, requestId, latestOffchainNAV, amount, uint8(action)); } //////////////////////////////////////////////////////////// // Public entrypoints //////////////////////////////////////////////////////////// /** * Subscribe to the fund. * @dev Handled in {_processDeposit} * @param assets Amount of {asset} to subscribe * @param receiver Must be msg.sender */ function deposit(uint256 assets, address receiver) public override onlyCaller(receiver) nonReentrant whenNotPaused returns (uint256) { // receiver is msg.sender _kycManager.onlyKyc(receiver); _kycManager.onlyNotBanned(receiver); _validateDeposit(assets); bytes32 requestId = super._requestTotalOffchainNAV(receiver, assets, Action.DEPOSIT, decimals()); emit RequestDeposit(receiver, assets, requestId); return 0; } /** * Redeem exact shares * @dev Handled in {_processRedemption} * @param shares Amount of shares to redeem * @param receiver Must be msg.sender * @param owner Must be msg.sender */ function redeem(uint256 shares, address receiver, address owner) public override onlyCaller(receiver) onlyCaller(owner) nonReentrant whenNotPaused returns (uint256) { // receiver is msg.sender _kycManager.onlyKyc(receiver); _kycManager.onlyNotBanned(receiver); _validateRedemption(receiver, shares); bytes32 requestId = super._requestTotalOffchainNAV(receiver, shares, Action.REDEEM, decimals()); emit RequestRedemption(receiver, shares, requestId); return 0; } /** * @notice Cannot be directly minted. */ function mint(uint256, address) public pure override returns (uint256) { revert(); } /** * @notice Asset balance may change between requesting and fulfilling, so using {withdraw} may result in * leftover assets. Use {redeem} instead. */ function withdraw(uint256, address, address) public pure override returns (uint256) { revert(); } //////////////////////////////////////////////////////////// // Public getters //////////////////////////////////////////////////////////// function getRedemptionQueueInfo(uint256 index) external view returns (address investor, uint256 shares) { if (_redemptionQueue.empty() || index > _redemptionQueue.length() - 1) { return (address(0), 0); } bytes memory data = bytes(_redemptionQueue.at(index)); (investor, shares) = abi.decode(data, (address, uint256)); } function getRedemptionQueueLength() external view returns (uint256) { return _redemptionQueue.length(); } /** * Returns the maximum of the calculated fee and the minimum fee. */ function getTxFee(uint256 assets) public view returns (uint256) { return _minTxFee.max((assets * _baseVault.getTransactionFee()) / BPS_UNIT); } /** * Returns the requested deposit/withdraw amount for the given user for the current epoch, and the net amount */ function getUserEpochInfo(address user, uint256 epoch) public view returns (uint256 depositAmt, uint256 withdrawAmt, uint256 delta) { depositAmt = _depositAmount[user][epoch]; withdrawAmt = _withdrawAmount[user][epoch]; delta = depositAmt >= withdrawAmt ? depositAmt - withdrawAmt : withdrawAmt - depositAmt; return (depositAmt, withdrawAmt, delta); } /** * @notice totalAssets(): returns the amount of vault assets (eg. USDC), including fees * * vaultNetAssets(): Returns vault assets, net fees */ function vaultNetAssets() public view returns (uint256 amount) { return uint256(0).max(totalAssets() - _onchainFee - _offchainFee); } /** * combinedNetAssets(): Returns vault + offchain assets, net fees */ function combinedNetAssets() public view returns (uint256 amount) { return _latestOffchainNAV + vaultNetAssets(); } /** * excessReserves(): Returns the amount of assets in vault above the target reserve level, or 0 if below */ function excessReserves() public view returns (uint256 amount) { uint256 targetReserves = _baseVault.getTargetReservesLevel() * combinedNetAssets() / 100; uint256 currentReserves = vaultNetAssets(); return (currentReserves - targetReserves).max(0); } /** * Applies KYC checks on transfers. Sender/receiver cannot be banned. * If strict, check both sender/receiver. * If sender is US, check receiver. * @dev will be called during: transfer, transferFrom, mint, burn */ function _beforeTokenTransfer(address from, address to, uint256) internal view override { // no restrictions on minting or burning, or self-transfers if (from == address(0) || to == address(0) || to == address(this)) { return; } uint8 restrictionCode = detectTransferRestriction(from, to, 0); require(restrictionCode == SUCCESS_CODE, messageForTransferRestriction(restrictionCode)); } /** * After any user receives a token, mark as having deposited. */ function _afterTokenTransfer(address, address to, uint256) internal override { if (to != address(0) && !_initialDeposit[to]) { _initialDeposit[to] = true; } } //////////////////////////////////////////////////////////// // ERC-1404 Overrides //////////////////////////////////////////////////////////// function detectTransferRestriction(address from, address to, uint256 /*value*/ ) public view override returns (uint8 restrictionCode) { if (_kycManager.isBanned(from)) return REVOKED_OR_BANNED_CODE; else if (_kycManager.isBanned(to)) return REVOKED_OR_BANNED_CODE; if (_kycManager.isStrict()) { if (!_kycManager.isKyc(from)) return DISALLOWED_OR_STOP_CODE; else if (!_kycManager.isKyc(to)) return DISALLOWED_OR_STOP_CODE; } else if (_kycManager.isUSKyc(from)) { if (!_kycManager.isKyc(to)) return DISALLOWED_OR_STOP_CODE; } return SUCCESS_CODE; } //////////////////////////////////////////////////////////// // ERC-4626 Overrides //////////////////////////////////////////////////////////// function _convertToAssets(uint256 shares, Math.Rounding rounding) internal view override returns (uint256 assets) { uint256 supply = totalSupply(); return (supply == 0) ? shares : shares.mulDiv(combinedNetAssets(), supply, rounding); } function _convertToShares(uint256 assets, Math.Rounding rounding) internal view override returns (uint256 shares) { uint256 supply = totalSupply(); return (assets == 0 || supply == 0) ? assets : assets.mulDiv(supply, combinedNetAssets(), rounding); } //////////////////////////////////////////////////////////// // Internal //////////////////////////////////////////////////////////// /** * Ensures deposit amount is within limits */ function _validateDeposit(uint256 assets) internal view { // gas saving by defining local variable address sender = _msgSender(); (uint256 minDeposit, uint256 maxDeposit) = _baseVault.getMinMaxDeposit(); uint256 initialDeposit = _baseVault.getInitialDeposit(); if (assets > _getAssetBalance(sender)) { revert InsufficientBalance(_getAssetBalance(sender), assets); } if (assets < minDeposit) { revert MinimumDepositRequired(minDeposit); } if (!_initialDeposit[sender] && assets < initialDeposit) { revert MinimumInitialDepositRequired(initialDeposit); } if (IERC20(asset()).allowance(sender, address(this)) < assets) { revert InsufficientAllowance(IERC20(asset()).allowance(sender, address(this)), assets); } (uint256 depositAmt, uint256 withdrawAmt, uint256 delta) = getUserEpochInfo(sender, _epoch); if (depositAmt >= withdrawAmt) { // Net deposit if (assets > maxDeposit - delta) { revert MaximumDepositExceeded(maxDeposit); } } else { // Net withdraw if (assets > maxDeposit + delta) { revert MaximumDepositExceeded(maxDeposit); } } } /** * Transfers assets from investor to vault, and tx fees to {_feeReceiver} */ function _processDeposit(address investor, uint256 assets, bytes32 requestId) internal { uint256 txFee = getTxFee(assets); uint256 actualAsset = assets - txFee; uint256 shares = previewDeposit(actualAsset); super._deposit(investor, investor, actualAsset, shares); SafeERC20.safeTransferFrom(IERC20(asset()), investor, _feeReceiver, txFee); _depositAmount[investor][_epoch] += actualAsset; emit ProcessDeposit(investor, assets, shares, requestId, txFee, _feeReceiver); } /** * Ensures withdraw amount is within limits */ function _validateRedemption(address sender, uint256 share) internal view virtual { if (share > balanceOf(sender)) { revert InsufficientBalance(balanceOf(sender), share); } (uint256 minWithdraw, uint256 maxWithdraw) = _baseVault.getMinMaxWithdraw(); uint256 assets = previewRedeem(share); if (assets < minWithdraw) { revert MinimumWithdrawRequired(minWithdraw); } (uint256 depositAmt, uint256 withdrawAmt, uint256 delta) = getUserEpochInfo(sender, _epoch); if (depositAmt >= withdrawAmt) { // Net deposit if (assets > maxWithdraw + delta) { revert MaximumWithdrawExceeded(maxWithdraw); } } else { // Net withdraw if (assets > maxWithdraw - delta) { revert MaximumWithdrawExceeded(maxWithdraw); } } } /** * Burns shares and transfers assets to investor. * NOTE: If insufficient asset liquidity, then queue for later */ function _processRedemption(address investor, uint256 requestedShares, bytes32 requestId) internal { if (requestedShares > balanceOf(investor)) { revert InsufficientBalance(balanceOf(investor), requestedShares); } uint256 availableAssets = vaultNetAssets(); uint256 requestedAssets = previewRedeem(requestedShares); uint256 actualShares = requestedShares; uint256 actualAssets = requestedAssets; // Requested assets are insufficient, use all available if (actualAssets > availableAssets) { actualAssets = availableAssets; actualShares = previewWithdraw(actualAssets); } // Burn shares and transfer assets if (actualAssets > 0) { super._withdraw(investor, investor, investor, actualAssets, actualShares); } // Queue remaining shares for later if (requestedShares > actualShares) { uint256 remainingShares = requestedShares - actualShares; _redemptionQueue.pushBack(abi.encode(investor, remainingShares, requestId)); super._transfer(investor, address(this), remainingShares); emit AddToRedemptionQueue(investor, remainingShares, requestId); } _withdrawAmount[investor][_epoch] += requestedAssets; emit ProcessRedemption( investor, requestedAssets, requestedShares, requestId, availableAssets, actualAssets, actualShares ); } /** * Processes queued redemptions until no assets are remaining. * @dev May have remainders */ function _processRedemptionQueue(bytes32 requestId) internal { for (; !_redemptionQueue.empty();) { bytes memory data = _redemptionQueue.front(); (address investor, uint256 shares, bytes32 prevId) = abi.decode(data, (address, uint256, bytes32)); uint256 assets = previewRedeem(shares); // we allow users to drain this vault by design if (assets > vaultNetAssets()) { return; } _redemptionQueue.popFront(); super._withdraw(address(this), investor, address(this), assets, shares); emit ProcessRedemptionQueue(investor, assets, shares, requestId, prevId); } } /** * Advances epoch and accrues fees based on {BaseVault-getOnchainAndOffChainServiceFeeRate} */ function _advanceEpoch(bytes32 requestId) internal { _epoch++; (uint256 onchainFeeRate, uint256 offchainFeeRate) = _baseVault.getOnchainAndOffChainServiceFeeRate(); _onchainFee += _getServiceFee(vaultNetAssets(), onchainFeeRate); _offchainFee += _getServiceFee(_latestOffchainNAV, offchainFeeRate); emit ProcessAdvanceEpoch(_onchainFee, _offchainFee, _epoch, requestId); } function _getAssetBalance(address addr) internal view returns (uint256) { return IERC20(asset()).balanceOf(addr); } function _getServiceFee(uint256 assets, uint256 rate) internal pure returns (uint256 fee) { return (assets * rate) / (365 * BPS_UNIT); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol) pragma solidity ^0.8.0; import "../utils/Context.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 Pausable is Context { /** * @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. */ constructor() { _paused = false; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { _requireNotPaused(); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { _requirePaused(); _; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Throws if the contract is paused. */ function _requireNotPaused() internal view virtual { require(!paused(), "Pausable: paused"); } /** * @dev Throws if the contract is not paused. */ function _requirePaused() internal view virtual { 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()); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { // On the first call to nonReentrant, _status will be _NOT_ENTERED require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; } function _nonReentrantAfter() private { // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } /** * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a * `nonReentrant` function in the call stack. */ function _reentrancyGuardEntered() internal view returns (bool) { return _status == _ENTERED; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/ERC4626.sol) pragma solidity ^0.8.0; import "../ERC20.sol"; import "../utils/SafeERC20.sol"; import "../../../interfaces/IERC4626.sol"; import "../../../utils/math/Math.sol"; /** * @dev Implementation of the ERC4626 "Tokenized Vault Standard" as defined in * https://eips.ethereum.org/EIPS/eip-4626[EIP-4626]. * * This extension allows the minting and burning of "shares" (represented using the ERC20 inheritance) in exchange for * underlying "assets" through standardized {deposit}, {mint}, {redeem} and {burn} workflows. This contract extends * the ERC20 standard. Any additional extensions included along it would affect the "shares" token represented by this * contract and not the "assets" token which is an independent contract. * * [CAUTION] * ==== * In empty (or nearly empty) ERC-4626 vaults, deposits are at high risk of being stolen through frontrunning * with a "donation" to the vault that inflates the price of a share. This is variously known as a donation or inflation * attack and is essentially a problem of slippage. Vault deployers can protect against this attack by making an initial * deposit of a non-trivial amount of the asset, such that price manipulation becomes infeasible. Withdrawals may * similarly be affected by slippage. Users can protect against this attack as well as unexpected slippage in general by * verifying the amount received is as expected, using a wrapper that performs these checks such as * https://github.com/fei-protocol/ERC4626#erc4626router-and-base[ERC4626Router]. * * Since v4.9, this implementation uses virtual assets and shares to mitigate that risk. The `_decimalsOffset()` * corresponds to an offset in the decimal representation between the underlying asset's decimals and the vault * decimals. This offset also determines the rate of virtual shares to virtual assets in the vault, which itself * determines the initial exchange rate. While not fully preventing the attack, analysis shows that the default offset * (0) makes it non-profitable, as a result of the value being captured by the virtual shares (out of the attacker's * donation) matching the attacker's expected gains. With a larger offset, the attack becomes orders of magnitude more * expensive than it is profitable. More details about the underlying math can be found * xref:erc4626.adoc#inflation-attack[here]. * * The drawback of this approach is that the virtual shares do capture (a very small) part of the value being accrued * to the vault. Also, if the vault experiences losses, the users try to exit the vault, the virtual shares and assets * will cause the first user to exit to experience reduced losses in detriment to the last users that will experience * bigger losses. Developers willing to revert back to the pre-v4.9 behavior just need to override the * `_convertToShares` and `_convertToAssets` functions. * * To learn more, check out our xref:ROOT:erc4626.adoc[ERC-4626 guide]. * ==== * * _Available since v4.7._ */ abstract contract ERC4626 is ERC20, IERC4626 { using Math for uint256; IERC20 private immutable _asset; uint8 private immutable _underlyingDecimals; /** * @dev Set the underlying asset contract. This must be an ERC20-compatible contract (ERC20 or ERC777). */ constructor(IERC20 asset_) { (bool success, uint8 assetDecimals) = _tryGetAssetDecimals(asset_); _underlyingDecimals = success ? assetDecimals : 18; _asset = asset_; } /** * @dev Attempts to fetch the asset decimals. A return value of false indicates that the attempt failed in some way. */ function _tryGetAssetDecimals(IERC20 asset_) private view returns (bool, uint8) { (bool success, bytes memory encodedDecimals) = address(asset_).staticcall( abi.encodeWithSelector(IERC20Metadata.decimals.selector) ); if (success && encodedDecimals.length >= 32) { uint256 returnedDecimals = abi.decode(encodedDecimals, (uint256)); if (returnedDecimals <= type(uint8).max) { return (true, uint8(returnedDecimals)); } } return (false, 0); } /** * @dev Decimals are computed by adding the decimal offset on top of the underlying asset's decimals. This * "original" value is cached during construction of the vault contract. If this read operation fails (e.g., the * asset has not been created yet), a default of 18 is used to represent the underlying asset's decimals. * * See {IERC20Metadata-decimals}. */ function decimals() public view virtual override(IERC20Metadata, ERC20) returns (uint8) { return _underlyingDecimals + _decimalsOffset(); } /** @dev See {IERC4626-asset}. */ function asset() public view virtual override returns (address) { return address(_asset); } /** @dev See {IERC4626-totalAssets}. */ function totalAssets() public view virtual override returns (uint256) { return _asset.balanceOf(address(this)); } /** @dev See {IERC4626-convertToShares}. */ function convertToShares(uint256 assets) public view virtual override returns (uint256) { return _convertToShares(assets, Math.Rounding.Down); } /** @dev See {IERC4626-convertToAssets}. */ function convertToAssets(uint256 shares) public view virtual override returns (uint256) { return _convertToAssets(shares, Math.Rounding.Down); } /** @dev See {IERC4626-maxDeposit}. */ function maxDeposit(address) public view virtual override returns (uint256) { return type(uint256).max; } /** @dev See {IERC4626-maxMint}. */ function maxMint(address) public view virtual override returns (uint256) { return type(uint256).max; } /** @dev See {IERC4626-maxWithdraw}. */ function maxWithdraw(address owner) public view virtual override returns (uint256) { return _convertToAssets(balanceOf(owner), Math.Rounding.Down); } /** @dev See {IERC4626-maxRedeem}. */ function maxRedeem(address owner) public view virtual override returns (uint256) { return balanceOf(owner); } /** @dev See {IERC4626-previewDeposit}. */ function previewDeposit(uint256 assets) public view virtual override returns (uint256) { return _convertToShares(assets, Math.Rounding.Down); } /** @dev See {IERC4626-previewMint}. */ function previewMint(uint256 shares) public view virtual override returns (uint256) { return _convertToAssets(shares, Math.Rounding.Up); } /** @dev See {IERC4626-previewWithdraw}. */ function previewWithdraw(uint256 assets) public view virtual override returns (uint256) { return _convertToShares(assets, Math.Rounding.Up); } /** @dev See {IERC4626-previewRedeem}. */ function previewRedeem(uint256 shares) public view virtual override returns (uint256) { return _convertToAssets(shares, Math.Rounding.Down); } /** @dev See {IERC4626-deposit}. */ function deposit(uint256 assets, address receiver) public virtual override returns (uint256) { require(assets <= maxDeposit(receiver), "ERC4626: deposit more than max"); uint256 shares = previewDeposit(assets); _deposit(_msgSender(), receiver, assets, shares); return shares; } /** @dev See {IERC4626-mint}. * * As opposed to {deposit}, minting is allowed even if the vault is in a state where the price of a share is zero. * In this case, the shares will be minted without requiring any assets to be deposited. */ function mint(uint256 shares, address receiver) public virtual override returns (uint256) { require(shares <= maxMint(receiver), "ERC4626: mint more than max"); uint256 assets = previewMint(shares); _deposit(_msgSender(), receiver, assets, shares); return assets; } /** @dev See {IERC4626-withdraw}. */ function withdraw(uint256 assets, address receiver, address owner) public virtual override returns (uint256) { require(assets <= maxWithdraw(owner), "ERC4626: withdraw more than max"); uint256 shares = previewWithdraw(assets); _withdraw(_msgSender(), receiver, owner, assets, shares); return shares; } /** @dev See {IERC4626-redeem}. */ function redeem(uint256 shares, address receiver, address owner) public virtual override returns (uint256) { require(shares <= maxRedeem(owner), "ERC4626: redeem more than max"); uint256 assets = previewRedeem(shares); _withdraw(_msgSender(), receiver, owner, assets, shares); return assets; } /** * @dev Internal conversion function (from assets to shares) with support for rounding direction. */ function _convertToShares(uint256 assets, Math.Rounding rounding) internal view virtual returns (uint256) { return assets.mulDiv(totalSupply() + 10 ** _decimalsOffset(), totalAssets() + 1, rounding); } /** * @dev Internal conversion function (from shares to assets) with support for rounding direction. */ function _convertToAssets(uint256 shares, Math.Rounding rounding) internal view virtual returns (uint256) { return shares.mulDiv(totalAssets() + 1, totalSupply() + 10 ** _decimalsOffset(), rounding); } /** * @dev Deposit/mint common workflow. */ function _deposit(address caller, address receiver, uint256 assets, uint256 shares) internal virtual { // If _asset is ERC777, `transferFrom` can trigger a reentrancy BEFORE the transfer happens through the // `tokensToSend` hook. On the other hand, the `tokenReceived` hook, that is triggered after the transfer, // calls the vault, which is assumed not malicious. // // Conclusion: we need to do the transfer before we mint so that any reentrancy would happen before the // assets are transferred and before the shares are minted, which is a valid state. // slither-disable-next-line reentrancy-no-eth SafeERC20.safeTransferFrom(_asset, caller, address(this), assets); _mint(receiver, shares); emit Deposit(caller, receiver, assets, shares); } /** * @dev Withdraw/redeem common workflow. */ function _withdraw( address caller, address receiver, address owner, uint256 assets, uint256 shares ) internal virtual { if (caller != owner) { _spendAllowance(owner, caller, shares); } // If _asset is ERC777, `transfer` can trigger a reentrancy AFTER the transfer happens through the // `tokensReceived` hook. On the other hand, the `tokensToSend` hook, that is triggered before the transfer, // calls the vault, which is assumed not malicious. // // Conclusion: we need to do the transfer after the burn so that any reentrancy would happen after the // shares are burned and after the assets are transferred, which is a valid state. _burn(owner, shares); SafeERC20.safeTransfer(_asset, receiver, assets); emit Withdraw(caller, receiver, owner, assets, shares); } function _decimalsOffset() internal view virtual returns (uint8) { return 0; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; import "chainlink/ChainlinkClient.sol"; import "./interfaces/IChainlinkAccessor.sol"; import "./interfaces/IFundVault.sol"; import "./utils/AdminRole.sol"; /** * Wrapper for ChainlinkClient. Builds Chainlink requests */ abstract contract ChainlinkAccessor is IChainlinkAccessor, ChainlinkClient, AdminRole { using Chainlink for Chainlink.Request; ChainlinkParameters _params; mapping(bytes32 => RequestData) internal _requestIdToRequestData; // requestId => RequestData /** * @dev Initializes Chainlink parameters, token, and oracle. * @param params Chainlink parameters containing fee, jobId, urlData, and paths. * @param chainlinkToken Address of the Chainlink token. * @param chainlinkOracle Address of the Chainlink oracle. */ function init(ChainlinkParameters memory params, address chainlinkToken, address chainlinkOracle) internal { _params.fee = params.fee; _params.jobId = params.jobId; _params.urlData = params.urlData; _params.pathToOffchainAssets = params.pathToOffchainAssets; _params.pathToTotalOffchainAssetAtLastClose = params.pathToTotalOffchainAssetAtLastClose; setChainlinkOracle(chainlinkOracle); setChainlinkToken(chainlinkToken); } /** * Build and send request to offchain API for NAV data. */ function _requestTotalOffchainNAV(address investor, uint256 amount, Action action, uint8 decimals) internal returns (bytes32 requestId) { Chainlink.Request memory req = buildChainlinkRequest( _params.jobId, // NOTE: this will be ignored and replace by address(this) during encode address(0), IFundVault(address(this)).fulfill.selector ); // Set the URL to perform the GET request on req.add( "get", _params.urlData // offchain assets url ); if (action == Action.ADVANCE_EPOCH) { req.add("path", _params.pathToTotalOffchainAssetAtLastClose); } else { req.add("path", _params.pathToOffchainAssets); } // Multiply the result by decimals int256 timesAmount = int256(10 ** decimals); req.addInt("times", timesAmount); RequestData memory requestData = RequestData(investor, amount, action); requestId = sendChainlinkRequest(req, _params.fee); // Add to mapping _requestIdToRequestData[requestId] = requestData; } function setChainlinkOracleAddress(address newAddress) external onlyAdmin { super.setChainlinkOracle(newAddress); emit SetChainlinkOracleAddress(newAddress); } function setChainlinkFee(uint256 fee) external onlyAdmin { _params.fee = fee; emit SetChainlinkFee(fee); } function setChainlinkJobId(bytes32 jobId) external onlyAdmin { _params.jobId = jobId; emit SetChainlinkJobId(jobId); } function setChainlinkURLData(string memory url) external onlyAdmin { _params.urlData = url; emit SetChainlinkURLData(url); } function setPathToOffchainAssets(string memory path) external onlyAdmin { _params.pathToOffchainAssets = path; emit SetPathToOffchainAssets(path); } function setPathToTotalOffchainAssetAtLastClose(string memory path) external onlyAdmin { _params.pathToTotalOffchainAssetAtLastClose = path; emit SetPathToTotalOffchainAssetAtLastClose(path); } function getChainLinkParameters() external view returns (ChainlinkParameters memory params) { params = _params; } function getRequestData(bytes32 requestId) public view returns (address investor, uint256 amount, Action action) { investor = _requestIdToRequestData[requestId].investor; amount = _requestIdToRequestData[requestId].amount; action = _requestIdToRequestData[requestId].action; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; import "./Action.sol"; interface IBaseVault { event SetTransactionFee(uint256 transactionFee); event SetInitialDeposit(uint256 initialDeposit); event SetMinDeposit(uint256 minDeposit); event SetMaxDeposit(uint256 maxDeposit); event SetMinWithdraw(uint256 minWithdraw); event SetMaxWithdraw(uint256 maxWithdraw); event SetTargetReservesLevel(uint256 targetReservesLevel); event SetOnchainServiceFeeRate(uint256 onchainServiceFeeRate); event SetOffchainServiceFeeRate(uint256 offchainServiceFeeRate); function getTransactionFee() external view returns (uint256 txFee); function getMinMaxDeposit() external view returns (uint256 minDeposit, uint256 maxDeposit); function getMinMaxWithdraw() external view returns (uint256 minWithdraw, uint256 maxWithdraw); function getTargetReservesLevel() external view returns (uint256 targetReservesLevel); function getOnchainAndOffChainServiceFeeRate() external view returns (uint256 onchainFeeRate, uint256 offchainFeeRate); function getInitialDeposit() external view returns (uint256 initialDeposit); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; import "./IFundVaultEvents.sol"; interface IFundVault is IFundVaultEvents { function fulfill(bytes32 requestId, uint256 latestOffchainNAV) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; interface IKycManager { enum KycType { NON_KYC, US_KYC, GENERAL_KYC } struct UserAddress { address user; KycType kycType; bool isBanned; } struct User { bool exists; KycType kycType; bool isBanned; } event GrantKyc(address _investor, KycType _kycType); event RevokeKyc(address _investor, KycType _kycType); event Banned(address _investor, bool _status); event SetStrict(bool _status); function onlyNotBanned(address investor) external view; function onlyKyc(address investor) external view; function isBanned(address investor) external view returns (bool); function isKyc(address investor) external view returns (bool); function isUSKyc(address investor) external view returns (bool); function isNonUSKyc(address investor) external view returns (bool); function isStrict() external view returns (bool); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; import "../interfaces/Errors.sol"; import "./AdminRole.sol"; abstract contract AdminOperatorRoles is AdminRole { bytes32 public constant OPERATOR_ROLE = keccak256("OPERATOR_ROLE"); modifier onlyAdminOrOperator() { if (!hasRole(DEFAULT_ADMIN_ROLE, _msgSender()) && !hasRole(OPERATOR_ROLE, _msgSender())) { revert PermissionDenied(); } _; } modifier onlyCaller(address receiver) { if (_msgSender() != receiver) { revert InvalidAddress(receiver); } _; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (utils/structs/DoubleEndedQueue.sol) pragma solidity ^0.8.19; // import "../math/SafeCast.sol"; /** * @notice Forked from OpenZeppelin DoubleEndedQueue. Removes `popBack` and `pushFront`. Changes underlying data from `bytes32` to `bytes`. * * @dev A sequence of items with the ability to efficiently push and pop items (i.e. insert and remove) on both ends of * the sequence (called front and back). Among other access patterns, it can be used to implement efficient LIFO and * FIFO queues. Storage use is optimized, and all operations are O(1) constant time. This includes {clear}, given that * the existing queue contents are left in storage. * * The struct is called `Bytes32Deque`. Other types can be cast to and from `bytes32`. This data structure can only be * used in storage, and not in memory. * ``` * DoubleEndedQueue.Bytes32Deque queue; * ``` * * _Available since v4.6._ */ library BytesQueue { /** * @dev An operation (e.g. {front}) couldn't be completed due to the queue being empty. */ error Empty(); /** * @dev An operation (e.g. {at}) couldn't be completed due to an index being out of bounds. */ error OutOfBounds(); /** * @dev Indices are signed integers because the queue can grow in any direction. They are 128 bits so begin and end * are packed in a single storage slot for efficient access. Since the items are added one at a time we can safely * assume that these 128-bit indices will not overflow, and use unchecked arithmetic. * * Struct members have an underscore prefix indicating that they are "private" and should not be read or written to * directly. Use the functions provided below instead. Modifying the struct manually may violate assumptions and * lead to unexpected behavior. * * Indices are in the range [begin, end) which means the first item is at data[begin] and the last item is at * data[end - 1]. */ struct BytesDeque { int128 _begin; int128 _end; mapping(int128 => bytes) _data; } /** * @dev Inserts an item at the end of the queue. */ function pushBack(BytesDeque storage deque, bytes memory value) internal { int128 backIndex = deque._end; deque._data[backIndex] = value; unchecked { deque._end = backIndex + 1; } } /** * @dev Removes the item at the beginning of the queue and returns it. * * Reverts with `Empty` if the queue is empty. */ function popFront(BytesDeque storage deque) internal returns (bytes memory value) { if (empty(deque)) revert Empty(); int128 frontIndex = deque._begin; value = deque._data[frontIndex]; delete deque._data[frontIndex]; unchecked { deque._begin = frontIndex + 1; } } /** * @dev Returns the item at the beginning of the queue. * * Reverts with `Empty` if the queue is empty. */ function front(BytesDeque storage deque) internal view returns (bytes memory value) { if (empty(deque)) revert Empty(); int128 frontIndex = deque._begin; return deque._data[frontIndex]; } /** * @dev Return the item at a position in the queue given by `index`, with the first item at 0 and last item at * `length(deque) - 1`. * * Reverts with `OutOfBounds` if the index is out of bounds. */ function at(BytesDeque storage deque, uint256 index) internal view returns (bytes memory value) { // int256(deque._begin) is a safe upcast int128 idx = _toInt128(int256(deque._begin) + _toInt256(index)); if (idx >= deque._end) revert OutOfBounds(); return deque._data[idx]; } function _toInt128(int256 value) internal pure returns (int128 downcasted) { downcasted = int128(value); require(downcasted == value, "SafeCast: value doesn't fit in 128 bits"); } function _toInt256(uint256 value) internal pure returns (int256) { // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive require(value <= uint256(type(int256).max), "SafeCast: value doesn't fit in an int256"); return int256(value); } /** * @dev Resets the queue back to being empty. * * NOTE: The current items are left behind in storage. This does not affect the functioning of the queue, but misses * out on potential gas refunds. */ function clear(BytesDeque storage deque) internal { deque._begin = 0; deque._end = 0; } /** * @dev Returns the number of items in the queue. */ function length(BytesDeque storage deque) internal view returns (uint256) { // The interface preserves the invariant that begin <= end so we assume this will not overflow. // We also assume there are at most int256.max items in the queue. unchecked { return uint256(int256(deque._end) - int256(deque._begin)); } } /** * @dev Returns true if the queue is empty. */ function empty(BytesDeque storage deque) internal view returns (bool) { return deque._end <= deque._begin; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; import "../interfaces/IERC1404.sol"; import "../interfaces/Errors.sol"; abstract contract ERC1404 is IERC1404 { modifier notRestricted(address from, address to) { uint8 restrictionCode = detectTransferRestriction(from, to, 0); require(restrictionCode == SUCCESS_CODE, messageForTransferRestriction(restrictionCode)); _; } function detectTransferRestriction(address from, address to, uint256 value) public view virtual returns (uint8); function messageForTransferRestriction(uint8 restrictionCode) public pure returns (string memory message) { if (restrictionCode == SUCCESS_CODE) { message = SUCCESS_MESSAGE; } else if (restrictionCode == DISALLOWED_OR_STOP_CODE) { message = DISALLOWED_OR_STOP_MESSAGE; } else if (restrictionCode == REVOKED_OR_BANNED_CODE) { message = REVOKED_OR_BANNED_MESSAGE; } } }
// 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.9.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.0; import "./IERC20.sol"; import "./extensions/IERC20Metadata.sol"; import "../../utils/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.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * The default value of {decimals} is 18. To change this, you should override * this function so it returns a different value. * * 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}. * * 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 default value returned by this function, unless * it's 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 `from` to `to`. * * 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; // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by // decrementing then incrementing. _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; unchecked { // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above. _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; // Overflow not possible: amount <= accountBalance <= totalSupply. _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 // OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/IERC20Permit.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; /** * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } /** * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful. */ 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)); } /** * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 oldAllowance = token.allowance(address(this), spender); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value)); } /** * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ 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"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value)); } } /** * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval * to be set to zero before setting it to a non-zero value, such as USDT. */ function forceApprove(IERC20 token, address spender, uint256 value) internal { bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value); if (!_callOptionalReturnBool(token, approvalCall)) { _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0)); _callOptionalReturn(token, approvalCall); } } /** * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`. * Revert on invalid signature. */ function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). * * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead. */ function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) { // 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 cannot use {Address-functionCall} here since this should return false // and not revert is the subcall reverts. (bool success, bytes memory returndata) = address(token).call(data); return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC4626.sol) pragma solidity ^0.8.0; import "../token/ERC20/IERC20.sol"; import "../token/ERC20/extensions/IERC20Metadata.sol"; /** * @dev Interface of the ERC4626 "Tokenized Vault Standard", as defined in * https://eips.ethereum.org/EIPS/eip-4626[ERC-4626]. * * _Available since v4.7._ */ interface IERC4626 is IERC20, IERC20Metadata { 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 ); /** * @dev Returns the address of the underlying token used for the Vault for accounting, depositing, and withdrawing. * * - MUST be an ERC-20 token contract. * - MUST NOT revert. */ function asset() external view returns (address assetTokenAddress); /** * @dev Returns the total amount of the underlying asset that is “managed” by Vault. * * - SHOULD include any compounding that occurs from yield. * - MUST be inclusive of any fees that are charged against assets in the Vault. * - MUST NOT revert. */ function totalAssets() external view returns (uint256 totalManagedAssets); /** * @dev Returns the amount of shares that the Vault would exchange for the amount of assets provided, in an ideal * scenario where all the conditions are met. * * - MUST NOT be inclusive of any fees that are charged against assets in the Vault. * - MUST NOT show any variations depending on the caller. * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange. * - MUST NOT revert. * * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and * from. */ function convertToShares(uint256 assets) external view returns (uint256 shares); /** * @dev Returns the amount of assets that the Vault would exchange for the amount of shares provided, in an ideal * scenario where all the conditions are met. * * - MUST NOT be inclusive of any fees that are charged against assets in the Vault. * - MUST NOT show any variations depending on the caller. * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange. * - MUST NOT revert. * * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and * from. */ function convertToAssets(uint256 shares) external view returns (uint256 assets); /** * @dev Returns the maximum amount of the underlying asset that can be deposited into the Vault for the receiver, * through a deposit call. * * - MUST return a limited value if receiver is subject to some deposit limit. * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of assets that may be deposited. * - MUST NOT revert. */ function maxDeposit(address receiver) external view returns (uint256 maxAssets); /** * @dev Allows an on-chain or off-chain user to simulate the effects of their deposit at the current block, given * current on-chain conditions. * * - MUST return as close to and no more than the exact amount of Vault shares that would be minted in a deposit * call in the same transaction. I.e. deposit should return the same or more shares as previewDeposit if called * in the same transaction. * - MUST NOT account for deposit limits like those returned from maxDeposit and should always act as though the * deposit would be accepted, regardless if the user has enough tokens approved, etc. * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees. * - MUST NOT revert. * * NOTE: any unfavorable discrepancy between convertToShares and previewDeposit SHOULD be considered slippage in * share price or some other type of condition, meaning the depositor will lose assets by depositing. */ function previewDeposit(uint256 assets) external view returns (uint256 shares); /** * @dev Mints shares Vault shares to receiver by depositing exactly amount of underlying tokens. * * - MUST emit the Deposit event. * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the * deposit execution, and are accounted for during deposit. * - MUST revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not * approving enough underlying tokens to the Vault contract, etc). * * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token. */ function deposit(uint256 assets, address receiver) external returns (uint256 shares); /** * @dev Returns the maximum amount of the Vault shares that can be minted for the receiver, through a mint call. * - MUST return a limited value if receiver is subject to some mint limit. * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of shares that may be minted. * - MUST NOT revert. */ function maxMint(address receiver) external view returns (uint256 maxShares); /** * @dev Allows an on-chain or off-chain user to simulate the effects of their mint at the current block, given * current on-chain conditions. * * - MUST return as close to and no fewer than the exact amount of assets that would be deposited in a mint call * in the same transaction. I.e. mint should return the same or fewer assets as previewMint if called in the * same transaction. * - MUST NOT account for mint limits like those returned from maxMint and should always act as though the mint * would be accepted, regardless if the user has enough tokens approved, etc. * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees. * - MUST NOT revert. * * NOTE: any unfavorable discrepancy between convertToAssets and previewMint SHOULD be considered slippage in * share price or some other type of condition, meaning the depositor will lose assets by minting. */ function previewMint(uint256 shares) external view returns (uint256 assets); /** * @dev Mints exactly shares Vault shares to receiver by depositing amount of underlying tokens. * * - MUST emit the Deposit event. * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the mint * execution, and are accounted for during mint. * - MUST revert if all of shares cannot be minted (due to deposit limit being reached, slippage, the user not * approving enough underlying tokens to the Vault contract, etc). * * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token. */ function mint(uint256 shares, address receiver) external returns (uint256 assets); /** * @dev Returns the maximum amount of the underlying asset that can be withdrawn from the owner balance in the * Vault, through a withdraw call. * * - MUST return a limited value if owner is subject to some withdrawal limit or timelock. * - MUST NOT revert. */ function maxWithdraw(address owner) external view returns (uint256 maxAssets); /** * @dev Allows an on-chain or off-chain user to simulate the effects of their withdrawal at the current block, * given current on-chain conditions. * * - MUST return as close to and no fewer than the exact amount of Vault shares that would be burned in a withdraw * call in the same transaction. I.e. withdraw should return the same or fewer shares as previewWithdraw if * called * in the same transaction. * - MUST NOT account for withdrawal limits like those returned from maxWithdraw and should always act as though * the withdrawal would be accepted, regardless if the user has enough shares, etc. * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees. * - MUST NOT revert. * * NOTE: any unfavorable discrepancy between convertToShares and previewWithdraw SHOULD be considered slippage in * share price or some other type of condition, meaning the depositor will lose assets by depositing. */ function previewWithdraw(uint256 assets) external view returns (uint256 shares); /** * @dev Burns shares from owner and sends exactly assets of underlying tokens to receiver. * * - MUST emit the Withdraw event. * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the * withdraw execution, and are accounted for during withdraw. * - MUST revert if all of assets cannot be withdrawn (due to withdrawal limit being reached, slippage, the owner * not having enough shares, etc). * * Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed. * Those methods should be performed separately. */ function withdraw(uint256 assets, address receiver, address owner) external returns (uint256 shares); /** * @dev Returns the maximum amount of Vault shares that can be redeemed from the owner balance in the Vault, * through a redeem call. * * - MUST return a limited value if owner is subject to some withdrawal limit or timelock. * - MUST return balanceOf(owner) if owner is not subject to any withdrawal limit or timelock. * - MUST NOT revert. */ function maxRedeem(address owner) external view returns (uint256 maxShares); /** * @dev Allows an on-chain or off-chain user to simulate the effects of their redeemption at the current block, * given current on-chain conditions. * * - MUST return as close to and no more than the exact amount of assets that would be withdrawn in a redeem call * in the same transaction. I.e. redeem should return the same or more assets as previewRedeem if called in the * same transaction. * - MUST NOT account for redemption limits like those returned from maxRedeem and should always act as though the * redemption would be accepted, regardless if the user has enough shares, etc. * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees. * - MUST NOT revert. * * NOTE: any unfavorable discrepancy between convertToAssets and previewRedeem SHOULD be considered slippage in * share price or some other type of condition, meaning the depositor will lose assets by redeeming. */ function previewRedeem(uint256 shares) external view returns (uint256 assets); /** * @dev Burns exactly shares from owner and sends assets of underlying tokens to receiver. * * - MUST emit the Withdraw event. * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the * redeem execution, and are accounted for during redeem. * - MUST revert if all of shares cannot be redeemed (due to withdrawal limit being reached, slippage, the owner * not having enough shares, etc). * * NOTE: some implementations will require pre-requesting to the Vault before a withdrawal may be performed. * Those methods should be performed separately. */ function redeem(uint256 shares, address receiver, address owner) external returns (uint256 assets); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { // Solidity will revert if denominator == 0, unlike the div opcode on its own. // The surrounding unchecked block does not change this fact. // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic. return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1, "Math: mulDiv overflow"); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works // in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10 ** 64) { value /= 10 ** 64; result += 64; } if (value >= 10 ** 32) { value /= 10 ** 32; result += 32; } if (value >= 10 ** 16) { value /= 10 ** 16; result += 16; } if (value >= 10 ** 8) { value /= 10 ** 8; result += 8; } if (value >= 10 ** 4) { value /= 10 ** 4; result += 4; } if (value >= 10 ** 2) { value /= 10 ** 2; result += 2; } if (value >= 10 ** 1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 256, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0); } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./Chainlink.sol"; import "./interfaces/ENSInterface.sol"; import "./interfaces/LinkTokenInterface.sol"; import "./interfaces/ChainlinkRequestInterface.sol"; import "./interfaces/OperatorInterface.sol"; import "./interfaces/PointerInterface.sol"; import {ENSResolver as ENSResolver_Chainlink} from "./vendor/ENSResolver.sol"; /** * @title The ChainlinkClient contract * @notice Contract writers can inherit this contract in order to create requests for the * Chainlink network */ abstract contract ChainlinkClient { using Chainlink for Chainlink.Request; uint256 internal constant LINK_DIVISIBILITY = 10 ** 18; uint256 private constant AMOUNT_OVERRIDE = 0; address private constant SENDER_OVERRIDE = address(0); uint256 private constant ORACLE_ARGS_VERSION = 1; uint256 private constant OPERATOR_ARGS_VERSION = 2; bytes32 private constant ENS_TOKEN_SUBNAME = keccak256("link"); bytes32 private constant ENS_ORACLE_SUBNAME = keccak256("oracle"); address private constant LINK_TOKEN_POINTER = 0xC89bD4E1632D3A43CB03AAAd5262cbe4038Bc571; ENSInterface private s_ens; bytes32 private s_ensNode; LinkTokenInterface private s_link; OperatorInterface private s_oracle; uint256 private s_requestCount = 1; mapping(bytes32 => address) private s_pendingRequests; event ChainlinkRequested(bytes32 indexed id); event ChainlinkFulfilled(bytes32 indexed id); event ChainlinkCancelled(bytes32 indexed id); /** * @notice Creates a request that can hold additional parameters * @param specId The Job Specification ID that the request will be created for * @param callbackAddr address to operate the callback on * @param callbackFunctionSignature function signature to use for the callback * @return A Chainlink Request struct in memory */ function buildChainlinkRequest( bytes32 specId, address callbackAddr, bytes4 callbackFunctionSignature ) internal pure returns (Chainlink.Request memory) { Chainlink.Request memory req; return req.initialize(specId, callbackAddr, callbackFunctionSignature); } /** * @notice Creates a request that can hold additional parameters * @param specId The Job Specification ID that the request will be created for * @param callbackFunctionSignature function signature to use for the callback * @return A Chainlink Request struct in memory */ function buildOperatorRequest( bytes32 specId, bytes4 callbackFunctionSignature ) internal view returns (Chainlink.Request memory) { Chainlink.Request memory req; return req.initialize(specId, address(this), callbackFunctionSignature); } /** * @notice Creates a Chainlink request to the stored oracle address * @dev Calls `chainlinkRequestTo` with the stored oracle address * @param req The initialized Chainlink Request * @param payment The amount of LINK to send for the request * @return requestId The request ID */ function sendChainlinkRequest(Chainlink.Request memory req, uint256 payment) internal returns (bytes32) { return sendChainlinkRequestTo(address(s_oracle), req, payment); } /** * @notice Creates a Chainlink request to the specified oracle address * @dev Generates and stores a request ID, increments the local nonce, and uses `transferAndCall` to * send LINK which creates a request on the target oracle contract. * Emits ChainlinkRequested event. * @param oracleAddress The address of the oracle for the request * @param req The initialized Chainlink Request * @param payment The amount of LINK to send for the request * @return requestId The request ID */ function sendChainlinkRequestTo( address oracleAddress, Chainlink.Request memory req, uint256 payment ) internal returns (bytes32 requestId) { uint256 nonce = s_requestCount; s_requestCount = nonce + 1; bytes memory encodedRequest = abi.encodeWithSelector( ChainlinkRequestInterface.oracleRequest.selector, SENDER_OVERRIDE, // Sender value - overridden by onTokenTransfer by the requesting contract's address AMOUNT_OVERRIDE, // Amount value - overridden by onTokenTransfer by the actual amount of LINK sent req.id, address(this), req.callbackFunctionId, nonce, ORACLE_ARGS_VERSION, req.buf.buf ); return _rawRequest(oracleAddress, nonce, payment, encodedRequest); } /** * @notice Creates a Chainlink request to the stored oracle address * @dev This function supports multi-word response * @dev Calls `sendOperatorRequestTo` with the stored oracle address * @param req The initialized Chainlink Request * @param payment The amount of LINK to send for the request * @return requestId The request ID */ function sendOperatorRequest(Chainlink.Request memory req, uint256 payment) internal returns (bytes32) { return sendOperatorRequestTo(address(s_oracle), req, payment); } /** * @notice Creates a Chainlink request to the specified oracle address * @dev This function supports multi-word response * @dev Generates and stores a request ID, increments the local nonce, and uses `transferAndCall` to * send LINK which creates a request on the target oracle contract. * Emits ChainlinkRequested event. * @param oracleAddress The address of the oracle for the request * @param req The initialized Chainlink Request * @param payment The amount of LINK to send for the request * @return requestId The request ID */ function sendOperatorRequestTo( address oracleAddress, Chainlink.Request memory req, uint256 payment ) internal returns (bytes32 requestId) { uint256 nonce = s_requestCount; s_requestCount = nonce + 1; bytes memory encodedRequest = abi.encodeWithSelector( OperatorInterface.operatorRequest.selector, SENDER_OVERRIDE, // Sender value - overridden by onTokenTransfer by the requesting contract's address AMOUNT_OVERRIDE, // Amount value - overridden by onTokenTransfer by the actual amount of LINK sent req.id, req.callbackFunctionId, nonce, OPERATOR_ARGS_VERSION, req.buf.buf ); return _rawRequest(oracleAddress, nonce, payment, encodedRequest); } /** * @notice Make a request to an oracle * @param oracleAddress The address of the oracle for the request * @param nonce used to generate the request ID * @param payment The amount of LINK to send for the request * @param encodedRequest data encoded for request type specific format * @return requestId The request ID */ function _rawRequest( address oracleAddress, uint256 nonce, uint256 payment, bytes memory encodedRequest ) private returns (bytes32 requestId) { requestId = keccak256(abi.encodePacked(this, nonce)); s_pendingRequests[requestId] = oracleAddress; emit ChainlinkRequested(requestId); require(s_link.transferAndCall(oracleAddress, payment, encodedRequest), "unable to transferAndCall to oracle"); } /** * @notice Allows a request to be cancelled if it has not been fulfilled * @dev Requires keeping track of the expiration value emitted from the oracle contract. * Deletes the request from the `pendingRequests` mapping. * Emits ChainlinkCancelled event. * @param requestId The request ID * @param payment The amount of LINK sent for the request * @param callbackFunc The callback function specified for the request * @param expiration The time of the expiration for the request */ function cancelChainlinkRequest( bytes32 requestId, uint256 payment, bytes4 callbackFunc, uint256 expiration ) internal { OperatorInterface requested = OperatorInterface(s_pendingRequests[requestId]); delete s_pendingRequests[requestId]; emit ChainlinkCancelled(requestId); requested.cancelOracleRequest(requestId, payment, callbackFunc, expiration); } /** * @notice the next request count to be used in generating a nonce * @dev starts at 1 in order to ensure consistent gas cost * @return returns the next request count to be used in a nonce */ function getNextRequestCount() internal view returns (uint256) { return s_requestCount; } /** * @notice Sets the stored oracle address * @param oracleAddress The address of the oracle contract */ function setChainlinkOracle(address oracleAddress) internal { s_oracle = OperatorInterface(oracleAddress); } /** * @notice Sets the LINK token address * @param linkAddress The address of the LINK token contract */ function setChainlinkToken(address linkAddress) internal { s_link = LinkTokenInterface(linkAddress); } /** * @notice Sets the Chainlink token address for the public * network as given by the Pointer contract */ function setPublicChainlinkToken() internal { setChainlinkToken(PointerInterface(LINK_TOKEN_POINTER).getAddress()); } /** * @notice Retrieves the stored address of the LINK token * @return The address of the LINK token */ function chainlinkTokenAddress() internal view returns (address) { return address(s_link); } /** * @notice Retrieves the stored address of the oracle contract * @return The address of the oracle contract */ function chainlinkOracleAddress() internal view returns (address) { return address(s_oracle); } /** * @notice Allows for a request which was created on another contract to be fulfilled * on this contract * @param oracleAddress The address of the oracle contract that will fulfill the request * @param requestId The request ID used for the response */ function addChainlinkExternalRequest(address oracleAddress, bytes32 requestId) internal notPendingRequest(requestId) { s_pendingRequests[requestId] = oracleAddress; } /** * @notice Sets the stored oracle and LINK token contracts with the addresses resolved by ENS * @dev Accounts for subnodes having different resolvers * @param ensAddress The address of the ENS contract * @param node The ENS node hash */ function useChainlinkWithENS(address ensAddress, bytes32 node) internal { s_ens = ENSInterface(ensAddress); s_ensNode = node; bytes32 linkSubnode = keccak256(abi.encodePacked(s_ensNode, ENS_TOKEN_SUBNAME)); ENSResolver_Chainlink resolver = ENSResolver_Chainlink(s_ens.resolver(linkSubnode)); setChainlinkToken(resolver.addr(linkSubnode)); updateChainlinkOracleWithENS(); } /** * @notice Sets the stored oracle contract with the address resolved by ENS * @dev This may be called on its own as long as `useChainlinkWithENS` has been called previously */ function updateChainlinkOracleWithENS() internal { bytes32 oracleSubnode = keccak256(abi.encodePacked(s_ensNode, ENS_ORACLE_SUBNAME)); ENSResolver_Chainlink resolver = ENSResolver_Chainlink(s_ens.resolver(oracleSubnode)); setChainlinkOracle(resolver.addr(oracleSubnode)); } /** * @notice Ensures that the fulfillment is valid for this contract * @dev Use if the contract developer prefers methods instead of modifiers for validation * @param requestId The request ID for fulfillment */ function validateChainlinkCallback( bytes32 requestId ) internal recordChainlinkFulfillment(requestId) // solhint-disable-next-line no-empty-blocks {} /** * @dev Reverts if the sender is not the oracle of the request. * Emits ChainlinkFulfilled event. * @param requestId The request ID for fulfillment */ modifier recordChainlinkFulfillment(bytes32 requestId) { require(msg.sender == s_pendingRequests[requestId], "Source must be the oracle of the request"); delete s_pendingRequests[requestId]; emit ChainlinkFulfilled(requestId); _; } /** * @dev Reverts if the request is already pending * @param requestId The request ID for fulfillment */ modifier notPendingRequest(bytes32 requestId) { require(s_pendingRequests[requestId] == address(0), "Request is already pending"); _; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; import "./Action.sol"; interface IChainlinkAccessor { struct ChainlinkParameters { bytes32 jobId; uint256 fee; string urlData; string pathToOffchainAssets; string pathToTotalOffchainAssetAtLastClose; } struct RequestData { address investor; uint256 amount; Action action; } event SetChainlinkOracleAddress(address newAddress); event SetChainlinkJobId(bytes32 jobId); event SetChainlinkFee(uint256 fee); event SetChainlinkURLData(string url); event SetPathToOffchainAssets(string path); event SetPathToTotalOffchainAssetAtLastClose(string path); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; import "openzeppelin-contracts/access/AccessControl.sol"; abstract contract AdminRole is AccessControl { modifier onlyAdmin() { _checkRole(DEFAULT_ADMIN_ROLE); _; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; enum Action { DEPOSIT, REDEEM, ADVANCE_EPOCH, REDEMPTION_QUEUE } struct VaultParameters { uint256 transactionFee; uint256 initialDeposit; uint256 minDeposit; uint256 maxDeposit; uint256 maxWithdraw; uint256 targetReservesLevel; uint256 onchainServiceFeeRate; uint256 offchainServiceFeeRate; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; interface IFundVaultEvents { event SetFeeReceiver(address feeReceiver); event SetTreasury(address newAddress); event SetBaseVault(address baseVault); event SetKycManager(address kycManager); event SetMinTxFee(uint256 newValue); event ClaimOnchainServiceFee(address caller, address receiver, uint256 amount); event ClaimOffchainServiceFee(address caller, address receiver, uint256 amount); event TransferToTreasury(address receiver, address asset, uint256 amount); event RequestAdvanceEpoch(address caller, bytes32 requestId); event ProcessAdvanceEpoch( uint256 onchainFeeClaimable, uint256 offchainFeeClaimable, uint256 epoch, bytes32 requestId ); event AddToRedemptionQueue(address investor, uint256 shares, bytes32 requestId); event RequestRedemptionQueue(address caller, bytes32 requestId); event ProcessRedemptionQueue(address investor, uint256 assets, uint256 shares, bytes32 requestId, bytes32 prevId); event RequestDeposit(address receiver, uint256 assets, bytes32 requestId); event ProcessDeposit( address receiver, uint256 assets, uint256 shares, bytes32 requestId, uint256 txFee, address feeReceiver ); event RequestRedemption(address receiver, uint256 shares, bytes32 requestId); event ProcessRedemption( address receiver, uint256 requestedAssets, uint256 requestedShares, bytes32 requestId, uint256 availableAssets, uint256 actualAssets, uint256 actualShares ); event Fulfill(address investor, bytes32 requestId, uint256 _latestOffchainNAV, uint256 amount, uint8 action); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; /** * @dev ERC-1066 codes * https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1066.md */ uint8 constant SUCCESS_CODE = 0x01; uint8 constant DISALLOWED_OR_STOP_CODE = 0x10; uint8 constant REVOKED_OR_BANNED_CODE = 0x16; string constant SUCCESS_MESSAGE = "Success"; string constant DISALLOWED_OR_STOP_MESSAGE = "User is not KYCed"; string constant REVOKED_OR_BANNED_MESSAGE = "User is banned"; error PermissionDenied(); error InvalidAddress(address addr); error InvalidAmount(uint256 amount); error UserMissingKyc(address user); error UserBanned(address user); error RedemptionQueueEmpty(); error NoExcessReserves(); error InsufficientBalance(uint256 current, uint256 needed); error InsufficientAllowance(uint256 current, uint256 needed); error MinimumDepositRequired(uint256 minimum); error MinimumInitialDepositRequired(uint256 minimum); error MaximumDepositExceeded(uint256 maximum); error MinimumWithdrawRequired(uint256 minimum); error MaximumWithdrawExceeded(uint256 maximum);
pragma solidity ^0.8.19; import "openzeppelin-contracts/token/ERC20/IERC20.sol"; interface IERC1404 is IERC20 { /// @notice Detects if a transfer will be reverted and if so returns an appropriate reference code /// @param from Sending address /// @param to Receiving address /// @param value Amount of tokens being transferred /// @return Code by which to reference message for rejection reasoning /// @dev Overwrite with your custom transfer restriction logic function detectTransferRestriction(address from, address to, uint256 value) external view returns (uint8); /// @notice Returns a human-readable message for a given restriction code /// @param restrictionCode Identifier for looking up a message /// @return Text showing the restriction's reasoning /// @dev Overwrite with your custom message and restrictionCode handling function messageForTransferRestriction(uint8 restrictionCode) external view returns (string memory); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.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/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 (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.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 * * Furthermore, `isContract` will also return true if the target contract within * the same transaction is already scheduled for destruction by `SELFDESTRUCT`, * which only has an effect at the end of a transaction. * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import {CBORChainlink} from "./vendor/CBORChainlink.sol"; import {BufferChainlink} from "./vendor/BufferChainlink.sol"; /** * @title Library for common Chainlink functions * @dev Uses imported CBOR library for encoding to buffer */ library Chainlink { uint256 internal constant defaultBufferSize = 256; // solhint-disable-line const-name-snakecase using CBORChainlink for BufferChainlink.buffer; struct Request { bytes32 id; address callbackAddress; bytes4 callbackFunctionId; uint256 nonce; BufferChainlink.buffer buf; } /** * @notice Initializes a Chainlink request * @dev Sets the ID, callback address, and callback function signature on the request * @param self The uninitialized request * @param jobId The Job Specification ID * @param callbackAddr The callback address * @param callbackFunc The callback function signature * @return The initialized request */ function initialize( Request memory self, bytes32 jobId, address callbackAddr, bytes4 callbackFunc ) internal pure returns (Chainlink.Request memory) { BufferChainlink.init(self.buf, defaultBufferSize); self.id = jobId; self.callbackAddress = callbackAddr; self.callbackFunctionId = callbackFunc; return self; } /** * @notice Sets the data for the buffer without encoding CBOR on-chain * @dev CBOR can be closed with curly-brackets {} or they can be left off * @param self The initialized request * @param data The CBOR data */ function setBuffer(Request memory self, bytes memory data) internal pure { BufferChainlink.init(self.buf, data.length); BufferChainlink.append(self.buf, data); } /** * @notice Adds a string value to the request with a given key name * @param self The initialized request * @param key The name of the key * @param value The string value to add */ function add(Request memory self, string memory key, string memory value) internal pure { self.buf.encodeString(key); self.buf.encodeString(value); } /** * @notice Adds a bytes value to the request with a given key name * @param self The initialized request * @param key The name of the key * @param value The bytes value to add */ function addBytes(Request memory self, string memory key, bytes memory value) internal pure { self.buf.encodeString(key); self.buf.encodeBytes(value); } /** * @notice Adds a int256 value to the request with a given key name * @param self The initialized request * @param key The name of the key * @param value The int256 value to add */ function addInt(Request memory self, string memory key, int256 value) internal pure { self.buf.encodeString(key); self.buf.encodeInt(value); } /** * @notice Adds a uint256 value to the request with a given key name * @param self The initialized request * @param key The name of the key * @param value The uint256 value to add */ function addUint(Request memory self, string memory key, uint256 value) internal pure { self.buf.encodeString(key); self.buf.encodeUInt(value); } /** * @notice Adds an array of strings to the request with a given key name * @param self The initialized request * @param key The name of the key * @param values The array of string values to add */ function addStringArray(Request memory self, string memory key, string[] memory values) internal pure { self.buf.encodeString(key); self.buf.startArray(); for (uint256 i = 0; i < values.length; i++) { self.buf.encodeString(values[i]); } self.buf.endSequence(); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface ENSInterface { // Logged when the owner of a node assigns a new owner to a subnode. event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner); // Logged when the owner of a node transfers ownership to a new account. event Transfer(bytes32 indexed node, address owner); // Logged when the resolver for a node changes. event NewResolver(bytes32 indexed node, address resolver); // Logged when the TTL of a node changes event NewTTL(bytes32 indexed node, uint64 ttl); function setSubnodeOwner(bytes32 node, bytes32 label, address owner) external; function setResolver(bytes32 node, address resolver) external; function setOwner(bytes32 node, address owner) external; function setTTL(bytes32 node, uint64 ttl) external; function owner(bytes32 node) external view returns (address); function resolver(bytes32 node) external view returns (address); function ttl(bytes32 node) external view returns (uint64); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface LinkTokenInterface { function allowance(address owner, address spender) external view returns (uint256 remaining); function approve(address spender, uint256 value) external returns (bool success); function balanceOf(address owner) external view returns (uint256 balance); function decimals() external view returns (uint8 decimalPlaces); function decreaseApproval(address spender, uint256 addedValue) external returns (bool success); function increaseApproval(address spender, uint256 subtractedValue) external; function name() external view returns (string memory tokenName); function symbol() external view returns (string memory tokenSymbol); function totalSupply() external view returns (uint256 totalTokensIssued); function transfer(address to, uint256 value) external returns (bool success); function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool success); function transferFrom(address from, address to, uint256 value) external returns (bool success); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface ChainlinkRequestInterface { function oracleRequest( address sender, uint256 requestPrice, bytes32 serviceAgreementID, address callbackAddress, bytes4 callbackFunctionId, uint256 nonce, uint256 dataVersion, bytes calldata data ) external; function cancelOracleRequest( bytes32 requestId, uint256 payment, bytes4 callbackFunctionId, uint256 expiration ) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./OracleInterface.sol"; import "./ChainlinkRequestInterface.sol"; interface OperatorInterface is OracleInterface, ChainlinkRequestInterface { function operatorRequest( address sender, uint256 payment, bytes32 specId, bytes4 callbackFunctionId, uint256 nonce, uint256 dataVersion, bytes calldata data ) external; function fulfillOracleRequest2( bytes32 requestId, uint256 payment, address callbackAddress, bytes4 callbackFunctionId, uint256 expiration, bytes calldata data ) external returns (bool); function ownerTransferAndCall(address to, uint256 value, bytes calldata data) external returns (bool success); function distributeFunds(address payable[] calldata receivers, uint256[] calldata amounts) external payable; function getAuthorizedSenders() external returns (address[] memory); function setAuthorizedSenders(address[] calldata senders) external; function getForwarder() external returns (address); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface PointerInterface { function getAddress() external view returns (address); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; abstract contract ENSResolver { function addr(bytes32 node) public view virtual returns (address); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol) pragma solidity ^0.8.0; import "./IAccessControl.sol"; import "../utils/Context.sol"; import "../utils/Strings.sol"; import "../utils/introspection/ERC165.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: * * ```solidity * 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}: * * ```solidity * 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. We recommend using {AccessControlDefaultAdminRules} * to enforce additional security measures for this role. */ abstract contract AccessControl is Context, IAccessControl, ERC165 { 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); _; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view virtual override returns (bool) { return _roles[role].members[account]; } /** * @dev Revert with a standard message if `_msgSender()` is missing `role`. * Overriding this function changes the behavior of the {onlyRole} modifier. * * Format of the revert message is described in {_checkRole}. * * _Available since v4.6._ */ function _checkRole(bytes32 role) internal view virtual { _checkRole(role, _msgSender()); } /** * @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 virtual { if (!hasRole(role, account)) { revert( string( abi.encodePacked( "AccessControl: account ", Strings.toHexString(account), " is missing role ", Strings.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 virtual 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. * * May emit a {RoleGranted} event. */ 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. * * May emit a {RoleRevoked} event. */ 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`. * * May emit a {RoleRevoked} event. */ 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. * * May emit a {RoleGranted} event. * * [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. * * May emit a {RoleGranted} event. */ 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. * * May emit a {RoleRevoked} event. */ function _revokeRole(bytes32 role, address account) internal virtual { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } }
// SPDX-License-Identifier: MIT pragma solidity >=0.4.19; import {BufferChainlink} from "./BufferChainlink.sol"; library CBORChainlink { using BufferChainlink for BufferChainlink.buffer; uint8 private constant MAJOR_TYPE_INT = 0; uint8 private constant MAJOR_TYPE_NEGATIVE_INT = 1; uint8 private constant MAJOR_TYPE_BYTES = 2; uint8 private constant MAJOR_TYPE_STRING = 3; uint8 private constant MAJOR_TYPE_ARRAY = 4; uint8 private constant MAJOR_TYPE_MAP = 5; uint8 private constant MAJOR_TYPE_TAG = 6; uint8 private constant MAJOR_TYPE_CONTENT_FREE = 7; uint8 private constant TAG_TYPE_BIGNUM = 2; uint8 private constant TAG_TYPE_NEGATIVE_BIGNUM = 3; function encodeFixedNumeric(BufferChainlink.buffer memory buf, uint8 major, uint64 value) private pure { if(value <= 23) { buf.appendUint8(uint8((major << 5) | value)); } else if (value <= 0xFF) { buf.appendUint8(uint8((major << 5) | 24)); buf.appendInt(value, 1); } else if (value <= 0xFFFF) { buf.appendUint8(uint8((major << 5) | 25)); buf.appendInt(value, 2); } else if (value <= 0xFFFFFFFF) { buf.appendUint8(uint8((major << 5) | 26)); buf.appendInt(value, 4); } else { buf.appendUint8(uint8((major << 5) | 27)); buf.appendInt(value, 8); } } function encodeIndefiniteLengthType(BufferChainlink.buffer memory buf, uint8 major) private pure { buf.appendUint8(uint8((major << 5) | 31)); } function encodeUInt(BufferChainlink.buffer memory buf, uint value) internal pure { if(value > 0xFFFFFFFFFFFFFFFF) { encodeBigNum(buf, value); } else { encodeFixedNumeric(buf, MAJOR_TYPE_INT, uint64(value)); } } function encodeInt(BufferChainlink.buffer memory buf, int value) internal pure { if(value < -0x10000000000000000) { encodeSignedBigNum(buf, value); } else if(value > 0xFFFFFFFFFFFFFFFF) { encodeBigNum(buf, uint(value)); } else if(value >= 0) { encodeFixedNumeric(buf, MAJOR_TYPE_INT, uint64(uint256(value))); } else { encodeFixedNumeric(buf, MAJOR_TYPE_NEGATIVE_INT, uint64(uint256(-1 - value))); } } function encodeBytes(BufferChainlink.buffer memory buf, bytes memory value) internal pure { encodeFixedNumeric(buf, MAJOR_TYPE_BYTES, uint64(value.length)); buf.append(value); } function encodeBigNum(BufferChainlink.buffer memory buf, uint value) internal pure { buf.appendUint8(uint8((MAJOR_TYPE_TAG << 5) | TAG_TYPE_BIGNUM)); encodeBytes(buf, abi.encode(value)); } function encodeSignedBigNum(BufferChainlink.buffer memory buf, int input) internal pure { buf.appendUint8(uint8((MAJOR_TYPE_TAG << 5) | TAG_TYPE_NEGATIVE_BIGNUM)); encodeBytes(buf, abi.encode(uint256(-1 - input))); } function encodeString(BufferChainlink.buffer memory buf, string memory value) internal pure { encodeFixedNumeric(buf, MAJOR_TYPE_STRING, uint64(bytes(value).length)); buf.append(bytes(value)); } function startArray(BufferChainlink.buffer memory buf) internal pure { encodeIndefiniteLengthType(buf, MAJOR_TYPE_ARRAY); } function startMap(BufferChainlink.buffer memory buf) internal pure { encodeIndefiniteLengthType(buf, MAJOR_TYPE_MAP); } function endSequence(BufferChainlink.buffer memory buf) internal pure { encodeIndefiniteLengthType(buf, MAJOR_TYPE_CONTENT_FREE); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev A library for working with mutable byte buffers in Solidity. * * Byte buffers are mutable and expandable, and provide a variety of primitives * for writing to them. At any time you can fetch a bytes object containing the * current contents of the buffer. The bytes object should not be stored between * operations, as it may change due to resizing of the buffer. */ library BufferChainlink { /** * @dev Represents a mutable buffer. Buffers have a current value (buf) and * a capacity. The capacity may be longer than the current value, in * which case it can be extended without the need to allocate more memory. */ struct buffer { bytes buf; uint256 capacity; } /** * @dev Initializes a buffer with an initial capacity. * @param buf The buffer to initialize. * @param capacity The number of bytes of space to allocate the buffer. * @return The buffer, for chaining. */ function init(buffer memory buf, uint256 capacity) internal pure returns (buffer memory) { if (capacity % 32 != 0) { capacity += 32 - (capacity % 32); } // Allocate space for the buffer data buf.capacity = capacity; assembly { let ptr := mload(0x40) mstore(buf, ptr) mstore(ptr, 0) mstore(0x40, add(32, add(ptr, capacity))) } return buf; } /** * @dev Initializes a new buffer from an existing bytes object. * Changes to the buffer may mutate the original value. * @param b The bytes object to initialize the buffer with. * @return A new buffer. */ function fromBytes(bytes memory b) internal pure returns (buffer memory) { buffer memory buf; buf.buf = b; buf.capacity = b.length; return buf; } function resize(buffer memory buf, uint256 capacity) private pure { bytes memory oldbuf = buf.buf; init(buf, capacity); append(buf, oldbuf); } function max(uint256 a, uint256 b) private pure returns (uint256) { if (a > b) { return a; } return b; } /** * @dev Sets buffer length to 0. * @param buf The buffer to truncate. * @return The original buffer, for chaining.. */ function truncate(buffer memory buf) internal pure returns (buffer memory) { assembly { let bufptr := mload(buf) mstore(bufptr, 0) } return buf; } /** * @dev Writes a byte string to a buffer. Resizes if doing so would exceed * the capacity of the buffer. * @param buf The buffer to append to. * @param off The start offset to write to. * @param data The data to append. * @param len The number of bytes to copy. * @return The original buffer, for chaining. */ function write( buffer memory buf, uint256 off, bytes memory data, uint256 len ) internal pure returns (buffer memory) { require(len <= data.length); if (off + len > buf.capacity) { resize(buf, max(buf.capacity, len + off) * 2); } uint256 dest; uint256 src; assembly { // Memory address of the buffer data let bufptr := mload(buf) // Length of existing buffer data let buflen := mload(bufptr) // Start address = buffer address + offset + sizeof(buffer length) dest := add(add(bufptr, 32), off) // Update buffer length if we're extending it if gt(add(len, off), buflen) { mstore(bufptr, add(len, off)) } src := add(data, 32) } // Copy word-length chunks while possible for (; len >= 32; len -= 32) { assembly { mstore(dest, mload(src)) } dest += 32; src += 32; } // Copy remaining bytes unchecked { uint256 mask = (256**(32 - len)) - 1; assembly { let srcpart := and(mload(src), not(mask)) let destpart := and(mload(dest), mask) mstore(dest, or(destpart, srcpart)) } } return buf; } /** * @dev Appends a byte string to a buffer. Resizes if doing so would exceed * the capacity of the buffer. * @param buf The buffer to append to. * @param data The data to append. * @param len The number of bytes to copy. * @return The original buffer, for chaining. */ function append( buffer memory buf, bytes memory data, uint256 len ) internal pure returns (buffer memory) { return write(buf, buf.buf.length, data, len); } /** * @dev Appends a byte string to a buffer. Resizes if doing so would exceed * the capacity of the buffer. * @param buf The buffer to append to. * @param data The data to append. * @return The original buffer, for chaining. */ function append(buffer memory buf, bytes memory data) internal pure returns (buffer memory) { return write(buf, buf.buf.length, data, data.length); } /** * @dev Writes a byte to the buffer. Resizes if doing so would exceed the * capacity of the buffer. * @param buf The buffer to append to. * @param off The offset to write the byte at. * @param data The data to append. * @return The original buffer, for chaining. */ function writeUint8( buffer memory buf, uint256 off, uint8 data ) internal pure returns (buffer memory) { if (off >= buf.capacity) { resize(buf, buf.capacity * 2); } assembly { // Memory address of the buffer data let bufptr := mload(buf) // Length of existing buffer data let buflen := mload(bufptr) // Address = buffer address + sizeof(buffer length) + off let dest := add(add(bufptr, off), 32) mstore8(dest, data) // Update buffer length if we extended it if eq(off, buflen) { mstore(bufptr, add(buflen, 1)) } } return buf; } /** * @dev Appends a byte to the buffer. Resizes if doing so would exceed the * capacity of the buffer. * @param buf The buffer to append to. * @param data The data to append. * @return The original buffer, for chaining. */ function appendUint8(buffer memory buf, uint8 data) internal pure returns (buffer memory) { return writeUint8(buf, buf.buf.length, data); } /** * @dev Writes up to 32 bytes to the buffer. Resizes if doing so would * exceed the capacity of the buffer. * @param buf The buffer to append to. * @param off The offset to write at. * @param data The data to append. * @param len The number of bytes to write (left-aligned). * @return The original buffer, for chaining. */ function write( buffer memory buf, uint256 off, bytes32 data, uint256 len ) private pure returns (buffer memory) { if (len + off > buf.capacity) { resize(buf, (len + off) * 2); } unchecked { uint256 mask = (256**len) - 1; // Right-align data data = data >> (8 * (32 - len)); assembly { // Memory address of the buffer data let bufptr := mload(buf) // Address = buffer address + sizeof(buffer length) + off + len let dest := add(add(bufptr, off), len) mstore(dest, or(and(mload(dest), not(mask)), data)) // Update buffer length if we extended it if gt(add(off, len), mload(bufptr)) { mstore(bufptr, add(off, len)) } } } return buf; } /** * @dev Writes a bytes20 to the buffer. Resizes if doing so would exceed the * capacity of the buffer. * @param buf The buffer to append to. * @param off The offset to write at. * @param data The data to append. * @return The original buffer, for chaining. */ function writeBytes20( buffer memory buf, uint256 off, bytes20 data ) internal pure returns (buffer memory) { return write(buf, off, bytes32(data), 20); } /** * @dev Appends a bytes20 to the buffer. Resizes if doing so would exceed * the capacity of the buffer. * @param buf The buffer to append to. * @param data The data to append. * @return The original buffer, for chhaining. */ function appendBytes20(buffer memory buf, bytes20 data) internal pure returns (buffer memory) { return write(buf, buf.buf.length, bytes32(data), 20); } /** * @dev Appends a bytes32 to the buffer. Resizes if doing so would exceed * the capacity of the buffer. * @param buf The buffer to append to. * @param data The data to append. * @return The original buffer, for chaining. */ function appendBytes32(buffer memory buf, bytes32 data) internal pure returns (buffer memory) { return write(buf, buf.buf.length, data, 32); } /** * @dev Writes an integer to the buffer. Resizes if doing so would exceed * the capacity of the buffer. * @param buf The buffer to append to. * @param off The offset to write at. * @param data The data to append. * @param len The number of bytes to write (right-aligned). * @return The original buffer, for chaining. */ function writeInt( buffer memory buf, uint256 off, uint256 data, uint256 len ) private pure returns (buffer memory) { if (len + off > buf.capacity) { resize(buf, (len + off) * 2); } uint256 mask = (256**len) - 1; assembly { // Memory address of the buffer data let bufptr := mload(buf) // Address = buffer address + off + sizeof(buffer length) + len let dest := add(add(bufptr, off), len) mstore(dest, or(and(mload(dest), not(mask)), data)) // Update buffer length if we extended it if gt(add(off, len), mload(bufptr)) { mstore(bufptr, add(off, len)) } } return buf; } /** * @dev Appends a byte to the end of the buffer. Resizes if doing so would * exceed the capacity of the buffer. * @param buf The buffer to append to. * @param data The data to append. * @return The original buffer. */ function appendInt( buffer memory buf, uint256 data, uint256 len ) internal pure returns (buffer memory) { return writeInt(buf, buf.buf.length, data, len); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface OracleInterface { function fulfillOracleRequest( bytes32 requestId, uint256 payment, address callbackAddress, bytes4 callbackFunctionId, uint256 expiration, bytes32 data ) external returns (bool); function isAuthorizedSender(address node) external view returns (bool); function withdraw(address recipient, uint256 amount) external; function withdrawable() external view returns (uint256); }
// 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 IAccessControl { /** * @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 (last updated v4.9.0) (utils/Strings.sol) pragma solidity ^0.8.0; import "./math/Math.sol"; import "./math/SignedMath.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant _SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), _SYMBOLS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `int256` to its ASCII `string` decimal representation. */ function toString(int256 value) internal pure returns (string memory) { return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMath.abs(value)))); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, Math.log256(value) + 1); } } /** * @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] = _SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } /** * @dev Returns true if the two strings are equal. */ function equal(string memory a, string memory b) internal pure returns (bool) { return keccak256(bytes(a)) == keccak256(bytes(b)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.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 ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol) pragma solidity ^0.8.0; /** * @dev Standard signed math utilities missing in the Solidity language. */ library SignedMath { /** * @dev Returns the largest of two signed numbers. */ function max(int256 a, int256 b) internal pure returns (int256) { return a > b ? a : b; } /** * @dev Returns the smallest of two signed numbers. */ function min(int256 a, int256 b) internal pure returns (int256) { return a < b ? a : b; } /** * @dev Returns the average of two signed numbers without overflow. * The result is rounded towards zero. */ function average(int256 a, int256 b) internal pure returns (int256) { // Formula from the book "Hacker's Delight" int256 x = (a & b) + ((a ^ b) >> 1); return x + (int256(uint256(x) >> 255) & (a ^ b)); } /** * @dev Returns the absolute unsigned value of a signed value. */ function abs(int256 n) internal pure returns (uint256) { unchecked { // must be unchecked in order to support `n = type(int256).min` return uint256(n >= 0 ? n : -n); } } }
// 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); }
{ "remappings": [ "chainlink/=lib/chainlink/contracts/src/v0.8/", "ds-test/=lib/forge-std/lib/ds-test/src/", "erc4626-tests/=lib/chainlink/contracts/foundry-lib/openzeppelin-contracts/lib/erc4626-tests/", "forge-std/=lib/forge-std/src/", "openzeppelin-contracts/=lib/openzeppelin-contracts/contracts/", "openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/", "openzeppelin/=lib/openzeppelin-contracts-upgradeable/contracts/" ], "optimizer": { "enabled": true, "runs": 200 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "ipfs", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "paris", "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"contract IERC20","name":"asset","type":"address"},{"internalType":"address","name":"operator","type":"address"},{"internalType":"address","name":"feeReceiver","type":"address"},{"internalType":"address","name":"treasury","type":"address"},{"internalType":"contract IBaseVault","name":"baseVault","type":"address"},{"internalType":"contract IKycManager","name":"kycManager","type":"address"},{"internalType":"address","name":"chainlinkToken","type":"address"},{"internalType":"address","name":"chainlinkOracle","type":"address"},{"components":[{"internalType":"bytes32","name":"jobId","type":"bytes32"},{"internalType":"uint256","name":"fee","type":"uint256"},{"internalType":"string","name":"urlData","type":"string"},{"internalType":"string","name":"pathToOffchainAssets","type":"string"},{"internalType":"string","name":"pathToTotalOffchainAssetAtLastClose","type":"string"}],"internalType":"struct IChainlinkAccessor.ChainlinkParameters","name":"chainlinkParams","type":"tuple"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"Empty","type":"error"},{"inputs":[{"internalType":"uint256","name":"current","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"InsufficientAllowance","type":"error"},{"inputs":[{"internalType":"uint256","name":"current","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"InsufficientBalance","type":"error"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"InvalidAddress","type":"error"},{"inputs":[{"internalType":"uint256","name":"maximum","type":"uint256"}],"name":"MaximumDepositExceeded","type":"error"},{"inputs":[{"internalType":"uint256","name":"maximum","type":"uint256"}],"name":"MaximumWithdrawExceeded","type":"error"},{"inputs":[{"internalType":"uint256","name":"minimum","type":"uint256"}],"name":"MinimumDepositRequired","type":"error"},{"inputs":[{"internalType":"uint256","name":"minimum","type":"uint256"}],"name":"MinimumInitialDepositRequired","type":"error"},{"inputs":[{"internalType":"uint256","name":"minimum","type":"uint256"}],"name":"MinimumWithdrawRequired","type":"error"},{"inputs":[],"name":"NoExcessReserves","type":"error"},{"inputs":[],"name":"OutOfBounds","type":"error"},{"inputs":[],"name":"PermissionDenied","type":"error"},{"inputs":[],"name":"RedemptionQueueEmpty","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"investor","type":"address"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"requestId","type":"bytes32"}],"name":"AddToRedemptionQueue","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":"bytes32","name":"id","type":"bytes32"}],"name":"ChainlinkCancelled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"id","type":"bytes32"}],"name":"ChainlinkFulfilled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"id","type":"bytes32"}],"name":"ChainlinkRequested","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"caller","type":"address"},{"indexed":false,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"ClaimOffchainServiceFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"caller","type":"address"},{"indexed":false,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"ClaimOnchainServiceFee","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":false,"internalType":"address","name":"investor","type":"address"},{"indexed":false,"internalType":"bytes32","name":"requestId","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"_latestOffchainNAV","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint8","name":"action","type":"uint8"}],"name":"Fulfill","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"onchainFeeClaimable","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"offchainFeeClaimable","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"epoch","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"requestId","type":"bytes32"}],"name":"ProcessAdvanceEpoch","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"assets","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"requestId","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"txFee","type":"uint256"},{"indexed":false,"internalType":"address","name":"feeReceiver","type":"address"}],"name":"ProcessDeposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"requestedAssets","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"requestedShares","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"requestId","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"availableAssets","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"actualAssets","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"actualShares","type":"uint256"}],"name":"ProcessRedemption","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"investor","type":"address"},{"indexed":false,"internalType":"uint256","name":"assets","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"requestId","type":"bytes32"},{"indexed":false,"internalType":"bytes32","name":"prevId","type":"bytes32"}],"name":"ProcessRedemptionQueue","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"caller","type":"address"},{"indexed":false,"internalType":"bytes32","name":"requestId","type":"bytes32"}],"name":"RequestAdvanceEpoch","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"assets","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"requestId","type":"bytes32"}],"name":"RequestDeposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"requestId","type":"bytes32"}],"name":"RequestRedemption","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"caller","type":"address"},{"indexed":false,"internalType":"bytes32","name":"requestId","type":"bytes32"}],"name":"RequestRedemptionQueue","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":false,"internalType":"address","name":"baseVault","type":"address"}],"name":"SetBaseVault","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"fee","type":"uint256"}],"name":"SetChainlinkFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"jobId","type":"bytes32"}],"name":"SetChainlinkJobId","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newAddress","type":"address"}],"name":"SetChainlinkOracleAddress","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"url","type":"string"}],"name":"SetChainlinkURLData","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"feeReceiver","type":"address"}],"name":"SetFeeReceiver","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"kycManager","type":"address"}],"name":"SetKycManager","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newValue","type":"uint256"}],"name":"SetMinTxFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"path","type":"string"}],"name":"SetPathToOffchainAssets","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"path","type":"string"}],"name":"SetPathToTotalOffchainAssetAtLastClose","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newAddress","type":"address"}],"name":"SetTreasury","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":false,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"address","name":"asset","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"TransferToTreasury","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":"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"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"OPERATOR_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_baseVault","outputs":[{"internalType":"contract IBaseVault","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_epoch","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_feeReceiver","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"_initialDeposit","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_kycManager","outputs":[{"internalType":"contract IKycManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_latestOffchainNAV","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_minTxFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_offchainFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_onchainFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_treasury","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","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":"address","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":"address[]","name":"_investors","type":"address[]"}],"name":"bulkSetInitialDeposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"claimOffchainServiceFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"claimOnchainServiceFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"combinedNetAssets","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"shares","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":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"detectTransferRestriction","outputs":[{"internalType":"uint8","name":"restrictionCode","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"excessReserves","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"requestId","type":"bytes32"},{"internalType":"uint256","name":"latestOffchainNAV","type":"uint256"}],"name":"fulfill","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getChainLinkParameters","outputs":[{"components":[{"internalType":"bytes32","name":"jobId","type":"bytes32"},{"internalType":"uint256","name":"fee","type":"uint256"},{"internalType":"string","name":"urlData","type":"string"},{"internalType":"string","name":"pathToOffchainAssets","type":"string"},{"internalType":"string","name":"pathToTotalOffchainAssetAtLastClose","type":"string"}],"internalType":"struct IChainlinkAccessor.ChainlinkParameters","name":"params","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getRedemptionQueueInfo","outputs":[{"internalType":"address","name":"investor","type":"address"},{"internalType":"uint256","name":"shares","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getRedemptionQueueLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"requestId","type":"bytes32"}],"name":"getRequestData","outputs":[{"internalType":"address","name":"investor","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"enum Action","name":"action","type":"uint8"}],"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":"uint256","name":"assets","type":"uint256"}],"name":"getTxFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"epoch","type":"uint256"}],"name":"getUserEpochInfo","outputs":[{"internalType":"uint256","name":"depositAmt","type":"uint256"},{"internalType":"uint256","name":"withdrawAmt","type":"uint256"},{"internalType":"uint256","name":"delta","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":"address","name":"","type":"address"}],"name":"maxDeposit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","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":[{"internalType":"address","name":"owner","type":"address"}],"name":"maxWithdraw","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"restrictionCode","type":"uint8"}],"name":"messageForTransferRestriction","outputs":[{"internalType":"string","name":"message","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"mint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","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":[{"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":[],"name":"requestAdvanceEpoch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"requestRedemptionQueue","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":"address","name":"baseVault","type":"address"}],"name":"setBaseVault","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"fee","type":"uint256"}],"name":"setChainlinkFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"jobId","type":"bytes32"}],"name":"setChainlinkJobId","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newAddress","type":"address"}],"name":"setChainlinkOracleAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"url","type":"string"}],"name":"setChainlinkURLData","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"feeReceiver","type":"address"}],"name":"setFeeReceiver","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"kycManager","type":"address"}],"name":"setKycManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newValue","type":"uint256"}],"name":"setMinTxFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"path","type":"string"}],"name":"setPathToOffchainAssets","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"path","type":"string"}],"name":"setPathToTotalOffchainAssetAtLastClose","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newAddress","type":"address"}],"name":"setTreasury","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":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"transferExcessReservesToTreasury","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"underlying","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferToTreasury","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"vaultNetAssets","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"withdraw","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"}]
Contract Creation Code
60c060405260016004553480156200001657600080fd5b5060405162006404380380620064048339810160408190526200003991620005b8565b886040518060400160405280600c81526020016b10dbd9da5d1bc8151195539160a21b81525060405180604001604052806005815260200164151195539160da1b81525081600990816200008e919062000734565b50600a6200009d828262000734565b505050600080620000b483620001b160201b60201c565b9150915081620000c6576012620000c8565b805b60ff1660a05250506001600160a01b03166080526001600b55600c805460ff19169055620000f860003362000296565b620001247f97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b9298962000296565b601b80546001600160a01b03808a166001600160a01b031992831617909255601c8054898416908316179055601d8054888416908316179055601e8054928716929091169190911790556200017862000321565b6200018590600a62000913565b620001929060196200092b565b601755620001a281848462000338565b50505050505050505062000999565b60408051600481526024810182526020810180516001600160e01b031663313ce56760e01b17905290516000918291829182916001600160a01b03871691620001fa9162000945565b600060405180830381855afa9150503d806000811462000237576040519150601f19603f3d011682016040523d82523d6000602084013e6200023c565b606091505b50915091508180156200025157506020815110155b1562000289576000818060200190518101906200026f919062000963565b905060ff811162000287576001969095509350505050565b505b5060009485945092505050565b620002a28282620003c6565b6200031d576000828152600d602090815260408083206001600160a01b03851684529091529020805460ff19166001179055620002dc3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b60008060a0516200033391906200097d565b905090565b6020830151600f558251600e55604083015160109062000359908262000734565b5060608301516011906200036e908262000734565b50608083015160129062000383908262000734565b50600380546001600160a01b0319166001600160a01b038316179055600280546001600160a01b0384166001600160a01b0319909116179055505050565b505050565b6000828152600d602090815260408083206001600160a01b038516845290915290205460ff165b92915050565b6001600160a01b03811681146200040957600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60405160a081016001600160401b03811182821017156200044757620004476200040c565b60405290565b60005b838110156200046a57818101518382015260200162000450565b50506000910152565b600082601f8301126200048557600080fd5b81516001600160401b0380821115620004a257620004a26200040c565b604051601f8301601f19908116603f01168101908282118183101715620004cd57620004cd6200040c565b81604052838152866020858801011115620004e757600080fd5b620004fa8460208301602089016200044d565b9695505050505050565b600060a082840312156200051757600080fd5b6200052162000422565b825181526020808401519082015260408301519091506001600160401b03808211156200054d57600080fd5b6200055b8583860162000473565b604084015260608401519150808211156200057557600080fd5b620005838583860162000473565b606084015260808401519150808211156200059d57600080fd5b50620005ac8482850162000473565b60808301525092915050565b60008060008060008060008060006101208a8c031215620005d857600080fd5b8951620005e581620003f3565b60208b0151909950620005f881620003f3565b60408b01519098506200060b81620003f3565b60608b01519097506200061e81620003f3565b60808b01519096506200063181620003f3565b60a08b01519095506200064481620003f3565b60c08b01519094506200065781620003f3565b60e08b01519093506200066a81620003f3565b6101008b01519092506001600160401b038111156200068857600080fd5b620006968c828d0162000504565b9150509295985092959850929598565b600181811c90821680620006bb57607f821691505b602082108103620006dc57634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620003c157600081815260208120601f850160051c810160208610156200070b5750805b601f850160051c820191505b818110156200072c5782815560010162000717565b505050505050565b81516001600160401b038111156200075057620007506200040c565b6200076881620007618454620006a6565b84620006e2565b602080601f831160018114620007a05760008415620007875750858301515b600019600386901b1c1916600185901b1785556200072c565b600085815260208120601f198616915b82811015620007d157888601518255948401946001909101908401620007b0565b5085821015620007f05787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b634e487b7160e01b600052601160045260246000fd5b600181815b80851115620008575781600019048211156200083b576200083b62000800565b808516156200084957918102915b93841c93908002906200081b565b509250929050565b6000826200087057506001620003ed565b816200087f57506000620003ed565b8160018114620008985760028114620008a357620008c3565b6001915050620003ed565b60ff841115620008b757620008b762000800565b50506001821b620003ed565b5060208310610133831016604e8410600b8410161715620008e8575081810a620003ed565b620008f4838362000816565b80600019048211156200090b576200090b62000800565b029392505050565b60006200092460ff8416836200085f565b9392505050565b8082028115828204841417620003ed57620003ed62000800565b60008251620009598184602087016200044d565b9190910192915050565b6000602082840312156200097657600080fd5b5051919050565b60ff8181168382160190811115620003ed57620003ed62000800565b60805160a0516159f162000a136000396000610ea301526000818161061001528181610a3301528181610c230152818161146d01528181611c2001528181611d4201528181611e0001528181612f4f015281816136790152818161371201528181613ce401528181613dc5015261419901526159f16000f3fe608060405234801561001057600080fd5b506004361061046a5760003560e01c80637fb9a8e11161024c578063c63d75b611610146578063dd62ed3e116100c3578063ef8b30f711610087578063ef8b30f7146108ac578063efdcd974146109cd578063f0f44260146109e0578063f5b541a6146109f3578063fdabd16a14610a0857600080fd5b8063dd62ed3e14610978578063def9ba771461098b578063dfb7bc2d14610994578063e2a7ece0146109a7578063e319a3d9146109ba57600080fd5b8063d44396591161010a578063d443965914610913578063d4ce141514610936578063d547741f14610949578063d673f4c31461095c578063d905777e1461096557600080fd5b8063c63d75b61461069d578063c6e6f592146108ac578063c7a1dcf3146108bf578063ccdcbf38146108d2578063ce96cb771461090057600080fd5b8063a217fddf116101d4578063a9059cbb11610198578063a9059cbb14610852578063b268457714610865578063b3d7f6b914610878578063b460af941461088b578063ba0876521461089957600080fd5b8063a217fddf14610812578063a284673f1461081a578063a28c216f1461082d578063a457c2d714610836578063a8f040fb1461084957600080fd5b806390426a3d1161021b57806390426a3d146107c357806391d14854146107d657806394bf804d146107e957806395d89b41146107f75780639dd267e6146107ff57600080fd5b80637fb9a8e1146107825780638456cb59146107955780638748e7fb1461079d5780638758b1b5146107b057600080fd5b806338d52e0f116103685780635864c492116102e557806368f7d289116102a957806368f7d289146107215780636e553f651461073657806370a082311461074957806370a3ef651461075c5780637f4ab1dd1461076f57600080fd5b80635864c492146106e057806359e764d6146106f357806359f406c4146107065780635c975abb1461070e5780635db896cf1461071957600080fd5b8063402d267d1161032c578063402d267d1461069d57806341799da3146106b25780634357855e146106ba5780634cdad506146104c25780634e266918146106cd57600080fd5b806338d52e0f1461060e57806339509351146106485780633c5ac5e21461065b5780633f4ba83a146106635780633f920b4b1461066b57600080fd5b80631b71c637116103f65780632a4b8c57116103ba5780632a4b8c57146105b25780632f2ff15d146105c55780633064d18a146105d8578063313ce567146105e157806336568abe146105fb57600080fd5b80631b71c6371461051557806320160b071461051d57806323b872dd14610530578063248a9ca3146105435780632a00a4721461056657600080fd5b8063095ea7b31161043d578063095ea7b3146104d55780630a28a477146104e85780630aed44c6146104fb5780630c3513a81461050557806318160ddd1461050d57600080fd5b806301e1d1141461046f57806301ffc9a71461048a57806306fdde03146104ad57806307a2d13a146104c2575b600080fd5b610477610a1b565b6040519081526020015b60405180910390f35b61049d610498366004614fd1565b610aab565b6040519015158152602001610481565b6104b5610ae2565b604051610481919061504b565b6104776104d036600461505e565b610b74565b61049d6104e336600461508c565b610b81565b6104776104f636600461505e565b610b99565b610503610ba6565b005b610477610c4b565b600854610477565b610477610d0d565b61050361052b36600461505e565b610d28565b61049d61053e3660046150b8565b610daf565b61047761055136600461505e565b6000908152600d602052604090206001015490565b6105a361057436600461505e565b6000908152601360205260409020805460018201546002909201546001600160a01b039091169260ff90911690565b6040516104819392919061510f565b6104776105c036600461505e565b610dd5565b6105036105d3366004615152565b610e71565b61047760195481565b6105e9610e9b565b60405160ff9091168152602001610481565b610503610609366004615152565b610ec7565b7f00000000000000000000000000000000000000000000000000000000000000005b6040516001600160a01b039091168152602001610481565b61049d61065636600461508c565b610f4a565b610503610f6c565b610503611037565b61067e61067936600461505e565b61108c565b604080516001600160a01b039093168352602083019190915201610481565b6104776106ab366004615182565b5060001990565b610477611115565b6105036106c836600461519f565b611144565b6105036106db36600461505e565b611339565b6105036106ee3660046151d7565b611378565b61050361070136600461505e565b6113be565b6105036114de565b600c5460ff1661049d565b610477611574565b61072961158b565b6040516104819190615287565b610477610744366004615152565b611798565b610477610757366004615182565b611906565b61050361076a3660046151d7565b611921565b6104b561077d3660046152f3565b611967565b610503610790366004615182565b611a09565b610503611a61565b6105036107ab366004615316565b611ab4565b601b54610630906001600160a01b031681565b6105036107d136600461505e565b611b71565b61049d6107e4366004615152565b611c83565b61047761046a366004615152565b6104b5611cae565b61050361080d36600461508c565b611cbd565b610477600081565b61050361082836600461505e565b611e3b565b61047760165481565b61049d61084436600461508c565b611e7a565b61047760175481565b61049d61086036600461508c565b611f00565b6105036108733660046151d7565b611f0e565b61047761088636600461505e565b611f54565b61047761046a36600461538a565b6104776108a736600461538a565b611f61565b6104776108ba36600461505e565b612107565b601e54610630906001600160a01b031681565b6108e56108e036600461508c565b612114565b60408051938452602084019290925290820152606001610481565b61047761090e366004615182565b612174565b61049d610921366004615182565b601f6020526000908152604090205460ff1681565b6105e96109443660046150b8565b612189565b610503610957366004615152565b6124e2565b610477601a5481565b610477610973366004615182565b612507565b6104776109863660046153cc565b612512565b61047760185481565b6105036109a2366004615182565b61253d565b601d54610630906001600160a01b031681565b601c54610630906001600160a01b031681565b6105036109db366004615182565b612595565b6105036109ee366004615182565b6125ed565b61047760008051602061599c83398151915281565b610503610a16366004615182565b612645565b6040516370a0823160e01b81523060048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa158015610a82573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aa691906153fa565b905090565b60006001600160e01b03198216637965db0b60e01b1480610adc57506301ffc9a760e01b6001600160e01b03198316145b92915050565b606060098054610af190615413565b80601f0160208091040260200160405190810160405280929190818152602001828054610b1d90615413565b8015610b6a5780601f10610b3f57610100808354040283529160200191610b6a565b820191906000526020600020905b815481529060010190602001808311610b4d57829003601f168201915b5050505050905090565b6000610adc8260006126a3565b600033610b8f8185856126da565b5060019392505050565b6000610adc8260016127fe565b610bb1600033611c83565b158015610bd35750610bd160008051602061599c83398151915233611c83565b155b15610bf157604051630782484160e21b815260040160405180910390fd5b6000610bfb610c4b565b905080600003610c1e576040516324c2eb3760e11b815260040160405180910390fd5b610c487f000000000000000000000000000000000000000000000000000000000000000082611cbd565b50565b6000806064610c58611574565b601d60009054906101000a90046001600160a01b03166001600160a01b0316637e1edddb6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610cab573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ccf91906153fa565b610cd9919061545d565b610ce3919061548a565b90506000610cef611115565b9050610d066000610d00848461549e565b90612830565b9250505090565b6000610aa6601454600f81810b600160801b909204900b0390565b610d33600033611c83565b158015610d555750610d5360008051602061599c83398151915233611c83565b155b15610d7357604051630782484160e21b815260040160405180910390fd5b60178190556040518181527f963c15c9f2c7f80167f8c1daa955ba3b84bd1cc728123df3c456dfe8eeeb2eaa906020015b60405180910390a150565b600033610dbd858285612846565b610dc88585856128c0565b60019150505b9392505050565b6000610adc612710601d60009054906101000a90046001600160a01b03166001600160a01b03166385d791026040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e30573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e5491906153fa565b610e5e908561545d565b610e68919061548a565b60175490612830565b6000828152600d6020526040902060010154610e8c81612a7c565b610e968383612a86565b505050565b6000610aa6817f00000000000000000000000000000000000000000000000000000000000000006154b1565b6001600160a01b0381163314610f3c5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b610f468282612b0c565b5050565b600033610b8f818585610f5d8383612512565b610f6791906154ca565b6126da565b610f77600033611c83565b158015610f995750610f9760008051602061599c83398151915233611c83565b155b15610fb757604051630782484160e21b815260040160405180910390fd5b601454600f81810b600160801b909204900b13610fe75760405163028a0f7d60e41b815260040160405180910390fd5b6000610ffe3360006003610ff9610e9b565b612b73565b60408051338152602081018390529192507f716d3fbe8d1ce38cbe304bb44018ee355d953a6521951480fc72a3db451b449e9101610da4565b611042600033611c83565b158015611064575061106260008051602061599c83398151915233611c83565b155b1561108257604051630782484160e21b815260040160405180910390fd5b61108a612dc6565b565b6000806110a9601454600f81810b600160801b909204900b131590565b806110d7575060016110ca601454600f81810b600160801b909204900b0390565b6110d4919061549e565b83115b156110e757506000928392509050565b60006110f4601485612e18565b90508080602001905181019061110a91906154dd565b909590945092505050565b6000610aa6601954601854611128610a1b565b611132919061549e565b61113c919061549e565b600090612830565b60008281526005602052604090205482906001600160a01b031633146111bd5760405162461bcd60e51b815260206004820152602860248201527f536f75726365206d75737420626520746865206f7261636c65206f6620746865604482015267081c995c5d595cdd60c21b6064820152608401610f33565b60008181526005602052604080822080546001600160a01b03191690555182917f7cc135e0cebb02c3480ae5d74d377283180a2601f8f644edf7987b009316c63a91a260168290556000838152601360205260408120805460018201546002909201546001600160a01b039091169260ff90911690816003811115611244576112446150f9565b0361125957611254838388612f16565b6112c1565b600181600381111561126d5761126d6150f9565b0361127d5761125483838861301a565b6003816003811115611291576112916150f9565b0361129f57611254866131d2565b60028160038111156112b3576112b36150f9565b036112c1576112c1866132b5565b7f0dbae402c67d2dd40cdfcb29e2d9c50d26ff9f25c459c8813ce8f605a3c4cbdd838787858560038111156112f8576112f86150f9565b604080516001600160a01b039096168652602086019490945292840191909152606083015260ff16608082015260a0015b60405180910390a1505050505050565b6113436000612a7c565b600e8190556040518181527fcb68d10d707acc3ad009c1f42e1a58b552a9a1b4f3879269771bc489c36fcbec90602001610da4565b6113826000612a7c565b601261138e8282615559565b507f30e545e75714460758dab95f15e8090a18055e0aeaa1b3eed2e10673952b251481604051610da4919061504b565b6113c9600033611c83565b1580156113eb57506113e960008051602061599c83398151915233611c83565b155b1561140957604051630782484160e21b815260040160405180910390fd5b601b546001600160a01b031661144157601b54604051634726455360e11b81526001600160a01b039091166004820152602401610f33565b60185481111561145057506018545b8060186000828254611462919061549e565b9091555061149f90507f00000000000000000000000000000000000000000000000000000000000000005b601b546001600160a01b0316836133d9565b601b546040517f10b938c733dd43c2561e4a07c5e13c5c3929e419d6e4c4966b363d6008ef536c91610da49133916001600160a01b0316908590615618565b6114e9600033611c83565b15801561150b575061150960008051602061599c83398151915233611c83565b155b1561152957604051630782484160e21b815260040160405180910390fd5b600061153b3360006002610ff9610e9b565b60408051338152602081018390529192507f6abafed575c53f450b743ea029d5351fb015323195789dfd2055eb597c06cfb79101610da4565b600061157e611115565b601654610aa691906154ca565b6115c06040518060a0016040528060008019168152602001600081526020016060815260200160608152602001606081525090565b6040805160a081018252600e80548252600f5460208301526010805492939192918401916115ed90615413565b80601f016020809104026020016040519081016040528092919081815260200182805461161990615413565b80156116665780601f1061163b57610100808354040283529160200191611666565b820191906000526020600020905b81548152906001019060200180831161164957829003601f168201915b5050505050815260200160038201805461167f90615413565b80601f01602080910402602001604051908101604052809291908181526020018280546116ab90615413565b80156116f85780601f106116cd576101008083540402835291602001916116f8565b820191906000526020600020905b8154815290600101906020018083116116db57829003601f168201915b5050505050815260200160048201805461171190615413565b80601f016020809104026020016040519081016040528092919081815260200182805461173d90615413565b801561178a5780601f1061175f5761010080835404028352916020019161178a565b820191906000526020600020905b81548152906001019060200180831161176d57829003601f168201915b505050505081525050905090565b600081336001600160a01b038216146117cf57604051634726455360e11b81526001600160a01b0382166004820152602401610f33565b6117d761343c565b6117df613495565b601e5460405163de287fd560e01b81526001600160a01b0385811660048301529091169063de287fd59060240160006040518083038186803b15801561182457600080fd5b505afa158015611838573d6000803e3d6000fd5b5050601e54604051636b89e62560e11b81526001600160a01b038781166004830152909116925063d713cc4a915060240160006040518083038186803b15801561188157600080fd5b505afa158015611895573d6000803e3d6000fd5b505050506118a2846134db565b60006118b384866000610ff9610e9b565b90507f77a1ff59578f47b4853e56ac0ffaed0ea40917b6b82bed50224c6b9c69daa8d08486836040516118e89392919061563c565b60405180910390a160009250506118ff6001600b55565b5092915050565b6001600160a01b031660009081526006602052604090205490565b61192b6000612a7c565b60116119378282615559565b507f05b7952983c1d4a37fb936ebe2981f4760165b9c967512d728b2b3b9b4ec5bd281604051610da4919061504b565b606060001960ff8316016119985750506040805180820190915260078152665375636365737360c81b602082015290565b600f1960ff8316016119d1575050604080518082019091526011815270155cd95c881a5cc81b9bdd0812d650d959607a1b602082015290565b60151960ff831601611a04575060408051808201909152600e81526d155cd95c881a5cc818985b9b995960921b60208201525b919050565b611a136000612a7c565b601e80546001600160a01b0319166001600160a01b0383169081179091556040519081527f59db455b2e2f3c6d638cb245a1d3076c51e0052c9ac959fd0d89ed3f8705e1d590602001610da4565b611a6c600033611c83565b158015611a8e5750611a8c60008051602061599c83398151915233611c83565b155b15611aac57604051630782484160e21b815260040160405180910390fd5b61108a61384e565b611abf600033611c83565b158015611ae15750611adf60008051602061599c83398151915233611c83565b155b15611aff57604051630782484160e21b815260040160405180910390fd5b60005b81811015610e96576001601f6000858585818110611b2257611b2261565d565b9050602002016020810190611b379190615182565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580611b6981615673565b915050611b02565b611b7c600033611c83565b158015611b9e5750611b9c60008051602061599c83398151915233611c83565b155b15611bbc57604051630782484160e21b815260040160405180910390fd5b601b546001600160a01b0316611bf457601b54604051634726455360e11b81526001600160a01b039091166004820152602401610f33565b601954811115611c0357506019545b8060196000828254611c15919061549e565b90915550611c4490507f000000000000000000000000000000000000000000000000000000000000000061148d565b601b546040517f52a67bb7145a0d732da184879f46d8f77025061683fbe764fc134c5624345b9c91610da49133916001600160a01b0316908590615618565b6000918252600d602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6060600a8054610af190615413565b611cc8600033611c83565b158015611cea5750611ce860008051602061599c83398151915233611c83565b155b15611d0857604051630782484160e21b815260040160405180910390fd5b601c546001600160a01b0316611d4057601c54604051634726455360e11b81526001600160a01b039091166004820152602401610f33565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316826001600160a01b0316148015611d875750611d84611115565b81115b15611db857611d94611115565b60405163cf47918160e01b8152600481019190915260248101829052604401610f33565b601c54611dd09083906001600160a01b0316836133d9565b601c547f098d73659e8bb3ae59db9b3f19f73a3e0099f2543416a65c0a21f9a0fdade824906001600160a01b03167f000000000000000000000000000000000000000000000000000000000000000083604051611e2f93929190615618565b60405180910390a15050565b611e456000612a7c565b600f8190556040518181527f569d6fd9662d75d2224294ce9e35e9a09e4850c7760c53f5467eb05adb74006d90602001610da4565b60003381611e888286612512565b905083811015611ee85760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610f33565b611ef582868684036126da565b506001949350505050565b600033610b8f8185856128c0565b611f186000612a7c565b6010611f248282615559565b507f44cffdb2fa051b2f134942d8620531cc7ef8bdd9042849ad9ad05c062181518f81604051610da4919061504b565b6000610adc8260016126a3565b600082336001600160a01b03821614611f9857604051634726455360e11b81526001600160a01b0382166004820152602401610f33565b82336001600160a01b03821614611fcd57604051634726455360e11b81526001600160a01b0382166004820152602401610f33565b611fd561343c565b611fdd613495565b601e5460405163de287fd560e01b81526001600160a01b0387811660048301529091169063de287fd59060240160006040518083038186803b15801561202257600080fd5b505afa158015612036573d6000803e3d6000fd5b5050601e54604051636b89e62560e11b81526001600160a01b038981166004830152909116925063d713cc4a915060240160006040518083038186803b15801561207f57600080fd5b505afa158015612093573d6000803e3d6000fd5b505050506120a1858761388b565b60006120b286886001610ff9610e9b565b90507f848aa31aa85e46c439cde57428e3c81b37d38e37dba249faf11b8ed5338582bb8688836040516120e79392919061563c565b60405180910390a160009350506120fe6001600b55565b50509392505050565b6000610adc8260006127fe565b6001600160a01b0382166000818152602080805260408083208584528252808320549383526021825280832085845290915281205490818310156121615761215c838361549e565b61216b565b61216b828461549e565b90509250925092565b6000610adc61218283611906565b60006126a3565b601e546040516397f735d560e01b81526001600160a01b03858116600483015260009216906397f735d590602401602060405180830381865afa1580156121d4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121f8919061568c565b1561220557506016610dce565b601e546040516397f735d560e01b81526001600160a01b038581166004830152909116906397f735d590602401602060405180830381865afa15801561224f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612273919061568c565b1561228057506016610dce565b601e60009054906101000a90046001600160a01b03166001600160a01b031663103257016040518163ffffffff1660e01b8152600401602060405180830381865afa1580156122d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122f7919061568c565b156123f557601e54604051633e295b9d60e01b81526001600160a01b03868116600483015290911690633e295b9d90602401602060405180830381865afa158015612346573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061236a919061568c565b61237657506010610dce565b601e54604051633e295b9d60e01b81526001600160a01b03858116600483015290911690633e295b9d90602401602060405180830381865afa1580156123c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123e4919061568c565b6123f057506010610dce565b610b8f565b601e546040516318b57b0f60e01b81526001600160a01b038681166004830152909116906318b57b0f90602401602060405180830381865afa15801561243f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612463919061568c565b15610b8f57601e54604051633e295b9d60e01b81526001600160a01b03858116600483015290911690633e295b9d90602401602060405180830381865afa1580156124b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124d6919061568c565b610b8f57506010610dce565b6000828152600d60205260409020600101546124fd81612a7c565b610e968383612b0c565b6000610adc82611906565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205490565b6125476000612a7c565b601d80546001600160a01b0319166001600160a01b0383169081179091556040519081527f817009ff135e2bd2b91a4214cb8c403d88a6d5ad7e685f4cd882b68106c3d89290602001610da4565b61259f6000612a7c565b601b80546001600160a01b0319166001600160a01b0383169081179091556040519081527fffb40bfdfd246e95f543d08d9713c339f1d90fa9265e39b4f562f9011d7c919f90602001610da4565b6125f76000612a7c565b601c80546001600160a01b0319166001600160a01b0383169081179091556040519081527fcb7ef3e545f5cdb893f5c568ba710fe08f336375a2d9fd66e161033f8fc09ef390602001610da4565b61264f6000612a7c565b600380546001600160a01b0319166001600160a01b0383161790556040516001600160a01b03821681527f929ac0b1ba25716b6c90e8ba4ffaa8958f77eea8a7b96e4d0bac86578e579ac390602001610da4565b6000806126af60085490565b905080156126d0576126cb6126c2611574565b859083866139bf565b6126d2565b835b949350505050565b6001600160a01b03831661273c5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610f33565b6001600160a01b03821661279d5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610f33565b6001600160a01b0383811660008181526007602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b60008061280a60085490565b9050831580612817575080155b6126d0576126cb81612827611574565b869190866139bf565b600081831161283f5781610dce565b5090919050565b60006128528484612512565b905060001981146128ba57818110156128ad5760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610f33565b6128ba84848484036126da565b50505050565b6001600160a01b0383166129245760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610f33565b6001600160a01b0382166129865760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610f33565b612991838383613a1c565b6001600160a01b03831660009081526006602052604090205481811015612a095760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610f33565b6001600160a01b0380851660008181526006602052604080822086860390559286168082529083902080548601905591517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90612a699086815260200190565b60405180910390a36128ba848484613a9b565b610c488133613af9565b612a908282611c83565b610f46576000828152600d602090815260408083206001600160a01b03851684529091529020805460ff19166001179055612ac83390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b612b168282611c83565b15610f46576000828152600d602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b600e546000908190612b8d90826321abc2af60e11b613b52565b9050612c4c6040518060400160405280600381526020016219d95d60ea1b815250600e6002018054612bbe90615413565b80601f0160208091040260200160405190810160405280929190818152602001828054612bea90615413565b8015612c375780601f10612c0c57610100808354040283529160200191612c37565b820191906000526020600020905b815481529060010190602001808311612c1a57829003601f168201915b505050505083613b6e9092919063ffffffff16565b6002846003811115612c6057612c606150f9565b03612c9a57612c95604051806040016040528060048152602001630e0c2e8d60e31b815250600e6004018054612bbe90615413565b612cca565b612cca604051806040016040528060048152602001630e0c2e8d60e31b815250600e6003018054612bbe90615413565b6000612cd784600a615792565b60408051808201909152600581526474696d657360d81b6020820152909150612d0290839083613b8c565b60006040518060600160405280896001600160a01b03168152602001888152602001876003811115612d3657612d366150f9565b8152509050612d4a83600e60010154613baa565b600081815260136020908152604091829020845181546001600160a01b0319166001600160a01b039091161781559084015160018083019190915591840151600282018054949850859492939192909160ff1990911690836003811115612db357612db36150f9565b0217905550905050505050949350505050565b612dce613bc4565b600c805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b60606000612e3c612e2884613c0d565b8554612e379190600f0b6157a1565b613c7b565b8454909150600160801b9004600f90810b9082900b12612e6f57604051632d0483c560e21b815260040160405180910390fd5b600f81900b600090815260018501602052604090208054612e8f90615413565b80601f0160208091040260200160405190810160405280929190818152602001828054612ebb90615413565b8015612f085780601f10612edd57610100808354040283529160200191612f08565b820191906000526020600020905b815481529060010190602001808311612eeb57829003601f168201915b505050505091505092915050565b6000612f2183610dd5565b90506000612f2f828561549e565b90506000612f3c82612107565b9050612f4a86878484613cdf565b612f827f0000000000000000000000000000000000000000000000000000000000000000601b5488906001600160a01b031686613d71565b6001600160a01b038616600090815260208080526040808320601a54845290915281208054849290612fb59084906154ca565b9091555050601b54604080516001600160a01b03808a168252602082018990529181018490526060810187905260808101869052911660a08201527f88d74b8aca4ba0d64a288a7a53a74991f12b0717812285b1d3b0e896cdb9f2db9060c001611329565b61302383611906565b8211156130575761303383611906565b60405163cf47918160e01b8152600481019190915260248101839052604401610f33565b6000613061611115565b9050600061306e84610b74565b905083818381111561308857508261308581610b99565b91505b801561309b5761309b8788898486613d92565b818611156131295760006130af838861549e565b90506130e18882886040516020016130c99392919061563c565b60408051601f19818403018152919052601490613e52565b6130ec8830836128c0565b7f271908afd9991f9302d824eca7993538398811286a1f4111ba52d41a2409fe6188828860405161311f9392919061563c565b60405180910390a1505b6001600160a01b0387166000908152602160209081526040808320601a5484529091528120805485929061315e9084906154ca565b9091555050604080516001600160a01b038916815260208101859052908101879052606081018690526080810185905260a0810182905260c081018390527f666625871351a9508972baad98106c186e229b03ce88b9a65a44b4bdc182a63b9060e00160405180910390a150505050505050565b601454600f81810b600160801b909204900b1315610c485760006131f66014613e99565b905060008060008380602001905181019061321191906157c9565b925092509250600061322283610b74565b905061322c611115565b81111561323b57505050505050565b6132456014613f78565b506132533085308487613d92565b604080516001600160a01b03861681526020810183905290810184905260608101879052608081018390527f4004fd398ff2afb15961d2fcc831f3a9d475eb3f679fdb7d7c25ef9a81f485a49060a00160405180910390a150505050506131d2565b601a80549060006132c583615673565b9091555050601d5460408051639dc5ba9b60e01b8152815160009384936001600160a01b0390911692639dc5ba9b92600480830193928290030181865afa158015613314573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133389190615800565b9150915061334d613347611115565b8361409c565b6018600082825461335e91906154ca565b9091555050601654613370908261409c565b6019600082825461338191906154ca565b9091555050601854601954601a546040805193845260208401929092528282015260608201859052517ff74ffd8c024cb890289335fc218ef3af1e26f10575b736f4be3e98871812686b9181900360800190a1505050565b6040516001600160a01b038316602482015260448101829052610e9690849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526140c0565b6002600b540361348e5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610f33565b6002600b55565b600c5460ff161561108a5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610f33565b600033601d5460408051631a671d7160e21b8152815193945060009384936001600160a01b03169263699c75c492600480820193918290030181865afa158015613529573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061354d9190615800565b915091506000601d60009054906101000a90046001600160a01b03166001600160a01b03166330b3409e6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156135a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135ca91906153fa565b90506135d584614195565b851115613609576135e584614195565b60405163cf47918160e01b8152600481019190915260248101869052604401610f33565b8285101561362d576040516320ab153360e01b815260048101849052602401610f33565b6001600160a01b0384166000908152601f602052604090205460ff1615801561365557508085105b156136765760405163ed937a4f60e01b815260048101829052602401610f33565b847f0000000000000000000000000000000000000000000000000000000000000000604051636eb1769f60e11b81526001600160a01b038781166004830152306024830152919091169063dd62ed3e90604401602060405180830381865afa1580156136e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061370a91906153fa565b10156137c7577f0000000000000000000000000000000000000000000000000000000000000000604051636eb1769f60e11b81526001600160a01b038681166004830152306024830152919091169063dd62ed3e90604401602060405180830381865afa15801561377f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137a391906153fa565b60405163054365bb60e31b8152600481019190915260248101869052604401610f33565b60008060006137d887601a54612114565b925092509250818310613817576137ef818661549e565b881115613812576040516379bb6d9160e01b815260048101869052602401610f33565b613844565b61382181866154ca565b881115613844576040516379bb6d9160e01b815260048101869052602401610f33565b5050505050505050565b613856613495565b600c805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258612dfb3390565b61389482611906565b8111156138a457611d9482611906565b601d5460408051630384ce6360e61b8152815160009384936001600160a01b039091169263e13398c092600480830193928290030181865afa1580156138ee573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906139129190615800565b91509150600061392184610b74565b9050828110156139475760405163654dcbfb60e01b815260048101849052602401610f33565b600080600061395888601a54612114565b9250925092508183106139925761396f81866154ca565b8411156138125760405163028cfce160e41b815260048101869052602401610f33565b61399c818661549e565b8411156138445760405163028cfce160e41b815260048101869052602401610f33565b6000806139cd868686614224565b905060018360028111156139e3576139e36150f9565b148015613a005750600084806139fb576139fb615474565b868809115b15613a1357613a106001826154ca565b90505b95945050505050565b6001600160a01b0383161580613a3957506001600160a01b038216155b80613a4c57506001600160a01b03821630145b15613a5657505050565b6000613a6484846000612189565b905060ff8116600114613a7682611967565b90613a945760405162461bcd60e51b8152600401610f33919061504b565b5050505050565b6001600160a01b03821615801590613acc57506001600160a01b0382166000908152601f602052604090205460ff16155b15610e96576001600160a01b0382166000908152601f60205260409020805460ff19166001179055505050565b613b038282611c83565b610f4657613b108161430e565b613b1b836020614320565b604051602001613b2c929190615824565b60408051601f198184030181529082905262461bcd60e51b8252610f339160040161504b565b613b5a614f4c565b613b62614f4c565b613a13818686866144bb565b6080830151613b7d90836144f8565b6080830151610e9690826144f8565b6080830151613b9b90836144f8565b6080830151610e96908261450f565b600354600090610dce906001600160a01b0316848461456e565b600c5460ff1661108a5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610f33565b60006001600160ff1b03821115613c775760405162461bcd60e51b815260206004820152602860248201527f53616665436173743a2076616c756520646f65736e27742066697420696e2061604482015267371034b73a191a9b60c11b6064820152608401610f33565b5090565b80600f81900b8114611a045760405162461bcd60e51b815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e20316044820152663238206269747360c81b6064820152608401610f33565b613d0b7f0000000000000000000000000000000000000000000000000000000000000000853085613d71565b613d158382614601565b826001600160a01b0316846001600160a01b03167fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d78484604051613d63929190918252602082015260400190565b60405180910390a350505050565b6128ba846323b872dd60e01b85858560405160240161340593929190615618565b826001600160a01b0316856001600160a01b031614613db657613db6838683612846565b613dc083826146d6565b613deb7f000000000000000000000000000000000000000000000000000000000000000085846133d9565b826001600160a01b0316846001600160a01b0316866001600160a01b03167ffbde797d201c681b91056529119e0b02407c7bb96a4a2c75c01fc9667232c8db8585604051613e43929190918252602082015260400190565b60405180910390a45050505050565b8154600160801b9004600f0b60008181526001840160205260409020613e788382615559565b5082546001600160801b0360019092018216600160801b0291161790915550565b6060613eb48254600f81810b600160801b909204900b131590565b15613ed257604051631ed9509560e11b815260040160405180910390fd5b8154600f0b600081815260018401602052604090208054613ef290615413565b80601f0160208091040260200160405190810160405280929190818152602001828054613f1e90615413565b8015613f6b5780601f10613f4057610100808354040283529160200191613f6b565b820191906000526020600020905b815481529060010190602001808311613f4e57829003601f168201915b5050505050915050919050565b6060613f938254600f81810b600160801b909204900b131590565b15613fb157604051631ed9509560e11b815260040160405180910390fd5b8154600f0b600081815260018401602052604090208054613fd190615413565b80601f0160208091040260200160405190810160405280929190818152602001828054613ffd90615413565b801561404a5780601f1061401f5761010080835404028352916020019161404a565b820191906000526020600020905b81548152906001019060200180831161402d57829003601f168201915b50505050600f83900b60009081526001860160205260408120929450614071929150614f87565b82546fffffffffffffffffffffffffffffffff19166001919091016001600160801b03161790915590565b60006140ac61271061016d61545d565b6140b6838561545d565b610dce919061548a565b6000614115826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661481d9092919063ffffffff16565b9050805160001480614136575080806020019051810190614136919061568c565b610e965760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610f33565b60007f00000000000000000000000000000000000000000000000000000000000000006040516370a0823160e01b81526001600160a01b03848116600483015291909116906370a0823190602401602060405180830381865afa158015614200573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610adc91906153fa565b600080806000198587098587029250828110838203039150508060000361425e5783828161425457614254615474565b0492505050610dce565b8084116142a55760405162461bcd60e51b81526020600482015260156024820152744d6174683a206d756c446976206f766572666c6f7760581b6044820152606401610f33565b60008486880960026001871981018816978890046003810283188082028403028082028403028082028403028082028403028082028403029081029092039091026000889003889004909101858311909403939093029303949094049190911702949350505050565b6060610adc6001600160a01b03831660145b6060600061432f83600261545d565b61433a9060026154ca565b6001600160401b03811115614351576143516151c1565b6040519080825280601f01601f19166020018201604052801561437b576020820181803683370190505b509050600360fc1b816000815181106143965761439661565d565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106143c5576143c561565d565b60200101906001600160f81b031916908160001a90535060006143e984600261545d565b6143f49060016154ca565b90505b600181111561446c576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106144285761442861565d565b1a60f81b82828151811061443e5761443e61565d565b60200101906001600160f81b031916908160001a90535060049490941c9361446581615899565b90506143f7565b508315610dce5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610f33565b6144c3614f4c565b6144d3856080015161010061482c565b50509183526001600160a01b031660208301526001600160e01b031916604082015290565b6145058260038351614891565b610e968282614998565b67ffffffffffffffff1981121561452a57610f4682826149bf565b6001600160401b0381131561454357610f468282614a01565b6000811261455757610f4682600083614891565b610f46826001614569846000196158b0565b614891565b60045460009061457f8160016154ca565b600455835160408086015160808701515191516000936320214ca360e11b936145b79386938493923092918a916001916024016158d0565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915290506145f786838684614a24565b9695505050505050565b6001600160a01b0382166146575760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610f33565b61466360008383613a1c565b806008600082825461467591906154ca565b90915550506001600160a01b0382166000818152600660209081526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3610f4660008383613a9b565b6001600160a01b0382166147365760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401610f33565b61474282600083613a1c565b6001600160a01b038216600090815260066020526040902054818110156147b65760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401610f33565b6001600160a01b03831660008181526006602090815260408083208686039055600880548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3610e9683600084613a9b565b60606126d28484600085614b82565b60408051808201909152606081526000602082015261484c602083615938565b156148745761485c602083615938565b61486790602061549e565b61487190836154ca565b91505b506020828101829052604080518085526000815290920101905290565b6017816001600160401b0316116148b5576128ba8360e0600585901b168317614c5d565b60ff816001600160401b0316116148f1576148db836018611fe0600586901b1617614c5d565b506128ba836001600160401b0383166001614c82565b61ffff816001600160401b03161161492e57614918836019611fe0600586901b1617614c5d565b506128ba836001600160401b0383166002614c82565b63ffffffff816001600160401b03161161496d5761495783601a611fe0600586901b1617614c5d565b506128ba836001600160401b0383166004614c82565b61498283601b611fe0600586901b1617614c5d565b506128ba836001600160401b0383166008614c82565b604080518082019091526060815260006020820152610dce83846000015151848551614ca8565b6149ca8260c3614c5d565b50610f46826149db836000196158b0565b6040516020016149ed91815260200190565b604051602081830303815290604052614d92565b614a0c8260c2614c5d565b50610f4682826040516020016149ed91815260200190565b6040516bffffffffffffffffffffffff193060601b1660208201526034810184905260009060540160408051808303601f1901815282825280516020918201206000818152600590925291812080546001600160a01b0319166001600160a01b038a1617905590925082917fb5e6e01e79f91267dc17b4e6314d5d4d03593d2ceee0fbb452b750bd70ea5af99190a2600254604051630200057560e51b81526001600160a01b0390911690634000aea090614ae79088908790879060040161594c565b6020604051808303816000875af1158015614b06573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614b2a919061568c565b6126d25760405162461bcd60e51b815260206004820152602360248201527f756e61626c6520746f207472616e73666572416e6443616c6c20746f206f7261604482015262636c6560e81b6064820152608401610f33565b606082471015614be35760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610f33565b600080866001600160a01b03168587604051614bff9190615973565b60006040518083038185875af1925050503d8060008114614c3c576040519150601f19603f3d011682016040523d82523d6000602084013e614c41565b606091505b5091509150614c5287838387614d9f565b979650505050505050565b604080518082019091526060815260006020820152610dce8384600001515184614e18565b6040805180820190915260608152600060208201526126d2848560000151518585614e73565b6040805180820190915260608152600060208201528251821115614ccb57600080fd5b6020850151614cda83866154ca565b1115614d0d57614d0d85614cfd87602001518786614cf891906154ca565b614ef4565b614d0890600261545d565b614f0b565b600080865180518760208301019350808887011115614d2c5787860182525b505050602084015b60208410614d6c5780518252614d4b6020836154ca565b9150614d586020826154ca565b9050614d6560208561549e565b9350614d34565b51815160001960208690036101000a019081169019919091161790525083949350505050565b6145058260028351614891565b60608315614e0e578251600003614e07576001600160a01b0385163b614e075760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610f33565b50816126d2565b6126d28383614f22565b60408051808201909152606081526000602082015283602001518310614e4d57614e4d8485602001516002614d08919061545d565b8351805160208583010184815350808503614e69576001810182525b5093949350505050565b6040805180820190915260608152600060208201526020850151614e9785846154ca565b1115614eab57614eab85614cfd86856154ca565b60006001614ebb8461010061598f565b614ec5919061549e565b9050855183868201018583198251161781525080518487011115614ee95783860181525b509495945050505050565b600081831115614f05575081610adc565b50919050565b8151614f17838361482c565b506128ba8382614998565b815115614f325781518083602001fd5b8060405162461bcd60e51b8152600401610f33919061504b565b6040805160a0810182526000808252602080830182905282840182905260608084018390528451808601909552845283015290608082015290565b508054614f9390615413565b6000825580601f10614fa3575050565b601f016020900490600052602060002090810190610c4891905b80821115613c775760008155600101614fbd565b600060208284031215614fe357600080fd5b81356001600160e01b031981168114610dce57600080fd5b60005b83811015615016578181015183820152602001614ffe565b50506000910152565b60008151808452615037816020860160208601614ffb565b601f01601f19169290920160200192915050565b602081526000610dce602083018461501f565b60006020828403121561507057600080fd5b5035919050565b6001600160a01b0381168114610c4857600080fd5b6000806040838503121561509f57600080fd5b82356150aa81615077565b946020939093013593505050565b6000806000606084860312156150cd57600080fd5b83356150d881615077565b925060208401356150e881615077565b929592945050506040919091013590565b634e487b7160e01b600052602160045260246000fd5b6001600160a01b038416815260208101839052606081016004831061514457634e487b7160e01b600052602160045260246000fd5b826040830152949350505050565b6000806040838503121561516557600080fd5b82359150602083013561517781615077565b809150509250929050565b60006020828403121561519457600080fd5b8135610dce81615077565b600080604083850312156151b257600080fd5b50508035926020909101359150565b634e487b7160e01b600052604160045260246000fd5b6000602082840312156151e957600080fd5b81356001600160401b038082111561520057600080fd5b818401915084601f83011261521457600080fd5b813581811115615226576152266151c1565b604051601f8201601f19908116603f0116810190838211818310171561524e5761524e6151c1565b8160405282815287602084870101111561526757600080fd5b826020860160208301376000928101602001929092525095945050505050565b6020815281516020820152602082015160408201526000604083015160a060608401526152b760c084018261501f565b90506060840151601f19808584030160808601526152d5838361501f565b925060808601519150808584030160a086015250613a13828261501f565b60006020828403121561530557600080fd5b813560ff81168114610dce57600080fd5b6000806020838503121561532957600080fd5b82356001600160401b038082111561534057600080fd5b818501915085601f83011261535457600080fd5b81358181111561536357600080fd5b8660208260051b850101111561537857600080fd5b60209290920196919550909350505050565b60008060006060848603121561539f57600080fd5b8335925060208401356153b181615077565b915060408401356153c181615077565b809150509250925092565b600080604083850312156153df57600080fd5b82356153ea81615077565b9150602083013561517781615077565b60006020828403121561540c57600080fd5b5051919050565b600181811c9082168061542757607f821691505b602082108103614f0557634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b8082028115828204841417610adc57610adc615447565b634e487b7160e01b600052601260045260246000fd5b60008261549957615499615474565b500490565b81810381811115610adc57610adc615447565b60ff8181168382160190811115610adc57610adc615447565b80820180821115610adc57610adc615447565b600080604083850312156154f057600080fd5b82516154fb81615077565b6020939093015192949293505050565b601f821115610e9657600081815260208120601f850160051c810160208610156155325750805b601f850160051c820191505b818110156155515782815560010161553e565b505050505050565b81516001600160401b03811115615572576155726151c1565b615586816155808454615413565b8461550b565b602080601f8311600181146155bb57600084156155a35750858301515b600019600386901b1c1916600185901b178555615551565b600085815260208120601f198616915b828110156155ea578886015182559484019460019091019084016155cb565b50858210156156085787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b039390931683526020830191909152604082015260600190565b634e487b7160e01b600052603260045260246000fd5b60006001820161568557615685615447565b5060010190565b60006020828403121561569e57600080fd5b81518015158114610dce57600080fd5b600181815b808511156156e95781600019048211156156cf576156cf615447565b808516156156dc57918102915b93841c93908002906156b3565b509250929050565b60008261570057506001610adc565b8161570d57506000610adc565b8160018114615723576002811461572d57615749565b6001915050610adc565b60ff84111561573e5761573e615447565b50506001821b610adc565b5060208310610133831016604e8410600b841016171561576c575081810a610adc565b61577683836156ae565b806000190482111561578a5761578a615447565b029392505050565b6000610dce60ff8416836156f1565b80820182811260008312801582168215821617156157c1576157c1615447565b505092915050565b6000806000606084860312156157de57600080fd5b83516157e981615077565b602085015160409095015190969495509392505050565b6000806040838503121561581357600080fd5b505080516020909101519092909150565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081526000835161585c816017850160208801614ffb565b7001034b99036b4b9b9b4b733903937b6329607d1b601791840191820152835161588d816028840160208801614ffb565b01602801949350505050565b6000816158a8576158a8615447565b506000190190565b81810360008312801583831316838312821617156118ff576118ff615447565b6001600160a01b0389811682526020820189905260408201889052861660608201526001600160e01b03198516608082015260a0810184905260c0810183905261010060e082018190526000906159298382018561501f565b9b9a5050505050505050505050565b60008261594757615947615474565b500690565b60018060a01b0384168152826020820152606060408201526000613a13606083018461501f565b60008251615985818460208701614ffb565b9190910192915050565b6000610dce83836156f156fe97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b929a26469706673582212205e12fb361d6f198acc0b93ec24c7d83f709ce40dcffa12eaf0724e614df8584364736f6c63430008130033000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000db3662449ce9c594825a40e863edd0429297d81b0000000000000000000000009b00168b7ddc6284a160f7bcf5bc13ba7a93195c000000000000000000000000f2b6e84922998dd7d32c47313ece1730cf43b6ae000000000000000000000000dafec86d96f8a97f34186f9988ead7991cbc2dd4000000000000000000000000908f368431b2a9d2d26e2d9984b8c81e37e4faec000000000000000000000000514910771af9ca656af840dff83e8264ecf986ca0000000000000000000000003e64cd889482443324f91bfa9c84fe72a511f48a0000000000000000000000000000000000000000000000000000000000000120ca98366cc7314957b8c012c72f05aeeb00000000000000000000000000000000000000000000000000000000000000000000000000000000016345785d8a000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000002568747470733a2f2f636f6769746f2e66696e616e63652f6170692f6e61762f6c617465737400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
Deployed Bytecode
0x608060405234801561001057600080fd5b506004361061046a5760003560e01c80637fb9a8e11161024c578063c63d75b611610146578063dd62ed3e116100c3578063ef8b30f711610087578063ef8b30f7146108ac578063efdcd974146109cd578063f0f44260146109e0578063f5b541a6146109f3578063fdabd16a14610a0857600080fd5b8063dd62ed3e14610978578063def9ba771461098b578063dfb7bc2d14610994578063e2a7ece0146109a7578063e319a3d9146109ba57600080fd5b8063d44396591161010a578063d443965914610913578063d4ce141514610936578063d547741f14610949578063d673f4c31461095c578063d905777e1461096557600080fd5b8063c63d75b61461069d578063c6e6f592146108ac578063c7a1dcf3146108bf578063ccdcbf38146108d2578063ce96cb771461090057600080fd5b8063a217fddf116101d4578063a9059cbb11610198578063a9059cbb14610852578063b268457714610865578063b3d7f6b914610878578063b460af941461088b578063ba0876521461089957600080fd5b8063a217fddf14610812578063a284673f1461081a578063a28c216f1461082d578063a457c2d714610836578063a8f040fb1461084957600080fd5b806390426a3d1161021b57806390426a3d146107c357806391d14854146107d657806394bf804d146107e957806395d89b41146107f75780639dd267e6146107ff57600080fd5b80637fb9a8e1146107825780638456cb59146107955780638748e7fb1461079d5780638758b1b5146107b057600080fd5b806338d52e0f116103685780635864c492116102e557806368f7d289116102a957806368f7d289146107215780636e553f651461073657806370a082311461074957806370a3ef651461075c5780637f4ab1dd1461076f57600080fd5b80635864c492146106e057806359e764d6146106f357806359f406c4146107065780635c975abb1461070e5780635db896cf1461071957600080fd5b8063402d267d1161032c578063402d267d1461069d57806341799da3146106b25780634357855e146106ba5780634cdad506146104c25780634e266918146106cd57600080fd5b806338d52e0f1461060e57806339509351146106485780633c5ac5e21461065b5780633f4ba83a146106635780633f920b4b1461066b57600080fd5b80631b71c637116103f65780632a4b8c57116103ba5780632a4b8c57146105b25780632f2ff15d146105c55780633064d18a146105d8578063313ce567146105e157806336568abe146105fb57600080fd5b80631b71c6371461051557806320160b071461051d57806323b872dd14610530578063248a9ca3146105435780632a00a4721461056657600080fd5b8063095ea7b31161043d578063095ea7b3146104d55780630a28a477146104e85780630aed44c6146104fb5780630c3513a81461050557806318160ddd1461050d57600080fd5b806301e1d1141461046f57806301ffc9a71461048a57806306fdde03146104ad57806307a2d13a146104c2575b600080fd5b610477610a1b565b6040519081526020015b60405180910390f35b61049d610498366004614fd1565b610aab565b6040519015158152602001610481565b6104b5610ae2565b604051610481919061504b565b6104776104d036600461505e565b610b74565b61049d6104e336600461508c565b610b81565b6104776104f636600461505e565b610b99565b610503610ba6565b005b610477610c4b565b600854610477565b610477610d0d565b61050361052b36600461505e565b610d28565b61049d61053e3660046150b8565b610daf565b61047761055136600461505e565b6000908152600d602052604090206001015490565b6105a361057436600461505e565b6000908152601360205260409020805460018201546002909201546001600160a01b039091169260ff90911690565b6040516104819392919061510f565b6104776105c036600461505e565b610dd5565b6105036105d3366004615152565b610e71565b61047760195481565b6105e9610e9b565b60405160ff9091168152602001610481565b610503610609366004615152565b610ec7565b7f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb485b6040516001600160a01b039091168152602001610481565b61049d61065636600461508c565b610f4a565b610503610f6c565b610503611037565b61067e61067936600461505e565b61108c565b604080516001600160a01b039093168352602083019190915201610481565b6104776106ab366004615182565b5060001990565b610477611115565b6105036106c836600461519f565b611144565b6105036106db36600461505e565b611339565b6105036106ee3660046151d7565b611378565b61050361070136600461505e565b6113be565b6105036114de565b600c5460ff1661049d565b610477611574565b61072961158b565b6040516104819190615287565b610477610744366004615152565b611798565b610477610757366004615182565b611906565b61050361076a3660046151d7565b611921565b6104b561077d3660046152f3565b611967565b610503610790366004615182565b611a09565b610503611a61565b6105036107ab366004615316565b611ab4565b601b54610630906001600160a01b031681565b6105036107d136600461505e565b611b71565b61049d6107e4366004615152565b611c83565b61047761046a366004615152565b6104b5611cae565b61050361080d36600461508c565b611cbd565b610477600081565b61050361082836600461505e565b611e3b565b61047760165481565b61049d61084436600461508c565b611e7a565b61047760175481565b61049d61086036600461508c565b611f00565b6105036108733660046151d7565b611f0e565b61047761088636600461505e565b611f54565b61047761046a36600461538a565b6104776108a736600461538a565b611f61565b6104776108ba36600461505e565b612107565b601e54610630906001600160a01b031681565b6108e56108e036600461508c565b612114565b60408051938452602084019290925290820152606001610481565b61047761090e366004615182565b612174565b61049d610921366004615182565b601f6020526000908152604090205460ff1681565b6105e96109443660046150b8565b612189565b610503610957366004615152565b6124e2565b610477601a5481565b610477610973366004615182565b612507565b6104776109863660046153cc565b612512565b61047760185481565b6105036109a2366004615182565b61253d565b601d54610630906001600160a01b031681565b601c54610630906001600160a01b031681565b6105036109db366004615182565b612595565b6105036109ee366004615182565b6125ed565b61047760008051602061599c83398151915281565b610503610a16366004615182565b612645565b6040516370a0823160e01b81523060048201526000907f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb486001600160a01b0316906370a0823190602401602060405180830381865afa158015610a82573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aa691906153fa565b905090565b60006001600160e01b03198216637965db0b60e01b1480610adc57506301ffc9a760e01b6001600160e01b03198316145b92915050565b606060098054610af190615413565b80601f0160208091040260200160405190810160405280929190818152602001828054610b1d90615413565b8015610b6a5780601f10610b3f57610100808354040283529160200191610b6a565b820191906000526020600020905b815481529060010190602001808311610b4d57829003601f168201915b5050505050905090565b6000610adc8260006126a3565b600033610b8f8185856126da565b5060019392505050565b6000610adc8260016127fe565b610bb1600033611c83565b158015610bd35750610bd160008051602061599c83398151915233611c83565b155b15610bf157604051630782484160e21b815260040160405180910390fd5b6000610bfb610c4b565b905080600003610c1e576040516324c2eb3760e11b815260040160405180910390fd5b610c487f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4882611cbd565b50565b6000806064610c58611574565b601d60009054906101000a90046001600160a01b03166001600160a01b0316637e1edddb6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610cab573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ccf91906153fa565b610cd9919061545d565b610ce3919061548a565b90506000610cef611115565b9050610d066000610d00848461549e565b90612830565b9250505090565b6000610aa6601454600f81810b600160801b909204900b0390565b610d33600033611c83565b158015610d555750610d5360008051602061599c83398151915233611c83565b155b15610d7357604051630782484160e21b815260040160405180910390fd5b60178190556040518181527f963c15c9f2c7f80167f8c1daa955ba3b84bd1cc728123df3c456dfe8eeeb2eaa906020015b60405180910390a150565b600033610dbd858285612846565b610dc88585856128c0565b60019150505b9392505050565b6000610adc612710601d60009054906101000a90046001600160a01b03166001600160a01b03166385d791026040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e30573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e5491906153fa565b610e5e908561545d565b610e68919061548a565b60175490612830565b6000828152600d6020526040902060010154610e8c81612a7c565b610e968383612a86565b505050565b6000610aa6817f00000000000000000000000000000000000000000000000000000000000000066154b1565b6001600160a01b0381163314610f3c5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b610f468282612b0c565b5050565b600033610b8f818585610f5d8383612512565b610f6791906154ca565b6126da565b610f77600033611c83565b158015610f995750610f9760008051602061599c83398151915233611c83565b155b15610fb757604051630782484160e21b815260040160405180910390fd5b601454600f81810b600160801b909204900b13610fe75760405163028a0f7d60e41b815260040160405180910390fd5b6000610ffe3360006003610ff9610e9b565b612b73565b60408051338152602081018390529192507f716d3fbe8d1ce38cbe304bb44018ee355d953a6521951480fc72a3db451b449e9101610da4565b611042600033611c83565b158015611064575061106260008051602061599c83398151915233611c83565b155b1561108257604051630782484160e21b815260040160405180910390fd5b61108a612dc6565b565b6000806110a9601454600f81810b600160801b909204900b131590565b806110d7575060016110ca601454600f81810b600160801b909204900b0390565b6110d4919061549e565b83115b156110e757506000928392509050565b60006110f4601485612e18565b90508080602001905181019061110a91906154dd565b909590945092505050565b6000610aa6601954601854611128610a1b565b611132919061549e565b61113c919061549e565b600090612830565b60008281526005602052604090205482906001600160a01b031633146111bd5760405162461bcd60e51b815260206004820152602860248201527f536f75726365206d75737420626520746865206f7261636c65206f6620746865604482015267081c995c5d595cdd60c21b6064820152608401610f33565b60008181526005602052604080822080546001600160a01b03191690555182917f7cc135e0cebb02c3480ae5d74d377283180a2601f8f644edf7987b009316c63a91a260168290556000838152601360205260408120805460018201546002909201546001600160a01b039091169260ff90911690816003811115611244576112446150f9565b0361125957611254838388612f16565b6112c1565b600181600381111561126d5761126d6150f9565b0361127d5761125483838861301a565b6003816003811115611291576112916150f9565b0361129f57611254866131d2565b60028160038111156112b3576112b36150f9565b036112c1576112c1866132b5565b7f0dbae402c67d2dd40cdfcb29e2d9c50d26ff9f25c459c8813ce8f605a3c4cbdd838787858560038111156112f8576112f86150f9565b604080516001600160a01b039096168652602086019490945292840191909152606083015260ff16608082015260a0015b60405180910390a1505050505050565b6113436000612a7c565b600e8190556040518181527fcb68d10d707acc3ad009c1f42e1a58b552a9a1b4f3879269771bc489c36fcbec90602001610da4565b6113826000612a7c565b601261138e8282615559565b507f30e545e75714460758dab95f15e8090a18055e0aeaa1b3eed2e10673952b251481604051610da4919061504b565b6113c9600033611c83565b1580156113eb57506113e960008051602061599c83398151915233611c83565b155b1561140957604051630782484160e21b815260040160405180910390fd5b601b546001600160a01b031661144157601b54604051634726455360e11b81526001600160a01b039091166004820152602401610f33565b60185481111561145057506018545b8060186000828254611462919061549e565b9091555061149f90507f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb485b601b546001600160a01b0316836133d9565b601b546040517f10b938c733dd43c2561e4a07c5e13c5c3929e419d6e4c4966b363d6008ef536c91610da49133916001600160a01b0316908590615618565b6114e9600033611c83565b15801561150b575061150960008051602061599c83398151915233611c83565b155b1561152957604051630782484160e21b815260040160405180910390fd5b600061153b3360006002610ff9610e9b565b60408051338152602081018390529192507f6abafed575c53f450b743ea029d5351fb015323195789dfd2055eb597c06cfb79101610da4565b600061157e611115565b601654610aa691906154ca565b6115c06040518060a0016040528060008019168152602001600081526020016060815260200160608152602001606081525090565b6040805160a081018252600e80548252600f5460208301526010805492939192918401916115ed90615413565b80601f016020809104026020016040519081016040528092919081815260200182805461161990615413565b80156116665780601f1061163b57610100808354040283529160200191611666565b820191906000526020600020905b81548152906001019060200180831161164957829003601f168201915b5050505050815260200160038201805461167f90615413565b80601f01602080910402602001604051908101604052809291908181526020018280546116ab90615413565b80156116f85780601f106116cd576101008083540402835291602001916116f8565b820191906000526020600020905b8154815290600101906020018083116116db57829003601f168201915b5050505050815260200160048201805461171190615413565b80601f016020809104026020016040519081016040528092919081815260200182805461173d90615413565b801561178a5780601f1061175f5761010080835404028352916020019161178a565b820191906000526020600020905b81548152906001019060200180831161176d57829003601f168201915b505050505081525050905090565b600081336001600160a01b038216146117cf57604051634726455360e11b81526001600160a01b0382166004820152602401610f33565b6117d761343c565b6117df613495565b601e5460405163de287fd560e01b81526001600160a01b0385811660048301529091169063de287fd59060240160006040518083038186803b15801561182457600080fd5b505afa158015611838573d6000803e3d6000fd5b5050601e54604051636b89e62560e11b81526001600160a01b038781166004830152909116925063d713cc4a915060240160006040518083038186803b15801561188157600080fd5b505afa158015611895573d6000803e3d6000fd5b505050506118a2846134db565b60006118b384866000610ff9610e9b565b90507f77a1ff59578f47b4853e56ac0ffaed0ea40917b6b82bed50224c6b9c69daa8d08486836040516118e89392919061563c565b60405180910390a160009250506118ff6001600b55565b5092915050565b6001600160a01b031660009081526006602052604090205490565b61192b6000612a7c565b60116119378282615559565b507f05b7952983c1d4a37fb936ebe2981f4760165b9c967512d728b2b3b9b4ec5bd281604051610da4919061504b565b606060001960ff8316016119985750506040805180820190915260078152665375636365737360c81b602082015290565b600f1960ff8316016119d1575050604080518082019091526011815270155cd95c881a5cc81b9bdd0812d650d959607a1b602082015290565b60151960ff831601611a04575060408051808201909152600e81526d155cd95c881a5cc818985b9b995960921b60208201525b919050565b611a136000612a7c565b601e80546001600160a01b0319166001600160a01b0383169081179091556040519081527f59db455b2e2f3c6d638cb245a1d3076c51e0052c9ac959fd0d89ed3f8705e1d590602001610da4565b611a6c600033611c83565b158015611a8e5750611a8c60008051602061599c83398151915233611c83565b155b15611aac57604051630782484160e21b815260040160405180910390fd5b61108a61384e565b611abf600033611c83565b158015611ae15750611adf60008051602061599c83398151915233611c83565b155b15611aff57604051630782484160e21b815260040160405180910390fd5b60005b81811015610e96576001601f6000858585818110611b2257611b2261565d565b9050602002016020810190611b379190615182565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580611b6981615673565b915050611b02565b611b7c600033611c83565b158015611b9e5750611b9c60008051602061599c83398151915233611c83565b155b15611bbc57604051630782484160e21b815260040160405180910390fd5b601b546001600160a01b0316611bf457601b54604051634726455360e11b81526001600160a01b039091166004820152602401610f33565b601954811115611c0357506019545b8060196000828254611c15919061549e565b90915550611c4490507f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4861148d565b601b546040517f52a67bb7145a0d732da184879f46d8f77025061683fbe764fc134c5624345b9c91610da49133916001600160a01b0316908590615618565b6000918252600d602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6060600a8054610af190615413565b611cc8600033611c83565b158015611cea5750611ce860008051602061599c83398151915233611c83565b155b15611d0857604051630782484160e21b815260040160405180910390fd5b601c546001600160a01b0316611d4057601c54604051634726455360e11b81526001600160a01b039091166004820152602401610f33565b7f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb486001600160a01b0316826001600160a01b0316148015611d875750611d84611115565b81115b15611db857611d94611115565b60405163cf47918160e01b8152600481019190915260248101829052604401610f33565b601c54611dd09083906001600160a01b0316836133d9565b601c547f098d73659e8bb3ae59db9b3f19f73a3e0099f2543416a65c0a21f9a0fdade824906001600160a01b03167f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4883604051611e2f93929190615618565b60405180910390a15050565b611e456000612a7c565b600f8190556040518181527f569d6fd9662d75d2224294ce9e35e9a09e4850c7760c53f5467eb05adb74006d90602001610da4565b60003381611e888286612512565b905083811015611ee85760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610f33565b611ef582868684036126da565b506001949350505050565b600033610b8f8185856128c0565b611f186000612a7c565b6010611f248282615559565b507f44cffdb2fa051b2f134942d8620531cc7ef8bdd9042849ad9ad05c062181518f81604051610da4919061504b565b6000610adc8260016126a3565b600082336001600160a01b03821614611f9857604051634726455360e11b81526001600160a01b0382166004820152602401610f33565b82336001600160a01b03821614611fcd57604051634726455360e11b81526001600160a01b0382166004820152602401610f33565b611fd561343c565b611fdd613495565b601e5460405163de287fd560e01b81526001600160a01b0387811660048301529091169063de287fd59060240160006040518083038186803b15801561202257600080fd5b505afa158015612036573d6000803e3d6000fd5b5050601e54604051636b89e62560e11b81526001600160a01b038981166004830152909116925063d713cc4a915060240160006040518083038186803b15801561207f57600080fd5b505afa158015612093573d6000803e3d6000fd5b505050506120a1858761388b565b60006120b286886001610ff9610e9b565b90507f848aa31aa85e46c439cde57428e3c81b37d38e37dba249faf11b8ed5338582bb8688836040516120e79392919061563c565b60405180910390a160009350506120fe6001600b55565b50509392505050565b6000610adc8260006127fe565b6001600160a01b0382166000818152602080805260408083208584528252808320549383526021825280832085845290915281205490818310156121615761215c838361549e565b61216b565b61216b828461549e565b90509250925092565b6000610adc61218283611906565b60006126a3565b601e546040516397f735d560e01b81526001600160a01b03858116600483015260009216906397f735d590602401602060405180830381865afa1580156121d4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121f8919061568c565b1561220557506016610dce565b601e546040516397f735d560e01b81526001600160a01b038581166004830152909116906397f735d590602401602060405180830381865afa15801561224f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612273919061568c565b1561228057506016610dce565b601e60009054906101000a90046001600160a01b03166001600160a01b031663103257016040518163ffffffff1660e01b8152600401602060405180830381865afa1580156122d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122f7919061568c565b156123f557601e54604051633e295b9d60e01b81526001600160a01b03868116600483015290911690633e295b9d90602401602060405180830381865afa158015612346573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061236a919061568c565b61237657506010610dce565b601e54604051633e295b9d60e01b81526001600160a01b03858116600483015290911690633e295b9d90602401602060405180830381865afa1580156123c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123e4919061568c565b6123f057506010610dce565b610b8f565b601e546040516318b57b0f60e01b81526001600160a01b038681166004830152909116906318b57b0f90602401602060405180830381865afa15801561243f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612463919061568c565b15610b8f57601e54604051633e295b9d60e01b81526001600160a01b03858116600483015290911690633e295b9d90602401602060405180830381865afa1580156124b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124d6919061568c565b610b8f57506010610dce565b6000828152600d60205260409020600101546124fd81612a7c565b610e968383612b0c565b6000610adc82611906565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205490565b6125476000612a7c565b601d80546001600160a01b0319166001600160a01b0383169081179091556040519081527f817009ff135e2bd2b91a4214cb8c403d88a6d5ad7e685f4cd882b68106c3d89290602001610da4565b61259f6000612a7c565b601b80546001600160a01b0319166001600160a01b0383169081179091556040519081527fffb40bfdfd246e95f543d08d9713c339f1d90fa9265e39b4f562f9011d7c919f90602001610da4565b6125f76000612a7c565b601c80546001600160a01b0319166001600160a01b0383169081179091556040519081527fcb7ef3e545f5cdb893f5c568ba710fe08f336375a2d9fd66e161033f8fc09ef390602001610da4565b61264f6000612a7c565b600380546001600160a01b0319166001600160a01b0383161790556040516001600160a01b03821681527f929ac0b1ba25716b6c90e8ba4ffaa8958f77eea8a7b96e4d0bac86578e579ac390602001610da4565b6000806126af60085490565b905080156126d0576126cb6126c2611574565b859083866139bf565b6126d2565b835b949350505050565b6001600160a01b03831661273c5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610f33565b6001600160a01b03821661279d5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610f33565b6001600160a01b0383811660008181526007602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b60008061280a60085490565b9050831580612817575080155b6126d0576126cb81612827611574565b869190866139bf565b600081831161283f5781610dce565b5090919050565b60006128528484612512565b905060001981146128ba57818110156128ad5760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610f33565b6128ba84848484036126da565b50505050565b6001600160a01b0383166129245760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610f33565b6001600160a01b0382166129865760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610f33565b612991838383613a1c565b6001600160a01b03831660009081526006602052604090205481811015612a095760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610f33565b6001600160a01b0380851660008181526006602052604080822086860390559286168082529083902080548601905591517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90612a699086815260200190565b60405180910390a36128ba848484613a9b565b610c488133613af9565b612a908282611c83565b610f46576000828152600d602090815260408083206001600160a01b03851684529091529020805460ff19166001179055612ac83390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b612b168282611c83565b15610f46576000828152600d602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b600e546000908190612b8d90826321abc2af60e11b613b52565b9050612c4c6040518060400160405280600381526020016219d95d60ea1b815250600e6002018054612bbe90615413565b80601f0160208091040260200160405190810160405280929190818152602001828054612bea90615413565b8015612c375780601f10612c0c57610100808354040283529160200191612c37565b820191906000526020600020905b815481529060010190602001808311612c1a57829003601f168201915b505050505083613b6e9092919063ffffffff16565b6002846003811115612c6057612c606150f9565b03612c9a57612c95604051806040016040528060048152602001630e0c2e8d60e31b815250600e6004018054612bbe90615413565b612cca565b612cca604051806040016040528060048152602001630e0c2e8d60e31b815250600e6003018054612bbe90615413565b6000612cd784600a615792565b60408051808201909152600581526474696d657360d81b6020820152909150612d0290839083613b8c565b60006040518060600160405280896001600160a01b03168152602001888152602001876003811115612d3657612d366150f9565b8152509050612d4a83600e60010154613baa565b600081815260136020908152604091829020845181546001600160a01b0319166001600160a01b039091161781559084015160018083019190915591840151600282018054949850859492939192909160ff1990911690836003811115612db357612db36150f9565b0217905550905050505050949350505050565b612dce613bc4565b600c805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b60606000612e3c612e2884613c0d565b8554612e379190600f0b6157a1565b613c7b565b8454909150600160801b9004600f90810b9082900b12612e6f57604051632d0483c560e21b815260040160405180910390fd5b600f81900b600090815260018501602052604090208054612e8f90615413565b80601f0160208091040260200160405190810160405280929190818152602001828054612ebb90615413565b8015612f085780601f10612edd57610100808354040283529160200191612f08565b820191906000526020600020905b815481529060010190602001808311612eeb57829003601f168201915b505050505091505092915050565b6000612f2183610dd5565b90506000612f2f828561549e565b90506000612f3c82612107565b9050612f4a86878484613cdf565b612f827f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48601b5488906001600160a01b031686613d71565b6001600160a01b038616600090815260208080526040808320601a54845290915281208054849290612fb59084906154ca565b9091555050601b54604080516001600160a01b03808a168252602082018990529181018490526060810187905260808101869052911660a08201527f88d74b8aca4ba0d64a288a7a53a74991f12b0717812285b1d3b0e896cdb9f2db9060c001611329565b61302383611906565b8211156130575761303383611906565b60405163cf47918160e01b8152600481019190915260248101839052604401610f33565b6000613061611115565b9050600061306e84610b74565b905083818381111561308857508261308581610b99565b91505b801561309b5761309b8788898486613d92565b818611156131295760006130af838861549e565b90506130e18882886040516020016130c99392919061563c565b60408051601f19818403018152919052601490613e52565b6130ec8830836128c0565b7f271908afd9991f9302d824eca7993538398811286a1f4111ba52d41a2409fe6188828860405161311f9392919061563c565b60405180910390a1505b6001600160a01b0387166000908152602160209081526040808320601a5484529091528120805485929061315e9084906154ca565b9091555050604080516001600160a01b038916815260208101859052908101879052606081018690526080810185905260a0810182905260c081018390527f666625871351a9508972baad98106c186e229b03ce88b9a65a44b4bdc182a63b9060e00160405180910390a150505050505050565b601454600f81810b600160801b909204900b1315610c485760006131f66014613e99565b905060008060008380602001905181019061321191906157c9565b925092509250600061322283610b74565b905061322c611115565b81111561323b57505050505050565b6132456014613f78565b506132533085308487613d92565b604080516001600160a01b03861681526020810183905290810184905260608101879052608081018390527f4004fd398ff2afb15961d2fcc831f3a9d475eb3f679fdb7d7c25ef9a81f485a49060a00160405180910390a150505050506131d2565b601a80549060006132c583615673565b9091555050601d5460408051639dc5ba9b60e01b8152815160009384936001600160a01b0390911692639dc5ba9b92600480830193928290030181865afa158015613314573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133389190615800565b9150915061334d613347611115565b8361409c565b6018600082825461335e91906154ca565b9091555050601654613370908261409c565b6019600082825461338191906154ca565b9091555050601854601954601a546040805193845260208401929092528282015260608201859052517ff74ffd8c024cb890289335fc218ef3af1e26f10575b736f4be3e98871812686b9181900360800190a1505050565b6040516001600160a01b038316602482015260448101829052610e9690849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526140c0565b6002600b540361348e5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610f33565b6002600b55565b600c5460ff161561108a5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610f33565b600033601d5460408051631a671d7160e21b8152815193945060009384936001600160a01b03169263699c75c492600480820193918290030181865afa158015613529573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061354d9190615800565b915091506000601d60009054906101000a90046001600160a01b03166001600160a01b03166330b3409e6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156135a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135ca91906153fa565b90506135d584614195565b851115613609576135e584614195565b60405163cf47918160e01b8152600481019190915260248101869052604401610f33565b8285101561362d576040516320ab153360e01b815260048101849052602401610f33565b6001600160a01b0384166000908152601f602052604090205460ff1615801561365557508085105b156136765760405163ed937a4f60e01b815260048101829052602401610f33565b847f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48604051636eb1769f60e11b81526001600160a01b038781166004830152306024830152919091169063dd62ed3e90604401602060405180830381865afa1580156136e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061370a91906153fa565b10156137c7577f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48604051636eb1769f60e11b81526001600160a01b038681166004830152306024830152919091169063dd62ed3e90604401602060405180830381865afa15801561377f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137a391906153fa565b60405163054365bb60e31b8152600481019190915260248101869052604401610f33565b60008060006137d887601a54612114565b925092509250818310613817576137ef818661549e565b881115613812576040516379bb6d9160e01b815260048101869052602401610f33565b613844565b61382181866154ca565b881115613844576040516379bb6d9160e01b815260048101869052602401610f33565b5050505050505050565b613856613495565b600c805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258612dfb3390565b61389482611906565b8111156138a457611d9482611906565b601d5460408051630384ce6360e61b8152815160009384936001600160a01b039091169263e13398c092600480830193928290030181865afa1580156138ee573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906139129190615800565b91509150600061392184610b74565b9050828110156139475760405163654dcbfb60e01b815260048101849052602401610f33565b600080600061395888601a54612114565b9250925092508183106139925761396f81866154ca565b8411156138125760405163028cfce160e41b815260048101869052602401610f33565b61399c818661549e565b8411156138445760405163028cfce160e41b815260048101869052602401610f33565b6000806139cd868686614224565b905060018360028111156139e3576139e36150f9565b148015613a005750600084806139fb576139fb615474565b868809115b15613a1357613a106001826154ca565b90505b95945050505050565b6001600160a01b0383161580613a3957506001600160a01b038216155b80613a4c57506001600160a01b03821630145b15613a5657505050565b6000613a6484846000612189565b905060ff8116600114613a7682611967565b90613a945760405162461bcd60e51b8152600401610f33919061504b565b5050505050565b6001600160a01b03821615801590613acc57506001600160a01b0382166000908152601f602052604090205460ff16155b15610e96576001600160a01b0382166000908152601f60205260409020805460ff19166001179055505050565b613b038282611c83565b610f4657613b108161430e565b613b1b836020614320565b604051602001613b2c929190615824565b60408051601f198184030181529082905262461bcd60e51b8252610f339160040161504b565b613b5a614f4c565b613b62614f4c565b613a13818686866144bb565b6080830151613b7d90836144f8565b6080830151610e9690826144f8565b6080830151613b9b90836144f8565b6080830151610e96908261450f565b600354600090610dce906001600160a01b0316848461456e565b600c5460ff1661108a5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610f33565b60006001600160ff1b03821115613c775760405162461bcd60e51b815260206004820152602860248201527f53616665436173743a2076616c756520646f65736e27742066697420696e2061604482015267371034b73a191a9b60c11b6064820152608401610f33565b5090565b80600f81900b8114611a045760405162461bcd60e51b815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e20316044820152663238206269747360c81b6064820152608401610f33565b613d0b7f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48853085613d71565b613d158382614601565b826001600160a01b0316846001600160a01b03167fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d78484604051613d63929190918252602082015260400190565b60405180910390a350505050565b6128ba846323b872dd60e01b85858560405160240161340593929190615618565b826001600160a01b0316856001600160a01b031614613db657613db6838683612846565b613dc083826146d6565b613deb7f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4885846133d9565b826001600160a01b0316846001600160a01b0316866001600160a01b03167ffbde797d201c681b91056529119e0b02407c7bb96a4a2c75c01fc9667232c8db8585604051613e43929190918252602082015260400190565b60405180910390a45050505050565b8154600160801b9004600f0b60008181526001840160205260409020613e788382615559565b5082546001600160801b0360019092018216600160801b0291161790915550565b6060613eb48254600f81810b600160801b909204900b131590565b15613ed257604051631ed9509560e11b815260040160405180910390fd5b8154600f0b600081815260018401602052604090208054613ef290615413565b80601f0160208091040260200160405190810160405280929190818152602001828054613f1e90615413565b8015613f6b5780601f10613f4057610100808354040283529160200191613f6b565b820191906000526020600020905b815481529060010190602001808311613f4e57829003601f168201915b5050505050915050919050565b6060613f938254600f81810b600160801b909204900b131590565b15613fb157604051631ed9509560e11b815260040160405180910390fd5b8154600f0b600081815260018401602052604090208054613fd190615413565b80601f0160208091040260200160405190810160405280929190818152602001828054613ffd90615413565b801561404a5780601f1061401f5761010080835404028352916020019161404a565b820191906000526020600020905b81548152906001019060200180831161402d57829003601f168201915b50505050600f83900b60009081526001860160205260408120929450614071929150614f87565b82546fffffffffffffffffffffffffffffffff19166001919091016001600160801b03161790915590565b60006140ac61271061016d61545d565b6140b6838561545d565b610dce919061548a565b6000614115826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661481d9092919063ffffffff16565b9050805160001480614136575080806020019051810190614136919061568c565b610e965760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610f33565b60007f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb486040516370a0823160e01b81526001600160a01b03848116600483015291909116906370a0823190602401602060405180830381865afa158015614200573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610adc91906153fa565b600080806000198587098587029250828110838203039150508060000361425e5783828161425457614254615474565b0492505050610dce565b8084116142a55760405162461bcd60e51b81526020600482015260156024820152744d6174683a206d756c446976206f766572666c6f7760581b6044820152606401610f33565b60008486880960026001871981018816978890046003810283188082028403028082028403028082028403028082028403028082028403029081029092039091026000889003889004909101858311909403939093029303949094049190911702949350505050565b6060610adc6001600160a01b03831660145b6060600061432f83600261545d565b61433a9060026154ca565b6001600160401b03811115614351576143516151c1565b6040519080825280601f01601f19166020018201604052801561437b576020820181803683370190505b509050600360fc1b816000815181106143965761439661565d565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106143c5576143c561565d565b60200101906001600160f81b031916908160001a90535060006143e984600261545d565b6143f49060016154ca565b90505b600181111561446c576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106144285761442861565d565b1a60f81b82828151811061443e5761443e61565d565b60200101906001600160f81b031916908160001a90535060049490941c9361446581615899565b90506143f7565b508315610dce5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610f33565b6144c3614f4c565b6144d3856080015161010061482c565b50509183526001600160a01b031660208301526001600160e01b031916604082015290565b6145058260038351614891565b610e968282614998565b67ffffffffffffffff1981121561452a57610f4682826149bf565b6001600160401b0381131561454357610f468282614a01565b6000811261455757610f4682600083614891565b610f46826001614569846000196158b0565b614891565b60045460009061457f8160016154ca565b600455835160408086015160808701515191516000936320214ca360e11b936145b79386938493923092918a916001916024016158d0565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915290506145f786838684614a24565b9695505050505050565b6001600160a01b0382166146575760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610f33565b61466360008383613a1c565b806008600082825461467591906154ca565b90915550506001600160a01b0382166000818152600660209081526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3610f4660008383613a9b565b6001600160a01b0382166147365760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401610f33565b61474282600083613a1c565b6001600160a01b038216600090815260066020526040902054818110156147b65760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401610f33565b6001600160a01b03831660008181526006602090815260408083208686039055600880548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3610e9683600084613a9b565b60606126d28484600085614b82565b60408051808201909152606081526000602082015261484c602083615938565b156148745761485c602083615938565b61486790602061549e565b61487190836154ca565b91505b506020828101829052604080518085526000815290920101905290565b6017816001600160401b0316116148b5576128ba8360e0600585901b168317614c5d565b60ff816001600160401b0316116148f1576148db836018611fe0600586901b1617614c5d565b506128ba836001600160401b0383166001614c82565b61ffff816001600160401b03161161492e57614918836019611fe0600586901b1617614c5d565b506128ba836001600160401b0383166002614c82565b63ffffffff816001600160401b03161161496d5761495783601a611fe0600586901b1617614c5d565b506128ba836001600160401b0383166004614c82565b61498283601b611fe0600586901b1617614c5d565b506128ba836001600160401b0383166008614c82565b604080518082019091526060815260006020820152610dce83846000015151848551614ca8565b6149ca8260c3614c5d565b50610f46826149db836000196158b0565b6040516020016149ed91815260200190565b604051602081830303815290604052614d92565b614a0c8260c2614c5d565b50610f4682826040516020016149ed91815260200190565b6040516bffffffffffffffffffffffff193060601b1660208201526034810184905260009060540160408051808303601f1901815282825280516020918201206000818152600590925291812080546001600160a01b0319166001600160a01b038a1617905590925082917fb5e6e01e79f91267dc17b4e6314d5d4d03593d2ceee0fbb452b750bd70ea5af99190a2600254604051630200057560e51b81526001600160a01b0390911690634000aea090614ae79088908790879060040161594c565b6020604051808303816000875af1158015614b06573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614b2a919061568c565b6126d25760405162461bcd60e51b815260206004820152602360248201527f756e61626c6520746f207472616e73666572416e6443616c6c20746f206f7261604482015262636c6560e81b6064820152608401610f33565b606082471015614be35760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610f33565b600080866001600160a01b03168587604051614bff9190615973565b60006040518083038185875af1925050503d8060008114614c3c576040519150601f19603f3d011682016040523d82523d6000602084013e614c41565b606091505b5091509150614c5287838387614d9f565b979650505050505050565b604080518082019091526060815260006020820152610dce8384600001515184614e18565b6040805180820190915260608152600060208201526126d2848560000151518585614e73565b6040805180820190915260608152600060208201528251821115614ccb57600080fd5b6020850151614cda83866154ca565b1115614d0d57614d0d85614cfd87602001518786614cf891906154ca565b614ef4565b614d0890600261545d565b614f0b565b600080865180518760208301019350808887011115614d2c5787860182525b505050602084015b60208410614d6c5780518252614d4b6020836154ca565b9150614d586020826154ca565b9050614d6560208561549e565b9350614d34565b51815160001960208690036101000a019081169019919091161790525083949350505050565b6145058260028351614891565b60608315614e0e578251600003614e07576001600160a01b0385163b614e075760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610f33565b50816126d2565b6126d28383614f22565b60408051808201909152606081526000602082015283602001518310614e4d57614e4d8485602001516002614d08919061545d565b8351805160208583010184815350808503614e69576001810182525b5093949350505050565b6040805180820190915260608152600060208201526020850151614e9785846154ca565b1115614eab57614eab85614cfd86856154ca565b60006001614ebb8461010061598f565b614ec5919061549e565b9050855183868201018583198251161781525080518487011115614ee95783860181525b509495945050505050565b600081831115614f05575081610adc565b50919050565b8151614f17838361482c565b506128ba8382614998565b815115614f325781518083602001fd5b8060405162461bcd60e51b8152600401610f33919061504b565b6040805160a0810182526000808252602080830182905282840182905260608084018390528451808601909552845283015290608082015290565b508054614f9390615413565b6000825580601f10614fa3575050565b601f016020900490600052602060002090810190610c4891905b80821115613c775760008155600101614fbd565b600060208284031215614fe357600080fd5b81356001600160e01b031981168114610dce57600080fd5b60005b83811015615016578181015183820152602001614ffe565b50506000910152565b60008151808452615037816020860160208601614ffb565b601f01601f19169290920160200192915050565b602081526000610dce602083018461501f565b60006020828403121561507057600080fd5b5035919050565b6001600160a01b0381168114610c4857600080fd5b6000806040838503121561509f57600080fd5b82356150aa81615077565b946020939093013593505050565b6000806000606084860312156150cd57600080fd5b83356150d881615077565b925060208401356150e881615077565b929592945050506040919091013590565b634e487b7160e01b600052602160045260246000fd5b6001600160a01b038416815260208101839052606081016004831061514457634e487b7160e01b600052602160045260246000fd5b826040830152949350505050565b6000806040838503121561516557600080fd5b82359150602083013561517781615077565b809150509250929050565b60006020828403121561519457600080fd5b8135610dce81615077565b600080604083850312156151b257600080fd5b50508035926020909101359150565b634e487b7160e01b600052604160045260246000fd5b6000602082840312156151e957600080fd5b81356001600160401b038082111561520057600080fd5b818401915084601f83011261521457600080fd5b813581811115615226576152266151c1565b604051601f8201601f19908116603f0116810190838211818310171561524e5761524e6151c1565b8160405282815287602084870101111561526757600080fd5b826020860160208301376000928101602001929092525095945050505050565b6020815281516020820152602082015160408201526000604083015160a060608401526152b760c084018261501f565b90506060840151601f19808584030160808601526152d5838361501f565b925060808601519150808584030160a086015250613a13828261501f565b60006020828403121561530557600080fd5b813560ff81168114610dce57600080fd5b6000806020838503121561532957600080fd5b82356001600160401b038082111561534057600080fd5b818501915085601f83011261535457600080fd5b81358181111561536357600080fd5b8660208260051b850101111561537857600080fd5b60209290920196919550909350505050565b60008060006060848603121561539f57600080fd5b8335925060208401356153b181615077565b915060408401356153c181615077565b809150509250925092565b600080604083850312156153df57600080fd5b82356153ea81615077565b9150602083013561517781615077565b60006020828403121561540c57600080fd5b5051919050565b600181811c9082168061542757607f821691505b602082108103614f0557634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b8082028115828204841417610adc57610adc615447565b634e487b7160e01b600052601260045260246000fd5b60008261549957615499615474565b500490565b81810381811115610adc57610adc615447565b60ff8181168382160190811115610adc57610adc615447565b80820180821115610adc57610adc615447565b600080604083850312156154f057600080fd5b82516154fb81615077565b6020939093015192949293505050565b601f821115610e9657600081815260208120601f850160051c810160208610156155325750805b601f850160051c820191505b818110156155515782815560010161553e565b505050505050565b81516001600160401b03811115615572576155726151c1565b615586816155808454615413565b8461550b565b602080601f8311600181146155bb57600084156155a35750858301515b600019600386901b1c1916600185901b178555615551565b600085815260208120601f198616915b828110156155ea578886015182559484019460019091019084016155cb565b50858210156156085787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b039390931683526020830191909152604082015260600190565b634e487b7160e01b600052603260045260246000fd5b60006001820161568557615685615447565b5060010190565b60006020828403121561569e57600080fd5b81518015158114610dce57600080fd5b600181815b808511156156e95781600019048211156156cf576156cf615447565b808516156156dc57918102915b93841c93908002906156b3565b509250929050565b60008261570057506001610adc565b8161570d57506000610adc565b8160018114615723576002811461572d57615749565b6001915050610adc565b60ff84111561573e5761573e615447565b50506001821b610adc565b5060208310610133831016604e8410600b841016171561576c575081810a610adc565b61577683836156ae565b806000190482111561578a5761578a615447565b029392505050565b6000610dce60ff8416836156f1565b80820182811260008312801582168215821617156157c1576157c1615447565b505092915050565b6000806000606084860312156157de57600080fd5b83516157e981615077565b602085015160409095015190969495509392505050565b6000806040838503121561581357600080fd5b505080516020909101519092909150565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081526000835161585c816017850160208801614ffb565b7001034b99036b4b9b9b4b733903937b6329607d1b601791840191820152835161588d816028840160208801614ffb565b01602801949350505050565b6000816158a8576158a8615447565b506000190190565b81810360008312801583831316838312821617156118ff576118ff615447565b6001600160a01b0389811682526020820189905260408201889052861660608201526001600160e01b03198516608082015260a0810184905260c0810183905261010060e082018190526000906159298382018561501f565b9b9a5050505050505050505050565b60008261594757615947615474565b500690565b60018060a01b0384168152826020820152606060408201526000613a13606083018461501f565b60008251615985818460208701614ffb565b9190910192915050565b6000610dce83836156f156fe97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b929a26469706673582212205e12fb361d6f198acc0b93ec24c7d83f709ce40dcffa12eaf0724e614df8584364736f6c63430008130033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000db3662449ce9c594825a40e863edd0429297d81b0000000000000000000000009b00168b7ddc6284a160f7bcf5bc13ba7a93195c000000000000000000000000f2b6e84922998dd7d32c47313ece1730cf43b6ae000000000000000000000000dafec86d96f8a97f34186f9988ead7991cbc2dd4000000000000000000000000908f368431b2a9d2d26e2d9984b8c81e37e4faec000000000000000000000000514910771af9ca656af840dff83e8264ecf986ca0000000000000000000000003e64cd889482443324f91bfa9c84fe72a511f48a0000000000000000000000000000000000000000000000000000000000000120ca98366cc7314957b8c012c72f05aeeb00000000000000000000000000000000000000000000000000000000000000000000000000000000016345785d8a000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000002568747470733a2f2f636f6769746f2e66696e616e63652f6170692f6e61762f6c617465737400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
-----Decoded View---------------
Arg [0] : asset (address): 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48
Arg [1] : operator (address): 0xdB3662449cE9C594825a40e863edD0429297D81b
Arg [2] : feeReceiver (address): 0x9B00168B7ddc6284a160F7bcf5bc13ba7A93195c
Arg [3] : treasury (address): 0xf2b6e84922998Dd7D32c47313ecE1730cf43b6ae
Arg [4] : baseVault (address): 0xdaFec86d96F8a97f34186f9988Ead7991CBc2dd4
Arg [5] : kycManager (address): 0x908f368431B2A9d2D26E2d9984b8c81e37E4FAEc
Arg [6] : chainlinkToken (address): 0x514910771AF9Ca656af840dff83E8264EcF986CA
Arg [7] : chainlinkOracle (address): 0x3E64Cd889482443324F91bFA9c84fE72A511f48A
Arg [8] : chainlinkParams (tuple): System.Collections.Generic.List`1[Nethereum.ABI.FunctionEncoding.ParameterOutput]
-----Encoded View---------------
19 Constructor Arguments found :
Arg [0] : 000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48
Arg [1] : 000000000000000000000000db3662449ce9c594825a40e863edd0429297d81b
Arg [2] : 0000000000000000000000009b00168b7ddc6284a160f7bcf5bc13ba7a93195c
Arg [3] : 000000000000000000000000f2b6e84922998dd7d32c47313ece1730cf43b6ae
Arg [4] : 000000000000000000000000dafec86d96f8a97f34186f9988ead7991cbc2dd4
Arg [5] : 000000000000000000000000908f368431b2a9d2d26e2d9984b8c81e37e4faec
Arg [6] : 000000000000000000000000514910771af9ca656af840dff83e8264ecf986ca
Arg [7] : 0000000000000000000000003e64cd889482443324f91bfa9c84fe72a511f48a
Arg [8] : 0000000000000000000000000000000000000000000000000000000000000120
Arg [9] : ca98366cc7314957b8c012c72f05aeeb00000000000000000000000000000000
Arg [10] : 000000000000000000000000000000000000000000000000016345785d8a0000
Arg [11] : 00000000000000000000000000000000000000000000000000000000000000a0
Arg [12] : 0000000000000000000000000000000000000000000000000000000000000100
Arg [13] : 0000000000000000000000000000000000000000000000000000000000000120
Arg [14] : 0000000000000000000000000000000000000000000000000000000000000025
Arg [15] : 68747470733a2f2f636f6769746f2e66696e616e63652f6170692f6e61762f6c
Arg [16] : 6174657374000000000000000000000000000000000000000000000000000000
Arg [17] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [18] : 0000000000000000000000000000000000000000000000000000000000000000
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.