Feature Tip: Add private address tag to any address under My Name Tag !
ERC-721
Overview
Max Total Supply
300 MASS
Holders
141
Market
Volume (24H)
N/A
Min Price (24H)
N/A
Max Price (24H)
N/A
Other Info
Token Contract
Balance
2 MASSLoading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
Contract Name:
Mass
Compiler Version
v0.8.17+commit.8df45f5f
Optimization Enabled:
Yes with 500 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.17; import {PaymentSplitter} from "@openzeppelin/contracts/finance/PaymentSplitter.sol"; import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {SafeCast} from "@openzeppelin/contracts/utils/math/SafeCast.sol"; import {AccessControl} from "@openzeppelin/contracts/access/AccessControl.sol"; import {Pausable} from "@openzeppelin/contracts/security/Pausable.sol"; import {ERC721} from "./lib/ERC721.sol"; import {Strings} from "@openzeppelin/contracts/utils/Strings.sol"; error NotAuthorized(); error MaxSupplyReached(); interface IMassRenderer { function tokenURI(uint256 tokenId) external view returns (string memory); } /// @title Mass /// @author @0x_jj contract Mass is ERC721, PaymentSplitter, AccessControl, Ownable, Pausable { using SafeCast for uint256; uint256 public totalSupply = 0; uint256 public maxSupply; address public minter; IMassRenderer public renderer; IERC20 public wethContract; struct TokenData { uint256 transferCount; uint256[HISTORY_LENGTH] latestTransferTimestamps; uint256 mintTimestamp; bytes32 seed; uint256 resetTimestamp; } /// @dev Mapping from token ID to token data mapping(uint256 => TokenData) public tokenData; /// @dev Track when we receive royalty payments struct RoyaltyReceipt { uint64 timestamp; uint192 amount; } uint256 public ethReceivedCount; RoyaltyReceipt[HISTORY_LENGTH] public ethReceipts; /// @dev Track WETH roughly by checking balances between transfers struct WethStats { uint64 wethReceivedCount; uint192 latestWethBalance; } WethStats private wethStats; RoyaltyReceipt[HISTORY_LENGTH] public wethReceipts; /// @dev Number of transfers that have happened on the contract uint256 public transferCount; /// @dev Timestamp of the last transfer that happened on the contract uint256[HISTORY_LENGTH] public latestTransferTimestamps; /// @dev Base timestamp to use to calculate averages in the art script uint256 public baseTimestamp; constructor( address[] memory payees, uint256[] memory shares, address[] memory admins_, address wethContract_, address renderer_, uint256 maxSupply_ ) PaymentSplitter(payees, shares) ERC721("Mass", "MASS") { _grantRole(DEFAULT_ADMIN_ROLE, _msgSender()); for (uint256 i = 0; i < admins_.length; i++) { _grantRole(DEFAULT_ADMIN_ROLE, admins_[i]); } wethContract = IERC20(wethContract_); renderer = IMassRenderer(renderer_); baseTimestamp = block.timestamp; maxSupply = maxSupply_; } receive() external payable override { emit PaymentReceived(_msgSender(), msg.value); ethReceipts[ethReceivedCount % HISTORY_LENGTH] = RoyaltyReceipt( block.timestamp.toUint64(), msg.value.toUint192() ); ethReceivedCount += 1; } function unpause() external onlyRole(DEFAULT_ADMIN_ROLE) { _unpause(); } function pause() external onlyRole(DEFAULT_ADMIN_ROLE) { _pause(); } function setBaseTimestamp(uint256 _baseTimestamp) external onlyRole(DEFAULT_ADMIN_ROLE) { baseTimestamp = _baseTimestamp; } function setMinterAddress(address _minter) external onlyRole(DEFAULT_ADMIN_ROLE) { minter = _minter; } function setRendererAddress(address _renderer) external onlyRole(DEFAULT_ADMIN_ROLE) { renderer = IMassRenderer(_renderer); } function endMint() external onlyRole(DEFAULT_ADMIN_ROLE) { maxSupply = totalSupply; } function mint(address to) public whenNotPaused { if (totalSupply >= maxSupply) revert MaxSupplyReached(); if (!(_msgSender() == minter || _msgSender() == owner())) revert NotAuthorized(); uint256 tokenId = totalSupply; totalSupply++; tokenData[tokenId].mintTimestamp = block.timestamp; tokenData[tokenId].seed = keccak256( abi.encodePacked(blockhash(block.number - 1), block.number, block.timestamp, _msgSender(), tokenId) ); _safeMint(to, tokenId); } function mintMany(uint256 amt) external onlyOwner { for (uint256 i = 0; i < amt; i++) { mint(_msgSender()); } } function tokenURI(uint256 tokenId) public view override returns (string memory) { return renderer.tokenURI(tokenId); } function _afterTokenTransfer(address from, address, uint256 tokenId, uint256) internal override { if (from == address(0)) { return; } // Record latest transfer on contract latestTransferTimestamps[transferCount % HISTORY_LENGTH] = block.timestamp; // Record latest transfer on token. Unordered, to be sorted by timestamp off chain tokenData[tokenId].latestTransferTimestamps[tokenData[tokenId].transferCount % HISTORY_LENGTH] = block .timestamp; // Increase transfer counts on token and contract. Important so that we can correctly write to history arrays in a loop tokenData[tokenId].transferCount++; transferCount++; // Record WETH receipts, if any, attempting to match how we record native ETH receipts // We do this by checking the balance of the contract before and after the transfer, taking into account any WETH that has been released to payees // Of course this means we don't know when WETH was received multiple times between two transfers occurring, but that's fine, it's just a rough estimate WethStats memory stats = wethStats; uint256 prevBalance = stats.latestWethBalance; uint256 currentBalance = wethContract.balanceOf(address(this)) + totalReleased(wethContract); if (currentBalance > prevBalance) { stats.latestWethBalance = currentBalance.toUint192(); wethReceipts[stats.wethReceivedCount % HISTORY_LENGTH] = RoyaltyReceipt( block.timestamp.toUint64(), (currentBalance - prevBalance).toUint192() ); stats.wethReceivedCount++; wethStats = stats; } } function getHolderAddresses() public view returns (string[] memory) { string[] memory owners = new string[](totalSupply); address[] memory seen = new address[](totalSupply); uint256 count = 0; for (uint256 i = 0; i < totalSupply; i++) { address tokenOwner = ownerOf(i); if (findElement(seen, tokenOwner) == false) { owners[count] = Strings.toHexString(tokenOwner); seen[i] = tokenOwner; count++; } } return trimArray(owners, count); } function trimArray(string[] memory arr, uint256 toLength) internal pure returns (string[] memory) { string[] memory trimmed = new string[](toLength); for (uint256 i = 0; i < toLength; i++) { trimmed[i] = arr[i]; } return trimmed; } function getContractMetrics() external view returns ( uint256, uint256[HISTORY_LENGTH] memory, uint256, uint256[HISTORY_LENGTH] memory, uint256, RoyaltyReceipt[HISTORY_LENGTH] memory, RoyaltyReceipt[HISTORY_LENGTH] memory, uint256, string[] memory ) { return ( approvalCount, latestApprovalTimestamps, transferCount, latestTransferTimestamps, getHolderCount(), ethReceipts, wethReceipts, totalSupply, getHolderAddresses() ); } function getTokenMetrics( uint256 tokenId ) external view returns (uint256, uint256[HISTORY_LENGTH] memory, uint256, bytes32, uint256) { return ( tokenData[tokenId].transferCount, tokenData[tokenId].latestTransferTimestamps, tokenData[tokenId].mintTimestamp, tokenData[tokenId].seed, balanceOf(ownerOf(tokenId)) ); } function getHolderCount() internal view returns (uint256) { uint256 count = 0; address[] memory seen = new address[](totalSupply); for (uint256 i = 0; i < totalSupply; i++) { address owner = ownerOf(i); if (findElement(seen, owner) == false) { count++; seen[i] = owner; } else { seen[i] = address(0); } } return count; } function latestTransferTimestamp(TokenData memory _tokenData) internal pure returns (uint256) { if (_tokenData.transferCount == 0) return _tokenData.mintTimestamp; return _tokenData.latestTransferTimestamps[(_tokenData.transferCount - 1) % HISTORY_LENGTH]; } function supportsInterface(bytes4 interfaceId) public view override(ERC721, AccessControl) returns (bool) { return super.supportsInterface(interfaceId); } function findElement(address[] memory arr, address element) internal pure returns (bool) { for (uint256 i = 0; i < arr.length; i++) { if (arr[i] == element) { return true; } } return false; } function toHexDigit(uint8 d) internal pure returns (bytes1) { if (0 <= d && d <= 9) { return bytes1(uint8(bytes1("0")) + d); } else if (10 <= uint8(d) && uint8(d) <= 15) { return bytes1(uint8(bytes1("a")) + d - 10); } revert(); } function fromCode(bytes4 code) internal pure returns (string memory) { bytes memory result = new bytes(10); result[0] = bytes1("0"); result[1] = bytes1("x"); for (uint i = 0; i < 4; ++i) { result[2 * i + 2] = toHexDigit(uint8(code[i]) / 16); result[2 * i + 3] = toHexDigit(uint8(code[i]) % 16); } return string(result); } function getSelectors() public pure returns (string memory, string memory) { return (fromCode(this.getContractMetrics.selector), fromCode(this.getTokenMetrics.selector)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol) pragma solidity ^0.8.0; import "./IAccessControl.sol"; import "../utils/Context.sol"; import "../utils/Strings.sol"; import "../utils/introspection/ERC165.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: * * ```solidity * 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}: * * ```solidity * 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. We recommend using {AccessControlDefaultAdminRules} * to enforce additional security measures for this role. */ abstract contract AccessControl is Context, IAccessControl, ERC165 { 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(IAccessControl).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 ", Strings.toHexString(account), " is missing role ", Strings.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()); } } }
// 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 IAccessControl { /** * @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.9.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby disabling any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (finance/PaymentSplitter.sol) pragma solidity ^0.8.0; import "../token/ERC20/utils/SafeERC20.sol"; import "../utils/Address.sol"; import "../utils/Context.sol"; /** * @title PaymentSplitter * @dev This contract allows to split Ether payments among a group of accounts. The sender does not need to be aware * that the Ether will be split in this way, since it is handled transparently by the contract. * * The split can be in equal parts or in any other arbitrary proportion. The way this is specified is by assigning each * account to a number of shares. Of all the Ether that this contract receives, each account will then be able to claim * an amount proportional to the percentage of total shares they were assigned. The distribution of shares is set at the * time of contract deployment and can't be updated thereafter. * * `PaymentSplitter` follows a _pull payment_ model. This means that payments are not automatically forwarded to the * accounts but kept in this contract, and the actual transfer is triggered as a separate step by calling the {release} * function. * * NOTE: This contract assumes that ERC20 tokens will behave similarly to native tokens (Ether). Rebasing tokens, and * tokens that apply fees during transfers, are likely to not be supported as expected. If in doubt, we encourage you * to run tests before sending real value to this contract. */ contract PaymentSplitter is Context { event PayeeAdded(address account, uint256 shares); event PaymentReleased(address to, uint256 amount); event ERC20PaymentReleased(IERC20 indexed token, address to, uint256 amount); event PaymentReceived(address from, uint256 amount); uint256 private _totalShares; uint256 private _totalReleased; mapping(address => uint256) private _shares; mapping(address => uint256) private _released; address[] private _payees; mapping(IERC20 => uint256) private _erc20TotalReleased; mapping(IERC20 => mapping(address => uint256)) private _erc20Released; /** * @dev Creates an instance of `PaymentSplitter` where each account in `payees` is assigned the number of shares at * the matching position in the `shares` array. * * All addresses in `payees` must be non-zero. Both arrays must have the same non-zero length, and there must be no * duplicates in `payees`. */ constructor(address[] memory payees, uint256[] memory shares_) payable { require(payees.length == shares_.length, "PaymentSplitter: payees and shares length mismatch"); require(payees.length > 0, "PaymentSplitter: no payees"); for (uint256 i = 0; i < payees.length; i++) { _addPayee(payees[i], shares_[i]); } } /** * @dev The Ether received will be logged with {PaymentReceived} events. Note that these events are not fully * reliable: it's possible for a contract to receive Ether without triggering this function. This only affects the * reliability of the events, and not the actual splitting of Ether. * * To learn more about this see the Solidity documentation for * https://solidity.readthedocs.io/en/latest/contracts.html#fallback-function[fallback * functions]. */ receive() external payable virtual { emit PaymentReceived(_msgSender(), msg.value); } /** * @dev Getter for the total shares held by payees. */ function totalShares() public view returns (uint256) { return _totalShares; } /** * @dev Getter for the total amount of Ether already released. */ function totalReleased() public view returns (uint256) { return _totalReleased; } /** * @dev Getter for the total amount of `token` already released. `token` should be the address of an IERC20 * contract. */ function totalReleased(IERC20 token) public view returns (uint256) { return _erc20TotalReleased[token]; } /** * @dev Getter for the amount of shares held by an account. */ function shares(address account) public view returns (uint256) { return _shares[account]; } /** * @dev Getter for the amount of Ether already released to a payee. */ function released(address account) public view returns (uint256) { return _released[account]; } /** * @dev Getter for the amount of `token` tokens already released to a payee. `token` should be the address of an * IERC20 contract. */ function released(IERC20 token, address account) public view returns (uint256) { return _erc20Released[token][account]; } /** * @dev Getter for the address of the payee number `index`. */ function payee(uint256 index) public view returns (address) { return _payees[index]; } /** * @dev Getter for the amount of payee's releasable Ether. */ function releasable(address account) public view returns (uint256) { uint256 totalReceived = address(this).balance + totalReleased(); return _pendingPayment(account, totalReceived, released(account)); } /** * @dev Getter for the amount of payee's releasable `token` tokens. `token` should be the address of an * IERC20 contract. */ function releasable(IERC20 token, address account) public view returns (uint256) { uint256 totalReceived = token.balanceOf(address(this)) + totalReleased(token); return _pendingPayment(account, totalReceived, released(token, account)); } /** * @dev Triggers a transfer to `account` of the amount of Ether they are owed, according to their percentage of the * total shares and their previous withdrawals. */ function release(address payable account) public virtual { require(_shares[account] > 0, "PaymentSplitter: account has no shares"); uint256 payment = releasable(account); require(payment != 0, "PaymentSplitter: account is not due payment"); // _totalReleased is the sum of all values in _released. // If "_totalReleased += payment" does not overflow, then "_released[account] += payment" cannot overflow. _totalReleased += payment; unchecked { _released[account] += payment; } Address.sendValue(account, payment); emit PaymentReleased(account, payment); } /** * @dev Triggers a transfer to `account` of the amount of `token` tokens they are owed, according to their * percentage of the total shares and their previous withdrawals. `token` must be the address of an IERC20 * contract. */ function release(IERC20 token, address account) public virtual { require(_shares[account] > 0, "PaymentSplitter: account has no shares"); uint256 payment = releasable(token, account); require(payment != 0, "PaymentSplitter: account is not due payment"); // _erc20TotalReleased[token] is the sum of all values in _erc20Released[token]. // If "_erc20TotalReleased[token] += payment" does not overflow, then "_erc20Released[token][account] += payment" // cannot overflow. _erc20TotalReleased[token] += payment; unchecked { _erc20Released[token][account] += payment; } SafeERC20.safeTransfer(token, account, payment); emit ERC20PaymentReleased(token, account, payment); } /** * @dev internal logic for computing the pending payment of an `account` given the token historical balances and * already released amounts. */ function _pendingPayment( address account, uint256 totalReceived, uint256 alreadyReleased ) private view returns (uint256) { return (totalReceived * _shares[account]) / _totalShares - alreadyReleased; } /** * @dev Add a new payee to the contract. * @param account The address of the payee to add. * @param shares_ The number of shares owned by the payee. */ function _addPayee(address account, uint256 shares_) private { require(account != address(0), "PaymentSplitter: account is the zero address"); require(shares_ > 0, "PaymentSplitter: shares are 0"); require(_shares[account] == 0, "PaymentSplitter: account already has shares"); _payees.push(account); _shares[account] = shares_; _totalShares = _totalShares + shares_; emit PayeeAdded(account, shares_); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract Pausable is Context { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ constructor() { _paused = false; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { _requireNotPaused(); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { _requirePaused(); _; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Throws if the contract is paused. */ function _requireNotPaused() internal view virtual { require(!paused(), "Pausable: paused"); } /** * @dev Throws if the contract is not paused. */ function _requirePaused() internal view virtual { require(paused(), "Pausable: not paused"); } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 amount) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/IERC20Permit.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; /** * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } /** * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful. */ function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } /** * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 oldAllowance = token.allowance(address(this), spender); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value)); } /** * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value)); } } /** * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. Compatible with tokens that require the approval to be set to * 0 before setting it to a non-zero value. */ function forceApprove(IERC20 token, address spender, uint256 value) internal { bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value); if (!_callOptionalReturnBool(token, approvalCall)) { _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0)); _callOptionalReturn(token, approvalCall); } } /** * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`. * Revert on invalid signature. */ function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). * * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead. */ function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false // and not revert is the subcall reverts. (bool success, bytes memory returndata) = address(token).call(data); return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol) pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external; /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom(address from, address to, uint256 tokenId) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721 * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must * understand this adds an external call which potentially creates a reentrancy vulnerability. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 tokenId) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool approved) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); }
// 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.9.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * * Furthermore, `isContract` will also return true if the target contract within * the same transaction is already scheduled for destruction by `SELFDESTRUCT`, * which only has an effect at the end of a transaction. * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { // Solidity will revert if denominator == 0, unlike the div opcode on its own. // The surrounding unchecked block does not change this fact. // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic. return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1, "Math: mulDiv overflow"); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works // in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10 ** 64) { value /= 10 ** 64; result += 64; } if (value >= 10 ** 32) { value /= 10 ** 32; result += 32; } if (value >= 10 ** 16) { value /= 10 ** 16; result += 16; } if (value >= 10 ** 8) { value /= 10 ** 8; result += 8; } if (value >= 10 ** 4) { value /= 10 ** 4; result += 4; } if (value >= 10 ** 2) { value /= 10 ** 2; result += 2; } if (value >= 10 ** 1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 256, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SafeCast.sol) // This file was procedurally generated from scripts/generate/templates/SafeCast.js. pragma solidity ^0.8.0; /** * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow * checks. * * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can * easily result in undesired exploitation or bugs, since developers usually * assume that overflows raise errors. `SafeCast` restores this intuition by * reverting the transaction when such an operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. * * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing * all math on `uint256` and `int256` and then downcasting. */ library SafeCast { /** * @dev Returns the downcasted uint248 from uint256, reverting on * overflow (when the input is greater than largest uint248). * * Counterpart to Solidity's `uint248` operator. * * Requirements: * * - input must fit into 248 bits * * _Available since v4.7._ */ function toUint248(uint256 value) internal pure returns (uint248) { require(value <= type(uint248).max, "SafeCast: value doesn't fit in 248 bits"); return uint248(value); } /** * @dev Returns the downcasted uint240 from uint256, reverting on * overflow (when the input is greater than largest uint240). * * Counterpart to Solidity's `uint240` operator. * * Requirements: * * - input must fit into 240 bits * * _Available since v4.7._ */ function toUint240(uint256 value) internal pure returns (uint240) { require(value <= type(uint240).max, "SafeCast: value doesn't fit in 240 bits"); return uint240(value); } /** * @dev Returns the downcasted uint232 from uint256, reverting on * overflow (when the input is greater than largest uint232). * * Counterpart to Solidity's `uint232` operator. * * Requirements: * * - input must fit into 232 bits * * _Available since v4.7._ */ function toUint232(uint256 value) internal pure returns (uint232) { require(value <= type(uint232).max, "SafeCast: value doesn't fit in 232 bits"); return uint232(value); } /** * @dev Returns the downcasted uint224 from uint256, reverting on * overflow (when the input is greater than largest uint224). * * Counterpart to Solidity's `uint224` operator. * * Requirements: * * - input must fit into 224 bits * * _Available since v4.2._ */ function toUint224(uint256 value) internal pure returns (uint224) { require(value <= type(uint224).max, "SafeCast: value doesn't fit in 224 bits"); return uint224(value); } /** * @dev Returns the downcasted uint216 from uint256, reverting on * overflow (when the input is greater than largest uint216). * * Counterpart to Solidity's `uint216` operator. * * Requirements: * * - input must fit into 216 bits * * _Available since v4.7._ */ function toUint216(uint256 value) internal pure returns (uint216) { require(value <= type(uint216).max, "SafeCast: value doesn't fit in 216 bits"); return uint216(value); } /** * @dev Returns the downcasted uint208 from uint256, reverting on * overflow (when the input is greater than largest uint208). * * Counterpart to Solidity's `uint208` operator. * * Requirements: * * - input must fit into 208 bits * * _Available since v4.7._ */ function toUint208(uint256 value) internal pure returns (uint208) { require(value <= type(uint208).max, "SafeCast: value doesn't fit in 208 bits"); return uint208(value); } /** * @dev Returns the downcasted uint200 from uint256, reverting on * overflow (when the input is greater than largest uint200). * * Counterpart to Solidity's `uint200` operator. * * Requirements: * * - input must fit into 200 bits * * _Available since v4.7._ */ function toUint200(uint256 value) internal pure returns (uint200) { require(value <= type(uint200).max, "SafeCast: value doesn't fit in 200 bits"); return uint200(value); } /** * @dev Returns the downcasted uint192 from uint256, reverting on * overflow (when the input is greater than largest uint192). * * Counterpart to Solidity's `uint192` operator. * * Requirements: * * - input must fit into 192 bits * * _Available since v4.7._ */ function toUint192(uint256 value) internal pure returns (uint192) { require(value <= type(uint192).max, "SafeCast: value doesn't fit in 192 bits"); return uint192(value); } /** * @dev Returns the downcasted uint184 from uint256, reverting on * overflow (when the input is greater than largest uint184). * * Counterpart to Solidity's `uint184` operator. * * Requirements: * * - input must fit into 184 bits * * _Available since v4.7._ */ function toUint184(uint256 value) internal pure returns (uint184) { require(value <= type(uint184).max, "SafeCast: value doesn't fit in 184 bits"); return uint184(value); } /** * @dev Returns the downcasted uint176 from uint256, reverting on * overflow (when the input is greater than largest uint176). * * Counterpart to Solidity's `uint176` operator. * * Requirements: * * - input must fit into 176 bits * * _Available since v4.7._ */ function toUint176(uint256 value) internal pure returns (uint176) { require(value <= type(uint176).max, "SafeCast: value doesn't fit in 176 bits"); return uint176(value); } /** * @dev Returns the downcasted uint168 from uint256, reverting on * overflow (when the input is greater than largest uint168). * * Counterpart to Solidity's `uint168` operator. * * Requirements: * * - input must fit into 168 bits * * _Available since v4.7._ */ function toUint168(uint256 value) internal pure returns (uint168) { require(value <= type(uint168).max, "SafeCast: value doesn't fit in 168 bits"); return uint168(value); } /** * @dev Returns the downcasted uint160 from uint256, reverting on * overflow (when the input is greater than largest uint160). * * Counterpart to Solidity's `uint160` operator. * * Requirements: * * - input must fit into 160 bits * * _Available since v4.7._ */ function toUint160(uint256 value) internal pure returns (uint160) { require(value <= type(uint160).max, "SafeCast: value doesn't fit in 160 bits"); return uint160(value); } /** * @dev Returns the downcasted uint152 from uint256, reverting on * overflow (when the input is greater than largest uint152). * * Counterpart to Solidity's `uint152` operator. * * Requirements: * * - input must fit into 152 bits * * _Available since v4.7._ */ function toUint152(uint256 value) internal pure returns (uint152) { require(value <= type(uint152).max, "SafeCast: value doesn't fit in 152 bits"); return uint152(value); } /** * @dev Returns the downcasted uint144 from uint256, reverting on * overflow (when the input is greater than largest uint144). * * Counterpart to Solidity's `uint144` operator. * * Requirements: * * - input must fit into 144 bits * * _Available since v4.7._ */ function toUint144(uint256 value) internal pure returns (uint144) { require(value <= type(uint144).max, "SafeCast: value doesn't fit in 144 bits"); return uint144(value); } /** * @dev Returns the downcasted uint136 from uint256, reverting on * overflow (when the input is greater than largest uint136). * * Counterpart to Solidity's `uint136` operator. * * Requirements: * * - input must fit into 136 bits * * _Available since v4.7._ */ function toUint136(uint256 value) internal pure returns (uint136) { require(value <= type(uint136).max, "SafeCast: value doesn't fit in 136 bits"); return uint136(value); } /** * @dev Returns the downcasted uint128 from uint256, reverting on * overflow (when the input is greater than largest uint128). * * Counterpart to Solidity's `uint128` operator. * * Requirements: * * - input must fit into 128 bits * * _Available since v2.5._ */ function toUint128(uint256 value) internal pure returns (uint128) { require(value <= type(uint128).max, "SafeCast: value doesn't fit in 128 bits"); return uint128(value); } /** * @dev Returns the downcasted uint120 from uint256, reverting on * overflow (when the input is greater than largest uint120). * * Counterpart to Solidity's `uint120` operator. * * Requirements: * * - input must fit into 120 bits * * _Available since v4.7._ */ function toUint120(uint256 value) internal pure returns (uint120) { require(value <= type(uint120).max, "SafeCast: value doesn't fit in 120 bits"); return uint120(value); } /** * @dev Returns the downcasted uint112 from uint256, reverting on * overflow (when the input is greater than largest uint112). * * Counterpart to Solidity's `uint112` operator. * * Requirements: * * - input must fit into 112 bits * * _Available since v4.7._ */ function toUint112(uint256 value) internal pure returns (uint112) { require(value <= type(uint112).max, "SafeCast: value doesn't fit in 112 bits"); return uint112(value); } /** * @dev Returns the downcasted uint104 from uint256, reverting on * overflow (when the input is greater than largest uint104). * * Counterpart to Solidity's `uint104` operator. * * Requirements: * * - input must fit into 104 bits * * _Available since v4.7._ */ function toUint104(uint256 value) internal pure returns (uint104) { require(value <= type(uint104).max, "SafeCast: value doesn't fit in 104 bits"); return uint104(value); } /** * @dev Returns the downcasted uint96 from uint256, reverting on * overflow (when the input is greater than largest uint96). * * Counterpart to Solidity's `uint96` operator. * * Requirements: * * - input must fit into 96 bits * * _Available since v4.2._ */ function toUint96(uint256 value) internal pure returns (uint96) { require(value <= type(uint96).max, "SafeCast: value doesn't fit in 96 bits"); return uint96(value); } /** * @dev Returns the downcasted uint88 from uint256, reverting on * overflow (when the input is greater than largest uint88). * * Counterpart to Solidity's `uint88` operator. * * Requirements: * * - input must fit into 88 bits * * _Available since v4.7._ */ function toUint88(uint256 value) internal pure returns (uint88) { require(value <= type(uint88).max, "SafeCast: value doesn't fit in 88 bits"); return uint88(value); } /** * @dev Returns the downcasted uint80 from uint256, reverting on * overflow (when the input is greater than largest uint80). * * Counterpart to Solidity's `uint80` operator. * * Requirements: * * - input must fit into 80 bits * * _Available since v4.7._ */ function toUint80(uint256 value) internal pure returns (uint80) { require(value <= type(uint80).max, "SafeCast: value doesn't fit in 80 bits"); return uint80(value); } /** * @dev Returns the downcasted uint72 from uint256, reverting on * overflow (when the input is greater than largest uint72). * * Counterpart to Solidity's `uint72` operator. * * Requirements: * * - input must fit into 72 bits * * _Available since v4.7._ */ function toUint72(uint256 value) internal pure returns (uint72) { require(value <= type(uint72).max, "SafeCast: value doesn't fit in 72 bits"); return uint72(value); } /** * @dev Returns the downcasted uint64 from uint256, reverting on * overflow (when the input is greater than largest uint64). * * Counterpart to Solidity's `uint64` operator. * * Requirements: * * - input must fit into 64 bits * * _Available since v2.5._ */ function toUint64(uint256 value) internal pure returns (uint64) { require(value <= type(uint64).max, "SafeCast: value doesn't fit in 64 bits"); return uint64(value); } /** * @dev Returns the downcasted uint56 from uint256, reverting on * overflow (when the input is greater than largest uint56). * * Counterpart to Solidity's `uint56` operator. * * Requirements: * * - input must fit into 56 bits * * _Available since v4.7._ */ function toUint56(uint256 value) internal pure returns (uint56) { require(value <= type(uint56).max, "SafeCast: value doesn't fit in 56 bits"); return uint56(value); } /** * @dev Returns the downcasted uint48 from uint256, reverting on * overflow (when the input is greater than largest uint48). * * Counterpart to Solidity's `uint48` operator. * * Requirements: * * - input must fit into 48 bits * * _Available since v4.7._ */ function toUint48(uint256 value) internal pure returns (uint48) { require(value <= type(uint48).max, "SafeCast: value doesn't fit in 48 bits"); return uint48(value); } /** * @dev Returns the downcasted uint40 from uint256, reverting on * overflow (when the input is greater than largest uint40). * * Counterpart to Solidity's `uint40` operator. * * Requirements: * * - input must fit into 40 bits * * _Available since v4.7._ */ function toUint40(uint256 value) internal pure returns (uint40) { require(value <= type(uint40).max, "SafeCast: value doesn't fit in 40 bits"); return uint40(value); } /** * @dev Returns the downcasted uint32 from uint256, reverting on * overflow (when the input is greater than largest uint32). * * Counterpart to Solidity's `uint32` operator. * * Requirements: * * - input must fit into 32 bits * * _Available since v2.5._ */ function toUint32(uint256 value) internal pure returns (uint32) { require(value <= type(uint32).max, "SafeCast: value doesn't fit in 32 bits"); return uint32(value); } /** * @dev Returns the downcasted uint24 from uint256, reverting on * overflow (when the input is greater than largest uint24). * * Counterpart to Solidity's `uint24` operator. * * Requirements: * * - input must fit into 24 bits * * _Available since v4.7._ */ function toUint24(uint256 value) internal pure returns (uint24) { require(value <= type(uint24).max, "SafeCast: value doesn't fit in 24 bits"); return uint24(value); } /** * @dev Returns the downcasted uint16 from uint256, reverting on * overflow (when the input is greater than largest uint16). * * Counterpart to Solidity's `uint16` operator. * * Requirements: * * - input must fit into 16 bits * * _Available since v2.5._ */ function toUint16(uint256 value) internal pure returns (uint16) { require(value <= type(uint16).max, "SafeCast: value doesn't fit in 16 bits"); return uint16(value); } /** * @dev Returns the downcasted uint8 from uint256, reverting on * overflow (when the input is greater than largest uint8). * * Counterpart to Solidity's `uint8` operator. * * Requirements: * * - input must fit into 8 bits * * _Available since v2.5._ */ function toUint8(uint256 value) internal pure returns (uint8) { require(value <= type(uint8).max, "SafeCast: value doesn't fit in 8 bits"); return uint8(value); } /** * @dev Converts a signed int256 into an unsigned uint256. * * Requirements: * * - input must be greater than or equal to 0. * * _Available since v3.0._ */ function toUint256(int256 value) internal pure returns (uint256) { require(value >= 0, "SafeCast: value must be positive"); return uint256(value); } /** * @dev Returns the downcasted int248 from int256, reverting on * overflow (when the input is less than smallest int248 or * greater than largest int248). * * Counterpart to Solidity's `int248` operator. * * Requirements: * * - input must fit into 248 bits * * _Available since v4.7._ */ function toInt248(int256 value) internal pure returns (int248 downcasted) { downcasted = int248(value); require(downcasted == value, "SafeCast: value doesn't fit in 248 bits"); } /** * @dev Returns the downcasted int240 from int256, reverting on * overflow (when the input is less than smallest int240 or * greater than largest int240). * * Counterpart to Solidity's `int240` operator. * * Requirements: * * - input must fit into 240 bits * * _Available since v4.7._ */ function toInt240(int256 value) internal pure returns (int240 downcasted) { downcasted = int240(value); require(downcasted == value, "SafeCast: value doesn't fit in 240 bits"); } /** * @dev Returns the downcasted int232 from int256, reverting on * overflow (when the input is less than smallest int232 or * greater than largest int232). * * Counterpart to Solidity's `int232` operator. * * Requirements: * * - input must fit into 232 bits * * _Available since v4.7._ */ function toInt232(int256 value) internal pure returns (int232 downcasted) { downcasted = int232(value); require(downcasted == value, "SafeCast: value doesn't fit in 232 bits"); } /** * @dev Returns the downcasted int224 from int256, reverting on * overflow (when the input is less than smallest int224 or * greater than largest int224). * * Counterpart to Solidity's `int224` operator. * * Requirements: * * - input must fit into 224 bits * * _Available since v4.7._ */ function toInt224(int256 value) internal pure returns (int224 downcasted) { downcasted = int224(value); require(downcasted == value, "SafeCast: value doesn't fit in 224 bits"); } /** * @dev Returns the downcasted int216 from int256, reverting on * overflow (when the input is less than smallest int216 or * greater than largest int216). * * Counterpart to Solidity's `int216` operator. * * Requirements: * * - input must fit into 216 bits * * _Available since v4.7._ */ function toInt216(int256 value) internal pure returns (int216 downcasted) { downcasted = int216(value); require(downcasted == value, "SafeCast: value doesn't fit in 216 bits"); } /** * @dev Returns the downcasted int208 from int256, reverting on * overflow (when the input is less than smallest int208 or * greater than largest int208). * * Counterpart to Solidity's `int208` operator. * * Requirements: * * - input must fit into 208 bits * * _Available since v4.7._ */ function toInt208(int256 value) internal pure returns (int208 downcasted) { downcasted = int208(value); require(downcasted == value, "SafeCast: value doesn't fit in 208 bits"); } /** * @dev Returns the downcasted int200 from int256, reverting on * overflow (when the input is less than smallest int200 or * greater than largest int200). * * Counterpart to Solidity's `int200` operator. * * Requirements: * * - input must fit into 200 bits * * _Available since v4.7._ */ function toInt200(int256 value) internal pure returns (int200 downcasted) { downcasted = int200(value); require(downcasted == value, "SafeCast: value doesn't fit in 200 bits"); } /** * @dev Returns the downcasted int192 from int256, reverting on * overflow (when the input is less than smallest int192 or * greater than largest int192). * * Counterpart to Solidity's `int192` operator. * * Requirements: * * - input must fit into 192 bits * * _Available since v4.7._ */ function toInt192(int256 value) internal pure returns (int192 downcasted) { downcasted = int192(value); require(downcasted == value, "SafeCast: value doesn't fit in 192 bits"); } /** * @dev Returns the downcasted int184 from int256, reverting on * overflow (when the input is less than smallest int184 or * greater than largest int184). * * Counterpart to Solidity's `int184` operator. * * Requirements: * * - input must fit into 184 bits * * _Available since v4.7._ */ function toInt184(int256 value) internal pure returns (int184 downcasted) { downcasted = int184(value); require(downcasted == value, "SafeCast: value doesn't fit in 184 bits"); } /** * @dev Returns the downcasted int176 from int256, reverting on * overflow (when the input is less than smallest int176 or * greater than largest int176). * * Counterpart to Solidity's `int176` operator. * * Requirements: * * - input must fit into 176 bits * * _Available since v4.7._ */ function toInt176(int256 value) internal pure returns (int176 downcasted) { downcasted = int176(value); require(downcasted == value, "SafeCast: value doesn't fit in 176 bits"); } /** * @dev Returns the downcasted int168 from int256, reverting on * overflow (when the input is less than smallest int168 or * greater than largest int168). * * Counterpart to Solidity's `int168` operator. * * Requirements: * * - input must fit into 168 bits * * _Available since v4.7._ */ function toInt168(int256 value) internal pure returns (int168 downcasted) { downcasted = int168(value); require(downcasted == value, "SafeCast: value doesn't fit in 168 bits"); } /** * @dev Returns the downcasted int160 from int256, reverting on * overflow (when the input is less than smallest int160 or * greater than largest int160). * * Counterpart to Solidity's `int160` operator. * * Requirements: * * - input must fit into 160 bits * * _Available since v4.7._ */ function toInt160(int256 value) internal pure returns (int160 downcasted) { downcasted = int160(value); require(downcasted == value, "SafeCast: value doesn't fit in 160 bits"); } /** * @dev Returns the downcasted int152 from int256, reverting on * overflow (when the input is less than smallest int152 or * greater than largest int152). * * Counterpart to Solidity's `int152` operator. * * Requirements: * * - input must fit into 152 bits * * _Available since v4.7._ */ function toInt152(int256 value) internal pure returns (int152 downcasted) { downcasted = int152(value); require(downcasted == value, "SafeCast: value doesn't fit in 152 bits"); } /** * @dev Returns the downcasted int144 from int256, reverting on * overflow (when the input is less than smallest int144 or * greater than largest int144). * * Counterpart to Solidity's `int144` operator. * * Requirements: * * - input must fit into 144 bits * * _Available since v4.7._ */ function toInt144(int256 value) internal pure returns (int144 downcasted) { downcasted = int144(value); require(downcasted == value, "SafeCast: value doesn't fit in 144 bits"); } /** * @dev Returns the downcasted int136 from int256, reverting on * overflow (when the input is less than smallest int136 or * greater than largest int136). * * Counterpart to Solidity's `int136` operator. * * Requirements: * * - input must fit into 136 bits * * _Available since v4.7._ */ function toInt136(int256 value) internal pure returns (int136 downcasted) { downcasted = int136(value); require(downcasted == value, "SafeCast: value doesn't fit in 136 bits"); } /** * @dev Returns the downcasted int128 from int256, reverting on * overflow (when the input is less than smallest int128 or * greater than largest int128). * * Counterpart to Solidity's `int128` operator. * * Requirements: * * - input must fit into 128 bits * * _Available since v3.1._ */ function toInt128(int256 value) internal pure returns (int128 downcasted) { downcasted = int128(value); require(downcasted == value, "SafeCast: value doesn't fit in 128 bits"); } /** * @dev Returns the downcasted int120 from int256, reverting on * overflow (when the input is less than smallest int120 or * greater than largest int120). * * Counterpart to Solidity's `int120` operator. * * Requirements: * * - input must fit into 120 bits * * _Available since v4.7._ */ function toInt120(int256 value) internal pure returns (int120 downcasted) { downcasted = int120(value); require(downcasted == value, "SafeCast: value doesn't fit in 120 bits"); } /** * @dev Returns the downcasted int112 from int256, reverting on * overflow (when the input is less than smallest int112 or * greater than largest int112). * * Counterpart to Solidity's `int112` operator. * * Requirements: * * - input must fit into 112 bits * * _Available since v4.7._ */ function toInt112(int256 value) internal pure returns (int112 downcasted) { downcasted = int112(value); require(downcasted == value, "SafeCast: value doesn't fit in 112 bits"); } /** * @dev Returns the downcasted int104 from int256, reverting on * overflow (when the input is less than smallest int104 or * greater than largest int104). * * Counterpart to Solidity's `int104` operator. * * Requirements: * * - input must fit into 104 bits * * _Available since v4.7._ */ function toInt104(int256 value) internal pure returns (int104 downcasted) { downcasted = int104(value); require(downcasted == value, "SafeCast: value doesn't fit in 104 bits"); } /** * @dev Returns the downcasted int96 from int256, reverting on * overflow (when the input is less than smallest int96 or * greater than largest int96). * * Counterpart to Solidity's `int96` operator. * * Requirements: * * - input must fit into 96 bits * * _Available since v4.7._ */ function toInt96(int256 value) internal pure returns (int96 downcasted) { downcasted = int96(value); require(downcasted == value, "SafeCast: value doesn't fit in 96 bits"); } /** * @dev Returns the downcasted int88 from int256, reverting on * overflow (when the input is less than smallest int88 or * greater than largest int88). * * Counterpart to Solidity's `int88` operator. * * Requirements: * * - input must fit into 88 bits * * _Available since v4.7._ */ function toInt88(int256 value) internal pure returns (int88 downcasted) { downcasted = int88(value); require(downcasted == value, "SafeCast: value doesn't fit in 88 bits"); } /** * @dev Returns the downcasted int80 from int256, reverting on * overflow (when the input is less than smallest int80 or * greater than largest int80). * * Counterpart to Solidity's `int80` operator. * * Requirements: * * - input must fit into 80 bits * * _Available since v4.7._ */ function toInt80(int256 value) internal pure returns (int80 downcasted) { downcasted = int80(value); require(downcasted == value, "SafeCast: value doesn't fit in 80 bits"); } /** * @dev Returns the downcasted int72 from int256, reverting on * overflow (when the input is less than smallest int72 or * greater than largest int72). * * Counterpart to Solidity's `int72` operator. * * Requirements: * * - input must fit into 72 bits * * _Available since v4.7._ */ function toInt72(int256 value) internal pure returns (int72 downcasted) { downcasted = int72(value); require(downcasted == value, "SafeCast: value doesn't fit in 72 bits"); } /** * @dev Returns the downcasted int64 from int256, reverting on * overflow (when the input is less than smallest int64 or * greater than largest int64). * * Counterpart to Solidity's `int64` operator. * * Requirements: * * - input must fit into 64 bits * * _Available since v3.1._ */ function toInt64(int256 value) internal pure returns (int64 downcasted) { downcasted = int64(value); require(downcasted == value, "SafeCast: value doesn't fit in 64 bits"); } /** * @dev Returns the downcasted int56 from int256, reverting on * overflow (when the input is less than smallest int56 or * greater than largest int56). * * Counterpart to Solidity's `int56` operator. * * Requirements: * * - input must fit into 56 bits * * _Available since v4.7._ */ function toInt56(int256 value) internal pure returns (int56 downcasted) { downcasted = int56(value); require(downcasted == value, "SafeCast: value doesn't fit in 56 bits"); } /** * @dev Returns the downcasted int48 from int256, reverting on * overflow (when the input is less than smallest int48 or * greater than largest int48). * * Counterpart to Solidity's `int48` operator. * * Requirements: * * - input must fit into 48 bits * * _Available since v4.7._ */ function toInt48(int256 value) internal pure returns (int48 downcasted) { downcasted = int48(value); require(downcasted == value, "SafeCast: value doesn't fit in 48 bits"); } /** * @dev Returns the downcasted int40 from int256, reverting on * overflow (when the input is less than smallest int40 or * greater than largest int40). * * Counterpart to Solidity's `int40` operator. * * Requirements: * * - input must fit into 40 bits * * _Available since v4.7._ */ function toInt40(int256 value) internal pure returns (int40 downcasted) { downcasted = int40(value); require(downcasted == value, "SafeCast: value doesn't fit in 40 bits"); } /** * @dev Returns the downcasted int32 from int256, reverting on * overflow (when the input is less than smallest int32 or * greater than largest int32). * * Counterpart to Solidity's `int32` operator. * * Requirements: * * - input must fit into 32 bits * * _Available since v3.1._ */ function toInt32(int256 value) internal pure returns (int32 downcasted) { downcasted = int32(value); require(downcasted == value, "SafeCast: value doesn't fit in 32 bits"); } /** * @dev Returns the downcasted int24 from int256, reverting on * overflow (when the input is less than smallest int24 or * greater than largest int24). * * Counterpart to Solidity's `int24` operator. * * Requirements: * * - input must fit into 24 bits * * _Available since v4.7._ */ function toInt24(int256 value) internal pure returns (int24 downcasted) { downcasted = int24(value); require(downcasted == value, "SafeCast: value doesn't fit in 24 bits"); } /** * @dev Returns the downcasted int16 from int256, reverting on * overflow (when the input is less than smallest int16 or * greater than largest int16). * * Counterpart to Solidity's `int16` operator. * * Requirements: * * - input must fit into 16 bits * * _Available since v3.1._ */ function toInt16(int256 value) internal pure returns (int16 downcasted) { downcasted = int16(value); require(downcasted == value, "SafeCast: value doesn't fit in 16 bits"); } /** * @dev Returns the downcasted int8 from int256, reverting on * overflow (when the input is less than smallest int8 or * greater than largest int8). * * Counterpart to Solidity's `int8` operator. * * Requirements: * * - input must fit into 8 bits * * _Available since v3.1._ */ function toInt8(int256 value) internal pure returns (int8 downcasted) { downcasted = int8(value); require(downcasted == value, "SafeCast: value doesn't fit in 8 bits"); } /** * @dev Converts an unsigned uint256 into a signed int256. * * Requirements: * * - input must be less than or equal to maxInt256. * * _Available since v3.0._ */ function toInt256(uint256 value) internal pure returns (int256) { // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive require(value <= uint256(type(int256).max), "SafeCast: value doesn't fit in an int256"); return int256(value); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol) pragma solidity ^0.8.0; /** * @dev Standard signed math utilities missing in the Solidity language. */ library SignedMath { /** * @dev Returns the largest of two signed numbers. */ function max(int256 a, int256 b) internal pure returns (int256) { return a > b ? a : b; } /** * @dev Returns the smallest of two signed numbers. */ function min(int256 a, int256 b) internal pure returns (int256) { return a < b ? a : b; } /** * @dev Returns the average of two signed numbers without overflow. * The result is rounded towards zero. */ function average(int256 a, int256 b) internal pure returns (int256) { // Formula from the book "Hacker's Delight" int256 x = (a & b) + ((a ^ b) >> 1); return x + (int256(uint256(x) >> 255) & (a ^ b)); } /** * @dev Returns the absolute unsigned value of a signed value. */ function abs(int256 n) internal pure returns (uint256) { unchecked { // must be unchecked in order to support `n = type(int256).min` return uint256(n >= 0 ? n : -n); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol) pragma solidity ^0.8.0; import "./math/Math.sol"; import "./math/SignedMath.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant _SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), _SYMBOLS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `int256` to its ASCII `string` decimal representation. */ function toString(int256 value) internal pure returns (string memory) { return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMath.abs(value)))); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, Math.log256(value) + 1); } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } /** * @dev Returns true if the two strings are equal. */ function equal(string memory a, string memory b) internal pure returns (bool) { return keccak256(bytes(a)) == keccak256(bytes(b)); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/utils/Context.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "@openzeppelin/contracts/utils/introspection/ERC165.sol"; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Number of datapoints to store uint256 public constant HISTORY_LENGTH = 200; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; // Tracking uint256 public approvalCount; uint256[HISTORY_LENGTH] public latestApprovalTimestamps; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface( bytes4 interfaceId ) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf( address owner ) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: address zero is not a valid owner"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf( uint256 tokenId ) public view virtual override returns (address) { address owner = _ownerOf(tokenId); require(owner != address(0), "ERC721: invalid token ID"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI( uint256 tokenId ) public view virtual override returns (string memory) { _requireMinted(tokenId); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overridden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not token owner or approved for all" ); latestApprovalTimestamps[approvalCount % HISTORY_LENGTH] = block.timestamp; approvalCount++; _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved( uint256 tokenId ) public view virtual override returns (address) { _requireMinted(tokenId); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll( address operator, bool approved ) public virtual override { if (approved) { latestApprovalTimestamps[approvalCount % HISTORY_LENGTH] = block .timestamp; approvalCount++; } _setApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll( address owner, address operator ) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require( _isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner or approved" ); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory data ) public virtual override { require( _isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner or approved" ); _safeTransfer(from, to, tokenId, data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory data ) internal virtual { _transfer(from, to, tokenId); require( _checkOnERC721Received(from, to, tokenId, data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist */ function _ownerOf(uint256 tokenId) internal view virtual returns (address) { return _owners[tokenId]; } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _ownerOf(tokenId) != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner( address spender, uint256 tokenId ) internal view virtual returns (bool) { address owner = ERC721.ownerOf(tokenId); return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint( address to, uint256 tokenId, bytes memory data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId, 1); // Check that tokenId was not minted by `_beforeTokenTransfer` hook require(!_exists(tokenId), "ERC721: token already minted"); unchecked { // Will not overflow unless all 2**256 token ids are minted to the same owner. // Given that tokens are minted one by one, it is impossible in practice that // this ever happens. Might change if we allow batch minting. // The ERC fails to describe this case. _balances[to] += 1; } _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); _afterTokenTransfer(address(0), to, tokenId, 1); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * This is an internal function that does not check if the sender is authorized to operate on the token. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId, 1); // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook owner = ERC721.ownerOf(tokenId); // Clear approvals delete _tokenApprovals[tokenId]; unchecked { // Cannot overflow, as that would require more tokens to be burned/transferred // out than the owner initially received through minting and transferring in. _balances[owner] -= 1; } delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); _afterTokenTransfer(owner, address(0), tokenId, 1); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require( ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner" ); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId, 1); // Check that tokenId was not transferred by `_beforeTokenTransfer` hook require( ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner" ); // Clear approvals from the previous owner delete _tokenApprovals[tokenId]; unchecked { // `_balances[from]` cannot overflow for the same reason as described in `_burn`: // `from`'s balance is the number of token held, which is at least one before the current // transfer. // `_balances[to]` could overflow in the conditions described in `_mint`. That would require // all 2**256 token ids to be minted, which in practice is impossible. _balances[from] -= 1; _balances[to] += 1; } _owners[tokenId] = to; emit Transfer(from, to, tokenId); _afterTokenTransfer(from, to, tokenId, 1); } /** * @dev Approve `to` to operate on `tokenId` * * Emits an {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Approve `operator` to operate on all of `owner` tokens * * Emits an {ApprovalForAll} event. */ function _setApprovalForAll( address owner, address operator, bool approved ) internal virtual { require(owner != operator, "ERC721: approve to caller"); _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } /** * @dev Reverts if the `tokenId` has not been minted yet. */ function _requireMinted(uint256 tokenId) internal view virtual { require(_exists(tokenId), "ERC721: invalid token ID"); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { /// @solidity memory-safe-assembly assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`. * - When `from` is zero, the tokens will be minted for `to`. * - When `to` is zero, ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * - `batchSize` is non-zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 /* firstTokenId */, uint256 batchSize ) internal virtual { if (batchSize > 1) { if (from != address(0)) { _balances[from] -= batchSize; } if (to != address(0)) { _balances[to] += batchSize; } } } /** * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`. * - When `from` is zero, the tokens were minted for `to`. * - When `to` is zero, ``from``'s tokens were burned. * - `from` and `to` are never both zero. * - `batchSize` is non-zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 firstTokenId, uint256 batchSize ) internal virtual {} }
{ "optimizer": { "enabled": true, "runs": 500, "details": { "yul": true, "yulDetails": { "stackAllocation": true, "optimizerSteps": "dhfoDgvulfnTUtnIf" } } }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address[]","name":"payees","type":"address[]"},{"internalType":"uint256[]","name":"shares","type":"uint256[]"},{"internalType":"address[]","name":"admins_","type":"address[]"},{"internalType":"address","name":"wethContract_","type":"address"},{"internalType":"address","name":"renderer_","type":"address"},{"internalType":"uint256","name":"maxSupply_","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"MaxSupplyReached","type":"error"},{"inputs":[],"name":"NotAuthorized","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract IERC20","name":"token","type":"address"},{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"ERC20PaymentReleased","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"PayeeAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"PaymentReceived","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"PaymentReleased","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":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"HISTORY_LENGTH","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"approvalCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"endMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"ethReceipts","outputs":[{"internalType":"uint64","name":"timestamp","type":"uint64"},{"internalType":"uint192","name":"amount","type":"uint192"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ethReceivedCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getContractMetrics","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256[200]","name":"","type":"uint256[200]"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256[200]","name":"","type":"uint256[200]"},{"internalType":"uint256","name":"","type":"uint256"},{"components":[{"internalType":"uint64","name":"timestamp","type":"uint64"},{"internalType":"uint192","name":"amount","type":"uint192"}],"internalType":"struct Mass.RoyaltyReceipt[200]","name":"","type":"tuple[200]"},{"components":[{"internalType":"uint64","name":"timestamp","type":"uint64"},{"internalType":"uint192","name":"amount","type":"uint192"}],"internalType":"struct Mass.RoyaltyReceipt[200]","name":"","type":"tuple[200]"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"string[]","name":"","type":"string[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getHolderAddresses","outputs":[{"internalType":"string[]","name":"","type":"string[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getSelectors","outputs":[{"internalType":"string","name":"","type":"string"},{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getTokenMetrics","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256[200]","name":"","type":"uint256[200]"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes32","name":"","type":"bytes32"},{"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":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"latestApprovalTimestamps","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"latestTransferTimestamps","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amt","type":"uint256"}],"name":"mintMany","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"minter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"payee","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"releasable","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"address","name":"account","type":"address"}],"name":"releasable","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address payable","name":"account","type":"address"}],"name":"release","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"address","name":"account","type":"address"}],"name":"release","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"address","name":"account","type":"address"}],"name":"released","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"released","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renderer","outputs":[{"internalType":"contract IMassRenderer","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","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":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_baseTimestamp","type":"uint256"}],"name":"setBaseTimestamp","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_minter","type":"address"}],"name":"setMinterAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_renderer","type":"address"}],"name":"setRendererAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"shares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokenData","outputs":[{"internalType":"uint256","name":"transferCount","type":"uint256"},{"internalType":"uint256","name":"mintTimestamp","type":"uint256"},{"internalType":"bytes32","name":"seed","type":"bytes32"},{"internalType":"uint256","name":"resetTimestamp","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"}],"name":"totalReleased","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalReleased","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalShares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"transferCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"wethContract","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"wethReceipts","outputs":[{"internalType":"uint64","name":"timestamp","type":"uint64"},{"internalType":"uint192","name":"amount","type":"uint192"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
6080604052600060d8553480156200001657600080fd5b5060405162004ddb38038062004ddb833981016040819052620000399162000651565b8585604051806040016040528060048152602001634d61737360e01b815250604051806040016040528060048152602001634d41535360e01b815250816000908162000086919062000839565b50600162000095828262000839565b5050508051825114620000c55760405162461bcd60e51b8152600401620000bc9062000954565b60405180910390fd5b6000825111620000e95760405162461bcd60e51b8152600401620000bc906200099a565b60005b82518110156200015557620001408382815181106200010f576200010f620009ac565b60200260200101518383815181106200012c576200012c620009ac565b60200260200101516200022260201b60201c565b806200014c81620009d8565b915050620000ec565b505050620001726200016c6200035460201b60201c565b62000358565b60d7805460ff60a01b191690556200018c600033620003aa565b60005b8451811015620001df57620001ca6000801b868381518110620001b657620001b6620009ac565b6020026020010151620003aa60201b60201c565b80620001d681620009d8565b9150506200018f565b5060dc80546001600160a01b039485166001600160a01b03199182161790915560db805493909416921691909117909155426103395560d9555062000b40915050565b6001600160a01b0382166200024b5760405162461bcd60e51b8152600401620000bc9062000a3c565b600081116200026e5760405162461bcd60e51b8152600401620000bc9062000a81565b6001600160a01b038216600090815260d1602052604090205415620002a75760405162461bcd60e51b8152600401620000bc9062000ada565b60d38054600181019091557f915c3eb987b20e1af620c1403197bf687fb7f18513b3a73fde6e78c7072c41a60180546001600160a01b0319166001600160a01b038416908117909155600090815260d16020526040902081905560cf546200031190829062000aec565b60cf556040517f40c340f65e17194d14ddddb073d3c9f888e3cb52b5aae0c6c7706b4fbc905fac9062000348908490849062000b1a565b60405180910390a15050565b3390565b60d780546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b620003b6828262000435565b6200043157600082815260d6602090815260408083206001600160a01b03851684529091529020805460ff19166001179055620003f03390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b600082815260d6602090815260408083206001600160a01b038516845290915290205460ff165b92915050565b634e487b7160e01b600052604160045260246000fd5b601f19601f83011681016001600160401b0381118282101715620004a057620004a062000462565b6040525050565b6000620004b360405190565b9050620004c1828262000478565b919050565b60006001600160401b03821115620004e257620004e262000462565b5060209081020190565b60006001600160a01b0382166200045c565b6200050981620004ec565b81146200051557600080fd5b50565b80516200045c81620004fe565b60006200053c6200053684620004c6565b620004a7565b838152905060208082019084028301858111156200055d576200055d600080fd5b835b81811015620005835762000574878262000518565b8352602092830192016200055f565b5050509392505050565b600082601f830112620005a357620005a3600080fd5b8151620005b584826020860162000525565b949350505050565b8062000509565b80516200045c81620005bd565b6000620005e26200053684620004c6565b83815290506020808201908402830185811115620006035762000603600080fd5b835b8181101562000583576200061a8782620005c4565b83526020928301920162000605565b600082601f8301126200063f576200063f600080fd5b8151620005b5848260208601620005d1565b60008060008060008060c087890312156200066f576200066f600080fd5b86516001600160401b038111156200068a576200068a600080fd5b6200069889828a016200058d565b602089015190975090506001600160401b03811115620006bb57620006bb600080fd5b620006c989828a0162000629565b604089015190965090506001600160401b03811115620006ec57620006ec600080fd5b620006fa89828a016200058d565b94505060606200070d89828a0162000518565b93505060806200072089828a0162000518565b92505060a06200073389828a01620005c4565b9150509295509295509295565b634e487b7160e01b600052602260045260246000fd5b6002810460018216806200076b57607f821691505b60208210810362000780576200078062000740565b50919050565b60006200045c620007948381565b90565b620007a28362000786565b81546008840282811b60001990911b908116901990911617825550505050565b6000620007d181848462000797565b505050565b818110156200043157620007ec600082620007c2565b600101620007d6565b601f821115620007d1576000818152602090206020601f850104810160208510156200081e5750805b620008326020601f860104830182620007d6565b5050505050565b81516001600160401b0381111562000855576200085562000462565b62000861825462000756565b6200086e828285620007f5565b506020601f821160018114620008a657600083156200088d5750848201515b600019600885021c198116600285021785555062000832565b600084815260208120601f198516915b82811015620008d85787850151825560209485019460019092019101620008b6565b5084821015620008f65783870151600019601f87166008021c191681555b50505050600202600101905550565b60328152602081017f5061796d656e7453706c69747465723a2070617965657320616e6420736861728152710cae640d8cadccee8d040dad2e6dac2e8c6d60731b602082015290505b60400190565b602080825281016200045c8162000905565b601a8152602081017f5061796d656e7453706c69747465723a206e6f20706179656573000000000000815290505b60200190565b602080825281016200045c8162000966565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201620009ed57620009ed620009c2565b5060010190565b602c8152602081017f5061796d656e7453706c69747465723a206163636f756e74206973207468652081526b7a65726f206164647265737360a01b602082015290506200094e565b602080825281016200045c81620009f4565b601d8152602081017f5061796d656e7453706c69747465723a207368617265732061726520300000008152905062000994565b602080825281016200045c8162000a4e565b602b8152602081017f5061796d656e7453706c69747465723a206163636f756e7420616c726561647981526a206861732073686172657360a81b602082015290506200094e565b602080825281016200045c8162000a93565b808201808211156200045c576200045c620009c2565b62000b0d81620004ec565b82525050565b8062000b0d565b6040810162000b2a828562000b02565b62000b39602083018462000b13565b9392505050565b61428b8062000b506000396000f3fe6080604052600436106103a65760003560e01c80636a627842116101e7578063a556f60f1161010d578063d5abeb01116100a0578063e41a13171161006f578063e41a131714610c53578063e6a8efb914610c69578063e985e9c514610c89578063f2fde38b14610cd257600080fd5b8063d5abeb0114610bdb578063d79779b214610bf1578063e33b7de314610c27578063e3d33fc914610c3c57600080fd5b8063c45ac050116100dc578063c45ac05014610b45578063c87b56dd14610b65578063ce7c2ac214610b85578063d547741f14610bbb57600080fd5b8063a556f60f14610a91578063b4b5b48f14610ab1578063b88d4fde14610b03578063c451674114610b2357600080fd5b80638da5cb5b11610185578063a217fddf11610154578063a217fddf14610a1c578063a22cb46514610a31578063a3106b9514610a51578063a3f8eace14610a7157600080fd5b80638da5cb5b1461096d57806391d148541461098b57806395d89b41146109d15780639852595c146109e657600080fd5b8063715018a6116101c1578063715018a6146109035780638456cb59146109185780638ada6b0f1461092d5780638b83209b1461094d57600080fd5b80636a627842146108ae5780636c41808a146108ce57806370a08231146108e357600080fd5b80633a98ef39116102cc57806348b750441161026a578063568e0eac11610239578063568e0eac146108395780635c975abb146108595780636352211e146108785780636884d0a61461089857600080fd5b806348b75044146107ac5780634976bddb146107cc5780634b503f0b146107ec5780635681e00b1461080f57600080fd5b806342842e0e116102a657806342842e0e1461071157806344a0c8a11461073157806346c4d346146107515780634780eac11461077f57600080fd5b80633a98ef39146106a15780633f4ba83a146106b6578063406072a9146106cb57600080fd5b806313cf2f4f11610344578063248a9ca311610313578063248a9ca3146106005780632d56ab42146106305780632f2ff15d1461066157806336568abe1461068157600080fd5b806313cf2f4f1461058657806318160ddd146105aa57806319165587146105c057806323b872dd146105e057600080fd5b806306fdde031161038057806306fdde03146104f75780630754617214610519578063081812fc14610546578063095ea7b31461056657600080fd5b8063017043a51461048a57806301ffc9a7146104a1578063059513a6146104d757600080fd5b36610485577f6ef95f06320e7a25a04a175ca677b7052bdd97131872c2192525a629f51be77033346040516103dc929190612f35565b60405180910390a160405180604001604052806103f842610cf2565b67ffffffffffffffff16815260200161041034610d29565b6001600160c01b031681525060df60c860de5461042d9190612f66565b60c8811061043d5761043d612f7e565b82516020909301516001600160c01b0316600160401b0267ffffffffffffffff9093169290921791015560de80546001919060009061047d908490612faa565b925050819055005b600080fd5b34801561049657600080fd5b5061049f610d52565b005b3480156104ad57600080fd5b506104c16104bc366004612fdf565b610d66565b6040516104ce9190613008565b60405180910390f35b3480156104e357600080fd5b5061049f6104f2366004613027565b610d77565b34801561050357600080fd5b5061050c610da9565b6040516104ce919061309e565b34801561052557600080fd5b5060da54610539906001600160a01b031681565b6040516104ce91906130af565b34801561055257600080fd5b50610539610561366004613027565b610e3b565b34801561057257600080fd5b5061049f6105813660046130d1565b610e62565b34801561059257600080fd5b5061059d6103395481565b6040516104ce919061310e565b3480156105b657600080fd5b5061059d60d85481565b3480156105cc57600080fd5b5061049f6105db36600461311c565b610f20565b3480156105ec57600080fd5b5061049f6105fb36600461313d565b610ffe565b34801561060c57600080fd5b5061059d61061b366004613027565b600090815260d6602052604090206001015490565b34801561063c57600080fd5b5061065061064b366004613027565b61102f565b6040516104ce9594939291906131d6565b34801561066d57600080fd5b5061049f61067c366004613226565b6110ac565b34801561068d57600080fd5b5061049f61069c366004613226565b6110d1565b3480156106ad57600080fd5b5060cf5461059d565b3480156106c257600080fd5b5061049f611103565b3480156106d757600080fd5b5061059d6106e6366004613278565b6001600160a01b03918216600090815260d56020908152604080832093909416825291909152205490565b34801561071d57600080fd5b5061049f61072c36600461313d565b611119565b34801561073d57600080fd5b5061049f61074c366004613027565b611134565b34801561075d57600080fd5b5061077161076c366004613027565b611146565b6040516104ce9291906132b9565b34801561078b57600080fd5b5060dc5461079f906001600160a01b031681565b6040516104ce91906132e8565b3480156107b857600080fd5b5061049f6107c7366004613278565b611179565b3480156107d857600080fd5b5061059d6107e7366004613027565b611287565b3480156107f857600080fd5b5061080161129f565b6040516104ce9291906132f6565b34801561081b57600080fd5b506108246112ca565b6040516104ce999897969594939291906133e6565b34801561084557600080fd5b5061059d610854366004613027565b611465565b34801561086557600080fd5b5060d754600160a01b900460ff166104c1565b34801561088457600080fd5b50610539610893366004613027565b611475565b3480156108a457600080fd5b5061059d60065481565b3480156108ba57600080fd5b5061049f6108c936600461311c565b6114aa565b3480156108da57600080fd5b5061059d60c881565b3480156108ef57600080fd5b5061059d6108fe36600461311c565b6115a1565b34801561090f57600080fd5b5061049f6115e5565b34801561092457600080fd5b5061049f6115f9565b34801561093957600080fd5b5060db5461079f906001600160a01b031681565b34801561095957600080fd5b50610539610968366004613027565b61160c565b34801561097957600080fd5b5060d7546001600160a01b0316610539565b34801561099757600080fd5b506104c16109a6366004613226565b600091825260d6602090815260408084206001600160a01b0393909316845291905290205460ff1690565b3480156109dd57600080fd5b5061050c61163c565b3480156109f257600080fd5b5061059d610a0136600461311c565b6001600160a01b0316600090815260d2602052604090205490565b348015610a2857600080fd5b5061059d600081565b348015610a3d57600080fd5b5061049f610a4c36600461348b565b61164b565b348015610a5d57600080fd5b5061049f610a6c36600461311c565b611696565b348015610a7d57600080fd5b5061059d610a8c36600461311c565b6116c4565b348015610a9d57600080fd5b5061049f610aac36600461311c565b61170c565b348015610abd57600080fd5b50610af3610acc366004613027565b60dd602052600090815260409020805460c982015460ca83015460cb909301549192909184565b6040516104ce94939291906134be565b348015610b0f57600080fd5b5061049f610b1e3660046135ef565b61173a565b348015610b2f57600080fd5b50610b38611772565b6040516104ce919061366e565b348015610b5157600080fd5b5061059d610b60366004613278565b6118c3565b348015610b7157600080fd5b5061050c610b80366004613027565b61198a565b348015610b9157600080fd5b5061059d610ba036600461311c565b6001600160a01b0316600090815260d1602052604090205490565b348015610bc757600080fd5b5061049f610bd6366004613226565b611a00565b348015610be757600080fd5b5061059d60d95481565b348015610bfd57600080fd5b5061059d610c0c36600461367f565b6001600160a01b0316600090815260d4602052604090205490565b348015610c3357600080fd5b5060d05461059d565b348015610c4857600080fd5b5061059d6102705481565b348015610c5f57600080fd5b5061059d60de5481565b348015610c7557600080fd5b50610771610c84366004613027565b611a25565b348015610c9557600080fd5b506104c1610ca43660046136a0565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b348015610cde57600080fd5b5061049f610ced36600461311c565b611a35565b600067ffffffffffffffff821115610d255760405162461bcd60e51b8152600401610d1c90613705565b60405180910390fd5b5090565b60006001600160c01b03821115610d255760405162461bcd60e51b8152600401610d1c90613757565b6000610d5d81611a6c565b5060d85460d955565b6000610d7182611a76565b92915050565b610d7f611a9b565b60005b81811015610da557610d93336114aa565b80610d9d81613767565b915050610d82565b5050565b606060008054610db890613796565b80601f0160208091040260200160405190810160405280929190818152602001828054610de490613796565b8015610e315780601f10610e0657610100808354040283529160200191610e31565b820191906000526020600020905b815481529060010190602001808311610e1457829003601f168201915b5050505050905090565b6000610e4682611ac5565b506000908152600460205260409020546001600160a01b031690565b6000610e6d82611475565b9050806001600160a01b0316836001600160a01b031603610ea05760405162461bcd60e51b8152600401610d1c906137fe565b336001600160a01b0382161480610ebc5750610ebc8133610ca4565b610ed85760405162461bcd60e51b8152600401610d1c90613866565b42600760c8600654610eea9190612f66565b60c88110610efa57610efa612f7e565b015560068054906000610f0c83613767565b9190505550610f1b8383611af9565b505050565b6001600160a01b038116600090815260d16020526040902054610f555760405162461bcd60e51b8152600401610d1c906138b7565b6000610f60826116c4565b905080600003610f825760405162461bcd60e51b8152600401610d1c9061390d565b8060d06000828254610f949190612faa565b90915550506001600160a01b038216600090815260d260205260409020805482019055610fc18282611b67565b7fdf20fd1e76bc69d672e4814fafb2c449bba3a5369d8359adf9e05e6fde87b0568282604051610ff292919061391d565b60405180910390a15050565b6110083382611bfa565b6110245760405162461bcd60e51b8152600401610d1c90613973565b610f1b838383611c78565b6000611039612eb6565b600083815260dd60205260408120805460c982015460ca830154849384939260019091019161106a6108fe8b611475565b6040805161190081019182905290859060c89082845b8154815260200190600101908083116110805750989f939e50959c50939a509198509650505050505050565b600082815260d660205260409020600101546110c781611a6c565b610f1b8383611db5565b6001600160a01b03811633146110f95760405162461bcd60e51b8152600401610d1c906139db565b610da58282611e57565b600061110e81611a6c565b611116611eda565b50565b610f1b8383836040518060200160405280600081525061173a565b600061113f81611a6c565b5061033955565b6101a88160c8811061115757600080fd5b015467ffffffffffffffff81169150600160401b90046001600160c01b031682565b6001600160a01b038116600090815260d160205260409020546111ae5760405162461bcd60e51b8152600401610d1c906138b7565b60006111ba83836118c3565b9050806000036111dc5760405162461bcd60e51b8152600401610d1c9061390d565b6001600160a01b038316600090815260d4602052604081208054839290611204908490612faa565b90915550506001600160a01b03808416600090815260d56020908152604080832093861683529290522080548201905561123f838383611f29565b826001600160a01b03167f3be5b7a71e84ed12875d241991c70855ac5817d847039e17a9d895c1ceb0f18a838360405161127a929190612f35565b60405180910390a2505050565b6102718160c8811061129857600080fd5b0154905081565b6060806112b2635681e00b60e01b611f94565b6112c26316ab55a160e11b611f94565b915091509091565b60006112d4612eb6565b60006112de612eb6565b60006112e8612ed5565b6112f0612ed5565b60006060600654600761027054610271611308612101565b60df6101a860d854611318611772565b6040805161190081019182905290899060c89082845b81548152602001906001019080831161132e57505060408051611900810191829052949c508a935060c89250905082845b81548152602001906001019080831161135f57505060408051611900810190915293995087925060c8915060009050835b828210156113db57604080518082019091528483015467ffffffffffffffff81168252600160401b90046001600160c01b031660208083019190915290825260019092019101611390565b505060408051611900810190915292965085915060c890506000835b8282101561144257604080518082019091528483015467ffffffffffffffff81168252600160401b90046001600160c01b0316602080830191909152908252600190920191016113f7565b505050509250985098509850985098509850985098509850909192939495969798565b60078160c8811061129857600080fd5b6000818152600260205260408120546001600160a01b031680610d715760405162461bcd60e51b8152600401610d1c90613a1d565b6114b2612213565b60d95460d854106114d65760405163d05cb60960e01b815260040160405180910390fd5b60da546001600160a01b0316336001600160a01b03161480611502575060d7546001600160a01b031633145b61151f5760405163ea8e4eb560e01b815260040160405180910390fd5b60d88054908190600061153183613767565b9091555050600081815260dd602052604090204260c990910155611556600143613a2d565b404342338460405160200161156f959493929190613a68565b60408051601f198184030181529181528151602092830120600084815260dd909352912060ca0155610da5828261223d565b60006001600160a01b0382166115c95760405162461bcd60e51b8152600401610d1c90613af6565b506001600160a01b031660009081526003602052604090205490565b6115ed611a9b565b6115f76000612257565b565b600061160481611a6c565b6111166122a9565b600060d3828154811061162157611621612f7e565b6000918252602090912001546001600160a01b031692915050565b606060018054610db890613796565b801561168b5742600760c86006546116639190612f66565b60c8811061167357611673612f7e565b01556006805490600061168583613767565b91905055505b610da53383836122ec565b60006116a181611a6c565b5060da80546001600160a01b0319166001600160a01b0392909216919091179055565b6000806116d060d05490565b6116da9047612faa565b90506117058382611700866001600160a01b0316600090815260d2602052604090205490565b61238e565b9392505050565b600061171781611a6c565b5060db80546001600160a01b0319166001600160a01b0392909216919091179055565b6117443383611bfa565b6117605760405162461bcd60e51b8152600401610d1c90613973565b61176c848484846123cc565b50505050565b6060600060d85467ffffffffffffffff811115611791576117916134fc565b6040519080825280602002602001820160405280156117c457816020015b60608152602001906001900390816117af5790505b509050600060d85467ffffffffffffffff8111156117e4576117e46134fc565b60405190808252806020026020018201604052801561180d578160200160208202803683370190505b5090506000805b60d8548110156118b057600061182982611475565b905061183584826123ff565b151560000361189d5761184781612464565b85848151811061185957611859612f7e565b60200260200101819052508084838151811061187757611877612f7e565b6001600160a01b03909216602092830291909101909101528261189981613767565b9350505b50806118a881613767565b915050611814565b506118bb838261247a565b935050505090565b6001600160a01b038216600081815260d460205260408082205490516370a0823160e01b8152919283926370a08231906119019030906004016130af565b602060405180830381865afa15801561191e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119429190613b11565b61194c9190612faa565b6001600160a01b03808616600090815260d56020908152604080832093881683529290522054909150611982908490839061238e565b949350505050565b60db5460405163c87b56dd60e01b81526060916001600160a01b03169063c87b56dd906119bb90859060040161310e565b600060405180830381865afa1580156119d8573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610d719190810190613b8a565b600082815260d66020526040902060010154611a1b81611a6c565b610f1b8383611e57565b60df8160c8811061115757600080fd5b611a3d611a9b565b6001600160a01b038116611a635760405162461bcd60e51b8152600401610d1c90613c06565b61111681612257565b611116813361252a565b60006001600160e01b03198216637965db0b60e01b1480610d715750610d718261259f565b60d7546001600160a01b031633146115f75760405162461bcd60e51b8152600401610d1c90613c46565b6000818152600260205260409020546001600160a01b03166111165760405162461bcd60e51b8152600401610d1c90613a1d565b600081815260046020526040902080546001600160a01b0319166001600160a01b0384169081179091558190611b2e82611475565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b80471015611b875760405162461bcd60e51b8152600401610d1c90613c88565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114611bd4576040519150601f19603f3d011682016040523d82523d6000602084013e611bd9565b606091505b5050905080610f1b5760405162461bcd60e51b8152600401610d1c90613cf0565b600080611c0683611475565b9050806001600160a01b0316846001600160a01b03161480611c4d57506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b806119825750836001600160a01b0316611c6684610e3b565b6001600160a01b031614949350505050565b826001600160a01b0316611c8b82611475565b6001600160a01b031614611cb15760405162461bcd60e51b8152600401610d1c90613d40565b6001600160a01b038216611cd75760405162461bcd60e51b8152600401610d1c90613d8f565b611ce483838360016125ef565b826001600160a01b0316611cf782611475565b6001600160a01b031614611d1d5760405162461bcd60e51b8152600401610d1c90613d40565b600081815260046020908152604080832080546001600160a01b03199081169091556001600160a01b0387811680865260038552838620805460001901905590871680865283862080546001019055868652600290945282852080549092168417909155905184937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4610f1b8383836001612677565b600082815260d6602090815260408083206001600160a01b038516845290915290205460ff16610da557600082815260d6602090815260408083206001600160a01b03851684529091529020805460ff19166001179055611e133390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b600082815260d6602090815260408083206001600160a01b038516845290915290205460ff1615610da557600082815260d6602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b611ee26128cd565b60d7805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b604051611f1f91906130af565b60405180910390a1565b610f1b8363a9059cbb60e01b8484604051602401611f48929190612f35565b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166001600160e01b0319909316929092179091526128f6565b60408051600a80825281830190925260609160009190602082018180368337019050509050600360fc1b81600081518110611fd157611fd1612f7e565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061200057612000612f7e565b60200101906001600160f81b031916908160001a90535060005b60048110156120fa5761204b601085836004811061203a5761203a612f7e565b6120469291901a613d9f565b612988565b82612057836002613dbe565b612062906002612faa565b8151811061207257612072612f7e565b60200101906001600160f81b031916908160001a9053506120ac60108583600481106120a0576120a0612f7e565b6120469291901a613dd5565b826120b8836002613dbe565b6120c3906003612faa565b815181106120d3576120d3612f7e565b60200101906001600160f81b031916908160001a9053506120f381613767565b905061201a565b5092915050565b60008060009050600060d85467ffffffffffffffff811115612125576121256134fc565b60405190808252806020026020018201604052801561214e578160200160208202803683370190505b50905060005b60d85481101561220b57600061216982611475565b905061217583826123ff565b15156000036121c3578361218881613767565b9450508083838151811061219e5761219e612f7e565b60200260200101906001600160a01b031690816001600160a01b0316815250506121f8565b60008383815181106121d7576121d7612f7e565b60200260200101906001600160a01b031690816001600160a01b0316815250505b508061220381613767565b915050612154565b509092915050565b60d754600160a01b900460ff16156115f75760405162461bcd60e51b8152600401610d1c90613e14565b610da58282604051806020016040528060008152506129dd565b60d780546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6122b1612213565b60d7805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258611f123390565b816001600160a01b0316836001600160a01b03160361231d5760405162461bcd60e51b8152600401610d1c90613e56565b6001600160a01b0383811660008181526005602090815260408083209487168084529490915290819020805460ff1916851515179055517f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3190612381908590613008565b60405180910390a3505050565b60cf546001600160a01b038416600090815260d16020526040812054909183916123b89086613dbe565b6123c29190613e66565b6119829190613a2d565b6123d7848484611c78565b6123e384848484612a10565b61176c5760405162461bcd60e51b8152600401610d1c90613ec4565b6000805b835181101561245a57826001600160a01b031684828151811061242857612428612f7e565b60200260200101516001600160a01b031603612448576001915050610d71565b8061245281613767565b915050612403565b5060009392505050565b6060610d716001600160a01b0383166014612b11565b606060008267ffffffffffffffff811115612497576124976134fc565b6040519080825280602002602001820160405280156124ca57816020015b60608152602001906001900390816124b55790505b50905060005b83811015612522578481815181106124ea576124ea612f7e565b602002602001015182828151811061250457612504612f7e565b6020026020010181905250808061251a90613767565b9150506124d0565b509392505050565b600082815260d6602090815260408083206001600160a01b038516845290915290205460ff16610da55761255d81612464565b612568836020612b11565b604051602001612579929190613ef6565b60408051601f198184030181529082905262461bcd60e51b8252610d1c9160040161309e565b60006001600160e01b031982166380ac58cd60e01b14806125d057506001600160e01b03198216635b5e139f60e01b145b80610d7157506301ffc9a760e01b6001600160e01b0319831614610d71565b600181111561176c576001600160a01b03841615612635576001600160a01b0384166000908152600360205260408120805483929061262f908490613a2d565b90915550505b6001600160a01b0383161561176c576001600160a01b0383166000908152600360205260408120805483929061266c908490612faa565b909155505050505050565b6001600160a01b0384161561176c574261027160c86102705461269a9190612f66565b60c881106126aa576126aa612f7e565b0155600082815260dd6020526040902080544291600101906126ce9060c890612f66565b60c881106126de576126de612f7e565b0155600082815260dd602052604081208054916126fa83613767565b9091555050610270805490600061271083613767565b90915550506040805180820182526101a75467ffffffffffffffff81168252600160401b90046001600160c01b0316602080830182905260dc546001600160a01b0316600081815260d49092528482205494516370a0823160e01b8152939492939192916370a08231906127889030906004016130af565b602060405180830381865afa1580156127a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127c99190613b11565b6127d39190612faa565b9050818111156128c4576127e681610d29565b6001600160c01b03166020840152604080518082019091528061280842610cf2565b67ffffffffffffffff1681526020016128296128248585613a2d565b610d29565b6001600160c01b0316905283516101a8906128509060c89067ffffffffffffffff16612f66565b60c8811061286057612860612f7e565b82516020909301516001600160c01b0316600160401b0267ffffffffffffffff9093169290921791015582518361289682613f58565b67ffffffffffffffff908116909152845160208601516001600160c01b0316600160401b029116176101a755505b50505050505050565b60d754600160a01b900460ff166115f75760405162461bcd60e51b8152600401610d1c90613fae565b600061294b826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612c8a9092919063ffffffff16565b905080516000148061296c57508080602001905181019061296c9190613fc9565b610f1b5760405162461bcd60e51b8152600401610d1c9061402f565b600060098260ff16116129a9576129a082603061403f565b60f81b92915050565b8160ff16600a111580156129c15750600f8260ff1611155b1561048557600a6129d383606161403f565b6129a0919061405c565b6129e78383612c99565b6129f46000848484612a10565b610f1b5760405162461bcd60e51b8152600401610d1c90613ec4565b60006001600160a01b0384163b15612b0657604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290612a54903390899088908890600401614079565b6020604051808303816000875af1925050508015612a8f575060408051601f3d908101601f19168201909252612a8c918101906140be565b60015b612aec573d808015612abd576040519150601f19603f3d011682016040523d82523d6000602084013e612ac2565b606091505b508051600003612ae45760405162461bcd60e51b8152600401610d1c90613ec4565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050611982565b506001949350505050565b60606000612b20836002613dbe565b612b2b906002612faa565b67ffffffffffffffff811115612b4357612b436134fc565b6040519080825280601f01601f191660200182016040528015612b6d576020820181803683370190505b509050600360fc1b81600081518110612b8857612b88612f7e565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110612bb757612bb7612f7e565b60200101906001600160f81b031916908160001a9053506000612bdb846002613dbe565b612be6906001612faa565b90505b6001811115612c6b577f303132333435363738396162636465660000000000000000000000000000000085600f1660108110612c2757612c27612f7e565b1a60f81b828281518110612c3d57612c3d612f7e565b60200101906001600160f81b031916908160001a90535060049490941c93612c64816140df565b9050612be9565b5083156117055760405162461bcd60e51b8152600401610d1c90614126565b60606119828484600085612dac565b6001600160a01b038216612cbf5760405162461bcd60e51b8152600401610d1c90614166565b6000818152600260205260409020546001600160a01b031615612cf45760405162461bcd60e51b8152600401610d1c906141a8565b612d026000838360016125ef565b6000818152600260205260409020546001600160a01b031615612d375760405162461bcd60e51b8152600401610d1c906141a8565b6001600160a01b038216600081815260036020908152604080832080546001019055848352600290915280822080546001600160a01b0319168417905551839291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a4610da5600083836001612677565b606082471015612dce5760405162461bcd60e51b8152600401610d1c906141f9565b600080866001600160a01b03168587604051612dea9190614209565b60006040518083038185875af1925050503d8060008114612e27576040519150601f19603f3d011682016040523d82523d6000602084013e612e2c565b606091505b5091509150612e3d87838387612e48565b979650505050505050565b60608315612e87578251600003612e80576001600160a01b0385163b612e805760405162461bcd60e51b8152600401610d1c90614245565b5081611982565b6119828383815115612e9c5781518083602001fd5b8060405162461bcd60e51b8152600401610d1c919061309e565b60405180611900016040528060c8906020820280368337509192915050565b60405180611900016040528060c8905b6040805180820190915260008082526020820152815260200190600190039081612ee55790505090565b60006001600160a01b038216610d71565b612f2981612f0f565b82525050565b80612f29565b60408101612f438285612f20565b6117056020830184612f2f565b634e487b7160e01b600052601260045260246000fd5b815b9150600082612f7957612f79612f50565b500690565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b80820180821115610d7157610d71612f94565b6001600160e01b031981165b811461111657600080fd5b8035610d7181612fbd565b600060208284031215612ff457612ff4600080fd5b60006119828484612fd4565b801515612f29565b60208101610d718284613000565b80612fc9565b8035610d7181613016565b60006020828403121561303c5761303c600080fd5b6000611982848461301c565b60005b8381101561306357818101518382015260200161304b565b50506000910152565b6000613076825190565b80845260208401935061308d818560208601613048565b601f01601f19169290920192915050565b60208082528101611705818461306c565b60208101610d718284612f20565b612fc981612f0f565b8035610d71816130bd565b600080604083850312156130e7576130e7600080fd5b60006130f385856130c6565b92505060206131048582860161301c565b9150509250929050565b60208101610d718284612f2f565b60006020828403121561313157613131600080fd5b600061198284846130c6565b60008060006060848603121561315557613155600080fd5b600061316186866130c6565b9350506020613172868287016130c6565b92505060406131838682870161301c565b9150509250925092565b6131978282612f2f565b5060200190565b60200190565b60c88160005b828110156131cf5781516131be868261318d565b9550506020820191506001016131aa565b5050505050565b61198081016131e58288612f2f565b6131f260208301876131a4565b613200611920830186612f2f565b61320e611940830185612f2f565b61321c611960830184612f2f565b9695505050505050565b6000806040838503121561323c5761323c600080fd5b6000613248858561301c565b9250506020613104858286016130c6565b6000610d7182612f0f565b612fc981613259565b8035610d7181613264565b6000806040838503121561328e5761328e600080fd5b6000613248858561326d565b67ffffffffffffffff8116612f29565b6001600160c01b038116612f29565b604081016132c7828561329a565b61170560208301846132aa565b6000610d7182613259565b612f29816132d4565b60208101610d7182846132df565b60408082528101613307818561306c565b90508181036020830152611982818461306c565b8051613327838261329a565b506020810151610f1b60208401826132aa565b613344828261331b565b5060400190565b60c88160005b828110156131cf578151613365868261333a565b955050602082019150600101613351565b6000611705838361306c565b600061338c825190565b808452602084019350836020820285016133a68560200190565b60005b848110156133da57838303885281516133c28482613376565b935050602082016020989098019791506001016133a9565b50909695505050505050565b6196a081016133f5828c612f2f565b613402602083018b6131a4565b61341061192083018a612f2f565b61341e6119408301896131a4565b61342c613240830188612f2f565b61343a61326083018761334b565b61344861646083018661334b565b613456619660830185612f2f565b8181036196808301526134698184613382565b9b9a5050505050505050505050565b801515612fc9565b8035610d7181613478565b600080604083850312156134a1576134a1600080fd5b60006134ad85856130c6565b925050602061310485828601613480565b608081016134cc8287612f2f565b6134d96020830186612f2f565b6134e66040830185612f2f565b6134f36060830184612f2f565b95945050505050565b634e487b7160e01b600052604160045260246000fd5b601f19601f830116810181811067ffffffffffffffff82111715613538576135386134fc565b6040525050565b600061354a60405190565b90506135568282613512565b919050565b600067ffffffffffffffff821115613575576135756134fc565b601f19601f83011660200192915050565b82818337506000910152565b60006135a56135a08461355b565b61353f565b9050828152602081018484840111156135c0576135c0600080fd5b612522848285613586565b600082601f8301126135df576135df600080fd5b8135611982848260208601613592565b6000806000806080858703121561360857613608600080fd5b600061361487876130c6565b9450506020613625878288016130c6565b93505060406136368782880161301c565b925050606085013567ffffffffffffffff81111561365657613656600080fd5b613662878288016135cb565b91505092959194509250565b602080825281016117058184613382565b60006020828403121561369457613694600080fd5b6000611982848461326d565b600080604083850312156136b6576136b6600080fd5b600061324885856130c6565b60268152602081017f53616665436173743a2076616c756520646f65736e27742066697420696e203681526534206269747360d01b602082015290505b60400190565b60208082528101610d71816136c2565b60278152602081017f53616665436173743a2076616c756520646f65736e27742066697420696e20318152663932206269747360c81b602082015290506136ff565b60208082528101610d7181613715565b60006001820161377957613779612f94565b5060010190565b634e487b7160e01b600052602260045260246000fd5b6002810460018216806137aa57607f821691505b6020821081036137bc576137bc613780565b50919050565b60218152602081017f4552433732313a20617070726f76616c20746f2063757272656e74206f776e658152603960f91b602082015290506136ff565b60208082528101610d71816137c2565b603d8152602081017f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f81527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c000000602082015290506136ff565b60208082528101610d718161380e565b60268152602081017f5061796d656e7453706c69747465723a206163636f756e7420686173206e6f2081526573686172657360d01b602082015290506136ff565b60208082528101610d7181613876565b602b8152602081017f5061796d656e7453706c69747465723a206163636f756e74206973206e6f742081526a191d59481c185e5b595b9d60aa1b602082015290506136ff565b60208082528101610d71816138c7565b60408101612f4382856132df565b602d8152602081017f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6581526c1c881bdc88185c1c1c9bdd9959609a1b602082015290506136ff565b60208082528101610d718161392b565b602f8152602081017f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636581527f20726f6c657320666f722073656c660000000000000000000000000000000000602082015290506136ff565b60208082528101610d7181613983565b60188152602081017f4552433732313a20696e76616c696420746f6b656e20494400000000000000008152905061319e565b60208082528101610d71816139eb565b81810381811115610d7157610d71612f94565b6000610d718260601b90565b6000610d7182613a40565b612f29613a6382612f0f565b613a4c565b613a728187612f2f565b602001613a7f8186612f2f565b602001613a8c8185612f2f565b602001613a998184613a57565b601401613aa68183612f2f565b60200195945050505050565b60298152602081017f4552433732313a2061646472657373207a65726f206973206e6f7420612076618152683634b21037bbb732b960b91b602082015290506136ff565b60208082528101610d7181613ab2565b8051610d7181613016565b600060208284031215613b2657613b26600080fd5b60006119828484613b06565b6000613b406135a08461355b565b905082815260208101848484011115613b5b57613b5b600080fd5b612522848285613048565b600082601f830112613b7a57613b7a600080fd5b8151611982848260208601613b32565b600060208284031215613b9f57613b9f600080fd5b815167ffffffffffffffff811115613bb957613bb9600080fd5b61198284828501613b66565b60268152602081017f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206181526564647265737360d01b602082015290506136ff565b60208082528101610d7181613bc5565b60208082527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572910190815261319e565b60208082528101610d7181613c16565b601d8152602081017f416464726573733a20696e73756666696369656e742062616c616e63650000008152905061319e565b60208082528101610d7181613c56565b603a8152602081017f416464726573733a20756e61626c6520746f2073656e642076616c75652c207281527f6563697069656e74206d61792068617665207265766572746564000000000000602082015290506136ff565b60208082528101610d7181613c98565b60258152602081017f4552433732313a207472616e736665722066726f6d20696e636f72726563742081526437bbb732b960d91b602082015290506136ff565b60208082528101610d7181613d00565b60248152602081017f4552433732313a207472616e7366657220746f20746865207a65726f206164648152637265737360e01b602082015290506136ff565b60208082528101610d7181613d50565b60ff9081169082165b9150600082613db957613db9612f50565b500490565b8181028115828204841417610d7157610d71612f94565b60ff908116908216612f68565b60108152602081017f5061757361626c653a20706175736564000000000000000000000000000000008152905061319e565b60208082528101610d7181613de2565b60198152602081017f4552433732313a20617070726f766520746f2063616c6c6572000000000000008152905061319e565b60208082528101610d7181613e24565b81613da8565b60328152602081017f4552433732313a207472616e7366657220746f206e6f6e20455243373231526581527f63656976657220696d706c656d656e7465720000000000000000000000000000602082015290506136ff565b60208082528101610d7181613e6c565b6000613ede825190565b613eec818560208601613048565b9290920192915050565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152601701613f268184613ed4565b7f206973206d697373696e6720726f6c6520000000000000000000000000000000815260110190506117058183613ed4565b67ffffffffffffffff16600067fffffffffffffffe19820161377957613779612f94565b60148152602081017f5061757361626c653a206e6f74207061757365640000000000000000000000008152905061319e565b60208082528101610d7181613f7c565b8051610d7181613478565b600060208284031215613fde57613fde600080fd5b60006119828484613fbe565b602a8152602081017f5361666545524332303a204552433230206f7065726174696f6e20646964206e8152691bdd081cdd58d8d9595960b21b602082015290506136ff565b60208082528101610d7181613fea565b60ff918216919081169082820190811115610d7157610d71612f94565b60ff918216919081169082820390811115610d7157610d71612f94565b608081016140878287612f20565b6140946020830186612f20565b6140a16040830185612f2f565b818103606083015261321c818461306c565b8051610d7181612fbd565b6000602082840312156140d3576140d3600080fd5b600061198284846140b3565b6000816140ee576140ee612f94565b506000190190565b60208082527f537472696e67733a20686578206c656e67746820696e73756666696369656e74910190815261319e565b60208082528101610d71816140f6565b60208082527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373910190815261319e565b60208082528101610d7181614136565b601c8152602081017f4552433732313a20746f6b656e20616c7265616479206d696e746564000000008152905061319e565b60208082528101610d7181614176565b60268152602081017f416464726573733a20696e73756666696369656e742062616c616e636520666f8152651c8818d85b1b60d21b602082015290506136ff565b60208082528101610d71816141b8565b610d718183613ed4565b601d8152602081017f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000008152905061319e565b60208082528101610d718161421356fea26469706673582212208bfae487f4e8dc284f8c984b29d9dc4de22dd180a9275a166183daf1ec1ee0ce64736f6c6343000811003300000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000001c0000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000009861f4b3e833b9e8618f6c3af3b295d1b2177303000000000000000000000000000000000000000000000000000000000000012c000000000000000000000000000000000000000000000000000000000000000300000000000000000000000065c7432e6662a96f4e999603991d5e929e57f60a000000000000000000000000134309c4cf57bfa43ef66bf20bd0eeccdeb2d80c0000000000000000000000001b9f1b5a6032af69f71eee1a25fa597fac1ee5a3000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000002d50000000000000000000000000000000000000000000000000000000000000096000000000000000000000000000000000000000000000000000000000000007d000000000000000000000000000000000000000000000000000000000000000100000000000000000000000020ec68ba5dc8af5380bdb37465b3f9bde75f9635
Deployed Bytecode
0x6080604052600436106103a65760003560e01c80636a627842116101e7578063a556f60f1161010d578063d5abeb01116100a0578063e41a13171161006f578063e41a131714610c53578063e6a8efb914610c69578063e985e9c514610c89578063f2fde38b14610cd257600080fd5b8063d5abeb0114610bdb578063d79779b214610bf1578063e33b7de314610c27578063e3d33fc914610c3c57600080fd5b8063c45ac050116100dc578063c45ac05014610b45578063c87b56dd14610b65578063ce7c2ac214610b85578063d547741f14610bbb57600080fd5b8063a556f60f14610a91578063b4b5b48f14610ab1578063b88d4fde14610b03578063c451674114610b2357600080fd5b80638da5cb5b11610185578063a217fddf11610154578063a217fddf14610a1c578063a22cb46514610a31578063a3106b9514610a51578063a3f8eace14610a7157600080fd5b80638da5cb5b1461096d57806391d148541461098b57806395d89b41146109d15780639852595c146109e657600080fd5b8063715018a6116101c1578063715018a6146109035780638456cb59146109185780638ada6b0f1461092d5780638b83209b1461094d57600080fd5b80636a627842146108ae5780636c41808a146108ce57806370a08231146108e357600080fd5b80633a98ef39116102cc57806348b750441161026a578063568e0eac11610239578063568e0eac146108395780635c975abb146108595780636352211e146108785780636884d0a61461089857600080fd5b806348b75044146107ac5780634976bddb146107cc5780634b503f0b146107ec5780635681e00b1461080f57600080fd5b806342842e0e116102a657806342842e0e1461071157806344a0c8a11461073157806346c4d346146107515780634780eac11461077f57600080fd5b80633a98ef39146106a15780633f4ba83a146106b6578063406072a9146106cb57600080fd5b806313cf2f4f11610344578063248a9ca311610313578063248a9ca3146106005780632d56ab42146106305780632f2ff15d1461066157806336568abe1461068157600080fd5b806313cf2f4f1461058657806318160ddd146105aa57806319165587146105c057806323b872dd146105e057600080fd5b806306fdde031161038057806306fdde03146104f75780630754617214610519578063081812fc14610546578063095ea7b31461056657600080fd5b8063017043a51461048a57806301ffc9a7146104a1578063059513a6146104d757600080fd5b36610485577f6ef95f06320e7a25a04a175ca677b7052bdd97131872c2192525a629f51be77033346040516103dc929190612f35565b60405180910390a160405180604001604052806103f842610cf2565b67ffffffffffffffff16815260200161041034610d29565b6001600160c01b031681525060df60c860de5461042d9190612f66565b60c8811061043d5761043d612f7e565b82516020909301516001600160c01b0316600160401b0267ffffffffffffffff9093169290921791015560de80546001919060009061047d908490612faa565b925050819055005b600080fd5b34801561049657600080fd5b5061049f610d52565b005b3480156104ad57600080fd5b506104c16104bc366004612fdf565b610d66565b6040516104ce9190613008565b60405180910390f35b3480156104e357600080fd5b5061049f6104f2366004613027565b610d77565b34801561050357600080fd5b5061050c610da9565b6040516104ce919061309e565b34801561052557600080fd5b5060da54610539906001600160a01b031681565b6040516104ce91906130af565b34801561055257600080fd5b50610539610561366004613027565b610e3b565b34801561057257600080fd5b5061049f6105813660046130d1565b610e62565b34801561059257600080fd5b5061059d6103395481565b6040516104ce919061310e565b3480156105b657600080fd5b5061059d60d85481565b3480156105cc57600080fd5b5061049f6105db36600461311c565b610f20565b3480156105ec57600080fd5b5061049f6105fb36600461313d565b610ffe565b34801561060c57600080fd5b5061059d61061b366004613027565b600090815260d6602052604090206001015490565b34801561063c57600080fd5b5061065061064b366004613027565b61102f565b6040516104ce9594939291906131d6565b34801561066d57600080fd5b5061049f61067c366004613226565b6110ac565b34801561068d57600080fd5b5061049f61069c366004613226565b6110d1565b3480156106ad57600080fd5b5060cf5461059d565b3480156106c257600080fd5b5061049f611103565b3480156106d757600080fd5b5061059d6106e6366004613278565b6001600160a01b03918216600090815260d56020908152604080832093909416825291909152205490565b34801561071d57600080fd5b5061049f61072c36600461313d565b611119565b34801561073d57600080fd5b5061049f61074c366004613027565b611134565b34801561075d57600080fd5b5061077161076c366004613027565b611146565b6040516104ce9291906132b9565b34801561078b57600080fd5b5060dc5461079f906001600160a01b031681565b6040516104ce91906132e8565b3480156107b857600080fd5b5061049f6107c7366004613278565b611179565b3480156107d857600080fd5b5061059d6107e7366004613027565b611287565b3480156107f857600080fd5b5061080161129f565b6040516104ce9291906132f6565b34801561081b57600080fd5b506108246112ca565b6040516104ce999897969594939291906133e6565b34801561084557600080fd5b5061059d610854366004613027565b611465565b34801561086557600080fd5b5060d754600160a01b900460ff166104c1565b34801561088457600080fd5b50610539610893366004613027565b611475565b3480156108a457600080fd5b5061059d60065481565b3480156108ba57600080fd5b5061049f6108c936600461311c565b6114aa565b3480156108da57600080fd5b5061059d60c881565b3480156108ef57600080fd5b5061059d6108fe36600461311c565b6115a1565b34801561090f57600080fd5b5061049f6115e5565b34801561092457600080fd5b5061049f6115f9565b34801561093957600080fd5b5060db5461079f906001600160a01b031681565b34801561095957600080fd5b50610539610968366004613027565b61160c565b34801561097957600080fd5b5060d7546001600160a01b0316610539565b34801561099757600080fd5b506104c16109a6366004613226565b600091825260d6602090815260408084206001600160a01b0393909316845291905290205460ff1690565b3480156109dd57600080fd5b5061050c61163c565b3480156109f257600080fd5b5061059d610a0136600461311c565b6001600160a01b0316600090815260d2602052604090205490565b348015610a2857600080fd5b5061059d600081565b348015610a3d57600080fd5b5061049f610a4c36600461348b565b61164b565b348015610a5d57600080fd5b5061049f610a6c36600461311c565b611696565b348015610a7d57600080fd5b5061059d610a8c36600461311c565b6116c4565b348015610a9d57600080fd5b5061049f610aac36600461311c565b61170c565b348015610abd57600080fd5b50610af3610acc366004613027565b60dd602052600090815260409020805460c982015460ca83015460cb909301549192909184565b6040516104ce94939291906134be565b348015610b0f57600080fd5b5061049f610b1e3660046135ef565b61173a565b348015610b2f57600080fd5b50610b38611772565b6040516104ce919061366e565b348015610b5157600080fd5b5061059d610b60366004613278565b6118c3565b348015610b7157600080fd5b5061050c610b80366004613027565b61198a565b348015610b9157600080fd5b5061059d610ba036600461311c565b6001600160a01b0316600090815260d1602052604090205490565b348015610bc757600080fd5b5061049f610bd6366004613226565b611a00565b348015610be757600080fd5b5061059d60d95481565b348015610bfd57600080fd5b5061059d610c0c36600461367f565b6001600160a01b0316600090815260d4602052604090205490565b348015610c3357600080fd5b5060d05461059d565b348015610c4857600080fd5b5061059d6102705481565b348015610c5f57600080fd5b5061059d60de5481565b348015610c7557600080fd5b50610771610c84366004613027565b611a25565b348015610c9557600080fd5b506104c1610ca43660046136a0565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b348015610cde57600080fd5b5061049f610ced36600461311c565b611a35565b600067ffffffffffffffff821115610d255760405162461bcd60e51b8152600401610d1c90613705565b60405180910390fd5b5090565b60006001600160c01b03821115610d255760405162461bcd60e51b8152600401610d1c90613757565b6000610d5d81611a6c565b5060d85460d955565b6000610d7182611a76565b92915050565b610d7f611a9b565b60005b81811015610da557610d93336114aa565b80610d9d81613767565b915050610d82565b5050565b606060008054610db890613796565b80601f0160208091040260200160405190810160405280929190818152602001828054610de490613796565b8015610e315780601f10610e0657610100808354040283529160200191610e31565b820191906000526020600020905b815481529060010190602001808311610e1457829003601f168201915b5050505050905090565b6000610e4682611ac5565b506000908152600460205260409020546001600160a01b031690565b6000610e6d82611475565b9050806001600160a01b0316836001600160a01b031603610ea05760405162461bcd60e51b8152600401610d1c906137fe565b336001600160a01b0382161480610ebc5750610ebc8133610ca4565b610ed85760405162461bcd60e51b8152600401610d1c90613866565b42600760c8600654610eea9190612f66565b60c88110610efa57610efa612f7e565b015560068054906000610f0c83613767565b9190505550610f1b8383611af9565b505050565b6001600160a01b038116600090815260d16020526040902054610f555760405162461bcd60e51b8152600401610d1c906138b7565b6000610f60826116c4565b905080600003610f825760405162461bcd60e51b8152600401610d1c9061390d565b8060d06000828254610f949190612faa565b90915550506001600160a01b038216600090815260d260205260409020805482019055610fc18282611b67565b7fdf20fd1e76bc69d672e4814fafb2c449bba3a5369d8359adf9e05e6fde87b0568282604051610ff292919061391d565b60405180910390a15050565b6110083382611bfa565b6110245760405162461bcd60e51b8152600401610d1c90613973565b610f1b838383611c78565b6000611039612eb6565b600083815260dd60205260408120805460c982015460ca830154849384939260019091019161106a6108fe8b611475565b6040805161190081019182905290859060c89082845b8154815260200190600101908083116110805750989f939e50959c50939a509198509650505050505050565b600082815260d660205260409020600101546110c781611a6c565b610f1b8383611db5565b6001600160a01b03811633146110f95760405162461bcd60e51b8152600401610d1c906139db565b610da58282611e57565b600061110e81611a6c565b611116611eda565b50565b610f1b8383836040518060200160405280600081525061173a565b600061113f81611a6c565b5061033955565b6101a88160c8811061115757600080fd5b015467ffffffffffffffff81169150600160401b90046001600160c01b031682565b6001600160a01b038116600090815260d160205260409020546111ae5760405162461bcd60e51b8152600401610d1c906138b7565b60006111ba83836118c3565b9050806000036111dc5760405162461bcd60e51b8152600401610d1c9061390d565b6001600160a01b038316600090815260d4602052604081208054839290611204908490612faa565b90915550506001600160a01b03808416600090815260d56020908152604080832093861683529290522080548201905561123f838383611f29565b826001600160a01b03167f3be5b7a71e84ed12875d241991c70855ac5817d847039e17a9d895c1ceb0f18a838360405161127a929190612f35565b60405180910390a2505050565b6102718160c8811061129857600080fd5b0154905081565b6060806112b2635681e00b60e01b611f94565b6112c26316ab55a160e11b611f94565b915091509091565b60006112d4612eb6565b60006112de612eb6565b60006112e8612ed5565b6112f0612ed5565b60006060600654600761027054610271611308612101565b60df6101a860d854611318611772565b6040805161190081019182905290899060c89082845b81548152602001906001019080831161132e57505060408051611900810191829052949c508a935060c89250905082845b81548152602001906001019080831161135f57505060408051611900810190915293995087925060c8915060009050835b828210156113db57604080518082019091528483015467ffffffffffffffff81168252600160401b90046001600160c01b031660208083019190915290825260019092019101611390565b505060408051611900810190915292965085915060c890506000835b8282101561144257604080518082019091528483015467ffffffffffffffff81168252600160401b90046001600160c01b0316602080830191909152908252600190920191016113f7565b505050509250985098509850985098509850985098509850909192939495969798565b60078160c8811061129857600080fd5b6000818152600260205260408120546001600160a01b031680610d715760405162461bcd60e51b8152600401610d1c90613a1d565b6114b2612213565b60d95460d854106114d65760405163d05cb60960e01b815260040160405180910390fd5b60da546001600160a01b0316336001600160a01b03161480611502575060d7546001600160a01b031633145b61151f5760405163ea8e4eb560e01b815260040160405180910390fd5b60d88054908190600061153183613767565b9091555050600081815260dd602052604090204260c990910155611556600143613a2d565b404342338460405160200161156f959493929190613a68565b60408051601f198184030181529181528151602092830120600084815260dd909352912060ca0155610da5828261223d565b60006001600160a01b0382166115c95760405162461bcd60e51b8152600401610d1c90613af6565b506001600160a01b031660009081526003602052604090205490565b6115ed611a9b565b6115f76000612257565b565b600061160481611a6c565b6111166122a9565b600060d3828154811061162157611621612f7e565b6000918252602090912001546001600160a01b031692915050565b606060018054610db890613796565b801561168b5742600760c86006546116639190612f66565b60c8811061167357611673612f7e565b01556006805490600061168583613767565b91905055505b610da53383836122ec565b60006116a181611a6c565b5060da80546001600160a01b0319166001600160a01b0392909216919091179055565b6000806116d060d05490565b6116da9047612faa565b90506117058382611700866001600160a01b0316600090815260d2602052604090205490565b61238e565b9392505050565b600061171781611a6c565b5060db80546001600160a01b0319166001600160a01b0392909216919091179055565b6117443383611bfa565b6117605760405162461bcd60e51b8152600401610d1c90613973565b61176c848484846123cc565b50505050565b6060600060d85467ffffffffffffffff811115611791576117916134fc565b6040519080825280602002602001820160405280156117c457816020015b60608152602001906001900390816117af5790505b509050600060d85467ffffffffffffffff8111156117e4576117e46134fc565b60405190808252806020026020018201604052801561180d578160200160208202803683370190505b5090506000805b60d8548110156118b057600061182982611475565b905061183584826123ff565b151560000361189d5761184781612464565b85848151811061185957611859612f7e565b60200260200101819052508084838151811061187757611877612f7e565b6001600160a01b03909216602092830291909101909101528261189981613767565b9350505b50806118a881613767565b915050611814565b506118bb838261247a565b935050505090565b6001600160a01b038216600081815260d460205260408082205490516370a0823160e01b8152919283926370a08231906119019030906004016130af565b602060405180830381865afa15801561191e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119429190613b11565b61194c9190612faa565b6001600160a01b03808616600090815260d56020908152604080832093881683529290522054909150611982908490839061238e565b949350505050565b60db5460405163c87b56dd60e01b81526060916001600160a01b03169063c87b56dd906119bb90859060040161310e565b600060405180830381865afa1580156119d8573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610d719190810190613b8a565b600082815260d66020526040902060010154611a1b81611a6c565b610f1b8383611e57565b60df8160c8811061115757600080fd5b611a3d611a9b565b6001600160a01b038116611a635760405162461bcd60e51b8152600401610d1c90613c06565b61111681612257565b611116813361252a565b60006001600160e01b03198216637965db0b60e01b1480610d715750610d718261259f565b60d7546001600160a01b031633146115f75760405162461bcd60e51b8152600401610d1c90613c46565b6000818152600260205260409020546001600160a01b03166111165760405162461bcd60e51b8152600401610d1c90613a1d565b600081815260046020526040902080546001600160a01b0319166001600160a01b0384169081179091558190611b2e82611475565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b80471015611b875760405162461bcd60e51b8152600401610d1c90613c88565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114611bd4576040519150601f19603f3d011682016040523d82523d6000602084013e611bd9565b606091505b5050905080610f1b5760405162461bcd60e51b8152600401610d1c90613cf0565b600080611c0683611475565b9050806001600160a01b0316846001600160a01b03161480611c4d57506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b806119825750836001600160a01b0316611c6684610e3b565b6001600160a01b031614949350505050565b826001600160a01b0316611c8b82611475565b6001600160a01b031614611cb15760405162461bcd60e51b8152600401610d1c90613d40565b6001600160a01b038216611cd75760405162461bcd60e51b8152600401610d1c90613d8f565b611ce483838360016125ef565b826001600160a01b0316611cf782611475565b6001600160a01b031614611d1d5760405162461bcd60e51b8152600401610d1c90613d40565b600081815260046020908152604080832080546001600160a01b03199081169091556001600160a01b0387811680865260038552838620805460001901905590871680865283862080546001019055868652600290945282852080549092168417909155905184937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4610f1b8383836001612677565b600082815260d6602090815260408083206001600160a01b038516845290915290205460ff16610da557600082815260d6602090815260408083206001600160a01b03851684529091529020805460ff19166001179055611e133390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b600082815260d6602090815260408083206001600160a01b038516845290915290205460ff1615610da557600082815260d6602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b611ee26128cd565b60d7805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b604051611f1f91906130af565b60405180910390a1565b610f1b8363a9059cbb60e01b8484604051602401611f48929190612f35565b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166001600160e01b0319909316929092179091526128f6565b60408051600a80825281830190925260609160009190602082018180368337019050509050600360fc1b81600081518110611fd157611fd1612f7e565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061200057612000612f7e565b60200101906001600160f81b031916908160001a90535060005b60048110156120fa5761204b601085836004811061203a5761203a612f7e565b6120469291901a613d9f565b612988565b82612057836002613dbe565b612062906002612faa565b8151811061207257612072612f7e565b60200101906001600160f81b031916908160001a9053506120ac60108583600481106120a0576120a0612f7e565b6120469291901a613dd5565b826120b8836002613dbe565b6120c3906003612faa565b815181106120d3576120d3612f7e565b60200101906001600160f81b031916908160001a9053506120f381613767565b905061201a565b5092915050565b60008060009050600060d85467ffffffffffffffff811115612125576121256134fc565b60405190808252806020026020018201604052801561214e578160200160208202803683370190505b50905060005b60d85481101561220b57600061216982611475565b905061217583826123ff565b15156000036121c3578361218881613767565b9450508083838151811061219e5761219e612f7e565b60200260200101906001600160a01b031690816001600160a01b0316815250506121f8565b60008383815181106121d7576121d7612f7e565b60200260200101906001600160a01b031690816001600160a01b0316815250505b508061220381613767565b915050612154565b509092915050565b60d754600160a01b900460ff16156115f75760405162461bcd60e51b8152600401610d1c90613e14565b610da58282604051806020016040528060008152506129dd565b60d780546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6122b1612213565b60d7805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258611f123390565b816001600160a01b0316836001600160a01b03160361231d5760405162461bcd60e51b8152600401610d1c90613e56565b6001600160a01b0383811660008181526005602090815260408083209487168084529490915290819020805460ff1916851515179055517f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3190612381908590613008565b60405180910390a3505050565b60cf546001600160a01b038416600090815260d16020526040812054909183916123b89086613dbe565b6123c29190613e66565b6119829190613a2d565b6123d7848484611c78565b6123e384848484612a10565b61176c5760405162461bcd60e51b8152600401610d1c90613ec4565b6000805b835181101561245a57826001600160a01b031684828151811061242857612428612f7e565b60200260200101516001600160a01b031603612448576001915050610d71565b8061245281613767565b915050612403565b5060009392505050565b6060610d716001600160a01b0383166014612b11565b606060008267ffffffffffffffff811115612497576124976134fc565b6040519080825280602002602001820160405280156124ca57816020015b60608152602001906001900390816124b55790505b50905060005b83811015612522578481815181106124ea576124ea612f7e565b602002602001015182828151811061250457612504612f7e565b6020026020010181905250808061251a90613767565b9150506124d0565b509392505050565b600082815260d6602090815260408083206001600160a01b038516845290915290205460ff16610da55761255d81612464565b612568836020612b11565b604051602001612579929190613ef6565b60408051601f198184030181529082905262461bcd60e51b8252610d1c9160040161309e565b60006001600160e01b031982166380ac58cd60e01b14806125d057506001600160e01b03198216635b5e139f60e01b145b80610d7157506301ffc9a760e01b6001600160e01b0319831614610d71565b600181111561176c576001600160a01b03841615612635576001600160a01b0384166000908152600360205260408120805483929061262f908490613a2d565b90915550505b6001600160a01b0383161561176c576001600160a01b0383166000908152600360205260408120805483929061266c908490612faa565b909155505050505050565b6001600160a01b0384161561176c574261027160c86102705461269a9190612f66565b60c881106126aa576126aa612f7e565b0155600082815260dd6020526040902080544291600101906126ce9060c890612f66565b60c881106126de576126de612f7e565b0155600082815260dd602052604081208054916126fa83613767565b9091555050610270805490600061271083613767565b90915550506040805180820182526101a75467ffffffffffffffff81168252600160401b90046001600160c01b0316602080830182905260dc546001600160a01b0316600081815260d49092528482205494516370a0823160e01b8152939492939192916370a08231906127889030906004016130af565b602060405180830381865afa1580156127a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127c99190613b11565b6127d39190612faa565b9050818111156128c4576127e681610d29565b6001600160c01b03166020840152604080518082019091528061280842610cf2565b67ffffffffffffffff1681526020016128296128248585613a2d565b610d29565b6001600160c01b0316905283516101a8906128509060c89067ffffffffffffffff16612f66565b60c8811061286057612860612f7e565b82516020909301516001600160c01b0316600160401b0267ffffffffffffffff9093169290921791015582518361289682613f58565b67ffffffffffffffff908116909152845160208601516001600160c01b0316600160401b029116176101a755505b50505050505050565b60d754600160a01b900460ff166115f75760405162461bcd60e51b8152600401610d1c90613fae565b600061294b826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612c8a9092919063ffffffff16565b905080516000148061296c57508080602001905181019061296c9190613fc9565b610f1b5760405162461bcd60e51b8152600401610d1c9061402f565b600060098260ff16116129a9576129a082603061403f565b60f81b92915050565b8160ff16600a111580156129c15750600f8260ff1611155b1561048557600a6129d383606161403f565b6129a0919061405c565b6129e78383612c99565b6129f46000848484612a10565b610f1b5760405162461bcd60e51b8152600401610d1c90613ec4565b60006001600160a01b0384163b15612b0657604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290612a54903390899088908890600401614079565b6020604051808303816000875af1925050508015612a8f575060408051601f3d908101601f19168201909252612a8c918101906140be565b60015b612aec573d808015612abd576040519150601f19603f3d011682016040523d82523d6000602084013e612ac2565b606091505b508051600003612ae45760405162461bcd60e51b8152600401610d1c90613ec4565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050611982565b506001949350505050565b60606000612b20836002613dbe565b612b2b906002612faa565b67ffffffffffffffff811115612b4357612b436134fc565b6040519080825280601f01601f191660200182016040528015612b6d576020820181803683370190505b509050600360fc1b81600081518110612b8857612b88612f7e565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110612bb757612bb7612f7e565b60200101906001600160f81b031916908160001a9053506000612bdb846002613dbe565b612be6906001612faa565b90505b6001811115612c6b577f303132333435363738396162636465660000000000000000000000000000000085600f1660108110612c2757612c27612f7e565b1a60f81b828281518110612c3d57612c3d612f7e565b60200101906001600160f81b031916908160001a90535060049490941c93612c64816140df565b9050612be9565b5083156117055760405162461bcd60e51b8152600401610d1c90614126565b60606119828484600085612dac565b6001600160a01b038216612cbf5760405162461bcd60e51b8152600401610d1c90614166565b6000818152600260205260409020546001600160a01b031615612cf45760405162461bcd60e51b8152600401610d1c906141a8565b612d026000838360016125ef565b6000818152600260205260409020546001600160a01b031615612d375760405162461bcd60e51b8152600401610d1c906141a8565b6001600160a01b038216600081815260036020908152604080832080546001019055848352600290915280822080546001600160a01b0319168417905551839291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a4610da5600083836001612677565b606082471015612dce5760405162461bcd60e51b8152600401610d1c906141f9565b600080866001600160a01b03168587604051612dea9190614209565b60006040518083038185875af1925050503d8060008114612e27576040519150601f19603f3d011682016040523d82523d6000602084013e612e2c565b606091505b5091509150612e3d87838387612e48565b979650505050505050565b60608315612e87578251600003612e80576001600160a01b0385163b612e805760405162461bcd60e51b8152600401610d1c90614245565b5081611982565b6119828383815115612e9c5781518083602001fd5b8060405162461bcd60e51b8152600401610d1c919061309e565b60405180611900016040528060c8906020820280368337509192915050565b60405180611900016040528060c8905b6040805180820190915260008082526020820152815260200190600190039081612ee55790505090565b60006001600160a01b038216610d71565b612f2981612f0f565b82525050565b80612f29565b60408101612f438285612f20565b6117056020830184612f2f565b634e487b7160e01b600052601260045260246000fd5b815b9150600082612f7957612f79612f50565b500690565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b80820180821115610d7157610d71612f94565b6001600160e01b031981165b811461111657600080fd5b8035610d7181612fbd565b600060208284031215612ff457612ff4600080fd5b60006119828484612fd4565b801515612f29565b60208101610d718284613000565b80612fc9565b8035610d7181613016565b60006020828403121561303c5761303c600080fd5b6000611982848461301c565b60005b8381101561306357818101518382015260200161304b565b50506000910152565b6000613076825190565b80845260208401935061308d818560208601613048565b601f01601f19169290920192915050565b60208082528101611705818461306c565b60208101610d718284612f20565b612fc981612f0f565b8035610d71816130bd565b600080604083850312156130e7576130e7600080fd5b60006130f385856130c6565b92505060206131048582860161301c565b9150509250929050565b60208101610d718284612f2f565b60006020828403121561313157613131600080fd5b600061198284846130c6565b60008060006060848603121561315557613155600080fd5b600061316186866130c6565b9350506020613172868287016130c6565b92505060406131838682870161301c565b9150509250925092565b6131978282612f2f565b5060200190565b60200190565b60c88160005b828110156131cf5781516131be868261318d565b9550506020820191506001016131aa565b5050505050565b61198081016131e58288612f2f565b6131f260208301876131a4565b613200611920830186612f2f565b61320e611940830185612f2f565b61321c611960830184612f2f565b9695505050505050565b6000806040838503121561323c5761323c600080fd5b6000613248858561301c565b9250506020613104858286016130c6565b6000610d7182612f0f565b612fc981613259565b8035610d7181613264565b6000806040838503121561328e5761328e600080fd5b6000613248858561326d565b67ffffffffffffffff8116612f29565b6001600160c01b038116612f29565b604081016132c7828561329a565b61170560208301846132aa565b6000610d7182613259565b612f29816132d4565b60208101610d7182846132df565b60408082528101613307818561306c565b90508181036020830152611982818461306c565b8051613327838261329a565b506020810151610f1b60208401826132aa565b613344828261331b565b5060400190565b60c88160005b828110156131cf578151613365868261333a565b955050602082019150600101613351565b6000611705838361306c565b600061338c825190565b808452602084019350836020820285016133a68560200190565b60005b848110156133da57838303885281516133c28482613376565b935050602082016020989098019791506001016133a9565b50909695505050505050565b6196a081016133f5828c612f2f565b613402602083018b6131a4565b61341061192083018a612f2f565b61341e6119408301896131a4565b61342c613240830188612f2f565b61343a61326083018761334b565b61344861646083018661334b565b613456619660830185612f2f565b8181036196808301526134698184613382565b9b9a5050505050505050505050565b801515612fc9565b8035610d7181613478565b600080604083850312156134a1576134a1600080fd5b60006134ad85856130c6565b925050602061310485828601613480565b608081016134cc8287612f2f565b6134d96020830186612f2f565b6134e66040830185612f2f565b6134f36060830184612f2f565b95945050505050565b634e487b7160e01b600052604160045260246000fd5b601f19601f830116810181811067ffffffffffffffff82111715613538576135386134fc565b6040525050565b600061354a60405190565b90506135568282613512565b919050565b600067ffffffffffffffff821115613575576135756134fc565b601f19601f83011660200192915050565b82818337506000910152565b60006135a56135a08461355b565b61353f565b9050828152602081018484840111156135c0576135c0600080fd5b612522848285613586565b600082601f8301126135df576135df600080fd5b8135611982848260208601613592565b6000806000806080858703121561360857613608600080fd5b600061361487876130c6565b9450506020613625878288016130c6565b93505060406136368782880161301c565b925050606085013567ffffffffffffffff81111561365657613656600080fd5b613662878288016135cb565b91505092959194509250565b602080825281016117058184613382565b60006020828403121561369457613694600080fd5b6000611982848461326d565b600080604083850312156136b6576136b6600080fd5b600061324885856130c6565b60268152602081017f53616665436173743a2076616c756520646f65736e27742066697420696e203681526534206269747360d01b602082015290505b60400190565b60208082528101610d71816136c2565b60278152602081017f53616665436173743a2076616c756520646f65736e27742066697420696e20318152663932206269747360c81b602082015290506136ff565b60208082528101610d7181613715565b60006001820161377957613779612f94565b5060010190565b634e487b7160e01b600052602260045260246000fd5b6002810460018216806137aa57607f821691505b6020821081036137bc576137bc613780565b50919050565b60218152602081017f4552433732313a20617070726f76616c20746f2063757272656e74206f776e658152603960f91b602082015290506136ff565b60208082528101610d71816137c2565b603d8152602081017f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f81527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c000000602082015290506136ff565b60208082528101610d718161380e565b60268152602081017f5061796d656e7453706c69747465723a206163636f756e7420686173206e6f2081526573686172657360d01b602082015290506136ff565b60208082528101610d7181613876565b602b8152602081017f5061796d656e7453706c69747465723a206163636f756e74206973206e6f742081526a191d59481c185e5b595b9d60aa1b602082015290506136ff565b60208082528101610d71816138c7565b60408101612f4382856132df565b602d8152602081017f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6581526c1c881bdc88185c1c1c9bdd9959609a1b602082015290506136ff565b60208082528101610d718161392b565b602f8152602081017f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636581527f20726f6c657320666f722073656c660000000000000000000000000000000000602082015290506136ff565b60208082528101610d7181613983565b60188152602081017f4552433732313a20696e76616c696420746f6b656e20494400000000000000008152905061319e565b60208082528101610d71816139eb565b81810381811115610d7157610d71612f94565b6000610d718260601b90565b6000610d7182613a40565b612f29613a6382612f0f565b613a4c565b613a728187612f2f565b602001613a7f8186612f2f565b602001613a8c8185612f2f565b602001613a998184613a57565b601401613aa68183612f2f565b60200195945050505050565b60298152602081017f4552433732313a2061646472657373207a65726f206973206e6f7420612076618152683634b21037bbb732b960b91b602082015290506136ff565b60208082528101610d7181613ab2565b8051610d7181613016565b600060208284031215613b2657613b26600080fd5b60006119828484613b06565b6000613b406135a08461355b565b905082815260208101848484011115613b5b57613b5b600080fd5b612522848285613048565b600082601f830112613b7a57613b7a600080fd5b8151611982848260208601613b32565b600060208284031215613b9f57613b9f600080fd5b815167ffffffffffffffff811115613bb957613bb9600080fd5b61198284828501613b66565b60268152602081017f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206181526564647265737360d01b602082015290506136ff565b60208082528101610d7181613bc5565b60208082527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572910190815261319e565b60208082528101610d7181613c16565b601d8152602081017f416464726573733a20696e73756666696369656e742062616c616e63650000008152905061319e565b60208082528101610d7181613c56565b603a8152602081017f416464726573733a20756e61626c6520746f2073656e642076616c75652c207281527f6563697069656e74206d61792068617665207265766572746564000000000000602082015290506136ff565b60208082528101610d7181613c98565b60258152602081017f4552433732313a207472616e736665722066726f6d20696e636f72726563742081526437bbb732b960d91b602082015290506136ff565b60208082528101610d7181613d00565b60248152602081017f4552433732313a207472616e7366657220746f20746865207a65726f206164648152637265737360e01b602082015290506136ff565b60208082528101610d7181613d50565b60ff9081169082165b9150600082613db957613db9612f50565b500490565b8181028115828204841417610d7157610d71612f94565b60ff908116908216612f68565b60108152602081017f5061757361626c653a20706175736564000000000000000000000000000000008152905061319e565b60208082528101610d7181613de2565b60198152602081017f4552433732313a20617070726f766520746f2063616c6c6572000000000000008152905061319e565b60208082528101610d7181613e24565b81613da8565b60328152602081017f4552433732313a207472616e7366657220746f206e6f6e20455243373231526581527f63656976657220696d706c656d656e7465720000000000000000000000000000602082015290506136ff565b60208082528101610d7181613e6c565b6000613ede825190565b613eec818560208601613048565b9290920192915050565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152601701613f268184613ed4565b7f206973206d697373696e6720726f6c6520000000000000000000000000000000815260110190506117058183613ed4565b67ffffffffffffffff16600067fffffffffffffffe19820161377957613779612f94565b60148152602081017f5061757361626c653a206e6f74207061757365640000000000000000000000008152905061319e565b60208082528101610d7181613f7c565b8051610d7181613478565b600060208284031215613fde57613fde600080fd5b60006119828484613fbe565b602a8152602081017f5361666545524332303a204552433230206f7065726174696f6e20646964206e8152691bdd081cdd58d8d9595960b21b602082015290506136ff565b60208082528101610d7181613fea565b60ff918216919081169082820190811115610d7157610d71612f94565b60ff918216919081169082820390811115610d7157610d71612f94565b608081016140878287612f20565b6140946020830186612f20565b6140a16040830185612f2f565b818103606083015261321c818461306c565b8051610d7181612fbd565b6000602082840312156140d3576140d3600080fd5b600061198284846140b3565b6000816140ee576140ee612f94565b506000190190565b60208082527f537472696e67733a20686578206c656e67746820696e73756666696369656e74910190815261319e565b60208082528101610d71816140f6565b60208082527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373910190815261319e565b60208082528101610d7181614136565b601c8152602081017f4552433732313a20746f6b656e20616c7265616479206d696e746564000000008152905061319e565b60208082528101610d7181614176565b60268152602081017f416464726573733a20696e73756666696369656e742062616c616e636520666f8152651c8818d85b1b60d21b602082015290506136ff565b60208082528101610d71816141b8565b610d718183613ed4565b601d8152602081017f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000008152905061319e565b60208082528101610d718161421356fea26469706673582212208bfae487f4e8dc284f8c984b29d9dc4de22dd180a9275a166183daf1ec1ee0ce64736f6c63430008110033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000001c0000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000009861f4b3e833b9e8618f6c3af3b295d1b2177303000000000000000000000000000000000000000000000000000000000000012c000000000000000000000000000000000000000000000000000000000000000300000000000000000000000065c7432e6662a96f4e999603991d5e929e57f60a000000000000000000000000134309c4cf57bfa43ef66bf20bd0eeccdeb2d80c0000000000000000000000001b9f1b5a6032af69f71eee1a25fa597fac1ee5a3000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000002d50000000000000000000000000000000000000000000000000000000000000096000000000000000000000000000000000000000000000000000000000000007d000000000000000000000000000000000000000000000000000000000000000100000000000000000000000020ec68ba5dc8af5380bdb37465b3f9bde75f9635
-----Decoded View---------------
Arg [0] : payees (address[]): 0x65C7432E6662A96f4e999603991d5E929E57f60A,0x134309c4cf57BfA43EF66bF20bD0EEcCDEb2D80c,0x1B9f1B5A6032af69F71EEe1a25Fa597FAC1Ee5a3
Arg [1] : shares (uint256[]): 725,150,125
Arg [2] : admins_ (address[]): 0x20Ec68Ba5dC8aF5380BDb37465b3F9BDE75f9635
Arg [3] : wethContract_ (address): 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
Arg [4] : renderer_ (address): 0x9861F4b3E833b9e8618F6c3Af3B295d1b2177303
Arg [5] : maxSupply_ (uint256): 300
-----Encoded View---------------
16 Constructor Arguments found :
Arg [0] : 00000000000000000000000000000000000000000000000000000000000000c0
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000140
Arg [2] : 00000000000000000000000000000000000000000000000000000000000001c0
Arg [3] : 000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
Arg [4] : 0000000000000000000000009861f4b3e833b9e8618f6c3af3b295d1b2177303
Arg [5] : 000000000000000000000000000000000000000000000000000000000000012c
Arg [6] : 0000000000000000000000000000000000000000000000000000000000000003
Arg [7] : 00000000000000000000000065c7432e6662a96f4e999603991d5e929e57f60a
Arg [8] : 000000000000000000000000134309c4cf57bfa43ef66bf20bd0eeccdeb2d80c
Arg [9] : 0000000000000000000000001b9f1b5a6032af69f71eee1a25fa597fac1ee5a3
Arg [10] : 0000000000000000000000000000000000000000000000000000000000000003
Arg [11] : 00000000000000000000000000000000000000000000000000000000000002d5
Arg [12] : 0000000000000000000000000000000000000000000000000000000000000096
Arg [13] : 000000000000000000000000000000000000000000000000000000000000007d
Arg [14] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [15] : 00000000000000000000000020ec68ba5dc8af5380bdb37465b3f9bde75f9635
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.