More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 256 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Open | 16293159 | 691 days ago | IN | 0 ETH | 0.00180681 | ||||
Open | 16293150 | 691 days ago | IN | 0 ETH | 0.0020398 | ||||
Open | 16278027 | 693 days ago | IN | 0 ETH | 0.00202771 | ||||
Open | 16277922 | 693 days ago | IN | 0 ETH | 0.00157842 | ||||
Steal | 16276725 | 693 days ago | IN | 0 ETH | 0.00121015 | ||||
Open | 16276660 | 693 days ago | IN | 0 ETH | 0.00143941 | ||||
Open | 16276507 | 693 days ago | IN | 0 ETH | 0.00168437 | ||||
Open | 16276373 | 693 days ago | IN | 0 ETH | 0.00165032 | ||||
Open | 16276358 | 693 days ago | IN | 0 ETH | 0.00155593 | ||||
Steal | 16276346 | 693 days ago | IN | 0 ETH | 0.00104075 | ||||
Open | 16273287 | 694 days ago | IN | 0 ETH | 0.00151113 | ||||
Open | 16272678 | 694 days ago | IN | 0 ETH | 0.00202282 | ||||
Open | 16272673 | 694 days ago | IN | 0 ETH | 0.00171948 | ||||
Start Game | 16272670 | 694 days ago | IN | 0.02 ETH | 0.00088167 | ||||
Open | 16272597 | 694 days ago | IN | 0 ETH | 0.00197448 | ||||
Steal | 16272542 | 694 days ago | IN | 0 ETH | 0.00136837 | ||||
Open | 16272510 | 694 days ago | IN | 0 ETH | 0.0017468 | ||||
Open | 16272440 | 694 days ago | IN | 0 ETH | 0.00162991 | ||||
Steal | 16272406 | 694 days ago | IN | 0 ETH | 0.00093081 | ||||
Steal | 16272382 | 694 days ago | IN | 0 ETH | 0.00123661 | ||||
Steal | 16272379 | 694 days ago | IN | 0 ETH | 0.00112519 | ||||
Steal | 16272366 | 694 days ago | IN | 0 ETH | 0.00121773 | ||||
Steal | 16272312 | 694 days ago | IN | 0 ETH | 0.00153756 | ||||
Open | 16272235 | 694 days ago | IN | 0 ETH | 0.00132474 | ||||
Open | 16272204 | 694 days ago | IN | 0 ETH | 0.00151763 |
Latest 1 internal transaction
Advanced mode:
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
16257776 | 696 days ago | Contract Creation | 0 ETH |
Loading...
Loading
Contract Name:
NounishWhiteElephant
Compiler Version
v0.8.17+commit.8df45f5f
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; import {Owned} from "solmate/auth/Owned.sol"; import {SafeTransferLib} from "solmate/utils/SafeTransferLib.sol"; import {WhiteElephant} from "./base/WhiteElephant.sol"; import {NounishChristmasNFT, NounishChristmasMetadata} from "./NounishChristmasNFT.sol"; contract NounishWhiteElephant is WhiteElephant, Owned { error InsufficientPayment(); error DoneForNow(); uint256 public participantFee; uint256 public endTimestamp; constructor(uint256 fee, uint256 _endTimestamp, NounishChristmasMetadata _metadata) Owned(msg.sender) { nft = new NounishChristmasNFT(_metadata); participantFee = fee; endTimestamp = _endTimestamp; } /// @inheritdoc WhiteElephant function startGame(Game calldata game) public payable override returns (bytes32 _gameID) { if (block.timestamp > endTimestamp) { revert DoneForNow(); } if (msg.value < game.participants.length * participantFee) { revert InsufficientPayment(); } return super.startGame(game); } /// @inheritdoc WhiteElephant function open(Game calldata game) public override { if (block.timestamp > endTimestamp) { revert DoneForNow(); } super.open(game); } /// @inheritdoc WhiteElephant function steal(Game calldata game, uint256 tokenID) public override { if (block.timestamp > endTimestamp) { revert DoneForNow(); } super.steal(game, tokenID); } function transferFees(address to, uint256 amount) external onlyOwner { SafeTransferLib.safeTransferETH(to, amount); } function setEndTimestamp(uint256 _new) external onlyOwner { endTimestamp = _new; } function updateMetadata(NounishChristmasMetadata _metadata) external onlyOwner { NounishChristmasNFT(address(nft)).updateMetadata(_metadata); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0; /// @title Base64 /// @author Brecht Devos - <[email protected]> /// @notice Provides functions for encoding/decoding base64 library Base64 { string internal constant TABLE_ENCODE = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; bytes internal constant TABLE_DECODE = hex"0000000000000000000000000000000000000000000000000000000000000000" hex"00000000000000000000003e0000003f3435363738393a3b3c3d000000000000" hex"00000102030405060708090a0b0c0d0e0f101112131415161718190000000000" hex"001a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132330000000000"; function encode(bytes memory data) internal pure returns (string memory) { if (data.length == 0) return ''; // load the table into memory string memory table = TABLE_ENCODE; // multiply by 4/3 rounded up uint256 encodedLen = 4 * ((data.length + 2) / 3); // add some extra buffer at the end required for the writing string memory result = new string(encodedLen + 32); assembly { // set the actual output length mstore(result, encodedLen) // prepare the lookup table let tablePtr := add(table, 1) // input ptr let dataPtr := data let endPtr := add(dataPtr, mload(data)) // result ptr, jump over length let resultPtr := add(result, 32) // run over the input, 3 bytes at a time for {} lt(dataPtr, endPtr) {} { // read 3 bytes dataPtr := add(dataPtr, 3) let input := mload(dataPtr) // write 4 characters mstore8(resultPtr, mload(add(tablePtr, and(shr(18, input), 0x3F)))) resultPtr := add(resultPtr, 1) mstore8(resultPtr, mload(add(tablePtr, and(shr(12, input), 0x3F)))) resultPtr := add(resultPtr, 1) mstore8(resultPtr, mload(add(tablePtr, and(shr( 6, input), 0x3F)))) resultPtr := add(resultPtr, 1) mstore8(resultPtr, mload(add(tablePtr, and( input, 0x3F)))) resultPtr := add(resultPtr, 1) } // padding with '=' switch mod(mload(data), 3) case 1 { mstore(sub(resultPtr, 2), shl(240, 0x3d3d)) } case 2 { mstore(sub(resultPtr, 1), shl(248, 0x3d)) } } return result; } function decode(string memory _data) internal pure returns (bytes memory) { bytes memory data = bytes(_data); if (data.length == 0) return new bytes(0); require(data.length % 4 == 0, "invalid base64 decoder input"); // load the table into memory bytes memory table = TABLE_DECODE; // every 4 characters represent 3 bytes uint256 decodedLen = (data.length / 4) * 3; // add some extra buffer at the end required for the writing bytes memory result = new bytes(decodedLen + 32); assembly { // padding with '=' let lastBytes := mload(add(data, mload(data))) if eq(and(lastBytes, 0xFF), 0x3d) { decodedLen := sub(decodedLen, 1) if eq(and(lastBytes, 0xFFFF), 0x3d3d) { decodedLen := sub(decodedLen, 1) } } // set the actual output length mstore(result, decodedLen) // prepare the lookup table let tablePtr := add(table, 1) // input ptr let dataPtr := data let endPtr := add(dataPtr, mload(data)) // result ptr, jump over length let resultPtr := add(result, 32) // run over the input, 4 characters at a time for {} lt(dataPtr, endPtr) {} { // read 4 characters dataPtr := add(dataPtr, 4) let input := mload(dataPtr) // write 3 bytes let output := add( add( shl(18, and(mload(add(tablePtr, and(shr(24, input), 0xFF))), 0xFF)), shl(12, and(mload(add(tablePtr, and(shr(16, input), 0xFF))), 0xFF))), add( shl( 6, and(mload(add(tablePtr, and(shr( 8, input), 0xFF))), 0xFF)), and(mload(add(tablePtr, and( input , 0xFF))), 0xFF) ) ) mstore(resultPtr, shl(232, output)) resultPtr := add(resultPtr, 3) } } return result; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol) pragma solidity ^0.8.0; import "./math/Math.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant _SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), _SYMBOLS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, Math.log256(value) + 1); } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv( uint256 x, uint256 y, uint256 denominator ) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works // in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv( uint256 x, uint256 y, uint256 denominator, Rounding rounding ) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10**64) { value /= 10**64; result += 64; } if (value >= 10**32) { value /= 10**32; result += 32; } if (value >= 10**16) { value /= 10**16; result += 16; } if (value >= 10**8) { value /= 10**8; result += 8; } if (value >= 10**4) { value /= 10**4; result += 4; } if (value >= 10**2) { value /= 10**2; result += 2; } if (value >= 10**1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0); } } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; /// @notice Simple single owner authorization mixin. /// @author Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/auth/Owned.sol) abstract contract Owned { /*////////////////////////////////////////////////////////////// EVENTS //////////////////////////////////////////////////////////////*/ event OwnerUpdated(address indexed user, address indexed newOwner); /*////////////////////////////////////////////////////////////// OWNERSHIP STORAGE //////////////////////////////////////////////////////////////*/ address public owner; modifier onlyOwner() virtual { require(msg.sender == owner, "UNAUTHORIZED"); _; } /*////////////////////////////////////////////////////////////// CONSTRUCTOR //////////////////////////////////////////////////////////////*/ constructor(address _owner) { owner = _owner; emit OwnerUpdated(address(0), _owner); } /*////////////////////////////////////////////////////////////// OWNERSHIP LOGIC //////////////////////////////////////////////////////////////*/ function setOwner(address newOwner) public virtual onlyOwner { owner = newOwner; emit OwnerUpdated(msg.sender, newOwner); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; /// @notice Modern and gas efficient ERC20 + EIP-2612 implementation. /// @author Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/tokens/ERC20.sol) /// @author Modified from Uniswap (https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol) /// @dev Do not manually set balances without updating totalSupply, as the sum of all user balances must not exceed it. abstract contract ERC20 { /*////////////////////////////////////////////////////////////// EVENTS //////////////////////////////////////////////////////////////*/ event Transfer(address indexed from, address indexed to, uint256 amount); event Approval(address indexed owner, address indexed spender, uint256 amount); /*////////////////////////////////////////////////////////////// METADATA STORAGE //////////////////////////////////////////////////////////////*/ string public name; string public symbol; uint8 public immutable decimals; /*////////////////////////////////////////////////////////////// ERC20 STORAGE //////////////////////////////////////////////////////////////*/ uint256 public totalSupply; mapping(address => uint256) public balanceOf; mapping(address => mapping(address => uint256)) public allowance; /*////////////////////////////////////////////////////////////// EIP-2612 STORAGE //////////////////////////////////////////////////////////////*/ uint256 internal immutable INITIAL_CHAIN_ID; bytes32 internal immutable INITIAL_DOMAIN_SEPARATOR; mapping(address => uint256) public nonces; /*////////////////////////////////////////////////////////////// CONSTRUCTOR //////////////////////////////////////////////////////////////*/ constructor( string memory _name, string memory _symbol, uint8 _decimals ) { name = _name; symbol = _symbol; decimals = _decimals; INITIAL_CHAIN_ID = block.chainid; INITIAL_DOMAIN_SEPARATOR = computeDomainSeparator(); } /*////////////////////////////////////////////////////////////// ERC20 LOGIC //////////////////////////////////////////////////////////////*/ function approve(address spender, uint256 amount) public virtual returns (bool) { allowance[msg.sender][spender] = amount; emit Approval(msg.sender, spender, amount); return true; } function transfer(address to, uint256 amount) public virtual returns (bool) { balanceOf[msg.sender] -= amount; // Cannot overflow because the sum of all user // balances can't exceed the max uint256 value. unchecked { balanceOf[to] += amount; } emit Transfer(msg.sender, to, amount); return true; } function transferFrom( address from, address to, uint256 amount ) public virtual returns (bool) { uint256 allowed = allowance[from][msg.sender]; // Saves gas for limited approvals. if (allowed != type(uint256).max) allowance[from][msg.sender] = allowed - amount; balanceOf[from] -= amount; // Cannot overflow because the sum of all user // balances can't exceed the max uint256 value. unchecked { balanceOf[to] += amount; } emit Transfer(from, to, amount); return true; } /*////////////////////////////////////////////////////////////// EIP-2612 LOGIC //////////////////////////////////////////////////////////////*/ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) public virtual { require(deadline >= block.timestamp, "PERMIT_DEADLINE_EXPIRED"); // Unchecked because the only math done is incrementing // the owner's nonce which cannot realistically overflow. unchecked { address recoveredAddress = ecrecover( keccak256( abi.encodePacked( "\x19\x01", DOMAIN_SEPARATOR(), keccak256( abi.encode( keccak256( "Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)" ), owner, spender, value, nonces[owner]++, deadline ) ) ) ), v, r, s ); require(recoveredAddress != address(0) && recoveredAddress == owner, "INVALID_SIGNER"); allowance[recoveredAddress][spender] = value; } emit Approval(owner, spender, value); } function DOMAIN_SEPARATOR() public view virtual returns (bytes32) { return block.chainid == INITIAL_CHAIN_ID ? INITIAL_DOMAIN_SEPARATOR : computeDomainSeparator(); } function computeDomainSeparator() internal view virtual returns (bytes32) { return keccak256( abi.encode( keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"), keccak256(bytes(name)), keccak256("1"), block.chainid, address(this) ) ); } /*////////////////////////////////////////////////////////////// INTERNAL MINT/BURN LOGIC //////////////////////////////////////////////////////////////*/ function _mint(address to, uint256 amount) internal virtual { totalSupply += amount; // Cannot overflow because the sum of all user // balances can't exceed the max uint256 value. unchecked { balanceOf[to] += amount; } emit Transfer(address(0), to, amount); } function _burn(address from, uint256 amount) internal virtual { balanceOf[from] -= amount; // Cannot underflow because a user's balance // will never be larger than the total supply. unchecked { totalSupply -= amount; } emit Transfer(from, address(0), amount); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; /// @notice Modern, minimalist, and gas efficient ERC-721 implementation. /// @author Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/tokens/ERC721.sol) abstract contract ERC721 { /*////////////////////////////////////////////////////////////// EVENTS //////////////////////////////////////////////////////////////*/ event Transfer(address indexed from, address indexed to, uint256 indexed id); event Approval(address indexed owner, address indexed spender, uint256 indexed id); event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /*////////////////////////////////////////////////////////////// METADATA STORAGE/LOGIC //////////////////////////////////////////////////////////////*/ string public name; string public symbol; function tokenURI(uint256 id) public view virtual returns (string memory); /*////////////////////////////////////////////////////////////// ERC721 BALANCE/OWNER STORAGE //////////////////////////////////////////////////////////////*/ mapping(uint256 => address) internal _ownerOf; mapping(address => uint256) internal _balanceOf; function ownerOf(uint256 id) public view virtual returns (address owner) { require((owner = _ownerOf[id]) != address(0), "NOT_MINTED"); } function balanceOf(address owner) public view virtual returns (uint256) { require(owner != address(0), "ZERO_ADDRESS"); return _balanceOf[owner]; } /*////////////////////////////////////////////////////////////// ERC721 APPROVAL STORAGE //////////////////////////////////////////////////////////////*/ mapping(uint256 => address) public getApproved; mapping(address => mapping(address => bool)) public isApprovedForAll; /*////////////////////////////////////////////////////////////// CONSTRUCTOR //////////////////////////////////////////////////////////////*/ constructor(string memory _name, string memory _symbol) { name = _name; symbol = _symbol; } /*////////////////////////////////////////////////////////////// ERC721 LOGIC //////////////////////////////////////////////////////////////*/ function approve(address spender, uint256 id) public virtual { address owner = _ownerOf[id]; require(msg.sender == owner || isApprovedForAll[owner][msg.sender], "NOT_AUTHORIZED"); getApproved[id] = spender; emit Approval(owner, spender, id); } function setApprovalForAll(address operator, bool approved) public virtual { isApprovedForAll[msg.sender][operator] = approved; emit ApprovalForAll(msg.sender, operator, approved); } function transferFrom( address from, address to, uint256 id ) public virtual { require(from == _ownerOf[id], "WRONG_FROM"); require(to != address(0), "INVALID_RECIPIENT"); require( msg.sender == from || isApprovedForAll[from][msg.sender] || msg.sender == getApproved[id], "NOT_AUTHORIZED" ); // Underflow of the sender's balance is impossible because we check for // ownership above and the recipient's balance can't realistically overflow. unchecked { _balanceOf[from]--; _balanceOf[to]++; } _ownerOf[id] = to; delete getApproved[id]; emit Transfer(from, to, id); } function safeTransferFrom( address from, address to, uint256 id ) public virtual { transferFrom(from, to, id); if (to.code.length != 0) require( ERC721TokenReceiver(to).onERC721Received(msg.sender, from, id, "") == ERC721TokenReceiver.onERC721Received.selector, "UNSAFE_RECIPIENT" ); } function safeTransferFrom( address from, address to, uint256 id, bytes calldata data ) public virtual { transferFrom(from, to, id); if (to.code.length != 0) require( ERC721TokenReceiver(to).onERC721Received(msg.sender, from, id, data) == ERC721TokenReceiver.onERC721Received.selector, "UNSAFE_RECIPIENT" ); } /*////////////////////////////////////////////////////////////// ERC165 LOGIC //////////////////////////////////////////////////////////////*/ function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) { return interfaceId == 0x01ffc9a7 || // ERC165 Interface ID for ERC165 interfaceId == 0x80ac58cd || // ERC165 Interface ID for ERC721 interfaceId == 0x5b5e139f; // ERC165 Interface ID for ERC721Metadata } /*////////////////////////////////////////////////////////////// INTERNAL MINT/BURN LOGIC //////////////////////////////////////////////////////////////*/ function _mint(address to, uint256 id) internal virtual { require(to != address(0), "INVALID_RECIPIENT"); require(_ownerOf[id] == address(0), "ALREADY_MINTED"); // Counter overflow is incredibly unrealistic. unchecked { _balanceOf[to]++; } _ownerOf[id] = to; emit Transfer(address(0), to, id); } function _burn(uint256 id) internal virtual { address owner = _ownerOf[id]; require(owner != address(0), "NOT_MINTED"); // Ownership check above ensures no underflow. unchecked { _balanceOf[owner]--; } delete _ownerOf[id]; delete getApproved[id]; emit Transfer(owner, address(0), id); } /*////////////////////////////////////////////////////////////// INTERNAL SAFE MINT LOGIC //////////////////////////////////////////////////////////////*/ function _safeMint(address to, uint256 id) internal virtual { _mint(to, id); if (to.code.length != 0) require( ERC721TokenReceiver(to).onERC721Received(msg.sender, address(0), id, "") == ERC721TokenReceiver.onERC721Received.selector, "UNSAFE_RECIPIENT" ); } function _safeMint( address to, uint256 id, bytes memory data ) internal virtual { _mint(to, id); if (to.code.length != 0) require( ERC721TokenReceiver(to).onERC721Received(msg.sender, address(0), id, data) == ERC721TokenReceiver.onERC721Received.selector, "UNSAFE_RECIPIENT" ); } } /// @notice A generic interface for a contract which properly accepts ERC721 tokens. /// @author Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/tokens/ERC721.sol) abstract contract ERC721TokenReceiver { function onERC721Received( address, address, uint256, bytes calldata ) external virtual returns (bytes4) { return ERC721TokenReceiver.onERC721Received.selector; } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; import {ERC20} from "../tokens/ERC20.sol"; /// @notice Safe ETH and ERC20 transfer library that gracefully handles missing return values. /// @author Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/utils/SafeTransferLib.sol) /// @dev Caution! This library won't check that a token has code, responsibility is delegated to the caller. library SafeTransferLib { /*////////////////////////////////////////////////////////////// ETH OPERATIONS //////////////////////////////////////////////////////////////*/ function safeTransferETH(address to, uint256 amount) internal { bool success; assembly { // Transfer the ETH and store if it succeeded or not. success := call(gas(), to, amount, 0, 0, 0, 0) } require(success, "ETH_TRANSFER_FAILED"); } /*////////////////////////////////////////////////////////////// ERC20 OPERATIONS //////////////////////////////////////////////////////////////*/ function safeTransferFrom( ERC20 token, address from, address to, uint256 amount ) internal { bool success; assembly { // We'll write our calldata to this slot below, but restore it later. let memPointer := mload(0x40) // Write the abi-encoded calldata into memory, beginning with the function selector. mstore(0, 0x23b872dd00000000000000000000000000000000000000000000000000000000) mstore(4, from) // Append the "from" argument. mstore(36, to) // Append the "to" argument. mstore(68, amount) // Append the "amount" argument. success := and( // Set success to whether the call reverted, if not we check it either // returned exactly 1 (can't just be non-zero data), or had no return data. or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())), // We use 100 because that's the total length of our calldata (4 + 32 * 3) // Counterintuitively, this call() must be positioned after the or() in the // surrounding and() because and() evaluates its arguments from right to left. call(gas(), token, 0, 0, 100, 0, 32) ) mstore(0x60, 0) // Restore the zero slot to zero. mstore(0x40, memPointer) // Restore the memPointer. } require(success, "TRANSFER_FROM_FAILED"); } function safeTransfer( ERC20 token, address to, uint256 amount ) internal { bool success; assembly { // We'll write our calldata to this slot below, but restore it later. let memPointer := mload(0x40) // Write the abi-encoded calldata into memory, beginning with the function selector. mstore(0, 0xa9059cbb00000000000000000000000000000000000000000000000000000000) mstore(4, to) // Append the "to" argument. mstore(36, amount) // Append the "amount" argument. success := and( // Set success to whether the call reverted, if not we check it either // returned exactly 1 (can't just be non-zero data), or had no return data. or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())), // We use 68 because that's the total length of our calldata (4 + 32 * 2) // Counterintuitively, this call() must be positioned after the or() in the // surrounding and() because and() evaluates its arguments from right to left. call(gas(), token, 0, 0, 68, 0, 32) ) mstore(0x60, 0) // Restore the zero slot to zero. mstore(0x40, memPointer) // Restore the memPointer. } require(success, "TRANSFER_FAILED"); } function safeApprove( ERC20 token, address to, uint256 amount ) internal { bool success; assembly { // We'll write our calldata to this slot below, but restore it later. let memPointer := mload(0x40) // Write the abi-encoded calldata into memory, beginning with the function selector. mstore(0, 0x095ea7b300000000000000000000000000000000000000000000000000000000) mstore(4, to) // Append the "to" argument. mstore(36, amount) // Append the "amount" argument. success := and( // Set success to whether the call reverted, if not we check it either // returned exactly 1 (can't just be non-zero data), or had no return data. or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())), // We use 68 because that's the total length of our calldata (4 + 32 * 2) // Counterintuitively, this call() must be positioned after the or() in the // surrounding and() because and() evaluates its arguments from right to left. call(gas(), token, 0, 0, 68, 0, 32) ) mstore(0x60, 0) // Restore the zero slot to zero. mstore(0x40, memPointer) // Restore the memPointer. } require(success, "APPROVE_FAILED"); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; import {Strings} from "lib/openzeppelin-contracts/contracts/utils/Strings.sol"; import {Base64} from "base64/base64.sol"; import {NounishERC721} from "./base/NounishERC721.sol"; import {NounishDescriptors} from "./libraries/NounishDescriptors.sol"; import {ICharacterSVGRenderer} from "./interfaces/ICharacterSVGRenderer.sol"; contract NounishChristmasMetadata { using Strings for uint256; ICharacterSVGRenderer characterRenderHelper1; ICharacterSVGRenderer characterRenderHelper2; ICharacterSVGRenderer characterRenderHelper3; constructor( ICharacterSVGRenderer renderHelper1, ICharacterSVGRenderer renderHelper2, ICharacterSVGRenderer renderHelper3 ) { characterRenderHelper1 = renderHelper1; characterRenderHelper2 = renderHelper2; characterRenderHelper3 = renderHelper3; } function tokenURI(uint256 id, bytes32 gameID, NounishERC721.Info calldata info) external view returns (string memory) { return string( string.concat( "data:application/json;base64,", Base64.encode( bytes( abi.encodePacked( '{"name":"' "#", id.toString(), " - ", NounishDescriptors.tintColorName(info.tint), " ", NounishDescriptors.characterName(info.character), '", "description":"', "Nounish Christmas NFTs are created by playing the Nounish White Elephant game, where players can open new NFTs by minting and steal opened NFTs from others.", '", "attributes": ', attributes(gameID, info), ', "image": "' "data:image/svg+xml;base64,", Base64.encode(bytes(svg(info))), '"}' ) ) ) ) ); } function svg(NounishERC721.Info calldata info) public view returns (string memory) { return string.concat( '<svg width="500" height="500" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" shape-rendering="crispEdges" style="background-color:#', NounishDescriptors.backgroundColorHex(info.backgroundColor), '" >', '<style type="text/css">', ".noggles{fill:#", NounishDescriptors.noggleColorHex(info.noggleColor), ";}", ".tintable{fill:#", NounishDescriptors.tintColorHex(info.tint), ";}", "</style>", characterSVG(info.character), NounishDescriptors.noggleTypeSVG(info.noggleType), "</svg>" ); } function attributes(bytes32 gameID, NounishERC721.Info calldata info) public view returns (string memory) { return string.concat( "[", _traitTypeString("game ID", uint256(gameID).toString()), ",", _traitTypeString("character", NounishDescriptors.characterName(info.character)), ",", _traitTypeString("tint", NounishDescriptors.tintColorName(info.tint)), ",", _traitTypeString("noggle", NounishDescriptors.noggleTypeName(info.noggleType)), ",", _traitTypeString("noggle color", NounishDescriptors.noggleColorName(info.noggleColor)), ",", _traitTypeString("background color", NounishDescriptors.backgroundColorName(info.backgroundColor)), "]" ); } function characterSVG(uint8 character) public view returns (string memory) { if (character < 7) { return NounishDescriptors.characterSVG(character); } else if (character < 20) { return characterRenderHelper1.characterSVG(character); } else if (character < 29) { return characterRenderHelper2.characterSVG(character); } else { return characterRenderHelper3.characterSVG(character); } } function _traitTypeString(string memory t, string memory v) internal pure returns (string memory) { return string.concat("{", '"trait_type": "', t, '",', '"value": "', v, '"}'); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; import {WhiteElephantNFT, ERC721} from "./base/WhiteElephantNFT.sol"; import {WhiteElephant} from "./base/WhiteElephant.sol"; import {NounishChristmasMetadata} from "./NounishChristmasMetadata.sol"; contract NounishChristmasNFT is WhiteElephantNFT { uint256 private _nonce; WhiteElephant public whiteElephant; NounishChristmasMetadata public metadata; constructor(NounishChristmasMetadata _metadata) ERC721("Nounish White Elephant Christmas", "NWEC") { whiteElephant = WhiteElephant(msg.sender); metadata = _metadata; } function mint(address to) external override returns (uint256 id) { require(msg.sender == address(whiteElephant), "FORBIDDEN"); _mint(to, (id = _nonce++)); require(id < 1 << 64, "MAX_MINT"); bytes32 h = keccak256(abi.encode(id, to, block.timestamp)); _nftInfo[id].character = uint8(h[0]) % 32 + 1; _nftInfo[id].tint = uint8(h[1]) % 12 + 1; _nftInfo[id].backgroundColor = uint8(h[2]) % 4 + 1; _nftInfo[id].noggleType = uint8(h[3]) % 3 + 1; _nftInfo[id].noggleColor = uint8(h[4]) % 4 + 1; } /// @dev steal should be guarded as an owner/admin function function steal(address from, address to, uint256 id) external override { require(msg.sender == address(whiteElephant), "FORBIDDEN"); // Underflow of the sender's balance is impossible because we check for // ownership above and the recipient's balance can't realistically overflow. unchecked { _balanceOf[from]--; _balanceOf[to]++; } _nftInfo[id].owner = to; delete getApproved[id]; emit Transfer(from, to, id); } function transferFrom(address from, address to, uint256 id) public override { require(whiteElephant.state(whiteElephant.tokenGameID(id)).gameOver, "GAME_IN_PROGRESS"); super.transferFrom(from, to, id); } function updateMetadata(NounishChristmasMetadata _metadata) external { require(msg.sender == address(whiteElephant), "FORBIDDEN"); metadata = _metadata; } function tokenURI(uint256 id) public view override returns (string memory) { return metadata.tokenURI(id, whiteElephant.tokenGameID(id), _nftInfo[id]); } function nftInfo(uint256 id) public view returns (Info memory) { return _nftInfo[id]; } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; import {ERC721} from "solmate/tokens/ERC721.sol"; abstract contract NounishERC721 is ERC721 { struct Info { uint8 character; uint8 tint; uint8 backgroundColor; uint8 noggleType; uint8 noggleColor; address owner; } mapping(uint256 => Info) public _nftInfo; function transferFrom(address from, address to, uint256 id) public virtual override { require(from == _nftInfo[id].owner, "WRONG_FROM"); require(to != address(0), "INVALID_RECIPIENT"); require( msg.sender == from || isApprovedForAll[from][msg.sender] || msg.sender == getApproved[id], "NOT_AUTHORIZED" ); // Underflow of the sender's balance is impossible because we check for // ownership above and the recipient's balance can't realistically overflow. unchecked { _balanceOf[from]--; _balanceOf[to]++; } _nftInfo[id].owner = to; delete getApproved[id]; emit Transfer(from, to, id); } function approve(address spender, uint256 id) public override { address owner = _nftInfo[id].owner; require(msg.sender == owner || isApprovedForAll[owner][msg.sender], "NOT_AUTHORIZED"); getApproved[id] = spender; emit Approval(owner, spender, id); } // function tokenURI(uint256 id) public view override returns (string memory) { // return ""; // } function ownerOf(uint256 id) public view override returns (address owner) { require((owner = _nftInfo[id].owner) != address(0), "NOT_MINTED"); } function _mint(address to, uint256 id) internal override { require(to != address(0), "INVALID_RECIPIENT"); require(_nftInfo[id].owner == address(0), "ALREADY_MINTED"); // Counter overflow is incredibly unrealistic. unchecked { _balanceOf[to]++; } _nftInfo[id].owner = to; emit Transfer(address(0), to, id); } function _burn(uint256 id) internal override { address owner = _nftInfo[id].owner; require(owner != address(0), "NOT_MINTED"); // Ownership check above ensures no underflow. unchecked { _balanceOf[owner]--; } delete _nftInfo[id]; delete getApproved[id]; emit Transfer(owner, address(0), id); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; import {WhiteElephantNFT} from "./WhiteElephantNFT.sol"; contract WhiteElephant { /// @dev when game already Exists error GameExists(); /// @dev when msg.sender is not `currentParticipantTurn` error NotTurn(); /// @dev when tokenID was not minted in game error InvalidTokenIDForGame(); /// @dev when tokenID has already been stolen twice error MaxSteals(); /// @dev when tokenID was just stolen error JustStolen(); /// @dev when game is over error GameOver(); event StartGame(bytes32 indexed gameID, Game game); event Open(bytes32 indexed gameID, address indexed player, uint256 indexed tokenId); event Steal(bytes32 indexed gameID, address indexed stealer, uint256 indexed tokenId, address stolenFrom); struct Game { /// @dev the addresses in this game, ordered how they should have turns address[] participants; /// @dev any unique value, probably timestamp best uint256 nonce; } // used to prevent stealing back immediately // cannot be stollen if curRound == round // and trying to steal lastStolenID struct LastStealInfo { // which NFT was last stole uint64 lastStolenID; uint8 round; } struct GameState { // starts at 0 // for whose turn, use participants[round - 1] uint8 round; bool gameOver; // used to track who goes next after a steal address nextToGo; LastStealInfo lastStealInfo; } WhiteElephantNFT public nft; /// @notice how many times has a tokenID been stolen mapping(uint256 => uint256) public timesStolen; /// @notice what game a given tokenID was minted in mapping(uint256 => bytes32) public tokenGameID; mapping(bytes32 => GameState) internal _state; /// @notice starts a game /// @dev does not check participant addresses, address(0) or other incorrect /// address could render game unable to progress /// @dev reverts if `game` exists /// @param game Game specification, {participants: address[], nonce: uint256} /// @return _gameID the unique identifier for the game function startGame(Game calldata game) public payable virtual returns (bytes32 _gameID) { _gameID = gameID(game); if (_state[_gameID].round != 0) { revert GameExists(); } _state[_gameID].round = 1; emit StartGame(_gameID, game); } /// @notice open a new gift /// @param game the game the participant caller is in and wishes to open in /// game = {participants: address[], nonce: uint256} function open(Game calldata game) public virtual { bytes32 _gameID = gameID(game); _checkGameOver(_gameID); _checkTurn(_gameID, game); uint8 newRoundCount = _state[_gameID].round + 1; _state[_gameID].round = newRoundCount; if (newRoundCount > game.participants.length) { _state[_gameID].gameOver = true; } _state[_gameID].nextToGo = address(0); uint256 tokenID = nft.mint(msg.sender); tokenGameID[tokenID] = _gameID; emit Open(_gameID, msg.sender, tokenID); } /// @notice Steals NFT from another participant /// @dev reverts if tokenID not minted in `game` /// @dev reverts if token has been stolen twice already /// @dev reverts if tokenID was just stolen /// @param game the game the participant is in and wishes to steal in /// game = {participants: address[], nonce: uint256} /// @param tokenID that token they wish to steal, must have been minted by another participant in same game function steal(Game calldata game, uint256 tokenID) public virtual { bytes32 _gameID = gameID(game); _checkGameOver(_gameID); _checkTurn(_gameID, game); if (_gameID != tokenGameID[tokenID]) { revert InvalidTokenIDForGame(); } if (timesStolen[tokenID] == 2) { revert MaxSteals(); } uint8 currentRound = _state[_gameID].round; if (_state[_gameID].round == _state[_gameID].lastStealInfo.round) { if (_state[_gameID].lastStealInfo.lastStolenID == tokenID) { revert JustStolen(); } } timesStolen[tokenID] += 1; _state[_gameID].lastStealInfo = LastStealInfo({lastStolenID: uint64(tokenID), round: currentRound}); address currentOwner = nft.ownerOf(tokenID); _state[_gameID].nextToGo = currentOwner; nft.steal(currentOwner, msg.sender, tokenID); emit Steal(_gameID, msg.sender, tokenID, currentOwner); } /// @notice returns the state of the given game ID /// @param _gameID the game identifier, from gameID(game) /// @return state the state of the game /// struct GameState { /// uint8 round; /// bool gameOver; /// address nextToGo; /// LastStealInfo lastStealInfo; /// } /// struct LastStealInfo { /// uint64 lastStolenID; /// uint8 round; /// } function state(bytes32 _gameID) public view virtual returns (GameState memory) { return _state[_gameID]; } /// @notice returns which address can call open or steal next in a given game /// @param _gameID the id of the game /// @param game the game /// game = {participants: address[], nonce: uint256} /// @return participant the address that is up to go next function currentParticipantTurn(bytes32 _gameID, Game calldata game) public view virtual returns (address) { if (_state[_gameID].gameOver) { return address(0); } address next = _state[_gameID].nextToGo; if (next != address(0)) return next; return game.participants[_state[_gameID].round - 1]; } /// @notice returns the unique identifier for a given game /// @param game, {participants: address[], nonce: uint256} /// @return gameID the id of the game function gameID(Game calldata game) public pure virtual returns (bytes32) { return keccak256(abi.encode(game)); } function _checkTurn(bytes32 _gameID, Game calldata game) internal view { if (currentParticipantTurn(_gameID, game) != msg.sender) { revert NotTurn(); } } function _checkGameOver(bytes32 _gameID) internal view { if (_state[_gameID].gameOver) { revert GameOver(); } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; import {NounishERC721, ERC721} from "./NounishERC721.sol"; abstract contract WhiteElephantNFT is NounishERC721 { /// @dev mint should be guarded as an owner/admin function function mint(address to) external virtual returns (uint256); /// @dev steal should be guarded as an owner/admin function function steal(address from, address to, uint256 id) external virtual; }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; interface ICharacterSVGRenderer { function characterSVG(uint8 character) external pure returns (string memory); }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; library NoggleSVGs { function basic() internal pure returns (string memory) { return '<rect x="6" y="8" width="1" height="2" class="noggles"/>' '<rect x="8" y="6" width="1" height="4" class="noggles"/>' '<rect x="13" y="6" width="1" height="4" class="noggles"/>' '<rect x="16" y="6" width="1" height="4" class="noggles"/>' '<rect x="11" y="6" width="1" height="4" class="noggles"/>' '<rect x="7" y="8" width="1" height="1" class="noggles"/>' '<rect x="12" y="8" width="1" height="1" class="noggles"/>' '<rect x="9" y="6" width="2" height="1" class="noggles"/>' '<rect x="14" y="6" width="2" height="1" class="noggles"/>' '<rect x="14" y="9" width="2" height="1" class="noggles"/>' '<rect x="9" y="9" width="2" height="1" class="noggles"/>' '<rect x="15" y="7" width="1" height="2" fill="black"/>' '<rect x="10" y="7" width="1" height="2" fill="black"/>' '<rect x="14" y="7" width="1" height="2" fill="white"/>' '<rect x="9" y="7" width="1" height="2" fill="white"/>'; } function cool() internal pure returns (string memory) { return '<rect x="6" y="8" width="1" height="2" class="noggles"/>' '<rect x="8" y="6" width="1" height="4" class="noggles"/>' '<rect x="13" y="6" width="1" height="4" class="noggles"/>' '<rect x="16" y="6" width="1" height="4" class="noggles"/>' '<rect x="11" y="6" width="1" height="4" class="noggles"/>' '<rect x="7" y="8" width="1" height="1" class="noggles"/>' '<rect x="12" y="8" width="1" height="1" class="noggles"/>' '<rect x="9" y="6" width="2" height="1" class="noggles"/>' '<rect x="14" y="6" width="2" height="1" class="noggles"/>' '<rect x="14" y="7" width="1" height="3" class="noggles"/>' '<rect x="9" y="7" width="1" height="3" class="noggles"/>' '<rect x="10" y="8" width="1" height="2" class="noggles"/>' '<rect x="15" y="8" width="1" height="2" class="noggles"/>' '<rect x="15" y="7" width="1" height="1" fill="white"/>' '<rect x="10" y="7" width="1" height="1" fill="white"/>'; } function large() internal pure returns (string memory) { return '<rect x="3" y="8" width="1" height="3" class="noggles"/>' '<rect x="4" y="8" width="2" height="1" class="noggles"/>' '<rect x="6" y="6" width="1" height="6" class="noggles"/>' '<rect x="7" y="11" width="4" height="1" class="noggles"/>' '<rect x="7" y="6" width="4" height="1" class="noggles"/>' '<rect x="11" y="6" width="1" height="6" class="noggles"/>' '<rect x="12" y="8" width="1" height="1" class="noggles"/>' '<rect x="13" y="6" width="1" height="6" class="noggles"/>' '<rect x="18" y="6" width="1" height="6" class="noggles"/>' '<rect x="14" y="6" width="4" height="1" class="noggles"/>' '<rect x="14" y="11" width="4" height="1" class="noggles"/>' '<rect x="16" y="7" width="2" height="4" fill="black"/>' '<rect x="9" y="7" width="2" height="4" fill="black"/>' '<rect x="14" y="7" width="2" height="4" fill="white"/>' '<rect x="7" y="7" width="2" height="4" fill="white"/>'; } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; import {NoggleSVGs} from "./NoggleSVGs.sol"; import {OneThroughSixCharacterSVGs} from "./OneThroughSixCharacterSVGs.sol"; library NounishDescriptors { function characterName(uint8 character) internal pure returns (string memory) { if (character == 1) { return "Cardinal"; } else if (character == 2) { return "Swan"; } else if (character == 3) { return "Blockhead"; } else if (character == 4) { return "Dad"; } else if (character == 5) { return "Trout Sniffer"; } else if (character == 6) { return "Elf"; } else if (character == 7) { return "Mothertrucker"; } else if (character == 8) { return "Girl"; } else if (character == 9) { return "Lamp"; } else if (character == 10) { return "Mean One"; } else if (character == 11) { return "Miner"; } else if (character == 12) { return "Mrs. Claus"; } else if (character == 13) { return "Noggleman"; } else if (character == 14) { return "Noggle Tree"; } else if (character == 15) { return "Nutcracker"; } else if (character == 16) { return "Partridge in a Pear Tree"; } else if (character == 17) { return "Rat King"; } else if (character == 18) { return "Reindeer S"; } else if (character == 19) { return "Reindeer Pro Max"; } else if (character == 20) { return "Santa S"; } else if (character == 21) { return "Santa Max Pro"; } else if (character == 22) { return "Skeleton"; } else if (character == 23) { return "Chunky Snowman"; } else if (character == 24) { return "Slender Snowman"; } else if (character == 25) { return "Snowman Pro Max"; } else if (character == 26) { return "Sugar Plum Fairy"; } else if (character == 27) { return "Short Thief"; } else if (character == 28) { return "Tall Thief"; } else if (character == 29) { return "Train"; } else if (character == 30) { return "Christmas Tree"; } else if (character == 31) { return "Yeti S"; } else if (character == 32) { return "Yeti Pro Max"; } return ""; } /// @dev wanted to make the most of contract space, only renders through character 6 function characterSVG(uint8 character) internal pure returns (string memory) { if (character == 1) { return OneThroughSixCharacterSVGs.cardinal(); } else if (character == 2) { return OneThroughSixCharacterSVGs.swan(); } else if (character == 3) { return OneThroughSixCharacterSVGs.blockhead(); } else if (character == 4) { return OneThroughSixCharacterSVGs.dad(); } else if (character == 5) { return OneThroughSixCharacterSVGs.troutSniffer(); } else if (character == 6) { return OneThroughSixCharacterSVGs.elf(); } return ""; } function noggleTypeName(uint8 noggleType) internal pure returns (string memory) { if (noggleType == 1) { return "Noggles S"; } else if (noggleType == 2) { return "Cool Noggles"; } else if (noggleType == 3) { return "Noggles Pro Max"; } return ""; } function noggleTypeSVG(uint8 noggleType) internal pure returns (string memory) { if (noggleType == 1) { return NoggleSVGs.basic(); } else if (noggleType == 2) { return NoggleSVGs.cool(); } else if (noggleType == 3) { return NoggleSVGs.large(); } return ""; } function noggleColorName(uint8 noggleColor) internal pure returns (string memory) { if (noggleColor == 1) { return "Dark Plum"; } else if (noggleColor == 2) { return "Warm Red"; } else if (noggleColor == 3) { return "Peppermint"; } else if (noggleColor == 4) { return "Cold Blue"; } else if (noggleColor == 5) { return "Ring-a-Ding"; } return ""; } function noggleColorHex(uint8 noggleColor) internal pure returns (string memory) { if (noggleColor == 1) { return "513340"; } else if (noggleColor == 2) { return "bd2d24"; } else if (noggleColor == 3) { return "4ab49a"; } else if (noggleColor == 4) { return "0827f5"; } else if (noggleColor == 5) { return "f0c14d"; } return ""; } function backgroundColorName(uint8 background) internal pure returns (string memory) { if (background == 1) { return "Douglas Fir"; } else if (background == 2) { return "Night"; } else if (background == 3) { return "Rooftop"; } else if (background == 4) { return "Mistletoe"; } else if (background == 5) { return "Spice"; } return ""; } function backgroundColorHex(uint8 background) internal pure returns (string memory) { if (background == 1) { return "3e5d25"; } else if (background == 2) { return "100d98"; } else if (background == 3) { return "403037"; } else if (background == 4) { return "326849"; } else if (background == 5) { return "651d19"; } return ""; } function tintColorName(uint8 tint) internal pure returns (string memory) { if (tint == 1) { return "Boot Black"; } else if (tint == 2) { return "Fairydust"; } else if (tint == 3) { return "Elf"; } else if (tint == 4) { return "Plum"; } else if (tint == 5) { return "Explorer"; } else if (tint == 6) { return "Hot Cocoa"; } else if (tint == 7) { return "Carrot"; } else if (tint == 8) { return "Spruce"; } else if (tint == 9) { return "Holly"; } else if (tint == 10) { return "Sleigh"; } else if (tint == 11) { return "Jolly"; } else if (tint == 12) { return "Coal"; } else if (tint == 13) { return "Snow White"; } return ""; } function tintColorHex(uint8 tint) internal pure returns (string memory) { if (tint == 1) { return "000000"; } else if (tint == 2) { return "2a46ff"; } else if (tint == 3) { return "f38b7c"; } else if (tint == 4) { return "7c3c58"; } else if (tint == 5) { return "16786c"; } else if (tint == 6) { return "36262d"; } else if (tint == 7) { return "cb7300"; } else if (tint == 8) { return "06534a"; } else if (tint == 9) { return "369f49"; } else if (tint == 10) { return "ff0e0e"; } else if (tint == 11) { return "fd5442"; } else if (tint == 12) { return "453f41"; } else if (tint == 13) { return "ffffff"; } return ""; } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; library OneThroughSixCharacterSVGs { function cardinal() internal pure returns (string memory) { return '<rect x="11" y="1" width="1" height="1" class="tintable"/>' '<rect x="9" y="15" width="1" height="1" class="tintable"/>' '<rect x="12" y="15" width="1" height="1" class="tintable"/>' '<rect x="2" y="6" width="1" height="1" class="tintable"/>' '<rect x="10" y="2" width="3" height="1" class="tintable"/>' '<rect x="3" y="9" width="3" height="1" class="tintable"/>' '<rect x="2" y="8" width="3" height="1" class="tintable"/>' '<rect x="1" y="7" width="3" height="1" class="tintable"/>' '<rect x="11" y="3" width="3" height="1" class="tintable"/>' '<rect x="11" y="5" width="4" height="1" class="tintable"/>' '<rect x="10" y="6" width="4" height="1" class="tintable"/>' '<rect x="11" y="7" width="2" height="1" class="tintable"/>' '<rect x="10" y="8" width="3" height="1" class="tintable"/>' '<rect x="9" y="9" width="5" height="1" class="tintable"/>' '<rect x="4" y="10" width="11" height="1" class="tintable"/>' '<rect x="5" y="11" width="11" height="1" class="tintable"/>' '<rect x="6" y="12" width="10" height="1" class="tintable"/>' '<rect x="7" y="13" width="8" height="1" class="tintable"/>' '<rect x="8" y="14" width="6" height="1" class="tintable"/>' '<rect x="10" y="4" width="5" height="1" class="tintable"/>' '<rect x="9" y="16" width="1" height="5" fill="white"/>' '<rect x="12" y="16" width="1" height="5" fill="white"/>' '<rect x="9" y="21" width="2" height="1" fill="white"/>' '<rect x="12" y="21" width="2" height="1" fill="white"/>' '<rect x="13" y="7" width="1" height="2" fill="black"/>' '<rect x="16" y="7" width="2" height="3" fill="#CB7300"/>' '<rect x="18" y="8" width="1" height="1" fill="#CB7300"/>' '<rect x="14" y="6" width="1" height="4" fill="black"/>' '<rect x="15" y="5" width="1" height="6" fill="black"/>'; } function swan() internal pure returns (string memory) { return '<rect y="14" width="24" height="10" class="tintable"/>' '<rect x="1" y="8" width="1" height="1" fill="white"/>' '<rect x="6" y="9" width="1" height="1" fill="white"/>' '<rect x="2" y="9" width="1" height="1" fill="white"/>' '<rect x="3" y="10" width="1" height="1" fill="white"/>' '<rect x="4" y="11" width="1" height="1" fill="white"/>' '<rect x="5" y="10" width="1" height="3" fill="white"/>' '<rect x="6" y="11" width="1" height="3" fill="white"/>' '<rect x="7" y="8" width="1" height="3" fill="white"/>' '<rect x="13" y="7" width="1" height="4" fill="white"/>' '<rect x="7" y="12" width="1" height="2" fill="white"/>' '<rect x="13" y="12" width="1" height="2" fill="white"/>' '<rect x="8" y="7" width="5" height="5" fill="white"/>' '<rect x="8" y="13" width="5" height="1" fill="white"/>' '<rect x="14" y="7" width="1" height="7" fill="white"/>' '<rect x="15" y="8" width="1" height="6" fill="white"/>' '<rect x="16" y="9" width="1" height="5" fill="white"/>' '<rect x="17" y="3" width="1" height="10" fill="white"/>' '<rect x="18" y="3" width="1" height="1" fill="white"/>' '<rect x="19" y="4" width="1" height="5" fill="white"/>' '<rect x="21" y="7" width="1" height="2" fill="white"/>' '<rect x="20" y="7" width="1" height="1" fill="white"/>' '<rect x="19" y="9" width="3" height="1" fill="black"/>' '<rect x="20" y="8" width="1" height="1" fill="black"/>' '<rect x="20" y="10" width="1" height="1" fill="#CB7300"/>'; } function blockhead() internal pure returns (string memory) { return '<rect x="6" y="2" width="10" height="1" fill="#CB7300"/>' '<rect x="11" y="3" width="5" height="1" fill="#CB7300"/>' '<rect x="11" y="4" width="7" height="1" fill="#CB7300"/>' '<rect x="6" y="4" width="4" height="1" fill="#CB7300"/>' '<rect x="6" y="21" width="5" height="1" fill="#CB7300"/>' '<rect x="12" y="21" width="5" height="1" fill="#CB7300"/>' '<rect x="6" y="5" width="10" height="3" fill="#F38B7C"/>' '<rect x="5" y="8" width="13" height="2" fill="#F38B7C"/>' '<rect x="15" y="10" width="3" height="1" fill="#F38B7C"/>' '<rect x="13" y="10" width="1" height="1" fill="#F38B7C"/>' '<rect x="17" y="17" width="1" height="1" fill="#F38B7C"/>' '<rect x="5" y="17" width="2" height="1" fill="#F38B7C"/>' '<rect x="12" y="11" width="1" height="1" fill="#F38B7C"/>' '<rect x="14" y="11" width="1" height="1" fill="#F38B7C"/>' '<rect x="11" y="10" width="1" height="1" fill="#F38B7C"/>' '<rect x="10" y="11" width="1" height="1" fill="#F38B7C"/>' '<rect x="6" y="10" width="4" height="1" fill="#F38B7C"/>' '<rect x="6" y="11" width="3" height="1" fill="#F38B7C"/>' '<rect x="6" y="12" width="10" height="1" fill="#F38B7C"/>' '<rect x="9" y="11" width="1" height="1" fill="black"/>' '<rect x="7" y="18" width="4" height="3" fill="black"/>' '<rect x="12" y="18" width="4" height="3" fill="black"/>' '<rect x="10" y="10" width="1" height="1" fill="black"/>' '<rect x="11" y="11" width="1" height="1" fill="black"/>' '<rect x="12" y="10" width="1" height="1" fill="black"/>' '<rect x="13" y="11" width="1" height="1" fill="black"/>' '<rect x="16" y="13" width="1" height="1" class="tintable"/>' '<rect x="17" y="14" width="1" height="3" class="tintable"/>' '<rect x="15" y="14" width="1" height="4" class="tintable"/>' '<rect x="13" y="13" width="2" height="5" class="tintable"/>' '<rect x="8" y="13" width="4" height="5" class="tintable"/>' '<rect x="5" y="13" width="2" height="4" class="tintable"/>' '<rect x="14" y="10" width="1" height="1" fill="black"/>' '<rect x="15" y="11" width="1" height="1" fill="black"/>'; } function dad() internal pure returns (string memory) { return 'return <rect x="11" y="1" width="1" height="1" fill="#FF0E0E"/>' '<rect x="9" y="3" width="1" height="2" fill="#FF0E0E"/>' '<rect x="10" y="2" width="3" height="1" fill="#FF0E0E"/>' '<rect x="10" y="4" width="3" height="1" fill="#F38B7C"/>' '<rect x="10" y="6" width="3" height="1" fill="#F38B7C"/>' '<rect x="10" y="3" width="3" height="1" fill="white"/>' '<rect x="8" y="5" width="1" height="1" fill="white"/>' '<rect x="11" y="12" width="1" height="1" fill="white"/>' '<rect x="12" y="5" width="1" height="1" fill="#F38B7C"/>' '<rect x="10" y="5" width="1" height="1" fill="#F38B7C"/>' '<rect x="11" y="5" width="1" height="1" fill="black"/>' '<rect x="7" y="7" width="1" height="1" fill="#36262D"/>' '<rect x="9" y="8" width="1" height="1" fill="#36262D"/>' '<rect x="15" y="7" width="1" height="1" fill="#36262D"/>' '<rect x="15" y="9" width="1" height="1" fill="#36262D"/>' '<rect x="15" y="13" width="1" height="1" fill="#36262D"/>' '<rect x="15" y="11" width="1" height="1" fill="#36262D"/>' '<rect x="13" y="8" width="1" height="1" fill="#36262D"/>' '<rect x="9" y="8" width="1" height="1" fill="#36262D"/>' '<rect x="9" y="10" width="1" height="1" fill="#36262D"/>' '<rect x="9" y="12" width="1" height="1" fill="#36262D"/>' '<rect x="9" y="14" width="1" height="1" fill="#36262D"/>' '<rect x="7" y="9" width="1" height="1" fill="#36262D"/>' '<rect x="7" y="9" width="1" height="1" fill="#36262D"/>' '<rect x="7" y="13" width="1" height="1" fill="#36262D"/>' '<rect x="13" y="10" width="1" height="1" fill="#36262D"/>' '<rect x="13" y="12" width="1" height="1" fill="#36262D"/>' '<rect x="13" y="14" width="1" height="1" fill="#36262D"/>' '<rect x="9" y="7" width="1" height="1" fill="#453F41"/>' '<rect x="7" y="8" width="1" height="1" fill="#453F41"/>' '<rect x="13" y="7" width="1" height="1" fill="#453F41"/>' '<rect x="9" y="7" width="1" height="1" fill="#453F41"/>' '<rect x="9" y="9" width="1" height="1" fill="#453F41"/>' '<rect x="9" y="11" width="1" height="1" fill="#453F41"/>' '<rect x="9" y="13" width="1" height="1" fill="#453F41"/>' '<rect x="7" y="10" width="1" height="1" fill="#453F41"/>' '<rect x="7" y="14" width="1" height="1" fill="#453F41"/>' '<rect x="7" y="15" width="1" height="1" fill="#F38B7C"/>' '<rect x="15" y="15" width="1" height="1" fill="#F38B7C"/>' '<rect x="7" y="12" width="1" height="1" fill="#453F41"/>' '<rect x="13" y="9" width="1" height="1" fill="#453F41"/>' '<rect x="13" y="11" width="1" height="1" fill="#453F41"/>' '<rect x="13" y="13" width="1" height="1" fill="#453F41"/>' '<rect x="15" y="8" width="1" height="1" fill="#453F41"/>' '<rect x="15" y="10" width="1" height="1" fill="#453F41"/>' '<rect x="15" y="12" width="1" height="1" fill="#453F41"/>' '<rect x="10" y="13" width="3" height="1" fill="black"/>' '<rect x="10" y="14" width="1" height="1" fill="black"/>' '<rect x="12" y="14" width="1" height="1" fill="black"/>' '<rect x="12" y="15" width="2" height="4" fill="black"/>' '<rect x="9" y="16" width="2" height="4" fill="black"/>' '<rect x="10" y="20" width="1" height="2" fill="black"/>' '<rect x="9" y="21" width="1" height="1" fill="black"/>' '<rect x="12" y="20" width="1" height="1" fill="black"/>' '<rect x="12" y="21" width="2" height="1" fill="black"/>' '<rect x="14" y="11" width="1" height="1" fill="#06534A"/>' '<rect x="15" y="14" width="1" height="1" fill="#06534A"/>' '<rect x="11" y="15" width="1" height="1" fill="#06534A"/>' '<rect x="14" y="16" width="1" height="1" fill="#06534A"/>' '<rect x="15" y="17" width="1" height="1" fill="#06534A"/>' '<rect x="14" y="18" width="1" height="1" fill="#06534A"/>' '<rect x="11" y="18" width="1" height="1" fill="#06534A"/>' '<rect x="8" y="17" width="1" height="1" fill="#06534A"/>' '<rect x="7" y="18" width="1" height="1" fill="#06534A"/>' '<rect x="6" y="19" width="1" height="1" fill="#06534A"/>' '<rect x="7" y="20" width="1" height="1" fill="#06534A"/>' '<rect x="8" y="19" width="1" height="1" fill="#FF0E0E"/>' '<rect x="16" y="18" width="1" height="1" fill="#FF0E0E"/>' '<rect x="17" y="11" width="1" height="1" fill="#FF0E0E"/>' '<rect x="5" y="13" width="1" height="1" fill="#FF0E0E"/>' '<rect x="5" y="11" width="1" height="1" fill="#2A46FF"/>' '<rect x="8" y="12" width="1" height="1" fill="#2A46FF"/>' '<rect x="17" y="14" width="1" height="1" fill="#2A46FF"/>' '<rect x="14" y="15" width="1" height="1" fill="#2A46FF"/>' '<rect x="6" y="17" width="1" height="1" fill="#2A46FF"/>' '<rect x="11" y="20" width="1" height="1" fill="#2A46FF"/>' '<rect x="12" y="19" width="2" height="1" fill="#06534A"/>' '<rect x="8" y="10" width="1" height="1" fill="#06534A"/>' '<rect x="7" y="11" width="1" height="1" fill="#06534A"/>' '<rect x="6" y="12" width="1" height="1" fill="#06534A"/>' '<rect x="8" y="13" width="1" height="1" fill="#06534A"/>' '<rect x="16" y="12" width="1" height="2" fill="#06534A"/>' '<rect x="10" y="7" width="1" height="6" fill="white"/>' '<rect x="12" y="7" width="1" height="6" fill="white"/>' '<rect x="11" y="7" width="1" height="5" class="tintable"/>'; } function troutSniffer() internal pure returns (string memory) { return '<rect x="8" y="7" width="7" height="7" class="tintable"/>' '<rect x="10" y="4" width="3" height="3" fill="#F38B7C"/>' '<rect x="10" y="3" width="3" height="1" fill="#CB7300"/>' '<rect x="11" y="4" width="2" height="1" fill="#CB7300"/>' '<rect x="9" y="5" width="1" height="1" fill="#FD5442"/>' '<rect x="5" y="7" width="1" height="1" class="tintable"/>' '<rect x="17" y="7" width="1" height="1" class="tintable"/>' '<rect x="5" y="9" width="1" height="1" class="tintable"/>' '<rect x="17" y="9" width="1" height="1" class="tintable"/>' '<rect x="5" y="11" width="1" height="1" class="tintable"/>' '<rect x="17" y="11" width="1" height="1" class="tintable"/>' '<rect x="5" y="13" width="1" height="1" class="tintable"/>' '<rect x="17" y="13" width="1" height="1" class="tintable"/>' '<rect x="5" y="15" width="1" height="1" class="tintable"/>' '<rect x="17" y="15" width="1" height="1" class="tintable"/>' '<rect x="13" y="5" width="1" height="1" fill="#FD5442"/>' '<rect x="16" y="16" width="1" height="1" fill="#F38B7C"/>' '<rect x="6" y="16" width="1" height="1" fill="#F38B7C"/>' '<rect x="8" y="7" width="1" height="1" fill="#06534A"/>' '<rect x="9" y="8" width="1" height="1" fill="#06534A"/>' '<rect x="10" y="9" width="1" height="1" fill="#06534A"/>' '<rect x="11" y="10" width="1" height="1" fill="#06534A"/>' '<rect x="12" y="11" width="1" height="1" fill="#06534A"/>' '<rect x="13" y="12" width="1" height="1" fill="#06534A"/>' '<rect x="12" y="14" width="2" height="6" fill="#06534A"/>' '<rect x="9" y="14" width="2" height="6" fill="#06534A"/>' '<rect width="2" height="1" transform="matrix(1 0 0 -1 9 21)" fill="#CB7300"/>' '<rect width="2" height="1" transform="matrix(1 0 0 -1 12 21)" fill="#CB7300"/>' '<rect width="3" height="1" transform="matrix(1 0 0 -1 12 22)" fill="#08030D"/>' '<rect width="3" height="1" transform="matrix(1 0 0 -1 8 22)" fill="#08030D"/>' '<rect x="9" y="13" width="6" height="1" fill="#06534A"/>' '<rect x="16" y="7" width="1" height="9" class="tintable"/>' '<rect x="6" y="7" width="1" height="9" class="tintable"/>'; } function elf() internal pure returns (string memory) { return '<rect x="9" y="11" width="5" height="3" fill="black"/>' '<rect x="12" y="21" width="4" height="1" fill="black"/>' '<rect x="7" y="21" width="4" height="1" fill="black"/>' '<rect x="7" y="20" width="1" height="1" fill="black"/>' '<rect x="15" y="20" width="1" height="1" fill="black"/>' '<rect x="12" y="14" width="2" height="7" fill="#CB7300"/>' '<rect x="9" y="14" width="2" height="7" fill="#CB7300"/>' '<rect x="9" y="6" width="5" height="5" class="tintable"/>' '<rect x="8" y="3" width="1" height="1" fill="#FF0E0E"/>' '<rect x="9" y="2" width="1" height="1" class="tintable"/>' '<rect x="9" y="14" width="1" height="1" class="tintable"/>' '<rect x="13" y="14" width="1" height="1" class="tintable"/>' '<rect x="7" y="9" width="1" height="7" class="tintable"/>' '<rect x="15" y="9" width="1" height="7" class="tintable"/>' '<rect x="9" y="3" width="2" height="1" class="tintable"/>' '<rect x="9" y="5" width="4" height="1" class="tintable"/>' '<rect x="9" y="6" width="5" height="1" fill="white"/>' '<rect x="9" y="7" width="2" height="1" fill="white"/>' '<rect x="9" y="8" width="1" height="1" fill="white"/>' '<rect x="7" y="16" width="1" height="1" fill="white"/>' '<rect width="1" height="1" transform="matrix(1 0 0 -1 15 17)" fill="white"/>' '<rect width="1" height="1" transform="matrix(1 0 0 -1 15 18)" fill="#F38B7C"/>' '<rect width="1" height="1" transform="matrix(1 0 0 -1 7 18)" fill="#F38B7C"/>' '<rect x="13" y="8" width="1" height="1" fill="white"/>' '<rect x="12" y="7" width="2" height="1" fill="white"/>' '<rect x="9" y="4" width="3" height="1" fill="#F0C14D"/>' '<rect x="10" y="11" width="3" height="1" fill="#F0C14D"/>' '<rect x="10" y="13" width="3" height="1" fill="#F0C14D"/>' '<rect x="10" y="12" width="1" height="1" fill="#F0C14D"/>' '<rect x="12" y="12" width="1" height="1" fill="#F0C14D"/>'; } }
{ "remappings": [ "base64/=lib/base64/", "ds-test/=lib/forge-std/lib/ds-test/src/", "forge-std/=lib/forge-std/src/", "solmate/=lib/solmate/src/" ], "optimizer": { "enabled": true, "runs": 200 }, "metadata": { "bytecodeHash": "ipfs" }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "london", "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"uint256","name":"fee","type":"uint256"},{"internalType":"uint256","name":"_endTimestamp","type":"uint256"},{"internalType":"contract NounishChristmasMetadata","name":"_metadata","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"DoneForNow","type":"error"},{"inputs":[],"name":"GameExists","type":"error"},{"inputs":[],"name":"GameOver","type":"error"},{"inputs":[],"name":"InsufficientPayment","type":"error"},{"inputs":[],"name":"InvalidTokenIDForGame","type":"error"},{"inputs":[],"name":"JustStolen","type":"error"},{"inputs":[],"name":"MaxSteals","type":"error"},{"inputs":[],"name":"NotTurn","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"gameID","type":"bytes32"},{"indexed":true,"internalType":"address","name":"player","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Open","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnerUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"gameID","type":"bytes32"},{"components":[{"internalType":"address[]","name":"participants","type":"address[]"},{"internalType":"uint256","name":"nonce","type":"uint256"}],"indexed":false,"internalType":"struct WhiteElephant.Game","name":"game","type":"tuple"}],"name":"StartGame","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"gameID","type":"bytes32"},{"indexed":true,"internalType":"address","name":"stealer","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"address","name":"stolenFrom","type":"address"}],"name":"Steal","type":"event"},{"inputs":[{"internalType":"bytes32","name":"_gameID","type":"bytes32"},{"components":[{"internalType":"address[]","name":"participants","type":"address[]"},{"internalType":"uint256","name":"nonce","type":"uint256"}],"internalType":"struct WhiteElephant.Game","name":"game","type":"tuple"}],"name":"currentParticipantTurn","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"endTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address[]","name":"participants","type":"address[]"},{"internalType":"uint256","name":"nonce","type":"uint256"}],"internalType":"struct WhiteElephant.Game","name":"game","type":"tuple"}],"name":"gameID","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"nft","outputs":[{"internalType":"contract WhiteElephantNFT","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address[]","name":"participants","type":"address[]"},{"internalType":"uint256","name":"nonce","type":"uint256"}],"internalType":"struct WhiteElephant.Game","name":"game","type":"tuple"}],"name":"open","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"participantFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_new","type":"uint256"}],"name":"setEndTimestamp","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"setOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address[]","name":"participants","type":"address[]"},{"internalType":"uint256","name":"nonce","type":"uint256"}],"internalType":"struct WhiteElephant.Game","name":"game","type":"tuple"}],"name":"startGame","outputs":[{"internalType":"bytes32","name":"_gameID","type":"bytes32"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_gameID","type":"bytes32"}],"name":"state","outputs":[{"components":[{"internalType":"uint8","name":"round","type":"uint8"},{"internalType":"bool","name":"gameOver","type":"bool"},{"internalType":"address","name":"nextToGo","type":"address"},{"components":[{"internalType":"uint64","name":"lastStolenID","type":"uint64"},{"internalType":"uint8","name":"round","type":"uint8"}],"internalType":"struct WhiteElephant.LastStealInfo","name":"lastStealInfo","type":"tuple"}],"internalType":"struct WhiteElephant.GameState","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address[]","name":"participants","type":"address[]"},{"internalType":"uint256","name":"nonce","type":"uint256"}],"internalType":"struct WhiteElephant.Game","name":"game","type":"tuple"},{"internalType":"uint256","name":"tokenID","type":"uint256"}],"name":"steal","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"timesStolen","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokenGameID","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract NounishChristmasMetadata","name":"_metadata","type":"address"}],"name":"updateMetadata","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b50604051612b1f380380612b1f83398101604081905261002f916100e8565b600480546001600160a01b0319163390811790915560405181906000907f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d76908290a3508060405161007f906100db565b6001600160a01b039091168152602001604051809103906000f0801580156100ab573d6000803e3d6000fd5b50600080546001600160a01b0319166001600160a01b03929092169190911790555060059190915560065561012e565b6119d58061114a83390190565b6000806000606084860312156100fd57600080fd5b83516020850151604086015191945092506001600160a01b038116811461012357600080fd5b809150509250925092565b61100d8061013d6000396000f3fe6080604052600436106100f35760003560e01c80637df6a6c81161008a578063c5e2a7db11610059578063c5e2a7db146102ed578063e49a12dc1461030d578063eeb0511f1461032d578063ff8312271461034d57600080fd5b80637df6a6c8146102815780638da5cb5b146102a15780639c031ace146102c1578063a85adeab146102d757600080fd5b80634ff1c59b116100c65780634ff1c59b1461019757806354275c46146101c5578063590b990b146101d857806361d585da1461020557600080fd5b80630a9af7bd146100f857806313af4035146101355780633c65000d1461015757806347ccca0214610177575b600080fd5b34801561010457600080fd5b50610118610113366004610cbc565b61037a565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561014157600080fd5b50610155610150366004610d18565b610422565b005b34801561016357600080fd5b50610155610172366004610d3c565b6104a1565b34801561018357600080fd5b50600054610118906001600160a01b031681565b3480156101a357600080fd5b506101b76101b2366004610d3c565b6104d0565b60405190815260200161012c565b6101b76101d3366004610d3c565b610500565b3480156101e457600080fd5b506101b76101f3366004610d71565b60016020526000908152604090205481565b34801561021157600080fd5b50610225610220366004610d71565b610566565b60405161012c9190815160ff90811682526020808401511515818401526040808501516001600160a01b031690840152606093840151805167ffffffffffffffff16948401949094529290920151909116608082015260a00190565b34801561028d57600080fd5b5061015561029c366004610d71565b610619565b3480156102ad57600080fd5b50600454610118906001600160a01b031681565b3480156102cd57600080fd5b506101b760055481565b3480156102e357600080fd5b506101b760065481565b3480156102f957600080fd5b50610155610308366004610d18565b610648565b34801561031957600080fd5b50610155610328366004610d8a565b6106d4565b34801561033957600080fd5b50610155610348366004610db6565b61070c565b34801561035957600080fd5b506101b7610368366004610d71565b60026020526000908152604090205481565b600082815260036020526040812054610100900460ff161561039e5750600061041c565b6000838152600360205260409020546201000090046001600160a01b031680156103c957905061041c565b6103d38380610dfb565b6000868152600360205260409020546103f19060019060ff16610e62565b60ff1681811061040357610403610e7b565b90506020020160208101906104189190610d18565b9150505b92915050565b6004546001600160a01b031633146104555760405162461bcd60e51b815260040161044c90610e91565b60405180910390fd5b600480546001600160a01b0319166001600160a01b03831690811790915560405133907f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d7690600090a350565b6006544211156104c45760405163575c6c9160e11b815260040160405180910390fd5b6104cd81610739565b50565b6000816040516020016104e39190610eb7565b604051602081830303815290604052805190602001209050919050565b60006006544211156105255760405163575c6c9160e11b815260040160405180910390fd5b6005546105328380610dfb565b61053d929150610f5e565b34101561055d5760405163cd1c886760e01b815260040160405180910390fd5b61041c82610896565b61059d6040805160808101825260008082526020808301829052828401829052835180850190945281845283015290606082015290565b506000908152600360209081526040918290208251608081018452815460ff808216835261010082048116151583860152620100009091046001600160a01b031682860152845180860190955260019092015467ffffffffffffffff81168552600160401b900490911691830191909152606081019190915290565b6004546001600160a01b031633146106435760405162461bcd60e51b815260040161044c90610e91565b600655565b6004546001600160a01b031633146106725760405162461bcd60e51b815260040161044c90610e91565b60005460405163c5e2a7db60e01b81526001600160a01b0383811660048301529091169063c5e2a7db90602401600060405180830381600087803b1580156106b957600080fd5b505af11580156106cd573d6000803e3d6000fd5b5050505050565b6004546001600160a01b031633146106fe5760405162461bcd60e51b815260040161044c90610e91565b610708828261092c565b5050565b60065442111561072f5760405163575c6c9160e11b815260040160405180910390fd5b6107088282610982565b6000610744826104d0565b905061074f81610c3d565b6107598183610c72565b6000818152600360205260408120546107769060ff166001610f75565b6000838152600360205260409020805460ff191660ff8316179055905061079d8380610dfb565b90508160ff1611156107c5576000828152600360205260409020805461ff0019166101001790555b600082815260036020526040808220805462010000600160b01b0319169055815490516335313c2160e11b81523360048201526001600160a01b0390911690636a627842906024016020604051808303816000875af115801561082c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108509190610f8e565b600081815260026020526040808220869055519192508291339186917ffa48ecb13b782c85d632bfbac8bacc5a9fccbacaf7807914c48e6d60f875b15a9190a450505050565b60006108a1826104d0565b60008181526003602052604090205490915060ff16156108d45760405163332e591360e21b815260040160405180910390fd5b60008181526003602052604090819020805460ff191660011790555181907fd49624af310011b0738bb3294d81360a2250970102cb325a2da024f6b8e3b4ea9061091f908590610eb7565b60405180910390a2919050565b600080600080600085875af190508061097d5760405162461bcd60e51b815260206004820152601360248201527211551217d514905394d1915497d19052531151606a1b604482015260640161044c565b505050565b600061098d836104d0565b905061099881610c3d565b6109a28184610c72565b60008281526002602052604090205481146109d0576040516315db3de560e01b815260040160405180910390fd5b6000828152600160205260409020546002036109ff5760405163ebd42f3160e01b815260040160405180910390fd5b6000818152600360205260409020805460019091015460ff91821691600160401b909104168103610a665760008281526003602052604090206001015467ffffffffffffffff16839003610a66576040516304d797d560e41b815260040160405180910390fd5b60018060008581526020019081526020016000206000828254610a899190610fa7565b909155505060408051808201825267ffffffffffffffff858116825260ff84811660208085019182526000888152600390915285812094516001909501805492519590941668ffffffffffffffffff1990921691909117600160401b9490921693909302179055805491516331a9108f60e11b81526004810186905290916001600160a01b031690636352211e90602401602060405180830381865afa158015610b37573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b5b9190610fba565b600084815260036020526040808220805462010000600160b01b031916620100006001600160a01b038681169182029290921790925592549151634c1e04f760e11b8152600481019190915233602482015260448101889052929350169063983c09ee90606401600060405180830381600087803b158015610bdc57600080fd5b505af1158015610bf0573d6000803e3d6000fd5b50506040516001600160a01b038416815286925033915085907fcf699bdd4430ab57fbf4adf19ae0d3cbf0eece3f370225ce2e0e87ec0cd9e3d09060200160405180910390a45050505050565b600081815260036020526040902054610100900460ff16156104cd5760405163df469ccb60e01b815260040160405180910390fd5b33610c7d838361037a565b6001600160a01b0316146107085760405163c6e1dd1d60e01b815260040160405180910390fd5b600060408284031215610cb657600080fd5b50919050565b60008060408385031215610ccf57600080fd5b82359150602083013567ffffffffffffffff811115610ced57600080fd5b610cf985828601610ca4565b9150509250929050565b6001600160a01b03811681146104cd57600080fd5b600060208284031215610d2a57600080fd5b8135610d3581610d03565b9392505050565b600060208284031215610d4e57600080fd5b813567ffffffffffffffff811115610d6557600080fd5b61041884828501610ca4565b600060208284031215610d8357600080fd5b5035919050565b60008060408385031215610d9d57600080fd5b8235610da881610d03565b946020939093013593505050565b60008060408385031215610dc957600080fd5b823567ffffffffffffffff811115610de057600080fd5b610dec85828601610ca4565b95602094909401359450505050565b6000808335601e19843603018112610e1257600080fd5b83018035915067ffffffffffffffff821115610e2d57600080fd5b6020019150600581901b3603821315610e4557600080fd5b9250929050565b634e487b7160e01b600052601160045260246000fd5b60ff828116828216039081111561041c5761041c610e4c565b634e487b7160e01b600052603260045260246000fd5b6020808252600c908201526b15539055551213d49256915160a21b604082015260600190565b60006020808352606083018435601e19863603018112610ed657600080fd5b8501828101903567ffffffffffffffff811115610ef257600080fd5b8060051b3603821315610f0457600080fd5b6040868501529182905290600090608086015b81831015610f47578335610f2a81610d03565b6001600160a01b0316815292840192600192909201918401610f17565b848801356040880152809550505050505092915050565b808202811582820484141761041c5761041c610e4c565b60ff818116838216019081111561041c5761041c610e4c565b600060208284031215610fa057600080fd5b5051919050565b8082018082111561041c5761041c610e4c565b600060208284031215610fcc57600080fd5b8151610d3581610d0356fea264697066735822122029b2a752aa375058a14477ed7722b0711f2852c6624b1dccbc974bd9932b6b7a64736f6c6343000811003360806040523480156200001157600080fd5b50604051620019d5380380620019d58339810160408190526200003491620000d5565b60408051808201825260208082527f4e6f756e69736820576869746520456c657068616e74204368726973746d617381830152825180840190935260048352634e57454360e01b908301529060006200008e8382620001ac565b5060016200009d8282620001ac565b505060088054336001600160a01b031991821617909155600980549091166001600160a01b0393909316929092179091555062000278565b600060208284031215620000e857600080fd5b81516001600160a01b03811681146200010057600080fd5b9392505050565b634e487b7160e01b600052604160045260246000fd5b600181811c908216806200013257607f821691505b6020821081036200015357634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620001a757600081815260208120601f850160051c81016020861015620001825750805b601f850160051c820191505b81811015620001a3578281556001016200018e565b5050505b505050565b81516001600160401b03811115620001c857620001c862000107565b620001e081620001d984546200011d565b8462000159565b602080601f831160018114620002185760008415620001ff5750858301515b600019600386901b1c1916600185901b178555620001a3565b600085815260208120601f198616915b82811015620002495788860151825594840194600190910190840162000228565b5085821015620002685787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b61174d80620002886000396000f3fe608060405234801561001057600080fd5b506004361061012c5760003560e01c806370a08231116100ad578063b88d4fde11610071578063b88d4fde1461042d578063c5e2a7db14610440578063c87b56dd14610453578063e985e9c514610466578063f7cc15121461049457600080fd5b806370a082311461034c57806395d89b411461035f578063983c09ee14610367578063a03c5d6e1461037a578063a22cb4651461041a57600080fd5b806323b872dd116100f457806323b872dd146102df578063392f37e9146102f257806342842e0e146103055780636352211e146103185780636a6278421461032b57600080fd5b806301ffc9a71461013157806306fdde0314610159578063081812fc1461016e578063095ea7b3146101af5780631f8bc790146101c4575b600080fd5b61014461013f3660046111aa565b6104a7565b60405190151581526020015b60405180910390f35b6101616104f9565b60405161015091906111f2565b61019761017c366004611225565b6004602052600090815260409020546001600160a01b031681565b6040516001600160a01b039091168152602001610150565b6101c26101bd366004611253565b610587565b005b61027c6101d2366004611225565b6040805160c081018252600080825260208201819052918101829052606081018290526080810182905260a081019190915250600090815260066020908152604091829020825160c081018452905460ff80821683526101008204811693830193909352620100008104831693820193909352630100000083048216606082015264010000000083049091166080820152600160281b9091046001600160a01b031660a082015290565b6040516101509190600060c08201905060ff835116825260ff602084015116602083015260ff604084015116604083015260ff606084015116606083015260ff608084015116608083015260018060a01b0360a08401511660a083015292915050565b6101c26102ed36600461127f565b610675565b600954610197906001600160a01b031681565b6101c261031336600461127f565b61079f565b610197610326366004611225565b61088f565b61033e6103393660046112c0565b6108ed565b604051908152602001610150565b61033e61035a3660046112c0565b610b0e565b610161610b71565b6101c261037536600461127f565b610b7e565b6103d5610388366004611225565b60066020526000908152604090205460ff8082169161010081048216916201000082048116916301000000810482169164010000000082041690600160281b90046001600160a01b031686565b6040805160ff9788168152958716602087015293861693850193909352908416606084015290921660808201526001600160a01b0390911660a082015260c001610150565b6101c26104283660046112eb565b610c45565b6101c261043b366004611324565b610cb1565b6101c261044e3660046112c0565b610d96565b610161610461366004611225565b610de2565b6101446104743660046113c3565b600560209081526000928352604080842090915290825290205460ff1681565b600854610197906001600160a01b031681565b60006301ffc9a760e01b6001600160e01b0319831614806104d857506380ac58cd60e01b6001600160e01b03198316145b806104f35750635b5e139f60e01b6001600160e01b03198316145b92915050565b60008054610506906113f1565b80601f0160208091040260200160405190810160405280929190818152602001828054610532906113f1565b801561057f5780601f106105545761010080835404028352916020019161057f565b820191906000526020600020905b81548152906001019060200180831161056257829003601f168201915b505050505081565b600081815260066020526040902054600160281b90046001600160a01b0316338114806105d757506001600160a01b038116600090815260056020908152604080832033845290915290205460ff165b6106195760405162461bcd60e51b815260206004820152600e60248201526d1393d517d055551213d49256915160921b60448201526064015b60405180910390fd5b60008281526004602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b6008546040516001627cedd960e01b03198152600481018390526001600160a01b03909116906361d585da90829063ff83122790602401602060405180830381865afa1580156106c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106ed919061142b565b6040518263ffffffff1660e01b815260040161070b91815260200190565b60a060405180830381865afa158015610728573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061074c91906114b7565b6020015161078f5760405162461bcd60e51b815260206004820152601060248201526f47414d455f494e5f50524f475245535360801b6044820152606401610610565b61079a838383610f35565b505050565b6107aa838383610675565b6001600160a01b0382163b1561079a57604051630a85bd0160e11b8082523360048301526001600160a01b03858116602484015260448301849052608060648401526000608484015290919084169063150b7a029060a4016020604051808303816000875af1158015610821573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610845919061155e565b6001600160e01b0319161461079a5760405162461bcd60e51b815260206004820152601060248201526f155394d0519157d49150d2541251539560821b6044820152606401610610565b600081815260066020526040902054600160281b90046001600160a01b0316806108e85760405162461bcd60e51b815260206004820152600a6024820152691393d517d3525395115160b21b6044820152606401610610565b919050565b6008546000906001600160a01b0316331461091a5760405162461bcd60e51b81526004016106109061157b565b6007805461093c918491906000610930836115b4565b91905055925082611074565b68010000000000000000811061097f5760405162461bcd60e51b815260206004820152600860248201526713505617d352539560c21b6044820152606401610610565b60408051602081018390526001600160a01b0384169181019190915242606082015260009060800160408051808303601f19018152919052805160209182012091506109cf90600083901a6115cd565b6109da9060016115fd565b6000838152600660205260409020805460ff191660ff92909216919091179055600c816001610a0b9291901a6115cd565b610a169060016115fd565b6000838152600660205260409020805460ff929092166101000261ff0019909216919091179055610a4c6004600283901a6115cd565b610a579060016115fd565b6000838152600660205260409020805460ff92909216620100000262ff000019909216919091179055610a8d600382811a6115cd565b610a989060016115fd565b6000838152600660205260409020805460ff9290921663010000000263ff00000019909216919091179055610ad0600482811a6115cd565b610adb9060016115fd565b6000838152600660205260409020805460ff929092166401000000000264ff000000001990921691909117905550919050565b60006001600160a01b038216610b555760405162461bcd60e51b815260206004820152600c60248201526b5a45524f5f4144445245535360a01b6044820152606401610610565b506001600160a01b031660009081526003602052604090205490565b60018054610506906113f1565b6008546001600160a01b03163314610ba85760405162461bcd60e51b81526004016106109061157b565b6001600160a01b03838116600081815260036020908152604080832080546000190190559386168083528483208054600101905585835260068252848320805465010000000000600160c81b031916600160281b8302179055600490915283822080546001600160a01b03191690559251849392917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b3360008181526005602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b610cbc858585610675565b6001600160a01b0384163b15610d8f57604051630a85bd0160e11b808252906001600160a01b0386169063150b7a0290610d029033908a90899089908990600401611616565b6020604051808303816000875af1158015610d21573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d45919061155e565b6001600160e01b03191614610d8f5760405162461bcd60e51b815260206004820152601060248201526f155394d0519157d49150d2541251539560821b6044820152606401610610565b5050505050565b6008546001600160a01b03163314610dc05760405162461bcd60e51b81526004016106109061157b565b600980546001600160a01b0319166001600160a01b0392909216919091179055565b6009546008546040516001627cedd960e01b03198152600481018490526060926001600160a01b03908116926370fbb0579286929091169063ff83122790602401602060405180830381865afa158015610e40573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e64919061142b565b6000868152600660205260409081902090516001600160e01b031960e086901b168152610ef0939291906004019283526020808401929092525460ff8082166040850152600882901c81166060850152601082901c81166080850152601882901c811660a08501529181901c90911660c083015260281c6001600160a01b031660e08201526101000190565b600060405180830381865afa158015610f0d573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526104f3919081019061166a565b6000818152600660205260409020546001600160a01b03848116600160281b9092041614610f925760405162461bcd60e51b815260206004820152600a60248201526957524f4e475f46524f4d60b01b6044820152606401610610565b6001600160a01b038216610fdc5760405162461bcd60e51b81526020600482015260116024820152701253959053125117d49150d25412515395607a1b6044820152606401610610565b336001600160a01b038416148061101657506001600160a01b038316600090815260056020908152604080832033845290915290205460ff165b8061103757506000818152600460205260409020546001600160a01b031633145b610ba85760405162461bcd60e51b815260206004820152600e60248201526d1393d517d055551213d49256915160921b6044820152606401610610565b6001600160a01b0382166110be5760405162461bcd60e51b81526020600482015260116024820152701253959053125117d49150d25412515395607a1b6044820152606401610610565b600081815260066020526040902054600160281b90046001600160a01b03161561111b5760405162461bcd60e51b815260206004820152600e60248201526d1053149150511657d3525395115160921b6044820152606401610610565b6001600160a01b0382166000818152600360209081526040808320805460010190558483526006909152808220805465010000000000600160c81b031916600160281b850217905551839291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b6001600160e01b0319811681146111a757600080fd5b50565b6000602082840312156111bc57600080fd5b81356111c781611191565b9392505050565b60005b838110156111e95781810151838201526020016111d1565b50506000910152565b60208152600082518060208401526112118160408501602087016111ce565b601f01601f19169190910160400192915050565b60006020828403121561123757600080fd5b5035919050565b6001600160a01b03811681146111a757600080fd5b6000806040838503121561126657600080fd5b82356112718161123e565b946020939093013593505050565b60008060006060848603121561129457600080fd5b833561129f8161123e565b925060208401356112af8161123e565b929592945050506040919091013590565b6000602082840312156112d257600080fd5b81356111c78161123e565b80151581146111a757600080fd5b600080604083850312156112fe57600080fd5b82356113098161123e565b91506020830135611319816112dd565b809150509250929050565b60008060008060006080868803121561133c57600080fd5b85356113478161123e565b945060208601356113578161123e565b935060408601359250606086013567ffffffffffffffff8082111561137b57600080fd5b818801915088601f83011261138f57600080fd5b81358181111561139e57600080fd5b8960208285010111156113b057600080fd5b9699959850939650602001949392505050565b600080604083850312156113d657600080fd5b82356113e18161123e565b915060208301356113198161123e565b600181811c9082168061140557607f821691505b60208210810361142557634e487b7160e01b600052602260045260246000fd5b50919050565b60006020828403121561143d57600080fd5b5051919050565b634e487b7160e01b600052604160045260246000fd5b6040516080810167ffffffffffffffff8111828210171561147d5761147d611444565b60405290565b6040805190810167ffffffffffffffff8111828210171561147d5761147d611444565b805160ff811681146108e857600080fd5b600081830360a08112156114ca57600080fd5b6114d261145a565b6114db846114a6565b815260208401516114eb816112dd565b602082015260408401516114fe8161123e565b806040830152506040605f198301121561151757600080fd5b61151f611483565b9150606084015167ffffffffffffffff8116811461153c57600080fd5b825261154a608085016114a6565b602083015260608101919091529392505050565b60006020828403121561157057600080fd5b81516111c781611191565b6020808252600990820152682327a92124a22222a760b91b604082015260600190565b634e487b7160e01b600052601160045260246000fd5b6000600182016115c6576115c661159e565b5060010190565b600060ff8316806115ee57634e487b7160e01b600052601260045260246000fd5b8060ff84160691505092915050565b60ff81811683821601908111156104f3576104f361159e565b6001600160a01b038681168252851660208201526040810184905260806060820181905281018290526000828460a0840137600060a0848401015260a0601f19601f85011683010190509695505050505050565b60006020828403121561167c57600080fd5b815167ffffffffffffffff8082111561169457600080fd5b818401915084601f8301126116a857600080fd5b8151818111156116ba576116ba611444565b604051601f8201601f19908116603f011681019083821181831017156116e2576116e2611444565b816040528281528760208487010111156116fb57600080fd5b61170c8360208301602088016111ce565b97965050505050505056fea2646970667358221220de2c65a8943f7fb6dc3ca95697a7ba9c66fa41b1b10720c8b7634469e201f00f64736f6c63430008110033000000000000000000000000000000000000000000000000002386f26fc100000000000000000000000000000000000000000000000000000000000063b0ccff000000000000000000000000c783df333fc6d615d98b1cf7785a378982ae5520
Deployed Bytecode
0x6080604052600436106100f35760003560e01c80637df6a6c81161008a578063c5e2a7db11610059578063c5e2a7db146102ed578063e49a12dc1461030d578063eeb0511f1461032d578063ff8312271461034d57600080fd5b80637df6a6c8146102815780638da5cb5b146102a15780639c031ace146102c1578063a85adeab146102d757600080fd5b80634ff1c59b116100c65780634ff1c59b1461019757806354275c46146101c5578063590b990b146101d857806361d585da1461020557600080fd5b80630a9af7bd146100f857806313af4035146101355780633c65000d1461015757806347ccca0214610177575b600080fd5b34801561010457600080fd5b50610118610113366004610cbc565b61037a565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561014157600080fd5b50610155610150366004610d18565b610422565b005b34801561016357600080fd5b50610155610172366004610d3c565b6104a1565b34801561018357600080fd5b50600054610118906001600160a01b031681565b3480156101a357600080fd5b506101b76101b2366004610d3c565b6104d0565b60405190815260200161012c565b6101b76101d3366004610d3c565b610500565b3480156101e457600080fd5b506101b76101f3366004610d71565b60016020526000908152604090205481565b34801561021157600080fd5b50610225610220366004610d71565b610566565b60405161012c9190815160ff90811682526020808401511515818401526040808501516001600160a01b031690840152606093840151805167ffffffffffffffff16948401949094529290920151909116608082015260a00190565b34801561028d57600080fd5b5061015561029c366004610d71565b610619565b3480156102ad57600080fd5b50600454610118906001600160a01b031681565b3480156102cd57600080fd5b506101b760055481565b3480156102e357600080fd5b506101b760065481565b3480156102f957600080fd5b50610155610308366004610d18565b610648565b34801561031957600080fd5b50610155610328366004610d8a565b6106d4565b34801561033957600080fd5b50610155610348366004610db6565b61070c565b34801561035957600080fd5b506101b7610368366004610d71565b60026020526000908152604090205481565b600082815260036020526040812054610100900460ff161561039e5750600061041c565b6000838152600360205260409020546201000090046001600160a01b031680156103c957905061041c565b6103d38380610dfb565b6000868152600360205260409020546103f19060019060ff16610e62565b60ff1681811061040357610403610e7b565b90506020020160208101906104189190610d18565b9150505b92915050565b6004546001600160a01b031633146104555760405162461bcd60e51b815260040161044c90610e91565b60405180910390fd5b600480546001600160a01b0319166001600160a01b03831690811790915560405133907f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d7690600090a350565b6006544211156104c45760405163575c6c9160e11b815260040160405180910390fd5b6104cd81610739565b50565b6000816040516020016104e39190610eb7565b604051602081830303815290604052805190602001209050919050565b60006006544211156105255760405163575c6c9160e11b815260040160405180910390fd5b6005546105328380610dfb565b61053d929150610f5e565b34101561055d5760405163cd1c886760e01b815260040160405180910390fd5b61041c82610896565b61059d6040805160808101825260008082526020808301829052828401829052835180850190945281845283015290606082015290565b506000908152600360209081526040918290208251608081018452815460ff808216835261010082048116151583860152620100009091046001600160a01b031682860152845180860190955260019092015467ffffffffffffffff81168552600160401b900490911691830191909152606081019190915290565b6004546001600160a01b031633146106435760405162461bcd60e51b815260040161044c90610e91565b600655565b6004546001600160a01b031633146106725760405162461bcd60e51b815260040161044c90610e91565b60005460405163c5e2a7db60e01b81526001600160a01b0383811660048301529091169063c5e2a7db90602401600060405180830381600087803b1580156106b957600080fd5b505af11580156106cd573d6000803e3d6000fd5b5050505050565b6004546001600160a01b031633146106fe5760405162461bcd60e51b815260040161044c90610e91565b610708828261092c565b5050565b60065442111561072f5760405163575c6c9160e11b815260040160405180910390fd5b6107088282610982565b6000610744826104d0565b905061074f81610c3d565b6107598183610c72565b6000818152600360205260408120546107769060ff166001610f75565b6000838152600360205260409020805460ff191660ff8316179055905061079d8380610dfb565b90508160ff1611156107c5576000828152600360205260409020805461ff0019166101001790555b600082815260036020526040808220805462010000600160b01b0319169055815490516335313c2160e11b81523360048201526001600160a01b0390911690636a627842906024016020604051808303816000875af115801561082c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108509190610f8e565b600081815260026020526040808220869055519192508291339186917ffa48ecb13b782c85d632bfbac8bacc5a9fccbacaf7807914c48e6d60f875b15a9190a450505050565b60006108a1826104d0565b60008181526003602052604090205490915060ff16156108d45760405163332e591360e21b815260040160405180910390fd5b60008181526003602052604090819020805460ff191660011790555181907fd49624af310011b0738bb3294d81360a2250970102cb325a2da024f6b8e3b4ea9061091f908590610eb7565b60405180910390a2919050565b600080600080600085875af190508061097d5760405162461bcd60e51b815260206004820152601360248201527211551217d514905394d1915497d19052531151606a1b604482015260640161044c565b505050565b600061098d836104d0565b905061099881610c3d565b6109a28184610c72565b60008281526002602052604090205481146109d0576040516315db3de560e01b815260040160405180910390fd5b6000828152600160205260409020546002036109ff5760405163ebd42f3160e01b815260040160405180910390fd5b6000818152600360205260409020805460019091015460ff91821691600160401b909104168103610a665760008281526003602052604090206001015467ffffffffffffffff16839003610a66576040516304d797d560e41b815260040160405180910390fd5b60018060008581526020019081526020016000206000828254610a899190610fa7565b909155505060408051808201825267ffffffffffffffff858116825260ff84811660208085019182526000888152600390915285812094516001909501805492519590941668ffffffffffffffffff1990921691909117600160401b9490921693909302179055805491516331a9108f60e11b81526004810186905290916001600160a01b031690636352211e90602401602060405180830381865afa158015610b37573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b5b9190610fba565b600084815260036020526040808220805462010000600160b01b031916620100006001600160a01b038681169182029290921790925592549151634c1e04f760e11b8152600481019190915233602482015260448101889052929350169063983c09ee90606401600060405180830381600087803b158015610bdc57600080fd5b505af1158015610bf0573d6000803e3d6000fd5b50506040516001600160a01b038416815286925033915085907fcf699bdd4430ab57fbf4adf19ae0d3cbf0eece3f370225ce2e0e87ec0cd9e3d09060200160405180910390a45050505050565b600081815260036020526040902054610100900460ff16156104cd5760405163df469ccb60e01b815260040160405180910390fd5b33610c7d838361037a565b6001600160a01b0316146107085760405163c6e1dd1d60e01b815260040160405180910390fd5b600060408284031215610cb657600080fd5b50919050565b60008060408385031215610ccf57600080fd5b82359150602083013567ffffffffffffffff811115610ced57600080fd5b610cf985828601610ca4565b9150509250929050565b6001600160a01b03811681146104cd57600080fd5b600060208284031215610d2a57600080fd5b8135610d3581610d03565b9392505050565b600060208284031215610d4e57600080fd5b813567ffffffffffffffff811115610d6557600080fd5b61041884828501610ca4565b600060208284031215610d8357600080fd5b5035919050565b60008060408385031215610d9d57600080fd5b8235610da881610d03565b946020939093013593505050565b60008060408385031215610dc957600080fd5b823567ffffffffffffffff811115610de057600080fd5b610dec85828601610ca4565b95602094909401359450505050565b6000808335601e19843603018112610e1257600080fd5b83018035915067ffffffffffffffff821115610e2d57600080fd5b6020019150600581901b3603821315610e4557600080fd5b9250929050565b634e487b7160e01b600052601160045260246000fd5b60ff828116828216039081111561041c5761041c610e4c565b634e487b7160e01b600052603260045260246000fd5b6020808252600c908201526b15539055551213d49256915160a21b604082015260600190565b60006020808352606083018435601e19863603018112610ed657600080fd5b8501828101903567ffffffffffffffff811115610ef257600080fd5b8060051b3603821315610f0457600080fd5b6040868501529182905290600090608086015b81831015610f47578335610f2a81610d03565b6001600160a01b0316815292840192600192909201918401610f17565b848801356040880152809550505050505092915050565b808202811582820484141761041c5761041c610e4c565b60ff818116838216019081111561041c5761041c610e4c565b600060208284031215610fa057600080fd5b5051919050565b8082018082111561041c5761041c610e4c565b600060208284031215610fcc57600080fd5b8151610d3581610d0356fea264697066735822122029b2a752aa375058a14477ed7722b0711f2852c6624b1dccbc974bd9932b6b7a64736f6c63430008110033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000000000000000000000000000002386f26fc100000000000000000000000000000000000000000000000000000000000063b0ccff000000000000000000000000c783df333fc6d615d98b1cf7785a378982ae5520
-----Decoded View---------------
Arg [0] : fee (uint256): 10000000000000000
Arg [1] : _endTimestamp (uint256): 1672531199
Arg [2] : _metadata (address): 0xC783df333fC6d615D98b1CF7785a378982aE5520
-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 000000000000000000000000000000000000000000000000002386f26fc10000
Arg [1] : 0000000000000000000000000000000000000000000000000000000063b0ccff
Arg [2] : 000000000000000000000000c783df333fc6d615d98b1cf7785a378982ae5520
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|---|---|---|---|---|
ETH | Ether (ETH) | 100.00% | $3,120.82 | 1.77 | $5,523.85 |
Loading...
Loading
[ Download: CSV Export ]
[ 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.