Contract 0xa150492a6f8107b9f4ad0dce0ed31310942ad38e 1

 
Txn Hash Method
Block
From
To
Value [Txn Fee]
0x1c54e11219c6dc00a46f591326ff77dbc6cf64a7858cb355ae178fdd2633e3ccLock417595842022-11-28 1:40:3310 hrs 51 mins ago0xfdfe0847cd314d7c3855a6f19d83e92355cd4e8a IN  0xa150492a6f8107b9f4ad0dce0ed31310942ad38e0 ETH0.00002176
0x9e5855b3a6ada636996394aad30061262e8742736c1d0b5019996a620ed8c70fRelock414277812022-11-26 17:39:321 day 18 hrs ago0xba189a4f264f5a434b5dcd49df5ab150dd0e54ae IN  0xa150492a6f8107b9f4ad0dce0ed31310942ad38e0 ETH0.00002052
0x73170aadb4cee3fc909c7d07e91f52cb6bbb6960317d473ba6c54c0ac161df4bRelock414277642022-11-26 17:39:251 day 18 hrs ago0xba189a4f264f5a434b5dcd49df5ab150dd0e54ae IN  0xa150492a6f8107b9f4ad0dce0ed31310942ad38e0 ETH0.00002061
0x4c4c9fa700ac4f2af9961465c9fceaa3039d52766dcc07f663fb7889e2ab8109Relock414277432022-11-26 17:39:171 day 18 hrs ago0xba189a4f264f5a434b5dcd49df5ab150dd0e54ae IN  0xa150492a6f8107b9f4ad0dce0ed31310942ad38e0 ETH0.00002061
0x60f78b1392316cc38c88c94c753b09f090c10f54aa8c7b6295ac828f375840dfLock414144922022-11-26 16:29:451 day 20 hrs ago0xfdfe0847cd314d7c3855a6f19d83e92355cd4e8a IN  0xa150492a6f8107b9f4ad0dce0ed31310942ad38e0 ETH0.00002787
0x16a760d2f86ce45cf53545b0386a1bfbdf7d9effc63a08842a5ae4ba1abf80a9Lock409066542022-11-24 19:21:313 days 17 hrs ago0xfdfe0847cd314d7c3855a6f19d83e92355cd4e8a IN  0xa150492a6f8107b9f4ad0dce0ed31310942ad38e0 ETH0.00002761
0x2dc3e8b85fe17e8a2c79ee435266f181d8a8b876b2606172c7ddc71c62790673Lock405805912022-11-23 15:16:004 days 21 hrs ago0xfdfe0847cd314d7c3855a6f19d83e92355cd4e8a IN  0xa150492a6f8107b9f4ad0dce0ed31310942ad38e0 ETH0.00002716
0xdd0603ea0a315b19a159b6cb2ebe7086991c859c016567ba820811f7ac4063acLock404129782022-11-23 2:02:315 days 10 hrs ago0xfdfe0847cd314d7c3855a6f19d83e92355cd4e8a IN  0xa150492a6f8107b9f4ad0dce0ed31310942ad38e0 ETH0.00002381
0xaf5d2a5fbf70d3880e8bb961f9e220946b1e07f9ca429eebe6f6a633accf40b4Unlock404076992022-11-23 1:31:395 days 11 hrs ago0x196eb61840ca3165a9940d6b078eea73480940a6 IN  0xa150492a6f8107b9f4ad0dce0ed31310942ad38e0 ETH0.00001671
0xece4e279cd79f00102e7cf9392b6d3a5198d6c84e931b8575df755ec4d625dcdUnlock404075652022-11-23 1:30:535 days 11 hrs ago0x196eb61840ca3165a9940d6b078eea73480940a6 IN  0xa150492a6f8107b9f4ad0dce0ed31310942ad38e0 ETH0.00001671
0x78a15a838875aed942657d7c810a25165101236cd1afef5b35056673ae211223Lock403077002022-11-22 17:08:055 days 19 hrs ago0xfe43c1e054098c5178ec347cbb858593b7201047 IN  0xa150492a6f8107b9f4ad0dce0ed31310942ad38e0 ETH0.00003356
0xfcbb337d641e329d3dae967c4c2c9fa5ac7f9f0e6bda0c87fe8d1771366ef55cLock391738362022-11-19 0:07:519 days 12 hrs ago0xfe43c1e054098c5178ec347cbb858593b7201047 IN  0xa150492a6f8107b9f4ad0dce0ed31310942ad38e0 ETH0.00002296
0x2cbba4826870895d8e95cd1ad16ced645480d68f3393184abf73ef9e7ea67e75Lock391737782022-11-19 0:07:249 days 12 hrs ago0xfe43c1e054098c5178ec347cbb858593b7201047 IN  0xa150492a6f8107b9f4ad0dce0ed31310942ad38e0 ETH0.00002296
0xe42032912835d5dea137d698f007ac641a40b1d848c997b4dc97610cf6c0ebc2Lock391737002022-11-19 0:06:469 days 12 hrs ago0xfe43c1e054098c5178ec347cbb858593b7201047 IN  0xa150492a6f8107b9f4ad0dce0ed31310942ad38e0 ETH0.00002289
0xdd2a248ddb39136412cd0a43a3d4946bf863e0d5bf97fd98c91931ae09121b55Lock391736662022-11-19 0:06:299 days 12 hrs ago0xfe43c1e054098c5178ec347cbb858593b7201047 IN  0xa150492a6f8107b9f4ad0dce0ed31310942ad38e0 ETH0.00002296
0x36421a22cdd411656e7522c08f712b5f2c1a5dc28d57e709ecbfa34a900c7406Relock391027012022-11-18 16:41:339 days 19 hrs ago0x98abb17006aaa4f29f60cb8c9c3db70b174eba24 IN  0xa150492a6f8107b9f4ad0dce0ed31310942ad38e0 ETH0.00005239
0x4a54b4c26977392723a5ee0e65878622aa30bc68154a97fc0b2b1b54ba63ff02Relock391024902022-11-18 16:40:229 days 19 hrs ago0x98abb17006aaa4f29f60cb8c9c3db70b174eba24 IN  0xa150492a6f8107b9f4ad0dce0ed31310942ad38e0 ETH0.00005239
0x16668d46e039f1b84f1352920d37c1622b7aa2dea7f0ce8865b242e625860521Unlock390139222022-11-18 9:33:0710 days 2 hrs ago0xd112071a5837ac1f69e40fac7a25caaa9baafbcd IN  0xa150492a6f8107b9f4ad0dce0ed31310942ad38e0 ETH0.00001648
0x5efb4c5bdc7efa3e514af24f63ef2c26b95fc8fdd09a14343563da9ae7c65019Relock386726582022-11-16 23:24:4411 days 13 hrs ago0x55d82b654b71bd2dd2ff8975361379922f0e9b68 IN  0xa150492a6f8107b9f4ad0dce0ed31310942ad38e0 ETH0.00003535
0xbc60785f71f9d40b474c0c8d2d9be74df98580048486f1eada4ac211362f537fRelock386725992022-11-16 23:24:1611 days 13 hrs ago0x55d82b654b71bd2dd2ff8975361379922f0e9b68 IN  0xa150492a6f8107b9f4ad0dce0ed31310942ad38e0 ETH0.00003535
0xcb1109e1569190d923a93b9f7e2349e67036b37095aea52850e2af4c7023be7dRelock386722552022-11-16 23:21:3011 days 13 hrs ago0x55d82b654b71bd2dd2ff8975361379922f0e9b68 IN  0xa150492a6f8107b9f4ad0dce0ed31310942ad38e0 ETH0.00003544
0x1b4d547c4504623d906348006c1e7bd5bd474b01cf7cfb0de4502cfec5869401Relock386722112022-11-16 23:21:1211 days 13 hrs ago0x55d82b654b71bd2dd2ff8975361379922f0e9b68 IN  0xa150492a6f8107b9f4ad0dce0ed31310942ad38e0 ETH0.00003544
0xe52a0874a02b2f5954042121239aa5a57c784f09d4c41fb00c8d076e7eebdc1cRelock386721512022-11-16 23:20:4411 days 13 hrs ago0x55d82b654b71bd2dd2ff8975361379922f0e9b68 IN  0xa150492a6f8107b9f4ad0dce0ed31310942ad38e0 ETH0.00003544
0x72fe8a864c8a24cef58bea525bf25be8ea6b8cb330394a809b0a6b96dead8315Relock386720862022-11-16 23:20:1611 days 13 hrs ago0x55d82b654b71bd2dd2ff8975361379922f0e9b68 IN  0xa150492a6f8107b9f4ad0dce0ed31310942ad38e0 ETH0.00003535
0x3469c691957307f690fe4d778c63e0ebda22a199cf6ad70d9194ae2b11801afaRelock386720022022-11-16 23:19:4311 days 13 hrs ago0x55d82b654b71bd2dd2ff8975361379922f0e9b68 IN  0xa150492a6f8107b9f4ad0dce0ed31310942ad38e0 ETH0.00003544
[ Download CSV Export 
Latest 25 internal transaction
Parent Txn Hash Block From To Value
0x09b4eaac9a7e322265bd52a6916a49368f838b2b30dd274b152068b4ddcf9bbb417940882022-11-28 5:07:097 hrs 24 mins ago 0x1a8b020f621a43abb0ee600b3a38b5b40b750656 0xa150492a6f8107b9f4ad0dce0ed31310942ad38e0 ETH
0x1c54e11219c6dc00a46f591326ff77dbc6cf64a7858cb355ae178fdd2633e3cc417595842022-11-28 1:40:3310 hrs 51 mins ago 0xa150492a6f8107b9f4ad0dce0ed31310942ad38e 0x9b7723244b62b49b57092aa8003fe8f49e0fd91e0 ETH
0x1c54e11219c6dc00a46f591326ff77dbc6cf64a7858cb355ae178fdd2633e3cc417595842022-11-28 1:40:3310 hrs 51 mins ago 0xa150492a6f8107b9f4ad0dce0ed31310942ad38e 0x9b7723244b62b49b57092aa8003fe8f49e0fd91e0 ETH
0x54ab554dcc0f3c217d7b195ff6599d465c45fe6552135c42a57a54bca03108af417434742022-11-27 23:54:0012 hrs 37 mins ago 0x1a8b020f621a43abb0ee600b3a38b5b40b750656 0xa150492a6f8107b9f4ad0dce0ed31310942ad38e0 ETH
0xa59764832b4c0b716aa3d396c143df32e0d44c2a59c7d176d6310198d406fc3f417310492022-11-27 22:25:3414 hrs 6 mins ago 0x1a8b020f621a43abb0ee600b3a38b5b40b750656 0xa150492a6f8107b9f4ad0dce0ed31310942ad38e0 ETH
0xf4413fcf661dfe8e8a686e67d3dde7f7d12dce2cb92fd345b5eee88863301416416362452022-11-27 14:04:3622 hrs 27 mins ago 0x1a8b020f621a43abb0ee600b3a38b5b40b750656 0xa150492a6f8107b9f4ad0dce0ed31310942ad38e0 ETH
0x9e5855b3a6ada636996394aad30061262e8742736c1d0b5019996a620ed8c70f414277812022-11-26 17:39:321 day 18 hrs ago 0xa150492a6f8107b9f4ad0dce0ed31310942ad38e 0x9b7723244b62b49b57092aa8003fe8f49e0fd91e0 ETH
0x9e5855b3a6ada636996394aad30061262e8742736c1d0b5019996a620ed8c70f414277812022-11-26 17:39:321 day 18 hrs ago 0xa150492a6f8107b9f4ad0dce0ed31310942ad38e 0x9b7723244b62b49b57092aa8003fe8f49e0fd91e0 ETH
0x73170aadb4cee3fc909c7d07e91f52cb6bbb6960317d473ba6c54c0ac161df4b414277642022-11-26 17:39:251 day 18 hrs ago 0xa150492a6f8107b9f4ad0dce0ed31310942ad38e 0x9b7723244b62b49b57092aa8003fe8f49e0fd91e0 ETH
0x73170aadb4cee3fc909c7d07e91f52cb6bbb6960317d473ba6c54c0ac161df4b414277642022-11-26 17:39:251 day 18 hrs ago 0xa150492a6f8107b9f4ad0dce0ed31310942ad38e 0x9b7723244b62b49b57092aa8003fe8f49e0fd91e0 ETH
0x4c4c9fa700ac4f2af9961465c9fceaa3039d52766dcc07f663fb7889e2ab8109414277432022-11-26 17:39:171 day 18 hrs ago 0xa150492a6f8107b9f4ad0dce0ed31310942ad38e 0x9b7723244b62b49b57092aa8003fe8f49e0fd91e0 ETH
0x4c4c9fa700ac4f2af9961465c9fceaa3039d52766dcc07f663fb7889e2ab8109414277432022-11-26 17:39:171 day 18 hrs ago 0xa150492a6f8107b9f4ad0dce0ed31310942ad38e 0x9b7723244b62b49b57092aa8003fe8f49e0fd91e0 ETH
0x60f78b1392316cc38c88c94c753b09f090c10f54aa8c7b6295ac828f375840df414144922022-11-26 16:29:451 day 20 hrs ago 0xa150492a6f8107b9f4ad0dce0ed31310942ad38e 0x9b7723244b62b49b57092aa8003fe8f49e0fd91e0 ETH
0x60f78b1392316cc38c88c94c753b09f090c10f54aa8c7b6295ac828f375840df414144922022-11-26 16:29:451 day 20 hrs ago 0xa150492a6f8107b9f4ad0dce0ed31310942ad38e 0x9b7723244b62b49b57092aa8003fe8f49e0fd91e0 ETH
0xfb0617e9db21018c176260e15b075fda16a0c2f037f645b713f1a26a987a78f1413417582022-11-26 10:48:002 days 1 hr ago 0x1a8b020f621a43abb0ee600b3a38b5b40b750656 0xa150492a6f8107b9f4ad0dce0ed31310942ad38e0 ETH
0xd03999d1a0f8fff8d6b3994d2b29be9946c0f247c6abbf2317f5eeb1ad8710e0412067302022-11-25 22:31:352 days 14 hrs ago 0x1a8b020f621a43abb0ee600b3a38b5b40b750656 0xa150492a6f8107b9f4ad0dce0ed31310942ad38e0 ETH
0x16a760d2f86ce45cf53545b0386a1bfbdf7d9effc63a08842a5ae4ba1abf80a9409066542022-11-24 19:21:313 days 17 hrs ago 0xa150492a6f8107b9f4ad0dce0ed31310942ad38e 0x9b7723244b62b49b57092aa8003fe8f49e0fd91e0 ETH
0x16a760d2f86ce45cf53545b0386a1bfbdf7d9effc63a08842a5ae4ba1abf80a9409066542022-11-24 19:21:313 days 17 hrs ago 0xa150492a6f8107b9f4ad0dce0ed31310942ad38e 0x9b7723244b62b49b57092aa8003fe8f49e0fd91e0 ETH
0x9a8d0f44387376c417f972d5b4a98db5d271f7e106dbc27c9df0c233103eb5f4408441062022-11-24 14:12:143 days 22 hrs ago 0x1a8b020f621a43abb0ee600b3a38b5b40b750656 0xa150492a6f8107b9f4ad0dce0ed31310942ad38e0 ETH
0xd727d11f19071a6875663a8e119b8cc1a852e93e9379079ed28ac66f58d66399407693792022-11-24 8:19:404 days 4 hrs ago 0x1a8b020f621a43abb0ee600b3a38b5b40b750656 0xa150492a6f8107b9f4ad0dce0ed31310942ad38e0 ETH
0xf08f66d269816ceb151b6c64b4746844a3e0977aba0e221996dcab909293c8a0407666002022-11-24 8:06:554 days 4 hrs ago 0x1a8b020f621a43abb0ee600b3a38b5b40b750656 0xa150492a6f8107b9f4ad0dce0ed31310942ad38e0 ETH
0x2dc3e8b85fe17e8a2c79ee435266f181d8a8b876b2606172c7ddc71c62790673405805912022-11-23 15:16:004 days 21 hrs ago 0xa150492a6f8107b9f4ad0dce0ed31310942ad38e 0x9b7723244b62b49b57092aa8003fe8f49e0fd91e0 ETH
0x2dc3e8b85fe17e8a2c79ee435266f181d8a8b876b2606172c7ddc71c62790673405805912022-11-23 15:16:004 days 21 hrs ago 0xa150492a6f8107b9f4ad0dce0ed31310942ad38e 0x9b7723244b62b49b57092aa8003fe8f49e0fd91e0 ETH
0x4e3540ccdf492c35d573a8f3e2513ddd4429c347cd7ff81dd0a07eaef561f648405658162022-11-23 14:11:274 days 22 hrs ago 0x1a8b020f621a43abb0ee600b3a38b5b40b750656 0xa150492a6f8107b9f4ad0dce0ed31310942ad38e0 ETH
0xdd0603ea0a315b19a159b6cb2ebe7086991c859c016567ba820811f7ac4063ac404129782022-11-23 2:02:315 days 10 hrs ago 0xa150492a6f8107b9f4ad0dce0ed31310942ad38e 0x9b7723244b62b49b57092aa8003fe8f49e0fd91e0 ETH
[ Download CSV Export 
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
SharksLocking

Compiler Version
v0.8.9+commit.e5eed63a

Optimization Enabled:
No with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 19 : SharksLocking.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
import "./Sharks.sol";
import "@openzeppelin/contracts/utils/math/Math.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";

contract SharksLocking is AccessControl {
    Sharks public sharks;

    uint256 public constant WEEK = 7 days;
    uint256 public xpPerWeek;
    uint256 public maxLockWeeksCount;
    mapping(uint256 => uint256) public lockedAt;
    mapping(uint256 => uint256) public lockedUntil;

    bytes32 public constant LOCK_MANAGER = keccak256("LOCK_MANAGER");

    event Locked(uint256 indexed tokenId, uint256 until, uint256 xpIncrease);
    event Relocked(uint256 indexed tokenId, uint256 until, uint256 xpIncrease);
    event Unlocked(uint256 indexed tokenId, uint256 lockedForWeeksCount);
    event XpPerWeekChanged(uint256 xpWeekWeek);
    event MaxLockWeeksCountChanged(uint256 maxLockWeeksCount);
    event LockUpdated(uint256 indexed tokenId, uint256 at, uint256 until, address lockManager);

    modifier onlySharkOwner(uint256 tokenId_) {
        require(sharks.ownerOf(tokenId_) == msg.sender, "SharksLocking: You do not own this shark");
        _;
    }

    constructor(address sharksAddress_) {
        sharks = Sharks(sharksAddress_);
        xpPerWeek = 168; // 1XP/h
        maxLockWeeksCount = 52;

        _setupRole(DEFAULT_ADMIN_ROLE, msg.sender);
    }

    function lockMany(uint256[] calldata tokenIds_, uint256 weeksCount_) public {
        for (uint256 i = 0; i < tokenIds_.length; i++) {
            lock(tokenIds_[i], weeksCount_);
        }
    }

    function relockMany(uint256[] calldata tokenIds_, uint256 weeksCount_) public {
        for (uint256 i = 0; i < tokenIds_.length; i++) {
            relock(tokenIds_[i], weeksCount_);
        }
    }

    function unlockMany(uint256[] calldata tokenIds_) public {
        for (uint256 i = 0; i < tokenIds_.length; i++) {
            unlock(tokenIds_[i]);
        }
    }


    function lock(uint256 tokenId_, uint256 weeksCount_) public onlySharkOwner(tokenId_) {
        require(lockedUntil[tokenId_] == 0, "SharksLocking: already locked");
        require(weeksCount_ > 0, "SharksLocking: must lock for at least 1 week");
        require(weeksCount_ <= maxLockWeeksCount, "SharksLocking: cannot lock for more than maxLockWeeksCount");

        uint256 _xpIncrease = calculateXpIncrease(weeksCount_);
        uint256 _lockedUntilTimestamp = block.timestamp + weeksToSeconds(weeksCount_);

        lockedAt[tokenId_] = block.timestamp;
        lockedUntil[tokenId_] = _lockedUntilTimestamp;

        sharks.increaseXp(
            tokenId_,
            _xpIncrease
        );

        emit Locked(
            tokenId_,
            _lockedUntilTimestamp,
            _xpIncrease
        );
    }

    function relock(uint256 tokenId_, uint256 weeksCount_) public onlySharkOwner(tokenId_) {
        require(lockedUntil[tokenId_] > 0, "SharksLocking: not locked yet");
        require(weeksCount_ > 0, "SharksLocking: must relock for at least 1 week");
        require(weeksCount_ <= maxLockWeeksCount, "SharksLocking: cannot relock for more than maxLockWeeksCount");

        uint256 _weeksRemainingCount;
        uint256 _baseTimestamp;
        if (lockedUntil[tokenId_] > block.timestamp) {
            _weeksRemainingCount = ((lockedUntil[tokenId_] - block.timestamp) / WEEK) + 1;
            _baseTimestamp = lockedUntil[tokenId_];
        } else {
            _weeksRemainingCount = 0;
            _baseTimestamp = block.timestamp;
        }

        uint256 _actualMaxLockWeeksCount = maxLockWeeksCount - _weeksRemainingCount;

        if (weeksCount_ > _actualMaxLockWeeksCount) {
            revert(string(abi.encodePacked(
                "SharksLocking: can only relock for ",
                Strings.toString(_actualMaxLockWeeksCount),
                " weeks max "
            )));
        }

        uint256 _xpIncrease = calculateXpIncrease(weeksCount_);

        uint256 _lockedUntilTimestamp = _baseTimestamp + weeksToSeconds(weeksCount_);

        lockedUntil[tokenId_] = _lockedUntilTimestamp;

        sharks.increaseXp(
            tokenId_,
            _xpIncrease
        );

        emit Relocked(
            tokenId_,
            _lockedUntilTimestamp,
            _xpIncrease
        );
    }

    function unlock(uint256 tokenId_) public onlySharkOwner(tokenId_) {
        require(lockedUntil[tokenId_] > 0, "SharksLocking: not locked");
        require(block.timestamp > lockedUntil[tokenId_], "SharksLocking: cannot unlock yet");

        uint256 _lockedForWeeksCount = (lockedUntil[tokenId_] - lockedAt[tokenId_]) / WEEK;

        lockedAt[tokenId_] = 0;
        lockedUntil[tokenId_] = 0;

        emit Unlocked(
            tokenId_,
            _lockedForWeeksCount
        );
    }

    function updateLock(uint256 tokenId_, uint256 lockedAt_, uint256 lockedUntil_) public onlyRole(LOCK_MANAGER) {
        lockedAt[tokenId_] = lockedAt_;
        lockedUntil[tokenId_] = lockedUntil_;

        emit LockUpdated(
            tokenId_,
            lockedAt_,
            lockedUntil_,
            msg.sender
        );
    }

    function setXpPerWeek(uint256 xpPerWeek_) external onlyRole(DEFAULT_ADMIN_ROLE) {
        xpPerWeek = xpPerWeek_;
        emit XpPerWeekChanged(xpPerWeek);
    }

    function setMaxLockWeeksCount(uint256 maxLockWeeksCount_) external onlyRole(DEFAULT_ADMIN_ROLE) {
        maxLockWeeksCount = maxLockWeeksCount_;
        emit MaxLockWeeksCountChanged(maxLockWeeksCount);
    }

    function sharkCanBeTransferred(uint tokenId_) public view returns (bool) {
        if (lockedUntil[tokenId_] == 0) {
            return true;
        } else {
            return false;
        }
    }

    function calculateXpIncrease(uint256 weeksCount_) public view returns (uint256) {
        return weeksCount_ * xpPerWeek;
    }

    function weeksToSeconds(uint256 weeksCount_) public pure returns (uint256) {
        return weeksCount_ * WEEK;
    }
}

File 2 of 19 : Math.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    /**
     * @dev Returns the largest of two numbers.
     */
    function max(uint256 a, uint256 b) internal pure returns (uint256) {
        return a >= b ? a : b;
    }

    /**
     * @dev Returns the smallest of two numbers.
     */
    function min(uint256 a, uint256 b) internal pure returns (uint256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two numbers. The result is rounded towards
     * zero.
     */
    function average(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b) / 2 can overflow, so we distribute
        return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2);
    }
}

File 3 of 19 : IERC165.sol
// 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);
}

File 4 of 19 : ERC165.sol
// 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;
    }
}

File 5 of 19 : Strings.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant alphabet = "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] = alphabet[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }

}

File 6 of 19 : Counters.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @title Counters
 * @author Matt Condon (@shrugs)
 * @dev Provides counters that can only be incremented or decremented by one. 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;
        }
    }
}

File 7 of 19 : Context.sol
// 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) {
        this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
        return msg.data;
    }
}

File 8 of 19 : Address.sol
// 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;
        // solhint-disable-next-line no-inline-assembly
        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");

        // solhint-disable-next-line avoid-low-level-calls, avoid-call-value
        (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");

        // solhint-disable-next-line avoid-low-level-calls
        (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");

        // solhint-disable-next-line avoid-low-level-calls
        (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");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private 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

                // solhint-disable-next-line no-inline-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 9 of 19 : IERC721Metadata.sol
// 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);
}

File 10 of 19 : IERC721Enumerable.sol
// 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);
}

File 11 of 19 : ERC721Enumerable.sol
// 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();
    }
}

File 12 of 19 : IERC721Receiver.sol
// 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);
}

File 13 of 19 : IERC721.sol
// 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;
}

File 14 of 19 : ERC721.sol
// 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}. 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(to).onERC721Received.selector;
            } catch (bytes memory reason) {
                if (reason.length == 0) {
                    revert("ERC721: transfer to non ERC721Receiver implementer");
                } else {
                    // solhint-disable-next-line no-inline-assembly
                    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` 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 { }
}

File 15 of 19 : AccessControl.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../utils/Context.sol";
import "../utils/Strings.sol";
import "../utils/introspection/ERC165.sol";

/**
 * @dev External interface of AccessControl declared to support ERC165 detection.
 */
interface IAccessControl {
    function hasRole(bytes32 role, address account) external view returns (bool);
    function getRoleAdmin(bytes32 role) external view returns (bytes32);
    function grantRole(bytes32 role, address account) external;
    function revokeRole(bytes32 role, address account) external;
    function renounceRole(bytes32 role, address account) external;
}

/**
 * @dev Contract module that allows children to implement role-based access
 * control mechanisms. This is a lightweight version that doesn't allow enumerating role
 * members except through off-chain means by accessing the contract event logs. Some
 * applications may benefit from on-chain enumerability, for those cases see
 * {AccessControlEnumerable}.
 *
 * Roles are referred to by their `bytes32` identifier. These should be exposed
 * in the external API and be unique. The best way to achieve this is by
 * using `public constant` hash digests:
 *
 * ```
 * bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
 * ```
 *
 * Roles can be used to represent a set of permissions. To restrict access to a
 * function call, use {hasRole}:
 *
 * ```
 * function foo() public {
 *     require(hasRole(MY_ROLE, msg.sender));
 *     ...
 * }
 * ```
 *
 * Roles can be granted and revoked dynamically via the {grantRole} and
 * {revokeRole} functions. Each role has an associated admin role, and only
 * accounts that have a role's admin role can call {grantRole} and {revokeRole}.
 *
 * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
 * that only accounts with this role will be able to grant or revoke other
 * roles. More complex role relationships can be created by using
 * {_setRoleAdmin}.
 *
 * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
 * grant and revoke this role. Extra precautions should be taken to secure
 * accounts that have been granted it.
 */
abstract contract AccessControl is Context, IAccessControl, ERC165 {
    struct RoleData {
        mapping (address => bool) members;
        bytes32 adminRole;
    }

    mapping (bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

    /**
     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
     *
     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
     * {RoleAdminChanged} not being emitted signaling this.
     *
     * _Available since v3.1._
     */
    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);

    /**
     * @dev Emitted when `account` is granted `role`.
     *
     * `sender` is the account that originated the contract call, an admin role
     * bearer except when using {_setupRole}.
     */
    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Emitted when `account` is revoked `role`.
     *
     * `sender` is the account that originated the contract call:
     *   - if using `revokeRole`, it is the admin role bearer
     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)
     */
    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Modifier that checks that an account has a specific role. Reverts
     * with a standardized message including the required role.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{20}) is missing role (0x[0-9a-f]{32})$/
     *
     * _Available since v4.1._
     */
    modifier onlyRole(bytes32 role) {
        _checkRole(role, _msgSender());
        _;
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IAccessControl).interfaceId
            || super.supportsInterface(interfaceId);
    }

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) public view override returns (bool) {
        return _roles[role].members[account];
    }

    /**
     * @dev Revert with a standard message if `account` is missing `role`.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{20}) is missing role (0x[0-9a-f]{32})$/
     */
    function _checkRole(bytes32 role, address account) internal view {
        if(!hasRole(role, account)) {
            revert(string(abi.encodePacked(
                "AccessControl: account ",
                Strings.toHexString(uint160(account), 20),
                " is missing role ",
                Strings.toHexString(uint256(role), 32)
            )));
        }
    }

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) public view override returns (bytes32) {
        return _roles[role].adminRole;
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _grantRole(role, account);
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _revokeRole(role, account);
    }

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been granted `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    function renounceRole(bytes32 role, address account) public virtual override {
        require(account == _msgSender(), "AccessControl: can only renounce roles for self");

        _revokeRole(role, account);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event. Note that unlike {grantRole}, this function doesn't perform any
     * checks on the calling account.
     *
     * [WARNING]
     * ====
     * This function should only be called from the constructor when setting
     * up the initial roles for the system.
     *
     * Using this function in any other way is effectively circumventing the admin
     * system imposed by {AccessControl}.
     * ====
     */
    function _setupRole(bytes32 role, address account) internal virtual {
        _grantRole(role, account);
    }

    /**
     * @dev Sets `adminRole` as ``role``'s admin role.
     *
     * Emits a {RoleAdminChanged} event.
     */
    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
        emit RoleAdminChanged(role, getRoleAdmin(role), adminRole);
        _roles[role].adminRole = adminRole;
    }

    function _grantRole(bytes32 role, address account) private {
        if (!hasRole(role, account)) {
            _roles[role].members[account] = true;
            emit RoleGranted(role, account, _msgSender());
        }
    }

    function _revokeRole(bytes32 role, address account) private {
        if (hasRole(role, account)) {
            _roles[role].members[account] = false;
            emit RoleRevoked(role, account, _msgSender());
        }
    }
}

File 16 of 19 : SharksTransferControl.sol
// SPDX-License-Identifier: UNLICENSED

pragma solidity ^0.8.9;
import "./SharksLocking.sol";

contract SharksTransferControl {
    SharksLocking public sharksLocking;

    constructor(address sharksLockingAddress_) {
        sharksLocking = SharksLocking(sharksLockingAddress_);
    }

    function sharkCanBeTransferred(uint tokenId_) public view returns (bool) {
        return sharksLocking.sharkCanBeTransferred(tokenId_);
    }
}

File 17 of 19 : SharksSizeControl.sol
// SPDX-License-Identifier: UNLICENSED

pragma solidity ^0.8.9;
import "./Sharks.sol";

contract SharksSizeControl {
    Sharks public sharks;

    constructor(address sharksAddress_) {
        sharks = Sharks(sharksAddress_);
    }

    function sharkSize(uint tokenId_) public view returns (uint256) {
        return sharks.xp(tokenId_) * sharks.rarity(tokenId_);
    }
}

File 18 of 19 : SharksAccessControl.sol
// SPDX-License-Identifier: UNLICENSED

pragma solidity ^0.8.9;

import "@openzeppelin/contracts/access/AccessControl.sol";

abstract contract SharksAccessControl is AccessControl {
    bytes32 public constant OWNER_ROLE = keccak256("OWNER_ROLE");
    bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
    bytes32 public constant REVEALER_ROLE = keccak256("REVEALER_ROLE");
    bytes32 public constant XP_MANAGER_ROLE = keccak256("XP_MANAGER_ROLE");

    modifier onlyOwner() {
        require(hasRole(OWNER_ROLE, _msgSender()), "SharksAccessControl: no OWNER_ROLE");
        _;
    }

    modifier onlyMinter() {
        require(isMinter(_msgSender()), "SharksAccessControl: no MINTER_ROLE");
        _;
    }

    modifier onlyRevealer() {
        require(isRevealer(_msgSender()), "SharksAccessControl: no REVEALER_ROLE");
        _;
    }

    modifier onlyXpManager() {
        require(isXpManager(_msgSender()), "SharksAccessControl: no XP_MANAGER_ROLE");
        _;
    }


    constructor() {
        _setRoleAdmin(OWNER_ROLE, OWNER_ROLE);
        _setRoleAdmin(MINTER_ROLE, OWNER_ROLE);
        _setRoleAdmin(REVEALER_ROLE, OWNER_ROLE);
        _setRoleAdmin(XP_MANAGER_ROLE, OWNER_ROLE);

        _setupRole(OWNER_ROLE, _msgSender());
    }

    function grantOwner(address _owner) external onlyOwner {
        grantRole(OWNER_ROLE, _owner);
    }

    function grantXpManager(address _xpManager) external onlyOwner {
        grantRole(XP_MANAGER_ROLE, _xpManager);
    }

    function grantMinter(address _minter) external onlyOwner {
        grantRole(MINTER_ROLE, _minter);
    }
    function grantRevealer(address _revealer) external onlyOwner {
        grantRole(REVEALER_ROLE, _revealer);
    }

    function revokeOwner(address _owner) external onlyOwner {
        revokeRole(OWNER_ROLE, _owner);
    }

    function revokeXpManager(address _xpManager) external onlyOwner {
        revokeRole(XP_MANAGER_ROLE, _xpManager);
    }

    function revokeMinter(address _minter) external onlyOwner {
        revokeRole(MINTER_ROLE, _minter);
    }

    function revokeRevealer(address _revealer) external onlyOwner {
        revokeRole(REVEALER_ROLE, _revealer);
    }

    function isOwner(address _owner) public view returns (bool) {
        return hasRole(OWNER_ROLE, _owner);
    }

    function isXpManager(address _xpManager) public view returns (bool) {
        return hasRole(XP_MANAGER_ROLE, _xpManager);
    }

    function isRevealer(address _revealer) public view returns (bool) {
        return hasRole(REVEALER_ROLE, _revealer);
    }

    function isMinter(address _minter) public view returns (bool) {
        return hasRole(MINTER_ROLE, _minter);
    }

}

File 19 of 19 : Sharks.sol
// SPDX-License-Identifier: UNLICENSED

pragma solidity ^0.8.9;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/utils/math/Math.sol";
import "@openzeppelin/contracts/utils/Strings.sol";

import "./SharksAccessControl.sol";
import "./SharksTransferControl.sol";
import "./SharksSizeControl.sol";


contract Sharks is ERC721, ERC721Enumerable, SharksAccessControl {
    using Counters for Counters.Counter;
    Counters.Counter private tokenIdTracker;

    string public baseURI;

    uint256 public immutable MAX_SUPPLY;
    uint256 public immutable INITIAL_XP;

    uint256 public totalSharksSize;

    SharksTransferControl public sharksTransferControl;
    SharksSizeControl public sharksSizeControl;

    mapping(uint256 => uint256) public xp;
    mapping(uint256 => uint256) public rarity;

    event Minted(address indexed to, uint256 indexed tokenId);
    event Revealed(uint256 indexed tokenId, uint256 rarity);
    event XpIncreased(uint256 indexed tokenId, uint256 xpIncrease, uint256 totalXp);

    event BaseURIChanged(string baseURI);
    event SharksSizeControlChanged(address sharksSizeControl);
    event SharksTransferControlChanged(address sharksTransferControl);

    constructor(uint256 maxSupply_) ERC721("Smol Sharks", "SMOLSHARKS") {
        MAX_SUPPLY = maxSupply_;
        INITIAL_XP = 1;
    }


    // internal
    function _requireMinted(uint256 tokenId) internal view virtual {
        require(_exists(tokenId), "ERC721: invalid token ID");
    }

    function _beforeTokenTransfer(address from_, address to_, uint256 tokenId_)
        internal
        override(ERC721, ERC721Enumerable)
    {
        require(sharkCanBeTransferred(tokenId_) == true, "SharksTransferControl: transfer not allowed");

        super._beforeTokenTransfer(from_, to_, tokenId_);
    }

    // onlyOwner

    function setSharksSizeControl(address sharksSizeControl_)
        public
        onlyOwner
    {
        sharksSizeControl = SharksSizeControl(sharksSizeControl_);
        emit SharksSizeControlChanged(sharksSizeControl_);
    }

    function setSharksTransferControl(address sharksTransferControl_)
        public
        onlyOwner
    {
        sharksTransferControl = SharksTransferControl(sharksTransferControl_);
        emit SharksTransferControlChanged(sharksTransferControl_);
    }

    function setBaseURI(string memory baseURI_)
        public
        onlyOwner
    {
        baseURI = baseURI_;
        emit BaseURIChanged(baseURI);
    }


    // onlyMinter

    function mint(
        address to_,
        uint256 mintsCount_
    )
        public
        onlyMinter
    {
        uint256 _actualMintsCount = Math.min(mintsCount_, MAX_SUPPLY - tokenIdTracker.current());

        require(_actualMintsCount > 0, "MAX_SUPPLY reached");

        for (uint256 i = 0; i < _actualMintsCount; i++) {
            tokenIdTracker.increment();

            uint256 _tokenId = tokenIdTracker.current();

            require(_tokenId <= MAX_SUPPLY, "MAX_SUPPLY reached"); // sanity check, should not ever trigger

            _safeMint(to_, _tokenId);
            emit Minted(to_, _tokenId);
        }
    }

    // onlyRevealer

    function reveal(
        uint256 tokenId_,
        uint256 rarity_
    )
        public
        onlyRevealer
    {
        _requireMinted(tokenId_);
        require(rarity[tokenId_] == 0, "already revealed");

        rarity[tokenId_] = rarity_;
        emit Revealed(tokenId_, rarity_);
        _increaseXp(tokenId_, INITIAL_XP);
    }



    // onlyXpManager

    function increaseXp(uint tokenId_, uint xp_)
        public
        onlyXpManager
    {
        _requireMinted(tokenId_);
        _increaseXp(tokenId_, xp_);
    }

    function _increaseXp(uint tokenId_, uint xp_)
        internal
    {
        totalSharksSize += xp_;
        xp[tokenId_] += xp_;
        emit XpIncreased(tokenId_, xp_, xp[tokenId_]);
    }


    // Views

    function sharkCanBeTransferred(uint256 tokenId_)
        public
        view
        returns (bool)
    {
        if (address(sharksTransferControl) != address(0)) {
            return (sharksTransferControl.sharkCanBeTransferred(tokenId_) == true);
        } else {
            return true;
        }
    }

    function supportsInterface(bytes4 interfaceId)
        public
        view
        override(ERC721, ERC721Enumerable, AccessControl)
        returns (bool)
    {
        return super.supportsInterface(interfaceId);
    }

    function _baseURI() internal view override returns (string memory) {
        return baseURI;
    }

    function tokenURI(uint256 tokenId)
        public
        view
        virtual
        override
        returns (string memory)
    {
        _requireMinted(tokenId);

        require(bytes(_baseURI()).length > 0, "baseURI not set");

        string memory tokenFilename = rarity[tokenId] > 0 ? Strings.toString(tokenId) : "0";

        return string(abi.encodePacked(_baseURI(), tokenFilename, ".json"));
    }

    function size(uint256 tokenId_)
        public
        view
        returns (uint256)
    {
        _requireMinted(tokenId_);

        if(address(sharksSizeControl) != address(0)) {
            return sharksSizeControl.sharkSize(tokenId_);
        } else {
            return 0;
        }
    }
}

Settings
{
  "remappings": [],
  "optimizer": {
    "enabled": false,
    "runs": 200
  },
  "evmVersion": "london",
  "libraries": {},
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  }
}

Contract ABI

[{"inputs":[{"internalType":"address","name":"sharksAddress_","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"at","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"until","type":"uint256"},{"indexed":false,"internalType":"address","name":"lockManager","type":"address"}],"name":"LockUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"until","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"xpIncrease","type":"uint256"}],"name":"Locked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"maxLockWeeksCount","type":"uint256"}],"name":"MaxLockWeeksCountChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"until","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"xpIncrease","type":"uint256"}],"name":"Relocked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"lockedForWeeksCount","type":"uint256"}],"name":"Unlocked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"xpWeekWeek","type":"uint256"}],"name":"XpPerWeekChanged","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"LOCK_MANAGER","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WEEK","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"weeksCount_","type":"uint256"}],"name":"calculateXpIncrease","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId_","type":"uint256"},{"internalType":"uint256","name":"weeksCount_","type":"uint256"}],"name":"lock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds_","type":"uint256[]"},{"internalType":"uint256","name":"weeksCount_","type":"uint256"}],"name":"lockMany","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"lockedAt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"lockedUntil","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxLockWeeksCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId_","type":"uint256"},{"internalType":"uint256","name":"weeksCount_","type":"uint256"}],"name":"relock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds_","type":"uint256[]"},{"internalType":"uint256","name":"weeksCount_","type":"uint256"}],"name":"relockMany","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"maxLockWeeksCount_","type":"uint256"}],"name":"setMaxLockWeeksCount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"xpPerWeek_","type":"uint256"}],"name":"setXpPerWeek","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId_","type":"uint256"}],"name":"sharkCanBeTransferred","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"sharks","outputs":[{"internalType":"contract Sharks","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId_","type":"uint256"}],"name":"unlock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds_","type":"uint256[]"}],"name":"unlockMany","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId_","type":"uint256"},{"internalType":"uint256","name":"lockedAt_","type":"uint256"},{"internalType":"uint256","name":"lockedUntil_","type":"uint256"}],"name":"updateLock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"weeksCount_","type":"uint256"}],"name":"weeksToSeconds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"xpPerWeek","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]

60806040523480156200001157600080fd5b5060405162002d1238038062002d12833981810160405281019062000037919062000287565b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060a860028190555060346003819055506200009d6000801b33620000a460201b60201c565b50620002b9565b620000b68282620000ba60201b60201c565b5050565b620000cc8282620001ab60201b60201c565b620001a757600160008084815260200190815260200160002060000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506200014c6200021560201b60201c565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b600080600084815260200190815260200160002060000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b600033905090565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006200024f8262000222565b9050919050565b620002618162000242565b81146200026d57600080fd5b50565b600081519050620002818162000256565b92915050565b600060208284031215620002a0576200029f6200021d565b5b6000620002b08482850162000270565b91505092915050565b612a4980620002c96000396000f3fe608060405234801561001057600080fd5b506004361061018e5760003560e01c80637f407235116100de578063b0ce3da211610097578063d547741f11610071578063d547741f1461048f578063dcae6754146104ab578063ebeda4fb146104db578063f4359ce5146104f95761018e565b8063b0ce3da21461043b578063b2fb30cb14610457578063c1719a5e146104735761018e565b80637f407235146103795780638f1038081461039757806391d14854146103b35780639601b745146103e3578063a0084d2514610401578063a217fddf1461041d5761018e565b806336568abe1161014b5780636198e339116101255780636198e339146102e157806366e8e517146102fd578063778aad2e1461032d5780637cd78b02146103495761018e565b806336568abe1461027957806347028a5c146102955780634ab33a70146102b15761018e565b806301ffc9a714610193578063055f4a3f146101c35780631338736f146101e157806321758ced146101fd578063248a9ca31461022d5780632f2ff15d1461025d575b600080fd5b6101ad60048036038101906101a89190611a77565b610517565b6040516101ba9190611abf565b60405180910390f35b6101cb610591565b6040516101d89190611af3565b60405180910390f35b6101fb60048036038101906101f69190611b3a565b610597565b005b61021760048036038101906102129190611b7a565b6108b3565b6040516102249190611abf565b60405180910390f35b61024760048036038101906102429190611bdd565b6108e3565b6040516102549190611c19565b60405180910390f35b61027760048036038101906102729190611c92565b610902565b005b610293600480360381019061028e9190611c92565b61092b565b005b6102af60048036038101906102aa9190611d37565b6109ae565b005b6102cb60048036038101906102c69190611b7a565b6109f6565b6040516102d89190611af3565b60405180910390f35b6102fb60048036038101906102f69190611b7a565b610a0d565b005b61031760048036038101906103129190611b7a565b610c84565b6040516103249190611af3565b60405180910390f35b61034760048036038101906103429190611d84565b610c9c565b005b610363600480360381019061035e9190611b7a565b610d40565b6040516103709190611af3565b60405180910390f35b610381610d58565b60405161038e9190611c19565b60405180910390f35b6103b160048036038101906103ac9190611dd7565b610d7c565b005b6103cd60048036038101906103c89190611c92565b610dc6565b6040516103da9190611abf565b60405180910390f35b6103eb610e30565b6040516103f89190611af3565b60405180910390f35b61041b60048036038101906104169190611b7a565b610e36565b005b610425610e8f565b6040516104329190611c19565b60405180910390f35b61045560048036038101906104509190611dd7565b610e96565b005b610471600480360381019061046c9190611b3a565b610ee0565b005b61048d60048036038101906104889190611b7a565b6112e1565b005b6104a960048036038101906104a49190611c92565b61133a565b005b6104c560048036038101906104c09190611b7a565b611363565b6040516104d29190611af3565b60405180910390f35b6104e361137b565b6040516104f09190611e96565b60405180910390f35b6105016113a1565b60405161050e9190611af3565b60405180910390f35b60007f7965db0b000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061058a5750610589826113a8565b5b9050919050565b60035481565b813373ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636352211e836040518263ffffffff1660e01b815260040161060a9190611af3565b60206040518083038186803b15801561062257600080fd5b505afa158015610636573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061065a9190611ec6565b73ffffffffffffffffffffffffffffffffffffffff16146106b0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106a790611f76565b60405180910390fd5b6000600560008581526020019081526020016000205414610706576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106fd90611fe2565b60405180910390fd5b60008211610749576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161074090612074565b60405180910390fd5b60035482111561078e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161078590612106565b60405180910390fd5b6000610799836109f6565b905060006107a684610c84565b426107b19190612155565b9050426004600087815260200190815260200160002081905550806005600087815260200190815260200160002081905550600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d41a9bca86846040518363ffffffff1660e01b81526004016108409291906121ab565b600060405180830381600087803b15801561085a57600080fd5b505af115801561086e573d6000803e3d6000fd5b50505050847ff26b23f4faf546e2647b477c0eb493c07bbb7bd04c865a3d33ba1d99687d88c682846040516108a49291906121ab565b60405180910390a25050505050565b600080600560008481526020019081526020016000205414156108d957600190506108de565b600090505b919050565b6000806000838152602001908152602001600020600101549050919050565b61090b826108e3565b61091c81610917611412565b61141a565b61092683836114b7565b505050565b610933611412565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16146109a0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161099790612246565b60405180910390fd5b6109aa8282611597565b5050565b60005b828290508110156109f1576109de8383838181106109d2576109d1612266565b5b90506020020135610a0d565b80806109e990612295565b9150506109b1565b505050565b600060025482610a0691906122de565b9050919050565b803373ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636352211e836040518263ffffffff1660e01b8152600401610a809190611af3565b60206040518083038186803b158015610a9857600080fd5b505afa158015610aac573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ad09190611ec6565b73ffffffffffffffffffffffffffffffffffffffff1614610b26576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b1d90611f76565b60405180910390fd5b6000600560008481526020019081526020016000205411610b7c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b7390612384565b60405180910390fd5b60056000838152602001908152602001600020544211610bd1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bc8906123f0565b60405180910390fd5b600062093a8060046000858152602001908152602001600020546005600086815260200190815260200160002054610c099190612410565b610c139190612473565b90506000600460008581526020019081526020016000208190555060006005600085815260200190815260200160002081905550827f6a4ab9eaabc176a1c70b5f19a39c8f7a220e8f3f649ddb5a7e8c1f957ac112ab82604051610c779190611af3565b60405180910390a2505050565b600062093a8082610c9591906122de565b9050919050565b7fb89cdd26cddd51301940bf2715f765b626b8a5a9e2681ac62dc83cc2db2530c0610cce81610cc9611412565b61141a565b826004600086815260200190815260200160002081905550816005600086815260200190815260200160002081905550837f8c400e9e0f8cb9e696c54bbd5f36700fa483ed39f2bfd1e2ff785dd1a09d9a91848433604051610d32939291906124b3565b60405180910390a250505050565b60056020528060005260406000206000915090505481565b7fb89cdd26cddd51301940bf2715f765b626b8a5a9e2681ac62dc83cc2db2530c081565b60005b83839050811015610dc057610dad848483818110610da057610d9f612266565b5b9050602002013583610597565b8080610db890612295565b915050610d7f565b50505050565b600080600084815260200190815260200160002060000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b60025481565b6000801b610e4b81610e46611412565b61141a565b816003819055507fd59eca65b83da134ae06853512f0707d7d6d13bb5c149ba17361eb7fa6cdfb3f600354604051610e839190611af3565b60405180910390a15050565b6000801b81565b60005b83839050811015610eda57610ec7848483818110610eba57610eb9612266565b5b9050602002013583610ee0565b8080610ed290612295565b915050610e99565b50505050565b813373ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636352211e836040518263ffffffff1660e01b8152600401610f539190611af3565b60206040518083038186803b158015610f6b57600080fd5b505afa158015610f7f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fa39190611ec6565b73ffffffffffffffffffffffffffffffffffffffff1614610ff9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ff090611f76565b60405180910390fd5b600060056000858152602001908152602001600020541161104f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161104690612536565b60405180910390fd5b60008211611092576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611089906125c8565b60405180910390fd5b6003548211156110d7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110ce9061265a565b60405180910390fd5b600080426005600087815260200190815260200160002054111561114b57600162093a8042600560008981526020019081526020016000205461111a9190612410565b6111249190612473565b61112e9190612155565b915060056000868152602001908152602001600020549050611153565b600091504290505b6000826003546111639190612410565b9050808511156111d15761117681611678565b60405160200161118691906127b2565b6040516020818303038152906040526040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111c89190612829565b60405180910390fd5b60006111dc866109f6565b905060006111e987610c84565b846111f49190612155565b905080600560008a815260200190815260200160002081905550600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d41a9bca89846040518363ffffffff1660e01b815260040161126b9291906121ab565b600060405180830381600087803b15801561128557600080fd5b505af1158015611299573d6000803e3d6000fd5b50505050877f33a87ba488658b3d1319098cd49c6d65b72a79c0f3530fec611e7afffed0439582846040516112cf9291906121ab565b60405180910390a25050505050505050565b6000801b6112f6816112f1611412565b61141a565b816002819055507f779e6f85e5cab0944c0c3bc12ebc8fd1572bfaf07991f7f7173a9dcad99c4d6060025460405161132e9190611af3565b60405180910390a15050565b611343826108e3565b6113548161134f611412565b61141a565b61135e8383611597565b505050565b60046020528060005260406000206000915090505481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b62093a8081565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b600033905090565b6114248282610dc6565b6114b3576114498173ffffffffffffffffffffffffffffffffffffffff1660146117d9565b6114578360001c60206117d9565b6040516020016114689291906128e3565b6040516020818303038152906040526040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114aa9190612829565b60405180910390fd5b5050565b6114c18282610dc6565b61159357600160008084815260200190815260200160002060000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550611538611412565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b6115a18282610dc6565b1561167457600080600084815260200190815260200160002060000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550611619611412565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45b5050565b606060008214156116c0576040518060400160405280600181526020017f300000000000000000000000000000000000000000000000000000000000000081525090506117d4565b600082905060005b600082146116f25780806116db90612295565b915050600a826116eb9190612473565b91506116c8565b60008167ffffffffffffffff81111561170e5761170d61291d565b5b6040519080825280601f01601f1916602001820160405280156117405781602001600182028036833780820191505090505b5090505b600085146117cd576001826117599190612410565b9150600a85611768919061294c565b60306117749190612155565b60f81b81838151811061178a57611789612266565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a856117c69190612473565b9450611744565b8093505050505b919050565b6060600060028360026117ec91906122de565b6117f69190612155565b67ffffffffffffffff81111561180f5761180e61291d565b5b6040519080825280601f01601f1916602001820160405280156118415781602001600182028036833780820191505090505b5090507f30000000000000000000000000000000000000000000000000000000000000008160008151811061187957611878612266565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f7800000000000000000000000000000000000000000000000000000000000000816001815181106118dd576118dc612266565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506000600184600261191d91906122de565b6119279190612155565b90505b60018111156119c7577f3031323334353637383961626364656600000000000000000000000000000000600f86166010811061196957611968612266565b5b1a60f81b8282815181106119805761197f612266565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600485901c9450806119c09061297d565b905061192a565b5060008414611a0b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a02906129f3565b60405180910390fd5b8091505092915050565b600080fd5b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b611a5481611a1f565b8114611a5f57600080fd5b50565b600081359050611a7181611a4b565b92915050565b600060208284031215611a8d57611a8c611a15565b5b6000611a9b84828501611a62565b91505092915050565b60008115159050919050565b611ab981611aa4565b82525050565b6000602082019050611ad46000830184611ab0565b92915050565b6000819050919050565b611aed81611ada565b82525050565b6000602082019050611b086000830184611ae4565b92915050565b611b1781611ada565b8114611b2257600080fd5b50565b600081359050611b3481611b0e565b92915050565b60008060408385031215611b5157611b50611a15565b5b6000611b5f85828601611b25565b9250506020611b7085828601611b25565b9150509250929050565b600060208284031215611b9057611b8f611a15565b5b6000611b9e84828501611b25565b91505092915050565b6000819050919050565b611bba81611ba7565b8114611bc557600080fd5b50565b600081359050611bd781611bb1565b92915050565b600060208284031215611bf357611bf2611a15565b5b6000611c0184828501611bc8565b91505092915050565b611c1381611ba7565b82525050565b6000602082019050611c2e6000830184611c0a565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000611c5f82611c34565b9050919050565b611c6f81611c54565b8114611c7a57600080fd5b50565b600081359050611c8c81611c66565b92915050565b60008060408385031215611ca957611ca8611a15565b5b6000611cb785828601611bc8565b9250506020611cc885828601611c7d565b9150509250929050565b600080fd5b600080fd5b600080fd5b60008083601f840112611cf757611cf6611cd2565b5b8235905067ffffffffffffffff811115611d1457611d13611cd7565b5b602083019150836020820283011115611d3057611d2f611cdc565b5b9250929050565b60008060208385031215611d4e57611d4d611a15565b5b600083013567ffffffffffffffff811115611d6c57611d6b611a1a565b5b611d7885828601611ce1565b92509250509250929050565b600080600060608486031215611d9d57611d9c611a15565b5b6000611dab86828701611b25565b9350506020611dbc86828701611b25565b9250506040611dcd86828701611b25565b9150509250925092565b600080600060408486031215611df057611def611a15565b5b600084013567ffffffffffffffff811115611e0e57611e0d611a1a565b5b611e1a86828701611ce1565b93509350506020611e2d86828701611b25565b9150509250925092565b6000819050919050565b6000611e5c611e57611e5284611c34565b611e37565b611c34565b9050919050565b6000611e6e82611e41565b9050919050565b6000611e8082611e63565b9050919050565b611e9081611e75565b82525050565b6000602082019050611eab6000830184611e87565b92915050565b600081519050611ec081611c66565b92915050565b600060208284031215611edc57611edb611a15565b5b6000611eea84828501611eb1565b91505092915050565b600082825260208201905092915050565b7f536861726b734c6f636b696e673a20596f7520646f206e6f74206f776e20746860008201527f697320736861726b000000000000000000000000000000000000000000000000602082015250565b6000611f60602883611ef3565b9150611f6b82611f04565b604082019050919050565b60006020820190508181036000830152611f8f81611f53565b9050919050565b7f536861726b734c6f636b696e673a20616c7265616479206c6f636b6564000000600082015250565b6000611fcc601d83611ef3565b9150611fd782611f96565b602082019050919050565b60006020820190508181036000830152611ffb81611fbf565b9050919050565b7f536861726b734c6f636b696e673a206d757374206c6f636b20666f722061742060008201527f6c656173742031207765656b0000000000000000000000000000000000000000602082015250565b600061205e602c83611ef3565b915061206982612002565b604082019050919050565b6000602082019050818103600083015261208d81612051565b9050919050565b7f536861726b734c6f636b696e673a2063616e6e6f74206c6f636b20666f72206d60008201527f6f7265207468616e206d61784c6f636b5765656b73436f756e74000000000000602082015250565b60006120f0603a83611ef3565b91506120fb82612094565b604082019050919050565b6000602082019050818103600083015261211f816120e3565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061216082611ada565b915061216b83611ada565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156121a05761219f612126565b5b828201905092915050565b60006040820190506121c06000830185611ae4565b6121cd6020830184611ae4565b9392505050565b7f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560008201527f20726f6c657320666f722073656c660000000000000000000000000000000000602082015250565b6000612230602f83611ef3565b915061223b826121d4565b604082019050919050565b6000602082019050818103600083015261225f81612223565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60006122a082611ada565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156122d3576122d2612126565b5b600182019050919050565b60006122e982611ada565b91506122f483611ada565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561232d5761232c612126565b5b828202905092915050565b7f536861726b734c6f636b696e673a206e6f74206c6f636b656400000000000000600082015250565b600061236e601983611ef3565b915061237982612338565b602082019050919050565b6000602082019050818103600083015261239d81612361565b9050919050565b7f536861726b734c6f636b696e673a2063616e6e6f7420756e6c6f636b20796574600082015250565b60006123da602083611ef3565b91506123e5826123a4565b602082019050919050565b60006020820190508181036000830152612409816123cd565b9050919050565b600061241b82611ada565b915061242683611ada565b92508282101561243957612438612126565b5b828203905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600061247e82611ada565b915061248983611ada565b92508261249957612498612444565b5b828204905092915050565b6124ad81611c54565b82525050565b60006060820190506124c86000830186611ae4565b6124d56020830185611ae4565b6124e260408301846124a4565b949350505050565b7f536861726b734c6f636b696e673a206e6f74206c6f636b656420796574000000600082015250565b6000612520601d83611ef3565b915061252b826124ea565b602082019050919050565b6000602082019050818103600083015261254f81612513565b9050919050565b7f536861726b734c6f636b696e673a206d7573742072656c6f636b20666f72206160008201527f74206c656173742031207765656b000000000000000000000000000000000000602082015250565b60006125b2602e83611ef3565b91506125bd82612556565b604082019050919050565b600060208201905081810360008301526125e1816125a5565b9050919050565b7f536861726b734c6f636b696e673a2063616e6e6f742072656c6f636b20666f7260008201527f206d6f7265207468616e206d61784c6f636b5765656b73436f756e7400000000602082015250565b6000612644603c83611ef3565b915061264f826125e8565b604082019050919050565b6000602082019050818103600083015261267381612637565b9050919050565b600081905092915050565b7f536861726b734c6f636b696e673a2063616e206f6e6c792072656c6f636b206660008201527f6f72200000000000000000000000000000000000000000000000000000000000602082015250565b60006126e160238361267a565b91506126ec82612685565b602382019050919050565b600081519050919050565b60005b83811015612720578082015181840152602081019050612705565b8381111561272f576000848401525b50505050565b6000612740826126f7565b61274a818561267a565b935061275a818560208601612702565b80840191505092915050565b7f207765656b73206d617820000000000000000000000000000000000000000000600082015250565b600061279c600b8361267a565b91506127a782612766565b600b82019050919050565b60006127bd826126d4565b91506127c98284612735565b91506127d48261278f565b915081905092915050565b6000601f19601f8301169050919050565b60006127fb826126f7565b6128058185611ef3565b9350612815818560208601612702565b61281e816127df565b840191505092915050565b6000602082019050818103600083015261284381846127f0565b905092915050565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000600082015250565b600061288160178361267a565b915061288c8261284b565b601782019050919050565b7f206973206d697373696e6720726f6c6520000000000000000000000000000000600082015250565b60006128cd60118361267a565b91506128d882612897565b601182019050919050565b60006128ee82612874565b91506128fa8285612735565b9150612905826128c0565b91506129118284612735565b91508190509392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600061295782611ada565b915061296283611ada565b92508261297257612971612444565b5b828206905092915050565b600061298882611ada565b9150600082141561299c5761299b612126565b5b600182039050919050565b7f537472696e67733a20686578206c656e67746820696e73756666696369656e74600082015250565b60006129dd602083611ef3565b91506129e8826129a7565b602082019050919050565b60006020820190508181036000830152612a0c816129d0565b905091905056fea26469706673582212207146345cde1928ac260fe729b4909eaaa2bf0dbecb95f0b02162282761ff97a064736f6c634300080900330000000000000000000000009b7723244b62b49b57092aa8003fe8f49e0fd91e

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

0000000000000000000000009b7723244b62b49b57092aa8003fe8f49e0fd91e

-----Decoded View---------------
Arg [0] : sharksAddress_ (address): 0x9b7723244b62b49b57092aa8003fe8f49e0fd91e

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 0000000000000000000000009b7723244b62b49b57092aa8003fe8f49e0fd91e


Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.