More Info
Private Name Tags
ContractCreator
TokenTracker
Latest 25 from a total of 89 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Approve | 2926218 | 34 mins ago | IN | 0 S | 0.00025447 | ||||
Approve | 2926113 | 36 mins ago | IN | 0 S | 0.00026768 | ||||
Approve | 2916801 | 2 hrs ago | IN | 0 S | 0.00025447 | ||||
Approve | 2904085 | 4 hrs ago | IN | 0 S | 0.00026768 | ||||
Approve | 2900417 | 5 hrs ago | IN | 0 S | 0.00025447 | ||||
Approve | 2898584 | 5 hrs ago | IN | 0 S | 0.00048581 | ||||
Approve | 2886330 | 7 hrs ago | IN | 0 S | 0.00034249 | ||||
Approve | 2881952 | 7 hrs ago | IN | 0 S | 0.00025434 | ||||
Approve | 2881046 | 7 hrs ago | IN | 0 S | 0.00025447 | ||||
Approve | 2879093 | 8 hrs ago | IN | 0 S | 0.00026083 | ||||
Approve | 2876207 | 8 hrs ago | IN | 0 S | 0.0002544 | ||||
Approve | 2868932 | 9 hrs ago | IN | 0 S | 0.00016905 | ||||
Approve | 2868847 | 9 hrs ago | IN | 0 S | 0.00034735 | ||||
Approve | 2864470 | 10 hrs ago | IN | 0 S | 0.00026768 | ||||
Approve | 2863751 | 10 hrs ago | IN | 0 S | 0.00025447 | ||||
Approve | 2859321 | 11 hrs ago | IN | 0 S | 0.00026823 | ||||
Approve | 2849086 | 13 hrs ago | IN | 0 S | 0.00010739 | ||||
Approve | 2848453 | 13 hrs ago | IN | 0 S | 0.00005436 | ||||
Approve | 2847986 | 14 hrs ago | IN | 0 S | 0.00005088 | ||||
Approve | 2830871 | 17 hrs ago | IN | 0 S | 0.00005089 | ||||
Approve | 2830663 | 17 hrs ago | IN | 0 S | 0.00005089 | ||||
Approve | 2795667 | 22 hrs ago | IN | 0 S | 0.00005392 | ||||
Approve | 2766211 | 26 hrs ago | IN | 0 S | 0.00005089 | ||||
Approve | 2764626 | 27 hrs ago | IN | 0 S | 0.00005086 | ||||
Approve | 2740141 | 31 hrs ago | IN | 0 S | 0.00006022 |
Latest 1 internal transaction
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
2417211 | 4 days ago | Contract Creation | 0 S |
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
Potion
Compiler Version
v0.8.24+commit.e11b9ed9
Optimization Enabled:
Yes with 0 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// https://peapods.finance // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; import "@uniswap/v3-core/contracts/libraries/FixedPoint96.sol"; import "./interfaces/IUniswapV2Pair.sol"; import "./interfaces/IV3TwapUtilities.sol"; import "./DecentralizedIndex.sol"; contract Potion is DecentralizedIndex { using SafeERC20 for IERC20; IUniswapV2Factory immutable V2_FACTORY; uint256 _totalWeights; constructor( IDeploy.Deploy memory _deploy ) DecentralizedIndex(IndexType.WEIGHTED, _deploy) { V2_FACTORY = IUniswapV2Factory( IUniswapV2Router02(_deploy._v2Router).factory() ); require(_deploy._tokens.length == _deploy._weights.length, "INIT"); for (uint256 _i; _i < _deploy._tokens.length; _i++) { require(!_isTokenInIndex[_deploy._tokens[_i]], "DUP"); require(_deploy._weights[_i] > 0, "WVAL"); indexTokens.push( IndexAssetInfo({ token: _deploy._tokens[_i], basePriceUSDX96: 0, weighting: _deploy._weights[_i], c1: address(0), q1: 0 // amountsPerIdxTokenX96 }) ); _totalWeights += _deploy._weights[_i]; _fundTokenIdx[_deploy._tokens[_i]] = _i; _isTokenInIndex[_deploy._tokens[_i]] = true; } // at idx == 0, need to find X in [1/X = tokenWeightAtIdx/totalWeights] // at idx > 0, need to find Y in (Y/X = tokenWeightAtIdx/totalWeights) uint256 _xX96 = (FixedPoint96.Q96 * _totalWeights) / _deploy._weights[0]; for (uint256 _i; _i < _deploy._tokens.length; _i++) { indexTokens[_i].q1 = (_deploy._weights[_i] * _xX96 * 10 ** IERC20Metadata(_deploy._tokens[_i]).decimals()) / _totalWeights; } } function _getNativePriceUSDX96() internal view returns (uint256) { IUniswapV2Pair _nativeStablePool = IUniswapV2Pair( V2_FACTORY.getPair(STABLECOIN, WETH) ); address _token0 = _nativeStablePool.token0(); (uint8 _decimals0, uint8 _decimals1) = ( IERC20Metadata(_token0).decimals(), IERC20Metadata(_nativeStablePool.token1()).decimals() ); (uint112 _res0, uint112 _res1, ) = _nativeStablePool.getReserves(); return _token0 == STABLECOIN ? (FixedPoint96.Q96 * _res0 * 10 ** _decimals1) / _res1 / 10 ** _decimals0 : (FixedPoint96.Q96 * _res1 * 10 ** _decimals0) / _res0 / 10 ** _decimals1; } function _getTokenPriceUSDX96( address _token ) internal view returns (uint256) { if (_token == WETH) { return _getNativePriceUSDX96(); } IUniswapV2Pair _pool = IUniswapV2Pair(V2_FACTORY.getPair(_token, WETH)); address _token0 = _pool.token0(); uint8 _decimals0 = IERC20Metadata(_token0).decimals(); uint8 _decimals1 = IERC20Metadata(_pool.token1()).decimals(); (uint112 _res0, uint112 _res1, ) = _pool.getReserves(); uint256 _nativePriceUSDX96 = _getNativePriceUSDX96(); return _token0 == WETH ? (_nativePriceUSDX96 * _res0 * 10 ** _decimals1) / _res1 / 10 ** _decimals0 : (_nativePriceUSDX96 * _res1 * 10 ** _decimals0) / _res0 / 10 ** _decimals1; } function bond( address _token, uint256 _amount, uint256 _amountMintMin ) external override lock noSwapOrFee whenNotPaused { require(_isTokenInIndex[_token], "INVALIDTOKEN"); uint256 _tokenIdx = _fundTokenIdx[_token]; uint256 _tokenCurSupply = IERC20(_token).balanceOf(address(this)); bool _firstIn = _isFirstIn(); uint256 _tokenAmtSupplyRatioX96 = _firstIn ? FixedPoint96.Q96 : (_amount * FixedPoint96.Q96) / _tokenCurSupply; uint256 _tokensMinted; if (_firstIn) { _tokensMinted = (_amount * FixedPoint96.Q96 * 10 ** decimals()) / indexTokens[_tokenIdx].q1; } else { _tokensMinted = (totalSupply() * _tokenAmtSupplyRatioX96) / FixedPoint96.Q96; } uint256 _feeTokens = _canWrapFeeFree(_msgSender()) ? 0 : (_tokensMinted * fees.bond) / DEN; require(_tokensMinted - _feeTokens >= _amountMintMin, "MIN"); _mint(_msgSender(), _tokensMinted - _feeTokens); if (_feeTokens > 0) { _mint(address(this), _feeTokens); _processBurnFee(_feeTokens); } for (uint256 _i; _i < indexTokens.length; _i++) { uint256 _transferAmt = _firstIn ? getInitialAmount(_token, _amount, indexTokens[_i].token) : (IERC20(indexTokens[_i].token).balanceOf(address(this)) * _tokenAmtSupplyRatioX96) / FixedPoint96.Q96; _transferFromAndValidate( IERC20(indexTokens[_i].token), _msgSender(), _transferAmt ); } _bond(); emit Bond(_msgSender(), _token, _amount, _tokensMinted, _feeTokens); } function debond( uint256 _amount, address[] memory, uint8[] memory ) external override lock noSwapOrFee whenNotPaused { uint256 _amountAfterFee = _isLastOut(_amount) ? _amount : (_amount * (DEN - fees.debond)) / DEN; uint256 _percAfterFeeX96 = (_amountAfterFee * FixedPoint96.Q96) / totalSupply(); super._transfer(_msgSender(), address(this), _amount); _burn(address(this), _amountAfterFee); _processBurnFee(_amount - _amountAfterFee); for (uint256 _i; _i < indexTokens.length; _i++) { uint256 _tokenSupply = IERC20(indexTokens[_i].token).balanceOf( address(this) ); uint256 _debondAmount = (_tokenSupply * _percAfterFeeX96) / FixedPoint96.Q96; if (_debondAmount > 0) { IERC20(indexTokens[_i].token).transfer( _msgSender(), _debondAmount ); } } emit Debond(_msgSender(), _amount, _amount - _amountAfterFee); } function getInitialAmount( address _sourceToken, uint256 _sourceAmount, address _targetToken ) public view override returns (uint256) { uint256 _sourceTokenIdx = _fundTokenIdx[_sourceToken]; uint256 _targetTokenIdx = _fundTokenIdx[_targetToken]; return (_sourceAmount * indexTokens[_targetTokenIdx].weighting * 10 ** IERC20Metadata(_targetToken).decimals()) / indexTokens[_sourceTokenIdx].weighting / 10 ** IERC20Metadata(_sourceToken).decimals(); } function pause() public { require(msg.sender == partner, "ACCESS_ERR"); _pause(); } function unpause() public { require(msg.sender == partner, "ACCESS_ERR"); _unpause(); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @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. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby disabling 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); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC5267.sol) pragma solidity ^0.8.0; interface IERC5267 { /** * @dev MAY be emitted to signal that the domain could have changed. */ event EIP712DomainChanged(); /** * @dev returns the fields and values that describe the domain separator used by this contract for EIP-712 * signature. */ function eip712Domain() external view returns ( bytes1 fields, string memory name, string memory version, uint256 chainId, address verifyingContract, bytes32 salt, uint256[] memory extensions ); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract Pausable is Context { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ constructor() { _paused = false; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { _requireNotPaused(); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { _requirePaused(); _; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Throws if the contract is paused. */ function _requireNotPaused() internal view virtual { require(!paused(), "Pausable: paused"); } /** * @dev Throws if the contract is not paused. */ function _requirePaused() internal view virtual { require(paused(), "Pausable: not paused"); } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.0; import "./IERC20.sol"; import "./extensions/IERC20Metadata.sol"; import "../../utils/Context.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * The default value of {decimals} is 18. To change this, you should override * this function so it returns a different value. * * We have followed general OpenZeppelin Contracts guidelines: functions revert * instead returning `false` on failure. This behavior is nonetheless * conventional and does not conflict with the expectations of ERC20 * applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20, IERC20Metadata { mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * All two of these values are immutable: they can only be set once during * construction. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the default value returned by this function, unless * it's overridden. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `to` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address to, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _transfer(owner, to, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on * `transferFrom`. This is semantically equivalent to an infinite approval. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _approve(owner, spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * NOTE: Does not update the allowance if the current allowance * is the maximum `uint256`. * * Requirements: * * - `from` and `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. * - the caller must have allowance for ``from``'s tokens of at least * `amount`. */ function transferFrom(address from, address to, uint256 amount) public virtual override returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, amount); _transfer(from, to, amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, allowance(owner, spender) + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { address owner = _msgSender(); uint256 currentAllowance = allowance(owner, spender); require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(owner, spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `from` to `to`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. */ function _transfer(address from, address to, uint256 amount) internal virtual { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(from, to, amount); uint256 fromBalance = _balances[from]; require(fromBalance >= amount, "ERC20: transfer amount exceeds balance"); unchecked { _balances[from] = fromBalance - amount; // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by // decrementing then incrementing. _balances[to] += amount; } emit Transfer(from, to, amount); _afterTokenTransfer(from, to, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; unchecked { // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above. _balances[account] += amount; } emit Transfer(address(0), account, amount); _afterTokenTransfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); unchecked { _balances[account] = accountBalance - amount; // Overflow not possible: amount <= accountBalance <= totalSupply. _totalSupply -= amount; } emit Transfer(account, address(0), amount); _afterTokenTransfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Updates `owner` s allowance for `spender` based on spent `amount`. * * Does not update the allowance amount in case of infinite allowance. * Revert if not enough allowance is available. * * Might emit an {Approval} event. */ function _spendAllowance(address owner, address spender, uint256 amount) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { require(currentAllowance >= amount, "ERC20: insufficient allowance"); unchecked { _approve(owner, spender, currentAllowance - amount); } } } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * has been transferred to `to`. * - when `from` is zero, `amount` tokens have been minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens have been burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.4) (token/ERC20/extensions/ERC20Permit.sol) pragma solidity ^0.8.0; import "./IERC20Permit.sol"; import "../ERC20.sol"; import "../../../utils/cryptography/ECDSA.sol"; import "../../../utils/cryptography/EIP712.sol"; import "../../../utils/Counters.sol"; /** * @dev Implementation 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. * * _Available since v3.4._ */ abstract contract ERC20Permit is ERC20, IERC20Permit, EIP712 { using Counters for Counters.Counter; mapping(address => Counters.Counter) private _nonces; // solhint-disable-next-line var-name-mixedcase bytes32 private constant _PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"); /** * @dev In previous versions `_PERMIT_TYPEHASH` was declared as `immutable`. * However, to ensure consistency with the upgradeable transpiler, we will continue * to reserve a slot. * @custom:oz-renamed-from _PERMIT_TYPEHASH */ // solhint-disable-next-line var-name-mixedcase bytes32 private _PERMIT_TYPEHASH_DEPRECATED_SLOT; /** * @dev Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `"1"`. * * It's a good idea to use the same `name` that is defined as the ERC20 token name. */ constructor(string memory name) EIP712(name, "1") {} /** * @inheritdoc IERC20Permit */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) public virtual override { require(block.timestamp <= deadline, "ERC20Permit: expired deadline"); bytes32 structHash = keccak256(abi.encode(_PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline)); bytes32 hash = _hashTypedDataV4(structHash); address signer = ECDSA.recover(hash, v, r, s); require(signer == owner, "ERC20Permit: invalid signature"); _approve(owner, spender, value); } /** * @inheritdoc IERC20Permit */ function nonces(address owner) public view virtual override returns (uint256) { return _nonces[owner].current(); } /** * @inheritdoc IERC20Permit */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view override returns (bytes32) { return _domainSeparatorV4(); } /** * @dev "Consume a nonce": return the current value and increment. * * _Available since v4.1._ */ function _useNonce(address owner) internal virtual returns (uint256 current) { Counters.Counter storage nonce = _nonces[owner]; current = nonce.current(); nonce.increment(); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.4) (token/ERC20/extensions/IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. * * ==== Security Considerations * * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be * considered as an intention to spend the allowance in any specific way. The second is that because permits have * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be * generally recommended is: * * ```solidity * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public { * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {} * doThing(..., value); * } * * function doThing(..., uint256 value) public { * token.safeTransferFrom(msg.sender, address(this), value); * ... * } * ``` * * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also * {SafeERC20-safeTransferFrom}). * * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so * contracts should have entry points that don't rely on permit. */ 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]. * * CAUTION: See Security Considerations above. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 amount) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/IERC20Permit.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; /** * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } /** * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful. */ function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } /** * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 oldAllowance = token.allowance(address(this), spender); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value)); } /** * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value)); } } /** * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval * to be set to zero before setting it to a non-zero value, such as USDT. */ function forceApprove(IERC20 token, address spender, uint256 value) internal { bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value); if (!_callOptionalReturnBool(token, approvalCall)) { _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0)); _callOptionalReturn(token, approvalCall); } } /** * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`. * Revert on invalid signature. */ function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). * * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead. */ function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false // and not revert is the subcall reverts. (bool success, bytes memory returndata) = address(token).call(data); return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * * Furthermore, `isContract` will also return true if the target contract within * the same transaction is already scheduled for destruction by `SELFDESTRUCT`, * which only has an effect at the end of a transaction. * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.4) (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; } function _contextSuffixLength() internal view virtual returns (uint256) { return 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Counters.sol) pragma solidity ^0.8.0; /** * @title Counters * @author Matt Condon (@shrugs) * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number * of elements in a mapping, issuing ERC721 ids, or counting request ids. * * Include with `using Counters for Counters.Counter;` */ library Counters { struct Counter { // This variable should never be directly accessed by users of the library: interactions must be restricted to // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add // this feature: see https://github.com/ethereum/solidity/issues/4637 uint256 _value; // default: 0 } function current(Counter storage counter) internal view returns (uint256) { return counter._value; } function increment(Counter storage counter) internal { unchecked { counter._value += 1; } } function decrement(Counter storage counter) internal { uint256 value = counter._value; require(value > 0, "Counter: decrement overflow"); unchecked { counter._value = value - 1; } } function reset(Counter storage counter) internal { counter._value = 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.0; import "../Strings.sol"; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSA { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS, InvalidSignatureV // Deprecated in v4.8 } function _throwError(RecoverError error) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert("ECDSA: invalid signature"); } else if (error == RecoverError.InvalidSignatureLength) { revert("ECDSA: invalid signature length"); } else if (error == RecoverError.InvalidSignatureS) { revert("ECDSA: invalid signature 's' value"); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature` or error string. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) { if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. /// @solidity memory-safe-assembly assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return tryRecover(hash, v, r, s); } else { return (address(0), RecoverError.InvalidSignatureLength); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, signature); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately. * * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError) { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); uint8 v = uint8((uint256(vs) >> 255) + 27); return tryRecover(hash, v, r, s); } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. * * _Available since v4.2._ */ function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, r, vs); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. * * _Available since v4.3._ */ function tryRecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address, RecoverError) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS); } // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature); } return (signer, RecoverError.NoError); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, v, r, s); _throwError(error); return recovered; } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 message) { // 32 is the length in bytes of hash, // enforced by the type signature above /// @solidity memory-safe-assembly assembly { mstore(0x00, "\x19Ethereum Signed Message:\n32") mstore(0x1c, hash) message := keccak256(0x00, 0x3c) } } /** * @dev Returns an Ethereum Signed Message, created from `s`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s)); } /** * @dev Returns an Ethereum Signed Typed Data, created from a * `domainSeparator` and a `structHash`. This produces hash corresponding * to the one signed with the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] * JSON-RPC method as part of EIP-712. * * See {recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 data) { /// @solidity memory-safe-assembly assembly { let ptr := mload(0x40) mstore(ptr, "\x19\x01") mstore(add(ptr, 0x02), domainSeparator) mstore(add(ptr, 0x22), structHash) data := keccak256(ptr, 0x42) } } /** * @dev Returns an Ethereum Signed Data with intended validator, created from a * `validator` and `data` according to the version 0 of EIP-191. * * See {recover}. */ function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19\x00", validator, data)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/EIP712.sol) pragma solidity ^0.8.8; import "./ECDSA.sol"; import "../ShortStrings.sol"; import "../../interfaces/IERC5267.sol"; /** * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data. * * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible, * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding * they need in their contracts using a combination of `abi.encode` and `keccak256`. * * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA * ({_hashTypedDataV4}). * * The implementation of the domain separator was designed to be as efficient as possible while still properly updating * the chain id to protect against replay attacks on an eventual fork of the chain. * * NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask]. * * NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain * separator of the implementation contract. This will cause the `_domainSeparatorV4` function to always rebuild the * separator from the immutable values, which is cheaper than accessing a cached version in cold storage. * * _Available since v3.4._ * * @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment */ abstract contract EIP712 is IERC5267 { using ShortStrings for *; bytes32 private constant _TYPE_HASH = keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"); // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to // invalidate the cached domain separator if the chain id changes. bytes32 private immutable _cachedDomainSeparator; uint256 private immutable _cachedChainId; address private immutable _cachedThis; bytes32 private immutable _hashedName; bytes32 private immutable _hashedVersion; ShortString private immutable _name; ShortString private immutable _version; string private _nameFallback; string private _versionFallback; /** * @dev Initializes the domain separator and parameter caches. * * The meaning of `name` and `version` is specified in * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]: * * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol. * - `version`: the current major version of the signing domain. * * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart * contract upgrade]. */ constructor(string memory name, string memory version) { _name = name.toShortStringWithFallback(_nameFallback); _version = version.toShortStringWithFallback(_versionFallback); _hashedName = keccak256(bytes(name)); _hashedVersion = keccak256(bytes(version)); _cachedChainId = block.chainid; _cachedDomainSeparator = _buildDomainSeparator(); _cachedThis = address(this); } /** * @dev Returns the domain separator for the current chain. */ function _domainSeparatorV4() internal view returns (bytes32) { if (address(this) == _cachedThis && block.chainid == _cachedChainId) { return _cachedDomainSeparator; } else { return _buildDomainSeparator(); } } function _buildDomainSeparator() private view returns (bytes32) { return keccak256(abi.encode(_TYPE_HASH, _hashedName, _hashedVersion, block.chainid, address(this))); } /** * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this * function returns the hash of the fully encoded EIP712 message for this domain. * * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example: * * ```solidity * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode( * keccak256("Mail(address to,string contents)"), * mailTo, * keccak256(bytes(mailContents)) * ))); * address signer = ECDSA.recover(digest, signature); * ``` */ function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) { return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash); } /** * @dev See {EIP-5267}. * * _Available since v4.9._ */ function eip712Domain() public view virtual override returns ( bytes1 fields, string memory name, string memory version, uint256 chainId, address verifyingContract, bytes32 salt, uint256[] memory extensions ) { return ( hex"0f", // 01111 _name.toStringWithFallback(_nameFallback), _version.toStringWithFallback(_versionFallback), block.chainid, address(this), bytes32(0), new uint256[](0) ); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { // Solidity will revert if denominator == 0, unlike the div opcode on its own. // The surrounding unchecked block does not change this fact. // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic. return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1, "Math: mulDiv overflow"); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works // in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10 ** 64) { value /= 10 ** 64; result += 64; } if (value >= 10 ** 32) { value /= 10 ** 32; result += 32; } if (value >= 10 ** 16) { value /= 10 ** 16; result += 16; } if (value >= 10 ** 8) { value /= 10 ** 8; result += 8; } if (value >= 10 ** 4) { value /= 10 ** 4; result += 4; } if (value >= 10 ** 2) { value /= 10 ** 2; result += 2; } if (value >= 10 ** 1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 256, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol) pragma solidity ^0.8.0; /** * @dev Standard signed math utilities missing in the Solidity language. */ library SignedMath { /** * @dev Returns the largest of two signed numbers. */ function max(int256 a, int256 b) internal pure returns (int256) { return a > b ? a : b; } /** * @dev Returns the smallest of two signed numbers. */ function min(int256 a, int256 b) internal pure returns (int256) { return a < b ? a : b; } /** * @dev Returns the average of two signed numbers without overflow. * The result is rounded towards zero. */ function average(int256 a, int256 b) internal pure returns (int256) { // Formula from the book "Hacker's Delight" int256 x = (a & b) + ((a ^ b) >> 1); return x + (int256(uint256(x) >> 255) & (a ^ b)); } /** * @dev Returns the absolute unsigned value of a signed value. */ function abs(int256 n) internal pure returns (uint256) { unchecked { // must be unchecked in order to support `n = type(int256).min` return uint256(n >= 0 ? n : -n); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/ShortStrings.sol) pragma solidity ^0.8.8; import "./StorageSlot.sol"; // | string | 0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA | // | length | 0x BB | type ShortString is bytes32; /** * @dev This library provides functions to convert short memory strings * into a `ShortString` type that can be used as an immutable variable. * * Strings of arbitrary length can be optimized using this library if * they are short enough (up to 31 bytes) by packing them with their * length (1 byte) in a single EVM word (32 bytes). Additionally, a * fallback mechanism can be used for every other case. * * Usage example: * * ```solidity * contract Named { * using ShortStrings for *; * * ShortString private immutable _name; * string private _nameFallback; * * constructor(string memory contractName) { * _name = contractName.toShortStringWithFallback(_nameFallback); * } * * function name() external view returns (string memory) { * return _name.toStringWithFallback(_nameFallback); * } * } * ``` */ library ShortStrings { // Used as an identifier for strings longer than 31 bytes. bytes32 private constant _FALLBACK_SENTINEL = 0x00000000000000000000000000000000000000000000000000000000000000FF; error StringTooLong(string str); error InvalidShortString(); /** * @dev Encode a string of at most 31 chars into a `ShortString`. * * This will trigger a `StringTooLong` error is the input string is too long. */ function toShortString(string memory str) internal pure returns (ShortString) { bytes memory bstr = bytes(str); if (bstr.length > 31) { revert StringTooLong(str); } return ShortString.wrap(bytes32(uint256(bytes32(bstr)) | bstr.length)); } /** * @dev Decode a `ShortString` back to a "normal" string. */ function toString(ShortString sstr) internal pure returns (string memory) { uint256 len = byteLength(sstr); // using `new string(len)` would work locally but is not memory safe. string memory str = new string(32); /// @solidity memory-safe-assembly assembly { mstore(str, len) mstore(add(str, 0x20), sstr) } return str; } /** * @dev Return the length of a `ShortString`. */ function byteLength(ShortString sstr) internal pure returns (uint256) { uint256 result = uint256(ShortString.unwrap(sstr)) & 0xFF; if (result > 31) { revert InvalidShortString(); } return result; } /** * @dev Encode a string into a `ShortString`, or write it to storage if it is too long. */ function toShortStringWithFallback(string memory value, string storage store) internal returns (ShortString) { if (bytes(value).length < 32) { return toShortString(value); } else { StorageSlot.getStringSlot(store).value = value; return ShortString.wrap(_FALLBACK_SENTINEL); } } /** * @dev Decode a string that was encoded to `ShortString` or written to storage using {setWithFallback}. */ function toStringWithFallback(ShortString value, string storage store) internal pure returns (string memory) { if (ShortString.unwrap(value) != _FALLBACK_SENTINEL) { return toString(value); } else { return store; } } /** * @dev Return the length of a string that was encoded to `ShortString` or written to storage using {setWithFallback}. * * WARNING: This will return the "byte length" of the string. This may not reflect the actual length in terms of * actual characters as the UTF-8 encoding of a single character can span over multiple bytes. */ function byteLengthWithFallback(ShortString value, string storage store) internal view returns (uint256) { if (ShortString.unwrap(value) != _FALLBACK_SENTINEL) { return byteLength(value); } else { return bytes(store).length; } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/StorageSlot.sol) // This file was procedurally generated from scripts/generate/templates/StorageSlot.js. pragma solidity ^0.8.0; /** * @dev Library for reading and writing primitive types to specific storage slots. * * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. * This library helps with reading and writing to such slots without the need for inline assembly. * * The functions in this library return Slot structs that contain a `value` member that can be used to read or write. * * Example usage to set ERC1967 implementation slot: * ```solidity * contract ERC1967 { * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; * * function _getImplementation() internal view returns (address) { * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; * } * * function _setImplementation(address newImplementation) internal { * require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` * * _Available since v4.1 for `address`, `bool`, `bytes32`, `uint256`._ * _Available since v4.9 for `string`, `bytes`._ */ library StorageSlot { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } struct StringSlot { string value; } struct BytesSlot { bytes value; } /** * @dev Returns an `AddressSlot` with member `value` located at `slot`. */ function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BooleanSlot` with member `value` located at `slot`. */ function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Bytes32Slot` with member `value` located at `slot`. */ function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Uint256Slot` with member `value` located at `slot`. */ function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `StringSlot` with member `value` located at `slot`. */ function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `StringSlot` representation of the string storage pointer `store`. */ function getStringSlot(string storage store) internal pure returns (StringSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := store.slot } } /** * @dev Returns an `BytesSlot` with member `value` located at `slot`. */ function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`. */ function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := store.slot } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol) pragma solidity ^0.8.0; import "./math/Math.sol"; import "./math/SignedMath.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant _SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), _SYMBOLS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `int256` to its ASCII `string` decimal representation. */ function toString(int256 value) internal pure returns (string memory) { return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMath.abs(value)))); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, Math.log256(value) + 1); } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } /** * @dev Returns true if the two strings are equal. */ function equal(string memory a, string memory b) internal pure returns (bool) { return keccak256(bytes(a)) == keccak256(bytes(b)); } }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Callback for IUniswapV3PoolActions#swap /// @notice Any contract that calls IUniswapV3PoolActions#swap must implement this interface interface IUniswapV3SwapCallback { /// @notice Called to `msg.sender` after executing a swap via IUniswapV3Pool#swap. /// @dev In the implementation you must pay the pool tokens owed for the swap. /// The caller of this method must be checked to be a UniswapV3Pool deployed by the canonical UniswapV3Factory. /// amount0Delta and amount1Delta can both be 0 if no tokens were swapped. /// @param amount0Delta The amount of token0 that was sent (negative) or must be received (positive) by the pool by /// the end of the swap. If positive, the callback must send that amount of token0 to the pool. /// @param amount1Delta The amount of token1 that was sent (negative) or must be received (positive) by the pool by /// the end of the swap. If positive, the callback must send that amount of token1 to the pool. /// @param data Any data passed through by the caller via the IUniswapV3PoolActions#swap call function uniswapV3SwapCallback( int256 amount0Delta, int256 amount1Delta, bytes calldata data ) external; }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.4.0; /// @title FixedPoint96 /// @notice A library for handling binary fixed point numbers, see https://en.wikipedia.org/wiki/Q_(number_format) /// @dev Used in SqrtPriceMath.sol library FixedPoint96 { uint8 internal constant RESOLUTION = 96; uint256 internal constant Q96 = 0x1000000000000000000000000; }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Immutable state /// @notice Functions that return immutable state of the router interface IPeripheryImmutableState { /// @return Returns the address of the Uniswap V3 factory function factory() external view returns (address); /// @return Returns the address of WETH9 function WETH9() external view returns (address); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.7.5; pragma abicoder v2; import '@uniswap/v3-core/contracts/interfaces/callback/IUniswapV3SwapCallback.sol'; /// @title Router token swapping functionality /// @notice Functions for swapping tokens via Uniswap V3 interface ISwapRouter is IUniswapV3SwapCallback { struct ExactInputSingleParams { address tokenIn; address tokenOut; uint24 fee; address recipient; uint256 deadline; uint256 amountIn; uint256 amountOutMinimum; uint160 sqrtPriceLimitX96; } /// @notice Swaps `amountIn` of one token for as much as possible of another token /// @param params The parameters necessary for the swap, encoded as `ExactInputSingleParams` in calldata /// @return amountOut The amount of the received token function exactInputSingle(ExactInputSingleParams calldata params) external payable returns (uint256 amountOut); struct ExactInputParams { bytes path; address recipient; uint256 deadline; uint256 amountIn; uint256 amountOutMinimum; } /// @notice Swaps `amountIn` of one token for as much as possible of another along the specified path /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata /// @return amountOut The amount of the received token function exactInput(ExactInputParams calldata params) external payable returns (uint256 amountOut); struct ExactOutputSingleParams { address tokenIn; address tokenOut; uint24 fee; address recipient; uint256 deadline; uint256 amountOut; uint256 amountInMaximum; uint160 sqrtPriceLimitX96; } /// @notice Swaps as little as possible of one token for `amountOut` of another token /// @param params The parameters necessary for the swap, encoded as `ExactOutputSingleParams` in calldata /// @return amountIn The amount of the input token function exactOutputSingle(ExactOutputSingleParams calldata params) external payable returns (uint256 amountIn); struct ExactOutputParams { bytes path; address recipient; uint256 deadline; uint256 amountOut; uint256 amountInMaximum; } /// @notice Swaps as little as possible of one token for `amountOut` of another along the specified path (reversed) /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactOutputParams` in calldata /// @return amountIn The amount of the input token function exactOutput(ExactOutputParams calldata params) external payable returns (uint256 amountIn); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Permit.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; import "./interfaces/IDecentralizedIndex.sol"; import "./interfaces/IFlashLoanRecipient.sol"; import "./interfaces/IProtocolFeeRouter.sol"; import "./interfaces/ITokenRewards.sol"; import "./interfaces/IUniswapV2Factory.sol"; import "./interfaces/IUniswapV2Router02.sol"; import "./StakingPoolToken.sol"; abstract contract DecentralizedIndex is IDecentralizedIndex, ERC20, ERC20Permit, Pausable { using SafeERC20 for IERC20; uint256 constant DEN = 10000; uint256 constant SWAP_DELAY = 20; // seconds address public STABLECOIN; IProtocolFeeRouter PROTOCOL_FEE_ROUTER; uint256 public constant override FLASH_FEE = 10; // 10 STABLECOIN address public immutable override PAIRED_LP_TOKEN; address immutable V2_ROUTER; address V2_POOL; address immutable WETH; IndexType public immutable override indexType; uint256 public immutable override created; address public immutable override lpStakingPool; address public immutable override lpRewardsToken; address public override partner; Fees public fees; IndexAssetInfo[] public indexTokens; mapping(address => bool) _isTokenInIndex; mapping(address => uint256) _fundTokenIdx; mapping(address => bool) public whiteListArb; uint256 _partnerFirstWrapped; uint256 _lastSwap; bool _swapping; bool _swapAndFeeOn = true; bool _unlocked = true; bool _initialized; event FlashLoan( address indexed executor, address indexed recipient, address token, uint256 amount ); event Buy( address indexed user, uint indexed buyFee, address token, uint256 amount ); event Sell( address indexed user, uint indexed sellFee, address token, uint256 amount ); modifier lock() { require(_unlocked, "LOCKED"); _unlocked = false; _; _unlocked = true; } modifier onlyPartner() { require(_msgSender() == partner, "PARTNER"); _; } modifier onlyRewards() { require( _msgSender() == StakingPoolToken(lpStakingPool).poolRewards(), "REWARDS" ); _; } modifier noSwapOrFee() { _swapAndFeeOn = false; _; _swapAndFeeOn = true; } constructor( IndexType _idxType, IDeploy.Deploy memory _deploy ) ERC20(_deploy._name, _deploy._symbol) ERC20Permit(_deploy._name) { require(_deploy._fees.buy <= (DEN * 20) / 100, "lte20%"); require(_deploy._fees.sell <= (DEN * 20) / 100, "lte20%"); require(_deploy._fees.burn <= (DEN * 70) / 100, "lte70%"); require(_deploy._fees.bond <= (DEN * 99) / 100, "lt99%"); require(_deploy._fees.debond <= (DEN * 99) / 100, "lt99%"); require(_deploy._fees.partner <= (DEN * 5) / 100, "lte5%"); STABLECOIN = _deploy._stableCoin; PROTOCOL_FEE_ROUTER = IProtocolFeeRouter(_deploy._feeRouter); WETH = IUniswapV2Router02(_deploy._v2Router).WETH(); indexType = _idxType; created = block.timestamp; fees = _deploy._fees; partner = _deploy._partner; lpRewardsToken = _deploy._lpRewardsToken; V2_ROUTER = _deploy._v2Router; address _finalPairedLpToken = _deploy._pairedLpToken == address(0) ? STABLECOIN : _deploy._pairedLpToken; PAIRED_LP_TOKEN = _finalPairedLpToken; lpStakingPool = address( new StakingPoolToken( IDeploy.DeployStakinPool({ _name: string(abi.encodePacked("Staked ", _deploy._name)), _symbol: string(abi.encodePacked("s", _deploy._symbol)), _pairedLpToken: _finalPairedLpToken, _stakingToken: address(0), _rewardsToken: _deploy._lpRewardsToken, _stakeUserRestriction: _deploy._stakeRestriction ? _msgSender() : address(0), _feeRouter: address(PROTOCOL_FEE_ROUTER), _WETH: WETH, _stableCoin: STABLECOIN, _v2Router: _deploy._v2Router, _quoter: _deploy._quoter, _routerv3: _deploy._routerv3 }) ) ); emit Create(address(this), _msgSender()); // IBlast(0x4300000000000000000000000000000000000002) // .configureClaimableGas(); // IBlast(0x2536FE9ab3F511540F2f9e2eC2A805005C3Dd800) // .configurePointsOperator(_msgSender()); // IBlast(0x4300000000000000000000000000000000000002).configureGovernor( // _msgSender() // ); } function initialize() external { require(!_initialized, "INITED"); address _v2Pool = IUniswapV2Factory( IUniswapV2Router02(V2_ROUTER).factory() ).createPair(address(this), PAIRED_LP_TOKEN); V2_POOL = _v2Pool; StakingPoolToken(lpStakingPool).init(V2_POOL); _initialized = true; } function _transfer( address _from, address _to, uint256 _amount ) internal virtual override { bool isArbBot = whiteListArb[msg.sender]; bool _buy = _from == V2_POOL && _to != address(V2_ROUTER); bool _sell = _to == V2_POOL; uint256 _fee; if (!_swapping && _swapAndFeeOn) { if (_from != V2_POOL) { _processPreSwapFeesAndSwap(); } if (_buy && fees.buy > 0) { if (isArbBot) { _fee = (_amount * (fees.buy / 2)) / DEN; } else { _fee = (_amount * fees.buy) / DEN; } super._transfer(_from, address(this), _fee); emit Buy(msg.sender, _fee, address(this), _amount); } if (_sell && fees.sell > 0) { if (isArbBot) { _fee = (_amount * (fees.sell / 2)) / DEN; } else { _fee = (_amount * fees.sell) / DEN; } super._transfer(_from, address(this), _fee); emit Sell(msg.sender, _fee, address(this), _amount); } } _processBurnFee(_fee); super._transfer(_from, _to, _amount - _fee); } function _processPreSwapFeesAndSwap() internal { bool _passesSwapDelay = block.timestamp > _lastSwap + SWAP_DELAY; uint256 _bal = balanceOf(address(this)); uint256 _lpBal = balanceOf(V2_POOL); uint256 _min = (_lpBal * 1) / 100; // 1% LP bal if (_passesSwapDelay && _bal >= _min && _lpBal > 0) { _swapping = true; _lastSwap = block.timestamp; uint256 _totalAmt = _bal >= _min * 25 ? _min * 25 : _bal >= _min * 10 ? _min * 10 : _min; uint256 _partnerAmt; if (fees.partner > 0 && partner != address(0)) { _partnerAmt = (_totalAmt * fees.partner) / DEN; super._transfer(address(this), partner, _partnerAmt); } _feeSwap(_totalAmt - _partnerAmt); _swapping = false; } } function _processBurnFee(uint256 _amtToProcess) internal { if (_amtToProcess == 0 || fees.burn == 0) { return; } _burn(address(this), (_amtToProcess * fees.burn) / DEN); } function _feeSwap(uint256 _amount) internal { address[] memory path = new address[](2); path[0] = address(this); path[1] = PAIRED_LP_TOKEN; _approve(address(this), V2_ROUTER, _amount); address _rewards = StakingPoolToken(lpStakingPool).poolRewards(); uint256 _pairedLpBalBefore = IERC20(PAIRED_LP_TOKEN).balanceOf( address(this) ); address _recipient = PAIRED_LP_TOKEN == lpRewardsToken ? address(this) : _rewards; IUniswapV2Router02(V2_ROUTER) .swapExactTokensForTokensSupportingFeeOnTransferTokens( _amount, 0, path, _recipient, block.timestamp ); if (PAIRED_LP_TOKEN == lpRewardsToken) { uint256 _newPairedLpTkns = IERC20(PAIRED_LP_TOKEN).balanceOf( address(this) ) - _pairedLpBalBefore; if (_newPairedLpTkns > 0) { IERC20(PAIRED_LP_TOKEN).safeIncreaseAllowance( _rewards, _newPairedLpTkns ); ITokenRewards(_rewards).depositRewards(_newPairedLpTkns); } } else if (IERC20(PAIRED_LP_TOKEN).balanceOf(_rewards) > 0) { ITokenRewards(_rewards).depositFromPairedLpToken(0, 0); } } function _transferFromAndValidate( IERC20 _token, address _sender, uint256 _amount ) internal { uint256 _balanceBefore = _token.balanceOf(address(this)); _token.transferFrom(_sender, address(this), _amount); require( _token.balanceOf(address(this)) >= _balanceBefore + _amount, "TFRVAL" ); } function _bond() internal { if (_partnerFirstWrapped == 0 && _msgSender() == partner) { _partnerFirstWrapped = block.timestamp; } } function _canWrapFeeFree(address _wrapper) internal view returns (bool) { return _isFirstIn() || (_wrapper == partner && _partnerFirstWrapped == 0 && block.timestamp <= created + 7 days); } function _isFirstIn() internal view returns (bool) { return totalSupply() == 0; } function _isLastOut(uint256 _debondAmount) internal view returns (bool) { return _debondAmount >= (totalSupply() * 98) / 100; } function processPreSwapFeesAndSwap() external override onlyRewards { _processPreSwapFeesAndSwap(); } function BOND_FEE() external view override returns (uint256) { return fees.bond; } function DEBOND_FEE() external view override returns (uint256) { return fees.debond; } function isAsset(address _token) public view override returns (bool) { return _isTokenInIndex[_token]; } function getAllAssets() external view override returns (IndexAssetInfo[] memory) { return indexTokens; } function burn(uint256 _amount) external lock { _burn(_msgSender(), _amount); } function addLiquidityV2( uint256 _idxLPTokens, uint256 _pairedLPTokens, uint256 _slippage, // 100 == 10%, 1000 == 100% uint256 _deadline ) external override lock noSwapOrFee whenNotPaused { uint256 _idxTokensBefore = balanceOf(address(this)); uint256 _pairedBefore = IERC20(PAIRED_LP_TOKEN).balanceOf( address(this) ); super._transfer(_msgSender(), address(this), _idxLPTokens); _approve(address(this), V2_ROUTER, _idxLPTokens); IERC20(PAIRED_LP_TOKEN).transferFrom( _msgSender(), address(this), _pairedLPTokens ); IERC20(PAIRED_LP_TOKEN).safeIncreaseAllowance( V2_ROUTER, _pairedLPTokens ); IUniswapV2Router02(V2_ROUTER).addLiquidity( address(this), PAIRED_LP_TOKEN, _idxLPTokens, _pairedLPTokens, (_idxLPTokens * (1000 - _slippage)) / 1000, (_pairedLPTokens * (1000 - _slippage)) / 1000, _msgSender(), _deadline ); uint256 _remainingAllowance = IERC20(PAIRED_LP_TOKEN).allowance( address(this), V2_ROUTER ); if (_remainingAllowance > 0) { IERC20(PAIRED_LP_TOKEN).safeDecreaseAllowance( V2_ROUTER, _remainingAllowance ); } // check & refund excess tokens from LPing if (balanceOf(address(this)) > _idxTokensBefore) { super._transfer( address(this), _msgSender(), balanceOf(address(this)) - _idxTokensBefore ); } if (IERC20(PAIRED_LP_TOKEN).balanceOf(address(this)) > _pairedBefore) { IERC20(PAIRED_LP_TOKEN).transfer( _msgSender(), IERC20(PAIRED_LP_TOKEN).balanceOf(address(this)) - _pairedBefore ); } emit AddLiquidity(_msgSender(), _idxLPTokens, _pairedLPTokens); } function removeLiquidityV2( uint256 _lpTokens, uint256 _minIdxTokens, // 0 == 100% slippage uint256 _minPairedLpToken, // 0 == 100% slippage uint256 _deadline ) external override lock noSwapOrFee whenNotPaused { _lpTokens = _lpTokens == 0 ? IERC20(V2_POOL).balanceOf(_msgSender()) : _lpTokens; require(_lpTokens > 0, "LPREM"); IERC20(V2_POOL).transferFrom(_msgSender(), address(this), _lpTokens); IERC20(V2_POOL).safeIncreaseAllowance(V2_ROUTER, _lpTokens); IUniswapV2Router02(V2_ROUTER).removeLiquidity( address(this), PAIRED_LP_TOKEN, _lpTokens, _minIdxTokens, _minPairedLpToken, _msgSender(), _deadline ); emit RemoveLiquidity(_msgSender(), _lpTokens); } function flash( address _recipient, address _token, uint256 _amount, bytes calldata _data ) external override lock whenNotPaused { require(_isTokenInIndex[_token], "ONLYPODTKN"); bool isArbBot = whiteListArb[msg.sender]; if (isArbBot) { uint256 _balance = IERC20(_token).balanceOf(address(this)); IERC20(_token).transfer(_recipient, _amount); IFlashLoanRecipient(_recipient).callback(_data); require( IERC20(_token).balanceOf(address(this)) >= _balance, "FLASHAFTER" ); emit FlashLoan(_msgSender(), _recipient, _token, _amount); } else { uint256 _amountSTABLECOIN = FLASH_FEE * 10 ** IERC20Metadata(STABLECOIN).decimals(); address _rewards = StakingPoolToken(lpStakingPool).poolRewards(); address _feeRecipient = lpRewardsToken == STABLECOIN ? address(this) : PAIRED_LP_TOKEN == STABLECOIN ? _rewards : partner; IERC20(STABLECOIN).transferFrom( _msgSender(), _feeRecipient, _amountSTABLECOIN ); if (lpRewardsToken == STABLECOIN) { IERC20(STABLECOIN).safeIncreaseAllowance( _rewards, _amountSTABLECOIN ); ITokenRewards(_rewards).depositRewards(_amountSTABLECOIN); } uint256 _balance = IERC20(_token).balanceOf(address(this)); IERC20(_token).transfer(_recipient, _amount); IFlashLoanRecipient(_recipient).callback(_data); require( IERC20(_token).balanceOf(address(this)) >= _balance, "FLASHAFTER" ); emit FlashLoan(_msgSender(), _recipient, _token, _amount); } } function setPartner(address _partner) external onlyPartner { partner = _partner; } function setPartnerFee(uint256 _fee) external onlyPartner { require(_fee < fees.partner, "LTCUR"); fees.partner = _fee; } function setBurnFee(uint256 _fee) external onlyPartner { require(_fee <= (DEN * 70) / 100, "lte70%"); fees.burn = _fee; } function setBuyFee(uint256 _fee) external onlyPartner { require(_fee <= (DEN * 20) / 100, "lte20%"); fees.buy = _fee; } function setSellFee(uint256 _fee) external onlyPartner { require(_fee <= (DEN * 20) / 100, "lte20%"); fees.sell = _fee; } function setBondFee(uint256 _fee) external onlyPartner { require(_fee <= (DEN * 99) / 100, "lt99%"); fees.bond = _fee; } function setDebondFee(uint256 _fee) external onlyPartner { require(_fee <= (DEN * 99) / 100, "lt99%"); fees.debond = _fee; } function rescueERC20(address _token) external lock onlyPartner { IERC20(_token).transfer( partner, IERC20(_token).balanceOf(address(this)) ); } function rescueETH() external lock onlyPartner { require(address(this).balance > 0, "NOETH"); (bool _sent, ) = partner.call{value: address(this).balance}(""); require(_sent, "SENT"); } function setWhitelistArb(address arb, bool isAllow) external onlyPartner { whiteListArb[arb] = isAllow; } }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.7.5; /// @title Callback for IPoolActions#swap /// @notice Any contract that calls IPoolActions#swap must implement this interface interface ISwapCallback { /// @notice Called to `msg.sender` after executing a swap via IPool#swap. /// @dev In the implementation you must pay the pool tokens owed for the swap. /// The caller of this method must be checked to be a Pool deployed by the canonical PoolFactory. /// amount0Delta and amount1Delta can both be 0 if no tokens were swapped. /// @param amount0Delta The amount of token0 that was sent (negative) or must be received (positive) by the pool by /// the end of the swap. If positive, the callback must send that amount of token0 to the pool. /// @param amount1Delta The amount of token1 that was sent (negative) or must be received (positive) by the pool by /// the end of the swap. If positive, the callback must send that amount of token1 to the pool. /// @param data Any data passed through by the caller via the IPoolActions#swap call function uniswapV3SwapCallback(int256 amount0Delta, int256 amount1Delta, bytes calldata data) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; interface IDecentralizedIndex is IERC20 { enum IndexType { WEIGHTED, UNWEIGHTED } // all fees: 1 == 0.01%, 10 == 0.1%, 100 == 1% struct Fees { uint256 burn; uint256 bond; uint256 debond; uint256 buy; uint256 sell; uint256 partner; } struct IndexAssetInfo { address token; uint256 weighting; uint256 basePriceUSDX96; address c1; // arbitrary contract/address field we can use for an index uint256 q1; // arbitrary quantity/number field we can use for an index } event Create(address indexed newIdx, address indexed wallet); event Bond( address indexed wallet, address indexed token, uint256 amountTokensBonded, uint256 amountTokensMinted, uint256 indexed feesBond ); event Debond( address indexed wallet, uint256 amountDebonded, uint256 indexed feesDebond ); event AddLiquidity( address indexed wallet, uint256 amountTokens, uint256 amountDAI ); event RemoveLiquidity(address indexed wallet, uint256 amountLiquidity); function BOND_FEE() external view returns (uint256); function DEBOND_FEE() external view returns (uint256); function STABLECOIN() external view returns (address); function FLASH_FEE() external view returns (uint256); function PAIRED_LP_TOKEN() external view returns (address); function indexType() external view returns (IndexType); function created() external view returns (uint256); function lpStakingPool() external view returns (address); function lpRewardsToken() external view returns (address); function partner() external view returns (address); function isAsset(address token) external view returns (bool); function getAllAssets() external view returns (IndexAssetInfo[] memory); function getInitialAmount( address sToken, uint256 sAmount, address tToken ) external view returns (uint256); function processPreSwapFeesAndSwap() external; function bond( address token, uint256 amount, uint256 amountMintMin ) external; function debond( uint256 amount, address[] memory token, uint8[] memory percentage ) external; function addLiquidityV2( uint256 idxTokens, uint256 daiTokens, uint256 slippage, uint256 deadline ) external; function removeLiquidityV2( uint256 lpTokens, uint256 minTokens, uint256 minDAI, uint256 deadline ) external; function flash( address recipient, address token, uint256 amount, bytes calldata data ) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IDecentralizedIndex.sol"; interface IDeploy { struct DeployStakinPool { string _name; string _symbol; address _pairedLpToken; address _stakingToken; address _rewardsToken; address _stakeUserRestriction; address _feeRouter; address _WETH; address _stableCoin; address _v2Router; address _quoter; address _routerv3; } struct Deploy { string _name; string _symbol; IDecentralizedIndex.Fees _fees; address[] _tokens; uint256[] _weights; address _partner; address _pairedLpToken; address _lpRewardsToken; address _v2Router; bool _stakeRestriction; address _stableCoin; address _feeRouter; address _quoter; address _routerv3; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; interface IFlashLoanRecipient { function callback(bytes calldata data) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; import './IProtocolFees.sol'; interface IProtocolFeeRouter { function protocolFees() external view returns (IProtocolFees); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; interface IProtocolFees { event SetYieldAdmin(uint256 newFee); event SetYieldBurn(uint256 newFee); function DEN() external view returns (uint256); function yieldAdmin() external view returns (uint256); function yieldBurn() external view returns (uint256); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.7.5; pragma abicoder v2; /// @title QuoterV2 Interface /// @notice Supports quoting the calculated amounts from exact input or exact output swaps. /// @notice For each pool also tells you the number of initialized ticks crossed and the sqrt price of the pool after the swap. /// @dev These functions are not marked view because they rely on calling non-view functions and reverting /// to compute the result. They are also not gas efficient and should not be called on-chain. interface IQuoterV2 { /// @notice Returns the amount out received for a given exact input swap without executing the swap /// @param path The path of the swap, i.e. each token pair and the pool fee /// @param amountIn The amount of the first token to swap /// @return amountOut The amount of the last token that would be received /// @return sqrtPriceX96AfterList List of the sqrt price after the swap for each pool in the path /// @return initializedTicksCrossedList List of the initialized ticks that the swap crossed for each pool in the path /// @return gasEstimate The estimate of the gas that the swap consumes function quoteExactInput(bytes memory path, uint256 amountIn) external returns ( uint256 amountOut, uint160[] memory sqrtPriceX96AfterList, uint32[] memory initializedTicksCrossedList, uint256 gasEstimate ); struct QuoteExactInputSingleParams { address tokenIn; address tokenOut; uint256 amountIn; uint24 fee; uint160 sqrtPriceLimitX96; } /// @notice Returns the amount out received for a given exact input but for a swap of a single pool /// @param params The params for the quote, encoded as `QuoteExactInputSingleParams` /// tokenIn The token being swapped in /// tokenOut The token being swapped out /// fee The fee of the token pool to consider for the pair /// amountIn The desired input amount /// sqrtPriceLimitX96 The price limit of the pool that cannot be exceeded by the swap /// @return amountOut The amount of `tokenOut` that would be received /// @return sqrtPriceX96After The sqrt price of the pool after the swap /// @return initializedTicksCrossed The number of initialized ticks that the swap crossed /// @return gasEstimate The estimate of the gas that the swap consumes function quoteExactInputSingle(QuoteExactInputSingleParams memory params) external returns ( uint256 amountOut, uint160 sqrtPriceX96After, uint32 initializedTicksCrossed, uint256 gasEstimate ); /// @notice Returns the amount in required for a given exact output swap without executing the swap /// @param path The path of the swap, i.e. each token pair and the pool fee. Path must be provided in reverse order /// @param amountOut The amount of the last token to receive /// @return amountIn The amount of first token required to be paid /// @return sqrtPriceX96AfterList List of the sqrt price after the swap for each pool in the path /// @return initializedTicksCrossedList List of the initialized ticks that the swap crossed for each pool in the path /// @return gasEstimate The estimate of the gas that the swap consumes function quoteExactOutput(bytes memory path, uint256 amountOut) external returns ( uint256 amountIn, uint160[] memory sqrtPriceX96AfterList, uint32[] memory initializedTicksCrossedList, uint256 gasEstimate ); struct QuoteExactOutputSingleParams { address tokenIn; address tokenOut; uint256 amount; uint24 fee; uint160 sqrtPriceLimitX96; } /// @notice Returns the amount in required to receive the given exact output amount but for a swap of a single pool /// @param params The params for the quote, encoded as `QuoteExactOutputSingleParams` /// tokenIn The token being swapped in /// tokenOut The token being swapped out /// fee The fee of the token pool to consider for the pair /// amountOut The desired output amount /// sqrtPriceLimitX96 The price limit of the pool that cannot be exceeded by the swap /// @return amountIn The amount required as the input for the swap in order to receive `amountOut` /// @return sqrtPriceX96After The sqrt price of the pool after the swap /// @return initializedTicksCrossed The number of initialized ticks that the swap crossed /// @return gasEstimate The estimate of the gas that the swap consumes function quoteExactOutputSingle(QuoteExactOutputSingleParams memory params) external returns ( uint256 amountIn, uint160 sqrtPriceX96After, uint32 initializedTicksCrossed, uint256 gasEstimate ); function factory() external returns(address); function WETH9() external returns(address); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; interface IStakingPoolToken { event Stake(address indexed executor, address indexed user, uint256 amount); event Unstake(address indexed user, uint256 amount); function indexFund() external view returns (address); function stakingToken() external view returns (address); function poolRewards() external view returns (address); function stakeUserRestriction() external view returns (address); function stake(address user, uint256 amount) external; function unstake(uint256 amount) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; interface ITOKEN is IERC20 { event Burn(address indexed user, uint256 amount); function burn(uint256 amount) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; interface ITokenRewards { event AddShares(address indexed wallet, uint256 amount); event RemoveShares(address indexed wallet, uint256 amount); event ClaimReward(address indexed wallet); event DistributeReward(address indexed wallet, uint256 amount); event DepositRewards(address indexed wallet, uint256 amount); function totalShares() external view returns (uint256); function totalStakers() external view returns (uint256); function rewardsToken() external view returns (address); function trackingToken() external view returns (address); function depositFromPairedLpToken( uint256 amount, uint256 slippageOverride ) external; function depositRewards(uint256 amount) external; function claimReward(address wallet) external; function setShares( address wallet, uint256 amount, bool sharesRemoving ) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; interface IUniswapV2Factory { function feeTo() external view returns (address owner); function yieldTo() external view returns (address owner); function yieldCut() external view returns (uint); function WETH() external view returns (address); function ws() external view returns (address); function createPair( address tokenA, address tokenB ) external returns (address pair); function getPair( address tokenA, address tokenB ) external view returns (address pair); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; interface IUniswapV2Pair { function token0() external view returns (address); function token1() external view returns (address); function balanceOf(address user) external view returns (uint); function totalSupply() external view returns (uint); function kLast() external view returns (uint); function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; interface IUniswapV2Router02 { function factory() external view returns (address); function WETH() external view returns (address); function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut); function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts); function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts); function addLiquidity( address tokenA, address tokenB, uint amountADesired, uint amountBDesired, uint amountAMin, uint amountBMin, address to, uint deadline ) external returns (uint amountA, uint amountB, uint liquidity); function removeLiquidity( address tokenA, address tokenB, uint liquidity, uint amountAMin, uint amountBMin, address to, uint deadline ) external returns (uint amountA, uint amountB); function swapETHForExactTokens( uint256 amountOut, address[] calldata path, address to, uint256 deadline ) external payable returns (uint256[] memory amounts); function swapExactTokensForTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external returns (uint[] memory amounts); function swapExactETHForTokens(uint256 amountOutMin, address[] calldata path, address to, uint256 deadline) external payable returns (uint256[] memory amounts); function swapExactTokensForTokensSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; function removeLiquidityETH( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external returns (uint amountToken, uint amountETH); function quote(uint256 amountA, uint256 reserveA, uint256 reserveB) external view returns (uint256 amountB); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.7.5; pragma abicoder v2; import "./callback/ISwapCallback.sol"; /// @title Router token swapping functionality /// @notice Functions for swapping tokens via Thruster CLMM interface IUniswapV3Router is ISwapCallback { struct ExactInputSingleParams { address tokenIn; address tokenOut; uint24 fee; address recipient; // uint256 deadline; uint256 amountIn; uint256 amountOutMinimum; uint160 sqrtPriceLimitX96; } /// @notice Swaps `amountIn` of one token for as much as possible of another token /// @param params The parameters necessary for the swap, encoded as `ExactInputSingleParams` in calldata /// @return amountOut The amount of the received token function exactInputSingle( ExactInputSingleParams calldata params ) external payable returns (uint256 amountOut); struct ExactInputParams { bytes path; address recipient; uint256 deadline; uint256 amountIn; uint256 amountOutMinimum; } /// @notice Swaps `amountIn` of one token for as much as possible of another along the specified path /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata /// @return amountOut The amount of the received token function exactInput( ExactInputParams calldata params ) external payable returns (uint256 amountOut); struct ExactOutputSingleParams { address tokenIn; address tokenOut; uint24 fee; address recipient; uint256 deadline; uint256 amountOut; uint256 amountInMaximum; uint160 sqrtPriceLimitX96; } /// @notice Swaps as little as possible of one token for `amountOut` of another token /// @param params The parameters necessary for the swap, encoded as `ExactOutputSingleParams` in calldata /// @return amountIn The amount of the input token function exactOutputSingle( ExactOutputSingleParams calldata params ) external payable returns (uint256 amountIn); struct ExactOutputParams { bytes path; address recipient; uint256 deadline; uint256 amountOut; uint256 amountInMaximum; } /// @notice Swaps as little as possible of one token for `amountOut` of another along the specified path (reversed) /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactOutputParams` in calldata /// @return amountIn The amount of the input token function exactOutput( ExactOutputParams calldata params ) external payable returns (uint256 amountIn); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.7.5; pragma abicoder v2; import "./callback/ISwapCallback.sol"; interface IUniswapV3RouterALT is ISwapCallback { struct ExactInputSingleParams { address tokenIn; address tokenOut; uint24 fee; address recipient; uint256 deadline; uint256 amountIn; uint256 amountOutMinimum; uint160 sqrtPriceLimitX96; } function exactInputSingle( ExactInputSingleParams calldata params ) external payable returns (uint256 amountOut); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; interface IV3TwapUtilities { function getV3Pool( address v3Factory, address token0, address token1, uint24 poolFee ) external view returns (address); function getPoolPriceUSDX96( address pricePool, address nativeStablePool, address WETH9 ) external view returns (uint256); function sqrtPriceX96FromPoolAndInterval( address pool ) external view returns (uint160); function priceX96FromSqrtPriceX96( uint160 sqrtPriceX96 ) external pure returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; // ---------------------------------------------------------------------------- // BokkyPooBah's DateTime Library v1.00 // // A gas-efficient Solidity date and time library // // https://github.com/bokkypoobah/BokkyPooBahsDateTimeLibrary // // Tested date range 1970/01/01 to 2345/12/31 // // Conventions: // Unit | Range | Notes // :-------- |:-------------:|:----- // timestamp | >= 0 | Unix timestamp, number of seconds since 1970/01/01 00:00:00 UTC // year | 1970 ... 2345 | // month | 1 ... 12 | // day | 1 ... 31 | // hour | 0 ... 23 | // minute | 0 ... 59 | // second | 0 ... 59 | // dayOfWeek | 1 ... 7 | 1 = Monday, ..., 7 = Sunday // // // Enjoy. (c) BokkyPooBah / Bok Consulting Pty Ltd 2018. // // GNU Lesser General Public License 3.0 // https://www.gnu.org/licenses/lgpl-3.0.en.html // ---------------------------------------------------------------------------- library BokkyPooBahsDateTimeLibrary { uint constant SECONDS_PER_DAY = 24 * 60 * 60; int constant OFFSET19700101 = 2440588; // ------------------------------------------------------------------------ // Calculate year/month/day from the number of days since 1970/01/01 using // the date conversion algorithm from // http://aa.usno.navy.mil/faq/docs/JD_Formula.php // and adding the offset 2440588 so that 1970/01/01 is day 0 // // int L = days + 68569 + offset // int N = 4 * L / 146097 // L = L - (146097 * N + 3) / 4 // year = 4000 * (L + 1) / 1461001 // L = L - 1461 * year / 4 + 31 // month = 80 * L / 2447 // dd = L - 2447 * month / 80 // L = month / 11 // month = month + 2 - 12 * L // year = 100 * (N - 49) + year + L // ------------------------------------------------------------------------ function _daysToDate( uint _days ) internal pure returns (uint year, uint month, uint day) { int __days = int(_days); int L = __days + 68569 + OFFSET19700101; int N = (4 * L) / 146097; L = L - (146097 * N + 3) / 4; int _year = (4000 * (L + 1)) / 1461001; L = L - (1461 * _year) / 4 + 31; int _month = (80 * L) / 2447; int _day = L - (2447 * _month) / 80; L = _month / 11; _month = _month + 2 - 12 * L; _year = 100 * (N - 49) + _year + L; year = uint(_year); month = uint(_month); day = uint(_day); } function timestampToDate( uint timestamp ) internal pure returns (uint year, uint month, uint day) { (year, month, day) = _daysToDate(timestamp / SECONDS_PER_DAY); } }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Provides functions for deriving a pool address from the factory, tokens, and the fee library PoolAddress { bytes32 internal constant POOL_INIT_CODE_HASH = 0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54; /// @notice The identifying key of the pool struct PoolKey { address token0; address token1; uint24 fee; } /// @notice Returns PoolKey: the ordered tokens with the matched fee levels /// @param tokenA The first token of a pool, unsorted /// @param tokenB The second token of a pool, unsorted /// @param fee The fee level of the pool /// @return Poolkey The pool details with ordered token0 and token1 assignments function getPoolKey( address tokenA, address tokenB, uint24 fee ) internal pure returns (PoolKey memory) { if (tokenA > tokenB) (tokenA, tokenB) = (tokenB, tokenA); return PoolKey({ token0: tokenA, token1: tokenB, fee: fee }); } /// @notice Deterministically computes the pool address given the factory and PoolKey /// @param factory The Uniswap V3 factory contract address /// @param key The PoolKey /// @return pool The contract address of the V3 pool function computeAddress( address factory, PoolKey memory key ) internal pure returns (address pool) { require(key.token0 < key.token1); pool = address( uint160( uint256( keccak256( abi.encodePacked( hex'ff', factory, keccak256(abi.encode(key.token0, key.token1, key.fee)), POOL_INIT_CODE_HASH ) ) ) ) ); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "./interfaces/IStakingPoolToken.sol"; import "./interfaces/IDeploy.sol"; import "./TokenRewards.sol"; interface IBlast { enum YieldMode { AUTOMATIC, VOID, CLAIMABLE } enum GasMode { VOID, CLAIMABLE } function configure(YieldMode) external returns (uint256); function configureClaimableYield() external; function configureClaimableGas() external; function configureGovernor(address _governor) external; function configurePointsOperator(address operator) external; function claimYield(address contractAddress, address recipientOfYield, uint256 amount) external returns (uint256); function claimAllYield(address contractAddress, address recipientOfYield) external returns (uint256); function claim(address recipient, uint256 amount) external returns (uint256); function getClaimableAmount(address account) external view returns (uint256); } contract StakingPoolToken is IStakingPoolToken, ERC20 { using SafeERC20 for IERC20; address public immutable override indexFund; address public override stakingToken; address public immutable override poolRewards; address public override stakeUserRestriction; bool _initialized; modifier onlyRestricted() { require(_msgSender() == stakeUserRestriction, "RESUSERAUTH"); _; } constructor( IDeploy.DeployStakinPool memory _deploy ) ERC20(_deploy._name, _deploy._symbol) { indexFund = _msgSender(); stakingToken = _deploy._stakingToken; stakeUserRestriction = _deploy._stakeUserRestriction; poolRewards = address( new TokenRewards( _deploy._feeRouter, indexFund, _deploy._pairedLpToken, address(this), _deploy._rewardsToken, _deploy._WETH, _deploy._stableCoin, _deploy._v2Router, _deploy._quoter, _deploy._routerv3 ) ); } function init(address _lpForStaking) external { require(!_initialized, "INITED"); stakingToken = _lpForStaking; _initialized = true; } function stake(address _user, uint256 _amount) external override { if (stakeUserRestriction != address(0)) { require(_user == stakeUserRestriction, "RESTRICT"); } _mint(_user, _amount); IERC20(stakingToken).transferFrom(_msgSender(), address(this), _amount); emit Stake(_msgSender(), _user, _amount); } function unstake(uint256 _amount) external override { _burn(_msgSender(), _amount); IERC20(stakingToken).transfer(_msgSender(), _amount); emit Unstake(_msgSender(), _amount); } function removeStakeUserRestriction() external onlyRestricted { stakeUserRestriction = address(0); } function setStakeUserRestriction(address _user) external onlyRestricted { stakeUserRestriction = _user; } function _afterTokenTransfer( address _from, address _to, uint256 _amount ) internal override { if (_from != address(0) && _from != address(0xdead)) { TokenRewards(poolRewards).setShares(_from, _amount, true); } if (_to != address(0) && _to != address(0xdead)) { TokenRewards(poolRewards).setShares(_to, _amount, false); } } function withdrawERC20(address token) external { require( msg.sender == IDecentralizedIndex(indexFund).partner(), "ACCESS_ERR" ); IERC20(token).transfer( IDecentralizedIndex(indexFund).partner(), IERC20(token).balanceOf(address(this)) ); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/utils/Context.sol"; import "@uniswap/v3-core/contracts/libraries/FixedPoint96.sol"; import "@uniswap/v3-periphery/contracts/interfaces/ISwapRouter.sol"; import "@uniswap/v3-periphery/contracts/interfaces/IPeripheryImmutableState.sol"; import "./interfaces/IDecentralizedIndex.sol"; import "./interfaces/ITOKEN.sol"; import "./interfaces/IQuoterV2.sol"; import "./interfaces/IProtocolFees.sol"; import "./interfaces/IProtocolFeeRouter.sol"; import "./interfaces/ITokenRewards.sol"; import "./interfaces/IUniswapV2Router02.sol"; import "./interfaces/IUniswapV3Router.sol"; import "./libraries/BokkyPooBahsDateTimeLibrary.sol"; import "./libraries/PoolAddress.sol"; import "./interfaces/IUniswapV3RouterALT.sol"; contract TokenRewards is ITokenRewards, Context { using SafeERC20 for IERC20; address public WETH; address public STABLECOIN; address public v2Router; uint256 _swapSlippage = 10; // 1% uint256 constant PRECISION = 10 ** 36; uint24 constant REWARDS_POOL_FEE = 10000; // 1% address immutable INDEX_FUND; address immutable PAIRED_LP_TOKEN; IProtocolFeeRouter immutable PROTOCOL_FEE_ROUTER; IQuoterV2 public quoter; IUniswapV3Router public routerV3; struct Reward { uint256 excluded; uint256 realized; } enum SWAP { V2, V3_500, V3_3000 } address public immutable override trackingToken; address public immutable override rewardsToken; uint256 public override totalShares; uint256 public override totalStakers; mapping(address => uint256) public shares; mapping(address => Reward) public rewards; uint256 _rewardsSwapSlippage = 10; // 1% uint256 _rewardsPerShare; uint256 public rewardsDistributed; uint256 public rewardsDeposited; modifier onlyTrackingToken() { require(_msgSender() == trackingToken, "UNAUTHORIZED"); _; } constructor( address _feeRouter, address _indexFund, address _pairedLpToken, address _trackingToken, address _rewardsToken, address _WETH, address _stableCoin, address _v2Router, address _quoter, address _routerv3 ) { PROTOCOL_FEE_ROUTER = IProtocolFeeRouter(_feeRouter); INDEX_FUND = _indexFund; PAIRED_LP_TOKEN = _pairedLpToken; trackingToken = _trackingToken; rewardsToken = _rewardsToken; WETH = _WETH; STABLECOIN = _stableCoin; v2Router = _v2Router; quoter = IQuoterV2(_quoter); routerV3 = IUniswapV3Router(_routerv3); } function setShares( address _wallet, uint256 _amount, bool _sharesRemoving ) external override onlyTrackingToken { _setShares(_wallet, _amount, _sharesRemoving); } function _setShares( address _wallet, uint256 _amount, bool _sharesRemoving ) internal { _processFeesIfApplicable(); if (_sharesRemoving) { _removeShares(_wallet, _amount); emit RemoveShares(_wallet, _amount); } else { _addShares(_wallet, _amount); emit AddShares(_wallet, _amount); } } function _addShares(address _wallet, uint256 _amount) internal { if (shares[_wallet] > 0) { _distributeReward(_wallet); } uint256 sharesBefore = shares[_wallet]; totalShares += _amount; shares[_wallet] += _amount; if (sharesBefore == 0 && shares[_wallet] > 0) { totalStakers++; } rewards[_wallet].excluded = _cumulativeRewards(shares[_wallet]); } function _removeShares(address _wallet, uint256 _amount) internal { require(shares[_wallet] > 0 && _amount <= shares[_wallet], "REMOVE"); _distributeReward(_wallet); totalShares -= _amount; shares[_wallet] -= _amount; if (shares[_wallet] == 0) { totalStakers--; } rewards[_wallet].excluded = _cumulativeRewards(shares[_wallet]); } function _processFeesIfApplicable() internal { IDecentralizedIndex(INDEX_FUND).processPreSwapFeesAndSwap(); if ( rewardsToken != PAIRED_LP_TOKEN && IERC20(PAIRED_LP_TOKEN).balanceOf(address(this)) > 0 ) { depositFromPairedLpToken(0, 0); } } function depositFromPairedLpToken( uint256 _amountTknDepositing, uint256 /*_slippageOverride*/ ) public override { require(PAIRED_LP_TOKEN != rewardsToken, "LPREWSAME"); if (_amountTknDepositing > 0) { IERC20(PAIRED_LP_TOKEN).transferFrom( _msgSender(), address(this), _amountTknDepositing ); } uint256 _amountTkn = IERC20(PAIRED_LP_TOKEN).balanceOf(address(this)); require(_amountTkn > 0, "NEEDTKN"); uint256 _rewardsBalBefore = IERC20(rewardsToken).balanceOf( address(this) ); uint256 _adminAmt; (uint256 _yieldAdminFee, ) = _getYieldFees(); if (_yieldAdminFee > 0) { _adminAmt = (_amountTkn * _yieldAdminFee) / PROTOCOL_FEE_ROUTER.protocolFees().DEN(); _amountTkn -= _adminAmt; } IERC20(PAIRED_LP_TOKEN).safeIncreaseAllowance(v2Router, _amountTkn); uint rewardBalance; if (PAIRED_LP_TOKEN == STABLECOIN) { rewardBalance = _swapper(STABLECOIN, _amountTkn); } if (PAIRED_LP_TOKEN != STABLECOIN) { IDecentralizedIndex.IndexAssetInfo[] memory baseAssets = IDecentralizedIndex(PAIRED_LP_TOKEN) .getAllAssets(); uint baseTokenBefore = IERC20(baseAssets[0].token).balanceOf( address(this) ); address[] memory token = new address[](1); token[0] = address(0); uint8[] memory percentage = new uint8[](1); percentage[0] = 0; IDecentralizedIndex(PAIRED_LP_TOKEN).debond( _amountTkn, token, percentage ); uint baseTokenAfter = IERC20(baseAssets[0].token).balanceOf( address(this) ); rewardBalance = _swapper( baseAssets[0].token, baseTokenAfter - baseTokenBefore ); if (_adminAmt > 0) { uint refundAmount; try IERC20(PAIRED_LP_TOKEN).transfer( IDecentralizedIndex(INDEX_FUND).partner(), _adminAmt ) { refundAmount = 0; } catch { refundAmount = _adminAmt; } IERC20(PAIRED_LP_TOKEN).transfer( IDecentralizedIndex(INDEX_FUND).partner(), refundAmount ); } } _depositRewards( IERC20(rewardsToken).balanceOf(address(this)) - _rewardsBalBefore ); } function depositRewards(uint256 _amount) external override { require(_amount > 0, "DEPAM"); uint256 _rewardsBalBefore = IERC20(rewardsToken).balanceOf( address(this) ); IERC20(rewardsToken).transferFrom(_msgSender(), address(this), _amount); _depositRewards( IERC20(rewardsToken).balanceOf(address(this)) - _rewardsBalBefore ); } function _depositRewards(uint256 _amountTotal) internal { if (_amountTotal == 0) { return; } if (totalShares == 0) { _burnRewards(_amountTotal); return; } uint256 _depositAmount = _amountTotal; (, uint256 _yieldBurnFee) = _getYieldFees(); if (_yieldBurnFee > 0) { uint256 _burnAmount = (_amountTotal * _yieldBurnFee) / PROTOCOL_FEE_ROUTER.protocolFees().DEN(); if (_burnAmount > 0) { _burnRewards(_burnAmount); _depositAmount -= _burnAmount; } } rewardsDeposited += _depositAmount; _rewardsPerShare += (PRECISION * _depositAmount) / totalShares; emit DepositRewards(_msgSender(), _depositAmount); } function _distributeReward(address _wallet) internal { if (shares[_wallet] == 0) { return; } uint256 _amount = getUnpaid(_wallet); rewards[_wallet].realized += _amount; rewards[_wallet].excluded = _cumulativeRewards(shares[_wallet]); if (_amount > 0) { rewardsDistributed += _amount; IERC20(rewardsToken).transfer(_wallet, _amount); emit DistributeReward(_wallet, _amount); } } function _burnRewards(uint256 _burnAmount) internal { try ITOKEN(rewardsToken).burn(_burnAmount) {} catch { IERC20(rewardsToken).transfer(address(0xdead), _burnAmount); } } function _getYieldFees() internal view returns (uint256 _admin, uint256 _burn) { IProtocolFees _fees = PROTOCOL_FEE_ROUTER.protocolFees(); if (address(_fees) != address(0)) { _admin = _fees.yieldAdmin(); _burn = _fees.yieldBurn(); } } function claimReward(address _wallet) external override { _distributeReward(_wallet); emit ClaimReward(_wallet); } function getUnpaid(address _wallet) public view returns (uint256) { if (shares[_wallet] == 0) { return 0; } uint256 earnedRewards = _cumulativeRewards(shares[_wallet]); uint256 rewardsExcluded = rewards[_wallet].excluded; if (earnedRewards <= rewardsExcluded) { return 0; } return earnedRewards - rewardsExcluded; } function _cumulativeRewards( uint256 _share ) internal view returns (uint256) { return (_share * _rewardsPerShare) / PRECISION; } function _swapper( address token, uint amount ) internal returns (uint swappedRewards) { if (token != WETH) { address[] memory path = new address[](2); path[0] = token; path[1] = WETH; swappedRewards = _swap(path, amount); path[0] = WETH; path[1] = rewardsToken; swappedRewards = _swap(path, IERC20(WETH).balanceOf(address(this))); } if (token == WETH) { address[] memory path = new address[](2); path[0] = WETH; path[1] = rewardsToken; swappedRewards = _swap(path, amount); } } function _swap(address[] memory path, uint amount) internal returns (uint) { uint balanceBefore = IERC20(path[path.length - 1]).balanceOf( address(this) ); (SWAP decision, uint24 fee, uint amountOut) = decider( amount, path[0], path[1] ); uint amountOutMin = (amountOut * (1000 - _swapSlippage)) / 1000; if (decision == SWAP.V2) { IERC20(path[0]).approve(address(v2Router), amount); IUniswapV2Router02(v2Router).swapExactTokensForTokens( amount, amountOutMin, path, address(this), block.timestamp ); } else { _swapV3Single( path[0], fee, path[1], amount, _swapSlippage, address(this) ); } uint balanceAfter = IERC20(path[path.length - 1]).balanceOf( address(this) ); return balanceAfter - balanceBefore; } function changeSwapSlippage(uint _newSlippage) external { require( msg.sender == IDecentralizedIndex(INDEX_FUND).partner(), "ACCESS_ERR" ); _swapSlippage = _newSlippage; } function decider( uint amount, address tokenA, address tokenB ) internal returns (SWAP decision, uint24, uint) { uint256 amount1 = getQuote(tokenA, tokenB, amount, 500); //fee 0.5% uint256 amount2 = getQuote(tokenA, tokenB, amount, 3000); //fe 3.0% address[] memory path = new address[](2); path[0] = tokenA; path[1] = tokenB; uint256 amount3; try IUniswapV2Router02(v2Router).getAmountsOut(amount, path) returns ( uint256[] memory result ) { amount3 = result[1]; } catch { amount3 = 0; } uint maxAmount = amount1; uint24 fee = 500; decision = SWAP.V3_500; if (amount2 > maxAmount) { maxAmount = amount2; decision = SWAP.V3_3000; fee = 3000; } if (amount3 > maxAmount) { maxAmount = amount3; decision = SWAP.V2; fee = 0; } return (decision, fee, maxAmount); } function getQuote( address tokenIn, address tokenOut, uint256 amountIn, uint24 fee ) internal returns (uint256) { uint256 amountOut; IQuoterV2.QuoteExactInputSingleParams memory params = IQuoterV2 .QuoteExactInputSingleParams({ tokenIn: tokenIn, tokenOut: tokenOut, amountIn: amountIn, fee: fee, sqrtPriceLimitX96: 0 }); try quoter.quoteExactInputSingle(params) returns ( uint256 out, uint160, uint32, uint256 ) { amountOut = out; } catch { amountOut = 0; } return amountOut; } function _swapV3Single( address _in, uint24 _fee, address _out, uint256 _amountIn, uint256 _slippage, address recipient ) internal { IERC20(_in).safeIncreaseAllowance(address(routerV3), _amountIn); uint _amountOutMin = getQuote(_in, _out, _amountIn, _fee); try IUniswapV3Router(routerV3).exactInputSingle( IUniswapV3Router.ExactInputSingleParams({ tokenIn: _in, tokenOut: _out, fee: _fee, recipient: recipient, amountIn: _amountIn, amountOutMinimum: _amountOutMin - ((_amountOutMin * _slippage) / 1000), sqrtPriceLimitX96: 0 }) ) { } catch { IUniswapV3RouterALT(address(routerV3)).exactInputSingle( IUniswapV3RouterALT.ExactInputSingleParams({ tokenIn: _in, tokenOut: _out, fee: _fee, recipient: recipient, deadline: block.timestamp, amountIn: _amountIn, amountOutMinimum: _amountOutMin - ((_amountOutMin * _slippage) / 1000), sqrtPriceLimitX96: 0 })); } } }
{ "optimizer": { "enabled": true, "runs": 0, "details": { "yul": true, "yulDetails": { "optimizerSteps": "dhfoDgvulfnTUtnIf [xa[r]scLM cCTUtTOntnfDIul Lcul Vcul [j] Tpeul xa[rul] xa[r]cL gvif CTUca[r]LsTOtfDnca[r]Iulc] jmul[jul] VcTOcul jmul" } } }, "evmVersion": "paris", "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"components":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"components":[{"internalType":"uint256","name":"burn","type":"uint256"},{"internalType":"uint256","name":"bond","type":"uint256"},{"internalType":"uint256","name":"debond","type":"uint256"},{"internalType":"uint256","name":"buy","type":"uint256"},{"internalType":"uint256","name":"sell","type":"uint256"},{"internalType":"uint256","name":"partner","type":"uint256"}],"internalType":"struct IDecentralizedIndex.Fees","name":"_fees","type":"tuple"},{"internalType":"address[]","name":"_tokens","type":"address[]"},{"internalType":"uint256[]","name":"_weights","type":"uint256[]"},{"internalType":"address","name":"_partner","type":"address"},{"internalType":"address","name":"_pairedLpToken","type":"address"},{"internalType":"address","name":"_lpRewardsToken","type":"address"},{"internalType":"address","name":"_v2Router","type":"address"},{"internalType":"bool","name":"_stakeRestriction","type":"bool"},{"internalType":"address","name":"_stableCoin","type":"address"},{"internalType":"address","name":"_feeRouter","type":"address"},{"internalType":"address","name":"_quoter","type":"address"},{"internalType":"address","name":"_routerv3","type":"address"}],"internalType":"struct IDeploy.Deploy","name":"_deploy","type":"tuple"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"InvalidShortString","type":"error"},{"inputs":[{"internalType":"string","name":"str","type":"string"}],"name":"StringTooLong","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"wallet","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountTokens","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountDAI","type":"uint256"}],"name":"AddLiquidity","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"wallet","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountTokensBonded","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountTokensMinted","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"feesBond","type":"uint256"}],"name":"Bond","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"buyFee","type":"uint256"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Buy","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"newIdx","type":"address"},{"indexed":true,"internalType":"address","name":"wallet","type":"address"}],"name":"Create","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"wallet","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountDebonded","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"feesDebond","type":"uint256"}],"name":"Debond","type":"event"},{"anonymous":false,"inputs":[],"name":"EIP712DomainChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"executor","type":"address"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"FlashLoan","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"wallet","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountLiquidity","type":"uint256"}],"name":"RemoveLiquidity","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"sellFee","type":"uint256"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Sell","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"BOND_FEE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEBOND_FEE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DOMAIN_SEPARATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"FLASH_FEE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PAIRED_LP_TOKEN","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"STABLECOIN","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_idxLPTokens","type":"uint256"},{"internalType":"uint256","name":"_pairedLPTokens","type":"uint256"},{"internalType":"uint256","name":"_slippage","type":"uint256"},{"internalType":"uint256","name":"_deadline","type":"uint256"}],"name":"addLiquidityV2","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_amountMintMin","type":"uint256"}],"name":"bond","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"created","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"address[]","name":"","type":"address[]"},{"internalType":"uint8[]","name":"","type":"uint8[]"}],"name":"debond","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"eip712Domain","outputs":[{"internalType":"bytes1","name":"fields","type":"bytes1"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"version","type":"string"},{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"address","name":"verifyingContract","type":"address"},{"internalType":"bytes32","name":"salt","type":"bytes32"},{"internalType":"uint256[]","name":"extensions","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"fees","outputs":[{"internalType":"uint256","name":"burn","type":"uint256"},{"internalType":"uint256","name":"bond","type":"uint256"},{"internalType":"uint256","name":"debond","type":"uint256"},{"internalType":"uint256","name":"buy","type":"uint256"},{"internalType":"uint256","name":"sell","type":"uint256"},{"internalType":"uint256","name":"partner","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_recipient","type":"address"},{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"flash","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getAllAssets","outputs":[{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"weighting","type":"uint256"},{"internalType":"uint256","name":"basePriceUSDX96","type":"uint256"},{"internalType":"address","name":"c1","type":"address"},{"internalType":"uint256","name":"q1","type":"uint256"}],"internalType":"struct IDecentralizedIndex.IndexAssetInfo[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_sourceToken","type":"address"},{"internalType":"uint256","name":"_sourceAmount","type":"uint256"},{"internalType":"address","name":"_targetToken","type":"address"}],"name":"getInitialAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"indexTokens","outputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"weighting","type":"uint256"},{"internalType":"uint256","name":"basePriceUSDX96","type":"uint256"},{"internalType":"address","name":"c1","type":"address"},{"internalType":"uint256","name":"q1","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"indexType","outputs":[{"internalType":"enum IDecentralizedIndex.IndexType","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"isAsset","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lpRewardsToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lpStakingPool","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"nonces","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"partner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"permit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"processPreSwapFeesAndSwap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_lpTokens","type":"uint256"},{"internalType":"uint256","name":"_minIdxTokens","type":"uint256"},{"internalType":"uint256","name":"_minPairedLpToken","type":"uint256"},{"internalType":"uint256","name":"_deadline","type":"uint256"}],"name":"removeLiquidityV2","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"rescueERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rescueETH","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_fee","type":"uint256"}],"name":"setBondFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_fee","type":"uint256"}],"name":"setBurnFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_fee","type":"uint256"}],"name":"setBuyFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_fee","type":"uint256"}],"name":"setDebondFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_partner","type":"address"}],"name":"setPartner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_fee","type":"uint256"}],"name":"setPartnerFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_fee","type":"uint256"}],"name":"setSellFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"arb","type":"address"},{"internalType":"bool","name":"isAllow","type":"bool"}],"name":"setWhitelistArb","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"whiteListArb","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
6102606040526019805462ffff001916620101001790553480156200002357600080fd5b506040516200b5c33803806200b5c3833981016040819052620000469162000e38565b600081806000015180604051806040016040528060018152602001603160f81b81525083600001518460200151816003908162000084919062001087565b50600462000093828262001087565b50620000a59150839050600562000b34565b61012052620000b681600662000b34565b61014052815160208084019190912060e052815190820120610100524660a0526200014460e05161010051604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201529081019290925260608201524660808201523060a082015260009060c00160405160208183030381529060405280519060200120905090565b60805250503060c052506009805460ff19169055606462000169612710601462001169565b62000175919062001183565b8160400151606001511115620001a85760405162461bcd60e51b81526004016200019f90620011a6565b60405180910390fd5b6064620001b9612710601462001169565b620001c5919062001183565b8160400151608001511115620001ef5760405162461bcd60e51b81526004016200019f90620011a6565b606462000200612710604662001169565b6200020c919062001183565b60408201515111156200024b5760405162461bcd60e51b81526020600482015260066024820152656c746537302560d01b60448201526064016200019f565b60646200025c612710606362001169565b62000268919062001183565b8160400151602001511115620002925760405162461bcd60e51b81526004016200019f90620011c6565b6064620002a3612710606362001169565b620002af919062001183565b8160400151604001511115620002d95760405162461bcd60e51b81526004016200019f90620011c6565b6064620002ea612710600562001169565b620002f6919062001183565b816040015160a001511115620003375760405162461bcd60e51b81526020600482015260056024820152646c7465352560d81b60448201526064016200019f565b806101400151600960016101000a8154816001600160a01b0302191690836001600160a01b03160217905550806101600151600a60006101000a8154816001600160a01b0302191690836001600160a01b031602179055508061010001516001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015620003d3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620003f99190620011e5565b6001600160a01b03166101a0528160018111156200041b576200041b6200120a565b6101c08160018111156200043357620004336200120a565b905250426101e0526040818101518051600d556020810151600e5590810151600f556060810151601055608081015160115560a090810151601255810151600c80546001600160a01b0319166001600160a01b0392831617905560e082015181166102205261010082015181166101805260c08201516000911615620004be578160c00151620004d0565b60095461010090046001600160a01b03165b6001600160a01b03811661016052604080516101808101909152835191925090819062000502906101a0830162001220565b604051602081830303815290604052815260200183602001516040516020016200052d919062001251565b6040516020818303038152906040528152602001826001600160a01b0316815260200160006001600160a01b031681526020018360e001516001600160a01b031681526020018361012001516200058657600062000588565b335b6001600160a01b039081168252600a54811660208301526101a080518216604080850191909152600954610100908190048416606086015287015183166080850152610180870151831660a08501529086015190911660c09092019190915251620005f39062000bb0565b620005ff9190620012b7565b604051809103906000f0801580156200061c573d6000803e3d6000fd5b506001600160a01b031661020052604051339030907f96b5b9b8a7193304150caccf9b80d150675fa3d6af57761d8d8ef1d6f9a1a90990600090a35050508061010001516001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa1580156200069e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620006c49190620011e5565b6001600160a01b03166102405260808101515160608201515114620007155760405162461bcd60e51b81526004016200019f906020808252600490820152631253925560e21b604082015260600190565b60005b816060015151811015620009bc576014600083606001518381518110620007435762000743620013d8565b6020908102919091018101516001600160a01b031682528101919091526040016000205460ff16156200079f5760405162461bcd60e51b815260206004820152600360248201526204455560ec1b60448201526064016200019f565b600082608001518281518110620007ba57620007ba620013d8565b602002602001015111620007fa5760405162461bcd60e51b81526004016200019f9060208082526004908201526315d5905360e21b604082015260600190565b60136040518060a0016040528084606001518481518110620008205762000820620013d8565b60200260200101516001600160a01b03168152602001846080015184815181106200084f576200084f620013d8565b602090810291909101810151825260008282018190526040808401829052606093840182905285546001818101885596835291839020855160059093020180546001600160a01b039384166001600160a01b03199182161782559386015196810196909655840151600286015591830151600385018054919093169116179055608090810151600490920191909155820151805182908110620008f657620008f6620013d8565b6020026020010151601a6000828254620009119190620013ee565b92505081905550806015600084606001518481518110620009365762000936620013d8565b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000208190555060016014600084606001518481518110620009815762000981620013d8565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff191691151591909117905560010162000718565b5060008160800151600081518110620009d957620009d9620013d8565b6020026020010151601a546c01000000000000000000000000620009fe919062001169565b62000a0a919062001183565b905060005b82606001515181101562000b2b57601a548360600151828151811062000a395762000a39620013d8565b60200260200101516001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000a7f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000aa5919062001404565b62000ab290600a62001553565b838560800151848151811062000acc5762000acc620013d8565b602002602001015162000ae0919062001169565b62000aec919062001169565b62000af8919062001183565b6013828154811062000b0e5762000b0e620013d8565b600091825260209091206004600590920201015560010162000a0f565b505050620015a1565b600060208351101562000b545762000b4c8362000b6d565b905062000b67565b8162000b61848262001087565b5060ff90505b92915050565b600080829050601f8151111562000b9b578260405163305a27a960e01b81526004016200019f919062001567565b805162000ba8826200157c565b179392505050565b614a408062006b8383390190565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b038111828210171562000bff5762000bff62000bbe565b604052919050565b60005b8381101562000c2457818101518382015260200162000c0a565b50506000910152565b600082601f83011262000c3f57600080fd5b81516001600160401b0381111562000c5b5762000c5b62000bbe565b62000c70601f8201601f191660200162000bd4565b81815284602083860101111562000c8657600080fd5b62000c9982602083016020870162000c07565b949350505050565b600060c0828403121562000cb457600080fd5b62000cc060c062000bd4565b9050815181526020820151602082015260408201516040820152606082015160608201526080820151608082015260a082015160a082015292915050565b60006001600160401b0382111562000d1a5762000d1a62000bbe565b5060051b60200190565b80516001600160a01b038116811462000d3c57600080fd5b919050565b600082601f83011262000d5357600080fd5b8151602062000d6c62000d668362000cfe565b62000bd4565b8083825260208201915060208460051b87010193508684111562000d8f57600080fd5b602086015b8481101562000db65762000da88162000d24565b835291830191830162000d94565b509695505050505050565b600082601f83011262000dd357600080fd5b8151602062000de662000d668362000cfe565b8083825260208201915060208460051b87010193508684111562000e0957600080fd5b602086015b8481101562000db6578051835291830191830162000e0e565b8051801515811462000d3c57600080fd5b60006020828403121562000e4b57600080fd5b81516001600160401b038082111562000e6357600080fd5b90830190610260828603121562000e7957600080fd5b6101c062000e878162000bd4565b83518381111562000e9757600080fd5b62000ea58882870162000c2d565b82525060208401518381111562000ebb57600080fd5b62000ec98882870162000c2d565b60208301525062000ede876040860162000ca1565b6040820152610100808501518481111562000ef857600080fd5b62000f068982880162000d41565b606084015250610120808601518581111562000f2157600080fd5b62000f2f8a82890162000dc1565b608085015250610140945062000f4785870162000d24565b60a084015261016062000f5c81880162000d24565b60c085015261018062000f7181890162000d24565b60e08601526101a062000f86818a0162000d24565b8587015262000f97878a0162000e27565b8487015262000faa6101e08a0162000d24565b8887015262000fbd6102008a0162000d24565b8387015262000fd06102208a0162000d24565b8287015262000fe36102408a0162000d24565b9086015250929998505050505050505050565b600181811c908216806200100b57607f821691505b6020821081036200102c57634e487b7160e01b600052602260045260246000fd5b50919050565b601f82111562001082576000816000526020600020601f850160051c810160208610156200105d5750805b601f850160051c820191505b818110156200107e5782815560010162001069565b5050505b505050565b81516001600160401b03811115620010a357620010a362000bbe565b620010bb81620010b4845462000ff6565b8462001032565b602080601f831160018114620010f35760008415620010da5750858301515b600019600386901b1c1916600185901b1785556200107e565b600085815260208120601f198616915b82811015620011245788860151825594840194600190910190840162001103565b5085821015620011435787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b634e487b7160e01b600052601160045260246000fd5b808202811582820484141762000b675762000b6762001153565b600082620011a157634e487b7160e01b600052601260045260246000fd5b500490565b6020808252600690820152656c746532302560d01b604082015260600190565b6020808252600590820152646c7439392560d81b604082015260600190565b600060208284031215620011f857600080fd5b620012038262000d24565b9392505050565b634e487b7160e01b600052602160045260246000fd5b66029ba30b5b2b2160cd1b8152600082516200124481600785016020870162000c07565b9190910160070192915050565b607360f81b8152600082516200126f81600185016020870162000c07565b9190910160010192915050565b600081518084526200129681602086016020860162000c07565b601f01601f19169290920160200192915050565b6001600160a01b03169052565b6020815260008251610180806020850152620012d86101a08501836200127c565b91506020850151601f19858403016040860152620012f783826200127c565b92505060408501516200130e6060860182620012aa565b506060850151620013236080860182620012aa565b5060808501516200133860a0860182620012aa565b5060a08501516200134d60c0860182620012aa565b5060c08501516200136260e0860182620012aa565b5060e08501516101006200137981870183620012aa565b86015190506101206200138f86820183620012aa565b8601519050610140620013a586820183620012aa565b8601519050610160620013bb86820183620012aa565b8601519050620013ce85830182620012aa565b5090949350505050565b634e487b7160e01b600052603260045260246000fd5b8082018082111562000b675762000b6762001153565b6000602082840312156200141757600080fd5b815160ff811681146200120357600080fd5b80825b60018086116200143d57506200146d565b81870482111562001452576200145262001153565b808616156200146057918102915b9490941c9380026200142c565b94509492505050565b600082620014875750600162001203565b81620014965750600062001203565b8160018114620014af5760028114620014ba57620014ee565b600191505062001203565b60ff841115620014ce57620014ce62001153565b6001841b915084821115620014e757620014e762001153565b5062001203565b5060208310610133831016604e8410600b841016171562001526575081810a8381111562001520576200152062001153565b62001203565b62001535848484600162001429565b8086048211156200154a576200154a62001153565b02949350505050565b60006200120360001960ff85168462001476565b6020815260006200120360208301846200127c565b805160208083015191908110156200102c5760001960209190910360031b1b16919050565b60805160a05160c05160e05161010051610120516101405161016051610180516101a0516101c0516101e05161020051610220516102405161542b620017586000396000505060008181610468015281816121020152818161221f01528181614217015261430201526000818161052901528181610e9e01528181611c5301528181612077015261410001526000818161032001526139f10152600061042101526000505060008181610d5d0152818161129901528181611381015281816113b001528181611524015281816115c401528181612d4501528181612dd401528181613075015281816140d701526142900152600081816103ed01528181610dee015281816111fb015281816112cd0152818161135f015281816113d8015281816114f5015281816115a201528181611630015281816116b6015281816116f50152818161213d01528181612d880152818161407f01528181614186015281816142410152818161432c0152818161435e0152818161440801526144aa01526000610f8601526000610f5b015260006133630152600061333b01526000613296015260006132c0015260006132ea015261542b6000f3fe608060405234801561001057600080fd5b506004361061025c5760003560e01c806306fdde0314610261578063095ea7b31461027f5780630cc835a3146102a257806318160ddd146102b757806320800a00146102c957806323b872dd146102d157806324f7b216146102e45780632acada4d146102f7578063313ce5671461030c578063325a19f11461031b5780633644e515146103425780633741454d1461034a578063395093511461035d5780633f4ba83a1461037057806342966c68146103785780634a437f881461038b5780634bf2c7c9146103d55780634f4ce61d146103e857806353f504471461041c5780635552c07b1461045057806358f4dcc3146104635780635c975abb1461048a57806370a08231146104955780637ecebe00146104a85780638129fc1c146104bb5780638456cb59146104c357806384b0196e146104cb5780638b4cee08146104e657806390578a12146104f957806393a397761461050c57806394cc699e1461052457806395d89b411461054b5780639af1d35a146105535780639d649e661461059e5780639e0e1050146105a6578063a16d5960146105c9578063a457c2d7146105dc578063a9059cbb146105ef578063a9e9c8bc14610602578063b08d033314610615578063bb46302714610628578063bdbc91ab14610630578063bdc8d06014610643578063be10862b1461064b578063c87fa42a1461065e578063ccec37161461068a578063d505accf1461069d578063dd62ed3e146106b0578063e4b54957146106c3578063ee9c79da146106d6578063f6823996146106e9578063ff140ca6146106fc575b600080fd5b610269610704565b6040516102769190614929565b60405180910390f35b61029261028d366004614951565b610796565b6040519015158152602001610276565b6102b56102b036600461497d565b6107b0565b005b6002545b604051908152602001610276565b6102b5610829565b6102926102df366004614996565b610968565b6102b56102f23660046149e5565b61098e565b6102ff6109ec565b6040516102769190614a1e565b60405160128152602001610276565b6102bb7f000000000000000000000000000000000000000000000000000000000000000081565b6102bb610a83565b6102b561035836600461497d565b610a92565b61029261036b366004614951565b610b03565b6102b5610b25565b6102b561038636600461497d565b610b59565b61039e61039936600461497d565b610b97565b604080516001600160a01b03968716815260208101959095528401929092529092166060820152608081019190915260a001610276565b6102b56103e336600461497d565b610be4565b61040f7f000000000000000000000000000000000000000000000000000000000000000081565b6040516102769190614a9a565b6104437f000000000000000000000000000000000000000000000000000000000000000081565b6040516102769190614ac4565b6102b561045e36600461497d565b610c6d565b61040f7f000000000000000000000000000000000000000000000000000000000000000081565b60095460ff16610292565b6102bb6104a3366004614aec565b610cdd565b6102bb6104b6366004614aec565b610cf8565b6102b5610d16565b6102b5610f1b565b6104d3610f4d565b6040516102769796959493929190614b09565b6102b56104f436600461497d565b610fd6565b6102b561050736600461497d565b611046565b60095461040f9061010090046001600160a01b031681565b61040f7f000000000000000000000000000000000000000000000000000000000000000081565b6102696110b6565b600d54600e54600f5460105460115460125461057195949392919086565b604080519687526020870195909552938501929092526060840152608083015260a082015260c001610276565b6102bb600a81565b6102926105b4366004614aec565b60166020526000908152604090205460ff1681565b6102b56105d7366004614aec565b6110c5565b6102926105ea366004614951565b61111a565b6102926105fd366004614951565b6111a0565b6102b5610610366004614ba2565b6111ae565b6102b5610623366004614bd4565b61182c565b6102b5611c51565b6102b561063e366004614c09565b611d25565b600f546102bb565b600c5461040f906001600160a01b031681565b61029261066c366004614aec565b6001600160a01b031660009081526014602052604090205460ff1690565b6102b5610698366004614aec565b6124e8565b6102b56106ab366004614cb6565b612640565b6102bb6106be366004614d27565b6127a4565b6102bb6106d1366004614d55565b6127cf565b6102b56106e4366004614e78565b612949565b6102b56106f7366004614ba2565b612bcc565b600e546102bb565b60606003805461071390614f44565b80601f016020809104026020016040519081016040528092919081815260200182805461073f90614f44565b801561078c5780601f106107615761010080835404028352916020019161078c565b820191906000526020600020905b81548152906001019060200180831161076f57829003601f168201915b5050505050905090565b6000336107a4818585612ea5565b60019150505b92915050565b600c546001600160a01b0316336001600160a01b0316146107ec5760405162461bcd60e51b81526004016107e390614f78565b60405180910390fd5b60646107fb6127106014614faf565b6108059190614fc6565b8111156108245760405162461bcd60e51b81526004016107e390614fe8565b601055565b60195462010000900460ff166108515760405162461bcd60e51b81526004016107e390615008565b6019805462ff000019169055600c546001600160a01b0316336001600160a01b0316146108905760405162461bcd60e51b81526004016107e390614f78565b600047116108c85760405162461bcd60e51b815260206004820152600560248201526409c9e8aa8960db1b60448201526064016107e3565b600c546040516000916001600160a01b03169047908381818185875af1925050503d8060008114610915576040519150601f19603f3d011682016040523d82523d6000602084013e61091a565b606091505b50509050806109545760405162461bcd60e51b81526004016107e39060208082526004908201526314d1539560e21b604082015260600190565b506019805462ff0000191662010000179055565b600033610976858285612fca565b610981858585613044565b60019150505b9392505050565b600c546001600160a01b0316336001600160a01b0316146109c15760405162461bcd60e51b81526004016107e390614f78565b6001600160a01b03919091166000908152601660205260409020805460ff1916911515919091179055565b60606013805480602002602001604051908101604052809291908181526020016000905b82821015610a7a5760008481526020908190206040805160a0810182526005860290920180546001600160a01b0390811684526001808301548587015260028301549385019390935260038201541660608401526004015460808301529083529092019101610a10565b50505050905090565b6000610a8d613289565b905090565b600c546001600160a01b0316336001600160a01b031614610ac55760405162461bcd60e51b81526004016107e390614f78565b6012548110610afe5760405162461bcd60e51b8152602060048201526005602482015264262a21aaa960d91b60448201526064016107e3565b601255565b6000336107a4818585610b1683836127a4565b610b209190615028565b612ea5565b600c546001600160a01b03163314610b4f5760405162461bcd60e51b81526004016107e39061503b565b610b576133b4565b565b60195462010000900460ff16610b815760405162461bcd60e51b81526004016107e390615008565b6019805462ff0000191690556109543382613400565b60138181548110610ba757600080fd5b6000918252602090912060059091020180546001820154600283015460038401546004909401546001600160a01b03938416955091939092169085565b600c546001600160a01b0316336001600160a01b031614610c175760405162461bcd60e51b81526004016107e390614f78565b6064610c266127106046614faf565b610c309190614fc6565b811115610c685760405162461bcd60e51b81526020600482015260066024820152656c746537302560d01b60448201526064016107e3565b600d55565b600c546001600160a01b0316336001600160a01b031614610ca05760405162461bcd60e51b81526004016107e390614f78565b6064610caf6127106063614faf565b610cb99190614fc6565b811115610cd85760405162461bcd60e51b81526004016107e39061505f565b600e55565b6001600160a01b031660009081526020819052604090205490565b6001600160a01b0381166000908152600760205260408120546107aa565b6019546301000000900460ff1615610d595760405162461bcd60e51b815260206004820152600660248201526512539255115160d21b60448201526064016107e3565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610db9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ddd919061507e565b6001600160a01b031663c9c65396307f00000000000000000000000000000000000000000000000000000000000000006040518363ffffffff1660e01b8152600401610e2a92919061509b565b6020604051808303816000875af1158015610e49573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e6d919061507e565b600b80546001600160a01b0319166001600160a01b0383811691821790925560405163066ad14f60e21b81529293507f0000000000000000000000000000000000000000000000000000000000000000909116916319ab453c91610ed391600401614a9a565b600060405180830381600087803b158015610eed57600080fd5b505af1158015610f01573d6000803e3d6000fd5b50506019805463ff00000019166301000000179055505050565b600c546001600160a01b03163314610f455760405162461bcd60e51b81526004016107e39061503b565b610b5761351d565b600060608082808083610f817f0000000000000000000000000000000000000000000000000000000000000000600561355a565b610fac7f0000000000000000000000000000000000000000000000000000000000000000600661355a565b60408051600080825260208201909252600f60f81b9b939a50919850469750309650945092509050565b600c546001600160a01b0316336001600160a01b0316146110095760405162461bcd60e51b81526004016107e390614f78565b60646110186127106014614faf565b6110229190614fc6565b8111156110415760405162461bcd60e51b81526004016107e390614fe8565b601155565b600c546001600160a01b0316336001600160a01b0316146110795760405162461bcd60e51b81526004016107e390614f78565b60646110886127106063614faf565b6110929190614fc6565b8111156110b15760405162461bcd60e51b81526004016107e39061505f565b600f55565b60606004805461071390614f44565b600c546001600160a01b0316336001600160a01b0316146110f85760405162461bcd60e51b81526004016107e390614f78565b600c80546001600160a01b0319166001600160a01b0392909216919091179055565b6000338161112882866127a4565b9050838110156111885760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b60648201526084016107e3565b6111958286868403612ea5565b506001949350505050565b6000336107a4818585613044565b60195462010000900460ff166111d65760405162461bcd60e51b81526004016107e390615008565b6019805462ffff00191690556111ea613605565b60006111f530610cdd565b905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166370a08231306040518263ffffffff1660e01b81526004016112459190614a9a565b602060405180830381865afa158015611262573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061128691906150b5565b905061129333308861364b565b6112be307f000000000000000000000000000000000000000000000000000000000000000088612ea5565b6040516323b872dd60e01b81527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906323b872dd9061130e90339030908a906004016150ce565b6020604051808303816000875af115801561132d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061135191906150f2565b506113a66001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000167f0000000000000000000000000000000000000000000000000000000000000000876137dd565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001663e8e33700307f000000000000000000000000000000000000000000000000000000000000000089896103e86114068b8261510f565b611410908e614faf565b61141a9190614fc6565b6103e86114278c8261510f565b611431908e614faf565b61143b9190614fc6565b3360405160e089901b6001600160e01b03191681526001600160a01b039788166004820152958716602487015260448601949094526064850192909252608484015260a483015290911660c482015260e48101869052610104016060604051808303816000875af11580156114b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114d89190615122565b5050604051636eb1769f60e11b8152600091506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063dd62ed3e9061154c9030907f00000000000000000000000000000000000000000000000000000000000000009060040161509b565b602060405180830381865afa158015611569573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061158d91906150b5565b905080156115e9576115e96001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000167f0000000000000000000000000000000000000000000000000000000000000000836138b0565b826115f330610cdd565b11156116175761161730338561160830610cdd565b611612919061510f565b61364b565b6040516370a0823160e01b815282906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a0823190611665903090600401614a9a565b602060405180830381865afa158015611682573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116a691906150b5565b11156117d7576001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001663a9059cbb336040516370a0823160e01b815285906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a082319061172a903090600401614a9a565b602060405180830381865afa158015611747573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061176b91906150b5565b611775919061510f565b6040518363ffffffff1660e01b8152600401611792929190615150565b6020604051808303816000875af11580156117b1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117d591906150f2565b505b604080518881526020810188905233917f06239653922ac7bea6aa2b19dc486b9361821d37712eb796adfd38d81de278ca910160405180910390a250506019805462ffff001916620101001790555050505050565b60195462010000900460ff166118545760405162461bcd60e51b81526004016107e390615008565b6019805462ffff0019169055611868613605565b6001600160a01b03831660009081526014602052604090205460ff166118bf5760405162461bcd60e51b815260206004820152600c60248201526b24a72b20a624a22a27a5a2a760a11b60448201526064016107e3565b6001600160a01b0383166000818152601560205260408082205490516370a0823160e01b81529092906370a08231906118fc903090600401614a9a565b602060405180830381865afa158015611919573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061193d91906150b5565b905060006119496139a7565b90506000816119705782611961600160601b88614faf565b61196b9190614fc6565b611976565b600160601b5b9050600082156119e1576013858154811061199357611993615169565b9060005260206000209060050201600401546119ad601290565b6119b890600a615280565b6119c6600160601b8a614faf565b6119d09190614faf565b6119da9190614fc6565b9050611a07565b600160601b826119f060025490565b6119fa9190614faf565b611a049190614fc6565b90505b6000611a12336139b8565b611a3657600e5461271090611a279084614faf565b611a319190614fc6565b611a39565b60005b905086611a46828461510f565b1015611a7a5760405162461bcd60e51b815260206004820152600360248201526226a4a760e91b60448201526064016107e3565b611a8d33611a88838561510f565b613a22565b8015611aa657611a9d3082613a22565b611aa681613acf565b60005b601354811015611be457600085611b6b57600160601b8560138481548110611ad357611ad3615169565b60009182526020909120600590910201546040516370a0823160e01b81526001600160a01b03909116906370a0823190611b11903090600401614a9a565b602060405180830381865afa158015611b2e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b5291906150b5565b611b5c9190614faf565b611b669190614fc6565b611ba2565b611ba28b8b60138581548110611b8357611b83615169565b60009182526020909120600590910201546001600160a01b03166127cf565b9050611bdb60138381548110611bba57611bba615169565b60009182526020909120600590910201546001600160a01b03163383613b0e565b50600101611aa9565b50611bed613ca3565b604080518981526020810184905282916001600160a01b038c169133917fa0d4c018dc52dcb9f3edfde940bbcf3dbedee971c90c17295f3a93003d5e77a2910160405180910390a450506019805462ffff0019166201010017905550505050505050565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316638bc6beb26040518163ffffffff1660e01b8152600401602060405180830381865afa158015611caf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cd3919061507e565b6001600160a01b0316336001600160a01b031614611d1d5760405162461bcd60e51b81526020600482015260076024820152665245574152445360c81b60448201526064016107e3565b610b57613cd1565b60195462010000900460ff16611d4d5760405162461bcd60e51b81526004016107e390615008565b6019805462ff000019169055611d61613605565b6001600160a01b03841660009081526014602052604090205460ff16611db65760405162461bcd60e51b815260206004820152600a60248201526927a7262ca827a22a25a760b11b60448201526064016107e3565b3360009081526016602052604090205460ff168015611fe2576040516370a0823160e01b81526000906001600160a01b038716906370a0823190611dfe903090600401614a9a565b602060405180830381865afa158015611e1b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e3f91906150b5565b60405163a9059cbb60e01b81529091506001600160a01b0387169063a9059cbb90611e70908a908990600401615150565b6020604051808303816000875af1158015611e8f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611eb391906150f2565b50604051633a62959560e21b81526001600160a01b0388169063e98a565490611ee29087908790600401615292565b600060405180830381600087803b158015611efc57600080fd5b505af1158015611f10573d6000803e3d6000fd5b50506040516370a0823160e01b81528392506001600160a01b03891691506370a0823190611f42903090600401614a9a565b602060405180830381865afa158015611f5f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f8391906150b5565b1015611fa15760405162461bcd60e51b81526004016107e3906152c1565b6001600160a01b038716336001600160a01b03166000805160206153b68339815191528888604051611fd4929190615150565b60405180910390a3506124cf565b6000600960019054906101000a90046001600160a01b03166001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015612037573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061205b91906152e5565b61206690600a615280565b61207190600a614faf565b905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316638bc6beb26040518163ffffffff1660e01b8152600401602060405180830381865afa1580156120d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120f7919061507e565b6009549091506000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03908116610100909204161461218a576009547f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03908116610100909204161461218457600c546001600160a01b031661218c565b8161218c565b305b6009546040516323b872dd60e01b815291925061010090046001600160a01b0316906323b872dd906121c6903390859088906004016150ce565b6020604051808303816000875af11580156121e5573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061220991906150f2565b506009546001600160a01b0361010090910481167f0000000000000000000000000000000000000000000000000000000000000000909116036122bd576009546122629061010090046001600160a01b031683856137dd565b6040516345efb3f960e11b8152600481018490526001600160a01b03831690638bdf67f290602401600060405180830381600087803b1580156122a457600080fd5b505af11580156122b8573d6000803e3d6000fd5b505050505b6040516370a0823160e01b81526000906001600160a01b038a16906370a08231906122ec903090600401614a9a565b602060405180830381865afa158015612309573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061232d91906150b5565b60405163a9059cbb60e01b81529091506001600160a01b038a169063a9059cbb9061235e908d908c90600401615150565b6020604051808303816000875af115801561237d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123a191906150f2565b50604051633a62959560e21b81526001600160a01b038b169063e98a5654906123d0908a908a90600401615292565b600060405180830381600087803b1580156123ea57600080fd5b505af11580156123fe573d6000803e3d6000fd5b50506040516370a0823160e01b81528392506001600160a01b038c1691506370a0823190612430903090600401614a9a565b602060405180830381865afa15801561244d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061247191906150b5565b101561248f5760405162461bcd60e51b81526004016107e3906152c1565b6001600160a01b038a16336001600160a01b03166000805160206153b68339815191528b8b6040516124c2929190615150565b60405180910390a3505050505b50506019805462ff000019166201000017905550505050565b60195462010000900460ff166125105760405162461bcd60e51b81526004016107e390615008565b6019805462ff000019169055600c546001600160a01b0316336001600160a01b03161461254f5760405162461bcd60e51b81526004016107e390614f78565b600c546040516370a0823160e01b81526001600160a01b038084169263a9059cbb9291169083906370a082319061258a903090600401614a9a565b602060405180830381865afa1580156125a7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125cb91906150b5565b6040518363ffffffff1660e01b81526004016125e8929190615150565b6020604051808303816000875af1158015612607573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061262b91906150f2565b50506019805462ff0000191662010000179055565b834211156126905760405162461bcd60e51b815260206004820152601d60248201527f45524332305065726d69743a206578706972656420646561646c696e6500000060448201526064016107e3565b60007f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98888886126bf8c613e21565b6040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810186905260e001604051602081830303815290604052805190602001209050600061271a82613e49565b9050600061272a82878787613e76565b9050896001600160a01b0316816001600160a01b03161461278d5760405162461bcd60e51b815260206004820152601e60248201527f45524332305065726d69743a20696e76616c6964207369676e6174757265000060448201526064016107e3565b6127988a8a8a612ea5565b50505050505050505050565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6001600160a01b03808416600081815260156020908152604080832054948616835280832054815163313ce56760e01b815291519395949093909263313ce56792600480820193918290030181865afa158015612830573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061285491906152e5565b61285f90600a615280565b6013838154811061287257612872615169565b906000526020600020906005020160010154856001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa1580156128c2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128e691906152e5565b6128f190600a615280565b6013848154811061290457612904615169565b906000526020600020906005020160010154886129219190614faf565b61292b9190614faf565b6129359190614fc6565b61293f9190614fc6565b9695505050505050565b60195462010000900460ff166129715760405162461bcd60e51b81526004016107e390615008565b6019805462ffff0019169055612985613605565b600061299084613ea0565b6129be57600f54612710906129a5908261510f565b6129af9086614faf565b6129b99190614fc6565b6129c0565b835b905060006129cd60025490565b6129db600160601b84614faf565b6129e59190614fc6565b90506129f2333087613044565b6129fc3083613400565b612a0e612a09838761510f565b613acf565b60005b601354811015612b7457600060138281548110612a3057612a30615169565b60009182526020909120600590910201546040516370a0823160e01b81526001600160a01b03909116906370a0823190612a6e903090600401614a9a565b602060405180830381865afa158015612a8b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612aaf91906150b5565b90506000600160601b612ac28584614faf565b612acc9190614fc6565b90508015612b6a5760138381548110612ae757612ae7615169565b60009182526020909120600590910201546001600160a01b031663a9059cbb33836040518363ffffffff1660e01b8152600401612b25929190615150565b6020604051808303816000875af1158015612b44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b6891906150f2565b505b5050600101612a11565b50612b7f828661510f565b60405186815233907feb4e1f68c885fce0dc37cc7eecbff0d11209b7580c2a5d336015497b20af895f9060200160405180910390a350506019805462ffff00191662010100179055505050565b60195462010000900460ff16612bf45760405162461bcd60e51b81526004016107e390615008565b6019805462ffff0019169055612c08613605565b8315612c145783612c83565b600b546001600160a01b03166370a08231336040518263ffffffff1660e01b8152600401612c429190614a9a565b602060405180830381865afa158015612c5f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c8391906150b5565b935060008411612cbd5760405162461bcd60e51b81526020600482015260056024820152644c5052454d60d81b60448201526064016107e3565b600b546001600160a01b03166323b872dd3330876040518463ffffffff1660e01b8152600401612cef939291906150ce565b6020604051808303816000875af1158015612d0e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d3291906150f2565b50600b54612d6a906001600160a01b03167f0000000000000000000000000000000000000000000000000000000000000000866137dd565b60408051635d5155ef60e11b81523060048201526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811660248301526044820187905260648201869052608482018590523360a483015260c4820184905282517f00000000000000000000000000000000000000000000000000000000000000009091169263baa2abde9260e4808201939182900301816000875af1158015612e1f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e439190615302565b5050612e4c3390565b6001600160a01b03167fdfdd120ded9b7afc0c23dd5310e93aaa3e1c3b9f75af9b805fab3030842439f285604051612e8691815260200190565b60405180910390a250506019805462ffff001916620101001790555050565b6001600160a01b038316612f075760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016107e3565b6001600160a01b038216612f685760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016107e3565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b6000612fd684846127a4565b9050600019811461303e57818110156130315760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e636500000060448201526064016107e3565b61303e8484848403612ea5565b50505050565b33600090815260166020526040812054600b5460ff90911691906001600160a01b0386811691161480156130aa57507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316846001600160a01b031614155b600b546019549192506001600160a01b038681169116149060009060ff161580156130dc5750601954610100900460ff165b1561326857600b546001600160a01b038881169116146130fe576130fe613cd1565b82801561310c575060105415155b156131b3578315613145576010546127109061312a90600290614fc6565b6131349087614faf565b61313e9190614fc6565b9050613163565b601054612710906131569087614faf565b6131609190614fc6565b90505b61316e87308361364b565b80336001600160a01b03167fa76261e4127b2ebc809716d704216602fdaee4ae5b72745ed9aec0d7bd73b75d30886040516131aa929190615150565b60405180910390a35b8180156131c1575060115415155b156132685783156131fa57601154612710906131df90600290614fc6565b6131e99087614faf565b6131f39190614fc6565b9050613218565b6011546127109061320b9087614faf565b6132159190614fc6565b90505b61322387308361364b565b80336001600160a01b03167f463904c4b0359ad674399537c3d4e4e44acc0b0dd259453d17329fd9b4be52c0308860405161325f929190615150565b60405180910390a35b61327181613acf565b6132808787611612848961510f565b50505050505050565b6000306001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161480156132e257507f000000000000000000000000000000000000000000000000000000000000000046145b1561330c57507f000000000000000000000000000000000000000000000000000000000000000090565b610a8d604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201527f0000000000000000000000000000000000000000000000000000000000000000918101919091527f000000000000000000000000000000000000000000000000000000000000000060608201524660808201523060a082015260009060c00160405160208183030381529060405280519060200120905090565b6133bc613ecb565b6009805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516133f69190614a9a565b60405180910390a1565b6001600160a01b0382166134605760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b60648201526084016107e3565b6001600160a01b038216600090815260208190526040902054818110156134d45760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b60648201526084016107e3565b6001600160a01b0383166000818152602081815260408083208686039055600280548790039055518581529192916000805160206153d68339815191529101612fbd565b505050565b613525613605565b6009805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586133e93390565b606060ff83146135745761356d83613f14565b90506107aa565b81805461358090614f44565b80601f01602080910402602001604051908101604052809291908181526020018280546135ac90614f44565b80156135f95780601f106135ce576101008083540402835291602001916135f9565b820191906000526020600020905b8154815290600101906020018083116135dc57829003601f168201915b505050505090506107aa565b60095460ff1615610b575760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016107e3565b6001600160a01b0383166136af5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016107e3565b6001600160a01b0382166137115760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016107e3565b6001600160a01b038316600090815260208190526040902054818110156137895760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b60648201526084016107e3565b6001600160a01b03848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290926000805160206153d6833981519152910160405180910390a361303e565b604051636eb1769f60e11b81526000906001600160a01b0385169063dd62ed3e9061380e903090879060040161509b565b602060405180830381865afa15801561382b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061384f91906150b5565b905061303e8463095ea7b360e01b856138688686615028565b604051602401613879929190615150565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152613f53565b604051636eb1769f60e11b81526000906001600160a01b0385169063dd62ed3e906138e1903090879060040161509b565b602060405180830381865afa1580156138fe573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061392291906150b5565b9050818110156139865760405162461bcd60e51b815260206004820152602960248201527f5361666545524332303a2064656372656173656420616c6c6f77616e63652062604482015268656c6f77207a65726f60b81b60648201526084016107e3565b61303e8463095ea7b360e01b85858503604051602401613879929190615150565b60006139b260025490565b15919050565b60006139c26139a7565b806107aa5750600c546001600160a01b0383811691161480156139e55750601754155b80156107aa5750613a197f000000000000000000000000000000000000000000000000000000000000000062093a80615028565b42111592915050565b6001600160a01b038216613a785760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f20616464726573730060448201526064016107e3565b8060026000828254613a8a9190615028565b90915550506001600160a01b038216600081815260208181526040808320805486019055518481526000805160206153d6833981519152910160405180910390a35050565b801580613adc5750600d54155b15613ae45750565b613b0b30612710600d6000015484613afc9190614faf565b613b069190614fc6565b613400565b50565b6040516370a0823160e01b81526000906001600160a01b038516906370a0823190613b3d903090600401614a9a565b602060405180830381865afa158015613b5a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613b7e91906150b5565b6040516323b872dd60e01b81529091506001600160a01b038516906323b872dd90613bb1908690309087906004016150ce565b6020604051808303816000875af1158015613bd0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613bf491906150f2565b50613bff8282615028565b6040516370a0823160e01b81526001600160a01b038616906370a0823190613c2b903090600401614a9a565b602060405180830381865afa158015613c48573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613c6c91906150b5565b101561303e5760405162461bcd60e51b815260206004820152600660248201526515119495905360d21b60448201526064016107e3565b601754158015613cc65750600c546001600160a01b0316336001600160a01b0316145b15610b575742601755565b60006014601854613ce29190615028565b421190506000613cf130610cdd565b600b54909150600090613d0c906001600160a01b0316610cdd565b905060006064613d1d836001614faf565b613d279190614fc6565b9050838015613d365750808310155b8015613d425750600082115b1561303e576019805460ff1916600117815542601855600090613d66908390614faf565b841015613d9557613d7882600a614faf565b841015613d855781613da0565b613d9082600a614faf565b613da0565b613da0826019614faf565b9050600080600d60050154118015613dc25750600c546001600160a01b031615155b15613dfd5760125461271090613dd89084614faf565b613de29190614fc6565b600c54909150613dfd9030906001600160a01b03168361364b565b613e0f613e0a828461510f565b614028565b50506019805460ff1916905550505050565b6001600160a01b03811660009081526007602052604090208054600181018255905b50919050565b60006107aa613e56613289565b8360405161190160f01b8152600281019290925260228201526042902090565b6000806000613e878787878761458f565b91509150613e9481614649565b5090505b949350505050565b60006064613ead60025490565b613eb8906062614faf565b613ec29190614fc6565b90911015919050565b60095460ff16610b575760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016107e3565b60606000613f218361478e565b604080516020808252818301909252919250600091906020820181803683375050509182525060208101929092525090565b6000613fa8826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166147b69092919063ffffffff16565b9050805160001480613fc9575080806020019051810190613fc991906150f2565b6135185760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016107e3565b604080516002808252606082018352600092602083019080368337019050509050308160008151811061405d5761405d615169565b60200260200101906001600160a01b031690816001600160a01b0316815250507f0000000000000000000000000000000000000000000000000000000000000000816001815181106140b1576140b1615169565b60200260200101906001600160a01b031690816001600160a01b0316815250506140fc307f000000000000000000000000000000000000000000000000000000000000000084612ea5565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316638bc6beb26040518163ffffffff1660e01b8152600401602060405180830381865afa15801561415c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614180919061507e565b905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166370a08231306040518263ffffffff1660e01b81526004016141d09190614a9a565b602060405180830381865afa1580156141ed573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061421191906150b5565b905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316146142745782614276565b305b604051635c11d79560e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690635c11d795906142ce908890600090899087904290600401615326565b600060405180830381600087803b1580156142e857600080fd5b505af11580156142fc573d6000803e3d6000fd5b505050507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031603614490576000827f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166370a08231306040518263ffffffff1660e01b81526004016143a89190614a9a565b602060405180830381865afa1580156143c5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906143e991906150b5565b6143f3919061510f565b9050801561448a5761442f6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001685836137dd565b6040516345efb3f960e11b8152600481018290526001600160a01b03851690638bdf67f290602401600060405180830381600087803b15801561447157600080fd5b505af1158015614485573d6000803e3d6000fd5b505050505b50614588565b6040516370a0823160e01b81526000906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a08231906144df908790600401614a9a565b602060405180830381865afa1580156144fc573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061452091906150b5565b1115614588576040516370b9f1f960e01b815260006004820181905260248201526001600160a01b038416906370b9f1f990604401600060405180830381600087803b15801561456f57600080fd5b505af1158015614583573d6000803e3d6000fd5b505050505b5050505050565b6000806fa2a8918ca85bafe22016d0b997e4df60600160ff1b038311156145bc5750600090506003614640565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015614610573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661463957600060019250925050614640565b9150600090505b94509492505050565b600081600481111561465d5761465d614aae565b036146655750565b600181600481111561467957614679614aae565b036146c15760405162461bcd60e51b815260206004820152601860248201527745434453413a20696e76616c6964207369676e617475726560401b60448201526064016107e3565b60028160048111156146d5576146d5614aae565b036147225760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e6774680060448201526064016107e3565b600381600481111561473657614736614aae565b03613b0b5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b60648201526084016107e3565b600060ff8216601f8111156107aa57604051632cd44ac360e21b815260040160405180910390fd5b6060613e98848460008585600080866001600160a01b031685876040516147dd9190615399565b60006040518083038185875af1925050503d806000811461481a576040519150601f19603f3d011682016040523d82523d6000602084013e61481f565b606091505b50915091506148308783838761483b565b979650505050505050565b606083156148aa5782516000036148a3576001600160a01b0385163b6148a35760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016107e3565b5081613e98565b613e9883838151156148bf5781518083602001fd5b8060405162461bcd60e51b81526004016107e39190614929565b60005b838110156148f45781810151838201526020016148dc565b50506000910152565b600081518084526149158160208601602086016148d9565b601f01601f19169290920160200192915050565b60208152600061098760208301846148fd565b6001600160a01b0381168114613b0b57600080fd5b6000806040838503121561496457600080fd5b823561496f8161493c565b946020939093013593505050565b60006020828403121561498f57600080fd5b5035919050565b6000806000606084860312156149ab57600080fd5b83356149b68161493c565b925060208401356149c68161493c565b929592945050506040919091013590565b8015158114613b0b57600080fd5b600080604083850312156149f857600080fd5b8235614a038161493c565b91506020830135614a13816149d7565b809150509250929050565b602080825282518282018190526000919060409081850190868401855b82811015614a8d57815180516001600160a01b03908116865287820151888701528682015187870152606080830151909116908601526080908101519085015260a09093019290850190600101614a3b565b5091979650505050505050565b6001600160a01b0391909116815260200190565b634e487b7160e01b600052602160045260246000fd5b6020810160028310614ae657634e487b7160e01b600052602160045260246000fd5b91905290565b600060208284031215614afe57600080fd5b81356109878161493c565b60ff60f81b881681526000602060e06020840152614b2a60e084018a6148fd565b8381036040850152614b3c818a6148fd565b606085018990526001600160a01b038816608086015260a0850187905284810360c08601528551808252602080880193509091019060005b81811015614b9057835183529284019291840191600101614b74565b50909c9b505050505050505050505050565b60008060008060808587031215614bb857600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060608486031215614be957600080fd5b8335614bf48161493c565b95602085013595506040909401359392505050565b600080600080600060808688031215614c2157600080fd5b8535614c2c8161493c565b94506020860135614c3c8161493c565b93506040860135925060608601356001600160401b0380821115614c5f57600080fd5b818801915088601f830112614c7357600080fd5b813581811115614c8257600080fd5b896020828501011115614c9457600080fd5b9699959850939650602001949392505050565b60ff81168114613b0b57600080fd5b600080600080600080600060e0888a031215614cd157600080fd5b8735614cdc8161493c565b96506020880135614cec8161493c565b955060408801359450606088013593506080880135614d0a81614ca7565b9699959850939692959460a0840135945060c09093013592915050565b60008060408385031215614d3a57600080fd5b8235614d458161493c565b91506020830135614a138161493c565b600080600060608486031215614d6a57600080fd5b8335614d758161493c565b9250602084013591506040840135614d8c8161493c565b809150509250925092565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715614dd557614dd5614d97565b604052919050565b60006001600160401b03821115614df657614df6614d97565b5060051b60200190565b600082601f830112614e1157600080fd5b81356020614e26614e2183614ddd565b614dad565b8083825260208201915060208460051b870101935086841115614e4857600080fd5b602086015b84811015614e6d578035614e6081614ca7565b8352918301918301614e4d565b509695505050505050565b600080600060608486031215614e8d57600080fd5b833592506020808501356001600160401b0380821115614eac57600080fd5b818701915087601f830112614ec057600080fd5b8135614ece614e2182614ddd565b81815260059190911b8301840190848101908a831115614eed57600080fd5b938501935b82851015614f14578435614f058161493c565b82529385019390850190614ef2565b965050506040870135925080831115614f2c57600080fd5b5050614f3a86828701614e00565b9150509250925092565b600181811c90821680614f5857607f821691505b602082108103613e4357634e487b7160e01b600052602260045260246000fd5b6020808252600790820152662820a92a2722a960c91b604082015260600190565b634e487b7160e01b600052601160045260246000fd5b80820281158282048414176107aa576107aa614f99565b600082614fe357634e487b7160e01b600052601260045260246000fd5b500490565b6020808252600690820152656c746532302560d01b604082015260600190565b6020808252600690820152651313d0d2d15160d21b604082015260600190565b808201808211156107aa576107aa614f99565b6020808252600a908201526920a1a1a2a9a9afa2a92960b11b604082015260600190565b6020808252600590820152646c7439392560d81b604082015260600190565b60006020828403121561509057600080fd5b81516109878161493c565b6001600160a01b0392831681529116602082015260400190565b6000602082840312156150c757600080fd5b5051919050565b6001600160a01b039384168152919092166020820152604081019190915260600190565b60006020828403121561510457600080fd5b8151610987816149d7565b818103818111156107aa576107aa614f99565b60008060006060848603121561513757600080fd5b8351925060208401519150604084015190509250925092565b6001600160a01b03929092168252602082015260400190565b634e487b7160e01b600052603260045260246000fd5b80825b60018086116151915750614640565b8187048211156151a3576151a3614f99565b808616156151b057918102915b9490941c938002615182565b6000826151cb57506001610987565b816151d857506000610987565b81600181146151ee57600281146151f857615225565b6001915050610987565b60ff84111561520957615209614f99565b6001841b91508482111561521f5761521f614f99565b50610987565b5060208310610133831016604e8410600b8410161715615258575081810a8381111561525357615253614f99565b610987565b615265848484600161517f565b80860482111561527757615277614f99565b02949350505050565b600061098760001960ff8516846151bc565b60208152816020820152818360408301376000818301604090810191909152601f909201601f19160101919050565b6020808252600a9082015269232620a9a420a32a22a960b11b604082015260600190565b6000602082840312156152f757600080fd5b815161098781614ca7565b6000806040838503121561531557600080fd5b505080516020909101519092909150565b600060a08201878352602087602085015260a0604085015281875180845260c08601915060208901935060005b818110156153785784516001600160a01b031683529383019391830191600101615353565b50506001600160a01b03969096166060850152505050608001529392505050565b600082516153ab8184602087016148d9565b919091019291505056fe5a9eeaf8949838813289046091e8ea8a9196a2265ac24841464a2d27026a8549ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa26469706673582212209a6d86548462dd76aac58f331415038c9315b0d2ba098ed6dc5a3e9e72e84e5a64736f6c6343000818003360c06040523480156200001157600080fd5b5060405162004a4038038062004a4083398101604081905262000034916200026b565b80516020820151600362000049838262000469565b50600462000058828262000469565b50620000649150503390565b6001600160a01b0390811660808181526060840151600580549185166001600160a01b031992831617905560a0850151600680549190951691161790925560c08301516040808501519385015160e08601516101008701516101208801516101408901516101608a01519551969896309690620000e1906200016a565b6001600160a01b039a8b168152988a1660208a015296891660408901529488166060880152928716608087015290861660a0860152851660c0850152841660e0840152831661010083015290911661012082015261014001604051809103906000f08015801562000156573d6000803e3d6000fd5b506001600160a01b031660a0525062000535565b6131c5806200187b83390190565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715620001b957620001b962000178565b604052919050565b600082601f830112620001d357600080fd5b81516001600160401b03811115620001ef57620001ef62000178565b602062000205601f8301601f191682016200018e565b82815285828487010111156200021a57600080fd5b60005b838110156200023a5785810183015182820184015282016200021d565b506000928101909101919091529392505050565b80516001600160a01b03811681146200026657600080fd5b919050565b6000602082840312156200027e57600080fd5b81516001600160401b03808211156200029657600080fd5b8184019150610180808387031215620002ae57600080fd5b620002b9816200018e565b9050825182811115620002cb57600080fd5b620002d987828601620001c1565b825250602083015182811115620002ef57600080fd5b620002fd87828601620001c1565b60208301525062000311604084016200024e565b604082015262000324606084016200024e565b606082015262000337608084016200024e565b60808201526200034a60a084016200024e565b60a08201526200035d60c084016200024e565b60c08201526200037060e084016200024e565b60e08201526101009150620003878284016200024e565b8282015261012091506200039d8284016200024e565b828201526101409150620003b38284016200024e565b828201526101609150620003c98284016200024e565b91810191909152949350505050565b600181811c90821680620003ed57607f821691505b6020821081036200040e57634e487b7160e01b600052602260045260246000fd5b50919050565b601f82111562000464576000816000526020600020601f850160051c810160208610156200043f5750805b601f850160051c820191505b8181101562000460578281556001016200044b565b5050505b505050565b81516001600160401b0381111562000485576200048562000178565b6200049d81620004968454620003d8565b8462000414565b602080601f831160018114620004d55760008415620004bc5750858301515b600019600386901b1c1916600185901b17855562000460565b600085815260208120601f198616915b828110156200050657888601518255948401946001909101908401620004e5565b5085821015620005255787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60805160a051611304620005776000396000818161020a01528181610f1f0152610fcb0152600081816102310152818161079e015261087c01526113046000f3fe608060405234801561001057600080fd5b50600436106101075760003560e01c806306fdde031461010c578063095ea7b31461012a57806318160ddd1461014d57806319ab453c1461015f57806323b872dd146101745780632e17de7814610187578063313ce5671461019a57806339509351146101a957806370a08231146101bc57806372f702f3146101e55780638bc6beb21461020557806390eb39111461022c57806395d89b4114610253578063a457c2d71461025b578063a9059cbb1461026e578063adc9772e14610281578063c56e0ad814610294578063da0e1dab1461029c578063dba802d9146102af578063dd62ed3e146102c2578063f4f3b200146102d5575b600080fd5b6101146102e8565b604051610121919061103c565b60405180910390f35b61013d6101383660046110a3565b61037a565b6040519015158152602001610121565b6002545b604051908152602001610121565b61017261016d3660046110cf565b610394565b005b61013d6101823660046110f3565b610412565b610172610195366004611134565b610436565b60405160128152602001610121565b61013d6101b73660046110a3565b6104ec565b6101516101ca3660046110cf565b6001600160a01b031660009081526020819052604090205490565b6005546101f8906001600160a01b031681565b604051610121919061114d565b6101f87f000000000000000000000000000000000000000000000000000000000000000081565b6101f87f000000000000000000000000000000000000000000000000000000000000000081565b61011461050e565b61013d6102693660046110a3565b61051d565b61013d61027c3660046110a3565b610598565b61017261028f3660046110a3565b6105a6565b6101726106d7565b6006546101f8906001600160a01b031681565b6101726102bd3660046110cf565b61071c565b6101516102d0366004611161565b610771565b6101726102e33660046110cf565b61079c565b6060600380546102f79061119a565b80601f01602080910402602001604051908101604052809291908181526020018280546103239061119a565b80156103705780601f1061034557610100808354040283529160200191610370565b820191906000526020600020905b81548152906001019060200180831161035357829003601f168201915b5050505050905090565b6000336103888185856109cd565b60019150505b92915050565b600654600160a01b900460ff16156103dc5760405162461bcd60e51b815260206004820152600660248201526512539255115160d21b60448201526064015b60405180910390fd5b600580546001600160a01b039092166001600160a01b03199092169190911790556006805460ff60a01b1916600160a01b179055565b600033610420858285610af1565b61042b858585610b6b565b506001949350505050565b6104403382610d03565b6005546001600160a01b031663a9059cbb33836040518363ffffffff1660e01b81526004016104709291906111d4565b6020604051808303816000875af115801561048f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104b391906111ed565b5060405181815233907f85082129d87b2fe11527cb1b3b7a520aeb5aa6913f88a3d8757fe40d1db02fdd9060200160405180910390a250565b6000336103888185856104ff8383610771565b610509919061120f565b6109cd565b6060600480546102f79061119a565b6000338161052b8286610771565b90508381101561058b5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b60648201526084016103d3565b61042b82868684036109cd565b600033610388818585610b6b565b6006546001600160a01b0316156105ff576006546001600160a01b038381169116146105ff5760405162461bcd60e51b8152602060048201526008602482015267149154d5149250d560c21b60448201526064016103d3565b6106098282610e2f565b6005546001600160a01b03166323b872dd336040516001600160e01b031960e084901b1681526001600160a01b039091166004820152306024820152604481018490526064016020604051808303816000875af115801561066e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061069291906111ed565b506040518181526001600160a01b0383169033907f99039fcf0a98f484616c5196ee8b2ecfa971babf0b519848289ea4db381f85f79060200160405180910390a35050565b6006546001600160a01b0316336001600160a01b03161461070a5760405162461bcd60e51b81526004016103d390611230565b600680546001600160a01b0319169055565b6006546001600160a01b0316336001600160a01b03161461074f5760405162461bcd60e51b81526004016103d390611230565b600680546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663be10862b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156107fa573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061081e9190611255565b6001600160a01b0316336001600160a01b03161461086b5760405162461bcd60e51b815260206004820152600a60248201526920a1a1a2a9a9afa2a92960b11b60448201526064016103d3565b806001600160a01b031663a9059cbb7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663be10862b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156108d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108fc9190611255565b6040516370a0823160e01b81526001600160a01b038516906370a082319061092890309060040161114d565b602060405180830381865afa158015610945573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109699190611272565b6040518363ffffffff1660e01b81526004016109869291906111d4565b6020604051808303816000875af11580156109a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109c991906111ed565b5050565b6001600160a01b038316610a2f5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016103d3565b6001600160a01b038216610a905760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016103d3565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6000610afd8484610771565b90506000198114610b655781811015610b585760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e636500000060448201526064016103d3565b610b6584848484036109cd565b50505050565b6001600160a01b038316610bcf5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016103d3565b6001600160a01b038216610c315760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016103d3565b6001600160a01b03831660009081526020819052604090205481811015610ca95760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b60648201526084016103d3565b6001600160a01b03848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290926000805160206112af833981519152910160405180910390a3610b65848484610ee0565b6001600160a01b038216610d635760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b60648201526084016103d3565b6001600160a01b03821660009081526020819052604090205481811015610dd75760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b60648201526084016103d3565b6001600160a01b0383166000818152602081815260408083208686039055600280548790039055518581529192916000805160206112af833981519152910160405180910390a3610e2a83600084610ee0565b505050565b6001600160a01b038216610e855760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f20616464726573730060448201526064016103d3565b8060026000828254610e97919061120f565b90915550506001600160a01b038216600081815260208181526040808320805486019055518481526000805160206112af833981519152910160405180910390a36109c9600083835b6001600160a01b03831615801590610f0357506001600160a01b03831661dead14155b15610f8c5760405163d6460b4b60e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063d6460b4b90610f59908690859060019060040161128b565b600060405180830381600087803b158015610f7357600080fd5b505af1158015610f87573d6000803e3d6000fd5b505050505b6001600160a01b03821615801590610faf57506001600160a01b03821661dead14155b15610e2a5760405163d6460b4b60e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063d6460b4b90611005908590859060009060040161128b565b600060405180830381600087803b15801561101f57600080fd5b505af1158015611033573d6000803e3d6000fd5b50505050505050565b60006020808352835180602085015260005b8181101561106a5785810183015185820160400152820161104e565b506000604082860101526040601f19601f8301168501019250505092915050565b6001600160a01b03811681146110a057600080fd5b50565b600080604083850312156110b657600080fd5b82356110c18161108b565b946020939093013593505050565b6000602082840312156110e157600080fd5b81356110ec8161108b565b9392505050565b60008060006060848603121561110857600080fd5b83356111138161108b565b925060208401356111238161108b565b929592945050506040919091013590565b60006020828403121561114657600080fd5b5035919050565b6001600160a01b0391909116815260200190565b6000806040838503121561117457600080fd5b823561117f8161108b565b9150602083013561118f8161108b565b809150509250929050565b600181811c908216806111ae57607f821691505b6020821081036111ce57634e487b7160e01b600052602260045260246000fd5b50919050565b6001600160a01b03929092168252602082015260400190565b6000602082840312156111ff57600080fd5b815180151581146110ec57600080fd5b8082018082111561038e57634e487b7160e01b600052601160045260246000fd5b6020808252600b908201526a0a48aa6aaa68aa482aaa8960ab1b604082015260600190565b60006020828403121561126757600080fd5b81516110ec8161108b565b60006020828403121561128457600080fd5b5051919050565b6001600160a01b039390931683526020830191909152151560408201526060019056feddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa264697066735822122065d2af4f5dfc45bffe646f630a0131a6fba87ea51fa233c58b679224536e33f864736f6c63430008180033610120604052600a600355600a80553480156200001b57600080fd5b50604051620031c5380380620031c58339810160408190526200003e91620000de565b6001600160a01b03998a1660c05297891660805295881660a05293871660e05291861661010052600080549187166001600160a01b031992831617905560018054928716928216929092179091556002805492861692821692909217909155600480549285169282169290921790915560058054929093169116179055620001ad565b80516001600160a01b0381168114620000d957600080fd5b919050565b6000806000806000806000806000806101408b8d031215620000ff57600080fd5b6200010a8b620000c1565b99506200011a60208c01620000c1565b98506200012a60408c01620000c1565b97506200013a60608c01620000c1565b96506200014a60808c01620000c1565b95506200015a60a08c01620000c1565b94506200016a60c08c01620000c1565b93506200017a60e08c01620000c1565b92506200018b6101008c01620000c1565b91506200019c6101208c01620000c1565b90509295989b9194979a5092959850565b60805160a05160c05160e05161010051612f08620002bd60003960008181610249015281816103920152818161059e01528181610d3301528181610eb001528181610f3801528181610fc3015281816113f3015281816115280152818161186301528181611dda01528181611e520152611f6d0152600081816101ef015261105401526000818161062c015281816110cf01526115c70152600081816103bc01528181610432015281816104d2015281816107410152818161077d015281816107c2015281816107f7015281816109c001528181610af901528181610c1401528181611f430152611fb80152600081816102b901528181610b2801528181610c430152611ed00152612f086000f3fe608060405234801561001057600080fd5b50600436106100f15760003560e01c80630700037d146100f65780633a98ef39146101375780635176cdec1461014e57806370b9f1f914610163578063869890381461017657806389d969171461017f5780638bdf67f21461019257806393a39776146101a55780639c1454d4146101c5578063a95ae7eb146101ce578063ad5c4648146101d7578063bde30818146101ea578063c6bbd5a714610211578063ce7c2ac214610224578063d1af0c7d14610244578063d279c1911461026b578063d6460b4b1461027e578063deadbc1414610291578063f2b3b467146102a4575b600080fd5b61011d610104366004612918565b6009602052600090815260409020805460019091015482565b604080519283526020830191909152015b60405180910390f35b61014060065481565b60405190815260200161012e565b61016161015c36600461293c565b6102b7565b005b610161610171366004612955565b610390565b61014060075481565b61014061018d366004612918565b610dd6565b6101616101a036600461293c565b610e5e565b6001546101b8906001600160a01b031681565b60405161012e9190612977565b610140600c5481565b610140600d5481565b6000546101b8906001600160a01b031681565b6101b87f000000000000000000000000000000000000000000000000000000000000000081565b6004546101b8906001600160a01b031681565b610140610232366004612918565b60086020526000908152604090205481565b6101b87f000000000000000000000000000000000000000000000000000000000000000081565b610161610279366004612918565b611011565b61016161028c366004612999565b611051565b6002546101b8906001600160a01b031681565b6005546101b8906001600160a01b031681565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663be10862b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610315573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061033991906129db565b6001600160a01b0316336001600160a01b03161461038b5760405162461bcd60e51b815260206004820152600a60248201526920a1a1a2a9a9afa2a92960b11b60448201526064015b60405180910390fd5b600355565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03160361041d5760405162461bcd60e51b81526020600482015260096024820152684c5052455753414d4560b81b6044820152606401610382565b81156104b8576040516323b872dd60e01b81527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906323b872dd90610473903390309087906004016129f8565b6020604051808303816000875af1158015610492573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104b69190612a1c565b505b6040516370a0823160e01b81526000906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a0823190610507903090600401612977565b602060405180830381865afa158015610524573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105489190612a39565b9050600081116105845760405162461bcd60e51b81526020600482015260076024820152662722a2a22a25a760c91b6044820152606401610382565b6040516370a0823160e01b81526000906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a08231906105d3903090600401612977565b602060405180830381865afa1580156105f0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106149190612a39565b90506000806106216110c8565b5090508015610730577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316631ad8b03b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610688573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106ac91906129db565b6001600160a01b0316633c9a07006040518163ffffffff1660e01b8152600401602060405180830381865afa1580156106e9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061070d9190612a39565b6107178286612a68565b6107219190612a7f565b915061072d8285612aa1565b93505b60025461076a906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811691168661122e565b6001546000906001600160a01b039081167f0000000000000000000000000000000000000000000000000000000000000000909116036107bd576001546107ba906001600160a01b031686611309565b90505b6001547f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03908116911614610d2d5760007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316632acada4d6040518163ffffffff1660e01b8152600401600060405180830381865afa158015610853573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261087b9190810190612b1d565b905060008160008151811061089257610892612c06565b6020026020010151600001516001600160a01b03166370a08231306040518263ffffffff1660e01b81526004016108c99190612977565b602060405180830381865afa1580156108e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061090a9190612a39565b604080516001808252818301909252919250600091906020808301908036833701905050905060008160008151811061094557610945612c06565b6001600160a01b03929092166020928302919091019091015260408051600180825281830190925260009181602001602082028036833701905050905060008160008151811061099757610997612c06565b60ff9092166020928302919091019091015260405163774e3ced60e11b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063ee9c79da906109f9908c9086908690600401612c61565b600060405180830381600087803b158015610a1357600080fd5b505af1158015610a27573d6000803e3d6000fd5b50505050600084600081518110610a4057610a40612c06565b6020026020010151600001516001600160a01b03166370a08231306040518263ffffffff1660e01b8152600401610a779190612977565b602060405180830381865afa158015610a94573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ab89190612a39565b9050610aed85600081518110610ad057610ad0612c06565b6020026020010151600001518583610ae89190612aa1565b611309565b95508715610d275760007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663a9059cbb7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663be10862b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b84573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ba891906129db565b8b6040518363ffffffff1660e01b8152600401610bc6929190612cc1565b6020604051808303816000875af1925050508015610c01575060408051601f3d908101601f19168201909252610bfe91810190612a1c565b60015b610c0c575087610c12565b50600090505b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663a9059cbb7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663be10862b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610c9f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cc391906129db565b836040518363ffffffff1660e01b8152600401610ce1929190612cc1565b6020604051808303816000875af1158015610d00573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d249190612a1c565b50505b50505050505b610dcd847f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166370a08231306040518263ffffffff1660e01b8152600401610d7d9190612977565b602060405180830381865afa158015610d9a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dbe9190612a39565b610dc89190612aa1565b61158e565b50505050505050565b6001600160a01b0381166000908152600860205260408120548103610dfd57506000919050565b6001600160a01b038216600090815260086020526040812054610e1f90611769565b6001600160a01b038416600090815260096020526040902054909150808211610e4c575060009392505050565b610e568183612aa1565b949350505050565b60008111610e965760405162461bcd60e51b8152602060048201526005602482015264444550414d60d81b6044820152606401610382565b6040516370a0823160e01b81526000906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a0823190610ee5903090600401612977565b602060405180830381865afa158015610f02573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f269190612a39565b6040516323b872dd60e01b81529091507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906323b872dd90610f79903390309087906004016129f8565b6020604051808303816000875af1158015610f98573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fbc9190612a1c565b5061100d817f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166370a08231306040518263ffffffff1660e01b8152600401610d7d9190612977565b5050565b61101a81611792565b6040516001600160a01b038216907f63e32091e4445d16e29c33a6b264577c2d86694021aa4e6f4dd590048f5792e890600090a250565b337f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316146110b85760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b6044820152606401610382565b6110c3838383611925565b505050565b60008060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316631ad8b03b6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561112b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061114f91906129db565b90506001600160a01b0381161561122957806001600160a01b031663676011556040518163ffffffff1660e01b8152600401602060405180830381865afa15801561119e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111c29190612a39565b9250806001600160a01b0316630389ed176040518163ffffffff1660e01b8152600401602060405180830381865afa158015611202573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112269190612a39565b91505b509091565b604051636eb1769f60e11b81523060048201526001600160a01b0383811660248301526000919085169063dd62ed3e90604401602060405180830381865afa15801561127e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112a29190612a39565b90506113038463095ea7b360e01b856112bb8686612cda565b6040516024016112cc929190612cc1565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526119bd565b50505050565b600080546001600160a01b038481169116146114b157604080516002808252606082018352600092602083019080368337019050509050838160008151811061135457611354612c06565b6001600160a01b03928316602091820292909201015260005482519116908290600190811061138557611385612c06565b60200260200101906001600160a01b031690816001600160a01b0316815250506113af8184611a92565b6000805483519294506001600160a01b0316918391906113d1576113d1612c06565b60200260200101906001600160a01b031690816001600160a01b0316815250507f00000000000000000000000000000000000000000000000000000000000000008160018151811061142557611425612c06565b6001600160a01b0392831660209182029290920101526000546040516370a0823160e01b81526114ad92849216906370a0823190611467903090600401612977565b602060405180830381865afa158015611484573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114a89190612a39565b611a92565b9150505b6000546001600160a01b03908116908416036115885760408051600280825260608201835260009260208301908036833750506000805483519394506001600160a01b03169284925061150657611506612c06565b60200260200101906001600160a01b031690816001600160a01b0316815250507f00000000000000000000000000000000000000000000000000000000000000008160018151811061155a5761155a612c06565b60200260200101906001600160a01b031690816001600160a01b0316815250506115848184611a92565b9150505b92915050565b806000036115995750565b6006546000036115af576115ac81611dc4565b50565b8060006115ba6110c8565b91505080156116dc5760007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316631ad8b03b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611623573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061164791906129db565b6001600160a01b0316633c9a07006040518163ffffffff1660e01b8152600401602060405180830381865afa158015611684573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116a89190612a39565b6116b28386612a68565b6116bc9190612a7f565b905080156116da576116cd81611dc4565b6116d78184612aa1565b92505b505b81600d60008282546116ee9190612cda565b909155505060065461170e836a0c097ce7bc90715b34b9f160241b612a68565b6117189190612a7f565b600b60008282546117299190612cda565b909155505060405182815233907fb9ad861b752f80117b35bea6dec99933d8a5ae360f2839ee8784b750d5613409906020015b60405180910390a2505050565b60006a0c097ce7bc90715b34b9f160241b600b54836117889190612a68565b6115889190612a7f565b6001600160a01b03811660009081526008602052604081205490036117b45750565b60006117bf82610dd6565b6001600160a01b0383166000908152600960205260408120600101805492935083929091906117ef908490612cda565b90915550506001600160a01b03821660009081526008602052604090205461181690611769565b6001600160a01b038316600090815260096020526040902055801561100d5780600c60008282546118479190612cda565b909155505060405163a9059cbb60e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063a9059cbb9061189a9085908590600401612cc1565b6020604051808303816000875af11580156118b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118dd9190612a1c565b50816001600160a01b03167fe8b160e373db99a103e0a2abfa029b9c3fc8b328984a1ead8a65ae68ae646db78260405161191991815260200190565b60405180910390a25050565b61192d611ece565b80156119785761193d8383612042565b826001600160a01b03167fae0577e1c96b26fbc0b9df702431f5470979d001d24f136eded791b8b6521d6f8360405161175c91815260200190565b611982838361217a565b826001600160a01b03167fba8f3777cf908803bf1f3dd58e7f4b7d3de4dbe3c234c4ccab0975d98f7cd3888360405161175c91815260200190565b6000611a12826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166122829092919063ffffffff16565b9050805160001480611a33575080806020019051810190611a339190612a1c565b6110c35760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610382565b6000808360018551611aa49190612aa1565b81518110611ab457611ab4612c06565b60200260200101516001600160a01b03166370a08231306040518263ffffffff1660e01b8152600401611ae79190612977565b602060405180830381865afa158015611b04573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b289190612a39565b90506000806000611b6e8688600081518110611b4657611b46612c06565b602002602001015189600181518110611b6157611b61612c06565b6020026020010151612291565b92509250925060006103e86003546103e8611b899190612aa1565b611b939084612a68565b611b9d9190612a7f565b90506000846002811115611bb357611bb3612ced565b03611cd25787600081518110611bcb57611bcb612c06565b602090810291909101015160025460405163095ea7b360e01b81526001600160a01b039283169263095ea7b392611c09929116908b90600401612cc1565b6020604051808303816000875af1158015611c28573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c4c9190612a1c565b506002546040516338ed173960e01b81526001600160a01b03909116906338ed173990611c85908a9085908d9030904290600401612d03565b6000604051808303816000875af1158015611ca4573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611ccc9190810190612d3f565b50611d16565b611d1688600081518110611ce857611ce8612c06565b6020026020010151848a600181518110611d0457611d04612c06565b60200260200101518a60035430612411565b60008860018a51611d279190612aa1565b81518110611d3757611d37612c06565b60200260200101516001600160a01b03166370a08231306040518263ffffffff1660e01b8152600401611d6a9190612977565b602060405180830381865afa158015611d87573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611dab9190612a39565b9050611db78682612aa1565b9998505050505050505050565b604051630852cd8d60e31b8152600481018290527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906342966c6890602401600060405180830381600087803b158015611e2657600080fd5b505af1925050508015611e37575060015b6115ac5760405163a9059cbb60e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063a9059cbb90611e8b9061dead908590600401612cc1565b6020604051808303816000875af1158015611eaa573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061100d9190612a1c565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663bb4630276040518163ffffffff1660e01b8152600401600060405180830381600087803b158015611f2957600080fd5b505af1158015611f3d573d6000803e3d6000fd5b505050507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03161415801561203057506040516370a0823160e01b81526000906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a0823190611fed903090600401612977565b602060405180830381865afa15801561200a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061202e9190612a39565b115b1561204057612040600080610390565b565b6001600160a01b0382166000908152600860205260409020541580159061208157506001600160a01b0382166000908152600860205260409020548111155b6120b65760405162461bcd60e51b815260206004820152600660248201526552454d4f564560d01b6044820152606401610382565b6120bf82611792565b80600660008282546120d19190612aa1565b90915550506001600160a01b038216600090815260086020526040812080548392906120fe908490612aa1565b90915550506001600160a01b0382166000908152600860205260408120549003612138576007805490600061213283612dc4565b91905055505b6001600160a01b03821660009081526008602052604090205461215a90611769565b6001600160a01b0390921660009081526009602052604090209190915550565b6001600160a01b038216600090815260086020526040902054156121a1576121a182611792565b6001600160a01b03821660009081526008602052604081205460068054919284926121cd908490612cda565b90915550506001600160a01b038316600090815260086020526040812080548492906121fa908490612cda565b90915550508015801561222457506001600160a01b03831660009081526008602052604090205415155b1561223f576007805490600061223983612ddb565b91905055505b6001600160a01b03831660009081526008602052604090205461226190611769565b6001600160a01b039093166000908152600960205260409020929092555050565b6060610e5684846000856126a6565b6000806000806122a58686896101f4612781565b905060006122b787878a610bb8612781565b604080516002808252606082018352929350600092909160208301908036833701905050905087816000815181106122f1576122f1612c06565b60200260200101906001600160a01b031690816001600160a01b031681525050868160018151811061232557612325612c06565b6001600160a01b03928316602091820292909201015260025460405163d06ca61f60e01b8152600092919091169063d06ca61f90612369908d908690600401612df4565b600060405180830381865afa9250505080156123a757506040513d6000823e601f3d908101601f191682016040526123a49190810190612d3f565b60015b6123b3575060006123d2565b806001815181106123c6576123c6612c06565b60200260200101519150505b60019650836101f4818511156123ee575060029750839050610bb85b81831115612400575060009750819050875b965094505050505093509350939050565b60055461242b906001600160a01b0388811691168561122e565b600061243987868689612781565b6005546040805160e0810182526001600160a01b038b81168252898116602083015262ffffff8b169282019290925285821660608201526080810188905292935016906304e45aaf9060a081016103e86124938887612a68565b61249d9190612a7f565b6124a79086612aa1565b815260006020918201526040805160e085901b6001600160e01b031916815283516001600160a01b03908116600483015292840151831660248201529083015162ffffff1660448201526060830151821660648201526080830151608482015260a083015160a482015260c0909201511660c482015260e4016020604051808303816000875af192505050801561255b575060408051601f3d908101601f1916820190925261255891810190612a39565b60015b61269c5760055460408051610100810182526001600160a01b038a81168252888116602083015262ffffff8a1692820192909252848216606082015242608082015260a0810187905291169063414bf3899060c081016103e86125be8887612a68565b6125c89190612a7f565b6125d29086612aa1565b815260006020918201526040805160e085811b6001600160e01b031916825284516001600160a01b03908116600484015293850151841660248301529184015162ffffff1660448201526060840151831660648201526080840151608482015260a084015160a482015260c084015160c48201529201511660e4820152610104016020604051808303816000875af1158015612672573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126969190612a39565b50610dcd565b5050505050505050565b6060824710156127075760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610382565b600080866001600160a01b031685876040516127239190612e31565b60006040518083038185875af1925050503d8060008114612760576040519150601f19603f3d011682016040523d82523d6000602084013e612765565b606091505b509150915061277687838387612865565b979650505050505050565b6040805160a0810182526001600160a01b0386811682528581166020830190815282840186815262ffffff86811660608601908152600060808701818152600480549951636352813560e11b81528951891691810191909152955187166024870152935160448601529051909116606484015290518316608483015293849392169063c6a5026a9060a4016080604051808303816000875af1925050508015612847575060408051601f3d908101601f1916820190925261284491810190612e4d565b60015b612854576000915061285b565b5091935050505b5095945050505050565b606083156128d45782516000036128cd576001600160a01b0385163b6128cd5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610382565b5081610e56565b610e5683838151156128e95781518083602001fd5b8060405162461bcd60e51b81526004016103829190612e9f565b6001600160a01b03811681146115ac57600080fd5b60006020828403121561292a57600080fd5b813561293581612903565b9392505050565b60006020828403121561294e57600080fd5b5035919050565b6000806040838503121561296857600080fd5b50508035926020909101359150565b6001600160a01b0391909116815260200190565b80151581146115ac57600080fd5b6000806000606084860312156129ae57600080fd5b83356129b981612903565b92506020840135915060408401356129d08161298b565b809150509250925092565b6000602082840312156129ed57600080fd5b815161293581612903565b6001600160a01b039384168152919092166020820152604081019190915260600190565b600060208284031215612a2e57600080fd5b81516129358161298b565b600060208284031215612a4b57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b808202811582820484141761158857611588612a52565b600082612a9c57634e487b7160e01b600052601260045260246000fd5b500490565b8181038181111561158857611588612a52565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715612af257612af2612ab4565b604052919050565b60006001600160401b03821115612b1357612b13612ab4565b5060051b60200190565b60006020808385031215612b3057600080fd5b82516001600160401b03811115612b4657600080fd5b8301601f81018513612b5757600080fd5b8051612b6a612b6582612afa565b612aca565b81815260a09182028301840191848201919088841115612b8957600080fd5b938501935b83851015612bfa5780858a031215612ba65760008081fd5b612baf81612aca565b8551612bba81612903565b8152858701518782015260408087015190820152606080870151612bdd81612903565b908201526080868101519082015283529384019391850191612b8e565b50979650505050505050565b634e487b7160e01b600052603260045260246000fd5b60008151808452602080850194506020840160005b83811015612c565781516001600160a01b031687529582019590820190600101612c31565b509495945050505050565b8381526000602060606020840152612c7c6060840186612c1c565b83810360408501528451808252602080870192019060005b81811015612cb357835160ff1683529284019291840191600101612c94565b509098975050505050505050565b6001600160a01b03929092168252602082015260400190565b8082018082111561158857611588612a52565b634e487b7160e01b600052602160045260246000fd5b85815284602082015260a060408201526000612d2260a0830186612c1c565b6001600160a01b0394909416606083015250608001529392505050565b60006020808385031215612d5257600080fd5b82516001600160401b03811115612d6857600080fd5b8301601f81018513612d7957600080fd5b8051612d87612b6582612afa565b81815260059190911b82018301908381019087831115612da657600080fd5b928401925b8284101561277657835182529284019290840190612dab565b600081612dd357612dd3612a52565b506000190190565b600060018201612ded57612ded612a52565b5060010190565b828152604060208201526000610e566040830184612c1c565b60005b83811015612e28578181015183820152602001612e10565b50506000910152565b60008251612e43818460208701612e0d565b9190910192915050565b60008060008060808587031215612e6357600080fd5b845193506020850151612e7581612903565b604086015190935063ffffffff81168114612e8f57600080fd5b6060959095015193969295505050565b6020815260008251806020840152612ebe816040850160208701612e0d565b601f01601f1916919091016040019291505056fea2646970667358221220c2cb2fbfeeafa8ea6ab070c19cd99c043153da0a785a77b0efadb5c844b5c7b064736f6c634300081800330000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000026000000000000000000000000000000000000000000000000000000000000002a000000000000000000000000000000000000000000000000000000000000013880000000000000000000000000000000000000000000000000000000000000096000000000000000000000000000000000000000000000000000000000000001900000000000000000000000000000000000000000000000000000000000000190000000000000000000000000000000000000000000000000000000000000019000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002e000000000000000000000000000000000000000000000000000000000000003200000000000000000000000007ed6fd046ef71e2a71092d1597bcebe578a57a760000000000000000000000000000000000000000000000000000000000000000000000000000000000000000949185d3be66775ea648f4a306740ea9eff9c567000000000000000000000000a6ad18c2ac47803e193f75c3677b14bf19b94883000000000000000000000000000000000000000000000000000000000000000000000000000000000000000029219dd400f2bf60e5a23d13be72b486d4038894000000000000000000000000b747dc4fb976e4ba2bbe8c13a92e2faa7b9f64ce000000000000000000000000db51cffff3b989d0cb6b58abf173371b6f2d0d240000000000000000000000001ac569879ef7eacb17cc373ef801cdce4accded500000000000000000000000000000000000000000000000000000000000000086c69717569642d5300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000026c530000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad3800000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000056bc75e2d63100000
Deployed Bytecode
0x608060405234801561001057600080fd5b506004361061025c5760003560e01c806306fdde0314610261578063095ea7b31461027f5780630cc835a3146102a257806318160ddd146102b757806320800a00146102c957806323b872dd146102d157806324f7b216146102e45780632acada4d146102f7578063313ce5671461030c578063325a19f11461031b5780633644e515146103425780633741454d1461034a578063395093511461035d5780633f4ba83a1461037057806342966c68146103785780634a437f881461038b5780634bf2c7c9146103d55780634f4ce61d146103e857806353f504471461041c5780635552c07b1461045057806358f4dcc3146104635780635c975abb1461048a57806370a08231146104955780637ecebe00146104a85780638129fc1c146104bb5780638456cb59146104c357806384b0196e146104cb5780638b4cee08146104e657806390578a12146104f957806393a397761461050c57806394cc699e1461052457806395d89b411461054b5780639af1d35a146105535780639d649e661461059e5780639e0e1050146105a6578063a16d5960146105c9578063a457c2d7146105dc578063a9059cbb146105ef578063a9e9c8bc14610602578063b08d033314610615578063bb46302714610628578063bdbc91ab14610630578063bdc8d06014610643578063be10862b1461064b578063c87fa42a1461065e578063ccec37161461068a578063d505accf1461069d578063dd62ed3e146106b0578063e4b54957146106c3578063ee9c79da146106d6578063f6823996146106e9578063ff140ca6146106fc575b600080fd5b610269610704565b6040516102769190614929565b60405180910390f35b61029261028d366004614951565b610796565b6040519015158152602001610276565b6102b56102b036600461497d565b6107b0565b005b6002545b604051908152602001610276565b6102b5610829565b6102926102df366004614996565b610968565b6102b56102f23660046149e5565b61098e565b6102ff6109ec565b6040516102769190614a1e565b60405160128152602001610276565b6102bb7f00000000000000000000000000000000000000000000000000000000677875d281565b6102bb610a83565b6102b561035836600461497d565b610a92565b61029261036b366004614951565b610b03565b6102b5610b25565b6102b561038636600461497d565b610b59565b61039e61039936600461497d565b610b97565b604080516001600160a01b03968716815260208101959095528401929092529092166060820152608081019190915260a001610276565b6102b56103e336600461497d565b610be4565b61040f7f00000000000000000000000029219dd400f2bf60e5a23d13be72b486d403889481565b6040516102769190614a9a565b6104437f000000000000000000000000000000000000000000000000000000000000000081565b6040516102769190614ac4565b6102b561045e36600461497d565b610c6d565b61040f7f000000000000000000000000949185d3be66775ea648f4a306740ea9eff9c56781565b60095460ff16610292565b6102bb6104a3366004614aec565b610cdd565b6102bb6104b6366004614aec565b610cf8565b6102b5610d16565b6102b5610f1b565b6104d3610f4d565b6040516102769796959493929190614b09565b6102b56104f436600461497d565b610fd6565b6102b561050736600461497d565b611046565b60095461040f9061010090046001600160a01b031681565b61040f7f000000000000000000000000b694c8d7bc260b6e76ff2644b10189c9a4b6e54881565b6102696110b6565b600d54600e54600f5460105460115460125461057195949392919086565b604080519687526020870195909552938501929092526060840152608083015260a082015260c001610276565b6102bb600a81565b6102926105b4366004614aec565b60166020526000908152604090205460ff1681565b6102b56105d7366004614aec565b6110c5565b6102926105ea366004614951565b61111a565b6102926105fd366004614951565b6111a0565b6102b5610610366004614ba2565b6111ae565b6102b5610623366004614bd4565b61182c565b6102b5611c51565b6102b561063e366004614c09565b611d25565b600f546102bb565b600c5461040f906001600160a01b031681565b61029261066c366004614aec565b6001600160a01b031660009081526014602052604090205460ff1690565b6102b5610698366004614aec565b6124e8565b6102b56106ab366004614cb6565b612640565b6102bb6106be366004614d27565b6127a4565b6102bb6106d1366004614d55565b6127cf565b6102b56106e4366004614e78565b612949565b6102b56106f7366004614ba2565b612bcc565b600e546102bb565b60606003805461071390614f44565b80601f016020809104026020016040519081016040528092919081815260200182805461073f90614f44565b801561078c5780601f106107615761010080835404028352916020019161078c565b820191906000526020600020905b81548152906001019060200180831161076f57829003601f168201915b5050505050905090565b6000336107a4818585612ea5565b60019150505b92915050565b600c546001600160a01b0316336001600160a01b0316146107ec5760405162461bcd60e51b81526004016107e390614f78565b60405180910390fd5b60646107fb6127106014614faf565b6108059190614fc6565b8111156108245760405162461bcd60e51b81526004016107e390614fe8565b601055565b60195462010000900460ff166108515760405162461bcd60e51b81526004016107e390615008565b6019805462ff000019169055600c546001600160a01b0316336001600160a01b0316146108905760405162461bcd60e51b81526004016107e390614f78565b600047116108c85760405162461bcd60e51b815260206004820152600560248201526409c9e8aa8960db1b60448201526064016107e3565b600c546040516000916001600160a01b03169047908381818185875af1925050503d8060008114610915576040519150601f19603f3d011682016040523d82523d6000602084013e61091a565b606091505b50509050806109545760405162461bcd60e51b81526004016107e39060208082526004908201526314d1539560e21b604082015260600190565b506019805462ff0000191662010000179055565b600033610976858285612fca565b610981858585613044565b60019150505b9392505050565b600c546001600160a01b0316336001600160a01b0316146109c15760405162461bcd60e51b81526004016107e390614f78565b6001600160a01b03919091166000908152601660205260409020805460ff1916911515919091179055565b60606013805480602002602001604051908101604052809291908181526020016000905b82821015610a7a5760008481526020908190206040805160a0810182526005860290920180546001600160a01b0390811684526001808301548587015260028301549385019390935260038201541660608401526004015460808301529083529092019101610a10565b50505050905090565b6000610a8d613289565b905090565b600c546001600160a01b0316336001600160a01b031614610ac55760405162461bcd60e51b81526004016107e390614f78565b6012548110610afe5760405162461bcd60e51b8152602060048201526005602482015264262a21aaa960d91b60448201526064016107e3565b601255565b6000336107a4818585610b1683836127a4565b610b209190615028565b612ea5565b600c546001600160a01b03163314610b4f5760405162461bcd60e51b81526004016107e39061503b565b610b576133b4565b565b60195462010000900460ff16610b815760405162461bcd60e51b81526004016107e390615008565b6019805462ff0000191690556109543382613400565b60138181548110610ba757600080fd5b6000918252602090912060059091020180546001820154600283015460038401546004909401546001600160a01b03938416955091939092169085565b600c546001600160a01b0316336001600160a01b031614610c175760405162461bcd60e51b81526004016107e390614f78565b6064610c266127106046614faf565b610c309190614fc6565b811115610c685760405162461bcd60e51b81526020600482015260066024820152656c746537302560d01b60448201526064016107e3565b600d55565b600c546001600160a01b0316336001600160a01b031614610ca05760405162461bcd60e51b81526004016107e390614f78565b6064610caf6127106063614faf565b610cb99190614fc6565b811115610cd85760405162461bcd60e51b81526004016107e39061505f565b600e55565b6001600160a01b031660009081526020819052604090205490565b6001600160a01b0381166000908152600760205260408120546107aa565b6019546301000000900460ff1615610d595760405162461bcd60e51b815260206004820152600660248201526512539255115160d21b60448201526064016107e3565b60007f000000000000000000000000a6ad18c2ac47803e193f75c3677b14bf19b948836001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610db9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ddd919061507e565b6001600160a01b031663c9c65396307f00000000000000000000000029219dd400f2bf60e5a23d13be72b486d40388946040518363ffffffff1660e01b8152600401610e2a92919061509b565b6020604051808303816000875af1158015610e49573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e6d919061507e565b600b80546001600160a01b0319166001600160a01b0383811691821790925560405163066ad14f60e21b81529293507f000000000000000000000000b694c8d7bc260b6e76ff2644b10189c9a4b6e548909116916319ab453c91610ed391600401614a9a565b600060405180830381600087803b158015610eed57600080fd5b505af1158015610f01573d6000803e3d6000fd5b50506019805463ff00000019166301000000179055505050565b600c546001600160a01b03163314610f455760405162461bcd60e51b81526004016107e39061503b565b610b5761351d565b600060608082808083610f817f6c69717569642d53000000000000000000000000000000000000000000000008600561355a565b610fac7f3100000000000000000000000000000000000000000000000000000000000001600661355a565b60408051600080825260208201909252600f60f81b9b939a50919850469750309650945092509050565b600c546001600160a01b0316336001600160a01b0316146110095760405162461bcd60e51b81526004016107e390614f78565b60646110186127106014614faf565b6110229190614fc6565b8111156110415760405162461bcd60e51b81526004016107e390614fe8565b601155565b600c546001600160a01b0316336001600160a01b0316146110795760405162461bcd60e51b81526004016107e390614f78565b60646110886127106063614faf565b6110929190614fc6565b8111156110b15760405162461bcd60e51b81526004016107e39061505f565b600f55565b60606004805461071390614f44565b600c546001600160a01b0316336001600160a01b0316146110f85760405162461bcd60e51b81526004016107e390614f78565b600c80546001600160a01b0319166001600160a01b0392909216919091179055565b6000338161112882866127a4565b9050838110156111885760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b60648201526084016107e3565b6111958286868403612ea5565b506001949350505050565b6000336107a4818585613044565b60195462010000900460ff166111d65760405162461bcd60e51b81526004016107e390615008565b6019805462ffff00191690556111ea613605565b60006111f530610cdd565b905060007f00000000000000000000000029219dd400f2bf60e5a23d13be72b486d40388946001600160a01b03166370a08231306040518263ffffffff1660e01b81526004016112459190614a9a565b602060405180830381865afa158015611262573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061128691906150b5565b905061129333308861364b565b6112be307f000000000000000000000000a6ad18c2ac47803e193f75c3677b14bf19b9488388612ea5565b6040516323b872dd60e01b81527f00000000000000000000000029219dd400f2bf60e5a23d13be72b486d40388946001600160a01b0316906323b872dd9061130e90339030908a906004016150ce565b6020604051808303816000875af115801561132d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061135191906150f2565b506113a66001600160a01b037f00000000000000000000000029219dd400f2bf60e5a23d13be72b486d4038894167f000000000000000000000000a6ad18c2ac47803e193f75c3677b14bf19b94883876137dd565b6001600160a01b037f000000000000000000000000a6ad18c2ac47803e193f75c3677b14bf19b948831663e8e33700307f00000000000000000000000029219dd400f2bf60e5a23d13be72b486d403889489896103e86114068b8261510f565b611410908e614faf565b61141a9190614fc6565b6103e86114278c8261510f565b611431908e614faf565b61143b9190614fc6565b3360405160e089901b6001600160e01b03191681526001600160a01b039788166004820152958716602487015260448601949094526064850192909252608484015260a483015290911660c482015260e48101869052610104016060604051808303816000875af11580156114b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114d89190615122565b5050604051636eb1769f60e11b8152600091506001600160a01b037f00000000000000000000000029219dd400f2bf60e5a23d13be72b486d4038894169063dd62ed3e9061154c9030907f000000000000000000000000a6ad18c2ac47803e193f75c3677b14bf19b948839060040161509b565b602060405180830381865afa158015611569573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061158d91906150b5565b905080156115e9576115e96001600160a01b037f00000000000000000000000029219dd400f2bf60e5a23d13be72b486d4038894167f000000000000000000000000a6ad18c2ac47803e193f75c3677b14bf19b94883836138b0565b826115f330610cdd565b11156116175761161730338561160830610cdd565b611612919061510f565b61364b565b6040516370a0823160e01b815282906001600160a01b037f00000000000000000000000029219dd400f2bf60e5a23d13be72b486d403889416906370a0823190611665903090600401614a9a565b602060405180830381865afa158015611682573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116a691906150b5565b11156117d7576001600160a01b037f00000000000000000000000029219dd400f2bf60e5a23d13be72b486d40388941663a9059cbb336040516370a0823160e01b815285906001600160a01b037f00000000000000000000000029219dd400f2bf60e5a23d13be72b486d403889416906370a082319061172a903090600401614a9a565b602060405180830381865afa158015611747573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061176b91906150b5565b611775919061510f565b6040518363ffffffff1660e01b8152600401611792929190615150565b6020604051808303816000875af11580156117b1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117d591906150f2565b505b604080518881526020810188905233917f06239653922ac7bea6aa2b19dc486b9361821d37712eb796adfd38d81de278ca910160405180910390a250506019805462ffff001916620101001790555050505050565b60195462010000900460ff166118545760405162461bcd60e51b81526004016107e390615008565b6019805462ffff0019169055611868613605565b6001600160a01b03831660009081526014602052604090205460ff166118bf5760405162461bcd60e51b815260206004820152600c60248201526b24a72b20a624a22a27a5a2a760a11b60448201526064016107e3565b6001600160a01b0383166000818152601560205260408082205490516370a0823160e01b81529092906370a08231906118fc903090600401614a9a565b602060405180830381865afa158015611919573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061193d91906150b5565b905060006119496139a7565b90506000816119705782611961600160601b88614faf565b61196b9190614fc6565b611976565b600160601b5b9050600082156119e1576013858154811061199357611993615169565b9060005260206000209060050201600401546119ad601290565b6119b890600a615280565b6119c6600160601b8a614faf565b6119d09190614faf565b6119da9190614fc6565b9050611a07565b600160601b826119f060025490565b6119fa9190614faf565b611a049190614fc6565b90505b6000611a12336139b8565b611a3657600e5461271090611a279084614faf565b611a319190614fc6565b611a39565b60005b905086611a46828461510f565b1015611a7a5760405162461bcd60e51b815260206004820152600360248201526226a4a760e91b60448201526064016107e3565b611a8d33611a88838561510f565b613a22565b8015611aa657611a9d3082613a22565b611aa681613acf565b60005b601354811015611be457600085611b6b57600160601b8560138481548110611ad357611ad3615169565b60009182526020909120600590910201546040516370a0823160e01b81526001600160a01b03909116906370a0823190611b11903090600401614a9a565b602060405180830381865afa158015611b2e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b5291906150b5565b611b5c9190614faf565b611b669190614fc6565b611ba2565b611ba28b8b60138581548110611b8357611b83615169565b60009182526020909120600590910201546001600160a01b03166127cf565b9050611bdb60138381548110611bba57611bba615169565b60009182526020909120600590910201546001600160a01b03163383613b0e565b50600101611aa9565b50611bed613ca3565b604080518981526020810184905282916001600160a01b038c169133917fa0d4c018dc52dcb9f3edfde940bbcf3dbedee971c90c17295f3a93003d5e77a2910160405180910390a450506019805462ffff0019166201010017905550505050505050565b7f000000000000000000000000b694c8d7bc260b6e76ff2644b10189c9a4b6e5486001600160a01b0316638bc6beb26040518163ffffffff1660e01b8152600401602060405180830381865afa158015611caf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cd3919061507e565b6001600160a01b0316336001600160a01b031614611d1d5760405162461bcd60e51b81526020600482015260076024820152665245574152445360c81b60448201526064016107e3565b610b57613cd1565b60195462010000900460ff16611d4d5760405162461bcd60e51b81526004016107e390615008565b6019805462ff000019169055611d61613605565b6001600160a01b03841660009081526014602052604090205460ff16611db65760405162461bcd60e51b815260206004820152600a60248201526927a7262ca827a22a25a760b11b60448201526064016107e3565b3360009081526016602052604090205460ff168015611fe2576040516370a0823160e01b81526000906001600160a01b038716906370a0823190611dfe903090600401614a9a565b602060405180830381865afa158015611e1b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e3f91906150b5565b60405163a9059cbb60e01b81529091506001600160a01b0387169063a9059cbb90611e70908a908990600401615150565b6020604051808303816000875af1158015611e8f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611eb391906150f2565b50604051633a62959560e21b81526001600160a01b0388169063e98a565490611ee29087908790600401615292565b600060405180830381600087803b158015611efc57600080fd5b505af1158015611f10573d6000803e3d6000fd5b50506040516370a0823160e01b81528392506001600160a01b03891691506370a0823190611f42903090600401614a9a565b602060405180830381865afa158015611f5f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f8391906150b5565b1015611fa15760405162461bcd60e51b81526004016107e3906152c1565b6001600160a01b038716336001600160a01b03166000805160206153b68339815191528888604051611fd4929190615150565b60405180910390a3506124cf565b6000600960019054906101000a90046001600160a01b03166001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015612037573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061205b91906152e5565b61206690600a615280565b61207190600a614faf565b905060007f000000000000000000000000b694c8d7bc260b6e76ff2644b10189c9a4b6e5486001600160a01b0316638bc6beb26040518163ffffffff1660e01b8152600401602060405180830381865afa1580156120d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120f7919061507e565b6009549091506000907f000000000000000000000000949185d3be66775ea648f4a306740ea9eff9c5676001600160a01b03908116610100909204161461218a576009547f00000000000000000000000029219dd400f2bf60e5a23d13be72b486d40388946001600160a01b03908116610100909204161461218457600c546001600160a01b031661218c565b8161218c565b305b6009546040516323b872dd60e01b815291925061010090046001600160a01b0316906323b872dd906121c6903390859088906004016150ce565b6020604051808303816000875af11580156121e5573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061220991906150f2565b506009546001600160a01b0361010090910481167f000000000000000000000000949185d3be66775ea648f4a306740ea9eff9c567909116036122bd576009546122629061010090046001600160a01b031683856137dd565b6040516345efb3f960e11b8152600481018490526001600160a01b03831690638bdf67f290602401600060405180830381600087803b1580156122a457600080fd5b505af11580156122b8573d6000803e3d6000fd5b505050505b6040516370a0823160e01b81526000906001600160a01b038a16906370a08231906122ec903090600401614a9a565b602060405180830381865afa158015612309573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061232d91906150b5565b60405163a9059cbb60e01b81529091506001600160a01b038a169063a9059cbb9061235e908d908c90600401615150565b6020604051808303816000875af115801561237d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123a191906150f2565b50604051633a62959560e21b81526001600160a01b038b169063e98a5654906123d0908a908a90600401615292565b600060405180830381600087803b1580156123ea57600080fd5b505af11580156123fe573d6000803e3d6000fd5b50506040516370a0823160e01b81528392506001600160a01b038c1691506370a0823190612430903090600401614a9a565b602060405180830381865afa15801561244d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061247191906150b5565b101561248f5760405162461bcd60e51b81526004016107e3906152c1565b6001600160a01b038a16336001600160a01b03166000805160206153b68339815191528b8b6040516124c2929190615150565b60405180910390a3505050505b50506019805462ff000019166201000017905550505050565b60195462010000900460ff166125105760405162461bcd60e51b81526004016107e390615008565b6019805462ff000019169055600c546001600160a01b0316336001600160a01b03161461254f5760405162461bcd60e51b81526004016107e390614f78565b600c546040516370a0823160e01b81526001600160a01b038084169263a9059cbb9291169083906370a082319061258a903090600401614a9a565b602060405180830381865afa1580156125a7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125cb91906150b5565b6040518363ffffffff1660e01b81526004016125e8929190615150565b6020604051808303816000875af1158015612607573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061262b91906150f2565b50506019805462ff0000191662010000179055565b834211156126905760405162461bcd60e51b815260206004820152601d60248201527f45524332305065726d69743a206578706972656420646561646c696e6500000060448201526064016107e3565b60007f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98888886126bf8c613e21565b6040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810186905260e001604051602081830303815290604052805190602001209050600061271a82613e49565b9050600061272a82878787613e76565b9050896001600160a01b0316816001600160a01b03161461278d5760405162461bcd60e51b815260206004820152601e60248201527f45524332305065726d69743a20696e76616c6964207369676e6174757265000060448201526064016107e3565b6127988a8a8a612ea5565b50505050505050505050565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6001600160a01b03808416600081815260156020908152604080832054948616835280832054815163313ce56760e01b815291519395949093909263313ce56792600480820193918290030181865afa158015612830573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061285491906152e5565b61285f90600a615280565b6013838154811061287257612872615169565b906000526020600020906005020160010154856001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa1580156128c2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128e691906152e5565b6128f190600a615280565b6013848154811061290457612904615169565b906000526020600020906005020160010154886129219190614faf565b61292b9190614faf565b6129359190614fc6565b61293f9190614fc6565b9695505050505050565b60195462010000900460ff166129715760405162461bcd60e51b81526004016107e390615008565b6019805462ffff0019169055612985613605565b600061299084613ea0565b6129be57600f54612710906129a5908261510f565b6129af9086614faf565b6129b99190614fc6565b6129c0565b835b905060006129cd60025490565b6129db600160601b84614faf565b6129e59190614fc6565b90506129f2333087613044565b6129fc3083613400565b612a0e612a09838761510f565b613acf565b60005b601354811015612b7457600060138281548110612a3057612a30615169565b60009182526020909120600590910201546040516370a0823160e01b81526001600160a01b03909116906370a0823190612a6e903090600401614a9a565b602060405180830381865afa158015612a8b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612aaf91906150b5565b90506000600160601b612ac28584614faf565b612acc9190614fc6565b90508015612b6a5760138381548110612ae757612ae7615169565b60009182526020909120600590910201546001600160a01b031663a9059cbb33836040518363ffffffff1660e01b8152600401612b25929190615150565b6020604051808303816000875af1158015612b44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b6891906150f2565b505b5050600101612a11565b50612b7f828661510f565b60405186815233907feb4e1f68c885fce0dc37cc7eecbff0d11209b7580c2a5d336015497b20af895f9060200160405180910390a350506019805462ffff00191662010100179055505050565b60195462010000900460ff16612bf45760405162461bcd60e51b81526004016107e390615008565b6019805462ffff0019169055612c08613605565b8315612c145783612c83565b600b546001600160a01b03166370a08231336040518263ffffffff1660e01b8152600401612c429190614a9a565b602060405180830381865afa158015612c5f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c8391906150b5565b935060008411612cbd5760405162461bcd60e51b81526020600482015260056024820152644c5052454d60d81b60448201526064016107e3565b600b546001600160a01b03166323b872dd3330876040518463ffffffff1660e01b8152600401612cef939291906150ce565b6020604051808303816000875af1158015612d0e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d3291906150f2565b50600b54612d6a906001600160a01b03167f000000000000000000000000a6ad18c2ac47803e193f75c3677b14bf19b94883866137dd565b60408051635d5155ef60e11b81523060048201526001600160a01b037f00000000000000000000000029219dd400f2bf60e5a23d13be72b486d4038894811660248301526044820187905260648201869052608482018590523360a483015260c4820184905282517f000000000000000000000000a6ad18c2ac47803e193f75c3677b14bf19b948839091169263baa2abde9260e4808201939182900301816000875af1158015612e1f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e439190615302565b5050612e4c3390565b6001600160a01b03167fdfdd120ded9b7afc0c23dd5310e93aaa3e1c3b9f75af9b805fab3030842439f285604051612e8691815260200190565b60405180910390a250506019805462ffff001916620101001790555050565b6001600160a01b038316612f075760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016107e3565b6001600160a01b038216612f685760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016107e3565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b6000612fd684846127a4565b9050600019811461303e57818110156130315760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e636500000060448201526064016107e3565b61303e8484848403612ea5565b50505050565b33600090815260166020526040812054600b5460ff90911691906001600160a01b0386811691161480156130aa57507f000000000000000000000000a6ad18c2ac47803e193f75c3677b14bf19b948836001600160a01b0316846001600160a01b031614155b600b546019549192506001600160a01b038681169116149060009060ff161580156130dc5750601954610100900460ff165b1561326857600b546001600160a01b038881169116146130fe576130fe613cd1565b82801561310c575060105415155b156131b3578315613145576010546127109061312a90600290614fc6565b6131349087614faf565b61313e9190614fc6565b9050613163565b601054612710906131569087614faf565b6131609190614fc6565b90505b61316e87308361364b565b80336001600160a01b03167fa76261e4127b2ebc809716d704216602fdaee4ae5b72745ed9aec0d7bd73b75d30886040516131aa929190615150565b60405180910390a35b8180156131c1575060115415155b156132685783156131fa57601154612710906131df90600290614fc6565b6131e99087614faf565b6131f39190614fc6565b9050613218565b6011546127109061320b9087614faf565b6132159190614fc6565b90505b61322387308361364b565b80336001600160a01b03167f463904c4b0359ad674399537c3d4e4e44acc0b0dd259453d17329fd9b4be52c0308860405161325f929190615150565b60405180910390a35b61327181613acf565b6132808787611612848961510f565b50505050505050565b6000306001600160a01b037f0000000000000000000000007ba0abb5f6bdcbf6409bb2803cdf801215424490161480156132e257507f000000000000000000000000000000000000000000000000000000000000009246145b1561330c57507f47f83e5684a66c807a087a5fb3fe43e64a84ac059e04e2a2e27fd20aac21bb0f90565b610a8d604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201527f5066fd705a1cda4ac30750f97dff174ce715ecd631bcff4841d346d5e4d22956918101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260009060c00160405160208183030381529060405280519060200120905090565b6133bc613ecb565b6009805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516133f69190614a9a565b60405180910390a1565b6001600160a01b0382166134605760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b60648201526084016107e3565b6001600160a01b038216600090815260208190526040902054818110156134d45760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b60648201526084016107e3565b6001600160a01b0383166000818152602081815260408083208686039055600280548790039055518581529192916000805160206153d68339815191529101612fbd565b505050565b613525613605565b6009805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586133e93390565b606060ff83146135745761356d83613f14565b90506107aa565b81805461358090614f44565b80601f01602080910402602001604051908101604052809291908181526020018280546135ac90614f44565b80156135f95780601f106135ce576101008083540402835291602001916135f9565b820191906000526020600020905b8154815290600101906020018083116135dc57829003601f168201915b505050505090506107aa565b60095460ff1615610b575760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016107e3565b6001600160a01b0383166136af5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016107e3565b6001600160a01b0382166137115760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016107e3565b6001600160a01b038316600090815260208190526040902054818110156137895760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b60648201526084016107e3565b6001600160a01b03848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290926000805160206153d6833981519152910160405180910390a361303e565b604051636eb1769f60e11b81526000906001600160a01b0385169063dd62ed3e9061380e903090879060040161509b565b602060405180830381865afa15801561382b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061384f91906150b5565b905061303e8463095ea7b360e01b856138688686615028565b604051602401613879929190615150565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152613f53565b604051636eb1769f60e11b81526000906001600160a01b0385169063dd62ed3e906138e1903090879060040161509b565b602060405180830381865afa1580156138fe573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061392291906150b5565b9050818110156139865760405162461bcd60e51b815260206004820152602960248201527f5361666545524332303a2064656372656173656420616c6c6f77616e63652062604482015268656c6f77207a65726f60b81b60648201526084016107e3565b61303e8463095ea7b360e01b85858503604051602401613879929190615150565b60006139b260025490565b15919050565b60006139c26139a7565b806107aa5750600c546001600160a01b0383811691161480156139e55750601754155b80156107aa5750613a197f00000000000000000000000000000000000000000000000000000000677875d262093a80615028565b42111592915050565b6001600160a01b038216613a785760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f20616464726573730060448201526064016107e3565b8060026000828254613a8a9190615028565b90915550506001600160a01b038216600081815260208181526040808320805486019055518481526000805160206153d6833981519152910160405180910390a35050565b801580613adc5750600d54155b15613ae45750565b613b0b30612710600d6000015484613afc9190614faf565b613b069190614fc6565b613400565b50565b6040516370a0823160e01b81526000906001600160a01b038516906370a0823190613b3d903090600401614a9a565b602060405180830381865afa158015613b5a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613b7e91906150b5565b6040516323b872dd60e01b81529091506001600160a01b038516906323b872dd90613bb1908690309087906004016150ce565b6020604051808303816000875af1158015613bd0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613bf491906150f2565b50613bff8282615028565b6040516370a0823160e01b81526001600160a01b038616906370a0823190613c2b903090600401614a9a565b602060405180830381865afa158015613c48573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613c6c91906150b5565b101561303e5760405162461bcd60e51b815260206004820152600660248201526515119495905360d21b60448201526064016107e3565b601754158015613cc65750600c546001600160a01b0316336001600160a01b0316145b15610b575742601755565b60006014601854613ce29190615028565b421190506000613cf130610cdd565b600b54909150600090613d0c906001600160a01b0316610cdd565b905060006064613d1d836001614faf565b613d279190614fc6565b9050838015613d365750808310155b8015613d425750600082115b1561303e576019805460ff1916600117815542601855600090613d66908390614faf565b841015613d9557613d7882600a614faf565b841015613d855781613da0565b613d9082600a614faf565b613da0565b613da0826019614faf565b9050600080600d60050154118015613dc25750600c546001600160a01b031615155b15613dfd5760125461271090613dd89084614faf565b613de29190614fc6565b600c54909150613dfd9030906001600160a01b03168361364b565b613e0f613e0a828461510f565b614028565b50506019805460ff1916905550505050565b6001600160a01b03811660009081526007602052604090208054600181018255905b50919050565b60006107aa613e56613289565b8360405161190160f01b8152600281019290925260228201526042902090565b6000806000613e878787878761458f565b91509150613e9481614649565b5090505b949350505050565b60006064613ead60025490565b613eb8906062614faf565b613ec29190614fc6565b90911015919050565b60095460ff16610b575760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016107e3565b60606000613f218361478e565b604080516020808252818301909252919250600091906020820181803683375050509182525060208101929092525090565b6000613fa8826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166147b69092919063ffffffff16565b9050805160001480613fc9575080806020019051810190613fc991906150f2565b6135185760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016107e3565b604080516002808252606082018352600092602083019080368337019050509050308160008151811061405d5761405d615169565b60200260200101906001600160a01b031690816001600160a01b0316815250507f00000000000000000000000029219dd400f2bf60e5a23d13be72b486d4038894816001815181106140b1576140b1615169565b60200260200101906001600160a01b031690816001600160a01b0316815250506140fc307f000000000000000000000000a6ad18c2ac47803e193f75c3677b14bf19b9488384612ea5565b60007f000000000000000000000000b694c8d7bc260b6e76ff2644b10189c9a4b6e5486001600160a01b0316638bc6beb26040518163ffffffff1660e01b8152600401602060405180830381865afa15801561415c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614180919061507e565b905060007f00000000000000000000000029219dd400f2bf60e5a23d13be72b486d40388946001600160a01b03166370a08231306040518263ffffffff1660e01b81526004016141d09190614a9a565b602060405180830381865afa1580156141ed573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061421191906150b5565b905060007f000000000000000000000000949185d3be66775ea648f4a306740ea9eff9c5676001600160a01b03167f00000000000000000000000029219dd400f2bf60e5a23d13be72b486d40388946001600160a01b0316146142745782614276565b305b604051635c11d79560e01b81529091506001600160a01b037f000000000000000000000000a6ad18c2ac47803e193f75c3677b14bf19b948831690635c11d795906142ce908890600090899087904290600401615326565b600060405180830381600087803b1580156142e857600080fd5b505af11580156142fc573d6000803e3d6000fd5b505050507f000000000000000000000000949185d3be66775ea648f4a306740ea9eff9c5676001600160a01b03167f00000000000000000000000029219dd400f2bf60e5a23d13be72b486d40388946001600160a01b031603614490576000827f00000000000000000000000029219dd400f2bf60e5a23d13be72b486d40388946001600160a01b03166370a08231306040518263ffffffff1660e01b81526004016143a89190614a9a565b602060405180830381865afa1580156143c5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906143e991906150b5565b6143f3919061510f565b9050801561448a5761442f6001600160a01b037f00000000000000000000000029219dd400f2bf60e5a23d13be72b486d40388941685836137dd565b6040516345efb3f960e11b8152600481018290526001600160a01b03851690638bdf67f290602401600060405180830381600087803b15801561447157600080fd5b505af1158015614485573d6000803e3d6000fd5b505050505b50614588565b6040516370a0823160e01b81526000906001600160a01b037f00000000000000000000000029219dd400f2bf60e5a23d13be72b486d403889416906370a08231906144df908790600401614a9a565b602060405180830381865afa1580156144fc573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061452091906150b5565b1115614588576040516370b9f1f960e01b815260006004820181905260248201526001600160a01b038416906370b9f1f990604401600060405180830381600087803b15801561456f57600080fd5b505af1158015614583573d6000803e3d6000fd5b505050505b5050505050565b6000806fa2a8918ca85bafe22016d0b997e4df60600160ff1b038311156145bc5750600090506003614640565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015614610573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661463957600060019250925050614640565b9150600090505b94509492505050565b600081600481111561465d5761465d614aae565b036146655750565b600181600481111561467957614679614aae565b036146c15760405162461bcd60e51b815260206004820152601860248201527745434453413a20696e76616c6964207369676e617475726560401b60448201526064016107e3565b60028160048111156146d5576146d5614aae565b036147225760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e6774680060448201526064016107e3565b600381600481111561473657614736614aae565b03613b0b5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b60648201526084016107e3565b600060ff8216601f8111156107aa57604051632cd44ac360e21b815260040160405180910390fd5b6060613e98848460008585600080866001600160a01b031685876040516147dd9190615399565b60006040518083038185875af1925050503d806000811461481a576040519150601f19603f3d011682016040523d82523d6000602084013e61481f565b606091505b50915091506148308783838761483b565b979650505050505050565b606083156148aa5782516000036148a3576001600160a01b0385163b6148a35760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016107e3565b5081613e98565b613e9883838151156148bf5781518083602001fd5b8060405162461bcd60e51b81526004016107e39190614929565b60005b838110156148f45781810151838201526020016148dc565b50506000910152565b600081518084526149158160208601602086016148d9565b601f01601f19169290920160200192915050565b60208152600061098760208301846148fd565b6001600160a01b0381168114613b0b57600080fd5b6000806040838503121561496457600080fd5b823561496f8161493c565b946020939093013593505050565b60006020828403121561498f57600080fd5b5035919050565b6000806000606084860312156149ab57600080fd5b83356149b68161493c565b925060208401356149c68161493c565b929592945050506040919091013590565b8015158114613b0b57600080fd5b600080604083850312156149f857600080fd5b8235614a038161493c565b91506020830135614a13816149d7565b809150509250929050565b602080825282518282018190526000919060409081850190868401855b82811015614a8d57815180516001600160a01b03908116865287820151888701528682015187870152606080830151909116908601526080908101519085015260a09093019290850190600101614a3b565b5091979650505050505050565b6001600160a01b0391909116815260200190565b634e487b7160e01b600052602160045260246000fd5b6020810160028310614ae657634e487b7160e01b600052602160045260246000fd5b91905290565b600060208284031215614afe57600080fd5b81356109878161493c565b60ff60f81b881681526000602060e06020840152614b2a60e084018a6148fd565b8381036040850152614b3c818a6148fd565b606085018990526001600160a01b038816608086015260a0850187905284810360c08601528551808252602080880193509091019060005b81811015614b9057835183529284019291840191600101614b74565b50909c9b505050505050505050505050565b60008060008060808587031215614bb857600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060608486031215614be957600080fd5b8335614bf48161493c565b95602085013595506040909401359392505050565b600080600080600060808688031215614c2157600080fd5b8535614c2c8161493c565b94506020860135614c3c8161493c565b93506040860135925060608601356001600160401b0380821115614c5f57600080fd5b818801915088601f830112614c7357600080fd5b813581811115614c8257600080fd5b896020828501011115614c9457600080fd5b9699959850939650602001949392505050565b60ff81168114613b0b57600080fd5b600080600080600080600060e0888a031215614cd157600080fd5b8735614cdc8161493c565b96506020880135614cec8161493c565b955060408801359450606088013593506080880135614d0a81614ca7565b9699959850939692959460a0840135945060c09093013592915050565b60008060408385031215614d3a57600080fd5b8235614d458161493c565b91506020830135614a138161493c565b600080600060608486031215614d6a57600080fd5b8335614d758161493c565b9250602084013591506040840135614d8c8161493c565b809150509250925092565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715614dd557614dd5614d97565b604052919050565b60006001600160401b03821115614df657614df6614d97565b5060051b60200190565b600082601f830112614e1157600080fd5b81356020614e26614e2183614ddd565b614dad565b8083825260208201915060208460051b870101935086841115614e4857600080fd5b602086015b84811015614e6d578035614e6081614ca7565b8352918301918301614e4d565b509695505050505050565b600080600060608486031215614e8d57600080fd5b833592506020808501356001600160401b0380821115614eac57600080fd5b818701915087601f830112614ec057600080fd5b8135614ece614e2182614ddd565b81815260059190911b8301840190848101908a831115614eed57600080fd5b938501935b82851015614f14578435614f058161493c565b82529385019390850190614ef2565b965050506040870135925080831115614f2c57600080fd5b5050614f3a86828701614e00565b9150509250925092565b600181811c90821680614f5857607f821691505b602082108103613e4357634e487b7160e01b600052602260045260246000fd5b6020808252600790820152662820a92a2722a960c91b604082015260600190565b634e487b7160e01b600052601160045260246000fd5b80820281158282048414176107aa576107aa614f99565b600082614fe357634e487b7160e01b600052601260045260246000fd5b500490565b6020808252600690820152656c746532302560d01b604082015260600190565b6020808252600690820152651313d0d2d15160d21b604082015260600190565b808201808211156107aa576107aa614f99565b6020808252600a908201526920a1a1a2a9a9afa2a92960b11b604082015260600190565b6020808252600590820152646c7439392560d81b604082015260600190565b60006020828403121561509057600080fd5b81516109878161493c565b6001600160a01b0392831681529116602082015260400190565b6000602082840312156150c757600080fd5b5051919050565b6001600160a01b039384168152919092166020820152604081019190915260600190565b60006020828403121561510457600080fd5b8151610987816149d7565b818103818111156107aa576107aa614f99565b60008060006060848603121561513757600080fd5b8351925060208401519150604084015190509250925092565b6001600160a01b03929092168252602082015260400190565b634e487b7160e01b600052603260045260246000fd5b80825b60018086116151915750614640565b8187048211156151a3576151a3614f99565b808616156151b057918102915b9490941c938002615182565b6000826151cb57506001610987565b816151d857506000610987565b81600181146151ee57600281146151f857615225565b6001915050610987565b60ff84111561520957615209614f99565b6001841b91508482111561521f5761521f614f99565b50610987565b5060208310610133831016604e8410600b8410161715615258575081810a8381111561525357615253614f99565b610987565b615265848484600161517f565b80860482111561527757615277614f99565b02949350505050565b600061098760001960ff8516846151bc565b60208152816020820152818360408301376000818301604090810191909152601f909201601f19160101919050565b6020808252600a9082015269232620a9a420a32a22a960b11b604082015260600190565b6000602082840312156152f757600080fd5b815161098781614ca7565b6000806040838503121561531557600080fd5b505080516020909101519092909150565b600060a08201878352602087602085015260a0604085015281875180845260c08601915060208901935060005b818110156153785784516001600160a01b031683529383019391830191600101615353565b50506001600160a01b03969096166060850152505050608001529392505050565b600082516153ab8184602087016148d9565b919091019291505056fe5a9eeaf8949838813289046091e8ea8a9196a2265ac24841464a2d27026a8549ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa26469706673582212209a6d86548462dd76aac58f331415038c9315b0d2ba098ed6dc5a3e9e72e84e5a64736f6c63430008180033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000026000000000000000000000000000000000000000000000000000000000000002a000000000000000000000000000000000000000000000000000000000000013880000000000000000000000000000000000000000000000000000000000000096000000000000000000000000000000000000000000000000000000000000001900000000000000000000000000000000000000000000000000000000000000190000000000000000000000000000000000000000000000000000000000000019000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002e000000000000000000000000000000000000000000000000000000000000003200000000000000000000000007ed6fd046ef71e2a71092d1597bcebe578a57a760000000000000000000000000000000000000000000000000000000000000000000000000000000000000000949185d3be66775ea648f4a306740ea9eff9c567000000000000000000000000a6ad18c2ac47803e193f75c3677b14bf19b94883000000000000000000000000000000000000000000000000000000000000000000000000000000000000000029219dd400f2bf60e5a23d13be72b486d4038894000000000000000000000000b747dc4fb976e4ba2bbe8c13a92e2faa7b9f64ce000000000000000000000000db51cffff3b989d0cb6b58abf173371b6f2d0d240000000000000000000000001ac569879ef7eacb17cc373ef801cdce4accded500000000000000000000000000000000000000000000000000000000000000086c69717569642d5300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000026c530000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad3800000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000056bc75e2d63100000
-----Decoded View---------------
Arg [0] : _deploy (tuple): System.Collections.Generic.List`1[Nethereum.ABI.FunctionEncoding.ParameterOutput]
-----Encoded View---------------
28 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000020
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000260
Arg [2] : 00000000000000000000000000000000000000000000000000000000000002a0
Arg [3] : 0000000000000000000000000000000000000000000000000000000000001388
Arg [4] : 0000000000000000000000000000000000000000000000000000000000000096
Arg [5] : 0000000000000000000000000000000000000000000000000000000000000019
Arg [6] : 0000000000000000000000000000000000000000000000000000000000000019
Arg [7] : 0000000000000000000000000000000000000000000000000000000000000019
Arg [8] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [9] : 00000000000000000000000000000000000000000000000000000000000002e0
Arg [10] : 0000000000000000000000000000000000000000000000000000000000000320
Arg [11] : 0000000000000000000000007ed6fd046ef71e2a71092d1597bcebe578a57a76
Arg [12] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [13] : 000000000000000000000000949185d3be66775ea648f4a306740ea9eff9c567
Arg [14] : 000000000000000000000000a6ad18c2ac47803e193f75c3677b14bf19b94883
Arg [15] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [16] : 00000000000000000000000029219dd400f2bf60e5a23d13be72b486d4038894
Arg [17] : 000000000000000000000000b747dc4fb976e4ba2bbe8c13a92e2faa7b9f64ce
Arg [18] : 000000000000000000000000db51cffff3b989d0cb6b58abf173371b6f2d0d24
Arg [19] : 0000000000000000000000001ac569879ef7eacb17cc373ef801cdce4accded5
Arg [20] : 0000000000000000000000000000000000000000000000000000000000000008
Arg [21] : 6c69717569642d53000000000000000000000000000000000000000000000000
Arg [22] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [23] : 6c53000000000000000000000000000000000000000000000000000000000000
Arg [24] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [25] : 000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad38
Arg [26] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [27] : 0000000000000000000000000000000000000000000000056bc75e2d63100000
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.