Overview
ETH Balance
0 ETH
Eth Value
$0.00Token Holdings
More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 8,747 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Withdraw LINK | 19186478 | 320 days ago | IN | 0 ETH | 0.00296566 | ||||
Claim Many From ... | 18715534 | 386 days ago | IN | 0 ETH | 0.0078684 | ||||
Claim Many From ... | 18650759 | 395 days ago | IN | 0 ETH | 0.00809094 | ||||
Rescue | 16296326 | 726 days ago | IN | 0 ETH | 0.00197963 | ||||
Rescue | 16296323 | 726 days ago | IN | 0 ETH | 0.00211143 | ||||
Rescue | 16296313 | 726 days ago | IN | 0 ETH | 0.0022739 | ||||
Rescue | 16265904 | 730 days ago | IN | 0 ETH | 0.0029416 | ||||
Rescue | 16265900 | 730 days ago | IN | 0 ETH | 0.00634497 | ||||
Rescue | 15977421 | 770 days ago | IN | 0 ETH | 0.00393953 | ||||
Rescue | 15617547 | 820 days ago | IN | 0 ETH | 0.00093197 | ||||
Rescue | 15271509 | 874 days ago | IN | 0 ETH | 0.00409414 | ||||
Rescue | 15248260 | 878 days ago | IN | 0 ETH | 0.00410835 | ||||
Rescue | 15200486 | 885 days ago | IN | 0 ETH | 0.00209669 | ||||
Rescue | 15029513 | 912 days ago | IN | 0 ETH | 0.00361074 | ||||
Rescue | 14997958 | 918 days ago | IN | 0 ETH | 0.0053686 | ||||
Rescue | 14989521 | 920 days ago | IN | 0 ETH | 0.00733016 | ||||
Rescue | 14872553 | 939 days ago | IN | 0 ETH | 0.01075433 | ||||
Rescue | 14841911 | 944 days ago | IN | 0 ETH | 0.01274461 | ||||
Rescue | 14835767 | 945 days ago | IN | 0 ETH | 0.00608581 | ||||
Rescue | 14546614 | 991 days ago | IN | 0 ETH | 0.00564677 | ||||
Rescue | 14485046 | 1001 days ago | IN | 0 ETH | 0.0079058 | ||||
Rescue | 14473656 | 1003 days ago | IN | 0 ETH | 0.00897431 | ||||
Rescue | 14429673 | 1009 days ago | IN | 0 ETH | 0.00438366 | ||||
Rescue | 14428518 | 1010 days ago | IN | 0 ETH | 0.0045017 | ||||
Rescue | 14416807 | 1011 days ago | IN | 0 ETH | 0.00180537 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
River
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.0; import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; import "./Roar.sol"; import "@chainlink/contracts/src/v0.8/VRFConsumerBase.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; interface ITSalmon { function mint(address to, uint256 amount) external; } contract River is Ownable, IERC721Receiver, Pausable, VRFConsumerBase,ReentrancyGuard { using Address for address; using Counters for Counters.Counter; using EnumerableSet for EnumerableSet.UintSet; struct Stake { uint16 tokenId; uint80 value; address owner; } /** INTERFACES */ Roar roar; // reference to the Roar NFT contract ITSalmon salmon; // reference to the $SALMON contract for minting $SALMON earnings event TokenStaked(address owner, uint256 tokenId, uint256 value); event FishermanClaimed(uint256 tokenId, uint256 earned, bool unstaked); event BearClaimed(uint256 tokenId, uint256 earned, bool unstaked); mapping(uint256 => Stake) public riverside; // maps tokenId to stake mapping(uint256 => Stake[]) public Bears; // maps alpha to all Bear stakes with that alpha mapping(address => EnumerableSet.UintSet) private _deposits; mapping(uint256 => uint256) public packIndices; // tracks location of each Bear in Pack uint256 public totalAlphaStaked = 0; // total alpha scores staked uint256 public unaccountedRewards = 0; // any rewards distributed when no bears are staked uint256 public SalmonPerAlpha = 0; // amount of $SALMON due for each alpha point staked uint256 public DAILY_SALMON_RATE = 10000 ether; // Fisherman earn 10000 $SALMON per day uint256 public MINIMUM_TO_EXIT = 2 days; // Fisherman must have 2 days worth of $SALMON to unstake or else it's too cold /** Constant Parameters*/ uint256 public constant SALMON_CLAIM_TAX_PERCENTAGE = 20; // Bears take a 20% tax on all $SALMON claimed uint256 public constant MAXIMUM_GLOBAL_WOOL = 2400000000 ether; // there will only ever be (roughly) 2.4 billion $SALMON earned through staking uint8 public constant MAX_ALPHA = 8; uint256 public totalSalmonEarned; // amount of $SALMON earned so far uint256 public totalFishermanStaked; // number of Fisherman staked in the Riverside uint256 public lastClaimTimestamp; // the last time $SALMON was claimed bool public rescueEnabled = false; // emergency rescue to allow unstaking without any checks but without $SALMON //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 _roar, address _salmon, address _vrfCoordinator, address _link) VRFConsumerBase(_vrfCoordinator, _link) { roar = Roar(_roar); // reference to the Roar NFT contract salmon = ITSalmon(_salmon); //reference to the $SALMON token keyHash = 0xAA77729D3466CA35AE8D28B3BBAC7CC36A5031EFDC430821C02BC31A238AF445; fee = 2 * 10 ** 18; // 0.1 LINK (Varies by network) linkToken = _link; } function depositsOf(address account) external view returns (uint256[] memory) { EnumerableSet.UintSet storage depositSet = _deposits[account]; uint256[] memory tokenIds = new uint256[] (depositSet.length()); for (uint256 i; i < depositSet.length(); i++) { tokenIds[i] = depositSet.at(i); } return tokenIds; } /** STAKING */ function addManyToRiverSideAndFishing(address account, uint16[] calldata tokenIds) external { // called in mint require(account == _msgSender() || _msgSender() == address(roar), "DONT GIVE YOUR TOKENS AWAY"); /// SEE IF I CAN ADD THE MF CONTRACT BAN for (uint i = 0; i < tokenIds.length; i++) { if (_msgSender() != address(roar)) { // dont do this step if its a mint + stake require(roar.ownerOf(tokenIds[i]) == _msgSender(), "AINT YO TOKEN"); roar.transferFrom(_msgSender(), address(this), tokenIds[i]); } else if (tokenIds[i] == 0) { continue; // there may be gaps in the array for stolen tokens } if (isFisherman(tokenIds[i])) _addFishermanToRiverside(account, tokenIds[i]); else _sendBearsFishing(account, tokenIds[i]); } } function _addFishermanToRiverside(address account, uint256 tokenId) internal whenNotPaused _updateEarnings { riverside[tokenId] = Stake({ owner: account, tokenId: uint16(tokenId), value: uint80(block.timestamp) }); totalFishermanStaked += 1; emit TokenStaked(account, tokenId, block.timestamp); _deposits[account].add(tokenId); } function _sendBearsFishing(address account, uint256 tokenId) internal { uint256 alpha = _alphaForBear(tokenId); totalAlphaStaked += alpha; // Portion of earnings ranges from 8 to 5 packIndices[tokenId] = Bears[alpha].length; // Store the location of the Bear in the Pack Bears[alpha].push(Stake({ // Add the Bear to the Pack owner: account, tokenId: uint16(tokenId), value: uint80(SalmonPerAlpha) })); emit TokenStaked(account, tokenId, SalmonPerAlpha); _deposits[account].add(tokenId); } /** CLAIMING / UNSTAKING */ // realize $SALMON earnings and optionally unstake tokens from the RIVER / FISHING function claimManyFromRiverAndFishing(uint16[] calldata tokenIds, bool unstake) external whenNotPaused _updateEarnings nonReentrant() { require(!_msgSender().isContract(), "Contracts are not allowed big man"); uint256 owed = 0; for (uint i = 0; i < tokenIds.length; i++) { if (isFisherman(tokenIds[i])) owed += _claimFisherFromRiver(tokenIds[i], unstake); else owed += _claimBearFromFishing(tokenIds[i], unstake); } if (owed == 0) return; salmon.mint(_msgSender(), owed); } function calculateReward(uint16[] calldata tokenIds) public view returns (uint256 owed) { for (uint i = 0; i < tokenIds.length; i++) { if (isFisherman(tokenIds[i])) owed += calcRewardFisherman(tokenIds[i]); else owed += calcRewardBear(tokenIds[i]); } } function calcRewardFisherman(uint256 tokenId) public view returns (uint256 owed) { Stake memory stake = riverside[tokenId]; if (totalSalmonEarned < MAXIMUM_GLOBAL_WOOL) { owed = (block.timestamp - stake.value) * DAILY_SALMON_RATE / 1 days; } else if (stake.value > lastClaimTimestamp) { owed = 0; // $WOOL production stopped already } else { owed = (lastClaimTimestamp - stake.value) * DAILY_SALMON_RATE / 1 days; // stop earning additional $WOOL if it's all been earned } } function calcRewardBear(uint256 tokenId) public view returns (uint256 owed) { uint256 alpha = _alphaForBear(tokenId); Stake memory stake = Bears[alpha][packIndices[tokenId]]; owed = (alpha) * (SalmonPerAlpha - stake.value); // Calculate portion of tokens based on Alpha } // Basically, withdraws $SALMON earnings for a single Fisherman and optionally unstake it. // 20% Bear Tax, 50% chance all goes to Bear if unstaking. function _claimFisherFromRiver(uint256 tokenId, bool unstake) internal returns (uint256 owed) { Stake memory stake = riverside[tokenId]; require(stake.owner == _msgSender(), "SWIPER, NO SWIPING"); require(!(unstake && block.timestamp - stake.value < MINIMUM_TO_EXIT), "GONNA BE COLD WITHOUT TWO DAY'S WOOL"); owed = calcRewardFisherman(tokenId); if (unstake) { getRandomChainlink(); if (random(tokenId) & 1 == 1) { // 50% chance of all $SALMON stolen _payBearTax(owed); owed = 0; } delete riverside[tokenId]; totalFishermanStaked -= 1; _deposits[_msgSender()].remove(tokenId); roar.safeTransferFrom(address(this), _msgSender(), tokenId, ""); // send back Fisherman } else { _payBearTax(owed * SALMON_CLAIM_TAX_PERCENTAGE / 100); // percentage tax to staked Bears riverside[tokenId] = Stake({ owner: _msgSender(), tokenId: uint16(tokenId), value: uint80(block.timestamp) }); // reset stake owed = owed * (100 - SALMON_CLAIM_TAX_PERCENTAGE) / 100; // remainder goes to Fisherman owner } emit FishermanClaimed(tokenId, owed, unstake); } // Basically, withdraws $SALMON earnings for a single BEAR and optionally unstake it. function _claimBearFromFishing(uint256 tokenId, bool unstake) internal returns (uint256 owed) { uint256 alpha = _alphaForBear(tokenId); Stake memory stake = Bears[alpha][packIndices[tokenId]]; require(roar.ownerOf(tokenId) == address(this), "AINT A PART OF THE PACK"); require(stake.owner == _msgSender(), "SWIPER, NO SWIPING"); owed = calcRewardBear(tokenId); // Calculate portion of tokens based on Alpha if (unstake) { totalAlphaStaked -= alpha; // Remove Alpha from total staked Stake memory lastStake = Bears[alpha][Bears[alpha].length - 1]; // Shuffle last Bear to current position PT 1 Bears[alpha][packIndices[tokenId]] = lastStake; // Shuffle last Bear to current position PT 2 packIndices[lastStake.tokenId] = packIndices[tokenId]; // Shuffle last Bear to current position PT 3 Bears[alpha].pop(); // Remove duplicate delete packIndices[tokenId]; // Delete old mapping _deposits[_msgSender()].remove(tokenId); roar.safeTransferFrom(address(this), _msgSender(), tokenId, ""); // Send back Bear } else { Bears[alpha][packIndices[tokenId]] = Stake({ owner: _msgSender(), tokenId: uint16(tokenId), value: uint80(SalmonPerAlpha) }); // reset stake } emit BearClaimed(tokenId, owed, unstake); } // emergency unstake tokens function rescue(uint256[] calldata tokenIds) external nonReentrant() { require(!_msgSender().isContract(), "Contracts are not allowed big man"); require(rescueEnabled, "RESCUE DISABLED"); uint256 tokenId; Stake memory stake; Stake memory lastStake; uint256 alpha; for (uint i = 0; i < tokenIds.length; i++) { tokenId = tokenIds[i]; if (isFisherman(tokenId)) { stake = riverside[tokenId]; require(stake.owner == _msgSender(), "SWIPER, NO SWIPING"); delete riverside[tokenId]; totalFishermanStaked -= 1; roar.safeTransferFrom(address(this), _msgSender(), tokenId, ""); // send back Fisherman emit FishermanClaimed(tokenId, 0, true); } else { alpha = _alphaForBear(tokenId); stake = Bears[alpha][packIndices[tokenId]]; require(stake.owner == _msgSender(), "SWIPER, NO SWIPING"); totalAlphaStaked -= alpha; // Remove Alpha from total staked lastStake = Bears[alpha][Bears[alpha].length - 1]; Bears[alpha][packIndices[tokenId]] = lastStake; // Shuffle last bear to current position packIndices[lastStake.tokenId] = packIndices[tokenId]; Bears[alpha].pop(); // Remove duplicate delete packIndices[tokenId]; // Delete old mapping roar.safeTransferFrom(address(this), _msgSender(), tokenId, ""); // Send back Fisherman emit BearClaimed(tokenId, 0, true); } } } /** ACCOUNTING */ // add $SALMON to claimable pot for the Pack function _payBearTax(uint256 amount) internal { if (totalAlphaStaked == 0) { // if there's no staked Bear > keep track of $SALMON due to Bear unaccountedRewards += amount; return; } SalmonPerAlpha += (amount + unaccountedRewards) / totalAlphaStaked; // makes sure to include any unaccounted $SALMON unaccountedRewards = 0; } // tracks $SALMIN earnings to ensure it stops once 2.4 billion is eclipsed modifier _updateEarnings() { if (totalSalmonEarned < MAXIMUM_GLOBAL_WOOL) { totalSalmonEarned += (block.timestamp - lastClaimTimestamp) * totalFishermanStaked * DAILY_SALMON_RATE / 1 days; lastClaimTimestamp = block.timestamp; } _; } function isFisherman(uint256 tokenId) public view returns (bool fisherman) { // SheepWolf memory t = roar.getTokenTraits(tokenId);(sheep, , , , , , , , , ) = roar.tokenTraits(tokenId); (fisherman, ) = roar.tokenTraits(tokenId); } // gets the alpha score for a Bear function _alphaForBear(uint256 tokenId) public view returns (uint8) { ( ,uint8 alphaIndex) = roar.tokenTraits(tokenId); return MAX_ALPHA - alphaIndex; // alpha index is 0-3 } // chooses a random Bear thief when a newly minted token is stolen function randomBearOwner(uint256 seed) external view returns (address) { if (totalAlphaStaked == 0) return address(0x0); uint256 bucket = (seed & 0xFFFFFFFF) % totalAlphaStaked; // choose a value from 0 to total alpha staked uint256 cumulative; seed >>= 32; for (uint i = MAX_ALPHA - 3; i <= MAX_ALPHA; i++) { // loop through each bucket of Bears with the same alpha score cumulative += Bears[i].length * i; if (bucket >= cumulative) continue; // if the value is not inside of that bucket, keep going return Bears[i][seed % Bears[i].length].owner; // get the address of a random Bear with that alpha score } return address(0x0); } /** CHANGE PARAMETERS */ function setInit(address _roar, address _salmon) external onlyOwner{ roar = Roar(_roar); // reference to the Roar NFT contract salmon = ITSalmon(_salmon); //reference to the $SALMON token } function changeDailyRate(uint256 _newRate) external onlyOwner{ DAILY_SALMON_RATE = _newRate; } function changeMinExit(uint256 _newExit) external onlyOwner{ _newExit = _newExit ; } function setRescueEnabled(bool _enabled) external onlyOwner { rescueEnabled = _enabled; } function setPaused(bool _paused) external onlyOwner { if (_paused) _pause(); else _unpause(); } /** RANDOMNESSSS */ function changeLinkFee(uint256 _fee) external onlyOwner { // fee = 0.1 * 10 ** 18; // 0.1 LINK (Varies by network) fee = _fee; } function random(uint256 seed) internal view returns (uint256) { return uint256(keccak256(abi.encodePacked( tx.origin, blockhash(block.number - 1), block.timestamp, seed, randomNumber ))); } 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); } /** OTHERS */ function onERC721Received(address, address from, uint256, bytes calldata) external pure override returns (bytes4) { require(from == address(0x0), "Cannot send tokens to Barn directly"); return IERC721Receiver.onERC721Received.selector; } }
// 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":"_roar","type":"address"},{"internalType":"address","name":"_salmon","type":"address"},{"internalType":"address","name":"_vrfCoordinator","type":"address"},{"internalType":"address","name":"_link","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"earned","type":"uint256"},{"indexed":false,"internalType":"bool","name":"unstaked","type":"bool"}],"name":"BearClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"earned","type":"uint256"},{"indexed":false,"internalType":"bool","name":"unstaked","type":"bool"}],"name":"FishermanClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"TokenStaked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"Bears","outputs":[{"internalType":"uint16","name":"tokenId","type":"uint16"},{"internalType":"uint80","name":"value","type":"uint80"},{"internalType":"address","name":"owner","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DAILY_SALMON_RATE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAXIMUM_GLOBAL_WOOL","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_ALPHA","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINIMUM_TO_EXIT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SALMON_CLAIM_TAX_PERCENTAGE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SalmonPerAlpha","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"_alphaForBear","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint16[]","name":"tokenIds","type":"uint16[]"}],"name":"addManyToRiverSideAndFishing","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"calcRewardBear","outputs":[{"internalType":"uint256","name":"owed","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"calcRewardFisherman","outputs":[{"internalType":"uint256","name":"owed","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16[]","name":"tokenIds","type":"uint16[]"}],"name":"calculateReward","outputs":[{"internalType":"uint256","name":"owed","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_newRate","type":"uint256"}],"name":"changeDailyRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_fee","type":"uint256"}],"name":"changeLinkFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_newExit","type":"uint256"}],"name":"changeMinExit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_cooldown","type":"uint256"}],"name":"changeVrfCooldown","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16[]","name":"tokenIds","type":"uint16[]"},{"internalType":"bool","name":"unstake","type":"bool"}],"name":"claimManyFromRiverAndFishing","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"depositsOf","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"fee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"initChainLink","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"isFisherman","outputs":[{"internalType":"bool","name":"fisherman","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastClaimTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"linkToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"packIndices","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"seed","type":"uint256"}],"name":"randomBearOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"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":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"rescue","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rescueEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"riverside","outputs":[{"internalType":"uint16","name":"tokenId","type":"uint16"},{"internalType":"uint80","name":"value","type":"uint80"},{"internalType":"address","name":"owner","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_roar","type":"address"},{"internalType":"address","name":"_salmon","type":"address"}],"name":"setInit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_paused","type":"bool"}],"name":"setPaused","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_enabled","type":"bool"}],"name":"setRescueEnabled","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"totalAlphaStaked","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalFishermanStaked","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSalmonEarned","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unaccountedRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","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":[],"name":"withdrawLINK","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60c060405260006009819055600a819055600b5569021e19e0c9bab2400000600c556202a300600d556011805460ff191690556127106017553480156200004557600080fd5b506040516200345238038062003452833981016040819052620000689162000183565b8181620000753362000116565b6000805460ff60a01b19169055606091821b6001600160601b031990811660a052911b166080526001600255600380546001600160a01b03199081166001600160a01b0396871617909155600480548216948616949094179093557faa77729d3466ca35ae8d28b3bbac7cc36a5031efdc430821c02bc31a238af445601255671bc16d674ec8000060135560168054909316931692909217905550620001e0565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b03811681146200017e57600080fd5b919050565b600080600080608085870312156200019a57600080fd5b620001a58562000166565b9350620001b56020860162000166565b9250620001c56040860162000166565b9150620001d56060860162000166565b905092959194509250565b60805160601c60a05160601c6132386200021a600039600081816114330152612844015260008181611c89015261281501526132386000f3fe608060405234801561001057600080fd5b50600436106102745760003560e01c80637a98a82a11610151578063b6532d64116100c3578063e3a9db1a11610087578063e3a9db1a14610544578063e46addf214610564578063ec0767bf14610577578063ec77e4601461058a578063ee5f55ad146105d0578063f2fde38b146105e357600080fd5b8063b6532d641461050d578063b72cac3414610516578063c0c472c01461051f578063ddca3f4314610528578063e0898f311461053157600080fd5b806388ff498b1161011557806388ff498b146104b25780638a46fe7b146104c55780638da5cb5b146104d857806394985ddd146104e957806399e4d8ef146104fc578063adc2112f1461050557600080fd5b80637a98a82a146104685780637b7b9bc8146104705780637ce522d01461047957806383a3af531461048c578063873efeff1461049f57600080fd5b8063586583d3116101ea5780636d18824b116101ae5780636d18824b146103fe5780636f234fb5146104115780636f257875146104315780636f5f6b411461043a578063715018a61461044d578063765310081461045557600080fd5b8063586583d3146103b55780635c975abb146103bd578063607af397146103cf578063676995e8146103d85780636a3ef057146103eb57600080fd5b806339db714f1161023c57806339db714f1461030357806341eb5d811461032057806350bbbdaf1461036457806351a11e4a14610377578063568303ca1461038057806357970e931461038a57600080fd5b80630576c1c514610279578063150b7a021461029f57806316c38b3c146102cb578063201ef2a4146102e057806337a386b9146102fa575b600080fd5b61028c610287366004612edc565b6105f6565b6040519081526020015b60405180910390f35b6102b26102ad366004612c9a565b6106f3565b6040516001600160e01b03199091168152602001610296565b6102de6102d9366004612e27565b61076f565b005b6102e8600881565b60405160ff9091168152602001610296565b61028c600d5481565b6011546103109060ff1681565b6040519015158152602001610296565b61033361032e366004612e96565b6107b2565b6040805161ffff90941684526001600160501b0390921660208401526001600160a01b031690820152606001610296565b610310610372366004612edc565b610805565b61028c600c5481565b60185461028c9081565b60165461039d906001600160a01b031681565b6040516001600160a01b039091168152602001610296565b61028c601481565b600054600160a01b900460ff16610310565b61028c60105481565b6102e86103e6366004612edc565b610888565b6102de6103f9366004612d8e565b610917565b61028c61040c366004612d8e565b610e67565b61028c61041f366004612edc565b60086020526000908152604090205481565b61028c60095481565b61028c610448366004612edc565b610f41565b6102de610ff0565b6102de610463366004612e27565b611026565b6102de611063565b61028c600e5481565b6102de610487366004612edc565b611095565b6102de61049a366004612edc565b6110bf565b6102de6104ad366004612edc565b6110ee565b61028c6b07c13bc4b2c133c56000000081565b6102de6104d3366004612d39565b61111d565b6000546001600160a01b031661039d565b6102de6104f7366004612e96565b611428565b61028c60175481565b6102de6114aa565b61028c600b5481565b61028c600f5481565b61028c600a5481565b61028c60135481565b61039d61053f366004612edc565b6115d5565b610557610552366004612c27565b6116c4565b6040516102969190612fad565b6102de610572366004612dd0565b611780565b6102de610585366004612edc565b6119d5565b610333610598366004612edc565b60056020526000908152604090205461ffff8116906201000081046001600160501b031690600160601b90046001600160a01b031683565b6102de6105de366004612c61565b611a04565b6102de6105f1366004612c27565b611a5c565b60008181526005602090815260408083208151606081018352905461ffff811682526201000081046001600160501b031693820193909352600160601b9092046001600160a01b031690820152600e546b07c13bc4b2c133c56000000011156106945762015180600c5482602001516001600160501b0316426106799190613108565b61068391906130e9565b61068d91906130d5565b91506106ed565b60105481602001516001600160501b031611156106b457600091506106ed565b62015180600c5482602001516001600160501b03166010546106d69190613108565b6106e091906130e9565b6106ea91906130d5565b91505b50919050565b60006001600160a01b0385161561075d5760405162461bcd60e51b815260206004820152602360248201527f43616e6e6f742073656e6420746f6b656e7320746f204261726e206469726563604482015262746c7960e81b60648201526084015b60405180910390fd5b50630a85bd0160e11b95945050505050565b6000546001600160a01b031633146107995760405162461bcd60e51b815260040161075490613088565b80156107aa576107a7611af4565b50565b6107a7611b76565b600660205281600052604060002081815481106107ce57600080fd5b60009182526020909120015461ffff811692506201000081046001600160501b03169150600160601b90046001600160a01b031683565b60035460405163e05c57bf60e01b8152600481018390526000916001600160a01b03169063e05c57bf90602401604080518083038186803b15801561084957600080fd5b505afa15801561085d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108819190612e61565b5092915050565b60035460405163e05c57bf60e01b81526004810183905260009182916001600160a01b039091169063e05c57bf90602401604080518083038186803b1580156108d057600080fd5b505afa1580156108e4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109089190612e61565b91506106ea905081600861311f565b6002805414156109695760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610754565b60028055610981335b6001600160a01b03163b151590565b1561099e5760405162461bcd60e51b815260040161075490612ff1565b60115460ff166109e25760405162461bcd60e51b815260206004820152600f60248201526e149154d0d55148111254d050931151608a1b6044820152606401610754565b60408051606080820183526000808352602080840182905283850182905284519283018552818352820181905292810183905282805b85811015610e5957868682818110610a3257610a326131b3565b905060200201359450610a4485610805565b15610b8c576000858152600560209081526040918290208251606081018452905461ffff811682526201000081046001600160501b031692820192909252600160601b9091046001600160a01b031691810182905294503314610ab95760405162461bcd60e51b815260040161075490613032565b6000858152600560205260408120819055600f805460019290610add908490613108565b90915550506003546001600160a01b031663b88d4fde3033886040518463ffffffff1660e01b8152600401610b1493929190612f0e565b600060405180830381600087803b158015610b2e57600080fd5b505af1158015610b42573d6000803e3d6000fd5b5050604080518881526000602082015260018183015290517f6947144199e2d07c33c5916f272414aca924857d62b89d1b56d369262ab07a219350908190036060019150a1610e47565b610b9585610888565b60ff166000818152600660209081526040808320898452600890925290912054815492945090918110610bca57610bca6131b3565b600091825260209182902060408051606081018252929091015461ffff811683526201000081046001600160501b031693830193909352600160601b9092046001600160a01b031691810182905294503314610c385760405162461bcd60e51b815260040161075490613032565b8160096000828254610c4a9190613108565b909155505060008281526006602052604090208054610c6b90600190613108565b81548110610c7b57610c7b6131b3565b6000918252602080832060408051606081018252939091015461ffff811684526201000081046001600160501b031684840152600160601b90046001600160a01b0316838201528584526006825280842089855260089092529092205482549195508592918110610cee57610cee6131b3565b60009182526020808320845192018054858301516040968701516001600160a01b0316600160601b026001600160601b036001600160501b0390921662010000026001600160601b031990931661ffff968716179290921716179055888352600881528383205487519092168352838320919091558482526006905220805480610d7a57610d7a61319d565b6000828152602080822060001990840181018390559092019092558682526008905260408120556003546001600160a01b031663b88d4fde3033886040518463ffffffff1660e01b8152600401610dd393929190612f0e565b600060405180830381600087803b158015610ded57600080fd5b505af1158015610e01573d6000803e3d6000fd5b5050604080518881526000602082015260018183015290517f14ac2d855f81ac277fc8aad6d23e264f49d6c8411c0503dffaaffb96f89f35759350908190036060019150a15b80610e5181613142565b915050610a18565b505060016002555050505050565b6000805b8281101561088157610ea6848483818110610e8857610e886131b3565b9050602002016020810190610e9d9190612eb8565b61ffff16610805565b15610eef57610ede848483818110610ec057610ec06131b3565b9050602002016020810190610ed59190612eb8565b61ffff166105f6565b610ee890836130bd565b9150610f2f565b610f22848483818110610f0457610f046131b3565b9050602002016020810190610f199190612eb8565b61ffff16610f41565b610f2c90836130bd565b91505b80610f3981613142565b915050610e6b565b600080610f4d83610888565b60ff1660008181526006602090815260408083208784526008909252822054815493945091929091908110610f8457610f846131b3565b600091825260209182902060408051606081018252929091015461ffff811683526201000081046001600160501b0316938301849052600160601b90046001600160a01b031690820152600b54909250610fde9190613108565b610fe890836130e9565b949350505050565b6000546001600160a01b0316331461101a5760405162461bcd60e51b815260040161075490613088565b6110246000611bfa565b565b6000546001600160a01b031633146110505760405162461bcd60e51b815260040161075490613088565b6011805460ff1916911515919091179055565b6000546001600160a01b0316331461108d5760405162461bcd60e51b815260040161075490613088565b6107a7611c4a565b6000546001600160a01b031633146107a75760405162461bcd60e51b815260040161075490613088565b6000546001600160a01b031633146110e95760405162461bcd60e51b815260040161075490613088565b601755565b6000546001600160a01b031633146111185760405162461bcd60e51b815260040161075490613088565b601355565b6001600160a01b03831633148061114757506003546001600160a01b0316336001600160a01b0316145b6111935760405162461bcd60e51b815260206004820152601a60248201527f444f4e54204749564520594f555220544f4b454e5320415741590000000000006044820152606401610754565b60005b81811015611422576003546001600160a01b0316336001600160a01b0316146113555760035433906001600160a01b0316636352211e8585858181106111de576111de6131b3565b90506020020160208101906111f39190612eb8565b6040516001600160e01b031960e084901b16815261ffff909116600482015260240160206040518083038186803b15801561122d57600080fd5b505afa158015611241573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112659190612c44565b6001600160a01b0316146112ab5760405162461bcd60e51b815260206004820152600d60248201526c20a4a72a102ca7902a27a5a2a760991b6044820152606401610754565b6003546001600160a01b03166323b872dd33308686868181106112d0576112d06131b3565b90506020020160208101906112e59190612eb8565b6040516001600160e01b031960e086901b1681526001600160a01b03938416600482015292909116602483015261ffff166044820152606401600060405180830381600087803b15801561133857600080fd5b505af115801561134c573d6000803e3d6000fd5b50505050611389565b828282818110611367576113676131b3565b905060200201602081019061137c9190612eb8565b61ffff1661138957611410565b61139e838383818110610e8857610e886131b3565b156113dc576113d7848484848181106113b9576113b96131b3565b90506020020160208101906113ce9190612eb8565b61ffff16611d85565b611410565b611410848484848181106113f2576113f26131b3565b90506020020160208101906114079190612eb8565b61ffff16611f1f565b8061141a81613142565b915050611196565b50505050565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146114a05760405162461bcd60e51b815260206004820152601f60248201527f4f6e6c7920565246436f6f7264696e61746f722063616e2066756c66696c6c006044820152606401610754565b60155550565b5050565b6000546001600160a01b031633146114d45760405162461bcd60e51b815260040161075490613088565b6016546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a082319060240160206040518083038186803b15801561151857600080fd5b505afa15801561152c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115509190612ef5565b60165460405163a9059cbb60e01b8152336004820152602481018390529192506001600160a01b03169063a9059cbb90604401602060405180830381600087803b15801561159d57600080fd5b505af11580156115b1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114a69190612e44565b6000600954600014156115ea57506000919050565b60006009548363ffffffff16611600919061315d565b60209390931c9290506000806116186003600861311f565b60ff1690505b600881116116b9576000818152600660205260409020546116409082906130e9565b61164a90836130bd565b9150818310611658576116a7565b60008181526006602052604090208054611672908761315d565b81548110611682576116826131b3565b600091825260209091200154600160601b90046001600160a01b031695945050505050565b806116b181613142565b91505061161e565b506000949350505050565b6001600160a01b03811660009081526007602052604081206060916116e882612052565b67ffffffffffffffff811115611700576117006131c9565b604051908082528060200260200182016040528015611729578160200160208202803683370190505b50905060005b61173883612052565b811015611778576117498382612062565b82828151811061175b5761175b6131b3565b60209081029190910101528061177081613142565b91505061172f565b509392505050565b600054600160a01b900460ff16156117aa5760405162461bcd60e51b81526004016107549061305e565b6b07c13bc4b2c133c560000000600e5410156118115762015180600c54600f54601054426117d89190613108565b6117e291906130e9565b6117ec91906130e9565b6117f691906130d5565b600e600082825461180791906130bd565b9091555050426010555b6002805414156118635760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610754565b6002805561187033610972565b1561188d5760405162461bcd60e51b815260040161075490612ff1565b6000805b8381101561194b576118ae858583818110610e8857610e886131b3565b156118f8576118e78585838181106118c8576118c86131b3565b90506020020160208101906118dd9190612eb8565b61ffff1684612075565b6118f190836130bd565b9150611939565b61192c85858381811061190d5761190d6131b3565b90506020020160208101906119229190612eb8565b61ffff168461237e565b61193690836130bd565b91505b8061194381613142565b915050611891565b508061195757506119cb565b6004546001600160a01b03166340c10f19336040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260248101849052604401600060405180830381600087803b1580156119b157600080fd5b505af11580156119c5573d6000803e3d6000fd5b50505050505b5050600160025550565b6000546001600160a01b031633146119ff5760405162461bcd60e51b815260040161075490613088565b600c55565b6000546001600160a01b03163314611a2e5760405162461bcd60e51b815260040161075490613088565b600380546001600160a01b039384166001600160a01b03199182161790915560048054929093169116179055565b6000546001600160a01b03163314611a865760405162461bcd60e51b815260040161075490613088565b6001600160a01b038116611aeb5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610754565b6107a781611bfa565b600054600160a01b900460ff1615611b1e5760405162461bcd60e51b81526004016107549061305e565b6000805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258611b593390565b6040516001600160a01b03909116815260200160405180910390a1565b600054600160a01b900460ff16611bc65760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610754565b6000805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa33611b59565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000601754611c5860185490565b11611c7157611c6b601880546001019055565b50600090565b6013546040516370a0823160e01b81523060048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a082319060240160206040518083038186803b158015611cd357600080fd5b505afa158015611ce7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d0b9190612ef5565b1015611d6d5760405162461bcd60e51b815260206004820152602b60248201527f4e6f7420656e6f756768204c494e4b202d2066696c6c20636f6e74726163742060448201526a1dda5d1a0819985d58d95d60aa1b6064820152608401610754565b6000601855611d80601254601354612811565b905090565b600054600160a01b900460ff1615611daf5760405162461bcd60e51b81526004016107549061305e565b6b07c13bc4b2c133c560000000600e541015611e165762015180600c54600f5460105442611ddd9190613108565b611de791906130e9565b611df191906130e9565b611dfb91906130d5565b600e6000828254611e0c91906130bd565b9091555050426010555b6040805160608101825261ffff80841682526001600160501b0342811660208085019182526001600160a01b03808916868801908152600089815260059093529682209551865493519751909116600160601b026001600160601b039790941662010000026001600160601b03199093169416939093171793909316929092179055600f805460019290611eab9084906130bd565b9091555050604080516001600160a01b038416815260208101839052428183015290517f6173e4d2d9dd52aae0ed37afed3adcf924a490639b759ca93d32dc43366c17d29181900360600190a16001600160a01b0382166000908152600760205260409020611f1a908261299b565b505050565b6000611f2a82610888565b60ff1690508060096000828254611f4191906130bd565b9091555050600081815260066020818152604080842080548786526008845282862081905593835281516060808201845261ffff808a168352600b80546001600160501b039081168589019081526001600160a01b038e8116878a0181815260018d018a55988d529b8a9020965196909a01805491519751969094166001600160601b031990911617620100009690911695909502949094176001600160601b0316600160601b93909716929092029590951790555481519485529184018690528301527f6173e4d2d9dd52aae0ed37afed3adcf924a490639b759ca93d32dc43366c17d2910160405180910390a16001600160a01b0383166000908152600760205260409020611422908361299b565b600061205c825490565b92915050565b600061206e83836129a7565b9392505050565b60008281526005602090815260408083208151606081018352905461ffff811682526201000081046001600160501b031693820193909352600160601b9092046001600160a01b031690820181905233146120e25760405162461bcd60e51b815260040161075490613032565b8280156121075750600d546020820151612105906001600160501b031642613108565b105b156121605760405162461bcd60e51b8152602060048201526024808201527f474f4e4e4120424520434f4c4420574954484f55542054574f2044415927532060448201526315d3d3d360e21b6064820152608401610754565b612169846105f6565b9150821561225957612179611c4a565b50612183846129d1565b6001166001141561219c5761219782612a34565b600091505b6000848152600560205260408120819055600f8054600192906121c0908490613108565b909155506121ef90508460076000335b6001600160a01b03168152602081019190915260400160002090612a8d565b506003546001600160a01b031663b88d4fde3033876040518463ffffffff1660e01b815260040161222293929190612f0e565b600060405180830381600087803b15801561223c57600080fd5b505af1158015612250573d6000803e3d6000fd5b50505050612336565b61227860646122696014856130e9565b61227391906130d5565b612a34565b60405180606001604052808561ffff168152602001426001600160501b031681526020016122a33390565b6001600160a01b0390811690915260008681526005602090815260409182902084518154928601519590930151909316600160601b026001600160601b036001600160501b0390951662010000026001600160601b031990921661ffff909316929092171792909216919091179055606461231f601482613108565b61232990846130e9565b61233391906130d5565b91505b60408051858152602081018490528415158183015290517f6947144199e2d07c33c5916f272414aca924857d62b89d1b56d369262ab07a219181900360600190a15092915050565b60008061238a84610888565b60ff16600081815260066020908152604080832088845260089092528220548154939450919290919081106123c1576123c16131b3565b600091825260209182902060408051606081018252929091015461ffff811683526001600160501b0362010000820416938301939093526001600160a01b03600160601b90930483168282015260035490516331a9108f60e11b81526004810189905291935030921690636352211e9060240160206040518083038186803b15801561244c57600080fd5b505afa158015612460573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124849190612c44565b6001600160a01b0316146124da5760405162461bcd60e51b815260206004820152601760248201527f41494e5420412050415254204f4620544845205041434b0000000000000000006044820152606401610754565b60408101516001600160a01b031633146125065760405162461bcd60e51b815260040161075490613032565b61250f85610f41565b925083156126fc5781600960008282546125299190613108565b90915550506000828152600660205260408120805461254a90600190613108565b8154811061255a5761255a6131b3565b6000918252602080832060408051606081018252939091015461ffff811684526201000081046001600160501b031684840152600160601b90046001600160a01b031683820152868452600682528084208a8552600890925290922054825491935083929181106125cd576125cd6131b3565b60009182526020808320845192018054858301516040968701516001600160a01b0316600160601b026001600160601b036001600160501b0390921662010000026001600160601b031990931661ffff9687161792909217161790558983526008815283832054855190921683528383209190915585825260069052208054806126595761265961319d565b6000828152602080822060001990840181018390559092019092558782526008905260408120819055612691908790600790336121d0565b506003546001600160a01b031663b88d4fde3033896040518463ffffffff1660e01b81526004016126c493929190612f0e565b600060405180830381600087803b1580156126de57600080fd5b505af11580156126f2573d6000803e3d6000fd5b50505050506127c8565b60405180606001604052808661ffff168152602001600b546001600160501b031681526020016127293390565b6001600160a01b03169052600083815260066020908152604080832089845260089092529091205481548110612761576127616131b3565b6000918252602091829020835191018054928401516040909401516001600160a01b0316600160601b026001600160601b036001600160501b0390951662010000026001600160601b031990941661ffff9093169290921792909217929092169190911790555b60408051868152602081018590528515158183015290517f14ac2d855f81ac277fc8aad6d23e264f49d6c8411c0503dffaaffb96f89f35759181900360600190a1505092915050565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316634000aea07f000000000000000000000000000000000000000000000000000000000000000084866000604051602001612881929190918252602082015260400190565b6040516020818303038152906040526040518463ffffffff1660e01b81526004016128ae93929190612f41565b602060405180830381600087803b1580156128c857600080fd5b505af11580156128dc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129009190612e44565b50600083815260016020818152604080842054815180840189905280830186905230606082015260808082018390528351808303909101815260a0909101909252815191830191909120938790529082905261295b916130bd565b600085815260016020526040902055610fe88482604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b600061206e8383612a99565b60008260000182815481106129be576129be6131b3565b9060005260206000200154905092915050565b6000326129df600143613108565b60155460405160609390931b6001600160601b03191660208401529040603483015242605483015260748201849052609482015260b40160408051601f19818403018152919052805160209091012092915050565b600954612a555780600a6000828254612a4d91906130bd565b909155505050565b600954600a54612a6590836130bd565b612a6f91906130d5565b600b6000828254612a8091906130bd565b90915550506000600a5550565b600061206e8383612ae8565b6000818152600183016020526040812054612ae05750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561205c565b50600061205c565b60008181526001830160205260408120548015612bd1576000612b0c600183613108565b8554909150600090612b2090600190613108565b9050818114612b85576000866000018281548110612b4057612b406131b3565b9060005260206000200154905080876000018481548110612b6357612b636131b3565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080612b9657612b9661319d565b60019003818190600052602060002001600090559055856001016000868152602001908152602001600020600090556001935050505061205c565b600091505061205c565b60008083601f840112612bed57600080fd5b50813567ffffffffffffffff811115612c0557600080fd5b6020830191508360208260051b8501011115612c2057600080fd5b9250929050565b600060208284031215612c3957600080fd5b813561206e816131df565b600060208284031215612c5657600080fd5b815161206e816131df565b60008060408385031215612c7457600080fd5b8235612c7f816131df565b91506020830135612c8f816131df565b809150509250929050565b600080600080600060808688031215612cb257600080fd5b8535612cbd816131df565b94506020860135612ccd816131df565b935060408601359250606086013567ffffffffffffffff80821115612cf157600080fd5b818801915088601f830112612d0557600080fd5b813581811115612d1457600080fd5b896020828501011115612d2657600080fd5b9699959850939650602001949392505050565b600080600060408486031215612d4e57600080fd5b8335612d59816131df565b9250602084013567ffffffffffffffff811115612d7557600080fd5b612d8186828701612bdb565b9497909650939450505050565b60008060208385031215612da157600080fd5b823567ffffffffffffffff811115612db857600080fd5b612dc485828601612bdb565b90969095509350505050565b600080600060408486031215612de557600080fd5b833567ffffffffffffffff811115612dfc57600080fd5b612e0886828701612bdb565b9094509250506020840135612e1c816131f4565b809150509250925092565b600060208284031215612e3957600080fd5b813561206e816131f4565b600060208284031215612e5657600080fd5b815161206e816131f4565b60008060408385031215612e7457600080fd5b8251612e7f816131f4565b602084015190925060ff81168114612c8f57600080fd5b60008060408385031215612ea957600080fd5b50508035926020909101359150565b600060208284031215612eca57600080fd5b813561ffff8116811461206e57600080fd5b600060208284031215612eee57600080fd5b5035919050565b600060208284031215612f0757600080fd5b5051919050565b6001600160a01b039384168152919092166020820152604081019190915260806060820181905260009082015260a00190565b60018060a01b038416815260006020848184015260606040840152835180606085015260005b81811015612f8357858101830151858201608001528201612f67565b81811115612f95576000608083870101525b50601f01601f19169290920160800195945050505050565b6020808252825182820181905260009190848201906040850190845b81811015612fe557835183529284019291840191600101612fc9565b50909695505050505050565b60208082526021908201527f436f6e74726163747320617265206e6f7420616c6c6f77656420626967206d616040820152603760f91b606082015260800190565b6020808252601290820152715357495045522c204e4f2053574950494e4760701b604082015260600190565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600082198211156130d0576130d0613171565b500190565b6000826130e4576130e4613187565b500490565b600081600019048311821515161561310357613103613171565b500290565b60008282101561311a5761311a613171565b500390565b600060ff821660ff84168082101561313957613139613171565b90039392505050565b600060001982141561315657613156613171565b5060010190565b60008261316c5761316c613187565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107a757600080fd5b80151581146107a757600080fdfea26469706673582212203fcb9d46190cda851f983316dae91a78417c66fa1e865773fa612463fc71df8a64736f6c63430008070033000000000000000000000000e27a60f3cf27f716ac998b61492a36090973aac7000000000000000000000000f422b6f41a14fb74b21cb95a8d82971a3b527117000000000000000000000000f0d54349addcf704f77ae15b96510dea15cb7952000000000000000000000000514910771af9ca656af840dff83e8264ecf986ca
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106102745760003560e01c80637a98a82a11610151578063b6532d64116100c3578063e3a9db1a11610087578063e3a9db1a14610544578063e46addf214610564578063ec0767bf14610577578063ec77e4601461058a578063ee5f55ad146105d0578063f2fde38b146105e357600080fd5b8063b6532d641461050d578063b72cac3414610516578063c0c472c01461051f578063ddca3f4314610528578063e0898f311461053157600080fd5b806388ff498b1161011557806388ff498b146104b25780638a46fe7b146104c55780638da5cb5b146104d857806394985ddd146104e957806399e4d8ef146104fc578063adc2112f1461050557600080fd5b80637a98a82a146104685780637b7b9bc8146104705780637ce522d01461047957806383a3af531461048c578063873efeff1461049f57600080fd5b8063586583d3116101ea5780636d18824b116101ae5780636d18824b146103fe5780636f234fb5146104115780636f257875146104315780636f5f6b411461043a578063715018a61461044d578063765310081461045557600080fd5b8063586583d3146103b55780635c975abb146103bd578063607af397146103cf578063676995e8146103d85780636a3ef057146103eb57600080fd5b806339db714f1161023c57806339db714f1461030357806341eb5d811461032057806350bbbdaf1461036457806351a11e4a14610377578063568303ca1461038057806357970e931461038a57600080fd5b80630576c1c514610279578063150b7a021461029f57806316c38b3c146102cb578063201ef2a4146102e057806337a386b9146102fa575b600080fd5b61028c610287366004612edc565b6105f6565b6040519081526020015b60405180910390f35b6102b26102ad366004612c9a565b6106f3565b6040516001600160e01b03199091168152602001610296565b6102de6102d9366004612e27565b61076f565b005b6102e8600881565b60405160ff9091168152602001610296565b61028c600d5481565b6011546103109060ff1681565b6040519015158152602001610296565b61033361032e366004612e96565b6107b2565b6040805161ffff90941684526001600160501b0390921660208401526001600160a01b031690820152606001610296565b610310610372366004612edc565b610805565b61028c600c5481565b60185461028c9081565b60165461039d906001600160a01b031681565b6040516001600160a01b039091168152602001610296565b61028c601481565b600054600160a01b900460ff16610310565b61028c60105481565b6102e86103e6366004612edc565b610888565b6102de6103f9366004612d8e565b610917565b61028c61040c366004612d8e565b610e67565b61028c61041f366004612edc565b60086020526000908152604090205481565b61028c60095481565b61028c610448366004612edc565b610f41565b6102de610ff0565b6102de610463366004612e27565b611026565b6102de611063565b61028c600e5481565b6102de610487366004612edc565b611095565b6102de61049a366004612edc565b6110bf565b6102de6104ad366004612edc565b6110ee565b61028c6b07c13bc4b2c133c56000000081565b6102de6104d3366004612d39565b61111d565b6000546001600160a01b031661039d565b6102de6104f7366004612e96565b611428565b61028c60175481565b6102de6114aa565b61028c600b5481565b61028c600f5481565b61028c600a5481565b61028c60135481565b61039d61053f366004612edc565b6115d5565b610557610552366004612c27565b6116c4565b6040516102969190612fad565b6102de610572366004612dd0565b611780565b6102de610585366004612edc565b6119d5565b610333610598366004612edc565b60056020526000908152604090205461ffff8116906201000081046001600160501b031690600160601b90046001600160a01b031683565b6102de6105de366004612c61565b611a04565b6102de6105f1366004612c27565b611a5c565b60008181526005602090815260408083208151606081018352905461ffff811682526201000081046001600160501b031693820193909352600160601b9092046001600160a01b031690820152600e546b07c13bc4b2c133c56000000011156106945762015180600c5482602001516001600160501b0316426106799190613108565b61068391906130e9565b61068d91906130d5565b91506106ed565b60105481602001516001600160501b031611156106b457600091506106ed565b62015180600c5482602001516001600160501b03166010546106d69190613108565b6106e091906130e9565b6106ea91906130d5565b91505b50919050565b60006001600160a01b0385161561075d5760405162461bcd60e51b815260206004820152602360248201527f43616e6e6f742073656e6420746f6b656e7320746f204261726e206469726563604482015262746c7960e81b60648201526084015b60405180910390fd5b50630a85bd0160e11b95945050505050565b6000546001600160a01b031633146107995760405162461bcd60e51b815260040161075490613088565b80156107aa576107a7611af4565b50565b6107a7611b76565b600660205281600052604060002081815481106107ce57600080fd5b60009182526020909120015461ffff811692506201000081046001600160501b03169150600160601b90046001600160a01b031683565b60035460405163e05c57bf60e01b8152600481018390526000916001600160a01b03169063e05c57bf90602401604080518083038186803b15801561084957600080fd5b505afa15801561085d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108819190612e61565b5092915050565b60035460405163e05c57bf60e01b81526004810183905260009182916001600160a01b039091169063e05c57bf90602401604080518083038186803b1580156108d057600080fd5b505afa1580156108e4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109089190612e61565b91506106ea905081600861311f565b6002805414156109695760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610754565b60028055610981335b6001600160a01b03163b151590565b1561099e5760405162461bcd60e51b815260040161075490612ff1565b60115460ff166109e25760405162461bcd60e51b815260206004820152600f60248201526e149154d0d55148111254d050931151608a1b6044820152606401610754565b60408051606080820183526000808352602080840182905283850182905284519283018552818352820181905292810183905282805b85811015610e5957868682818110610a3257610a326131b3565b905060200201359450610a4485610805565b15610b8c576000858152600560209081526040918290208251606081018452905461ffff811682526201000081046001600160501b031692820192909252600160601b9091046001600160a01b031691810182905294503314610ab95760405162461bcd60e51b815260040161075490613032565b6000858152600560205260408120819055600f805460019290610add908490613108565b90915550506003546001600160a01b031663b88d4fde3033886040518463ffffffff1660e01b8152600401610b1493929190612f0e565b600060405180830381600087803b158015610b2e57600080fd5b505af1158015610b42573d6000803e3d6000fd5b5050604080518881526000602082015260018183015290517f6947144199e2d07c33c5916f272414aca924857d62b89d1b56d369262ab07a219350908190036060019150a1610e47565b610b9585610888565b60ff166000818152600660209081526040808320898452600890925290912054815492945090918110610bca57610bca6131b3565b600091825260209182902060408051606081018252929091015461ffff811683526201000081046001600160501b031693830193909352600160601b9092046001600160a01b031691810182905294503314610c385760405162461bcd60e51b815260040161075490613032565b8160096000828254610c4a9190613108565b909155505060008281526006602052604090208054610c6b90600190613108565b81548110610c7b57610c7b6131b3565b6000918252602080832060408051606081018252939091015461ffff811684526201000081046001600160501b031684840152600160601b90046001600160a01b0316838201528584526006825280842089855260089092529092205482549195508592918110610cee57610cee6131b3565b60009182526020808320845192018054858301516040968701516001600160a01b0316600160601b026001600160601b036001600160501b0390921662010000026001600160601b031990931661ffff968716179290921716179055888352600881528383205487519092168352838320919091558482526006905220805480610d7a57610d7a61319d565b6000828152602080822060001990840181018390559092019092558682526008905260408120556003546001600160a01b031663b88d4fde3033886040518463ffffffff1660e01b8152600401610dd393929190612f0e565b600060405180830381600087803b158015610ded57600080fd5b505af1158015610e01573d6000803e3d6000fd5b5050604080518881526000602082015260018183015290517f14ac2d855f81ac277fc8aad6d23e264f49d6c8411c0503dffaaffb96f89f35759350908190036060019150a15b80610e5181613142565b915050610a18565b505060016002555050505050565b6000805b8281101561088157610ea6848483818110610e8857610e886131b3565b9050602002016020810190610e9d9190612eb8565b61ffff16610805565b15610eef57610ede848483818110610ec057610ec06131b3565b9050602002016020810190610ed59190612eb8565b61ffff166105f6565b610ee890836130bd565b9150610f2f565b610f22848483818110610f0457610f046131b3565b9050602002016020810190610f199190612eb8565b61ffff16610f41565b610f2c90836130bd565b91505b80610f3981613142565b915050610e6b565b600080610f4d83610888565b60ff1660008181526006602090815260408083208784526008909252822054815493945091929091908110610f8457610f846131b3565b600091825260209182902060408051606081018252929091015461ffff811683526201000081046001600160501b0316938301849052600160601b90046001600160a01b031690820152600b54909250610fde9190613108565b610fe890836130e9565b949350505050565b6000546001600160a01b0316331461101a5760405162461bcd60e51b815260040161075490613088565b6110246000611bfa565b565b6000546001600160a01b031633146110505760405162461bcd60e51b815260040161075490613088565b6011805460ff1916911515919091179055565b6000546001600160a01b0316331461108d5760405162461bcd60e51b815260040161075490613088565b6107a7611c4a565b6000546001600160a01b031633146107a75760405162461bcd60e51b815260040161075490613088565b6000546001600160a01b031633146110e95760405162461bcd60e51b815260040161075490613088565b601755565b6000546001600160a01b031633146111185760405162461bcd60e51b815260040161075490613088565b601355565b6001600160a01b03831633148061114757506003546001600160a01b0316336001600160a01b0316145b6111935760405162461bcd60e51b815260206004820152601a60248201527f444f4e54204749564520594f555220544f4b454e5320415741590000000000006044820152606401610754565b60005b81811015611422576003546001600160a01b0316336001600160a01b0316146113555760035433906001600160a01b0316636352211e8585858181106111de576111de6131b3565b90506020020160208101906111f39190612eb8565b6040516001600160e01b031960e084901b16815261ffff909116600482015260240160206040518083038186803b15801561122d57600080fd5b505afa158015611241573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112659190612c44565b6001600160a01b0316146112ab5760405162461bcd60e51b815260206004820152600d60248201526c20a4a72a102ca7902a27a5a2a760991b6044820152606401610754565b6003546001600160a01b03166323b872dd33308686868181106112d0576112d06131b3565b90506020020160208101906112e59190612eb8565b6040516001600160e01b031960e086901b1681526001600160a01b03938416600482015292909116602483015261ffff166044820152606401600060405180830381600087803b15801561133857600080fd5b505af115801561134c573d6000803e3d6000fd5b50505050611389565b828282818110611367576113676131b3565b905060200201602081019061137c9190612eb8565b61ffff1661138957611410565b61139e838383818110610e8857610e886131b3565b156113dc576113d7848484848181106113b9576113b96131b3565b90506020020160208101906113ce9190612eb8565b61ffff16611d85565b611410565b611410848484848181106113f2576113f26131b3565b90506020020160208101906114079190612eb8565b61ffff16611f1f565b8061141a81613142565b915050611196565b50505050565b336001600160a01b037f000000000000000000000000f0d54349addcf704f77ae15b96510dea15cb795216146114a05760405162461bcd60e51b815260206004820152601f60248201527f4f6e6c7920565246436f6f7264696e61746f722063616e2066756c66696c6c006044820152606401610754565b60155550565b5050565b6000546001600160a01b031633146114d45760405162461bcd60e51b815260040161075490613088565b6016546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a082319060240160206040518083038186803b15801561151857600080fd5b505afa15801561152c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115509190612ef5565b60165460405163a9059cbb60e01b8152336004820152602481018390529192506001600160a01b03169063a9059cbb90604401602060405180830381600087803b15801561159d57600080fd5b505af11580156115b1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114a69190612e44565b6000600954600014156115ea57506000919050565b60006009548363ffffffff16611600919061315d565b60209390931c9290506000806116186003600861311f565b60ff1690505b600881116116b9576000818152600660205260409020546116409082906130e9565b61164a90836130bd565b9150818310611658576116a7565b60008181526006602052604090208054611672908761315d565b81548110611682576116826131b3565b600091825260209091200154600160601b90046001600160a01b031695945050505050565b806116b181613142565b91505061161e565b506000949350505050565b6001600160a01b03811660009081526007602052604081206060916116e882612052565b67ffffffffffffffff811115611700576117006131c9565b604051908082528060200260200182016040528015611729578160200160208202803683370190505b50905060005b61173883612052565b811015611778576117498382612062565b82828151811061175b5761175b6131b3565b60209081029190910101528061177081613142565b91505061172f565b509392505050565b600054600160a01b900460ff16156117aa5760405162461bcd60e51b81526004016107549061305e565b6b07c13bc4b2c133c560000000600e5410156118115762015180600c54600f54601054426117d89190613108565b6117e291906130e9565b6117ec91906130e9565b6117f691906130d5565b600e600082825461180791906130bd565b9091555050426010555b6002805414156118635760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610754565b6002805561187033610972565b1561188d5760405162461bcd60e51b815260040161075490612ff1565b6000805b8381101561194b576118ae858583818110610e8857610e886131b3565b156118f8576118e78585838181106118c8576118c86131b3565b90506020020160208101906118dd9190612eb8565b61ffff1684612075565b6118f190836130bd565b9150611939565b61192c85858381811061190d5761190d6131b3565b90506020020160208101906119229190612eb8565b61ffff168461237e565b61193690836130bd565b91505b8061194381613142565b915050611891565b508061195757506119cb565b6004546001600160a01b03166340c10f19336040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260248101849052604401600060405180830381600087803b1580156119b157600080fd5b505af11580156119c5573d6000803e3d6000fd5b50505050505b5050600160025550565b6000546001600160a01b031633146119ff5760405162461bcd60e51b815260040161075490613088565b600c55565b6000546001600160a01b03163314611a2e5760405162461bcd60e51b815260040161075490613088565b600380546001600160a01b039384166001600160a01b03199182161790915560048054929093169116179055565b6000546001600160a01b03163314611a865760405162461bcd60e51b815260040161075490613088565b6001600160a01b038116611aeb5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610754565b6107a781611bfa565b600054600160a01b900460ff1615611b1e5760405162461bcd60e51b81526004016107549061305e565b6000805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258611b593390565b6040516001600160a01b03909116815260200160405180910390a1565b600054600160a01b900460ff16611bc65760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610754565b6000805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa33611b59565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000601754611c5860185490565b11611c7157611c6b601880546001019055565b50600090565b6013546040516370a0823160e01b81523060048201527f000000000000000000000000514910771af9ca656af840dff83e8264ecf986ca6001600160a01b0316906370a082319060240160206040518083038186803b158015611cd357600080fd5b505afa158015611ce7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d0b9190612ef5565b1015611d6d5760405162461bcd60e51b815260206004820152602b60248201527f4e6f7420656e6f756768204c494e4b202d2066696c6c20636f6e74726163742060448201526a1dda5d1a0819985d58d95d60aa1b6064820152608401610754565b6000601855611d80601254601354612811565b905090565b600054600160a01b900460ff1615611daf5760405162461bcd60e51b81526004016107549061305e565b6b07c13bc4b2c133c560000000600e541015611e165762015180600c54600f5460105442611ddd9190613108565b611de791906130e9565b611df191906130e9565b611dfb91906130d5565b600e6000828254611e0c91906130bd565b9091555050426010555b6040805160608101825261ffff80841682526001600160501b0342811660208085019182526001600160a01b03808916868801908152600089815260059093529682209551865493519751909116600160601b026001600160601b039790941662010000026001600160601b03199093169416939093171793909316929092179055600f805460019290611eab9084906130bd565b9091555050604080516001600160a01b038416815260208101839052428183015290517f6173e4d2d9dd52aae0ed37afed3adcf924a490639b759ca93d32dc43366c17d29181900360600190a16001600160a01b0382166000908152600760205260409020611f1a908261299b565b505050565b6000611f2a82610888565b60ff1690508060096000828254611f4191906130bd565b9091555050600081815260066020818152604080842080548786526008845282862081905593835281516060808201845261ffff808a168352600b80546001600160501b039081168589019081526001600160a01b038e8116878a0181815260018d018a55988d529b8a9020965196909a01805491519751969094166001600160601b031990911617620100009690911695909502949094176001600160601b0316600160601b93909716929092029590951790555481519485529184018690528301527f6173e4d2d9dd52aae0ed37afed3adcf924a490639b759ca93d32dc43366c17d2910160405180910390a16001600160a01b0383166000908152600760205260409020611422908361299b565b600061205c825490565b92915050565b600061206e83836129a7565b9392505050565b60008281526005602090815260408083208151606081018352905461ffff811682526201000081046001600160501b031693820193909352600160601b9092046001600160a01b031690820181905233146120e25760405162461bcd60e51b815260040161075490613032565b8280156121075750600d546020820151612105906001600160501b031642613108565b105b156121605760405162461bcd60e51b8152602060048201526024808201527f474f4e4e4120424520434f4c4420574954484f55542054574f2044415927532060448201526315d3d3d360e21b6064820152608401610754565b612169846105f6565b9150821561225957612179611c4a565b50612183846129d1565b6001166001141561219c5761219782612a34565b600091505b6000848152600560205260408120819055600f8054600192906121c0908490613108565b909155506121ef90508460076000335b6001600160a01b03168152602081019190915260400160002090612a8d565b506003546001600160a01b031663b88d4fde3033876040518463ffffffff1660e01b815260040161222293929190612f0e565b600060405180830381600087803b15801561223c57600080fd5b505af1158015612250573d6000803e3d6000fd5b50505050612336565b61227860646122696014856130e9565b61227391906130d5565b612a34565b60405180606001604052808561ffff168152602001426001600160501b031681526020016122a33390565b6001600160a01b0390811690915260008681526005602090815260409182902084518154928601519590930151909316600160601b026001600160601b036001600160501b0390951662010000026001600160601b031990921661ffff909316929092171792909216919091179055606461231f601482613108565b61232990846130e9565b61233391906130d5565b91505b60408051858152602081018490528415158183015290517f6947144199e2d07c33c5916f272414aca924857d62b89d1b56d369262ab07a219181900360600190a15092915050565b60008061238a84610888565b60ff16600081815260066020908152604080832088845260089092528220548154939450919290919081106123c1576123c16131b3565b600091825260209182902060408051606081018252929091015461ffff811683526001600160501b0362010000820416938301939093526001600160a01b03600160601b90930483168282015260035490516331a9108f60e11b81526004810189905291935030921690636352211e9060240160206040518083038186803b15801561244c57600080fd5b505afa158015612460573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124849190612c44565b6001600160a01b0316146124da5760405162461bcd60e51b815260206004820152601760248201527f41494e5420412050415254204f4620544845205041434b0000000000000000006044820152606401610754565b60408101516001600160a01b031633146125065760405162461bcd60e51b815260040161075490613032565b61250f85610f41565b925083156126fc5781600960008282546125299190613108565b90915550506000828152600660205260408120805461254a90600190613108565b8154811061255a5761255a6131b3565b6000918252602080832060408051606081018252939091015461ffff811684526201000081046001600160501b031684840152600160601b90046001600160a01b031683820152868452600682528084208a8552600890925290922054825491935083929181106125cd576125cd6131b3565b60009182526020808320845192018054858301516040968701516001600160a01b0316600160601b026001600160601b036001600160501b0390921662010000026001600160601b031990931661ffff9687161792909217161790558983526008815283832054855190921683528383209190915585825260069052208054806126595761265961319d565b6000828152602080822060001990840181018390559092019092558782526008905260408120819055612691908790600790336121d0565b506003546001600160a01b031663b88d4fde3033896040518463ffffffff1660e01b81526004016126c493929190612f0e565b600060405180830381600087803b1580156126de57600080fd5b505af11580156126f2573d6000803e3d6000fd5b50505050506127c8565b60405180606001604052808661ffff168152602001600b546001600160501b031681526020016127293390565b6001600160a01b03169052600083815260066020908152604080832089845260089092529091205481548110612761576127616131b3565b6000918252602091829020835191018054928401516040909401516001600160a01b0316600160601b026001600160601b036001600160501b0390951662010000026001600160601b031990941661ffff9093169290921792909217929092169190911790555b60408051868152602081018590528515158183015290517f14ac2d855f81ac277fc8aad6d23e264f49d6c8411c0503dffaaffb96f89f35759181900360600190a1505092915050565b60007f000000000000000000000000514910771af9ca656af840dff83e8264ecf986ca6001600160a01b0316634000aea07f000000000000000000000000f0d54349addcf704f77ae15b96510dea15cb795284866000604051602001612881929190918252602082015260400190565b6040516020818303038152906040526040518463ffffffff1660e01b81526004016128ae93929190612f41565b602060405180830381600087803b1580156128c857600080fd5b505af11580156128dc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129009190612e44565b50600083815260016020818152604080842054815180840189905280830186905230606082015260808082018390528351808303909101815260a0909101909252815191830191909120938790529082905261295b916130bd565b600085815260016020526040902055610fe88482604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b600061206e8383612a99565b60008260000182815481106129be576129be6131b3565b9060005260206000200154905092915050565b6000326129df600143613108565b60155460405160609390931b6001600160601b03191660208401529040603483015242605483015260748201849052609482015260b40160408051601f19818403018152919052805160209091012092915050565b600954612a555780600a6000828254612a4d91906130bd565b909155505050565b600954600a54612a6590836130bd565b612a6f91906130d5565b600b6000828254612a8091906130bd565b90915550506000600a5550565b600061206e8383612ae8565b6000818152600183016020526040812054612ae05750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561205c565b50600061205c565b60008181526001830160205260408120548015612bd1576000612b0c600183613108565b8554909150600090612b2090600190613108565b9050818114612b85576000866000018281548110612b4057612b406131b3565b9060005260206000200154905080876000018481548110612b6357612b636131b3565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080612b9657612b9661319d565b60019003818190600052602060002001600090559055856001016000868152602001908152602001600020600090556001935050505061205c565b600091505061205c565b60008083601f840112612bed57600080fd5b50813567ffffffffffffffff811115612c0557600080fd5b6020830191508360208260051b8501011115612c2057600080fd5b9250929050565b600060208284031215612c3957600080fd5b813561206e816131df565b600060208284031215612c5657600080fd5b815161206e816131df565b60008060408385031215612c7457600080fd5b8235612c7f816131df565b91506020830135612c8f816131df565b809150509250929050565b600080600080600060808688031215612cb257600080fd5b8535612cbd816131df565b94506020860135612ccd816131df565b935060408601359250606086013567ffffffffffffffff80821115612cf157600080fd5b818801915088601f830112612d0557600080fd5b813581811115612d1457600080fd5b896020828501011115612d2657600080fd5b9699959850939650602001949392505050565b600080600060408486031215612d4e57600080fd5b8335612d59816131df565b9250602084013567ffffffffffffffff811115612d7557600080fd5b612d8186828701612bdb565b9497909650939450505050565b60008060208385031215612da157600080fd5b823567ffffffffffffffff811115612db857600080fd5b612dc485828601612bdb565b90969095509350505050565b600080600060408486031215612de557600080fd5b833567ffffffffffffffff811115612dfc57600080fd5b612e0886828701612bdb565b9094509250506020840135612e1c816131f4565b809150509250925092565b600060208284031215612e3957600080fd5b813561206e816131f4565b600060208284031215612e5657600080fd5b815161206e816131f4565b60008060408385031215612e7457600080fd5b8251612e7f816131f4565b602084015190925060ff81168114612c8f57600080fd5b60008060408385031215612ea957600080fd5b50508035926020909101359150565b600060208284031215612eca57600080fd5b813561ffff8116811461206e57600080fd5b600060208284031215612eee57600080fd5b5035919050565b600060208284031215612f0757600080fd5b5051919050565b6001600160a01b039384168152919092166020820152604081019190915260806060820181905260009082015260a00190565b60018060a01b038416815260006020848184015260606040840152835180606085015260005b81811015612f8357858101830151858201608001528201612f67565b81811115612f95576000608083870101525b50601f01601f19169290920160800195945050505050565b6020808252825182820181905260009190848201906040850190845b81811015612fe557835183529284019291840191600101612fc9565b50909695505050505050565b60208082526021908201527f436f6e74726163747320617265206e6f7420616c6c6f77656420626967206d616040820152603760f91b606082015260800190565b6020808252601290820152715357495045522c204e4f2053574950494e4760701b604082015260600190565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600082198211156130d0576130d0613171565b500190565b6000826130e4576130e4613187565b500490565b600081600019048311821515161561310357613103613171565b500290565b60008282101561311a5761311a613171565b500390565b600060ff821660ff84168082101561313957613139613171565b90039392505050565b600060001982141561315657613156613171565b5060010190565b60008261316c5761316c613187565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107a757600080fd5b80151581146107a757600080fdfea26469706673582212203fcb9d46190cda851f983316dae91a78417c66fa1e865773fa612463fc71df8a64736f6c63430008070033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000e27a60f3cf27f716ac998b61492a36090973aac7000000000000000000000000f422b6f41a14fb74b21cb95a8d82971a3b527117000000000000000000000000f0d54349addcf704f77ae15b96510dea15cb7952000000000000000000000000514910771af9ca656af840dff83e8264ecf986ca
-----Decoded View---------------
Arg [0] : _roar (address): 0xE27A60F3CF27F716Ac998b61492a36090973Aac7
Arg [1] : _salmon (address): 0xF422B6f41a14Fb74b21CB95a8d82971a3b527117
Arg [2] : _vrfCoordinator (address): 0xf0d54349aDdcf704F77AE15b96510dEA15cb7952
Arg [3] : _link (address): 0x514910771AF9Ca656af840dff83E8264EcF986CA
-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 000000000000000000000000e27a60f3cf27f716ac998b61492a36090973aac7
Arg [1] : 000000000000000000000000f422b6f41a14fb74b21cb95a8d82971a3b527117
Arg [2] : 000000000000000000000000f0d54349addcf704f77ae15b96510dea15cb7952
Arg [3] : 000000000000000000000000514910771af9ca656af840dff83e8264ecf986ca
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.