Contract Overview
My Name Tag:
Not Available
[ 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:
RdpxSSOVV2
Compiler Version
v0.8.9+commit.e5eed63a
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.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 initializer { __Context_init_unchained(); __ERC165_init_unchained(); __AccessControl_init_unchained(); __AccessControlEnumerable_init_unchained(); } function __AccessControlEnumerable_init_unchained() internal initializer { } using EnumerableSetUpgradeable for EnumerableSetUpgradeable.AddressSet; mapping(bytes32 => EnumerableSetUpgradeable.AddressSet) private _roleMembers; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControlEnumerableUpgradeable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) public view override returns (address) { return _roleMembers[role].at(index); } /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) public view override returns (uint256) { return _roleMembers[role].length(); } /** * @dev Overload {_grantRole} to track enumerable memberships */ function _grantRole(bytes32 role, address account) internal virtual override { super._grantRole(role, account); _roleMembers[role].add(account); } /** * @dev Overload {_revokeRole} to track enumerable memberships */ function _revokeRole(bytes32 role, address account) internal virtual override { super._revokeRole(role, account); _roleMembers[role].remove(account); } uint256[49] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.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 initializer { __Context_init_unchained(); __ERC165_init_unchained(); __AccessControl_init_unchained(); } function __AccessControl_init_unchained() internal initializer { } struct RoleData { mapping(address => bool) members; bytes32 adminRole; } mapping(bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with a standardized message including the required role. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ * * _Available since v4.1._ */ modifier onlyRole(bytes32 role) { _checkRole(role, _msgSender()); _; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControlUpgradeable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view override returns (bool) { return _roles[role].members[account]; } /** * @dev Revert with a standard message if `account` is missing `role`. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ */ function _checkRole(bytes32 role, address account) internal view { if (!hasRole(role, account)) { revert( string( abi.encodePacked( "AccessControl: account ", StringsUpgradeable.toHexString(uint160(account), 20), " is missing role ", StringsUpgradeable.toHexString(uint256(role), 32) ) ) ); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view override returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been revoked `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) public virtual override { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== * * NOTE: This function is deprecated in favor of {_grantRole}. */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { bytes32 previousAdminRole = getRoleAdmin(role); _roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Grants `role` to `account`. * * Internal function without access restriction. */ function _grantRole(bytes32 role, address account) internal virtual { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); } } /** * @dev Revokes `role` from `account`. * * Internal function without access restriction. */ function _revokeRole(bytes32 role, address account) internal virtual { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } uint256[49] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (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.0 (access/IAccessControl.sol) pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControlUpgradeable { /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (proxy/utils/Initializable.sol) pragma solidity ^0.8.0; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To initialize the implementation contract, you can either invoke the * initializer manually, or you can include a constructor to automatically mark it as initialized when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() initializer {} * ``` * ==== */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. */ bool private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Modifier to protect an initializer function from being invoked twice. */ modifier initializer() { require(_initializing || !_initialized, "Initializable: contract is already initialized"); bool isTopLevelCall = !_initializing; if (isTopLevelCall) { _initializing = true; _initialized = true; } _; if (isTopLevelCall) { _initializing = false; } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (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 initializer { __Context_init_unchained(); __Pausable_init_unchained(); } function __Pausable_init_unchained() internal initializer { _paused = false; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { require(!paused(), "Pausable: paused"); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { require(paused(), "Pausable: not paused"); _; } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } uint256[49] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.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 initializer { __Context_init_unchained(); __ERC20_init_unchained(name_, symbol_); } function __ERC20_init_unchained(string memory name_, string memory symbol_) internal initializer { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overridden; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom( address sender, address recipient, uint256 amount ) public virtual override returns (bool) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); unchecked { _approve(sender, _msgSender(), currentAllowance - amount); } return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(_msgSender(), spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `sender` to `recipient`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer( address sender, address recipient, uint256 amount ) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance"); unchecked { _balances[sender] = senderBalance - amount; } _balances[recipient] += amount; emit Transfer(sender, recipient, amount); _afterTokenTransfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); _afterTokenTransfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); unchecked { _balances[account] = accountBalance - amount; } _totalSupply -= amount; emit Transfer(account, address(0), amount); _afterTokenTransfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve( address owner, address spender, uint256 amount ) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * has been transferred to `to`. * - when `from` is zero, `amount` tokens have been minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens have been burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 amount ) internal virtual {} uint256[45] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.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 `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.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 initializer { __Context_init_unchained(); __ERC20Burnable_init_unchained(); } function __ERC20Burnable_init_unchained() internal initializer { } /** * @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 { uint256 currentAllowance = allowance(account, _msgSender()); require(currentAllowance >= amount, "ERC20: burn amount exceeds allowance"); unchecked { _approve(account, _msgSender(), currentAllowance - amount); } _burn(account, amount); } uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (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 initializer { __Context_init_unchained(); __Pausable_init_unchained(); __ERC20Pausable_init_unchained(); } function __ERC20Pausable_init_unchained() internal initializer { } /** * @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"); } uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.0; import "../IERC20Upgradeable.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20MetadataUpgradeable is IERC20Upgradeable { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.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. */ 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 initializer { __Context_init_unchained(); __ERC165_init_unchained(); __AccessControl_init_unchained(); __AccessControlEnumerable_init_unchained(); __ERC20_init_unchained(name, symbol); __ERC20Burnable_init_unchained(); __Pausable_init_unchained(); __ERC20Pausable_init_unchained(); __ERC20PresetMinterPauser_init_unchained(name, symbol); } function __ERC20PresetMinterPauser_init_unchained(string memory name, string memory symbol) internal initializer { _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); } uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (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 initializer { __Context_init_unchained(); } function __Context_init_unchained() internal initializer { } function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (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.0 (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 initializer { __ERC165_init_unchained(); } function __ERC165_init_unchained() internal initializer { } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165Upgradeable).interfaceId; } uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (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.0 (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.0 (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev 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.0 (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.0 (security/Pausable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract Pausable is Context { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ constructor() { _paused = false; } /** * @dev 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()); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (utils/Address.sol) pragma solidity ^0.8.0; /** * @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 * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev 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.0 (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.0 (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.0 (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; /** . . .'. .'. .;:. .;:. .:o:. .;l:. .:dd, ,od:. .:dxo' .lxd:. .:dkxc. .:xkd:. .:dkkx:. .;dkkd:. .ckkkkxl:,'.. ..':dkkkkl. 'codxxkkkxxdol, .,cldxkkkxdoc, ..',;coxkkkl. .;dxkxdol:;'.. .cxkxl. ;dkxl,.. .:xxxc. .cxxd' ;dxd:. ;c,. .:dxo' .lddc. .cdoc. 'odd:. .loo;. .clol' .;ool, .:loc,. ..'. .:loc' .,cllc;'. .;llc' .';cccc:'. .;cc:. ..,;::;' .;::;. .';::,. .;:;. .,;;,. .;;;. .,,,'.. .,,,'. ..',,,'.. ..'','. ...'''''.....'''... ............ DOPEX SINGLE STAKING OPTION VAULT Mints covered calls while farming yield on single sided rDPX staking farm */ // Libraries import {Strings} from '@openzeppelin/contracts/utils/Strings.sol'; import {Clones} from '@openzeppelin/contracts/proxy/Clones.sol'; import {BokkyPooBahsDateTimeLibrary} from '../../external/libraries/BokkyPooBahsDateTimeLibrary.sol'; import {SafeERC20} from '../../external/libraries/SafeERC20.sol'; // Contracts import {ERC20PresetMinterPauserUpgradeable} from '@openzeppelin/contracts-upgradeable/token/ERC20/presets/ERC20PresetMinterPauserUpgradeable.sol'; import {Pausable} from '@openzeppelin/contracts/security/Pausable.sol'; import {ContractWhitelist} from '../../helper/ContractWhitelist.sol'; // Interfaces import {IERC20} from '../../external/interfaces/IERC20.sol'; import {IVolatilityOracle} from '../../interfaces/IVolatilityOracle.sol'; import {IOptionPricing} from '../../interfaces/IOptionPricing.sol'; import {IERC20SSOV} from '../../interfaces/IERC20SSOV.sol'; import {IFeeStrategy} from '../../fees/IFeeStrategy.sol'; interface IPriceOracle { function getPriceInUSD() external view returns (uint256); } contract RdpxSSOVV2 is ContractWhitelist, Pausable, IERC20SSOV { using BokkyPooBahsDateTimeLibrary for uint256; using Strings for uint256; using SafeERC20 for IERC20; /// @dev ERC20PresetMinterPauserUpgradeable implementation address address public immutable erc20Implementation; /// @dev Current epoch for ssov uint256 public currentEpoch; /// @dev Expire delay tolerance uint256 public expireDelayTolerance = 5 minutes; /// @dev The list of contract addresses the contract uses mapping(bytes32 => address) public addresses; /// @dev epoch => the epoch start time mapping(uint256 => uint256) public epochStartTimes; /// @notice Is epoch expired /// @dev epoch => whether the epoch is expired mapping(uint256 => bool) public isEpochExpired; /// @notice Is vault ready for next epoch /// @dev epoch => whether the vault is ready (boostrapped) mapping(uint256 => bool) public isVaultReady; /// @dev Mapping of strikes for each epoch mapping(uint256 => uint256[]) public epochStrikes; /// @dev Mapping of (epoch => (strike => tokens)) mapping(uint256 => mapping(uint256 => address)) public epochStrikeTokens; /// @notice Total epoch deposits for specific strikes /// @dev mapping (epoch => (strike => deposits)) mapping(uint256 => mapping(uint256 => uint256)) public totalEpochStrikeDeposits; /// @notice Total epoch deposits across all strikes /// @dev mapping (epoch => deposits) mapping(uint256 => uint256) public totalEpochDeposits; /// @notice Total epoch deposits across all strikes including premiums and rewards /// @dev mapping (epoch => deposits) mapping(uint256 => uint256) public totalEpochBalance; /// @notice Epoch deposits by user for each strike /// @dev mapping (epoch => (abi.encodePacked(user, strike) => user deposits)) mapping(uint256 => mapping(bytes32 => uint256)) public userEpochDeposits; /// @notice Epoch rDPX balance per strike after accounting for rewards /// @dev mapping (epoch => (strike => balance)) mapping(uint256 => mapping(uint256 => uint256)) public totalEpochStrikeRdpxBalance; // Calls purchased for each strike in an epoch /// @dev mapping (epoch => (strike => calls purchased)) mapping(uint256 => mapping(uint256 => uint256)) public totalEpochCallsPurchased; /// @notice Calls purchased by user for each strike /// @dev mapping (epoch => (abi.encodePacked(user, strike) => user calls purchased)) mapping(uint256 => mapping(bytes32 => uint256)) public userEpochCallsPurchased; /// @notice Premium collected per strike for an epoch /// @dev mapping (epoch => (strike => premium)) mapping(uint256 => mapping(uint256 => uint256)) public totalEpochPremium; /// @notice User premium collected per strike for an epoch /// @dev mapping (epoch => (abi.encodePacked(user, strike) => user premium)) mapping(uint256 => mapping(bytes32 => uint256)) public userEpochPremium; /// @dev epoch => settlement price mapping(uint256 => uint256) public settlementPrices; /*==== EVENTS ====*/ event ExpireDelayToleranceUpdate(uint256 expireDelayTolerance); event AddressSet(bytes32 indexed name, address indexed destination); event EmergencyWithdraw(address sender); event NewStrike(uint256 epoch, uint256 strike); event Bootstrap(uint256 epoch); event NewDeposit( uint256 epoch, uint256 strike, uint256 amount, address user, address sender ); event NewPurchase( uint256 epoch, uint256 strike, uint256 amount, uint256 premium, uint256 fee, address user, address sender ); event NewSettle( uint256 epoch, uint256 strike, address user, uint256 amount, uint256 pnl ); event Compound( uint256 epoch, uint256 rewards, uint256 oldBalance, uint256 newBalance ); event NewWithdraw( uint256 epoch, uint256 strike, address user, uint256 amount, uint256 rdpxAmount ); /*==== CONSTRUCTOR ====*/ constructor( address _rdpx, address _optionPricing, address _rdpxPriceOracle, address _volatilityOracle, address _feeDistributor, address _feeStrategy ) { require(_rdpx != address(0), 'E1'); require(_optionPricing != address(0), 'E1'); require(_rdpxPriceOracle != address(0), 'E1'); require(_feeStrategy != address(0), 'E1'); addresses['FeeDistributor'] = _feeDistributor; addresses['rDPX'] = _rdpx; addresses['OptionPricing'] = _optionPricing; addresses['RdpxPriceOracle'] = _rdpxPriceOracle; addresses['VolatilityOracle'] = _volatilityOracle; addresses['FeeStrategy'] = _feeStrategy; addresses['Governance'] = msg.sender; erc20Implementation = address(new ERC20PresetMinterPauserUpgradeable()); } /*==== SETTER METHODS ====*/ /// @notice Pauses the vault for emergency cases /// @dev Can only be called by governance /// @return Whether it was successfully paused function pause() external onlyGovernance returns (bool) { _pause(); _updateFinalEpochBalances(false); return true; } /// @notice Unpauses the vault /// @dev Can only be called by governance /// @return Whether it was successfully unpaused function unpause() external onlyGovernance returns (bool) { _unpause(); return true; } /// @notice Updates the delay tolerance for the expiry epoch function /// @dev Can only be called by governance /// @return Whether it was successfully updated function updateExpireDelayTolerance(uint256 _expireDelayTolerance) external onlyGovernance returns (bool) { expireDelayTolerance = _expireDelayTolerance; emit ExpireDelayToleranceUpdate(_expireDelayTolerance); return true; } /// @notice Sets (adds) a list of addresses to the address list /// @param names Names of the contracts /// @param destinations Addresses of the contract /// @return Whether the addresses were set function setAddresses( bytes32[] calldata names, address[] calldata destinations ) external onlyOwner returns (bool) { require(names.length == destinations.length, 'E2'); for (uint256 i = 0; i < names.length; i++) { bytes32 name = names[i]; address destination = destinations[i]; addresses[name] = destination; emit AddressSet(name, destination); } return true; } /*==== METHODS ====*/ /// @notice Transfers all funds to msg.sender /// @dev Can only be called by governance /// @param tokens The list of erc20 tokens to withdraw /// @param transferNative Whether should transfer the native currency /// @return Whether emergency withdraw was successful function emergencyWithdraw(address[] calldata tokens, bool transferNative) external onlyGovernance whenPaused returns (bool) { if (transferNative) payable(msg.sender).transfer(address(this).balance); for (uint256 i = 0; i < tokens.length; i++) { IERC20 token = IERC20(tokens[i]); token.safeTransfer(msg.sender, token.balanceOf(address(this))); } emit EmergencyWithdraw(msg.sender); return true; } /// @notice Sets the current epoch as expired. /// @return Whether expire was successful function expireEpoch() external whenNotPaused isEligibleSender returns (bool) { require(!isEpochExpired[currentEpoch], 'E3'); (, uint256 epochExpiry) = getEpochTimes(currentEpoch); require((block.timestamp >= epochExpiry), 'E4'); require(block.timestamp <= epochExpiry + expireDelayTolerance, 'E23'); settlementPrices[currentEpoch] = getUsdPrice(); _updateFinalEpochBalances(true); isEpochExpired[currentEpoch] = true; return true; } /// @notice Sets the current epoch as expired. /// @return Whether expire was successful function expireEpoch(uint256 settlementPrice) external onlyGovernance whenNotPaused returns (bool) { require(!isEpochExpired[currentEpoch], 'E3'); (, uint256 epochExpiry) = getEpochTimes(currentEpoch); require((block.timestamp > epochExpiry + expireDelayTolerance), 'E4'); settlementPrices[currentEpoch] = settlementPrice; _updateFinalEpochBalances(true); isEpochExpired[currentEpoch] = true; return true; } /// @dev Updates the final epoch rDPX balances per strike of the vault /// @param accountPremiums Should the fn account for premiums function _updateFinalEpochBalances(bool accountPremiums) internal { if (totalEpochBalance[currentEpoch] > 0) { uint256[] memory strikes = epochStrikes[currentEpoch]; for (uint256 i = 0; i < strikes.length; i++) { // PnL from ssov option settlements uint256 settlement = calculatePnl( settlementPrices[currentEpoch], strikes[i], totalEpochCallsPurchased[currentEpoch][strikes[i]] ); // Update final rdpx balance for epoch and strike totalEpochStrikeRdpxBalance[currentEpoch][strikes[i]] += totalEpochStrikeDeposits[currentEpoch][strikes[i]] - settlement; if (accountPremiums) { totalEpochStrikeRdpxBalance[currentEpoch][ strikes[i] ] += totalEpochPremium[currentEpoch][strikes[i]]; } } } } /** * @notice Bootstraps a new epoch and mints option tokens equivalent to user deposits for the epoch * @return Whether bootstrap was successful */ function bootstrap() external onlyOwner whenNotPaused returns (bool) { uint256 nextEpoch = currentEpoch + 1; require(!isVaultReady[nextEpoch], 'E5'); require(epochStrikes[nextEpoch].length > 0, 'E6'); if (currentEpoch > 0) { // Previous epoch must be expired require(isEpochExpired[currentEpoch], 'E7'); } for (uint256 i = 0; i < epochStrikes[nextEpoch].length; i++) { uint256 strike = epochStrikes[nextEpoch][i]; string memory name = concatenate('rDPX-CALL', strike.toString()); name = concatenate(name, '-EPOCH-'); name = concatenate(name, (nextEpoch).toString()); // Create doTokens representing calls for selected strike in epoch ERC20PresetMinterPauserUpgradeable _erc20 = ERC20PresetMinterPauserUpgradeable( Clones.clone(erc20Implementation) ); _erc20.initialize(name, name); epochStrikeTokens[nextEpoch][strike] = address(_erc20); // Mint tokens equivalent to deposits for strike in epoch _erc20.mint( address(this), totalEpochStrikeDeposits[nextEpoch][strike] ); } // Mark vault as ready for epoch isVaultReady[nextEpoch] = true; // Increase the current epoch currentEpoch = nextEpoch; emit Bootstrap(nextEpoch); return true; } /** * @notice Sets strikes for next epoch * @param strikes Strikes to set for next epoch * @return Whether strikes were set */ function setStrikes(uint256[] memory strikes) external onlyOwner whenNotPaused returns (bool) { uint256 nextEpoch = currentEpoch + 1; require(totalEpochDeposits[nextEpoch] == 0, 'E8'); if (currentEpoch > 0) { (, uint256 epochExpiry) = getEpochTimes(currentEpoch); require((block.timestamp > epochExpiry), 'E9'); } // Set the next epoch strikes epochStrikes[nextEpoch] = strikes; // Set the next epoch start time epochStartTimes[nextEpoch] = block.timestamp; for (uint256 i = 0; i < strikes.length; i++) emit NewStrike(nextEpoch, strikes[i]); return true; } /** * @notice Deposits rdpx into the ssov to mint options in the next epoch for selected strikes * @param strikeIndex Index of strike * @param amount Amout of rDPX to deposit * @param user Address of the user to deposit for * @return Whether deposit was successful */ function deposit( uint256 strikeIndex, uint256 amount, address user ) public whenNotPaused isEligibleSender returns (bool) { uint256 nextEpoch = currentEpoch + 1; if (currentEpoch > 0) { require( isEpochExpired[currentEpoch] && !isVaultReady[nextEpoch], 'E19' ); } require(strikeIndex < epochStrikes[nextEpoch].length, 'E10'); require(amount > 0, 'E11'); uint256 strike = epochStrikes[nextEpoch][strikeIndex]; require(strike != 0, 'E12'); bytes32 userStrike = keccak256(abi.encodePacked(user, strike)); // Transfer rDPX from msg.sender (maybe different from user param) to ssov IERC20(getAddress('rDPX')).safeTransferFrom( msg.sender, address(this), amount ); // Add to user epoch deposits userEpochDeposits[nextEpoch][userStrike] += amount; // Add to total epoch strike deposits totalEpochStrikeDeposits[nextEpoch][strike] += amount; // Add to total epoch deposits totalEpochDeposits[nextEpoch] += amount; // Add to total epoch deposits totalEpochBalance[nextEpoch] += amount; emit NewDeposit(nextEpoch, strike, amount, user, msg.sender); return true; } /** * @notice Deposit rDPX multiple times * @param strikeIndices Indices of strikes to deposit into * @param amounts Amount of rDPX to deposit into each strike index * @param user Address of the user to deposit for * @return Whether deposits went through successfully */ function depositMultiple( uint256[] memory strikeIndices, uint256[] memory amounts, address user ) external whenNotPaused returns (bool) { require(strikeIndices.length == amounts.length, 'E2'); for (uint256 i = 0; i < strikeIndices.length; i++) deposit(strikeIndices[i], amounts[i], user); return true; } /** * @notice Purchases calls for the current epoch * @param strikeIndex Strike index for current epoch * @param amount Amount of calls to purchase * @param user User to purchase options for * @return Whether purchase was successful */ function purchase( uint256 strikeIndex, uint256 amount, address user ) external whenNotPaused isEligibleSender returns (uint256, uint256) { require(isVaultReady[currentEpoch], 'E20'); require(strikeIndex < epochStrikes[currentEpoch].length, 'E10'); require(amount > 0, 'E11'); uint256 strike = epochStrikes[currentEpoch][strikeIndex]; require(strike != 0, 'E12'); bytes32 userStrike = keccak256(abi.encodePacked(user, strike)); address rdpx = getAddress('rDPX'); uint256 currentPrice = getUsdPrice(); // Get total premium for all calls being purchased uint256 premium = calculatePremium(strike, amount); // Total fee charged uint256 totalFee = calculatePurchaseFees(currentPrice, strike, amount); // Add to total epoch calls purchased totalEpochCallsPurchased[currentEpoch][strike] += amount; // Add to user epoch calls purchased userEpochCallsPurchased[currentEpoch][userStrike] += amount; // Add to total epoch premium totalEpochPremium[currentEpoch][strike] += premium; // Add to user epoch premium // Add to user epoch premium userEpochPremium[currentEpoch][userStrike] += premium; // Add to total epoch balance premium totalEpochBalance[currentEpoch] += premium; // Transfer premium from msg.sender (need not be same as user) IERC20(rdpx).safeTransferFrom( msg.sender, address(this), premium + totalFee ); if (totalFee > 0) { // Transfer fee to FeeDistributor IERC20(rdpx).safeTransfer(getAddress('FeeDistributor'), totalFee); } // Transfer doTokens to user IERC20(epochStrikeTokens[currentEpoch][strike]).safeTransfer( user, amount ); emit NewPurchase( currentEpoch, strike, amount, premium, totalFee, user, msg.sender ); return (premium, totalFee); } /** * @notice Settle calculates the PnL for the user and withdraws the PnL in rDPX to the user. Will also the burn the option tokens from the user. * @param strikeIndex Strike index * @param amount Amount of options * @param epoch Epoch * @return pnl */ function settle( uint256 strikeIndex, uint256 amount, uint256 epoch ) external whenNotPaused isEligibleSender returns (uint256 pnl) { require(isEpochExpired[epoch], 'E17'); require(strikeIndex < epochStrikes[epoch].length, 'E10'); require(amount > 0, 'E11'); uint256 strike = epochStrikes[epoch][strikeIndex]; require(strike != 0, 'E12'); require( IERC20(epochStrikeTokens[epoch][strike]).balanceOf(msg.sender) >= amount, 'E16' ); // Calculate PnL (in rDPX) pnl = calculatePnl(settlementPrices[epoch], strike, amount); // Total fee charged uint256 totalFee = calculateSettlementFees( settlementPrices[epoch], pnl, amount ); IERC20 rdpx = IERC20(getAddress('rDPX')); require(pnl > 0, 'E15'); // Burn user option tokens ERC20PresetMinterPauserUpgradeable(epochStrikeTokens[epoch][strike]) .burnFrom(msg.sender, amount); if (totalFee > 0) { // Transfer fee to FeeDistributor rdpx.safeTransfer(getAddress('FeeDistributor'), totalFee); } // Transfer PnL to user rdpx.safeTransfer(msg.sender, pnl - totalFee); emit NewSettle(epoch, strike, msg.sender, amount, pnl); } /** * @notice Withdraws balances for a strike in a completed epoch * @param withdrawEpoch Epoch to withdraw from * @param strikeIndex Index of strike * @return rDPX withdrawn */ function withdraw(uint256 withdrawEpoch, uint256 strikeIndex) external whenNotPaused isEligibleSender returns (uint256[1] memory) { require(isEpochExpired[withdrawEpoch], 'E17'); require(strikeIndex < epochStrikes[withdrawEpoch].length, 'E10'); uint256 strike = epochStrikes[withdrawEpoch][strikeIndex]; require(strike != 0, 'E12'); bytes32 userStrike = keccak256(abi.encodePacked(msg.sender, strike)); uint256 userStrikeDeposits = userEpochDeposits[withdrawEpoch][ userStrike ]; require(userStrikeDeposits > 0, 'E18'); address rdpx = getAddress('rDPX'); // Transfer rDPX tokens to user uint256 userRdpxAmount = (totalEpochStrikeRdpxBalance[withdrawEpoch][ strike ] * userStrikeDeposits) / totalEpochStrikeDeposits[withdrawEpoch][strike]; userEpochDeposits[withdrawEpoch][userStrike] = 0; IERC20(rdpx).safeTransfer(msg.sender, userRdpxAmount); emit NewWithdraw( withdrawEpoch, strike, msg.sender, userStrikeDeposits, userRdpxAmount ); return [userRdpxAmount]; } /*==== PURE FUNCTIONS ====*/ /// @notice Calculates the monthly expiry from a solidity date /// @param timestamp Timestamp from which the monthly expiry is to be calculated /// @return The monthly expiry function getMonthlyExpiryFromTimestamp(uint256 timestamp) public pure returns (uint256) { uint256 lastDay = BokkyPooBahsDateTimeLibrary.timestampFromDate( timestamp.getYear(), timestamp.getMonth() + 1, 0 ); if (lastDay.getDayOfWeek() < 5) { lastDay = BokkyPooBahsDateTimeLibrary.timestampFromDate( lastDay.getYear(), lastDay.getMonth(), lastDay.getDay() - 7 ); } uint256 lastFridayOfMonth = BokkyPooBahsDateTimeLibrary .timestampFromDateTime( lastDay.getYear(), lastDay.getMonth(), lastDay.getDay() + 5 - lastDay.getDayOfWeek(), 8, 0, 0 ); if (lastFridayOfMonth <= timestamp) { uint256 temp = BokkyPooBahsDateTimeLibrary.timestampFromDate( timestamp.getYear(), timestamp.getMonth() + 2, 0 ); if (temp.getDayOfWeek() < 5) { temp = BokkyPooBahsDateTimeLibrary.timestampFromDate( temp.getYear(), temp.getMonth(), temp.getDay() - 7 ); } lastFridayOfMonth = BokkyPooBahsDateTimeLibrary .timestampFromDateTime( temp.getYear(), temp.getMonth(), temp.getDay() + 5 - temp.getDayOfWeek(), 8, 0, 0 ); } return lastFridayOfMonth; } /** * @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)); } /// @notice Calculate Pnl /// @param price price of rDPX /// @param strike strike price of the the rDPX option /// @param amount amount of options function calculatePnl( uint256 price, uint256 strike, uint256 amount ) public pure returns (uint256) { return price > strike ? (((price - strike) * amount) / price) : 0; } /*==== VIEWS ====*/ /// @notice Calculate premium for an option /// @param _strike Strike price of the option /// @param _amount Amount of options function calculatePremium(uint256 _strike, uint256 _amount) public view returns (uint256 premium) { uint256 currentPrice = getUsdPrice(); premium = (IOptionPricing(getAddress('OptionPricing')).getOptionPrice( false, getMonthlyExpiryFromTimestamp(block.timestamp), _strike, currentPrice, IVolatilityOracle(getAddress('VolatilityOracle')).getVolatility() ) * _amount) / currentPrice; } /// @notice Calculate Fees for purchase /// @param price price of rDPX /// @param strike strike price of the the rDPX option /// @param amount amount of options being bought function calculatePurchaseFees( uint256 price, uint256 strike, uint256 amount ) public view returns (uint256) { return IFeeStrategy(getAddress('FeeStrategy')).calculatePurchaseFees( price, strike, amount ); } /// @notice Calculate Fees for settlement /// @param settlementPrice settlement price of rDPX /// @param pnl total pnl /// @param amount amount of options being settled function calculateSettlementFees( uint256 settlementPrice, uint256 pnl, uint256 amount ) public view returns (uint256) { return IFeeStrategy(getAddress('FeeStrategy')).calculateSettlementFees( settlementPrice, pnl, amount ); } /** * @notice Returns start and end times for an epoch * @param epoch Target epoch */ function getEpochTimes(uint256 epoch) public view epochGreaterThanZero(epoch) returns (uint256 start, uint256 end) { return ( epochStartTimes[epoch], getMonthlyExpiryFromTimestamp(epochStartTimes[epoch]) ); } /** * @notice Returns epoch strikes array for an epoch * @param epoch Target epoch */ function getEpochStrikes(uint256 epoch) external view epochGreaterThanZero(epoch) returns (uint256[] memory) { return epochStrikes[epoch]; } /** * Returns epoch strike tokens array for an epoch * @param epoch Target epoch */ function getEpochStrikeTokens(uint256 epoch) external view epochGreaterThanZero(epoch) returns (address[] memory) { uint256 length = epochStrikes[epoch].length; address[] memory _epochStrikeTokens = new address[](length); for (uint256 i = 0; i < length; i++) { _epochStrikeTokens[i] = epochStrikeTokens[epoch][ epochStrikes[epoch][i] ]; } return _epochStrikeTokens; } /** * @notice Returns total epoch strike deposits array for an epoch * @param epoch Target epoch */ function getTotalEpochStrikeDeposits(uint256 epoch) external view epochGreaterThanZero(epoch) returns (uint256[] memory) { uint256 length = epochStrikes[epoch].length; uint256[] memory _totalEpochStrikeDeposits = new uint256[](length); for (uint256 i = 0; i < length; i++) { _totalEpochStrikeDeposits[i] = totalEpochStrikeDeposits[epoch][ epochStrikes[epoch][i] ]; } return _totalEpochStrikeDeposits; } /** * @notice Returns user epoch deposits array for an epoch * @param epoch Target epoch * @param user Address of the user */ function getUserEpochDeposits(uint256 epoch, address user) external view epochGreaterThanZero(epoch) returns (uint256[] memory) { uint256 length = epochStrikes[epoch].length; uint256[] memory _userEpochDeposits = new uint256[](length); for (uint256 i = 0; i < length; i++) { uint256 strike = epochStrikes[epoch][i]; bytes32 userStrike = keccak256(abi.encodePacked(user, strike)); _userEpochDeposits[i] = userEpochDeposits[epoch][userStrike]; } return _userEpochDeposits; } /** * @notice Returns total epoch calls purchased array for an epoch * @param epoch Target epoch */ function getTotalEpochCallsPurchased(uint256 epoch) external view epochGreaterThanZero(epoch) returns (uint256[] memory) { uint256 length = epochStrikes[epoch].length; uint256[] memory _totalEpochCallsPurchased = new uint256[](length); for (uint256 i = 0; i < length; i++) { _totalEpochCallsPurchased[i] = totalEpochCallsPurchased[epoch][ epochStrikes[epoch][i] ]; } return _totalEpochCallsPurchased; } /** * @notice Returns user epoch calls purchased array for an epoch * @param epoch Target epoch * @param user Address of the user */ function getUserEpochCallsPurchased(uint256 epoch, address user) external view epochGreaterThanZero(epoch) returns (uint256[] memory) { uint256 length = epochStrikes[epoch].length; uint256[] memory _userEpochCallsPurchased = new uint256[](length); for (uint256 i = 0; i < length; i++) { uint256 strike = epochStrikes[epoch][i]; bytes32 userStrike = keccak256(abi.encodePacked(user, strike)); _userEpochCallsPurchased[i] = userEpochCallsPurchased[epoch][ userStrike ]; } return _userEpochCallsPurchased; } /** * @notice Returns total epoch premium array for an epoch * @param epoch Target epoch */ function getTotalEpochPremium(uint256 epoch) external view epochGreaterThanZero(epoch) returns (uint256[] memory) { uint256 length = epochStrikes[epoch].length; uint256[] memory _totalEpochPremium = new uint256[](length); for (uint256 i = 0; i < length; i++) { _totalEpochPremium[i] = totalEpochPremium[epoch][ epochStrikes[epoch][i] ]; } return _totalEpochPremium; } /** * @notice Returns user epoch premium array for an epoch * @param epoch Target epoch * @param user Address of the user */ function getUserEpochPremium(uint256 epoch, address user) external view epochGreaterThanZero(epoch) returns (uint256[] memory) { uint256 length = epochStrikes[epoch].length; uint256[] memory _userEpochPremium = new uint256[](length); for (uint256 i = 0; i < length; i++) { uint256 strike = epochStrikes[epoch][i]; bytes32 userStrike = keccak256(abi.encodePacked(user, strike)); _userEpochPremium[i] = userEpochPremium[epoch][userStrike]; } return _userEpochPremium; } /** * @notice Returns rDPX price in USD */ function getUsdPrice() public view returns (uint256) { return IPriceOracle(getAddress('RdpxPriceOracle')).getPriceInUSD(); } /** * @notice Gets the address of a set contract * @param name Name of the contract * @return The address of the contract */ function getAddress(bytes32 name) public view returns (address) { return addresses[name]; } /*==== MODIFIERS ====*/ modifier onlyGovernance() { require(msg.sender == getAddress('Governance'), 'E22'); _; } modifier epochGreaterThanZero(uint256 epoch) { require(epoch > 0, 'E13'); _; } } // ERROR MAPPING: // { // "E1": "SSOV: Address cannot be a zero address", // "E2": "SSOV: Input lengths must match", // "E3": "SSOV: Epoch must not be expired", // "E4": "SSOV: Cannot expire epoch before epoch's expiry", // "E5": "SSOV: Already bootstrapped", // "E6": "SSOV: Strikes have not been set for next epoch", // "E7": "SSOV: Previous epoch has not expired", // "E8": "SSOV: Deposit already started", // "E9": "SSOV: Cannot set next strikes before current epoch's expiry", // "E10": "SSOV: Invalid strike index", // "E11": "SSOV: Invalid amount", // "E12": "SSOV: Invalid strike", // "E13": "SSOV: Epoch passed must be greater than 0", // "E14": "SSOV: Option must be in exercise window", // "E15": "SSOV: Strike is higher than current price", // "E16": "SSOV: Option token balance is not enough", // "E17": "SSOV: Epoch must be expired", // "E18": "SSOV: User strike deposit amount must be greater than zero", // "E19": "SSOV: Deposit is only available between epochs", // "E20": "SSOV: Not bootstrapped", // "E21": "SSOV: Can not call function in exercise window", // "E22": "SSOV: Caller is not governance" // }
// 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: UNLICENSED pragma solidity ^0.8.0; // ---------------------------------------------------------------------------- // BokkyPooBah's DateTime Library v1.01 // // A gas-efficient Solidity date and time library // // https://github.com/bokkypoobah/BokkyPooBahsDateTimeLibrary // // Tested date range 1970/01/01 to 2345/12/31 // // Conventions: // Unit | Range | Notes // :-------- |:-------------:|:----- // timestamp | >= 0 | Unix timestamp, number of seconds since 1970/01/01 00:00:00 UTC // year | 1970 ... 2345 | // month | 1 ... 12 | // day | 1 ... 31 | // hour | 0 ... 23 | // minute | 0 ... 59 | // second | 0 ... 59 | // dayOfWeek | 1 ... 7 | 1 = Monday, ..., 7 = Sunday // // // Enjoy. (c) BokkyPooBah / Bok Consulting Pty Ltd 2018-2019. The MIT Licence. // ---------------------------------------------------------------------------- library BokkyPooBahsDateTimeLibrary { uint256 constant SECONDS_PER_DAY = 24 * 60 * 60; uint256 constant SECONDS_PER_HOUR = 60 * 60; uint256 constant SECONDS_PER_MINUTE = 60; int256 constant OFFSET19700101 = 2440588; uint256 constant DOW_MON = 1; uint256 constant DOW_TUE = 2; uint256 constant DOW_WED = 3; uint256 constant DOW_THU = 4; uint256 constant DOW_FRI = 5; uint256 constant DOW_SAT = 6; uint256 constant DOW_SUN = 7; // ------------------------------------------------------------------------ // Calculate the number of days from 1970/01/01 to year/month/day using // the date conversion algorithm from // http://aa.usno.navy.mil/faq/docs/JD_Formula.php // and subtracting the offset 2440588 so that 1970/01/01 is day 0 // // days = day // - 32075 // + 1461 * (year + 4800 + (month - 14) / 12) / 4 // + 367 * (month - 2 - (month - 14) / 12 * 12) / 12 // - 3 * ((year + 4900 + (month - 14) / 12) / 100) / 4 // - offset // ------------------------------------------------------------------------ function _daysFromDate( uint256 year, uint256 month, uint256 day ) internal pure returns (uint256 _days) { require(year >= 1970); int256 _year = int256(year); int256 _month = int256(month); int256 _day = int256(day); int256 __days = _day - 32075 + (1461 * (_year + 4800 + (_month - 14) / 12)) / 4 + (367 * (_month - 2 - ((_month - 14) / 12) * 12)) / 12 - (3 * ((_year + 4900 + (_month - 14) / 12) / 100)) / 4 - OFFSET19700101; _days = uint256(__days); } // ------------------------------------------------------------------------ // Calculate year/month/day from the number of days since 1970/01/01 using // the date conversion algorithm from // http://aa.usno.navy.mil/faq/docs/JD_Formula.php // and adding the offset 2440588 so that 1970/01/01 is day 0 // // int L = days + 68569 + offset // int N = 4 * L / 146097 // L = L - (146097 * N + 3) / 4 // year = 4000 * (L + 1) / 1461001 // L = L - 1461 * year / 4 + 31 // month = 80 * L / 2447 // dd = L - 2447 * month / 80 // L = month / 11 // month = month + 2 - 12 * L // year = 100 * (N - 49) + year + L // ------------------------------------------------------------------------ function _daysToDate(uint256 _days) internal pure returns ( uint256 year, uint256 month, uint256 day ) { int256 __days = int256(_days); int256 L = __days + 68569 + OFFSET19700101; int256 N = (4 * L) / 146097; L = L - (146097 * N + 3) / 4; int256 _year = (4000 * (L + 1)) / 1461001; L = L - (1461 * _year) / 4 + 31; int256 _month = (80 * L) / 2447; int256 _day = L - (2447 * _month) / 80; L = _month / 11; _month = _month + 2 - 12 * L; _year = 100 * (N - 49) + _year + L; year = uint256(_year); month = uint256(_month); day = uint256(_day); } function timestampFromDate( uint256 year, uint256 month, uint256 day ) internal pure returns (uint256 timestamp) { timestamp = _daysFromDate(year, month, day) * SECONDS_PER_DAY; } function timestampFromDateTime( uint256 year, uint256 month, uint256 day, uint256 hour, uint256 minute, uint256 second ) internal pure returns (uint256 timestamp) { timestamp = _daysFromDate(year, month, day) * SECONDS_PER_DAY + hour * SECONDS_PER_HOUR + minute * SECONDS_PER_MINUTE + second; } function timestampToDate(uint256 timestamp) internal pure returns ( uint256 year, uint256 month, uint256 day ) { (year, month, day) = _daysToDate(timestamp / SECONDS_PER_DAY); } function timestampToDateTime(uint256 timestamp) internal pure returns ( uint256 year, uint256 month, uint256 day, uint256 hour, uint256 minute, uint256 second ) { (year, month, day) = _daysToDate(timestamp / SECONDS_PER_DAY); uint256 secs = timestamp % SECONDS_PER_DAY; hour = secs / SECONDS_PER_HOUR; secs = secs % SECONDS_PER_HOUR; minute = secs / SECONDS_PER_MINUTE; second = secs % SECONDS_PER_MINUTE; } function isValidDate( uint256 year, uint256 month, uint256 day ) internal pure returns (bool valid) { if (year >= 1970 && month > 0 && month <= 12) { uint256 daysInMonth = _getDaysInMonth(year, month); if (day > 0 && day <= daysInMonth) { valid = true; } } } function isValidDateTime( uint256 year, uint256 month, uint256 day, uint256 hour, uint256 minute, uint256 second ) internal pure returns (bool valid) { if (isValidDate(year, month, day)) { if (hour < 24 && minute < 60 && second < 60) { valid = true; } } } function isLeapYear(uint256 timestamp) internal pure returns (bool leapYear) { (uint256 year, , ) = _daysToDate(timestamp / SECONDS_PER_DAY); leapYear = _isLeapYear(year); } function _isLeapYear(uint256 year) internal pure returns (bool leapYear) { leapYear = ((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0); } function isWeekDay(uint256 timestamp) internal pure returns (bool weekDay) { weekDay = getDayOfWeek(timestamp) <= DOW_FRI; } function isWeekEnd(uint256 timestamp) internal pure returns (bool weekEnd) { weekEnd = getDayOfWeek(timestamp) >= DOW_SAT; } function getDaysInMonth(uint256 timestamp) internal pure returns (uint256 daysInMonth) { (uint256 year, uint256 month, ) = _daysToDate(timestamp / SECONDS_PER_DAY); daysInMonth = _getDaysInMonth(year, month); } function _getDaysInMonth(uint256 year, uint256 month) internal pure returns (uint256 daysInMonth) { if ( month == 1 || month == 3 || month == 5 || month == 7 || month == 8 || month == 10 || month == 12 ) { daysInMonth = 31; } else if (month != 2) { daysInMonth = 30; } else { daysInMonth = _isLeapYear(year) ? 29 : 28; } } // 1 = Monday, 7 = Sunday function getDayOfWeek(uint256 timestamp) internal pure returns (uint256 dayOfWeek) { uint256 _days = timestamp / SECONDS_PER_DAY; dayOfWeek = ((_days + 3) % 7) + 1; } // 1 = Monday, 7 = Sunday function getDayOfWeek(uint256 timestamp, uint256 index) internal pure returns (uint256 dayOfWeek) { uint256 _days = timestamp / SECONDS_PER_DAY; dayOfWeek = ((_days + index) % 7) + 1; } function getYear(uint256 timestamp) internal pure returns (uint256 year) { (year, , ) = _daysToDate(timestamp / SECONDS_PER_DAY); } function getMonth(uint256 timestamp) internal pure returns (uint256 month) { (, month, ) = _daysToDate(timestamp / SECONDS_PER_DAY); } function getDay(uint256 timestamp) internal pure returns (uint256 day) { (, , day) = _daysToDate(timestamp / SECONDS_PER_DAY); } function getHour(uint256 timestamp) internal pure returns (uint256 hour) { uint256 secs = timestamp % SECONDS_PER_DAY; hour = secs / SECONDS_PER_HOUR; } function getMinute(uint256 timestamp) internal pure returns (uint256 minute) { uint256 secs = timestamp % SECONDS_PER_HOUR; minute = secs / SECONDS_PER_MINUTE; } function getSecond(uint256 timestamp) internal pure returns (uint256 second) { second = timestamp % SECONDS_PER_MINUTE; } function addYears(uint256 timestamp, uint256 _years) internal pure returns (uint256 newTimestamp) { (uint256 year, uint256 month, uint256 day) = _daysToDate( timestamp / SECONDS_PER_DAY ); year += _years; uint256 daysInMonth = _getDaysInMonth(year, month); if (day > daysInMonth) { day = daysInMonth; } newTimestamp = _daysFromDate(year, month, day) * SECONDS_PER_DAY + (timestamp % SECONDS_PER_DAY); require(newTimestamp >= timestamp); } function addMonths(uint256 timestamp, uint256 _months) internal pure returns (uint256 newTimestamp) { (uint256 year, uint256 month, uint256 day) = _daysToDate( timestamp / SECONDS_PER_DAY ); month += _months; year += (month - 1) / 12; month = ((month - 1) % 12) + 1; uint256 daysInMonth = _getDaysInMonth(year, month); if (day > daysInMonth) { day = daysInMonth; } newTimestamp = _daysFromDate(year, month, day) * SECONDS_PER_DAY + (timestamp % SECONDS_PER_DAY); require(newTimestamp >= timestamp); } function addDays(uint256 timestamp, uint256 _days) internal pure returns (uint256 newTimestamp) { newTimestamp = timestamp + _days * SECONDS_PER_DAY; require(newTimestamp >= timestamp); } function addHours(uint256 timestamp, uint256 _hours) internal pure returns (uint256 newTimestamp) { newTimestamp = timestamp + _hours * SECONDS_PER_HOUR; require(newTimestamp >= timestamp); } function addMinutes(uint256 timestamp, uint256 _minutes) internal pure returns (uint256 newTimestamp) { newTimestamp = timestamp + _minutes * SECONDS_PER_MINUTE; require(newTimestamp >= timestamp); } function addSeconds(uint256 timestamp, uint256 _seconds) internal pure returns (uint256 newTimestamp) { newTimestamp = timestamp + _seconds; require(newTimestamp >= timestamp); } function subYears(uint256 timestamp, uint256 _years) internal pure returns (uint256 newTimestamp) { (uint256 year, uint256 month, uint256 day) = _daysToDate( timestamp / SECONDS_PER_DAY ); year -= _years; uint256 daysInMonth = _getDaysInMonth(year, month); if (day > daysInMonth) { day = daysInMonth; } newTimestamp = _daysFromDate(year, month, day) * SECONDS_PER_DAY + (timestamp % SECONDS_PER_DAY); require(newTimestamp <= timestamp); } function subMonths(uint256 timestamp, uint256 _months) internal pure returns (uint256 newTimestamp) { (uint256 year, uint256 month, uint256 day) = _daysToDate( timestamp / SECONDS_PER_DAY ); uint256 yearMonth = year * 12 + (month - 1) - _months; year = yearMonth / 12; month = (yearMonth % 12) + 1; uint256 daysInMonth = _getDaysInMonth(year, month); if (day > daysInMonth) { day = daysInMonth; } newTimestamp = _daysFromDate(year, month, day) * SECONDS_PER_DAY + (timestamp % SECONDS_PER_DAY); require(newTimestamp <= timestamp); } function subDays(uint256 timestamp, uint256 _days) internal pure returns (uint256 newTimestamp) { newTimestamp = timestamp - _days * SECONDS_PER_DAY; require(newTimestamp <= timestamp); } function subHours(uint256 timestamp, uint256 _hours) internal pure returns (uint256 newTimestamp) { newTimestamp = timestamp - _hours * SECONDS_PER_HOUR; require(newTimestamp <= timestamp); } function subMinutes(uint256 timestamp, uint256 _minutes) internal pure returns (uint256 newTimestamp) { newTimestamp = timestamp - _minutes * SECONDS_PER_MINUTE; require(newTimestamp <= timestamp); } function subSeconds(uint256 timestamp, uint256 _seconds) internal pure returns (uint256 newTimestamp) { newTimestamp = timestamp - _seconds; require(newTimestamp <= timestamp); } function diffYears(uint256 fromTimestamp, uint256 toTimestamp) internal pure returns (uint256 _years) { require(fromTimestamp <= toTimestamp); (uint256 fromYear, , ) = _daysToDate(fromTimestamp / SECONDS_PER_DAY); (uint256 toYear, , ) = _daysToDate(toTimestamp / SECONDS_PER_DAY); _years = toYear - fromYear; } function diffMonths(uint256 fromTimestamp, uint256 toTimestamp) internal pure returns (uint256 _months) { require(fromTimestamp <= toTimestamp); (uint256 fromYear, uint256 fromMonth, ) = _daysToDate( fromTimestamp / SECONDS_PER_DAY ); (uint256 toYear, uint256 toMonth, ) = _daysToDate( toTimestamp / SECONDS_PER_DAY ); _months = toYear * 12 + toMonth - fromYear * 12 - fromMonth; } function diffDays(uint256 fromTimestamp, uint256 toTimestamp) internal pure returns (uint256 _days) { require(fromTimestamp <= toTimestamp); _days = (toTimestamp - fromTimestamp) / SECONDS_PER_DAY; } function diffHours(uint256 fromTimestamp, uint256 toTimestamp) internal pure returns (uint256 _hours) { require(fromTimestamp <= toTimestamp); _hours = (toTimestamp - fromTimestamp) / SECONDS_PER_HOUR; } function diffMinutes(uint256 fromTimestamp, uint256 toTimestamp) internal pure returns (uint256 _minutes) { require(fromTimestamp <= toTimestamp); _minutes = (toTimestamp - fromTimestamp) / SECONDS_PER_MINUTE; } function diffSeconds(uint256 fromTimestamp, uint256 toTimestamp) internal pure returns (uint256 _seconds) { require(fromTimestamp <= toTimestamp); _seconds = toTimestamp - fromTimestamp; } }
// 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; interface IFeeStrategy { function calculatePurchaseFees( uint256, uint256, uint256 ) external view returns (uint256); function calculateSettlementFees( uint256, uint256, uint256 ) external view returns (uint256); }
//SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; import {Ownable} from '@openzeppelin/contracts/access/Ownable.sol'; /// @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 is Ownable { /// @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 /// @return whether the contract was successfully added to the whitelist function addToContractWhitelist(address _contract) external onlyOwner returns (bool) { require( isContract(_contract), 'ContractWhitelist: Address must be a contract address' ); require( !whitelistedContracts[_contract], 'ContractWhitelist: Contract already whitelisted' ); whitelistedContracts[_contract] = true; emit AddToContractWhitelist(_contract); return true; } /// @dev remove from the contract whitelist /// @param _contract the address of the contract to remove from the contract whitelist /// @return whether the contract was successfully removed from the whitelist function removeFromContractWhitelist(address _contract) external returns (bool) { require( whitelistedContracts[_contract], 'ContractWhitelist: Contract not whitelisted' ); whitelistedContracts[_contract] = false; emit RemoveFromContractWhitelist(_contract); return true; } /* ========== MODIFIERS ========== */ // Modifier is eligible sender modifier modifier isEligibleSender() { if (isContract(msg.sender)) require( whitelistedContracts[msg.sender], 'ContractWhitelist: Contract must be whitelisted' ); _; } /*==== VIEWS ====*/ /// @dev checks for contract or eoa addresses /// @param addr the address to check /// @return 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; import {ISSOV} from './ISSOV.sol'; interface IERC20SSOV is ISSOV { function purchase( uint256 strikeIndex, uint256 amount, address user ) external returns (uint256, uint256); function deposit( uint256 strikeIndex, uint256 amount, address user ) external returns (bool); function depositMultiple( uint256[] memory strikeIndices, uint256[] memory amounts, address user ) external returns (bool); }
//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 ISSOV { function epochStrikeTokens(uint256 epoch, uint256 strike) external view returns (address); function getAddress(bytes32 name) external view returns (address); function currentEpoch() external view returns (uint256); function epochStrikes(uint256 epoch, uint256 strikeIndex) external view returns (uint256); function settle( uint256 strikeIndex, uint256 amount, uint256 epoch ) external returns (uint256); }
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; interface IVolatilityOracle { function getVolatility() external view returns (uint256); }
{ "evmVersion": "london", "libraries": {}, "metadata": { "bytecodeHash": "ipfs", "useLiteralContent": true }, "optimizer": { "enabled": true, "runs": 200 }, "remappings": [], "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
[{"inputs":[{"internalType":"address","name":"_rdpx","type":"address"},{"internalType":"address","name":"_optionPricing","type":"address"},{"internalType":"address","name":"_rdpxPriceOracle","type":"address"},{"internalType":"address","name":"_volatilityOracle","type":"address"},{"internalType":"address","name":"_feeDistributor","type":"address"},{"internalType":"address","name":"_feeStrategy","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_contract","type":"address"}],"name":"AddToContractWhitelist","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"name","type":"bytes32"},{"indexed":true,"internalType":"address","name":"destination","type":"address"}],"name":"AddressSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"epoch","type":"uint256"}],"name":"Bootstrap","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"epoch","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"rewards","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"oldBalance","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newBalance","type":"uint256"}],"name":"Compound","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"sender","type":"address"}],"name":"EmergencyWithdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"expireDelayTolerance","type":"uint256"}],"name":"ExpireDelayToleranceUpdate","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":"address","name":"user","type":"address"},{"indexed":false,"internalType":"address","name":"sender","type":"address"}],"name":"NewDeposit","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":false,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"address","name":"sender","type":"address"}],"name":"NewPurchase","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"epoch","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"strike","type":"uint256"},{"indexed":false,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"pnl","type":"uint256"}],"name":"NewSettle","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"epoch","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"strike","type":"uint256"}],"name":"NewStrike","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"epoch","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"strike","type":"uint256"},{"indexed":false,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"rdpxAmount","type":"uint256"}],"name":"NewWithdraw","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":true,"internalType":"address","name":"_contract","type":"address"}],"name":"RemoveFromContractWhitelist","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[{"internalType":"address","name":"_contract","type":"address"}],"name":"addToContractWhitelist","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"addresses","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bootstrap","outputs":[{"internalType":"bool","name":"","type":"bool"}],"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":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"_strike","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"calculatePremium","outputs":[{"internalType":"uint256","name":"premium","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"price","type":"uint256"},{"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":"settlementPrice","type":"uint256"},{"internalType":"uint256","name":"pnl","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"calculateSettlementFees","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"strikeIndices","type":"uint256[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"address","name":"user","type":"address"}],"name":"depositMultiple","outputs":[{"internalType":"bool","name":"","type":"bool"}],"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":"epochStartTimes","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"epochStrikeTokens","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"epochStrikes","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"erc20Implementation","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"expireDelayTolerance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"expireEpoch","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"settlementPrice","type":"uint256"}],"name":"expireEpoch","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"name","type":"bytes32"}],"name":"getAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"epoch","type":"uint256"}],"name":"getEpochStrikeTokens","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"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":[{"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"getMonthlyExpiryFromTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"epoch","type":"uint256"}],"name":"getTotalEpochCallsPurchased","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"epoch","type":"uint256"}],"name":"getTotalEpochPremium","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"epoch","type":"uint256"}],"name":"getTotalEpochStrikeDeposits","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getUsdPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"epoch","type":"uint256"},{"internalType":"address","name":"user","type":"address"}],"name":"getUserEpochCallsPurchased","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"epoch","type":"uint256"},{"internalType":"address","name":"user","type":"address"}],"name":"getUserEpochDeposits","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"epoch","type":"uint256"},{"internalType":"address","name":"user","type":"address"}],"name":"getUserEpochPremium","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"isContract","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"isEpochExpired","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"isVaultReady","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[{"internalType":"bool","name":"","type":"bool"}],"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":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_contract","type":"address"}],"name":"removeFromContractWhitelist","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32[]","name":"names","type":"bytes32[]"},{"internalType":"address[]","name":"destinations","type":"address[]"}],"name":"setAddresses","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"strikes","type":"uint256[]"}],"name":"setStrikes","outputs":[{"internalType":"bool","name":"","type":"bool"}],"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":"uint256","name":"","type":"uint256"}],"name":"settlementPrices","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"totalEpochBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"totalEpochCallsPurchased","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"totalEpochDeposits","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"totalEpochPremium","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"totalEpochStrikeDeposits","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"totalEpochStrikeRdpxBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_expireDelayTolerance","type":"uint256"}],"name":"updateExpireDelayTolerance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"userEpochCallsPurchased","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"userEpochDeposits","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"userEpochPremium","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"whitelistedContracts","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"withdrawEpoch","type":"uint256"},{"internalType":"uint256","name":"strikeIndex","type":"uint256"}],"name":"withdraw","outputs":[{"internalType":"uint256[1]","name":"","type":"uint256[1]"}],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60a060405261012c6004553480156200001757600080fd5b5060405162006a4238038062006a428339810160408190526200003a9162000365565b6200004533620002ea565b6002805460ff191690556001600160a01b038616620000905760405162461bcd60e51b8152602060048201526002602482015261453160f01b60448201526064015b60405180910390fd5b6001600160a01b038516620000cd5760405162461bcd60e51b8152602060048201526002602482015261453160f01b604482015260640162000087565b6001600160a01b0384166200010a5760405162461bcd60e51b8152602060048201526002602482015261453160f01b604482015260640162000087565b6001600160a01b038116620001475760405162461bcd60e51b8152602060048201526002602482015261453160f01b604482015260640162000087565b60056020527fccc88b330c22465d54da85345ca7fd42d1073ea97c5696e33432b63c081923d980546001600160a01b038085166001600160a01b0319928316179092557f76418bd9033fcb3d7cf104f4b8a0c7f3193da6e5dec806b4a1fe6a5457c27bcd80548984169083161790557fa34895bf08a03c19903f153b83bd840ec96aae5ac855d19e36ace94ce537d65080548884169083161790557f20c17b37c5ab78def72d8ce7ce366f23eec10bf6eeb6bc6d80495dfa53ea505780548784169083161790557f6c8d5cbdd8e467916e2737c29f79ca89a665f8bae1b1f2a63b3c4bff7df8a43580548684169083161790557fc1b1ed1d0373551f5ac3de995f6231e27485d5ffed3b3270cbdd6ba32f9ee87480549284169282169290921790915569476f7665726e616e636560b01b6000527fa3c20e4cfcdbe0796697a05f5cc56e3d568bc2f08a21308461ccefe56b2fecb5805490911633179055604051620002b3906200033a565b604051809103906000f080158015620002d0573d6000803e3d6000fd5b506001600160a01b031660805250620003e6945050505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b611ed68062004b6c83390190565b80516001600160a01b03811681146200036057600080fd5b919050565b60008060008060008060c087890312156200037f57600080fd5b6200038a8762000348565b95506200039a6020880162000348565b9450620003aa6040880162000348565b9350620003ba6060880162000348565b9250620003ca6080880162000348565b9150620003da60a0880162000348565b90509295509295509295565b6080516147636200040960003960008181610721015261312a01526147636000f3fe608060405234801561001057600080fd5b50600436106103825760003560e01c80638144eeba116101de578063b0f48cf71161010f578063d7e15131116100ad578063f2fde38b1161007c578063f2fde38b146108f2578063f6ac848814610905578063f72bf8fe14610918578063fb969b0a1461092b57600080fd5b8063d7e1513114610899578063e8468ee4146108b9578063ea3bd5df146108cc578063ec856816146108df57600080fd5b8063c300fd64116100e9578063c300fd641461084d578063c3d9ed3914610860578063cd653df614610873578063d3e3e3521461088657600080fd5b8063b0f48cf7146107cc578063b12daf69146107f7578063bf434b7a1461082257600080fd5b80638e143ccb1161017c5780639bbce478116101565780639bbce47814610766578063a6fe2b9e14610786578063ab2150cf146107a6578063acc3a006146107b957600080fd5b80638e143ccb14610709578063901be0411461071c57806393c82c751461074357600080fd5b806388e18e13116101b857806388e18e13146106a75780638990d045146106ba5780638da5cb5b146106e55780638dbdbe6d146106f657600080fd5b80638144eeba1461066c578063823c15121461067f5780638456cb591461069f57600080fd5b8063574cdded116102b85780636a77845411610256578063715018a611610230578063715018a614610633578063766718081461063d5780637c4b52cb146106465780637e36701f1461065957600080fd5b80636a778454146105f05780636db29f6d146106035780636f56f56f1461060b57600080fd5b806361560c991161029257806361560c991461059857806361644373146105ab5780636274d49d146105b4578063699f200f146105c757600080fd5b8063574cdded1461054f5780635ba0bee1146105625780635c975abb1461058d57600080fd5b8063344afb5f116103255780633f83b8a5116102ff5780633f83b8a5146104c5578063441a3e70146104e8578063470f4224146105085780634ab01f5b1461053c57600080fd5b8063344afb5f1461047a578063391feebb1461049a5780633f4ba83a146104bd57600080fd5b80631acf5582116103615780631acf5582146103f157806321f8a721146103f95780632807b9a8146104245780632dc96c8e1461044f57600080fd5b806212100c1461038757806315943b99146103ad57806316279055146103cd575b600080fd5b61039a610395366004613ea7565b610933565b6040519081526020015b60405180910390f35b6103c06103bb366004613ec9565b610aa7565b6040516103a49190613ee2565b6103e16103db366004613f3d565b3b151590565b60405190151581526020016103a4565b61039a610b34565b61040c610407366004613ec9565b610bc6565b6040516001600160a01b0390911681526020016103a4565b61039a610432366004613ea7565b601160209081526000928352604080842090915290825290205481565b61039a61045d366004613ea7565b600f60209081526000928352604080842090915290825290205481565b61039a610488366004613ec9565b600d6020526000908152604090205481565b6103e16104a8366004613f3d565b60016020526000908152604090205460ff1681565b6103e1610be1565b6103e16104d3366004613ec9565b60086020526000908152604090205460ff1681565b6104fb6104f6366004613ea7565b610c37565b6040516103a49190613f58565b61040c610516366004613ea7565b600a6020908152600092835260408084209091529082529020546001600160a01b031681565b6103e161054a366004613fd5565b610ebe565b61039a61055d366004614040565b610fe5565b61039a610570366004613ea7565b601360209081526000928352604080842090915290825290205481565b60025460ff166103e1565b6103c06105a636600461406c565b611399565b61039a60045481565b6103c06105c236600461406c565b6114cd565b61040c6105d5366004613ec9565b6005602052600090815260409020546001600160a01b031681565b6103c06105fe366004613ec9565b6115f7565b6103e16116f8565b61061e610619366004613ec9565b61186f565b604080519283526020830191909152016103a4565b61063b6118b5565b005b61039a60035481565b6103e16106543660046140a6565b6118eb565b61039a610667366004613ea7565b611ab6565b6103e161067a3660046141a1565b611ae7565b61069261068d366004613ec9565b611baf565b6040516103a49190614214565b6103e1611cc7565b61039a6106b5366004614040565b611d21565b61039a6106c8366004613ea7565b600e60209081526000928352604080842090915290825290205481565b6000546001600160a01b031661040c565b6103e1610704366004614255565b611d3d565b61039a610717366004613ec9565b612010565b61040c7f000000000000000000000000000000000000000000000000000000000000000081565b6103e1610751366004613ec9565b60076020526000908152604090205460ff1681565b61039a610774366004613ec9565b60146020526000908152604090205481565b61039a610794366004613ec9565b60066020526000908152604090205481565b6103e16107b4366004613ec9565b612144565b6103e16107c7366004613f3d565b6121cd565b61039a6107da366004613ea7565b601260209081526000928352604080842090915290825290205481565b61039a610805366004613ea7565b600b60209081526000928352604080842090915290825290205481565b61039a610830366004613ea7565b601060209081526000928352604080842090915290825290205481565b6103c061085b366004613ec9565b612339565b6103e161086e366004613f3d565b612431565b6103c0610881366004613ec9565b6124fb565b6103e1610894366004614281565b6125f3565b61039a6108a7366004613ec9565b600c6020526000908152604090205481565b61039a6108c7366004614040565b612796565b61061e6108da366004614255565b612838565b6103c06108ed36600461406c565b612bd6565b61063b610900366004613f3d565b612d00565b6103e1610913366004613ec9565b612d9b565b61039a610926366004614040565b612ee2565b6103e1612f38565b60008061093e610b34565b9050808361095b6c4f7074696f6e50726963696e6760981b610bc6565b6001600160a01b0316635b7b6d88600061097442612010565b89876109926f566f6c6174696c6974794f7261636c6560801b610bc6565b6001600160a01b0316633af2888b6040518163ffffffff1660e01b815260040160206040518083038186803b1580156109ca57600080fd5b505afa1580156109de573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a0291906142b5565b6040516001600160e01b031960e088901b1681529415156004860152602485019390935260448401919091526064830152608482015260a40160206040518083038186803b158015610a5357600080fd5b505afa158015610a67573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a8b91906142b5565b610a9591906142e4565b610a9f9190614319565b949350505050565b60608160008111610ad35760405162461bcd60e51b8152600401610aca9061432d565b60405180910390fd5b60008381526009602090815260409182902080548351818402810184019094528084529091830182828015610b2757602002820191906000526020600020905b815481526020019060010190808311610b13575b5050505050915050919050565b6000610b516e5264707850726963654f7261636c6560881b610bc6565b6001600160a01b031663e1aa60366040518163ffffffff1660e01b815260040160206040518083038186803b158015610b8957600080fd5b505afa158015610b9d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bc191906142b5565b905090565b6000908152600560205260409020546001600160a01b031690565b6000610bf969476f7665726e616e636560b01b610bc6565b6001600160a01b0316336001600160a01b031614610c295760405162461bcd60e51b8152600401610aca9061434a565b610c316132c8565b50600190565b610c3f613e29565b60025460ff1615610c625760405162461bcd60e51b8152600401610aca90614367565b333b15610c98573360009081526001602052604090205460ff16610c985760405162461bcd60e51b8152600401610aca90614391565b60008381526007602052604090205460ff16610cdc5760405162461bcd60e51b815260206004820152600360248201526245313760e81b6044820152606401610aca565b6000838152600960205260409020548210610d095760405162461bcd60e51b8152600401610aca906143e0565b6000838152600960205260408120805484908110610d2957610d296143fd565b906000526020600020015490508060001415610d575760405162461bcd60e51b8152600401610aca90614413565b60003382604051602001610d6c929190614430565b60408051601f1981840301815291815281516020928301206000888152600e845282812082825290935291205490915080610dcf5760405162461bcd60e51b815260206004820152600360248201526208a62760eb1b6044820152606401610aca565b6000610de1630e488a0b60e31b610bc6565b6000888152600b602090815260408083208884528252808320548b8452600f83528184208985529092528220549293509091610e1e9085906142e4565b610e289190614319565b6000898152600e602090815260408083208884529091528120559050610e586001600160a01b038316338361335b565b60408051898152602081018790523381830152606081018590526080810183905290517fbe7586dfb192ca07af28bcc9fc95e78619abff84853e614ba95a4864e955c5929181900360a00190a16040805160208101909152908152979650505050505050565b600080546001600160a01b03163314610ee95760405162461bcd60e51b8152600401610aca90614452565b838214610f1d5760405162461bcd60e51b8152602060048201526002602482015261229960f11b6044820152606401610aca565b60005b84811015610fd9576000868683818110610f3c57610f3c6143fd565b9050602002013590506000858584818110610f5957610f596143fd565b9050602002016020810190610f6e9190613f3d565b60008381526005602052604080822080546001600160a01b0319166001600160a01b03851690811790915590519293509184917fb37614c7d254ea8d16eb81fa11dddaeb266aa8ba4917980859c7740aff30c69191a350508080610fd190614487565b915050610f20565b50600195945050505050565b6000610ff360025460ff1690565b156110105760405162461bcd60e51b8152600401610aca90614367565b333b15611046573360009081526001602052604090205460ff166110465760405162461bcd60e51b8152600401610aca90614391565b60008281526007602052604090205460ff1661108a5760405162461bcd60e51b815260206004820152600360248201526245313760e81b6044820152606401610aca565b60008281526009602052604090205484106110b75760405162461bcd60e51b8152600401610aca906143e0565b600083116110d75760405162461bcd60e51b8152600401610aca906144a2565b60008281526009602052604081208054869081106110f7576110f76143fd565b9060005260206000200154905080600014156111255760405162461bcd60e51b8152600401610aca90614413565b6000838152600a60209081526040808320848452909152908190205490516370a0823160e01b815233600482015285916001600160a01b0316906370a082319060240160206040518083038186803b15801561118057600080fd5b505afa158015611194573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111b891906142b5565b10156111ec5760405162461bcd60e51b815260206004820152600360248201526222989b60e91b6044820152606401610aca565b600083815260146020526040902054611206908286611d21565b60008481526014602052604081205491935090611224908487612ee2565b90506000611238630e488a0b60e31b610bc6565b9050600084116112705760405162461bcd60e51b815260206004820152600360248201526245313560e81b6044820152606401610aca565b6000858152600a602090815260408083208684529091529081902054905163079cc67960e41b8152336004820152602481018890526001600160a01b03909116906379cc679090604401600060405180830381600087803b1580156112d457600080fd5b505af11580156112e8573d6000803e3d6000fd5b505050506000821115611323576113236113126d2332b2a234b9ba3934b13aba37b960911b610bc6565b6001600160a01b038316908461335b565b6113423361133184876144bf565b6001600160a01b038416919061335b565b60408051868152602081018590523381830152606081018890526080810186905290517f170d93e3a85ba1c08f72d2c0ebd8835178a9b9f444c318ab404506c743d925bd9181900360a00190a15050509392505050565b606082600081116113bc5760405162461bcd60e51b8152600401610aca9061432d565b60008481526009602052604081205490816001600160401b038111156113e4576113e46140fc565b60405190808252806020026020018201604052801561140d578160200160208202803683370190505b50905060005b828110156114c357600087815260096020526040812080548390811061143b5761143b6143fd565b906000526020600020015490506000878260405160200161145d929190614430565b60408051601f19818403018152918152815160209283012060008c8152601384528281208282529093529120548551919250908590859081106114a2576114a26143fd565b602002602001018181525050505080806114bb90614487565b915050611413565b5095945050505050565b606082600081116114f05760405162461bcd60e51b8152600401610aca9061432d565b60008481526009602052604081205490816001600160401b03811115611518576115186140fc565b604051908082528060200260200182016040528015611541578160200160208202803683370190505b50905060005b828110156114c357600087815260096020526040812080548390811061156f5761156f6143fd565b9060005260206000200154905060008782604051602001611591929190614430565b60408051601f19818403018152918152815160209283012060008c8152600e84528281208282529093529120548551919250908590859081106115d6576115d66143fd565b602002602001018181525050505080806115ef90614487565b915050611547565b6060816000811161161a5760405162461bcd60e51b8152600401610aca9061432d565b60008381526009602052604081205490816001600160401b03811115611642576116426140fc565b60405190808252806020026020018201604052801561166b578160200160208202803683370190505b50905060005b828110156116ef576000868152601060209081526040808320600990925282208054919291849081106116a6576116a66143fd565b90600052602060002001548152602001908152602001600020548282815181106116d2576116d26143fd565b6020908102919091010152806116e781614487565b915050611671565b50949350505050565b600061170660025460ff1690565b156117235760405162461bcd60e51b8152600401610aca90614367565b333b15611759573360009081526001602052604090205460ff166117595760405162461bcd60e51b8152600401610aca90614391565b60035460009081526007602052604090205460ff16156117a05760405162461bcd60e51b8152602060048201526002602482015261453360f01b6044820152606401610aca565b60006117ad60035461186f565b915050804210156117e55760405162461bcd60e51b8152602060048201526002602482015261114d60f21b6044820152606401610aca565b6004546117f290826144d6565b4211156118275760405162461bcd60e51b815260206004820152600360248201526245323360e81b6044820152606401610aca565b61182f610b34565b60035460009081526014602052604090205561184b60016133c3565b50506003546000908152600760205260409020805460ff1916600190811790915590565b60008082600081116118935760405162461bcd60e51b8152600401610aca9061432d565b6000848152600660205260409020546118ab81612010565b9250925050915091565b6000546001600160a01b031633146118df5760405162461bcd60e51b8152600401610aca90614452565b6118e9600061360d565b565b600061190369476f7665726e616e636560b01b610bc6565b6001600160a01b0316336001600160a01b0316146119335760405162461bcd60e51b8152600401610aca9061434a565b60025460ff1661197c5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610aca565b81156119b05760405133904780156108fc02916000818181858888f193505050501580156119ae573d6000803e3d6000fd5b505b60005b83811015611a775760008585838181106119cf576119cf6143fd565b90506020020160208101906119e49190613f3d565b6040516370a0823160e01b8152306004820152909150611a649033906001600160a01b038416906370a082319060240160206040518083038186803b158015611a2c57600080fd5b505afa158015611a40573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061133191906142b5565b5080611a6f81614487565b9150506119b3565b506040513381527f5e7b34819cd91b239220bec92fcfd3c10da2214ba13e4e2b1f6c9cfdbd68a9a29060200160405180910390a15060015b9392505050565b60096020528160005260406000208181548110611ad257600080fd5b90600052602060002001600091509150505481565b6000611af560025460ff1690565b15611b125760405162461bcd60e51b8152600401610aca90614367565b8251845114611b485760405162461bcd60e51b8152602060048201526002602482015261229960f11b6044820152606401610aca565b60005b8451811015611ba457611b91858281518110611b6957611b696143fd565b6020026020010151858381518110611b8357611b836143fd565b602002602001015185611d3d565b5080611b9c81614487565b915050611b4b565b506001949350505050565b60608160008111611bd25760405162461bcd60e51b8152600401610aca9061432d565b60008381526009602052604081205490816001600160401b03811115611bfa57611bfa6140fc565b604051908082528060200260200182016040528015611c23578160200160208202803683370190505b50905060005b828110156116ef576000868152600a6020908152604080832060099092528220805491929184908110611c5e57611c5e6143fd565b9060005260206000200154815260200190815260200160002060009054906101000a90046001600160a01b0316828281518110611c9d57611c9d6143fd565b6001600160a01b039092166020928302919091019091015280611cbf81614487565b915050611c29565b6000611cdf69476f7665726e616e636560b01b610bc6565b6001600160a01b0316336001600160a01b031614611d0f5760405162461bcd60e51b8152600401610aca9061434a565b611d1761365d565b610c3160006133c3565b6000828411611d31576000610a9f565b8382610a8b85836144bf565b6000611d4b60025460ff1690565b15611d685760405162461bcd60e51b8152600401610aca90614367565b333b15611d9e573360009081526001602052604090205460ff16611d9e5760405162461bcd60e51b8152600401610aca90614391565b60006003546001611daf91906144d6565b60035490915015611e1c5760035460009081526007602052604090205460ff168015611dea575060008181526008602052604090205460ff16155b611e1c5760405162461bcd60e51b815260206004820152600360248201526245313960e81b6044820152606401610aca565b6000818152600960205260409020548510611e495760405162461bcd60e51b8152600401610aca906143e0565b60008411611e695760405162461bcd60e51b8152600401610aca906144a2565b6000818152600960205260408120805487908110611e8957611e896143fd565b906000526020600020015490508060001415611eb75760405162461bcd60e51b8152600401610aca90614413565b60008482604051602001611ecc929190614430565b604051602081830303815290604052805190602001209050611f0b333088611efa630e488a0b60e31b610bc6565b6001600160a01b03169291906136b5565b6000838152600e6020908152604080832084845290915281208054889290611f349084906144d6565b90915550506000838152600b6020908152604080832085845290915281208054889290611f629084906144d6565b90915550506000838152600c602052604081208054889290611f859084906144d6565b90915550506000838152600d602052604081208054889290611fa89084906144d6565b909155505060408051848152602081018490529081018790526001600160a01b03861660608201523360808201527fcaa9001342572663a8f7c22e7c6f0331a45254407418d9f993ed2d1485adc2059060a00160405180910390a15060019695505050505050565b60008061203a61201f846136f3565b61202885613713565b6120339060016144d6565b600061372d565b9050600561204782613748565b101561207f5761207c612059826136f3565b61206283613713565b600761206d8561377c565b61207791906144bf565b61372d565b90505b60006120c761208d836136f3565b61209684613713565b61209f85613748565b6120a88661377c565b6120b39060056144d6565b6120bd91906144bf565b600860008061378e565b9050838111611aaf5760006120f26120de866136f3565b6120e787613713565b6120339060026144d6565b905060056120ff82613748565b101561211457612111612059826136f3565b90505b61213b612120826136f3565b61212983613713565b61213284613748565b6120a88561377c565b95945050505050565b600061215c69476f7665726e616e636560b01b610bc6565b6001600160a01b0316336001600160a01b03161461218c5760405162461bcd60e51b8152600401610aca9061434a565b60048290556040518281527f5259439c9ac2029585dd4a349897aa1e8298d26537c3b57453f275126db919189060200160405180910390a15060015b919050565b600080546001600160a01b031633146121f85760405162461bcd60e51b8152600401610aca90614452565b813b6122645760405162461bcd60e51b815260206004820152603560248201527f436f6e747261637457686974656c6973743a2041646472657373206d757374206044820152746265206120636f6e7472616374206164647265737360581b6064820152608401610aca565b6001600160a01b03821660009081526001602052604090205460ff16156122e55760405162461bcd60e51b815260206004820152602f60248201527f436f6e747261637457686974656c6973743a20436f6e747261637420616c726560448201526e18591e481dda1a5d195b1a5cdd1959608a1b6064820152608401610aca565b6001600160a01b0382166000818152600160208190526040808320805460ff1916909217909155517ffbd3cde7ff522a917e485c8ed2a6e87590887ab399f5ac312307903f498543079190a2506001919050565b6060816000811161235c5760405162461bcd60e51b8152600401610aca9061432d565b60008381526009602052604081205490816001600160401b03811115612384576123846140fc565b6040519080825280602002602001820160405280156123ad578160200160208202803683370190505b50905060005b828110156116ef576000868152600b60209081526040808320600990925282208054919291849081106123e8576123e86143fd565b9060005260206000200154815260200190815260200160002054828281518110612414576124146143fd565b60209081029190910101528061242981614487565b9150506123b3565b6001600160a01b03811660009081526001602052604081205460ff166124ad5760405162461bcd60e51b815260206004820152602b60248201527f436f6e747261637457686974656c6973743a20436f6e7472616374206e6f742060448201526a1dda1a5d195b1a5cdd195960aa1b6064820152608401610aca565b6001600160a01b038216600081815260016020526040808220805460ff19169055517f8e81447740597754af5db3e176253a36f7981a9549f48ace3f0cb233913f9d859190a2506001919050565b6060816000811161251e5760405162461bcd60e51b8152600401610aca9061432d565b60008381526009602052604081205490816001600160401b03811115612546576125466140fc565b60405190808252806020026020018201604052801561256f578160200160208202803683370190505b50905060005b828110156116ef576000868152601260209081526040808320600990925282208054919291849081106125aa576125aa6143fd565b90600052602060002001548152602001908152602001600020548282815181106125d6576125d66143fd565b6020908102919091010152806125eb81614487565b915050612575565b600080546001600160a01b0316331461261e5760405162461bcd60e51b8152600401610aca90614452565b60025460ff16156126415760405162461bcd60e51b8152600401610aca90614367565b6000600354600161265291906144d6565b6000818152600c6020526040902054909150156126965760405162461bcd60e51b815260206004820152600260248201526108a760f31b6044820152606401610aca565b600354156126e45760006126ab60035461186f565b9150508042116126e25760405162461bcd60e51b8152602060048201526002602482015261453960f01b6044820152606401610aca565b505b6000818152600960209081526040909120845161270392860190613e47565b5060008181526006602052604081204290555b835181101561278c577f5185be10ef2a03e926961817be495a630ded54bceffb3ba11f6af477c9c7668282858381518110612753576127536143fd565b6020026020010151604051612772929190918252602082015260400190565b60405180910390a18061278481614487565b915050612716565b5060019392505050565b60006127af6a466565537472617465677960a81b610bc6565b604051633a11a3b960e21b81526004810186905260248101859052604481018490526001600160a01b03919091169063e8468ee4906064015b60206040518083038186803b15801561280057600080fd5b505afa158015612814573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a9f91906142b5565b60008061284760025460ff1690565b156128645760405162461bcd60e51b8152600401610aca90614367565b333b1561289a573360009081526001602052604090205460ff1661289a5760405162461bcd60e51b8152600401610aca90614391565b60035460009081526008602052604090205460ff166128e15760405162461bcd60e51b815260206004820152600360248201526204532360ec1b6044820152606401610aca565b60035460009081526009602052604090205485106129115760405162461bcd60e51b8152600401610aca906143e0565b600084116129315760405162461bcd60e51b8152600401610aca906144a2565b6003546000908152600960205260408120805487908110612954576129546143fd565b9060005260206000200154905080600014156129825760405162461bcd60e51b8152600401610aca90614413565b60008482604051602001612997929190614430565b60405160208183030381529060405280519060200120905060006129c1630e488a0b60e31b610bc6565b905060006129cd610b34565b905060006129db858a610933565b905060006129ea83878c612796565b60035460009081526010602090815260408083208a8452909152812080549293508c92909190612a1b9084906144d6565b90915550506003546000908152601160209081526040808320888452909152812080548c9290612a4c9084906144d6565b9091555050600354600090815260126020908152604080832089845290915281208054849290612a7d9084906144d6565b9091555050600354600090815260136020908152604080832088845290915281208054849290612aae9084906144d6565b90915550506003546000908152600d602052604081208054849290612ad49084906144d6565b90915550612afb90503330612ae984866144d6565b6001600160a01b0388169291906136b5565b8015612b2f57612b2f612b1e6d2332b2a234b9ba3934b13aba37b960911b610bc6565b6001600160a01b038616908361335b565b6003546000908152600a60209081526040808320898452909152902054612b60906001600160a01b03168a8c61335b565b600354604080519182526020820188905281018b905260608101839052608081018290526001600160a01b038a1660a08201523360c08201527f78de8c82973d11415ea2004f458680aa6d5826c3e8a798496a61db56fa66417b9060e00160405180910390a1909a909950975050505050505050565b60608260008111612bf95760405162461bcd60e51b8152600401610aca9061432d565b60008481526009602052604081205490816001600160401b03811115612c2157612c216140fc565b604051908082528060200260200182016040528015612c4a578160200160208202803683370190505b50905060005b828110156114c3576000878152600960205260408120805483908110612c7857612c786143fd565b9060005260206000200154905060008782604051602001612c9a929190614430565b60408051601f19818403018152918152815160209283012060008c815260118452828120828252909352912054855191925090859085908110612cdf57612cdf6143fd565b60200260200101818152505050508080612cf890614487565b915050612c50565b6000546001600160a01b03163314612d2a5760405162461bcd60e51b8152600401610aca90614452565b6001600160a01b038116612d8f5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610aca565b612d988161360d565b50565b6000612db369476f7665726e616e636560b01b610bc6565b6001600160a01b0316336001600160a01b031614612de35760405162461bcd60e51b8152600401610aca9061434a565b60025460ff1615612e065760405162461bcd60e51b8152600401610aca90614367565b60035460009081526007602052604090205460ff1615612e4d5760405162461bcd60e51b8152602060048201526002602482015261453360f01b6044820152606401610aca565b6000612e5a60035461186f565b91505060045481612e6b91906144d6565b4211612e9e5760405162461bcd60e51b8152602060048201526002602482015261114d60f21b6044820152606401610aca565b6003546000908152601460205260409020839055612ebc60016133c3565b50506003546000908152600760205260409020805460ff19166001908117909155919050565b6000612efb6a466565537472617465677960a81b610bc6565b604051637b95fc7f60e11b81526004810186905260248101859052604481018490526001600160a01b03919091169063f72bf8fe906064016127e8565b600080546001600160a01b03163314612f635760405162461bcd60e51b8152600401610aca90614452565b60025460ff1615612f865760405162461bcd60e51b8152600401610aca90614367565b60006003546001612f9791906144d6565b60008181526008602052604090205490915060ff1615612fde5760405162461bcd60e51b8152602060048201526002602482015261453560f01b6044820152606401610aca565b60008181526009602052604090205461301e5760405162461bcd60e51b8152602060048201526002602482015261229b60f11b6044820152606401610aca565b6003541561306c5760035460009081526007602052604090205460ff1661306c5760405162461bcd60e51b8152602060048201526002602482015261453760f01b6044820152606401610aca565b60005b6000828152600960205260409020548110156132675760008281526009602052604081208054839081106130a5576130a56143fd565b9060005260206000200154905060006130e7604051806040016040528060098152602001681c9114160b50d0531360ba1b8152506130e2846137ea565b6138e7565b905061311281604051806040016040528060078152602001662d45504f43482d60c81b8152506138e7565b9050613121816130e2866137ea565b9050600061314e7f0000000000000000000000000000000000000000000000000000000000000000613913565b60405163266c45bb60e11b81529091506001600160a01b03821690634cd88b769061317f9085908190600401614546565b600060405180830381600087803b15801561319957600080fd5b505af11580156131ad573d6000803e3d6000fd5b5050506000868152600a60209081526040808320878452825280832080546001600160a01b0319166001600160a01b038716908117909155898452600b8352818420888552909252918290205491516340c10f1960e01b8152306004820152602481019290925291506340c10f1990604401600060405180830381600087803b15801561323957600080fd5b505af115801561324d573d6000803e3d6000fd5b50505050505050808061325f90614487565b91505061306f565b5060008181526008602052604090819020805460ff191660011790556003829055517fb5ca1ca1b7b47549eb8af476f3ef702fc63bcd8b8c01dc163b009bb818f97997906132b89083815260200190565b60405180910390a1600191505090565b60025460ff166133115760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610aca565b6002805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b6040516001600160a01b0383166024820152604481018290526133be90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526139ab565b505050565b6003546000908152600d602052604090205415612d985760035460009081526009602090815260408083208054825181850281018501909352808352919290919083018282801561343357602002820191906000526020600020905b81548152602001906001019080831161341f575b5050505050905060005b81518110156133be5760006134c060146000600354815260200190815260200160002054848481518110613473576134736143fd565b602002602001015160106000600354815260200190815260200160002060008787815181106134a4576134a46143fd565b6020026020010151815260200190815260200160002054611d21565b905080600b6000600354815260200190815260200160002060008585815181106134ec576134ec6143fd565b602002602001015181526020019081526020016000205461350d91906144bf565b600f600060035481526020019081526020016000206000858581518110613536576135366143fd565b60200260200101518152602001908152602001600020600082825461355b91906144d6565b909155505083156135fa57601260006003548152602001908152602001600020600084848151811061358f5761358f6143fd565b6020026020010151815260200190815260200160002054600f6000600354815260200190815260200160002060008585815181106135cf576135cf6143fd565b6020026020010151815260200190815260200160002060008282546135f491906144d6565b90915550505b508061360581614487565b91505061343d565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60025460ff16156136805760405162461bcd60e51b8152600401610aca90614367565b6002805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25861333e3390565b6040516001600160a01b03808516602483015283166044820152606481018290526136ed9085906323b872dd60e01b90608401613387565b50505050565b600061370a6137056201518084614319565b613a7d565b50909392505050565b60006137256137056201518084614319565b509392505050565b60006201518061373e858585613bf1565b610a9f91906142e4565b6000806137586201518084614319565b905060076137678260036144d6565b613771919061456b565b611aaf9060016144d6565b6000610a9f6137056201518084614319565b60008161379c603c856142e4565b6137a8610e10876142e4565b620151806137b78b8b8b613bf1565b6137c191906142e4565b6137cb91906144d6565b6137d591906144d6565b6137df91906144d6565b979650505050505050565b60608161380e5750506040805180820190915260018152600360fc1b602082015290565b8160005b8115613838578061382281614487565b91506138319050600a83614319565b9150613812565b6000816001600160401b03811115613852576138526140fc565b6040519080825280601f01601f19166020018201604052801561387c576020820181803683370190505b5090505b8415610a9f576138916001836144bf565b915061389e600a8661456b565b6138a99060306144d6565b60f81b8183815181106138be576138be6143fd565b60200101906001600160f81b031916908160001a9053506138e0600a86614319565b9450613880565b606082826040516020016138fc92919061457f565b604051602081830303815290604052905092915050565b6000604051733d602d80600a3d3981f3363d3d373d3d3d363d7360601b81528260601b60148201526e5af43d82803e903d91602b57fd5bf360881b60288201526037816000f09150506001600160a01b0381166121c85760405162461bcd60e51b8152602060048201526016602482015275115490cc4c4d8dce8818dc99585d194819985a5b195960521b6044820152606401610aca565b6000613a00826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316613d2e9092919063ffffffff16565b8051909150156133be5780806020019051810190613a1e91906145ae565b6133be5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610aca565b60008080838162253d8c613a948362010bd96145cb565b613a9e91906145cb565b9050600062023ab1613ab183600461460c565b613abb9190614691565b90506004613acc8262023ab161460c565b613ad79060036145cb565b613ae19190614691565b613aeb90836146bf565b9150600062164b09613afe8460016145cb565b613b0a90610fa061460c565b613b149190614691565b90506004613b24826105b561460c565b613b2e9190614691565b613b3890846146bf565b613b4390601f6145cb565b9250600061098f613b5585605061460c565b613b5f9190614691565b905060006050613b718361098f61460c565b613b7b9190614691565b613b8590866146bf565b9050613b92600b83614691565b9450613b9f85600c61460c565b613baa8360026145cb565b613bb491906146bf565b91508483613bc36031876146bf565b613bce90606461460c565b613bd891906145cb565b613be291906145cb565b9a919950975095505050505050565b60006107b2841015613c0257600080fd5b838383600062253d8c60046064600c613c1c600e886146bf565b613c269190614691565b613c32886113246145cb565b613c3c91906145cb565b613c469190614691565b613c5190600361460c565b613c5b9190614691565b600c80613c69600e886146bf565b613c739190614691565b613c7e90600c61460c565b613c896002886146bf565b613c9391906146bf565b613c9f9061016f61460c565b613ca99190614691565b6004600c613cb8600e896146bf565b613cc29190614691565b613cce896112c06145cb565b613cd891906145cb565b613ce4906105b561460c565b613cee9190614691565b613cfa617d4b876146bf565b613d0491906145cb565b613d0e91906145cb565b613d1891906146bf565b613d2291906146bf565b98975050505050505050565b6060610a9f848460008585843b613d875760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610aca565b600080866001600160a01b03168587604051613da391906146fe565b60006040518083038185875af1925050503d8060008114613de0576040519150601f19603f3d011682016040523d82523d6000602084013e613de5565b606091505b50915091506137df82828660608315613dff575081611aaf565b825115613e0f5782518084602001fd5b8160405162461bcd60e51b8152600401610aca919061471a565b60405180602001604052806001906020820280368337509192915050565b828054828255906000526020600020908101928215613e82579160200282015b82811115613e82578251825591602001919060010190613e67565b50613e8e929150613e92565b5090565b5b80821115613e8e5760008155600101613e93565b60008060408385031215613eba57600080fd5b50508035926020909101359150565b600060208284031215613edb57600080fd5b5035919050565b6020808252825182820181905260009190848201906040850190845b81811015613f1a57835183529284019291840191600101613efe565b50909695505050505050565b80356001600160a01b03811681146121c857600080fd5b600060208284031215613f4f57600080fd5b611aaf82613f26565b602081810190828460005b6001811015613f8057815183529183019190830190600101613f63565b5050505092915050565b60008083601f840112613f9c57600080fd5b5081356001600160401b03811115613fb357600080fd5b6020830191508360208260051b8501011115613fce57600080fd5b9250929050565b60008060008060408587031215613feb57600080fd5b84356001600160401b038082111561400257600080fd5b61400e88838901613f8a565b9096509450602087013591508082111561402757600080fd5b5061403487828801613f8a565b95989497509550505050565b60008060006060848603121561405557600080fd5b505081359360208301359350604090920135919050565b6000806040838503121561407f57600080fd5b8235915061408f60208401613f26565b90509250929050565b8015158114612d9857600080fd5b6000806000604084860312156140bb57600080fd5b83356001600160401b038111156140d157600080fd5b6140dd86828701613f8a565b90945092505060208401356140f181614098565b809150509250925092565b634e487b7160e01b600052604160045260246000fd5b600082601f83011261412357600080fd5b813560206001600160401b038083111561413f5761413f6140fc565b8260051b604051601f19603f83011681018181108482111715614164576141646140fc565b60405293845285810183019383810192508785111561418257600080fd5b83870191505b848210156137df57813583529183019190830190614188565b6000806000606084860312156141b657600080fd5b83356001600160401b03808211156141cd57600080fd5b6141d987838801614112565b945060208601359150808211156141ef57600080fd5b506141fc86828701614112565b92505061420b60408501613f26565b90509250925092565b6020808252825182820181905260009190848201906040850190845b81811015613f1a5783516001600160a01b031683529284019291840191600101614230565b60008060006060848603121561426a57600080fd5b833592506020840135915061420b60408501613f26565b60006020828403121561429357600080fd5b81356001600160401b038111156142a957600080fd5b610a9f84828501614112565b6000602082840312156142c757600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b60008160001904831182151516156142fe576142fe6142ce565b500290565b634e487b7160e01b600052601260045260246000fd5b60008261432857614328614303565b500490565b60208082526003908201526245313360e81b604082015260600190565b60208082526003908201526222991960e91b604082015260600190565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b6020808252602f908201527f436f6e747261637457686974656c6973743a20436f6e7472616374206d75737460408201526e081899481dda1a5d195b1a5cdd1959608a1b606082015260800190565b60208082526003908201526204531360ec1b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b60208082526003908201526222989960e91b604082015260600190565b60609290921b6bffffffffffffffffffffffff19168252601482015260340190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060001982141561449b5761449b6142ce565b5060010190565b60208082526003908201526245313160e81b604082015260600190565b6000828210156144d1576144d16142ce565b500390565b600082198211156144e9576144e96142ce565b500190565b60005b838110156145095781810151838201526020016144f1565b838111156136ed5750506000910152565b600081518084526145328160208601602086016144ee565b601f01601f19169290920160200192915050565b604081526000614559604083018561451a565b828103602084015261213b818561451a565b60008261457a5761457a614303565b500690565b600083516145918184602088016144ee565b8351908301906145a58183602088016144ee565b01949350505050565b6000602082840312156145c057600080fd5b8151611aaf81614098565b600080821280156001600160ff1b03849003851316156145ed576145ed6142ce565b600160ff1b8390038412811615614606576146066142ce565b50500190565b60006001600160ff1b0381841382841380821686840486111615614632576146326142ce565b600160ff1b6000871282811687830589121615614651576146516142ce565b6000871292508782058712848416161561466d5761466d6142ce565b87850587128184161615614683576146836142ce565b505050929093029392505050565b6000826146a0576146a0614303565b600160ff1b8214600019841416156146ba576146ba6142ce565b500590565b60008083128015600160ff1b8501841216156146dd576146dd6142ce565b6001600160ff1b03840183138116156146f8576146f86142ce565b50500390565b600082516147108184602087016144ee565b9190910192915050565b602081526000611aaf602083018461451a56fea2646970667358221220976ef15a72dfa6658e540819aa480111ad1fb94ea171cd1256192a2754ce5b1364736f6c63430008090033608060405234801561001057600080fd5b50611eb6806100206000396000f3fe608060405234801561001057600080fd5b50600436106101cf5760003560e01c80635c975abb11610104578063a217fddf116100a2578063d539139311610071578063d5391393146103ce578063d547741f146103f5578063dd62ed3e14610408578063e63ab1e91461044157600080fd5b8063a217fddf1461038d578063a457c2d714610395578063a9059cbb146103a8578063ca15c873146103bb57600080fd5b80638456cb59116100de5780638456cb591461033f5780639010d07c1461034757806391d148541461037257806395d89b411461038557600080fd5b80635c975abb146102f757806370a082311461030357806379cc67901461032c57600080fd5b8063313ce567116101715780633f4ba83a1161014b5780633f4ba83a146102b657806340c10f19146102be57806342966c68146102d15780634cd88b76146102e457600080fd5b8063313ce5671461028157806336568abe1461029057806339509351146102a357600080fd5b806318160ddd116101ad57806318160ddd1461022457806323b872dd14610236578063248a9ca3146102495780632f2ff15d1461026c57600080fd5b806301ffc9a7146101d457806306fdde03146101fc578063095ea7b314610211575b600080fd5b6101e76101e23660046119fd565b610456565b60405190151581526020015b60405180910390f35b610204610481565b6040516101f39190611a53565b6101e761021f366004611aa2565b610513565b60cb545b6040519081526020016101f3565b6101e7610244366004611acc565b610529565b610228610257366004611b08565b60009081526065602052604090206001015490565b61027f61027a366004611b21565b6105d8565b005b604051601281526020016101f3565b61027f61029e366004611b21565b610603565b6101e76102b1366004611aa2565b610681565b61027f6106bd565b61027f6102cc366004611aa2565b610751565b61027f6102df366004611b08565b6107f0565b61027f6102f2366004611bf0565b6107fd565b61012d5460ff166101e7565b610228610311366004611c54565b6001600160a01b0316600090815260c9602052604090205490565b61027f61033a366004611aa2565b610874565b61027f6108f5565b61035a610355366004611c6f565b610987565b6040516001600160a01b0390911681526020016101f3565b6101e7610380366004611b21565b6109a6565b6102046109d1565b610228600081565b6101e76103a3366004611aa2565b6109e0565b6101e76103b6366004611aa2565b610a79565b6102286103c9366004611b08565b610a86565b6102287f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a681565b61027f610403366004611b21565b610a9d565b610228610416366004611c91565b6001600160a01b03918216600090815260ca6020908152604080832093909416825291909152205490565b610228600080516020611e6183398151915281565b60006001600160e01b03198216635a05180f60e01b148061047b575061047b82610ac3565b92915050565b606060cc805461049090611cbb565b80601f01602080910402602001604051908101604052809291908181526020018280546104bc90611cbb565b80156105095780601f106104de57610100808354040283529160200191610509565b820191906000526020600020905b8154815290600101906020018083116104ec57829003601f168201915b5050505050905090565b6000610520338484610af8565b50600192915050565b6000610536848484610c1c565b6001600160a01b038416600090815260ca60209081526040808320338452909152902054828110156105c05760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b60648201526084015b60405180910390fd5b6105cd8533858403610af8565b506001949350505050565b6000828152606560205260409020600101546105f48133610df7565b6105fe8383610e5b565b505050565b6001600160a01b03811633146106735760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084016105b7565b61067d8282610e7d565b5050565b33600081815260ca602090815260408083206001600160a01b038716845290915281205490916105209185906106b8908690611d0c565b610af8565b6106d5600080516020611e61833981519152336109a6565b6107475760405162461bcd60e51b815260206004820152603960248201527f45524332305072657365744d696e7465725061757365723a206d75737420686160448201527f76652070617573657220726f6c6520746f20756e70617573650000000000000060648201526084016105b7565b61074f610e9f565b565b61077b7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a6336109a6565b6107e65760405162461bcd60e51b815260206004820152603660248201527f45524332305072657365744d696e7465725061757365723a206d7573742068616044820152751d99481b5a5b9d195c881c9bdb19481d1bc81b5a5b9d60521b60648201526084016105b7565b61067d8282610f34565b6107fa338261101f565b50565b600054610100900460ff1680610816575060005460ff16155b6108325760405162461bcd60e51b81526004016105b790611d24565b600054610100900460ff16158015610854576000805461ffff19166101011790555b61085e8383611179565b80156105fe576000805461ff0019169055505050565b60006108808333610416565b9050818110156108de5760405162461bcd60e51b8152602060048201526024808201527f45524332303a206275726e20616d6f756e74206578636565647320616c6c6f77604482015263616e636560e01b60648201526084016105b7565b6108eb8333848403610af8565b6105fe838361101f565b61090d600080516020611e61833981519152336109a6565b61097f5760405162461bcd60e51b815260206004820152603760248201527f45524332305072657365744d696e7465725061757365723a206d75737420686160448201527f76652070617573657220726f6c6520746f20706175736500000000000000000060648201526084016105b7565b61074f61121c565b600082815260976020526040812061099f9083611299565b9392505050565b60009182526065602090815260408084206001600160a01b0393909316845291905290205460ff1690565b606060cd805461049090611cbb565b33600090815260ca602090815260408083206001600160a01b038616845290915281205482811015610a625760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b60648201526084016105b7565b610a6f3385858403610af8565b5060019392505050565b6000610520338484610c1c565b600081815260976020526040812061047b906112a5565b600082815260656020526040902060010154610ab98133610df7565b6105fe8383610e7d565b60006001600160e01b03198216637965db0b60e01b148061047b57506301ffc9a760e01b6001600160e01b031983161461047b565b6001600160a01b038316610b5a5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105b7565b6001600160a01b038216610bbb5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105b7565b6001600160a01b03838116600081815260ca602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610c805760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105b7565b6001600160a01b038216610ce25760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105b7565b610ced8383836112af565b6001600160a01b038316600090815260c9602052604090205481811015610d655760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b60648201526084016105b7565b6001600160a01b03808516600090815260c96020526040808220858503905591851681529081208054849290610d9c908490611d0c565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610de891815260200190565b60405180910390a35b50505050565b610e0182826109a6565b61067d57610e19816001600160a01b031660146112ba565b610e248360206112ba565b604051602001610e35929190611d72565b60408051601f198184030181529082905262461bcd60e51b82526105b791600401611a53565b610e658282611456565b60008281526097602052604090206105fe90826114dc565b610e8782826114f1565b60008281526097602052604090206105fe9082611558565b61012d5460ff16610ee95760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016105b7565b61012d805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b6001600160a01b038216610f8a5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f20616464726573730060448201526064016105b7565b610f96600083836112af565b8060cb6000828254610fa89190611d0c565b90915550506001600160a01b038216600090815260c9602052604081208054839290610fd5908490611d0c565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b6001600160a01b03821661107f5760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b60648201526084016105b7565b61108b826000836112af565b6001600160a01b038216600090815260c96020526040902054818110156110ff5760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b60648201526084016105b7565b6001600160a01b038316600090815260c960205260408120838303905560cb805484929061112e908490611de7565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a3505050565b600054610100900460ff1680611192575060005460ff16155b6111ae5760405162461bcd60e51b81526004016105b790611d24565b600054610100900460ff161580156111d0576000805461ffff19166101011790555b6111d861156d565b6111e061156d565b6111e861156d565b6111f061156d565b6111fa83836115d8565b61120261156d565b61120a61166d565b61121261156d565b61085e83836116e3565b61012d5460ff16156112635760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016105b7565b61012d805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258610f173390565b600061099f8383611787565b600061047b825490565b6105fe8383836117b1565b606060006112c9836002611dfe565b6112d4906002611d0c565b67ffffffffffffffff8111156112ec576112ec611b4d565b6040519080825280601f01601f191660200182016040528015611316576020820181803683370190505b509050600360fc1b8160008151811061133157611331611e1d565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061136057611360611e1d565b60200101906001600160f81b031916908160001a9053506000611384846002611dfe565b61138f906001611d0c565b90505b6001811115611407576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106113c3576113c3611e1d565b1a60f81b8282815181106113d9576113d9611e1d565b60200101906001600160f81b031916908160001a90535060049490941c9361140081611e33565b9050611392565b50831561099f5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016105b7565b61146082826109a6565b61067d5760008281526065602090815260408083206001600160a01b03851684529091529020805460ff191660011790556114983390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b600061099f836001600160a01b038416611818565b6114fb82826109a6565b1561067d5760008281526065602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b600061099f836001600160a01b038416611867565b600054610100900460ff1680611586575060005460ff16155b6115a25760405162461bcd60e51b81526004016105b790611d24565b600054610100900460ff161580156115c4576000805461ffff19166101011790555b80156107fa576000805461ff001916905550565b600054610100900460ff16806115f1575060005460ff16155b61160d5760405162461bcd60e51b81526004016105b790611d24565b600054610100900460ff1615801561162f576000805461ffff19166101011790555b82516116429060cc906020860190611964565b5081516116569060cd906020850190611964565b5080156105fe576000805461ff0019169055505050565b600054610100900460ff1680611686575060005460ff16155b6116a25760405162461bcd60e51b81526004016105b790611d24565b600054610100900460ff161580156116c4576000805461ffff19166101011790555b61012d805460ff1916905580156107fa576000805461ff001916905550565b600054610100900460ff16806116fc575060005460ff16155b6117185760405162461bcd60e51b81526004016105b790611d24565b600054610100900460ff1615801561173a576000805461ffff19166101011790555b61174560003361195a565b61176f7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a63361195a565b61085e600080516020611e618339815191523361195a565b600082600001828154811061179e5761179e611e1d565b9060005260206000200154905092915050565b61012d5460ff16156105fe5760405162461bcd60e51b815260206004820152602a60248201527f45524332305061757361626c653a20746f6b656e207472616e736665722077686044820152691a5b19481c185d5cd95960b21b60648201526084016105b7565b600081815260018301602052604081205461185f5750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561047b565b50600061047b565b6000818152600183016020526040812054801561195057600061188b600183611de7565b855490915060009061189f90600190611de7565b90508181146119045760008660000182815481106118bf576118bf611e1d565b90600052602060002001549050808760000184815481106118e2576118e2611e1d565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061191557611915611e4a565b60019003818190600052602060002001600090559055856001016000868152602001908152602001600020600090556001935050505061047b565b600091505061047b565b61067d8282610e5b565b82805461197090611cbb565b90600052602060002090601f01602090048101928261199257600085556119d8565b82601f106119ab57805160ff19168380011785556119d8565b828001600101855582156119d8579182015b828111156119d85782518255916020019190600101906119bd565b506119e49291506119e8565b5090565b5b808211156119e457600081556001016119e9565b600060208284031215611a0f57600080fd5b81356001600160e01b03198116811461099f57600080fd5b60005b83811015611a42578181015183820152602001611a2a565b83811115610df15750506000910152565b6020815260008251806020840152611a72816040850160208701611a27565b601f01601f19169190910160400192915050565b80356001600160a01b0381168114611a9d57600080fd5b919050565b60008060408385031215611ab557600080fd5b611abe83611a86565b946020939093013593505050565b600080600060608486031215611ae157600080fd5b611aea84611a86565b9250611af860208501611a86565b9150604084013590509250925092565b600060208284031215611b1a57600080fd5b5035919050565b60008060408385031215611b3457600080fd5b82359150611b4460208401611a86565b90509250929050565b634e487b7160e01b600052604160045260246000fd5b600082601f830112611b7457600080fd5b813567ffffffffffffffff80821115611b8f57611b8f611b4d565b604051601f8301601f19908116603f01168101908282118183101715611bb757611bb7611b4d565b81604052838152866020858801011115611bd057600080fd5b836020870160208301376000602085830101528094505050505092915050565b60008060408385031215611c0357600080fd5b823567ffffffffffffffff80821115611c1b57600080fd5b611c2786838701611b63565b93506020850135915080821115611c3d57600080fd5b50611c4a85828601611b63565b9150509250929050565b600060208284031215611c6657600080fd5b61099f82611a86565b60008060408385031215611c8257600080fd5b50508035926020909101359150565b60008060408385031215611ca457600080fd5b611cad83611a86565b9150611b4460208401611a86565b600181811c90821680611ccf57607f821691505b60208210811415611cf057634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b60008219821115611d1f57611d1f611cf6565b500190565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351611daa816017850160208801611a27565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351611ddb816028840160208801611a27565b01602801949350505050565b600082821015611df957611df9611cf6565b500390565b6000816000190483118215151615611e1857611e18611cf6565b500290565b634e487b7160e01b600052603260045260246000fd5b600081611e4257611e42611cf6565b506000190190565b634e487b7160e01b600052603160045260246000fdfe65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862aa26469706673582212201e8e71d04321c61cbea798e0c220b88d5e37b921bdfb67b7e07db65b7fd1d00064736f6c6343000809003300000000000000000000000032eb7902d4134bf98a28b963d26de779af92a2120000000000000000000000002b99e3d67dad973c1b9747da742b7e26c8bdd67b000000000000000000000000c0cdd1176aa1624b89b7476142b41c04414afaa00000000000000000000000003e0215c1d639280e13b46e3af94fb5630d1b321200000000000000000000000055594cce8cc0014ea08c49fd820d731308f204c10000000000000000000000001a5444362857cafdc58ab95b79a5a9285d16563a
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106103825760003560e01c80638144eeba116101de578063b0f48cf71161010f578063d7e15131116100ad578063f2fde38b1161007c578063f2fde38b146108f2578063f6ac848814610905578063f72bf8fe14610918578063fb969b0a1461092b57600080fd5b8063d7e1513114610899578063e8468ee4146108b9578063ea3bd5df146108cc578063ec856816146108df57600080fd5b8063c300fd64116100e9578063c300fd641461084d578063c3d9ed3914610860578063cd653df614610873578063d3e3e3521461088657600080fd5b8063b0f48cf7146107cc578063b12daf69146107f7578063bf434b7a1461082257600080fd5b80638e143ccb1161017c5780639bbce478116101565780639bbce47814610766578063a6fe2b9e14610786578063ab2150cf146107a6578063acc3a006146107b957600080fd5b80638e143ccb14610709578063901be0411461071c57806393c82c751461074357600080fd5b806388e18e13116101b857806388e18e13146106a75780638990d045146106ba5780638da5cb5b146106e55780638dbdbe6d146106f657600080fd5b80638144eeba1461066c578063823c15121461067f5780638456cb591461069f57600080fd5b8063574cdded116102b85780636a77845411610256578063715018a611610230578063715018a614610633578063766718081461063d5780637c4b52cb146106465780637e36701f1461065957600080fd5b80636a778454146105f05780636db29f6d146106035780636f56f56f1461060b57600080fd5b806361560c991161029257806361560c991461059857806361644373146105ab5780636274d49d146105b4578063699f200f146105c757600080fd5b8063574cdded1461054f5780635ba0bee1146105625780635c975abb1461058d57600080fd5b8063344afb5f116103255780633f83b8a5116102ff5780633f83b8a5146104c5578063441a3e70146104e8578063470f4224146105085780634ab01f5b1461053c57600080fd5b8063344afb5f1461047a578063391feebb1461049a5780633f4ba83a146104bd57600080fd5b80631acf5582116103615780631acf5582146103f157806321f8a721146103f95780632807b9a8146104245780632dc96c8e1461044f57600080fd5b806212100c1461038757806315943b99146103ad57806316279055146103cd575b600080fd5b61039a610395366004613ea7565b610933565b6040519081526020015b60405180910390f35b6103c06103bb366004613ec9565b610aa7565b6040516103a49190613ee2565b6103e16103db366004613f3d565b3b151590565b60405190151581526020016103a4565b61039a610b34565b61040c610407366004613ec9565b610bc6565b6040516001600160a01b0390911681526020016103a4565b61039a610432366004613ea7565b601160209081526000928352604080842090915290825290205481565b61039a61045d366004613ea7565b600f60209081526000928352604080842090915290825290205481565b61039a610488366004613ec9565b600d6020526000908152604090205481565b6103e16104a8366004613f3d565b60016020526000908152604090205460ff1681565b6103e1610be1565b6103e16104d3366004613ec9565b60086020526000908152604090205460ff1681565b6104fb6104f6366004613ea7565b610c37565b6040516103a49190613f58565b61040c610516366004613ea7565b600a6020908152600092835260408084209091529082529020546001600160a01b031681565b6103e161054a366004613fd5565b610ebe565b61039a61055d366004614040565b610fe5565b61039a610570366004613ea7565b601360209081526000928352604080842090915290825290205481565b60025460ff166103e1565b6103c06105a636600461406c565b611399565b61039a60045481565b6103c06105c236600461406c565b6114cd565b61040c6105d5366004613ec9565b6005602052600090815260409020546001600160a01b031681565b6103c06105fe366004613ec9565b6115f7565b6103e16116f8565b61061e610619366004613ec9565b61186f565b604080519283526020830191909152016103a4565b61063b6118b5565b005b61039a60035481565b6103e16106543660046140a6565b6118eb565b61039a610667366004613ea7565b611ab6565b6103e161067a3660046141a1565b611ae7565b61069261068d366004613ec9565b611baf565b6040516103a49190614214565b6103e1611cc7565b61039a6106b5366004614040565b611d21565b61039a6106c8366004613ea7565b600e60209081526000928352604080842090915290825290205481565b6000546001600160a01b031661040c565b6103e1610704366004614255565b611d3d565b61039a610717366004613ec9565b612010565b61040c7f000000000000000000000000a07113e6e63c6d99081fcf7e0aecfcf73157c02881565b6103e1610751366004613ec9565b60076020526000908152604090205460ff1681565b61039a610774366004613ec9565b60146020526000908152604090205481565b61039a610794366004613ec9565b60066020526000908152604090205481565b6103e16107b4366004613ec9565b612144565b6103e16107c7366004613f3d565b6121cd565b61039a6107da366004613ea7565b601260209081526000928352604080842090915290825290205481565b61039a610805366004613ea7565b600b60209081526000928352604080842090915290825290205481565b61039a610830366004613ea7565b601060209081526000928352604080842090915290825290205481565b6103c061085b366004613ec9565b612339565b6103e161086e366004613f3d565b612431565b6103c0610881366004613ec9565b6124fb565b6103e1610894366004614281565b6125f3565b61039a6108a7366004613ec9565b600c6020526000908152604090205481565b61039a6108c7366004614040565b612796565b61061e6108da366004614255565b612838565b6103c06108ed36600461406c565b612bd6565b61063b610900366004613f3d565b612d00565b6103e1610913366004613ec9565b612d9b565b61039a610926366004614040565b612ee2565b6103e1612f38565b60008061093e610b34565b9050808361095b6c4f7074696f6e50726963696e6760981b610bc6565b6001600160a01b0316635b7b6d88600061097442612010565b89876109926f566f6c6174696c6974794f7261636c6560801b610bc6565b6001600160a01b0316633af2888b6040518163ffffffff1660e01b815260040160206040518083038186803b1580156109ca57600080fd5b505afa1580156109de573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a0291906142b5565b6040516001600160e01b031960e088901b1681529415156004860152602485019390935260448401919091526064830152608482015260a40160206040518083038186803b158015610a5357600080fd5b505afa158015610a67573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a8b91906142b5565b610a9591906142e4565b610a9f9190614319565b949350505050565b60608160008111610ad35760405162461bcd60e51b8152600401610aca9061432d565b60405180910390fd5b60008381526009602090815260409182902080548351818402810184019094528084529091830182828015610b2757602002820191906000526020600020905b815481526020019060010190808311610b13575b5050505050915050919050565b6000610b516e5264707850726963654f7261636c6560881b610bc6565b6001600160a01b031663e1aa60366040518163ffffffff1660e01b815260040160206040518083038186803b158015610b8957600080fd5b505afa158015610b9d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bc191906142b5565b905090565b6000908152600560205260409020546001600160a01b031690565b6000610bf969476f7665726e616e636560b01b610bc6565b6001600160a01b0316336001600160a01b031614610c295760405162461bcd60e51b8152600401610aca9061434a565b610c316132c8565b50600190565b610c3f613e29565b60025460ff1615610c625760405162461bcd60e51b8152600401610aca90614367565b333b15610c98573360009081526001602052604090205460ff16610c985760405162461bcd60e51b8152600401610aca90614391565b60008381526007602052604090205460ff16610cdc5760405162461bcd60e51b815260206004820152600360248201526245313760e81b6044820152606401610aca565b6000838152600960205260409020548210610d095760405162461bcd60e51b8152600401610aca906143e0565b6000838152600960205260408120805484908110610d2957610d296143fd565b906000526020600020015490508060001415610d575760405162461bcd60e51b8152600401610aca90614413565b60003382604051602001610d6c929190614430565b60408051601f1981840301815291815281516020928301206000888152600e845282812082825290935291205490915080610dcf5760405162461bcd60e51b815260206004820152600360248201526208a62760eb1b6044820152606401610aca565b6000610de1630e488a0b60e31b610bc6565b6000888152600b602090815260408083208884528252808320548b8452600f83528184208985529092528220549293509091610e1e9085906142e4565b610e289190614319565b6000898152600e602090815260408083208884529091528120559050610e586001600160a01b038316338361335b565b60408051898152602081018790523381830152606081018590526080810183905290517fbe7586dfb192ca07af28bcc9fc95e78619abff84853e614ba95a4864e955c5929181900360a00190a16040805160208101909152908152979650505050505050565b600080546001600160a01b03163314610ee95760405162461bcd60e51b8152600401610aca90614452565b838214610f1d5760405162461bcd60e51b8152602060048201526002602482015261229960f11b6044820152606401610aca565b60005b84811015610fd9576000868683818110610f3c57610f3c6143fd565b9050602002013590506000858584818110610f5957610f596143fd565b9050602002016020810190610f6e9190613f3d565b60008381526005602052604080822080546001600160a01b0319166001600160a01b03851690811790915590519293509184917fb37614c7d254ea8d16eb81fa11dddaeb266aa8ba4917980859c7740aff30c69191a350508080610fd190614487565b915050610f20565b50600195945050505050565b6000610ff360025460ff1690565b156110105760405162461bcd60e51b8152600401610aca90614367565b333b15611046573360009081526001602052604090205460ff166110465760405162461bcd60e51b8152600401610aca90614391565b60008281526007602052604090205460ff1661108a5760405162461bcd60e51b815260206004820152600360248201526245313760e81b6044820152606401610aca565b60008281526009602052604090205484106110b75760405162461bcd60e51b8152600401610aca906143e0565b600083116110d75760405162461bcd60e51b8152600401610aca906144a2565b60008281526009602052604081208054869081106110f7576110f76143fd565b9060005260206000200154905080600014156111255760405162461bcd60e51b8152600401610aca90614413565b6000838152600a60209081526040808320848452909152908190205490516370a0823160e01b815233600482015285916001600160a01b0316906370a082319060240160206040518083038186803b15801561118057600080fd5b505afa158015611194573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111b891906142b5565b10156111ec5760405162461bcd60e51b815260206004820152600360248201526222989b60e91b6044820152606401610aca565b600083815260146020526040902054611206908286611d21565b60008481526014602052604081205491935090611224908487612ee2565b90506000611238630e488a0b60e31b610bc6565b9050600084116112705760405162461bcd60e51b815260206004820152600360248201526245313560e81b6044820152606401610aca565b6000858152600a602090815260408083208684529091529081902054905163079cc67960e41b8152336004820152602481018890526001600160a01b03909116906379cc679090604401600060405180830381600087803b1580156112d457600080fd5b505af11580156112e8573d6000803e3d6000fd5b505050506000821115611323576113236113126d2332b2a234b9ba3934b13aba37b960911b610bc6565b6001600160a01b038316908461335b565b6113423361133184876144bf565b6001600160a01b038416919061335b565b60408051868152602081018590523381830152606081018890526080810186905290517f170d93e3a85ba1c08f72d2c0ebd8835178a9b9f444c318ab404506c743d925bd9181900360a00190a15050509392505050565b606082600081116113bc5760405162461bcd60e51b8152600401610aca9061432d565b60008481526009602052604081205490816001600160401b038111156113e4576113e46140fc565b60405190808252806020026020018201604052801561140d578160200160208202803683370190505b50905060005b828110156114c357600087815260096020526040812080548390811061143b5761143b6143fd565b906000526020600020015490506000878260405160200161145d929190614430565b60408051601f19818403018152918152815160209283012060008c8152601384528281208282529093529120548551919250908590859081106114a2576114a26143fd565b602002602001018181525050505080806114bb90614487565b915050611413565b5095945050505050565b606082600081116114f05760405162461bcd60e51b8152600401610aca9061432d565b60008481526009602052604081205490816001600160401b03811115611518576115186140fc565b604051908082528060200260200182016040528015611541578160200160208202803683370190505b50905060005b828110156114c357600087815260096020526040812080548390811061156f5761156f6143fd565b9060005260206000200154905060008782604051602001611591929190614430565b60408051601f19818403018152918152815160209283012060008c8152600e84528281208282529093529120548551919250908590859081106115d6576115d66143fd565b602002602001018181525050505080806115ef90614487565b915050611547565b6060816000811161161a5760405162461bcd60e51b8152600401610aca9061432d565b60008381526009602052604081205490816001600160401b03811115611642576116426140fc565b60405190808252806020026020018201604052801561166b578160200160208202803683370190505b50905060005b828110156116ef576000868152601060209081526040808320600990925282208054919291849081106116a6576116a66143fd565b90600052602060002001548152602001908152602001600020548282815181106116d2576116d26143fd565b6020908102919091010152806116e781614487565b915050611671565b50949350505050565b600061170660025460ff1690565b156117235760405162461bcd60e51b8152600401610aca90614367565b333b15611759573360009081526001602052604090205460ff166117595760405162461bcd60e51b8152600401610aca90614391565b60035460009081526007602052604090205460ff16156117a05760405162461bcd60e51b8152602060048201526002602482015261453360f01b6044820152606401610aca565b60006117ad60035461186f565b915050804210156117e55760405162461bcd60e51b8152602060048201526002602482015261114d60f21b6044820152606401610aca565b6004546117f290826144d6565b4211156118275760405162461bcd60e51b815260206004820152600360248201526245323360e81b6044820152606401610aca565b61182f610b34565b60035460009081526014602052604090205561184b60016133c3565b50506003546000908152600760205260409020805460ff1916600190811790915590565b60008082600081116118935760405162461bcd60e51b8152600401610aca9061432d565b6000848152600660205260409020546118ab81612010565b9250925050915091565b6000546001600160a01b031633146118df5760405162461bcd60e51b8152600401610aca90614452565b6118e9600061360d565b565b600061190369476f7665726e616e636560b01b610bc6565b6001600160a01b0316336001600160a01b0316146119335760405162461bcd60e51b8152600401610aca9061434a565b60025460ff1661197c5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610aca565b81156119b05760405133904780156108fc02916000818181858888f193505050501580156119ae573d6000803e3d6000fd5b505b60005b83811015611a775760008585838181106119cf576119cf6143fd565b90506020020160208101906119e49190613f3d565b6040516370a0823160e01b8152306004820152909150611a649033906001600160a01b038416906370a082319060240160206040518083038186803b158015611a2c57600080fd5b505afa158015611a40573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061133191906142b5565b5080611a6f81614487565b9150506119b3565b506040513381527f5e7b34819cd91b239220bec92fcfd3c10da2214ba13e4e2b1f6c9cfdbd68a9a29060200160405180910390a15060015b9392505050565b60096020528160005260406000208181548110611ad257600080fd5b90600052602060002001600091509150505481565b6000611af560025460ff1690565b15611b125760405162461bcd60e51b8152600401610aca90614367565b8251845114611b485760405162461bcd60e51b8152602060048201526002602482015261229960f11b6044820152606401610aca565b60005b8451811015611ba457611b91858281518110611b6957611b696143fd565b6020026020010151858381518110611b8357611b836143fd565b602002602001015185611d3d565b5080611b9c81614487565b915050611b4b565b506001949350505050565b60608160008111611bd25760405162461bcd60e51b8152600401610aca9061432d565b60008381526009602052604081205490816001600160401b03811115611bfa57611bfa6140fc565b604051908082528060200260200182016040528015611c23578160200160208202803683370190505b50905060005b828110156116ef576000868152600a6020908152604080832060099092528220805491929184908110611c5e57611c5e6143fd565b9060005260206000200154815260200190815260200160002060009054906101000a90046001600160a01b0316828281518110611c9d57611c9d6143fd565b6001600160a01b039092166020928302919091019091015280611cbf81614487565b915050611c29565b6000611cdf69476f7665726e616e636560b01b610bc6565b6001600160a01b0316336001600160a01b031614611d0f5760405162461bcd60e51b8152600401610aca9061434a565b611d1761365d565b610c3160006133c3565b6000828411611d31576000610a9f565b8382610a8b85836144bf565b6000611d4b60025460ff1690565b15611d685760405162461bcd60e51b8152600401610aca90614367565b333b15611d9e573360009081526001602052604090205460ff16611d9e5760405162461bcd60e51b8152600401610aca90614391565b60006003546001611daf91906144d6565b60035490915015611e1c5760035460009081526007602052604090205460ff168015611dea575060008181526008602052604090205460ff16155b611e1c5760405162461bcd60e51b815260206004820152600360248201526245313960e81b6044820152606401610aca565b6000818152600960205260409020548510611e495760405162461bcd60e51b8152600401610aca906143e0565b60008411611e695760405162461bcd60e51b8152600401610aca906144a2565b6000818152600960205260408120805487908110611e8957611e896143fd565b906000526020600020015490508060001415611eb75760405162461bcd60e51b8152600401610aca90614413565b60008482604051602001611ecc929190614430565b604051602081830303815290604052805190602001209050611f0b333088611efa630e488a0b60e31b610bc6565b6001600160a01b03169291906136b5565b6000838152600e6020908152604080832084845290915281208054889290611f349084906144d6565b90915550506000838152600b6020908152604080832085845290915281208054889290611f629084906144d6565b90915550506000838152600c602052604081208054889290611f859084906144d6565b90915550506000838152600d602052604081208054889290611fa89084906144d6565b909155505060408051848152602081018490529081018790526001600160a01b03861660608201523360808201527fcaa9001342572663a8f7c22e7c6f0331a45254407418d9f993ed2d1485adc2059060a00160405180910390a15060019695505050505050565b60008061203a61201f846136f3565b61202885613713565b6120339060016144d6565b600061372d565b9050600561204782613748565b101561207f5761207c612059826136f3565b61206283613713565b600761206d8561377c565b61207791906144bf565b61372d565b90505b60006120c761208d836136f3565b61209684613713565b61209f85613748565b6120a88661377c565b6120b39060056144d6565b6120bd91906144bf565b600860008061378e565b9050838111611aaf5760006120f26120de866136f3565b6120e787613713565b6120339060026144d6565b905060056120ff82613748565b101561211457612111612059826136f3565b90505b61213b612120826136f3565b61212983613713565b61213284613748565b6120a88561377c565b95945050505050565b600061215c69476f7665726e616e636560b01b610bc6565b6001600160a01b0316336001600160a01b03161461218c5760405162461bcd60e51b8152600401610aca9061434a565b60048290556040518281527f5259439c9ac2029585dd4a349897aa1e8298d26537c3b57453f275126db919189060200160405180910390a15060015b919050565b600080546001600160a01b031633146121f85760405162461bcd60e51b8152600401610aca90614452565b813b6122645760405162461bcd60e51b815260206004820152603560248201527f436f6e747261637457686974656c6973743a2041646472657373206d757374206044820152746265206120636f6e7472616374206164647265737360581b6064820152608401610aca565b6001600160a01b03821660009081526001602052604090205460ff16156122e55760405162461bcd60e51b815260206004820152602f60248201527f436f6e747261637457686974656c6973743a20436f6e747261637420616c726560448201526e18591e481dda1a5d195b1a5cdd1959608a1b6064820152608401610aca565b6001600160a01b0382166000818152600160208190526040808320805460ff1916909217909155517ffbd3cde7ff522a917e485c8ed2a6e87590887ab399f5ac312307903f498543079190a2506001919050565b6060816000811161235c5760405162461bcd60e51b8152600401610aca9061432d565b60008381526009602052604081205490816001600160401b03811115612384576123846140fc565b6040519080825280602002602001820160405280156123ad578160200160208202803683370190505b50905060005b828110156116ef576000868152600b60209081526040808320600990925282208054919291849081106123e8576123e86143fd565b9060005260206000200154815260200190815260200160002054828281518110612414576124146143fd565b60209081029190910101528061242981614487565b9150506123b3565b6001600160a01b03811660009081526001602052604081205460ff166124ad5760405162461bcd60e51b815260206004820152602b60248201527f436f6e747261637457686974656c6973743a20436f6e7472616374206e6f742060448201526a1dda1a5d195b1a5cdd195960aa1b6064820152608401610aca565b6001600160a01b038216600081815260016020526040808220805460ff19169055517f8e81447740597754af5db3e176253a36f7981a9549f48ace3f0cb233913f9d859190a2506001919050565b6060816000811161251e5760405162461bcd60e51b8152600401610aca9061432d565b60008381526009602052604081205490816001600160401b03811115612546576125466140fc565b60405190808252806020026020018201604052801561256f578160200160208202803683370190505b50905060005b828110156116ef576000868152601260209081526040808320600990925282208054919291849081106125aa576125aa6143fd565b90600052602060002001548152602001908152602001600020548282815181106125d6576125d66143fd565b6020908102919091010152806125eb81614487565b915050612575565b600080546001600160a01b0316331461261e5760405162461bcd60e51b8152600401610aca90614452565b60025460ff16156126415760405162461bcd60e51b8152600401610aca90614367565b6000600354600161265291906144d6565b6000818152600c6020526040902054909150156126965760405162461bcd60e51b815260206004820152600260248201526108a760f31b6044820152606401610aca565b600354156126e45760006126ab60035461186f565b9150508042116126e25760405162461bcd60e51b8152602060048201526002602482015261453960f01b6044820152606401610aca565b505b6000818152600960209081526040909120845161270392860190613e47565b5060008181526006602052604081204290555b835181101561278c577f5185be10ef2a03e926961817be495a630ded54bceffb3ba11f6af477c9c7668282858381518110612753576127536143fd565b6020026020010151604051612772929190918252602082015260400190565b60405180910390a18061278481614487565b915050612716565b5060019392505050565b60006127af6a466565537472617465677960a81b610bc6565b604051633a11a3b960e21b81526004810186905260248101859052604481018490526001600160a01b03919091169063e8468ee4906064015b60206040518083038186803b15801561280057600080fd5b505afa158015612814573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a9f91906142b5565b60008061284760025460ff1690565b156128645760405162461bcd60e51b8152600401610aca90614367565b333b1561289a573360009081526001602052604090205460ff1661289a5760405162461bcd60e51b8152600401610aca90614391565b60035460009081526008602052604090205460ff166128e15760405162461bcd60e51b815260206004820152600360248201526204532360ec1b6044820152606401610aca565b60035460009081526009602052604090205485106129115760405162461bcd60e51b8152600401610aca906143e0565b600084116129315760405162461bcd60e51b8152600401610aca906144a2565b6003546000908152600960205260408120805487908110612954576129546143fd565b9060005260206000200154905080600014156129825760405162461bcd60e51b8152600401610aca90614413565b60008482604051602001612997929190614430565b60405160208183030381529060405280519060200120905060006129c1630e488a0b60e31b610bc6565b905060006129cd610b34565b905060006129db858a610933565b905060006129ea83878c612796565b60035460009081526010602090815260408083208a8452909152812080549293508c92909190612a1b9084906144d6565b90915550506003546000908152601160209081526040808320888452909152812080548c9290612a4c9084906144d6565b9091555050600354600090815260126020908152604080832089845290915281208054849290612a7d9084906144d6565b9091555050600354600090815260136020908152604080832088845290915281208054849290612aae9084906144d6565b90915550506003546000908152600d602052604081208054849290612ad49084906144d6565b90915550612afb90503330612ae984866144d6565b6001600160a01b0388169291906136b5565b8015612b2f57612b2f612b1e6d2332b2a234b9ba3934b13aba37b960911b610bc6565b6001600160a01b038616908361335b565b6003546000908152600a60209081526040808320898452909152902054612b60906001600160a01b03168a8c61335b565b600354604080519182526020820188905281018b905260608101839052608081018290526001600160a01b038a1660a08201523360c08201527f78de8c82973d11415ea2004f458680aa6d5826c3e8a798496a61db56fa66417b9060e00160405180910390a1909a909950975050505050505050565b60608260008111612bf95760405162461bcd60e51b8152600401610aca9061432d565b60008481526009602052604081205490816001600160401b03811115612c2157612c216140fc565b604051908082528060200260200182016040528015612c4a578160200160208202803683370190505b50905060005b828110156114c3576000878152600960205260408120805483908110612c7857612c786143fd565b9060005260206000200154905060008782604051602001612c9a929190614430565b60408051601f19818403018152918152815160209283012060008c815260118452828120828252909352912054855191925090859085908110612cdf57612cdf6143fd565b60200260200101818152505050508080612cf890614487565b915050612c50565b6000546001600160a01b03163314612d2a5760405162461bcd60e51b8152600401610aca90614452565b6001600160a01b038116612d8f5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610aca565b612d988161360d565b50565b6000612db369476f7665726e616e636560b01b610bc6565b6001600160a01b0316336001600160a01b031614612de35760405162461bcd60e51b8152600401610aca9061434a565b60025460ff1615612e065760405162461bcd60e51b8152600401610aca90614367565b60035460009081526007602052604090205460ff1615612e4d5760405162461bcd60e51b8152602060048201526002602482015261453360f01b6044820152606401610aca565b6000612e5a60035461186f565b91505060045481612e6b91906144d6565b4211612e9e5760405162461bcd60e51b8152602060048201526002602482015261114d60f21b6044820152606401610aca565b6003546000908152601460205260409020839055612ebc60016133c3565b50506003546000908152600760205260409020805460ff19166001908117909155919050565b6000612efb6a466565537472617465677960a81b610bc6565b604051637b95fc7f60e11b81526004810186905260248101859052604481018490526001600160a01b03919091169063f72bf8fe906064016127e8565b600080546001600160a01b03163314612f635760405162461bcd60e51b8152600401610aca90614452565b60025460ff1615612f865760405162461bcd60e51b8152600401610aca90614367565b60006003546001612f9791906144d6565b60008181526008602052604090205490915060ff1615612fde5760405162461bcd60e51b8152602060048201526002602482015261453560f01b6044820152606401610aca565b60008181526009602052604090205461301e5760405162461bcd60e51b8152602060048201526002602482015261229b60f11b6044820152606401610aca565b6003541561306c5760035460009081526007602052604090205460ff1661306c5760405162461bcd60e51b8152602060048201526002602482015261453760f01b6044820152606401610aca565b60005b6000828152600960205260409020548110156132675760008281526009602052604081208054839081106130a5576130a56143fd565b9060005260206000200154905060006130e7604051806040016040528060098152602001681c9114160b50d0531360ba1b8152506130e2846137ea565b6138e7565b905061311281604051806040016040528060078152602001662d45504f43482d60c81b8152506138e7565b9050613121816130e2866137ea565b9050600061314e7f000000000000000000000000a07113e6e63c6d99081fcf7e0aecfcf73157c028613913565b60405163266c45bb60e11b81529091506001600160a01b03821690634cd88b769061317f9085908190600401614546565b600060405180830381600087803b15801561319957600080fd5b505af11580156131ad573d6000803e3d6000fd5b5050506000868152600a60209081526040808320878452825280832080546001600160a01b0319166001600160a01b038716908117909155898452600b8352818420888552909252918290205491516340c10f1960e01b8152306004820152602481019290925291506340c10f1990604401600060405180830381600087803b15801561323957600080fd5b505af115801561324d573d6000803e3d6000fd5b50505050505050808061325f90614487565b91505061306f565b5060008181526008602052604090819020805460ff191660011790556003829055517fb5ca1ca1b7b47549eb8af476f3ef702fc63bcd8b8c01dc163b009bb818f97997906132b89083815260200190565b60405180910390a1600191505090565b60025460ff166133115760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610aca565b6002805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b6040516001600160a01b0383166024820152604481018290526133be90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526139ab565b505050565b6003546000908152600d602052604090205415612d985760035460009081526009602090815260408083208054825181850281018501909352808352919290919083018282801561343357602002820191906000526020600020905b81548152602001906001019080831161341f575b5050505050905060005b81518110156133be5760006134c060146000600354815260200190815260200160002054848481518110613473576134736143fd565b602002602001015160106000600354815260200190815260200160002060008787815181106134a4576134a46143fd565b6020026020010151815260200190815260200160002054611d21565b905080600b6000600354815260200190815260200160002060008585815181106134ec576134ec6143fd565b602002602001015181526020019081526020016000205461350d91906144bf565b600f600060035481526020019081526020016000206000858581518110613536576135366143fd565b60200260200101518152602001908152602001600020600082825461355b91906144d6565b909155505083156135fa57601260006003548152602001908152602001600020600084848151811061358f5761358f6143fd565b6020026020010151815260200190815260200160002054600f6000600354815260200190815260200160002060008585815181106135cf576135cf6143fd565b6020026020010151815260200190815260200160002060008282546135f491906144d6565b90915550505b508061360581614487565b91505061343d565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60025460ff16156136805760405162461bcd60e51b8152600401610aca90614367565b6002805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25861333e3390565b6040516001600160a01b03808516602483015283166044820152606481018290526136ed9085906323b872dd60e01b90608401613387565b50505050565b600061370a6137056201518084614319565b613a7d565b50909392505050565b60006137256137056201518084614319565b509392505050565b60006201518061373e858585613bf1565b610a9f91906142e4565b6000806137586201518084614319565b905060076137678260036144d6565b613771919061456b565b611aaf9060016144d6565b6000610a9f6137056201518084614319565b60008161379c603c856142e4565b6137a8610e10876142e4565b620151806137b78b8b8b613bf1565b6137c191906142e4565b6137cb91906144d6565b6137d591906144d6565b6137df91906144d6565b979650505050505050565b60608161380e5750506040805180820190915260018152600360fc1b602082015290565b8160005b8115613838578061382281614487565b91506138319050600a83614319565b9150613812565b6000816001600160401b03811115613852576138526140fc565b6040519080825280601f01601f19166020018201604052801561387c576020820181803683370190505b5090505b8415610a9f576138916001836144bf565b915061389e600a8661456b565b6138a99060306144d6565b60f81b8183815181106138be576138be6143fd565b60200101906001600160f81b031916908160001a9053506138e0600a86614319565b9450613880565b606082826040516020016138fc92919061457f565b604051602081830303815290604052905092915050565b6000604051733d602d80600a3d3981f3363d3d373d3d3d363d7360601b81528260601b60148201526e5af43d82803e903d91602b57fd5bf360881b60288201526037816000f09150506001600160a01b0381166121c85760405162461bcd60e51b8152602060048201526016602482015275115490cc4c4d8dce8818dc99585d194819985a5b195960521b6044820152606401610aca565b6000613a00826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316613d2e9092919063ffffffff16565b8051909150156133be5780806020019051810190613a1e91906145ae565b6133be5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610aca565b60008080838162253d8c613a948362010bd96145cb565b613a9e91906145cb565b9050600062023ab1613ab183600461460c565b613abb9190614691565b90506004613acc8262023ab161460c565b613ad79060036145cb565b613ae19190614691565b613aeb90836146bf565b9150600062164b09613afe8460016145cb565b613b0a90610fa061460c565b613b149190614691565b90506004613b24826105b561460c565b613b2e9190614691565b613b3890846146bf565b613b4390601f6145cb565b9250600061098f613b5585605061460c565b613b5f9190614691565b905060006050613b718361098f61460c565b613b7b9190614691565b613b8590866146bf565b9050613b92600b83614691565b9450613b9f85600c61460c565b613baa8360026145cb565b613bb491906146bf565b91508483613bc36031876146bf565b613bce90606461460c565b613bd891906145cb565b613be291906145cb565b9a919950975095505050505050565b60006107b2841015613c0257600080fd5b838383600062253d8c60046064600c613c1c600e886146bf565b613c269190614691565b613c32886113246145cb565b613c3c91906145cb565b613c469190614691565b613c5190600361460c565b613c5b9190614691565b600c80613c69600e886146bf565b613c739190614691565b613c7e90600c61460c565b613c896002886146bf565b613c9391906146bf565b613c9f9061016f61460c565b613ca99190614691565b6004600c613cb8600e896146bf565b613cc29190614691565b613cce896112c06145cb565b613cd891906145cb565b613ce4906105b561460c565b613cee9190614691565b613cfa617d4b876146bf565b613d0491906145cb565b613d0e91906145cb565b613d1891906146bf565b613d2291906146bf565b98975050505050505050565b6060610a9f848460008585843b613d875760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610aca565b600080866001600160a01b03168587604051613da391906146fe565b60006040518083038185875af1925050503d8060008114613de0576040519150601f19603f3d011682016040523d82523d6000602084013e613de5565b606091505b50915091506137df82828660608315613dff575081611aaf565b825115613e0f5782518084602001fd5b8160405162461bcd60e51b8152600401610aca919061471a565b60405180602001604052806001906020820280368337509192915050565b828054828255906000526020600020908101928215613e82579160200282015b82811115613e82578251825591602001919060010190613e67565b50613e8e929150613e92565b5090565b5b80821115613e8e5760008155600101613e93565b60008060408385031215613eba57600080fd5b50508035926020909101359150565b600060208284031215613edb57600080fd5b5035919050565b6020808252825182820181905260009190848201906040850190845b81811015613f1a57835183529284019291840191600101613efe565b50909695505050505050565b80356001600160a01b03811681146121c857600080fd5b600060208284031215613f4f57600080fd5b611aaf82613f26565b602081810190828460005b6001811015613f8057815183529183019190830190600101613f63565b5050505092915050565b60008083601f840112613f9c57600080fd5b5081356001600160401b03811115613fb357600080fd5b6020830191508360208260051b8501011115613fce57600080fd5b9250929050565b60008060008060408587031215613feb57600080fd5b84356001600160401b038082111561400257600080fd5b61400e88838901613f8a565b9096509450602087013591508082111561402757600080fd5b5061403487828801613f8a565b95989497509550505050565b60008060006060848603121561405557600080fd5b505081359360208301359350604090920135919050565b6000806040838503121561407f57600080fd5b8235915061408f60208401613f26565b90509250929050565b8015158114612d9857600080fd5b6000806000604084860312156140bb57600080fd5b83356001600160401b038111156140d157600080fd5b6140dd86828701613f8a565b90945092505060208401356140f181614098565b809150509250925092565b634e487b7160e01b600052604160045260246000fd5b600082601f83011261412357600080fd5b813560206001600160401b038083111561413f5761413f6140fc565b8260051b604051601f19603f83011681018181108482111715614164576141646140fc565b60405293845285810183019383810192508785111561418257600080fd5b83870191505b848210156137df57813583529183019190830190614188565b6000806000606084860312156141b657600080fd5b83356001600160401b03808211156141cd57600080fd5b6141d987838801614112565b945060208601359150808211156141ef57600080fd5b506141fc86828701614112565b92505061420b60408501613f26565b90509250925092565b6020808252825182820181905260009190848201906040850190845b81811015613f1a5783516001600160a01b031683529284019291840191600101614230565b60008060006060848603121561426a57600080fd5b833592506020840135915061420b60408501613f26565b60006020828403121561429357600080fd5b81356001600160401b038111156142a957600080fd5b610a9f84828501614112565b6000602082840312156142c757600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b60008160001904831182151516156142fe576142fe6142ce565b500290565b634e487b7160e01b600052601260045260246000fd5b60008261432857614328614303565b500490565b60208082526003908201526245313360e81b604082015260600190565b60208082526003908201526222991960e91b604082015260600190565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b6020808252602f908201527f436f6e747261637457686974656c6973743a20436f6e7472616374206d75737460408201526e081899481dda1a5d195b1a5cdd1959608a1b606082015260800190565b60208082526003908201526204531360ec1b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b60208082526003908201526222989960e91b604082015260600190565b60609290921b6bffffffffffffffffffffffff19168252601482015260340190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060001982141561449b5761449b6142ce565b5060010190565b60208082526003908201526245313160e81b604082015260600190565b6000828210156144d1576144d16142ce565b500390565b600082198211156144e9576144e96142ce565b500190565b60005b838110156145095781810151838201526020016144f1565b838111156136ed5750506000910152565b600081518084526145328160208601602086016144ee565b601f01601f19169290920160200192915050565b604081526000614559604083018561451a565b828103602084015261213b818561451a565b60008261457a5761457a614303565b500690565b600083516145918184602088016144ee565b8351908301906145a58183602088016144ee565b01949350505050565b6000602082840312156145c057600080fd5b8151611aaf81614098565b600080821280156001600160ff1b03849003851316156145ed576145ed6142ce565b600160ff1b8390038412811615614606576146066142ce565b50500190565b60006001600160ff1b0381841382841380821686840486111615614632576146326142ce565b600160ff1b6000871282811687830589121615614651576146516142ce565b6000871292508782058712848416161561466d5761466d6142ce565b87850587128184161615614683576146836142ce565b505050929093029392505050565b6000826146a0576146a0614303565b600160ff1b8214600019841416156146ba576146ba6142ce565b500590565b60008083128015600160ff1b8501841216156146dd576146dd6142ce565b6001600160ff1b03840183138116156146f8576146f86142ce565b50500390565b600082516147108184602087016144ee565b9190910192915050565b602081526000611aaf602083018461451a56fea2646970667358221220976ef15a72dfa6658e540819aa480111ad1fb94ea171cd1256192a2754ce5b1364736f6c63430008090033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000032eb7902d4134bf98a28b963d26de779af92a2120000000000000000000000002b99e3d67dad973c1b9747da742b7e26c8bdd67b000000000000000000000000c0cdd1176aa1624b89b7476142b41c04414afaa00000000000000000000000003e0215c1d639280e13b46e3af94fb5630d1b321200000000000000000000000055594cce8cc0014ea08c49fd820d731308f204c10000000000000000000000001a5444362857cafdc58ab95b79a5a9285d16563a
-----Decoded View---------------
Arg [0] : _rdpx (address): 0x32Eb7902D4134bf98A28b963D26de779AF92A212
Arg [1] : _optionPricing (address): 0x2b99e3D67dAD973c1B9747Da742B7E26c8Bdd67B
Arg [2] : _rdpxPriceOracle (address): 0xC0cdD1176aA1624b89B7476142b41C04414afaa0
Arg [3] : _volatilityOracle (address): 0x3E0215c1D639280e13B46e3aF94Fb5630d1b3212
Arg [4] : _feeDistributor (address): 0x55594cCe8cC0014eA08C49fd820D731308f204c1
Arg [5] : _feeStrategy (address): 0x1a5444362857CaFDc58AB95b79A5A9285d16563A
-----Encoded View---------------
6 Constructor Arguments found :
Arg [0] : 00000000000000000000000032eb7902d4134bf98a28b963d26de779af92a212
Arg [1] : 0000000000000000000000002b99e3d67dad973c1b9747da742b7e26c8bdd67b
Arg [2] : 000000000000000000000000c0cdd1176aa1624b89b7476142b41c04414afaa0
Arg [3] : 0000000000000000000000003e0215c1d639280e13b46e3af94fb5630d1b3212
Arg [4] : 00000000000000000000000055594cce8cc0014ea08c49fd820d731308f204c1
Arg [5] : 0000000000000000000000001a5444362857cafdc58ab95b79a5a9285d16563a
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.