Contract Overview
My Name Tag:
Not Available
TokenTracker:
[ Download CSV Export ]
Latest 25 internal transaction
[ Download CSV Export ]
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Name:
RdpxWeeklyPutsSsovV3
Compiler Version
v0.8.9+commit.e5eed63a
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControlEnumerable.sol) pragma solidity ^0.8.0; import "./IAccessControlEnumerableUpgradeable.sol"; import "./AccessControlUpgradeable.sol"; import "../utils/structs/EnumerableSetUpgradeable.sol"; import "../proxy/utils/Initializable.sol"; /** * @dev Extension of {AccessControl} that allows enumerating the members of each role. */ abstract contract AccessControlEnumerableUpgradeable is Initializable, IAccessControlEnumerableUpgradeable, AccessControlUpgradeable { function __AccessControlEnumerable_init() internal onlyInitializing { } function __AccessControlEnumerable_init_unchained() internal onlyInitializing { } using EnumerableSetUpgradeable for EnumerableSetUpgradeable.AddressSet; mapping(bytes32 => EnumerableSetUpgradeable.AddressSet) private _roleMembers; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControlEnumerableUpgradeable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) public view virtual override returns (address) { return _roleMembers[role].at(index); } /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) public view virtual override returns (uint256) { return _roleMembers[role].length(); } /** * @dev Overload {_grantRole} to track enumerable memberships */ function _grantRole(bytes32 role, address account) internal virtual override { super._grantRole(role, account); _roleMembers[role].add(account); } /** * @dev Overload {_revokeRole} to track enumerable memberships */ function _revokeRole(bytes32 role, address account) internal virtual override { super._revokeRole(role, account); _roleMembers[role].remove(account); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControl.sol) pragma solidity ^0.8.0; import "./IAccessControlUpgradeable.sol"; import "../utils/ContextUpgradeable.sol"; import "../utils/StringsUpgradeable.sol"; import "../utils/introspection/ERC165Upgradeable.sol"; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight version that doesn't allow enumerating role * members except through off-chain means by accessing the contract event logs. Some * applications may benefit from on-chain enumerability, for those cases see * {AccessControlEnumerable}. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ``` * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ``` * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. */ abstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable { function __AccessControl_init() internal onlyInitializing { } function __AccessControl_init_unchained() internal onlyInitializing { } struct RoleData { mapping(address => bool) members; bytes32 adminRole; } mapping(bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with a standardized message including the required role. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ * * _Available since v4.1._ */ modifier onlyRole(bytes32 role) { _checkRole(role, _msgSender()); _; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControlUpgradeable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view virtual override returns (bool) { return _roles[role].members[account]; } /** * @dev Revert with a standard message if `account` is missing `role`. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ */ function _checkRole(bytes32 role, address account) internal view virtual { if (!hasRole(role, account)) { revert( string( abi.encodePacked( "AccessControl: account ", StringsUpgradeable.toHexString(uint160(account), 20), " is missing role ", StringsUpgradeable.toHexString(uint256(role), 32) ) ) ); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been revoked `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) public virtual override { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== * * NOTE: This function is deprecated in favor of {_grantRole}. */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { bytes32 previousAdminRole = getRoleAdmin(role); _roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Grants `role` to `account`. * * Internal function without access restriction. */ function _grantRole(bytes32 role, address account) internal virtual { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); } } /** * @dev Revokes `role` from `account`. * * Internal function without access restriction. */ function _revokeRole(bytes32 role, address account) internal virtual { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControlEnumerable.sol) pragma solidity ^0.8.0; import "./IAccessControlUpgradeable.sol"; /** * @dev External interface of AccessControlEnumerable declared to support ERC165 detection. */ interface IAccessControlEnumerableUpgradeable is IAccessControlUpgradeable { /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) external view returns (address); /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) external view returns (uint256); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol) pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControlUpgradeable { /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.0; import "../../utils/AddressUpgradeable.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To initialize the implementation contract, you can either invoke the * initializer manually, or you can include a constructor to automatically mark it as initialized when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() initializer {} * ``` * ==== */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. */ bool private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Modifier to protect an initializer function from being invoked twice. */ modifier initializer() { // If the contract is initializing we ignore whether _initialized is set in order to support multiple // inheritance patterns, but we only do this in the context of a constructor, because in other contexts the // contract may have been reentered. require(_initializing ? _isConstructor() : !_initialized, "Initializable: contract is already initialized"); bool isTopLevelCall = !_initializing; if (isTopLevelCall) { _initializing = true; _initialized = true; } _; if (isTopLevelCall) { _initializing = false; } } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} modifier, directly or indirectly. */ modifier onlyInitializing() { require(_initializing, "Initializable: contract is not initializing"); _; } function _isConstructor() private view returns (bool) { return !AddressUpgradeable.isContract(address(this)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (security/Pausable.sol) pragma solidity ^0.8.0; import "../utils/ContextUpgradeable.sol"; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract PausableUpgradeable is Initializable, ContextUpgradeable { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ function __Pausable_init() internal onlyInitializing { __Pausable_init_unchained(); } function __Pausable_init_unchained() internal onlyInitializing { _paused = false; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { require(!paused(), "Pausable: paused"); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { require(paused(), "Pausable: not paused"); _; } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.0; import "./IERC20Upgradeable.sol"; import "./extensions/IERC20MetadataUpgradeable.sol"; import "../../utils/ContextUpgradeable.sol"; import "../../proxy/utils/Initializable.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin Contracts guidelines: functions revert * instead returning `false` on failure. This behavior is nonetheless * conventional and does not conflict with the expectations of ERC20 * applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20Upgradeable is Initializable, ContextUpgradeable, IERC20Upgradeable, IERC20MetadataUpgradeable { mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ function __ERC20_init(string memory name_, string memory symbol_) internal onlyInitializing { __ERC20_init_unchained(name_, symbol_); } function __ERC20_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overridden; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `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, _allowances[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 = _allowances[owner][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(owner, spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `sender` to `recipient`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. */ function _transfer( address from, address to, uint256 amount ) internal virtual { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(from, to, amount); uint256 fromBalance = _balances[from]; require(fromBalance >= amount, "ERC20: transfer amount exceeds balance"); unchecked { _balances[from] = fromBalance - amount; } _balances[to] += amount; emit Transfer(from, to, amount); _afterTokenTransfer(from, to, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); _afterTokenTransfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); unchecked { _balances[account] = accountBalance - amount; } _totalSupply -= amount; emit Transfer(account, address(0), amount); _afterTokenTransfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve( address owner, address spender, uint256 amount ) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Spend `amount` form the allowance of `owner` toward `spender`. * * 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 {} /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[45] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20Upgradeable { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `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); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/extensions/ERC20Burnable.sol) pragma solidity ^0.8.0; import "../ERC20Upgradeable.sol"; import "../../../utils/ContextUpgradeable.sol"; import "../../../proxy/utils/Initializable.sol"; /** * @dev Extension of {ERC20} that allows token holders to destroy both their own * tokens and those that they have an allowance for, in a way that can be * recognized off-chain (via event analysis). */ abstract contract ERC20BurnableUpgradeable is Initializable, ContextUpgradeable, ERC20Upgradeable { function __ERC20Burnable_init() internal onlyInitializing { } function __ERC20Burnable_init_unchained() internal onlyInitializing { } /** * @dev Destroys `amount` tokens from the caller. * * See {ERC20-_burn}. */ function burn(uint256 amount) public virtual { _burn(_msgSender(), amount); } /** * @dev Destroys `amount` tokens from `account`, deducting from the caller's * allowance. * * See {ERC20-_burn} and {ERC20-allowance}. * * Requirements: * * - the caller must have allowance for ``accounts``'s tokens of at least * `amount`. */ function burnFrom(address account, uint256 amount) public virtual { _spendAllowance(account, _msgSender(), amount); _burn(account, amount); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/ERC20Pausable.sol) pragma solidity ^0.8.0; import "../ERC20Upgradeable.sol"; import "../../../security/PausableUpgradeable.sol"; import "../../../proxy/utils/Initializable.sol"; /** * @dev ERC20 token with pausable token transfers, minting and burning. * * Useful for scenarios such as preventing trades until the end of an evaluation * period, or having an emergency switch for freezing all token transfers in the * event of a large bug. */ abstract contract ERC20PausableUpgradeable is Initializable, ERC20Upgradeable, PausableUpgradeable { function __ERC20Pausable_init() internal onlyInitializing { __Pausable_init_unchained(); } function __ERC20Pausable_init_unchained() internal onlyInitializing { } /** * @dev See {ERC20-_beforeTokenTransfer}. * * Requirements: * * - the contract must not be paused. */ function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual override { super._beforeTokenTransfer(from, to, amount); require(!paused(), "ERC20Pausable: token transfer while paused"); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.0; import "../IERC20Upgradeable.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20MetadataUpgradeable is IERC20Upgradeable { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/presets/ERC20PresetMinterPauser.sol) pragma solidity ^0.8.0; import "../ERC20Upgradeable.sol"; import "../extensions/ERC20BurnableUpgradeable.sol"; import "../extensions/ERC20PausableUpgradeable.sol"; import "../../../access/AccessControlEnumerableUpgradeable.sol"; import "../../../utils/ContextUpgradeable.sol"; import "../../../proxy/utils/Initializable.sol"; /** * @dev {ERC20} token, including: * * - ability for holders to burn (destroy) their tokens * - a minter role that allows for token minting (creation) * - a pauser role that allows to stop all token transfers * * This contract uses {AccessControl} to lock permissioned functions using the * different roles - head to its documentation for details. * * The account that deploys the contract will be granted the minter and pauser * roles, as well as the default admin role, which will let it grant both minter * and pauser roles to other accounts. * * _Deprecated in favor of https://wizard.openzeppelin.com/[Contracts Wizard]._ */ contract ERC20PresetMinterPauserUpgradeable is Initializable, ContextUpgradeable, AccessControlEnumerableUpgradeable, ERC20BurnableUpgradeable, ERC20PausableUpgradeable { function initialize(string memory name, string memory symbol) public virtual initializer { __ERC20PresetMinterPauser_init(name, symbol); } bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE"); /** * @dev Grants `DEFAULT_ADMIN_ROLE`, `MINTER_ROLE` and `PAUSER_ROLE` to the * account that deploys the contract. * * See {ERC20-constructor}. */ function __ERC20PresetMinterPauser_init(string memory name, string memory symbol) internal onlyInitializing { __ERC20_init_unchained(name, symbol); __Pausable_init_unchained(); __ERC20PresetMinterPauser_init_unchained(name, symbol); } function __ERC20PresetMinterPauser_init_unchained(string memory, string memory) internal onlyInitializing { _setupRole(DEFAULT_ADMIN_ROLE, _msgSender()); _setupRole(MINTER_ROLE, _msgSender()); _setupRole(PAUSER_ROLE, _msgSender()); } /** * @dev Creates `amount` new tokens for `to`. * * See {ERC20-_mint}. * * Requirements: * * - the caller must have the `MINTER_ROLE`. */ function mint(address to, uint256 amount) public virtual { require(hasRole(MINTER_ROLE, _msgSender()), "ERC20PresetMinterPauser: must have minter role to mint"); _mint(to, amount); } /** * @dev Pauses all token transfers. * * See {ERC20Pausable} and {Pausable-_pause}. * * Requirements: * * - the caller must have the `PAUSER_ROLE`. */ function pause() public virtual { require(hasRole(PAUSER_ROLE, _msgSender()), "ERC20PresetMinterPauser: must have pauser role to pause"); _pause(); } /** * @dev Unpauses all token transfers. * * See {ERC20Pausable} and {Pausable-_unpause}. * * Requirements: * * - the caller must have the `PAUSER_ROLE`. */ function unpause() public virtual { require(hasRole(PAUSER_ROLE, _msgSender()), "ERC20PresetMinterPauser: must have pauser role to unpause"); _unpause(); } function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual override(ERC20Upgradeable, ERC20PausableUpgradeable) { super._beforeTokenTransfer(from, to, amount); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; import "../proxy/utils/Initializable.sol"; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract ContextUpgradeable is Initializable { function __Context_init() internal onlyInitializing { } function __Context_init_unchained() internal onlyInitializing { } function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library StringsUpgradeable { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165Upgradeable.sol"; import "../../proxy/utils/Initializable.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable { function __ERC165_init() internal onlyInitializing { } function __ERC165_init_unchained() internal onlyInitializing { } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165Upgradeable).interfaceId; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165Upgradeable { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/structs/EnumerableSet.sol) pragma solidity ^0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. */ library EnumerableSetUpgradeable { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping(bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; if (lastIndex != toDeleteIndex) { bytes32 lastvalue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastvalue; // Update the index for the moved value set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex } // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { return set._values[index]; } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function _values(Set storage set) private view returns (bytes32[] memory) { return set._values; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(Bytes32Set storage set) internal view returns (bytes32[] memory) { return _values(set._inner); } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(AddressSet storage set) internal view returns (address[] memory) { bytes32[] memory store = _values(set._inner); address[] memory result; assembly { result := store } return result; } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values on the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(UintSet storage set) internal view returns (uint256[] memory) { bytes32[] memory store = _values(set._inner); uint256[] memory result; assembly { result := store } return result; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/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 Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (proxy/Clones.sol) pragma solidity ^0.8.0; /** * @dev https://eips.ethereum.org/EIPS/eip-1167[EIP 1167] is a standard for * deploying minimal proxy contracts, also known as "clones". * * > To simply and cheaply clone contract functionality in an immutable way, this standard specifies * > a minimal bytecode implementation that delegates all calls to a known, fixed address. * * The library includes functions to deploy a proxy using either `create` (traditional deployment) or `create2` * (salted deterministic deployment). It also includes functions to predict the addresses of clones deployed using the * deterministic method. * * _Available since v3.4._ */ library Clones { /** * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`. * * This function uses the create opcode, which should never revert. */ function clone(address implementation) internal returns (address instance) { assembly { let ptr := mload(0x40) mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000) mstore(add(ptr, 0x14), shl(0x60, implementation)) mstore(add(ptr, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000) instance := create(0, ptr, 0x37) } require(instance != address(0), "ERC1167: create failed"); } /** * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`. * * This function uses the create2 opcode and a `salt` to deterministically deploy * the clone. Using the same `implementation` and `salt` multiple time will revert, since * the clones cannot be deployed twice at the same address. */ function cloneDeterministic(address implementation, bytes32 salt) internal returns (address instance) { assembly { let ptr := mload(0x40) mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000) mstore(add(ptr, 0x14), shl(0x60, implementation)) mstore(add(ptr, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000) instance := create2(0, ptr, 0x37, salt) } require(instance != address(0), "ERC1167: create2 failed"); } /** * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}. */ function predictDeterministicAddress( address implementation, bytes32 salt, address deployer ) internal pure returns (address predicted) { assembly { let ptr := mload(0x40) mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000) mstore(add(ptr, 0x14), shl(0x60, implementation)) mstore(add(ptr, 0x28), 0x5af43d82803e903d91602b57fd5bf3ff00000000000000000000000000000000) mstore(add(ptr, 0x38), shl(0x60, deployer)) mstore(add(ptr, 0x4c), salt) mstore(add(ptr, 0x6c), keccak256(ptr, 0x37)) predicted := keccak256(add(ptr, 0x37), 0x55) } } /** * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}. */ function predictDeterministicAddress(address implementation, bytes32 salt) internal view returns (address predicted) { return predictDeterministicAddress(implementation, salt, address(this)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/ERC721.sol) pragma solidity ^0.8.0; import "./IERC721.sol"; import "./IERC721Receiver.sol"; import "./extensions/IERC721Metadata.sol"; import "../../utils/Address.sol"; import "../../utils/Context.sol"; import "../../utils/Strings.sol"; import "../../utils/introspection/ERC165.sol"; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { _setApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint( address to, uint256 tokenId, bytes memory _data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); _afterTokenTransfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); _afterTokenTransfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); _afterTokenTransfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Approve `operator` to operate on all of `owner` tokens * * Emits a {ApprovalForAll} event. */ function _setApprovalForAll( address owner, address operator, bool approved ) internal virtual { require(owner != operator, "ERC721: approve to caller"); _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` 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 tokenId ) 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. * - `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 tokenId ) internal virtual {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol) pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/ERC721Burnable.sol) pragma solidity ^0.8.0; import "../ERC721.sol"; import "../../../utils/Context.sol"; /** * @title ERC721 Burnable Token * @dev ERC721 Token that can be irreversibly burned (destroyed). */ abstract contract ERC721Burnable is Context, ERC721 { /** * @dev Burns `tokenId`. See {ERC721-_burn}. * * Requirements: * * - The caller must own `tokenId` or be an approved operator. */ function burn(uint256 tokenId) public virtual { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721Burnable: caller is not owner nor approved"); _burn(tokenId); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/ERC721Enumerable.sol) pragma solidity ^0.8.0; import "../ERC721.sol"; import "./IERC721Enumerable.sol"; /** * @dev This implements an optional extension of {ERC721} defined in the EIP that adds * enumerability of all the token ids in the contract as well as all token ids owned by each * account. */ abstract contract ERC721Enumerable is ERC721, IERC721Enumerable { // Mapping from owner to list of owned token IDs mapping(address => mapping(uint256 => uint256)) private _ownedTokens; // Mapping from token ID to index of the owner tokens list mapping(uint256 => uint256) private _ownedTokensIndex; // Array with all token ids, used for enumeration uint256[] private _allTokens; // Mapping from token id to position in the allTokens array mapping(uint256 => uint256) private _allTokensIndex; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) { return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) { require(index < ERC721.balanceOf(owner), "ERC721Enumerable: owner index out of bounds"); return _ownedTokens[owner][index]; } /** * @dev See {IERC721Enumerable-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _allTokens.length; } /** * @dev See {IERC721Enumerable-tokenByIndex}. */ function tokenByIndex(uint256 index) public view virtual override returns (uint256) { require(index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: global index out of bounds"); return _allTokens[index]; } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` cannot be the zero address. * - `to` cannot be the zero address. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual override { super._beforeTokenTransfer(from, to, tokenId); if (from == address(0)) { _addTokenToAllTokensEnumeration(tokenId); } else if (from != to) { _removeTokenFromOwnerEnumeration(from, tokenId); } if (to == address(0)) { _removeTokenFromAllTokensEnumeration(tokenId); } else if (to != from) { _addTokenToOwnerEnumeration(to, tokenId); } } /** * @dev Private function to add a token to this extension's ownership-tracking data structures. * @param to address representing the new owner of the given token ID * @param tokenId uint256 ID of the token to be added to the tokens list of the given address */ function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private { uint256 length = ERC721.balanceOf(to); _ownedTokens[to][length] = tokenId; _ownedTokensIndex[tokenId] = length; } /** * @dev Private function to add a token to this extension's token tracking data structures. * @param tokenId uint256 ID of the token to be added to the tokens list */ function _addTokenToAllTokensEnumeration(uint256 tokenId) private { _allTokensIndex[tokenId] = _allTokens.length; _allTokens.push(tokenId); } /** * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for * gas optimizations e.g. when performing a transfer operation (avoiding double writes). * This has O(1) time complexity, but alters the order of the _ownedTokens array. * @param from address representing the previous owner of the given token ID * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address */ function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private { // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = ERC721.balanceOf(from) - 1; uint256 tokenIndex = _ownedTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary if (tokenIndex != lastTokenIndex) { uint256 lastTokenId = _ownedTokens[from][lastTokenIndex]; _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index } // This also deletes the contents at the last position of the array delete _ownedTokensIndex[tokenId]; delete _ownedTokens[from][lastTokenIndex]; } /** * @dev Private function to remove a token from this extension's token tracking data structures. * This has O(1) time complexity, but alters the order of the _allTokens array. * @param tokenId uint256 ID of the token to be removed from the tokens list */ function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private { // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = _allTokens.length - 1; uint256 tokenIndex = _allTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding // an 'if' statement (like in _removeTokenFromOwnerEnumeration) uint256 lastTokenId = _allTokens[lastTokenIndex]; _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index // This also deletes the contents at the last position of the array delete _allTokensIndex[tokenId]; _allTokens.pop(); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol) pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Enumerable is IERC721 { /** * @dev Returns the total amount of tokens stored by the contract. */ function totalSupply() external view returns (uint256); /** * @dev Returns a token ID owned by `owner` at a given `index` of its token list. * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSupply} to enumerate all tokens. */ function tokenByIndex(uint256 index) external view returns (uint256); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol) pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts 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 v4.4.1 (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/math/SafeMath.sol) pragma solidity ^0.8.0; // CAUTION // This version of SafeMath should only be used with Solidity 0.8 or later, // because it relies on the compiler's built in overflow checks. /** * @dev Wrappers over Solidity's arithmetic operations. * * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler * now has built in overflow checking. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { return a + b; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { return a * b; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b <= a, errorMessage); return a - b; } } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a / b; } } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a % b; } } }
//SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; import {IERC721Enumerable} from "@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol"; import {IERC20} from "../external/interfaces/IERC20.sol"; /// @title SSOV V3 interface interface ISsovV3 is IERC721Enumerable { struct Addresses { address feeStrategy; address stakingStrategy; address optionPricing; address priceOracle; address volatilityOracle; address feeDistributor; address optionsTokenImplementation; } struct VaultCheckpoint { uint256 premiumCollectedCumulative; uint256 activeCollateral; uint256 totalCollateral; uint256 activeCollateralRatio; uint256 premiumDistributionRatio; uint256[] rewardDistributionRatios; } struct EpochData { uint256 startTime; uint256 expiry; uint256 settlementPrice; uint256 totalCollateralBalance; uint256 collateralExchangeRate; uint256[] totalRewardsCollected; uint256[] rewardDistributionRatios; address[] rewardTokensToDistribute; uint256[] strikes; bool expired; } struct EpochStrikeData { address strikeToken; VaultCheckpoint lastVaultCheckpoint; uint256[] rewardsStoredForPremiums; uint256[] rewardsDistributionRatiosForPremiums; } function currentEpoch() external returns (uint256); function addresses() external returns (Addresses memory); function collateralToken() external returns (IERC20); function deposit( uint256 strikeIndex, uint256 amount, address user ) external returns (uint256 tokenId); function purchase( uint256 strikeIndex, uint256 amount, address user ) external returns (uint256 premium, uint256 totalFee); function settle( uint256 strikeIndex, uint256 amount, uint256 epoch ) external returns (uint256 pnl); function withdraw(uint256 tokenId, address to) external returns ( uint256 collateralTokenWithdrawAmount, uint256[] memory rewardTokenWithdrawAmounts ); function getUnderlyingPrice() external view returns (uint256); function getCollateralPrice() external view returns (uint256); function getVolatility(uint256 _strike) external view returns (uint256); function calculatePremium( uint256 _strike, uint256 _amount, uint256 _expiry ) external view returns (uint256 premium); function calculatePnl( uint256 price, uint256 strike, uint256 amount ) external view returns (uint256); function calculatePurchaseFees(uint256 strike, uint256 amount) external view returns (uint256); function calculateSettlementFees(uint256 pnl) external view returns (uint256); function getEpochTimes(uint256 epoch) external view returns (uint256 start, uint256 end); function getEpochStrikes(uint256 epoch) external view returns (uint256[] memory); function writePosition(uint256 tokenId) external view returns ( uint256 epoch, uint256 strike, uint256 collateralAmount, VaultCheckpoint memory vaultCheckpoint ); function getEpochData(uint256 epoch) external view returns (EpochData memory); function getEpochStrikeData(uint256 epoch, uint256 strike) external view returns (EpochStrikeData memory); }
//SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; // Libraries import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol"; import {SafeERC20} from "../external/libraries/SafeERC20.sol"; // Contracts import {ReentrancyGuard} from "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import {ERC721} from "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import {ERC721Enumerable} from "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import {ERC721Burnable} from "@openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol"; import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; import {Counters} from "@openzeppelin/contracts/utils/Counters.sol"; import {SsovV3State} from "./SsovV3State.sol"; import {SsovV3OptionsToken} from "../options-token/SsovV3OptionsToken.sol"; import {ContractWhitelist} from "../helpers/ContractWhitelist.sol"; import {Pausable} from "../helpers/Pausable.sol"; // Interfaces import {IERC20} from "../external/interfaces/IERC20.sol"; import {IOptionPricing} from "../interfaces/IOptionPricing.sol"; import {IFeeStrategy} from "../interfaces/IFeeStrategy.sol"; import {IStakingStrategy} from "../staking-strategies/IStakingStrategy.sol"; import {IPriceOracle} from "../interfaces/IPriceOracle.sol"; import {IVolatilityOracle} from "../interfaces/IVolatilityOracle.sol"; /// @title SSOV V3 contract /// @dev Option tokens are in erc20 18 decimals & Strikes are in 1e8 precision contract SsovV3 is ReentrancyGuard, Pausable, ERC721, ERC721Enumerable, ERC721Burnable, Ownable, ContractWhitelist, SsovV3State { using SafeERC20 for IERC20; using Counters for Counters.Counter; /// @dev Token ID counter for write positions Counters.Counter private _tokenIdCounter; /*==== CONSTRUCTOR ====*/ constructor( string memory _name, string memory _symbol, string memory _underlyingSymbol, address _collateralToken, bool _isPut ) ERC721(_name, _symbol) { if (_collateralToken == address(0)) revert E1(); underlyingSymbol = _underlyingSymbol; collateralToken = IERC20(_collateralToken); collateralPrecision = 10**collateralToken.decimals(); isPut = _isPut; } /*==== METHODS ====*/ /// @notice Pauses the vault for emergency cases /// @dev Can only be called by the owner function pause() external onlyOwner { _pause(); _updateFinalEpochBalances(); } /// @notice Unpauses the vault /// @dev Can only be called by the owner function unpause() external onlyOwner { _unpause(); } /// @notice Add a contract to the whitelist /// @dev Can only be called by the owner /// @param _contract Address of the contract that needs to be added to the whitelist function addToContractWhitelist(address _contract) external onlyOwner { _addToContractWhitelist(_contract); } /// @notice Remove a contract to the whitelist /// @dev Can only be called by the owner /// @param _contract Address of the contract that needs to be removed from the whitelist function removeFromContractWhitelist(address _contract) external onlyOwner { _removeFromContractWhitelist(_contract); } /// @notice Updates the delay tolerance for the expiry epoch function /// @dev Can only be called by the owner function updateExpireDelayTolerance(uint256 _expireDelayTolerance) external onlyOwner { expireDelayTolerance = _expireDelayTolerance; emit ExpireDelayToleranceUpdate(_expireDelayTolerance); } /// @notice Sets (adds) a list of addresses to the address list /// @dev Can only be called by the owner /// @param _addresses addresses of contracts in the Addresses struct function setAddresses(Addresses calldata _addresses) external onlyOwner { addresses = _addresses; emit AddressesSet(_addresses); } /// @notice Change the collateral token allowance to the StakingStrategy contract /// @dev Can only be called by the owner /// @param _increase bool /// @param _allowance uint256 function changeAllowanceForStakingStrategy( bool _increase, uint256 _allowance ) external onlyOwner { if (_increase) { collateralToken.safeIncreaseAllowance( addresses.stakingStrategy, _allowance ); } else { collateralToken.safeDecreaseAllowance( addresses.stakingStrategy, _allowance ); } } /// @notice Transfers all funds to msg.sender /// @dev Can only be called by the owner /// @param tokens The list of erc20 tokens to withdraw /// @param transferNative Whether should transfer the native currency function emergencyWithdraw(address[] calldata tokens, bool transferNative) external onlyOwner returns (bool) { _whenPaused(); if (transferNative) payable(msg.sender).transfer(address(this).balance); IERC20 token; for (uint256 i = 0; i < tokens.length; i++) { token = IERC20(tokens[i]); token.safeTransfer(msg.sender, token.balanceOf(address(this))); } emit EmergencyWithdraw(msg.sender); return true; } /// @dev Internal function to expire an epoch /// @param _settlementPrice the settlement price function _expire(uint256 _settlementPrice) private nonReentrant { _whenNotPaused(); _epochNotExpired(currentEpoch); epochData[currentEpoch].settlementPrice = _settlementPrice; _updateFinalEpochBalances(); epochData[currentEpoch].expired = true; emit EpochExpired(msg.sender, _settlementPrice); } /// @notice Sets the current epoch as expired function expire() external { _isEligibleSender(); (, uint256 epochExpiry) = getEpochTimes(currentEpoch); if (block.timestamp < epochExpiry) revert E4(); if (block.timestamp > epochExpiry + expireDelayTolerance) revert E13(); _expire(getUnderlyingPrice()); } /// @notice Sets the current epoch as expired /// @dev Can only be called by the owner /// @param _settlementPrice The settlement price function expire(uint256 _settlementPrice) external onlyOwner { _epochNotExpired(currentEpoch); _expire(_settlementPrice); } /// @dev Internal function to unstake collateral, gather yield and checkpoint each strike function _updateFinalEpochBalances() private { uint256[] memory strikes = getEpochStrikes(currentEpoch); uint256[] memory rewardTokenAmounts = IStakingStrategy( addresses.stakingStrategy ).unstake(); uint256[] memory rewardsDistributionRatios; for (uint256 i = 0; i < strikes.length; i++) { rewardsDistributionRatios = _updateRewards( strikes[i], rewardTokenAmounts, true ); _vaultCheckpoint( strikes[i], 0, 0, 0, 0, 0, rewardsDistributionRatios ); } } /// @notice Bootstraps a new epoch with new strikes /// @dev Can only be called by the owner /// @param strikes the strikes for the epoch /// @param expiry the expiry for the epoch /// @param expirySymbol the expiry symbol for the epoch function bootstrap( uint256[] memory strikes, uint256 expiry, string memory expirySymbol ) external nonReentrant onlyOwner { _whenNotPaused(); uint256 nextEpoch = currentEpoch + 1; if (epochData[nextEpoch].strikes.length > 0) revert E5(); if (block.timestamp > expiry) revert E2(); if (currentEpoch > 0 && !epochData[currentEpoch].expired) revert E6(); // Set the next epoch strikes epochData[nextEpoch].strikes = strikes; // Set the next epoch start time epochData[nextEpoch].startTime = block.timestamp; // Set the next epochs expiry epochData[nextEpoch].expiry = expiry; // Increase the current epoch currentEpoch = nextEpoch; uint256 rewardTokensLength = IStakingStrategy(addresses.stakingStrategy) .getRewardTokens() .length; uint256 strike; SsovV3OptionsToken _optionsToken; for (uint256 i = 0; i < strikes.length; i++) { strike = strikes[i]; // Create options tokens representing the option for selected strike in epoch _optionsToken = SsovV3OptionsToken( Clones.clone(addresses.optionsTokenImplementation) ); _optionsToken.initialize( address(this), isPut, strike, expiry, underlyingSymbol, collateralToken.symbol(), expirySymbol ); epochStrikeData[nextEpoch][strike].strikeToken = address( _optionsToken ); _vaultCheckpoint( strikes[i], 0, 0, 0, 0, 0, new uint256[](rewardTokensLength) ); epochStrikeData[nextEpoch][strike] .rewardsStoredForPremiums = new uint256[](rewardTokensLength); epochStrikeData[nextEpoch][strike] .rewardsDistributionRatiosForPremiums = new uint256[]( rewardTokensLength ); } epochData[nextEpoch].totalRewardsCollected = new uint256[]( rewardTokensLength ); epochData[nextEpoch].rewardDistributionRatios = new uint256[]( rewardTokensLength ); epochData[nextEpoch].rewardTokensToDistribute = IStakingStrategy( addresses.stakingStrategy ).getRewardTokens(); epochData[nextEpoch].collateralExchangeRate = (getUnderlyingPrice() * 1e8) / getCollateralPrice(); emit Bootstrap(nextEpoch, strikes); } /// @dev Internal function to checkpoint the vault /// @param strike the strike /// @param collateralAdded the collateral being added /// @param premiumAdded the premium being added /// @param collateralUsed the collateral being used /// @param premiumDistributionRatio the premiumDistributionRatio /// @param activeCollateralRatio the activeCollateralRatio /// @param rewardDistributionRatios the rewardsDistributionRatios function _vaultCheckpoint( uint256 strike, uint256 collateralAdded, uint256 premiumAdded, uint256 collateralUsed, uint256 premiumDistributionRatio, uint256 activeCollateralRatio, uint256[] memory rewardDistributionRatios ) private { VaultCheckpoint memory _newVaultCheckpoint = VaultCheckpoint({ premiumCollectedCumulative: epochStrikeData[currentEpoch][strike] .lastVaultCheckpoint .premiumCollectedCumulative + premiumAdded, activeCollateral: epochStrikeData[currentEpoch][strike] .lastVaultCheckpoint .activeCollateral + collateralUsed, totalCollateral: epochStrikeData[currentEpoch][strike] .lastVaultCheckpoint .totalCollateral + collateralAdded, activeCollateralRatio: epochStrikeData[currentEpoch][strike] .lastVaultCheckpoint .activeCollateralRatio + activeCollateralRatio, premiumDistributionRatio: epochStrikeData[currentEpoch][strike] .lastVaultCheckpoint .premiumDistributionRatio + premiumDistributionRatio, rewardDistributionRatios: rewardDistributionRatios }); epochStrikeData[currentEpoch][strike] .lastVaultCheckpoint = _newVaultCheckpoint; } /// @dev Internal function to mint a write position token /// @param to the address to mint the position to function _mintPositionToken(address to) private returns (uint256 tokenId) { tokenId = _tokenIdCounter.current(); _tokenIdCounter.increment(); _safeMint(to, tokenId); } /// @dev Calculates & updates the total rewards collected & the rewards distribution ratios /// @param strike the strike /// @param totalRewardsArray the totalRewardsArray /// @param isPurchase whether this was called on purchase function _updateRewards( uint256 strike, uint256[] memory totalRewardsArray, bool isPurchase ) private returns (uint256[] memory rewardsDistributionRatios) { rewardsDistributionRatios = new uint256[](totalRewardsArray.length); uint256 newRewardsCollected; for (uint256 i = 0; i < totalRewardsArray.length; i++) { // Calculate the new rewards accrued newRewardsCollected = totalRewardsArray[i] - epochData[currentEpoch].totalRewardsCollected[i]; // Update the new total rewards accrued epochData[currentEpoch].totalRewardsCollected[ i ] = totalRewardsArray[i]; // Calculate the reward distribution ratios for the new rewards accrued if (epochData[currentEpoch].totalCollateralBalance == 0) { rewardsDistributionRatios[i] = 0; } else { rewardsDistributionRatios[i] = (newRewardsCollected * 1e18) / epochData[currentEpoch].totalCollateralBalance; } // Add it to the current reward distribution ratios epochData[currentEpoch].rewardDistributionRatios[ i ] += rewardsDistributionRatios[i]; if (isPurchase) { // Add the new rewards accrued for the premiums staked until now epochStrikeData[currentEpoch][strike].rewardsStoredForPremiums[ i ] += ((epochData[currentEpoch].rewardDistributionRatios[i] - epochStrikeData[currentEpoch][strike] .rewardsDistributionRatiosForPremiums[i]) * epochStrikeData[currentEpoch][strike] .lastVaultCheckpoint .premiumCollectedCumulative) / 1e18; // Update the reward distribution ratios for the strike epochStrikeData[currentEpoch][strike] .rewardsDistributionRatiosForPremiums[i] = epochData[ currentEpoch ].rewardDistributionRatios[i]; } rewardsDistributionRatios[i] = epochData[currentEpoch] .rewardDistributionRatios[i]; } } /// @notice Deposit into the ssov to mint options in the next epoch for selected strikes /// @param strikeIndex Index of strike /// @param amount Amout of collateralToken to deposit /// @param user Address of the user to deposit for /// @return tokenId token id of the deposit token function deposit( uint256 strikeIndex, uint256 amount, address user ) public nonReentrant returns (uint256 tokenId) { uint256 epoch = currentEpoch; _whenNotPaused(); _isEligibleSender(); _epochNotExpired(epoch); _amountNotZero(amount); // Must be a valid strike uint256 strike = epochData[epoch].strikes[strikeIndex]; _strikeNotZero(strike); // Transfer collateralToken from msg.sender (maybe different from user param) to ssov collateralToken.safeTransferFrom(msg.sender, address(this), amount); // Stake the collateral into the staking strategy and calculates rewards uint256[] memory rewardsDistributionRatios = _updateRewards( strike, IStakingStrategy(addresses.stakingStrategy).stake(amount), false ); // Checkpoint the vault _vaultCheckpoint(strike, amount, 0, 0, 0, 0, rewardsDistributionRatios); // Update the total collateral balance epochData[currentEpoch].totalCollateralBalance += amount; // Mint a write position token to the user tokenId = _mintPositionToken(user); // Store the write position writePositions[tokenId] = WritePosition({ epoch: epoch, strike: strike, collateralAmount: amount, vaultCheckpoint: epochStrikeData[epoch][strike].lastVaultCheckpoint }); emit Deposit(tokenId, user, msg.sender); } /// @notice Purchases options for the current epoch /// @param strikeIndex Strike index for current epoch /// @param amount Amount of options to purchase /// @param user User to purchase options for function purchase( uint256 strikeIndex, uint256 amount, address user ) external nonReentrant returns (uint256 premium, uint256 totalFee) { _whenNotPaused(); _isEligibleSender(); _amountNotZero(amount); uint256 epoch = currentEpoch; // Check if expiry time is beyond block.timestamp (, uint256 epochExpiry) = getEpochTimes(epoch); if (block.timestamp >= epochExpiry) revert E3(); uint256 strike = epochData[epoch].strikes[strikeIndex]; _strikeNotZero(strike); // Check if vault has enough collateral to write the options uint256 availableCollateral = epochStrikeData[epoch][strike] .lastVaultCheckpoint .totalCollateral - epochStrikeData[epoch][strike].lastVaultCheckpoint.activeCollateral; uint256 requiredCollateral = isPut ? ((amount * strike * collateralPrecision) / getCollateralPrice()) / 1e18 : (amount * epochData[epoch].collateralExchangeRate * collateralPrecision) / (1e26); /* 1e8 is the precision for the collateralExchangeRate, 1e18 is the precision of the options token */ if (requiredCollateral > availableCollateral) revert E14(); // Get total premium for all options being purchased premium = calculatePremium(strike, amount, epochExpiry); // Total fee charged totalFee = calculatePurchaseFees(strike, amount); // premiumDistributionRatio in 1e18 precision uint256 premiumDistributionRatio = (premium * 1e18) / epochStrikeData[epoch][strike].lastVaultCheckpoint.totalCollateral; // activeCollateralRatio in 1e18 precision uint256 activeCollateralRatio = ((epochStrikeData[epoch][strike] .lastVaultCheckpoint .activeCollateral + requiredCollateral) * 1e18) / epochStrikeData[epoch][strike].lastVaultCheckpoint.totalCollateral; // Transfer premium from msg.sender (need not be same as user) collateralToken.safeTransferFrom( msg.sender, address(this), premium + totalFee ); // Stake premium into the staking strategy and calculates rewards uint256[] memory rewardsDistributionRatios = _updateRewards( strike, IStakingStrategy(addresses.stakingStrategy).stake(premium), true ); // Store a vault checkpoint _vaultCheckpoint( strike, 0, premium, requiredCollateral, premiumDistributionRatio, activeCollateralRatio, rewardsDistributionRatios ); // Update the totalCollateralBalance epochData[epoch].totalCollateralBalance += premium; // Transfer fee to FeeDistributor collateralToken.safeTransfer(addresses.feeDistributor, totalFee); // Mint option tokens for user SsovV3OptionsToken(epochStrikeData[epoch][strike].strikeToken).mint( user, amount ); emit Purchase( epoch, strike, amount, premium, totalFee, user, msg.sender ); } /// @notice Settle calculates the PnL for the user and withdraws the PnL in the BaseToken to the user. Will also the burn the option tokens from the user. /// @param strikeIndex Strike index /// @param amount Amount of options /// @return pnl function settle( uint256 strikeIndex, uint256 amount, uint256 epoch ) external nonReentrant returns (uint256 pnl) { _whenNotPaused(); _isEligibleSender(); _amountNotZero(amount); _epochExpired(epoch); uint256 strike = epochData[epoch].strikes[strikeIndex]; SsovV3OptionsToken strikeToken = SsovV3OptionsToken( epochStrikeData[epoch][strike].strikeToken ); if (strikeToken.balanceOf(msg.sender) < amount) { revert E11(); } // Burn option tokens from user strikeToken.burnFrom(msg.sender, amount); // Get the settlement price for the epoch uint256 settlementPrice = epochData[epoch].settlementPrice; // Calculate pnl pnl = calculatePnl(settlementPrice, strike, amount); // Total fee charged uint256 totalFee = calculateSettlementFees(pnl); if (pnl <= 0) { revert E10(); } // Transfer fee to FeeDistributor collateralToken.safeTransfer(addresses.feeDistributor, totalFee); // Transfer PnL to user collateralToken.safeTransfer(msg.sender, pnl - totalFee); emit Settle( epoch, strike, amount, pnl - totalFee, totalFee, msg.sender ); } /// @notice Withdraw from the ssov via burning a write position token /// @param tokenId token id of the write position /// @param to address to transfer collateral and rewards function withdraw(uint256 tokenId, address to) external nonReentrant returns ( uint256 collateralTokenWithdrawAmount, uint256[] memory rewardTokenWithdrawAmounts ) { _whenNotPaused(); _isEligibleSender(); ( uint256 epoch, uint256 strike, uint256 collateralAmount, VaultCheckpoint memory vaultCheckpoint ) = writePosition(tokenId); _strikeNotZero(strike); _epochExpired(epoch); // Burn the write position token burn(tokenId); // Get the options usage from the activeCollateralRatio uint256 optionsUsage = isPut ? ((epochStrikeData[epoch][strike] .lastVaultCheckpoint .activeCollateralRatio - vaultCheckpoint.activeCollateralRatio) * collateralAmount * getCollateralPrice() * 1e18) / (collateralPrecision * strike * 1e18) : ((epochStrikeData[epoch][strike] .lastVaultCheckpoint .activeCollateralRatio - vaultCheckpoint.activeCollateralRatio) * collateralAmount * epochData[epoch].collateralExchangeRate * 1e18) / (1e26 * collateralPrecision); // Rewards calculations rewardTokenWithdrawAmounts = new uint256[]( epochData[epoch].rewardTokensToDistribute.length ); uint256 premiumCollected = (collateralAmount * (epochStrikeData[epoch][strike] .lastVaultCheckpoint .premiumDistributionRatio - vaultCheckpoint.premiumDistributionRatio)) / 1e18; // Calculate the withdrawable collateral amount with premiums earned collateralTokenWithdrawAmount = collateralAmount - calculatePnl( epochData[epoch].settlementPrice, strike, optionsUsage ) + premiumCollected; // Calculate and transfer rewards for (uint256 i = 0; i < rewardTokenWithdrawAmounts.length; i++) { rewardTokenWithdrawAmounts[i] += ((epochData[epoch].rewardDistributionRatios[i] - vaultCheckpoint.rewardDistributionRatios[i]) * collateralAmount) / 1e18; if ( epochStrikeData[epoch][strike] .lastVaultCheckpoint .premiumCollectedCumulative > 0 ) rewardTokenWithdrawAmounts[i] += (premiumCollected * epochStrikeData[epoch][strike].rewardsStoredForPremiums[ i ]) / epochStrikeData[epoch][strike] .lastVaultCheckpoint .premiumCollectedCumulative; IERC20(epochData[epoch].rewardTokensToDistribute[i]).safeTransfer( to, rewardTokenWithdrawAmounts[i] ); } // Transfer the collateralTokenWithdrawAmount to the user collateralToken.safeTransfer(to, collateralTokenWithdrawAmount); emit Withdraw( tokenId, collateralTokenWithdrawAmount, rewardTokenWithdrawAmounts, to, msg.sender ); } /*==== VIEWS ====*/ /// @notice Returns the price of the underlying in USD in 1e8 precision function getUnderlyingPrice() public view returns (uint256) { return IPriceOracle(addresses.priceOracle).getUnderlyingPrice(); } /// @notice Returns the price of the collateral token in 1e8 precision /// @dev This contract assumes that this price can never decrease in ratio of the underlying price function getCollateralPrice() public view returns (uint256) { return IPriceOracle(addresses.priceOracle).getCollateralPrice(); } /// @notice Returns the volatility from the volatility oracle /// @param _strike Strike of the option function getVolatility(uint256 _strike) public view returns (uint256) { return IVolatilityOracle(addresses.volatilityOracle).getVolatility( _strike ); } /// @notice Calculate premium for an option /// @param _strike Strike price of the option /// @param _amount Amount of options (1e18 precision) /// @param _expiry Expiry of the option /// @return premium in collateralToken in collateral precision function calculatePremium( uint256 _strike, uint256 _amount, uint256 _expiry ) public view returns (uint256 premium) { premium = (IOptionPricing(addresses.optionPricing).getOptionPrice( isPut, _expiry, _strike, getUnderlyingPrice(), getVolatility(_strike) ) * _amount); premium = (premium * collateralPrecision) / getCollateralPrice() / 1e18; } /// @notice Calculate Pnl /// @param price price of the underlying asset /// @param strike strike price of the option /// @param amount amount of options function calculatePnl( uint256 price, uint256 strike, uint256 amount ) public view returns (uint256) { if (isPut) return strike > price ? (((strike - price) * amount * collateralPrecision) / getCollateralPrice()) / 1e18 : 0; return price > strike ? (((price - strike) * amount * collateralPrecision) / getCollateralPrice()) / 1e18 : 0; } /// @notice Calculate fees for purchase /// @param strike strike price of the BaseToken option /// @param amount amount of options being bought function calculatePurchaseFees(uint256 strike, uint256 amount) public view returns (uint256) { return ((IFeeStrategy(addresses.feeStrategy).calculatePurchaseFees( getUnderlyingPrice(), strike, amount ) * collateralPrecision) / getCollateralPrice()); } /// @notice Calculate fees for settlement of options /// @param pnl total pnl function calculateSettlementFees(uint256 pnl) public view returns (uint256) { return IFeeStrategy(addresses.feeStrategy).calculateSettlementFees(pnl); } /// @notice Returns start and end times for an epoch /// @param epoch Target epoch function getEpochTimes(uint256 epoch) public view returns (uint256 start, uint256 end) { _epochGreaterThanZero(epoch); return (epochData[epoch].startTime, epochData[epoch].expiry); } /// @notice Returns the array of strikes in an epoch /// @param epoch the epoch for which the array of strikes need to be returned for function getEpochStrikes(uint256 epoch) public view returns (uint256[] memory) { _epochGreaterThanZero(epoch); return epochData[epoch].strikes; } /// @notice View a write position /// @param tokenId tokenId a parameter just like in doxygen (must be followed by parameter name) function writePosition(uint256 tokenId) public view returns ( uint256 epoch, uint256 strike, uint256 collateralAmount, VaultCheckpoint memory vaultCheckpoint ) { WritePosition memory _writePosition = writePositions[tokenId]; return ( _writePosition.epoch, _writePosition.strike, _writePosition.collateralAmount, _writePosition.vaultCheckpoint ); } /// @notice Returns the data for an epoch /// @param epoch the epoch function getEpochData(uint256 epoch) external view returns (EpochData memory) { _epochGreaterThanZero(epoch); return epochData[epoch]; } /// @notice Returns the data for an epoch and strike /// @param epoch the epoch /// @param strike the strike function getEpochStrikeData(uint256 epoch, uint256 strike) external view returns (EpochStrikeData memory) { _epochGreaterThanZero(epoch); return epochStrikeData[epoch][strike]; } /*==== PRIVATE FUCNTIONS FOR REVERTS ====*/ /// @dev Internal function to check if the epoch passed is greater than 0. Revert if 0. /// @param _epoch the epoch function _epochGreaterThanZero(uint256 _epoch) private pure { if (_epoch <= 0) revert E9(); } /// @dev Internal function to check if the epoch passed is not expired. Revert if expired. /// @param _epoch the epoch function _epochNotExpired(uint256 _epoch) private view { if (epochData[_epoch].expired) revert E3(); } /// @dev Internal function to check if the epoch passed is expired. Revert if not expired. /// @param _epoch the epoch function _epochExpired(uint256 _epoch) private view { if (!epochData[_epoch].expired) revert E12(); } /// @dev Internal function to check if the amount passed is not 0. Revert if 0. /// @param _amount the amount function _amountNotZero(uint256 _amount) private pure { if (_amount <= 0) revert E7(); } /// @dev Internal function to check if the strike passed is not 0. Revert if 0. /// @param _strike the strike function _strikeNotZero(uint256 _strike) private pure { if (_strike <= 0) revert E8(); } /*==== ERRORS ====*/ /// @notice Address cannot be a zero address error E1(); /// @notice Expiry passed must be after current block.timestamp error E2(); /// @notice Epoch must not be expired error E3(); /// @notice Cannot expire epoch before epoch's expiry error E4(); /// @notice Already bootstrapped error E5(); /// @notice Cannot bootstrap before current epoch's expiry error E6(); /// @notice Amount must not be 0 error E7(); /// @notice Strike must not be 0 error E8(); /// @notice Epoch must be greater than 0 error E9(); /// @notice Pnl must be greater than 0 error E10(); /// @notice Option token balance is not enough error E11(); /// @notice Epoch must be expired error E12(); /// @notice Expire delay tolerance exceeded error E13(); /// @notice Available collateral must be greater than or equal to required collateral error E14(); // The following functions are overrides required by Solidity. function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal override(ERC721, ERC721Enumerable) { _whenNotPaused(); super._beforeTokenTransfer(from, to, tokenId); } function supportsInterface(bytes4 interfaceId) public view override(ERC721, ERC721Enumerable) returns (bool) { return super.supportsInterface(interfaceId); } }
//SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; import {IERC20} from "../external/interfaces/IERC20.sol"; contract SsovV3State { /// @dev Underlying assets symbol string public underlyingSymbol; /// @notice Whether this is a Put or Call SSOV bool public isPut; /// @dev Contract addresses Addresses public addresses; /// @dev Collateral Token IERC20 public collateralToken; /// @dev Current epoch for ssov uint256 public currentEpoch; /// @dev Expire delay tolerance uint256 public expireDelayTolerance = 5 minutes; /// @dev The precision of the collateral token uint256 public collateralPrecision; /// @dev epoch => EpochData mapping(uint256 => EpochData) public epochData; /// @dev Mapping of (epoch => (strike => EpochStrikeData)) mapping(uint256 => mapping(uint256 => EpochStrikeData)) public epochStrikeData; /// @dev tokenId => WritePosition mapping(uint256 => WritePosition) internal writePositions; /*==== STRUCTS ====*/ struct Addresses { address feeStrategy; address stakingStrategy; address optionPricing; address priceOracle; address volatilityOracle; address feeDistributor; address optionsTokenImplementation; } struct EpochData { uint256 startTime; uint256 expiry; uint256 settlementPrice; uint256 totalCollateralBalance; // Premium + Deposits from all strikes uint256 collateralExchangeRate; // Exchange rate for collateral to underlying uint256[] totalRewardsCollected; uint256[] rewardDistributionRatios; address[] rewardTokensToDistribute; uint256[] strikes; bool expired; } struct EpochStrikeData { /// Address of the strike token address strikeToken; /// Last checkpoint for the vault for an epoch for a strike VaultCheckpoint lastVaultCheckpoint; uint256[] rewardsStoredForPremiums; uint256[] rewardsDistributionRatiosForPremiums; } struct VaultCheckpoint { uint256 premiumCollectedCumulative; uint256 activeCollateral; uint256 totalCollateral; uint256 activeCollateralRatio; uint256 premiumDistributionRatio; uint256[] rewardDistributionRatios; } struct WritePosition { uint256 epoch; uint256 strike; uint256 collateralAmount; VaultCheckpoint vaultCheckpoint; } /*==== ERRORS ====*/ event ExpireDelayToleranceUpdate(uint256 expireDelayTolerance); event AddressesSet(Addresses addresses); event EmergencyWithdraw(address sender); event EpochExpired(address sender, uint256 settlementPrice); event Bootstrap(uint256 epoch, uint256[] strikes); event Deposit(uint256 tokenId, address user, address sender); event Purchase( uint256 epoch, uint256 strike, uint256 amount, uint256 premium, uint256 fee, address indexed user, address sender ); event Settle( uint256 epoch, uint256 strike, uint256 amount, uint256 pnl, // pnl transfered to the user uint256 fee, // fee sent to fee distributor address indexed user ); event Withdraw( uint256 tokenId, uint256 collateralTokenWithdrawn, uint256[] rewardTokenWithdrawAmounts, address indexed to, address sender ); }
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. * NOTE: Modified to include symbols and decimals. */ interface IERC20 { function totalSupply() external view returns (uint256); function symbol() external view returns (string memory); function decimals() external view returns (uint8); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import {IERC20} from "../interfaces/IERC20.sol"; import {SafeMath} from "@openzeppelin/contracts/utils/math/SafeMath.sol"; import {Address} from "@openzeppelin/contracts/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 SafeMath for uint256; using Address for address; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn( token, abi.encodeWithSelector(token.transfer.selector, to, value) ); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn( token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value) ); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20 token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' // solhint-disable-next-line max-line-length require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn( token, abi.encodeWithSelector(token.approve.selector, spender, value) ); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender).add( value ); _callOptionalReturn( token, abi.encodeWithSelector( token.approve.selector, spender, newAllowance ) ); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender).sub( value, "SafeERC20: decreased allowance below zero" ); _callOptionalReturn( token, abi.encodeWithSelector( token.approve.selector, spender, newAllowance ) ); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall( data, "SafeERC20: low-level call failed" ); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require( abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed" ); } } }
//SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; /// @title ContractWhitelist /// @author witherblock /// @notice A helper contract that lets you add a list of whitelisted contracts that should be able to interact with restricited functions abstract contract ContractWhitelist { /// @dev contract => whitelisted or not mapping(address => bool) public whitelistedContracts; /*==== SETTERS ====*/ /// @dev add to the contract whitelist /// @param _contract the address of the contract to add to the contract whitelist function _addToContractWhitelist(address _contract) internal { require(isContract(_contract), "Address must be a contract"); require( !whitelistedContracts[_contract], "Contract already whitelisted" ); whitelistedContracts[_contract] = true; emit AddToContractWhitelist(_contract); } /// @dev remove from the contract whitelist /// @param _contract the address of the contract to remove from the contract whitelist function _removeFromContractWhitelist(address _contract) internal { require(whitelistedContracts[_contract], "Contract not whitelisted"); whitelistedContracts[_contract] = false; emit RemoveFromContractWhitelist(_contract); } // modifier is eligible sender modifier function _isEligibleSender() internal view { // the below condition checks whether the caller is a contract or not if (msg.sender != tx.origin) require( whitelistedContracts[msg.sender], "Contract must be whitelisted" ); } /*==== VIEWS ====*/ /// @dev checks for contract or eoa addresses /// @param addr the address to check /// @return bool whether the passed address is a contract address function isContract(address addr) public view returns (bool) { uint256 size; assembly { size := extcodesize(addr) } return size > 0; } /*==== EVENTS ====*/ event AddToContractWhitelist(address indexed _contract); event RemoveFromContractWhitelist(address indexed _contract); }
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; /// @title Lighter version of the Openzeppelin Pausable contract /// @author witherblock /// @notice Helps pause a contract to block the execution of selected functions /// @dev Difference from the Openzeppelin version is changing the modifiers to internal fns and requires to reverts abstract contract Pausable { /** * @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 Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Internal function to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ function _whenNotPaused() internal view { if (paused()) revert ContractPaused(); } /** * @dev Internal function to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ function _whenPaused() internal view { if (!paused()) revert ContractNotPaused(); } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual { _whenNotPaused(); _paused = true; emit Paused(msg.sender); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual { _whenPaused(); _paused = false; emit Unpaused(msg.sender); } error ContractPaused(); error ContractNotPaused(); }
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; interface IFeeStrategy { function calculatePurchaseFees( uint256, uint256, uint256 ) external view returns (uint256); function calculateSettlementFees(uint256) external view returns (uint256); }
//SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; interface IOptionPricing { function getOptionPrice( bool isPut, uint256 expiry, uint256 strike, uint256 lastPrice, uint256 baseIv ) external view returns (uint256); }
//SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; interface IPriceOracle { function getCollateralPrice() external view returns (uint256); function getUnderlyingPrice() external view returns (uint256); }
//SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; interface IVolatilityOracle { function getVolatility(uint256) external view returns (uint256); }
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; // Contracts import {ERC20PresetMinterPauserUpgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC20/presets/ERC20PresetMinterPauserUpgradeable.sol"; // Interfaces import {ISsovV3} from "../core/ISsovV3.sol"; // Libraries import {Strings} from "@openzeppelin/contracts/utils/Strings.sol"; /** * @title Dopex SSOV V3 ERC20 Options Token */ contract SsovV3OptionsToken is ERC20PresetMinterPauserUpgradeable { using Strings for uint256; /// @dev Is this a PUT or CALL options contract bool public isPut; /// @dev The strike of the options contract uint256 public strike; /// @dev The time of expiry of the options contract uint256 public expiry; /// @dev The address of the ssov creating the options contract address public ssov; /// @dev The symbol reperesenting the underlying asset of the option string public underlyingSymbol; /// @dev The symbol representing the collateral token of the option string public collateralSymbol; /*==== INITIALIZE FUNCTION ====*/ /** * @notice Initialize function, equivalent of a constructor for upgradeable contracts * @param _ssov The address of the ssov creating the options contract * @param _isPut Whether the options is a put option * @param _strike The amount of strike asset that will be paid out per doToken * @param _expiry The time at which the insurance expires * @param _underlyingSymbol The symbol of the underlying asset token * @param _collateralSymbol The symbol of the collateral token * @param _expirySymbol The symbol representing the expiry */ function initialize( address _ssov, bool _isPut, uint256 _strike, uint256 _expiry, string memory _underlyingSymbol, string memory _collateralSymbol, string memory _expirySymbol ) public { require(block.timestamp < _expiry, "Can't deploy an expired contract"); ssov = _ssov; underlyingSymbol = _underlyingSymbol; collateralSymbol = _collateralSymbol; isPut = _isPut; strike = _strike; expiry = _expiry; string memory symbol = concatenate(_underlyingSymbol, "-"); symbol = concatenate(symbol, _expirySymbol); symbol = concatenate(symbol, "-"); symbol = concatenate(symbol, (strike / 1e8).toString()); symbol = concatenate(symbol, isPut ? "-P" : "-C"); super.initialize("Dopex SSOV V3 Options Token", symbol); } /*==== VIEWS ====*/ /** * @notice Returns true if the doToken contract has expired */ function hasExpired() external view returns (bool) { return (block.timestamp >= expiry); } /** * @notice Returns the current value of an option */ function optionValue() external view returns (uint256) { return ISsovV3(ssov).calculatePremium(strike, 1e18, expiry); } /*==== PURE FUNCTIONS ====*/ /** * @notice Returns a concatenated string of a and b * @param _a string a * @param _b string b */ function concatenate(string memory _a, string memory _b) internal pure returns (string memory) { return string(abi.encodePacked(_a, _b)); } }
//SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; interface IStakingStrategy { function stake(uint256) external returns (uint256[] memory); function unstake() external returns (uint256[] memory); function getRewardTokens() external view returns (address[] memory); event Stake( address sender, uint256 amountStaked, uint256 totalStakedBalance, uint256[] totalRewardsArray ); event Unstake( address sender, uint256 amountUnstaked, uint256[] rewardTokenAmounts ); }
//SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; // Contracts import {SsovV3} from "../core/SsovV3.sol"; /// @title rDPX Weekly Puts SSOV V3 contract contract RdpxWeeklyPutsSsovV3 is SsovV3 { constructor() SsovV3( "rDPX WEEKLY PUTS SSOV V3", "rDPX-WEEKLY-PUTS-SSOV-V3", "rDPX", 0x7f90122BF0700F9E7e1F688fe926940E8839F353, true ) {} }
{ "evmVersion": "london", "libraries": {}, "metadata": { "bytecodeHash": "ipfs", "useLiteralContent": true }, "optimizer": { "enabled": true, "runs": 200 }, "remappings": [], "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ContractNotPaused","type":"error"},{"inputs":[],"name":"ContractPaused","type":"error"},{"inputs":[],"name":"E1","type":"error"},{"inputs":[],"name":"E10","type":"error"},{"inputs":[],"name":"E11","type":"error"},{"inputs":[],"name":"E12","type":"error"},{"inputs":[],"name":"E13","type":"error"},{"inputs":[],"name":"E14","type":"error"},{"inputs":[],"name":"E2","type":"error"},{"inputs":[],"name":"E3","type":"error"},{"inputs":[],"name":"E4","type":"error"},{"inputs":[],"name":"E5","type":"error"},{"inputs":[],"name":"E6","type":"error"},{"inputs":[],"name":"E7","type":"error"},{"inputs":[],"name":"E8","type":"error"},{"inputs":[],"name":"E9","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_contract","type":"address"}],"name":"AddToContractWhitelist","type":"event"},{"anonymous":false,"inputs":[{"components":[{"internalType":"address","name":"feeStrategy","type":"address"},{"internalType":"address","name":"stakingStrategy","type":"address"},{"internalType":"address","name":"optionPricing","type":"address"},{"internalType":"address","name":"priceOracle","type":"address"},{"internalType":"address","name":"volatilityOracle","type":"address"},{"internalType":"address","name":"feeDistributor","type":"address"},{"internalType":"address","name":"optionsTokenImplementation","type":"address"}],"indexed":false,"internalType":"struct SsovV3State.Addresses","name":"addresses","type":"tuple"}],"name":"AddressesSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"epoch","type":"uint256"},{"indexed":false,"internalType":"uint256[]","name":"strikes","type":"uint256[]"}],"name":"Bootstrap","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"address","name":"sender","type":"address"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"sender","type":"address"}],"name":"EmergencyWithdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"settlementPrice","type":"uint256"}],"name":"EpochExpired","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"expireDelayTolerance","type":"uint256"}],"name":"ExpireDelayToleranceUpdate","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"epoch","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"strike","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"premium","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"fee","type":"uint256"},{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"address","name":"sender","type":"address"}],"name":"Purchase","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_contract","type":"address"}],"name":"RemoveFromContractWhitelist","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"epoch","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"strike","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"pnl","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"fee","type":"uint256"},{"indexed":true,"internalType":"address","name":"user","type":"address"}],"name":"Settle","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"collateralTokenWithdrawn","type":"uint256"},{"indexed":false,"internalType":"uint256[]","name":"rewardTokenWithdrawAmounts","type":"uint256[]"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"address","name":"sender","type":"address"}],"name":"Withdraw","type":"event"},{"inputs":[{"internalType":"address","name":"_contract","type":"address"}],"name":"addToContractWhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"addresses","outputs":[{"internalType":"address","name":"feeStrategy","type":"address"},{"internalType":"address","name":"stakingStrategy","type":"address"},{"internalType":"address","name":"optionPricing","type":"address"},{"internalType":"address","name":"priceOracle","type":"address"},{"internalType":"address","name":"volatilityOracle","type":"address"},{"internalType":"address","name":"feeDistributor","type":"address"},{"internalType":"address","name":"optionsTokenImplementation","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"strikes","type":"uint256[]"},{"internalType":"uint256","name":"expiry","type":"uint256"},{"internalType":"string","name":"expirySymbol","type":"string"}],"name":"bootstrap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"strike","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"calculatePnl","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_strike","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_expiry","type":"uint256"}],"name":"calculatePremium","outputs":[{"internalType":"uint256","name":"premium","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"strike","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"calculatePurchaseFees","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"pnl","type":"uint256"}],"name":"calculateSettlementFees","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"_increase","type":"bool"},{"internalType":"uint256","name":"_allowance","type":"uint256"}],"name":"changeAllowanceForStakingStrategy","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"collateralPrecision","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"collateralToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"currentEpoch","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"strikeIndex","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"user","type":"address"}],"name":"deposit","outputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"tokens","type":"address[]"},{"internalType":"bool","name":"transferNative","type":"bool"}],"name":"emergencyWithdraw","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"epochData","outputs":[{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"expiry","type":"uint256"},{"internalType":"uint256","name":"settlementPrice","type":"uint256"},{"internalType":"uint256","name":"totalCollateralBalance","type":"uint256"},{"internalType":"uint256","name":"collateralExchangeRate","type":"uint256"},{"internalType":"bool","name":"expired","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"epochStrikeData","outputs":[{"internalType":"address","name":"strikeToken","type":"address"},{"components":[{"internalType":"uint256","name":"premiumCollectedCumulative","type":"uint256"},{"internalType":"uint256","name":"activeCollateral","type":"uint256"},{"internalType":"uint256","name":"totalCollateral","type":"uint256"},{"internalType":"uint256","name":"activeCollateralRatio","type":"uint256"},{"internalType":"uint256","name":"premiumDistributionRatio","type":"uint256"},{"internalType":"uint256[]","name":"rewardDistributionRatios","type":"uint256[]"}],"internalType":"struct SsovV3State.VaultCheckpoint","name":"lastVaultCheckpoint","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"expire","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_settlementPrice","type":"uint256"}],"name":"expire","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"expireDelayTolerance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCollateralPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"epoch","type":"uint256"}],"name":"getEpochData","outputs":[{"components":[{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"expiry","type":"uint256"},{"internalType":"uint256","name":"settlementPrice","type":"uint256"},{"internalType":"uint256","name":"totalCollateralBalance","type":"uint256"},{"internalType":"uint256","name":"collateralExchangeRate","type":"uint256"},{"internalType":"uint256[]","name":"totalRewardsCollected","type":"uint256[]"},{"internalType":"uint256[]","name":"rewardDistributionRatios","type":"uint256[]"},{"internalType":"address[]","name":"rewardTokensToDistribute","type":"address[]"},{"internalType":"uint256[]","name":"strikes","type":"uint256[]"},{"internalType":"bool","name":"expired","type":"bool"}],"internalType":"struct SsovV3State.EpochData","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"epoch","type":"uint256"},{"internalType":"uint256","name":"strike","type":"uint256"}],"name":"getEpochStrikeData","outputs":[{"components":[{"internalType":"address","name":"strikeToken","type":"address"},{"components":[{"internalType":"uint256","name":"premiumCollectedCumulative","type":"uint256"},{"internalType":"uint256","name":"activeCollateral","type":"uint256"},{"internalType":"uint256","name":"totalCollateral","type":"uint256"},{"internalType":"uint256","name":"activeCollateralRatio","type":"uint256"},{"internalType":"uint256","name":"premiumDistributionRatio","type":"uint256"},{"internalType":"uint256[]","name":"rewardDistributionRatios","type":"uint256[]"}],"internalType":"struct SsovV3State.VaultCheckpoint","name":"lastVaultCheckpoint","type":"tuple"},{"internalType":"uint256[]","name":"rewardsStoredForPremiums","type":"uint256[]"},{"internalType":"uint256[]","name":"rewardsDistributionRatiosForPremiums","type":"uint256[]"}],"internalType":"struct SsovV3State.EpochStrikeData","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"epoch","type":"uint256"}],"name":"getEpochStrikes","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"epoch","type":"uint256"}],"name":"getEpochTimes","outputs":[{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"end","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getUnderlyingPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_strike","type":"uint256"}],"name":"getVolatility","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"isContract","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isPut","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","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":"uint256","name":"strikeIndex","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"user","type":"address"}],"name":"purchase","outputs":[{"internalType":"uint256","name":"premium","type":"uint256"},{"internalType":"uint256","name":"totalFee","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_contract","type":"address"}],"name":"removeFromContractWhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"feeStrategy","type":"address"},{"internalType":"address","name":"stakingStrategy","type":"address"},{"internalType":"address","name":"optionPricing","type":"address"},{"internalType":"address","name":"priceOracle","type":"address"},{"internalType":"address","name":"volatilityOracle","type":"address"},{"internalType":"address","name":"feeDistributor","type":"address"},{"internalType":"address","name":"optionsTokenImplementation","type":"address"}],"internalType":"struct SsovV3State.Addresses","name":"_addresses","type":"tuple"}],"name":"setAddresses","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"strikeIndex","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"epoch","type":"uint256"}],"name":"settle","outputs":[{"internalType":"uint256","name":"pnl","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","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":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"underlyingSymbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_expireDelayTolerance","type":"uint256"}],"name":"updateExpireDelayTolerance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"whitelistedContracts","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"to","type":"address"}],"name":"withdraw","outputs":[{"internalType":"uint256","name":"collateralTokenWithdrawAmount","type":"uint256"},{"internalType":"uint256[]","name":"rewardTokenWithdrawAmounts","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"writePosition","outputs":[{"internalType":"uint256","name":"epoch","type":"uint256"},{"internalType":"uint256","name":"strike","type":"uint256"},{"internalType":"uint256","name":"collateralAmount","type":"uint256"},{"components":[{"internalType":"uint256","name":"premiumCollectedCumulative","type":"uint256"},{"internalType":"uint256","name":"activeCollateral","type":"uint256"},{"internalType":"uint256","name":"totalCollateral","type":"uint256"},{"internalType":"uint256","name":"activeCollateralRatio","type":"uint256"},{"internalType":"uint256","name":"premiumDistributionRatio","type":"uint256"},{"internalType":"uint256[]","name":"rewardDistributionRatios","type":"uint256[]"}],"internalType":"struct SsovV3State.VaultCheckpoint","name":"vaultCheckpoint","type":"tuple"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
608060405261012c6019553480156200001757600080fd5b5060408051808201825260188082527f72445058205745454b4c5920505554532053534f5620563300000000000000006020808401918252845180860186529283527f724450582d5745454b4c592d505554532d53534f562d5633000000000000000083820152845180860190955260048552630e488a0b60e31b9085015260016000819055805460ff19168155835193949293737f90122bf0700f9e7e1f688fe926940e8839f3539286918691620000d4916002919062000257565b508051620000ea90600390602084019062000257565b50505062000107620001016200020160201b60201c565b62000205565b6001600160a01b0382166200012f5760405163440a57bf60e01b815260040160405180910390fd5b82516200014490600e90602086019062000257565b50601780546001600160a01b0319166001600160a01b0384169081179091556040805163313ce56760e01b8152905163313ce56791600480820192602092909190829003018186803b1580156200019a57600080fd5b505afa158015620001af573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001d59190620002fd565b620001e290600a6200043e565b601a55600f805460ff1916911515919091179055506200048c92505050565b3390565b600c80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b82805462000265906200044f565b90600052602060002090601f016020900481019282620002895760008555620002d4565b82601f10620002a457805160ff1916838001178555620002d4565b82800160010185558215620002d4579182015b82811115620002d4578251825591602001919060010190620002b7565b50620002e2929150620002e6565b5090565b5b80821115620002e25760008155600101620002e7565b6000602082840312156200031057600080fd5b815160ff811681146200032257600080fd5b9392505050565b634e487b7160e01b600052601160045260246000fd5b600181815b808511156200038057816000190482111562000364576200036462000329565b808516156200037257918102915b93841c939080029062000344565b509250929050565b600082620003995750600162000438565b81620003a85750600062000438565b8160018114620003c15760028114620003cc57620003ec565b600191505062000438565b60ff841115620003e057620003e062000329565b50506001821b62000438565b5060208310610133831016604e8410600b841016171562000411575081810a62000438565b6200041d83836200033f565b806000190482111562000434576200043462000329565b0290505b92915050565b60006200032260ff84168362000388565b600181811c908216806200046457607f821691505b602082108114156200048657634e487b7160e01b600052602260045260246000fd5b50919050565b61609c806200049c6000396000f3fe608060405234801561001057600080fd5b50600436106103985760003560e01c806376671808116101e9578063b375d4921161010f578063d8202b8b116100ad578063ea3bd5df1161007c578063ea3bd5df146108e7578063f2fde38b146108fa578063f3c274a61461090d578063f7683bbc1461091a57600080fd5b8063d8202b8b1461080f578063d90a730e14610822578063da0321cd1461082a578063e985e9c5146108ab57600080fd5b8063c189c19b116100e9578063c189c19b146107c3578063c3d9ed39146107d6578063c48ce05b146107e9578063c87b56dd146107fc57600080fd5b8063b375d4921461078a578063b88d4fde1461079d578063bf81bf43146107b057600080fd5b80638dbdbe6d11610187578063a624ec6311610156578063a624ec631461072e578063ab2150cf14610751578063acc3a00614610764578063b2016bd41461077757600080fd5b80638dbdbe6d146106ed578063920023de1461070057806395d89b4114610713578063a22cb4651461071b57600080fd5b80638456cb59116101c35780638456cb59146106a1578063859e7d32146106a957806388e18e13146106c95780638da5cb5b146106dc57600080fd5b8063766718081461067d57806379599f96146106865780637c4b52cb1461068e57600080fd5b806342966c68116102ce578063616443731161026c5780636f56f56f1161023b5780636f56f56f1461062757806370a082311461064f578063715018a614610662578063751eb65c1461066a57600080fd5b806361644373146105765780636352211e1461057f57806369e3b748146105925780636e821b2e146105b257600080fd5b80634f6ccce7116102a85780634f6ccce714610524578063574cdded146105375780635871dc951461054a5780635c975abb1461056b57600080fd5b806342966c6814610500578063430aea2e14610513578063468f02d21461051c57600080fd5b8063162790551161033b5780632f745c59116103155780632f745c59146104af578063391feebb146104c25780633f4ba83a146104e557806342842e0e146104ed57600080fd5b8063162790551461048057806318160ddd1461049457806323b872dd1461049c57600080fd5b8063081812fc11610377578063081812fc146103ff578063095ea7b31461042a578063156f1d741461043f57806315943b991461046057600080fd5b8062f714ce1461039d57806301ffc9a7146103c757806306fdde03146103ea575b600080fd5b6103b06103ab366004615144565b610922565b6040516103be9291906151af565b60405180910390f35b6103da6103d53660046151de565b610dc4565b60405190151581526020016103be565b6103f2610dd5565b6040516103be9190615253565b61041261040d366004615266565b610e67565b6040516001600160a01b0390911681526020016103be565b61043d61043836600461527f565b610efc565b005b61045261044d3660046152ab565b611012565b6040519081526020016103be565b61047361046e366004615266565b611114565b6040516103be91906152d7565b6103da61048e3660046152ea565b3b151590565b600a54610452565b61043d6104aa366004615307565b611182565b6104526104bd36600461527f565b6111b4565b6103da6104d03660046152ea565b600d6020526000908152604090205460ff1681565b61043d61124a565b61043d6104fb366004615307565b61127e565b61043d61050e366004615266565b611299565b610452601a5481565b610452611313565b610452610532366004615266565b611395565b6104526105453660046152ab565b611428565b61055d610558366004615348565b6116ae565b6040516103be9291906153b1565b60015460ff166103da565b61045260195481565b61041261058d366004615266565b61176a565b6105a56105a0366004615348565b6117e1565b6040516103be91906153d5565b6105f86105c0366004615266565b601b60205260009081526040902080546001820154600283015460038401546004850154600990950154939492939192909160ff1686565b6040805196875260208701959095529385019290925260608401526080830152151560a082015260c0016103be565b61063a610635366004615266565b611974565b604080519283526020830191909152016103be565b61045261065d3660046152ea565b61199c565b61043d611a23565b61043d610678366004615536565b611a57565b61045260185481565b61043d612107565b6103da61069c366004615605565b61217d565b61043d6122fd565b6106bc6106b7366004615266565b612337565b6040516103be91906156c3565b6104526106d73660046152ab565b61255e565b600c546001600160a01b0316610412565b6104526106fb366004615791565b612609565b61045261070e366004615348565b61293c565b6103f26129f3565b61043d6107293660046157bf565b612a02565b61074161073c366004615266565b612a11565b6040516103be94939291906157ed565b61043d61075f366004615266565b612b4d565b61043d6107723660046152ea565b612bb3565b601754610412906001600160a01b031681565b61043d61079836600461581c565b612be6565b61043d6107ab366004615834565b612c4f565b61043d6107be366004615266565b612c87565b6104526107d1366004615266565b612cc5565b61043d6107e43660046152ea565b612d43565b6104526107f7366004615266565b612d76565b6103f261080a366004615266565b612da8565b61043d61081d3660046158b3565b612e8f565b6103f2612ef9565b601054601154601254601354601454601554601654610862966001600160a01b03908116968116958116948116938116928116911687565b604080516001600160a01b039889168152968816602088015294871694860194909452918516606085015284166080840152831660a083015290911660c082015260e0016103be565b6103da6108b93660046158d1565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b61063a6108f5366004615791565b612f87565b61043d6109083660046152ea565b6133bc565b600f546103da9060ff1681565b610452613454565b60006060600260005414156109525760405162461bcd60e51b8152600401610949906158ff565b60405180910390fd5b600260005561095f613499565b6109676134bd565b60008060008061097688612a11565b935093509350935061098783613523565b61099084613544565b61099988611299565b600f5460009060ff16610a2f57601a546109be906a52b7d2dcc80cd2e400000061594c565b6000868152601b602090815260408083206004908101546060880151601c85528386208b8752909452919093209092015486916109fa9161596b565b610a04919061594c565b610a0e919061594c565b610a2090670de0b6b3a764000061594c565b610a2a9190615998565b610ab4565b83601a54610a3d919061594c565b610a4f90670de0b6b3a764000061594c565b610a57613454565b60608401516000888152601c602090815260408083208a84529091529020600401548691610a849161596b565b610a8e919061594c565b610a98919061594c565b610aaa90670de0b6b3a764000061594c565b610ab49190615998565b6000868152601b60205260409020600701549091506001600160401b03811115610ae057610ae0615448565b604051908082528060200260200182016040528015610b09578160200160208202803683370190505b5060808301516000878152601c6020908152604080832089845290915281206005015492985091670de0b6b3a764000091610b439161596b565b610b4d908661594c565b610b579190615998565b6000878152601b60205260409020600201549091508190610b7990878561255e565b610b83908661596b565b610b8d91906159ac565b975060005b8751811015610d5057670de0b6b3a7640000858560a001518381518110610bbb57610bbb6159c4565b6020026020010151601b60008b81526020019081526020016000206006018481548110610bea57610bea6159c4565b9060005260206000200154610bff919061596b565b610c09919061594c565b610c139190615998565b888281518110610c2557610c256159c4565b60200260200101818151610c3991906159ac565b9052506000878152601c6020908152604080832089845290915290206001015415610cdd576000878152601c60209081526040808320898452909152902060018101546007909101805483908110610c9357610c936159c4565b906000526020600020015483610ca9919061594c565b610cb39190615998565b888281518110610cc557610cc56159c4565b60200260200101818151610cd991906159ac565b9052505b610d3e8a898381518110610cf357610cf36159c4565b6020026020010151601b60008b81526020019081526020016000206007018481548110610d2257610d226159c4565b6000918252602090912001546001600160a01b03169190613576565b80610d48816159da565b915050610b92565b50601754610d68906001600160a01b03168a8a613576565b886001600160a01b03167f091323a211bfa86543b51f77a7a67270d25f9bd406aebf4d2382312c908462618b8a8a33604051610da794939291906159f5565b60405180910390a250505050505060016000819055509250929050565b6000610dcf826135d9565b92915050565b606060028054610de490615a2d565b80601f0160208091040260200160405190810160405280929190818152602001828054610e1090615a2d565b8015610e5d5780601f10610e3257610100808354040283529160200191610e5d565b820191906000526020600020905b815481529060010190602001808311610e4057829003601f168201915b5050505050905090565b6000818152600460205260408120546001600160a01b0316610ee05760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610949565b506000908152600660205260409020546001600160a01b031690565b6000610f078261176a565b9050806001600160a01b0316836001600160a01b03161415610f755760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610949565b336001600160a01b0382161480610f915750610f9181336108b9565b6110035760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c00000000000000006064820152608401610949565b61100d83836135fe565b505050565b601254600f5460009184916001600160a01b0390911690635b7b6d889060ff16858861103c611313565b6110458b612cc5565b6040516001600160e01b031960e088901b1681529415156004860152602485019390935260448401919091526064830152608482015260a40160206040518083038186803b15801561109657600080fd5b505afa1580156110aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110ce9190615a62565b6110d8919061594c565b9050670de0b6b3a76400006110eb613454565b601a546110f8908461594c565b6111029190615998565b61110c9190615998565b949350505050565b606061111f8261366c565b6000828152601b60209081526040918290206008018054835181840281018401909452808452909183018282801561117657602002820191906000526020600020905b815481526020019060010190808311611162575b50505050509050919050565b61118d335b8261368d565b6111a95760405162461bcd60e51b815260040161094990615a7b565b61100d838383613780565b60006111bf8361199c565b82106112215760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b6064820152608401610949565b506001600160a01b03919091166000908152600860209081526040808320938352929052205490565b600c546001600160a01b031633146112745760405162461bcd60e51b815260040161094990615acc565b61127c613927565b565b61100d83838360405180602001604052806000815250612c4f565b6112a233611187565b6113075760405162461bcd60e51b815260206004820152603060248201527f4552433732314275726e61626c653a2063616c6c6572206973206e6f74206f7760448201526f1b995c881b9bdc88185c1c1c9bdd995960821b6064820152608401610949565b6113108161396f565b50565b60135460408051632347816960e11b815290516000926001600160a01b03169163468f02d2916004808301926020929190829003018186803b15801561135857600080fd5b505afa15801561136c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113909190615a62565b905090565b60006113a0600a5490565b82106114035760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b6064820152608401610949565b600a8281548110611416576114166159c4565b90600052602060002001549050919050565b60006002600054141561144d5760405162461bcd60e51b8152600401610949906158ff565b600260005561145a613499565b6114626134bd565b61146b83613a16565b61147482613544565b6000828152601b60205260408120600801805486908110611497576114976159c4565b600091825260208083209190910154858352601c82526040808420828552909252918190205490516370a0823160e01b81523360048201529192506001600160a01b031690859082906370a082319060240160206040518083038186803b15801561150157600080fd5b505afa158015611515573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115399190615a62565b1015611558576040516301899ea960e01b815260040160405180910390fd5b60405163079cc67960e41b8152336004820152602481018690526001600160a01b038216906379cc679090604401600060405180830381600087803b1580156115a057600080fd5b505af11580156115b4573d6000803e3d6000fd5b5050506000858152601b602052604090206002015490506115d681848861255e565b935060006115e385612d76565b9050600085116116065760405163e217c62b60e01b815260040160405180910390fd5b601554601754611623916001600160a01b03918216911683613576565b61164433611631838861596b565b6017546001600160a01b03169190613576565b337f9e2a8b291b40d0233575e4cd133fca1edccef377ed2f525adcb9deb669971e5487868a611673868b61596b565b6040805194855260208501939093529183015260608201526080810184905260a00160405180910390a2505060016000555090949350505050565b601c6020908152600092835260408084208252918352918190208054825160c081018452600183018054825260028401548287015260038401548286015260048401546060830152600584015460808301526006840180548651818902810189019097528087526001600160a01b039094169694959294919360a08601939283018282801561175c57602002820191906000526020600020905b815481526020019060010190808311611748575b505050505081525050905082565b6000818152600460205260408120546001600160a01b031680610dcf5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b6064820152608401610949565b6117e9615007565b6117f28361366c565b6000838152601c6020908152604080832085845282529182902082516080808201855282546001600160a01b03168252845160c0810186526001840180548252600285015482870152600385015482880152600485015460608301526005850154928201929092526006840180548751818802810188019098528088529396949587810195929460a086019392918301828280156118af57602002820191906000526020600020905b81548152602001906001019080831161189b575b50505050508152505081526020016007820180548060200260200160405190810160405280929190818152602001828054801561190b57602002820191906000526020600020905b8154815260200190600101908083116118f7575b505050505081526020016008820180548060200260200160405190810160405280929190818152602001828054801561196357602002820191906000526020600020905b81548152602001906001019080831161194f575b505050505081525050905092915050565b6000806119808361366c565b50506000908152601b6020526040902080546001909101549091565b60006001600160a01b038216611a075760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b6064820152608401610949565b506001600160a01b031660009081526005602052604090205490565b600c546001600160a01b03163314611a4d5760405162461bcd60e51b815260040161094990615acc565b61127c6000613a37565b60026000541415611a7a5760405162461bcd60e51b8152600401610949906158ff565b6002600055600c546001600160a01b03163314611aa95760405162461bcd60e51b815260040161094990615acc565b611ab1613499565b60006018546001611ac291906159ac565b6000818152601b602052604090206008015490915015611af5576040516388d0662b60e01b815260040160405180910390fd5b82421115611b1657604051633485c51360e21b815260040160405180910390fd5b6000601854118015611b3d57506018546000908152601b602052604090206009015460ff16155b15611b5b57604051639ce22bbb60e01b815260040160405180910390fd5b6000818152601b602090815260409091208551611b809260089092019187019061506f565b506000818152601b60205260408082204281556001018590556018839055601154815163c4f59f9b60e01b815291516001600160a01b039091169163c4f59f9b9160048083019286929190829003018186803b158015611bdf57600080fd5b505afa158015611bf3573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611c1b9190810190615b01565b51905060008060005b8751811015611efe57878181518110611c3f57611c3f6159c4565b6020908102919091010151601654909350611c62906001600160a01b0316613a89565b9150816001600160a01b0316635edabd8b30600f60009054906101000a900460ff16868b600e601760009054906101000a90046001600160a01b03166001600160a01b03166395d89b416040518163ffffffff1660e01b815260040160006040518083038186803b158015611cd657600080fd5b505afa158015611cea573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611d129190810190615b8f565b8d6040518863ffffffff1660e01b8152600401611d359796959493929190615bfc565b600060405180830381600087803b158015611d4f57600080fd5b505af1158015611d63573d6000803e3d6000fd5b5050506000868152601c60209081526040808320878452909152902080546001600160a01b0319166001600160a01b038516179055508751611e0890899083908110611db157611db16159c4565b602002602001015160008060008060008a6001600160401b03811115611dd957611dd9615448565b604051908082528060200260200182016040528015611e02578160200160208202803683370190505b50613b26565b836001600160401b03811115611e2057611e20615448565b604051908082528060200260200182016040528015611e49578160200160208202803683370190505b506000868152601c6020908152604080832087845282529091208251611e7993600790920192919091019061506f565b50836001600160401b03811115611e9257611e92615448565b604051908082528060200260200182016040528015611ebb578160200160208202803683370190505b506000868152601c6020908152604080832087845282529091208251611eeb93600890920192919091019061506f565b5080611ef6816159da565b915050611c24565b50826001600160401b03811115611f1757611f17615448565b604051908082528060200260200182016040528015611f40578160200160208202803683370190505b50601b60008681526020019081526020016000206005019080519060200190611f6a92919061506f565b50826001600160401b03811115611f8357611f83615448565b604051908082528060200260200182016040528015611fac578160200160208202803683370190505b50601b60008681526020019081526020016000206006019080519060200190611fd692919061506f565b506011546040805163c4f59f9b60e01b815290516001600160a01b039092169163c4f59f9b91600480820192600092909190829003018186803b15801561201c57600080fd5b505afa158015612030573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526120589190810190615b01565b601b600086815260200190815260200160002060070190805190602001906120819291906150ba565b5061208a613454565b612092611313565b6120a0906305f5e10061594c565b6120aa9190615998565b6000858152601b60205260409081902060040191909155517fa65bbf2074405dcc0df5134b6ae33db0e62584996f2a786d1a30be9d8efcf90d906120f19086908a906151af565b60405180910390a1505060016000555050505050565b61210f6134bd565b600061211c601854611974565b9150508042101561214057604051631bd18a1960e31b815260040160405180910390fd5b60195461214d90826159ac565b42111561216d5760405163496abc0760e01b815260040160405180910390fd5b611310612178611313565b613c9b565b600c546000906001600160a01b031633146121aa5760405162461bcd60e51b815260040161094990615acc565b6121b2613d56565b81156121e65760405133904780156108fc02916000818181858888f193505050501580156121e4573d6000803e3d6000fd5b505b6000805b848110156122bc57858582818110612204576122046159c4565b905060200201602081019061221991906152ea565b6040516370a0823160e01b81523060048201529092506122aa9033906001600160a01b038516906370a082319060240160206040518083038186803b15801561226157600080fd5b505afa158015612275573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122999190615a62565b6001600160a01b0385169190613576565b806122b4816159da565b9150506121ea565b506040513381527f5e7b34819cd91b239220bec92fcfd3c10da2214ba13e4e2b1f6c9cfdbd68a9a29060200160405180910390a160019150505b9392505050565b600c546001600160a01b031633146123275760405162461bcd60e51b815260040161094990615acc565b61232f613d79565b61127c613dbd565b61238f6040518061014001604052806000815260200160008152602001600081526020016000815260200160008152602001606081526020016060815260200160608152602001606081526020016000151581525090565b6123988261366c565b6000828152601b60209081526040918290208251610140810184528154815260018201548184015260028201548185015260038201546060820152600482015460808201526005820180548551818602810186019096528086529194929360a0860193929083018282801561242c57602002820191906000526020600020905b815481526020019060010190808311612418575b505050505081526020016006820180548060200260200160405190810160405280929190818152602001828054801561248457602002820191906000526020600020905b815481526020019060010190808311612470575b50505050508152602001600782018054806020026020016040519081016040528092919081815260200182805480156124e657602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116124c8575b505050505081526020016008820180548060200260200160405190810160405280929190818152602001828054801561253e57602002820191906000526020600020905b81548152602001906001019080831161252a575b50505091835250506009919091015460ff16151560209091015292915050565b600f5460009060ff16156125c85783831161257a5760006125c1565b670de0b6b3a764000061258b613454565b601a5484612599888861596b565b6125a3919061594c565b6125ad919061594c565b6125b79190615998565b6125c19190615998565b90506122f6565b8284116125d657600061110c565b670de0b6b3a76400006125e7613454565b601a54846125f5878961596b565b6125ff919061594c565b6110f8919061594c565b60006002600054141561262e5760405162461bcd60e51b8152600401610949906158ff565b600260005560185461263e613499565b6126466134bd565b61264f81613ed1565b61265884613a16565b6000818152601b6020526040812060080180548790811061267b5761267b6159c4565b9060005260206000200154905061269181613523565b6017546126a9906001600160a01b0316333088613f04565b60115460405163534a7e1d60e11b8152600481018790526000916127399184916001600160a01b03169063a694fc3a90602401600060405180830381600087803b1580156126f657600080fd5b505af115801561270a573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526127329190810190615cf5565b6000613f3c565b905061274c828760008060008087613b26565b6018546000908152601b6020526040812060030180548892906127709084906159ac565b9091555061277f9050856142f2565b93506040518060800160405280848152602001838152602001878152602001601c600086815260200190815260200160002060008581526020019081526020016000206001016040518060c001604052908160008201548152602001600182015481526020016002820154815260200160038201548152602001600482015481526020016005820180548060200260200160405190810160405280929190818152602001828054801561285157602002820191906000526020600020905b81548152602001906001019080831161283d575b5050509190925250505090526000858152601d6020908152604091829020835181558382015160018201558383015160028201556060808501518051600384019081558185015160048501559481015160058401559081015160068301556080810151600783015560a081015180519294919391926128d6926008870192019061506f565b5050604080518881526001600160a01b038a16602082015233918101919091527fa3d2cbcb90e0658235d4ba62aed9a50c231df9bc5bbfb74c95badbc798f38d1a935060600191506129259050565b60405180910390a150506001600055509392505050565b6000612946613454565b601a546010546001600160a01b031663e8468ee4612962611313565b6040516001600160e01b031960e084901b1681526004810191909152602481018890526044810187905260640160206040518083038186803b1580156129a757600080fd5b505afa1580156129bb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129df9190615a62565b6129e9919061594c565b6122f69190615998565b606060038054610de490615a2d565b612a0d338383614317565b5050565b6000806000612a4f6040518060c001604052806000815260200160008152602001600081526020016000815260200160008152602001606081525090565b6000601d6000878152602001908152602001600020604051806080016040529081600082015481526020016001820154815260200160028201548152602001600382016040518060c0016040529081600082015481526020016001820154815260200160028201548152602001600382015481526020016004820154815260200160058201805480602002602001604051908101604052809291908181526020018280548015612b1e57602002820191906000526020600020905b815481526020019060010190808311612b0a575b505050919092525050509052508051602082015160408301516060909301519199909850919650945092505050565b600c546001600160a01b03163314612b775760405162461bcd60e51b815260040161094990615acc565b60198190556040518181527f5259439c9ac2029585dd4a349897aa1e8298d26537c3b57453f275126db91918906020015b60405180910390a150565b600c546001600160a01b03163314612bdd5760405162461bcd60e51b815260040161094990615acc565b611310816143e6565b600c546001600160a01b03163314612c105760405162461bcd60e51b815260040161094990615acc565b806010612c1d8282615d9a565b9050507f626084554ed3d487b613abf59611e713f22caa8095d0c7b0d16b226ea45c3bc481604051612ba89190615e57565b612c59338361368d565b612c755760405162461bcd60e51b815260040161094990615a7b565b612c81848484846144e9565b50505050565b600c546001600160a01b03163314612cb15760405162461bcd60e51b815260040161094990615acc565b612cbc601854613ed1565b61131081613c9b565b60145460405163c189c19b60e01b8152600481018390526000916001600160a01b03169063c189c19b906024015b60206040518083038186803b158015612d0b57600080fd5b505afa158015612d1f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dcf9190615a62565b600c546001600160a01b03163314612d6d5760405162461bcd60e51b815260040161094990615acc565b6113108161451c565b60105460405163c48ce05b60e01b8152600481018390526000916001600160a01b03169063c48ce05b90602401612cf3565b6000818152600460205260409020546060906001600160a01b0316612e275760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b6064820152608401610949565b6000612e3e60408051602081019091526000815290565b90506000815111612e5e57604051806020016040528060008152506122f6565b80612e68846145cd565b604051602001612e79929190615f09565b6040516020818303038152906040529392505050565b600c546001600160a01b03163314612eb95760405162461bcd60e51b815260040161094990615acc565b8115612edc57601154601754612a0d916001600160a01b039182169116836146ca565b601154601754612a0d916001600160a01b0391821691168361478c565b600e8054612f0690615a2d565b80601f0160208091040260200160405190810160405280929190818152602001828054612f3290615a2d565b8015612f7f5780601f10612f5457610100808354040283529160200191612f7f565b820191906000526020600020905b815481529060010190602001808311612f6257829003601f168201915b505050505081565b60008060026000541415612fad5760405162461bcd60e51b8152600401610949906158ff565b6002600055612fba613499565b612fc26134bd565b612fcb84613a16565b6018546000612fd982611974565b915050804210612ffc57604051632fd8225d60e21b815260040160405180910390fd5b6000828152601b6020526040812060080180548990811061301f5761301f6159c4565b9060005260206000200154905061303581613523565b6000838152601c6020908152604080832084845290915281206002810154600390910154613063919061596b565b600f5490915060009060ff166130b957601a546000868152601b60205260409020600401546a52b7d2dcc80cd2e400000091906130a0908c61594c565b6130aa919061594c565b6130b49190615998565b6130f5565b670de0b6b3a76400006130ca613454565b601a546130d7868d61594c565b6130e1919061594c565b6130eb9190615998565b6130f59190615998565b905081811115613118576040516302b0eba760e21b815260040160405180910390fd5b613123838a86611012565b965061312f838a61293c565b6000868152601c602090815260408083208784529091528120600301549197509061316289670de0b6b3a764000061594c565b61316c9190615998565b6000878152601c602090815260408083208884529091528120600381015460029091015492935090916131a09085906159ac565b6131b290670de0b6b3a764000061594c565b6131bc9190615998565b90506131e133306131cd8b8d6159ac565b6017546001600160a01b0316929190613f04565b60115460405163534a7e1d60e11b8152600481018b90526000916132719188916001600160a01b03169063a694fc3a90602401600060405180830381600087803b15801561322e57600080fd5b505af1158015613242573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261326a9190810190615cf5565b6001613f3c565b90506132838660008c87878787613b26565b6000888152601b6020526040812060030180548c92906132a49084906159ac565b90915550506015546017546132c6916001600160a01b0391821691168b613576565b6000888152601c60209081526040808320898452909152908190205490516340c10f1960e01b81526001600160a01b038d81166004830152602482018f9052909116906340c10f1990604401600060405180830381600087803b15801561332c57600080fd5b505af1158015613340573d6000803e3d6000fd5b5050604080518b8152602081018a90529081018f9052606081018d9052608081018c90523360a08201526001600160a01b038e1692507f96d7fd34a786c8810a555ee775a241bf4b8f243f8e64aaf266ec5398d1199b0c915060c00160405180910390a250505050505050506001600081905550935093915050565b600c546001600160a01b031633146133e65760405162461bcd60e51b815260040161094990615acc565b6001600160a01b03811661344b5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610949565b61131081613a37565b60135460408051633dda0eef60e21b815290516000926001600160a01b03169163f7683bbc916004808301926020929190829003018186803b15801561135857600080fd5b60015460ff161561127c5760405163ab35696f60e01b815260040160405180910390fd5b33321461127c57336000908152600d602052604090205460ff1661127c5760405162461bcd60e51b815260206004820152601c60248201527f436f6e7472616374206d7573742062652077686974656c6973746564000000006044820152606401610949565b60008111611310576040516329be7c4760e11b815260040160405180910390fd5b6000818152601b602052604090206009015460ff166113105760405163652399f960e11b815260040160405180910390fd5b6040516001600160a01b03831660248201526044810182905261100d90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152614831565b60006001600160e01b0319821663780e9d6360e01b1480610dcf5750610dcf82614903565b600081815260066020526040902080546001600160a01b0319166001600160a01b03841690811790915581906136338261176a565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000811161131057604051630cba69cb60e01b815260040160405180910390fd5b6000818152600460205260408120546001600160a01b03166137065760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610949565b60006137118361176a565b9050806001600160a01b0316846001600160a01b0316148061374c5750836001600160a01b031661374184610e67565b6001600160a01b0316145b8061110c57506001600160a01b0380821660009081526007602090815260408083209388168352929052205460ff1661110c565b826001600160a01b03166137938261176a565b6001600160a01b0316146137f75760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b6064820152608401610949565b6001600160a01b0382166138595760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610949565b613864838383614953565b61386f6000826135fe565b6001600160a01b038316600090815260056020526040812080546001929061389890849061596b565b90915550506001600160a01b03821660009081526005602052604081208054600192906138c69084906159ac565b909155505060008181526004602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b61392f613d56565b6001805460ff191690556040513381527f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa906020015b60405180910390a1565b600061397a8261176a565b905061398881600084614953565b6139936000836135fe565b6001600160a01b03811660009081526005602052604081208054600192906139bc90849061596b565b909155505060008281526004602052604080822080546001600160a01b0319169055518391906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b6000811161131057604051633c4117f160e21b815260040160405180910390fd5b600c80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000604051733d602d80600a3d3981f3363d3d373d3d3d363d7360601b81528260601b60148201526e5af43d82803e903d91602b57fd5bf360881b60288201526037816000f09150506001600160a01b038116613b215760405162461bcd60e51b8152602060048201526016602482015275115490cc4c4d8dce8818dc99585d194819985a5b195960521b6044820152606401610949565b919050565b6040805160c0810182526018546000908152601c60209081528382208b83529052918220600101548190613b5b9089906159ac565b81526018546000908152601c602090815260408083208d8452825290912060020154910190613b8b9088906159ac565b81526018546000908152601c602090815260408083208d8452825290912060030154910190613bbb908a906159ac565b81526018546000908152601c602090815260408083208d8452825290912060040154910190613beb9086906159ac565b81526018546000908152601c602090815260408083208d8452825290912060050154910190613c1b9087906159ac565b815260209081018490526018546000908152601c825260408082208c8352835290819020835160018201908155848401516002830155918401516003820155606084015160048201556080840151600582015560a0840151805194955085949293613c8e9360069093019291019061506f565b5050505050505050505050565b60026000541415613cbe5760405162461bcd60e51b8152600401610949906158ff565b6002600055613ccb613499565b613cd6601854613ed1565b6018546000908152601b60205260409020600201819055613cf5613dbd565b6018546000908152601b6020908152604091829020600901805460ff1916600117905581513381529081018390527feebcafefe23aabb68b4dab0cabce2ec0228ff1d73f042e91acdd09efd17845b2910160405180910390a1506001600055565b60015460ff1661127c5760405163dcdde9dd60e01b815260040160405180910390fd5b613d81613499565b6001805460ff1916811790556040513381527f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25890602001613965565b6000613dca601854611114565b90506000601060010160009054906101000a90046001600160a01b03166001600160a01b0316632def66206040518163ffffffff1660e01b8152600401600060405180830381600087803b158015613e2157600080fd5b505af1158015613e35573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052613e5d9190810190615cf5565b9050606060005b8351811015612c8157613e92848281518110613e8257613e826159c4565b6020026020010151846001613f3c565b9150613ebf848281518110613ea957613ea96159c4565b6020026020010151600080600080600088613b26565b80613ec9816159da565b915050613e64565b6000818152601b602052604090206009015460ff161561131057604051632fd8225d60e21b815260040160405180910390fd5b6040516001600160a01b0380851660248301528316604482015260648101829052612c819085906323b872dd60e01b906084016135a2565b606082516001600160401b03811115613f5757613f57615448565b604051908082528060200260200182016040528015613f80578160200160208202803683370190505b5090506000805b84518110156142e9576018546000908152601b60205260409020600501805482908110613fb657613fb66159c4565b9060005260206000200154858281518110613fd357613fd36159c4565b6020026020010151613fe5919061596b565b9150848181518110613ff957613ff96159c4565b6020026020010151601b60006018548152602001908152602001600020600501828154811061402a5761402a6159c4565b60009182526020808320909101929092556018548152601b9091526040902060030154614076576000838281518110614065576140656159c4565b6020026020010181815250506140c6565b6018546000908152601b602052604090206003015461409d83670de0b6b3a764000061594c565b6140a79190615998565b8382815181106140b9576140b96159c4565b6020026020010181815250505b8281815181106140d8576140d86159c4565b6020026020010151601b600060185481526020019081526020016000206006018281548110614109576141096159c4565b90600052602060002001600082825461412291906159ac565b90915550508315614289576018546000908152601c602090815260408083208984529091529020600181015460089091018054670de0b6b3a764000092919084908110614171576141716159c4565b9060005260206000200154601b6000601854815260200190815260200160002060060184815481106141a5576141a56159c4565b90600052602060002001546141ba919061596b565b6141c4919061594c565b6141ce9190615998565b6018546000908152601c602090815260408083208a845290915290206007018054839081106141ff576141ff6159c4565b90600052602060002001600082825461421891906159ac565b90915550506018546000908152601b60205260409020600601805482908110614243576142436159c4565b60009182526020808320909101546018548352601c825260408084208a8552909252912060080180548390811061427c5761427c6159c4565b6000918252602090912001555b6018546000908152601b602052604090206006018054829081106142af576142af6159c4565b90600052602060002001548382815181106142cc576142cc6159c4565b6020908102919091010152806142e1816159da565b915050613f87565b50509392505050565b60006142fd601e5490565b905061430d601e80546001019055565b613b218282614966565b816001600160a01b0316836001600160a01b031614156143795760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610949565b6001600160a01b03838116600081815260076020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b803b6144345760405162461bcd60e51b815260206004820152601a60248201527f41646472657373206d757374206265206120636f6e74726163740000000000006044820152606401610949565b6001600160a01b0381166000908152600d602052604090205460ff161561449d5760405162461bcd60e51b815260206004820152601c60248201527f436f6e747261637420616c72656164792077686974656c6973746564000000006044820152606401610949565b6001600160a01b0381166000818152600d6020526040808220805460ff19166001179055517ffbd3cde7ff522a917e485c8ed2a6e87590887ab399f5ac312307903f498543079190a250565b6144f4848484613780565b61450084848484614980565b612c815760405162461bcd60e51b815260040161094990615f38565b6001600160a01b0381166000908152600d602052604090205460ff166145845760405162461bcd60e51b815260206004820152601860248201527f436f6e7472616374206e6f742077686974656c697374656400000000000000006044820152606401610949565b6001600160a01b0381166000818152600d6020526040808220805460ff19169055517f8e81447740597754af5db3e176253a36f7981a9549f48ace3f0cb233913f9d859190a250565b6060816145f15750506040805180820190915260018152600360fc1b602082015290565b8160005b811561461b5780614605816159da565b91506146149050600a83615998565b91506145f5565b6000816001600160401b0381111561463557614635615448565b6040519080825280601f01601f19166020018201604052801561465f576020820181803683370190505b5090505b841561110c5761467460018361596b565b9150614681600a86615f8a565b61468c9060306159ac565b60f81b8183815181106146a1576146a16159c4565b60200101906001600160f81b031916908160001a9053506146c3600a86615998565b9450614663565b604051636eb1769f60e11b81523060048201526001600160a01b0383811660248301526000916147599184919087169063dd62ed3e9060440160206040518083038186803b15801561471b57600080fd5b505afa15801561472f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906147539190615a62565b90614a8d565b6040516001600160a01b038516602482015260448101829052909150612c8190859063095ea7b360e01b906064016135a2565b60006147598260405180606001604052806029815260200161603e60299139604051636eb1769f60e11b81523060048201526001600160a01b03878116602483015288169063dd62ed3e9060440160206040518083038186803b1580156147f257600080fd5b505afa158015614806573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061482a9190615a62565b9190614a99565b6000614886826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316614ac59092919063ffffffff16565b80519091501561100d57808060200190518101906148a49190615f9e565b61100d5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610949565b60006001600160e01b031982166380ac58cd60e01b148061493457506001600160e01b03198216635b5e139f60e01b145b80610dcf57506301ffc9a760e01b6001600160e01b0319831614610dcf565b61495b613499565b61100d838383614ad4565b612a0d828260405180602001604052806000815250614b8c565b60006001600160a01b0384163b15614a8257604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906149c4903390899088908890600401615fbb565b602060405180830381600087803b1580156149de57600080fd5b505af1925050508015614a0e575060408051601f3d908101601f19168201909252614a0b91810190615fee565b60015b614a68573d808015614a3c576040519150601f19603f3d011682016040523d82523d6000602084013e614a41565b606091505b508051614a605760405162461bcd60e51b815260040161094990615f38565b805181602001fd5b6001600160e01b031916630a85bd0160e11b14905061110c565b506001949350505050565b60006122f682846159ac565b60008184841115614abd5760405162461bcd60e51b81526004016109499190615253565b505050900390565b606061110c8484600085614bbf565b6001600160a01b038316614b2f57614b2a81600a80546000838152600b60205260408120829055600182018355919091527fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a80155565b614b52565b816001600160a01b0316836001600160a01b031614614b5257614b528382614cf0565b6001600160a01b038216614b695761100d81614d8d565b826001600160a01b0316826001600160a01b03161461100d5761100d8282614e3c565b614b968383614e80565b614ba36000848484614980565b61100d5760405162461bcd60e51b815260040161094990615f38565b606082471015614c205760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610949565b6001600160a01b0385163b614c775760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610949565b600080866001600160a01b03168587604051614c93919061600b565b60006040518083038185875af1925050503d8060008114614cd0576040519150601f19603f3d011682016040523d82523d6000602084013e614cd5565b606091505b5091509150614ce5828286614fce565b979650505050505050565b60006001614cfd8461199c565b614d07919061596b565b600083815260096020526040902054909150808214614d5a576001600160a01b03841660009081526008602090815260408083208584528252808320548484528184208190558352600990915290208190555b5060009182526009602090815260408084208490556001600160a01b039094168352600881528383209183525290812055565b600a54600090614d9f9060019061596b565b6000838152600b6020526040812054600a8054939450909284908110614dc757614dc76159c4565b9060005260206000200154905080600a8381548110614de857614de86159c4565b6000918252602080832090910192909255828152600b9091526040808220849055858252812055600a805480614e2057614e20616027565b6001900381819060005260206000200160009055905550505050565b6000614e478361199c565b6001600160a01b039093166000908152600860209081526040808320868452825280832085905593825260099052919091209190915550565b6001600160a01b038216614ed65760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610949565b6000818152600460205260409020546001600160a01b031615614f3b5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610949565b614f4760008383614953565b6001600160a01b0382166000908152600560205260408120805460019290614f709084906159ac565b909155505060008181526004602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b60608315614fdd5750816122f6565b825115614fed5782518084602001fd5b8160405162461bcd60e51b81526004016109499190615253565b604051806080016040528060006001600160a01b0316815260200161505b6040518060c001604052806000815260200160008152602001600081526020016000815260200160008152602001606081525090565b815260200160608152602001606081525090565b8280548282559060005260206000209081019282156150aa579160200282015b828111156150aa57825182559160200191906001019061508f565b506150b692915061510f565b5090565b8280548282559060005260206000209081019282156150aa579160200282015b828111156150aa57825182546001600160a01b0319166001600160a01b039091161782556020909201916001909101906150da565b5b808211156150b65760008155600101615110565b6001600160a01b038116811461131057600080fd5b8035613b2181615124565b6000806040838503121561515757600080fd5b82359150602083013561516981615124565b809150509250929050565b600081518084526020808501945080840160005b838110156151a457815187529582019590820190600101615188565b509495945050505050565b82815260406020820152600061110c6040830184615174565b6001600160e01b03198116811461131057600080fd5b6000602082840312156151f057600080fd5b81356122f6816151c8565b60005b838110156152165781810151838201526020016151fe565b83811115612c815750506000910152565b6000815180845261523f8160208601602086016151fb565b601f01601f19169290920160200192915050565b6020815260006122f66020830184615227565b60006020828403121561527857600080fd5b5035919050565b6000806040838503121561529257600080fd5b823561529d81615124565b946020939093013593505050565b6000806000606084860312156152c057600080fd5b505081359360208301359350604090920135919050565b6020815260006122f66020830184615174565b6000602082840312156152fc57600080fd5b81356122f681615124565b60008060006060848603121561531c57600080fd5b833561532781615124565b9250602084013561533781615124565b929592945050506040919091013590565b6000806040838503121561535b57600080fd5b50508035926020909101359150565b8051825260208101516020830152604081015160408301526060810151606083015260808101516080830152600060a082015160c060a085015261110c60c0850182615174565b6001600160a01b038316815260406020820181905260009061110c9083018461536a565b602080825282516001600160a01b0316828201528201516080604083015260009061540360a084018261536a565b90506040840151601f19808584030160608601526154218383615174565b925060608601519150808584030160808601525061543f8282615174565b95945050505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b038111828210171561548657615486615448565b604052919050565b60006001600160401b038211156154a7576154a7615448565b5060051b60200190565b60006001600160401b038211156154ca576154ca615448565b50601f01601f191660200190565b60006154eb6154e6846154b1565b61545e565b90508281528383830111156154ff57600080fd5b828260208301376000602084830101529392505050565b600082601f83011261552757600080fd5b6122f6838335602085016154d8565b60008060006060848603121561554b57600080fd5b83356001600160401b038082111561556257600080fd5b818601915086601f83011261557657600080fd5b813560206155866154e68361548e565b82815260059290921b8401810191818101908a8411156155a557600080fd5b948201945b838610156155c3578535825294820194908201906155aa565b97505087013594505060408601359150808211156155e057600080fd5b506155ed86828701615516565b9150509250925092565b801515811461131057600080fd5b60008060006040848603121561561a57600080fd5b83356001600160401b038082111561563157600080fd5b818601915086601f83011261564557600080fd5b81358181111561565457600080fd5b8760208260051b850101111561566957600080fd5b6020928301955093505084013561567f816155f7565b809150509250925092565b600081518084526020808501945080840160005b838110156151a45781516001600160a01b03168752958201959082019060010161569e565b6020815281516020820152602082015160408201526040820151606082015260608201516080820152608082015160a0820152600060a08301516101408060c0850152615714610160850183615174565b915060c0850151601f19808685030160e08701526157328483615174565b935060e08701519150610100818786030181880152615751858461568a565b9450808801519250506101208187860301818801526157708584615174565b945080880151925050506157878286018215159052565b5090949350505050565b6000806000606084860312156157a657600080fd5b8335925060208401359150604084013561567f81615124565b600080604083850312156157d257600080fd5b82356157dd81615124565b91506020830135615169816155f7565b848152836020820152826040820152608060608201526000615812608083018461536a565b9695505050505050565b600060e0828403121561582e57600080fd5b50919050565b6000806000806080858703121561584a57600080fd5b843561585581615124565b9350602085013561586581615124565b92506040850135915060608501356001600160401b0381111561588757600080fd5b8501601f8101871361589857600080fd5b6158a7878235602084016154d8565b91505092959194509250565b600080604083850312156158c657600080fd5b823561529d816155f7565b600080604083850312156158e457600080fd5b82356158ef81615124565b9150602083013561516981615124565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b634e487b7160e01b600052601160045260246000fd5b600081600019048311821515161561596657615966615936565b500290565b60008282101561597d5761597d615936565b500390565b634e487b7160e01b600052601260045260246000fd5b6000826159a7576159a7615982565b500490565b600082198211156159bf576159bf615936565b500190565b634e487b7160e01b600052603260045260246000fd5b60006000198214156159ee576159ee615936565b5060010190565b848152836020820152608060408201526000615a146080830185615174565b905060018060a01b038316606083015295945050505050565b600181811c90821680615a4157607f821691505b6020821081141561582e57634e487b7160e01b600052602260045260246000fd5b600060208284031215615a7457600080fd5b5051919050565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60006020808385031215615b1457600080fd5b82516001600160401b03811115615b2a57600080fd5b8301601f81018513615b3b57600080fd5b8051615b496154e68261548e565b81815260059190911b82018301908381019087831115615b6857600080fd5b928401925b82841015614ce5578351615b8081615124565b82529284019290840190615b6d565b600060208284031215615ba157600080fd5b81516001600160401b03811115615bb757600080fd5b8201601f81018413615bc857600080fd5b8051615bd66154e6826154b1565b818152856020838501011115615beb57600080fd5b61543f8260208301602086016151fb565b60018060a01b0388168152600060208815158184015287604084015286606084015260e060808401526000865481600182811c915080831680615c4057607f831692505b858310811415615c5e57634e487b7160e01b85526022600452602485fd5b60e088018390526101008801818015615c7e5760018114615c8f57615cba565b60ff19861682528782019650615cba565b60008d81526020902060005b86811015615cb457815484820152908501908901615c9b565b83019750505b50505050505083810360a0850152615cd28187615227565b91505082810360c0840152615ce78185615227565b9a9950505050505050505050565b60006020808385031215615d0857600080fd5b82516001600160401b03811115615d1e57600080fd5b8301601f81018513615d2f57600080fd5b8051615d3d6154e68261548e565b81815260059190911b82018301908381019087831115615d5c57600080fd5b928401925b82841015614ce557835182529284019290840190615d61565b80546001600160a01b0319166001600160a01b0392909216919091179055565b8135615da581615124565b615daf8183615d7a565b506020820135615dbe81615124565b615dcb8160018401615d7a565b506040820135615dda81615124565b615de78160028401615d7a565b506060820135615df681615124565b615e038160038401615d7a565b506080820135615e1281615124565b615e1f8160048401615d7a565b5060a0820135615e2e81615124565b615e3b8160058401615d7a565b5060c0820135615e4a81615124565b61100d8160068401615d7a565b60e081018235615e6681615124565b6001600160a01b039081168352602084013590615e8282615124565b9081166020840152604084013590615e9982615124565b9081166040840152606084013590615eb082615124565b9081166060840152608084013590615ec782615124565b166080830152615ed960a08401615139565b6001600160a01b031660a0830152615ef360c08401615139565b6001600160a01b03811660c08401525092915050565b60008351615f1b8184602088016151fb565b835190830190615f2f8183602088016151fb565b01949350505050565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b600082615f9957615f99615982565b500690565b600060208284031215615fb057600080fd5b81516122f6816155f7565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061581290830184615227565b60006020828403121561600057600080fd5b81516122f6816151c8565b6000825161601d8184602087016151fb565b9190910192915050565b634e487b7160e01b600052603160045260246000fdfe5361666545524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220c0c808ad564636a59ef15b385c59cbaa369b35afb530280a0fe9e316839add0164736f6c63430008090033
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106103985760003560e01c806376671808116101e9578063b375d4921161010f578063d8202b8b116100ad578063ea3bd5df1161007c578063ea3bd5df146108e7578063f2fde38b146108fa578063f3c274a61461090d578063f7683bbc1461091a57600080fd5b8063d8202b8b1461080f578063d90a730e14610822578063da0321cd1461082a578063e985e9c5146108ab57600080fd5b8063c189c19b116100e9578063c189c19b146107c3578063c3d9ed39146107d6578063c48ce05b146107e9578063c87b56dd146107fc57600080fd5b8063b375d4921461078a578063b88d4fde1461079d578063bf81bf43146107b057600080fd5b80638dbdbe6d11610187578063a624ec6311610156578063a624ec631461072e578063ab2150cf14610751578063acc3a00614610764578063b2016bd41461077757600080fd5b80638dbdbe6d146106ed578063920023de1461070057806395d89b4114610713578063a22cb4651461071b57600080fd5b80638456cb59116101c35780638456cb59146106a1578063859e7d32146106a957806388e18e13146106c95780638da5cb5b146106dc57600080fd5b8063766718081461067d57806379599f96146106865780637c4b52cb1461068e57600080fd5b806342966c68116102ce578063616443731161026c5780636f56f56f1161023b5780636f56f56f1461062757806370a082311461064f578063715018a614610662578063751eb65c1461066a57600080fd5b806361644373146105765780636352211e1461057f57806369e3b748146105925780636e821b2e146105b257600080fd5b80634f6ccce7116102a85780634f6ccce714610524578063574cdded146105375780635871dc951461054a5780635c975abb1461056b57600080fd5b806342966c6814610500578063430aea2e14610513578063468f02d21461051c57600080fd5b8063162790551161033b5780632f745c59116103155780632f745c59146104af578063391feebb146104c25780633f4ba83a146104e557806342842e0e146104ed57600080fd5b8063162790551461048057806318160ddd1461049457806323b872dd1461049c57600080fd5b8063081812fc11610377578063081812fc146103ff578063095ea7b31461042a578063156f1d741461043f57806315943b991461046057600080fd5b8062f714ce1461039d57806301ffc9a7146103c757806306fdde03146103ea575b600080fd5b6103b06103ab366004615144565b610922565b6040516103be9291906151af565b60405180910390f35b6103da6103d53660046151de565b610dc4565b60405190151581526020016103be565b6103f2610dd5565b6040516103be9190615253565b61041261040d366004615266565b610e67565b6040516001600160a01b0390911681526020016103be565b61043d61043836600461527f565b610efc565b005b61045261044d3660046152ab565b611012565b6040519081526020016103be565b61047361046e366004615266565b611114565b6040516103be91906152d7565b6103da61048e3660046152ea565b3b151590565b600a54610452565b61043d6104aa366004615307565b611182565b6104526104bd36600461527f565b6111b4565b6103da6104d03660046152ea565b600d6020526000908152604090205460ff1681565b61043d61124a565b61043d6104fb366004615307565b61127e565b61043d61050e366004615266565b611299565b610452601a5481565b610452611313565b610452610532366004615266565b611395565b6104526105453660046152ab565b611428565b61055d610558366004615348565b6116ae565b6040516103be9291906153b1565b60015460ff166103da565b61045260195481565b61041261058d366004615266565b61176a565b6105a56105a0366004615348565b6117e1565b6040516103be91906153d5565b6105f86105c0366004615266565b601b60205260009081526040902080546001820154600283015460038401546004850154600990950154939492939192909160ff1686565b6040805196875260208701959095529385019290925260608401526080830152151560a082015260c0016103be565b61063a610635366004615266565b611974565b604080519283526020830191909152016103be565b61045261065d3660046152ea565b61199c565b61043d611a23565b61043d610678366004615536565b611a57565b61045260185481565b61043d612107565b6103da61069c366004615605565b61217d565b61043d6122fd565b6106bc6106b7366004615266565b612337565b6040516103be91906156c3565b6104526106d73660046152ab565b61255e565b600c546001600160a01b0316610412565b6104526106fb366004615791565b612609565b61045261070e366004615348565b61293c565b6103f26129f3565b61043d6107293660046157bf565b612a02565b61074161073c366004615266565b612a11565b6040516103be94939291906157ed565b61043d61075f366004615266565b612b4d565b61043d6107723660046152ea565b612bb3565b601754610412906001600160a01b031681565b61043d61079836600461581c565b612be6565b61043d6107ab366004615834565b612c4f565b61043d6107be366004615266565b612c87565b6104526107d1366004615266565b612cc5565b61043d6107e43660046152ea565b612d43565b6104526107f7366004615266565b612d76565b6103f261080a366004615266565b612da8565b61043d61081d3660046158b3565b612e8f565b6103f2612ef9565b601054601154601254601354601454601554601654610862966001600160a01b03908116968116958116948116938116928116911687565b604080516001600160a01b039889168152968816602088015294871694860194909452918516606085015284166080840152831660a083015290911660c082015260e0016103be565b6103da6108b93660046158d1565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b61063a6108f5366004615791565b612f87565b61043d6109083660046152ea565b6133bc565b600f546103da9060ff1681565b610452613454565b60006060600260005414156109525760405162461bcd60e51b8152600401610949906158ff565b60405180910390fd5b600260005561095f613499565b6109676134bd565b60008060008061097688612a11565b935093509350935061098783613523565b61099084613544565b61099988611299565b600f5460009060ff16610a2f57601a546109be906a52b7d2dcc80cd2e400000061594c565b6000868152601b602090815260408083206004908101546060880151601c85528386208b8752909452919093209092015486916109fa9161596b565b610a04919061594c565b610a0e919061594c565b610a2090670de0b6b3a764000061594c565b610a2a9190615998565b610ab4565b83601a54610a3d919061594c565b610a4f90670de0b6b3a764000061594c565b610a57613454565b60608401516000888152601c602090815260408083208a84529091529020600401548691610a849161596b565b610a8e919061594c565b610a98919061594c565b610aaa90670de0b6b3a764000061594c565b610ab49190615998565b6000868152601b60205260409020600701549091506001600160401b03811115610ae057610ae0615448565b604051908082528060200260200182016040528015610b09578160200160208202803683370190505b5060808301516000878152601c6020908152604080832089845290915281206005015492985091670de0b6b3a764000091610b439161596b565b610b4d908661594c565b610b579190615998565b6000878152601b60205260409020600201549091508190610b7990878561255e565b610b83908661596b565b610b8d91906159ac565b975060005b8751811015610d5057670de0b6b3a7640000858560a001518381518110610bbb57610bbb6159c4565b6020026020010151601b60008b81526020019081526020016000206006018481548110610bea57610bea6159c4565b9060005260206000200154610bff919061596b565b610c09919061594c565b610c139190615998565b888281518110610c2557610c256159c4565b60200260200101818151610c3991906159ac565b9052506000878152601c6020908152604080832089845290915290206001015415610cdd576000878152601c60209081526040808320898452909152902060018101546007909101805483908110610c9357610c936159c4565b906000526020600020015483610ca9919061594c565b610cb39190615998565b888281518110610cc557610cc56159c4565b60200260200101818151610cd991906159ac565b9052505b610d3e8a898381518110610cf357610cf36159c4565b6020026020010151601b60008b81526020019081526020016000206007018481548110610d2257610d226159c4565b6000918252602090912001546001600160a01b03169190613576565b80610d48816159da565b915050610b92565b50601754610d68906001600160a01b03168a8a613576565b886001600160a01b03167f091323a211bfa86543b51f77a7a67270d25f9bd406aebf4d2382312c908462618b8a8a33604051610da794939291906159f5565b60405180910390a250505050505060016000819055509250929050565b6000610dcf826135d9565b92915050565b606060028054610de490615a2d565b80601f0160208091040260200160405190810160405280929190818152602001828054610e1090615a2d565b8015610e5d5780601f10610e3257610100808354040283529160200191610e5d565b820191906000526020600020905b815481529060010190602001808311610e4057829003601f168201915b5050505050905090565b6000818152600460205260408120546001600160a01b0316610ee05760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610949565b506000908152600660205260409020546001600160a01b031690565b6000610f078261176a565b9050806001600160a01b0316836001600160a01b03161415610f755760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610949565b336001600160a01b0382161480610f915750610f9181336108b9565b6110035760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c00000000000000006064820152608401610949565b61100d83836135fe565b505050565b601254600f5460009184916001600160a01b0390911690635b7b6d889060ff16858861103c611313565b6110458b612cc5565b6040516001600160e01b031960e088901b1681529415156004860152602485019390935260448401919091526064830152608482015260a40160206040518083038186803b15801561109657600080fd5b505afa1580156110aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110ce9190615a62565b6110d8919061594c565b9050670de0b6b3a76400006110eb613454565b601a546110f8908461594c565b6111029190615998565b61110c9190615998565b949350505050565b606061111f8261366c565b6000828152601b60209081526040918290206008018054835181840281018401909452808452909183018282801561117657602002820191906000526020600020905b815481526020019060010190808311611162575b50505050509050919050565b61118d335b8261368d565b6111a95760405162461bcd60e51b815260040161094990615a7b565b61100d838383613780565b60006111bf8361199c565b82106112215760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b6064820152608401610949565b506001600160a01b03919091166000908152600860209081526040808320938352929052205490565b600c546001600160a01b031633146112745760405162461bcd60e51b815260040161094990615acc565b61127c613927565b565b61100d83838360405180602001604052806000815250612c4f565b6112a233611187565b6113075760405162461bcd60e51b815260206004820152603060248201527f4552433732314275726e61626c653a2063616c6c6572206973206e6f74206f7760448201526f1b995c881b9bdc88185c1c1c9bdd995960821b6064820152608401610949565b6113108161396f565b50565b60135460408051632347816960e11b815290516000926001600160a01b03169163468f02d2916004808301926020929190829003018186803b15801561135857600080fd5b505afa15801561136c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113909190615a62565b905090565b60006113a0600a5490565b82106114035760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b6064820152608401610949565b600a8281548110611416576114166159c4565b90600052602060002001549050919050565b60006002600054141561144d5760405162461bcd60e51b8152600401610949906158ff565b600260005561145a613499565b6114626134bd565b61146b83613a16565b61147482613544565b6000828152601b60205260408120600801805486908110611497576114976159c4565b600091825260208083209190910154858352601c82526040808420828552909252918190205490516370a0823160e01b81523360048201529192506001600160a01b031690859082906370a082319060240160206040518083038186803b15801561150157600080fd5b505afa158015611515573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115399190615a62565b1015611558576040516301899ea960e01b815260040160405180910390fd5b60405163079cc67960e41b8152336004820152602481018690526001600160a01b038216906379cc679090604401600060405180830381600087803b1580156115a057600080fd5b505af11580156115b4573d6000803e3d6000fd5b5050506000858152601b602052604090206002015490506115d681848861255e565b935060006115e385612d76565b9050600085116116065760405163e217c62b60e01b815260040160405180910390fd5b601554601754611623916001600160a01b03918216911683613576565b61164433611631838861596b565b6017546001600160a01b03169190613576565b337f9e2a8b291b40d0233575e4cd133fca1edccef377ed2f525adcb9deb669971e5487868a611673868b61596b565b6040805194855260208501939093529183015260608201526080810184905260a00160405180910390a2505060016000555090949350505050565b601c6020908152600092835260408084208252918352918190208054825160c081018452600183018054825260028401548287015260038401548286015260048401546060830152600584015460808301526006840180548651818902810189019097528087526001600160a01b039094169694959294919360a08601939283018282801561175c57602002820191906000526020600020905b815481526020019060010190808311611748575b505050505081525050905082565b6000818152600460205260408120546001600160a01b031680610dcf5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b6064820152608401610949565b6117e9615007565b6117f28361366c565b6000838152601c6020908152604080832085845282529182902082516080808201855282546001600160a01b03168252845160c0810186526001840180548252600285015482870152600385015482880152600485015460608301526005850154928201929092526006840180548751818802810188019098528088529396949587810195929460a086019392918301828280156118af57602002820191906000526020600020905b81548152602001906001019080831161189b575b50505050508152505081526020016007820180548060200260200160405190810160405280929190818152602001828054801561190b57602002820191906000526020600020905b8154815260200190600101908083116118f7575b505050505081526020016008820180548060200260200160405190810160405280929190818152602001828054801561196357602002820191906000526020600020905b81548152602001906001019080831161194f575b505050505081525050905092915050565b6000806119808361366c565b50506000908152601b6020526040902080546001909101549091565b60006001600160a01b038216611a075760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b6064820152608401610949565b506001600160a01b031660009081526005602052604090205490565b600c546001600160a01b03163314611a4d5760405162461bcd60e51b815260040161094990615acc565b61127c6000613a37565b60026000541415611a7a5760405162461bcd60e51b8152600401610949906158ff565b6002600055600c546001600160a01b03163314611aa95760405162461bcd60e51b815260040161094990615acc565b611ab1613499565b60006018546001611ac291906159ac565b6000818152601b602052604090206008015490915015611af5576040516388d0662b60e01b815260040160405180910390fd5b82421115611b1657604051633485c51360e21b815260040160405180910390fd5b6000601854118015611b3d57506018546000908152601b602052604090206009015460ff16155b15611b5b57604051639ce22bbb60e01b815260040160405180910390fd5b6000818152601b602090815260409091208551611b809260089092019187019061506f565b506000818152601b60205260408082204281556001018590556018839055601154815163c4f59f9b60e01b815291516001600160a01b039091169163c4f59f9b9160048083019286929190829003018186803b158015611bdf57600080fd5b505afa158015611bf3573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611c1b9190810190615b01565b51905060008060005b8751811015611efe57878181518110611c3f57611c3f6159c4565b6020908102919091010151601654909350611c62906001600160a01b0316613a89565b9150816001600160a01b0316635edabd8b30600f60009054906101000a900460ff16868b600e601760009054906101000a90046001600160a01b03166001600160a01b03166395d89b416040518163ffffffff1660e01b815260040160006040518083038186803b158015611cd657600080fd5b505afa158015611cea573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611d129190810190615b8f565b8d6040518863ffffffff1660e01b8152600401611d359796959493929190615bfc565b600060405180830381600087803b158015611d4f57600080fd5b505af1158015611d63573d6000803e3d6000fd5b5050506000868152601c60209081526040808320878452909152902080546001600160a01b0319166001600160a01b038516179055508751611e0890899083908110611db157611db16159c4565b602002602001015160008060008060008a6001600160401b03811115611dd957611dd9615448565b604051908082528060200260200182016040528015611e02578160200160208202803683370190505b50613b26565b836001600160401b03811115611e2057611e20615448565b604051908082528060200260200182016040528015611e49578160200160208202803683370190505b506000868152601c6020908152604080832087845282529091208251611e7993600790920192919091019061506f565b50836001600160401b03811115611e9257611e92615448565b604051908082528060200260200182016040528015611ebb578160200160208202803683370190505b506000868152601c6020908152604080832087845282529091208251611eeb93600890920192919091019061506f565b5080611ef6816159da565b915050611c24565b50826001600160401b03811115611f1757611f17615448565b604051908082528060200260200182016040528015611f40578160200160208202803683370190505b50601b60008681526020019081526020016000206005019080519060200190611f6a92919061506f565b50826001600160401b03811115611f8357611f83615448565b604051908082528060200260200182016040528015611fac578160200160208202803683370190505b50601b60008681526020019081526020016000206006019080519060200190611fd692919061506f565b506011546040805163c4f59f9b60e01b815290516001600160a01b039092169163c4f59f9b91600480820192600092909190829003018186803b15801561201c57600080fd5b505afa158015612030573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526120589190810190615b01565b601b600086815260200190815260200160002060070190805190602001906120819291906150ba565b5061208a613454565b612092611313565b6120a0906305f5e10061594c565b6120aa9190615998565b6000858152601b60205260409081902060040191909155517fa65bbf2074405dcc0df5134b6ae33db0e62584996f2a786d1a30be9d8efcf90d906120f19086908a906151af565b60405180910390a1505060016000555050505050565b61210f6134bd565b600061211c601854611974565b9150508042101561214057604051631bd18a1960e31b815260040160405180910390fd5b60195461214d90826159ac565b42111561216d5760405163496abc0760e01b815260040160405180910390fd5b611310612178611313565b613c9b565b600c546000906001600160a01b031633146121aa5760405162461bcd60e51b815260040161094990615acc565b6121b2613d56565b81156121e65760405133904780156108fc02916000818181858888f193505050501580156121e4573d6000803e3d6000fd5b505b6000805b848110156122bc57858582818110612204576122046159c4565b905060200201602081019061221991906152ea565b6040516370a0823160e01b81523060048201529092506122aa9033906001600160a01b038516906370a082319060240160206040518083038186803b15801561226157600080fd5b505afa158015612275573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122999190615a62565b6001600160a01b0385169190613576565b806122b4816159da565b9150506121ea565b506040513381527f5e7b34819cd91b239220bec92fcfd3c10da2214ba13e4e2b1f6c9cfdbd68a9a29060200160405180910390a160019150505b9392505050565b600c546001600160a01b031633146123275760405162461bcd60e51b815260040161094990615acc565b61232f613d79565b61127c613dbd565b61238f6040518061014001604052806000815260200160008152602001600081526020016000815260200160008152602001606081526020016060815260200160608152602001606081526020016000151581525090565b6123988261366c565b6000828152601b60209081526040918290208251610140810184528154815260018201548184015260028201548185015260038201546060820152600482015460808201526005820180548551818602810186019096528086529194929360a0860193929083018282801561242c57602002820191906000526020600020905b815481526020019060010190808311612418575b505050505081526020016006820180548060200260200160405190810160405280929190818152602001828054801561248457602002820191906000526020600020905b815481526020019060010190808311612470575b50505050508152602001600782018054806020026020016040519081016040528092919081815260200182805480156124e657602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116124c8575b505050505081526020016008820180548060200260200160405190810160405280929190818152602001828054801561253e57602002820191906000526020600020905b81548152602001906001019080831161252a575b50505091835250506009919091015460ff16151560209091015292915050565b600f5460009060ff16156125c85783831161257a5760006125c1565b670de0b6b3a764000061258b613454565b601a5484612599888861596b565b6125a3919061594c565b6125ad919061594c565b6125b79190615998565b6125c19190615998565b90506122f6565b8284116125d657600061110c565b670de0b6b3a76400006125e7613454565b601a54846125f5878961596b565b6125ff919061594c565b6110f8919061594c565b60006002600054141561262e5760405162461bcd60e51b8152600401610949906158ff565b600260005560185461263e613499565b6126466134bd565b61264f81613ed1565b61265884613a16565b6000818152601b6020526040812060080180548790811061267b5761267b6159c4565b9060005260206000200154905061269181613523565b6017546126a9906001600160a01b0316333088613f04565b60115460405163534a7e1d60e11b8152600481018790526000916127399184916001600160a01b03169063a694fc3a90602401600060405180830381600087803b1580156126f657600080fd5b505af115801561270a573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526127329190810190615cf5565b6000613f3c565b905061274c828760008060008087613b26565b6018546000908152601b6020526040812060030180548892906127709084906159ac565b9091555061277f9050856142f2565b93506040518060800160405280848152602001838152602001878152602001601c600086815260200190815260200160002060008581526020019081526020016000206001016040518060c001604052908160008201548152602001600182015481526020016002820154815260200160038201548152602001600482015481526020016005820180548060200260200160405190810160405280929190818152602001828054801561285157602002820191906000526020600020905b81548152602001906001019080831161283d575b5050509190925250505090526000858152601d6020908152604091829020835181558382015160018201558383015160028201556060808501518051600384019081558185015160048501559481015160058401559081015160068301556080810151600783015560a081015180519294919391926128d6926008870192019061506f565b5050604080518881526001600160a01b038a16602082015233918101919091527fa3d2cbcb90e0658235d4ba62aed9a50c231df9bc5bbfb74c95badbc798f38d1a935060600191506129259050565b60405180910390a150506001600055509392505050565b6000612946613454565b601a546010546001600160a01b031663e8468ee4612962611313565b6040516001600160e01b031960e084901b1681526004810191909152602481018890526044810187905260640160206040518083038186803b1580156129a757600080fd5b505afa1580156129bb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129df9190615a62565b6129e9919061594c565b6122f69190615998565b606060038054610de490615a2d565b612a0d338383614317565b5050565b6000806000612a4f6040518060c001604052806000815260200160008152602001600081526020016000815260200160008152602001606081525090565b6000601d6000878152602001908152602001600020604051806080016040529081600082015481526020016001820154815260200160028201548152602001600382016040518060c0016040529081600082015481526020016001820154815260200160028201548152602001600382015481526020016004820154815260200160058201805480602002602001604051908101604052809291908181526020018280548015612b1e57602002820191906000526020600020905b815481526020019060010190808311612b0a575b505050919092525050509052508051602082015160408301516060909301519199909850919650945092505050565b600c546001600160a01b03163314612b775760405162461bcd60e51b815260040161094990615acc565b60198190556040518181527f5259439c9ac2029585dd4a349897aa1e8298d26537c3b57453f275126db91918906020015b60405180910390a150565b600c546001600160a01b03163314612bdd5760405162461bcd60e51b815260040161094990615acc565b611310816143e6565b600c546001600160a01b03163314612c105760405162461bcd60e51b815260040161094990615acc565b806010612c1d8282615d9a565b9050507f626084554ed3d487b613abf59611e713f22caa8095d0c7b0d16b226ea45c3bc481604051612ba89190615e57565b612c59338361368d565b612c755760405162461bcd60e51b815260040161094990615a7b565b612c81848484846144e9565b50505050565b600c546001600160a01b03163314612cb15760405162461bcd60e51b815260040161094990615acc565b612cbc601854613ed1565b61131081613c9b565b60145460405163c189c19b60e01b8152600481018390526000916001600160a01b03169063c189c19b906024015b60206040518083038186803b158015612d0b57600080fd5b505afa158015612d1f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dcf9190615a62565b600c546001600160a01b03163314612d6d5760405162461bcd60e51b815260040161094990615acc565b6113108161451c565b60105460405163c48ce05b60e01b8152600481018390526000916001600160a01b03169063c48ce05b90602401612cf3565b6000818152600460205260409020546060906001600160a01b0316612e275760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b6064820152608401610949565b6000612e3e60408051602081019091526000815290565b90506000815111612e5e57604051806020016040528060008152506122f6565b80612e68846145cd565b604051602001612e79929190615f09565b6040516020818303038152906040529392505050565b600c546001600160a01b03163314612eb95760405162461bcd60e51b815260040161094990615acc565b8115612edc57601154601754612a0d916001600160a01b039182169116836146ca565b601154601754612a0d916001600160a01b0391821691168361478c565b600e8054612f0690615a2d565b80601f0160208091040260200160405190810160405280929190818152602001828054612f3290615a2d565b8015612f7f5780601f10612f5457610100808354040283529160200191612f7f565b820191906000526020600020905b815481529060010190602001808311612f6257829003601f168201915b505050505081565b60008060026000541415612fad5760405162461bcd60e51b8152600401610949906158ff565b6002600055612fba613499565b612fc26134bd565b612fcb84613a16565b6018546000612fd982611974565b915050804210612ffc57604051632fd8225d60e21b815260040160405180910390fd5b6000828152601b6020526040812060080180548990811061301f5761301f6159c4565b9060005260206000200154905061303581613523565b6000838152601c6020908152604080832084845290915281206002810154600390910154613063919061596b565b600f5490915060009060ff166130b957601a546000868152601b60205260409020600401546a52b7d2dcc80cd2e400000091906130a0908c61594c565b6130aa919061594c565b6130b49190615998565b6130f5565b670de0b6b3a76400006130ca613454565b601a546130d7868d61594c565b6130e1919061594c565b6130eb9190615998565b6130f59190615998565b905081811115613118576040516302b0eba760e21b815260040160405180910390fd5b613123838a86611012565b965061312f838a61293c565b6000868152601c602090815260408083208784529091528120600301549197509061316289670de0b6b3a764000061594c565b61316c9190615998565b6000878152601c602090815260408083208884529091528120600381015460029091015492935090916131a09085906159ac565b6131b290670de0b6b3a764000061594c565b6131bc9190615998565b90506131e133306131cd8b8d6159ac565b6017546001600160a01b0316929190613f04565b60115460405163534a7e1d60e11b8152600481018b90526000916132719188916001600160a01b03169063a694fc3a90602401600060405180830381600087803b15801561322e57600080fd5b505af1158015613242573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261326a9190810190615cf5565b6001613f3c565b90506132838660008c87878787613b26565b6000888152601b6020526040812060030180548c92906132a49084906159ac565b90915550506015546017546132c6916001600160a01b0391821691168b613576565b6000888152601c60209081526040808320898452909152908190205490516340c10f1960e01b81526001600160a01b038d81166004830152602482018f9052909116906340c10f1990604401600060405180830381600087803b15801561332c57600080fd5b505af1158015613340573d6000803e3d6000fd5b5050604080518b8152602081018a90529081018f9052606081018d9052608081018c90523360a08201526001600160a01b038e1692507f96d7fd34a786c8810a555ee775a241bf4b8f243f8e64aaf266ec5398d1199b0c915060c00160405180910390a250505050505050506001600081905550935093915050565b600c546001600160a01b031633146133e65760405162461bcd60e51b815260040161094990615acc565b6001600160a01b03811661344b5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610949565b61131081613a37565b60135460408051633dda0eef60e21b815290516000926001600160a01b03169163f7683bbc916004808301926020929190829003018186803b15801561135857600080fd5b60015460ff161561127c5760405163ab35696f60e01b815260040160405180910390fd5b33321461127c57336000908152600d602052604090205460ff1661127c5760405162461bcd60e51b815260206004820152601c60248201527f436f6e7472616374206d7573742062652077686974656c6973746564000000006044820152606401610949565b60008111611310576040516329be7c4760e11b815260040160405180910390fd5b6000818152601b602052604090206009015460ff166113105760405163652399f960e11b815260040160405180910390fd5b6040516001600160a01b03831660248201526044810182905261100d90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152614831565b60006001600160e01b0319821663780e9d6360e01b1480610dcf5750610dcf82614903565b600081815260066020526040902080546001600160a01b0319166001600160a01b03841690811790915581906136338261176a565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000811161131057604051630cba69cb60e01b815260040160405180910390fd5b6000818152600460205260408120546001600160a01b03166137065760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610949565b60006137118361176a565b9050806001600160a01b0316846001600160a01b0316148061374c5750836001600160a01b031661374184610e67565b6001600160a01b0316145b8061110c57506001600160a01b0380821660009081526007602090815260408083209388168352929052205460ff1661110c565b826001600160a01b03166137938261176a565b6001600160a01b0316146137f75760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b6064820152608401610949565b6001600160a01b0382166138595760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610949565b613864838383614953565b61386f6000826135fe565b6001600160a01b038316600090815260056020526040812080546001929061389890849061596b565b90915550506001600160a01b03821660009081526005602052604081208054600192906138c69084906159ac565b909155505060008181526004602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b61392f613d56565b6001805460ff191690556040513381527f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa906020015b60405180910390a1565b600061397a8261176a565b905061398881600084614953565b6139936000836135fe565b6001600160a01b03811660009081526005602052604081208054600192906139bc90849061596b565b909155505060008281526004602052604080822080546001600160a01b0319169055518391906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b6000811161131057604051633c4117f160e21b815260040160405180910390fd5b600c80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000604051733d602d80600a3d3981f3363d3d373d3d3d363d7360601b81528260601b60148201526e5af43d82803e903d91602b57fd5bf360881b60288201526037816000f09150506001600160a01b038116613b215760405162461bcd60e51b8152602060048201526016602482015275115490cc4c4d8dce8818dc99585d194819985a5b195960521b6044820152606401610949565b919050565b6040805160c0810182526018546000908152601c60209081528382208b83529052918220600101548190613b5b9089906159ac565b81526018546000908152601c602090815260408083208d8452825290912060020154910190613b8b9088906159ac565b81526018546000908152601c602090815260408083208d8452825290912060030154910190613bbb908a906159ac565b81526018546000908152601c602090815260408083208d8452825290912060040154910190613beb9086906159ac565b81526018546000908152601c602090815260408083208d8452825290912060050154910190613c1b9087906159ac565b815260209081018490526018546000908152601c825260408082208c8352835290819020835160018201908155848401516002830155918401516003820155606084015160048201556080840151600582015560a0840151805194955085949293613c8e9360069093019291019061506f565b5050505050505050505050565b60026000541415613cbe5760405162461bcd60e51b8152600401610949906158ff565b6002600055613ccb613499565b613cd6601854613ed1565b6018546000908152601b60205260409020600201819055613cf5613dbd565b6018546000908152601b6020908152604091829020600901805460ff1916600117905581513381529081018390527feebcafefe23aabb68b4dab0cabce2ec0228ff1d73f042e91acdd09efd17845b2910160405180910390a1506001600055565b60015460ff1661127c5760405163dcdde9dd60e01b815260040160405180910390fd5b613d81613499565b6001805460ff1916811790556040513381527f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25890602001613965565b6000613dca601854611114565b90506000601060010160009054906101000a90046001600160a01b03166001600160a01b0316632def66206040518163ffffffff1660e01b8152600401600060405180830381600087803b158015613e2157600080fd5b505af1158015613e35573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052613e5d9190810190615cf5565b9050606060005b8351811015612c8157613e92848281518110613e8257613e826159c4565b6020026020010151846001613f3c565b9150613ebf848281518110613ea957613ea96159c4565b6020026020010151600080600080600088613b26565b80613ec9816159da565b915050613e64565b6000818152601b602052604090206009015460ff161561131057604051632fd8225d60e21b815260040160405180910390fd5b6040516001600160a01b0380851660248301528316604482015260648101829052612c819085906323b872dd60e01b906084016135a2565b606082516001600160401b03811115613f5757613f57615448565b604051908082528060200260200182016040528015613f80578160200160208202803683370190505b5090506000805b84518110156142e9576018546000908152601b60205260409020600501805482908110613fb657613fb66159c4565b9060005260206000200154858281518110613fd357613fd36159c4565b6020026020010151613fe5919061596b565b9150848181518110613ff957613ff96159c4565b6020026020010151601b60006018548152602001908152602001600020600501828154811061402a5761402a6159c4565b60009182526020808320909101929092556018548152601b9091526040902060030154614076576000838281518110614065576140656159c4565b6020026020010181815250506140c6565b6018546000908152601b602052604090206003015461409d83670de0b6b3a764000061594c565b6140a79190615998565b8382815181106140b9576140b96159c4565b6020026020010181815250505b8281815181106140d8576140d86159c4565b6020026020010151601b600060185481526020019081526020016000206006018281548110614109576141096159c4565b90600052602060002001600082825461412291906159ac565b90915550508315614289576018546000908152601c602090815260408083208984529091529020600181015460089091018054670de0b6b3a764000092919084908110614171576141716159c4565b9060005260206000200154601b6000601854815260200190815260200160002060060184815481106141a5576141a56159c4565b90600052602060002001546141ba919061596b565b6141c4919061594c565b6141ce9190615998565b6018546000908152601c602090815260408083208a845290915290206007018054839081106141ff576141ff6159c4565b90600052602060002001600082825461421891906159ac565b90915550506018546000908152601b60205260409020600601805482908110614243576142436159c4565b60009182526020808320909101546018548352601c825260408084208a8552909252912060080180548390811061427c5761427c6159c4565b6000918252602090912001555b6018546000908152601b602052604090206006018054829081106142af576142af6159c4565b90600052602060002001548382815181106142cc576142cc6159c4565b6020908102919091010152806142e1816159da565b915050613f87565b50509392505050565b60006142fd601e5490565b905061430d601e80546001019055565b613b218282614966565b816001600160a01b0316836001600160a01b031614156143795760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610949565b6001600160a01b03838116600081815260076020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b803b6144345760405162461bcd60e51b815260206004820152601a60248201527f41646472657373206d757374206265206120636f6e74726163740000000000006044820152606401610949565b6001600160a01b0381166000908152600d602052604090205460ff161561449d5760405162461bcd60e51b815260206004820152601c60248201527f436f6e747261637420616c72656164792077686974656c6973746564000000006044820152606401610949565b6001600160a01b0381166000818152600d6020526040808220805460ff19166001179055517ffbd3cde7ff522a917e485c8ed2a6e87590887ab399f5ac312307903f498543079190a250565b6144f4848484613780565b61450084848484614980565b612c815760405162461bcd60e51b815260040161094990615f38565b6001600160a01b0381166000908152600d602052604090205460ff166145845760405162461bcd60e51b815260206004820152601860248201527f436f6e7472616374206e6f742077686974656c697374656400000000000000006044820152606401610949565b6001600160a01b0381166000818152600d6020526040808220805460ff19169055517f8e81447740597754af5db3e176253a36f7981a9549f48ace3f0cb233913f9d859190a250565b6060816145f15750506040805180820190915260018152600360fc1b602082015290565b8160005b811561461b5780614605816159da565b91506146149050600a83615998565b91506145f5565b6000816001600160401b0381111561463557614635615448565b6040519080825280601f01601f19166020018201604052801561465f576020820181803683370190505b5090505b841561110c5761467460018361596b565b9150614681600a86615f8a565b61468c9060306159ac565b60f81b8183815181106146a1576146a16159c4565b60200101906001600160f81b031916908160001a9053506146c3600a86615998565b9450614663565b604051636eb1769f60e11b81523060048201526001600160a01b0383811660248301526000916147599184919087169063dd62ed3e9060440160206040518083038186803b15801561471b57600080fd5b505afa15801561472f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906147539190615a62565b90614a8d565b6040516001600160a01b038516602482015260448101829052909150612c8190859063095ea7b360e01b906064016135a2565b60006147598260405180606001604052806029815260200161603e60299139604051636eb1769f60e11b81523060048201526001600160a01b03878116602483015288169063dd62ed3e9060440160206040518083038186803b1580156147f257600080fd5b505afa158015614806573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061482a9190615a62565b9190614a99565b6000614886826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316614ac59092919063ffffffff16565b80519091501561100d57808060200190518101906148a49190615f9e565b61100d5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610949565b60006001600160e01b031982166380ac58cd60e01b148061493457506001600160e01b03198216635b5e139f60e01b145b80610dcf57506301ffc9a760e01b6001600160e01b0319831614610dcf565b61495b613499565b61100d838383614ad4565b612a0d828260405180602001604052806000815250614b8c565b60006001600160a01b0384163b15614a8257604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906149c4903390899088908890600401615fbb565b602060405180830381600087803b1580156149de57600080fd5b505af1925050508015614a0e575060408051601f3d908101601f19168201909252614a0b91810190615fee565b60015b614a68573d808015614a3c576040519150601f19603f3d011682016040523d82523d6000602084013e614a41565b606091505b508051614a605760405162461bcd60e51b815260040161094990615f38565b805181602001fd5b6001600160e01b031916630a85bd0160e11b14905061110c565b506001949350505050565b60006122f682846159ac565b60008184841115614abd5760405162461bcd60e51b81526004016109499190615253565b505050900390565b606061110c8484600085614bbf565b6001600160a01b038316614b2f57614b2a81600a80546000838152600b60205260408120829055600182018355919091527fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a80155565b614b52565b816001600160a01b0316836001600160a01b031614614b5257614b528382614cf0565b6001600160a01b038216614b695761100d81614d8d565b826001600160a01b0316826001600160a01b03161461100d5761100d8282614e3c565b614b968383614e80565b614ba36000848484614980565b61100d5760405162461bcd60e51b815260040161094990615f38565b606082471015614c205760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610949565b6001600160a01b0385163b614c775760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610949565b600080866001600160a01b03168587604051614c93919061600b565b60006040518083038185875af1925050503d8060008114614cd0576040519150601f19603f3d011682016040523d82523d6000602084013e614cd5565b606091505b5091509150614ce5828286614fce565b979650505050505050565b60006001614cfd8461199c565b614d07919061596b565b600083815260096020526040902054909150808214614d5a576001600160a01b03841660009081526008602090815260408083208584528252808320548484528184208190558352600990915290208190555b5060009182526009602090815260408084208490556001600160a01b039094168352600881528383209183525290812055565b600a54600090614d9f9060019061596b565b6000838152600b6020526040812054600a8054939450909284908110614dc757614dc76159c4565b9060005260206000200154905080600a8381548110614de857614de86159c4565b6000918252602080832090910192909255828152600b9091526040808220849055858252812055600a805480614e2057614e20616027565b6001900381819060005260206000200160009055905550505050565b6000614e478361199c565b6001600160a01b039093166000908152600860209081526040808320868452825280832085905593825260099052919091209190915550565b6001600160a01b038216614ed65760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610949565b6000818152600460205260409020546001600160a01b031615614f3b5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610949565b614f4760008383614953565b6001600160a01b0382166000908152600560205260408120805460019290614f709084906159ac565b909155505060008181526004602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b60608315614fdd5750816122f6565b825115614fed5782518084602001fd5b8160405162461bcd60e51b81526004016109499190615253565b604051806080016040528060006001600160a01b0316815260200161505b6040518060c001604052806000815260200160008152602001600081526020016000815260200160008152602001606081525090565b815260200160608152602001606081525090565b8280548282559060005260206000209081019282156150aa579160200282015b828111156150aa57825182559160200191906001019061508f565b506150b692915061510f565b5090565b8280548282559060005260206000209081019282156150aa579160200282015b828111156150aa57825182546001600160a01b0319166001600160a01b039091161782556020909201916001909101906150da565b5b808211156150b65760008155600101615110565b6001600160a01b038116811461131057600080fd5b8035613b2181615124565b6000806040838503121561515757600080fd5b82359150602083013561516981615124565b809150509250929050565b600081518084526020808501945080840160005b838110156151a457815187529582019590820190600101615188565b509495945050505050565b82815260406020820152600061110c6040830184615174565b6001600160e01b03198116811461131057600080fd5b6000602082840312156151f057600080fd5b81356122f6816151c8565b60005b838110156152165781810151838201526020016151fe565b83811115612c815750506000910152565b6000815180845261523f8160208601602086016151fb565b601f01601f19169290920160200192915050565b6020815260006122f66020830184615227565b60006020828403121561527857600080fd5b5035919050565b6000806040838503121561529257600080fd5b823561529d81615124565b946020939093013593505050565b6000806000606084860312156152c057600080fd5b505081359360208301359350604090920135919050565b6020815260006122f66020830184615174565b6000602082840312156152fc57600080fd5b81356122f681615124565b60008060006060848603121561531c57600080fd5b833561532781615124565b9250602084013561533781615124565b929592945050506040919091013590565b6000806040838503121561535b57600080fd5b50508035926020909101359150565b8051825260208101516020830152604081015160408301526060810151606083015260808101516080830152600060a082015160c060a085015261110c60c0850182615174565b6001600160a01b038316815260406020820181905260009061110c9083018461536a565b602080825282516001600160a01b0316828201528201516080604083015260009061540360a084018261536a565b90506040840151601f19808584030160608601526154218383615174565b925060608601519150808584030160808601525061543f8282615174565b95945050505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b038111828210171561548657615486615448565b604052919050565b60006001600160401b038211156154a7576154a7615448565b5060051b60200190565b60006001600160401b038211156154ca576154ca615448565b50601f01601f191660200190565b60006154eb6154e6846154b1565b61545e565b90508281528383830111156154ff57600080fd5b828260208301376000602084830101529392505050565b600082601f83011261552757600080fd5b6122f6838335602085016154d8565b60008060006060848603121561554b57600080fd5b83356001600160401b038082111561556257600080fd5b818601915086601f83011261557657600080fd5b813560206155866154e68361548e565b82815260059290921b8401810191818101908a8411156155a557600080fd5b948201945b838610156155c3578535825294820194908201906155aa565b97505087013594505060408601359150808211156155e057600080fd5b506155ed86828701615516565b9150509250925092565b801515811461131057600080fd5b60008060006040848603121561561a57600080fd5b83356001600160401b038082111561563157600080fd5b818601915086601f83011261564557600080fd5b81358181111561565457600080fd5b8760208260051b850101111561566957600080fd5b6020928301955093505084013561567f816155f7565b809150509250925092565b600081518084526020808501945080840160005b838110156151a45781516001600160a01b03168752958201959082019060010161569e565b6020815281516020820152602082015160408201526040820151606082015260608201516080820152608082015160a0820152600060a08301516101408060c0850152615714610160850183615174565b915060c0850151601f19808685030160e08701526157328483615174565b935060e08701519150610100818786030181880152615751858461568a565b9450808801519250506101208187860301818801526157708584615174565b945080880151925050506157878286018215159052565b5090949350505050565b6000806000606084860312156157a657600080fd5b8335925060208401359150604084013561567f81615124565b600080604083850312156157d257600080fd5b82356157dd81615124565b91506020830135615169816155f7565b848152836020820152826040820152608060608201526000615812608083018461536a565b9695505050505050565b600060e0828403121561582e57600080fd5b50919050565b6000806000806080858703121561584a57600080fd5b843561585581615124565b9350602085013561586581615124565b92506040850135915060608501356001600160401b0381111561588757600080fd5b8501601f8101871361589857600080fd5b6158a7878235602084016154d8565b91505092959194509250565b600080604083850312156158c657600080fd5b823561529d816155f7565b600080604083850312156158e457600080fd5b82356158ef81615124565b9150602083013561516981615124565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b634e487b7160e01b600052601160045260246000fd5b600081600019048311821515161561596657615966615936565b500290565b60008282101561597d5761597d615936565b500390565b634e487b7160e01b600052601260045260246000fd5b6000826159a7576159a7615982565b500490565b600082198211156159bf576159bf615936565b500190565b634e487b7160e01b600052603260045260246000fd5b60006000198214156159ee576159ee615936565b5060010190565b848152836020820152608060408201526000615a146080830185615174565b905060018060a01b038316606083015295945050505050565b600181811c90821680615a4157607f821691505b6020821081141561582e57634e487b7160e01b600052602260045260246000fd5b600060208284031215615a7457600080fd5b5051919050565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60006020808385031215615b1457600080fd5b82516001600160401b03811115615b2a57600080fd5b8301601f81018513615b3b57600080fd5b8051615b496154e68261548e565b81815260059190911b82018301908381019087831115615b6857600080fd5b928401925b82841015614ce5578351615b8081615124565b82529284019290840190615b6d565b600060208284031215615ba157600080fd5b81516001600160401b03811115615bb757600080fd5b8201601f81018413615bc857600080fd5b8051615bd66154e6826154b1565b818152856020838501011115615beb57600080fd5b61543f8260208301602086016151fb565b60018060a01b0388168152600060208815158184015287604084015286606084015260e060808401526000865481600182811c915080831680615c4057607f831692505b858310811415615c5e57634e487b7160e01b85526022600452602485fd5b60e088018390526101008801818015615c7e5760018114615c8f57615cba565b60ff19861682528782019650615cba565b60008d81526020902060005b86811015615cb457815484820152908501908901615c9b565b83019750505b50505050505083810360a0850152615cd28187615227565b91505082810360c0840152615ce78185615227565b9a9950505050505050505050565b60006020808385031215615d0857600080fd5b82516001600160401b03811115615d1e57600080fd5b8301601f81018513615d2f57600080fd5b8051615d3d6154e68261548e565b81815260059190911b82018301908381019087831115615d5c57600080fd5b928401925b82841015614ce557835182529284019290840190615d61565b80546001600160a01b0319166001600160a01b0392909216919091179055565b8135615da581615124565b615daf8183615d7a565b506020820135615dbe81615124565b615dcb8160018401615d7a565b506040820135615dda81615124565b615de78160028401615d7a565b506060820135615df681615124565b615e038160038401615d7a565b506080820135615e1281615124565b615e1f8160048401615d7a565b5060a0820135615e2e81615124565b615e3b8160058401615d7a565b5060c0820135615e4a81615124565b61100d8160068401615d7a565b60e081018235615e6681615124565b6001600160a01b039081168352602084013590615e8282615124565b9081166020840152604084013590615e9982615124565b9081166040840152606084013590615eb082615124565b9081166060840152608084013590615ec782615124565b166080830152615ed960a08401615139565b6001600160a01b031660a0830152615ef360c08401615139565b6001600160a01b03811660c08401525092915050565b60008351615f1b8184602088016151fb565b835190830190615f2f8183602088016151fb565b01949350505050565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b600082615f9957615f99615982565b500690565b600060208284031215615fb057600080fd5b81516122f6816155f7565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061581290830184615227565b60006020828403121561600057600080fd5b81516122f6816151c8565b6000825161601d8184602087016151fb565b9190910192915050565b634e487b7160e01b600052603160045260246000fdfe5361666545524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220c0c808ad564636a59ef15b385c59cbaa369b35afb530280a0fe9e316839add0164736f6c63430008090033
Age | Block | Fee Address | BC Fee Address | Voting Power | Jailed | Incoming |
---|
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.