Feature Tip: Add private address tag to any address under My Name Tag !
ERC-721
Overview
Max Total Supply
100 LINE
Holders
40
Market
Volume (24H)
N/A
Min Price (24H)
N/A
Max Price (24H)
N/A
Other Info
Token Contract
Balance
1 LINELoading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
Contract Source Code Verified (Exact Match)
Contract Name:
LINE
Compiler Version
v0.8.23+commit.f704f362
Optimization Enabled:
Yes with 200 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.23; /// @title LINE by Figure31 /// @notice LINE is a photographic series of 250 tokens placed within a synthetic landscape. /// Using photographic and post-production techniques similar to Figure31's SALT, the images in /// LINE are captured using a digital camera combined with ultra-telephoto lenses. All photographs /// are taken in remote empty landscapes at sundown or night. There is no artificial light, only /// indirect natural light hitting the camera sensor. Photographs are arranged as panoramas /// to recreate a unified landscape. /// /// @author wilt.eth import {Constants} from "./Constants.sol"; import {MerkleProof} from "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol"; import {Descriptor} from "./Descriptor.sol"; import {ITokenDescriptor} from "./ITokenDescriptor.sol"; import {ERC721} from "solmate/tokens/ERC721.sol"; import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; import {Ownable2Step} from "@openzeppelin/contracts/access/Ownable2Step.sol"; import {ReentrancyGuard} from "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; import {SafeTransferLib} from "solmate/utils/SafeTransferLib.sol"; /// @dev Thrown when attempting to change a token to a star, which is already a star. error AlreadyStarToken(); /// @dev Thrown when too many tokens are attempted to be minted within a single transaction. error ExceedsMaxMintPerTransaction(); /// @dev Thrown when a token has not yet reached the end of the grid. error HasNotReachedEnd(); /// @dev Thrown when the eth passed to purchase a token is incorrect. error IncorrectPrice(); /// @dev Thrown when attempting to move in a direction opposite of the token's designated direction. error InvalidDirection(); /// @dev Thrown when the max number of star tokens has already occurred. error MaxStarTokensReached(); /// @dev Thrown when attempting to mint a token after minting has closed. error MintingClosed(); /// @dev Thrown when attempting to move a token, and the ability to move tokens has not started yet or is a star token. error MovementLocked(); /// @dev Thrown when checking the owner or approved address for a non-existent NFT. error NotMinted(); /// @dev Thrown when checking that the caller is not the owner of the NFT. error NotTokenOwner(); /// @dev Thrown when attempting to move a token to a place on the grid that is already taken. error PositionCurrentlyTaken(uint256 x, uint256 y); /// @dev Thrown when attempting to mint a token to a place on the grid that was not marked to be minted from. error PositionNotMintable(uint256 x, uint256 y); /// @dev Thrown when attempting to move a token to a place that is outside the bounds of the grid. error PositionOutOfBounds(uint256 x, uint256 y); contract LINE is ERC721, Ownable2Step, ReentrancyGuard, Constants { using SafeTransferLib for address payable; /// @dev Struct containing the details of the Dutch auction struct SalesConfig { // start time of the auction uint64 startTime; // end time of the auction uint64 endTime; // initial price of the Dutch auction uint256 startPriceInWei; // resting price of the Dutch auction uint256 endPriceInWei; // recepient of the funds from the Dutch auction address payable fundsRecipient; } /// @dev The maximum allowed number of star tokens. uint256 public constant MAX_STAR_TOKENS = 25; /// @dev The maximum allowed number of tokens to be minted within a single transaction. uint256 public constant MAX_MINT_PER_TX = 5; /// @dev The maximum number of tokens to be minted. uint256 public constant MAX_SUPPLY = 250; uint256 internal immutable FUNDS_SEND_GAS_LIMIT = 210_000; /// @dev The merkle root for collectors/holders. bytes32 public holdersMerkleRoot; /// @dev The merkle root for members of FingerprintsDAO. bytes32 public fpMembersMerkleRoot; /// @dev Keeps track of the current token id. uint256 public currentTokenId = 1; /// @dev Keeps track of the number of tokens that have become star tokens. uint256 public numStarTokens; /// @dev The flag to determine if tokens have the ability to move. bool public canMove; bool private _isMintingClosed; uint256 private _totalSupply; ITokenDescriptor public descriptor; SalesConfig public config; uint256[NUM_COLUMNS][NUM_ROWS] internal _grid; ITokenDescriptor.Coordinate[] internal _availableCoordinates; mapping(bytes32 => uint256) internal _coordinateHashToIndex; mapping(bytes32 => bool) internal _mintableCoordinates; mapping(uint256 => ITokenDescriptor.Token) public tokenIdToTokenInfo; constructor(address _descriptor) ERC721("LINE", "LINE") Ownable(msg.sender) { descriptor = ITokenDescriptor(_descriptor); config.startTime = uint64(1708538400); config.endTime = uint64(1708538400 + 3600); config.startPriceInWei = 1000000000000000000; // 1 eth config.endPriceInWei = 150000000000000000; // .15 eth config.fundsRecipient = payable(0x943ccdd95803e35369Ccf42e9618f992fD2Fea2E); } /// @dev Mints a token at a random position on the grid. function mintRandom(uint256 quantity, bytes32[] calldata merkleProof) external payable nonReentrant { if (block.timestamp < config.startTime || _isMintingClosed) { revert MintingClosed(); } if (quantity > MAX_MINT_PER_TX) { revert ExceedsMaxMintPerTransaction(); } uint256 currentPrice = getCurrentPrice(); if (merkleProof.length > 0) { currentPrice = _getDiscountedCurrentPrice(merkleProof, msg.sender, currentPrice); } uint256 totalPrice = currentPrice * quantity; if (msg.value < totalPrice) { revert IncorrectPrice(); } uint256 ethToReturn; for (uint256 i=0; i < quantity;) { bool success; if (_availableCoordinates.length == 0) { success = false; } else { ITokenDescriptor.Coordinate memory coordinateToMint = _availableCoordinates[0]; success = _mintWithChecks(coordinateToMint, msg.sender); } if (!success) { ethToReturn += currentPrice; } unchecked { ++i; } } // return eth for any pieces that failed to mint because a point on the board was already taken when the mint occurred if (ethToReturn > 0) { payable(msg.sender).safeTransferETH(ethToReturn); } } /// @dev Mints a token at the specified on the grid. function mintAtPosition(ITokenDescriptor.Coordinate[] memory coordinates, bytes32[] calldata merkleProof) external payable nonReentrant { if (block.timestamp < config.startTime || _isMintingClosed) { revert MintingClosed(); } uint256 numCoordinates = coordinates.length; if (numCoordinates > MAX_MINT_PER_TX) { revert ExceedsMaxMintPerTransaction(); } uint256 currentPrice = getCurrentPrice(); if (merkleProof.length > 0) { currentPrice = _getDiscountedCurrentPrice(merkleProof, msg.sender, currentPrice); } if (msg.value < (currentPrice * numCoordinates)) { revert IncorrectPrice(); } uint256 ethToReturn; for (uint256 i=0; i < numCoordinates;) { bool success = _mintWithChecks(coordinates[i], msg.sender); if (!success) { ethToReturn += currentPrice; } unchecked { ++i; } } // return eth for any pieces that failed to mint because a point on the board was already taken when the mint occurred if (ethToReturn > 0) { payable(msg.sender).safeTransferETH(ethToReturn); } } function artistMint(address receiver, ITokenDescriptor.Coordinate[] memory coordinates) external onlyOwner { if (_isMintingClosed) { revert MintingClosed(); } uint256 numCoordinates = coordinates.length; for (uint256 i=0; i < numCoordinates;) { _mintWithChecks(coordinates[i], receiver); unchecked { ++i; } } } /// @dev Ends the ability to mint. function closeMint() external onlyOwner { _closeMint(); } /// @dev Moves a token one spot to the north on the cartesian grid. function moveNorth(uint256 tokenId) external { if (tokenIdToTokenInfo[tokenId].direction != ITokenDescriptor.Direction.UP) { revert InvalidDirection(); } _move(tokenId, 0, -1); } /// @dev Moves a token one spot to the northwest on the cartesian grid. function moveNorthwest(uint256 tokenId) external { if (tokenIdToTokenInfo[tokenId].direction != ITokenDescriptor.Direction.UP) { revert InvalidDirection(); } _move(tokenId, -1, -1); } /// @dev Moves a token one spot to the northeast on the cartesian grid. function moveNortheast(uint256 tokenId) external { if (tokenIdToTokenInfo[tokenId].direction != ITokenDescriptor.Direction.UP) { revert InvalidDirection(); } _move(tokenId, 1, -1); } /// @dev Moves a token one spot to the south on the cartesian grid. function moveSouth(uint256 tokenId) external { if (tokenIdToTokenInfo[tokenId].direction != ITokenDescriptor.Direction.DOWN) { revert InvalidDirection(); } _move(tokenId, 0, 1); } /// @dev Moves a token one spot to the southwest on the cartesian grid. function moveSouthwest(uint256 tokenId) external { if (tokenIdToTokenInfo[tokenId].direction != ITokenDescriptor.Direction.DOWN) { revert InvalidDirection(); } _move(tokenId, -1, 1); } /// @dev Moves a token one spot to the southeast on the cartesian grid. function moveSoutheast(uint256 tokenId) external { if (tokenIdToTokenInfo[tokenId].direction != ITokenDescriptor.Direction.DOWN) { revert InvalidDirection(); } _move(tokenId, 1, 1); } /// @dev Moves a token one spot to the west on the cartesian grid. function moveWest(uint256 tokenId) external { _move(tokenId, -1, 0); } /// @dev Moves a token one spot to the east on the cartesian grid. function moveEast(uint256 tokenId) external { _move(tokenId, 1, 0); } /// @dev Converts a token to be a star token and locks their token at the given position. function lockAsStar(uint256 tokenId, uint256 x, uint256 y) external { if (msg.sender != ownerOf(tokenId)) { revert NotTokenOwner(); } ITokenDescriptor.Token memory token = tokenIdToTokenInfo[tokenId]; if (!_isPositionWithinBounds(x, y, token.direction)) { revert PositionOutOfBounds(x,y); } uint256 yGridIndex = _calculateYGridIndex(y); if (_grid[yGridIndex][x] > 0) { revert PositionCurrentlyTaken(x,y); } if (numStarTokens == MAX_STAR_TOKENS) { revert MaxStarTokensReached(); } if (!token.hasReachedEnd) { revert HasNotReachedEnd(); } if (token.isStar) { revert AlreadyStarToken(); } _grid[_calculateYGridIndex(token.current.y)][token.current.x] = 0; _grid[yGridIndex][x] = tokenId; tokenIdToTokenInfo[tokenId].current = ITokenDescriptor.Coordinate({x: x, y: y}); tokenIdToTokenInfo[tokenId].timestamp = block.timestamp; tokenIdToTokenInfo[tokenId].isStar = true; numStarTokens++; } /// @dev Sets the coordinates that are available to minted. function setInitialAvailableCoordinates(ITokenDescriptor.Coordinate[] calldata coordinates) external onlyOwner { uint256 currentNumTokens = _availableCoordinates.length; for (uint256 i = 0; i < coordinates.length;) { bytes32 hash = _getCoordinateHash(coordinates[i]); _mintableCoordinates[hash] = true; _coordinateHashToIndex[hash] = currentNumTokens + i; _availableCoordinates.push(coordinates[i]); unchecked { ++i; } } } /// @dev Updates the details of the Dutch auction. function updateConfig( uint64 startTime, uint64 endTime, uint256 startPriceInWei, uint256 endPriceInWei, address payable fundsRecipient ) external onlyOwner { config.startTime = startTime; config.endTime = endTime; config.startPriceInWei = startPriceInWei; config.endPriceInWei = endPriceInWei; config.fundsRecipient = fundsRecipient; } /// @dev Sets the address of the descriptor. function setDescriptor(address _descriptor) external onlyOwner { descriptor = ITokenDescriptor(_descriptor); } /// @dev Updates the merkle roots function updateMerkleRoots(bytes32 _holdersRoot, bytes32 _fpMembersRoot) external onlyOwner { holdersMerkleRoot = _holdersRoot; fpMembersMerkleRoot = _fpMembersRoot; } /// @dev Withdraws the eth from the contract to the set funds receipient. function withdraw() external onlyOwner { uint256 balance = address(this).balance; (bool success, ) = config.fundsRecipient.call{ value: balance, gas: FUNDS_SEND_GAS_LIMIT }(""); require(success, "Transfer failed."); } /// @dev Returns the available coordinates that are still available for mint. function getAvailableCoordinates() external view returns (ITokenDescriptor.Coordinate[] memory) { return _availableCoordinates; } /// @dev Returns the cartesian grid of where tokens are placed at within the grid. function getGrid() external view returns (uint256[NUM_COLUMNS][NUM_ROWS] memory) { return _grid; } /// @dev Returns the details of a token. function getToken(uint256 tokenId) external view returns (ITokenDescriptor.Token memory) { return tokenIdToTokenInfo[tokenId]; } /// @dev Returns the details of all tokens. function getTokens() external view returns (ITokenDescriptor.Token[] memory) { ITokenDescriptor.Token[] memory tokens = new ITokenDescriptor.Token[](_totalSupply); for(uint256 i=0;i < _totalSupply;) { tokens[i] = tokenIdToTokenInfo[i+1]; unchecked { ++i; } } return tokens; } /// @dev Returns if a wallet address/proof is part of the given merkle root. function checkMerkleProof( bytes32[] calldata merkleProof, address _address, bytes32 _root ) public pure returns (bool) { bytes32 leaf = keccak256(abi.encodePacked(_address)); return MerkleProof.verify(merkleProof, _root, leaf); } /// @dev Returns the current price of the Dutch auction. function getCurrentPrice() public view returns (uint256) { uint256 duration = config.endTime - config.startTime; uint256 halflife = 950; // adjust this to adjust speed of decay if (block.timestamp < config.startTime) { return config.startPriceInWei; } uint256 elapsedTime = ((block.timestamp - config.startTime) / 10 ) * 10; if (elapsedTime >= duration) { return config.endPriceInWei; } // h/t artblocks for exponential decaying price math uint256 decayedPrice = config.startPriceInWei; // Divide by two (via bit-shifting) for the number of entirely completed // half-lives that have elapsed since auction start time. decayedPrice >>= elapsedTime / halflife; // Perform a linear interpolation between partial half-life points, to // approximate the current place on a perfect exponential decay curve. decayedPrice -= (decayedPrice * (elapsedTime % halflife)) / halflife / 2; if (decayedPrice < config.endPriceInWei) { // Price may not decay below stay `basePrice`. return config.endPriceInWei; } return (decayedPrice / 1000000000000000) * 1000000000000000; } /// @dev Returns the token ids that a wallet has ownership of. function tokensOfOwner(address _owner) public view returns (uint256[] memory) { uint256 balance = balanceOf(_owner); uint256[] memory tokens = new uint256[](balance); uint256 index; unchecked { for (uint256 i=1; i <= _totalSupply; i++) { if (ownerOf(i) == _owner) { tokens[index] = i; index++; } } } return tokens; } /// @dev Returns the tokenURI of the given token id. function tokenURI(uint256 id) public view virtual override returns (string memory) { if (ownerOf(id) == address(0)) { revert NotMinted(); } ITokenDescriptor.Token memory token = tokenIdToTokenInfo[id]; return descriptor.generateMetadata(id, token); } /// @dev Returns the total supply. function totalSupply() public view returns (uint256) { return _totalSupply; } function _mintWithChecks(ITokenDescriptor.Coordinate memory coordinate, address receiver) internal returns (bool) { uint256 tokenId = currentTokenId; uint256 x = coordinate.x; uint256 y = coordinate.y; uint256 yIndex = _calculateYGridIndex(y); if (_grid[yIndex][x] > 0) { return false; } bytes32 hash = _getCoordinateHash(ITokenDescriptor.Coordinate({x: x, y: y})); if (!_mintableCoordinates[hash]) { revert PositionNotMintable(x, y); } _grid[yIndex][x] = tokenId; tokenIdToTokenInfo[tokenId] = ITokenDescriptor.Token({ initial: ITokenDescriptor.Coordinate({x: x, y: y}), current: ITokenDescriptor.Coordinate({x: x, y: y}), timestamp: block.timestamp, hasReachedEnd: false, isStar: false, direction: y >= 12 ? ITokenDescriptor.Direction.DOWN : ITokenDescriptor.Direction.UP, numMovements: 0 }); if (tokenId != MAX_SUPPLY) { currentTokenId++; } else { _closeMint(); } _totalSupply++; _removeFromAvailability(_coordinateHashToIndex[hash]); _mint(receiver, tokenId); return true; } function _move(uint256 tokenId, int256 xDelta, int256 yDelta) private { if (msg.sender != ownerOf(tokenId)) { revert NotTokenOwner(); } if (!canMove) { revert MovementLocked(); } ITokenDescriptor.Token memory token = tokenIdToTokenInfo[tokenId]; if (token.isStar) { revert MovementLocked(); } uint256 x = token.current.x; if (xDelta == -1) { x--; } else if (xDelta == 1) { x++; } uint256 y = token.current.y; if (yDelta == -1) { y++; } else if (yDelta == 1) { y--; } if (!_isPositionWithinBounds(x, y, token.direction)) { revert PositionOutOfBounds(x,y); } uint256 yGridIndex = _calculateYGridIndex(y); if (_grid[yGridIndex][x] > 0) { revert PositionCurrentlyTaken(x,y); } _grid[_calculateYGridIndex(token.current.y)][token.current.x] = 0; _grid[yGridIndex][x] = tokenId; tokenIdToTokenInfo[tokenId].current = ITokenDescriptor.Coordinate({x: x, y: y}); tokenIdToTokenInfo[tokenId].hasReachedEnd = ((token.direction == ITokenDescriptor.Direction.UP && y == (NUM_ROWS - 2)) || (token.direction == ITokenDescriptor.Direction.DOWN && y == 1)); tokenIdToTokenInfo[tokenId].numMovements = ++token.numMovements; tokenIdToTokenInfo[tokenId].timestamp = block.timestamp; } function _closeMint() private { _isMintingClosed = true; canMove = true; } function _calculateYGridIndex(uint256 y) private pure returns (uint256) { return (NUM_ROWS - 1) - y; } function _getCoordinateHash(ITokenDescriptor.Coordinate memory coordinate) private pure returns (bytes32) { return keccak256(abi.encode(coordinate)); } function _getDiscountedCurrentPrice(bytes32[] calldata merkleProof, address addressToCheck, uint256 currentPrice) private view returns (uint256) { bool isFp = checkMerkleProof(merkleProof, addressToCheck, fpMembersMerkleRoot); bool isPartner = checkMerkleProof(merkleProof, addressToCheck, holdersMerkleRoot); if (isFp) { currentPrice = (currentPrice * 75) / 100; // 25% off } else if (isPartner) { currentPrice = (currentPrice * 85) / 100; // 15% off } return currentPrice; } function _isPositionWithinBounds(uint256 x, uint256 y, ITokenDescriptor.Direction tokenDirection) private pure returns (bool) { if (x < 1 || x >= NUM_COLUMNS - 1) { return false; } if (tokenDirection == ITokenDescriptor.Direction.DOWN) { return y > 0; } else { return y < NUM_ROWS - 1; } } function _removeFromAvailability(uint256 index) private { uint256 lastCoordinateIndex = _availableCoordinates.length - 1; ITokenDescriptor.Coordinate memory lastCoordinate = _availableCoordinates[lastCoordinateIndex]; ITokenDescriptor.Coordinate memory coordinateToBeRemoved = _availableCoordinates[index]; _availableCoordinates[index] = lastCoordinate; _coordinateHashToIndex[_getCoordinateHash(lastCoordinate)] = index; delete _coordinateHashToIndex[_getCoordinateHash(coordinateToBeRemoved)]; _availableCoordinates.pop(); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.23; contract Constants { uint256 public constant NUM_ROWS = 25; uint256 public constant NUM_COLUMNS = 25; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/MerkleProof.sol) pragma solidity ^0.8.20; /** * @dev These functions deal with verification of Merkle Tree proofs. * * The tree and the proofs can be generated using our * https://github.com/OpenZeppelin/merkle-tree[JavaScript library]. * You will find a quickstart guide in the readme. * * WARNING: You should avoid using leaf values that are 64 bytes long prior to * hashing, or use a hash function other than keccak256 for hashing leaves. * This is because the concatenation of a sorted pair of internal nodes in * the Merkle tree could be reinterpreted as a leaf value. * OpenZeppelin's JavaScript library generates Merkle trees that are safe * against this attack out of the box. */ library MerkleProof { /** *@dev The multiproof provided is not valid. */ error MerkleProofInvalidMultiproof(); /** * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree * defined by `root`. For this, a `proof` must be provided, containing * sibling hashes on the branch from the leaf to the root of the tree. Each * pair of leaves and each pair of pre-images are assumed to be sorted. */ function verify(bytes32[] memory proof, bytes32 root, bytes32 leaf) internal pure returns (bool) { return processProof(proof, leaf) == root; } /** * @dev Calldata version of {verify} */ function verifyCalldata(bytes32[] calldata proof, bytes32 root, bytes32 leaf) internal pure returns (bool) { return processProofCalldata(proof, leaf) == root; } /** * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt * hash matches the root of the tree. When processing the proof, the pairs * of leafs & pre-images are assumed to be sorted. */ function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { computedHash = _hashPair(computedHash, proof[i]); } return computedHash; } /** * @dev Calldata version of {processProof} */ function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { computedHash = _hashPair(computedHash, proof[i]); } return computedHash; } /** * @dev Returns true if the `leaves` can be simultaneously proven to be a part of a Merkle tree defined by * `root`, according to `proof` and `proofFlags` as described in {processMultiProof}. * * CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details. */ function multiProofVerify( bytes32[] memory proof, bool[] memory proofFlags, bytes32 root, bytes32[] memory leaves ) internal pure returns (bool) { return processMultiProof(proof, proofFlags, leaves) == root; } /** * @dev Calldata version of {multiProofVerify} * * CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details. */ function multiProofVerifyCalldata( bytes32[] calldata proof, bool[] calldata proofFlags, bytes32 root, bytes32[] memory leaves ) internal pure returns (bool) { return processMultiProofCalldata(proof, proofFlags, leaves) == root; } /** * @dev Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstruction * proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another * leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false * respectively. * * CAUTION: Not all Merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree * is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the * tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer). */ function processMultiProof( bytes32[] memory proof, bool[] memory proofFlags, bytes32[] memory leaves ) internal pure returns (bytes32 merkleRoot) { // This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of // the Merkle tree. uint256 leavesLen = leaves.length; uint256 proofLen = proof.length; uint256 totalHashes = proofFlags.length; // Check proof validity. if (leavesLen + proofLen != totalHashes + 1) { revert MerkleProofInvalidMultiproof(); } // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop". bytes32[] memory hashes = new bytes32[](totalHashes); uint256 leafPos = 0; uint256 hashPos = 0; uint256 proofPos = 0; // At each step, we compute the next hash using two values: // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we // get the next hash. // - depending on the flag, either another value from the "main queue" (merging branches) or an element from the // `proof` array. for (uint256 i = 0; i < totalHashes; i++) { bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]; bytes32 b = proofFlags[i] ? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]) : proof[proofPos++]; hashes[i] = _hashPair(a, b); } if (totalHashes > 0) { if (proofPos != proofLen) { revert MerkleProofInvalidMultiproof(); } unchecked { return hashes[totalHashes - 1]; } } else if (leavesLen > 0) { return leaves[0]; } else { return proof[0]; } } /** * @dev Calldata version of {processMultiProof}. * * CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details. */ function processMultiProofCalldata( bytes32[] calldata proof, bool[] calldata proofFlags, bytes32[] memory leaves ) internal pure returns (bytes32 merkleRoot) { // This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of // the Merkle tree. uint256 leavesLen = leaves.length; uint256 proofLen = proof.length; uint256 totalHashes = proofFlags.length; // Check proof validity. if (leavesLen + proofLen != totalHashes + 1) { revert MerkleProofInvalidMultiproof(); } // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop". bytes32[] memory hashes = new bytes32[](totalHashes); uint256 leafPos = 0; uint256 hashPos = 0; uint256 proofPos = 0; // At each step, we compute the next hash using two values: // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we // get the next hash. // - depending on the flag, either another value from the "main queue" (merging branches) or an element from the // `proof` array. for (uint256 i = 0; i < totalHashes; i++) { bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]; bytes32 b = proofFlags[i] ? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]) : proof[proofPos++]; hashes[i] = _hashPair(a, b); } if (totalHashes > 0) { if (proofPos != proofLen) { revert MerkleProofInvalidMultiproof(); } unchecked { return hashes[totalHashes - 1]; } } else if (leavesLen > 0) { return leaves[0]; } else { return proof[0]; } } /** * @dev Sorts the pair (a, b) and hashes the result. */ function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) { return a < b ? _efficientHash(a, b) : _efficientHash(b, a); } /** * @dev Implementation of keccak256(abi.encode(a, b)) that doesn't allocate or expand memory. */ function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) { /// @solidity memory-safe-assembly assembly { mstore(0x00, a) mstore(0x20, b) value := keccak256(0x00, 0x40) } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.23; import {Constants} from "./Constants.sol"; import {ITokenDescriptor} from "./ITokenDescriptor.sol"; import {JsonWriter} from "solidity-json-writer/JsonWriter.sol"; import {Base64} from '@openzeppelin/contracts/utils/Base64.sol'; import {Strings} from "@openzeppelin/contracts/utils/Strings.sol"; contract Descriptor is ITokenDescriptor, Constants { using JsonWriter for JsonWriter.Json; function generateMetadata(uint256 tokenId, Token calldata token) external view returns (string memory) { JsonWriter.Json memory writer; writer = writer.writeStartObject(); writer = writer.writeStringProperty( 'name', string.concat('LINE ', Strings.toString(tokenId)) ); writer = writer.writeStringProperty( 'description', 'LINE is a dynamic photographic series of 250 tokens, each positioned within a meticulously crafted landscape of 625 coordinates. Tokens act like lenses, where location influences perception. They may cross this terrain while their paths intersect in time and space. By Figure31' ); writer = writer.writeStringProperty( 'external_url', 'https://line.fingerprintsdao.xyz' ); uint256 currentImageIndex = _getCurrentPanoramicImageIndex(token); writer = writer.writeStringProperty( 'image', string.concat('ar://Y-05cY1jiKkVn9aCL3Di3sOWfCUZRPLaoASs0LYJOsU/', Strings.toString(currentImageIndex), '.jpg') ); writer = _generateAttributes(writer, token); writer = writer.writeEndObject(); return string( abi.encodePacked( 'data:application/json;base64,', Base64.encode(abi.encodePacked(writer.value)) ) ); } function _determineCurrentImagePoint(Token calldata token) private view returns (uint256, uint256) { uint256 numDaysPassed = (block.timestamp - token.timestamp) / 1 days; uint256 numPanoramicPoints; if (!token.isStar) { numPanoramicPoints = 10; // 180° panoramic view } else { numPanoramicPoints = 16; // 360° panoramic view } uint256 panoramicPoint = numDaysPassed % numPanoramicPoints; // is at the origin point for the day if (panoramicPoint % 2 == 0) { return (token.current.x, token.current.y); } uint256 x; uint256 y; // full panoramic view // 1 = west // 3 = northwest // 5 = north // 7 = northeast // 9 = east // 11 = southeast // 13 = south // 15 = southwest if (token.isStar) { if (panoramicPoint == 1) { x = token.current.x - 1; y = token.current.y; } else if (panoramicPoint == 3) { x = token.current.x - 1; y = token.current.y + 1; } else if (panoramicPoint == 5) { x = token.current.x; y = token.current.y + 1; } else if (panoramicPoint == 7) { x = token.current.x + 1; y = token.current.y + 1; } else if (panoramicPoint == 9) { x = token.current.x + 1; y = token.current.y; } else if (panoramicPoint == 11) { x = token.current.x + 1; y = token.current.y - 1; } else if (panoramicPoint == 13) { x = token.current.x; y = token.current.y - 1; } else if (panoramicPoint == 15) { x = token.current.x - 1; y = token.current.y - 1; } return (x,y); } // 1 = look west // 3 = look southwest // 5 = look south // 7 = look southeast // 9 = look east if (token.direction == Direction.DOWN) { if (panoramicPoint == 1) { x = token.current.x - 1; y = token.current.y; } else if (panoramicPoint == 3) { x = token.current.x - 1; y = token.current.y - 1; } else if (panoramicPoint == 5) { x = token.current.x; y = token.current.y - 1; } else if (panoramicPoint == 7) { x = token.current.x + 1; y = token.current.y - 1; } else if (panoramicPoint == 9) { x = token.current.x + 1; y = token.current.y; } } // 1 = look west // 3 = look northwest // 5 = look north // 7 = look northeast // 9 = look east if (token.direction == Direction.UP) { if (panoramicPoint == 1) { x = token.current.x - 1; y = token.current.y; } else if (panoramicPoint == 3) { x = token.current.x - 1; y = token.current.y + 1; } else if (panoramicPoint == 5) { x = token.current.x; y = token.current.y + 1; } else if (panoramicPoint == 7) { x = token.current.x + 1; y = token.current.y + 1; } else if (panoramicPoint == 9) { x = token.current.x + 1; y = token.current.y; } } return (x,y); } function _getCurrentPanoramicImageIndex(Token calldata token) private view returns (uint256) { (uint256 x, uint256 y) = _determineCurrentImagePoint(token); return _calculateImageIndex(x, y); } function _calculateImageIndex(uint256 x, uint256 y) private pure returns (uint256) { uint256 yIndex = (NUM_ROWS - 1) - y; return ((NUM_ROWS - yIndex - 1) * NUM_COLUMNS) + x; } function _generateAttributes(JsonWriter.Json memory _writer, Token calldata token) private view returns (JsonWriter.Json memory writer) { writer = _writer.writeStartArray('attributes'); (uint256 imagePointX, uint256 imagePointY) = _determineCurrentImagePoint(token); writer = _addStringAttribute(writer, 'Origin Point', string.concat(Strings.toString(token.current.x), ',', Strings.toString(token.current.y))); writer = _addStringAttribute(writer, 'Image Point', string.concat(Strings.toString(imagePointX), ',', Strings.toString(imagePointY))); writer = _addStringAttribute(writer, 'Type', token.direction == Direction.UP ? 'Up' : 'Down'); writer = _addStringAttribute(writer, 'Starting Point', string.concat(Strings.toString(token.initial.x), ',', Strings.toString(token.initial.y))); writer = _addStringAttribute(writer, 'Has Reached End', token.hasReachedEnd == true ? 'Yes' : 'No'); writer = _addStringAttribute(writer, 'Is Star', token.isStar == true ? 'Yes' : 'No'); writer = _addStringAttribute(writer, 'Movements', Strings.toString(token.numMovements)); writer = writer.writeEndArray(); } function _addStringAttribute( JsonWriter.Json memory _writer, string memory key, string memory value ) private pure returns (JsonWriter.Json memory writer) { writer = _writer.writeStartObject(); writer = writer.writeStringProperty('trait_type', key); writer = writer.writeStringProperty('value', value); writer = writer.writeEndObject(); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.23; interface ITokenDescriptor { enum Direction { UP, DOWN } struct Coordinate { uint256 x; uint256 y; } struct Token { Coordinate initial; Coordinate current; uint256 timestamp; bool hasReachedEnd; bool isStar; Direction direction; uint256 numMovements; } function generateMetadata(uint256 tokenId, ITokenDescriptor.Token calldata token) external view returns (string memory); }
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity >=0.8.0; /// @notice Modern, minimalist, and gas efficient ERC-721 implementation. /// @author Solmate (https://github.com/transmissions11/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); require( to.code.length == 0 || 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); require( to.code.length == 0 || 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); require( to.code.length == 0 || 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); require( to.code.length == 0 || 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/transmissions11/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 // OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol) pragma solidity ^0.8.20; import {Context} from "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * The initial owner is set to the address provided by the deployer. This can * later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; /** * @dev The caller account is not authorized to perform an operation. */ error OwnableUnauthorizedAccount(address account); /** * @dev The owner is not a valid owner account. (eg. `address(0)`) */ error OwnableInvalidOwner(address owner); event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the address provided by the deployer as the initial owner. */ constructor(address initialOwner) { if (initialOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _transferOwnership(initialOwner); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { if (owner() != _msgSender()) { revert OwnableUnauthorizedAccount(_msgSender()); } } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby disabling any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { if (newOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable2Step.sol) pragma solidity ^0.8.20; import {Ownable} from "./Ownable.sol"; /** * @dev Contract module which provides access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * The initial owner is specified at deployment time in the constructor for `Ownable`. This * can later be changed with {transferOwnership} and {acceptOwnership}. * * This module is used through inheritance. It will make available all functions * from parent (Ownable). */ abstract contract Ownable2Step is Ownable { address private _pendingOwner; event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner); /** * @dev Returns the address of the pending owner. */ function pendingOwner() public view virtual returns (address) { return _pendingOwner; } /** * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual override onlyOwner { _pendingOwner = newOwner; emit OwnershipTransferStarted(owner(), newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner. * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual override { delete _pendingOwner; super._transferOwnership(newOwner); } /** * @dev The new owner accepts the ownership transfer. */ function acceptOwnership() public virtual { address sender = _msgSender(); if (pendingOwner() != sender) { revert OwnableUnauthorizedAccount(sender); } _transferOwnership(sender); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/ReentrancyGuard.sol) pragma solidity ^0.8.20; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant NOT_ENTERED = 1; uint256 private constant ENTERED = 2; uint256 private _status; /** * @dev Unauthorized reentrant call. */ error ReentrancyGuardReentrantCall(); constructor() { _status = NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { // On the first call to nonReentrant, _status will be NOT_ENTERED if (_status == ENTERED) { revert ReentrancyGuardReentrantCall(); } // Any calls to nonReentrant after this point will fail _status = ENTERED; } function _nonReentrantAfter() private { // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = NOT_ENTERED; } /** * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a * `nonReentrant` function in the call stack. */ function _reentrancyGuardEntered() internal view returns (bool) { return _status == ENTERED; } }
// SPDX-License-Identifier: AGPL-3.0-only 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/transmissions11/solmate/blob/main/src/utils/SafeTransferLib.sol) /// @dev Use with caution! Some functions in this library knowingly create dirty bits at the destination of the free memory pointer. /// @dev Note that none of the functions in this library check that a token has code at all! That responsibility is delegated to the caller. library SafeTransferLib { /*////////////////////////////////////////////////////////////// ETH OPERATIONS //////////////////////////////////////////////////////////////*/ function safeTransferETH(address to, uint256 amount) internal { bool success; /// @solidity memory-safe-assembly 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; /// @solidity memory-safe-assembly assembly { // Get a pointer to some free memory. let freeMemoryPointer := mload(0x40) // Write the abi-encoded calldata into memory, beginning with the function selector. mstore(freeMemoryPointer, 0x23b872dd00000000000000000000000000000000000000000000000000000000) mstore(add(freeMemoryPointer, 4), and(from, 0xffffffffffffffffffffffffffffffffffffffff)) // Append and mask the "from" argument. mstore(add(freeMemoryPointer, 36), and(to, 0xffffffffffffffffffffffffffffffffffffffff)) // Append and mask the "to" argument. mstore(add(freeMemoryPointer, 68), amount) // Append the "amount" argument. Masking not required as it's a full 32 byte type. 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 the length of our calldata totals up like so: 4 + 32 * 3. // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space. // Counterintuitively, this call must be positioned second to the or() call in the // surrounding and() call or else returndatasize() will be zero during the computation. call(gas(), token, 0, freeMemoryPointer, 100, 0, 32) ) } require(success, "TRANSFER_FROM_FAILED"); } function safeTransfer( ERC20 token, address to, uint256 amount ) internal { bool success; /// @solidity memory-safe-assembly assembly { // Get a pointer to some free memory. let freeMemoryPointer := mload(0x40) // Write the abi-encoded calldata into memory, beginning with the function selector. mstore(freeMemoryPointer, 0xa9059cbb00000000000000000000000000000000000000000000000000000000) mstore(add(freeMemoryPointer, 4), and(to, 0xffffffffffffffffffffffffffffffffffffffff)) // Append and mask the "to" argument. mstore(add(freeMemoryPointer, 36), amount) // Append the "amount" argument. Masking not required as it's a full 32 byte type. 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 the length of our calldata totals up like so: 4 + 32 * 2. // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space. // Counterintuitively, this call must be positioned second to the or() call in the // surrounding and() call or else returndatasize() will be zero during the computation. call(gas(), token, 0, freeMemoryPointer, 68, 0, 32) ) } require(success, "TRANSFER_FAILED"); } function safeApprove( ERC20 token, address to, uint256 amount ) internal { bool success; /// @solidity memory-safe-assembly assembly { // Get a pointer to some free memory. let freeMemoryPointer := mload(0x40) // Write the abi-encoded calldata into memory, beginning with the function selector. mstore(freeMemoryPointer, 0x095ea7b300000000000000000000000000000000000000000000000000000000) mstore(add(freeMemoryPointer, 4), and(to, 0xffffffffffffffffffffffffffffffffffffffff)) // Append and mask the "to" argument. mstore(add(freeMemoryPointer, 36), amount) // Append the "amount" argument. Masking not required as it's a full 32 byte type. 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 the length of our calldata totals up like so: 4 + 32 * 2. // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space. // Counterintuitively, this call must be positioned second to the or() call in the // surrounding and() call or else returndatasize() will be zero during the computation. call(gas(), token, 0, freeMemoryPointer, 68, 0, 32) ) } require(success, "APPROVE_FAILED"); } }
//SPDX-License-Identifier: MIT pragma solidity ^0.8.0; library JsonWriter { using JsonWriter for string; struct Json { int256 depthBitTracker; string value; } bytes1 constant BACKSLASH = bytes1(uint8(92)); bytes1 constant BACKSPACE = bytes1(uint8(8)); bytes1 constant CARRIAGE_RETURN = bytes1(uint8(13)); bytes1 constant DOUBLE_QUOTE = bytes1(uint8(34)); bytes1 constant FORM_FEED = bytes1(uint8(12)); bytes1 constant FRONTSLASH = bytes1(uint8(47)); bytes1 constant HORIZONTAL_TAB = bytes1(uint8(9)); bytes1 constant NEWLINE = bytes1(uint8(10)); string constant TRUE = "true"; string constant FALSE = "false"; bytes1 constant OPEN_BRACE = "{"; bytes1 constant CLOSED_BRACE = "}"; bytes1 constant OPEN_BRACKET = "["; bytes1 constant CLOSED_BRACKET = "]"; bytes1 constant LIST_SEPARATOR = ","; int256 constant MAX_INT256 = type(int256).max; /** * @dev Writes the beginning of a JSON array. */ function writeStartArray(Json memory json) internal pure returns (Json memory) { return writeStart(json, OPEN_BRACKET); } /** * @dev Writes the beginning of a JSON array with a property name as the key. */ function writeStartArray(Json memory json, string memory propertyName) internal pure returns (Json memory) { return writeStart(json, propertyName, OPEN_BRACKET); } /** * @dev Writes the beginning of a JSON object. */ function writeStartObject(Json memory json) internal pure returns (Json memory) { return writeStart(json, OPEN_BRACE); } /** * @dev Writes the beginning of a JSON object with a property name as the key. */ function writeStartObject(Json memory json, string memory propertyName) internal pure returns (Json memory) { return writeStart(json, propertyName, OPEN_BRACE); } /** * @dev Writes the end of a JSON array. */ function writeEndArray(Json memory json) internal pure returns (Json memory) { return writeEnd(json, CLOSED_BRACKET); } /** * @dev Writes the end of a JSON object. */ function writeEndObject(Json memory json) internal pure returns (Json memory) { return writeEnd(json, CLOSED_BRACE); } /** * @dev Writes the property name and address value (as a JSON string) as part of a name/value pair of a JSON object. */ function writeAddressProperty( Json memory json, string memory propertyName, address value ) internal pure returns (Json memory) { if (json.depthBitTracker < 0) { json.value = string(abi.encodePacked(json.value, LIST_SEPARATOR, '"', propertyName, '": "', addressToString(value), '"')); } else { json.value = string(abi.encodePacked(json.value, '"', propertyName, '": "', addressToString(value), '"')); } json.depthBitTracker = setListSeparatorFlag(json); return json; } /** * @dev Writes the address value (as a JSON string) as an element of a JSON array. */ function writeAddressValue(Json memory json, address value) internal pure returns (Json memory) { if (json.depthBitTracker < 0) { json.value = string(abi.encodePacked(json.value, LIST_SEPARATOR, '"', addressToString(value), '"')); } else { json.value = string(abi.encodePacked(json.value, '"', addressToString(value), '"')); } json.depthBitTracker = setListSeparatorFlag(json); return json; } /** * @dev Writes the property name and boolean value (as a JSON literal "true" or "false") as part of a name/value pair of a JSON object. */ function writeBooleanProperty( Json memory json, string memory propertyName, bool value ) internal pure returns (Json memory) { string memory strValue; if (value) { strValue = TRUE; } else { strValue = FALSE; } if (json.depthBitTracker < 0) { json.value = string(abi.encodePacked(json.value, LIST_SEPARATOR, '"', propertyName, '": ', strValue)); } else { json.value = string(abi.encodePacked(json.value, '"', propertyName, '": ', strValue)); } json.depthBitTracker = setListSeparatorFlag(json); return json; } /** * @dev Writes the boolean value (as a JSON literal "true" or "false") as an element of a JSON array. */ function writeBooleanValue(Json memory json, bool value) internal pure returns (Json memory) { string memory strValue; if (value) { strValue = TRUE; } else { strValue = FALSE; } if (json.depthBitTracker < 0) { json.value = string(abi.encodePacked(json.value, LIST_SEPARATOR, strValue)); } else { json.value = string(abi.encodePacked(json.value, strValue)); } json.depthBitTracker = setListSeparatorFlag(json); return json; } /** * @dev Writes the property name and int value (as a JSON number) as part of a name/value pair of a JSON object. */ function writeIntProperty( Json memory json, string memory propertyName, int256 value ) internal pure returns (Json memory) { if (json.depthBitTracker < 0) { json.value = string(abi.encodePacked(json.value, LIST_SEPARATOR, '"', propertyName, '": ', intToString(value))); } else { json.value = string(abi.encodePacked(json.value, '"', propertyName, '": ', intToString(value))); } json.depthBitTracker = setListSeparatorFlag(json); return json; } /** * @dev Writes the int value (as a JSON number) as an element of a JSON array. */ function writeIntValue(Json memory json, int256 value) internal pure returns (Json memory) { if (json.depthBitTracker < 0) { json.value = string(abi.encodePacked(json.value, LIST_SEPARATOR, intToString(value))); } else { json.value = string(abi.encodePacked(json.value, intToString(value))); } json.depthBitTracker = setListSeparatorFlag(json); return json; } /** * @dev Writes the property name and value of null as part of a name/value pair of a JSON object. */ function writeNullProperty(Json memory json, string memory propertyName) internal pure returns (Json memory) { if (json.depthBitTracker < 0) { json.value = string(abi.encodePacked(json.value, LIST_SEPARATOR, '"', propertyName, '": null')); } else { json.value = string(abi.encodePacked(json.value, '"', propertyName, '": null')); } json.depthBitTracker = setListSeparatorFlag(json); return json; } /** * @dev Writes the value of null as an element of a JSON array. */ function writeNullValue(Json memory json) internal pure returns (Json memory) { if (json.depthBitTracker < 0) { json.value = string(abi.encodePacked(json.value, LIST_SEPARATOR, "null")); } else { json.value = string(abi.encodePacked(json.value, "null")); } json.depthBitTracker = setListSeparatorFlag(json); return json; } /** * @dev Writes the string text value (as a JSON string) as an element of a JSON array. */ function writeStringProperty( Json memory json, string memory propertyName, string memory value ) internal pure returns (Json memory) { string memory jsonEscapedString = escapeJsonString(value); if (json.depthBitTracker < 0) { json.value = string(abi.encodePacked(json.value, LIST_SEPARATOR, '"', propertyName, '": "', jsonEscapedString, '"')); } else { json.value = string(abi.encodePacked(json.value, '"', propertyName, '": "', jsonEscapedString, '"')); } json.depthBitTracker = setListSeparatorFlag(json); return json; } /** * @dev Writes the property name and string text value (as a JSON string) as part of a name/value pair of a JSON object. */ function writeStringValue(Json memory json, string memory value) internal pure returns (Json memory) { string memory jsonEscapedString = escapeJsonString(value); if (json.depthBitTracker < 0) { json.value = string(abi.encodePacked(json.value, LIST_SEPARATOR, '"', jsonEscapedString, '"')); } else { json.value = string(abi.encodePacked(json.value, '"', jsonEscapedString, '"')); } json.depthBitTracker = setListSeparatorFlag(json); return json; } /** * @dev Writes the property name and uint value (as a JSON number) as part of a name/value pair of a JSON object. */ function writeUintProperty( Json memory json, string memory propertyName, uint256 value ) internal pure returns (Json memory) { if (json.depthBitTracker < 0) { json.value = string(abi.encodePacked(json.value, LIST_SEPARATOR, '"', propertyName, '": ', uintToString(value))); } else { json.value = string(abi.encodePacked(json.value, '"', propertyName, '": ', uintToString(value))); } json.depthBitTracker = setListSeparatorFlag(json); return json; } /** * @dev Writes the uint value (as a JSON number) as an element of a JSON array. */ function writeUintValue(Json memory json, uint256 value) internal pure returns (Json memory) { if (json.depthBitTracker < 0) { json.value = string(abi.encodePacked(json.value, LIST_SEPARATOR, uintToString(value))); } else { json.value = string(abi.encodePacked(json.value, uintToString(value))); } json.depthBitTracker = setListSeparatorFlag(json); return json; } /** * @dev Writes the beginning of a JSON array or object based on the token parameter. */ function writeStart(Json memory json, bytes1 token) private pure returns (Json memory) { if (json.depthBitTracker < 0) { json.value = string(abi.encodePacked(json.value, LIST_SEPARATOR, token)); } else { json.value = string(abi.encodePacked(json.value, token)); } json.depthBitTracker &= MAX_INT256; json.depthBitTracker++; return json; } /** * @dev Writes the beginning of a JSON array or object based on the token parameter with a property name as the key. */ function writeStart( Json memory json, string memory propertyName, bytes1 token ) private pure returns (Json memory) { if (json.depthBitTracker < 0) { json.value = string(abi.encodePacked(json.value, LIST_SEPARATOR, '"', propertyName, '": ', token)); } else { json.value = string(abi.encodePacked(json.value, '"', propertyName, '": ', token)); } json.depthBitTracker &= MAX_INT256; json.depthBitTracker++; return json; } /** * @dev Writes the end of a JSON array or object based on the token parameter. */ function writeEnd(Json memory json, bytes1 token) private pure returns (Json memory) { json.value = string(abi.encodePacked(json.value, token)); json.depthBitTracker = setListSeparatorFlag(json); if (getCurrentDepth(json) != 0) { json.depthBitTracker--; } return json; } /** * @dev Escapes any characters that required by JSON to be escaped. */ function escapeJsonString(string memory value) private pure returns (string memory str) { bytes memory b = bytes(value); bool foundEscapeChars; for (uint256 i; i < b.length; i++) { if (b[i] == BACKSLASH) { foundEscapeChars = true; break; } else if (b[i] == DOUBLE_QUOTE) { foundEscapeChars = true; break; } else if (b[i] == FRONTSLASH) { foundEscapeChars = true; break; } else if (b[i] == HORIZONTAL_TAB) { foundEscapeChars = true; break; } else if (b[i] == FORM_FEED) { foundEscapeChars = true; break; } else if (b[i] == NEWLINE) { foundEscapeChars = true; break; } else if (b[i] == CARRIAGE_RETURN) { foundEscapeChars = true; break; } else if (b[i] == BACKSPACE) { foundEscapeChars = true; break; } } if (!foundEscapeChars) { return value; } for (uint256 i; i < b.length; i++) { if (b[i] == BACKSLASH) { str = string(abi.encodePacked(str, "\\\\")); } else if (b[i] == DOUBLE_QUOTE) { str = string(abi.encodePacked(str, '\\"')); } else if (b[i] == FRONTSLASH) { str = string(abi.encodePacked(str, "\\/")); } else if (b[i] == HORIZONTAL_TAB) { str = string(abi.encodePacked(str, "\\t")); } else if (b[i] == FORM_FEED) { str = string(abi.encodePacked(str, "\\f")); } else if (b[i] == NEWLINE) { str = string(abi.encodePacked(str, "\\n")); } else if (b[i] == CARRIAGE_RETURN) { str = string(abi.encodePacked(str, "\\r")); } else if (b[i] == BACKSPACE) { str = string(abi.encodePacked(str, "\\b")); } else { str = string(abi.encodePacked(str, b[i])); } } return str; } /** * @dev Tracks the recursive depth of the nested objects / arrays within the JSON text * written so far. This provides the depth of the current token. */ function getCurrentDepth(Json memory json) private pure returns (int256) { return json.depthBitTracker & MAX_INT256; } /** * @dev The highest order bit of json.depthBitTracker is used to discern whether we are writing the first item in a list or not. * if (json.depthBitTracker >> 255) == 1, add a list separator before writing the item * else, no list separator is needed since we are writing the first item. */ function setListSeparatorFlag(Json memory json) private pure returns (int256) { return json.depthBitTracker | (int256(1) << 255); } /** * @dev Converts an address to a string. */ function addressToString(address _address) internal pure returns (string memory) { bytes32 value = bytes32(uint256(uint160(_address))); bytes16 alphabet = "0123456789abcdef"; bytes memory str = new bytes(42); str[0] = "0"; str[1] = "x"; for (uint256 i; i < 20; i++) { str[2 + i * 2] = alphabet[uint8(value[i + 12] >> 4)]; str[3 + i * 2] = alphabet[uint8(value[i + 12] & 0x0f)]; } return string(str); } /** * @dev Converts an int to a string. */ function intToString(int256 i) internal pure returns (string memory) { if (i == 0) { return "0"; } if (i == type(int256).min) { // hard-coded since int256 min value can't be converted to unsigned return "-57896044618658097711785492504343953926634992332820282019728792003956564819968"; } bool negative = i < 0; uint256 len; uint256 j; if(!negative) { j = uint256(i); } else { j = uint256(-i); ++len; // make room for '-' sign } uint256 l = j; while (j != 0) { len++; j /= 10; } bytes memory bstr = new bytes(len); uint256 k = len; while (l != 0) { bstr[--k] = bytes1((48 + uint8(l - (l / 10) * 10))); l /= 10; } if (negative) { bstr[0] = "-"; // prepend '-' } return string(bstr); } /** * @dev Converts a uint to a string. */ function uintToString(uint256 _i) internal pure returns (string memory) { if (_i == 0) { return "0"; } uint256 j = _i; uint256 len; while (j != 0) { len++; j /= 10; } bytes memory bstr = new bytes(len); uint256 k = len; while (_i != 0) { bstr[--k] = bytes1((48 + uint8(_i - (_i / 10) * 10))); _i /= 10; } return string(bstr); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Base64.sol) pragma solidity ^0.8.20; /** * @dev Provides a set of functions to operate with Base64 strings. */ library Base64 { /** * @dev Base64 Encoding/Decoding Table */ string internal constant _TABLE = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; /** * @dev Converts a `bytes` to its Bytes64 `string` representation. */ function encode(bytes memory data) internal pure returns (string memory) { /** * Inspired by Brecht Devos (Brechtpd) implementation - MIT licence * https://github.com/Brechtpd/base64/blob/e78d9fd951e7b0977ddca77d92dc85183770daf4/base64.sol */ if (data.length == 0) return ""; // Loads the table into memory string memory table = _TABLE; // Encoding takes 3 bytes chunks of binary data from `bytes` data parameter // and split into 4 numbers of 6 bits. // The final Base64 length should be `bytes` data length multiplied by 4/3 rounded up // - `data.length + 2` -> Round up // - `/ 3` -> Number of 3-bytes chunks // - `4 *` -> 4 characters for each chunk string memory result = new string(4 * ((data.length + 2) / 3)); /// @solidity memory-safe-assembly assembly { // Prepare the lookup table (skip the first "length" byte) let tablePtr := add(table, 1) // Prepare result pointer, jump over length let resultPtr := add(result, 32) // Run over the input, 3 bytes at a time for { let dataPtr := data let endPtr := add(data, mload(data)) } lt(dataPtr, endPtr) { } { // Advance 3 bytes dataPtr := add(dataPtr, 3) let input := mload(dataPtr) // To write each character, shift the 3 bytes (18 bits) chunk // 4 times in blocks of 6 bits for each character (18, 12, 6, 0) // and apply logical AND with 0x3F which is the number of // the previous character in the ASCII table prior to the Base64 Table // The result is then added to the table to get the character to write, // and finally write it in the result pointer but with a left shift // of 256 (1 byte) - 8 (1 ASCII char) = 248 bits mstore8(resultPtr, mload(add(tablePtr, and(shr(18, input), 0x3F)))) resultPtr := add(resultPtr, 1) // Advance mstore8(resultPtr, mload(add(tablePtr, and(shr(12, input), 0x3F)))) resultPtr := add(resultPtr, 1) // Advance mstore8(resultPtr, mload(add(tablePtr, and(shr(6, input), 0x3F)))) resultPtr := add(resultPtr, 1) // Advance mstore8(resultPtr, mload(add(tablePtr, and(input, 0x3F)))) resultPtr := add(resultPtr, 1) // Advance } // When data `bytes` is not exactly 3 bytes long // it is padded with `=` characters at the end switch mod(mload(data), 3) case 1 { mstore8(sub(resultPtr, 1), 0x3d) mstore8(sub(resultPtr, 2), 0x3d) } case 2 { mstore8(sub(resultPtr, 1), 0x3d) } } return result; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Strings.sol) pragma solidity ^0.8.20; import {Math} from "./math/Math.sol"; import {SignedMath} from "./math/SignedMath.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant HEX_DIGITS = "0123456789abcdef"; uint8 private constant ADDRESS_LENGTH = 20; /** * @dev The `value` string doesn't fit in the specified `length`. */ error StringsInsufficientHexLength(uint256 value, uint256 length); /** * @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), HEX_DIGITS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `int256` to its ASCII `string` decimal representation. */ function toStringSigned(int256 value) internal pure returns (string memory) { return string.concat(value < 0 ? "-" : "", toString(SignedMath.abs(value))); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, Math.log256(value) + 1); } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { uint256 localValue = value; bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = HEX_DIGITS[localValue & 0xf]; localValue >>= 4; } if (localValue != 0) { revert StringsInsufficientHexLength(value, length); } return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal * representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), ADDRESS_LENGTH); } /** * @dev Returns true if the two strings are equal. */ function equal(string memory a, string memory b) internal pure returns (bool) { return bytes(a).length == bytes(b).length && keccak256(bytes(a)) == keccak256(bytes(b)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Context.sol) pragma solidity ^0.8.20; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity >=0.8.0; /// @notice Modern and gas efficient ERC20 + EIP-2612 implementation. /// @author Solmate (https://github.com/transmissions11/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 // OpenZeppelin Contracts (last updated v5.0.0) (utils/math/Math.sol) pragma solidity ^0.8.20; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { /** * @dev Muldiv operation overflow. */ error MathOverflowedMulDiv(); enum Rounding { Floor, // Toward negative infinity Ceil, // Toward positive infinity Trunc, // Toward zero Expand // Away from zero } /** * @dev Returns the addition of two unsigned integers, with an overflow flag. */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the subtraction of two unsigned integers, with an overflow flag. */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds towards infinity instead * of rounding towards zero. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { if (b == 0) { // Guarantee the same behavior as in a regular Solidity division. return a / b; } // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or * denominator == 0. * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by * Uniswap Labs also under MIT license. */ function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0 = x * y; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { // Solidity will revert if denominator == 0, unlike the div opcode on its own. // The surrounding unchecked block does not change this fact. // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic. return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. if (denominator <= prod1) { revert MathOverflowedMulDiv(); } /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. // Always >= 1. See https://cs.stackexchange.com/q/138556/92363. uint256 twos = denominator & (0 - denominator); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also // works in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded * towards zero. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2 of a positive value rounded towards zero. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10 of a positive value rounded towards zero. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10 ** 64) { value /= 10 ** 64; result += 64; } if (value >= 10 ** 32) { value /= 10 ** 32; result += 32; } if (value >= 10 ** 16) { value /= 10 ** 16; result += 16; } if (value >= 10 ** 8) { value /= 10 ** 8; result += 8; } if (value >= 10 ** 4) { value /= 10 ** 4; result += 4; } if (value >= 10 ** 2) { value /= 10 ** 2; result += 2; } if (value >= 10 ** 1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0); } } /** * @dev Return the log in base 256 of a positive value rounded towards zero. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 256, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0); } } /** * @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers. */ function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) { return uint8(rounding) % 2 == 1; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SignedMath.sol) pragma solidity ^0.8.20; /** * @dev Standard signed math utilities missing in the Solidity language. */ library SignedMath { /** * @dev Returns the largest of two signed numbers. */ function max(int256 a, int256 b) internal pure returns (int256) { return a > b ? a : b; } /** * @dev Returns the smallest of two signed numbers. */ function min(int256 a, int256 b) internal pure returns (int256) { return a < b ? a : b; } /** * @dev Returns the average of two signed numbers without overflow. * The result is rounded towards zero. */ function average(int256 a, int256 b) internal pure returns (int256) { // Formula from the book "Hacker's Delight" int256 x = (a & b) + ((a ^ b) >> 1); return x + (int256(uint256(x) >> 255) & (a ^ b)); } /** * @dev Returns the absolute unsigned value of a signed value. */ function abs(int256 n) internal pure returns (uint256) { unchecked { // must be unchecked in order to support `n = type(int256).min` return uint256(n >= 0 ? n : -n); } } }
{ "remappings": [ "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/", "ds-test/=lib/forge-std/lib/ds-test/src/", "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/", "forge-std/=lib/forge-std/src/", "openzeppelin-contracts/=lib/openzeppelin-contracts/", "solidity-json-writer/=lib/solidity-json-writer/contracts/", "solmate/=lib/solmate/src/" ], "optimizer": { "enabled": true, "runs": 200 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "ipfs", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "paris", "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"_descriptor","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AlreadyStarToken","type":"error"},{"inputs":[],"name":"ExceedsMaxMintPerTransaction","type":"error"},{"inputs":[],"name":"HasNotReachedEnd","type":"error"},{"inputs":[],"name":"IncorrectPrice","type":"error"},{"inputs":[],"name":"InvalidDirection","type":"error"},{"inputs":[],"name":"MaxStarTokensReached","type":"error"},{"inputs":[],"name":"MintingClosed","type":"error"},{"inputs":[],"name":"MovementLocked","type":"error"},{"inputs":[],"name":"NotMinted","type":"error"},{"inputs":[],"name":"NotTokenOwner","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[{"internalType":"uint256","name":"x","type":"uint256"},{"internalType":"uint256","name":"y","type":"uint256"}],"name":"PositionCurrentlyTaken","type":"error"},{"inputs":[{"internalType":"uint256","name":"x","type":"uint256"},{"internalType":"uint256","name":"y","type":"uint256"}],"name":"PositionNotMintable","type":"error"},{"inputs":[{"internalType":"uint256","name":"x","type":"uint256"},{"internalType":"uint256","name":"y","type":"uint256"}],"name":"PositionOutOfBounds","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"MAX_MINT_PER_TX","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_STAR_TOKENS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_SUPPLY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"NUM_COLUMNS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"NUM_ROWS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"},{"components":[{"internalType":"uint256","name":"x","type":"uint256"},{"internalType":"uint256","name":"y","type":"uint256"}],"internalType":"struct ITokenDescriptor.Coordinate[]","name":"coordinates","type":"tuple[]"}],"name":"artistMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"canMove","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32[]","name":"merkleProof","type":"bytes32[]"},{"internalType":"address","name":"_address","type":"address"},{"internalType":"bytes32","name":"_root","type":"bytes32"}],"name":"checkMerkleProof","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"closeMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"config","outputs":[{"internalType":"uint64","name":"startTime","type":"uint64"},{"internalType":"uint64","name":"endTime","type":"uint64"},{"internalType":"uint256","name":"startPriceInWei","type":"uint256"},{"internalType":"uint256","name":"endPriceInWei","type":"uint256"},{"internalType":"address payable","name":"fundsRecipient","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"currentTokenId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"descriptor","outputs":[{"internalType":"contract ITokenDescriptor","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"fpMembersMerkleRoot","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAvailableCoordinates","outputs":[{"components":[{"internalType":"uint256","name":"x","type":"uint256"},{"internalType":"uint256","name":"y","type":"uint256"}],"internalType":"struct ITokenDescriptor.Coordinate[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCurrentPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getGrid","outputs":[{"internalType":"uint256[25][25]","name":"","type":"uint256[25][25]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getToken","outputs":[{"components":[{"components":[{"internalType":"uint256","name":"x","type":"uint256"},{"internalType":"uint256","name":"y","type":"uint256"}],"internalType":"struct ITokenDescriptor.Coordinate","name":"initial","type":"tuple"},{"components":[{"internalType":"uint256","name":"x","type":"uint256"},{"internalType":"uint256","name":"y","type":"uint256"}],"internalType":"struct ITokenDescriptor.Coordinate","name":"current","type":"tuple"},{"internalType":"uint256","name":"timestamp","type":"uint256"},{"internalType":"bool","name":"hasReachedEnd","type":"bool"},{"internalType":"bool","name":"isStar","type":"bool"},{"internalType":"enum ITokenDescriptor.Direction","name":"direction","type":"uint8"},{"internalType":"uint256","name":"numMovements","type":"uint256"}],"internalType":"struct ITokenDescriptor.Token","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTokens","outputs":[{"components":[{"components":[{"internalType":"uint256","name":"x","type":"uint256"},{"internalType":"uint256","name":"y","type":"uint256"}],"internalType":"struct ITokenDescriptor.Coordinate","name":"initial","type":"tuple"},{"components":[{"internalType":"uint256","name":"x","type":"uint256"},{"internalType":"uint256","name":"y","type":"uint256"}],"internalType":"struct ITokenDescriptor.Coordinate","name":"current","type":"tuple"},{"internalType":"uint256","name":"timestamp","type":"uint256"},{"internalType":"bool","name":"hasReachedEnd","type":"bool"},{"internalType":"bool","name":"isStar","type":"bool"},{"internalType":"enum ITokenDescriptor.Direction","name":"direction","type":"uint8"},{"internalType":"uint256","name":"numMovements","type":"uint256"}],"internalType":"struct ITokenDescriptor.Token[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"holdersMerkleRoot","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"x","type":"uint256"},{"internalType":"uint256","name":"y","type":"uint256"}],"name":"lockAsStar","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"x","type":"uint256"},{"internalType":"uint256","name":"y","type":"uint256"}],"internalType":"struct ITokenDescriptor.Coordinate[]","name":"coordinates","type":"tuple[]"},{"internalType":"bytes32[]","name":"merkleProof","type":"bytes32[]"}],"name":"mintAtPosition","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"quantity","type":"uint256"},{"internalType":"bytes32[]","name":"merkleProof","type":"bytes32[]"}],"name":"mintRandom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"moveEast","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"moveNorth","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"moveNortheast","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"moveNorthwest","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"moveSouth","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"moveSoutheast","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"moveSouthwest","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"moveWest","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"numStarTokens","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"owner","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_descriptor","type":"address"}],"name":"setDescriptor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"x","type":"uint256"},{"internalType":"uint256","name":"y","type":"uint256"}],"internalType":"struct ITokenDescriptor.Coordinate[]","name":"coordinates","type":"tuple[]"}],"name":"setInitialAvailableCoordinates","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokenIdToTokenInfo","outputs":[{"components":[{"internalType":"uint256","name":"x","type":"uint256"},{"internalType":"uint256","name":"y","type":"uint256"}],"internalType":"struct ITokenDescriptor.Coordinate","name":"initial","type":"tuple"},{"components":[{"internalType":"uint256","name":"x","type":"uint256"},{"internalType":"uint256","name":"y","type":"uint256"}],"internalType":"struct ITokenDescriptor.Coordinate","name":"current","type":"tuple"},{"internalType":"uint256","name":"timestamp","type":"uint256"},{"internalType":"bool","name":"hasReachedEnd","type":"bool"},{"internalType":"bool","name":"isStar","type":"bool"},{"internalType":"enum ITokenDescriptor.Direction","name":"direction","type":"uint8"},{"internalType":"uint256","name":"numMovements","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"tokensOfOwner","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint64","name":"startTime","type":"uint64"},{"internalType":"uint64","name":"endTime","type":"uint64"},{"internalType":"uint256","name":"startPriceInWei","type":"uint256"},{"internalType":"uint256","name":"endPriceInWei","type":"uint256"},{"internalType":"address payable","name":"fundsRecipient","type":"address"}],"name":"updateConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_holdersRoot","type":"bytes32"},{"internalType":"bytes32","name":"_fpMembersRoot","type":"bytes32"}],"name":"updateMerkleRoots","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60a0604052620334506080526001600b553480156200001d57600080fd5b5060405162003e3238038062003e328339810160408190526200004091620001ba565b6040805180820182526004808252634c494e4560e01b6020808401829052845180860190955291845290830152339160006200007d838262000293565b5060016200008c828262000293565b5050506001600160a01b038116620000be57604051631e4fbdf760e01b81526000600482015260240160405180910390fd5b620000c9816200014a565b506001600855600f80546001600160a01b039092166001600160a01b0319928316179055601080546b65d648300000000065d63a206001600160801b0319909116179055670de0b6b3a7640000601155670214e8348c4f00006012556013805490911673943ccdd95803e35369ccf42e9618f992fd2fea2e1790556200035f565b600780546001600160a01b0319169055620001658162000168565b50565b600680546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600060208284031215620001cd57600080fd5b81516001600160a01b0381168114620001e557600080fd5b9392505050565b634e487b7160e01b600052604160045260246000fd5b600181811c908216806200021757607f821691505b6020821081036200023857634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200028e576000816000526020600020601f850160051c81016020861015620002695750805b601f850160051c820191505b818110156200028a5782815560010162000275565b5050505b505050565b81516001600160401b03811115620002af57620002af620001ec565b620002c781620002c0845462000202565b846200023e565b602080601f831160018114620002ff5760008415620002e65750858301515b600019600386901b1c1916600185901b1785556200028a565b600085815260208120601f198616915b8281101562000330578886015182559484019460019091019084016200030f565b50858210156200034f5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b608051613ab76200037b60003960006112e50152613ab76000f3fe6080604052600436106103755760003560e01c806379ba5097116101d1578063a9cc1dbc11610102578063d692f7a7116100a0578063e985e9c51161006f578063e985e9c514610a7d578063eb91d37e14610ab8578063f2fde38b14610acd578063ff4f3a8414610aed57600080fd5b8063d692f7a7146109ff578063dcf2fe5414610a1f578063e30c397814610a32578063e4b50cb814610a5057600080fd5b8063c32c4b1f116100dc578063c32c4b1f1461099f578063c87b56dd146109bf578063d227975c146109df578063d240b7881461087457600080fd5b8063a9cc1dbc1461093d578063aa6ca8081461095d578063b88d4fde1461097f57600080fd5b80638ecad7211161016f5780639b66ad53116101495780639b66ad5314610874578063a22cb465146108f1578063a2e8bed914610911578063a85423181461092757600080fd5b80638ecad721146108a757806395d6a3cc146108bc57806395d89b41146108dc57600080fd5b8063840b88fe116101ab578063840b88fe146108275780638462151c1461084757806389ae5f47146108745780638da5cb5b1461088957600080fd5b806379ba5097146107df5780637f99c8e3146107f4578063825fa1e61461081457600080fd5b8063345af624116102ab5780635fb8bcd51161024957806370a082311161022357806370a082311461070d578063715018a61461072d57806373ea4db51461074257806379502c551461076257600080fd5b80635fb8bcd5146106385780636352211e146106d857806364f101f0146106f857600080fd5b806342842e0e1161028557806342842e0e146105be5780634779dbd9146105de578063570990e5146105fe5780635b85e90d1461061e57600080fd5b8063345af624146105695780633ccfd60b1461058957806340f91aea1461059e57600080fd5b8063134000c01161031857806323b872dd116102f257806323b872dd146104f4578063303e74df14610514578063326b97d11461053457806332cb6b0c1461055457600080fd5b8063134000c0146104a757806318160ddd146104c957806318c66804146104de57600080fd5b806306fdde031161035457806306fdde03146103f5578063081812fc14610417578063095ea7b314610465578063101eb3321461048557600080fd5b80629a9b7b1461037a57806301b9a397146103a357806301ffc9a7146103c5575b600080fd5b34801561038657600080fd5b50610390600b5481565b6040519081526020015b60405180910390f35b3480156103af57600080fd5b506103c36103be366004612f75565b610b0d565b005b3480156103d157600080fd5b506103e56103e0366004612fa8565b610b37565b604051901515815260200161039a565b34801561040157600080fd5b5061040a610b89565b60405161039a9190612fe9565b34801561042357600080fd5b5061044d61043236600461301c565b6004602052600090815260409020546001600160a01b031681565b6040516001600160a01b03909116815260200161039a565b34801561047157600080fd5b506103c3610480366004613035565b610c17565b34801561049157600080fd5b5061049a610cfe565b60405161039a9190613061565b3480156104b357600080fd5b506104bc610d72565b60405161039a91906130b8565b3480156104d557600080fd5b50600e54610390565b3480156104ea57600080fd5b50610390600a5481565b34801561050057600080fd5b506103c361050f36600461311a565b610dd6565b34801561052057600080fd5b50600f5461044d906001600160a01b031681565b34801561054057600080fd5b506103c361054f36600461301c565b610f9d565b34801561056057600080fd5b5061039060fa81565b34801561057557600080fd5b506103c361058436600461315b565b610ffb565b34801561059557600080fd5b506103c36112c4565b3480156105aa57600080fd5b506103c36105b936600461301c565b61138d565b3480156105ca57600080fd5b506103c36105d936600461311a565b6113e6565b3480156105ea57600080fd5b506103c36105f936600461301c565b6114de565b34801561060a57600080fd5b506103c3610619366004613187565b611537565b34801561062a57600080fd5b50600d546103e59060ff1681565b34801561064457600080fd5b506106c561065336600461301c565b61028860209081526000918252604091829020825180840184528154815260018201548184015283518085019094526002820154845260038201549284019290925260048101546005820154600690920154929392909160ff8082169261010083048216926201000090049091169087565b60405161039a97969594939291906131e1565b3480156106e457600080fd5b5061044d6106f336600461301c565b61154a565b34801561070457600080fd5b506103c36115a1565b34801561071957600080fd5b50610390610728366004612f75565b6115bc565b34801561073957600080fd5b506103c361161f565b34801561074e57600080fd5b506103c361075d36600461301c565b611631565b34801561076e57600080fd5b506010546011546012546013546107a3936001600160401b0380821694600160401b909204169290916001600160a01b031685565b604080516001600160401b0396871681529590941660208601529284019190915260608301526001600160a01b0316608082015260a00161039a565b3480156107eb57600080fd5b506103c361168b565b34801561080057600080fd5b506103c361080f36600461301c565b6116cc565b6103c36108223660046133a7565b6116d9565b34801561083357600080fd5b506103c361084236600461340f565b6117fa565b34801561085357600080fd5b50610867610862366004612f75565b6118dd565b60405161039a9190613483565b34801561088057600080fd5b50610390601981565b34801561089557600080fd5b506006546001600160a01b031661044d565b3480156108b357600080fd5b50610390600581565b3480156108c857600080fd5b506103e56108d73660046134c7565b611998565b3480156108e857600080fd5b5061040a611a1e565b3480156108fd57600080fd5b506103c361090c366004613523565b611a2b565b34801561091d57600080fd5b5061039060095481565b34801561093357600080fd5b50610390600c5481565b34801561094957600080fd5b506103c361095836600461301c565b611a97565b34801561096957600080fd5b50610972611aa5565b60405161039a91906135d0565b34801561098b57600080fd5b506103c361099a366004613613565b611c06565b3480156109ab57600080fd5b506103c36109ba36600461301c565b611cee565b3480156109cb57600080fd5b5061040a6109da36600461301c565b611d48565b3480156109eb57600080fd5b506103c36109fa3660046136c8565b611eba565b348015610a0b57600080fd5b506103c3610a1a36600461301c565b611f22565b6103c3610a2d366004613723565b611f7c565b348015610a3e57600080fd5b506007546001600160a01b031661044d565b348015610a5c57600080fd5b50610a70610a6b36600461301c565b6120c4565b60405161039a9190613761565b348015610a8957600080fd5b506103e5610a98366004613770565b600560209081526000928352604080842090915290825290205460ff1681565b348015610ac457600080fd5b50610390612194565b348015610ad957600080fd5b506103c3610ae8366004612f75565b6122ab565b348015610af957600080fd5b506103c3610b0836600461379e565b61231c565b610b15612386565b600f80546001600160a01b0319166001600160a01b0392909216919091179055565b60006301ffc9a760e01b6001600160e01b031983161480610b6857506380ac58cd60e01b6001600160e01b03198316145b80610b835750635b5e139f60e01b6001600160e01b03198316145b92915050565b60008054610b96906137ed565b80601f0160208091040260200160405190810160405280929190818152602001828054610bc2906137ed565b8015610c0f5780601f10610be457610100808354040283529160200191610c0f565b820191906000526020600020905b815481529060010190602001808311610bf257829003601f168201915b505050505081565b6000818152600260205260409020546001600160a01b031633811480610c6057506001600160a01b038116600090815260056020908152604080832033845290915290205460ff165b610ca25760405162461bcd60e51b815260206004820152600e60248201526d1393d517d055551213d49256915160921b60448201526064015b60405180910390fd5b60008281526004602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b6060610285805480602002602001604051908101604052809291908181526020016000905b82821015610d6957838290600052602060002090600202016040518060400160405290816000820154815260200160018201548152505081526020019060010190610d23565b50505050905090565b610d7a612ea8565b604080516103208101909152601460196000835b82821015610d69576040805161032081019182905290601984810287019182845b815481526020019060010190808311610daf57505050505081526020019060010190610d8e565b6000818152600260205260409020546001600160a01b03848116911614610e2c5760405162461bcd60e51b815260206004820152600a60248201526957524f4e475f46524f4d60b01b6044820152606401610c99565b6001600160a01b038216610e765760405162461bcd60e51b81526020600482015260116024820152701253959053125117d49150d25412515395607a1b6044820152606401610c99565b336001600160a01b0384161480610eb057506001600160a01b038316600090815260056020908152604080832033845290915290205460ff165b80610ed157506000818152600460205260409020546001600160a01b031633145b610f0e5760405162461bcd60e51b815260206004820152600e60248201526d1393d517d055551213d49256915160921b6044820152606401610c99565b6001600160a01b0380841660008181526003602090815260408083208054600019019055938616808352848320805460010190558583526002825284832080546001600160a01b03199081168317909155600490925284832080549092169091559251849392917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b60016000828152610288602052604090206005015462010000900460ff166001811115610fcc57610fcc6131a9565b14610fea5760405163034b254960e21b815260040160405180910390fd5b610ff88160001960016123b3565b50565b6110048361154a565b6001600160a01b0316336001600160a01b031614611035576040516359dc379f60e01b815260040160405180910390fd5b600083815261028860209081526040808320815161012081018352815460e0820190815260018084015461010080850191909152918352845180860186526002850154815260038501548188015295830195909552600483015493820193909352600582015460ff808216151560608401529381048416151560808301529093919260a08501926201000090920416908111156110d4576110d46131a9565b60018111156110e5576110e56131a9565b8152602001600682015481525050905061110483838360a0015161274b565b61112b5760405163441d952160e01b81526004810184905260248101839052604401610c99565b6000611136836127ac565b905060006014826019811061114d5761114d613821565b60190201856019811061116257611162613821565b0154111561118d576040516311f8b93560e21b81526004810185905260248101849052604401610c99565b6019600c54036111b0576040516372a1333760e01b815260040160405180910390fd5b81606001516111d257604051632b12607b60e11b815260040160405180910390fd5b8160800151156111f5576040516307123f2360e51b815260040160405180910390fd5b6000601461120a8460200151602001516127ac565b6019811061121a5761121a613821565b601902018360200151600001516019811061123757611237613821565b0155846014826019811061124d5761124d613821565b60190201856019811061126257611262613821565b0155604080518082018252858152602080820186815260008981526102889092529281209151600283015591516003820155426004820155600501805461ff001916610100179055600c8054916112b88361384d565b91905055505050505050565b6112cc612386565b60135460405147916000916001600160a01b03909116907f000000000000000000000000000000000000000000000000000000000000000090849084818181858888f193505050503d8060008114611340576040519150601f19603f3d011682016040523d82523d6000602084013e611345565b606091505b50509050806113895760405162461bcd60e51b815260206004820152601060248201526f2a3930b739b332b9103330b4b632b21760811b6044820152606401610c99565b5050565b600080828152610288602052604090206005015462010000900460ff1660018111156113bb576113bb6131a9565b146113d95760405163034b254960e21b815260040160405180910390fd5b610ff881600019806123b3565b6113f1838383610dd6565b6001600160a01b0382163b158061149a5750604051630a85bd0160e11b8082523360048301526001600160a01b03858116602484015260448301849052608060648401526000608484015290919084169063150b7a029060a4016020604051808303816000875af115801561146a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061148e9190613866565b6001600160e01b031916145b6114d95760405162461bcd60e51b815260206004820152601060248201526f155394d0519157d49150d2541251539560821b6044820152606401610c99565b505050565b60016000828152610288602052604090206005015462010000900460ff16600181111561150d5761150d6131a9565b1461152b5760405163034b254960e21b815260040160405180910390fd5b610ff8816001806123b3565b61153f612386565b600991909155600a55565b6000818152600260205260409020546001600160a01b03168061159c5760405162461bcd60e51b815260206004820152600a6024820152691393d517d3525395115160b21b6044820152606401610c99565b919050565b6115a9612386565b600d805461ffff1916610101179055565b565b60006001600160a01b0382166116035760405162461bcd60e51b815260206004820152600c60248201526b5a45524f5f4144445245535360a01b6044820152606401610c99565b506001600160a01b031660009081526003602052604090205490565b611627612386565b6115ba60006127c5565b600080828152610288602052604090206005015462010000900460ff16600181111561165f5761165f6131a9565b1461167d5760405163034b254960e21b815260040160405180910390fd5b610ff88160016000196123b3565b60075433906001600160a01b031681146116c35760405163118cdaa760e01b81526001600160a01b0382166004820152602401610c99565b610ff8816127c5565b610ff881600160006123b3565b6116e16127de565b6010546001600160401b03164210806117015750600d54610100900460ff165b1561171f5760405163a7e4d9bd60e01b815260040160405180910390fd5b825160058111156117435760405163ba3a0a9b60e01b815260040160405180910390fd5b600061174d612194565b905082156117645761176184843384612808565b90505b61176e8282613883565b34101561178e576040516399b5cb1d60e01b815260040160405180910390fd5b6000805b838110156117dc5760006117bf8883815181106117b1576117b1613821565b60200260200101513361287c565b9050806117d3576117d0848461389a565b92505b50600101611792565b5080156117ed576117ed3382612af5565b5050506114d96001600855565b611802612386565b6102855460005b828110156118d757600061184385858481811061182857611828613821565b90506040020180360381019061183e91906138ad565b612b46565b600081815261028760205260409020805460ff191660011790559050611869828461389a565b6000828152610286602052604090205561028585858481811061188e5761188e613821565b8354600181018555600094855260209094206040909102929092019260020290910190506118c9828281358155602082013560018201555050565b505081600101915050611809565b50505050565b606060006118ea836115bc565b90506000816001600160401b038111156119065761190661323b565b60405190808252806020026020018201604052801561192f578160200160208202803683370190505b509050600060015b600e54811161198e57856001600160a01b03166119538261154a565b6001600160a01b031603611986578083838151811061197457611974613821565b60209081029190910101526001909101905b600101611937565b5090949350505050565b6040516bffffffffffffffffffffffff19606084901b1660208201526000908190603401604051602081830303815290604052805190602001209050611a14868680806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250879250859150612b769050565b9695505050505050565b60018054610b96906137ed565b3360008181526005602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b610ff88160001960006123b3565b60606000600e546001600160401b03811115611ac357611ac361323b565b604051908082528060200260200182016040528015611afc57816020015b611ae9612ed6565b815260200190600190039081611ae15790505b50905060005b600e54811015611c00576102886000611b1c83600161389a565b81526020808201929092526040908101600020815161012081018352815460e0820190815260018084015461010080850191909152918352845180860186526002850154815260038501548188015295830195909552600483015493820193909352600582015460ff808216151560608401529381048416151560808301529093919260a0850192620100009092041690811115611bbc57611bbc6131a9565b6001811115611bcd57611bcd6131a9565b8152602001600682015481525050828281518110611bed57611bed613821565b6020908102919091010152600101611b02565b50919050565b611c11858585610dd6565b6001600160a01b0384163b1580611ca85750604051630a85bd0160e11b808252906001600160a01b0386169063150b7a0290611c599033908a908990899089906004016138c9565b6020604051808303816000875af1158015611c78573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c9c9190613866565b6001600160e01b031916145b611ce75760405162461bcd60e51b815260206004820152601060248201526f155394d0519157d49150d2541251539560821b6044820152606401610c99565b5050505050565b60016000828152610288602052604090206005015462010000900460ff166001811115611d1d57611d1d6131a9565b14611d3b5760405163034b254960e21b815260040160405180910390fd5b610ff881600060016123b3565b60606000611d558361154a565b6001600160a01b031603611d7c57604051634d5e5fb360e01b815260040160405180910390fd5b600082815261028860209081526040808320815161012081018352815460e0820190815260018084015461010080850191909152918352845180860186526002850154815260038501548188015295830195909552600483015493820193909352600582015460ff808216151560608401529381048416151560808301529093919260a0850192620100009092041690811115611e1b57611e1b6131a9565b6001811115611e2c57611e2c6131a9565b815260069190910154602090910152600f54604051635f7e9a6760e01b81529192506001600160a01b031690635f7e9a6790611e6e908690859060040161391d565b600060405180830381865afa158015611e8b573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611eb39190810190613932565b9392505050565b611ec2612386565b601080546001600160401b039687166fffffffffffffffffffffffffffffffff1990911617600160401b959096169490940294909417909255601155601255601380546001600160a01b0319166001600160a01b03909216919091179055565b600080828152610288602052604090206005015462010000900460ff166001811115611f5057611f506131a9565b14611f6e5760405163034b254960e21b815260040160405180910390fd5b610ff88160006000196123b3565b611f846127de565b6010546001600160401b0316421080611fa45750600d54610100900460ff165b15611fc25760405163a7e4d9bd60e01b815260040160405180910390fd5b6005831115611fe45760405163ba3a0a9b60e01b815260040160405180910390fd5b6000611fee612194565b905081156120055761200283833384612808565b90505b60006120118583613883565b905080341015612034576040516399b5cb1d60e01b815260040160405180910390fd5b6000805b868110156117dc57610285546000908103612055575060006120a9565b600061028560008154811061206c5761206c613821565b90600052602060002090600202016040518060400160405290816000820154815260200160018201548152505090506120a5813361287c565b9150505b806120bb576120b8858461389a565b92505b50600101612038565b6120cc612ed6565b60008281526102886020908152604091829020825161012081018452815460e0820190815260018084015461010080850191909152918352855180870187526002850154815260038501548187015294830194909452600483015494820194909452600582015460ff808216151560608401529481048516151560808301529093919260a0850192620100009092049091169081111561216e5761216e6131a9565b600181111561217f5761217f6131a9565b81526020016006820154815250509050919050565b60105460009081906121b9906001600160401b0380821691600160401b9004166139c5565b6010546001600160401b0391821692506103b691164210156121df575050601154919050565b601054600090600a906121fb906001600160401b0316426139ec565b6122059190613a15565b61221090600a613883565b905082811061222457505060125492915050565b6011546122318383613a15565b1c60028361223f8185613a29565b6122499084613883565b6122539190613a15565b61225d9190613a15565b61226790826139ec565b6012549091508110156122805750506012549392505050565b61229166038d7ea4c6800082613a15565b6122a29066038d7ea4c68000613883565b94505050505090565b6122b3612386565b600780546001600160a01b0383166001600160a01b031990911681179091556122e46006546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b612324612386565b600d54610100900460ff161561234d5760405163a7e4d9bd60e01b815260040160405180910390fd5b805160005b818110156118d75761237d83828151811061236f5761236f613821565b60200260200101518561287c565b50600101612352565b6006546001600160a01b031633146115ba5760405163118cdaa760e01b8152336004820152602401610c99565b6123bc8361154a565b6001600160a01b0316336001600160a01b0316146123ed576040516359dc379f60e01b815260040160405180910390fd5b600d5460ff166124105760405163015fd59560e41b815260040160405180910390fd5b600083815261028860209081526040808320815161012081018352815460e0820190815260018084015461010080850191909152918352845180860186526002850154815260038501548188015295830195909552600483015493820193909352600582015460ff808216151560608401529381048416151560808301529093919260a08501926201000090920416908111156124af576124af6131a9565b60018111156124c0576124c06131a9565b815260200160068201548152505090508060800151156124f35760405163015fd59560e41b815260040160405180910390fd5b6020810151518319612511578061250981613a3d565b915050612527565b8360010361252757806125238161384d565b9150505b60208083015101518319612547578061253f8161384d565b91505061255d565b8360010361255d578061255981613a3d565b9150505b61256c82828560a0015161274b565b6125935760405163441d952160e01b81526004810183905260248101829052604401610c99565b600061259e826127ac565b90506000601482601981106125b5576125b5613821565b6019020184601981106125ca576125ca613821565b015411156125f5576040516311f8b93560e21b81526004810184905260248101839052604401610c99565b6000601461260a8660200151602001516127ac565b6019811061261a5761261a613821565b601902018560200151600001516019811061263757612637613821565b0155866014826019811061264d5761264d613821565b60190201846019811061266257612662613821565b0155604080518082018252848152602080820185815260008b81526102889092529281209151600283015591516003909101558460a0015160018111156126ab576126ab6131a9565b1480156126c257506126bf600260196139ec565b82145b806126ed575060018460a0015160018111156126e0576126e06131a9565b1480156126ed5750816001145b600088815261028860205260409020600501805460ff191691151591909117905560c08401805161271d9061384d565b9081905260009788526102886020526040909720600681019790975550504260049095019490945550505050565b600060018410806127675750612763600160196139ec565b8410155b1561277457506000611eb3565b6001826001811115612788576127886131a9565b036127965750811515611eb3565b6127a2600160196139ec565b9092109392505050565b6000816127bb600160196139ec565b610b8391906139ec565b600780546001600160a01b0319169055610ff881612b8c565b60026008540361280157604051633ee5aeb560e01b815260040160405180910390fd5b6002600855565b600080612819868686600a54611998565b9050600061282b878787600954611998565b9050811561285157606461284085604b613883565b61284a9190613a15565b9350612871565b8015612871576064612864856055613883565b61286e9190613a15565b93505b509195945050505050565b600b5482516020840151600092919083612895826127ac565b90506000601482601981106128ac576128ac613821565b6019020184601981106128c1576128c1613821565b015411156128d6576000945050505050610b83565b60006128f5604051806040016040528086815260200185815250612b46565b6000818152610287602052604090205490915060ff1661293257604051631c7b1c4960e31b81526004810185905260248101849052604401610c99565b846014836019811061294657612946613821565b60190201856019811061295b5761295b613821565b0155604080516101208101825260e08101868152610100820186905281528151808301835286815260208181018790528201524291810191909152600060608201819052608082015260a08101600c8510156129b85760006129bb565b60015b60018111156129cc576129cc6131a9565b815260006020918201819052878152610288825260409081902083518051825583015160018083019190915584840151805160028401559093015160038201559083015160048201556060830151600582018054608086015115156101000261ff00199315159390931661ffff19909116179190911780825560a0850151929362ff0000199091169062010000908490811115612a6b57612a6b6131a9565b021790555060c0820151816006015590505060fa8514612a9f57600b8054906000612a958361384d565b9190505550612aaf565b600d805461ffff19166101011790555b600e8054906000612abf8361384d565b909155505060008181526102866020526040902054612add90612bde565b612ae78786612d2e565b506001979650505050505050565b600080600080600085875af19050806114d95760405162461bcd60e51b815260206004820152601360248201527211551217d514905394d1915497d19052531151606a1b6044820152606401610c99565b600081604051602001612b599190613a54565b604051602081830303815290604052805190602001209050919050565b600082612b838584612e39565b14949350505050565b600680546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b61028554600090612bf1906001906139ec565b905060006102858281548110612c0957612c09613821565b906000526020600020906002020160405180604001604052908160008201548152602001600182015481525050905060006102858481548110612c4e57612c4e613821565b9060005260206000209060020201604051806040016040529081600082015481526020016001820154815250509050816102858581548110612c9257612c92613821565b90600052602060002090600202016000820151816000015560208201518160010155905050836102866000612cc685612b46565b8152602001908152602001600020819055506102866000612ce683612b46565b815260200190815260200160002060009055610285805480612d0a57612d0a613a6b565b60008281526020812060026000199093019283020181815560010155905550505050565b6001600160a01b038216612d785760405162461bcd60e51b81526020600482015260116024820152701253959053125117d49150d25412515395607a1b6044820152606401610c99565b6000818152600260205260409020546001600160a01b031615612dce5760405162461bcd60e51b815260206004820152600e60248201526d1053149150511657d3525395115160921b6044820152606401610c99565b6001600160a01b038216600081815260036020908152604080832080546001019055848352600290915280822080546001600160a01b0319168417905551839291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b600081815b8451811015612e7457612e6a82868381518110612e5d57612e5d613821565b6020026020010151612e7c565b9150600101612e3e565b509392505050565b6000818310612e98576000828152602084905260409020611eb3565b5060009182526020526040902090565b6040518061032001604052806019905b612ec0612f41565b815260200190600190039081612eb85790505090565b604080516101208101909152600060e0820181815261010083019190915281908152602001612f18604051806040016040528060008152602001600081525090565b815260006020820181905260408201819052606082018190526080820181905260a09091015290565b6040518061032001604052806019906020820280368337509192915050565b6001600160a01b0381168114610ff857600080fd5b600060208284031215612f8757600080fd5b8135611eb381612f60565b6001600160e01b031981168114610ff857600080fd5b600060208284031215612fba57600080fd5b8135611eb381612f92565b60005b83811015612fe0578181015183820152602001612fc8565b50506000910152565b6020815260008251806020840152613008816040850160208701612fc5565b601f01601f19169190910160400192915050565b60006020828403121561302e57600080fd5b5035919050565b6000806040838503121561304857600080fd5b823561305381612f60565b946020939093013593505050565b602080825282518282018190526000919060409081850190868401855b828110156130ab5761309b84835180518252602090810151910152565b928401929085019060010161307e565b5091979650505050505050565b614e20810181836000805b60198082106130d25750613110565b835185845b838110156130f55782518252602092830192909101906001016130d7565b505050610320949094019350602092909201916001016130c3565b5050505092915050565b60008060006060848603121561312f57600080fd5b833561313a81612f60565b9250602084013561314a81612f60565b929592945050506040919091013590565b60008060006060848603121561317057600080fd5b505081359360208301359350604090920135919050565b6000806040838503121561319a57600080fd5b50508035926020909101359150565b634e487b7160e01b600052602160045260246000fd5b600281106131dd57634e487b7160e01b600052602160045260246000fd5b9052565b87518152602080890151908201526101208101875160408301526020880151606083015286608083015285151560a083015284151560c083015261322860e08301856131bf565b8261010083015298975050505050505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b03811182821017156132795761327961323b565b604052919050565b60006040828403121561329357600080fd5b604051604081018181106001600160401b03821117156132b5576132b561323b565b604052823581526020928301359281019290925250919050565b600082601f8301126132e057600080fd5b813560206001600160401b038211156132fb576132fb61323b565b61330a60208360051b01613251565b8083825260208201915060208460061b87010193508684111561332c57600080fd5b602086015b84811015613351576133438882613281565b835291830191604001613331565b509695505050505050565b60008083601f84011261336e57600080fd5b5081356001600160401b0381111561338557600080fd5b6020830191508360208260051b85010111156133a057600080fd5b9250929050565b6000806000604084860312156133bc57600080fd5b83356001600160401b03808211156133d357600080fd5b6133df878388016132cf565b945060208601359150808211156133f557600080fd5b506134028682870161335c565b9497909650939450505050565b6000806020838503121561342257600080fd5b82356001600160401b038082111561343957600080fd5b818501915085601f83011261344d57600080fd5b81358181111561345c57600080fd5b8660208260061b850101111561347157600080fd5b60209290920196919550909350505050565b6020808252825182820181905260009190848201906040850190845b818110156134bb5783518352928401929184019160010161349f565b50909695505050505050565b600080600080606085870312156134dd57600080fd5b84356001600160401b038111156134f357600080fd5b6134ff8782880161335c565b909550935050602085013561351381612f60565b9396929550929360400135925050565b6000806040838503121561353657600080fd5b823561354181612f60565b91506020830135801515811461355657600080fd5b809150509250929050565b61357682825180518252602090810151910152565b6020818101518051604085015290810151606084015250604081015160808301526060810151151560a08301526080810151151560c083015260a08101516135c160e08401826131bf565b5060c001516101009190910152565b6020808252825182820181905260009190848201906040850190845b818110156134bb576135ff838551613561565b9284019261012092909201916001016135ec565b60008060008060006080868803121561362b57600080fd5b853561363681612f60565b9450602086013561364681612f60565b93506040860135925060608601356001600160401b038082111561366957600080fd5b818801915088601f83011261367d57600080fd5b81358181111561368c57600080fd5b89602082850101111561369e57600080fd5b9699959850939650602001949392505050565b80356001600160401b038116811461159c57600080fd5b600080600080600060a086880312156136e057600080fd5b6136e9866136b1565b94506136f7602087016136b1565b93506040860135925060608601359150608086013561371581612f60565b809150509295509295909350565b60008060006040848603121561373857600080fd5b8335925060208401356001600160401b0381111561375557600080fd5b6134028682870161335c565b6101208101610b838284613561565b6000806040838503121561378357600080fd5b823561378e81612f60565b9150602083013561355681612f60565b600080604083850312156137b157600080fd5b82356137bc81612f60565b915060208301356001600160401b038111156137d757600080fd5b6137e3858286016132cf565b9150509250929050565b600181811c9082168061380157607f821691505b602082108103611c0057634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006001820161385f5761385f613837565b5060010190565b60006020828403121561387857600080fd5b8151611eb381612f92565b8082028115828204841417610b8357610b83613837565b80820180821115610b8357610b83613837565b6000604082840312156138bf57600080fd5b611eb38383613281565b6001600160a01b038681168252851660208201526040810184905260806060820181905281018290526000828460a0840137600060a0848401015260a0601f19601f85011683010190509695505050505050565b8281526101408101611eb36020830184613561565b60006020828403121561394457600080fd5b81516001600160401b038082111561395b57600080fd5b818401915084601f83011261396f57600080fd5b8151818111156139815761398161323b565b613994601f8201601f1916602001613251565b91508082528560208285010111156139ab57600080fd5b6139bc816020840160208601612fc5565b50949350505050565b6001600160401b038281168282160390808211156139e5576139e5613837565b5092915050565b81810381811115610b8357610b83613837565b634e487b7160e01b600052601260045260246000fd5b600082613a2457613a246139ff565b500490565b600082613a3857613a386139ff565b500690565b600081613a4c57613a4c613837565b506000190190565b815181526020808301519082015260408101610b83565b634e487b7160e01b600052603160045260246000fdfea26469706673582212206df861dce39689aa2e2ec953ef909f67de39e32829702c498c066f77212fb7f664736f6c6343000817003300000000000000000000000018d989a5d0ab92ed19aba879e4cac3735f8685c9
Deployed Bytecode
0x6080604052600436106103755760003560e01c806379ba5097116101d1578063a9cc1dbc11610102578063d692f7a7116100a0578063e985e9c51161006f578063e985e9c514610a7d578063eb91d37e14610ab8578063f2fde38b14610acd578063ff4f3a8414610aed57600080fd5b8063d692f7a7146109ff578063dcf2fe5414610a1f578063e30c397814610a32578063e4b50cb814610a5057600080fd5b8063c32c4b1f116100dc578063c32c4b1f1461099f578063c87b56dd146109bf578063d227975c146109df578063d240b7881461087457600080fd5b8063a9cc1dbc1461093d578063aa6ca8081461095d578063b88d4fde1461097f57600080fd5b80638ecad7211161016f5780639b66ad53116101495780639b66ad5314610874578063a22cb465146108f1578063a2e8bed914610911578063a85423181461092757600080fd5b80638ecad721146108a757806395d6a3cc146108bc57806395d89b41146108dc57600080fd5b8063840b88fe116101ab578063840b88fe146108275780638462151c1461084757806389ae5f47146108745780638da5cb5b1461088957600080fd5b806379ba5097146107df5780637f99c8e3146107f4578063825fa1e61461081457600080fd5b8063345af624116102ab5780635fb8bcd51161024957806370a082311161022357806370a082311461070d578063715018a61461072d57806373ea4db51461074257806379502c551461076257600080fd5b80635fb8bcd5146106385780636352211e146106d857806364f101f0146106f857600080fd5b806342842e0e1161028557806342842e0e146105be5780634779dbd9146105de578063570990e5146105fe5780635b85e90d1461061e57600080fd5b8063345af624146105695780633ccfd60b1461058957806340f91aea1461059e57600080fd5b8063134000c01161031857806323b872dd116102f257806323b872dd146104f4578063303e74df14610514578063326b97d11461053457806332cb6b0c1461055457600080fd5b8063134000c0146104a757806318160ddd146104c957806318c66804146104de57600080fd5b806306fdde031161035457806306fdde03146103f5578063081812fc14610417578063095ea7b314610465578063101eb3321461048557600080fd5b80629a9b7b1461037a57806301b9a397146103a357806301ffc9a7146103c5575b600080fd5b34801561038657600080fd5b50610390600b5481565b6040519081526020015b60405180910390f35b3480156103af57600080fd5b506103c36103be366004612f75565b610b0d565b005b3480156103d157600080fd5b506103e56103e0366004612fa8565b610b37565b604051901515815260200161039a565b34801561040157600080fd5b5061040a610b89565b60405161039a9190612fe9565b34801561042357600080fd5b5061044d61043236600461301c565b6004602052600090815260409020546001600160a01b031681565b6040516001600160a01b03909116815260200161039a565b34801561047157600080fd5b506103c3610480366004613035565b610c17565b34801561049157600080fd5b5061049a610cfe565b60405161039a9190613061565b3480156104b357600080fd5b506104bc610d72565b60405161039a91906130b8565b3480156104d557600080fd5b50600e54610390565b3480156104ea57600080fd5b50610390600a5481565b34801561050057600080fd5b506103c361050f36600461311a565b610dd6565b34801561052057600080fd5b50600f5461044d906001600160a01b031681565b34801561054057600080fd5b506103c361054f36600461301c565b610f9d565b34801561056057600080fd5b5061039060fa81565b34801561057557600080fd5b506103c361058436600461315b565b610ffb565b34801561059557600080fd5b506103c36112c4565b3480156105aa57600080fd5b506103c36105b936600461301c565b61138d565b3480156105ca57600080fd5b506103c36105d936600461311a565b6113e6565b3480156105ea57600080fd5b506103c36105f936600461301c565b6114de565b34801561060a57600080fd5b506103c3610619366004613187565b611537565b34801561062a57600080fd5b50600d546103e59060ff1681565b34801561064457600080fd5b506106c561065336600461301c565b61028860209081526000918252604091829020825180840184528154815260018201548184015283518085019094526002820154845260038201549284019290925260048101546005820154600690920154929392909160ff8082169261010083048216926201000090049091169087565b60405161039a97969594939291906131e1565b3480156106e457600080fd5b5061044d6106f336600461301c565b61154a565b34801561070457600080fd5b506103c36115a1565b34801561071957600080fd5b50610390610728366004612f75565b6115bc565b34801561073957600080fd5b506103c361161f565b34801561074e57600080fd5b506103c361075d36600461301c565b611631565b34801561076e57600080fd5b506010546011546012546013546107a3936001600160401b0380821694600160401b909204169290916001600160a01b031685565b604080516001600160401b0396871681529590941660208601529284019190915260608301526001600160a01b0316608082015260a00161039a565b3480156107eb57600080fd5b506103c361168b565b34801561080057600080fd5b506103c361080f36600461301c565b6116cc565b6103c36108223660046133a7565b6116d9565b34801561083357600080fd5b506103c361084236600461340f565b6117fa565b34801561085357600080fd5b50610867610862366004612f75565b6118dd565b60405161039a9190613483565b34801561088057600080fd5b50610390601981565b34801561089557600080fd5b506006546001600160a01b031661044d565b3480156108b357600080fd5b50610390600581565b3480156108c857600080fd5b506103e56108d73660046134c7565b611998565b3480156108e857600080fd5b5061040a611a1e565b3480156108fd57600080fd5b506103c361090c366004613523565b611a2b565b34801561091d57600080fd5b5061039060095481565b34801561093357600080fd5b50610390600c5481565b34801561094957600080fd5b506103c361095836600461301c565b611a97565b34801561096957600080fd5b50610972611aa5565b60405161039a91906135d0565b34801561098b57600080fd5b506103c361099a366004613613565b611c06565b3480156109ab57600080fd5b506103c36109ba36600461301c565b611cee565b3480156109cb57600080fd5b5061040a6109da36600461301c565b611d48565b3480156109eb57600080fd5b506103c36109fa3660046136c8565b611eba565b348015610a0b57600080fd5b506103c3610a1a36600461301c565b611f22565b6103c3610a2d366004613723565b611f7c565b348015610a3e57600080fd5b506007546001600160a01b031661044d565b348015610a5c57600080fd5b50610a70610a6b36600461301c565b6120c4565b60405161039a9190613761565b348015610a8957600080fd5b506103e5610a98366004613770565b600560209081526000928352604080842090915290825290205460ff1681565b348015610ac457600080fd5b50610390612194565b348015610ad957600080fd5b506103c3610ae8366004612f75565b6122ab565b348015610af957600080fd5b506103c3610b0836600461379e565b61231c565b610b15612386565b600f80546001600160a01b0319166001600160a01b0392909216919091179055565b60006301ffc9a760e01b6001600160e01b031983161480610b6857506380ac58cd60e01b6001600160e01b03198316145b80610b835750635b5e139f60e01b6001600160e01b03198316145b92915050565b60008054610b96906137ed565b80601f0160208091040260200160405190810160405280929190818152602001828054610bc2906137ed565b8015610c0f5780601f10610be457610100808354040283529160200191610c0f565b820191906000526020600020905b815481529060010190602001808311610bf257829003601f168201915b505050505081565b6000818152600260205260409020546001600160a01b031633811480610c6057506001600160a01b038116600090815260056020908152604080832033845290915290205460ff165b610ca25760405162461bcd60e51b815260206004820152600e60248201526d1393d517d055551213d49256915160921b60448201526064015b60405180910390fd5b60008281526004602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b6060610285805480602002602001604051908101604052809291908181526020016000905b82821015610d6957838290600052602060002090600202016040518060400160405290816000820154815260200160018201548152505081526020019060010190610d23565b50505050905090565b610d7a612ea8565b604080516103208101909152601460196000835b82821015610d69576040805161032081019182905290601984810287019182845b815481526020019060010190808311610daf57505050505081526020019060010190610d8e565b6000818152600260205260409020546001600160a01b03848116911614610e2c5760405162461bcd60e51b815260206004820152600a60248201526957524f4e475f46524f4d60b01b6044820152606401610c99565b6001600160a01b038216610e765760405162461bcd60e51b81526020600482015260116024820152701253959053125117d49150d25412515395607a1b6044820152606401610c99565b336001600160a01b0384161480610eb057506001600160a01b038316600090815260056020908152604080832033845290915290205460ff165b80610ed157506000818152600460205260409020546001600160a01b031633145b610f0e5760405162461bcd60e51b815260206004820152600e60248201526d1393d517d055551213d49256915160921b6044820152606401610c99565b6001600160a01b0380841660008181526003602090815260408083208054600019019055938616808352848320805460010190558583526002825284832080546001600160a01b03199081168317909155600490925284832080549092169091559251849392917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b60016000828152610288602052604090206005015462010000900460ff166001811115610fcc57610fcc6131a9565b14610fea5760405163034b254960e21b815260040160405180910390fd5b610ff88160001960016123b3565b50565b6110048361154a565b6001600160a01b0316336001600160a01b031614611035576040516359dc379f60e01b815260040160405180910390fd5b600083815261028860209081526040808320815161012081018352815460e0820190815260018084015461010080850191909152918352845180860186526002850154815260038501548188015295830195909552600483015493820193909352600582015460ff808216151560608401529381048416151560808301529093919260a08501926201000090920416908111156110d4576110d46131a9565b60018111156110e5576110e56131a9565b8152602001600682015481525050905061110483838360a0015161274b565b61112b5760405163441d952160e01b81526004810184905260248101839052604401610c99565b6000611136836127ac565b905060006014826019811061114d5761114d613821565b60190201856019811061116257611162613821565b0154111561118d576040516311f8b93560e21b81526004810185905260248101849052604401610c99565b6019600c54036111b0576040516372a1333760e01b815260040160405180910390fd5b81606001516111d257604051632b12607b60e11b815260040160405180910390fd5b8160800151156111f5576040516307123f2360e51b815260040160405180910390fd5b6000601461120a8460200151602001516127ac565b6019811061121a5761121a613821565b601902018360200151600001516019811061123757611237613821565b0155846014826019811061124d5761124d613821565b60190201856019811061126257611262613821565b0155604080518082018252858152602080820186815260008981526102889092529281209151600283015591516003820155426004820155600501805461ff001916610100179055600c8054916112b88361384d565b91905055505050505050565b6112cc612386565b60135460405147916000916001600160a01b03909116907f000000000000000000000000000000000000000000000000000000000003345090849084818181858888f193505050503d8060008114611340576040519150601f19603f3d011682016040523d82523d6000602084013e611345565b606091505b50509050806113895760405162461bcd60e51b815260206004820152601060248201526f2a3930b739b332b9103330b4b632b21760811b6044820152606401610c99565b5050565b600080828152610288602052604090206005015462010000900460ff1660018111156113bb576113bb6131a9565b146113d95760405163034b254960e21b815260040160405180910390fd5b610ff881600019806123b3565b6113f1838383610dd6565b6001600160a01b0382163b158061149a5750604051630a85bd0160e11b8082523360048301526001600160a01b03858116602484015260448301849052608060648401526000608484015290919084169063150b7a029060a4016020604051808303816000875af115801561146a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061148e9190613866565b6001600160e01b031916145b6114d95760405162461bcd60e51b815260206004820152601060248201526f155394d0519157d49150d2541251539560821b6044820152606401610c99565b505050565b60016000828152610288602052604090206005015462010000900460ff16600181111561150d5761150d6131a9565b1461152b5760405163034b254960e21b815260040160405180910390fd5b610ff8816001806123b3565b61153f612386565b600991909155600a55565b6000818152600260205260409020546001600160a01b03168061159c5760405162461bcd60e51b815260206004820152600a6024820152691393d517d3525395115160b21b6044820152606401610c99565b919050565b6115a9612386565b600d805461ffff1916610101179055565b565b60006001600160a01b0382166116035760405162461bcd60e51b815260206004820152600c60248201526b5a45524f5f4144445245535360a01b6044820152606401610c99565b506001600160a01b031660009081526003602052604090205490565b611627612386565b6115ba60006127c5565b600080828152610288602052604090206005015462010000900460ff16600181111561165f5761165f6131a9565b1461167d5760405163034b254960e21b815260040160405180910390fd5b610ff88160016000196123b3565b60075433906001600160a01b031681146116c35760405163118cdaa760e01b81526001600160a01b0382166004820152602401610c99565b610ff8816127c5565b610ff881600160006123b3565b6116e16127de565b6010546001600160401b03164210806117015750600d54610100900460ff165b1561171f5760405163a7e4d9bd60e01b815260040160405180910390fd5b825160058111156117435760405163ba3a0a9b60e01b815260040160405180910390fd5b600061174d612194565b905082156117645761176184843384612808565b90505b61176e8282613883565b34101561178e576040516399b5cb1d60e01b815260040160405180910390fd5b6000805b838110156117dc5760006117bf8883815181106117b1576117b1613821565b60200260200101513361287c565b9050806117d3576117d0848461389a565b92505b50600101611792565b5080156117ed576117ed3382612af5565b5050506114d96001600855565b611802612386565b6102855460005b828110156118d757600061184385858481811061182857611828613821565b90506040020180360381019061183e91906138ad565b612b46565b600081815261028760205260409020805460ff191660011790559050611869828461389a565b6000828152610286602052604090205561028585858481811061188e5761188e613821565b8354600181018555600094855260209094206040909102929092019260020290910190506118c9828281358155602082013560018201555050565b505081600101915050611809565b50505050565b606060006118ea836115bc565b90506000816001600160401b038111156119065761190661323b565b60405190808252806020026020018201604052801561192f578160200160208202803683370190505b509050600060015b600e54811161198e57856001600160a01b03166119538261154a565b6001600160a01b031603611986578083838151811061197457611974613821565b60209081029190910101526001909101905b600101611937565b5090949350505050565b6040516bffffffffffffffffffffffff19606084901b1660208201526000908190603401604051602081830303815290604052805190602001209050611a14868680806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250879250859150612b769050565b9695505050505050565b60018054610b96906137ed565b3360008181526005602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b610ff88160001960006123b3565b60606000600e546001600160401b03811115611ac357611ac361323b565b604051908082528060200260200182016040528015611afc57816020015b611ae9612ed6565b815260200190600190039081611ae15790505b50905060005b600e54811015611c00576102886000611b1c83600161389a565b81526020808201929092526040908101600020815161012081018352815460e0820190815260018084015461010080850191909152918352845180860186526002850154815260038501548188015295830195909552600483015493820193909352600582015460ff808216151560608401529381048416151560808301529093919260a0850192620100009092041690811115611bbc57611bbc6131a9565b6001811115611bcd57611bcd6131a9565b8152602001600682015481525050828281518110611bed57611bed613821565b6020908102919091010152600101611b02565b50919050565b611c11858585610dd6565b6001600160a01b0384163b1580611ca85750604051630a85bd0160e11b808252906001600160a01b0386169063150b7a0290611c599033908a908990899089906004016138c9565b6020604051808303816000875af1158015611c78573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c9c9190613866565b6001600160e01b031916145b611ce75760405162461bcd60e51b815260206004820152601060248201526f155394d0519157d49150d2541251539560821b6044820152606401610c99565b5050505050565b60016000828152610288602052604090206005015462010000900460ff166001811115611d1d57611d1d6131a9565b14611d3b5760405163034b254960e21b815260040160405180910390fd5b610ff881600060016123b3565b60606000611d558361154a565b6001600160a01b031603611d7c57604051634d5e5fb360e01b815260040160405180910390fd5b600082815261028860209081526040808320815161012081018352815460e0820190815260018084015461010080850191909152918352845180860186526002850154815260038501548188015295830195909552600483015493820193909352600582015460ff808216151560608401529381048416151560808301529093919260a0850192620100009092041690811115611e1b57611e1b6131a9565b6001811115611e2c57611e2c6131a9565b815260069190910154602090910152600f54604051635f7e9a6760e01b81529192506001600160a01b031690635f7e9a6790611e6e908690859060040161391d565b600060405180830381865afa158015611e8b573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611eb39190810190613932565b9392505050565b611ec2612386565b601080546001600160401b039687166fffffffffffffffffffffffffffffffff1990911617600160401b959096169490940294909417909255601155601255601380546001600160a01b0319166001600160a01b03909216919091179055565b600080828152610288602052604090206005015462010000900460ff166001811115611f5057611f506131a9565b14611f6e5760405163034b254960e21b815260040160405180910390fd5b610ff88160006000196123b3565b611f846127de565b6010546001600160401b0316421080611fa45750600d54610100900460ff165b15611fc25760405163a7e4d9bd60e01b815260040160405180910390fd5b6005831115611fe45760405163ba3a0a9b60e01b815260040160405180910390fd5b6000611fee612194565b905081156120055761200283833384612808565b90505b60006120118583613883565b905080341015612034576040516399b5cb1d60e01b815260040160405180910390fd5b6000805b868110156117dc57610285546000908103612055575060006120a9565b600061028560008154811061206c5761206c613821565b90600052602060002090600202016040518060400160405290816000820154815260200160018201548152505090506120a5813361287c565b9150505b806120bb576120b8858461389a565b92505b50600101612038565b6120cc612ed6565b60008281526102886020908152604091829020825161012081018452815460e0820190815260018084015461010080850191909152918352855180870187526002850154815260038501548187015294830194909452600483015494820194909452600582015460ff808216151560608401529481048516151560808301529093919260a0850192620100009092049091169081111561216e5761216e6131a9565b600181111561217f5761217f6131a9565b81526020016006820154815250509050919050565b60105460009081906121b9906001600160401b0380821691600160401b9004166139c5565b6010546001600160401b0391821692506103b691164210156121df575050601154919050565b601054600090600a906121fb906001600160401b0316426139ec565b6122059190613a15565b61221090600a613883565b905082811061222457505060125492915050565b6011546122318383613a15565b1c60028361223f8185613a29565b6122499084613883565b6122539190613a15565b61225d9190613a15565b61226790826139ec565b6012549091508110156122805750506012549392505050565b61229166038d7ea4c6800082613a15565b6122a29066038d7ea4c68000613883565b94505050505090565b6122b3612386565b600780546001600160a01b0383166001600160a01b031990911681179091556122e46006546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b612324612386565b600d54610100900460ff161561234d5760405163a7e4d9bd60e01b815260040160405180910390fd5b805160005b818110156118d75761237d83828151811061236f5761236f613821565b60200260200101518561287c565b50600101612352565b6006546001600160a01b031633146115ba5760405163118cdaa760e01b8152336004820152602401610c99565b6123bc8361154a565b6001600160a01b0316336001600160a01b0316146123ed576040516359dc379f60e01b815260040160405180910390fd5b600d5460ff166124105760405163015fd59560e41b815260040160405180910390fd5b600083815261028860209081526040808320815161012081018352815460e0820190815260018084015461010080850191909152918352845180860186526002850154815260038501548188015295830195909552600483015493820193909352600582015460ff808216151560608401529381048416151560808301529093919260a08501926201000090920416908111156124af576124af6131a9565b60018111156124c0576124c06131a9565b815260200160068201548152505090508060800151156124f35760405163015fd59560e41b815260040160405180910390fd5b6020810151518319612511578061250981613a3d565b915050612527565b8360010361252757806125238161384d565b9150505b60208083015101518319612547578061253f8161384d565b91505061255d565b8360010361255d578061255981613a3d565b9150505b61256c82828560a0015161274b565b6125935760405163441d952160e01b81526004810183905260248101829052604401610c99565b600061259e826127ac565b90506000601482601981106125b5576125b5613821565b6019020184601981106125ca576125ca613821565b015411156125f5576040516311f8b93560e21b81526004810184905260248101839052604401610c99565b6000601461260a8660200151602001516127ac565b6019811061261a5761261a613821565b601902018560200151600001516019811061263757612637613821565b0155866014826019811061264d5761264d613821565b60190201846019811061266257612662613821565b0155604080518082018252848152602080820185815260008b81526102889092529281209151600283015591516003909101558460a0015160018111156126ab576126ab6131a9565b1480156126c257506126bf600260196139ec565b82145b806126ed575060018460a0015160018111156126e0576126e06131a9565b1480156126ed5750816001145b600088815261028860205260409020600501805460ff191691151591909117905560c08401805161271d9061384d565b9081905260009788526102886020526040909720600681019790975550504260049095019490945550505050565b600060018410806127675750612763600160196139ec565b8410155b1561277457506000611eb3565b6001826001811115612788576127886131a9565b036127965750811515611eb3565b6127a2600160196139ec565b9092109392505050565b6000816127bb600160196139ec565b610b8391906139ec565b600780546001600160a01b0319169055610ff881612b8c565b60026008540361280157604051633ee5aeb560e01b815260040160405180910390fd5b6002600855565b600080612819868686600a54611998565b9050600061282b878787600954611998565b9050811561285157606461284085604b613883565b61284a9190613a15565b9350612871565b8015612871576064612864856055613883565b61286e9190613a15565b93505b509195945050505050565b600b5482516020840151600092919083612895826127ac565b90506000601482601981106128ac576128ac613821565b6019020184601981106128c1576128c1613821565b015411156128d6576000945050505050610b83565b60006128f5604051806040016040528086815260200185815250612b46565b6000818152610287602052604090205490915060ff1661293257604051631c7b1c4960e31b81526004810185905260248101849052604401610c99565b846014836019811061294657612946613821565b60190201856019811061295b5761295b613821565b0155604080516101208101825260e08101868152610100820186905281528151808301835286815260208181018790528201524291810191909152600060608201819052608082015260a08101600c8510156129b85760006129bb565b60015b60018111156129cc576129cc6131a9565b815260006020918201819052878152610288825260409081902083518051825583015160018083019190915584840151805160028401559093015160038201559083015160048201556060830151600582018054608086015115156101000261ff00199315159390931661ffff19909116179190911780825560a0850151929362ff0000199091169062010000908490811115612a6b57612a6b6131a9565b021790555060c0820151816006015590505060fa8514612a9f57600b8054906000612a958361384d565b9190505550612aaf565b600d805461ffff19166101011790555b600e8054906000612abf8361384d565b909155505060008181526102866020526040902054612add90612bde565b612ae78786612d2e565b506001979650505050505050565b600080600080600085875af19050806114d95760405162461bcd60e51b815260206004820152601360248201527211551217d514905394d1915497d19052531151606a1b6044820152606401610c99565b600081604051602001612b599190613a54565b604051602081830303815290604052805190602001209050919050565b600082612b838584612e39565b14949350505050565b600680546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b61028554600090612bf1906001906139ec565b905060006102858281548110612c0957612c09613821565b906000526020600020906002020160405180604001604052908160008201548152602001600182015481525050905060006102858481548110612c4e57612c4e613821565b9060005260206000209060020201604051806040016040529081600082015481526020016001820154815250509050816102858581548110612c9257612c92613821565b90600052602060002090600202016000820151816000015560208201518160010155905050836102866000612cc685612b46565b8152602001908152602001600020819055506102866000612ce683612b46565b815260200190815260200160002060009055610285805480612d0a57612d0a613a6b565b60008281526020812060026000199093019283020181815560010155905550505050565b6001600160a01b038216612d785760405162461bcd60e51b81526020600482015260116024820152701253959053125117d49150d25412515395607a1b6044820152606401610c99565b6000818152600260205260409020546001600160a01b031615612dce5760405162461bcd60e51b815260206004820152600e60248201526d1053149150511657d3525395115160921b6044820152606401610c99565b6001600160a01b038216600081815260036020908152604080832080546001019055848352600290915280822080546001600160a01b0319168417905551839291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b600081815b8451811015612e7457612e6a82868381518110612e5d57612e5d613821565b6020026020010151612e7c565b9150600101612e3e565b509392505050565b6000818310612e98576000828152602084905260409020611eb3565b5060009182526020526040902090565b6040518061032001604052806019905b612ec0612f41565b815260200190600190039081612eb85790505090565b604080516101208101909152600060e0820181815261010083019190915281908152602001612f18604051806040016040528060008152602001600081525090565b815260006020820181905260408201819052606082018190526080820181905260a09091015290565b6040518061032001604052806019906020820280368337509192915050565b6001600160a01b0381168114610ff857600080fd5b600060208284031215612f8757600080fd5b8135611eb381612f60565b6001600160e01b031981168114610ff857600080fd5b600060208284031215612fba57600080fd5b8135611eb381612f92565b60005b83811015612fe0578181015183820152602001612fc8565b50506000910152565b6020815260008251806020840152613008816040850160208701612fc5565b601f01601f19169190910160400192915050565b60006020828403121561302e57600080fd5b5035919050565b6000806040838503121561304857600080fd5b823561305381612f60565b946020939093013593505050565b602080825282518282018190526000919060409081850190868401855b828110156130ab5761309b84835180518252602090810151910152565b928401929085019060010161307e565b5091979650505050505050565b614e20810181836000805b60198082106130d25750613110565b835185845b838110156130f55782518252602092830192909101906001016130d7565b505050610320949094019350602092909201916001016130c3565b5050505092915050565b60008060006060848603121561312f57600080fd5b833561313a81612f60565b9250602084013561314a81612f60565b929592945050506040919091013590565b60008060006060848603121561317057600080fd5b505081359360208301359350604090920135919050565b6000806040838503121561319a57600080fd5b50508035926020909101359150565b634e487b7160e01b600052602160045260246000fd5b600281106131dd57634e487b7160e01b600052602160045260246000fd5b9052565b87518152602080890151908201526101208101875160408301526020880151606083015286608083015285151560a083015284151560c083015261322860e08301856131bf565b8261010083015298975050505050505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b03811182821017156132795761327961323b565b604052919050565b60006040828403121561329357600080fd5b604051604081018181106001600160401b03821117156132b5576132b561323b565b604052823581526020928301359281019290925250919050565b600082601f8301126132e057600080fd5b813560206001600160401b038211156132fb576132fb61323b565b61330a60208360051b01613251565b8083825260208201915060208460061b87010193508684111561332c57600080fd5b602086015b84811015613351576133438882613281565b835291830191604001613331565b509695505050505050565b60008083601f84011261336e57600080fd5b5081356001600160401b0381111561338557600080fd5b6020830191508360208260051b85010111156133a057600080fd5b9250929050565b6000806000604084860312156133bc57600080fd5b83356001600160401b03808211156133d357600080fd5b6133df878388016132cf565b945060208601359150808211156133f557600080fd5b506134028682870161335c565b9497909650939450505050565b6000806020838503121561342257600080fd5b82356001600160401b038082111561343957600080fd5b818501915085601f83011261344d57600080fd5b81358181111561345c57600080fd5b8660208260061b850101111561347157600080fd5b60209290920196919550909350505050565b6020808252825182820181905260009190848201906040850190845b818110156134bb5783518352928401929184019160010161349f565b50909695505050505050565b600080600080606085870312156134dd57600080fd5b84356001600160401b038111156134f357600080fd5b6134ff8782880161335c565b909550935050602085013561351381612f60565b9396929550929360400135925050565b6000806040838503121561353657600080fd5b823561354181612f60565b91506020830135801515811461355657600080fd5b809150509250929050565b61357682825180518252602090810151910152565b6020818101518051604085015290810151606084015250604081015160808301526060810151151560a08301526080810151151560c083015260a08101516135c160e08401826131bf565b5060c001516101009190910152565b6020808252825182820181905260009190848201906040850190845b818110156134bb576135ff838551613561565b9284019261012092909201916001016135ec565b60008060008060006080868803121561362b57600080fd5b853561363681612f60565b9450602086013561364681612f60565b93506040860135925060608601356001600160401b038082111561366957600080fd5b818801915088601f83011261367d57600080fd5b81358181111561368c57600080fd5b89602082850101111561369e57600080fd5b9699959850939650602001949392505050565b80356001600160401b038116811461159c57600080fd5b600080600080600060a086880312156136e057600080fd5b6136e9866136b1565b94506136f7602087016136b1565b93506040860135925060608601359150608086013561371581612f60565b809150509295509295909350565b60008060006040848603121561373857600080fd5b8335925060208401356001600160401b0381111561375557600080fd5b6134028682870161335c565b6101208101610b838284613561565b6000806040838503121561378357600080fd5b823561378e81612f60565b9150602083013561355681612f60565b600080604083850312156137b157600080fd5b82356137bc81612f60565b915060208301356001600160401b038111156137d757600080fd5b6137e3858286016132cf565b9150509250929050565b600181811c9082168061380157607f821691505b602082108103611c0057634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006001820161385f5761385f613837565b5060010190565b60006020828403121561387857600080fd5b8151611eb381612f92565b8082028115828204841417610b8357610b83613837565b80820180821115610b8357610b83613837565b6000604082840312156138bf57600080fd5b611eb38383613281565b6001600160a01b038681168252851660208201526040810184905260806060820181905281018290526000828460a0840137600060a0848401015260a0601f19601f85011683010190509695505050505050565b8281526101408101611eb36020830184613561565b60006020828403121561394457600080fd5b81516001600160401b038082111561395b57600080fd5b818401915084601f83011261396f57600080fd5b8151818111156139815761398161323b565b613994601f8201601f1916602001613251565b91508082528560208285010111156139ab57600080fd5b6139bc816020840160208601612fc5565b50949350505050565b6001600160401b038281168282160390808211156139e5576139e5613837565b5092915050565b81810381811115610b8357610b83613837565b634e487b7160e01b600052601260045260246000fd5b600082613a2457613a246139ff565b500490565b600082613a3857613a386139ff565b500690565b600081613a4c57613a4c613837565b506000190190565b815181526020808301519082015260408101610b83565b634e487b7160e01b600052603160045260246000fdfea26469706673582212206df861dce39689aa2e2ec953ef909f67de39e32829702c498c066f77212fb7f664736f6c63430008170033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000018d989a5d0ab92ed19aba879e4cac3735f8685c9
-----Decoded View---------------
Arg [0] : _descriptor (address): 0x18d989A5D0ab92ED19aBA879e4CaC3735f8685c9
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 00000000000000000000000018d989a5d0ab92ed19aba879e4cac3735f8685c9
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.