Overview
TokenID
8599
Total Transfers
-
Market
Onchain Market Cap
$0.00
Circulating Supply Market Cap
-
Other Info
Token Contract
Loading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
Contract Name:
Roar
Compiler Version
v0.8.7+commit.e28d00a7
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT LICENSE pragma solidity ^0.8.7; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@chainlink/contracts/src/v0.8/VRFConsumerBase.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; interface ISalmon { function burn(address from, uint256 amount) external; } interface ITraits { function tokenURI(uint256 tokenId) external view returns (string memory); } interface IRoar { struct ManBear {bool isFisherman; uint8[14] traitarray; uint8 alphaIndex;} function getPaidTokens() external view returns (uint256); function getTokenTraits(uint256 tokenId) external view returns (ManBear memory); } interface IRiver { function addManyToRiverSideAndFishing(address account, uint16[] calldata tokenIds) external; function randomBearOwner(uint256 seed) external view returns (address); } contract Roar is IRoar, ERC721Enumerable, Ownable, Pausable, VRFConsumerBase { using Counters for Counters.Counter; using EnumerableSet for EnumerableSet.UintSet; // mint variables uint256 public immutable MAX_TOKENS; // max number of tokens that can be minted - 50000 in production uint256 public PAID_TOKENS; // number of tokens that can be claimed for free - 20% of MAX_TOKENS uint16 public minted; // number of tokens have been minted so far uint256 public constant MINT_PRICE = .069420 ether; // mint price string public baseURI; // mappings mapping(address => uint256) public whitelists; mapping(uint256 => ManBear) public tokenTraits; // mapping from tokenId to a struct containing the token's traits mapping(uint256 => uint256) public existingCombinations; // mapping from hashed(tokenTrait) to the tokenId it's associated with, Why? used to ensure there are no duplicates mapping(address => uint256[]) public _mints; // Pobabilities & Aliases // 0 - 8 are associated with fishermen, 9 - 13 are associated with Bears uint8[][18] public rarities; uint8[][18] public aliases; IRiver public river; // STAKING - reference to the Barn for choosing random Bear thieves ISalmon public salmon; // TOKEN - reference to $WOOL for burning on mint ITraits public traits; // TRAITS - reference to Traits // Team Wallets address private project_wallet = 0x06e8198A5a4AB3E5F4B13DdC9e5c2FCDDD4f8838; address private Bear1 = 0x9E4FaAA4EFd0fb8CbC653Ee68C01c066d078098D; address private Bear2 = 0xe18195D4995D994fAa3663db0b6E2FFF4042D0a1; address private Bear3 = 0x9c39cD2f557B5E851f44ab18714BbBB15FA7417E; address private Bear4 = 0x24af21668F33C8C279025b0E53fCC3bFf48426A0; //Chainlink Setup: bytes32 internal keyHash; uint256 public fee; uint256 internal randomResult; uint256 internal randomNumber; address public linkToken; uint256 public vrfcooldown = 10000; Counters.Counter public vrfReqd; constructor(address _salmon, uint256 _maxTokens, address _vrfCoordinator, address _link) ERC721("BearGame", 'BEARGAME') VRFConsumerBase(_vrfCoordinator, _link) { keyHash = 0xAA77729D3466CA35AE8D28B3BBAC7CC36A5031EFDC430821C02BC31A238AF445; fee = 2 * 10 ** 18; // 0.1 LINK (Varies by network) linkToken = _link; // Initate Interfaces salmon = ISalmon(_salmon); MAX_TOKENS = _maxTokens; PAID_TOKENS = _maxTokens / 5; // string[13] _traitTypes = ['Hat','Eyes','Body','Pants','Skintone','Mouth','Feet','Fishing Pole','Fish','Fur','Eyes','Clothes','Mouth','Alpha']; rarities[0] = [31,49,51,69,113,187,204,207,225]; rarities[1] = [35,48,67,115,189,208,221]; rarities[2] = [59,97,136,159,197]; rarities[3] = [85,113,131,143,169]; rarities[4] = [255,255,255,255]; rarities[5] = [34,59,118,164,197,222]; rarities[6] = [59,111,145,197]; rarities[7] = [57,93,163,199]; rarities[8] = [255]; aliases[0] = [8,7,6,5,4,3,2,1,0]; aliases[1] = [6,5,4,3,2,1,0]; aliases[2] = [4,3,2,1,0]; aliases[3] = [4,3,2,1,0]; aliases[4] = [3,2,1,0]; aliases[5] = [5,4,3,2,1,0]; aliases[6] = [3,2,1,0]; aliases[7] = [3,2,1,0]; aliases[8] = [0]; rarities[9] = [255,255,255,255,255]; rarities[10] = [39,51,59,67,125,131,189,197,204,217]; rarities[11] = [51,54,57,64,72,90,194,199,202,207,212]; rarities[12] = [48,60,96,160,196,208]; rarities[13] = [51,102,153,204]; aliases[9] = [0,1,2,3,4]; aliases[10] = [9,8,7,6,5,4,3,2,1,0]; aliases[11] = [10,9,8,7,6,5,4,3,2,1,0]; aliases[12] = [5,4,3,2,1,0]; aliases[13] = [3,2,1,0]; } /** * mint a token - 90% Bears, 10% Fisherman * The first 20% are free to claim, the remaining cost $SALMON */ // Calculates Mint Cost using $SALMON function mintCost(uint256 tokenId) public view returns (uint256) { if (tokenId <= PAID_TOKENS) return 0; // the first 20% are paid in ETH, Hence 0 $SALMON if (tokenId <= MAX_TOKENS * 2 / 5) return 20000 ether; // the next 20% are 20000 $SALMON if (tokenId <= MAX_TOKENS * 4 / 5) return 40000 ether; // the next 40% are 40000 $SALMON return 80000 ether; // the final 20% are 80000 $SALMON } // Main Mint Functions function mint(uint256 amount, bool stake) external payable whenNotPaused { address msgSender = _msgSender(); require(tx.origin == msgSender, "Only EOA"); require(minted + amount <= MAX_TOKENS, "All tokens minted"); require(amount > 0 && amount <= 10, "Invalid mint amount"); if (minted < PAID_TOKENS) { uint256 mintCostEther = MINT_PRICE * amount; if (whitelists[msgSender] == 1) { mintCostEther = ( amount - 1) * MINT_PRICE; whitelists[msgSender] = 0; } require(minted + amount <= PAID_TOKENS, "All tokens on-sale already sold"); require(mintCostEther == msg.value, "Invalid payment amount"); } else { require(msg.value == 0); } uint256 totalSalmonCost = 0; // $SALMON Cost to mint. 0 is Gen0 uint16[] memory tokenIds = stake ? new uint16[](amount) : new uint16[](0); uint256 seed; for (uint i = 0; i < amount; i++) { minted++; seed = random(minted); // NOTES: SUS generate(minted, seed); // Generates Token Traits and adds it to the array address recipient = selectRecipient(seed); // Selects who the NFT is going to. Gen0 always will be minter. if (!stake || recipient != msgSender) { // recipient != _msgSender() -- IF I BAN CONTRACT, SHIT MIGHT BE GOOOOOFY _safeMint(recipient, minted); } else { _safeMint(address(river), minted); tokenIds[i] = minted; } totalSalmonCost += mintCost(minted); } if (totalSalmonCost > 0) salmon.burn(msgSender, totalSalmonCost); if (stake) river.addManyToRiverSideAndFishing(msgSender, tokenIds); } function transferFrom( address from, address to, uint256 tokenId ) public virtual override { // Hardcode the River's approval so that users don't have to waste gas approving if (_msgSender() != address(river)) require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } // generates traits for a specific token, checking to make sure it's unique function generate(uint256 tokenId, uint256 seed) internal returns (ManBear memory t) { getRandomChainlink(); t = selectTraits(seed); if (existingCombinations[structToHash(t.isFisherman, t.traitarray, t.alphaIndex)] == 0) { tokenTraits[tokenId] = t; existingCombinations[structToHash(t.isFisherman, t.traitarray, t.alphaIndex)] = tokenId; return t; } return generate(tokenId, random(seed)); } // Selects Trait using A.J. Walker's Alias algorithm for O(1) rarity table lookup function selectTrait(uint16 seed, uint8 traitType) internal view returns (uint8) { uint8 trait = uint8(seed) % uint8(rarities[traitType].length); if (seed >> 8 < rarities[traitType][trait]) return trait; return aliases[traitType][trait]; } // selects the species and all of its traits based on the seed value function selectTraits(uint256 seed) internal view returns (ManBear memory t) { t.isFisherman = (seed & 0xFFFF) % 10 != 0; uint8 shift = t.isFisherman ? 0 : 9; // 0 if its a Fisherman, 9 if its Bear seed >>= 16; if (t.isFisherman) { // / 0 - 8 are associated with fishermen, t.traitarray[0] = selectTrait(uint16(seed & 0xFFFF), 0 + shift); seed >>= 16; t.traitarray[1] = selectTrait(uint16(seed & 0xFFFF), 1 + shift); seed >>= 16; t.traitarray[2] = selectTrait(uint16(seed & 0xFFFF), 2 + shift); seed >>= 16; t.traitarray[3] = selectTrait(uint16(seed & 0xFFFF), 3 + shift); seed >>= 16; t.traitarray[4] = selectTrait(uint16(seed & 0xFFFF), 4 + shift); seed >>= 16; t.traitarray[5] = selectTrait(uint16(seed & 0xFFFF), 5 + shift); seed >>= 16; t.traitarray[6] = selectTrait(uint16(seed & 0xFFFF), 6 + shift); seed >>= 16; t.traitarray[7] = selectTrait(uint16(seed & 0xFFFF), 7 + shift); seed >>= 16; t.traitarray[8] = selectTrait(uint16(seed & 0xFFFF), 8 + shift); t.alphaIndex = 0; } else { // 9 - 13 are associated with Bears t.traitarray[9] = selectTrait(uint16(seed & 0xFFFF), 0 + shift); seed >>= 16; t.traitarray[10] = selectTrait(uint16(seed & 0xFFFF), 1 + shift); seed >>= 16; t.traitarray[11] = selectTrait(uint16(seed & 0xFFFF), 2 + shift); seed >>= 16; t.traitarray[12] = selectTrait(uint16(seed & 0xFFFF), 3 + shift); seed >>= 16; t.traitarray[13] = selectTrait(uint16(seed & 0xFFFF), 4 + shift); t.alphaIndex = t.traitarray[13]; } } // converts a struct to a 256 bit hash to check for uniqueness function structToHash(bool isFisherman, uint8[14] memory traitarray, uint8 alphaIndex) internal pure returns (uint256) { if(isFisherman){ return uint256(bytes32(abi.encodePacked(true, traitarray[0], traitarray[1], traitarray[2], traitarray[3], traitarray[4], traitarray[5], traitarray[6], traitarray[7], traitarray[8], "0", "0", "0", "0", "0", alphaIndex))); } else{ return uint256(bytes32(abi.encodePacked(false, "0", "0", "0", "0", "0", "0", "0", "0", "0", traitarray[9], traitarray[10], traitarray[11], traitarray[12], traitarray[13], alphaIndex))); } } // Select who the NFT goes to --- The first 20% (ETH purchases) go to the minter & the remaining 80% have a 10% chance to be given to a random staked Bear function selectRecipient(uint256 seed) internal view returns (address) { if (minted <= PAID_TOKENS || ((seed >> 245) % 10) != 0) return _msgSender(); // top 10 bits haven't been used address thief = river.randomBearOwner(seed >> 144); // 144 bits reserved for trait selection if (thief == address(0x0)) return _msgSender(); return thief; } /** READ */ function getTokenTraits(uint256 tokenId) external view override returns (ManBear memory) { return tokenTraits[tokenId]; } function getPaidTokens() external view override returns (uint256) { return PAID_TOKENS; } // called after deployment so that the contract can get random Bear thieves function setRiver(address _river) external onlyOwner { river = IRiver(_river); getRandomChainlink(); } // Set Interfaces function setInit(address _river, address erc20Address, address _traits ) public onlyOwner { river = IRiver(_river); salmon = ISalmon(erc20Address); // salmon = IERC20(_salmon); traits = ITraits(_traits); getRandomChainlink(); } // Set Base URL function setURI(string memory _newBaseURI) external onlyOwner { baseURI = _newBaseURI; } // withdraw functions function withdraw() public payable onlyOwner { uint256 _project = (address(this).balance * 10) / 100; uint256 _bear1 = (address(this).balance * 225) / 1000; uint256 _bear2 = (address(this).balance * 225) / 1000; uint256 _bear3 = (address(this).balance * 225) / 1000; uint256 _bear4 = (address(this).balance * 225) / 1000; payable(project_wallet).transfer(_project); payable(Bear1).transfer(_bear1); payable(Bear2).transfer(_bear2); payable(Bear3).transfer(_bear3); payable(Bear4).transfer(_bear4); } // updates the number of tokens for sale function setPaidTokens(uint256 _paidTokens) external onlyOwner { PAID_TOKENS = _paidTokens; // MAX_TOKENS = _maxTokens; // PAID_TOKENS = _maxTokens / 5; } // enables owner to pause / unpause minting function setPaused(bool _paused) external onlyOwner { if (_paused) _pause(); else _unpause(); } function addWhitelist(address[] calldata addressArrays) external onlyOwner { uint256 addylength = addressArrays.length; for (uint256 i; i < addylength; i++ ){ whitelists[addressArrays[i]] = 1; } } /** RENDER */ function setBaseURI(string memory newUri) public onlyOwner { baseURI = newUri; } function _baseURI() internal view virtual override returns (string memory) { return baseURI; } function getTokenIds(address _owner) public view returns (uint256[] memory _tokensOfOwner) { _tokensOfOwner = new uint256[](balanceOf(_owner)); for (uint256 i;i<balanceOf(_owner);i++){ _tokensOfOwner[i] = tokenOfOwnerByIndex(_owner, i); } } /** RANDOMNESSSS */ function random(uint256 seed) internal view returns (uint256) { return uint256(keccak256(abi.encodePacked( tx.origin, blockhash(block.number - 1), block.timestamp, seed, randomNumber ))); } function changeLinkFee(uint256 _fee) external onlyOwner { // fee = 0.1 * 10 ** 18; // 0.1 LINK (Varies by network) fee = _fee; } function initChainLink() external onlyOwner { getRandomChainlink(); } function getRandomChainlink() internal returns (bytes32 requestId) { if (vrfReqd.current() <= vrfcooldown) { vrfReqd.increment(); return 0x000; } require(LINK.balanceOf(address(this)) >= fee, "Not enough LINK - fill contract with faucet"); vrfReqd.reset(); return requestRandomness(keyHash, fee); } function changeVrfCooldown(uint256 _cooldown) external onlyOwner{ vrfcooldown = _cooldown; } function fulfillRandomness(bytes32 requestId, uint256 randomness) internal override { bytes32 reqId = requestId; randomNumber = randomness; } function withdrawLINK() external onlyOwner { uint256 tokenSupply = IERC20(linkToken).balanceOf(address(this)); IERC20(linkToken).transfer(msg.sender, tokenSupply); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping(bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; if (lastIndex != toDeleteIndex) { bytes32 lastvalue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastvalue; // Update the index for the moved value set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex } // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { return set._values[index]; } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function _values(Set storage set) private view returns (bytes32[] memory) { return set._values; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(Bytes32Set storage set) internal view returns (bytes32[] memory) { return _values(set._inner); } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(AddressSet storage set) internal view returns (address[] memory) { bytes32[] memory store = _values(set._inner); address[] memory result; assembly { result := store } return result; } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values on the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(UintSet storage set) internal view returns (uint256[] memory) { bytes32[] memory store = _values(set._inner); uint256[] memory result; assembly { result := store } return result; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @title Counters * @author Matt Condon (@shrugs) * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number * of elements in a mapping, issuing ERC721 ids, or counting request ids. * * Include with `using Counters for Counters.Counter;` */ library Counters { struct Counter { // This variable should never be directly accessed by users of the library: interactions must be restricted to // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add // this feature: see https://github.com/ethereum/solidity/issues/4637 uint256 _value; // default: 0 } function current(Counter storage counter) internal view returns (uint256) { return counter._value; } function increment(Counter storage counter) internal { unchecked { counter._value += 1; } } function decrement(Counter storage counter) internal { uint256 value = counter._value; require(value > 0, "Counter: decrement overflow"); unchecked { counter._value = value - 1; } } function reset(Counter storage counter) internal { counter._value = 0; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Enumerable is IERC721 { /** * @dev Returns the total amount of tokens stored by the contract. */ function totalSupply() external view returns (uint256); /** * @dev Returns a token ID owned by `owner` at a given `index` of its token list. * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSupply} to enumerate all tokens. */ function tokenByIndex(uint256 index) external view returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../ERC721.sol"; import "./IERC721Enumerable.sol"; /** * @dev This implements an optional extension of {ERC721} defined in the EIP that adds * enumerability of all the token ids in the contract as well as all token ids owned by each * account. */ abstract contract ERC721Enumerable is ERC721, IERC721Enumerable { // Mapping from owner to list of owned token IDs mapping(address => mapping(uint256 => uint256)) private _ownedTokens; // Mapping from token ID to index of the owner tokens list mapping(uint256 => uint256) private _ownedTokensIndex; // Array with all token ids, used for enumeration uint256[] private _allTokens; // Mapping from token id to position in the allTokens array mapping(uint256 => uint256) private _allTokensIndex; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) { return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) { require(index < ERC721.balanceOf(owner), "ERC721Enumerable: owner index out of bounds"); return _ownedTokens[owner][index]; } /** * @dev See {IERC721Enumerable-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _allTokens.length; } /** * @dev See {IERC721Enumerable-tokenByIndex}. */ function tokenByIndex(uint256 index) public view virtual override returns (uint256) { require(index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: global index out of bounds"); return _allTokens[index]; } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` cannot be the zero address. * - `to` cannot be the zero address. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual override { super._beforeTokenTransfer(from, to, tokenId); if (from == address(0)) { _addTokenToAllTokensEnumeration(tokenId); } else if (from != to) { _removeTokenFromOwnerEnumeration(from, tokenId); } if (to == address(0)) { _removeTokenFromAllTokensEnumeration(tokenId); } else if (to != from) { _addTokenToOwnerEnumeration(to, tokenId); } } /** * @dev Private function to add a token to this extension's ownership-tracking data structures. * @param to address representing the new owner of the given token ID * @param tokenId uint256 ID of the token to be added to the tokens list of the given address */ function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private { uint256 length = ERC721.balanceOf(to); _ownedTokens[to][length] = tokenId; _ownedTokensIndex[tokenId] = length; } /** * @dev Private function to add a token to this extension's token tracking data structures. * @param tokenId uint256 ID of the token to be added to the tokens list */ function _addTokenToAllTokensEnumeration(uint256 tokenId) private { _allTokensIndex[tokenId] = _allTokens.length; _allTokens.push(tokenId); } /** * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for * gas optimizations e.g. when performing a transfer operation (avoiding double writes). * This has O(1) time complexity, but alters the order of the _ownedTokens array. * @param from address representing the previous owner of the given token ID * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address */ function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private { // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = ERC721.balanceOf(from) - 1; uint256 tokenIndex = _ownedTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary if (tokenIndex != lastTokenIndex) { uint256 lastTokenId = _ownedTokens[from][lastTokenIndex]; _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index } // This also deletes the contents at the last position of the array delete _ownedTokensIndex[tokenId]; delete _ownedTokens[from][lastTokenIndex]; } /** * @dev Private function to remove a token from this extension's token tracking data structures. * This has O(1) time complexity, but alters the order of the _allTokens array. * @param tokenId uint256 ID of the token to be removed from the tokens list */ function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private { // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = _allTokens.length - 1; uint256 tokenIndex = _allTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding // an 'if' statement (like in _removeTokenFromOwnerEnumeration) uint256 lastTokenId = _allTokens[lastTokenIndex]; _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index // This also deletes the contents at the last position of the array delete _allTokensIndex[tokenId]; _allTokens.pop(); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IERC721.sol"; import "./IERC721Receiver.sol"; import "./extensions/IERC721Metadata.sol"; import "../../utils/Address.sol"; import "../../utils/Context.sol"; import "../../utils/Strings.sol"; import "../../utils/introspection/ERC165.sol"; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { require(operator != _msgSender(), "ERC721: approve to caller"); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint( address to, uint256 tokenId, bytes memory _data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @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; 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 make it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract Pausable is Context { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ constructor() { _paused = false; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { require(!paused(), "Pausable: paused"); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { require(paused(), "Pausable: not paused"); _; } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _setOwner(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _setOwner(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _setOwner(newOwner); } function _setOwner(address newOwner) private { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface LinkTokenInterface { function allowance( address owner, address spender ) external view returns ( uint256 remaining ); function approve( address spender, uint256 value ) external returns ( bool success ); function balanceOf( address owner ) external view returns ( uint256 balance ); function decimals() external view returns ( uint8 decimalPlaces ); function decreaseApproval( address spender, uint256 addedValue ) external returns ( bool success ); function increaseApproval( address spender, uint256 subtractedValue ) external; function name() external view returns ( string memory tokenName ); function symbol() external view returns ( string memory tokenSymbol ); function totalSupply() external view returns ( uint256 totalTokensIssued ); function transfer( address to, uint256 value ) external returns ( bool success ); function transferAndCall( address to, uint256 value, bytes calldata data ) external returns ( bool success ); function transferFrom( address from, address to, uint256 value ) external returns ( bool success ); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; contract VRFRequestIDBase { /** * @notice returns the seed which is actually input to the VRF coordinator * * @dev To prevent repetition of VRF output due to repetition of the * @dev user-supplied seed, that seed is combined in a hash with the * @dev user-specific nonce, and the address of the consuming contract. The * @dev risk of repetition is mostly mitigated by inclusion of a blockhash in * @dev the final seed, but the nonce does protect against repetition in * @dev requests which are included in a single block. * * @param _userSeed VRF seed input provided by user * @param _requester Address of the requesting contract * @param _nonce User-specific nonce at the time of the request */ function makeVRFInputSeed( bytes32 _keyHash, uint256 _userSeed, address _requester, uint256 _nonce ) internal pure returns ( uint256 ) { return uint256(keccak256(abi.encode(_keyHash, _userSeed, _requester, _nonce))); } /** * @notice Returns the id for this request * @param _keyHash The serviceAgreement ID to be used for this request * @param _vRFInputSeed The seed to be passed directly to the VRF * @return The id for this request * * @dev Note that _vRFInputSeed is not the seed passed by the consuming * @dev contract, but the one generated by makeVRFInputSeed */ function makeRequestId( bytes32 _keyHash, uint256 _vRFInputSeed ) internal pure returns ( bytes32 ) { return keccak256(abi.encodePacked(_keyHash, _vRFInputSeed)); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./interfaces/LinkTokenInterface.sol"; import "./VRFRequestIDBase.sol"; /** **************************************************************************** * @notice Interface for contracts using VRF randomness * ***************************************************************************** * @dev PURPOSE * * @dev Reggie the Random Oracle (not his real job) wants to provide randomness * @dev to Vera the verifier in such a way that Vera can be sure he's not * @dev making his output up to suit himself. Reggie provides Vera a public key * @dev to which he knows the secret key. Each time Vera provides a seed to * @dev Reggie, he gives back a value which is computed completely * @dev deterministically from the seed and the secret key. * * @dev Reggie provides a proof by which Vera can verify that the output was * @dev correctly computed once Reggie tells it to her, but without that proof, * @dev the output is indistinguishable to her from a uniform random sample * @dev from the output space. * * @dev The purpose of this contract is to make it easy for unrelated contracts * @dev to talk to Vera the verifier about the work Reggie is doing, to provide * @dev simple access to a verifiable source of randomness. * ***************************************************************************** * @dev USAGE * * @dev Calling contracts must inherit from VRFConsumerBase, and can * @dev initialize VRFConsumerBase's attributes in their constructor as * @dev shown: * * @dev contract VRFConsumer { * @dev constuctor(<other arguments>, address _vrfCoordinator, address _link) * @dev VRFConsumerBase(_vrfCoordinator, _link) public { * @dev <initialization with other arguments goes here> * @dev } * @dev } * * @dev The oracle will have given you an ID for the VRF keypair they have * @dev committed to (let's call it keyHash), and have told you the minimum LINK * @dev price for VRF service. Make sure your contract has sufficient LINK, and * @dev call requestRandomness(keyHash, fee, seed), where seed is the input you * @dev want to generate randomness from. * * @dev Once the VRFCoordinator has received and validated the oracle's response * @dev to your request, it will call your contract's fulfillRandomness method. * * @dev The randomness argument to fulfillRandomness is the actual random value * @dev generated from your seed. * * @dev The requestId argument is generated from the keyHash and the seed by * @dev makeRequestId(keyHash, seed). If your contract could have concurrent * @dev requests open, you can use the requestId to track which seed is * @dev associated with which randomness. See VRFRequestIDBase.sol for more * @dev details. (See "SECURITY CONSIDERATIONS" for principles to keep in mind, * @dev if your contract could have multiple requests in flight simultaneously.) * * @dev Colliding `requestId`s are cryptographically impossible as long as seeds * @dev differ. (Which is critical to making unpredictable randomness! See the * @dev next section.) * * ***************************************************************************** * @dev SECURITY CONSIDERATIONS * * @dev A method with the ability to call your fulfillRandomness method directly * @dev could spoof a VRF response with any random value, so it's critical that * @dev it cannot be directly called by anything other than this base contract * @dev (specifically, by the VRFConsumerBase.rawFulfillRandomness method). * * @dev For your users to trust that your contract's random behavior is free * @dev from malicious interference, it's best if you can write it so that all * @dev behaviors implied by a VRF response are executed *during* your * @dev fulfillRandomness method. If your contract must store the response (or * @dev anything derived from it) and use it later, you must ensure that any * @dev user-significant behavior which depends on that stored value cannot be * @dev manipulated by a subsequent VRF request. * * @dev Similarly, both miners and the VRF oracle itself have some influence * @dev over the order in which VRF responses appear on the blockchain, so if * @dev your contract could have multiple VRF requests in flight simultaneously, * @dev you must ensure that the order in which the VRF responses arrive cannot * @dev be used to manipulate your contract's user-significant behavior. * * @dev Since the ultimate input to the VRF is mixed with the block hash of the * @dev block in which the request is made, user-provided seeds have no impact * @dev on its economic security properties. They are only included for API * @dev compatability with previous versions of this contract. * * @dev Since the block hash of the block which contains the requestRandomness * @dev call is mixed into the input to the VRF *last*, a sufficiently powerful * @dev miner could, in principle, fork the blockchain to evict the block * @dev containing the request, forcing the request to be included in a * @dev different block with a different hash, and therefore a different input * @dev to the VRF. However, such an attack would incur a substantial economic * @dev cost. This cost scales with the number of blocks the VRF oracle waits * @dev until it calls responds to a request. */ abstract contract VRFConsumerBase is VRFRequestIDBase { /** * @notice fulfillRandomness handles the VRF response. Your contract must * @notice implement it. See "SECURITY CONSIDERATIONS" above for important * @notice principles to keep in mind when implementing your fulfillRandomness * @notice method. * * @dev VRFConsumerBase expects its subcontracts to have a method with this * @dev signature, and will call it once it has verified the proof * @dev associated with the randomness. (It is triggered via a call to * @dev rawFulfillRandomness, below.) * * @param requestId The Id initially returned by requestRandomness * @param randomness the VRF output */ function fulfillRandomness( bytes32 requestId, uint256 randomness ) internal virtual; /** * @dev In order to keep backwards compatibility we have kept the user * seed field around. We remove the use of it because given that the blockhash * enters later, it overrides whatever randomness the used seed provides. * Given that it adds no security, and can easily lead to misunderstandings, * we have removed it from usage and can now provide a simpler API. */ uint256 constant private USER_SEED_PLACEHOLDER = 0; /** * @notice requestRandomness initiates a request for VRF output given _seed * * @dev The fulfillRandomness method receives the output, once it's provided * @dev by the Oracle, and verified by the vrfCoordinator. * * @dev The _keyHash must already be registered with the VRFCoordinator, and * @dev the _fee must exceed the fee specified during registration of the * @dev _keyHash. * * @dev The _seed parameter is vestigial, and is kept only for API * @dev compatibility with older versions. It can't *hurt* to mix in some of * @dev your own randomness, here, but it's not necessary because the VRF * @dev oracle will mix the hash of the block containing your request into the * @dev VRF seed it ultimately uses. * * @param _keyHash ID of public key against which randomness is generated * @param _fee The amount of LINK to send with the request * * @return requestId unique ID for this request * * @dev The returned requestId can be used to distinguish responses to * @dev concurrent requests. It is passed as the first argument to * @dev fulfillRandomness. */ function requestRandomness( bytes32 _keyHash, uint256 _fee ) internal returns ( bytes32 requestId ) { LINK.transferAndCall(vrfCoordinator, _fee, abi.encode(_keyHash, USER_SEED_PLACEHOLDER)); // This is the seed passed to VRFCoordinator. The oracle will mix this with // the hash of the block containing this request to obtain the seed/input // which is finally passed to the VRF cryptographic machinery. uint256 vRFSeed = makeVRFInputSeed(_keyHash, USER_SEED_PLACEHOLDER, address(this), nonces[_keyHash]); // nonces[_keyHash] must stay in sync with // VRFCoordinator.nonces[_keyHash][this], which was incremented by the above // successful LINK.transferAndCall (in VRFCoordinator.randomnessRequest). // This provides protection against the user repeating their input seed, // which would result in a predictable/duplicate output, if multiple such // requests appeared in the same block. nonces[_keyHash] = nonces[_keyHash] + 1; return makeRequestId(_keyHash, vRFSeed); } LinkTokenInterface immutable internal LINK; address immutable private vrfCoordinator; // Nonces for each VRF key from which randomness has been requested. // // Must stay in sync with VRFCoordinator[_keyHash][this] mapping(bytes32 /* keyHash */ => uint256 /* nonce */) private nonces; /** * @param _vrfCoordinator address of VRFCoordinator contract * @param _link address of LINK token contract * * @dev https://docs.chain.link/docs/link-token-contracts */ constructor( address _vrfCoordinator, address _link ) { vrfCoordinator = _vrfCoordinator; LINK = LinkTokenInterface(_link); } // rawFulfillRandomness is called by VRFCoordinator when it receives a valid VRF // proof. rawFulfillRandomness then calls fulfillRandomness, after validating // the origin of the call function rawFulfillRandomness( bytes32 requestId, uint256 randomness ) external { require(msg.sender == vrfCoordinator, "Only VRFCoordinator can fulfill"); fulfillRandomness(requestId, randomness); } }
{ "remappings": [], "optimizer": { "enabled": true, "runs": 200 }, "evmVersion": "london", "libraries": {}, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_salmon","type":"address"},{"internalType":"uint256","name":"_maxTokens","type":"uint256"},{"internalType":"address","name":"_vrfCoordinator","type":"address"},{"internalType":"address","name":"_link","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"MAX_TOKENS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINT_PRICE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PAID_TOKENS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"_mints","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"addressArrays","type":"address[]"}],"name":"addWhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"aliases","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_fee","type":"uint256"}],"name":"changeLinkFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_cooldown","type":"uint256"}],"name":"changeVrfCooldown","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"existingCombinations","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"fee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPaidTokens","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"getTokenIds","outputs":[{"internalType":"uint256[]","name":"_tokensOfOwner","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getTokenTraits","outputs":[{"components":[{"internalType":"bool","name":"isFisherman","type":"bool"},{"internalType":"uint8[14]","name":"traitarray","type":"uint8[14]"},{"internalType":"uint8","name":"alphaIndex","type":"uint8"}],"internalType":"struct IRoar.ManBear","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"initChainLink","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"linkToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bool","name":"stake","type":"bool"}],"name":"mint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"mintCost","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minted","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"rarities","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"requestId","type":"bytes32"},{"internalType":"uint256","name":"randomness","type":"uint256"}],"name":"rawFulfillRandomness","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"river","outputs":[{"internalType":"contract IRiver","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"salmon","outputs":[{"internalType":"contract ISalmon","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"newUri","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_river","type":"address"},{"internalType":"address","name":"erc20Address","type":"address"},{"internalType":"address","name":"_traits","type":"address"}],"name":"setInit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_paidTokens","type":"uint256"}],"name":"setPaidTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_paused","type":"bool"}],"name":"setPaused","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_river","type":"address"}],"name":"setRiver","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_newBaseURI","type":"string"}],"name":"setURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokenTraits","outputs":[{"internalType":"bool","name":"isFisherman","type":"bool"},{"internalType":"uint8","name":"alphaIndex","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"traits","outputs":[{"internalType":"contract ITraits","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"vrfReqd","outputs":[{"internalType":"uint256","name":"_value","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"vrfcooldown","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"whitelists","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"withdrawLINK","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60e0604052603a80546001600160a01b03199081167306e8198a5a4ab3e5f4b13ddc9e5c2fcddd4f883817909155603b80548216739e4faaa4efd0fb8cbc653ee68c01c066d078098d179055603c8054821673e18195d4995d994faa3663db0b6e2fff4042d0a1179055603d80548216739c39cd2f557b5e851f44ab18714bbbb15fa7417e179055603e80549091167324af21668f33c8c279025b0e53fcc3bff48426a0179055612710604455348015620000b957600080fd5b5060405162004ca338038062004ca3833981016040819052620000dc9162000b24565b8181604051806040016040528060088152602001674265617247616d6560c01b815250604051806040016040528060088152602001674245415247414d4560c01b815250816000908051906020019062000138929190620009be565b5080516200014e906001906020840190620009be565b5050506200016b620001656200096860201b60201c565b6200096c565b600a805460ff60a01b191690556001600160601b0319606092831b811660a052911b166080527faa77729d3466ca35ae8d28b3bbac7cc36a5031efdc430821c02bc31a238af445603f55671bc16d674ec80000604055604380546001600160a01b038381166001600160a01b031992831617909255603880549287169290911691909117905560c08390526200020360058462000b78565b600c556040805161012081018252601f815260316020820152603391810191909152604560608201526071608082015260bb60a082015260cc60c082015260cf60e082015260e16101008201526200026090601390600962000a4d565b506040805160e08101825260238152603060208201526043918101919091526073606082015260bd608082015260d060a082015260dd60c0820152620002ab90601490600762000a4d565b506040805160a081018252603b815260616020820152608891810191909152609f606082015260c56080820152620002e890601590600562000a4d565b506040805160a0810182526055815260716020820152608391810191909152608f606082015260a960808201526200032590601690600562000a4d565b506040805160808101825260ff8082526020820181905291810182905260608101919091526200035a90601790600462000a4d565b506040805160c08101825260228152603b602082015260769181019190915260a4606082015260c5608082015260de60a08201526200039e90601890600662000a4d565b5060408051608081018252603b8152606f602082015260919181019190915260c56060820152620003d490601990600462000a4d565b506040805160808101825260398152605d602082015260a39181019190915260c760608201526200040a90601a90600462000a4d565b50604080516020810190915260ff81526200042a90601b90600162000a4d565b50604080516101208101825260088152600760208201526006918101919091526005606082015260046080820152600360a0820152600260c0820152600160e082015260006101008201526200048590602590600962000a4d565b506040805160e08101825260068152600560208201526004918101919091526003606082015260026080820152600160a0820152600060c0820152620004d090602690600762000a4d565b506040805160a081018252600481526003602082015260029181019190915260016060820152600060808201526200050d90602790600562000a4d565b506040805160a081018252600481526003602082015260029181019190915260016060820152600060808201526200054a90602890600562000a4d565b50604080516080810182526003815260026020820152600191810191909152600060608201526200058090602990600462000a4d565b506040805160c08101825260058152600460208201526003918101919091526002606082015260016080820152600060a0820152620005c490602a90600662000a4d565b5060408051608081018252600381526002602082015260019181019190915260006060820152620005fa90602b90600462000a4d565b50604080516080810182526003815260026020820152600191810191909152600060608201526200063090602c90600462000a4d565b506040805160208101909152600081526200065090602d90600162000a4d565b506040805160a08101825260ff808252602082018190529181018290526060810182905260808101919091526200068c90601c90600562000a4d565b5060408051610140810182526027815260336020820152603b9181019190915260436060820152607d6080820152608360a082015260bd60c082015260c560e082015260cc61010082015260d9610120820152620006ef90601d90600a62000a4d565b5060408051610160810182526033815260366020820152603981830152606081019190915260486080820152605a60a082015260c260c082015260c760e082015260ca61010082015260cf61012082015260d46101408201526200075890601e90600b62000a4d565b506040805160c08101825260308152603c6020820152606091810182905260a091810182905260c4608082015260d0918101919091526200079e90601f90600662000a4d565b5060408051608081018252603381526066602082015260999181019190915260cc60608201526013600d620007d892910190600462000a4d565b506040805160a081018252600081526001602082015260029181019190915260036060820152600460808201526200081590602e90600562000a4d565b50604080516101408101825260098152600860208201526007918101919091526006606082015260056080820152600460a0820152600360c0820152600260e0820152600161010082015260006101208201526200087890602f90600a62000a4d565b506040805161016081018252600a8152600960208201526008918101919091526007606082015260066080820152600560a0820152600460c0820152600360e0820152600261010082015260016101208201526000610140820152620008e390603090600b62000a4d565b506040805160c08101825260058152600460208201526003918101919091526002606082015260016080820152600060a08201526200092790603190600662000a4d565b50604080516080810182526003815260026020820152600191810191909152600060608201526200095d90603290600462000a4d565b505050505062000bd8565b3390565b600a80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b828054620009cc9062000b9b565b90600052602060002090601f016020900481019282620009f0576000855562000a3b565b82601f1062000a0b57805160ff191683800117855562000a3b565b8280016001018555821562000a3b579182015b8281111562000a3b57825182559160200191906001019062000a1e565b5062000a4992915062000af0565b5090565b82805482825590600052602060002090601f0160209004810192821562000a3b5791602002820160005b8382111562000ab757835183826101000a81548160ff021916908360ff160217905550926020019260010160208160000104928301926001030262000a77565b801562000ae65782816101000a81549060ff021916905560010160208160000104928301926001030262000ab7565b505062000a499291505b5b8082111562000a49576000815560010162000af1565b80516001600160a01b038116811462000b1f57600080fd5b919050565b6000806000806080858703121562000b3b57600080fd5b62000b468562000b07565b93506020850151925062000b5d6040860162000b07565b915062000b6d6060860162000b07565b905092959194509250565b60008262000b9657634e487b7160e01b600052601260045260246000fd5b500490565b600181811c9082168062000bb057607f821691505b6020821081141562000bd257634e487b7160e01b600052602260045260246000fd5b50919050565b60805160601c60a05160601c60c05161407262000c3160003960008181610a9101528181610e3f01528181610e8d0152611409015260008181611a590152612af601526000818161254a0152612ac701526140726000f3fe60806040526004361061036b5760003560e01c80636c0360eb116101c6578063b88d4fde116100f7578063e05c57bf11610095578063edac985b1161006f578063edac985b14610a1f578063f024747814610a3f578063f2fde38b14610a5f578063f47c84c514610a7f57600080fd5b8063e05c57bf14610962578063e1fc334f146109b6578063e985e9c5146109d657600080fd5b8063c87b56dd116100d1578063c87b56dd146108df578063cc1dda0f146108ff578063d004b0361461091f578063ddca3f431461094c57600080fd5b8063b88d4fde1461088e578063c002d23d146108ae578063c084f540146108c957600080fd5b806394985ddd1161016457806399e4d8ef1161013e57806399e4d8ef14610816578063a1b8f3741461082c578063a22cb46514610859578063adc2112f1461087957600080fd5b806394985ddd146107b457806394e56847146107d457806395d89b411461080157600080fd5b80637a98a82a116101a05780637a98a82a1461074157806383a3af5314610756578063873efeff146107765780638da5cb5b1461079657600080fd5b80636c0360eb146106f757806370a082311461070c578063715018a61461072c57600080fd5b80633431a753116102a05780634f6ccce71161023e57806357970e931161021857806357970e93146106855780635c975abb146106a55780636352211e146106c457806367f68fac146106e457600080fd5b80634f6ccce71461064e57806355f804b3146103a5578063568303ca1461066e57600080fd5b80633d955a701161027a5780633d955a70146105cb5780634018b1f8146105eb57806342842e0e146106005780634f02c4201461062057600080fd5b80633431a7531461058357806336838391146105a35780633ccfd60b146105c357600080fd5b806318160ddd1161030d57806327de8f27116102e757806327de8f27146104f15780632f745c59146105115780632fb641c91461053157806333df4b2c1461055157600080fd5b806318160ddd1461048f5780631e7be210146104a457806323b872dd146104d157600080fd5b8063081812fc11610349578063081812fc146103e9578063095ea7b314610421578063109b1ee61461044157806316c38b3c1461046f57600080fd5b806301ffc9a71461037057806302fe5305146103a557806306fdde03146103c7575b600080fd5b34801561037c57600080fd5b5061039061038b366004613921565b610ab3565b60405190151581526020015b60405180910390f35b3480156103b157600080fd5b506103c56103c036600461395b565b610ade565b005b3480156103d357600080fd5b506103dc610b28565b60405161039c9190613cda565b3480156103f557600080fd5b506104096104043660046139a4565b610bba565b6040516001600160a01b03909116815260200161039c565b34801561042d57600080fd5b506103c561043c366004613824565b610c4f565b34801561044d57600080fd5b5061046161045c366004613824565b610d65565b60405190815260200161039c565b34801561047b57600080fd5b506103c561048a3660046138c5565b610d96565b34801561049b57600080fd5b50600854610461565b3480156104b057600080fd5b506104616104bf366004613677565b600f6020526000908152604090205481565b3480156104dd57600080fd5b506103c56104ec366004613735565b610dd9565b3480156104fd57600080fd5b5061046161050c3660046139a4565b610e25565b34801561051d57600080fd5b5061046161052c366004613824565b610ee5565b34801561053d57600080fd5b506103c561054c3660046136ea565b610f7b565b34801561055d57600080fd5b5061057161056c3660046138ff565b610ff0565b60405160ff909116815260200161039c565b34801561058f57600080fd5b506103c561059e3660046139a4565b611036565b3480156105af57600080fd5b506105716105be3660046138ff565b611065565b6103c5611075565b3480156105d757600080fd5b50603754610409906001600160a01b031681565b3480156105f757600080fd5b50600c54610461565b34801561060c57600080fd5b506103c561061b366004613735565b611257565b34801561062c57600080fd5b50600d5461063b9061ffff1681565b60405161ffff909116815260200161039c565b34801561065a57600080fd5b506104616106693660046139a4565b611272565b34801561067a57600080fd5b506045546104619081565b34801561069157600080fd5b50604354610409906001600160a01b031681565b3480156106b157600080fd5b50600a54600160a01b900460ff16610390565b3480156106d057600080fd5b506104096106df3660046139a4565b611305565b6103c56106f23660046139d6565b61137c565b34801561070357600080fd5b506103dc611873565b34801561071857600080fd5b50610461610727366004613677565b611901565b34801561073857600080fd5b506103c5611988565b34801561074d57600080fd5b506103c56119be565b34801561076257600080fd5b506103c56107713660046139a4565b6119f0565b34801561078257600080fd5b506103c56107913660046139a4565b611a1f565b3480156107a257600080fd5b50600a546001600160a01b0316610409565b3480156107c057600080fd5b506103c56107cf3660046138ff565b611a4e565b3480156107e057600080fd5b506107f46107ef3660046139a4565b611acc565b60405161039c9190613dc5565b34801561080d57600080fd5b506103dc611b61565b34801561082257600080fd5b5061046160445481565b34801561083857600080fd5b506104616108473660046139a4565b60116020526000908152604090205481565b34801561086557600080fd5b506103c56108743660046137f6565b611b70565b34801561088557600080fd5b506103c5611c35565b34801561089a57600080fd5b506103c56108a9366004613776565b611d60565b3480156108ba57600080fd5b5061046166f6a11f484ec00081565b3480156108d557600080fd5b50610461600c5481565b3480156108eb57600080fd5b506103dc6108fa3660046139a4565b611d92565b34801561090b57600080fd5b50603854610409906001600160a01b031681565b34801561092b57600080fd5b5061093f61093a366004613677565b611e6d565b60405161039c9190613c96565b34801561095857600080fd5b5061046160405481565b34801561096e57600080fd5b5061099d61097d3660046139a4565b6010602052600090815260409020805460029091015460ff918216911682565b60408051921515835260ff90911660208301520161039c565b3480156109c257600080fd5b50603954610409906001600160a01b031681565b3480156109e257600080fd5b506103906109f13660046136b1565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b348015610a2b57600080fd5b506103c5610a3a366004613850565b611f0e565b348015610a4b57600080fd5b506103c5610a5a366004613677565b611f9d565b348015610a6b57600080fd5b506103c5610a7a366004613677565b611fea565b348015610a8b57600080fd5b506104617f000000000000000000000000000000000000000000000000000000000000000081565b60006001600160e01b0319821663780e9d6360e01b1480610ad85750610ad882612082565b92915050565b600a546001600160a01b03163314610b115760405162461bcd60e51b8152600401610b0890613d3f565b60405180910390fd5b8051610b2490600e906020840190613496565b5050565b606060008054610b3790613eed565b80601f0160208091040260200160405190810160405280929190818152602001828054610b6390613eed565b8015610bb05780601f10610b8557610100808354040283529160200191610bb0565b820191906000526020600020905b815481529060010190602001808311610b9357829003601f168201915b5050505050905090565b6000818152600260205260408120546001600160a01b0316610c335760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610b08565b506000908152600460205260409020546001600160a01b031690565b6000610c5a82611305565b9050806001600160a01b0316836001600160a01b03161415610cc85760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610b08565b336001600160a01b0382161480610ce45750610ce481336109f1565b610d565760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c00000000000000006064820152608401610b08565b610d6083836120d2565b505050565b60126020528160005260406000208181548110610d8157600080fd5b90600052602060002001600091509150505481565b600a546001600160a01b03163314610dc05760405162461bcd60e51b8152600401610b0890613d3f565b8015610dd157610dce612140565b50565b610dce6121e5565b6037546001600160a01b0316336001600160a01b031614610e1a57610dfe3382612269565b610e1a5760405162461bcd60e51b8152600401610b0890613d74565b610d60838383612360565b6000600c548211610e3857506000919050565b6005610e657f00000000000000000000000000000000000000000000000000000000000000006002613e67565b610e6f9190613e53565b8211610e86575069043c33c1937564800000919050565b6005610eb37f00000000000000000000000000000000000000000000000000000000000000006004613e67565b610ebd9190613e53565b8211610ed45750690878678326eac9000000919050565b506910f0cf064dd592000000919050565b6000610ef083611901565b8210610f525760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b6064820152608401610b08565b506001600160a01b03919091166000908152600660209081526040808320938352929052205490565b600a546001600160a01b03163314610fa55760405162461bcd60e51b8152600401610b0890613d3f565b603780546001600160a01b038086166001600160a01b031992831617909255603880548584169083161790556039805492841692909116919091179055610fea61250b565b50505050565b6013826012811061100057600080fd5b01818154811061100f57600080fd5b9060005260206000209060209182820401919006915091509054906101000a900460ff1681565b600a546001600160a01b031633146110605760405162461bcd60e51b8152600401610b0890613d3f565b600c55565b6025826012811061100057600080fd5b600a546001600160a01b0316331461109f5760405162461bcd60e51b8152600401610b0890613d3f565b600060646110ae47600a613e67565b6110b89190613e53565b905060006103e86110ca4760e1613e67565b6110d49190613e53565b905060006103e86110e64760e1613e67565b6110f09190613e53565b905060006103e86111024760e1613e67565b61110c9190613e53565b905060006103e861111e4760e1613e67565b6111289190613e53565b603a546040519192506001600160a01b03169086156108fc029087906000818181858888f19350505050158015611163573d6000803e3d6000fd5b50603b546040516001600160a01b039091169085156108fc029086906000818181858888f1935050505015801561119e573d6000803e3d6000fd5b50603c546040516001600160a01b039091169084156108fc029085906000818181858888f193505050501580156111d9573d6000803e3d6000fd5b50603d546040516001600160a01b039091169083156108fc029084906000818181858888f19350505050158015611214573d6000803e3d6000fd5b50603e546040516001600160a01b039091169082156108fc029083906000818181858888f1935050505015801561124f573d6000803e3d6000fd5b505050505050565b610d6083838360405180602001604052806000815250611d60565b600061127d60085490565b82106112e05760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b6064820152608401610b08565b600882815481106112f3576112f3613fd7565b90600052602060002001549050919050565b6000818152600260205260408120546001600160a01b031680610ad85760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b6064820152608401610b08565b600a54600160a01b900460ff16156113c95760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610b08565b333281146114045760405162461bcd60e51b81526020600482015260086024820152674f6e6c7920454f4160c01b6044820152606401610b08565b600d547f00000000000000000000000000000000000000000000000000000000000000009061143890859061ffff16613e16565b111561147a5760405162461bcd60e51b8152602060048201526011602482015270105b1b081d1bdad95b9cc81b5a5b9d1959607a1b6044820152606401610b08565b60008311801561148b5750600a8311155b6114cd5760405162461bcd60e51b8152602060048201526013602482015272125b9d985b1a59081b5a5b9d08185b5bdd5b9d606a1b6044820152606401610b08565b600c54600d5461ffff1610156115fe5760006114f08466f6a11f484ec000613e67565b6001600160a01b0383166000908152600f60205260409020549091506001141561154d5766f6a11f484ec000611527600186613e86565b6115319190613e67565b6001600160a01b0383166000908152600f602052604081205590505b600c54600d5461156290869061ffff16613e16565b11156115b05760405162461bcd60e51b815260206004820152601f60248201527f416c6c20746f6b656e73206f6e2d73616c6520616c726561647920736f6c64006044820152606401610b08565b3481146115f85760405162461bcd60e51b8152602060048201526016602482015275125b9d985b1a59081c185e5b595b9d08185b5bdd5b9d60521b6044820152606401610b08565b50611609565b341561160957600080fd5b6000808361162557604080516000815260208101909152611669565b8467ffffffffffffffff81111561163e5761163e613fed565b604051908082528060200260200182016040528015611667578160200160208202803683370190505b505b90506000805b8681101561179357600d805461ffff1690600061168b83613f22565b82546101009290920a61ffff818102199093169183160217909155600d546116b4925016612646565b600d549092506116c89061ffff16836126ae565b5060006116d483612795565b90508615806116f55750856001600160a01b0316816001600160a01b031614155b1561171157600d5461170c90829061ffff1661285f565b611763565b603754600d5461172e916001600160a01b03169061ffff1661285f565b600d54845161ffff9091169085908490811061174c5761174c613fd7565b602002602001019061ffff16908161ffff16815250505b600d546117739061ffff16610e25565b61177d9086613e16565b945050808061178b90613f44565b91505061166f565b50821561180157603854604051632770a7eb60e21b81526001600160a01b0386811660048301526024820186905290911690639dc29fac90604401600060405180830381600087803b1580156117e857600080fd5b505af11580156117fc573d6000803e3d6000fd5b505050505b841561124f57603754604051638a46fe7b60e01b81526001600160a01b0390911690638a46fe7b906118399087908690600401613c0c565b600060405180830381600087803b15801561185357600080fd5b505af1158015611867573d6000803e3d6000fd5b50505050505050505050565b600e805461188090613eed565b80601f01602080910402602001604051908101604052809291908181526020018280546118ac90613eed565b80156118f95780601f106118ce576101008083540402835291602001916118f9565b820191906000526020600020905b8154815290600101906020018083116118dc57829003601f168201915b505050505081565b60006001600160a01b03821661196c5760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b6064820152608401610b08565b506001600160a01b031660009081526003602052604090205490565b600a546001600160a01b031633146119b25760405162461bcd60e51b8152600401610b0890613d3f565b6119bc6000612879565b565b600a546001600160a01b031633146119e85760405162461bcd60e51b8152600401610b0890613d3f565b610dce61250b565b600a546001600160a01b03163314611a1a5760405162461bcd60e51b8152600401610b0890613d3f565b604455565b600a546001600160a01b03163314611a495760405162461bcd60e51b8152600401610b0890613d3f565b604055565b336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614611ac65760405162461bcd60e51b815260206004820152601f60248201527f4f6e6c7920565246436f6f7264696e61746f722063616e2066756c66696c6c006044820152606401610b08565b60425550565b611ad461351a565b60008281526010602090815260408083208151606081018352815460ff161515815282516101c08101938490529094919385019290916001850191600e918390855b825461010083900a900460ff16815260206001928301818104948501949093039092029101808411611b16575050509284525050506002919091015460ff1660209091015292915050565b606060018054610b3790613eed565b6001600160a01b038216331415611bc95760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610b08565b3360008181526005602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b600a546001600160a01b03163314611c5f5760405162461bcd60e51b8152600401610b0890613d3f565b6043546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a082319060240160206040518083038186803b158015611ca357600080fd5b505afa158015611cb7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cdb91906139bd565b60435460405163a9059cbb60e01b8152336004820152602481018390529192506001600160a01b03169063a9059cbb90604401602060405180830381600087803b158015611d2857600080fd5b505af1158015611d3c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b2491906138e2565b611d6a3383612269565b611d865760405162461bcd60e51b8152600401610b0890613d74565b610fea848484846128cb565b6000818152600260205260409020546060906001600160a01b0316611e115760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b6064820152608401610b08565b6000611e1b6128fe565b90506000815111611e3b5760405180602001604052806000815250611e66565b80611e458461290d565b604051602001611e56929190613ba0565b6040516020818303038152906040525b9392505050565b6060611e7882611901565b67ffffffffffffffff811115611e9057611e90613fed565b604051908082528060200260200182016040528015611eb9578160200160208202803683370190505b50905060005b611ec883611901565b811015611f0857611ed98382610ee5565b828281518110611eeb57611eeb613fd7565b602090810291909101015280611f0081613f44565b915050611ebf565b50919050565b600a546001600160a01b03163314611f385760405162461bcd60e51b8152600401610b0890613d3f565b8060005b81811015610fea576001600f6000868685818110611f5c57611f5c613fd7565b9050602002016020810190611f719190613677565b6001600160a01b0316815260208101919091526040016000205580611f9581613f44565b915050611f3c565b600a546001600160a01b03163314611fc75760405162461bcd60e51b8152600401610b0890613d3f565b603780546001600160a01b0319166001600160a01b038316179055610b2461250b565b600a546001600160a01b031633146120145760405162461bcd60e51b8152600401610b0890613d3f565b6001600160a01b0381166120795760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610b08565b610dce81612879565b60006001600160e01b031982166380ac58cd60e01b14806120b357506001600160e01b03198216635b5e139f60e01b145b80610ad857506301ffc9a760e01b6001600160e01b0319831614610ad8565b600081815260046020526040902080546001600160a01b0319166001600160a01b038416908117909155819061210782611305565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600a54600160a01b900460ff161561218d5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610b08565b600a805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586121c83390565b6040516001600160a01b03909116815260200160405180910390a1565b600a54600160a01b900460ff166122355760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610b08565b600a805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa336121c8565b6000818152600260205260408120546001600160a01b03166122e25760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610b08565b60006122ed83611305565b9050806001600160a01b0316846001600160a01b031614806123285750836001600160a01b031661231d84610bba565b6001600160a01b0316145b8061235857506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b949350505050565b826001600160a01b031661237382611305565b6001600160a01b0316146123db5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201526839903737ba1037bbb760b91b6064820152608401610b08565b6001600160a01b03821661243d5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610b08565b612448838383612a0b565b6124536000826120d2565b6001600160a01b038316600090815260036020526040812080546001929061247c908490613e86565b90915550506001600160a01b03821660009081526003602052604081208054600192906124aa908490613e16565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b600060445461251960455490565b116125325761252c604580546001019055565b50600090565b6040805490516370a0823160e01b81523060048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a082319060240160206040518083038186803b15801561259457600080fd5b505afa1580156125a8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125cc91906139bd565b101561262e5760405162461bcd60e51b815260206004820152602b60248201527f4e6f7420656e6f756768204c494e4b202d2066696c6c20636f6e74726163742060448201526a1dda5d1a0819985d58d95d60aa1b6064820152608401610b08565b6000604555612641603f54604054612ac3565b905090565b600032612654600143613e86565b60425460405160609390931b6bffffffffffffffffffffffff191660208401529040603483015242605483015260748201849052609482015260b40160408051601f19818403018152919052805160209091012092915050565b6126b661351a565b6126be61250b565b506126c882612c4e565b9050601160006126e5836000015184602001518560400151612ef9565b815260200190815260200160002054600014156127835760008381526010602090815260409091208251815460ff191690151517815590820151829190612732906001830190600e613543565b50604091820151600291909101805460ff191660ff9092169190911790558151602083015191830151859260119260009261276d9290612ef9565b8152602081019190915260400160002055610ad8565b611e668361279084612646565b6126ae565b600c54600d5460009161ffff9091161115806127be57506127bb600a60f584901c613f5f565b15155b156127c95733610ad8565b60375460405163e0898f3160e01b8152609084901c60048201526000916001600160a01b03169063e0898f319060240160206040518083038186803b15801561281157600080fd5b505afa158015612825573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128499190613694565b90506001600160a01b038116610ad85733611e66565b610b24828260405180602001604052806000815250612f9c565b600a80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6128d6848484612360565b6128e284848484612fcf565b610fea5760405162461bcd60e51b8152600401610b0890613ced565b6060600e8054610b3790613eed565b6060816129315750506040805180820190915260018152600360fc1b602082015290565b8160005b811561295b578061294581613f44565b91506129549050600a83613e53565b9150612935565b60008167ffffffffffffffff81111561297657612976613fed565b6040519080825280601f01601f1916602001820160405280156129a0576020820181803683370190505b5090505b8415612358576129b5600183613e86565b91506129c2600a86613f5f565b6129cd906030613e16565b60f81b8183815181106129e2576129e2613fd7565b60200101906001600160f81b031916908160001a905350612a04600a86613e53565b94506129a4565b6001600160a01b038316612a6657612a6181600880546000838152600960205260408120829055600182018355919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30155565b612a89565b816001600160a01b0316836001600160a01b031614612a8957612a8983826130dc565b6001600160a01b038216612aa057610d6081613179565b826001600160a01b0316826001600160a01b031614610d6057610d608282613228565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316634000aea07f000000000000000000000000000000000000000000000000000000000000000084866000604051602001612b33929190918252602082015260400190565b6040516020818303038152906040526040518463ffffffff1660e01b8152600401612b6093929190613c66565b602060405180830381600087803b158015612b7a57600080fd5b505af1158015612b8e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612bb291906138e2565b506000838152600b6020818152604080842054815180840189905280830186905230606082015260808082018390528351808303909101815260a090910190925281519183019190912093879052919052612c0e906001613e16565b6000858152600b60205260409020556123588482604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b612c5661351a565b612c65600a61ffff8416613f5f565b1515808252600090612c78576009612c7b565b60005b825160109490941c9390915015612e1457612ca461ffff8416612c9f836000613e2e565b61326c565b602083015160ff91909116905260109290921c91612ccb61ffff8416612c9f836001613e2e565b60208381015160ff9290921691015260109290921c91612cf461ffff8416612c9f836002613e2e565b602083015160ff9190911660409091015260109290921c91612d1f61ffff8416612c9f836003613e2e565b602083015160ff9190911660609091015260109290921c91612d4a61ffff8416612c9f836004613e2e565b602083015160ff9190911660809091015260109290921c91612d7561ffff8416612c9f836005613e2e565b602083015160ff9190911660a09091015260109290921c91612da061ffff8416612c9f836006613e2e565b602083015160ff9190911660c09091015260109290921c91612dcb61ffff8416612c9f836007613e2e565b602083015160ff9190911660e09091015260109290921c91612df661ffff8416612c9f836008613e2e565b602083015160ff919091166101009091015260006040830152611f08565b612e2761ffff8416612c9f836000613e2e565b602083015160ff919091166101209091015260109290921c91612e5361ffff8416612c9f836001613e2e565b602083015160ff919091166101409091015260109290921c91612e7f61ffff8416612c9f836002613e2e565b602083015160ff919091166101609091015260109290921c91612eab61ffff8416612c9f836003613e2e565b602083015160ff919091166101809091015260109290921c91612ed761ffff8416612c9f836004613e2e565b60208301805160ff9283166101a0918201529051015116604083015250919050565b60008315612f625782516020808501516040808701516060880151608089015160a08a015160c08b015160e08c01516101008d01519651612f439a60019a909998918e9101613adb565b604051602081830303815290604052612f5b90613e9d565b9050611e66565b6101208301516101408401516101608501516101808601516101a0870151604051612f439560009590949093909290918990602001613a38565b612fa68383613348565b612fb36000848484612fcf565b610d605760405162461bcd60e51b8152600401610b0890613ced565b60006001600160a01b0384163b156130d157604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290613013903390899088908890600401613bcf565b602060405180830381600087803b15801561302d57600080fd5b505af192505050801561305d575060408051601f3d908101601f1916820190925261305a9181019061393e565b60015b6130b7573d80801561308b576040519150601f19603f3d011682016040523d82523d6000602084013e613090565b606091505b5080516130af5760405162461bcd60e51b8152600401610b0890613ced565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050612358565b506001949350505050565b600060016130e984611901565b6130f39190613e86565b600083815260076020526040902054909150808214613146576001600160a01b03841660009081526006602090815260408083208584528252808320548484528184208190558352600790915290208190555b5060009182526007602090815260408084208490556001600160a01b039094168352600681528383209183525290812055565b60085460009061318b90600190613e86565b600083815260096020526040812054600880549394509092849081106131b3576131b3613fd7565b9060005260206000200154905080600883815481106131d4576131d4613fd7565b600091825260208083209091019290925582815260099091526040808220849055858252812055600880548061320c5761320c613fc1565b6001900381819060005260206000200160009055905550505050565b600061323383611901565b6001600160a01b039093166000908152600660209081526040808320868452825280832085905593825260079052919091209190915550565b60008060138360ff166012811061328557613285613fd7565b01546132919085613f73565b905060138360ff16601281106132a9576132a9613fd7565b018160ff16815481106132be576132be613fd7565b60009182526020918290209181049091015460ff601f9092166101000a90048116600886901c90911610156132f4579050610ad8565b60258360ff166012811061330a5761330a613fd7565b018160ff168154811061331f5761331f613fd7565b90600052602060002090602091828204019190069054906101000a900460ff1691505092915050565b6001600160a01b03821661339e5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610b08565b6000818152600260205260409020546001600160a01b0316156134035760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610b08565b61340f60008383612a0b565b6001600160a01b0382166000908152600360205260408120805460019290613438908490613e16565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b8280546134a290613eed565b90600052602060002090601f0160209004810192826134c4576000855561350a565b82601f106134dd57805160ff191683800117855561350a565b8280016001018555821561350a579182015b8281111561350a5782518255916020019190600101906134ef565b506135169291506135cd565b5090565b60405180606001604052806000151581526020016135366135e2565b8152600060209091015290565b60018301918390821561350a5791602002820160005b8382111561359757835183826101000a81548160ff021916908360ff1602179055509260200192600101602081600001049283019260010302613559565b80156135c45782816101000a81549060ff0219169055600101602081600001049283019260010302613597565b50506135169291505b5b8082111561351657600081556001016135ce565b604051806101c00160405280600e906020820280368337509192915050565b600067ffffffffffffffff8084111561361c5761361c613fed565b604051601f8501601f19908116603f0116810190828211818310171561364457613644613fed565b8160405280935085815286868601111561365d57600080fd5b858560208301376000602087830101525050509392505050565b60006020828403121561368957600080fd5b8135611e6681614003565b6000602082840312156136a657600080fd5b8151611e6681614003565b600080604083850312156136c457600080fd5b82356136cf81614003565b915060208301356136df81614003565b809150509250929050565b6000806000606084860312156136ff57600080fd5b833561370a81614003565b9250602084013561371a81614003565b9150604084013561372a81614003565b809150509250925092565b60008060006060848603121561374a57600080fd5b833561375581614003565b9250602084013561376581614003565b929592945050506040919091013590565b6000806000806080858703121561378c57600080fd5b843561379781614003565b935060208501356137a781614003565b925060408501359150606085013567ffffffffffffffff8111156137ca57600080fd5b8501601f810187136137db57600080fd5b6137ea87823560208401613601565b91505092959194509250565b6000806040838503121561380957600080fd5b823561381481614003565b915060208301356136df81614018565b6000806040838503121561383757600080fd5b823561384281614003565b946020939093013593505050565b6000806020838503121561386357600080fd5b823567ffffffffffffffff8082111561387b57600080fd5b818501915085601f83011261388f57600080fd5b81358181111561389e57600080fd5b8660208260051b85010111156138b357600080fd5b60209290920196919550909350505050565b6000602082840312156138d757600080fd5b8135611e6681614018565b6000602082840312156138f457600080fd5b8151611e6681614018565b6000806040838503121561391257600080fd5b50508035926020909101359150565b60006020828403121561393357600080fd5b8135611e6681614026565b60006020828403121561395057600080fd5b8151611e6681614026565b60006020828403121561396d57600080fd5b813567ffffffffffffffff81111561398457600080fd5b8201601f8101841361399557600080fd5b61235884823560208401613601565b6000602082840312156139b657600080fd5b5035919050565b6000602082840312156139cf57600080fd5b5051919050565b600080604083850312156139e957600080fd5b8235915060208301356136df81614018565b60008151808452613a13816020860160208601613ec1565b601f01601f19169290920160200192915050565b60f81b6001600160f81b0319169052565b87151560f81b81526000600360fc1b80600184015280600284015280600384015280600484015280600584015280600684015280600784015280600884015280600984015250613a8b600a830189613a27565b613a98600b830188613a27565b613aa5600c830187613a27565b613ab2600d830186613a27565b613abf600e830185613a27565b613acc600f830184613a27565b50601001979650505050505050565b8b151560f81b8152600060ff60f81b808d60f81b166001840152808c60f81b16600284015250613b0e600383018b613a27565b613b1b600483018a613a27565b613b286005830189613a27565b613b356006830188613a27565b613b426007830187613a27565b613b4f6008830186613a27565b613b5c6009830185613a27565b600360fc1b600a830152613b82613b758080600b860181565b600360fc1b815260010190565b613b8c8185613a27565b6001019d9c50505050505050505050505050565b60008351613bb2818460208801613ec1565b835190830190613bc6818360208801613ec1565b01949350505050565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090613c02908301846139fb565b9695505050505050565b6001600160a01b038316815260406020808301829052835191830182905260009184820191906060850190845b81811015613c5957845161ffff1683529383019391830191600101613c39565b5090979650505050505050565b60018060a01b0384168152826020820152606060408201526000613c8d60608301846139fb565b95945050505050565b6020808252825182820181905260009190848201906040850190845b81811015613cce57835183529284019291840191600101613cb2565b50909695505050505050565b602081526000611e6660208301846139fb565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b8151151581526020808301516102008301919081840160005b600e811015613dfe57825160ff1682529183019190830190600101613dde565b5050505060ff6040840151166101e083015292915050565b60008219821115613e2957613e29613f95565b500190565b600060ff821660ff84168060ff03821115613e4b57613e4b613f95565b019392505050565b600082613e6257613e62613fab565b500490565b6000816000190483118215151615613e8157613e81613f95565b500290565b600082821015613e9857613e98613f95565b500390565b80516020808301519190811015611f085760001960209190910360031b1b16919050565b60005b83811015613edc578181015183820152602001613ec4565b83811115610fea5750506000910152565b600181811c90821680613f0157607f821691505b60208210811415611f0857634e487b7160e01b600052602260045260246000fd5b600061ffff80831681811415613f3a57613f3a613f95565b6001019392505050565b6000600019821415613f5857613f58613f95565b5060010190565b600082613f6e57613f6e613fab565b500690565b600060ff831680613f8657613f86613fab565b8060ff84160691505092915050565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114610dce57600080fd5b8015158114610dce57600080fd5b6001600160e01b031981168114610dce57600080fdfea2646970667358221220f9be3a0629d522bf2977c0a19ea56dcad1960171b322e432a69de8f87e77093564736f6c63430008070033000000000000000000000000f422b6f41a14fb74b21cb95a8d82971a3b527117000000000000000000000000000000000000000000000000000000000000c350000000000000000000000000f0d54349addcf704f77ae15b96510dea15cb7952000000000000000000000000514910771af9ca656af840dff83e8264ecf986ca
Deployed Bytecode
0x60806040526004361061036b5760003560e01c80636c0360eb116101c6578063b88d4fde116100f7578063e05c57bf11610095578063edac985b1161006f578063edac985b14610a1f578063f024747814610a3f578063f2fde38b14610a5f578063f47c84c514610a7f57600080fd5b8063e05c57bf14610962578063e1fc334f146109b6578063e985e9c5146109d657600080fd5b8063c87b56dd116100d1578063c87b56dd146108df578063cc1dda0f146108ff578063d004b0361461091f578063ddca3f431461094c57600080fd5b8063b88d4fde1461088e578063c002d23d146108ae578063c084f540146108c957600080fd5b806394985ddd1161016457806399e4d8ef1161013e57806399e4d8ef14610816578063a1b8f3741461082c578063a22cb46514610859578063adc2112f1461087957600080fd5b806394985ddd146107b457806394e56847146107d457806395d89b411461080157600080fd5b80637a98a82a116101a05780637a98a82a1461074157806383a3af5314610756578063873efeff146107765780638da5cb5b1461079657600080fd5b80636c0360eb146106f757806370a082311461070c578063715018a61461072c57600080fd5b80633431a753116102a05780634f6ccce71161023e57806357970e931161021857806357970e93146106855780635c975abb146106a55780636352211e146106c457806367f68fac146106e457600080fd5b80634f6ccce71461064e57806355f804b3146103a5578063568303ca1461066e57600080fd5b80633d955a701161027a5780633d955a70146105cb5780634018b1f8146105eb57806342842e0e146106005780634f02c4201461062057600080fd5b80633431a7531461058357806336838391146105a35780633ccfd60b146105c357600080fd5b806318160ddd1161030d57806327de8f27116102e757806327de8f27146104f15780632f745c59146105115780632fb641c91461053157806333df4b2c1461055157600080fd5b806318160ddd1461048f5780631e7be210146104a457806323b872dd146104d157600080fd5b8063081812fc11610349578063081812fc146103e9578063095ea7b314610421578063109b1ee61461044157806316c38b3c1461046f57600080fd5b806301ffc9a71461037057806302fe5305146103a557806306fdde03146103c7575b600080fd5b34801561037c57600080fd5b5061039061038b366004613921565b610ab3565b60405190151581526020015b60405180910390f35b3480156103b157600080fd5b506103c56103c036600461395b565b610ade565b005b3480156103d357600080fd5b506103dc610b28565b60405161039c9190613cda565b3480156103f557600080fd5b506104096104043660046139a4565b610bba565b6040516001600160a01b03909116815260200161039c565b34801561042d57600080fd5b506103c561043c366004613824565b610c4f565b34801561044d57600080fd5b5061046161045c366004613824565b610d65565b60405190815260200161039c565b34801561047b57600080fd5b506103c561048a3660046138c5565b610d96565b34801561049b57600080fd5b50600854610461565b3480156104b057600080fd5b506104616104bf366004613677565b600f6020526000908152604090205481565b3480156104dd57600080fd5b506103c56104ec366004613735565b610dd9565b3480156104fd57600080fd5b5061046161050c3660046139a4565b610e25565b34801561051d57600080fd5b5061046161052c366004613824565b610ee5565b34801561053d57600080fd5b506103c561054c3660046136ea565b610f7b565b34801561055d57600080fd5b5061057161056c3660046138ff565b610ff0565b60405160ff909116815260200161039c565b34801561058f57600080fd5b506103c561059e3660046139a4565b611036565b3480156105af57600080fd5b506105716105be3660046138ff565b611065565b6103c5611075565b3480156105d757600080fd5b50603754610409906001600160a01b031681565b3480156105f757600080fd5b50600c54610461565b34801561060c57600080fd5b506103c561061b366004613735565b611257565b34801561062c57600080fd5b50600d5461063b9061ffff1681565b60405161ffff909116815260200161039c565b34801561065a57600080fd5b506104616106693660046139a4565b611272565b34801561067a57600080fd5b506045546104619081565b34801561069157600080fd5b50604354610409906001600160a01b031681565b3480156106b157600080fd5b50600a54600160a01b900460ff16610390565b3480156106d057600080fd5b506104096106df3660046139a4565b611305565b6103c56106f23660046139d6565b61137c565b34801561070357600080fd5b506103dc611873565b34801561071857600080fd5b50610461610727366004613677565b611901565b34801561073857600080fd5b506103c5611988565b34801561074d57600080fd5b506103c56119be565b34801561076257600080fd5b506103c56107713660046139a4565b6119f0565b34801561078257600080fd5b506103c56107913660046139a4565b611a1f565b3480156107a257600080fd5b50600a546001600160a01b0316610409565b3480156107c057600080fd5b506103c56107cf3660046138ff565b611a4e565b3480156107e057600080fd5b506107f46107ef3660046139a4565b611acc565b60405161039c9190613dc5565b34801561080d57600080fd5b506103dc611b61565b34801561082257600080fd5b5061046160445481565b34801561083857600080fd5b506104616108473660046139a4565b60116020526000908152604090205481565b34801561086557600080fd5b506103c56108743660046137f6565b611b70565b34801561088557600080fd5b506103c5611c35565b34801561089a57600080fd5b506103c56108a9366004613776565b611d60565b3480156108ba57600080fd5b5061046166f6a11f484ec00081565b3480156108d557600080fd5b50610461600c5481565b3480156108eb57600080fd5b506103dc6108fa3660046139a4565b611d92565b34801561090b57600080fd5b50603854610409906001600160a01b031681565b34801561092b57600080fd5b5061093f61093a366004613677565b611e6d565b60405161039c9190613c96565b34801561095857600080fd5b5061046160405481565b34801561096e57600080fd5b5061099d61097d3660046139a4565b6010602052600090815260409020805460029091015460ff918216911682565b60408051921515835260ff90911660208301520161039c565b3480156109c257600080fd5b50603954610409906001600160a01b031681565b3480156109e257600080fd5b506103906109f13660046136b1565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b348015610a2b57600080fd5b506103c5610a3a366004613850565b611f0e565b348015610a4b57600080fd5b506103c5610a5a366004613677565b611f9d565b348015610a6b57600080fd5b506103c5610a7a366004613677565b611fea565b348015610a8b57600080fd5b506104617f000000000000000000000000000000000000000000000000000000000000c35081565b60006001600160e01b0319821663780e9d6360e01b1480610ad85750610ad882612082565b92915050565b600a546001600160a01b03163314610b115760405162461bcd60e51b8152600401610b0890613d3f565b60405180910390fd5b8051610b2490600e906020840190613496565b5050565b606060008054610b3790613eed565b80601f0160208091040260200160405190810160405280929190818152602001828054610b6390613eed565b8015610bb05780601f10610b8557610100808354040283529160200191610bb0565b820191906000526020600020905b815481529060010190602001808311610b9357829003601f168201915b5050505050905090565b6000818152600260205260408120546001600160a01b0316610c335760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610b08565b506000908152600460205260409020546001600160a01b031690565b6000610c5a82611305565b9050806001600160a01b0316836001600160a01b03161415610cc85760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610b08565b336001600160a01b0382161480610ce45750610ce481336109f1565b610d565760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c00000000000000006064820152608401610b08565b610d6083836120d2565b505050565b60126020528160005260406000208181548110610d8157600080fd5b90600052602060002001600091509150505481565b600a546001600160a01b03163314610dc05760405162461bcd60e51b8152600401610b0890613d3f565b8015610dd157610dce612140565b50565b610dce6121e5565b6037546001600160a01b0316336001600160a01b031614610e1a57610dfe3382612269565b610e1a5760405162461bcd60e51b8152600401610b0890613d74565b610d60838383612360565b6000600c548211610e3857506000919050565b6005610e657f000000000000000000000000000000000000000000000000000000000000c3506002613e67565b610e6f9190613e53565b8211610e86575069043c33c1937564800000919050565b6005610eb37f000000000000000000000000000000000000000000000000000000000000c3506004613e67565b610ebd9190613e53565b8211610ed45750690878678326eac9000000919050565b506910f0cf064dd592000000919050565b6000610ef083611901565b8210610f525760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b6064820152608401610b08565b506001600160a01b03919091166000908152600660209081526040808320938352929052205490565b600a546001600160a01b03163314610fa55760405162461bcd60e51b8152600401610b0890613d3f565b603780546001600160a01b038086166001600160a01b031992831617909255603880548584169083161790556039805492841692909116919091179055610fea61250b565b50505050565b6013826012811061100057600080fd5b01818154811061100f57600080fd5b9060005260206000209060209182820401919006915091509054906101000a900460ff1681565b600a546001600160a01b031633146110605760405162461bcd60e51b8152600401610b0890613d3f565b600c55565b6025826012811061100057600080fd5b600a546001600160a01b0316331461109f5760405162461bcd60e51b8152600401610b0890613d3f565b600060646110ae47600a613e67565b6110b89190613e53565b905060006103e86110ca4760e1613e67565b6110d49190613e53565b905060006103e86110e64760e1613e67565b6110f09190613e53565b905060006103e86111024760e1613e67565b61110c9190613e53565b905060006103e861111e4760e1613e67565b6111289190613e53565b603a546040519192506001600160a01b03169086156108fc029087906000818181858888f19350505050158015611163573d6000803e3d6000fd5b50603b546040516001600160a01b039091169085156108fc029086906000818181858888f1935050505015801561119e573d6000803e3d6000fd5b50603c546040516001600160a01b039091169084156108fc029085906000818181858888f193505050501580156111d9573d6000803e3d6000fd5b50603d546040516001600160a01b039091169083156108fc029084906000818181858888f19350505050158015611214573d6000803e3d6000fd5b50603e546040516001600160a01b039091169082156108fc029083906000818181858888f1935050505015801561124f573d6000803e3d6000fd5b505050505050565b610d6083838360405180602001604052806000815250611d60565b600061127d60085490565b82106112e05760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b6064820152608401610b08565b600882815481106112f3576112f3613fd7565b90600052602060002001549050919050565b6000818152600260205260408120546001600160a01b031680610ad85760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b6064820152608401610b08565b600a54600160a01b900460ff16156113c95760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610b08565b333281146114045760405162461bcd60e51b81526020600482015260086024820152674f6e6c7920454f4160c01b6044820152606401610b08565b600d547f000000000000000000000000000000000000000000000000000000000000c3509061143890859061ffff16613e16565b111561147a5760405162461bcd60e51b8152602060048201526011602482015270105b1b081d1bdad95b9cc81b5a5b9d1959607a1b6044820152606401610b08565b60008311801561148b5750600a8311155b6114cd5760405162461bcd60e51b8152602060048201526013602482015272125b9d985b1a59081b5a5b9d08185b5bdd5b9d606a1b6044820152606401610b08565b600c54600d5461ffff1610156115fe5760006114f08466f6a11f484ec000613e67565b6001600160a01b0383166000908152600f60205260409020549091506001141561154d5766f6a11f484ec000611527600186613e86565b6115319190613e67565b6001600160a01b0383166000908152600f602052604081205590505b600c54600d5461156290869061ffff16613e16565b11156115b05760405162461bcd60e51b815260206004820152601f60248201527f416c6c20746f6b656e73206f6e2d73616c6520616c726561647920736f6c64006044820152606401610b08565b3481146115f85760405162461bcd60e51b8152602060048201526016602482015275125b9d985b1a59081c185e5b595b9d08185b5bdd5b9d60521b6044820152606401610b08565b50611609565b341561160957600080fd5b6000808361162557604080516000815260208101909152611669565b8467ffffffffffffffff81111561163e5761163e613fed565b604051908082528060200260200182016040528015611667578160200160208202803683370190505b505b90506000805b8681101561179357600d805461ffff1690600061168b83613f22565b82546101009290920a61ffff818102199093169183160217909155600d546116b4925016612646565b600d549092506116c89061ffff16836126ae565b5060006116d483612795565b90508615806116f55750856001600160a01b0316816001600160a01b031614155b1561171157600d5461170c90829061ffff1661285f565b611763565b603754600d5461172e916001600160a01b03169061ffff1661285f565b600d54845161ffff9091169085908490811061174c5761174c613fd7565b602002602001019061ffff16908161ffff16815250505b600d546117739061ffff16610e25565b61177d9086613e16565b945050808061178b90613f44565b91505061166f565b50821561180157603854604051632770a7eb60e21b81526001600160a01b0386811660048301526024820186905290911690639dc29fac90604401600060405180830381600087803b1580156117e857600080fd5b505af11580156117fc573d6000803e3d6000fd5b505050505b841561124f57603754604051638a46fe7b60e01b81526001600160a01b0390911690638a46fe7b906118399087908690600401613c0c565b600060405180830381600087803b15801561185357600080fd5b505af1158015611867573d6000803e3d6000fd5b50505050505050505050565b600e805461188090613eed565b80601f01602080910402602001604051908101604052809291908181526020018280546118ac90613eed565b80156118f95780601f106118ce576101008083540402835291602001916118f9565b820191906000526020600020905b8154815290600101906020018083116118dc57829003601f168201915b505050505081565b60006001600160a01b03821661196c5760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b6064820152608401610b08565b506001600160a01b031660009081526003602052604090205490565b600a546001600160a01b031633146119b25760405162461bcd60e51b8152600401610b0890613d3f565b6119bc6000612879565b565b600a546001600160a01b031633146119e85760405162461bcd60e51b8152600401610b0890613d3f565b610dce61250b565b600a546001600160a01b03163314611a1a5760405162461bcd60e51b8152600401610b0890613d3f565b604455565b600a546001600160a01b03163314611a495760405162461bcd60e51b8152600401610b0890613d3f565b604055565b336001600160a01b037f000000000000000000000000f0d54349addcf704f77ae15b96510dea15cb79521614611ac65760405162461bcd60e51b815260206004820152601f60248201527f4f6e6c7920565246436f6f7264696e61746f722063616e2066756c66696c6c006044820152606401610b08565b60425550565b611ad461351a565b60008281526010602090815260408083208151606081018352815460ff161515815282516101c08101938490529094919385019290916001850191600e918390855b825461010083900a900460ff16815260206001928301818104948501949093039092029101808411611b16575050509284525050506002919091015460ff1660209091015292915050565b606060018054610b3790613eed565b6001600160a01b038216331415611bc95760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610b08565b3360008181526005602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b600a546001600160a01b03163314611c5f5760405162461bcd60e51b8152600401610b0890613d3f565b6043546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a082319060240160206040518083038186803b158015611ca357600080fd5b505afa158015611cb7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cdb91906139bd565b60435460405163a9059cbb60e01b8152336004820152602481018390529192506001600160a01b03169063a9059cbb90604401602060405180830381600087803b158015611d2857600080fd5b505af1158015611d3c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b2491906138e2565b611d6a3383612269565b611d865760405162461bcd60e51b8152600401610b0890613d74565b610fea848484846128cb565b6000818152600260205260409020546060906001600160a01b0316611e115760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b6064820152608401610b08565b6000611e1b6128fe565b90506000815111611e3b5760405180602001604052806000815250611e66565b80611e458461290d565b604051602001611e56929190613ba0565b6040516020818303038152906040525b9392505050565b6060611e7882611901565b67ffffffffffffffff811115611e9057611e90613fed565b604051908082528060200260200182016040528015611eb9578160200160208202803683370190505b50905060005b611ec883611901565b811015611f0857611ed98382610ee5565b828281518110611eeb57611eeb613fd7565b602090810291909101015280611f0081613f44565b915050611ebf565b50919050565b600a546001600160a01b03163314611f385760405162461bcd60e51b8152600401610b0890613d3f565b8060005b81811015610fea576001600f6000868685818110611f5c57611f5c613fd7565b9050602002016020810190611f719190613677565b6001600160a01b0316815260208101919091526040016000205580611f9581613f44565b915050611f3c565b600a546001600160a01b03163314611fc75760405162461bcd60e51b8152600401610b0890613d3f565b603780546001600160a01b0319166001600160a01b038316179055610b2461250b565b600a546001600160a01b031633146120145760405162461bcd60e51b8152600401610b0890613d3f565b6001600160a01b0381166120795760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610b08565b610dce81612879565b60006001600160e01b031982166380ac58cd60e01b14806120b357506001600160e01b03198216635b5e139f60e01b145b80610ad857506301ffc9a760e01b6001600160e01b0319831614610ad8565b600081815260046020526040902080546001600160a01b0319166001600160a01b038416908117909155819061210782611305565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600a54600160a01b900460ff161561218d5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610b08565b600a805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586121c83390565b6040516001600160a01b03909116815260200160405180910390a1565b600a54600160a01b900460ff166122355760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610b08565b600a805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa336121c8565b6000818152600260205260408120546001600160a01b03166122e25760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610b08565b60006122ed83611305565b9050806001600160a01b0316846001600160a01b031614806123285750836001600160a01b031661231d84610bba565b6001600160a01b0316145b8061235857506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b949350505050565b826001600160a01b031661237382611305565b6001600160a01b0316146123db5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201526839903737ba1037bbb760b91b6064820152608401610b08565b6001600160a01b03821661243d5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610b08565b612448838383612a0b565b6124536000826120d2565b6001600160a01b038316600090815260036020526040812080546001929061247c908490613e86565b90915550506001600160a01b03821660009081526003602052604081208054600192906124aa908490613e16565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b600060445461251960455490565b116125325761252c604580546001019055565b50600090565b6040805490516370a0823160e01b81523060048201527f000000000000000000000000514910771af9ca656af840dff83e8264ecf986ca6001600160a01b0316906370a082319060240160206040518083038186803b15801561259457600080fd5b505afa1580156125a8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125cc91906139bd565b101561262e5760405162461bcd60e51b815260206004820152602b60248201527f4e6f7420656e6f756768204c494e4b202d2066696c6c20636f6e74726163742060448201526a1dda5d1a0819985d58d95d60aa1b6064820152608401610b08565b6000604555612641603f54604054612ac3565b905090565b600032612654600143613e86565b60425460405160609390931b6bffffffffffffffffffffffff191660208401529040603483015242605483015260748201849052609482015260b40160408051601f19818403018152919052805160209091012092915050565b6126b661351a565b6126be61250b565b506126c882612c4e565b9050601160006126e5836000015184602001518560400151612ef9565b815260200190815260200160002054600014156127835760008381526010602090815260409091208251815460ff191690151517815590820151829190612732906001830190600e613543565b50604091820151600291909101805460ff191660ff9092169190911790558151602083015191830151859260119260009261276d9290612ef9565b8152602081019190915260400160002055610ad8565b611e668361279084612646565b6126ae565b600c54600d5460009161ffff9091161115806127be57506127bb600a60f584901c613f5f565b15155b156127c95733610ad8565b60375460405163e0898f3160e01b8152609084901c60048201526000916001600160a01b03169063e0898f319060240160206040518083038186803b15801561281157600080fd5b505afa158015612825573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128499190613694565b90506001600160a01b038116610ad85733611e66565b610b24828260405180602001604052806000815250612f9c565b600a80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6128d6848484612360565b6128e284848484612fcf565b610fea5760405162461bcd60e51b8152600401610b0890613ced565b6060600e8054610b3790613eed565b6060816129315750506040805180820190915260018152600360fc1b602082015290565b8160005b811561295b578061294581613f44565b91506129549050600a83613e53565b9150612935565b60008167ffffffffffffffff81111561297657612976613fed565b6040519080825280601f01601f1916602001820160405280156129a0576020820181803683370190505b5090505b8415612358576129b5600183613e86565b91506129c2600a86613f5f565b6129cd906030613e16565b60f81b8183815181106129e2576129e2613fd7565b60200101906001600160f81b031916908160001a905350612a04600a86613e53565b94506129a4565b6001600160a01b038316612a6657612a6181600880546000838152600960205260408120829055600182018355919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30155565b612a89565b816001600160a01b0316836001600160a01b031614612a8957612a8983826130dc565b6001600160a01b038216612aa057610d6081613179565b826001600160a01b0316826001600160a01b031614610d6057610d608282613228565b60007f000000000000000000000000514910771af9ca656af840dff83e8264ecf986ca6001600160a01b0316634000aea07f000000000000000000000000f0d54349addcf704f77ae15b96510dea15cb795284866000604051602001612b33929190918252602082015260400190565b6040516020818303038152906040526040518463ffffffff1660e01b8152600401612b6093929190613c66565b602060405180830381600087803b158015612b7a57600080fd5b505af1158015612b8e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612bb291906138e2565b506000838152600b6020818152604080842054815180840189905280830186905230606082015260808082018390528351808303909101815260a090910190925281519183019190912093879052919052612c0e906001613e16565b6000858152600b60205260409020556123588482604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b612c5661351a565b612c65600a61ffff8416613f5f565b1515808252600090612c78576009612c7b565b60005b825160109490941c9390915015612e1457612ca461ffff8416612c9f836000613e2e565b61326c565b602083015160ff91909116905260109290921c91612ccb61ffff8416612c9f836001613e2e565b60208381015160ff9290921691015260109290921c91612cf461ffff8416612c9f836002613e2e565b602083015160ff9190911660409091015260109290921c91612d1f61ffff8416612c9f836003613e2e565b602083015160ff9190911660609091015260109290921c91612d4a61ffff8416612c9f836004613e2e565b602083015160ff9190911660809091015260109290921c91612d7561ffff8416612c9f836005613e2e565b602083015160ff9190911660a09091015260109290921c91612da061ffff8416612c9f836006613e2e565b602083015160ff9190911660c09091015260109290921c91612dcb61ffff8416612c9f836007613e2e565b602083015160ff9190911660e09091015260109290921c91612df661ffff8416612c9f836008613e2e565b602083015160ff919091166101009091015260006040830152611f08565b612e2761ffff8416612c9f836000613e2e565b602083015160ff919091166101209091015260109290921c91612e5361ffff8416612c9f836001613e2e565b602083015160ff919091166101409091015260109290921c91612e7f61ffff8416612c9f836002613e2e565b602083015160ff919091166101609091015260109290921c91612eab61ffff8416612c9f836003613e2e565b602083015160ff919091166101809091015260109290921c91612ed761ffff8416612c9f836004613e2e565b60208301805160ff9283166101a0918201529051015116604083015250919050565b60008315612f625782516020808501516040808701516060880151608089015160a08a015160c08b015160e08c01516101008d01519651612f439a60019a909998918e9101613adb565b604051602081830303815290604052612f5b90613e9d565b9050611e66565b6101208301516101408401516101608501516101808601516101a0870151604051612f439560009590949093909290918990602001613a38565b612fa68383613348565b612fb36000848484612fcf565b610d605760405162461bcd60e51b8152600401610b0890613ced565b60006001600160a01b0384163b156130d157604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290613013903390899088908890600401613bcf565b602060405180830381600087803b15801561302d57600080fd5b505af192505050801561305d575060408051601f3d908101601f1916820190925261305a9181019061393e565b60015b6130b7573d80801561308b576040519150601f19603f3d011682016040523d82523d6000602084013e613090565b606091505b5080516130af5760405162461bcd60e51b8152600401610b0890613ced565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050612358565b506001949350505050565b600060016130e984611901565b6130f39190613e86565b600083815260076020526040902054909150808214613146576001600160a01b03841660009081526006602090815260408083208584528252808320548484528184208190558352600790915290208190555b5060009182526007602090815260408084208490556001600160a01b039094168352600681528383209183525290812055565b60085460009061318b90600190613e86565b600083815260096020526040812054600880549394509092849081106131b3576131b3613fd7565b9060005260206000200154905080600883815481106131d4576131d4613fd7565b600091825260208083209091019290925582815260099091526040808220849055858252812055600880548061320c5761320c613fc1565b6001900381819060005260206000200160009055905550505050565b600061323383611901565b6001600160a01b039093166000908152600660209081526040808320868452825280832085905593825260079052919091209190915550565b60008060138360ff166012811061328557613285613fd7565b01546132919085613f73565b905060138360ff16601281106132a9576132a9613fd7565b018160ff16815481106132be576132be613fd7565b60009182526020918290209181049091015460ff601f9092166101000a90048116600886901c90911610156132f4579050610ad8565b60258360ff166012811061330a5761330a613fd7565b018160ff168154811061331f5761331f613fd7565b90600052602060002090602091828204019190069054906101000a900460ff1691505092915050565b6001600160a01b03821661339e5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610b08565b6000818152600260205260409020546001600160a01b0316156134035760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610b08565b61340f60008383612a0b565b6001600160a01b0382166000908152600360205260408120805460019290613438908490613e16565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b8280546134a290613eed565b90600052602060002090601f0160209004810192826134c4576000855561350a565b82601f106134dd57805160ff191683800117855561350a565b8280016001018555821561350a579182015b8281111561350a5782518255916020019190600101906134ef565b506135169291506135cd565b5090565b60405180606001604052806000151581526020016135366135e2565b8152600060209091015290565b60018301918390821561350a5791602002820160005b8382111561359757835183826101000a81548160ff021916908360ff1602179055509260200192600101602081600001049283019260010302613559565b80156135c45782816101000a81549060ff0219169055600101602081600001049283019260010302613597565b50506135169291505b5b8082111561351657600081556001016135ce565b604051806101c00160405280600e906020820280368337509192915050565b600067ffffffffffffffff8084111561361c5761361c613fed565b604051601f8501601f19908116603f0116810190828211818310171561364457613644613fed565b8160405280935085815286868601111561365d57600080fd5b858560208301376000602087830101525050509392505050565b60006020828403121561368957600080fd5b8135611e6681614003565b6000602082840312156136a657600080fd5b8151611e6681614003565b600080604083850312156136c457600080fd5b82356136cf81614003565b915060208301356136df81614003565b809150509250929050565b6000806000606084860312156136ff57600080fd5b833561370a81614003565b9250602084013561371a81614003565b9150604084013561372a81614003565b809150509250925092565b60008060006060848603121561374a57600080fd5b833561375581614003565b9250602084013561376581614003565b929592945050506040919091013590565b6000806000806080858703121561378c57600080fd5b843561379781614003565b935060208501356137a781614003565b925060408501359150606085013567ffffffffffffffff8111156137ca57600080fd5b8501601f810187136137db57600080fd5b6137ea87823560208401613601565b91505092959194509250565b6000806040838503121561380957600080fd5b823561381481614003565b915060208301356136df81614018565b6000806040838503121561383757600080fd5b823561384281614003565b946020939093013593505050565b6000806020838503121561386357600080fd5b823567ffffffffffffffff8082111561387b57600080fd5b818501915085601f83011261388f57600080fd5b81358181111561389e57600080fd5b8660208260051b85010111156138b357600080fd5b60209290920196919550909350505050565b6000602082840312156138d757600080fd5b8135611e6681614018565b6000602082840312156138f457600080fd5b8151611e6681614018565b6000806040838503121561391257600080fd5b50508035926020909101359150565b60006020828403121561393357600080fd5b8135611e6681614026565b60006020828403121561395057600080fd5b8151611e6681614026565b60006020828403121561396d57600080fd5b813567ffffffffffffffff81111561398457600080fd5b8201601f8101841361399557600080fd5b61235884823560208401613601565b6000602082840312156139b657600080fd5b5035919050565b6000602082840312156139cf57600080fd5b5051919050565b600080604083850312156139e957600080fd5b8235915060208301356136df81614018565b60008151808452613a13816020860160208601613ec1565b601f01601f19169290920160200192915050565b60f81b6001600160f81b0319169052565b87151560f81b81526000600360fc1b80600184015280600284015280600384015280600484015280600584015280600684015280600784015280600884015280600984015250613a8b600a830189613a27565b613a98600b830188613a27565b613aa5600c830187613a27565b613ab2600d830186613a27565b613abf600e830185613a27565b613acc600f830184613a27565b50601001979650505050505050565b8b151560f81b8152600060ff60f81b808d60f81b166001840152808c60f81b16600284015250613b0e600383018b613a27565b613b1b600483018a613a27565b613b286005830189613a27565b613b356006830188613a27565b613b426007830187613a27565b613b4f6008830186613a27565b613b5c6009830185613a27565b600360fc1b600a830152613b82613b758080600b860181565b600360fc1b815260010190565b613b8c8185613a27565b6001019d9c50505050505050505050505050565b60008351613bb2818460208801613ec1565b835190830190613bc6818360208801613ec1565b01949350505050565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090613c02908301846139fb565b9695505050505050565b6001600160a01b038316815260406020808301829052835191830182905260009184820191906060850190845b81811015613c5957845161ffff1683529383019391830191600101613c39565b5090979650505050505050565b60018060a01b0384168152826020820152606060408201526000613c8d60608301846139fb565b95945050505050565b6020808252825182820181905260009190848201906040850190845b81811015613cce57835183529284019291840191600101613cb2565b50909695505050505050565b602081526000611e6660208301846139fb565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b8151151581526020808301516102008301919081840160005b600e811015613dfe57825160ff1682529183019190830190600101613dde565b5050505060ff6040840151166101e083015292915050565b60008219821115613e2957613e29613f95565b500190565b600060ff821660ff84168060ff03821115613e4b57613e4b613f95565b019392505050565b600082613e6257613e62613fab565b500490565b6000816000190483118215151615613e8157613e81613f95565b500290565b600082821015613e9857613e98613f95565b500390565b80516020808301519190811015611f085760001960209190910360031b1b16919050565b60005b83811015613edc578181015183820152602001613ec4565b83811115610fea5750506000910152565b600181811c90821680613f0157607f821691505b60208210811415611f0857634e487b7160e01b600052602260045260246000fd5b600061ffff80831681811415613f3a57613f3a613f95565b6001019392505050565b6000600019821415613f5857613f58613f95565b5060010190565b600082613f6e57613f6e613fab565b500690565b600060ff831680613f8657613f86613fab565b8060ff84160691505092915050565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114610dce57600080fd5b8015158114610dce57600080fd5b6001600160e01b031981168114610dce57600080fdfea2646970667358221220f9be3a0629d522bf2977c0a19ea56dcad1960171b322e432a69de8f87e77093564736f6c63430008070033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000f422b6f41a14fb74b21cb95a8d82971a3b527117000000000000000000000000000000000000000000000000000000000000c350000000000000000000000000f0d54349addcf704f77ae15b96510dea15cb7952000000000000000000000000514910771af9ca656af840dff83e8264ecf986ca
-----Decoded View---------------
Arg [0] : _salmon (address): 0xF422B6f41a14Fb74b21CB95a8d82971a3b527117
Arg [1] : _maxTokens (uint256): 50000
Arg [2] : _vrfCoordinator (address): 0xf0d54349aDdcf704F77AE15b96510dEA15cb7952
Arg [3] : _link (address): 0x514910771AF9Ca656af840dff83E8264EcF986CA
-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 000000000000000000000000f422b6f41a14fb74b21cb95a8d82971a3b527117
Arg [1] : 000000000000000000000000000000000000000000000000000000000000c350
Arg [2] : 000000000000000000000000f0d54349addcf704f77ae15b96510dea15cb7952
Arg [3] : 000000000000000000000000514910771af9ca656af840dff83e8264ecf986ca
Loading...
Loading
Loading...
Loading
[ 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.