Feature Tip: Add private address tag to any address under My Name Tag !
Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
Splitter
Compiler Version
v0.8.16+commit.07a7930e
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity 0.8.16; import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/access/AccessControlEnumerableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/utils/math/Math.sol"; import "./interfaces/solidly/IGauge.sol"; import "./interfaces/INFTHolder.sol"; import "./interfaces/IVeDepositor.sol"; import "./interfaces/solidly/IBaseV1Voter.sol"; import "./interfaces/solidly/IVotingEscrow.sol"; import "./interfaces/solidly/IBaseV1Minter.sol"; /************************************************** * Splitter **************************************************/ /** * Methods in this contract assumes all interactions with gauges and bribes are safe * and that the anti-bricking logics are all already processed by voterProxy */ contract Splitter is IERC721Receiver, Initializable, AccessControlEnumerableUpgradeable, PausableUpgradeable { using SafeMath for uint256; /********** Storage slots start here **********/ bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE"); bytes32 public constant UNPAUSER_ROLE = keccak256("UNPAUSER_ROLE"); bytes32 public constant SETTER_ROLE = keccak256("SETTER_ROLE"); uint256 public workTimeLimit; // re-entrancy uint256 internal _unlocked; // Public addresses uint256 public splitTokenId; IBaseV1Voter public solidlyVoter; IVotingEscrow public votingEscrow; IBaseV1Minter public minter; ILpDepositor public NFTHolder; IVeDepositor public moSolid; address public elmoSOLID; uint256 public minTipPerGauge; uint256 public minBond; uint256 public fee; // States uint256 public lastSplitTimestamp; // Records last successful split timestamp address public currentWorker; uint256 public workingStage; uint256 public workFinishDeadline; mapping(address => bool) public reattachGauge; // Gauges to reattach uint256 public reattachGaugeLength; // Length of gauges to reattach // Accounting uint256 public totalSplitRequested; mapping(address => uint256) public balanceOf; // User => claimable balance mapping(address => uint256) public lastBurnTimestamp; // User => last burn timestamp /**************************************** * Events ****************************************/ event RequestBurn(address indexed from, uint256 amount); event WorkStarted(address indexed worker, uint256 deadline); event WorkerSplit(uint256 amount); event SplitClaimed(address indexed user, uint256 tokenId, uint256 amount); /**************************************** * Modifiers ****************************************/ modifier lock() { require(_unlocked != 2, "Reentrancy"); _unlocked = 2; _; _unlocked = 1; } modifier onlyStage(uint256 stage) { require(stage == workingStage, "Not current stage"); _; } function initialize( address _votingEscrow, address _minterAddress, address _solidlyVoter, uint256 _minTipPerGauge, uint256 _minBond, address admin, address setter, address pauser ) public initializer { __Pausable_init(); __AccessControlEnumerable_init(); votingEscrow = IVotingEscrow(_votingEscrow); minter = IBaseV1Minter(_minterAddress); solidlyVoter = IBaseV1Voter(_solidlyVoter); // Set presets _unlocked = 1; workTimeLimit = 3600; // 1 hour fee = 3e16; // 3% minTipPerGauge = _minTipPerGauge; minBond = _minBond; _grantRole(DEFAULT_ADMIN_ROLE, admin); _grantRole(UNPAUSER_ROLE, admin); _grantRole(SETTER_ROLE, setter); _grantRole(PAUSER_ROLE, pauser); } /**************************************** * Initialize ****************************************/ /** * @notice Initialize proxy storage */ function setAddresses( address _NFTHolder, address _moSolid, address _elmoSOLID ) public onlyRole(SETTER_ROLE) { // Set addresses and interfaces NFTHolder = ILpDepositor(_NFTHolder); moSolid = IVeDepositor(_moSolid); elmoSOLID = _elmoSOLID; } /**************************************** * View Methods ****************************************/ function totalTips() external view returns (uint256) { return address(this).balance; } function minTip() public view returns (uint256) { return votingEscrow.attachments(NFTHolder.tokenID()) * minTipPerGauge; } /**************************************** * User Methods ****************************************/ function requestSplit(uint256 splitAmount) external payable onlyStage(0) whenNotPaused { require(splitAmount > 0, "Cannot split 0"); require( balanceOf[msg.sender] == 0 || lastBurnTimestamp[msg.sender] > lastSplitTimestamp, "Claim available split first" ); require(msg.value >= minTip(), "Not enough tips"); uint256 feeAmount = (splitAmount * fee) / 1e18; uint256 burnAmount = splitAmount - feeAmount; // Burn moSolid moSolid.burnFrom(msg.sender, burnAmount); // Transfer fee require( moSolid.transferFrom(msg.sender, elmoSOLID, feeAmount), "TRANSFER FAILED" ); // Record user data balanceOf[msg.sender] += splitAmount; lastBurnTimestamp[msg.sender] = block.timestamp; // Record global data totalSplitRequested += splitAmount; emit RequestBurn(msg.sender, splitAmount); } function claimSplitVeNft() external lock whenNotPaused returns (uint256 tokenId) { require( lastBurnTimestamp[msg.sender] < lastSplitTimestamp, "Split not processed" ); uint256 amount = balanceOf[msg.sender]; require(amount > 0, "Nothing to claim"); // Reset state balanceOf[msg.sender] = 0; // Split if amount < total locked (uint256 lockedAmount, ) = votingEscrow.locked(splitTokenId); if (amount < uint128(lockedAmount)) { tokenId = votingEscrow.split(splitTokenId, amount); } else { // Transfer splitTokenId instead of split if amount = locked tokenId = splitTokenId; splitTokenId = 0; } votingEscrow.safeTransferFrom(address(this), msg.sender, tokenId); emit SplitClaimed(msg.sender, tokenId, amount); return tokenId; } /**************************************** * Worker Methods ****************************************/ function startWork() external payable lock onlyStage(0) whenNotPaused { uint256 activePeriod = minter.active_period(); require(activePeriod > lastSplitTimestamp, "Not new epoch"); require( block.timestamp < activePeriod + 1 weeks - NFTHolder.votingWindow() - workTimeLimit, "Cannot start work close to voting window" ); // Require workers to post bonds of 10% of the rewards, minimum: minBond require( msg.value >= Math.max(minBond, address(this).balance.sub(msg.value) / 10), "Not enough bond" ); NFTHolder.enterSplitMode(workTimeLimit); // Set work status currentWorker = msg.sender; workFinishDeadline = block.timestamp + workTimeLimit; workingStage = 1; emit WorkStarted(msg.sender, block.timestamp + workTimeLimit); } function detachGauges(address[] memory gaugeAddresses) external onlyStage(1) { uint256 _reattachGaugeLength = 0; address[] memory validGauges = new address[](gaugeAddresses.length); for (uint256 i = 0; i < gaugeAddresses.length; i++) { require(solidlyVoter.isGauge(gaugeAddresses[i]), "Invalid gauge"); if (IGauge(gaugeAddresses[i]).tokenIds(address(NFTHolder)) > 0) { reattachGauge[gaugeAddresses[i]] = true; validGauges[_reattachGaugeLength] = gaugeAddresses[i]; _reattachGaugeLength++; } } // Update array length assembly { mstore(validGauges, _reattachGaugeLength) } reattachGaugeLength += _reattachGaugeLength; // Detach gauges NFTHolder.detachGauges(validGauges); } function resetVotes() external onlyStage(1) { require( block.timestamp < minter.active_period() + 1 weeks, //- votingSnapshot.window(), "Voting underway" ); solidlyVoter.vote( NFTHolder.tokenID(), new address[](0), new int256[](0) ); } /** * @notice Split and enter next stage if possible */ function finishStage1() external lock onlyStage(1) { uint256 _primaryTokenId = NFTHolder.tokenID(); require( votingEscrow.attachments(_primaryTokenId) == 0, "Gauge Attachments" ); require(!votingEscrow.voted(_primaryTokenId), "Vote not cleared"); // Split veNFT uint256 incomingTokenId = votingEscrow.split( _primaryTokenId, totalSplitRequested ); emit WorkerSplit(totalSplitRequested); // Reset totalSplitRequested totalSplitRequested = 0; // Merge incoming veNFT into tokenId of splitting veNFT if (splitTokenId > 0) { votingEscrow.merge(incomingTokenId, splitTokenId); } else { splitTokenId = incomingTokenId; } // Record split timestamp lastSplitTimestamp = block.timestamp; // Enter next stage workingStage = 2; } function reattachGauges(address[] memory gaugeAddresses) external onlyStage(2) { // Process reattachGauge and reattachGaugeLength uint256 _reattachedGaugeLength = 0; address[] memory validGauges = new address[](gaugeAddresses.length); for (uint256 i = 0; i < gaugeAddresses.length; i++) { if (reattachGauge[gaugeAddresses[i]]) { reattachGauge[gaugeAddresses[i]] = false; validGauges[_reattachedGaugeLength] = gaugeAddresses[i]; _reattachedGaugeLength++; } } // Update array length assembly { mstore(validGauges, _reattachedGaugeLength) } reattachGaugeLength -= _reattachedGaugeLength; NFTHolder.reattachGauges(validGauges); } function claimTips() external lock onlyStage(2) { require(reattachGaugeLength == 0, "Not all gauges were reattached"); require( msg.sender == currentWorker || block.timestamp > workFinishDeadline, "Only current worker can claim tips unless over deadline" ); (bool success, ) = msg.sender.call{value: address(this).balance}(""); require(success, "Transfer tip failed"); // Reset status currentWorker = address(0); workingStage = 0; } /** * @notice Only allow inbound ERC721s during contract calls */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external override returns (bytes4) { require(_unlocked == 2, "No inbound ERC721s"); return IERC721Receiver.onERC721Received.selector; } /**************************************** * Restricted Methods ****************************************/ function setMinTipPerGauge(uint256 _minTipPerGauge) public onlyRole(SETTER_ROLE) { minTipPerGauge = _minTipPerGauge; } function setMinBond(uint256 _minBond) public onlyRole(SETTER_ROLE) { minBond = _minBond; } function setFee(uint256 _fee) public onlyRole(SETTER_ROLE) { fee = _fee; } function setWorkTimeLimit(uint256 _workTimeLimit) public onlyRole(SETTER_ROLE) { workTimeLimit = _workTimeLimit; } function pause() external onlyRole(PAUSER_ROLE) { _pause(); } function unpause() external onlyRole(UNPAUSER_ROLE) { _unpause(); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControlEnumerable.sol) pragma solidity ^0.8.0; import "./IAccessControlEnumerableUpgradeable.sol"; import "./AccessControlUpgradeable.sol"; import "../utils/structs/EnumerableSetUpgradeable.sol"; import "../proxy/utils/Initializable.sol"; /** * @dev Extension of {AccessControl} that allows enumerating the members of each role. */ abstract contract AccessControlEnumerableUpgradeable is Initializable, IAccessControlEnumerableUpgradeable, AccessControlUpgradeable { function __AccessControlEnumerable_init() internal onlyInitializing { } function __AccessControlEnumerable_init_unchained() internal onlyInitializing { } using EnumerableSetUpgradeable for EnumerableSetUpgradeable.AddressSet; mapping(bytes32 => EnumerableSetUpgradeable.AddressSet) private _roleMembers; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControlEnumerableUpgradeable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) public view virtual override returns (address) { return _roleMembers[role].at(index); } /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) public view virtual override returns (uint256) { return _roleMembers[role].length(); } /** * @dev Overload {_grantRole} to track enumerable memberships */ function _grantRole(bytes32 role, address account) internal virtual override { super._grantRole(role, account); _roleMembers[role].add(account); } /** * @dev Overload {_revokeRole} to track enumerable memberships */ function _revokeRole(bytes32 role, address account) internal virtual override { super._revokeRole(role, account); _roleMembers[role].remove(account); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (access/AccessControl.sol) pragma solidity ^0.8.0; import "./IAccessControlUpgradeable.sol"; import "../utils/ContextUpgradeable.sol"; import "../utils/StringsUpgradeable.sol"; import "../utils/introspection/ERC165Upgradeable.sol"; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight version that doesn't allow enumerating role * members except through off-chain means by accessing the contract event logs. Some * applications may benefit from on-chain enumerability, for those cases see * {AccessControlEnumerable}. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ``` * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ``` * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. */ abstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable { function __AccessControl_init() internal onlyInitializing { } function __AccessControl_init_unchained() internal onlyInitializing { } struct RoleData { mapping(address => bool) members; bytes32 adminRole; } mapping(bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with a standardized message including the required role. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ * * _Available since v4.1._ */ modifier onlyRole(bytes32 role) { _checkRole(role); _; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControlUpgradeable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view virtual override returns (bool) { return _roles[role].members[account]; } /** * @dev Revert with a standard message if `_msgSender()` is missing `role`. * Overriding this function changes the behavior of the {onlyRole} modifier. * * Format of the revert message is described in {_checkRole}. * * _Available since v4.6._ */ function _checkRole(bytes32 role) internal view virtual { _checkRole(role, _msgSender()); } /** * @dev Revert with a standard message if `account` is missing `role`. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ */ function _checkRole(bytes32 role, address account) internal view virtual { if (!hasRole(role, account)) { revert( string( abi.encodePacked( "AccessControl: account ", StringsUpgradeable.toHexString(account), " is missing role ", StringsUpgradeable.toHexString(uint256(role), 32) ) ) ); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleGranted} event. */ function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleRevoked} event. */ function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been revoked `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. * * May emit a {RoleRevoked} event. */ function renounceRole(bytes32 role, address account) public virtual override { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * May emit a {RoleGranted} event. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== * * NOTE: This function is deprecated in favor of {_grantRole}. */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { bytes32 previousAdminRole = getRoleAdmin(role); _roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Grants `role` to `account`. * * Internal function without access restriction. * * May emit a {RoleGranted} event. */ function _grantRole(bytes32 role, address account) internal virtual { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); } } /** * @dev Revokes `role` from `account`. * * Internal function without access restriction. * * May emit a {RoleRevoked} event. */ function _revokeRole(bytes32 role, address account) internal virtual { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControlEnumerable.sol) pragma solidity ^0.8.0; import "./IAccessControlUpgradeable.sol"; /** * @dev External interface of AccessControlEnumerable declared to support ERC165 detection. */ interface IAccessControlEnumerableUpgradeable is IAccessControlUpgradeable { /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) external view returns (address); /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) external view returns (uint256); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol) pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControlUpgradeable { /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.2; import "../../utils/AddressUpgradeable.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in * case an upgrade adds a module that needs to be initialized. * * For example: * * [.hljs-theme-light.nopadding] * ``` * contract MyToken is ERC20Upgradeable { * function initialize() initializer public { * __ERC20_init("MyToken", "MTK"); * } * } * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable { * function initializeV2() reinitializer(2) public { * __ERC20Permit_init("MyToken"); * } * } * ``` * * 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 prevent the implementation contract from being used, you should invoke * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() { * _disableInitializers(); * } * ``` * ==== */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. * @custom:oz-retyped-from bool */ uint8 private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint8 version); /** * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope, * `onlyInitializing` functions can be used to initialize parent contracts. * * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a * constructor. * * Emits an {Initialized} event. */ modifier initializer() { bool isTopLevelCall = !_initializing; require( (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1), "Initializable: contract is already initialized" ); _initialized = 1; if (isTopLevelCall) { _initializing = true; } _; if (isTopLevelCall) { _initializing = false; emit Initialized(1); } } /** * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be * used to initialize parent contracts. * * A reinitializer may be used after the original initialization step. This is essential to configure modules that * are added through upgrades and that require initialization. * * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer` * cannot be nested. If one is invoked in the context of another, execution will revert. * * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in * a contract, executing them in the right order is up to the developer or operator. * * WARNING: setting the version to 255 will prevent any future reinitialization. * * Emits an {Initialized} event. */ modifier reinitializer(uint8 version) { require(!_initializing && _initialized < version, "Initializable: contract is already initialized"); _initialized = version; _initializing = true; _; _initializing = false; emit Initialized(version); } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} and {reinitializer} modifiers, directly or indirectly. */ modifier onlyInitializing() { require(_initializing, "Initializable: contract is not initializing"); _; } /** * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call. * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized * to any version. It is recommended to use this to lock implementation contracts that are designed to be called * through proxies. * * Emits an {Initialized} event the first time it is successfully executed. */ function _disableInitializers() internal virtual { require(!_initializing, "Initializable: contract is initializing"); if (_initialized < type(uint8).max) { _initialized = type(uint8).max; emit Initialized(type(uint8).max); } } /** * @dev Internal function that returns the initialized version. Returns `_initialized` */ function _getInitializedVersion() internal view returns (uint8) { return _initialized; } /** * @dev Internal function that returns the initialized version. Returns `_initializing` */ function _isInitializing() internal view returns (bool) { return _initializing; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.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 onlyInitializing { __Pausable_init_unchained(); } function __Pausable_init_unchained() internal onlyInitializing { _paused = false; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { _requireNotPaused(); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { _requirePaused(); _; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Throws if the contract is paused. */ function _requireNotPaused() internal view virtual { require(!paused(), "Pausable: paused"); } /** * @dev Throws if the contract is not paused. */ function _requirePaused() internal view virtual { require(paused(), "Pausable: not paused"); } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; import "../proxy/utils/Initializable.sol"; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract ContextUpgradeable is Initializable { function __Context_init() internal onlyInitializing { } function __Context_init_unchained() internal onlyInitializing { } function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165Upgradeable.sol"; import "../../proxy/utils/Initializable.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable { function __ERC165_init() internal onlyInitializing { } function __ERC165_init_unchained() internal onlyInitializing { } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165Upgradeable).interfaceId; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165Upgradeable { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library MathUpgradeable { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv( uint256 x, uint256 y, uint256 denominator ) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works // in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv( uint256 x, uint256 y, uint256 denominator, Rounding rounding ) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10**64) { value /= 10**64; result += 64; } if (value >= 10**32) { value /= 10**32; result += 32; } if (value >= 10**16) { value /= 10**16; result += 16; } if (value >= 10**8) { value /= 10**8; result += 8; } if (value >= 10**4) { value /= 10**4; result += 4; } if (value >= 10**2) { value /= 10**2; result += 2; } if (value >= 10**1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol) pragma solidity ^0.8.0; import "./math/MathUpgradeable.sol"; /** * @dev String operations. */ library StringsUpgradeable { bytes16 private constant _SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = MathUpgradeable.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), _SYMBOLS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, MathUpgradeable.log256(value) + 1); } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/structs/EnumerableSet.sol) // This file was procedurally generated from scripts/generate/templates/EnumerableSet.js. 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. * * [WARNING] * ==== * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure * unusable. * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info. * * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an * array of EnumerableSet. * ==== */ 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) { bytes32[] memory store = _values(set._inner); bytes32[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // 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; /// @solidity memory-safe-assembly 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 in 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; /// @solidity memory-safe-assembly assembly { result := store } return result; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol) pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv( uint256 x, uint256 y, uint256 denominator ) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works // in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv( uint256 x, uint256 y, uint256 denominator, Rounding rounding ) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10**64) { value /= 10**64; result += 64; } if (value >= 10**32) { value /= 10**32; result += 32; } if (value >= 10**16) { value /= 10**16; result += 16; } if (value >= 10**8) { value /= 10**8; result += 8; } if (value >= 10**4) { value /= 10**4; result += 4; } if (value >= 10**2) { value /= 10**2; result += 2; } if (value >= 10**1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.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 subtraction 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: MIT pragma solidity 0.8.16; interface ILpDepositor { function tokenID() external view returns (uint256); function setTokenID(uint256 tokenID) external returns (bool); function userBalances(address user, address pool) external view returns (uint256); function totalBalances(address pool) external view returns (uint256); function transferDeposit( address pool, address from, address to, uint256 amount ) external returns (bool); function votingWindow() external returns (uint256); function enterSplitMode(uint256 workTimeLimit) external; function detachGauges(address[] memory gaugeAddresses) external; function reattachGauges(address[] memory gaugeAddresses) external; }
// SPDX-License-Identifier: MIT pragma solidity 0.8.16; interface IVeDepositor { function burnFrom(address user, uint256 amount) external; function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.16; interface IBaseV1Minter { function active_period() external view returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.16; interface IBaseV1Voter { function bribes(address gauge) external view returns (address bribe); function gauges(address pool) external view returns (address gauge); function feeDists(address pool) external view returns (address feeDist); function generalFees() external view returns (address generalFees); function poolForGauge(address gauge) external view returns (address pool); function createGauge(address pool) external returns (address); function vote( uint256 tokenId, address[] calldata pools, int256[] calldata weights ) external; function whitelist(address token, uint256 tokenId) external; function listing_fee() external view returns (uint256); function _ve() external view returns (address); function isWhitelisted(address pool) external view returns (bool); function isGauge(address gaugeAddress) external view returns (bool); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.16; interface IGauge { function balanceOf(address user) external returns (uint256); function deposit(uint256 amount, uint256 tokenId) external; function withdraw(uint256 amount) external; function withdrawToken(uint256 amount, uint256 tokenId) external; function getReward(address account, address[] memory tokens) external; function earned(address token, address account) external view returns (uint256); function tokenIds(address account) external view returns (uint256); function optIn(address[] calldata tokens) external; function rewardsListLength() external view returns (uint256); function rewards(uint256 index) external view returns (address); function isOptIn(address user, address token) external view returns (bool); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.16; interface IVotingEscrow { function create_lock(uint256 value, uint256 lock_duration) external returns (uint256); function increase_amount(uint256 tokenID, uint256 value) external; function increase_unlock_time(uint256 tokenID, uint256 duration) external; function merge(uint256 fromID, uint256 toID) external; function locked(uint256 tokenID) external view returns (uint256 amount, uint256 unlockTime); function setApprovalForAll(address operator, bool approved) external; function safeTransferFrom( address from, address to, uint256 tokenId ) external; function balanceOfNFT(uint256 tokenId) external view returns (uint256); function split(uint256 from, uint256 amount) external returns (uint256); function attachments(uint256 tokenId) external view returns (uint256); function voted(uint256 tokenId) external view returns (bool isVoted); function ownerOf(uint256 tokenId) external view returns (address); // function isApprovedOrOwner(address, uint256) external view returns (bool); // function transferFrom( // address from, // address to, // uint256 tokenID // ) external; }
{ "metadata": { "bytecodeHash": "none" }, "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","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":"from","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"RequestBurn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"SplitClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"worker","type":"address"},{"indexed":false,"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"WorkStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"WorkerSplit","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"NFTHolder","outputs":[{"internalType":"contract ILpDepositor","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PAUSER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SETTER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"UNPAUSER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"claimSplitVeNft","outputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"claimTips","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"currentWorker","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"gaugeAddresses","type":"address[]"}],"name":"detachGauges","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"elmoSOLID","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"fee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"finishStage1","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getRoleMember","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMemberCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_votingEscrow","type":"address"},{"internalType":"address","name":"_minterAddress","type":"address"},{"internalType":"address","name":"_solidlyVoter","type":"address"},{"internalType":"uint256","name":"_minTipPerGauge","type":"uint256"},{"internalType":"uint256","name":"_minBond","type":"uint256"},{"internalType":"address","name":"admin","type":"address"},{"internalType":"address","name":"setter","type":"address"},{"internalType":"address","name":"pauser","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"lastBurnTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastSplitTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minBond","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minTip","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minTipPerGauge","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minter","outputs":[{"internalType":"contract IBaseV1Minter","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"moSolid","outputs":[{"internalType":"contract IVeDepositor","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"reattachGauge","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"reattachGaugeLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"gaugeAddresses","type":"address[]"}],"name":"reattachGauges","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"splitAmount","type":"uint256"}],"name":"requestSplit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"resetVotes","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_NFTHolder","type":"address"},{"internalType":"address","name":"_moSolid","type":"address"},{"internalType":"address","name":"_elmoSOLID","type":"address"}],"name":"setAddresses","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_fee","type":"uint256"}],"name":"setFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_minBond","type":"uint256"}],"name":"setMinBond","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_minTipPerGauge","type":"uint256"}],"name":"setMinTipPerGauge","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_workTimeLimit","type":"uint256"}],"name":"setWorkTimeLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"solidlyVoter","outputs":[{"internalType":"contract IBaseV1Voter","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"splitTokenId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"startWork","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSplitRequested","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalTips","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"votingEscrow","outputs":[{"internalType":"contract IVotingEscrow","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"workFinishDeadline","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"workTimeLimit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"workingStage","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b506131bf806100206000396000f3fe6080604052600436106102ff5760003560e01c806369fe0e2d11610190578063a2011b3f116100dc578063d547741f11610095578063e7e5b6f31161006f578063e7e5b6f3146108cd578063fb1bb9de146108ed578063fd663da214610921578063fddbea2f1461094157600080fd5b8063d547741f14610862578063ddca3f4314610882578063e63ab1e91461089957600080fd5b8063a2011b3f146107c1578063a217fddf146107e3578063b05dd1d5146107f8578063b9830ff11461080d578063bb090d3114610822578063ca15c8731461084257600080fd5b80638456cb59116101495780639393691e116101235780639393691e1461076a578063990de8ae146107815780639d8df13414610794578063a00b4a5c146107ab57600080fd5b80638456cb59146107155780639010d07c1461072a57806391d148541461074a57600080fd5b806369fe0e2d1461064e5780636eaae8241461066e57806370a082311461068e5780637c56af85146106bc578063831518b7146106dd5780638338cbbb146106f457600080fd5b80632600bf141161024f5780633fbfcaaf1161020857806356b55793116101e257806356b55793146105f65780635c975abb1461060957806362677b901461062157806365ba68e51461063757600080fd5b80633fbfcaaf14610584578063410ef46e146105a55780634f2bfe5b146105d657600080fd5b80632600bf14146104ca5780632f2ff15d146104f857806335662c4014610518578063363bf9641461052f57806336568abe1461054f5780633f4ba83a1461056f57600080fd5b80630f2614b7116102bc5780631665619911610296578063166561991461044e57806321d8b7e51461046557806322d9cccd1461047a578063248a9ca31461049a57600080fd5b80630f2614b7146103d457806313fca9c5146103f5578063150b7a021461041557600080fd5b8063010349791461030457806301ffc9a71461030e5780630458b5b41461034357806306af3dfd14610366578063075461721461037b5780630b962791146103b4575b600080fd5b61030c610958565b005b34801561031a57600080fd5b5061032e610329366004612b38565b610ca5565b60405190151581526020015b60405180910390f35b34801561034f57600080fd5b50610358610cd0565b60405190815260200161033a565b34801561037257600080fd5b5061030c610dc1565b34801561038757600080fd5b506101005461039c906001600160a01b031681565b6040516001600160a01b03909116815260200161033a565b3480156103c057600080fd5b5061030c6103cf366004612b94565b610f99565b3480156103e057600080fd5b506101015461039c906001600160a01b031681565b34801561040157600080fd5b5061030c610410366004612c59565b6112bf565b34801561042157600080fd5b50610435610430366004612c72565b6112de565b6040516001600160e01b0319909116815260200161033a565b34801561045a57600080fd5b506103586101045481565b34801561047157600080fd5b50610358611339565b34801561048657600080fd5b5061030c610495366004612b94565b6115f2565b3480156104a657600080fd5b506103586104b5366004612c59565b60009081526065602052604090206001015490565b3480156104d657600080fd5b506103586104e5366004612d0d565b61010f6020526000908152604090205481565b34801561050457600080fd5b5061030c610513366004612d28565b6117b7565b34801561052457600080fd5b5061035861010d5481565b34801561053b57600080fd5b5061030c61054a366004612d54565b6117e1565b34801561055b57600080fd5b5061030c61056a366004612d28565b61183c565b34801561057b57600080fd5b5061030c6118ba565b34801561059057600080fd5b506101025461039c906001600160a01b031681565b3480156105b157600080fd5b5061032e6105c0366004612d0d565b61010b6020526000908152604090205460ff1681565b3480156105e257600080fd5b5060ff5461039c906001600160a01b031681565b61030c610604366004612c59565b6118ef565b34801561061557600080fd5b5060c95460ff1661032e565b34801561062d57600080fd5b5061035860fb5481565b34801561064357600080fd5b506103586101095481565b34801561065a57600080fd5b5061030c610669366004612c59565b611c02565b34801561067a57600080fd5b5061030c610689366004612c59565b611c21565b34801561069a57600080fd5b506103586106a9366004612d0d565b61010e6020526000908152604090205481565b3480156106c857600080fd5b506101085461039c906001600160a01b031681565b3480156106e957600080fd5b506103586101055481565b34801561070057600080fd5b506101035461039c906001600160a01b031681565b34801561072157600080fd5b5061030c611c40565b34801561073657600080fd5b5061039c610745366004612d97565b611c72565b34801561075657600080fd5b5061032e610765366004612d28565b611c91565b34801561077657600080fd5b5061035861010c5481565b34801561078d57600080fd5b5047610358565b3480156107a057600080fd5b5061035861010a5481565b3480156107b757600080fd5b5061035860fd5481565b3480156107cd57600080fd5b5061035860008051602061319383398151915281565b3480156107ef57600080fd5b50610358600081565b34801561080457600080fd5b5061030c611cbc565b34801561081957600080fd5b5061030c612029565b34801561082e57600080fd5b5061030c61083d366004612c59565b6121f7565b34801561084e57600080fd5b5061035861085d366004612c59565b612215565b34801561086e57600080fd5b5061030c61087d366004612d28565b61222c565b34801561088e57600080fd5b506103586101065481565b3480156108a557600080fd5b506103587f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a81565b3480156108d957600080fd5b5060fe5461039c906001600160a01b031681565b3480156108f957600080fd5b506103587f427da25fe773164f88948d3e215c94b6554e2ed5e5f203a821c9f2f6131cf75a81565b34801561092d57600080fd5b5061030c61093c366004612db9565b612251565b34801561094d57600080fd5b506103586101075481565b60fc546002036109835760405162461bcd60e51b815260040161097a90612e42565b60405180910390fd5b600260fc5561010954600090156109ac5760405162461bcd60e51b815260040161097a90612e66565b6109b461244a565b6101005460408051631a2732c160e31b815290516000926001600160a01b03169163d13996089160048083019260209291908290030181865afa1580156109ff573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a239190612e91565b9050610107548111610a675760405162461bcd60e51b815260206004820152600d60248201526c09cdee840dccaee40cae0dec6d609b1b604482015260640161097a565b60fb5461010160009054906101000a90046001600160a01b03166001600160a01b03166372a6300a6040518163ffffffff1660e01b81526004016020604051808303816000875af1158015610ac0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ae49190612e91565b610af18362093a80612ec0565b610afb9190612ed3565b610b059190612ed3565b4210610b645760405162461bcd60e51b815260206004820152602860248201527f43616e6e6f7420737461727420776f726b20636c6f736520746f20766f74696e604482015267672077696e646f7760c01b606482015260840161097a565b61010554610b8790600a610b784734612492565b610b829190612ee6565b61249e565b341015610bc85760405162461bcd60e51b815260206004820152600f60248201526e139bdd08195b9bdd59da08189bdb99608a1b604482015260640161097a565b6101015460fb54604051634a91ad3f60e11b81526001600160a01b03909216916395235a7e91610bfe9160040190815260200190565b600060405180830381600087803b158015610c1857600080fd5b505af1158015610c2c573d6000803e3d6000fd5b505061010880546001600160a01b03191633179055505060fb54610c509042612ec0565b61010a5560016101095560fb5433907f3a418e9cc3b61bda49e114dc7a01a75db0094b1b783b9272d12682d39c7cfabd90610c8b9042612ec0565b60405190815260200160405180910390a25050600160fc55565b60006001600160e01b03198216635a05180f60e01b1480610cca5750610cca826124b4565b92915050565b6101045460ff54610101546040805163a5c42ef160e01b81529051600094936001600160a01b0390811693630d6a20339391169163a5c42ef1916004808201926020929091908290030181865afa158015610d2f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d539190612e91565b6040518263ffffffff1660e01b8152600401610d7191815260200190565b602060405180830381865afa158015610d8e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610db29190612e91565b610dbc9190612f08565b905090565b60fc54600203610de35760405162461bcd60e51b815260040161097a90612e42565b600260fc819055610109548114610e0c5760405162461bcd60e51b815260040161097a90612e66565b61010c5415610e5d5760405162461bcd60e51b815260206004820152601e60248201527f4e6f7420616c6c20676175676573207765726520726561747461636865640000604482015260640161097a565b610108546001600160a01b0316331480610e79575061010a5442115b610eeb5760405162461bcd60e51b815260206004820152603760248201527f4f6e6c792063757272656e7420776f726b65722063616e20636c61696d20746960448201527f707320756e6c657373206f76657220646561646c696e65000000000000000000606482015260840161097a565b604051600090339047908381818185875af1925050503d8060008114610f2d576040519150601f19603f3d011682016040523d82523d6000602084013e610f32565b606091505b5050905080610f795760405162461bcd60e51b8152602060048201526013602482015272151c985b9cd9995c881d1a5c0819985a5b1959606a1b604482015260640161097a565b505061010880546001600160a01b0319169055600061010955600160fc55565b6001610109548114610fbd5760405162461bcd60e51b815260040161097a90612e66565b600080835167ffffffffffffffff811115610fda57610fda612b62565b604051908082528060200260200182016040528015611003578160200160208202803683370190505b50905060005b845181101561123a5760fe5485516001600160a01b039091169063aa79979b9087908490811061103b5761103b612f27565b60200260200101516040518263ffffffff1660e01b815260040161106e91906001600160a01b0391909116815260200190565b602060405180830381865afa15801561108b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110af9190612f3d565b6110eb5760405162461bcd60e51b815260206004820152600d60248201526c496e76616c696420676175676560981b604482015260640161097a565b60008582815181106110ff576110ff612f27565b60209081029190910101516101015460405163fc97a30360e01b81526001600160a01b03918216600482015291169063fc97a30390602401602060405180830381865afa158015611154573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111789190612e91565b111561122857600161010b600087848151811061119757611197612f27565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055508481815181106111e8576111e8612f27565b602002602001015182848151811061120257611202612f27565b6001600160a01b03909216602092830291909101909101528261122481612f5f565b9350505b8061123281612f5f565b915050611009565b508181528161010c60008282546112519190612ec0565b909155505061010154604051630b96279160e01b81526001600160a01b0390911690630b96279190611287908490600401612fbc565b600060405180830381600087803b1580156112a157600080fd5b505af11580156112b5573d6000803e3d6000fd5b5050505050505050565b6000805160206131938339815191526112d7816124e9565b5061010455565b600060fc546002146113275760405162461bcd60e51b81526020600482015260126024820152714e6f20696e626f756e64204552433732317360701b604482015260640161097a565b50630a85bd0160e11b95945050505050565b600060fc5460020361135d5760405162461bcd60e51b815260040161097a90612e42565b600260fc5561136a61244a565b6101075433600090815261010f6020526040902054106113c25760405162461bcd60e51b815260206004820152601360248201527214dc1b1a5d081b9bdd081c1c9bd8d95cdcd959606a1b604482015260640161097a565b33600090815261010e6020526040902054806114135760405162461bcd60e51b815260206004820152601060248201526f4e6f7468696e6720746f20636c61696d60801b604482015260640161097a565b33600090815261010e602052604080822082905560ff5460fd549151635a2d1e0760e11b815260048101929092526001600160a01b03169063b45a3c0e906024016040805180830381865afa158015611470573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114949190612fcf565b509050806fffffffffffffffffffffffffffffffff168210156115375760ff5460fd546040516312c66fb360e21b81526001600160a01b0390921691634b19becc916114ed918690600401918252602082015260400190565b6020604051808303816000875af115801561150c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115309190612e91565b9250611543565b60fd8054600090915592505b60ff54604051632142170760e11b8152306004820152336024820152604481018590526001600160a01b03909116906342842e0e90606401600060405180830381600087803b15801561159557600080fd5b505af11580156115a9573d6000803e3d6000fd5b505060408051868152602081018690523393507f75701bb6f540c608775db9c9b7d963dca6008255cbd29a321911136b140a2b6992500160405180910390a25050600160fc5590565b60026101095481146116165760405162461bcd60e51b815260040161097a90612e66565b600080835167ffffffffffffffff81111561163357611633612b62565b60405190808252806020026020018201604052801561165c578160200160208202803683370190505b50905060005b845181101561176a5761010b600086838151811061168257611682612f27565b6020908102919091018101516001600160a01b031682528101919091526040016000205460ff161561175857600061010b60008784815181106116c7576116c7612f27565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff02191690831515021790555084818151811061171857611718612f27565b602002602001015182848151811061173257611732612f27565b6001600160a01b03909216602092830291909101909101528261175481612f5f565b9350505b8061176281612f5f565b915050611662565b508181528161010c60008282546117819190612ed3565b9091555050610101546040516322d9cccd60e01b81526001600160a01b03909116906322d9cccd90611287908490600401612fbc565b6000828152606560205260409020600101546117d2816124e9565b6117dc83836124f3565b505050565b6000805160206131938339815191526117f9816124e9565b5061010180546001600160a01b039485166001600160a01b0319918216179091556101028054938516938216939093179092556101038054919093169116179055565b6001600160a01b03811633146118ac5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b606482015260840161097a565b6118b68282612515565b5050565b7f427da25fe773164f88948d3e215c94b6554e2ed5e5f203a821c9f2f6131cf75a6118e4816124e9565b6118ec612537565b50565b60006101095481146119135760405162461bcd60e51b815260040161097a90612e66565b61191b61244a565b6000821161195c5760405162461bcd60e51b815260206004820152600e60248201526d043616e6e6f742073706c697420360941b604482015260640161097a565b33600090815261010e6020526040902054158061198b57506101075433600090815261010f6020526040902054115b6119d75760405162461bcd60e51b815260206004820152601b60248201527f436c61696d20617661696c61626c652073706c69742066697273740000000000604482015260640161097a565b6119df610cd0565b341015611a205760405162461bcd60e51b815260206004820152600f60248201526e4e6f7420656e6f756768207469707360881b604482015260640161097a565b6000670de0b6b3a76400006101065484611a3a9190612f08565b611a449190612ee6565b90506000611a528285612ed3565b6101025460405163079cc67960e41b8152336004820152602481018390529192506001600160a01b0316906379cc679090604401600060405180830381600087803b158015611aa057600080fd5b505af1158015611ab4573d6000803e3d6000fd5b505061010254610103546040516323b872dd60e01b81523360048201526001600160a01b03918216602482015260448101879052911692506323b872dd91506064016020604051808303816000875af1158015611b15573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b399190612f3d565b611b775760405162461bcd60e51b815260206004820152600f60248201526e1514905394d1915488119052531151608a1b604482015260640161097a565b33600090815261010e602052604081208054869290611b97908490612ec0565b909155505033600090815261010f6020526040812042905561010d8054869290611bc2908490612ec0565b909155505060405184815233907ff05dc13309edd62ddfddf2ba57299daa8fc08d8be6d2fad6c648fa9b2b0d91df9060200160405180910390a250505050565b600080516020613193833981519152611c1a816124e9565b5061010655565b600080516020613193833981519152611c39816124e9565b5061010555565b7f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a611c6a816124e9565b6118ec612589565b6000828152609760205260408120611c8a90836125c6565b9392505050565b60009182526065602090815260408084206001600160a01b0393909316845291905290205460ff1690565b60fc54600203611cde5760405162461bcd60e51b815260040161097a90612e42565b600260fc55610109546001908114611d085760405162461bcd60e51b815260040161097a90612e66565b610101546040805163a5c42ef160e01b815290516000926001600160a01b03169163a5c42ef19160048083019260209291908290030181865afa158015611d53573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d779190612e91565b60ff54604051630d6a203360e01b8152600481018390529192506001600160a01b031690630d6a203390602401602060405180830381865afa158015611dc1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611de59190612e91565b15611e265760405162461bcd60e51b81526020600482015260116024820152704761756765204174746163686d656e747360781b604482015260640161097a565b60ff54604051638fbb38ff60e01b8152600481018390526001600160a01b0390911690638fbb38ff90602401602060405180830381865afa158015611e6f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e939190612f3d565b15611ed35760405162461bcd60e51b815260206004820152601060248201526f159bdd19481b9bdd0818db19585c995960821b604482015260640161097a565b60ff5461010d546040516312c66fb360e21b81526000926001600160a01b031691634b19becc91611f11918691600401918252602082015260400190565b6020604051808303816000875af1158015611f30573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f549190612e91565b90507f6eace4a82b8d3b79c7764a2044a72a81bc400e7c8716eeb1a5df579c5635aa6361010d54604051611f8a91815260200190565b60405180910390a1600061010d5560fd541561200e5760ff5460fd5460405163d1c2babb60e01b81526004810184905260248101919091526001600160a01b039091169063d1c2babb90604401600060405180830381600087803b158015611ff157600080fd5b505af1158015612005573d6000803e3d6000fd5b50505050612014565b60fd8190555b5050426101075550600261010955600160fc55565b600161010954811461204d5760405162461bcd60e51b815260040161097a90612e66565b61010060009054906101000a90046001600160a01b03166001600160a01b031663d13996086040518163ffffffff1660e01b8152600401602060405180830381865afa1580156120a1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120c59190612e91565b6120d29062093a80612ec0565b42106121125760405162461bcd60e51b815260206004820152600f60248201526e566f74696e6720756e64657277617960881b604482015260640161097a565b60fe54610101546040805163a5c42ef160e01b815290516001600160a01b039384169363fecdad6093169163a5c42ef19160048083019260209291908290030181865afa158015612167573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061218b9190612e91565b60408051600080825260208201908152818301928390526001600160e01b031960e086901b169092526121c2929160448201612ff3565b600060405180830381600087803b1580156121dc57600080fd5b505af11580156121f0573d6000803e3d6000fd5b5050505050565b60008051602061319383398151915261220f816124e9565b5060fb55565b6000818152609760205260408120610cca906125d2565b600082815260656020526040902060010154612247816124e9565b6117dc8383612515565b600054610100900460ff16158080156122715750600054600160ff909116105b8061228b5750303b15801561228b575060005460ff166001145b6122ee5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161097a565b6000805460ff191660011790558015612311576000805461ff0019166101001790555b6123196125dc565b61232161260b565b60ff80546001600160a01b03808c166001600160a01b03199283161790925561010080548b841690831617905560fe8054928a1692909116919091179055600160fc55610e1060fb55666a94d74f4300006101065561010486905561010585905561238d6000856124f3565b6123b77f427da25fe773164f88948d3e215c94b6554e2ed5e5f203a821c9f2f6131cf75a856124f3565b6123cf600080516020613193833981519152846124f3565b6123f97f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a836124f3565b801561243f576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050505050505050565b60c95460ff16156124905760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015260640161097a565b565b6000611c8a8284612ed3565b60008183116124ad5781611c8a565b5090919050565b60006001600160e01b03198216637965db0b60e01b1480610cca57506301ffc9a760e01b6001600160e01b0319831614610cca565b6118ec8133612632565b6124fd828261268b565b60008281526097602052604090206117dc9082612711565b61251f8282612726565b60008281526097602052604090206117dc908261278d565b61253f6127a2565b60c9805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b61259161244a565b60c9805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25861256c3390565b6000611c8a83836127eb565b6000610cca825490565b600054610100900460ff166126035760405162461bcd60e51b815260040161097a9061304e565b612490612815565b600054610100900460ff166124905760405162461bcd60e51b815260040161097a9061304e565b61263c8282611c91565b6118b65761264981612848565b61265483602061285a565b6040516020016126659291906130bd565b60408051601f198184030181529082905262461bcd60e51b825261097a91600401613132565b6126958282611c91565b6118b65760008281526065602090815260408083206001600160a01b03851684529091529020805460ff191660011790556126cd3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000611c8a836001600160a01b0384166129f6565b6127308282611c91565b156118b65760008281526065602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6000611c8a836001600160a01b038416612a45565b60c95460ff166124905760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b604482015260640161097a565b600082600001828154811061280257612802612f27565b9060005260206000200154905092915050565b600054610100900460ff1661283c5760405162461bcd60e51b815260040161097a9061304e565b60c9805460ff19169055565b6060610cca6001600160a01b03831660145b60606000612869836002612f08565b612874906002612ec0565b67ffffffffffffffff81111561288c5761288c612b62565b6040519080825280601f01601f1916602001820160405280156128b6576020820181803683370190505b509050600360fc1b816000815181106128d1576128d1612f27565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061290057612900612f27565b60200101906001600160f81b031916908160001a9053506000612924846002612f08565b61292f906001612ec0565b90505b60018111156129a7576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061296357612963612f27565b1a60f81b82828151811061297957612979612f27565b60200101906001600160f81b031916908160001a90535060049490941c936129a081613165565b9050612932565b508315611c8a5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640161097a565b6000818152600183016020526040812054612a3d57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610cca565b506000610cca565b60008181526001830160205260408120548015612b2e576000612a69600183612ed3565b8554909150600090612a7d90600190612ed3565b9050818114612ae2576000866000018281548110612a9d57612a9d612f27565b9060005260206000200154905080876000018481548110612ac057612ac0612f27565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080612af357612af361317c565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610cca565b6000915050610cca565b600060208284031215612b4a57600080fd5b81356001600160e01b031981168114611c8a57600080fd5b634e487b7160e01b600052604160045260246000fd5b80356001600160a01b0381168114612b8f57600080fd5b919050565b60006020808385031215612ba757600080fd5b823567ffffffffffffffff80821115612bbf57600080fd5b818501915085601f830112612bd357600080fd5b813581811115612be557612be5612b62565b8060051b604051601f19603f83011681018181108582111715612c0a57612c0a612b62565b604052918252848201925083810185019188831115612c2857600080fd5b938501935b82851015612c4d57612c3e85612b78565b84529385019392850192612c2d565b98975050505050505050565b600060208284031215612c6b57600080fd5b5035919050565b600080600080600060808688031215612c8a57600080fd5b612c9386612b78565b9450612ca160208701612b78565b935060408601359250606086013567ffffffffffffffff80821115612cc557600080fd5b818801915088601f830112612cd957600080fd5b813581811115612ce857600080fd5b896020828501011115612cfa57600080fd5b9699959850939650602001949392505050565b600060208284031215612d1f57600080fd5b611c8a82612b78565b60008060408385031215612d3b57600080fd5b82359150612d4b60208401612b78565b90509250929050565b600080600060608486031215612d6957600080fd5b612d7284612b78565b9250612d8060208501612b78565b9150612d8e60408501612b78565b90509250925092565b60008060408385031215612daa57600080fd5b50508035926020909101359150565b600080600080600080600080610100898b031215612dd657600080fd5b612ddf89612b78565b9750612ded60208a01612b78565b9650612dfb60408a01612b78565b95506060890135945060808901359350612e1760a08a01612b78565b9250612e2560c08a01612b78565b9150612e3360e08a01612b78565b90509295985092959890939650565b6020808252600a90820152695265656e7472616e637960b01b604082015260600190565b6020808252601190820152704e6f742063757272656e7420737461676560781b604082015260600190565b600060208284031215612ea357600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b80820180821115610cca57610cca612eaa565b81810381811115610cca57610cca612eaa565b600082612f0357634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615612f2257612f22612eaa565b500290565b634e487b7160e01b600052603260045260246000fd5b600060208284031215612f4f57600080fd5b81518015158114611c8a57600080fd5b600060018201612f7157612f71612eaa565b5060010190565b600081518084526020808501945080840160005b83811015612fb15781516001600160a01b031687529582019590820190600101612f8c565b509495945050505050565b602081526000611c8a6020830184612f78565b60008060408385031215612fe257600080fd5b505080516020909101519092909150565b8381526000602060608184015261300d6060840186612f78565b838103604085015284518082528286019183019060005b8181101561304057835183529284019291840191600101613024565b509098975050505050505050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60005b838110156130b457818101518382015260200161309c565b50506000910152565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516130f5816017850160208801613099565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351613126816028840160208801613099565b01602801949350505050565b6020815260008251806020840152613151816040850160208701613099565b601f01601f19169190910160400192915050565b60008161317457613174612eaa565b506000190190565b634e487b7160e01b600052603160045260246000fdfe61c92169ef077349011ff0b1383c894d86c5f0b41d986366b58a6cf31e93bedaa164736f6c6343000810000a
Deployed Bytecode
0x6080604052600436106102ff5760003560e01c806369fe0e2d11610190578063a2011b3f116100dc578063d547741f11610095578063e7e5b6f31161006f578063e7e5b6f3146108cd578063fb1bb9de146108ed578063fd663da214610921578063fddbea2f1461094157600080fd5b8063d547741f14610862578063ddca3f4314610882578063e63ab1e91461089957600080fd5b8063a2011b3f146107c1578063a217fddf146107e3578063b05dd1d5146107f8578063b9830ff11461080d578063bb090d3114610822578063ca15c8731461084257600080fd5b80638456cb59116101495780639393691e116101235780639393691e1461076a578063990de8ae146107815780639d8df13414610794578063a00b4a5c146107ab57600080fd5b80638456cb59146107155780639010d07c1461072a57806391d148541461074a57600080fd5b806369fe0e2d1461064e5780636eaae8241461066e57806370a082311461068e5780637c56af85146106bc578063831518b7146106dd5780638338cbbb146106f457600080fd5b80632600bf141161024f5780633fbfcaaf1161020857806356b55793116101e257806356b55793146105f65780635c975abb1461060957806362677b901461062157806365ba68e51461063757600080fd5b80633fbfcaaf14610584578063410ef46e146105a55780634f2bfe5b146105d657600080fd5b80632600bf14146104ca5780632f2ff15d146104f857806335662c4014610518578063363bf9641461052f57806336568abe1461054f5780633f4ba83a1461056f57600080fd5b80630f2614b7116102bc5780631665619911610296578063166561991461044e57806321d8b7e51461046557806322d9cccd1461047a578063248a9ca31461049a57600080fd5b80630f2614b7146103d457806313fca9c5146103f5578063150b7a021461041557600080fd5b8063010349791461030457806301ffc9a71461030e5780630458b5b41461034357806306af3dfd14610366578063075461721461037b5780630b962791146103b4575b600080fd5b61030c610958565b005b34801561031a57600080fd5b5061032e610329366004612b38565b610ca5565b60405190151581526020015b60405180910390f35b34801561034f57600080fd5b50610358610cd0565b60405190815260200161033a565b34801561037257600080fd5b5061030c610dc1565b34801561038757600080fd5b506101005461039c906001600160a01b031681565b6040516001600160a01b03909116815260200161033a565b3480156103c057600080fd5b5061030c6103cf366004612b94565b610f99565b3480156103e057600080fd5b506101015461039c906001600160a01b031681565b34801561040157600080fd5b5061030c610410366004612c59565b6112bf565b34801561042157600080fd5b50610435610430366004612c72565b6112de565b6040516001600160e01b0319909116815260200161033a565b34801561045a57600080fd5b506103586101045481565b34801561047157600080fd5b50610358611339565b34801561048657600080fd5b5061030c610495366004612b94565b6115f2565b3480156104a657600080fd5b506103586104b5366004612c59565b60009081526065602052604090206001015490565b3480156104d657600080fd5b506103586104e5366004612d0d565b61010f6020526000908152604090205481565b34801561050457600080fd5b5061030c610513366004612d28565b6117b7565b34801561052457600080fd5b5061035861010d5481565b34801561053b57600080fd5b5061030c61054a366004612d54565b6117e1565b34801561055b57600080fd5b5061030c61056a366004612d28565b61183c565b34801561057b57600080fd5b5061030c6118ba565b34801561059057600080fd5b506101025461039c906001600160a01b031681565b3480156105b157600080fd5b5061032e6105c0366004612d0d565b61010b6020526000908152604090205460ff1681565b3480156105e257600080fd5b5060ff5461039c906001600160a01b031681565b61030c610604366004612c59565b6118ef565b34801561061557600080fd5b5060c95460ff1661032e565b34801561062d57600080fd5b5061035860fb5481565b34801561064357600080fd5b506103586101095481565b34801561065a57600080fd5b5061030c610669366004612c59565b611c02565b34801561067a57600080fd5b5061030c610689366004612c59565b611c21565b34801561069a57600080fd5b506103586106a9366004612d0d565b61010e6020526000908152604090205481565b3480156106c857600080fd5b506101085461039c906001600160a01b031681565b3480156106e957600080fd5b506103586101055481565b34801561070057600080fd5b506101035461039c906001600160a01b031681565b34801561072157600080fd5b5061030c611c40565b34801561073657600080fd5b5061039c610745366004612d97565b611c72565b34801561075657600080fd5b5061032e610765366004612d28565b611c91565b34801561077657600080fd5b5061035861010c5481565b34801561078d57600080fd5b5047610358565b3480156107a057600080fd5b5061035861010a5481565b3480156107b757600080fd5b5061035860fd5481565b3480156107cd57600080fd5b5061035860008051602061319383398151915281565b3480156107ef57600080fd5b50610358600081565b34801561080457600080fd5b5061030c611cbc565b34801561081957600080fd5b5061030c612029565b34801561082e57600080fd5b5061030c61083d366004612c59565b6121f7565b34801561084e57600080fd5b5061035861085d366004612c59565b612215565b34801561086e57600080fd5b5061030c61087d366004612d28565b61222c565b34801561088e57600080fd5b506103586101065481565b3480156108a557600080fd5b506103587f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a81565b3480156108d957600080fd5b5060fe5461039c906001600160a01b031681565b3480156108f957600080fd5b506103587f427da25fe773164f88948d3e215c94b6554e2ed5e5f203a821c9f2f6131cf75a81565b34801561092d57600080fd5b5061030c61093c366004612db9565b612251565b34801561094d57600080fd5b506103586101075481565b60fc546002036109835760405162461bcd60e51b815260040161097a90612e42565b60405180910390fd5b600260fc5561010954600090156109ac5760405162461bcd60e51b815260040161097a90612e66565b6109b461244a565b6101005460408051631a2732c160e31b815290516000926001600160a01b03169163d13996089160048083019260209291908290030181865afa1580156109ff573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a239190612e91565b9050610107548111610a675760405162461bcd60e51b815260206004820152600d60248201526c09cdee840dccaee40cae0dec6d609b1b604482015260640161097a565b60fb5461010160009054906101000a90046001600160a01b03166001600160a01b03166372a6300a6040518163ffffffff1660e01b81526004016020604051808303816000875af1158015610ac0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ae49190612e91565b610af18362093a80612ec0565b610afb9190612ed3565b610b059190612ed3565b4210610b645760405162461bcd60e51b815260206004820152602860248201527f43616e6e6f7420737461727420776f726b20636c6f736520746f20766f74696e604482015267672077696e646f7760c01b606482015260840161097a565b61010554610b8790600a610b784734612492565b610b829190612ee6565b61249e565b341015610bc85760405162461bcd60e51b815260206004820152600f60248201526e139bdd08195b9bdd59da08189bdb99608a1b604482015260640161097a565b6101015460fb54604051634a91ad3f60e11b81526001600160a01b03909216916395235a7e91610bfe9160040190815260200190565b600060405180830381600087803b158015610c1857600080fd5b505af1158015610c2c573d6000803e3d6000fd5b505061010880546001600160a01b03191633179055505060fb54610c509042612ec0565b61010a5560016101095560fb5433907f3a418e9cc3b61bda49e114dc7a01a75db0094b1b783b9272d12682d39c7cfabd90610c8b9042612ec0565b60405190815260200160405180910390a25050600160fc55565b60006001600160e01b03198216635a05180f60e01b1480610cca5750610cca826124b4565b92915050565b6101045460ff54610101546040805163a5c42ef160e01b81529051600094936001600160a01b0390811693630d6a20339391169163a5c42ef1916004808201926020929091908290030181865afa158015610d2f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d539190612e91565b6040518263ffffffff1660e01b8152600401610d7191815260200190565b602060405180830381865afa158015610d8e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610db29190612e91565b610dbc9190612f08565b905090565b60fc54600203610de35760405162461bcd60e51b815260040161097a90612e42565b600260fc819055610109548114610e0c5760405162461bcd60e51b815260040161097a90612e66565b61010c5415610e5d5760405162461bcd60e51b815260206004820152601e60248201527f4e6f7420616c6c20676175676573207765726520726561747461636865640000604482015260640161097a565b610108546001600160a01b0316331480610e79575061010a5442115b610eeb5760405162461bcd60e51b815260206004820152603760248201527f4f6e6c792063757272656e7420776f726b65722063616e20636c61696d20746960448201527f707320756e6c657373206f76657220646561646c696e65000000000000000000606482015260840161097a565b604051600090339047908381818185875af1925050503d8060008114610f2d576040519150601f19603f3d011682016040523d82523d6000602084013e610f32565b606091505b5050905080610f795760405162461bcd60e51b8152602060048201526013602482015272151c985b9cd9995c881d1a5c0819985a5b1959606a1b604482015260640161097a565b505061010880546001600160a01b0319169055600061010955600160fc55565b6001610109548114610fbd5760405162461bcd60e51b815260040161097a90612e66565b600080835167ffffffffffffffff811115610fda57610fda612b62565b604051908082528060200260200182016040528015611003578160200160208202803683370190505b50905060005b845181101561123a5760fe5485516001600160a01b039091169063aa79979b9087908490811061103b5761103b612f27565b60200260200101516040518263ffffffff1660e01b815260040161106e91906001600160a01b0391909116815260200190565b602060405180830381865afa15801561108b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110af9190612f3d565b6110eb5760405162461bcd60e51b815260206004820152600d60248201526c496e76616c696420676175676560981b604482015260640161097a565b60008582815181106110ff576110ff612f27565b60209081029190910101516101015460405163fc97a30360e01b81526001600160a01b03918216600482015291169063fc97a30390602401602060405180830381865afa158015611154573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111789190612e91565b111561122857600161010b600087848151811061119757611197612f27565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055508481815181106111e8576111e8612f27565b602002602001015182848151811061120257611202612f27565b6001600160a01b03909216602092830291909101909101528261122481612f5f565b9350505b8061123281612f5f565b915050611009565b508181528161010c60008282546112519190612ec0565b909155505061010154604051630b96279160e01b81526001600160a01b0390911690630b96279190611287908490600401612fbc565b600060405180830381600087803b1580156112a157600080fd5b505af11580156112b5573d6000803e3d6000fd5b5050505050505050565b6000805160206131938339815191526112d7816124e9565b5061010455565b600060fc546002146113275760405162461bcd60e51b81526020600482015260126024820152714e6f20696e626f756e64204552433732317360701b604482015260640161097a565b50630a85bd0160e11b95945050505050565b600060fc5460020361135d5760405162461bcd60e51b815260040161097a90612e42565b600260fc5561136a61244a565b6101075433600090815261010f6020526040902054106113c25760405162461bcd60e51b815260206004820152601360248201527214dc1b1a5d081b9bdd081c1c9bd8d95cdcd959606a1b604482015260640161097a565b33600090815261010e6020526040902054806114135760405162461bcd60e51b815260206004820152601060248201526f4e6f7468696e6720746f20636c61696d60801b604482015260640161097a565b33600090815261010e602052604080822082905560ff5460fd549151635a2d1e0760e11b815260048101929092526001600160a01b03169063b45a3c0e906024016040805180830381865afa158015611470573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114949190612fcf565b509050806fffffffffffffffffffffffffffffffff168210156115375760ff5460fd546040516312c66fb360e21b81526001600160a01b0390921691634b19becc916114ed918690600401918252602082015260400190565b6020604051808303816000875af115801561150c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115309190612e91565b9250611543565b60fd8054600090915592505b60ff54604051632142170760e11b8152306004820152336024820152604481018590526001600160a01b03909116906342842e0e90606401600060405180830381600087803b15801561159557600080fd5b505af11580156115a9573d6000803e3d6000fd5b505060408051868152602081018690523393507f75701bb6f540c608775db9c9b7d963dca6008255cbd29a321911136b140a2b6992500160405180910390a25050600160fc5590565b60026101095481146116165760405162461bcd60e51b815260040161097a90612e66565b600080835167ffffffffffffffff81111561163357611633612b62565b60405190808252806020026020018201604052801561165c578160200160208202803683370190505b50905060005b845181101561176a5761010b600086838151811061168257611682612f27565b6020908102919091018101516001600160a01b031682528101919091526040016000205460ff161561175857600061010b60008784815181106116c7576116c7612f27565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff02191690831515021790555084818151811061171857611718612f27565b602002602001015182848151811061173257611732612f27565b6001600160a01b03909216602092830291909101909101528261175481612f5f565b9350505b8061176281612f5f565b915050611662565b508181528161010c60008282546117819190612ed3565b9091555050610101546040516322d9cccd60e01b81526001600160a01b03909116906322d9cccd90611287908490600401612fbc565b6000828152606560205260409020600101546117d2816124e9565b6117dc83836124f3565b505050565b6000805160206131938339815191526117f9816124e9565b5061010180546001600160a01b039485166001600160a01b0319918216179091556101028054938516938216939093179092556101038054919093169116179055565b6001600160a01b03811633146118ac5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b606482015260840161097a565b6118b68282612515565b5050565b7f427da25fe773164f88948d3e215c94b6554e2ed5e5f203a821c9f2f6131cf75a6118e4816124e9565b6118ec612537565b50565b60006101095481146119135760405162461bcd60e51b815260040161097a90612e66565b61191b61244a565b6000821161195c5760405162461bcd60e51b815260206004820152600e60248201526d043616e6e6f742073706c697420360941b604482015260640161097a565b33600090815261010e6020526040902054158061198b57506101075433600090815261010f6020526040902054115b6119d75760405162461bcd60e51b815260206004820152601b60248201527f436c61696d20617661696c61626c652073706c69742066697273740000000000604482015260640161097a565b6119df610cd0565b341015611a205760405162461bcd60e51b815260206004820152600f60248201526e4e6f7420656e6f756768207469707360881b604482015260640161097a565b6000670de0b6b3a76400006101065484611a3a9190612f08565b611a449190612ee6565b90506000611a528285612ed3565b6101025460405163079cc67960e41b8152336004820152602481018390529192506001600160a01b0316906379cc679090604401600060405180830381600087803b158015611aa057600080fd5b505af1158015611ab4573d6000803e3d6000fd5b505061010254610103546040516323b872dd60e01b81523360048201526001600160a01b03918216602482015260448101879052911692506323b872dd91506064016020604051808303816000875af1158015611b15573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b399190612f3d565b611b775760405162461bcd60e51b815260206004820152600f60248201526e1514905394d1915488119052531151608a1b604482015260640161097a565b33600090815261010e602052604081208054869290611b97908490612ec0565b909155505033600090815261010f6020526040812042905561010d8054869290611bc2908490612ec0565b909155505060405184815233907ff05dc13309edd62ddfddf2ba57299daa8fc08d8be6d2fad6c648fa9b2b0d91df9060200160405180910390a250505050565b600080516020613193833981519152611c1a816124e9565b5061010655565b600080516020613193833981519152611c39816124e9565b5061010555565b7f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a611c6a816124e9565b6118ec612589565b6000828152609760205260408120611c8a90836125c6565b9392505050565b60009182526065602090815260408084206001600160a01b0393909316845291905290205460ff1690565b60fc54600203611cde5760405162461bcd60e51b815260040161097a90612e42565b600260fc55610109546001908114611d085760405162461bcd60e51b815260040161097a90612e66565b610101546040805163a5c42ef160e01b815290516000926001600160a01b03169163a5c42ef19160048083019260209291908290030181865afa158015611d53573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d779190612e91565b60ff54604051630d6a203360e01b8152600481018390529192506001600160a01b031690630d6a203390602401602060405180830381865afa158015611dc1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611de59190612e91565b15611e265760405162461bcd60e51b81526020600482015260116024820152704761756765204174746163686d656e747360781b604482015260640161097a565b60ff54604051638fbb38ff60e01b8152600481018390526001600160a01b0390911690638fbb38ff90602401602060405180830381865afa158015611e6f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e939190612f3d565b15611ed35760405162461bcd60e51b815260206004820152601060248201526f159bdd19481b9bdd0818db19585c995960821b604482015260640161097a565b60ff5461010d546040516312c66fb360e21b81526000926001600160a01b031691634b19becc91611f11918691600401918252602082015260400190565b6020604051808303816000875af1158015611f30573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f549190612e91565b90507f6eace4a82b8d3b79c7764a2044a72a81bc400e7c8716eeb1a5df579c5635aa6361010d54604051611f8a91815260200190565b60405180910390a1600061010d5560fd541561200e5760ff5460fd5460405163d1c2babb60e01b81526004810184905260248101919091526001600160a01b039091169063d1c2babb90604401600060405180830381600087803b158015611ff157600080fd5b505af1158015612005573d6000803e3d6000fd5b50505050612014565b60fd8190555b5050426101075550600261010955600160fc55565b600161010954811461204d5760405162461bcd60e51b815260040161097a90612e66565b61010060009054906101000a90046001600160a01b03166001600160a01b031663d13996086040518163ffffffff1660e01b8152600401602060405180830381865afa1580156120a1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120c59190612e91565b6120d29062093a80612ec0565b42106121125760405162461bcd60e51b815260206004820152600f60248201526e566f74696e6720756e64657277617960881b604482015260640161097a565b60fe54610101546040805163a5c42ef160e01b815290516001600160a01b039384169363fecdad6093169163a5c42ef19160048083019260209291908290030181865afa158015612167573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061218b9190612e91565b60408051600080825260208201908152818301928390526001600160e01b031960e086901b169092526121c2929160448201612ff3565b600060405180830381600087803b1580156121dc57600080fd5b505af11580156121f0573d6000803e3d6000fd5b5050505050565b60008051602061319383398151915261220f816124e9565b5060fb55565b6000818152609760205260408120610cca906125d2565b600082815260656020526040902060010154612247816124e9565b6117dc8383612515565b600054610100900460ff16158080156122715750600054600160ff909116105b8061228b5750303b15801561228b575060005460ff166001145b6122ee5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161097a565b6000805460ff191660011790558015612311576000805461ff0019166101001790555b6123196125dc565b61232161260b565b60ff80546001600160a01b03808c166001600160a01b03199283161790925561010080548b841690831617905560fe8054928a1692909116919091179055600160fc55610e1060fb55666a94d74f4300006101065561010486905561010585905561238d6000856124f3565b6123b77f427da25fe773164f88948d3e215c94b6554e2ed5e5f203a821c9f2f6131cf75a856124f3565b6123cf600080516020613193833981519152846124f3565b6123f97f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a836124f3565b801561243f576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050505050505050565b60c95460ff16156124905760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015260640161097a565b565b6000611c8a8284612ed3565b60008183116124ad5781611c8a565b5090919050565b60006001600160e01b03198216637965db0b60e01b1480610cca57506301ffc9a760e01b6001600160e01b0319831614610cca565b6118ec8133612632565b6124fd828261268b565b60008281526097602052604090206117dc9082612711565b61251f8282612726565b60008281526097602052604090206117dc908261278d565b61253f6127a2565b60c9805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b61259161244a565b60c9805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25861256c3390565b6000611c8a83836127eb565b6000610cca825490565b600054610100900460ff166126035760405162461bcd60e51b815260040161097a9061304e565b612490612815565b600054610100900460ff166124905760405162461bcd60e51b815260040161097a9061304e565b61263c8282611c91565b6118b65761264981612848565b61265483602061285a565b6040516020016126659291906130bd565b60408051601f198184030181529082905262461bcd60e51b825261097a91600401613132565b6126958282611c91565b6118b65760008281526065602090815260408083206001600160a01b03851684529091529020805460ff191660011790556126cd3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000611c8a836001600160a01b0384166129f6565b6127308282611c91565b156118b65760008281526065602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6000611c8a836001600160a01b038416612a45565b60c95460ff166124905760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b604482015260640161097a565b600082600001828154811061280257612802612f27565b9060005260206000200154905092915050565b600054610100900460ff1661283c5760405162461bcd60e51b815260040161097a9061304e565b60c9805460ff19169055565b6060610cca6001600160a01b03831660145b60606000612869836002612f08565b612874906002612ec0565b67ffffffffffffffff81111561288c5761288c612b62565b6040519080825280601f01601f1916602001820160405280156128b6576020820181803683370190505b509050600360fc1b816000815181106128d1576128d1612f27565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061290057612900612f27565b60200101906001600160f81b031916908160001a9053506000612924846002612f08565b61292f906001612ec0565b90505b60018111156129a7576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061296357612963612f27565b1a60f81b82828151811061297957612979612f27565b60200101906001600160f81b031916908160001a90535060049490941c936129a081613165565b9050612932565b508315611c8a5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640161097a565b6000818152600183016020526040812054612a3d57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610cca565b506000610cca565b60008181526001830160205260408120548015612b2e576000612a69600183612ed3565b8554909150600090612a7d90600190612ed3565b9050818114612ae2576000866000018281548110612a9d57612a9d612f27565b9060005260206000200154905080876000018481548110612ac057612ac0612f27565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080612af357612af361317c565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610cca565b6000915050610cca565b600060208284031215612b4a57600080fd5b81356001600160e01b031981168114611c8a57600080fd5b634e487b7160e01b600052604160045260246000fd5b80356001600160a01b0381168114612b8f57600080fd5b919050565b60006020808385031215612ba757600080fd5b823567ffffffffffffffff80821115612bbf57600080fd5b818501915085601f830112612bd357600080fd5b813581811115612be557612be5612b62565b8060051b604051601f19603f83011681018181108582111715612c0a57612c0a612b62565b604052918252848201925083810185019188831115612c2857600080fd5b938501935b82851015612c4d57612c3e85612b78565b84529385019392850192612c2d565b98975050505050505050565b600060208284031215612c6b57600080fd5b5035919050565b600080600080600060808688031215612c8a57600080fd5b612c9386612b78565b9450612ca160208701612b78565b935060408601359250606086013567ffffffffffffffff80821115612cc557600080fd5b818801915088601f830112612cd957600080fd5b813581811115612ce857600080fd5b896020828501011115612cfa57600080fd5b9699959850939650602001949392505050565b600060208284031215612d1f57600080fd5b611c8a82612b78565b60008060408385031215612d3b57600080fd5b82359150612d4b60208401612b78565b90509250929050565b600080600060608486031215612d6957600080fd5b612d7284612b78565b9250612d8060208501612b78565b9150612d8e60408501612b78565b90509250925092565b60008060408385031215612daa57600080fd5b50508035926020909101359150565b600080600080600080600080610100898b031215612dd657600080fd5b612ddf89612b78565b9750612ded60208a01612b78565b9650612dfb60408a01612b78565b95506060890135945060808901359350612e1760a08a01612b78565b9250612e2560c08a01612b78565b9150612e3360e08a01612b78565b90509295985092959890939650565b6020808252600a90820152695265656e7472616e637960b01b604082015260600190565b6020808252601190820152704e6f742063757272656e7420737461676560781b604082015260600190565b600060208284031215612ea357600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b80820180821115610cca57610cca612eaa565b81810381811115610cca57610cca612eaa565b600082612f0357634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615612f2257612f22612eaa565b500290565b634e487b7160e01b600052603260045260246000fd5b600060208284031215612f4f57600080fd5b81518015158114611c8a57600080fd5b600060018201612f7157612f71612eaa565b5060010190565b600081518084526020808501945080840160005b83811015612fb15781516001600160a01b031687529582019590820190600101612f8c565b509495945050505050565b602081526000611c8a6020830184612f78565b60008060408385031215612fe257600080fd5b505080516020909101519092909150565b8381526000602060608184015261300d6060840186612f78565b838103604085015284518082528286019183019060005b8181101561304057835183529284019291840191600101613024565b509098975050505050505050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60005b838110156130b457818101518382015260200161309c565b50506000910152565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516130f5816017850160208801613099565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351613126816028840160208801613099565b01602801949350505050565b6020815260008251806020840152613151816040850160208701613099565b601f01601f19169190910160400192915050565b60008161317457613174612eaa565b506000190190565b634e487b7160e01b600052603160045260246000fdfe61c92169ef077349011ff0b1383c894d86c5f0b41d986366b58a6cf31e93bedaa164736f6c6343000810000a
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.