Overview
BTT Balance
0 BTT
BTT Value
$0.00More Info
Private Name Tags
ContractCreator
Loading...
Loading
Contract Name:
ElkFactoryHelper
Compiler Version
v0.8.19+commit.7dd6d404
Contract Source Code (Solidity)
/** *Submitted for verification at bttcscan.com on 2023-06-01 */ // SPDX-License-Identifier: BUSL-1.1 // // Copyright (c) 2023 ElkLabs // License terms: https://github.com/elkfinance/faas/blob/main/LICENSE // // Authors: // - Seth <[email protected]> // - Baal <[email protected]> // - Elijah <[email protected]> // - Snake <[email protected]> // File: @openzeppelin/[email protected]/utils/Address.sol // OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return 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); } } } // File: @openzeppelin/[email protected]/token/ERC20/extensions/draft-IERC20Permit.sol // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); } // File: @openzeppelin/[email protected]/token/ERC20/IERC20.sol // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); } // File: contracts/interfaces/IStaking.sol // // Copyright (c) 2023 ElkLabs // License terms: https://github.com/elkfinance/faas/blob/main/LICENSE // // Authors: // - Seth <[email protected]> // - Baal <[email protected]> pragma solidity >=0.8.0; interface IStaking { /* ========== STATE VARIABLES ========== */ function stakingToken() external returns (IERC20); function totalSupply() external returns (uint256); function balances(address _account) external returns (uint256); /* ========== MUTATIVE FUNCTIONS ========== */ function stake(uint256 _amount) external; function withdraw(uint256 _amount) external; function exit() external; function recoverERC20( address _tokenAddress, address _recipient, uint256 _amount ) external; /* ========== EVENTS ========== */ // Emitted on staking event Staked(address indexed account, uint256 amount); // Emitted on withdrawal (including exit) event Withdrawn(address indexed account, uint256 amount); // Emitted on token recovery event Recovered( address indexed token, address indexed recipient, uint256 amount ); } // File: contracts/interfaces/IStakingFee.sol // // Copyright (c) 2023 ElkLabs // License terms: https://github.com/elkfinance/faas/blob/main/LICENSE // // Authors: // - Seth <[email protected]> // - Baal <[email protected]> pragma solidity >=0.8.0; interface IStakingFee is IStaking { /* ========== STATE VARIABLES ========== */ function feesUnit() external returns (uint256); function maxFee() external returns (uint256); function withdrawalFeeSchedule(uint256) external returns (uint256); function withdrawalFeesBps(uint256) external returns (uint256); function depositFeeBps() external returns (uint256); function collectedFees() external returns (uint256); function userLastStakedTime(address _user) external view returns (uint32); /* ========== VIEWS ========== */ function depositFee(uint256 _depositAmount) external view returns (uint256); function withdrawalFee( address _account, uint256 _withdrawalAmount ) external view returns (uint256); /* ========== MUTATIVE FUNCTIONS ========== */ function recoverFees(address _recipient) external; /* ========== EVENTS ========== */ // Emitted when fees are (re)configured event FeesSet( uint16 _depositFeeBps, uint16[] _withdrawalFeesBps, uint32[] _feeSchedule ); // Emitted when a deposit fee is collected event DepositFeesCollected(address indexed _user, uint256 _amount); // Emitted when a withdrawal fee is collected event WithdrawalFeesCollected(address indexed _user, uint256 _amount); // Emitted when fees are recovered by governance event FeesRecovered(uint256 _amount); } // File: contracts/interfaces/IStakingRewards.sol // // Copyright (c) 2023 ElkLabs // License terms: https://github.com/elkfinance/faas/blob/main/LICENSE // // Authors: // - Seth <[email protected]> // - Baal <[email protected]> pragma solidity >=0.8.0; interface IStakingRewards is IStakingFee { /* ========== STATE VARIABLES ========== */ function rewardTokens(uint256) external view returns (IERC20); function rewardTokenAddresses( address _rewardAddress ) external view returns (bool); function periodFinish() external view returns (uint256); function rewardsDuration() external view returns (uint256); function lastUpdateTime() external view returns (uint256); function rewardRates( address _rewardAddress ) external view returns (uint256); function rewardPerTokenStored( address _rewardAddress ) external view returns (uint256); // wallet address => token address => amount function userRewardPerTokenPaid( address _walletAddress, address _tokenAddress ) external view returns (uint256); function rewards( address _walletAddress, address _tokenAddress ) external view returns (uint256); /* ========== VIEWS ========== */ function lastTimeRewardApplicable() external view returns (uint256); function rewardPerToken( address _tokenAddress ) external view returns (uint256); function earned( address _tokenAddress, address _account ) external view returns (uint256); /* ========== MUTATIVE FUNCTIONS ========== */ function getReward(address _tokenAddress, address _recipient) external; function getRewards(address _recipient) external; // Must send reward before calling this! function startEmission( uint256[] memory _rewards, uint256 _duration ) external; function stopEmission(address _refundAddress) external; function recoverLeftoverReward( address _tokenAddress, address _recipient ) external; function addRewardToken(address _tokenAddress) external; function rewardTokenIndex( address _tokenAddress ) external view returns (int8); /* ========== EVENTS ========== */ // Emitted when a reward is paid to an account event RewardPaid( address indexed _token, address indexed _account, uint256 _reward ); // Emitted when a leftover reward is recovered event LeftoverRewardRecovered(address indexed _recipient, uint256 _amount); // Emitted when rewards emission is started event RewardsEmissionStarted(uint256[] _rewards, uint256 _duration); // Emitted when rewards emission ends event RewardsEmissionEnded(); } // File: @openzeppelin/[email protected]/token/ERC20/extensions/IERC20Metadata.sol // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.0; /** * @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); } // File: @openzeppelin/[email protected]/token/ERC20/utils/SafeERC20.sol // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20 token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } } // File: @openzeppelin/[email protected]/security/ReentrancyGuard.sol // OpenZeppelin Contracts (last updated v4.8.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; } } // File: @openzeppelin/[email protected]/utils/Context.sol // 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; } } // File: @openzeppelin/[email protected]/token/ERC20/ERC20.sol // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.0; /** * @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]. * * We have followed general OpenZeppelin Contracts guidelines: functions revert * instead returning `false` on failure. This behavior is nonetheless * conventional and does not conflict with the expectations of ERC20 * applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20, IERC20Metadata { mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overridden; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `to` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address to, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _transfer(owner, to, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on * `transferFrom`. This is semantically equivalent to an infinite approval. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _approve(owner, spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * NOTE: Does not update the allowance if the current allowance * is the maximum `uint256`. * * Requirements: * * - `from` and `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. * - the caller must have allowance for ``from``'s tokens of at least * `amount`. */ function transferFrom( address from, address to, uint256 amount ) public virtual override returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, amount); _transfer(from, to, amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, allowance(owner, spender) + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { address owner = _msgSender(); uint256 currentAllowance = allowance(owner, spender); require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(owner, spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `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 {} } // File: @openzeppelin/[email protected]/access/Ownable.sol // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } } // File: contracts/Staking.sol // // Copyright (c) 2023 ElkLabs // License terms: https://github.com/elkfinance/faas/blob/main/LICENSE // // Authors: // - Seth <[email protected]> // - Baal <[email protected]> // - Elijah <[email protected]> // - Snake <[email protected]> pragma solidity >=0.8.0; /** * Base contract implementing simple ERC20 token staking functionality (no staking rewards). */ contract Staking is ReentrancyGuard, Ownable, IStaking { using SafeERC20 for IERC20; /* ========== STATE VARIABLES ========== */ /// @notice Staking token interface IERC20 public immutable stakingToken; /// @notice Total supply of the staking token uint256 public totalSupply; /// @notice Account balances mapping(address => uint256) public balances; // Scaling factor: supply is always stored as wei (10**18) regardless of the token's decimals uint256 private supplyScalingFactor; /* ========== CONSTRUCTOR ========== */ /// @param _stakingTokenAddress address of the token used for staking (must be ERC20) constructor(address _stakingTokenAddress) { require(_stakingTokenAddress != address(0), "E1"); stakingToken = IERC20(_stakingTokenAddress); supplyScalingFactor = 1e18 / 10**ERC20(_stakingTokenAddress).decimals(); } /** * @dev Stake tokens. * Note: the contract must have sufficient allowance for the staking token. * @param _amount amount to stake */ function stake(uint256 _amount) public nonReentrant { uint256 originalAmount = _amount; _amount = _beforeStake(msg.sender, _amount); require(_amount > 0 && originalAmount > 0, "E2"); // Check after the hook totalSupply += _amount * supplyScalingFactor; balances[msg.sender] += _amount; stakingToken.safeTransferFrom(msg.sender, address(this), originalAmount); emit Staked(msg.sender, _amount); } /** * @dev Withdraw previously staked tokens. * @param _amount amount to withdraw */ function withdraw(uint256 _amount) public nonReentrant { uint256 originalAmount = _amount; _amount = _beforeWithdraw(msg.sender, _amount); require( _amount > 0 && _amount <= balances[msg.sender] && originalAmount <= balances[msg.sender], "E3" ); // Check after the hook totalSupply -= originalAmount * supplyScalingFactor; balances[msg.sender] -= originalAmount; stakingToken.safeTransfer(msg.sender, _amount); emit Withdrawn(msg.sender, _amount); } /** * @dev Exit the farm, i.e., withdraw the entire token balance of the calling account */ function exit() external { _beforeExit(msg.sender); withdraw(balances[msg.sender]); } /* ========== RESTRICTED FUNCTIONS ========== */ /** * @dev Recover ERC20 tokens held in the contract. * Note: privileged governance function to recover tokens mistakenly sent to this contract address. * This function cannot be used to withdraw staking tokens. * @param _tokenAddress address of the token to recover * @param _recipient recovery address * @param _amount amount to withdraw * @ return withdrawn amount (may differ from input amount due to e.g., fees) */ function recoverERC20( address _tokenAddress, address _recipient, uint256 _amount ) external nonReentrant onlyOwner { require( _tokenAddress != address(stakingToken), "E4" ); _beforeRecoverERC20(_tokenAddress, _recipient, _amount); IERC20 token = IERC20(_tokenAddress); token.safeTransfer(_recipient, _amount); emit Recovered(_tokenAddress, _recipient, _amount); } /* ========== HOOKS ========== */ /** * @dev Internal hook called before staking (in the stake() function). * @ param _account staker address * @param _amount amount being staken * @return amount to stake (may be changed by the hook) */ function _beforeStake( address /*_account*/, uint256 _amount ) internal virtual returns (uint256) { return _amount; } /** * @dev Internal hook called before withdrawing (in the withdraw() function). * @ param _account withdrawer address * @param _amount amount being withdrawn * @return amount to withdraw (may be changed by the hook) */ function _beforeWithdraw( address /*_account*/, uint256 _amount ) internal virtual returns (uint256) { return _amount; } /** * @dev Internal hook called before exiting (in the exit() function). * Note: since exit() calls withdraw() internally, the _beforeWithdraw() hook fill fire too. * @param _account address exiting */ function _beforeExit(address _account) internal virtual {} /** * @dev Internal hook called before recovering tokens (in the recoverERC20() function). * @param _tokenAddress address of the token being recovered * @param _recipient recovery address * @param _amount amount being withdrawn */ function _beforeRecoverERC20( address _tokenAddress, address _recipient, uint256 _amount ) internal virtual {} } // File: contracts/StakingFee.sol // // Copyright (c) 2023 ElkLabs // License terms: https://github.com/elkfinance/faas/blob/main/LICENSE // // Authors: // - Seth <[email protected]> // - Baal <[email protected]> // - Elijah <[email protected]> // - Snake <[email protected]> pragma solidity >=0.8.0; /** * Contract implementing simple ERC20 token staking functionality and supporting deposit/withdrawal fees (no staking rewards). */ contract StakingFee is Staking, IStakingFee { using SafeERC20 for IERC20; /* ========== STATE VARIABLES ========== */ /// @notice Constant Fee Unit (1e4) uint256 public constant feesUnit = 10000; /// @notice Maximum fee (20%) uint256 public constant maxFee = 2000; /// @notice Schedule of withdrawal fees represented as a sorted array of durations /// @dev example: 10% after 1 hour, 1% after a day, 0% after a week => [3600, 86400] uint256[] public withdrawalFeeSchedule; /// @notice Withdrawal fees described in basis points (fee unit) represented as an array of the same length as withdrawalFeeSchedule /// @dev example: 10% after 1 hour, 1% after a day, 0% after a week => [1000, 100] uint256[] public withdrawalFeesBps; /// @notice Deposit (staking) fee in basis points (fee unit) uint256 public depositFeeBps; /// @notice Counter of collected fees uint256 public collectedFees; /// @notice Last staking time for each user mapping(address => uint32) public userLastStakedTime; /* ========== CONSTRUCTOR ========== */ /** * @param _stakingTokenAddress address of the token used for staking (must be ERC20) * @param _depositFeeBps deposit fee in basis points * @param _withdrawalFeesBps aligned to fee schedule * @param _withdrawalFeeSchedule assumes a sorted array */ constructor( address _stakingTokenAddress, uint16 _depositFeeBps, uint16[] memory _withdrawalFeesBps, uint32[] memory _withdrawalFeeSchedule ) Staking(_stakingTokenAddress) { _setFees(_depositFeeBps, _withdrawalFeesBps, _withdrawalFeeSchedule); } /* ========== VIEWS ========== */ /** * @dev Calculate the deposit fee for a given amount. * @param _depositAmount amount to stake * @return fee paid upon deposit */ function depositFee(uint256 _depositAmount) public view returns (uint256) { return depositFeeBps > 0 ? (_depositAmount * depositFeeBps) / feesUnit : 0; } /** * @dev Calculate the withdrawal fee for a given amount. * @param _account user wallet address * @param _withdrawalAmount amount to withdraw * @return fee paid upon withdrawal */ function withdrawalFee( address _account, uint256 _withdrawalAmount ) public view returns (uint256) { uint256 userLastStakedTimestampDiff = block.timestamp - userLastStakedTime[_account]; uint256 withdrawalFeeAmount; for (uint i = 0; i < withdrawalFeeSchedule.length; ++i) { if (userLastStakedTimestampDiff < withdrawalFeeSchedule[i]) { withdrawalFeeAmount = (_withdrawalAmount * withdrawalFeesBps[i]) / feesUnit; break; } } return withdrawalFeeAmount; } /* ========== RESTRICTED FUNCTIONS ========== */ /** * @dev Recover collected fees held in the contract. * Note: privileged function for governance * @param _recipient fee recovery address */ function recoverFees(address _recipient) external onlyOwner nonReentrant { _beforeRecoverFees(_recipient); uint256 previousFees = collectedFees; collectedFees = 0; emit FeesRecovered(previousFees); stakingToken.safeTransfer(_recipient, previousFees); } /* ========== PRIVATE FUNCTIONS ========== */ /** * @dev Configure the fees for this contract. * @param _depositFeeBps deposit fee in basis points * @param _withdrawalFeesBps withdrawal fees in basis points * @param _withdrawalFeeSchedule withdrawal fees schedule */ function _setFees( uint16 _depositFeeBps, uint16[] memory _withdrawalFeesBps, uint32[] memory _withdrawalFeeSchedule ) private { require(_withdrawalFeeSchedule.length == _withdrawalFeesBps.length && _withdrawalFeeSchedule.length <= 10 && _depositFeeBps <= maxFee, "E5"); uint32 lastFeeSchedule = 0; uint256 lastWithdrawalFee = maxFee + 1; for (uint i = 0; i < _withdrawalFeeSchedule.length; ++i) { require(_withdrawalFeeSchedule[i] > lastFeeSchedule, "E7"); require(_withdrawalFeesBps[i] < lastWithdrawalFee, "E8"); lastFeeSchedule = _withdrawalFeeSchedule[i]; lastWithdrawalFee = _withdrawalFeesBps[i]; } withdrawalFeeSchedule = _withdrawalFeeSchedule; withdrawalFeesBps = _withdrawalFeesBps; depositFeeBps = _depositFeeBps; emit FeesSet( _depositFeeBps, _withdrawalFeesBps, _withdrawalFeeSchedule ); } /* ========== HOOKS ========== */ /** * @dev Override _beforeStake() hook to collect the deposit fee and update associated state */ function _beforeStake( address _account, uint256 _amount ) internal virtual override returns (uint256) { uint256 fee = depositFee(_amount); userLastStakedTime[_account] = uint32(block.timestamp); if (fee > 0) { collectedFees += fee; emit DepositFeesCollected(_account, fee); } return super._beforeStake(_account, _amount - fee); } /** * @dev Override _beforeWithdrawl() hook to collect the withdrawal fee and update associated state */ function _beforeWithdraw( address _account, uint256 _amount ) internal virtual override returns (uint256) { uint256 fee = withdrawalFee(_account, _amount); if (fee > 0) { collectedFees += fee; emit WithdrawalFeesCollected(_account, fee); } return super._beforeWithdraw(_account, _amount - fee); } /** * @dev Internal hook called before recovering fees (in the recoverFees() function). * @param _recipient recovery address */ function _beforeRecoverFees(address _recipient) internal virtual {} } // File: contracts/StakingRewards.sol // // Copyright (c) 2023 ElkLabs // License terms: https://github.com/elkfinance/faas/blob/main/LICENSE // // Authors: // - Seth <[email protected]> // - Baal <[email protected]> // - Elijah <[email protected]> // - Snake <[email protected]> pragma solidity >=0.8.0; /** * Contract implementing simple ERC20 token staking functionality with staking rewards and deposit/withdrawal fees. */ contract StakingRewards is StakingFee, IStakingRewards { using SafeERC20 for IERC20; /* ========== STATE VARIABLES ========== */ /// @notice List of reward token interfaces IERC20[] public rewardTokens; /// @notice Reward token addresses (maps every reward token address to true, others to false) mapping(address => bool) public rewardTokenAddresses; /// @notice Timestamp when rewards stop emitting uint256 public periodFinish; /// @notice Duration for reward emission uint256 public rewardsDuration; /// @notice Last time the rewards were updated uint256 public lastUpdateTime; /// @notice Reward token rates (maps every reward token to an emission rate, i.e., how many tokens emitted per second) mapping(address => uint256) public rewardRates; /// @notice How many tokens are emitted per staked token mapping(address => uint256) public rewardPerTokenStored; /// @notice How many reward tokens were paid per user (token address => wallet address => amount) mapping(address => mapping(address => uint256)) public userRewardPerTokenPaid; /// @notice Accumulator of reward tokens per user (token address => wallet address => amount) mapping(address => mapping(address => uint256)) public rewards; /* ========== CONSTRUCTOR ========== */ /** * @param _stakingTokenAddress address of the token used for staking (must be ERC20) * @param _rewardTokenAddresses addresses the reward tokens (must be ERC20) * @param _rewardsDuration reward emission duration * @param _depositFeeBps deposit fee in basis points * @param _withdrawalFeesBps aligned to fee schedule * @param _withdrawalFeeSchedule assumes a sorted array */ constructor( address _stakingTokenAddress, address[] memory _rewardTokenAddresses, uint256 _rewardsDuration, uint16 _depositFeeBps, uint16[] memory _withdrawalFeesBps, uint32[] memory _withdrawalFeeSchedule ) StakingFee( _stakingTokenAddress, _depositFeeBps, _withdrawalFeesBps, _withdrawalFeeSchedule ) { require(_rewardTokenAddresses.length > 0, "E9"); // update reward data structures for (uint i = 0; i < _rewardTokenAddresses.length; ++i) { address tokenAddress = _rewardTokenAddresses[i]; _addRewardToken(tokenAddress); } rewardsDuration = _rewardsDuration; } /* ========== VIEWS ========== */ /** * @notice Return the last time rewards are applicable (the lowest of the current timestamp and the rewards expiry timestamp). * @return timestamp */ function lastTimeRewardApplicable() public view returns (uint256) { return block.timestamp < periodFinish ? block.timestamp : periodFinish; } /** * @notice Return the reward per staked token for a given reward token address. * @param _tokenAddress reward token address * @return amount of reward per staked token */ function rewardPerToken( address _tokenAddress ) public view returns (uint256) { if (totalSupply == 0) { return rewardPerTokenStored[_tokenAddress]; } return rewardPerTokenStored[_tokenAddress] + ((lastTimeRewardApplicable() - lastUpdateTime) * rewardRates[_tokenAddress] * 10**ERC20(_tokenAddress).decimals()) / totalSupply; } /** * @notice Return the total reward earned by a user for a given reward token address. * @param _tokenAddress reward token address * @param _account user wallet address * @return amount earned */ function earned( address _tokenAddress, address _account ) public view returns (uint256) { return (balances[_account] * (rewardPerToken(_tokenAddress) - userRewardPerTokenPaid[_tokenAddress][_account])) / 10**ERC20(_tokenAddress).decimals() + rewards[_tokenAddress][_account]; } /* ========== MUTATIVE FUNCTIONS ========== */ /** * @dev claim the specified token reward for a staker * @param _tokenAddress the address of the reward token * @param _recipient the address of the staker that should receive the reward * @ return amount of reward received */ function getReward( address _tokenAddress, address _recipient ) public nonReentrant updateRewards(_recipient) { return _getReward(_tokenAddress, _recipient); } /** * @dev claim rewards for all the reward tokens for the staker * @param _recipient address of the recipient to receive the rewards */ function getRewards( address _recipient ) public nonReentrant updateRewards(_recipient) { for (uint i = 0; i < rewardTokens.length; ++i) { _getReward(address(rewardTokens[i]), _recipient); } } /** * @dev Start the emission of rewards to stakers. The owner must send reward tokens to the contract before calling this function. * Note: Can only be called by owner when the contract is not emitting rewards. * @param _rewards array of rewards amounts for each reward token * @param _duration duration in seconds for which rewards will be emitted */ function startEmission( uint256[] memory _rewards, uint256 _duration ) public virtual nonReentrant onlyOwner whenNotEmitting updateRewards(address(0)) { require(_duration > 0, "E10"); require(_rewards.length == rewardTokens.length, "E11"); _beforeStartEmission(_rewards, _duration); rewardsDuration = _duration; for (uint i = 0; i < rewardTokens.length; ++i) { IERC20 token = rewardTokens[i]; address tokenAddress = address(token); rewardRates[tokenAddress] = _rewards[i] / rewardsDuration; // Ensure the provided reward amount is not more than the balance in the contract. // This keeps the reward rate in the right range, preventing overflows due to // very high values of rewardRate in the earned and rewardsPerToken functions; // Reward + leftover must be less than 2^256 / 10^18 to avoid overflow. uint256 balance = rewardTokens[i].balanceOf(address(this)); if (tokenAddress != address(stakingToken)) { require( rewardRates[tokenAddress] <= balance / rewardsDuration, "E3" ); } else { // Handle carefully where rewardsToken is the same as stakingToken (need to subtract total supply) require( rewardRates[tokenAddress] <= (balance - totalSupply) / rewardsDuration, "E3" ); } } lastUpdateTime = block.timestamp; periodFinish = block.timestamp + rewardsDuration; emit RewardsEmissionStarted(_rewards, _duration); } /** * @dev stop the reward emission process and transfer the remaining reward tokens to a specified address * Note: can only be called by owner when the contract is currently emitting rewards * @param _refundAddress the address to receive the remaining reward tokens */ function stopEmission( address _refundAddress ) external nonReentrant onlyOwner whenEmitting { _beforeStopEmission(_refundAddress); uint256 remaining = 0; if (periodFinish > block.timestamp) { remaining = periodFinish - block.timestamp; } periodFinish = block.timestamp; for (uint i = 0; i < rewardTokens.length; ++i) { IERC20 token = rewardTokens[i]; address tokenAddress = address(token); uint256 refund = rewardRates[tokenAddress] * remaining; if (refund > 0) { token.safeTransfer(_refundAddress, refund); } } emit RewardsEmissionEnded(); } /** * @dev recover leftover reward tokens and transfer them to a specified recipient * Note: can only be called by owner when the contract is not emitting rewards * @param _tokenAddress address of the reward token to be recovered * @param _recipient address to receive the recovered reward tokens */ function recoverLeftoverReward( address _tokenAddress, address _recipient ) external onlyOwner whenNotEmitting { require(totalSupply == 0, "E12"); if (rewardTokenAddresses[_tokenAddress]) { _beforeRecoverLeftoverReward(_tokenAddress, _recipient); IERC20 token = IERC20(_tokenAddress); uint256 amount = token.balanceOf(address(this)); if (amount > 0) { token.safeTransfer(_recipient, amount); } emit LeftoverRewardRecovered(_recipient, amount); } } /** * @dev add a reward token to the contract * Note: can only be called by owner when the contract is not emitting rewards * @param _tokenAddress address of the new reward token */ function addRewardToken( address _tokenAddress ) external onlyOwner whenNotEmitting { _addRewardToken(_tokenAddress); } /** * @dev Return the array index of the provided token address (if applicable) * @param _tokenAddress address of the LP token * @return the array index for _tokenAddress or -1 if it is not a reward token */ function rewardTokenIndex( address _tokenAddress ) public view returns (int8) { if (rewardTokenAddresses[_tokenAddress]) { for (uint i = 0; i < rewardTokens.length; ++i) { if (address(rewardTokens[i]) == _tokenAddress) { return int8(int256(i)); } } } return -1; } /* ========== PRIVATE FUNCTIONS ========== */ /** * @dev Get the reward amount of a token for a specific recipient * @param _tokenAddress address of the token * @param _recipient address of the recipient */ function _getReward(address _tokenAddress, address _recipient) private { require(msg.sender == owner() || msg.sender == _recipient, "E14"); require(rewardTokenAddresses[_tokenAddress], "E13"); uint256 reward = rewards[_tokenAddress][_recipient]; if (reward > 0) { rewards[_tokenAddress][_recipient] = 0; IERC20(_tokenAddress).safeTransfer(_recipient, reward); emit RewardPaid(_tokenAddress, _recipient, reward); } } /** * @dev Add a token as a reward token * @param _tokenAddress address of the token to be added as a reward token */ function _addRewardToken(address _tokenAddress) private { require(rewardTokens.length <= 15, "E15"); require(_tokenAddress != address(0), "E1"); if (!rewardTokenAddresses[_tokenAddress]) { rewardTokens.push(IERC20(_tokenAddress)); rewardTokenAddresses[_tokenAddress] = true; } } /* ========== HOOKS ========== */ /** * @dev Override _beforeStake() hook to ensure staking is only possible when rewards are emitting and update the rewards */ function _beforeStake( address _account, uint256 _amount ) internal virtual override whenEmitting updateRewards(_account) returns (uint256) { return super._beforeStake(_account, _amount); } /** * @dev Override _beforeExit() hook to claim all rewards for the account exiting */ function _beforeExit(address _account) internal virtual override { getRewards(_account); // getRewards calls updateRewards so we don't need to call it explicitly again here super._beforeExit(_account); } /** * @dev Override _beforeRecoverERC20() hook to prevent recovery of a reward token */ function _beforeRecoverERC20( address _tokenAddress, address _recipient, uint256 _amount ) internal virtual override { require(!rewardTokenAddresses[_tokenAddress], "E16"); super._beforeRecoverERC20(_tokenAddress, _recipient, _amount); } /** * @dev Internal hook called before starting the emission process (in the startEmission() function). * @param _rewards array of rewards per token. * @param _duration emission duration. */ function _beforeStartEmission( uint256[] memory _rewards, uint256 _duration ) internal virtual {} /** * @dev Internal hook called before stopping the emission process (in the stopEmission() function). * @param _refundAddress address to refund the remaining reward to */ function _beforeStopEmission(address _refundAddress) internal virtual {} /** * @dev Internal hook called before recovering leftover rewards (in the recoverLeftoverRewards() function). * @param _tokenAddress address of the token to recover * @param _recipient address to recover the leftover rewards to */ function _beforeRecoverLeftoverReward( address _tokenAddress, address _recipient ) internal virtual {} /* ========== MODIFIERS ========== */ /** * @dev Modifier to update rewards of a given account. * @param _account account to update rewards for */ modifier updateRewards(address _account) { for (uint i = 0; i < rewardTokens.length; ++i) { address tokenAddress = address(rewardTokens[i]); rewardPerTokenStored[tokenAddress] = rewardPerToken(tokenAddress); } lastUpdateTime = lastTimeRewardApplicable(); if (_account != address(0)) { for (uint i = 0; i < rewardTokens.length; ++i) { address tokenAddress = address(rewardTokens[i]); rewards[tokenAddress][_account] = earned(tokenAddress, _account); userRewardPerTokenPaid[tokenAddress][_account] = rewardPerTokenStored[tokenAddress]; } } _; } /** * @dev Modifier to check if rewards are emitting. */ modifier whenEmitting() { require(block.timestamp <= periodFinish, "E18"); _; } /** * @dev Modifier to check if rewards are not emitting. */ modifier whenNotEmitting() { require(block.timestamp > periodFinish, "E17"); _; } } // File: contracts/interfaces/IElkPair.sol // // Copyright (c) 2023 ElkLabs // License terms: https://github.com/elkfinance/faas/blob/main/LICENSE // // Authors: // - Seth <[email protected]> // - Baal <[email protected]> pragma solidity >=0.5.0; interface IElkPair { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external pure returns (string memory); function symbol() external pure returns (string memory); function decimals() external pure returns (uint8); function totalSupply() external view returns (uint); function balanceOf(address _owner) external view returns (uint); function allowance( address _owner, address _spender ) external view returns (uint); function approve(address _spender, uint _value) external returns (bool); function transfer(address _to, uint _value) external returns (bool); function transferFrom( address _from, address _to, uint _value ) external returns (bool); function DOMAIN_SEPARATOR() external view returns (bytes32); function PERMIT_TYPEHASH() external pure returns (bytes32); function nonces(address _owner) external view returns (uint); function permit( address _owner, address _spender, uint _value, uint _deadline, uint8 _v, bytes32 _r, bytes32 _s ) external; event Mint(address indexed sender, uint amount0, uint amount1); event Burn( address indexed sender, uint amount0, uint amount1, address indexed to ); event Swap( address indexed sender, uint amount0In, uint amount1In, uint amount0Out, uint amount1Out, address indexed to ); event Sync(uint112 reserve0, uint112 reserve1); function MINIMUM_LIQUIDITY() external pure returns (uint); function factory() external view returns (address); function token0() external view returns (address); function token1() external view returns (address); function getReserves() external view returns ( uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast ); function price0CumulativeLast() external view returns (uint); function price1CumulativeLast() external view returns (uint); function kLast() external view returns (uint); function mint(address _to) external returns (uint liquidity); function burn(address _to) external returns (uint amount0, uint amount1); function swap( uint _amount0Out, uint _amount1Out, address _to, bytes calldata _data ) external; function skim(address _to) external; function sync() external; function initialize(address, address) external; } // File: contracts/interfaces/IElkDexOracle.sol // // Copyright (c) 2023 ElkLabs // License terms: https://github.com/elkfinance/faas/blob/main/LICENSE // // Authors: // - Seth <[email protected]> // - Baal <[email protected]> pragma solidity >=0.8.0; interface IElkDexOracle { struct Observation { uint timestamp; uint price0Cumulative; uint price1Cumulative; } function weth() external view returns (address); function factory() external view returns (address); function windowSize() external view returns (uint); function granularity() external view returns (uint8); function periodSize() external view returns (uint); function pairObservations( address _pair ) external view returns (Observation[] memory); function observationIndexOf(uint _timestamp) external view returns (uint); function update(address _tokenA, address _tokenB) external; function updateWeth(address _token) external; function consult( address _tokenIn, uint _amountIn, address _tokenOut ) external view returns (uint); function consultWeth( address _tokenIn, uint _amountIn ) external view returns (uint); } // File: contracts/interfaces/IFarmingRewards.sol // // Copyright (c) 2023 ElkLabs // License terms: https://github.com/elkfinance/faas/blob/main/LICENSE // // Authors: // - Seth <[email protected]> // - Baal <[email protected]> pragma solidity >=0.8.0; interface IFarmingRewards is IStakingRewards { /// @notice Represents a snapshot of an LP position at a given timestamp struct Position { uint112 amount0; uint112 amount1; uint32 blockTimestamp; } /* ========== STATE VARIABLES ========== */ function oracle() external returns (IElkDexOracle); function lpToken() external returns (IElkPair); function coverageTokenAddress() external returns (address); function coverageAmount() external returns (uint256); function coverageVestingDuration() external returns (uint256); function coverageRate() external returns (uint256); function coveragePerTokenStored() external returns (uint256); function userCoveragePerTokenPaid( address _tokenPaid ) external returns (uint256); function coverage(address _token) external returns (uint256); function lastStakedPosition( address _user ) external returns (uint112 amount0, uint112 amount1, uint32 blockTimeStamp); /* ========== VIEWS ========== */ function coveragePerToken() external view returns (uint256); function coverageEarned(address _account) external view returns (uint256); /* ========== MUTATIVE FUNCTIONS ========== */ function getCoverage(address _recipient) external; function startEmission( uint256[] memory _rewards, uint256 _coverage, uint256 _duration ) external; function recoverLeftoverCoverage(address _recipient) external; /* ========== EVENTS ========== */ // Emitted when the coverage is paid to an account event CoveragePaid(address indexed account, uint256 coverage); // Emitted when the leftover coverage is recovered event LeftoverCoverageRecovered(address indexed recipient, uint256 amount); } // File: contracts/FarmingRewards.sol // // Copyright (c) 2023 ElkLabs // License terms: https://github.com/elkfinance/faas/blob/main/LICENSE // // Authors: // - Seth <[email protected]> // - Baal <[email protected]> // - Elijah <[email protected]> // - Snake <[email protected]> pragma solidity >=0.8.0; /** * Contract implementing simple ERC20 token staking functionality with staking rewards, impermanent loss coverage, and deposit/withdrawal fees. */ contract FarmingRewards is StakingRewards, IFarmingRewards { using SafeERC20 for IERC20; /* ========== STATE VARIABLES ========== */ /// @notice Interface to the ElkDex pricing oracle on this blockchain IElkDexOracle public immutable oracle; /// @notice Interface to the LP token that is staked in this farm IElkPair public immutable lpToken; /// @notice Address of the coverage token address public coverageTokenAddress; /// @notice Total amount of coverage available (worst case max amount) uint256 public coverageAmount; /// @notice Time until a farmed position is fully covered against impermanent loss (100%) uint256 public coverageVestingDuration; /// @notice Rate of coverage vesting uint256 public coverageRate; /// @notice Coverage amount per token staked in the farm uint256 public coveragePerTokenStored; /// @notice How much coverage was paid per user (wallet address => amount) mapping(address => uint256) public userCoveragePerTokenPaid; /// @notice Accumulator of coverage tokens per user (wallet address => amount) mapping(address => uint256) public coverage; /// @notice Last farming position for a given user (wallet address => position) mapping(address => Position) public lastStakedPosition; /* ========== CONSTRUCTOR ========== */ /** * @param _oracleAddress address of the price oracle * @param _lpTokenAddress address of the staking LP token (must be an ElkDex LP) * @param _coverageTokenAddress address of the token that the coverage is paid in * @param _coverageAmount total amount of coverage * @param _coverageVestingDuration time it takes to vest 100% of the coverage (min. 1 day) * @param _rewardTokenAddresses addresses the reward tokens (must be ERC20) * @param _rewardsDuration reward emission duration * @param _depositFeeBps deposit fee in basis points * @param _withdrawalFeesBps aligned to fee schedule * @param _withdrawalFeeSchedule assumes a sorted array */ constructor( address _oracleAddress, address _lpTokenAddress, address _coverageTokenAddress, uint256 _coverageAmount, uint32 _coverageVestingDuration, address[] memory _rewardTokenAddresses, uint256 _rewardsDuration, uint16 _depositFeeBps, uint16[] memory _withdrawalFeesBps, uint32[] memory _withdrawalFeeSchedule ) StakingRewards( _lpTokenAddress, _rewardTokenAddresses, _rewardsDuration, _depositFeeBps, _withdrawalFeesBps, _withdrawalFeeSchedule ) { oracle = IElkDexOracle(_oracleAddress); lpToken = IElkPair(_lpTokenAddress); if (_coverageTokenAddress != address(0)) { require( lpToken.token0() == _coverageTokenAddress || lpToken.token1() == _coverageTokenAddress, "E19" ); require( _coverageVestingDuration >= 24 * 3600 && _coverageVestingDuration <= rewardsDuration, "E21" ); } require( lpToken.factory() == oracle.factory(), "E20" ); coverageTokenAddress = _coverageTokenAddress; coverageAmount = _coverageAmount; coverageVestingDuration = _coverageVestingDuration; } // Optimized version below /*function coveragePerToken() public view returns (uint256) { if (totalSupply == 0) { return coveragePerTokenStored; } return // does this work for non 18 dec tokens? rate = _coverage / rewardsDuration, here rate is converted back to 18 dec coveragePerTokenStored + ((lastTimeRewardApplicable() - lastUpdateTime) * coverageRate * 10**ERC20(coverageTokenAddress).decimals()) / totalSupply; }*/ /** * @dev Return the coverage per staked token (in coverage token amounts) * @return amount of coverage per staked token */ function coveragePerToken() public view returns (uint256) { return totalSupply == 0 ? coveragePerTokenStored : coveragePerTokenStored + (((lastTimeRewardApplicable() - lastUpdateTime) * coverageRate * 10**ERC20(coverageTokenAddress).decimals()) / totalSupply); } // Code below optimizes this version of the function /*function coverageEarned(address _account) public view returns(uint256) { if (coverageTokenAddress == address(0)) { return 0; } uint256 hodlValue = lpValueWeth(lastStakedPosition[_account]); if (hodlValue == 0) { // prevent division by zero below // equivalent check would be lastStakedPosition[_account].blockTimestamp > 0 return coverage[_account]; } uint256 outValue = lpValueWeth(position(balances[_account])); uint256 cappedCoverage = (balances[_account] * (coveragePerToken() - userCoveragePerTokenPaid[_account])) / 1e18; uint256 vested = vestedCoverage( hodlValue, outValue, lastStakedPosition[_account].blockTimestamp ); if (vested > cappedCoverage) { vested = cappedCoverage; } // amount * (hodl value - out value) / hodl value = amount * (1 - (out value / hodl value)) return (vested - (vested * outValue) / hodlValue) + coverage[_account]; }*/ /** * @dev Return the total coverage earned by a user. * @param _account user wallet address * @return coverage amount earned */ function coverageEarned(address _account) public view returns(uint256) { if (coverageTokenAddress == address(0)) { return 0; } Position memory lastStake = lastStakedPosition[_account]; uint256 hodlValue = lpValueWeth(lastStake); if (hodlValue == 0) { return coverage[_account]; } uint256 outValue = lpValueWeth(position(balances[_account])); uint256 balance = balances[_account]; uint256 cappedCoverage = (balance * (coveragePerToken() - userCoveragePerTokenPaid[_account])) / 1e18; uint256 vested = vestedCoverage(hodlValue, outValue, lastStake.blockTimestamp); return (vested > cappedCoverage ? cappedCoverage : vested) - (vested * outValue) / hodlValue + coverage[_account]; } /* ========== MUTATIVE FUNCTIONS ========== */ // Optimized version of this below /* function getCoverage( address _recipient ) public nonReentrant updateCoverage(_recipient) { require( msg.sender == owner() || msg.sender == _recipient, "E14" ); require(coverageTokenAddress != address(0), "E23"); uint256 cov = coverage[_recipient]; if (cov > 0) { coverage[_recipient] = 0; IERC20(coverageTokenAddress).safeTransfer(_recipient, cov); emit CoveragePaid(_recipient, cov); } } */ /** * @dev claim the coverage for a staker * @param _recipient the address of the staker that should receive the coverage * @ return the amount of reward received */ function getCoverage(address _recipient) public nonReentrant updateCoverage(_recipient) { require(msg.sender == owner() || msg.sender == _recipient, "E14"); require(coverageTokenAddress != address(0), "E23"); uint256 cov = coverage[_recipient]; if (cov == 0) return; coverage[_recipient] = 0; IERC20(coverageTokenAddress).safeTransfer(_recipient, cov); emit CoveragePaid(_recipient, cov); } /** * @dev Set the coverage parameters if none were set in the constructor. Gives the option for farm owners to change coverage tokens. * Note: Can't change coverage token if coverage is already accumulated * @param _tokenAddress address of token to be used for coverage emissions * @param _coverageAmount total amount of coverage token to emit * @param _coverageVestingDuration vesting period in seconds that users need to have staked to claim coverage */ function setCoverage(address _tokenAddress, uint256 _coverageAmount, uint32 _coverageVestingDuration) external onlyOwner whenNotEmitting { require(coveragePerTokenStored == 0, "E24"); require( (lpToken.token0() == _tokenAddress || lpToken.token1() == _tokenAddress) && (_coverageVestingDuration >= 24 * 3600) && (_coverageVestingDuration <= rewardsDuration), "E19" ); coverageTokenAddress = _tokenAddress; coverageAmount = _coverageAmount; coverageVestingDuration = _coverageVestingDuration; } // Override startEmission() so it calls the expanded function that includes the coverage amount /** * @dev Start the emission of rewards to stakers with no coverage. The owner must send reward tokens to the contract before calling this function. * Note: Can only be called by owner when the contract is not emitting rewards. * @param _rewards array of rewards amounts for each reward token * @param _duration duration in seconds for which rewards will be emitted */ function startEmission( uint256[] memory _rewards, uint256 _duration ) public override(StakingRewards, IStakingRewards) onlyOwner { return startEmission(_rewards, 0, _duration); } /** * @dev Start the emission of rewards to stakers. The owner must send reward and coverage tokens to the contract before calling this function. * Note: Can only be called by owner when the contract is not emitting rewards. * @param _rewards array of rewards amounts for each reward token * @param _coverage total amount of coverage provided to users (worst case max) * @param _duration duration in seconds for which rewards will be emitted (and coverage will be active) */ function startEmission( uint256[] memory _rewards, uint256 _coverage, uint256 _duration ) public onlyOwner updateCoverage(address(0)) { super.startEmission(_rewards, _duration); require( coverageVestingDuration <= rewardsDuration, "E22" ); // must check again coverageRate = _coverage / rewardsDuration; // rewardsDuration, not coverageVestingDuration which can be shorter! if (coverageTokenAddress != address(0) && _coverage > 0) { // Ensure the provided coverage amount is not more than the balance in the contract uint256 balance = IERC20(coverageTokenAddress).balanceOf( address(this) ); int8 tokenIndex = rewardTokenIndex(coverageTokenAddress); if (tokenIndex >= 0) { balance -= _rewards[uint256(int256(tokenIndex))]; } require( coverageRate <= balance / rewardsDuration, "E3" ); } } /** * @dev recover leftover coverage tokens and transfer them to a specified recipient * Note: can only be called by owner when the contract is not emitting rewards * @param _recipient address to receive the recovered coverage tokens */ function recoverLeftoverCoverage(address _recipient) public onlyOwner whenNotEmitting { require(totalSupply == 0 && coverageTokenAddress != address(0), "E12/E23"); _beforeRecoverLeftoverCoverage(_recipient); IERC20 token = IERC20(coverageTokenAddress); uint256 amount = token.balanceOf(address(this)); if (amount > 0) { token.safeTransfer(_recipient, amount); emit LeftoverCoverageRecovered(_recipient, amount); } } /* ========== PRIVATE FUNCTIONS ========== */ /** * @dev Return the LP position for a given amount of LP token. * @param _amount the amount of LP token * @return the corresponding LP position (amount0, amount1, timestamp) */ function position(uint256 _amount) private view returns (Position memory) { (uint112 reserve0, uint112 reserve1, uint32 timestamp) = lpToken.getReserves(); uint256 totalAmount = lpToken.totalSupply(); return Position(uint112((_amount * reserve0) / totalAmount), uint112((_amount * reserve1) / totalAmount), timestamp); } /** * @dev Return the value in WETH of the given LP position. * @param _position LP position * @return the value in WETH */ function lpValueWeth( Position memory _position ) private view returns (uint256) { return oracle.consultWeth(lpToken.token0(), _position.amount0) + oracle.consultWeth(lpToken.token1(), _position.amount1); } /** * @dev Return the vested coverage in coverage token amount for the given HODL and OUT values since the provided timestamp. * @param _hodlValue the value (in WETH) if the tokens making up the LP were kept unpaired * @param _outValue the value (in WETH) of the LP token position * @param _lastTimestamp the start timestamp (when the LP token position was created) * @return vested coverage in coverage token amount */ function vestedCoverage( uint256 _hodlValue, uint256 _outValue, uint32 _lastTimestamp ) private view returns (uint256) { uint256 timeElapsed = block.timestamp - _lastTimestamp; uint256 wethCov = _hodlValue > _outValue ? _hodlValue - _outValue : 0; uint256 tokenCoverage = wethCov == 0 ? 0 : oracle.consult(oracle.weth(), wethCov, coverageTokenAddress); if (timeElapsed >= coverageVestingDuration) { return tokenCoverage; } return (tokenCoverage * timeElapsed) / coverageVestingDuration; } /* ========== HOOKS ========== */ /** * @dev Override _beforeStake() hook to ensure staking updates the coverage */ function _beforeStake( address _account, uint256 _amount ) internal virtual override updateCoverage(_account) returns (uint256) { return super._beforeStake(_account, _amount); } /** * @dev Override _beforeWithdraw() hook to ensure withdrawing updates the coverage */ function _beforeWithdraw( address _account, uint256 _amount ) internal virtual override updateCoverage(_account) returns (uint256) { return super._beforeWithdraw(_account, _amount); } /** * @dev Override _beforeExit() hook to claim all coverage for the account exiting */ function _beforeExit(address _account) internal virtual override { if (coverageTokenAddress != address(0)) { getCoverage(_account); } super._beforeExit(_account); } /** * @dev Override _beforeRecoverERC20() hook to prevent recovery of a coverage token */ function _beforeRecoverERC20( address _tokenAddress, address _recipient, uint256 _amount ) internal virtual override { require( _tokenAddress != coverageTokenAddress, "E16" ); super._beforeRecoverERC20(_tokenAddress, _recipient, _amount); } // New hooks /** * @dev Internal hook called before recovering leftover coverage (in the recoverLeftoverCoverage() function). * @param _recipient address to recover the leftover coverage to */ function _beforeRecoverLeftoverCoverage( address _recipient ) internal virtual {} /* ========== MODIFIERS ========== */ /** * @dev Modifier to update the coverage of a given account. * @param _account account to update coverage for */ modifier updateCoverage(address _account) { if (coverageTokenAddress != address(0)) { coveragePerTokenStored = coveragePerToken(); lastUpdateTime = lastTimeRewardApplicable(); // it seems fine to redo this here oracle.update(lpToken.token0(), oracle.weth()); // update oracle for first token oracle.update(lpToken.token1(), oracle.weth()); // ditto for the second token if (_account != address(0)) { coverage[_account] = coverageEarned(_account); userCoveragePerTokenPaid[_account] = coveragePerTokenStored; lastStakedPosition[_account] = position(balances[_account]); // don't forget to reset the last position info } } _; } } // File: contracts/ElkFactoryHelper.sol // // Copyright (c) 2023 ElkLabs // License terms: https://github.com/elkfinance/faas/blob/main/LICENSE // // Authors: // - Seth <[email protected]> // - Baal <[email protected]> // - Elijah <[email protected]> // - Snake <[email protected]> pragma solidity >=0.8.0; /** * @title contains a helper function that creates new FarmingRewards contracts in the ElkFarmFactory * @notice this is a separate contract so that the FarmFactory contract is not too large */ library ElkFactoryHelper { /** * @notice creates a new FarmingRewards contract and transfers ownership to the provided farm manager * @param _abi the abi of the FarmingRewards contract * @param _salt the salt used to create the contract * @param _farmManager the address of the farm manager */ function createFarmContract( bytes memory _abi, bytes32 _salt, address _farmManager ) external returns (address addr) { bytes memory bytecode = abi.encodePacked( type(FarmingRewards).creationCode, _abi ); assembly { addr := create2(0, add(bytecode, 0x20), mload(bytecode), _salt) if iszero(extcodesize(addr)) { revert(0, 0) } } FarmingRewards(addr).transferOwnership(_farmManager); } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract Creation Code
615b9d61003a600b82828239805160001a60731461002d57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe7300000000000000000000000000000000000000003014608060405260043610620000375760003560e01c8063c82e8b95146200003c575b600080fd5b8180156200004957600080fd5b50620000616200005b36600462000187565b6200007d565b6040516001600160a01b03909116815260200160405180910390f35b60008060405180602001620000929062000146565b601f1982820381018352601f909101166040819052620000b89190879060200162000290565b6040516020818303038152906040529050838151602083016000f59150813b620000e157600080fd5b60405163f2fde38b60e01b81526001600160a01b03848116600483015283169063f2fde38b90602401600060405180830381600087803b1580156200012557600080fd5b505af11580156200013a573d6000803e3d6000fd5b50505050509392505050565b6158b680620002b283390190565b634e487b7160e01b600052604160045260246000fd5b80356001600160a01b03811681146200018257600080fd5b919050565b6000806000606084860312156200019d57600080fd5b833567ffffffffffffffff80821115620001b657600080fd5b818601915086601f830112620001cb57600080fd5b813581811115620001e057620001e062000154565b604051601f8201601f19908116603f011681019083821181831017156200020b576200020b62000154565b816040528281528960208487010111156200022557600080fd5b8260208601602083013760006020848301015280975050505050506020840135915062000255604085016200016a565b90509250925092565b6000815160005b8181101562000281576020818501810151868301520162000265565b50600093019283525090919050565b6000620002a9620002a283866200025e565b846200025e565b94935050505056fe60e06040523480156200001157600080fd5b50604051620058b6380380620058b6833981016040819052620000349162000acf565b600160005588858585858585838383836200004f33620004c5565b6001600160a01b038116620000905760405162461bcd60e51b8152602060048201526002602482015261453160f01b60448201526064015b60405180910390fd5b6001600160a01b03811660808190526040805163313ce56760e01b8152905163313ce567916004808201926020929091908290030181865afa158015620000db573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000101919062000bd4565b6200010e90600a62000d15565b6200012290670de0b6b3a764000062000d26565b600455506200013383838362000517565b5050505060008551116200016f5760405162461bcd60e51b8152602060048201526002602482015261453960f01b604482015260640162000087565b60005b8551811015620001c257600086828151811062000193576200019362000d49565b60200260200101519050620001ae816200071660201b60201c565b50620001ba8162000d5f565b905062000172565b505050600d919091555050506001600160a01b03808b1660a05289811660c0528816156200037257876001600160a01b031660c0516001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000235573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200025b919062000d7b565b6001600160a01b03161480620002e85750876001600160a01b031660c0516001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015620002b7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620002dd919062000d7b565b6001600160a01b0316145b6200031c5760405162461bcd60e51b815260206004820152600360248201526245313960e81b604482015260640162000087565b620151808663ffffffff16101580156200033e5750600d548663ffffffff1611155b620003725760405162461bcd60e51b815260206004820152600360248201526245323160e81b604482015260640162000087565b60a0516001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015620003b3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620003d9919062000d7b565b6001600160a01b031660c0516001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000423573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000449919062000d7b565b6001600160a01b031614620004875760405162461bcd60e51b815260206004820152600360248201526204532360ec1b604482015260640162000087565b5050601380546001600160a01b0319166001600160a01b039790971696909617909555505060149190915563ffffffff166015555062000e47915050565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b815181511480156200052b5750600a815111155b80156200053e57506107d08361ffff1611155b620005715760405162461bcd60e51b8152602060048201526002602482015261453560f01b604482015260640162000087565b600080620005836107d0600162000d99565b905060005b83518110156200069c578263ffffffff16848281518110620005ae57620005ae62000d49565b602002602001015163ffffffff1611620005f05760405162461bcd60e51b8152602060048201526002602482015261453760f01b604482015260640162000087565b8185828151811062000606576200060662000d49565b602002602001015161ffff1610620006465760405162461bcd60e51b815260206004820152600260248201526108a760f31b604482015260640162000087565b8381815181106200065b576200065b62000d49565b602002602001015192508481815181106200067a576200067a62000d49565b602002602001015161ffff16915080620006949062000d5f565b905062000588565b508251620006b290600590602086019062000816565b508351620006c89060069060208701906200086e565b5061ffff85166007556040517fab4c36b25b04e6f8ac9915203aba1048c17841782324a583e98128b8c1c964f390620007079087908790879062000daf565b60405180910390a15050505050565b600a54600f1015620007515760405162461bcd60e51b815260206004820152600360248201526245313560e81b604482015260640162000087565b6001600160a01b0381166200078e5760405162461bcd60e51b8152602060048201526002602482015261453160f01b604482015260640162000087565b6001600160a01b0381166000908152600b602052604090205460ff166200081357600a805460018082019092557fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a80180546001600160a01b0319166001600160a01b0384169081179091556000908152600b60205260409020805460ff191690911790555b50565b8280548282559060005260206000209081019282156200085c579160200282015b828111156200085c578251829063ffffffff1690559160200191906001019062000837565b506200086a929150620008b2565b5090565b8280548282559060005260206000209081019282156200085c579160200282015b828111156200085c578251829061ffff169055916020019190600101906200088f565b5b808211156200086a5760008155600101620008b3565b80516001600160a01b0381168114620008e157600080fd5b919050565b805163ffffffff81168114620008e157600080fd5b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b03811182821017156200093c576200093c620008fb565b604052919050565b60006001600160401b03821115620009605762000960620008fb565b5060051b60200190565b600082601f8301126200097c57600080fd5b81516020620009956200098f8362000944565b62000911565b82815260059290921b84018101918181019086841115620009b557600080fd5b8286015b84811015620009db57620009cd81620008c9565b8352918301918301620009b9565b509695505050505050565b805161ffff81168114620008e157600080fd5b600082601f83011262000a0b57600080fd5b8151602062000a1e6200098f8362000944565b82815260059290921b8401810191818101908684111562000a3e57600080fd5b8286015b84811015620009db5762000a5681620009e6565b835291830191830162000a42565b600082601f83011262000a7657600080fd5b8151602062000a896200098f8362000944565b82815260059290921b8401810191818101908684111562000aa957600080fd5b8286015b84811015620009db5762000ac181620008e6565b835291830191830162000aad565b6000806000806000806000806000806101408b8d03121562000af057600080fd5b62000afb8b620008c9565b995062000b0b60208c01620008c9565b985062000b1b60408c01620008c9565b975060608b0151965062000b3260808c01620008e6565b60a08c01519096506001600160401b038082111562000b5057600080fd5b62000b5e8e838f016200096a565b965060c08d0151955062000b7560e08e01620009e6565b94506101008d015191508082111562000b8d57600080fd5b62000b9b8e838f01620009f9565b93506101208d015191508082111562000bb357600080fd5b5062000bc28d828e0162000a64565b9150509295989b9194979a5092959850565b60006020828403121562000be757600080fd5b815160ff8116811462000bf957600080fd5b9392505050565b634e487b7160e01b600052601160045260246000fd5b600181815b8085111562000c5757816000190482111562000c3b5762000c3b62000c00565b8085161562000c4957918102915b93841c939080029062000c1b565b509250929050565b60008262000c705750600162000d0f565b8162000c7f5750600062000d0f565b816001811462000c98576002811462000ca35762000cc3565b600191505062000d0f565b60ff84111562000cb75762000cb762000c00565b50506001821b62000d0f565b5060208310610133831016604e8410600b841016171562000ce8575081810a62000d0f565b62000cf4838362000c16565b806000190482111562000d0b5762000d0b62000c00565b0290505b92915050565b600062000bf960ff84168362000c5f565b60008262000d4457634e487b7160e01b600052601260045260246000fd5b500490565b634e487b7160e01b600052603260045260246000fd5b60006001820162000d745762000d7462000c00565b5060010190565b60006020828403121562000d8e57600080fd5b62000bf982620008c9565b8082018082111562000d0f5762000d0f62000c00565b60006060820161ffff80871684526020606081860152828751808552608087019150828901945060005b8181101562000df957855185168352948301949183019160010162000dd9565b5050858103604087015286518082529082019350915080860160005b8381101562000e3957815163ffffffff168552938201939082019060010162000e15565b509298975050505050505050565b60805160a05160c05161492e62000f8860003960008181610520015281816114d8015281816115740152818161188f01528181611a2201528181611e2a01528181611fbd015281816127af015281816128db01528181612a0101528181612a8b01528181612fed01528181613180015281816135bd01526137500152600081816106330152818161186001528181611911015281816119f301528181611aa401528181611dfb01528181611eac01528181611f8e0152818161203f01528181612780015281816128ac01528181612bc401528181612bf301528181612fbe0152818161306f01528181613151015281816132020152818161358e0152818161363f0152818161372101526137d20152600081816105c101528181610a1b01528181610d2c015281816116e2015281816117cf0152613ca3015261492e6000f3fe608060405234801561001057600080fd5b506004361061036d5760003560e01c80637aaeaf7f116101d3578063ab87982711610104578063ebe2b12b116100a2578063f2d176391161007c578063f2d1763914610831578063f2fde38b14610844578063f9cb1d0414610857578063f9ea07781461086057600080fd5b8063ebe2b12b146107a5578063ef2849b3146107ae578063f12297771461081e57600080fd5b8063ca423031116100de578063ca4230311461074c578063e13d87221461075f578063e70b9e2714610772578063e9fad8ee1461079d57600080fd5b8063ab87982714610727578063ad3bc54614610730578063c8f33c911461074357600080fd5b80638da5cb5b116101715780639ce43f901161014b5780639ce43f90146106a65780639e3582c8146106c6578063a694fc3a146106d9578063a7309d7d146106ec57600080fd5b80638da5cb5b146106835780639003adfe1461069457806399d531e11461069d57600080fd5b80637dc0d1d0116101ad5780637dc0d1d01461062e57806380faa57d146106555780638194c1781461065d57806387e7ed3a1461067057600080fd5b80637aaeaf7f146105ff5780637bb7bed1146106125780637beb3d9f1461062557600080fd5b8063415be3b5116102ad5780636b0916951161024b578063715018a611610225578063715018a6146105b457806372f702f3146105bc578063757767d7146105e357806379ee54f7146105ec57600080fd5b80636b091695146105635780636da9c58e146105765780637035ab981461058957600080fd5b8063502cd30f11610287578063502cd30f146104e857806354feec3e146105085780635fcbd2851461051b57806367c0d00f1461055a57600080fd5b8063415be3b5146104a7578063423c485a146104cd578063486e63b1146104e057600080fd5b8063211dc32d1161031a5780632e9f0602116102f45780632e9f06021461044b578063330244301461045e578063386a95251461047e5780633d3b26031461048757600080fd5b8063211dc32d1461040557806327e235e3146104185780632e1a7d4d1461043857600080fd5b806318160ddd1161034b57806318160ddd146103b65780631c03e6cc146103bf5780631db7efd8146103d257600080fd5b806301f59d161461037257806304a79e481461038e5780631171bda9146103a1575b600080fd5b61037b6107d081565b6040519081526020015b60405180910390f35b61037b61039c36600461436f565b610873565b6103b46103af36600461438c565b610a09565b005b61037b60025481565b6103b46103cd36600461436f565b610b01565b6103f56103e036600461436f565b600b6020526000908152604090205460ff1681565b6040519015158152602001610385565b61037b6104133660046143cd565b610b4c565b61037b61042636600461436f565b60036020526000908152604090205481565b6103b4610446366004614406565b610c57565b6103b46104593660046144c5565b610d94565b61037b61046c36600461436f565b60196020526000908152604090205481565b61037b600d5481565b61037b61049536600461436f565b600f6020526000908152604090205481565b6104ba6104b536600461436f565b610dac565b60405160009190910b8152602001610385565b61037b6104db366004614406565b610e32565b61037b610e5f565b61037b6104f636600461436f565b60186020526000908152604090205481565b61037b610516366004614406565b610f3f565b6105427f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610385565b61037b60145481565b6103b46105713660046143cd565b610f60565b6103b461058436600461436f565b6110a1565b61037b6105973660046143cd565b601160209081526000928352604080842090915290825290205481565b6103b46111c6565b6105427f000000000000000000000000000000000000000000000000000000000000000081565b61037b60155481565b6103b46105fa36600461436f565b6111da565b61037b61060d36600461450a565b611360565b610542610620366004614406565b611416565b61037b61271081565b6105427f000000000000000000000000000000000000000000000000000000000000000081565b61037b611440565b6103b461066b366004614548565b611457565b6103b461067e36600461436f565b611689565b6001546001600160a01b0316610542565b61037b60085481565b61037b60165481565b61037b6106b436600461436f565b60106020526000908152604090205481565b61037b6106d4366004614406565b611714565b6103b46106e7366004614406565b611724565b6107126106fa36600461436f565b60096020526000908152604090205463ffffffff1681565b60405163ffffffff9091168152602001610385565b61037b60075481565b6103b461073e36600461458a565b611829565b61037b600e5481565b6103b461075a36600461436f565b611dc5565b601354610542906001600160a01b031681565b61037b6107803660046143cd565b601260209081526000928352604080842090915290825290205481565b6103b4612311565b61037b600c5481565b6107f26107bc36600461436f565b601a602052600090815260409020546001600160701b0380821691600160701b810490911690600160e01b900463ffffffff1683565b604080516001600160701b03948516815293909216602084015263ffffffff1690820152606001610385565b61037b61082c36600461436f565b612333565b6103b461083f3660046143cd565b61243a565b6103b461085236600461436f565b6125a2565b61037b60175481565b6103b461086e36600461436f565b612618565b6013546000906001600160a01b031661088e57506000919050565b6001600160a01b0382166000908152601a60209081526040808320815160608101835290546001600160701b038082168352600160701b82041693820193909352600160e01b90920463ffffffff1690820152906108eb8261277c565b905080600003610913575050506001600160a01b031660009081526019602052604090205490565b6001600160a01b03841660009081526003602052604081205461093e90610939906129dd565b61277c565b6001600160a01b038616600090815260036020908152604080832054601890925282205492935091670de0b6b3a764000090610978610e5f565b61098291906145ee565b61098c9084614601565b6109969190614618565b905060006109a985858860400151612b89565b6001600160a01b038916600090815260196020526040902054909150856109d08684614601565b6109da9190614618565b8383116109e757826109e9565b835b6109f391906145ee565b6109fd919061463a565b98975050505050505050565b610a11612d2d565b610a19612d86565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b031603610a845760405162461bcd60e51b8152602060048201526002602482015261114d60f21b60448201526064015b60405180910390fd5b610a8f838383612de0565b82610aa46001600160a01b0382168484612e2f565b826001600160a01b0316846001600160a01b03167ffff3b3844276f57024e0b42afec1a37f75db36511e43819a4f2a63ab7862b64884604051610ae991815260200190565b60405180910390a350610afc6001600055565b505050565b610b09612d86565b600c544211610b405760405162461bcd60e51b815260206004820152600360248201526245313760e81b6044820152606401610a7b565b610b4981612e92565b50565b6001600160a01b038083166000818152601260209081526040808320948616835293815283822054845163313ce56760e01b81529451929490939263313ce567926004808401939192918290030181865afa158015610baf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bd3919061464d565b610bde90600a614754565b6001600160a01b03808616600090815260116020908152604080832093881683529290522054610c0d86612333565b610c1791906145ee565b6001600160a01b038516600090815260036020526040902054610c3a9190614601565b610c449190614618565b610c4e919061463a565b90505b92915050565b610c5f612d2d565b80610c6a3382612f8d565b9150600082118015610c8b5750336000908152600360205260409020548211155b8015610ca65750336000908152600360205260409020548111155b610cd75760405162461bcd60e51b8152602060048201526002602482015261453360f01b6044820152606401610a7b565b600454610ce49082614601565b60026000828254610cf591906145ee565b90915550503360009081526003602052604081208054839290610d199084906145ee565b90915550610d5390506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163384612e2f565b60405182815233907f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5906020015b60405180910390a250610b496001600055565b610d9c612d86565b610da882600083611829565b5050565b6001600160a01b0381166000908152600b602052604081205460ff1615610e295760005b600a54811015610e2757826001600160a01b0316600a8281548110610df757610df7614763565b6000918252602090912001546001600160a01b031603610e175792915050565b610e2081614779565b9050610dd0565b505b50600019919050565b60008060075411610e44576000610c51565b61271060075483610e559190614601565b610c519190614618565b6000600254600014610f3857600254601360009054906101000a90046001600160a01b03166001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ec1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ee5919061464d565b610ef090600a614754565b601654600e54610efe611440565b610f0891906145ee565b610f129190614601565b610f1c9190614601565b610f269190614618565b601754610f33919061463a565b905090565b5060175490565b60058181548110610f4f57600080fd5b600091825260209091200154905081565b610f68612d2d565b8060005b600a54811015610fd5576000600a8281548110610f8b57610f8b614763565b6000918252602090912001546001600160a01b03169050610fab81612333565b6001600160a01b03909116600090815260106020526040902055610fce81614779565b9050610f6c565b50610fde611440565b600e556001600160a01b0381161561108c5760005b600a5481101561108a576000600a828154811061101257611012614763565b6000918252602090912001546001600160a01b031690506110338184610b4c565b6001600160a01b0391821660008181526012602090815260408083209588168084529582528083209490945591815260108252828120546011835283822094825293909152205561108381614779565b9050610ff3565b505b61109683836133b6565b50610da86001600055565b6110a9612d2d565b6110b1612d86565b600c544211156110e95760405162461bcd60e51b815260206004820152600360248201526208a62760eb1b6044820152606401610a7b565b600042600c5411156111065742600c5461110391906145ee565b90505b42600c5560005b600a54811015611191576000600a828154811061112c5761112c614763565b60009182526020808320909101546001600160a01b0316808352600f9091526040822054909250829190611161908690614601565b9050801561117d5761117d6001600160a01b0384168783612e2f565b5050508061118a90614779565b905061110d565b506040517f9bad5e1e43bc35e89725967a54f4bc384078248a1ea5c315be3b260a68cbb17a90600090a150610b496001600055565b6111ce612d86565b6111d8600061350b565b565b6111e2612d2d565b8060005b600a5481101561124f576000600a828154811061120557611205614763565b6000918252602090912001546001600160a01b0316905061122581612333565b6001600160a01b0390911660009081526010602052604090205561124881614779565b90506111e6565b50611258611440565b600e556001600160a01b038116156113065760005b600a54811015611304576000600a828154811061128c5761128c614763565b6000918252602090912001546001600160a01b031690506112ad8184610b4c565b6001600160a01b039182166000818152601260209081526040808320958816808452958252808320949094559181526010825282812054601183528382209482529390915220556112fd81614779565b905061126d565b505b60005b600a5481101561135457611344600a828154811061132957611329614763565b6000918252602090912001546001600160a01b0316846133b6565b61134d81614779565b9050611309565b5050610b496001600055565b6001600160a01b038216600090815260096020526040812054819061138b9063ffffffff16426145ee565b90506000805b60055481101561140d57600581815481106113ae576113ae614763565b90600052602060002001548310156113fd57612710600682815481106113d6576113d6614763565b9060005260206000200154866113ec9190614601565b6113f69190614618565b915061140d565b61140681614779565b9050611391565b50949350505050565b600a818154811061142657600080fd5b6000918252602090912001546001600160a01b0316905081565b6000600c5442106114525750600c5490565b504290565b61145f612d86565b600c5442116114965760405162461bcd60e51b815260206004820152600360248201526245313760e81b6044820152606401610a7b565b601754156114cc5760405162461bcd60e51b8152602060048201526003602482015262114c8d60ea1b6044820152606401610a7b565b826001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015611534573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115589190614792565b6001600160a01b031614806115ff5750826001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa1580156115d0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115f49190614792565b6001600160a01b0316145b80156116145750620151808163ffffffff1610155b80156116285750600d548163ffffffff1611155b61165a5760405162461bcd60e51b815260206004820152600360248201526245313960e81b6044820152606401610a7b565b601380546001600160a01b0319166001600160a01b03949094169390931790925560145563ffffffff16601555565b611691612d86565b611699612d2d565b6008805460009091556040518181527f6857c770f3cb43e9c19050a37dd914ec876241c1f4b487d26a1d4f5d3054f49b9060200160405180910390a16117096001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168383612e2f565b50610b496001600055565b60068181548110610f4f57600080fd5b61172c612d2d565b80611737338261355d565b91506000821180156117495750600081115b61177a5760405162461bcd60e51b8152602060048201526002602482015261229960f11b6044820152606401610a7b565b6004546117879083614601565b60026000828254611798919061463a565b909155505033600090815260036020526040812080548492906117bc90849061463a565b909155506117f790506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001633308461397e565b60405182815233907f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d90602001610d81565b611831612d86565b6013546000906001600160a01b031615611c465761184d610e5f565b601755611858611440565b600e819055507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663c640752d7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa1580156118eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061190f9190614792565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633fc8cef36040518163ffffffff1660e01b8152600401602060405180830381865afa15801561196d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119919190614792565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401600060405180830381600087803b1580156119d957600080fd5b505af11580156119ed573d6000803e3d6000fd5b505050507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663c640752d7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015611a7e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611aa29190614792565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633fc8cef36040518163ffffffff1660e01b8152600401602060405180830381865afa158015611b00573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b249190614792565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401600060405180830381600087803b158015611b6c57600080fd5b505af1158015611b80573d6000803e3d6000fd5b505050506001600160a01b03811615611c4657611b9c81610873565b6001600160a01b0382166000908152601960209081526040808320939093556017546018825283832055600390522054611bd5906129dd565b6001600160a01b0382166000908152601a60209081526040918290208351815492850151949093015163ffffffff16600160e01b026001600160e01b036001600160701b03958616600160701b026001600160e01b0319909416959094169490941791909117919091169190911790555b611c5084836139b6565b600d546015541115611c8a5760405162461bcd60e51b815260206004820152600360248201526222991960e91b6044820152606401610a7b565b600d54611c979084614618565b6016556013546001600160a01b031615801590611cb45750600083115b15611dbf576013546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa158015611d02573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d2691906147af565b601354909150600090611d41906001600160a01b0316610dac565b905060008160000b12611d7957858160000b81518110611d6357611d63614763565b602002602001015182611d7691906145ee565b91505b600d54611d869083614618565b6016541115611dbc5760405162461bcd60e51b8152602060048201526002602482015261453360f01b6044820152606401610a7b565b50505b50505050565b611dcd612d2d565b60135481906001600160a01b0316156121e157611de8610e5f565b601755611df3611440565b600e819055507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663c640752d7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015611e86573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611eaa9190614792565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633fc8cef36040518163ffffffff1660e01b8152600401602060405180830381865afa158015611f08573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f2c9190614792565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401600060405180830381600087803b158015611f7457600080fd5b505af1158015611f88573d6000803e3d6000fd5b505050507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663c640752d7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015612019573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061203d9190614792565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633fc8cef36040518163ffffffff1660e01b8152600401602060405180830381865afa15801561209b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120bf9190614792565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401600060405180830381600087803b15801561210757600080fd5b505af115801561211b573d6000803e3d6000fd5b505050506001600160a01b038116156121e15761213781610873565b6001600160a01b0382166000908152601960209081526040808320939093556017546018825283832055600390522054612170906129dd565b6001600160a01b0382166000908152601a60209081526040918290208351815492850151949093015163ffffffff16600160e01b026001600160e01b036001600160701b03958616600160701b026001600160e01b0319909416959094169490941791909117919091169190911790555b6001546001600160a01b03163314806122025750336001600160a01b038316145b6122345760405162461bcd60e51b8152602060048201526003602482015262114c4d60ea1b6044820152606401610a7b565b6013546001600160a01b03166122725760405162461bcd60e51b815260206004820152600360248201526245323360e81b6044820152606401610a7b565b6001600160a01b038216600090815260196020526040812054908190036122995750611709565b6001600160a01b038084166000908152601960205260408120556013546122c291168483612e2f565b826001600160a01b03167fef4696bdcf47e292773442e4169d670e1b2d0d3f5ceff2a5c1e236c10109ee80826040516122fd91815260200190565b60405180910390a25050610b496001600055565b61231a33613e0d565b336000908152600360205260409020546111d890610c57565b600060025460000361235b57506001600160a01b031660009081526010602052604090205490565b600254826001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa15801561239c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123c0919061464d565b6123cb90600a614754565b6001600160a01b0384166000908152600f6020526040902054600e546123ef611440565b6123f991906145ee565b6124039190614601565b61240d9190614601565b6124179190614618565b6001600160a01b038316600090815260106020526040902054610c51919061463a565b612442612d86565b600c5442116124795760405162461bcd60e51b815260206004820152600360248201526245313760e81b6044820152606401610a7b565b600254156124af5760405162461bcd60e51b815260206004820152600360248201526222989960e91b6044820152606401610a7b565b6001600160a01b0382166000908152600b602052604090205460ff1615610da8576040516370a0823160e01b815230600482015282906000906001600160a01b038316906370a0823190602401602060405180830381865afa158015612519573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061253d91906147af565b90508015612559576125596001600160a01b0383168483612e2f565b826001600160a01b03167fcaa95c7b01f93ffe197f5e7316a1a2f387c5bfff8cb445095f2110ff5c1b29958260405161259491815260200190565b60405180910390a250505050565b6125aa612d86565b6001600160a01b03811661260f5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610a7b565b610b498161350b565b612620612d86565b600c5442116126575760405162461bcd60e51b815260206004820152600360248201526245313760e81b6044820152606401610a7b565b60025415801561267157506013546001600160a01b031615155b6126a75760405162461bcd60e51b81526020600482015260076024820152664531322f45323360c81b6044820152606401610a7b565b6013546040516370a0823160e01b81523060048201526001600160a01b039091169060009082906370a0823190602401602060405180830381865afa1580156126f4573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061271891906147af565b90508015610afc576127346001600160a01b0383168483612e2f565b826001600160a01b03167fcf018d466bd581a77eafe1429d5f079ea9a4a7363785b0561c51c9a8f2925c3c8260405161276f91815260200190565b60405180910390a2505050565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316631421f7307f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa15801561280b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061282f9190614792565b60208501516040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526001600160701b03166024820152604401602060405180830381865afa158015612886573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128aa91906147af565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316631421f7307f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015612937573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061295b9190614792565b855160405160e084901b6001600160e01b03191681526001600160a01b0390921660048301526001600160701b03166024820152604401602060405180830381865afa1580156129af573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129d391906147af565b610c51919061463a565b604080516060810182526000808252602082018190529181019190915260008060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316630902f1ac6040518163ffffffff1660e01b8152600401606060405180830381865afa158015612a5d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a8191906147df565b92509250925060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612ae7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b0b91906147af565b9050604051806060016040528082866001600160701b031689612b2e9190614601565b612b389190614618565b6001600160701b0316815260200182856001600160701b031689612b5c9190614601565b612b669190614618565b6001600160701b031681526020018363ffffffff16815250945050505050919050565b600080612b9c63ffffffff8416426145ee565b90506000848611612bae576000612bb8565b612bb885876145ee565b905060008115612cf1577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316638c86f1e47f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633fc8cef36040518163ffffffff1660e01b8152600401602060405180830381865afa158015612c4f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c739190614792565b60135460405160e084901b6001600160e01b03191681526001600160a01b0392831660048201526024810187905291166044820152606401602060405180830381865afa158015612cc8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612cec91906147af565b612cf4565b60005b90506015548310612d09579250612d26915050565b601554612d168483614601565b612d209190614618565b93505050505b9392505050565b600260005403612d7f5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610a7b565b6002600055565b6001546001600160a01b031633146111d85760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610a7b565b6013546001600160a01b0390811690841603612e245760405162461bcd60e51b815260206004820152600360248201526222989b60e91b6044820152606401610a7b565b610afc838383613e30565b6040516001600160a01b038316602482015260448101829052610afc90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152613e7f565b600a54600f1015612ecb5760405162461bcd60e51b815260206004820152600360248201526245313560e81b6044820152606401610a7b565b6001600160a01b038116612f065760405162461bcd60e51b8152602060048201526002602482015261453160f01b6044820152606401610a7b565b6001600160a01b0381166000908152600b602052604090205460ff16610b4957600a805460018181019092557fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a80180546001600160a01b0384166001600160a01b031990911681179091556000908152600b60205260409020805460ff1916909117905550565b60135460009083906001600160a01b0316156133a457612fab610e5f565b601755612fb6611440565b600e819055507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663c640752d7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015613049573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061306d9190614792565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633fc8cef36040518163ffffffff1660e01b8152600401602060405180830381865afa1580156130cb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130ef9190614792565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401600060405180830381600087803b15801561313757600080fd5b505af115801561314b573d6000803e3d6000fd5b505050507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663c640752d7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa1580156131dc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132009190614792565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633fc8cef36040518163ffffffff1660e01b8152600401602060405180830381865afa15801561325e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132829190614792565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401600060405180830381600087803b1580156132ca57600080fd5b505af11580156132de573d6000803e3d6000fd5b505050506001600160a01b038116156133a4576132fa81610873565b6001600160a01b0382166000908152601960209081526040808320939093556017546018825283832055600390522054613333906129dd565b6001600160a01b0382166000908152601a60209081526040918290208351815492850151949093015163ffffffff16600160e01b026001600160e01b036001600160701b03958616600160701b026001600160e01b0319909416959094169490941791909117919091169190911790555b6133ae8484613f51565b949350505050565b6001546001600160a01b03163314806133d75750336001600160a01b038216145b6134095760405162461bcd60e51b8152602060048201526003602482015262114c4d60ea1b6044820152606401610a7b565b6001600160a01b0382166000908152600b602052604090205460ff166134575760405162461bcd60e51b815260206004820152600360248201526245313360e81b6044820152606401610a7b565b6001600160a01b038083166000908152601260209081526040808320938516835292905220548015610afc576001600160a01b0380841660008181526012602090815260408083209487168352939052918220919091556134b9908383612e2f565b816001600160a01b0316836001600160a01b03167f540798df468d7b23d11f156fdb954cb19ad414d150722a7b6d55ba369dea792e836040516134fe91815260200190565b60405180910390a3505050565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60135460009083906001600160a01b0316156139745761357b610e5f565b601755613586611440565b600e819055507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663c640752d7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015613619573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061363d9190614792565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633fc8cef36040518163ffffffff1660e01b8152600401602060405180830381865afa15801561369b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136bf9190614792565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401600060405180830381600087803b15801561370757600080fd5b505af115801561371b573d6000803e3d6000fd5b505050507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663c640752d7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa1580156137ac573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137d09190614792565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633fc8cef36040518163ffffffff1660e01b8152600401602060405180830381865afa15801561382e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906138529190614792565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401600060405180830381600087803b15801561389a57600080fd5b505af11580156138ae573d6000803e3d6000fd5b505050506001600160a01b03811615613974576138ca81610873565b6001600160a01b0382166000908152601960209081526040808320939093556017546018825283832055600390522054613903906129dd565b6001600160a01b0382166000908152601a60209081526040918290208351815492850151949093015163ffffffff16600160e01b026001600160e01b036001600160701b03958616600160701b026001600160e01b0319909416959094169490941791909117919091169190911790555b6133ae8484613fd0565b6040516001600160a01b0380851660248301528316604482015260648101829052611dbf9085906323b872dd60e01b90608401612e5b565b6139be612d2d565b6139c6612d86565b600c5442116139fd5760405162461bcd60e51b815260206004820152600360248201526245313760e81b6044820152606401610a7b565b6000805b600a54811015613a6a576000600a8281548110613a2057613a20614763565b6000918252602090912001546001600160a01b03169050613a4081612333565b6001600160a01b03909116600090815260106020526040902055613a6381614779565b9050613a01565b50613a73611440565b600e556001600160a01b03811615613b215760005b600a54811015613b1f576000600a8281548110613aa757613aa7614763565b6000918252602090912001546001600160a01b03169050613ac88184610b4c565b6001600160a01b03918216600081815260126020908152604080832095881680845295825280832094909455918152601082528281205460118352838220948252939091522055613b1881614779565b9050613a88565b505b60008211613b575760405162461bcd60e51b815260206004820152600360248201526204531360ec1b6044820152606401610a7b565b600a54835114613b8f5760405162461bcd60e51b815260206004820152600360248201526245313160e81b6044820152606401610a7b565b600d82905560005b600a54811015613db2576000600a8281548110613bb657613bb6614763565b600091825260209091200154600d5486516001600160a01b0390921692508291879085908110613be857613be8614763565b6020026020010151613bfa9190614618565b6001600160a01b0382166000908152600f6020526040812091909155600a805485908110613c2a57613c2a614763565b6000918252602090912001546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa158015613c7b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613c9f91906147af565b90507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316826001600160a01b031614613d3857600d54613ce79082614618565b6001600160a01b0383166000908152600f60205260409020541115613d335760405162461bcd60e51b8152602060048201526002602482015261453360f01b6044820152606401610a7b565b613d9e565b600d54600254613d4890836145ee565b613d529190614618565b6001600160a01b0383166000908152600f60205260409020541115613d9e5760405162461bcd60e51b8152602060048201526002602482015261453360f01b6044820152606401610a7b565b50505080613dab90614779565b9050613b97565b5042600e819055600d54613dc59161463a565b600c556040517faab1f55dce0d0e628e283ce1061d0afccffcf61f9c14391c899b5952492ce82190613dfa908590859061481b565b60405180910390a150610da86001600055565b6013546001600160a01b031615613e2757613e2781611dc5565b610b4981614138565b6001600160a01b0383166000908152600b602052604090205460ff1615610afc5760405162461bcd60e51b815260206004820152600360248201526222989b60e91b6044820152606401610a7b565b6000613ed4826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166141419092919063ffffffff16565b805190915015610afc5780806020019051810190613ef29190614863565b610afc5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610a7b565b600080613f5e8484611360565b90508015613fbd578060086000828254613f78919061463a565b90915550506040518181526001600160a01b038516907fd0b34aaed5c558a8df736a5aaf9a49b539c4e86fb3ee5a1ac76e0bec23cbdd03906020015b60405180910390a25b6133ae84613fcb83866145ee565b919050565b6000600c5442111561400a5760405162461bcd60e51b815260206004820152600360248201526208a62760eb1b6044820152606401610a7b565b8260005b600a54811015614077576000600a828154811061402d5761402d614763565b6000918252602090912001546001600160a01b0316905061404d81612333565b6001600160a01b0390911660009081526010602052604090205561407081614779565b905061400e565b50614080611440565b600e556001600160a01b0381161561412e5760005b600a5481101561412c576000600a82815481106140b4576140b4614763565b6000918252602090912001546001600160a01b031690506140d58184610b4c565b6001600160a01b0391821660008181526012602090815260408083209588168084529582528083209490945591815260108252828120546011835283822094825293909152205561412581614779565b9050614095565b505b6133ae8484614150565b610b49816111da565b60606133ae84846000856141e1565b60008061415c83610e32565b6001600160a01b0385166000908152600960205260409020805463ffffffff19164263ffffffff1617905590508015613fbd5780600860008282546141a1919061463a565b90915550506040518181526001600160a01b038516907f34f2a7363b1ef64b0b62a223c88cf3f54a68686acfcb9531d7deb46004f37c4690602001613fb4565b6060824710156142425760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610a7b565b600080866001600160a01b0316858760405161425e91906148a9565b60006040518083038185875af1925050503d806000811461429b576040519150601f19603f3d011682016040523d82523d6000602084013e6142a0565b606091505b50915091506142b1878383876142bc565b979650505050505050565b6060831561432b578251600003614324576001600160a01b0385163b6143245760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610a7b565b50816133ae565b6133ae83838151156143405781518083602001fd5b8060405162461bcd60e51b8152600401610a7b91906148c5565b6001600160a01b0381168114610b4957600080fd5b60006020828403121561438157600080fd5b8135612d268161435a565b6000806000606084860312156143a157600080fd5b83356143ac8161435a565b925060208401356143bc8161435a565b929592945050506040919091013590565b600080604083850312156143e057600080fd5b82356143eb8161435a565b915060208301356143fb8161435a565b809150509250929050565b60006020828403121561441857600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b600082601f83011261444657600080fd5b8135602067ffffffffffffffff808311156144635761446361441f565b8260051b604051601f19603f830116810181811084821117156144885761448861441f565b6040529384528581018301938381019250878511156144a657600080fd5b83870191505b848210156142b1578135835291830191908301906144ac565b600080604083850312156144d857600080fd5b823567ffffffffffffffff8111156144ef57600080fd5b6144fb85828601614435565b95602094909401359450505050565b6000806040838503121561451d57600080fd5b82356145288161435a565b946020939093013593505050565b63ffffffff81168114610b4957600080fd5b60008060006060848603121561455d57600080fd5b83356145688161435a565b925060208401359150604084013561457f81614536565b809150509250925092565b60008060006060848603121561459f57600080fd5b833567ffffffffffffffff8111156145b657600080fd5b6145c286828701614435565b9660208601359650604090950135949350505050565b634e487b7160e01b600052601160045260246000fd5b81810381811115610c5157610c516145d8565b8082028115828204841417610c5157610c516145d8565b60008261463557634e487b7160e01b600052601260045260246000fd5b500490565b80820180821115610c5157610c516145d8565b60006020828403121561465f57600080fd5b815160ff81168114612d2657600080fd5b600181815b808511156146ab578160001904821115614691576146916145d8565b8085161561469e57918102915b93841c9390800290614675565b509250929050565b6000826146c257506001610c51565b816146cf57506000610c51565b81600181146146e557600281146146ef5761470b565b6001915050610c51565b60ff841115614700576147006145d8565b50506001821b610c51565b5060208310610133831016604e8410600b841016171561472e575081810a610c51565b6147388383614670565b806000190482111561474c5761474c6145d8565b029392505050565b6000610c4e60ff8416836146b3565b634e487b7160e01b600052603260045260246000fd5b60006001820161478b5761478b6145d8565b5060010190565b6000602082840312156147a457600080fd5b8151612d268161435a565b6000602082840312156147c157600080fd5b5051919050565b80516001600160701b0381168114613fcb57600080fd5b6000806000606084860312156147f457600080fd5b6147fd846147c8565b925061480b602085016147c8565b9150604084015161457f81614536565b604080825283519082018190526000906020906060840190828701845b8281101561485457815184529284019290840190600101614838565b50505092019290925292915050565b60006020828403121561487557600080fd5b81518015158114612d2657600080fd5b60005b838110156148a0578181015183820152602001614888565b50506000910152565b600082516148bb818460208701614885565b9190910192915050565b60208152600082518060208401526148e4816040850160208701614885565b601f01601f1916919091016040019291505056fea2646970667358221220c5101d6ea5bbb14fbabae9d6fb47659e7e4799122c193d590b35a0d68c4e4a2664736f6c63430008130033a2646970667358221220de4ebe46bbcfb24012671f7e6a076eeb6f0c7113d533fc0bc7f521df7bfb6e2264736f6c63430008130033
Deployed Bytecode
0x7340d4014b60dd73c7087d39b895aad2a6985781753014608060405260043610620000375760003560e01c8063c82e8b95146200003c575b600080fd5b8180156200004957600080fd5b50620000616200005b36600462000187565b6200007d565b6040516001600160a01b03909116815260200160405180910390f35b60008060405180602001620000929062000146565b601f1982820381018352601f909101166040819052620000b89190879060200162000290565b6040516020818303038152906040529050838151602083016000f59150813b620000e157600080fd5b60405163f2fde38b60e01b81526001600160a01b03848116600483015283169063f2fde38b90602401600060405180830381600087803b1580156200012557600080fd5b505af11580156200013a573d6000803e3d6000fd5b50505050509392505050565b6158b680620002b283390190565b634e487b7160e01b600052604160045260246000fd5b80356001600160a01b03811681146200018257600080fd5b919050565b6000806000606084860312156200019d57600080fd5b833567ffffffffffffffff80821115620001b657600080fd5b818601915086601f830112620001cb57600080fd5b813581811115620001e057620001e062000154565b604051601f8201601f19908116603f011681019083821181831017156200020b576200020b62000154565b816040528281528960208487010111156200022557600080fd5b8260208601602083013760006020848301015280975050505050506020840135915062000255604085016200016a565b90509250925092565b6000815160005b8181101562000281576020818501810151868301520162000265565b50600093019283525090919050565b6000620002a9620002a283866200025e565b846200025e565b94935050505056fe60e06040523480156200001157600080fd5b50604051620058b6380380620058b6833981016040819052620000349162000acf565b600160005588858585858585838383836200004f33620004c5565b6001600160a01b038116620000905760405162461bcd60e51b8152602060048201526002602482015261453160f01b60448201526064015b60405180910390fd5b6001600160a01b03811660808190526040805163313ce56760e01b8152905163313ce567916004808201926020929091908290030181865afa158015620000db573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000101919062000bd4565b6200010e90600a62000d15565b6200012290670de0b6b3a764000062000d26565b600455506200013383838362000517565b5050505060008551116200016f5760405162461bcd60e51b8152602060048201526002602482015261453960f01b604482015260640162000087565b60005b8551811015620001c257600086828151811062000193576200019362000d49565b60200260200101519050620001ae816200071660201b60201c565b50620001ba8162000d5f565b905062000172565b505050600d919091555050506001600160a01b03808b1660a05289811660c0528816156200037257876001600160a01b031660c0516001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000235573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200025b919062000d7b565b6001600160a01b03161480620002e85750876001600160a01b031660c0516001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015620002b7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620002dd919062000d7b565b6001600160a01b0316145b6200031c5760405162461bcd60e51b815260206004820152600360248201526245313960e81b604482015260640162000087565b620151808663ffffffff16101580156200033e5750600d548663ffffffff1611155b620003725760405162461bcd60e51b815260206004820152600360248201526245323160e81b604482015260640162000087565b60a0516001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015620003b3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620003d9919062000d7b565b6001600160a01b031660c0516001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000423573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000449919062000d7b565b6001600160a01b031614620004875760405162461bcd60e51b815260206004820152600360248201526204532360ec1b604482015260640162000087565b5050601380546001600160a01b0319166001600160a01b039790971696909617909555505060149190915563ffffffff166015555062000e47915050565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b815181511480156200052b5750600a815111155b80156200053e57506107d08361ffff1611155b620005715760405162461bcd60e51b8152602060048201526002602482015261453560f01b604482015260640162000087565b600080620005836107d0600162000d99565b905060005b83518110156200069c578263ffffffff16848281518110620005ae57620005ae62000d49565b602002602001015163ffffffff1611620005f05760405162461bcd60e51b8152602060048201526002602482015261453760f01b604482015260640162000087565b8185828151811062000606576200060662000d49565b602002602001015161ffff1610620006465760405162461bcd60e51b815260206004820152600260248201526108a760f31b604482015260640162000087565b8381815181106200065b576200065b62000d49565b602002602001015192508481815181106200067a576200067a62000d49565b602002602001015161ffff16915080620006949062000d5f565b905062000588565b508251620006b290600590602086019062000816565b508351620006c89060069060208701906200086e565b5061ffff85166007556040517fab4c36b25b04e6f8ac9915203aba1048c17841782324a583e98128b8c1c964f390620007079087908790879062000daf565b60405180910390a15050505050565b600a54600f1015620007515760405162461bcd60e51b815260206004820152600360248201526245313560e81b604482015260640162000087565b6001600160a01b0381166200078e5760405162461bcd60e51b8152602060048201526002602482015261453160f01b604482015260640162000087565b6001600160a01b0381166000908152600b602052604090205460ff166200081357600a805460018082019092557fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a80180546001600160a01b0319166001600160a01b0384169081179091556000908152600b60205260409020805460ff191690911790555b50565b8280548282559060005260206000209081019282156200085c579160200282015b828111156200085c578251829063ffffffff1690559160200191906001019062000837565b506200086a929150620008b2565b5090565b8280548282559060005260206000209081019282156200085c579160200282015b828111156200085c578251829061ffff169055916020019190600101906200088f565b5b808211156200086a5760008155600101620008b3565b80516001600160a01b0381168114620008e157600080fd5b919050565b805163ffffffff81168114620008e157600080fd5b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b03811182821017156200093c576200093c620008fb565b604052919050565b60006001600160401b03821115620009605762000960620008fb565b5060051b60200190565b600082601f8301126200097c57600080fd5b81516020620009956200098f8362000944565b62000911565b82815260059290921b84018101918181019086841115620009b557600080fd5b8286015b84811015620009db57620009cd81620008c9565b8352918301918301620009b9565b509695505050505050565b805161ffff81168114620008e157600080fd5b600082601f83011262000a0b57600080fd5b8151602062000a1e6200098f8362000944565b82815260059290921b8401810191818101908684111562000a3e57600080fd5b8286015b84811015620009db5762000a5681620009e6565b835291830191830162000a42565b600082601f83011262000a7657600080fd5b8151602062000a896200098f8362000944565b82815260059290921b8401810191818101908684111562000aa957600080fd5b8286015b84811015620009db5762000ac181620008e6565b835291830191830162000aad565b6000806000806000806000806000806101408b8d03121562000af057600080fd5b62000afb8b620008c9565b995062000b0b60208c01620008c9565b985062000b1b60408c01620008c9565b975060608b0151965062000b3260808c01620008e6565b60a08c01519096506001600160401b038082111562000b5057600080fd5b62000b5e8e838f016200096a565b965060c08d0151955062000b7560e08e01620009e6565b94506101008d015191508082111562000b8d57600080fd5b62000b9b8e838f01620009f9565b93506101208d015191508082111562000bb357600080fd5b5062000bc28d828e0162000a64565b9150509295989b9194979a5092959850565b60006020828403121562000be757600080fd5b815160ff8116811462000bf957600080fd5b9392505050565b634e487b7160e01b600052601160045260246000fd5b600181815b8085111562000c5757816000190482111562000c3b5762000c3b62000c00565b8085161562000c4957918102915b93841c939080029062000c1b565b509250929050565b60008262000c705750600162000d0f565b8162000c7f5750600062000d0f565b816001811462000c98576002811462000ca35762000cc3565b600191505062000d0f565b60ff84111562000cb75762000cb762000c00565b50506001821b62000d0f565b5060208310610133831016604e8410600b841016171562000ce8575081810a62000d0f565b62000cf4838362000c16565b806000190482111562000d0b5762000d0b62000c00565b0290505b92915050565b600062000bf960ff84168362000c5f565b60008262000d4457634e487b7160e01b600052601260045260246000fd5b500490565b634e487b7160e01b600052603260045260246000fd5b60006001820162000d745762000d7462000c00565b5060010190565b60006020828403121562000d8e57600080fd5b62000bf982620008c9565b8082018082111562000d0f5762000d0f62000c00565b60006060820161ffff80871684526020606081860152828751808552608087019150828901945060005b8181101562000df957855185168352948301949183019160010162000dd9565b5050858103604087015286518082529082019350915080860160005b8381101562000e3957815163ffffffff168552938201939082019060010162000e15565b509298975050505050505050565b60805160a05160c05161492e62000f8860003960008181610520015281816114d8015281816115740152818161188f01528181611a2201528181611e2a01528181611fbd015281816127af015281816128db01528181612a0101528181612a8b01528181612fed01528181613180015281816135bd01526137500152600081816106330152818161186001528181611911015281816119f301528181611aa401528181611dfb01528181611eac01528181611f8e0152818161203f01528181612780015281816128ac01528181612bc401528181612bf301528181612fbe0152818161306f01528181613151015281816132020152818161358e0152818161363f0152818161372101526137d20152600081816105c101528181610a1b01528181610d2c015281816116e2015281816117cf0152613ca3015261492e6000f3fe608060405234801561001057600080fd5b506004361061036d5760003560e01c80637aaeaf7f116101d3578063ab87982711610104578063ebe2b12b116100a2578063f2d176391161007c578063f2d1763914610831578063f2fde38b14610844578063f9cb1d0414610857578063f9ea07781461086057600080fd5b8063ebe2b12b146107a5578063ef2849b3146107ae578063f12297771461081e57600080fd5b8063ca423031116100de578063ca4230311461074c578063e13d87221461075f578063e70b9e2714610772578063e9fad8ee1461079d57600080fd5b8063ab87982714610727578063ad3bc54614610730578063c8f33c911461074357600080fd5b80638da5cb5b116101715780639ce43f901161014b5780639ce43f90146106a65780639e3582c8146106c6578063a694fc3a146106d9578063a7309d7d146106ec57600080fd5b80638da5cb5b146106835780639003adfe1461069457806399d531e11461069d57600080fd5b80637dc0d1d0116101ad5780637dc0d1d01461062e57806380faa57d146106555780638194c1781461065d57806387e7ed3a1461067057600080fd5b80637aaeaf7f146105ff5780637bb7bed1146106125780637beb3d9f1461062557600080fd5b8063415be3b5116102ad5780636b0916951161024b578063715018a611610225578063715018a6146105b457806372f702f3146105bc578063757767d7146105e357806379ee54f7146105ec57600080fd5b80636b091695146105635780636da9c58e146105765780637035ab981461058957600080fd5b8063502cd30f11610287578063502cd30f146104e857806354feec3e146105085780635fcbd2851461051b57806367c0d00f1461055a57600080fd5b8063415be3b5146104a7578063423c485a146104cd578063486e63b1146104e057600080fd5b8063211dc32d1161031a5780632e9f0602116102f45780632e9f06021461044b578063330244301461045e578063386a95251461047e5780633d3b26031461048757600080fd5b8063211dc32d1461040557806327e235e3146104185780632e1a7d4d1461043857600080fd5b806318160ddd1161034b57806318160ddd146103b65780631c03e6cc146103bf5780631db7efd8146103d257600080fd5b806301f59d161461037257806304a79e481461038e5780631171bda9146103a1575b600080fd5b61037b6107d081565b6040519081526020015b60405180910390f35b61037b61039c36600461436f565b610873565b6103b46103af36600461438c565b610a09565b005b61037b60025481565b6103b46103cd36600461436f565b610b01565b6103f56103e036600461436f565b600b6020526000908152604090205460ff1681565b6040519015158152602001610385565b61037b6104133660046143cd565b610b4c565b61037b61042636600461436f565b60036020526000908152604090205481565b6103b4610446366004614406565b610c57565b6103b46104593660046144c5565b610d94565b61037b61046c36600461436f565b60196020526000908152604090205481565b61037b600d5481565b61037b61049536600461436f565b600f6020526000908152604090205481565b6104ba6104b536600461436f565b610dac565b60405160009190910b8152602001610385565b61037b6104db366004614406565b610e32565b61037b610e5f565b61037b6104f636600461436f565b60186020526000908152604090205481565b61037b610516366004614406565b610f3f565b6105427f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610385565b61037b60145481565b6103b46105713660046143cd565b610f60565b6103b461058436600461436f565b6110a1565b61037b6105973660046143cd565b601160209081526000928352604080842090915290825290205481565b6103b46111c6565b6105427f000000000000000000000000000000000000000000000000000000000000000081565b61037b60155481565b6103b46105fa36600461436f565b6111da565b61037b61060d36600461450a565b611360565b610542610620366004614406565b611416565b61037b61271081565b6105427f000000000000000000000000000000000000000000000000000000000000000081565b61037b611440565b6103b461066b366004614548565b611457565b6103b461067e36600461436f565b611689565b6001546001600160a01b0316610542565b61037b60085481565b61037b60165481565b61037b6106b436600461436f565b60106020526000908152604090205481565b61037b6106d4366004614406565b611714565b6103b46106e7366004614406565b611724565b6107126106fa36600461436f565b60096020526000908152604090205463ffffffff1681565b60405163ffffffff9091168152602001610385565b61037b60075481565b6103b461073e36600461458a565b611829565b61037b600e5481565b6103b461075a36600461436f565b611dc5565b601354610542906001600160a01b031681565b61037b6107803660046143cd565b601260209081526000928352604080842090915290825290205481565b6103b4612311565b61037b600c5481565b6107f26107bc36600461436f565b601a602052600090815260409020546001600160701b0380821691600160701b810490911690600160e01b900463ffffffff1683565b604080516001600160701b03948516815293909216602084015263ffffffff1690820152606001610385565b61037b61082c36600461436f565b612333565b6103b461083f3660046143cd565b61243a565b6103b461085236600461436f565b6125a2565b61037b60175481565b6103b461086e36600461436f565b612618565b6013546000906001600160a01b031661088e57506000919050565b6001600160a01b0382166000908152601a60209081526040808320815160608101835290546001600160701b038082168352600160701b82041693820193909352600160e01b90920463ffffffff1690820152906108eb8261277c565b905080600003610913575050506001600160a01b031660009081526019602052604090205490565b6001600160a01b03841660009081526003602052604081205461093e90610939906129dd565b61277c565b6001600160a01b038616600090815260036020908152604080832054601890925282205492935091670de0b6b3a764000090610978610e5f565b61098291906145ee565b61098c9084614601565b6109969190614618565b905060006109a985858860400151612b89565b6001600160a01b038916600090815260196020526040902054909150856109d08684614601565b6109da9190614618565b8383116109e757826109e9565b835b6109f391906145ee565b6109fd919061463a565b98975050505050505050565b610a11612d2d565b610a19612d86565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b031603610a845760405162461bcd60e51b8152602060048201526002602482015261114d60f21b60448201526064015b60405180910390fd5b610a8f838383612de0565b82610aa46001600160a01b0382168484612e2f565b826001600160a01b0316846001600160a01b03167ffff3b3844276f57024e0b42afec1a37f75db36511e43819a4f2a63ab7862b64884604051610ae991815260200190565b60405180910390a350610afc6001600055565b505050565b610b09612d86565b600c544211610b405760405162461bcd60e51b815260206004820152600360248201526245313760e81b6044820152606401610a7b565b610b4981612e92565b50565b6001600160a01b038083166000818152601260209081526040808320948616835293815283822054845163313ce56760e01b81529451929490939263313ce567926004808401939192918290030181865afa158015610baf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bd3919061464d565b610bde90600a614754565b6001600160a01b03808616600090815260116020908152604080832093881683529290522054610c0d86612333565b610c1791906145ee565b6001600160a01b038516600090815260036020526040902054610c3a9190614601565b610c449190614618565b610c4e919061463a565b90505b92915050565b610c5f612d2d565b80610c6a3382612f8d565b9150600082118015610c8b5750336000908152600360205260409020548211155b8015610ca65750336000908152600360205260409020548111155b610cd75760405162461bcd60e51b8152602060048201526002602482015261453360f01b6044820152606401610a7b565b600454610ce49082614601565b60026000828254610cf591906145ee565b90915550503360009081526003602052604081208054839290610d199084906145ee565b90915550610d5390506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163384612e2f565b60405182815233907f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5906020015b60405180910390a250610b496001600055565b610d9c612d86565b610da882600083611829565b5050565b6001600160a01b0381166000908152600b602052604081205460ff1615610e295760005b600a54811015610e2757826001600160a01b0316600a8281548110610df757610df7614763565b6000918252602090912001546001600160a01b031603610e175792915050565b610e2081614779565b9050610dd0565b505b50600019919050565b60008060075411610e44576000610c51565b61271060075483610e559190614601565b610c519190614618565b6000600254600014610f3857600254601360009054906101000a90046001600160a01b03166001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ec1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ee5919061464d565b610ef090600a614754565b601654600e54610efe611440565b610f0891906145ee565b610f129190614601565b610f1c9190614601565b610f269190614618565b601754610f33919061463a565b905090565b5060175490565b60058181548110610f4f57600080fd5b600091825260209091200154905081565b610f68612d2d565b8060005b600a54811015610fd5576000600a8281548110610f8b57610f8b614763565b6000918252602090912001546001600160a01b03169050610fab81612333565b6001600160a01b03909116600090815260106020526040902055610fce81614779565b9050610f6c565b50610fde611440565b600e556001600160a01b0381161561108c5760005b600a5481101561108a576000600a828154811061101257611012614763565b6000918252602090912001546001600160a01b031690506110338184610b4c565b6001600160a01b0391821660008181526012602090815260408083209588168084529582528083209490945591815260108252828120546011835283822094825293909152205561108381614779565b9050610ff3565b505b61109683836133b6565b50610da86001600055565b6110a9612d2d565b6110b1612d86565b600c544211156110e95760405162461bcd60e51b815260206004820152600360248201526208a62760eb1b6044820152606401610a7b565b600042600c5411156111065742600c5461110391906145ee565b90505b42600c5560005b600a54811015611191576000600a828154811061112c5761112c614763565b60009182526020808320909101546001600160a01b0316808352600f9091526040822054909250829190611161908690614601565b9050801561117d5761117d6001600160a01b0384168783612e2f565b5050508061118a90614779565b905061110d565b506040517f9bad5e1e43bc35e89725967a54f4bc384078248a1ea5c315be3b260a68cbb17a90600090a150610b496001600055565b6111ce612d86565b6111d8600061350b565b565b6111e2612d2d565b8060005b600a5481101561124f576000600a828154811061120557611205614763565b6000918252602090912001546001600160a01b0316905061122581612333565b6001600160a01b0390911660009081526010602052604090205561124881614779565b90506111e6565b50611258611440565b600e556001600160a01b038116156113065760005b600a54811015611304576000600a828154811061128c5761128c614763565b6000918252602090912001546001600160a01b031690506112ad8184610b4c565b6001600160a01b039182166000818152601260209081526040808320958816808452958252808320949094559181526010825282812054601183528382209482529390915220556112fd81614779565b905061126d565b505b60005b600a5481101561135457611344600a828154811061132957611329614763565b6000918252602090912001546001600160a01b0316846133b6565b61134d81614779565b9050611309565b5050610b496001600055565b6001600160a01b038216600090815260096020526040812054819061138b9063ffffffff16426145ee565b90506000805b60055481101561140d57600581815481106113ae576113ae614763565b90600052602060002001548310156113fd57612710600682815481106113d6576113d6614763565b9060005260206000200154866113ec9190614601565b6113f69190614618565b915061140d565b61140681614779565b9050611391565b50949350505050565b600a818154811061142657600080fd5b6000918252602090912001546001600160a01b0316905081565b6000600c5442106114525750600c5490565b504290565b61145f612d86565b600c5442116114965760405162461bcd60e51b815260206004820152600360248201526245313760e81b6044820152606401610a7b565b601754156114cc5760405162461bcd60e51b8152602060048201526003602482015262114c8d60ea1b6044820152606401610a7b565b826001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015611534573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115589190614792565b6001600160a01b031614806115ff5750826001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa1580156115d0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115f49190614792565b6001600160a01b0316145b80156116145750620151808163ffffffff1610155b80156116285750600d548163ffffffff1611155b61165a5760405162461bcd60e51b815260206004820152600360248201526245313960e81b6044820152606401610a7b565b601380546001600160a01b0319166001600160a01b03949094169390931790925560145563ffffffff16601555565b611691612d86565b611699612d2d565b6008805460009091556040518181527f6857c770f3cb43e9c19050a37dd914ec876241c1f4b487d26a1d4f5d3054f49b9060200160405180910390a16117096001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168383612e2f565b50610b496001600055565b60068181548110610f4f57600080fd5b61172c612d2d565b80611737338261355d565b91506000821180156117495750600081115b61177a5760405162461bcd60e51b8152602060048201526002602482015261229960f11b6044820152606401610a7b565b6004546117879083614601565b60026000828254611798919061463a565b909155505033600090815260036020526040812080548492906117bc90849061463a565b909155506117f790506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001633308461397e565b60405182815233907f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d90602001610d81565b611831612d86565b6013546000906001600160a01b031615611c465761184d610e5f565b601755611858611440565b600e819055507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663c640752d7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa1580156118eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061190f9190614792565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633fc8cef36040518163ffffffff1660e01b8152600401602060405180830381865afa15801561196d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119919190614792565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401600060405180830381600087803b1580156119d957600080fd5b505af11580156119ed573d6000803e3d6000fd5b505050507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663c640752d7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015611a7e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611aa29190614792565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633fc8cef36040518163ffffffff1660e01b8152600401602060405180830381865afa158015611b00573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b249190614792565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401600060405180830381600087803b158015611b6c57600080fd5b505af1158015611b80573d6000803e3d6000fd5b505050506001600160a01b03811615611c4657611b9c81610873565b6001600160a01b0382166000908152601960209081526040808320939093556017546018825283832055600390522054611bd5906129dd565b6001600160a01b0382166000908152601a60209081526040918290208351815492850151949093015163ffffffff16600160e01b026001600160e01b036001600160701b03958616600160701b026001600160e01b0319909416959094169490941791909117919091169190911790555b611c5084836139b6565b600d546015541115611c8a5760405162461bcd60e51b815260206004820152600360248201526222991960e91b6044820152606401610a7b565b600d54611c979084614618565b6016556013546001600160a01b031615801590611cb45750600083115b15611dbf576013546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa158015611d02573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d2691906147af565b601354909150600090611d41906001600160a01b0316610dac565b905060008160000b12611d7957858160000b81518110611d6357611d63614763565b602002602001015182611d7691906145ee565b91505b600d54611d869083614618565b6016541115611dbc5760405162461bcd60e51b8152602060048201526002602482015261453360f01b6044820152606401610a7b565b50505b50505050565b611dcd612d2d565b60135481906001600160a01b0316156121e157611de8610e5f565b601755611df3611440565b600e819055507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663c640752d7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015611e86573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611eaa9190614792565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633fc8cef36040518163ffffffff1660e01b8152600401602060405180830381865afa158015611f08573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f2c9190614792565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401600060405180830381600087803b158015611f7457600080fd5b505af1158015611f88573d6000803e3d6000fd5b505050507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663c640752d7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015612019573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061203d9190614792565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633fc8cef36040518163ffffffff1660e01b8152600401602060405180830381865afa15801561209b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120bf9190614792565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401600060405180830381600087803b15801561210757600080fd5b505af115801561211b573d6000803e3d6000fd5b505050506001600160a01b038116156121e15761213781610873565b6001600160a01b0382166000908152601960209081526040808320939093556017546018825283832055600390522054612170906129dd565b6001600160a01b0382166000908152601a60209081526040918290208351815492850151949093015163ffffffff16600160e01b026001600160e01b036001600160701b03958616600160701b026001600160e01b0319909416959094169490941791909117919091169190911790555b6001546001600160a01b03163314806122025750336001600160a01b038316145b6122345760405162461bcd60e51b8152602060048201526003602482015262114c4d60ea1b6044820152606401610a7b565b6013546001600160a01b03166122725760405162461bcd60e51b815260206004820152600360248201526245323360e81b6044820152606401610a7b565b6001600160a01b038216600090815260196020526040812054908190036122995750611709565b6001600160a01b038084166000908152601960205260408120556013546122c291168483612e2f565b826001600160a01b03167fef4696bdcf47e292773442e4169d670e1b2d0d3f5ceff2a5c1e236c10109ee80826040516122fd91815260200190565b60405180910390a25050610b496001600055565b61231a33613e0d565b336000908152600360205260409020546111d890610c57565b600060025460000361235b57506001600160a01b031660009081526010602052604090205490565b600254826001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa15801561239c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123c0919061464d565b6123cb90600a614754565b6001600160a01b0384166000908152600f6020526040902054600e546123ef611440565b6123f991906145ee565b6124039190614601565b61240d9190614601565b6124179190614618565b6001600160a01b038316600090815260106020526040902054610c51919061463a565b612442612d86565b600c5442116124795760405162461bcd60e51b815260206004820152600360248201526245313760e81b6044820152606401610a7b565b600254156124af5760405162461bcd60e51b815260206004820152600360248201526222989960e91b6044820152606401610a7b565b6001600160a01b0382166000908152600b602052604090205460ff1615610da8576040516370a0823160e01b815230600482015282906000906001600160a01b038316906370a0823190602401602060405180830381865afa158015612519573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061253d91906147af565b90508015612559576125596001600160a01b0383168483612e2f565b826001600160a01b03167fcaa95c7b01f93ffe197f5e7316a1a2f387c5bfff8cb445095f2110ff5c1b29958260405161259491815260200190565b60405180910390a250505050565b6125aa612d86565b6001600160a01b03811661260f5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610a7b565b610b498161350b565b612620612d86565b600c5442116126575760405162461bcd60e51b815260206004820152600360248201526245313760e81b6044820152606401610a7b565b60025415801561267157506013546001600160a01b031615155b6126a75760405162461bcd60e51b81526020600482015260076024820152664531322f45323360c81b6044820152606401610a7b565b6013546040516370a0823160e01b81523060048201526001600160a01b039091169060009082906370a0823190602401602060405180830381865afa1580156126f4573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061271891906147af565b90508015610afc576127346001600160a01b0383168483612e2f565b826001600160a01b03167fcf018d466bd581a77eafe1429d5f079ea9a4a7363785b0561c51c9a8f2925c3c8260405161276f91815260200190565b60405180910390a2505050565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316631421f7307f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa15801561280b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061282f9190614792565b60208501516040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526001600160701b03166024820152604401602060405180830381865afa158015612886573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128aa91906147af565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316631421f7307f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015612937573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061295b9190614792565b855160405160e084901b6001600160e01b03191681526001600160a01b0390921660048301526001600160701b03166024820152604401602060405180830381865afa1580156129af573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129d391906147af565b610c51919061463a565b604080516060810182526000808252602082018190529181019190915260008060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316630902f1ac6040518163ffffffff1660e01b8152600401606060405180830381865afa158015612a5d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a8191906147df565b92509250925060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612ae7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b0b91906147af565b9050604051806060016040528082866001600160701b031689612b2e9190614601565b612b389190614618565b6001600160701b0316815260200182856001600160701b031689612b5c9190614601565b612b669190614618565b6001600160701b031681526020018363ffffffff16815250945050505050919050565b600080612b9c63ffffffff8416426145ee565b90506000848611612bae576000612bb8565b612bb885876145ee565b905060008115612cf1577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316638c86f1e47f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633fc8cef36040518163ffffffff1660e01b8152600401602060405180830381865afa158015612c4f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c739190614792565b60135460405160e084901b6001600160e01b03191681526001600160a01b0392831660048201526024810187905291166044820152606401602060405180830381865afa158015612cc8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612cec91906147af565b612cf4565b60005b90506015548310612d09579250612d26915050565b601554612d168483614601565b612d209190614618565b93505050505b9392505050565b600260005403612d7f5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610a7b565b6002600055565b6001546001600160a01b031633146111d85760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610a7b565b6013546001600160a01b0390811690841603612e245760405162461bcd60e51b815260206004820152600360248201526222989b60e91b6044820152606401610a7b565b610afc838383613e30565b6040516001600160a01b038316602482015260448101829052610afc90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152613e7f565b600a54600f1015612ecb5760405162461bcd60e51b815260206004820152600360248201526245313560e81b6044820152606401610a7b565b6001600160a01b038116612f065760405162461bcd60e51b8152602060048201526002602482015261453160f01b6044820152606401610a7b565b6001600160a01b0381166000908152600b602052604090205460ff16610b4957600a805460018181019092557fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a80180546001600160a01b0384166001600160a01b031990911681179091556000908152600b60205260409020805460ff1916909117905550565b60135460009083906001600160a01b0316156133a457612fab610e5f565b601755612fb6611440565b600e819055507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663c640752d7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015613049573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061306d9190614792565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633fc8cef36040518163ffffffff1660e01b8152600401602060405180830381865afa1580156130cb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130ef9190614792565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401600060405180830381600087803b15801561313757600080fd5b505af115801561314b573d6000803e3d6000fd5b505050507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663c640752d7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa1580156131dc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132009190614792565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633fc8cef36040518163ffffffff1660e01b8152600401602060405180830381865afa15801561325e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132829190614792565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401600060405180830381600087803b1580156132ca57600080fd5b505af11580156132de573d6000803e3d6000fd5b505050506001600160a01b038116156133a4576132fa81610873565b6001600160a01b0382166000908152601960209081526040808320939093556017546018825283832055600390522054613333906129dd565b6001600160a01b0382166000908152601a60209081526040918290208351815492850151949093015163ffffffff16600160e01b026001600160e01b036001600160701b03958616600160701b026001600160e01b0319909416959094169490941791909117919091169190911790555b6133ae8484613f51565b949350505050565b6001546001600160a01b03163314806133d75750336001600160a01b038216145b6134095760405162461bcd60e51b8152602060048201526003602482015262114c4d60ea1b6044820152606401610a7b565b6001600160a01b0382166000908152600b602052604090205460ff166134575760405162461bcd60e51b815260206004820152600360248201526245313360e81b6044820152606401610a7b565b6001600160a01b038083166000908152601260209081526040808320938516835292905220548015610afc576001600160a01b0380841660008181526012602090815260408083209487168352939052918220919091556134b9908383612e2f565b816001600160a01b0316836001600160a01b03167f540798df468d7b23d11f156fdb954cb19ad414d150722a7b6d55ba369dea792e836040516134fe91815260200190565b60405180910390a3505050565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60135460009083906001600160a01b0316156139745761357b610e5f565b601755613586611440565b600e819055507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663c640752d7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015613619573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061363d9190614792565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633fc8cef36040518163ffffffff1660e01b8152600401602060405180830381865afa15801561369b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136bf9190614792565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401600060405180830381600087803b15801561370757600080fd5b505af115801561371b573d6000803e3d6000fd5b505050507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663c640752d7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa1580156137ac573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137d09190614792565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633fc8cef36040518163ffffffff1660e01b8152600401602060405180830381865afa15801561382e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906138529190614792565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401600060405180830381600087803b15801561389a57600080fd5b505af11580156138ae573d6000803e3d6000fd5b505050506001600160a01b03811615613974576138ca81610873565b6001600160a01b0382166000908152601960209081526040808320939093556017546018825283832055600390522054613903906129dd565b6001600160a01b0382166000908152601a60209081526040918290208351815492850151949093015163ffffffff16600160e01b026001600160e01b036001600160701b03958616600160701b026001600160e01b0319909416959094169490941791909117919091169190911790555b6133ae8484613fd0565b6040516001600160a01b0380851660248301528316604482015260648101829052611dbf9085906323b872dd60e01b90608401612e5b565b6139be612d2d565b6139c6612d86565b600c5442116139fd5760405162461bcd60e51b815260206004820152600360248201526245313760e81b6044820152606401610a7b565b6000805b600a54811015613a6a576000600a8281548110613a2057613a20614763565b6000918252602090912001546001600160a01b03169050613a4081612333565b6001600160a01b03909116600090815260106020526040902055613a6381614779565b9050613a01565b50613a73611440565b600e556001600160a01b03811615613b215760005b600a54811015613b1f576000600a8281548110613aa757613aa7614763565b6000918252602090912001546001600160a01b03169050613ac88184610b4c565b6001600160a01b03918216600081815260126020908152604080832095881680845295825280832094909455918152601082528281205460118352838220948252939091522055613b1881614779565b9050613a88565b505b60008211613b575760405162461bcd60e51b815260206004820152600360248201526204531360ec1b6044820152606401610a7b565b600a54835114613b8f5760405162461bcd60e51b815260206004820152600360248201526245313160e81b6044820152606401610a7b565b600d82905560005b600a54811015613db2576000600a8281548110613bb657613bb6614763565b600091825260209091200154600d5486516001600160a01b0390921692508291879085908110613be857613be8614763565b6020026020010151613bfa9190614618565b6001600160a01b0382166000908152600f6020526040812091909155600a805485908110613c2a57613c2a614763565b6000918252602090912001546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa158015613c7b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613c9f91906147af565b90507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316826001600160a01b031614613d3857600d54613ce79082614618565b6001600160a01b0383166000908152600f60205260409020541115613d335760405162461bcd60e51b8152602060048201526002602482015261453360f01b6044820152606401610a7b565b613d9e565b600d54600254613d4890836145ee565b613d529190614618565b6001600160a01b0383166000908152600f60205260409020541115613d9e5760405162461bcd60e51b8152602060048201526002602482015261453360f01b6044820152606401610a7b565b50505080613dab90614779565b9050613b97565b5042600e819055600d54613dc59161463a565b600c556040517faab1f55dce0d0e628e283ce1061d0afccffcf61f9c14391c899b5952492ce82190613dfa908590859061481b565b60405180910390a150610da86001600055565b6013546001600160a01b031615613e2757613e2781611dc5565b610b4981614138565b6001600160a01b0383166000908152600b602052604090205460ff1615610afc5760405162461bcd60e51b815260206004820152600360248201526222989b60e91b6044820152606401610a7b565b6000613ed4826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166141419092919063ffffffff16565b805190915015610afc5780806020019051810190613ef29190614863565b610afc5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610a7b565b600080613f5e8484611360565b90508015613fbd578060086000828254613f78919061463a565b90915550506040518181526001600160a01b038516907fd0b34aaed5c558a8df736a5aaf9a49b539c4e86fb3ee5a1ac76e0bec23cbdd03906020015b60405180910390a25b6133ae84613fcb83866145ee565b919050565b6000600c5442111561400a5760405162461bcd60e51b815260206004820152600360248201526208a62760eb1b6044820152606401610a7b565b8260005b600a54811015614077576000600a828154811061402d5761402d614763565b6000918252602090912001546001600160a01b0316905061404d81612333565b6001600160a01b0390911660009081526010602052604090205561407081614779565b905061400e565b50614080611440565b600e556001600160a01b0381161561412e5760005b600a5481101561412c576000600a82815481106140b4576140b4614763565b6000918252602090912001546001600160a01b031690506140d58184610b4c565b6001600160a01b0391821660008181526012602090815260408083209588168084529582528083209490945591815260108252828120546011835283822094825293909152205561412581614779565b9050614095565b505b6133ae8484614150565b610b49816111da565b60606133ae84846000856141e1565b60008061415c83610e32565b6001600160a01b0385166000908152600960205260409020805463ffffffff19164263ffffffff1617905590508015613fbd5780600860008282546141a1919061463a565b90915550506040518181526001600160a01b038516907f34f2a7363b1ef64b0b62a223c88cf3f54a68686acfcb9531d7deb46004f37c4690602001613fb4565b6060824710156142425760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610a7b565b600080866001600160a01b0316858760405161425e91906148a9565b60006040518083038185875af1925050503d806000811461429b576040519150601f19603f3d011682016040523d82523d6000602084013e6142a0565b606091505b50915091506142b1878383876142bc565b979650505050505050565b6060831561432b578251600003614324576001600160a01b0385163b6143245760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610a7b565b50816133ae565b6133ae83838151156143405781518083602001fd5b8060405162461bcd60e51b8152600401610a7b91906148c5565b6001600160a01b0381168114610b4957600080fd5b60006020828403121561438157600080fd5b8135612d268161435a565b6000806000606084860312156143a157600080fd5b83356143ac8161435a565b925060208401356143bc8161435a565b929592945050506040919091013590565b600080604083850312156143e057600080fd5b82356143eb8161435a565b915060208301356143fb8161435a565b809150509250929050565b60006020828403121561441857600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b600082601f83011261444657600080fd5b8135602067ffffffffffffffff808311156144635761446361441f565b8260051b604051601f19603f830116810181811084821117156144885761448861441f565b6040529384528581018301938381019250878511156144a657600080fd5b83870191505b848210156142b1578135835291830191908301906144ac565b600080604083850312156144d857600080fd5b823567ffffffffffffffff8111156144ef57600080fd5b6144fb85828601614435565b95602094909401359450505050565b6000806040838503121561451d57600080fd5b82356145288161435a565b946020939093013593505050565b63ffffffff81168114610b4957600080fd5b60008060006060848603121561455d57600080fd5b83356145688161435a565b925060208401359150604084013561457f81614536565b809150509250925092565b60008060006060848603121561459f57600080fd5b833567ffffffffffffffff8111156145b657600080fd5b6145c286828701614435565b9660208601359650604090950135949350505050565b634e487b7160e01b600052601160045260246000fd5b81810381811115610c5157610c516145d8565b8082028115828204841417610c5157610c516145d8565b60008261463557634e487b7160e01b600052601260045260246000fd5b500490565b80820180821115610c5157610c516145d8565b60006020828403121561465f57600080fd5b815160ff81168114612d2657600080fd5b600181815b808511156146ab578160001904821115614691576146916145d8565b8085161561469e57918102915b93841c9390800290614675565b509250929050565b6000826146c257506001610c51565b816146cf57506000610c51565b81600181146146e557600281146146ef5761470b565b6001915050610c51565b60ff841115614700576147006145d8565b50506001821b610c51565b5060208310610133831016604e8410600b841016171561472e575081810a610c51565b6147388383614670565b806000190482111561474c5761474c6145d8565b029392505050565b6000610c4e60ff8416836146b3565b634e487b7160e01b600052603260045260246000fd5b60006001820161478b5761478b6145d8565b5060010190565b6000602082840312156147a457600080fd5b8151612d268161435a565b6000602082840312156147c157600080fd5b5051919050565b80516001600160701b0381168114613fcb57600080fd5b6000806000606084860312156147f457600080fd5b6147fd846147c8565b925061480b602085016147c8565b9150604084015161457f81614536565b604080825283519082018190526000906020906060840190828701845b8281101561485457815184529284019290840190600101614838565b50505092019290925292915050565b60006020828403121561487557600080fd5b81518015158114612d2657600080fd5b60005b838110156148a0578181015183820152602001614888565b50506000910152565b600082516148bb818460208701614885565b9190910192915050565b60208152600082518060208401526148e4816040850160208701614885565b601f01601f1916919091016040019291505056fea2646970667358221220c5101d6ea5bbb14fbabae9d6fb47659e7e4799122c193d590b35a0d68c4e4a2664736f6c63430008130033a2646970667358221220de4ebe46bbcfb24012671f7e6a076eeb6f0c7113d533fc0bc7f521df7bfb6e2264736f6c63430008130033
Deployed Bytecode Sourcemap
98303:888:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;98637:551;;;;;;;;;;-1:-1:-1;98637:551:0;;;;;:::i;:::-;;:::i;:::-;;;-1:-1:-1;;;;;1597:55:1;;;1579:74;;1567:2;1552:18;98637:551:0;;;;;;;;98773:12;98798:21;98853:33;;;;;;;;:::i;:::-;-1:-1:-1;;98853:33:0;;;;;;;;;;;;;;;;98822:94;;98853:33;98901:4;;98853:33;98822:94;;:::i;:::-;;;;;;;;;;;;;98798:118;;99010:5;98999:8;98993:15;98986:4;98976:8;98972:19;98969:1;98961:55;98953:63;;99052:4;99040:17;99030:75;;99088:1;99085;99078:12;99030:75;99128:52;;-1:-1:-1;;;99128:52:0;;-1:-1:-1;;;;;1597:55:1;;;99128:52:0;;;1579:74:1;99128:38:0;;;;;1552:18:1;;99128:52:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;98787:401;98637:551;;;;;:::o;-1:-1:-1:-;;;;;;;;:::o;14:127:1:-;75:10;70:3;66:20;63:1;56:31;106:4;103:1;96:15;130:4;127:1;120:15;146:196;214:20;;-1:-1:-1;;;;;263:54:1;;253:65;;243:93;;332:1;329;322:12;243:93;146:196;;;:::o;347:1073::-;433:6;441;449;502:2;490:9;481:7;477:23;473:32;470:52;;;518:1;515;508:12;470:52;558:9;545:23;587:18;628:2;620:6;617:14;614:34;;;644:1;641;634:12;614:34;682:6;671:9;667:22;657:32;;727:7;720:4;716:2;712:13;708:27;698:55;;749:1;746;739:12;698:55;785:2;772:16;807:2;803;800:10;797:36;;;813:18;;:::i;:::-;888:2;882:9;856:2;942:13;;-1:-1:-1;;938:22:1;;;962:2;934:31;930:40;918:53;;;986:18;;;1006:22;;;983:46;980:72;;;1032:18;;:::i;:::-;1072:10;1068:2;1061:22;1107:2;1099:6;1092:18;1149:7;1142:4;1137:2;1133;1129:11;1125:22;1122:35;1119:55;;;1170:1;1167;1160:12;1119:55;1230:2;1223:4;1219:2;1215:13;1208:4;1200:6;1196:17;1183:50;1277:1;1270:4;1265:2;1257:6;1253:15;1249:26;1242:37;1298:6;1288:16;;;;;;;1351:4;1340:9;1336:20;1323:34;1313:44;;1376:38;1410:2;1399:9;1395:18;1376:38;:::i;:::-;1366:48;;347:1073;;;;;:::o;1664:322::-;1705:3;1743:5;1737:12;1767:1;1777:128;1791:6;1788:1;1785:13;1777:128;;;1888:4;1873:13;;;1869:24;;1863:31;1850:11;;;1843:52;1806:12;1777:128;;;-1:-1:-1;1960:1:1;1924:16;;1949:13;;;-1:-1:-1;1924:16:1;;1664:322;-1:-1:-1;1664:322:1:o;1991:261::-;2166:3;2191:55;2216:29;2241:3;2233:6;2216:29;:::i;:::-;2208:6;2191:55;:::i;:::-;2184:62;1991:261;-1:-1:-1;;;;1991:261:1:o
Swarm Source
ipfs://de4ebe46bbcfb24012671f7e6a076eeb6f0c7113d533fc0bc7f521df7bfb6e22
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.