More Info
Private Name Tags
ContractCreator
TokenTracker
Latest 25 from a total of 750 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Withdraw | 19290936 | 330 days ago | IN | 0 ETH | 0.0023283 | ||||
Transfer | 19286427 | 331 days ago | IN | 0.925 ETH | 0.00140487 | ||||
Withdraw | 19286421 | 331 days ago | IN | 0 ETH | 0.00202774 | ||||
Resolve Gumball | 19281841 | 332 days ago | IN | 0 ETH | 0.00204306 | ||||
Activate Gumball | 19281839 | 332 days ago | IN | 0 ETH | 0.00435198 | ||||
Resolve Gumball | 19281684 | 332 days ago | IN | 0 ETH | 0.00300327 | ||||
Activate Gumball | 19281682 | 332 days ago | IN | 0 ETH | 0.0048055 | ||||
Resolve Gumball | 19281417 | 332 days ago | IN | 0 ETH | 0.00169727 | ||||
Activate Gumball | 19281415 | 332 days ago | IN | 0 ETH | 0.0036902 | ||||
Initialize Gumba... | 19281412 | 332 days ago | IN | 0 ETH | 0.00162565 | ||||
Claim Gumball | 19281410 | 332 days ago | IN | 0 ETH | 0.00657887 | ||||
Resolve Gumball | 19281406 | 332 days ago | IN | 0 ETH | 0.00200548 | ||||
Activate Gumball | 19281404 | 332 days ago | IN | 0 ETH | 0.00369501 | ||||
Initialize Gumba... | 19281402 | 332 days ago | IN | 0 ETH | 0.00166946 | ||||
Claim Gumball | 19281400 | 332 days ago | IN | 0 ETH | 0.00662192 | ||||
Resolve Gumball | 19281397 | 332 days ago | IN | 0 ETH | 0.00180829 | ||||
Activate Gumball | 19281395 | 332 days ago | IN | 0 ETH | 0.00375097 | ||||
Initialize Gumba... | 19281386 | 332 days ago | IN | 0 ETH | 0.00181336 | ||||
Claim Gumball | 19281383 | 332 days ago | IN | 0 ETH | 0.00677233 | ||||
Transfer | 19280827 | 332 days ago | IN | 1.1 ETH | 0.00075076 | ||||
Withdraw | 19280824 | 332 days ago | IN | 0 ETH | 0.00108641 | ||||
Resolve Gumball | 19279564 | 332 days ago | IN | 0 ETH | 0.00295521 | ||||
Activate Gumball | 19278989 | 332 days ago | IN | 0 ETH | 0.00439598 | ||||
Resolve Gumball | 19278549 | 332 days ago | IN | 0 ETH | 0.00229134 | ||||
Activate Gumball | 19278545 | 332 days ago | IN | 0 ETH | 0.00426096 |
Advanced mode: Intended for advanced users or developers and will display all Internal Transactions including zero value transfers. Name tag integration is not available in advanced view.
Latest 25 internal transactions (View All)
Advanced mode:
Parent Transaction Hash | Block |
From
|
To
|
||||
---|---|---|---|---|---|---|---|
19290936 | 330 days ago | 0.925 ETH | |||||
19286421 | 331 days ago | 1.08838015 ETH | |||||
19281841 | 332 days ago | 0.00108946 ETH | |||||
19281839 | 332 days ago | 0 ETH | |||||
19281684 | 332 days ago | 0.00382653 ETH | |||||
19281682 | 332 days ago | 0 ETH | |||||
19281417 | 332 days ago | 0.00010934 ETH | |||||
19281415 | 332 days ago | 0 ETH | |||||
19281410 | 332 days ago | 0 ETH | |||||
19281410 | 332 days ago | 0 ETH | |||||
19281410 | 332 days ago | 0 ETH | |||||
19281410 | 332 days ago | 0 ETH | |||||
19281410 | 332 days ago | 0 ETH | |||||
19281406 | 332 days ago | 0.0054945 ETH | |||||
19281404 | 332 days ago | 0 ETH | |||||
19281400 | 332 days ago | 0 ETH | |||||
19281400 | 332 days ago | 0 ETH | |||||
19281400 | 332 days ago | 0 ETH | |||||
19281400 | 332 days ago | 0 ETH | |||||
19281400 | 332 days ago | 0 ETH | |||||
19281397 | 332 days ago | 0.0011 ETH | |||||
19281395 | 332 days ago | 0 ETH | |||||
19281383 | 332 days ago | 0 ETH | |||||
19281383 | 332 days ago | 0 ETH | |||||
19281383 | 332 days ago | 0 ETH |
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
Gumball
Compiler Version
v0.8.24+commit.e11b9ed9
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity 0.8.24; import "TokenA.sol"; library Math { /** * @dev Muldiv operation overflow. */ error MathOverflowedMulDiv(); enum Rounding { Floor, // Toward negative infinity Ceil, // Toward positive infinity Trunc, // Toward zero Expand // Away from zero } /** * @dev Returns the addition of two unsigned integers, with an overflow flag. */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the subtraction of two unsigned integers, with an overflow flag. */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @dev Returns the 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 towards infinity instead * of rounding towards zero. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { if (b == 0) { // Guarantee the same behavior as in a regular Solidity division. return a / b; } // (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 = x * y; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) 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. if (denominator <= prod1) { revert MathOverflowedMulDiv(); } /////////////////////////////////////////////// // 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. uint256 twos = denominator & (0 - denominator); 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 (unsignedRoundsUp(rounding) && 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 * towards zero. * * 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 + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2 of a positive value rounded towards zero. * 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 + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10 of a positive value rounded towards zero. * 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 + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0); } } /** * @dev Return the log in base 256 of a positive value rounded towards zero. * 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 + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0); } } /** * @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers. */ function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) { return uint8(rounding) % 2 == 1; } } 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); } } } 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); } 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: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev 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); } interface IERC721Enumerable is IERC721 { /** * @dev Returns the total amount of tokens stored by the contract. */ function totalSupply() external view returns (uint256); /** * @dev Returns a token ID owned by `owner` at a given `index` of its token list. * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSupply} to enumerate all tokens. */ function tokenByIndex(uint256 index) external view returns (uint256); } 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); } interface IERC721Errors { /** * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in ERC-20. * Used in balance queries. * @param owner Address of the current owner of a token. */ error ERC721InvalidOwner(address owner); /** * @dev Indicates a `tokenId` whose `owner` is the zero address. * @param tokenId Identifier number of a token. */ error ERC721NonexistentToken(uint256 tokenId); /** * @dev Indicates an error related to the ownership over a particular token. Used in transfers. * @param sender Address whose tokens are being transferred. * @param tokenId Identifier number of a token. * @param owner Address of the current owner of a token. */ error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner); /** * @dev Indicates a failure with the token `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. */ error ERC721InvalidSender(address sender); /** * @dev Indicates a failure with the token `receiver`. Used in transfers. * @param receiver Address to which tokens are being transferred. */ error ERC721InvalidReceiver(address receiver); /** * @dev Indicates a failure with the `operator`’s approval. Used in transfers. * @param operator Address that may be allowed to operate on tokens without being their owner. * @param tokenId Identifier number of a token. */ error ERC721InsufficientApproval(address operator, uint256 tokenId); /** * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. * @param approver Address initiating an approval operation. */ error ERC721InvalidApprover(address approver); /** * @dev Indicates a failure with the `operator` to be approved. Used in approvals. * @param operator Address that may be allowed to operate on tokens without being their owner. */ error ERC721InvalidOperator(address operator); } library ERC721Utils { /** * @dev Performs an acceptance check for the provided `operator` by calling {IERC721-onERC721Received} * on the `to` address. The `operator` is generally the address that initiated the token transfer (i.e. `msg.sender`). * * The acceptance call is not executed and treated as a no-op if the target address is doesn't contain code (i.e. an EOA). * Otherwise, the recipient must implement {IERC721Receiver-onERC721Received} and return the acceptance magic value to accept * the transfer. */ function checkOnERC721Received( address operator, address from, address to, uint256 tokenId, bytes memory data ) internal { if (to.code.length > 0) { try IERC721Receiver(to).onERC721Received(operator, from, tokenId, data) returns (bytes4 retval) { if (retval != IERC721Receiver.onERC721Received.selector) { // Token rejected revert IERC721Errors.ERC721InvalidReceiver(to); } } catch (bytes memory reason) { if (reason.length == 0) { // non-IERC721Receiver implementer revert IERC721Errors.ERC721InvalidReceiver(to); } else { /// @solidity memory-safe-assembly assembly { revert(add(32, reason), mload(reason)) } } } } } } abstract contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Errors { using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; mapping(uint256 tokenId => address) private _owners; mapping(address owner => uint256) private _balances; mapping(uint256 tokenId => address) private _tokenApprovals; mapping(address owner => mapping(address operator => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual returns (uint256) { if (owner == address(0)) { revert ERC721InvalidOwner(address(0)); } return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual returns (address) { return _requireOwned(tokenId); } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual returns (string memory) { _requireOwned(tokenId); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string.concat(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 { _approve(to, tokenId, _msgSender()); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual returns (address) { _requireOwned(tokenId); return _getApproved(tokenId); } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual { _setApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom(address from, address to, uint256 tokenId) public virtual { if (to == address(0)) { revert ERC721InvalidReceiver(address(0)); } // Setting an "auth" arguments enables the `_isAuthorized` check which verifies that the token exists // (from != 0). Therefore, it is not needed to verify that the return value is not 0 here. address previousOwner = _update(to, tokenId, _msgSender()); if (previousOwner != from) { revert ERC721IncorrectOwner(from, tokenId, previousOwner); } } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom(address from, address to, uint256 tokenId) public { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual { transferFrom(from, to, tokenId); ERC721Utils.checkOnERC721Received(_msgSender(), from, to, tokenId, data); } /** * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist * * IMPORTANT: Any overrides to this function that add ownership of tokens not tracked by the * core ERC-721 logic MUST be matched with the use of {_increaseBalance} to keep balances * consistent with ownership. The invariant to preserve is that for any address `a` the value returned by * `balanceOf(a)` must be equal to the number of tokens such that `_ownerOf(tokenId)` is `a`. */ function _ownerOf(uint256 tokenId) internal view virtual returns (address) { return _owners[tokenId]; } /** * @dev Returns the approved address for `tokenId`. Returns 0 if `tokenId` is not minted. */ function _getApproved(uint256 tokenId) internal view virtual returns (address) { return _tokenApprovals[tokenId]; } /** * @dev Returns whether `spender` is allowed to manage `owner`'s tokens, or `tokenId` in * particular (ignoring whether it is owned by `owner`). * * WARNING: This function assumes that `owner` is the actual owner of `tokenId` and does not verify this * assumption. */ function _isAuthorized(address owner, address spender, uint256 tokenId) internal view virtual returns (bool) { return spender != address(0) && (owner == spender || isApprovedForAll(owner, spender) || _getApproved(tokenId) == spender); } /** * @dev Checks if `spender` can operate on `tokenId`, assuming the provided `owner` is the actual owner. * Reverts if `spender` does not have approval from the provided `owner` for the given token or for all its assets * the `spender` for the specific `tokenId`. * * WARNING: This function assumes that `owner` is the actual owner of `tokenId` and does not verify this * assumption. */ function _checkAuthorized(address owner, address spender, uint256 tokenId) internal view virtual { if (!_isAuthorized(owner, spender, tokenId)) { if (owner == address(0)) { revert ERC721NonexistentToken(tokenId); } else { revert ERC721InsufficientApproval(spender, tokenId); } } } /** * @dev Unsafe write access to the balances, used by extensions that "mint" tokens using an {ownerOf} override. * * NOTE: the value is limited to type(uint128).max. This protect against _balance overflow. It is unrealistic that * a uint256 would ever overflow from increments when these increments are bounded to uint128 values. * * WARNING: Increasing an account's balance using this function tends to be paired with an override of the * {_ownerOf} function to resolve the ownership of the corresponding tokens so that balances and ownership * remain consistent with one another. */ function _increaseBalance(address account, uint128 value) internal virtual { unchecked { _balances[account] += value; } } /** * @dev Transfers `tokenId` from its current owner to `to`, or alternatively mints (or burns) if the current owner * (or `to`) is the zero address. Returns the owner of the `tokenId` before the update. * * The `auth` argument is optional. If the value passed is non 0, then this function will check that * `auth` is either the owner of the token, or approved to operate on the token (by the owner). * * Emits a {Transfer} event. * * NOTE: If overriding this function in a way that tracks balances, see also {_increaseBalance}. */ function _update(address to, uint256 tokenId, address auth) internal virtual returns (address) { address from = _ownerOf(tokenId); // Perform (optional) operator check if (auth != address(0)) { _checkAuthorized(from, auth, tokenId); } // Execute the update if (from != address(0)) { // Clear approval. No need to re-authorize or emit the Approval event _approve(address(0), tokenId, address(0), false); unchecked { _balances[from] -= 1; } } if (to != address(0)) { unchecked { _balances[to] += 1; } } _owners[tokenId] = to; emit Transfer(from, to, tokenId); return from; } /** * @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 { if (to == address(0)) { revert ERC721InvalidReceiver(address(0)); } address previousOwner = _update(to, tokenId, address(0)); if (previousOwner != address(0)) { revert ERC721InvalidSender(address(0)); } } /** * @dev Mints `tokenId`, transfers it to `to` and checks for `to` acceptance. * * 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 { _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); ERC721Utils.checkOnERC721Received(_msgSender(), address(0), to, tokenId, data); } /** * @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 { address previousOwner = _update(address(0), tokenId, address(0)); if (previousOwner == address(0)) { revert ERC721NonexistentToken(tokenId); } } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer(address from, address to, uint256 tokenId) internal { if (to == address(0)) { revert ERC721InvalidReceiver(address(0)); } address previousOwner = _update(to, tokenId, address(0)); if (previousOwner == address(0)) { revert ERC721NonexistentToken(tokenId); } else if (previousOwner != from) { revert ERC721IncorrectOwner(from, tokenId, previousOwner); } } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking that contract recipients * are aware of the ERC-721 standard 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 like {safeTransferFrom} in the sense that it invokes * {IERC721Receiver-onERC721Received} on the receiver, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `tokenId` token must exist and be owned by `from`. * - `to` cannot be the zero address. * - `from` cannot be the zero address. * - 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) internal { _safeTransfer(from, to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeTransfer-address-address-uint256-}[`_safeTransfer`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeTransfer(address from, address to, uint256 tokenId, bytes memory data) internal virtual { _transfer(from, to, tokenId); ERC721Utils.checkOnERC721Received(_msgSender(), from, to, tokenId, data); } /** * @dev Approve `to` to operate on `tokenId` * * The `auth` argument is optional. If the value passed is non 0, then this function will check that `auth` is * either the owner of the token, or approved to operate on all tokens held by this owner. * * Emits an {Approval} event. * * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument. */ function _approve(address to, uint256 tokenId, address auth) internal { _approve(to, tokenId, auth, true); } /** * @dev Variant of `_approve` with an optional flag to enable or disable the {Approval} event. The event is not * emitted in the context of transfers. */ function _approve(address to, uint256 tokenId, address auth, bool emitEvent) internal virtual { // Avoid reading the owner unless necessary if (emitEvent || auth != address(0)) { address owner = _requireOwned(tokenId); // We do not use _isAuthorized because single-token approvals should not be able to call approve if (auth != address(0) && owner != auth && !isApprovedForAll(owner, auth)) { revert ERC721InvalidApprover(auth); } if (emitEvent) { emit Approval(owner, to, tokenId); } } _tokenApprovals[tokenId] = to; } /** * @dev Approve `operator` to operate on all of `owner` tokens * * Requirements: * - operator can't be the address zero. * * Emits an {ApprovalForAll} event. */ function _setApprovalForAll(address owner, address operator, bool approved) internal virtual { if (operator == address(0)) { revert ERC721InvalidOperator(operator); } _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } /** * @dev Reverts if the `tokenId` doesn't have a current owner (it hasn't been minted, or it has been burned). * Returns the owner. * * Overrides to ownership logic should be done to {_ownerOf}. */ function _requireOwned(uint256 tokenId) internal view returns (address) { address owner = _ownerOf(tokenId); if (owner == address(0)) { revert ERC721NonexistentToken(tokenId); } return owner; } } abstract contract ERC721Enumerable is ERC721, IERC721Enumerable { mapping(address owner => mapping(uint256 index => uint256)) private _ownedTokens; mapping(uint256 tokenId => uint256) private _ownedTokensIndex; uint256[] private _allTokens; mapping(uint256 tokenId => uint256) private _allTokensIndex; /** * @dev An `owner`'s token query was out of bounds for `index`. * * NOTE: The owner being `address(0)` indicates a global out of bounds index. */ error ERC721OutOfBoundsIndex(address owner, uint256 index); /** * @dev Batch mint is not allowed. */ error ERC721EnumerableForbiddenBatchMint(); /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) { return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual returns (uint256) { if (index >= balanceOf(owner)) { revert ERC721OutOfBoundsIndex(owner, index); } return _ownedTokens[owner][index]; } /** * @dev See {IERC721Enumerable-totalSupply}. */ function totalSupply() public view virtual returns (uint256) { return _allTokens.length; } /** * @dev See {IERC721Enumerable-tokenByIndex}. */ function tokenByIndex(uint256 index) public view virtual returns (uint256) { if (index >= totalSupply()) { revert ERC721OutOfBoundsIndex(address(0), index); } return _allTokens[index]; } /** * @dev See {ERC721-_update}. */ function _update(address to, uint256 tokenId, address auth) internal virtual override returns (address) { address previousOwner = super._update(to, tokenId, auth); if (previousOwner == address(0)) { _addTokenToAllTokensEnumeration(tokenId); } else if (previousOwner != to) { _removeTokenFromOwnerEnumeration(previousOwner, tokenId); } if (to == address(0)) { _removeTokenFromAllTokensEnumeration(tokenId); } else if (previousOwner != to) { _addTokenToOwnerEnumeration(to, tokenId); } return previousOwner; } /** * @dev Private function to add a token to this extension's ownership-tracking data structures. * @param to address representing the new owner of the given token ID * @param tokenId uint256 ID of the token to be added to the tokens list of the given address */ function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private { uint256 length = balanceOf(to) - 1; _ownedTokens[to][length] = tokenId; _ownedTokensIndex[tokenId] = length; } /** * @dev Private function to add a token to this extension's token tracking data structures. * @param tokenId uint256 ID of the token to be added to the tokens list */ function _addTokenToAllTokensEnumeration(uint256 tokenId) private { _allTokensIndex[tokenId] = _allTokens.length; _allTokens.push(tokenId); } /** * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for * gas optimizations e.g. when performing a transfer operation (avoiding double writes). * This has O(1) time complexity, but alters the order of the _ownedTokens array. * @param from address representing the previous owner of the given token ID * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address */ function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private { // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = balanceOf(from); uint256 tokenIndex = _ownedTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary if (tokenIndex != lastTokenIndex) { uint256 lastTokenId = _ownedTokens[from][lastTokenIndex]; _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index } // This also deletes the contents at the last position of the array delete _ownedTokensIndex[tokenId]; delete _ownedTokens[from][lastTokenIndex]; } /** * @dev Private function to remove a token from this extension's token tracking data structures. * This has O(1) time complexity, but alters the order of the _allTokens array. * @param tokenId uint256 ID of the token to be removed from the tokens list */ function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private { // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = _allTokens.length - 1; uint256 tokenIndex = _allTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding // an 'if' statement (like in _removeTokenFromOwnerEnumeration) uint256 lastTokenId = _allTokens[lastTokenIndex]; _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index // This also deletes the contents at the last position of the array delete _allTokensIndex[tokenId]; _allTokens.pop(); } /** * See {ERC721-_increaseBalance}. We need that to account tokens that were minted in batch */ function _increaseBalance(address account, uint128 amount) internal virtual override { if (amount > 0) { revert ERC721EnumerableForbiddenBatchMint(); } super._increaseBalance(account, amount); } } contract Gumball is ERC721Enumerable, ERC721Receiver { address public owner; address public gumballCoinAddress = 0xa72332aF4a7efBCE221903e7A09175BE64F0400d; address public authorizedResolver; uint256 public tokenCount; string public imageURL; enum GumballState { NOTMINTED, MINTED, INITIALIZED, ACTIVATED, RESOLVED } mapping(uint256 => mapping(uint256 => uint256)) public gumballTypeToDropTableSlotOdds; //Number used to determine if the rolled number hit this prize mapping(uint256 => mapping(uint256 => uint256)) public gumballTypeToDropTableSlotWinnings; //Number used for winnings in % to the 10,000 mapping(uint256 => uint256) public gumballTypeToDropTable; mapping(uint256 => uint256) public gumballType; mapping(uint256 => uint256) public gumballTypeStaticWinnings; mapping(uint256 => GumballState) public gumballState; mapping(uint256 => address) public gumballActivatedBy; event GumballActivated(uint256 gumballID); event GumballMinted(uint256 gumballID); event GumballResolved(uint256 gumballID,uint256 winningsPercent, uint256 winnings, bytes32 seed); event GumballInitialized(uint256 gumballID, bytes32 seed, uint256 gumballType); modifier onlyOwner() { require(msg.sender == owner, "only owner"); _; } modifier onlyResolver() { require(msg.sender == authorizedResolver, "only resolver"); _; } constructor( ) ERC721("Gumball", "GUMBALL") { owner = msg.sender; authorizedResolver = msg.sender; } function giveOwnership(address _address) external onlyOwner{ require(_address != address(0),"Cant renounce this contract"); owner = _address; } function setGumballAddress(address _addy) external onlyOwner{ gumballCoinAddress = _addy; } function setNewAuthorizer(address _addy) external onlyResolver{ authorizedResolver = _addy; } function setImageUrl(string memory url) external onlyOwner{ imageURL = url; } function updateGumballTable(uint256 _gumballType,uint256[] memory _winningsOdds, uint256[] memory _winningsAmount) external onlyOwner{ require(_winningsOdds.length == _winningsAmount.length,"Lists need to be the same length."); for(uint256 i = 0; i < _winningsOdds.length; i++){ gumballTypeToDropTableSlotOdds[_gumballType][i] = _winningsOdds[i]; gumballTypeToDropTableSlotWinnings[_gumballType][i] = _winningsAmount[i]; } } function updateTypeToTable(uint256[] memory _types, uint256[] memory _tableIds) external onlyOwner{ require(_types.length == _tableIds.length,"Lists need to be the same length."); for(uint256 i = 0; i < _tableIds.length; i++){ gumballTypeToDropTable[_types[i]] = _tableIds[i]; } } function updateTypeStaticWinnings(uint256[] memory _gumballType, uint256[] memory _winningsAmount) external onlyOwner{ require(_gumballType.length == _winningsAmount.length,"Lists need to be the same length."); for(uint256 i = 0; i < _winningsAmount.length; i++){ gumballTypeStaticWinnings[_gumballType[i]] = _winningsAmount[i]; } } receive() external payable { } function getBalance() public view returns(uint256){ return address(this).balance; } function getBalanceOfAddress(address _addy) public view returns(uint256){ return _addy.balance; } function getWinnings(uint256 _gumballType, uint256 _rolledNumber) public view returns(uint256){ uint256 index = 0; while(true){ if(_rolledNumber <= gumballTypeToDropTableSlotOdds[_gumballType][index]){ return gumballTypeToDropTableSlotWinnings[_gumballType][index]; } else { index++; } } return 0; } function initializeGumball(uint256[] memory _gumballID, bytes32[] memory _seedsList , uint256[] memory _typesList) external onlyResolver { require(_gumballID.length == _seedsList.length && _gumballID.length == _typesList.length,"Lists need to be the same length."); for(uint256 i = 0; i < _gumballID.length; i++){ uint256 tempId = _gumballID[i]; require(gumballState[tempId] == GumballState.MINTED,"This gumball needs to be in the MINTED state to be initialized."); gumballState[tempId] = GumballState.INITIALIZED; emit GumballInitialized(tempId,_seedsList[i], _typesList[i]); gumballType[tempId] = _typesList[i]; } } function resolveGumball(uint256[] memory _gumballID, bytes32[] memory _seedsList) external onlyResolver { require(_gumballID.length == _seedsList.length,"Lists need to be the same length."); for(uint256 i = 0; i < _gumballID.length; i++){ uint256 tempId = _gumballID[i]; require(gumballState[tempId] == GumballState.ACTIVATED,"This gumball needs to be in the ACTIVATED state to be resolved."); gumballState[tempId] = GumballState.RESOLVED; uint256 rolledNumber = uint256(bytes32(keccak256(abi.encodePacked(_seedsList[i])))); uint256 winnings = getWinnings(gumballTypeToDropTable[gumballType[tempId]], rolledNumber % 100000); uint256 winningsETH = (address(this).balance / 10000) * winnings; address winner = gumballActivatedBy[tempId]; emit GumballResolved(tempId,winnings,winningsETH,_seedsList[i]); payable(winner).transfer(winningsETH); } } function claimStaticGumballs(uint256[] memory _gumballID) external { for(uint256 i = 0; i < _gumballID.length; i++){ require(ownerOf(_gumballID[i]) == msg.sender,"You do not own this gumball."); require(gumballState[_gumballID[i]] == GumballState.INITIALIZED,"This gumball needs to be in the INITIALIZED state to be activated."); uint256 typeStaticWinnings = gumballTypeStaticWinnings[gumballType[_gumballID[i]]]; require( typeStaticWinnings > 0,"This gumball does not have static winnings and cannot be activated."); safeTransferFrom(msg.sender,address(this),_gumballID[i]); gumballState[_gumballID[i]] = GumballState.RESOLVED; emit GumballActivated(_gumballID[i]); uint256 winningsETH = (address(this).balance / 10000) * typeStaticWinnings; emit GumballResolved(_gumballID[i],typeStaticWinnings,winningsETH,bytes32(0)); payable(msg.sender).transfer(winningsETH); } } function activateGumball(uint256[] memory _gumballID) external { for(uint256 i = 0; i < _gumballID.length; i++){ require(ownerOf(_gumballID[i]) == msg.sender,"You do not own this gumball."); require(gumballState[_gumballID[i]] == GumballState.INITIALIZED,"This gumball needs to be in the INITIALIZED state to be activated."); require(gumballTypeStaticWinnings[gumballType[_gumballID[i]]] == 0,"This gumball has static winnings and cannot be activated."); safeTransferFrom(msg.sender,address(this),_gumballID[i]); gumballState[_gumballID[i]] = GumballState.ACTIVATED; gumballActivatedBy[_gumballID[i]] = msg.sender; emit GumballActivated(_gumballID[i]); } } function claimGumball(uint256[] memory _coinID) external { //In order to mint, the coin IDS must be transfered into this contract ERC_X gumballCoin = ERC_X(gumballCoinAddress); uint256 balanceBefore = gumballCoin.balanceOf(address(this)); uint256 tokensNeededForSuccess = _coinID.length * (1 * 10 ** 18); // 1 Coin, 18 decimals, is the UNITS for the 1155 tokens for(uint256 i = 0; i < _coinID.length; i++){ gumballCoin.safeTransferFrom(msg.sender,address(this),_coinID[i],1,""); _mint(msg.sender, tokenCount); gumballState[tokenCount] = GumballState.MINTED; emit GumballMinted(tokenCount); tokenCount++; } require(gumballCoin.balanceOf(address(this)) - balanceBefore == tokensNeededForSuccess,"Failed to receive tokens required."); } function uint2str(uint256 _i) internal pure returns (string memory _uintAsString) { if (_i == 0) { return "0"; } uint256 j = _i; uint256 len; while (j != 0) { len++; j /= 10; } bytes memory bstr = new bytes(len); uint256 k = len; while (_i != 0) { k = k - 1; uint8 temp = (48 + uint8(_i - (_i / 10) * 10)); bytes1 b1 = bytes1(temp); bstr[k] = b1; _i /= 10; } return string(bstr); } function getAttributeData(uint256 _gumballType) public view returns(string memory){ return string( abi.encodePacked( '{ "trait_type":"Gumball Type","value":"', uint2str(_gumballType), '"', "}" ) ); } function withdraw() external onlyOwner{ payable(owner).transfer(address(this).balance); } function withdrawTokens(address _tokenAddress) external onlyOwner{ IERC20 token = IERC20(_tokenAddress); token.transfer(payable(msg.sender), token.balanceOf(_tokenAddress)); } function withdrawGumballs(uint256[] memory _coinID) external onlyOwner{ ERC_X gumballCoin = ERC_X(gumballCoinAddress); for(uint256 i = 0; i < _coinID.length; i++){ gumballCoin.safeTransferFrom(address(this),msg.sender,_coinID[i],1,""); } } function withdrawamount(uint256 _amount) external onlyOwner { payable(owner).transfer(_amount); } function tokenURI(uint256 tokenId) public view override(ERC721) returns (string memory) { uint256 _gumballType = gumballType[tokenId]; return string.concat( "data:application/json;utf8,", string( abi.encodePacked( '{ "name": "GUMBALL #', uint2str(tokenId), '","attributes": [', getAttributeData(_gumballType), "]", ',"image" : "', imageURL, '%28', uint2str(_gumballType), "%29.png", ' ","external_url": "gumball.gg","description":"Claim this Gum Ball to get a share of the Prize Pool."', "}" ) ) ); } }
/** *Submitted for verification at Etherscan.io on 2024-02-11 */ //Inspired by all the great work out there from ERC20, 404, 721, 721a, 721Psi, 1155, 1155Delta // SPDX-License-Identifier: MIT pragma solidity 0.8.24; abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } /** * @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. * * The initial owner is set to the address provided by the deployer. 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; /** * @dev The caller account is not authorized to perform an operation. */ error OwnableUnauthorizedAccount(address account); /** * @dev The owner is not a valid owner account. (eg. `address(0)`) */ error OwnableInvalidOwner(address owner); event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the address provided by the deployer as the initial owner. */ constructor(address initialOwner) { if (initialOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _transferOwnership(initialOwner); } /** * @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 { if (owner() != _msgSender()) { revert OwnableUnauthorizedAccount(_msgSender()); } } /** * @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 { if (newOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _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); } } interface IERC20 { event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address to, uint256 value) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 value) external returns (bool); function transferFrom(address from, address to, uint256 value) external returns (bool); } interface IERC20Metadata is IERC20 { function name() external view returns (string memory); function symbol() external view returns (string memory); function decimals() external view returns (uint8); } interface IERC20Errors { error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed); error ERC20InvalidSender(address sender); error ERC20InvalidReceiver(address receiver); error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed); error ERC20InvalidApprover(address approver); error ERC20InvalidSpender(address spender); } /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } } interface IERCX { /** * The caller must own the token or be an approved operator. */ error ApprovalCallerNotOwnerNorApproved(); /** * Cannot query the balance for the zero address. */ error BalanceQueryForZeroAddress(); /** * Cannot mint to the zero address. */ error MintToZeroAddress(); /** * The quantity of tokens minted must be more than zero. */ error MintZeroQuantity(); /** * Cannot burn from the zero address. */ error BurnFromZeroAddress(); /** * Cannot burn from the address that doesn't owne the token. */ error BurnFromNonOnwerAddress(); /** * The caller must own the token or be an approved operator. */ error TransferCallerNotOwnerNorApproved(); /** * The token must be owned by `from` or the `amount` is not 1. */ error TransferFromIncorrectOwnerOrInvalidAmount(); /** * Cannot safely transfer to a contract that does not implement the * ERC1155Receiver interface. */ error TransferToNonERC1155ReceiverImplementer(); error TransferToNonERC721ReceiverImplementer(); /** * Cannot transfer to the zero address. */ error TransferToZeroAddress(); /** * The length of input arraies is not matching. */ error InputLengthMistmatch(); function isOwnerOf(address account, uint256 id) external view returns(bool); } /** * @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); } /** * @dev Interface that must be implemented by smart contracts in order to receive * ERC-1155 token transfers. */ interface IERC1155Receiver is IERC165 { /** * @dev Handles the receipt of a single ERC1155 token type. This function is * called at the end of a `safeTransferFrom` after the balance has been updated. * * NOTE: To accept the transfer, this must return * `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` * (i.e. 0xf23a6e61, or its own function selector). * * @param operator The address which initiated the transfer (i.e. msg.sender) * @param from The address which previously owned the token * @param id The ID of the token being transferred * @param value The amount of tokens being transferred * @param data Additional data with no specified format * @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed */ function onERC1155Received( address operator, address from, uint256 id, uint256 value, bytes calldata data ) external returns (bytes4); /** * @dev Handles the receipt of a multiple ERC1155 token types. This function * is called at the end of a `safeBatchTransferFrom` after the balances have * been updated. * * NOTE: To accept the transfer(s), this must return * `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` * (i.e. 0xbc197c81, or its own function selector). * * @param operator The address which initiated the batch transfer (i.e. msg.sender) * @param from The address which previously owned the token * @param ids An array containing ids of each token being transferred (order and length must match values array) * @param values An array containing amounts of each token being transferred (order and length must match ids array) * @param data Additional data with no specified format * @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed */ function onERC1155BatchReceived( address operator, address from, uint256[] calldata ids, uint256[] calldata values, bytes calldata data ) external returns (bytes4); } abstract contract ERC721Receiver { function onERC721Received( address, address, uint256, bytes calldata ) external virtual returns (bytes4) { return ERC721Receiver.onERC721Received.selector; } } /** * @dev Required interface of an ERC1155 compliant contract, as defined in the * https://eips.ethereum.org/EIPS/eip-1155[EIP]. * * _Available since v3.1._ */ interface IERC1155 is IERC165 { /** * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`. */ event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value); /** * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all * transfers. */ event TransferBatch( address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] values ); /** * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to * `approved`. */ event ApprovalForAll(address indexed account, address indexed operator, bool approved); /** * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI. * * If an {URI} event was emitted for `id`, the standard * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value * returned by {IERC1155MetadataURI-uri}. */ event URI(string value, uint256 indexed id); /** * @dev Returns the amount of tokens of token type `id` owned by `account`. * * Requirements: * * - `account` cannot be the zero address. */ function balanceOf(address account, uint256 id) external view returns (uint256); /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}. * * Requirements: * * - `accounts` and `ids` must have the same length. */ function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids) external view returns (uint256[] memory); /** * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`, * * Emits an {ApprovalForAll} event. * * Requirements: * * - `operator` cannot be the caller. */ function setApprovalForAll(address operator, bool approved) external; /** * @dev Returns true if `operator` is approved to transfer ``account``'s tokens. * * See {setApprovalForAll}. */ function isApprovedForAll(address account, address operator) external view returns (bool); /** * @dev Transfers `amount` tokens of token type `id` from `from` to `to`. * * Emits a {TransferSingle} event. * * Requirements: * * - `to` cannot be the zero address. * - If the caller is not `from`, it must be have been approved to spend ``from``'s tokens via {setApprovalForAll}. * - `from` must have a balance of tokens of type `id` of at least `amount`. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function safeTransferFrom( address from, address to, uint256 id, uint256 amount, bytes calldata data ) external; /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}. * * Emits a {TransferBatch} event. * * Requirements: * * - `ids` and `amounts` must have the same length. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the * acceptance magic value. */ function safeBatchTransferFrom( address from, address to, uint256[] calldata ids, uint256[] calldata amounts, bytes calldata data ) external; } /** * @dev Interface of the optional ERC1155MetadataExtension interface, as defined * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP]. * * _Available since v3.1._ */ interface IERC1155MetadataURI is IERC1155 { /** * @dev Returns the URI for token type `id`. * * If the `\{id\}` substring is present in the URI, it must be replaced by * clients with the actual token type ID. */ function uri(uint256 id) external view returns (string memory); } /** * @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; } } /// @notice Library for bit twiddling and boolean operations. /// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/LibBit.sol) /// @author Inspired by (https://graphics.stanford.edu/~seander/bithacks.html) library LibBit { /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* BIT TWIDDLING OPERATIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Find last set. /// Returns the index of the most significant bit of `x`, /// counting from the least significant bit position. /// If `x` is zero, returns 256. function fls(uint256 x) internal pure returns (uint256 r) { /// @solidity memory-safe-assembly assembly { r := or(shl(8, iszero(x)), shl(7, lt(0xffffffffffffffffffffffffffffffff, x))) r := or(r, shl(6, lt(0xffffffffffffffff, shr(r, x)))) r := or(r, shl(5, lt(0xffffffff, shr(r, x)))) r := or(r, shl(4, lt(0xffff, shr(r, x)))) r := or(r, shl(3, lt(0xff, shr(r, x)))) // forgefmt: disable-next-item r := or(r, byte(and(0x1f, shr(shr(r, x), 0x8421084210842108cc6318c6db6d54be)), 0x0706060506020504060203020504030106050205030304010505030400000000)) } } /// @dev Count leading zeros. /// Returns the number of zeros preceding the most significant one bit. /// If `x` is zero, returns 256. function clz(uint256 x) internal pure returns (uint256 r) { /// @solidity memory-safe-assembly assembly { r := shl(7, lt(0xffffffffffffffffffffffffffffffff, x)) r := or(r, shl(6, lt(0xffffffffffffffff, shr(r, x)))) r := or(r, shl(5, lt(0xffffffff, shr(r, x)))) r := or(r, shl(4, lt(0xffff, shr(r, x)))) r := or(r, shl(3, lt(0xff, shr(r, x)))) // forgefmt: disable-next-item r := add(xor(r, byte(and(0x1f, shr(shr(r, x), 0x8421084210842108cc6318c6db6d54be)), 0xf8f9f9faf9fdfafbf9fdfcfdfafbfcfef9fafdfafcfcfbfefafafcfbffffffff)), iszero(x)) } } /// @dev Find first set. /// Returns the index of the least significant bit of `x`, /// counting from the least significant bit position. /// If `x` is zero, returns 256. /// Equivalent to `ctz` (count trailing zeros), which gives /// the number of zeros following the least significant one bit. function ffs(uint256 x) internal pure returns (uint256 r) { /// @solidity memory-safe-assembly assembly { // Isolate the least significant bit. let b := and(x, add(not(x), 1)) r := or(shl(8, iszero(x)), shl(7, lt(0xffffffffffffffffffffffffffffffff, b))) r := or(r, shl(6, lt(0xffffffffffffffff, shr(r, b)))) r := or(r, shl(5, lt(0xffffffff, shr(r, b)))) // For the remaining 32 bits, use a De Bruijn lookup. // forgefmt: disable-next-item r := or(r, byte(and(div(0xd76453e0, shr(r, b)), 0x1f), 0x001f0d1e100c1d070f090b19131c1706010e11080a1a141802121b1503160405)) } } /// @dev Returns the number of set bits in `x`. function popCount(uint256 x) internal pure returns (uint256 c) { /// @solidity memory-safe-assembly assembly { let max := not(0) let isMax := eq(x, max) x := sub(x, and(shr(1, x), div(max, 3))) x := add(and(x, div(max, 5)), and(shr(2, x), div(max, 5))) x := and(add(x, shr(4, x)), div(max, 17)) c := or(shl(8, isMax), shr(248, mul(x, div(max, 255)))) } } /// @dev Returns whether `x` is a power of 2. function isPo2(uint256 x) internal pure returns (bool result) { /// @solidity memory-safe-assembly assembly { // Equivalent to `x && !(x & (x - 1))`. result := iszero(add(and(x, sub(x, 1)), iszero(x))) } } /// @dev Returns `x` reversed at the bit level. function reverseBits(uint256 x) internal pure returns (uint256 r) { uint256 m0 = 0x0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f; uint256 m1 = m0 ^ (m0 << 2); uint256 m2 = m1 ^ (m1 << 1); r = reverseBytes(x); r = (m2 & (r >> 1)) | ((m2 & r) << 1); r = (m1 & (r >> 2)) | ((m1 & r) << 2); r = (m0 & (r >> 4)) | ((m0 & r) << 4); } /// @dev Returns `x` reversed at the byte level. function reverseBytes(uint256 x) internal pure returns (uint256 r) { unchecked { // Computing masks on-the-fly reduces bytecode size by about 200 bytes. uint256 m0 = 0x100000000000000000000000000000001 * (~toUint(x == 0) >> 192); uint256 m1 = m0 ^ (m0 << 32); uint256 m2 = m1 ^ (m1 << 16); uint256 m3 = m2 ^ (m2 << 8); r = (m3 & (x >> 8)) | ((m3 & x) << 8); r = (m2 & (r >> 16)) | ((m2 & r) << 16); r = (m1 & (r >> 32)) | ((m1 & r) << 32); r = (m0 & (r >> 64)) | ((m0 & r) << 64); r = (r >> 128) | (r << 128); } } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* BOOLEAN OPERATIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ // A Solidity bool on the stack or memory is represented as a 256-bit word. // Non-zero values are true, zero is false. // A clean bool is either 0 (false) or 1 (true) under the hood. // Usually, if not always, the bool result of a regular Solidity expression, // or the argument of a public/external function will be a clean bool. // You can usually use the raw variants for more performance. // If uncertain, test (best with exact compiler settings). // Or use the non-raw variants (compiler can sometimes optimize out the double `iszero`s). /// @dev Returns `x & y`. Inputs must be clean. function rawAnd(bool x, bool y) internal pure returns (bool z) { /// @solidity memory-safe-assembly assembly { z := and(x, y) } } /// @dev Returns `x & y`. function and(bool x, bool y) internal pure returns (bool z) { /// @solidity memory-safe-assembly assembly { z := and(iszero(iszero(x)), iszero(iszero(y))) } } /// @dev Returns `x | y`. Inputs must be clean. function rawOr(bool x, bool y) internal pure returns (bool z) { /// @solidity memory-safe-assembly assembly { z := or(x, y) } } /// @dev Returns `x | y`. function or(bool x, bool y) internal pure returns (bool z) { /// @solidity memory-safe-assembly assembly { z := or(iszero(iszero(x)), iszero(iszero(y))) } } /// @dev Returns 1 if `b` is true, else 0. Input must be clean. function rawToUint(bool b) internal pure returns (uint256 z) { /// @solidity memory-safe-assembly assembly { z := b } } /// @dev Returns 1 if `b` is true, else 0. function toUint(bool b) internal pure returns (uint256 z) { /// @solidity memory-safe-assembly assembly { z := iszero(iszero(b)) } } } /// @notice Library for storage of packed unsigned booleans. /// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/LibBitmap.sol) /// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/LibBitmap.sol) /// @author Modified from Solidity-Bits (https://github.com/estarriolvetch/solidity-bits/blob/main/contracts/BitMaps.sol) library LibBitmap { /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* CONSTANTS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The constant returned when a bitmap scan does not find a result. uint256 internal constant NOT_FOUND = type(uint256).max; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* STRUCTS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev A bitmap in storage. struct Bitmap { mapping(uint256 => uint256) map; } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* OPERATIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Returns the boolean value of the bit at `index` in `bitmap`. function get(Bitmap storage bitmap, uint256 index) internal view returns (bool isSet) { // It is better to set `isSet` to either 0 or 1, than zero vs non-zero. // Both cost the same amount of gas, but the former allows the returned value // to be reused without cleaning the upper bits. uint256 b = (bitmap.map[index >> 8] >> (index & 0xff)) & 1; /// @solidity memory-safe-assembly assembly { isSet := b } } /// @dev Updates the bit at `index` in `bitmap` to true. function set(Bitmap storage bitmap, uint256 index) internal { bitmap.map[index >> 8] |= (1 << (index & 0xff)); } /// @dev Updates the bit at `index` in `bitmap` to false. function unset(Bitmap storage bitmap, uint256 index) internal { bitmap.map[index >> 8] &= ~(1 << (index & 0xff)); } /// @dev Flips the bit at `index` in `bitmap`. /// Returns the boolean result of the flipped bit. function toggle(Bitmap storage bitmap, uint256 index) internal returns (bool newIsSet) { /// @solidity memory-safe-assembly assembly { mstore(0x20, bitmap.slot) mstore(0x00, shr(8, index)) let storageSlot := keccak256(0x00, 0x40) let shift := and(index, 0xff) let storageValue := xor(sload(storageSlot), shl(shift, 1)) // It makes sense to return the `newIsSet`, // as it allow us to skip an additional warm `sload`, // and it costs minimal gas (about 15), // which may be optimized away if the returned value is unused. newIsSet := and(1, shr(shift, storageValue)) sstore(storageSlot, storageValue) } } /// @dev Updates the bit at `index` in `bitmap` to `shouldSet`. function setTo(Bitmap storage bitmap, uint256 index, bool shouldSet) internal { /// @solidity memory-safe-assembly assembly { mstore(0x20, bitmap.slot) mstore(0x00, shr(8, index)) let storageSlot := keccak256(0x00, 0x40) let storageValue := sload(storageSlot) let shift := and(index, 0xff) sstore( storageSlot, // Unsets the bit at `shift` via `and`, then sets its new value via `or`. or(and(storageValue, not(shl(shift, 1))), shl(shift, iszero(iszero(shouldSet)))) ) } } /// @dev Consecutively sets `amount` of bits starting from the bit at `start`. function setBatch(Bitmap storage bitmap, uint256 start, uint256 amount) internal { /// @solidity memory-safe-assembly assembly { let max := not(0) let shift := and(start, 0xff) mstore(0x20, bitmap.slot) mstore(0x00, shr(8, start)) if iszero(lt(add(shift, amount), 257)) { let storageSlot := keccak256(0x00, 0x40) sstore(storageSlot, or(sload(storageSlot), shl(shift, max))) let bucket := add(mload(0x00), 1) let bucketEnd := add(mload(0x00), shr(8, add(amount, shift))) amount := and(add(amount, shift), 0xff) shift := 0 for {} iszero(eq(bucket, bucketEnd)) { bucket := add(bucket, 1) } { mstore(0x00, bucket) sstore(keccak256(0x00, 0x40), max) } mstore(0x00, bucket) } let storageSlot := keccak256(0x00, 0x40) sstore(storageSlot, or(sload(storageSlot), shl(shift, shr(sub(256, amount), max)))) } } /// @dev Consecutively unsets `amount` of bits starting from the bit at `start`. function unsetBatch(Bitmap storage bitmap, uint256 start, uint256 amount) internal { /// @solidity memory-safe-assembly assembly { let shift := and(start, 0xff) mstore(0x20, bitmap.slot) mstore(0x00, shr(8, start)) if iszero(lt(add(shift, amount), 257)) { let storageSlot := keccak256(0x00, 0x40) sstore(storageSlot, and(sload(storageSlot), not(shl(shift, not(0))))) let bucket := add(mload(0x00), 1) let bucketEnd := add(mload(0x00), shr(8, add(amount, shift))) amount := and(add(amount, shift), 0xff) shift := 0 for {} iszero(eq(bucket, bucketEnd)) { bucket := add(bucket, 1) } { mstore(0x00, bucket) sstore(keccak256(0x00, 0x40), 0) } mstore(0x00, bucket) } let storageSlot := keccak256(0x00, 0x40) sstore( storageSlot, and(sload(storageSlot), not(shl(shift, shr(sub(256, amount), not(0))))) ) } } /// @dev Returns number of set bits within a range by /// scanning `amount` of bits starting from the bit at `start`. function popCount(Bitmap storage bitmap, uint256 start, uint256 amount) internal view returns (uint256 count) { unchecked { uint256 bucket = start >> 8; uint256 shift = start & 0xff; if (!(amount + shift < 257)) { count = LibBit.popCount(bitmap.map[bucket] >> shift); uint256 bucketEnd = bucket + ((amount + shift) >> 8); amount = (amount + shift) & 0xff; shift = 0; for (++bucket; bucket != bucketEnd; ++bucket) { count += LibBit.popCount(bitmap.map[bucket]); } } count += LibBit.popCount((bitmap.map[bucket] >> shift) << (256 - amount)); } } /// @dev Returns the index of the most significant set bit before the bit at `before`. /// If no set bit is found, returns `NOT_FOUND`. function findLastSet(Bitmap storage bitmap, uint256 before) internal view returns (uint256 setBitIndex) { uint256 bucket; uint256 bucketBits; /// @solidity memory-safe-assembly assembly { setBitIndex := not(0) bucket := shr(8, before) mstore(0x00, bucket) mstore(0x20, bitmap.slot) let offset := and(0xff, not(before)) // `256 - (255 & before) - 1`. bucketBits := shr(offset, shl(offset, sload(keccak256(0x00, 0x40)))) if iszero(or(bucketBits, iszero(bucket))) { for {} 1 {} { bucket := add(bucket, setBitIndex) // `sub(bucket, 1)`. mstore(0x00, bucket) bucketBits := sload(keccak256(0x00, 0x40)) if or(bucketBits, iszero(bucket)) { break } } } } if (bucketBits != 0) { setBitIndex = (bucket << 8) | LibBit.fls(bucketBits); /// @solidity memory-safe-assembly assembly { setBitIndex := or(setBitIndex, sub(0, gt(setBitIndex, before))) } } } } contract ERCX is Context, ERC165, IERC1155, IERC1155MetadataURI, IERCX, IERC20Metadata, IERC20Errors, Ownable { using Address for address; using LibBitmap for LibBitmap.Bitmap; error InvalidQueryRange(); // The mask of the lower 160 bits for addresses. uint256 private constant _BITMASK_ADDRESS = (1 << 160) - 1; // The `Transfer` event signature is given by: // `keccak256(bytes("Transfer(address,address,uint256)"))`. bytes32 private constant _TRANSFER_EVENT_SIGNATURE = 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef; // Mapping from accout to owned tokens mapping(address => LibBitmap.Bitmap) internal _owned; // Mapping from account to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; // Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json string private _uri; // The next token ID to be minted. uint256 private _currentIndex; // NFT Approval mapping(uint256 => address) public getApproved; //Token balances mapping(address => uint256) internal _balances; //Token allowances mapping(address account => mapping(address spender => uint256)) private _allowances; // Token name string public name; // Token symbol string public symbol; // Decimals for supply uint8 public immutable decimals; // Total ERC20 supply uint256 public immutable totalSupply; // Tokens Per NFT uint256 public immutable decimalFactor; uint256 public immutable tokensPerNFT; // Don't mint for these wallets mapping(address => bool) public whitelist; // Easy Launch - auto-whitelist first transfer which is probably the LP uint256 public easyLaunch = 10; /** * @dev See {_setURI}. */ constructor(string memory uri_, string memory _name, string memory _symbol, uint8 _decimals, uint256 _totalNativeSupply, uint256 _tokensPerNFT) Ownable(msg.sender) { _setURI(uri_); _currentIndex = _startTokenId(); name = _name; symbol = _symbol; decimals = _decimals; decimalFactor = 10 ** decimals; tokensPerNFT = _tokensPerNFT * decimalFactor; totalSupply = _totalNativeSupply * decimalFactor; whitelist[msg.sender] = false; _balances[msg.sender] = totalSupply; emit Transfer(address(0), msg.sender, totalSupply); } /** @notice Initialization function to set pairs / etc * saving gas by avoiding mint / burn on unnecessary targets */ function setWhitelist(address target, bool state) public virtual onlyOwner { whitelist[target] = state; } /** * @dev Returns the starting token ID. * To change the starting token ID, please override this function. */ function _startTokenId() internal pure virtual returns (uint256) { return 1; } /** * @dev Returns the next token ID to be minted. */ function _nextTokenId() internal view returns (uint256) { return _currentIndex; } /** * @dev Returns the total amount of tokens minted in the contract. */ function _totalMinted() internal view returns (uint256) { return _nextTokenId() - _startTokenId(); } /** * @dev Returns true if the account owns the `id` token. */ function isOwnerOf(address account, uint256 id) public view virtual override returns(bool) { return _owned[account].get(id); } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC1155).interfaceId || interfaceId == type(IERC1155MetadataURI).interfaceId || interfaceId == type(IERCX).interfaceId || interfaceId == 0x80ac58cd || // ERC165 interface ID for ERC721. interfaceId == 0x5b5e139f || // ERC165 interface ID for ERC721Metadata. super.supportsInterface(interfaceId); } /** * @dev See {IERC1155MetadataURI-uri}. * * This implementation returns the same URI for *all* token types. It relies * on the token type ID substitution mechanism * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP]. * * Clients calling this function must replace the `\{id\}` substring with the * actual token type ID. */ function uri(uint256) public view virtual override returns (string memory) { return _uri; } /** * @dev Returns the number of tokens owned by `owner`. */ function balanceOf(address owner) public view virtual returns (uint256) { return _balances[owner]; } /** * @dev Returns the number of nfts owned by `owner`, * in the range [`start`, `stop`) * (i.e. `start <= tokenId < stop`). * * Requirements: * * - `start < stop` */ function balanceOf(address owner, uint256 start, uint256 stop) public view virtual returns (uint256) { return _owned[owner].popCount(start, stop - start); } /** * @dev See {IERC1155-balanceOf}. * * Requirements: * * - `account` cannot be the zero address. */ function balanceOf(address account, uint256 id) public view virtual override returns (uint256) { if(account == address(0)) { revert BalanceQueryForZeroAddress(); } if(_owned[account].get(id)) { return 1; } else { return 0; } } /** * @dev See {IERC1155-balanceOfBatch}. * * Requirements: * * - `accounts` and `ids` must have the same length. */ function balanceOfBatch(address[] memory accounts, uint256[] memory ids) public view virtual override returns (uint256[] memory) { if(accounts.length != ids.length) { revert InputLengthMistmatch(); } uint256[] memory batchBalances = new uint256[](accounts.length); for (uint256 i = 0; i < accounts.length; ++i) { batchBalances[i] = balanceOf(accounts[i], ids[i]); } return batchBalances; } /** * @dev See {IERC1155-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { _setApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC1155-isApprovedForAll}. */ function isApprovedForAll(address account, address operator) public view virtual override returns (bool) { return _operatorApprovals[account][operator]; } /** * @dev See {IERC1155-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 id, uint256 amount, bytes memory data ) public virtual override { if(from == _msgSender() || isApprovedForAll(from, _msgSender())){ _safeTransferFrom(from, to, id, amount, data, true); } else { revert TransferCallerNotOwnerNorApproved(); } } /** * @dev See {IERC1155-safeBatchTransferFrom}. */ function safeBatchTransferFrom( address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) public virtual override { if(!(from == _msgSender() || isApprovedForAll(from, _msgSender()))) { revert TransferCallerNotOwnerNorApproved(); } _safeBatchTransferFrom(from, to, ids, amounts, data); } /** * @dev Transfers `amount` tokens of token type `id` from `from` to `to`. * * Emits a {TransferSingle} event. * * Requirements: * * - `to` cannot be the zero address. * - `amount` cannot be zero. * - `from` must have a balance of tokens of type `id` of at least `amount`. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function _safeTransferFrom( address from, address to, uint256 id, uint256 amount, bytes memory data, bool check ) internal virtual { if(to == address(0)) { revert TransferToZeroAddress(); } address operator = _msgSender(); uint256[] memory ids = _asSingletonArray(id); _beforeTokenTransfer(operator, from, to, ids); if(amount == 1 && _owned[from].get(id)) { _owned[from].unset(id); _owned[to].set(id); _transfer(from, to, tokensPerNFT, false); } else { revert TransferFromIncorrectOwnerOrInvalidAmount(); } uint256 toMasked; uint256 fromMasked; assembly { // Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean. toMasked := and(to, _BITMASK_ADDRESS) fromMasked := and(from, _BITMASK_ADDRESS) // Emit the `Transfer` event. log4( 0, // Start of data (0, since no data). 0, // End of data (0, since no data). _TRANSFER_EVENT_SIGNATURE, // Signature. fromMasked, // `from`. toMasked, // `to`. amount // `tokenId`. ) } emit TransferSingle(operator, from, to, id, amount); _afterTokenTransfer(operator, from, to, ids); if(check) _doSafeTransferAcceptanceCheck(operator, from, to, id, amount, data); } /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_safeTransferFrom}. * * Emits a {TransferBatch} event. * * Requirements: * * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the * acceptance magic value. */ function _safeBatchTransferFrom( address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual { if(ids.length != amounts.length) { revert InputLengthMistmatch(); } if(to == address(0)) { revert TransferToZeroAddress(); } address operator = _msgSender(); _beforeTokenTransfer(operator, from, to, ids); for (uint256 i = 0; i < ids.length; ++i) { uint256 id = ids[i]; uint256 amount = amounts[i]; if(amount == 1 && _owned[from].get(id)) { _owned[from].unset(id); _owned[to].set(id); } else { revert TransferFromIncorrectOwnerOrInvalidAmount(); } } _transfer(from, to, tokensPerNFT * ids.length, false); uint256 toMasked; uint256 fromMasked; uint256 end = ids.length + 1; // Use assembly to loop and emit the `Transfer` event for gas savings. // The duplicated `log4` removes an extra check and reduces stack juggling. // The assembly, together with the surrounding Solidity code, have been // delicately arranged to nudge the compiler into producing optimized opcodes. assembly { // Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean. fromMasked := and(from, _BITMASK_ADDRESS) toMasked := and(to, _BITMASK_ADDRESS) // Emit the `Transfer` event. log4( 0, // Start of data (0, since no data). 0, // End of data (0, since no data). _TRANSFER_EVENT_SIGNATURE, // Signature. fromMasked, // `from`. toMasked, // `to`. mload(add(ids, 0x20)) // `tokenId`. ) // The `iszero(eq(,))` check ensures that large values of `quantity` // that overflows uint256 will make the loop run out of gas. // The compiler will optimize the `iszero` away for performance. for { let arrayId := 2 } iszero(eq(arrayId, end)) { arrayId := add(arrayId, 1) } { // Emit the `Transfer` event. Similar to above. log4(0, 0, _TRANSFER_EVENT_SIGNATURE, fromMasked, toMasked, mload(add(ids, mul(0x20, arrayId)))) } } emit TransferBatch(operator, from, to, ids, amounts); _afterTokenTransfer(operator, from, to, ids); _doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, amounts, data); } /** * @dev Sets a new URI for all token types, by relying on the token type ID * substitution mechanism * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP]. * * By this mechanism, any occurrence of the `\{id\}` substring in either the * URI or any of the amounts in the JSON file at said URI will be replaced by * clients with the token type ID. * * For example, the `https://token-cdn-domain/\{id\}.json` URI would be * interpreted by clients as * `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json` * for token type ID 0x4cce0. * * See {uri}. * * Because these URIs cannot be meaningfully represented by the {URI} event, * this function emits no events. */ function _setURI(string memory newuri) internal virtual { _uri = newuri; } function _mint( address to, uint256 amount ) internal virtual { _mint(to, amount, ""); } /** * @dev Creates `amount` tokens, and assigns them to `to`. * * Emits a {TransferBatch} event. * * Requirements: * * - `to` cannot be the zero address. * - `amount` cannot be zero. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function _mint( address to, uint256 amount, bytes memory data ) internal virtual { (uint256[] memory ids, uint256[] memory amounts) = _mintWithoutCheck(to, amount); uint256 end = _currentIndex; _doSafeBatchTransferAcceptanceCheck(_msgSender(), address(0), to, ids, amounts, data); if (_currentIndex != end) revert(); } function _mintWithoutCheck( address to, uint256 amount ) internal virtual returns(uint256[] memory ids, uint256[] memory amounts) { if(to == address(0)) { revert MintToZeroAddress(); } if(amount == 0) { revert MintZeroQuantity(); } address operator = _msgSender(); ids = new uint256[](amount); amounts = new uint256[](amount); uint256 startTokenId = _nextTokenId(); unchecked { require(type(uint256).max - amount >= startTokenId); for(uint256 i = 0; i < amount; i++) { ids[i] = startTokenId + i; amounts[i] = 1; } } _beforeTokenTransfer(operator, address(0), to, ids); _owned[to].setBatch(startTokenId, amount); _currentIndex += amount; uint256 toMasked; uint256 end = startTokenId + amount; assembly { toMasked := and(to, _BITMASK_ADDRESS) log4( 0, 0, _TRANSFER_EVENT_SIGNATURE, 0, toMasked, startTokenId ) for { let tokenId := add(startTokenId, 1) } iszero(eq(tokenId, end)) { tokenId := add(tokenId, 1) } { log4(0, 0, _TRANSFER_EVENT_SIGNATURE, 0, toMasked, tokenId) } } emit TransferBatch(operator, address(0), to, ids, amounts); _afterTokenTransfer(operator, address(0), to, ids); } /** * @dev Destroys token of token type `id` from `from` * * Emits a {TransferSingle} event. * * Requirements: * * - `from` cannot be the zero address. * - `from` must have the token of token type `id`. */ function _burn( address from, uint256 id ) internal virtual { if(from == address(0)){ revert BurnFromZeroAddress(); } address operator = _msgSender(); uint256[] memory ids = _asSingletonArray(id); _beforeTokenTransfer(operator, from, address(0), ids); if(!_owned[from].get(id)) { revert BurnFromNonOnwerAddress(); } _owned[from].unset(id); uint256 fromMasked; assembly { fromMasked := and(from, _BITMASK_ADDRESS) log4( 0, 0, _TRANSFER_EVENT_SIGNATURE, fromMasked, 0, id ) } emit TransferSingle(operator, from, address(0), id, 1); _afterTokenTransfer(operator, from, address(0), ids); } /** * @dev Destroys tokens of token types in `ids` from `from` * * Emits a {TransferBatch} event. * * Requirements: * * - `from` cannot be the zero address. * - `from` must have the token of token types in `ids`. */ function _burnBatch( address from, uint256[] memory ids ) internal virtual { if(from == address(0)){ revert BurnFromZeroAddress(); } address operator = _msgSender(); uint256[] memory amounts = new uint256[](ids.length); _beforeTokenTransfer(operator, from, address(0), ids); unchecked { for(uint256 i = 0; i < ids.length; i++) { amounts[i] = 1; uint256 id = ids[i]; if(!_owned[from].get(id)) { revert BurnFromNonOnwerAddress(); } _owned[from].unset(id); } } uint256 fromMasked; uint256 end = ids.length + 1; assembly { fromMasked := and(from, _BITMASK_ADDRESS) log4( 0, 0, _TRANSFER_EVENT_SIGNATURE, fromMasked, 0, mload(add(ids, 0x20)) ) for { let arrayId := 2 } iszero(eq(arrayId, end)) { arrayId := add(arrayId, 1) } { log4(0, 0, _TRANSFER_EVENT_SIGNATURE, fromMasked, 0, mload(add(ids, mul(0x20, arrayId)))) } } emit TransferBatch(operator, from, address(0), ids, amounts); _afterTokenTransfer(operator, from, address(0), ids); } function _burnBatch( address from, uint256 amount ) internal virtual { if(from == address(0)){ revert BurnFromZeroAddress(); } address operator = _msgSender(); uint256 searchFrom = _nextTokenId(); uint256[] memory amounts = new uint256[](amount); uint256[] memory ids = new uint256[](amount); unchecked { for(uint256 i = 0; i < amount; i++) { amounts[i] = 1; uint256 id = _owned[from].findLastSet(searchFrom); ids[i] = id; _owned[from].unset(id); searchFrom = id; } } //technically after, but we didn't have the IDs then _beforeTokenTransfer(operator, from, address(0), ids); uint256 fromMasked; uint256 end = amount + 1; assembly { fromMasked := and(from, _BITMASK_ADDRESS) log4( 0, 0, _TRANSFER_EVENT_SIGNATURE, fromMasked, 0, mload(add(ids, 0x20)) ) for { let arrayId := 2 } iszero(eq(arrayId, end)) { arrayId := add(arrayId, 1) } { log4(0, 0, _TRANSFER_EVENT_SIGNATURE, fromMasked, 0, mload(add(ids, mul(0x20, arrayId)))) } } if(amount == 1) emit TransferSingle(operator, from, address(0), ids[0], 1); else emit TransferBatch(operator, from, address(0), ids, amounts); _afterTokenTransfer(operator, from, address(0), ids); } /** * @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, "ERC1155: setting approval status for self"); _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } /** * @dev Hook that is called before any token transfer. This includes minting * and burning, as well as batched variants. * * The same hook is called on both single and batched variants. For single * transfers, the length of the `ids` and `amounts` arrays will be 1. * * Calling conditions (for each `id` and `amount` pair): * * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens * of token type `id` will be transferred to `to`. * - When `from` is zero, `amount` tokens of token type `id` will be minted * for `to`. * - when `to` is zero, `amount` of ``from``'s tokens of token type `id` * will be burned. * - `from` and `to` are never both zero. * - `ids` and `amounts` have the same, non-zero length. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address operator, address from, address to, uint256[] memory ids ) internal virtual {} /** * @dev Hook that is called after any token transfer. This includes minting * and burning, as well as batched variants. * * The same hook is called on both single and batched variants. For single * transfers, the length of the `id` and `amount` arrays will be 1. * * Calling conditions (for each `id` and `amount` pair): * * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens * of token type `id` will be transferred to `to`. * - When `from` is zero, `amount` tokens of token type `id` will be minted * for `to`. * - when `to` is zero, `amount` of ``from``'s tokens of token type `id` * will be burned. * - `from` and `to` are never both zero. * - `ids` and `amounts` have the same, non-zero length. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address operator, address from, address to, uint256[] memory ids ) internal virtual {} function _doSafeTransferAcceptanceCheck( address operator, address from, address to, uint256 id, uint256 amount, bytes memory data ) private { if (to.isContract()) { if (IERC165(to).supportsInterface(type(IERC1155).interfaceId)) { try IERC1155Receiver(to).onERC1155Received(operator, from, id, amount, data) returns (bytes4 response) { if (response != IERC1155Receiver.onERC1155Received.selector) { revert TransferToNonERC1155ReceiverImplementer(); } } catch Error(string memory reason) { revert(reason); } catch { revert TransferToNonERC1155ReceiverImplementer(); } } else { try ERC721Receiver(to).onERC721Received(operator, from, id, data) returns (bytes4 response) { if (response != ERC721Receiver.onERC721Received.selector) { revert TransferToNonERC721ReceiverImplementer(); } } catch Error(string memory reason) { revert(reason); } catch { revert TransferToNonERC721ReceiverImplementer(); } } } } function _doSafeBatchTransferAcceptanceCheck( address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) private { if (to.isContract()) { try IERC1155Receiver(to).onERC1155BatchReceived(operator, from, ids, amounts, data) returns ( bytes4 response ) { if (response != IERC1155Receiver.onERC1155BatchReceived.selector) { revert TransferToNonERC1155ReceiverImplementer(); } } catch Error(string memory reason) { revert(reason); } catch { revert TransferToNonERC1155ReceiverImplementer(); } } } function _asSingletonArray(uint256 element) private pure returns (uint256[] memory array) { array = new uint256[](1); array[0] = element; } function transfer(address to, uint256 value) public virtual returns (bool) { address owner = msg.sender; _transfer(owner, to, value, true); return true; } function allowance(address owner, address spender) public view virtual returns (uint256) { return _allowances[owner][spender]; } function approve(address spender, uint256 value) public virtual returns (bool) { address owner = msg.sender; if (value < _nextTokenId() && value > 0) { if(!isOwnerOf(owner, value)) { revert ERC20InvalidSender(owner); } getApproved[value] = spender; emit Approval(owner, spender, value); } else { _approve(owner, spender, value); } return true; } /// @notice Function for mixed transfers /// @dev This function assumes id / native if amount less than or equal to current max id function transferFrom(address from, address to, uint256 value) public virtual returns (bool) { if (value < _nextTokenId()) { if(!_owned[from].get(value)) { revert ERC20InvalidSpender(from); } if ( msg.sender != from && !isApprovedForAll(from, msg.sender) && msg.sender != getApproved[value] ) { revert ERC20InvalidSpender(msg.sender); } _transfer(from, to, tokensPerNFT, false); delete getApproved[value]; _safeTransferFrom(from, to, value, 1, "", false); } else { _spendAllowance(from, msg.sender, value); _transfer(from, to, value, true); } return true; } function _transfer(address from, address to, uint256 value, bool mint) internal { if (from == address(0)) { revert ERC20InvalidSender(address(0)); } if (to == address(0)) { revert ERC20InvalidReceiver(address(0)); } _update(from, to, value, mint); } function _update(address from, address to, uint256 value, bool mint) internal virtual { uint256 fromBalance = _balances[from]; if (fromBalance < value) { revert ERC20InsufficientBalance(from, fromBalance, value); } unchecked { // Overflow not possible: value <= fromBalance <= totalSupply. _balances[from] -= value; // Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256. _balances[to] += value; } uint256 toBalance = _balances[to]; emit Transfer(from, to, value); if(mint) { // Skip burn for certain addresses to save gas bool wlf = whitelist[from]; if (!wlf) { uint256 tokens_to_burn = (fromBalance / tokensPerNFT) - ((fromBalance - value) / tokensPerNFT); if(tokens_to_burn > 0) _burnBatch(from, tokens_to_burn); } // Skip minting for certain addresses to save gas if (!whitelist[to]) { if(easyLaunch == 1 && wlf && from == owner()) { //auto-initialize first (assumed) LP whitelist[to] = true; easyLaunch = 2; } else { uint256 tokens_to_mint = (toBalance / tokensPerNFT) - ((toBalance - value) / tokensPerNFT); if(tokens_to_mint > 0) _mintWithoutCheck(to, tokens_to_mint); } } } } function _approve(address owner, address spender, uint256 value) internal { _approve(owner, spender, value, true); } function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual { if (owner == address(0)) { revert ERC20InvalidApprover(address(0)); } if (spender == address(0)) { revert ERC20InvalidSpender(address(0)); } _allowances[owner][spender] = value; if (emitEvent) { emit Approval(owner, spender, value); } } function _spendAllowance(address owner, address spender, uint256 value) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { if (currentAllowance < value) { revert ERC20InsufficientAllowance(spender, currentAllowance, value); } unchecked { _approve(owner, spender, currentAllowance - value, false); } } } /** * @dev Returns an array of token IDs owned by `owner`, * in the range [`start`, `stop`) * (i.e. `start <= tokenId < stop`). * * This function allows for tokens to be queried if the collection * grows too big for a single call of {ERC1155DelataQueryable-tokensOfOwner}. * * Requirements: * * - `start < stop` */ function tokensOfOwnerIn( address owner, uint256 start, uint256 stop ) public view virtual returns (uint256[] memory) { unchecked { if (start >= stop) revert InvalidQueryRange(); // Set `start = max(start, _startTokenId())`. if (start < _startTokenId()) { start = _startTokenId(); } // Set `stop = min(stop, stopLimit)`. uint256 stopLimit = _nextTokenId(); if (stop > stopLimit) { stop = stopLimit; } uint256 tokenIdsLength; if(start < stop) { tokenIdsLength = balanceOf(owner, start, stop); } else { tokenIdsLength = 0; } uint256[] memory tokenIds = new uint256[](tokenIdsLength); LibBitmap.Bitmap storage bmap = _owned[owner]; for ((uint256 i, uint256 tokenIdsIdx) = (start, 0); tokenIdsIdx != tokenIdsLength; ++i) { if(bmap.get(i) ) { tokenIds[tokenIdsIdx++] = i; } } return tokenIds; } } /** * @dev Returns an array of token IDs owned by `owner`. * * This function scans the ownership mapping and is O(`totalSupply`) in complexity. * It is meant to be called off-chain. * * See {ERC1155DeltaQueryable-tokensOfOwnerIn} for splitting the scan into * multiple smaller scans if the collection is large enough to cause * an out-of-gas error (10K collections should be fine). */ function tokensOfOwner(address owner) public view virtual returns (uint256[] memory) { if(_totalMinted() == 0) { return new uint256[](0); } return tokensOfOwnerIn(owner, _startTokenId(), _nextTokenId()); } } contract ERC_X is ERCX { using Strings for uint256; string public baseTokenURI; string public dataURI; uint8 private constant _decimals = 18; uint256 private constant _totalTokens = 10000; uint256 private constant _tokensPerNFT = 1; string private constant _name = "Gumball Machine"; string private constant _ticker = "GUM"; uint256 public maxWallet; bool public transferDelay = false; mapping (address => uint256) private delayTimer; constructor() ERCX("", _name, _ticker, _decimals, _totalTokens, _tokensPerNFT) { dataURI = "https://brown-premier-mollusk-514.mypinata.cloud/ipfs/QmSvFBnE22Y29Ga6Ukjj4G6JnkrwcuZbQtgdmChheuEtv2"; maxWallet = (_totalTokens * 10 ** _decimals) * 100 / 100; } function _afterTokenTransfer( address operator, address from, address to, uint256[] memory ids ) internal override { if(!whitelist[to]) { require(_balances[to] <= maxWallet, "Transfer exceeds maximum wallet"); if (transferDelay) { require(delayTimer[tx.origin] < block.number,"Only one transfer per block allowed."); delayTimer[tx.origin] = block.number; require(address(to).code.length == 0 && address(tx.origin).code.length == 0, "Contract trading restricted at launch"); } } super._afterTokenTransfer(operator, from, to, ids); } function setDataURI(string memory _dataURI) public onlyOwner { dataURI = _dataURI; } function toggleDelay() external onlyOwner { transferDelay = !transferDelay; } function setMaxWallet(uint256 percent) external onlyOwner { maxWallet = totalSupply * percent / 100; } function setTokenURI(string memory _tokenURI) public onlyOwner { baseTokenURI = _tokenURI; } function setURI(string memory newuri) external onlyOwner { _setURI(newuri); } function uint2str(uint256 _i) internal pure returns (string memory _uintAsString) { if (_i == 0) { return "0"; } uint256 j = _i; uint256 len; while (j != 0) { len++; j /= 10; } bytes memory bstr = new bytes(len); uint256 k = len; while (_i != 0) { k = k - 1; uint8 temp = (48 + uint8(_i - (_i / 10) * 10)); bytes1 b1 = bytes1(temp); bstr[k] = b1; _i /= 10; } return string(bstr); } function tokenURI(uint256 id) public view returns (string memory) { return string.concat( "data:application/json;utf8,", string( abi.encodePacked( '{ "name": "Gumball #', uint2str(id), '","image" : "', dataURI, ' ","external_url": "gumball.gg","description":"Use this token to claim your gumball."', "}" ) ) ); } function uri(uint256 id) public view override returns (string memory) { return tokenURI(id); } }
{ "evmVersion": "istanbul", "optimizer": { "enabled": true, "runs": 200 }, "libraries": { "TokenB.sol": {} }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ERC721EnumerableForbiddenBatchMint","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"owner","type":"address"}],"name":"ERC721IncorrectOwner","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ERC721InsufficientApproval","type":"error"},{"inputs":[{"internalType":"address","name":"approver","type":"address"}],"name":"ERC721InvalidApprover","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"ERC721InvalidOperator","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"ERC721InvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC721InvalidReceiver","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"ERC721InvalidSender","type":"error"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ERC721NonexistentToken","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"ERC721OutOfBoundsIndex","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":false,"internalType":"uint256","name":"gumballID","type":"uint256"}],"name":"GumballActivated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"gumballID","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"seed","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"gumballType","type":"uint256"}],"name":"GumballInitialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"gumballID","type":"uint256"}],"name":"GumballMinted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"gumballID","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"winningsPercent","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"winnings","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"seed","type":"bytes32"}],"name":"GumballResolved","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"},{"inputs":[{"internalType":"uint256[]","name":"_gumballID","type":"uint256[]"}],"name":"activateGumball","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"authorizedResolver","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_coinID","type":"uint256[]"}],"name":"claimGumball","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_gumballID","type":"uint256[]"}],"name":"claimStaticGumballs","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_gumballType","type":"uint256"}],"name":"getAttributeData","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_addy","type":"address"}],"name":"getBalanceOfAddress","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_gumballType","type":"uint256"},{"internalType":"uint256","name":"_rolledNumber","type":"uint256"}],"name":"getWinnings","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"giveOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"gumballActivatedBy","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"gumballCoinAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"gumballState","outputs":[{"internalType":"enum Gumball.GumballState","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"gumballType","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"gumballTypeStaticWinnings","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"gumballTypeToDropTable","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"gumballTypeToDropTableSlotOdds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"gumballTypeToDropTableSlotWinnings","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"imageURL","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_gumballID","type":"uint256[]"},{"internalType":"bytes32[]","name":"_seedsList","type":"bytes32[]"},{"internalType":"uint256[]","name":"_typesList","type":"uint256[]"}],"name":"initializeGumball","outputs":[],"stateMutability":"nonpayable","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":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","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":[{"internalType":"uint256[]","name":"_gumballID","type":"uint256[]"},{"internalType":"bytes32[]","name":"_seedsList","type":"bytes32[]"}],"name":"resolveGumball","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":"address","name":"_addy","type":"address"}],"name":"setGumballAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"url","type":"string"}],"name":"setImageUrl","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_addy","type":"address"}],"name":"setNewAuthorizer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_gumballType","type":"uint256"},{"internalType":"uint256[]","name":"_winningsOdds","type":"uint256[]"},{"internalType":"uint256[]","name":"_winningsAmount","type":"uint256[]"}],"name":"updateGumballTable","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_gumballType","type":"uint256[]"},{"internalType":"uint256[]","name":"_winningsAmount","type":"uint256[]"}],"name":"updateTypeStaticWinnings","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_types","type":"uint256[]"},{"internalType":"uint256[]","name":"_tableIds","type":"uint256[]"}],"name":"updateTypeToTable","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_coinID","type":"uint256[]"}],"name":"withdrawGumballs","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_tokenAddress","type":"address"}],"name":"withdrawTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdrawamount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
6080604052600b80546001600160a01b03191673a72332af4a7efbce221903e7a09175be64f0400d1790553480156200003757600080fd5b506040518060400160405280600781526020016611dd5b58985b1b60ca1b8152506040518060400160405280600781526020016611d5535090531360ca1b81525081600090816200008991906200016a565b5060016200009882826200016a565b5050600a8054336001600160a01b03199182168117909255600c805490911690911790555062000236565b634e487b7160e01b600052604160045260246000fd5b600181811c90821680620000ee57607f821691505b6020821081036200010f57634e487b7160e01b600052602260045260246000fd5b50919050565b601f82111562000165576000816000526020600020601f850160051c81016020861015620001405750805b601f850160051c820191505b8181101562000161578281556001016200014c565b5050505b505050565b81516001600160401b03811115620001865762000186620000c3565b6200019e81620001978454620000d9565b8462000115565b602080601f831160018114620001d65760008415620001bd5750858301515b600019600386901b1c1916600185901b17855562000161565b600085815260208120601f198616915b828110156200020757888601518255948401946001909101908401620001e6565b5085821015620002265787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b61370f80620002466000396000f3fe6080604052600436106102b25760003560e01c80636f122e5b11610175578063a665c4a4116100dc578063c5812b5a11610095578063d34138ae1161006f578063d34138ae146108ec578063dbdca7e714610924578063e3a0a14814610951578063e985e9c51461097157600080fd5b8063c5812b5a14610876578063c87b56dd146108ac578063cefe7e9b146108cc57600080fd5b8063a665c4a4146107a1578063a9ec6d28146107c9578063b88d4fde14610801578063b90497e014610821578063bed4171114610836578063befb15941461085657600080fd5b80638da5cb5b1161012e5780638da5cb5b146106e95780638dbeacaf1461070957806390dbaec41461072957806395d89b41146107565780639f181b5e1461076b578063a22cb4651461078157600080fd5b80636f122e5b1461060c5780636f5b18c61461062c57806370a082311461064c578063769f07a41461066c57806377352a461461068c57806388ae7cc6146106c957600080fd5b806324d42598116102195780633ccfd60b116101d25780633ccfd60b1461055757806342842e0e1461056c57806349df728c1461058c5780634f6ccce7146105ac578063535f263a146105cc5780636352211e146105ec57600080fd5b806324d425981461048a5780632abff1f2146104b75780632d38d98f146104d75780632f745c59146104f75780633ae1280d146105175780633cb565f61461053757600080fd5b80630e59b9f01161026b5780630e59b9f0146103bd57806312065fe0146103dd578063150b7a02146103f057806318160ddd146104355780631ebdf2461461044a57806323b872dd1461046a57600080fd5b806301421434146102be57806301ffc9a7146102f157806306fdde0314610321578063081812fc14610343578063095ea7b31461037b5780630c2979d21461039d57600080fd5b366102b957005b600080fd5b3480156102ca57600080fd5b506102de6102d9366004612a5f565b610991565b6040519081526020015b60405180910390f35b3480156102fd57600080fd5b5061031161030c366004612a97565b6109ed565b60405190151581526020016102e8565b34801561032d57600080fd5b50610336610a12565b6040516102e89190612b0b565b34801561034f57600080fd5b5061036361035e366004612b1e565b610aa4565b6040516001600160a01b0390911681526020016102e8565b34801561038757600080fd5b5061039b610396366004612b53565b610acd565b005b3480156103a957600080fd5b50600c54610363906001600160a01b031681565b3480156103c957600080fd5b5061039b6103d8366004612b1e565b610adc565b3480156103e957600080fd5b50476102de565b3480156103fc57600080fd5b5061041c61040b366004612b7d565b630a85bd0160e11b95945050505050565b6040516001600160e01b031990911681526020016102e8565b34801561044157600080fd5b506008546102de565b34801561045657600080fd5b5061039b610465366004612cdf565b610b49565b34801561047657600080fd5b5061039b610485366004612d67565b610d4b565b34801561049657600080fd5b506102de6104a5366004612b1e565b60116020526000908152604090205481565b3480156104c357600080fd5b5061039b6104d2366004612dfb565b610dd0565b3480156104e357600080fd5b5061039b6104f2366004612e44565b610e06565b34801561050357600080fd5b506102de610512366004612b53565b610ed5565b34801561052357600080fd5b5061039b610532366004612e78565b610f3a565b34801561054357600080fd5b5061039b610552366004612ead565b611273565b34801561056357600080fd5b5061039b6112bf565b34801561057857600080fd5b5061039b610587366004612d67565b611325565b34801561059857600080fd5b5061039b6105a7366004612ead565b611345565b3480156105b857600080fd5b506102de6105c7366004612b1e565b611452565b3480156105d857600080fd5b5061039b6105e7366004612e78565b6114ab565b3480156105f857600080fd5b50610363610607366004612b1e565b61175b565b34801561061857600080fd5b5061039b610627366004612ec8565b611766565b34801561063857600080fd5b50600b54610363906001600160a01b031681565b34801561065857600080fd5b506102de610667366004612ead565b611810565b34801561067857600080fd5b50610336610687366004612b1e565b611858565b34801561069857600080fd5b506106bc6106a7366004612b1e565b60146020526000908152604090205460ff1681565b6040516102e89190612f42565b3480156106d557600080fd5b5061039b6106e4366004612e78565b611889565b3480156106f557600080fd5b50600a54610363906001600160a01b031681565b34801561071557600080fd5b5061039b610724366004612ec8565b611aea565b34801561073557600080fd5b506102de610744366004612b1e565b60136020526000908152604090205481565b34801561076257600080fd5b50610336611d7b565b34801561077757600080fd5b506102de600d5481565b34801561078d57600080fd5b5061039b61079c366004612f78565b611d8a565b3480156107ad57600080fd5b506102de6107bc366004612ead565b6001600160a01b03163190565b3480156107d557600080fd5b506102de6107e4366004612a5f565b600f60209081526000928352604080842090915290825290205481565b34801561080d57600080fd5b5061039b61081c366004612faf565b611d95565b34801561082d57600080fd5b50610336611dad565b34801561084257600080fd5b5061039b610851366004612ec8565b611e3b565b34801561086257600080fd5b5061039b610871366004612ead565b611ee5565b34801561088257600080fd5b50610363610891366004612b1e565b6015602052600090815260409020546001600160a01b031681565b3480156108b857600080fd5b506103366108c7366004612b1e565b611f31565b3480156108d857600080fd5b5061039b6108e7366004612e78565b611fa7565b3480156108f857600080fd5b506102de610907366004612a5f565b601060209081526000928352604080842090915290825290205481565b34801561093057600080fd5b506102de61093f366004612b1e565b60126020526000908152604090205481565b34801561095d57600080fd5b5061039b61096c366004612ead565b612073565b34801561097d57600080fd5b5061031161098c36600461302b565b612115565b6000805b6000848152600f6020908152604080832084845290915290205483116109d5576000848152601060209081526040808320938352929052205490506109e7565b806109df81613074565b915050610995565b92915050565b60006001600160e01b0319821663780e9d6360e01b14806109e757506109e782612143565b606060008054610a219061308d565b80601f0160208091040260200160405190810160405280929190818152602001828054610a4d9061308d565b8015610a9a5780601f10610a6f57610100808354040283529160200191610a9a565b820191906000526020600020905b815481529060010190602001808311610a7d57829003601f168201915b5050505050905090565b6000610aaf82612193565b506000828152600460205260409020546001600160a01b03166109e7565b610ad88282336121cc565b5050565b600a546001600160a01b03163314610b0f5760405162461bcd60e51b8152600401610b06906130c7565b60405180910390fd5b600a546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610ad8573d6000803e3d6000fd5b600c546001600160a01b03163314610b735760405162461bcd60e51b8152600401610b06906130eb565b81518351148015610b85575080518351145b610ba15760405162461bcd60e51b8152600401610b0690613112565b60005b8351811015610d45576000848281518110610bc157610bc1613153565b6020026020010151905060016004811115610bde57610bde612f2c565b60008281526014602052604090205460ff166004811115610c0157610c01612f2c565b14610c745760405162461bcd60e51b815260206004820152603f60248201527f546869732067756d62616c6c206e6565647320746f20626520696e207468652060448201527f4d494e54454420737461746520746f20626520696e697469616c697a65642e006064820152608401610b06565b6000818152601460205260409020805460ff1916600217905583517fe9a7d20110c061e972cb4558d66a60a6985932b6436194a95e9ae85644b0665e908290869085908110610cc557610cc5613153565b6020026020010151858581518110610cdf57610cdf613153565b6020026020010151604051610d07939291909283526020830191909152604082015260600190565b60405180910390a1828281518110610d2157610d21613153565b60209081029190910181015160009283526012909152604090912055600101610ba4565b50505050565b6001600160a01b038216610d7557604051633250574960e11b815260006004820152602401610b06565b6000610d828383336121d9565b9050836001600160a01b0316816001600160a01b031614610d45576040516364283d7b60e01b81526001600160a01b0380861660048301526024820184905282166044820152606401610b06565b600a546001600160a01b03163314610dfa5760405162461bcd60e51b8152600401610b06906130c7565b600e610ad882826131b1565b600a546001600160a01b03163314610e305760405162461bcd60e51b8152600401610b06906130c7565b8051825114610e515760405162461bcd60e51b8152600401610b0690613112565b60005b8251811015610d4557828181518110610e6f57610e6f613153565b6020908102919091018101516000868152600f8352604080822085835290935291909120558151829082908110610ea857610ea8613153565b60209081029190910181015160008681526010835260408082208583529093529190912055600101610e54565b6000610ee083611810565b8210610f115760405163295f44f760e21b81526001600160a01b038416600482015260248101839052604401610b06565b506001600160a01b03919091166000908152600660209081526040808320938352929052205490565b60005b8151811015610ad857336001600160a01b0316610f72838381518110610f6557610f65613153565b602002602001015161175b565b6001600160a01b031614610fc85760405162461bcd60e51b815260206004820152601c60248201527f596f7520646f206e6f74206f776e20746869732067756d62616c6c2e000000006044820152606401610b06565b600260146000848481518110610fe057610fe0613153565b60209081029190910181015182528101919091526040016000205460ff16600481111561100f5761100f612f2c565b1461102c5760405162461bcd60e51b8152600401610b0690613271565b6000601360006012600086868151811061104857611048613153565b60200260200101518152602001908152602001600020548152602001908152602001600020549050600081116110f25760405162461bcd60e51b815260206004820152604360248201527f546869732067756d62616c6c20646f6573206e6f74206861766520737461746960448201527f632077696e6e696e677320616e642063616e6e6f74206265206163746976617460648201526232b21760e91b608482015260a401610b06565b611116333085858151811061110957611109613153565b6020026020010151611325565b60046014600085858151811061112e5761112e613153565b6020026020010151815260200190815260200160002060006101000a81548160ff0219169083600481111561116557611165612f2c565b02179055507fd973cd3f3ebda40a8c254cfc1038258bb964a61df27293d4e0aa1951038bf8d383838151811061119d5761119d613153565b60200260200101516040516111b491815260200190565b60405180910390a16000816111cb612710476132ef565b6111d59190613303565b90507ffcd3fdaadc9f9f4ea62870a544a0ad0375e0661f05404b9596fc367c66f32e3884848151811061120a5761120a613153565b602090810291909101810151604080519182529181018590529081018390526000606082015260800160405180910390a1604051339082156108fc029083906000818181858888f19350505050158015611268573d6000803e3d6000fd5b505050600101610f3d565b600a546001600160a01b0316331461129d5760405162461bcd60e51b8152600401610b06906130c7565b600b80546001600160a01b0319166001600160a01b0392909216919091179055565b600a546001600160a01b031633146112e95760405162461bcd60e51b8152600401610b06906130c7565b600a546040516001600160a01b03909116904780156108fc02916000818181858888f19350505050158015611322573d6000803e3d6000fd5b50565b61134083838360405180602001604052806000815250611d95565b505050565b600a546001600160a01b0316331461136f5760405162461bcd60e51b8152600401610b06906130c7565b6040516370a0823160e01b81526001600160a01b03821660048201819052829163a9059cbb90339083906370a0823190602401602060405180830381865afa1580156113bf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113e3919061331a565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af115801561142e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113409190613333565b600061145d60085490565b82106114865760405163295f44f760e21b81526000600482015260248101839052604401610b06565b6008828154811061149957611499613153565b90600052602060002001549050919050565b60005b8151811015610ad857336001600160a01b03166114d6838381518110610f6557610f65613153565b6001600160a01b03161461152c5760405162461bcd60e51b815260206004820152601c60248201527f596f7520646f206e6f74206f776e20746869732067756d62616c6c2e000000006044820152606401610b06565b60026014600084848151811061154457611544613153565b60209081029190910181015182528101919091526040016000205460ff16600481111561157357611573612f2c565b146115905760405162461bcd60e51b8152600401610b0690613271565b60136000601260008585815181106115aa576115aa613153565b60200260200101518152602001908152602001600020548152602001908152602001600020546000146116455760405162461bcd60e51b815260206004820152603960248201527f546869732067756d62616c6c20686173207374617469632077696e6e696e677360448201527f20616e642063616e6e6f74206265206163746976617465642e000000000000006064820152608401610b06565b61165c333084848151811061110957611109613153565b60036014600084848151811061167457611674613153565b6020026020010151815260200190815260200160002060006101000a81548160ff021916908360048111156116ab576116ab612f2c565b021790555033601560008484815181106116c7576116c7613153565b6020026020010151815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b031602179055507fd973cd3f3ebda40a8c254cfc1038258bb964a61df27293d4e0aa1951038bf8d382828151811061173457611734613153565b602002602001015160405161174b91815260200190565b60405180910390a16001016114ae565b60006109e782612193565b600a546001600160a01b031633146117905760405162461bcd60e51b8152600401610b06906130c7565b80518251146117b15760405162461bcd60e51b8152600401610b0690613112565b60005b8151811015611340578181815181106117cf576117cf613153565b6020026020010151601160008584815181106117ed576117ed613153565b6020908102919091018101518252810191909152604001600020556001016117b4565b60006001600160a01b03821661183c576040516322718ad960e21b815260006004820152602401610b06565b506001600160a01b031660009081526003602052604090205490565b6060611863826122ae565b604051602001611873919061336c565b6040516020818303038152906040529050919050565b600b546040516370a0823160e01b81523060048201526001600160a01b039091169060009082906370a0823190602401602060405180830381865afa1580156118d6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118fa919061331a565b905060008351670de0b6b3a76400006119139190613303565b905060005b8451811015611a1b57836001600160a01b031663f242432a333088858151811061194457611944613153565b602002602001015160016040518563ffffffff1660e01b815260040161196d94939291906133d6565b600060405180830381600087803b15801561198757600080fd5b505af115801561199b573d6000803e3d6000fd5b505050506119ab33600d546123da565b600d8054600090815260146020908152604091829020805460ff19166001179055915490519081527fd6fa52e45c8f83f9c0476cde38bd4d40b57d831c607fe25b2f7b0e220a7ba8c3910160405180910390a1600d8054906000611a0e83613074565b9091555050600101611918565b506040516370a0823160e01b8152306004820152819083906001600160a01b038616906370a0823190602401602060405180830381865afa158015611a64573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a88919061331a565b611a92919061340e565b14610d455760405162461bcd60e51b815260206004820152602260248201527f4661696c656420746f207265636569766520746f6b656e732072657175697265604482015261321760f11b6064820152608401610b06565b600c546001600160a01b03163314611b145760405162461bcd60e51b8152600401610b06906130eb565b8051825114611b355760405162461bcd60e51b8152600401610b0690613112565b60005b8251811015611340576000838281518110611b5557611b55613153565b6020026020010151905060036004811115611b7257611b72612f2c565b60008281526014602052604090205460ff166004811115611b9557611b95612f2c565b14611c085760405162461bcd60e51b815260206004820152603f60248201527f546869732067756d62616c6c206e6565647320746f20626520696e207468652060448201527f41435449564154454420737461746520746f206265207265736f6c7665642e006064820152608401610b06565b6000818152601460205260408120805460ff191660041790558351849084908110611c3557611c35613153565b6020026020010151604051602001611c4f91815260200190565b60408051601f198184030181529181528151602092830120600085815260128452828120548152601190935290822054909250611c93906102d9620186a085613421565b9050600081611ca4612710476132ef565b611cae9190613303565b60008581526015602052604090205487519192506001600160a01b0316907ffcd3fdaadc9f9f4ea62870a544a0ad0375e0661f05404b9596fc367c66f32e38908690859085908b908b908110611d0657611d06613153565b6020908102919091018101516040805195865291850193909352830152606082015260800160405180910390a16040516001600160a01b0382169083156108fc029084906000818181858888f19350505050158015611d69573d6000803e3d6000fd5b505060019094019350611b3892505050565b606060018054610a219061308d565b610ad833838361243f565b611da0848484610d4b565b610d4533858585856124de565b600e8054611dba9061308d565b80601f0160208091040260200160405190810160405280929190818152602001828054611de69061308d565b8015611e335780601f10611e0857610100808354040283529160200191611e33565b820191906000526020600020905b815481529060010190602001808311611e1657829003601f168201915b505050505081565b600a546001600160a01b03163314611e655760405162461bcd60e51b8152600401610b06906130c7565b8051825114611e865760405162461bcd60e51b8152600401610b0690613112565b60005b815181101561134057818181518110611ea457611ea4613153565b602002602001015160136000858481518110611ec257611ec2613153565b602090810291909101810151825281019190915260400160002055600101611e89565b600c546001600160a01b03163314611f0f5760405162461bcd60e51b8152600401610b06906130eb565b600c80546001600160a01b0319166001600160a01b0392909216919091179055565b600081815260126020526040902054606090611f4c836122ae565b611f5582611858565b600e611f60846122ae565b604051602001611f739493929190613435565b60408051601f1981840301815290829052611f909160200161360b565b604051602081830303815290604052915050919050565b600a546001600160a01b03163314611fd15760405162461bcd60e51b8152600401610b06906130c7565b600b546001600160a01b031660005b825181101561134057816001600160a01b031663f242432a303386858151811061200c5761200c613153565b602002602001015160016040518563ffffffff1660e01b815260040161203594939291906133d6565b600060405180830381600087803b15801561204f57600080fd5b505af1158015612063573d6000803e3d6000fd5b505060019092019150611fe09050565b600a546001600160a01b0316331461209d5760405162461bcd60e51b8152600401610b06906130c7565b6001600160a01b0381166120f35760405162461bcd60e51b815260206004820152601b60248201527f43616e742072656e6f756e6365207468697320636f6e747261637400000000006044820152606401610b06565b600a80546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b60006001600160e01b031982166380ac58cd60e01b148061217457506001600160e01b03198216635b5e139f60e01b145b806109e757506301ffc9a760e01b6001600160e01b03198316146109e7565b6000818152600260205260408120546001600160a01b0316806109e757604051637e27328960e01b815260048101849052602401610b06565b6113408383836001612609565b6000806121e785858561270f565b90506001600160a01b0381166122445761223f84600880546000838152600960205260408120829055600182018355919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30155565b612267565b846001600160a01b0316816001600160a01b031614612267576122678185612808565b6001600160a01b0385166122835761227e84612899565b6122a6565b846001600160a01b0316816001600160a01b0316146122a6576122a68585612948565b949350505050565b6060816000036122d55750506040805180820190915260018152600360fc1b602082015290565b8160005b81156122ff57806122e981613074565b91506122f89050600a836132ef565b91506122d9565b60008167ffffffffffffffff81111561231a5761231a612c18565b6040519080825280601f01601f191660200182016040528015612344576020820181803683370190505b509050815b85156123d15761235a60018261340e565b90506000612369600a886132ef565b61237490600a613303565b61237e908861340e565b612389906030613650565b905060008160f81b9050808484815181106123a6576123a6613153565b60200101906001600160f81b031916908160001a9053506123c8600a896132ef565b97505050612349565b50949350505050565b6001600160a01b03821661240457604051633250574960e11b815260006004820152602401610b06565b6000612412838360006121d9565b90506001600160a01b03811615611340576040516339e3563760e11b815260006004820152602401610b06565b6001600160a01b03821661247157604051630b61174360e31b81526001600160a01b0383166004820152602401610b06565b6001600160a01b03838116600081815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6001600160a01b0383163b1561260257604051630a85bd0160e11b81526001600160a01b0384169063150b7a0290612520908890889087908790600401613669565b6020604051808303816000875af192505050801561255b575060408051601f3d908101601f19168201909252612558918101906136a6565b60015b6125c4573d808015612589576040519150601f19603f3d011682016040523d82523d6000602084013e61258e565b606091505b5080516000036125bc57604051633250574960e11b81526001600160a01b0385166004820152602401610b06565b805181602001fd5b6001600160e01b03198116630a85bd0160e11b1461260057604051633250574960e11b81526001600160a01b0385166004820152602401610b06565b505b5050505050565b808061261d57506001600160a01b03821615155b156126df57600061262d84612193565b90506001600160a01b038316158015906126595750826001600160a01b0316816001600160a01b031614155b801561266c575061266a8184612115565b155b156126955760405163a9fbf51f60e01b81526001600160a01b0384166004820152602401610b06565b81156126dd5783856001600160a01b0316826001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45b505b5050600090815260046020526040902080546001600160a01b0319166001600160a01b0392909216919091179055565b6000828152600260205260408120546001600160a01b039081169083161561273c5761273c818486612998565b6001600160a01b0381161561277a57612759600085600080612609565b6001600160a01b038116600090815260036020526040902080546000190190555b6001600160a01b038516156127a9576001600160a01b0385166000908152600360205260409020805460010190555b60008481526002602052604080822080546001600160a01b0319166001600160a01b0389811691821790925591518793918516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4949350505050565b600061281383611810565b600083815260076020526040902054909150808214612866576001600160a01b03841660009081526006602090815260408083208584528252808320548484528184208190558352600790915290208190555b5060009182526007602090815260408084208490556001600160a01b039094168352600681528383209183525290812055565b6008546000906128ab9060019061340e565b600083815260096020526040812054600880549394509092849081106128d3576128d3613153565b9060005260206000200154905080600883815481106128f4576128f4613153565b600091825260208083209091019290925582815260099091526040808220849055858252812055600880548061292c5761292c6136c3565b6001900381819060005260206000200160009055905550505050565b6000600161295584611810565b61295f919061340e565b6001600160a01b039093166000908152600660209081526040808320868452825280832085905593825260079052919091209190915550565b6129a38383836129fc565b611340576001600160a01b0383166129d157604051637e27328960e01b815260048101829052602401610b06565b60405163177e802f60e01b81526001600160a01b038316600482015260248101829052604401610b06565b60006001600160a01b038316158015906122a65750826001600160a01b0316846001600160a01b03161480612a365750612a368484612115565b806122a65750506000908152600460205260409020546001600160a01b03908116911614919050565b60008060408385031215612a7257600080fd5b50508035926020909101359150565b6001600160e01b03198116811461132257600080fd5b600060208284031215612aa957600080fd5b8135612ab481612a81565b9392505050565b60005b83811015612ad6578181015183820152602001612abe565b50506000910152565b60008151808452612af7816020860160208601612abb565b601f01601f19169290920160200192915050565b602081526000612ab46020830184612adf565b600060208284031215612b3057600080fd5b5035919050565b80356001600160a01b0381168114612b4e57600080fd5b919050565b60008060408385031215612b6657600080fd5b612b6f83612b37565b946020939093013593505050565b600080600080600060808688031215612b9557600080fd5b612b9e86612b37565b9450612bac60208701612b37565b935060408601359250606086013567ffffffffffffffff80821115612bd057600080fd5b818801915088601f830112612be457600080fd5b813581811115612bf357600080fd5b896020828501011115612c0557600080fd5b9699959850939650602001949392505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715612c5757612c57612c18565b604052919050565b600082601f830112612c7057600080fd5b8135602067ffffffffffffffff821115612c8c57612c8c612c18565b8160051b612c9b828201612c2e565b9283528481018201928281019087851115612cb557600080fd5b83870192505b84831015612cd457823582529183019190830190612cbb565b979650505050505050565b600080600060608486031215612cf457600080fd5b833567ffffffffffffffff80821115612d0c57600080fd5b612d1887838801612c5f565b94506020860135915080821115612d2e57600080fd5b612d3a87838801612c5f565b93506040860135915080821115612d5057600080fd5b50612d5d86828701612c5f565b9150509250925092565b600080600060608486031215612d7c57600080fd5b612d8584612b37565b9250612d9360208501612b37565b9150604084013590509250925092565b600067ffffffffffffffff831115612dbd57612dbd612c18565b612dd0601f8401601f1916602001612c2e565b9050828152838383011115612de457600080fd5b828260208301376000602084830101529392505050565b600060208284031215612e0d57600080fd5b813567ffffffffffffffff811115612e2457600080fd5b8201601f81018413612e3557600080fd5b6122a684823560208401612da3565b600080600060608486031215612e5957600080fd5b83359250602084013567ffffffffffffffff80821115612d2e57600080fd5b600060208284031215612e8a57600080fd5b813567ffffffffffffffff811115612ea157600080fd5b6122a684828501612c5f565b600060208284031215612ebf57600080fd5b612ab482612b37565b60008060408385031215612edb57600080fd5b823567ffffffffffffffff80821115612ef357600080fd5b612eff86838701612c5f565b93506020850135915080821115612f1557600080fd5b50612f2285828601612c5f565b9150509250929050565b634e487b7160e01b600052602160045260246000fd5b6020810160058310612f6457634e487b7160e01b600052602160045260246000fd5b91905290565b801515811461132257600080fd5b60008060408385031215612f8b57600080fd5b612f9483612b37565b91506020830135612fa481612f6a565b809150509250929050565b60008060008060808587031215612fc557600080fd5b612fce85612b37565b9350612fdc60208601612b37565b925060408501359150606085013567ffffffffffffffff811115612fff57600080fd5b8501601f8101871361301057600080fd5b61301f87823560208401612da3565b91505092959194509250565b6000806040838503121561303e57600080fd5b61304783612b37565b915061305560208401612b37565b90509250929050565b634e487b7160e01b600052601160045260246000fd5b6000600182016130865761308661305e565b5060010190565b600181811c908216806130a157607f821691505b6020821081036130c157634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252600a908201526937b7363c9037bbb732b960b11b604082015260600190565b6020808252600d908201526c37b7363c903932b9b7b63b32b960991b604082015260600190565b60208082526021908201527f4c69737473206e65656420746f206265207468652073616d65206c656e6774686040820152601760f91b606082015260800190565b634e487b7160e01b600052603260045260246000fd5b601f821115611340576000816000526020600020601f850160051c810160208610156131925750805b601f850160051c820191505b818110156126005782815560010161319e565b815167ffffffffffffffff8111156131cb576131cb612c18565b6131df816131d9845461308d565b84613169565b602080601f83116001811461321457600084156131fc5750858301515b600019600386901b1c1916600185901b178555612600565b600085815260208120601f198616915b8281101561324357888601518255948401946001909101908401613224565b50858210156132615787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60208082526042908201527f546869732067756d62616c6c206e6565647320746f20626520696e207468652060408201527f494e495449414c495a454420737461746520746f206265206163746976617465606082015261321760f11b608082015260a00190565b634e487b7160e01b600052601260045260246000fd5b6000826132fe576132fe6132d9565b500490565b80820281158282048414176109e7576109e761305e565b60006020828403121561332c57600080fd5b5051919050565b60006020828403121561334557600080fd5b8151612ab481612f6a565b60008151613362818560208601612abb565b9290920192915050565b7f7b202274726169745f74797065223a2247756d62616c6c2054797065222c227681526630b63ab2911d1160c91b6020820152600082516133b4816027850160208701612abb565b601160f91b6027939091019283015250607d60f81b6028820152602901919050565b6001600160a01b0394851681529290931660208301526040820152606081019190915260a06080820181905260009082015260c00190565b818103818111156109e7576109e761305e565b600082613430576134306132d9565b500690565b737b20226e616d65223a202247554d42414c4c202360601b8152845160009060206134668260148601838b01612abb565b70222c2261747472696275746573223a205b60781b6014928501928301528651613497816025850160208b01612abb565b605d60f81b602593909101928301526b161134b6b0b3b291101d101160a11b602683015285546032906000906134cc8161308d565b600182811680156134e457600181146134ff57613531565b60ff1984166032890152603283151584028901019450613531565b8b600052602060002060005b848110156135265781548a820189015290830190880161350b565b505060328389010194505b505050506135fd6135f061356d61355a613554856204a64760eb1b815260030190565b8b613350565b662532392e706e6760c81b815260070190565b7f20222c2265787465726e616c5f75726c223a202267756d62616c6c2e6767222c81527f226465736372697074696f6e223a22436c61696d20746869732047756d20426160208201527f6c6c20746f206765742061207368617265206f6620746865205072697a65205060408201526437b7b6171160d91b606082015260650190565b607d60f81b815260010190565b9a9950505050505050505050565b7f646174613a6170706c69636174696f6e2f6a736f6e3b757466382c000000000081526000825161364381601b850160208701612abb565b91909101601b0192915050565b60ff81811683821601908111156109e7576109e761305e565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061369c90830184612adf565b9695505050505050565b6000602082840312156136b857600080fd5b8151612ab481612a81565b634e487b7160e01b600052603160045260246000fdfea264697066735822122053867798538da6b8d20f4e1004befc406b9f4a10e5347c82b32ddc41b764a63e64736f6c63430008180033
Deployed Bytecode
0x6080604052600436106102b25760003560e01c80636f122e5b11610175578063a665c4a4116100dc578063c5812b5a11610095578063d34138ae1161006f578063d34138ae146108ec578063dbdca7e714610924578063e3a0a14814610951578063e985e9c51461097157600080fd5b8063c5812b5a14610876578063c87b56dd146108ac578063cefe7e9b146108cc57600080fd5b8063a665c4a4146107a1578063a9ec6d28146107c9578063b88d4fde14610801578063b90497e014610821578063bed4171114610836578063befb15941461085657600080fd5b80638da5cb5b1161012e5780638da5cb5b146106e95780638dbeacaf1461070957806390dbaec41461072957806395d89b41146107565780639f181b5e1461076b578063a22cb4651461078157600080fd5b80636f122e5b1461060c5780636f5b18c61461062c57806370a082311461064c578063769f07a41461066c57806377352a461461068c57806388ae7cc6146106c957600080fd5b806324d42598116102195780633ccfd60b116101d25780633ccfd60b1461055757806342842e0e1461056c57806349df728c1461058c5780634f6ccce7146105ac578063535f263a146105cc5780636352211e146105ec57600080fd5b806324d425981461048a5780632abff1f2146104b75780632d38d98f146104d75780632f745c59146104f75780633ae1280d146105175780633cb565f61461053757600080fd5b80630e59b9f01161026b5780630e59b9f0146103bd57806312065fe0146103dd578063150b7a02146103f057806318160ddd146104355780631ebdf2461461044a57806323b872dd1461046a57600080fd5b806301421434146102be57806301ffc9a7146102f157806306fdde0314610321578063081812fc14610343578063095ea7b31461037b5780630c2979d21461039d57600080fd5b366102b957005b600080fd5b3480156102ca57600080fd5b506102de6102d9366004612a5f565b610991565b6040519081526020015b60405180910390f35b3480156102fd57600080fd5b5061031161030c366004612a97565b6109ed565b60405190151581526020016102e8565b34801561032d57600080fd5b50610336610a12565b6040516102e89190612b0b565b34801561034f57600080fd5b5061036361035e366004612b1e565b610aa4565b6040516001600160a01b0390911681526020016102e8565b34801561038757600080fd5b5061039b610396366004612b53565b610acd565b005b3480156103a957600080fd5b50600c54610363906001600160a01b031681565b3480156103c957600080fd5b5061039b6103d8366004612b1e565b610adc565b3480156103e957600080fd5b50476102de565b3480156103fc57600080fd5b5061041c61040b366004612b7d565b630a85bd0160e11b95945050505050565b6040516001600160e01b031990911681526020016102e8565b34801561044157600080fd5b506008546102de565b34801561045657600080fd5b5061039b610465366004612cdf565b610b49565b34801561047657600080fd5b5061039b610485366004612d67565b610d4b565b34801561049657600080fd5b506102de6104a5366004612b1e565b60116020526000908152604090205481565b3480156104c357600080fd5b5061039b6104d2366004612dfb565b610dd0565b3480156104e357600080fd5b5061039b6104f2366004612e44565b610e06565b34801561050357600080fd5b506102de610512366004612b53565b610ed5565b34801561052357600080fd5b5061039b610532366004612e78565b610f3a565b34801561054357600080fd5b5061039b610552366004612ead565b611273565b34801561056357600080fd5b5061039b6112bf565b34801561057857600080fd5b5061039b610587366004612d67565b611325565b34801561059857600080fd5b5061039b6105a7366004612ead565b611345565b3480156105b857600080fd5b506102de6105c7366004612b1e565b611452565b3480156105d857600080fd5b5061039b6105e7366004612e78565b6114ab565b3480156105f857600080fd5b50610363610607366004612b1e565b61175b565b34801561061857600080fd5b5061039b610627366004612ec8565b611766565b34801561063857600080fd5b50600b54610363906001600160a01b031681565b34801561065857600080fd5b506102de610667366004612ead565b611810565b34801561067857600080fd5b50610336610687366004612b1e565b611858565b34801561069857600080fd5b506106bc6106a7366004612b1e565b60146020526000908152604090205460ff1681565b6040516102e89190612f42565b3480156106d557600080fd5b5061039b6106e4366004612e78565b611889565b3480156106f557600080fd5b50600a54610363906001600160a01b031681565b34801561071557600080fd5b5061039b610724366004612ec8565b611aea565b34801561073557600080fd5b506102de610744366004612b1e565b60136020526000908152604090205481565b34801561076257600080fd5b50610336611d7b565b34801561077757600080fd5b506102de600d5481565b34801561078d57600080fd5b5061039b61079c366004612f78565b611d8a565b3480156107ad57600080fd5b506102de6107bc366004612ead565b6001600160a01b03163190565b3480156107d557600080fd5b506102de6107e4366004612a5f565b600f60209081526000928352604080842090915290825290205481565b34801561080d57600080fd5b5061039b61081c366004612faf565b611d95565b34801561082d57600080fd5b50610336611dad565b34801561084257600080fd5b5061039b610851366004612ec8565b611e3b565b34801561086257600080fd5b5061039b610871366004612ead565b611ee5565b34801561088257600080fd5b50610363610891366004612b1e565b6015602052600090815260409020546001600160a01b031681565b3480156108b857600080fd5b506103366108c7366004612b1e565b611f31565b3480156108d857600080fd5b5061039b6108e7366004612e78565b611fa7565b3480156108f857600080fd5b506102de610907366004612a5f565b601060209081526000928352604080842090915290825290205481565b34801561093057600080fd5b506102de61093f366004612b1e565b60126020526000908152604090205481565b34801561095d57600080fd5b5061039b61096c366004612ead565b612073565b34801561097d57600080fd5b5061031161098c36600461302b565b612115565b6000805b6000848152600f6020908152604080832084845290915290205483116109d5576000848152601060209081526040808320938352929052205490506109e7565b806109df81613074565b915050610995565b92915050565b60006001600160e01b0319821663780e9d6360e01b14806109e757506109e782612143565b606060008054610a219061308d565b80601f0160208091040260200160405190810160405280929190818152602001828054610a4d9061308d565b8015610a9a5780601f10610a6f57610100808354040283529160200191610a9a565b820191906000526020600020905b815481529060010190602001808311610a7d57829003601f168201915b5050505050905090565b6000610aaf82612193565b506000828152600460205260409020546001600160a01b03166109e7565b610ad88282336121cc565b5050565b600a546001600160a01b03163314610b0f5760405162461bcd60e51b8152600401610b06906130c7565b60405180910390fd5b600a546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610ad8573d6000803e3d6000fd5b600c546001600160a01b03163314610b735760405162461bcd60e51b8152600401610b06906130eb565b81518351148015610b85575080518351145b610ba15760405162461bcd60e51b8152600401610b0690613112565b60005b8351811015610d45576000848281518110610bc157610bc1613153565b6020026020010151905060016004811115610bde57610bde612f2c565b60008281526014602052604090205460ff166004811115610c0157610c01612f2c565b14610c745760405162461bcd60e51b815260206004820152603f60248201527f546869732067756d62616c6c206e6565647320746f20626520696e207468652060448201527f4d494e54454420737461746520746f20626520696e697469616c697a65642e006064820152608401610b06565b6000818152601460205260409020805460ff1916600217905583517fe9a7d20110c061e972cb4558d66a60a6985932b6436194a95e9ae85644b0665e908290869085908110610cc557610cc5613153565b6020026020010151858581518110610cdf57610cdf613153565b6020026020010151604051610d07939291909283526020830191909152604082015260600190565b60405180910390a1828281518110610d2157610d21613153565b60209081029190910181015160009283526012909152604090912055600101610ba4565b50505050565b6001600160a01b038216610d7557604051633250574960e11b815260006004820152602401610b06565b6000610d828383336121d9565b9050836001600160a01b0316816001600160a01b031614610d45576040516364283d7b60e01b81526001600160a01b0380861660048301526024820184905282166044820152606401610b06565b600a546001600160a01b03163314610dfa5760405162461bcd60e51b8152600401610b06906130c7565b600e610ad882826131b1565b600a546001600160a01b03163314610e305760405162461bcd60e51b8152600401610b06906130c7565b8051825114610e515760405162461bcd60e51b8152600401610b0690613112565b60005b8251811015610d4557828181518110610e6f57610e6f613153565b6020908102919091018101516000868152600f8352604080822085835290935291909120558151829082908110610ea857610ea8613153565b60209081029190910181015160008681526010835260408082208583529093529190912055600101610e54565b6000610ee083611810565b8210610f115760405163295f44f760e21b81526001600160a01b038416600482015260248101839052604401610b06565b506001600160a01b03919091166000908152600660209081526040808320938352929052205490565b60005b8151811015610ad857336001600160a01b0316610f72838381518110610f6557610f65613153565b602002602001015161175b565b6001600160a01b031614610fc85760405162461bcd60e51b815260206004820152601c60248201527f596f7520646f206e6f74206f776e20746869732067756d62616c6c2e000000006044820152606401610b06565b600260146000848481518110610fe057610fe0613153565b60209081029190910181015182528101919091526040016000205460ff16600481111561100f5761100f612f2c565b1461102c5760405162461bcd60e51b8152600401610b0690613271565b6000601360006012600086868151811061104857611048613153565b60200260200101518152602001908152602001600020548152602001908152602001600020549050600081116110f25760405162461bcd60e51b815260206004820152604360248201527f546869732067756d62616c6c20646f6573206e6f74206861766520737461746960448201527f632077696e6e696e677320616e642063616e6e6f74206265206163746976617460648201526232b21760e91b608482015260a401610b06565b611116333085858151811061110957611109613153565b6020026020010151611325565b60046014600085858151811061112e5761112e613153565b6020026020010151815260200190815260200160002060006101000a81548160ff0219169083600481111561116557611165612f2c565b02179055507fd973cd3f3ebda40a8c254cfc1038258bb964a61df27293d4e0aa1951038bf8d383838151811061119d5761119d613153565b60200260200101516040516111b491815260200190565b60405180910390a16000816111cb612710476132ef565b6111d59190613303565b90507ffcd3fdaadc9f9f4ea62870a544a0ad0375e0661f05404b9596fc367c66f32e3884848151811061120a5761120a613153565b602090810291909101810151604080519182529181018590529081018390526000606082015260800160405180910390a1604051339082156108fc029083906000818181858888f19350505050158015611268573d6000803e3d6000fd5b505050600101610f3d565b600a546001600160a01b0316331461129d5760405162461bcd60e51b8152600401610b06906130c7565b600b80546001600160a01b0319166001600160a01b0392909216919091179055565b600a546001600160a01b031633146112e95760405162461bcd60e51b8152600401610b06906130c7565b600a546040516001600160a01b03909116904780156108fc02916000818181858888f19350505050158015611322573d6000803e3d6000fd5b50565b61134083838360405180602001604052806000815250611d95565b505050565b600a546001600160a01b0316331461136f5760405162461bcd60e51b8152600401610b06906130c7565b6040516370a0823160e01b81526001600160a01b03821660048201819052829163a9059cbb90339083906370a0823190602401602060405180830381865afa1580156113bf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113e3919061331a565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af115801561142e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113409190613333565b600061145d60085490565b82106114865760405163295f44f760e21b81526000600482015260248101839052604401610b06565b6008828154811061149957611499613153565b90600052602060002001549050919050565b60005b8151811015610ad857336001600160a01b03166114d6838381518110610f6557610f65613153565b6001600160a01b03161461152c5760405162461bcd60e51b815260206004820152601c60248201527f596f7520646f206e6f74206f776e20746869732067756d62616c6c2e000000006044820152606401610b06565b60026014600084848151811061154457611544613153565b60209081029190910181015182528101919091526040016000205460ff16600481111561157357611573612f2c565b146115905760405162461bcd60e51b8152600401610b0690613271565b60136000601260008585815181106115aa576115aa613153565b60200260200101518152602001908152602001600020548152602001908152602001600020546000146116455760405162461bcd60e51b815260206004820152603960248201527f546869732067756d62616c6c20686173207374617469632077696e6e696e677360448201527f20616e642063616e6e6f74206265206163746976617465642e000000000000006064820152608401610b06565b61165c333084848151811061110957611109613153565b60036014600084848151811061167457611674613153565b6020026020010151815260200190815260200160002060006101000a81548160ff021916908360048111156116ab576116ab612f2c565b021790555033601560008484815181106116c7576116c7613153565b6020026020010151815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b031602179055507fd973cd3f3ebda40a8c254cfc1038258bb964a61df27293d4e0aa1951038bf8d382828151811061173457611734613153565b602002602001015160405161174b91815260200190565b60405180910390a16001016114ae565b60006109e782612193565b600a546001600160a01b031633146117905760405162461bcd60e51b8152600401610b06906130c7565b80518251146117b15760405162461bcd60e51b8152600401610b0690613112565b60005b8151811015611340578181815181106117cf576117cf613153565b6020026020010151601160008584815181106117ed576117ed613153565b6020908102919091018101518252810191909152604001600020556001016117b4565b60006001600160a01b03821661183c576040516322718ad960e21b815260006004820152602401610b06565b506001600160a01b031660009081526003602052604090205490565b6060611863826122ae565b604051602001611873919061336c565b6040516020818303038152906040529050919050565b600b546040516370a0823160e01b81523060048201526001600160a01b039091169060009082906370a0823190602401602060405180830381865afa1580156118d6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118fa919061331a565b905060008351670de0b6b3a76400006119139190613303565b905060005b8451811015611a1b57836001600160a01b031663f242432a333088858151811061194457611944613153565b602002602001015160016040518563ffffffff1660e01b815260040161196d94939291906133d6565b600060405180830381600087803b15801561198757600080fd5b505af115801561199b573d6000803e3d6000fd5b505050506119ab33600d546123da565b600d8054600090815260146020908152604091829020805460ff19166001179055915490519081527fd6fa52e45c8f83f9c0476cde38bd4d40b57d831c607fe25b2f7b0e220a7ba8c3910160405180910390a1600d8054906000611a0e83613074565b9091555050600101611918565b506040516370a0823160e01b8152306004820152819083906001600160a01b038616906370a0823190602401602060405180830381865afa158015611a64573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a88919061331a565b611a92919061340e565b14610d455760405162461bcd60e51b815260206004820152602260248201527f4661696c656420746f207265636569766520746f6b656e732072657175697265604482015261321760f11b6064820152608401610b06565b600c546001600160a01b03163314611b145760405162461bcd60e51b8152600401610b06906130eb565b8051825114611b355760405162461bcd60e51b8152600401610b0690613112565b60005b8251811015611340576000838281518110611b5557611b55613153565b6020026020010151905060036004811115611b7257611b72612f2c565b60008281526014602052604090205460ff166004811115611b9557611b95612f2c565b14611c085760405162461bcd60e51b815260206004820152603f60248201527f546869732067756d62616c6c206e6565647320746f20626520696e207468652060448201527f41435449564154454420737461746520746f206265207265736f6c7665642e006064820152608401610b06565b6000818152601460205260408120805460ff191660041790558351849084908110611c3557611c35613153565b6020026020010151604051602001611c4f91815260200190565b60408051601f198184030181529181528151602092830120600085815260128452828120548152601190935290822054909250611c93906102d9620186a085613421565b9050600081611ca4612710476132ef565b611cae9190613303565b60008581526015602052604090205487519192506001600160a01b0316907ffcd3fdaadc9f9f4ea62870a544a0ad0375e0661f05404b9596fc367c66f32e38908690859085908b908b908110611d0657611d06613153565b6020908102919091018101516040805195865291850193909352830152606082015260800160405180910390a16040516001600160a01b0382169083156108fc029084906000818181858888f19350505050158015611d69573d6000803e3d6000fd5b505060019094019350611b3892505050565b606060018054610a219061308d565b610ad833838361243f565b611da0848484610d4b565b610d4533858585856124de565b600e8054611dba9061308d565b80601f0160208091040260200160405190810160405280929190818152602001828054611de69061308d565b8015611e335780601f10611e0857610100808354040283529160200191611e33565b820191906000526020600020905b815481529060010190602001808311611e1657829003601f168201915b505050505081565b600a546001600160a01b03163314611e655760405162461bcd60e51b8152600401610b06906130c7565b8051825114611e865760405162461bcd60e51b8152600401610b0690613112565b60005b815181101561134057818181518110611ea457611ea4613153565b602002602001015160136000858481518110611ec257611ec2613153565b602090810291909101810151825281019190915260400160002055600101611e89565b600c546001600160a01b03163314611f0f5760405162461bcd60e51b8152600401610b06906130eb565b600c80546001600160a01b0319166001600160a01b0392909216919091179055565b600081815260126020526040902054606090611f4c836122ae565b611f5582611858565b600e611f60846122ae565b604051602001611f739493929190613435565b60408051601f1981840301815290829052611f909160200161360b565b604051602081830303815290604052915050919050565b600a546001600160a01b03163314611fd15760405162461bcd60e51b8152600401610b06906130c7565b600b546001600160a01b031660005b825181101561134057816001600160a01b031663f242432a303386858151811061200c5761200c613153565b602002602001015160016040518563ffffffff1660e01b815260040161203594939291906133d6565b600060405180830381600087803b15801561204f57600080fd5b505af1158015612063573d6000803e3d6000fd5b505060019092019150611fe09050565b600a546001600160a01b0316331461209d5760405162461bcd60e51b8152600401610b06906130c7565b6001600160a01b0381166120f35760405162461bcd60e51b815260206004820152601b60248201527f43616e742072656e6f756e6365207468697320636f6e747261637400000000006044820152606401610b06565b600a80546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b60006001600160e01b031982166380ac58cd60e01b148061217457506001600160e01b03198216635b5e139f60e01b145b806109e757506301ffc9a760e01b6001600160e01b03198316146109e7565b6000818152600260205260408120546001600160a01b0316806109e757604051637e27328960e01b815260048101849052602401610b06565b6113408383836001612609565b6000806121e785858561270f565b90506001600160a01b0381166122445761223f84600880546000838152600960205260408120829055600182018355919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30155565b612267565b846001600160a01b0316816001600160a01b031614612267576122678185612808565b6001600160a01b0385166122835761227e84612899565b6122a6565b846001600160a01b0316816001600160a01b0316146122a6576122a68585612948565b949350505050565b6060816000036122d55750506040805180820190915260018152600360fc1b602082015290565b8160005b81156122ff57806122e981613074565b91506122f89050600a836132ef565b91506122d9565b60008167ffffffffffffffff81111561231a5761231a612c18565b6040519080825280601f01601f191660200182016040528015612344576020820181803683370190505b509050815b85156123d15761235a60018261340e565b90506000612369600a886132ef565b61237490600a613303565b61237e908861340e565b612389906030613650565b905060008160f81b9050808484815181106123a6576123a6613153565b60200101906001600160f81b031916908160001a9053506123c8600a896132ef565b97505050612349565b50949350505050565b6001600160a01b03821661240457604051633250574960e11b815260006004820152602401610b06565b6000612412838360006121d9565b90506001600160a01b03811615611340576040516339e3563760e11b815260006004820152602401610b06565b6001600160a01b03821661247157604051630b61174360e31b81526001600160a01b0383166004820152602401610b06565b6001600160a01b03838116600081815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6001600160a01b0383163b1561260257604051630a85bd0160e11b81526001600160a01b0384169063150b7a0290612520908890889087908790600401613669565b6020604051808303816000875af192505050801561255b575060408051601f3d908101601f19168201909252612558918101906136a6565b60015b6125c4573d808015612589576040519150601f19603f3d011682016040523d82523d6000602084013e61258e565b606091505b5080516000036125bc57604051633250574960e11b81526001600160a01b0385166004820152602401610b06565b805181602001fd5b6001600160e01b03198116630a85bd0160e11b1461260057604051633250574960e11b81526001600160a01b0385166004820152602401610b06565b505b5050505050565b808061261d57506001600160a01b03821615155b156126df57600061262d84612193565b90506001600160a01b038316158015906126595750826001600160a01b0316816001600160a01b031614155b801561266c575061266a8184612115565b155b156126955760405163a9fbf51f60e01b81526001600160a01b0384166004820152602401610b06565b81156126dd5783856001600160a01b0316826001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45b505b5050600090815260046020526040902080546001600160a01b0319166001600160a01b0392909216919091179055565b6000828152600260205260408120546001600160a01b039081169083161561273c5761273c818486612998565b6001600160a01b0381161561277a57612759600085600080612609565b6001600160a01b038116600090815260036020526040902080546000190190555b6001600160a01b038516156127a9576001600160a01b0385166000908152600360205260409020805460010190555b60008481526002602052604080822080546001600160a01b0319166001600160a01b0389811691821790925591518793918516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4949350505050565b600061281383611810565b600083815260076020526040902054909150808214612866576001600160a01b03841660009081526006602090815260408083208584528252808320548484528184208190558352600790915290208190555b5060009182526007602090815260408084208490556001600160a01b039094168352600681528383209183525290812055565b6008546000906128ab9060019061340e565b600083815260096020526040812054600880549394509092849081106128d3576128d3613153565b9060005260206000200154905080600883815481106128f4576128f4613153565b600091825260208083209091019290925582815260099091526040808220849055858252812055600880548061292c5761292c6136c3565b6001900381819060005260206000200160009055905550505050565b6000600161295584611810565b61295f919061340e565b6001600160a01b039093166000908152600660209081526040808320868452825280832085905593825260079052919091209190915550565b6129a38383836129fc565b611340576001600160a01b0383166129d157604051637e27328960e01b815260048101829052602401610b06565b60405163177e802f60e01b81526001600160a01b038316600482015260248101829052604401610b06565b60006001600160a01b038316158015906122a65750826001600160a01b0316846001600160a01b03161480612a365750612a368484612115565b806122a65750506000908152600460205260409020546001600160a01b03908116911614919050565b60008060408385031215612a7257600080fd5b50508035926020909101359150565b6001600160e01b03198116811461132257600080fd5b600060208284031215612aa957600080fd5b8135612ab481612a81565b9392505050565b60005b83811015612ad6578181015183820152602001612abe565b50506000910152565b60008151808452612af7816020860160208601612abb565b601f01601f19169290920160200192915050565b602081526000612ab46020830184612adf565b600060208284031215612b3057600080fd5b5035919050565b80356001600160a01b0381168114612b4e57600080fd5b919050565b60008060408385031215612b6657600080fd5b612b6f83612b37565b946020939093013593505050565b600080600080600060808688031215612b9557600080fd5b612b9e86612b37565b9450612bac60208701612b37565b935060408601359250606086013567ffffffffffffffff80821115612bd057600080fd5b818801915088601f830112612be457600080fd5b813581811115612bf357600080fd5b896020828501011115612c0557600080fd5b9699959850939650602001949392505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715612c5757612c57612c18565b604052919050565b600082601f830112612c7057600080fd5b8135602067ffffffffffffffff821115612c8c57612c8c612c18565b8160051b612c9b828201612c2e565b9283528481018201928281019087851115612cb557600080fd5b83870192505b84831015612cd457823582529183019190830190612cbb565b979650505050505050565b600080600060608486031215612cf457600080fd5b833567ffffffffffffffff80821115612d0c57600080fd5b612d1887838801612c5f565b94506020860135915080821115612d2e57600080fd5b612d3a87838801612c5f565b93506040860135915080821115612d5057600080fd5b50612d5d86828701612c5f565b9150509250925092565b600080600060608486031215612d7c57600080fd5b612d8584612b37565b9250612d9360208501612b37565b9150604084013590509250925092565b600067ffffffffffffffff831115612dbd57612dbd612c18565b612dd0601f8401601f1916602001612c2e565b9050828152838383011115612de457600080fd5b828260208301376000602084830101529392505050565b600060208284031215612e0d57600080fd5b813567ffffffffffffffff811115612e2457600080fd5b8201601f81018413612e3557600080fd5b6122a684823560208401612da3565b600080600060608486031215612e5957600080fd5b83359250602084013567ffffffffffffffff80821115612d2e57600080fd5b600060208284031215612e8a57600080fd5b813567ffffffffffffffff811115612ea157600080fd5b6122a684828501612c5f565b600060208284031215612ebf57600080fd5b612ab482612b37565b60008060408385031215612edb57600080fd5b823567ffffffffffffffff80821115612ef357600080fd5b612eff86838701612c5f565b93506020850135915080821115612f1557600080fd5b50612f2285828601612c5f565b9150509250929050565b634e487b7160e01b600052602160045260246000fd5b6020810160058310612f6457634e487b7160e01b600052602160045260246000fd5b91905290565b801515811461132257600080fd5b60008060408385031215612f8b57600080fd5b612f9483612b37565b91506020830135612fa481612f6a565b809150509250929050565b60008060008060808587031215612fc557600080fd5b612fce85612b37565b9350612fdc60208601612b37565b925060408501359150606085013567ffffffffffffffff811115612fff57600080fd5b8501601f8101871361301057600080fd5b61301f87823560208401612da3565b91505092959194509250565b6000806040838503121561303e57600080fd5b61304783612b37565b915061305560208401612b37565b90509250929050565b634e487b7160e01b600052601160045260246000fd5b6000600182016130865761308661305e565b5060010190565b600181811c908216806130a157607f821691505b6020821081036130c157634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252600a908201526937b7363c9037bbb732b960b11b604082015260600190565b6020808252600d908201526c37b7363c903932b9b7b63b32b960991b604082015260600190565b60208082526021908201527f4c69737473206e65656420746f206265207468652073616d65206c656e6774686040820152601760f91b606082015260800190565b634e487b7160e01b600052603260045260246000fd5b601f821115611340576000816000526020600020601f850160051c810160208610156131925750805b601f850160051c820191505b818110156126005782815560010161319e565b815167ffffffffffffffff8111156131cb576131cb612c18565b6131df816131d9845461308d565b84613169565b602080601f83116001811461321457600084156131fc5750858301515b600019600386901b1c1916600185901b178555612600565b600085815260208120601f198616915b8281101561324357888601518255948401946001909101908401613224565b50858210156132615787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60208082526042908201527f546869732067756d62616c6c206e6565647320746f20626520696e207468652060408201527f494e495449414c495a454420737461746520746f206265206163746976617465606082015261321760f11b608082015260a00190565b634e487b7160e01b600052601260045260246000fd5b6000826132fe576132fe6132d9565b500490565b80820281158282048414176109e7576109e761305e565b60006020828403121561332c57600080fd5b5051919050565b60006020828403121561334557600080fd5b8151612ab481612f6a565b60008151613362818560208601612abb565b9290920192915050565b7f7b202274726169745f74797065223a2247756d62616c6c2054797065222c227681526630b63ab2911d1160c91b6020820152600082516133b4816027850160208701612abb565b601160f91b6027939091019283015250607d60f81b6028820152602901919050565b6001600160a01b0394851681529290931660208301526040820152606081019190915260a06080820181905260009082015260c00190565b818103818111156109e7576109e761305e565b600082613430576134306132d9565b500690565b737b20226e616d65223a202247554d42414c4c202360601b8152845160009060206134668260148601838b01612abb565b70222c2261747472696275746573223a205b60781b6014928501928301528651613497816025850160208b01612abb565b605d60f81b602593909101928301526b161134b6b0b3b291101d101160a11b602683015285546032906000906134cc8161308d565b600182811680156134e457600181146134ff57613531565b60ff1984166032890152603283151584028901019450613531565b8b600052602060002060005b848110156135265781548a820189015290830190880161350b565b505060328389010194505b505050506135fd6135f061356d61355a613554856204a64760eb1b815260030190565b8b613350565b662532392e706e6760c81b815260070190565b7f20222c2265787465726e616c5f75726c223a202267756d62616c6c2e6767222c81527f226465736372697074696f6e223a22436c61696d20746869732047756d20426160208201527f6c6c20746f206765742061207368617265206f6620746865205072697a65205060408201526437b7b6171160d91b606082015260650190565b607d60f81b815260010190565b9a9950505050505050505050565b7f646174613a6170706c69636174696f6e2f6a736f6e3b757466382c000000000081526000825161364381601b850160208701612abb565b91909101601b0192915050565b60ff81811683821601908111156109e7576109e761305e565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061369c90830184612adf565b9695505050505050565b6000602082840312156136b857600080fd5b8151612ab481612a81565b634e487b7160e01b600052603160045260246000fdfea264697066735822122053867798538da6b8d20f4e1004befc406b9f4a10e5347c82b32ddc41b764a63e64736f6c63430008180033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|---|---|---|---|---|
ETH | 100.00% | $13.1 | 239 | $3,130.9 |
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.