ETH Price: $3,345.62 (-0.80%)

Contract

0xf923CEA81d4d56135E1c4e6E2199A865A5c21040
 
Transaction Hash
Method
Block
From
To
Withdraw Shib210890082024-10-31 23:47:5952 days ago1730418479IN
0xf923CEA8...5A5c21040
0 ETH0.000399456.96174893
Mint Public With...190390322024-01-19 6:11:23339 days ago1705644683IN
0xf923CEA8...5A5c21040
0 ETH0.0702239118.82489374
Mint Public With...188275202023-12-20 13:49:11368 days ago1703080151IN
0xf923CEA8...5A5c21040
0 ETH0.0176896365.42434252
Mint Public With...186002312023-11-18 17:33:11400 days ago1700328791IN
0xf923CEA8...5A5c21040
0 ETH0.0082922431.78127554
Mint Public With...185740042023-11-15 1:25:23404 days ago1700011523IN
0xf923CEA8...5A5c21040
0 ETH0.008436531.9814289
Withdraw Shib184726442023-10-31 20:59:11418 days ago1698785951IN
0xf923CEA8...5A5c21040
0 ETH0.0016054427.98011121
Mint Public With...181301672023-09-13 21:50:23466 days ago1694641823IN
0xf923CEA8...5A5c21040
0 ETH0.0035199413.88088366
Mint Public With...180651592023-09-04 19:19:23475 days ago1693855163IN
0xf923CEA8...5A5c21040
0 ETH0.0060659323.10102998
Mint Public With...180013642023-08-26 20:55:35484 days ago1693083335IN
0xf923CEA8...5A5c21040
0 ETH0.0030847913.36214307
Mint Public With...180013592023-08-26 20:54:35484 days ago1693083275IN
0xf923CEA8...5A5c21040
0 ETH0.0029369812.87805386
Mint Public With...179525182023-08-20 0:54:47491 days ago1692492887IN
0xf923CEA8...5A5c21040
0 ETH0.0030397111.76755103
Mint Public With...179378652023-08-17 23:39:35493 days ago1692315575IN
0xf923CEA8...5A5c21040
0 ETH0.0116512744.84745289
Mint Public With...179345082023-08-17 12:21:59493 days ago1692274919IN
0xf923CEA8...5A5c21040
0 ETH0.0067740326.71340046
Mint Public With...176613932023-07-10 6:09:35532 days ago1688969375IN
0xf923CEA8...5A5c21040
0 ETH0.0053700613.88234674
Mint Public With...176612532023-07-10 5:41:11532 days ago1688967671IN
0xf923CEA8...5A5c21040
0 ETH0.0035326212.96276136
Mint Public With...174980252023-06-17 7:24:59555 days ago1686986699IN
0xf923CEA8...5A5c21040
0 ETH0.014823118.40782944
Mint Public With...174580732023-06-11 16:32:11560 days ago1686501131IN
0xf923CEA8...5A5c21040
0 ETH0.0091842217.06216618
Mint Public With...174575052023-06-11 14:36:59560 days ago1686494219IN
0xf923CEA8...5A5c21040
0 ETH0.0056186223.89570568
Mint Public With...174574902023-06-11 14:33:47560 days ago1686494027IN
0xf923CEA8...5A5c21040
0 ETH0.0051866320.7344498
Mint Public With...173389472023-05-25 21:52:11577 days ago1685051531IN
0xf923CEA8...5A5c21040
0 ETH0.0079616329.93871432
Mint Public With...172697702023-05-16 3:59:59587 days ago1684209599IN
0xf923CEA8...5A5c21040
0 ETH0.0113038950.63220723
Mint Public With...171170342023-04-24 15:28:11608 days ago1682350091IN
0xf923CEA8...5A5c21040
0 ETH0.0157615661.10459217
Mint Public With...170857862023-04-20 5:54:11613 days ago1681970051IN
0xf923CEA8...5A5c21040
0 ETH0.021439377.5092844
Mint Public With...170563662023-04-16 1:57:35617 days ago1681610255IN
0xf923CEA8...5A5c21040
0 ETH0.0062842124.32952881
Mint Public With...170230562023-04-11 6:22:23622 days ago1681194143IN
0xf923CEA8...5A5c21040
0 ETH0.0050397918.59443833
View all transactions

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
LandAuctionV3

Compiler Version
v0.8.13+commit.abaa5c0e

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 23 : LandAuctionV3.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@unification-com/xfund-router/contracts/lib/ConsumerBase.sol";

import "./interfaces/ILandRegistry.sol";
import "./LandAuction.sol";

contract LandAuctionV3 is ConsumerBase, Ownable, ReentrancyGuard {
    uint32 constant clearLow = 0xffff0000;
    uint32 constant clearHigh = 0x0000ffff;
    uint32 constant factor = 0x10000;

    int16 public constant xLow = -96;
    int16 public constant yLow = -99;
    int16 public constant xHigh = 96;
    int16 public constant yHigh = 99;

    enum Stage {
        Default,
        Inactive1,
        Inactive2,
        PublicSale
    }

    uint256 public ethToShib;
    bool public multiMintEnabled;

    LandAuction public auctionV1;
    LandAuction public auctionV2;
    ILandRegistry public landRegistry;

    IERC20 public immutable SHIB;
    Stage public currentStage;

    mapping(address => uint32[]) private _allMintsOf;

    event StageSet(uint256 stage);
    event multiMintToggled(bool newValue);
    event LandBoughtWithShib(
        address indexed user,
        uint32 indexed encXY,
        int16 x,
        int16 y,
        uint256 price,
        uint256 time,
        Stage saleStage
    );

    constructor(
        IERC20 _shib,
        LandAuction _auctionV1,
        LandAuction _auctionV2,
        ILandRegistry _landRegistry,
        address _router,
        address _xfund
    ) ConsumerBase(_router, _xfund) {
        SHIB = _shib;
        auctionV1 = _auctionV1;
        auctionV2 = _auctionV2;
        landRegistry = _landRegistry;
    }

    modifier onlyValid(int16 x, int16 y) {
        require(xLow <= x && x <= xHigh, "ERR_X_OUT_OF_RANGE");
        require(yLow <= y && y <= yHigh, "ERR_Y_OUT_OF_RANGE");
        _;
    }

    modifier onlyStage(Stage s) {
        require(currentStage == s, "ERR_THIS_STAGE_NOT_LIVE_YET");
        _;
    }

    function bidInfoOf(address user)
        external
        view
        returns (int16[] memory, int16[] memory)
    {
        (int16[] memory xsV1, int16[] memory ysV1) = auctionV2.bidInfoOf(user);
        uint256 lengthV1 = xsV1.length;

        uint256 bidCount = _allMintsOf[user].length;
        int16[] memory xs = new int16[](bidCount + lengthV1);
        int16[] memory ys = new int16[](bidCount + lengthV1);

        for (uint256 i = 0; i < lengthV1; i = _uncheckedInc(i)) {
            xs[i] = xsV1[i];
            ys[i] = ysV1[i];
        }

        uint256 ptr = lengthV1;
        uint32[] storage allMints = _allMintsOf[user];
        uint256 length = allMints.length;

        for (uint256 i = 0; i < length; i = _uncheckedInc(i)) {
            (int16 x, int16 y) = _decodeXY(allMints[i]);
            xs[ptr] = x;
            ys[ptr] = y;
            ptr = _uncheckedInc(ptr);
        }

        return (xs, ys);
    }

    function getReservePriceShib(int16 x, int16 y)
        public
        view
        onlyValid(x, y)
        returns (uint256)
    {
        // this will revert if not up for sale
        uint256 reservePrice = auctionV1.getReservePrice(x, y);

        // to check if this was bid on, in the bidding stage
        (uint256 cAmount, ) = auctionV1.getCurrentBid(x, y);
        require(cAmount == 0, "ERR_ALREADY_BOUGHT");

        uint256 reservePriceInShib = (ethToShib * reservePrice) / 1 ether;

        require(reservePriceInShib > 0, "ERR_BAD_PRICE");
        return reservePriceInShib;
    }

    function mintPublicWithShib(int16 x, int16 y)
        external
        onlyStage(Stage.PublicSale)
        nonReentrant
    {
        // this will revert if not up for sale
        uint256 reservePriceInShib = getReservePriceShib(x, y);

        address user = msg.sender;

        SHIB.transferFrom(user, address(this), reservePriceInShib);

        uint32 encXY = _encodeXY(x, y);
        _allMintsOf[user].push(encXY);

        landRegistry.mint(user, x, y);

        emit LandBoughtWithShib(
            user,
            encXY,
            x,
            y,
            reservePriceInShib,
            block.timestamp,
            Stage.PublicSale
        );
    }

    function mintPublicWithShibMulti(
        int16[] calldata xs,
        int16[] calldata ys,
        uint256[] calldata prices
    ) external onlyStage(Stage.PublicSale) nonReentrant {
        require(multiMintEnabled, "ERR_MULTI_BID_DISABLED");

        uint256 length = xs.length;
        require(length != 0, "ERR_NO_INPUT");
        require(length == ys.length, "ERR_INPUT_LENGTH_MISMATCH");
        require(length == prices.length, "ERR_INPUT_LENGTH_MISMATCH");

        uint256 total;
        for (uint256 i = 0; i < length; i = _uncheckedInc(i)) {
            total += prices[i];
        }

        address user = msg.sender;

        SHIB.transferFrom(user, address(this), total);

        for (uint256 i = 0; i < length; i = _uncheckedInc(i)) {
            int16 x = xs[i];
            int16 y = ys[i];

            uint256 reservePriceInShib = getReservePriceShib(x, y);
            require(
                reservePriceInShib == prices[i],
                "ERR_INSUFFICIENT_SHIB_SENT"
            );

            uint32 encXY = _encodeXY(x, y);
            _allMintsOf[user].push(encXY);

            landRegistry.mint(user, x, y);

            emit LandBoughtWithShib(
                user,
                encXY,
                x,
                y,
                prices[i],
                block.timestamp,
                Stage.PublicSale
            );
        }
    }

    function setStage(uint256 stage) external onlyOwner {
        currentStage = Stage(stage);
        emit StageSet(stage);
    }

    function setLandRegistry(address _landRegistry) external onlyOwner {
        landRegistry = ILandRegistry(_landRegistry);
    }

    function setAuctionV1(LandAuction _auctionV1) external onlyOwner {
        auctionV1 = _auctionV1;
    }

    function setAuctionV2(LandAuction _auctionV2) external onlyOwner {
        auctionV2 = _auctionV2;
    }

    function setMultiMint(bool desiredValue) external onlyOwner {
        require(multiMintEnabled != desiredValue, "ERR_ALREADY_DESIRED_VALUE");
        multiMintEnabled = desiredValue;

        emit multiMintToggled(desiredValue);
    }

    function increaseRouterAllowance(uint256 _amount) external onlyOwner {
        require(_increaseRouterAllowance(_amount), "ERR_FAILED_TO_INCREASE");
    }

    function getData(address _provider, uint256 _fee)
        external
        onlyOwner
        returns (bytes32)
    {
        bytes32 data = 0x4554482e534849422e50522e4156430000000000000000000000000000000000; // ETH.SHIB.PR.AVC
        return _requestData(_provider, _fee, data);
    }

    function withdrawShib(address to, uint256 amount) external onlyOwner {
        SHIB.transfer(to, amount);
    }

    function withdrawAny(
        address token,
        address to,
        uint256 amount
    ) external onlyOwner {
        IERC20(token).transfer(to, amount);
    }

    function receiveData(uint256 _price, bytes32) internal override {
        ethToShib = _price;
    }

    function _uncheckedInc(uint256 i) internal pure returns (uint256) {
        unchecked {
            return i + 1;
        }
    }

    function _encodeXY(int16 x, int16 y) internal pure returns (uint32) {
        return
            ((uint32(uint16(x)) * factor) & clearLow) |
            (uint32(uint16(y)) & clearHigh);
    }

    function _decodeXY(uint32 value) internal pure returns (int16 x, int16 y) {
        x = _expandNegative16BitCast((value & clearLow) >> 16);
        y = _expandNegative16BitCast(value & clearHigh);
    }

    function _expandNegative16BitCast(uint32 value)
        internal
        pure
        returns (int16)
    {
        if (value & (1 << 15) != 0) {
            return int16(int32(value | clearLow));
        }
        return int16(int32(value));
    }
}

File 2 of 23 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _transferOwnership(_msgSender());
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

File 3 of 23 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `from` to `to` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 amount
    ) external returns (bool);

    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);
}

File 4 of 23 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuard {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;

        _;

        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }
}

File 5 of 23 : ConsumerBase.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../vendor/OOOSafeMath.sol";
import "../interfaces/IERC20_Ex.sol";
import "../interfaces/IRouter.sol";
import "./RequestIdBase.sol";

/**
 * @title ConsumerBase smart contract
 *
 * @dev This contract can be imported by any smart contract wishing to include
 * off-chain data or data from a different network within it.
 *
 * The consumer initiates a data request by forwarding the request to the Router
 * smart contract, from where the data provider(s) pick up and process the
 * data request, and forward it back to the specified callback function.
 *
 */
abstract contract ConsumerBase is RequestIdBase {
    using OOOSafeMath for uint256;

    /*
     * STATE VARIABLES
     */

    // nonces for generating requestIds. Must be in sync with the
    // nonces defined in Router.sol.
    mapping(address => uint256) private nonces;

    IERC20_Ex internal immutable xFUND;
    IRouter internal router;

    /*
     * WRITE FUNCTIONS
     */

    /**
     * @dev Contract constructor. Accepts the address for the router smart contract,
     * and a token allowance for the Router to spend on the consumer's behalf (to pay fees).
     *
     * The Consumer contract should have enough tokens allocated to it to pay fees
     * and the Router should be able to use the Tokens to forward fees.
     *
     * @param _router address of the deployed Router smart contract
     * @param _xfund address of the deployed xFUND smart contract
     */
    constructor(address _router, address _xfund) {
        require(_router != address(0), "router cannot be the zero address");
        require(_xfund != address(0), "xfund cannot be the zero address");
        router = IRouter(_router);
        xFUND = IERC20_Ex(_xfund);
    }

    /**
     * @notice _setRouter is a helper function to allow changing the router contract address
     * Allows updating the router address. Future proofing for potential Router upgrades
     * NOTE: it is advisable to wrap this around a function that uses, for example, OpenZeppelin's
     * onlyOwner modifier
     *
     * @param _router address of the deployed Router smart contract
     */
    function _setRouter(address _router) internal returns (bool) {
        require(_router != address(0), "router cannot be the zero address");
        router = IRouter(_router);
        return true;
    }

    /**
     * @notice _increaseRouterAllowance is a helper function to increase token allowance for
     * the xFUND Router
     * Allows this contract to increase the xFUND allowance for the Router contract
     * enabling it to pay request fees on behalf of this contract.
     * NOTE: it is advisable to wrap this around a function that uses, for example, OpenZeppelin's
     * onlyOwner modifier
     *
     * @param _amount uint256 amount to increase allowance by
     */
    function _increaseRouterAllowance(uint256 _amount) internal returns (bool) {
        // The context of msg.sender is this contract's address
        require(xFUND.increaseAllowance(address(router), _amount), "failed to increase allowance");
        return true;
    }

    /**
     * @dev _requestData - initialises a data request. forwards the request to the deployed
     * Router smart contract.
     *
     * @param _dataProvider payable address of the data provider
     * @param _fee uint256 fee to be paid
     * @param _data bytes32 value of data being requested, e.g. PRICE.BTC.USD.AVG requests
     * average price for BTC/USD pair
     * @return requestId bytes32 request ID which can be used to track or cancel the request
     */
    function _requestData(address _dataProvider, uint256 _fee, bytes32 _data)
    internal returns (bytes32) {
        bytes32 requestId = makeRequestId(address(this), _dataProvider, address(router), nonces[_dataProvider], _data);
        // call the underlying ConsumerLib.sol lib's submitDataRequest function
        require(router.initialiseRequest(_dataProvider, _fee, _data));
        nonces[_dataProvider] = nonces[_dataProvider].safeAdd(1);
        return requestId;
    }

    /**
     * @dev rawReceiveData - Called by the Router's fulfillRequest function
     * in order to fulfil a data request. Data providers call the Router's fulfillRequest function
     * The request is validated to ensure it has indeed been sent via the Router.
     *
     * The Router will only call rawReceiveData once it has validated the origin of the data fulfillment.
     * rawReceiveData then calls the user defined receiveData function to finalise the fulfilment.
     * Contract developers will need to override the abstract receiveData function defined below.
     *
     * @param _price uint256 result being sent
     * @param _requestId bytes32 request ID of the request being fulfilled
     * has sent the data
     */
    function rawReceiveData(
        uint256 _price,
        bytes32 _requestId) external
    {
        // validate it came from the router
        require(msg.sender == address(router), "only Router can call");

        // call override function in end-user's contract
        receiveData(_price, _requestId);
    }

    /**
    * @dev receiveData - should be overridden by contract developers to process the
    * data fulfilment in their own contract.
    *
    * @param _price uint256 result being sent
    * @param _requestId bytes32 request ID of the request being fulfilled
    */
    function receiveData(
        uint256 _price,
        bytes32 _requestId
    ) internal virtual;

    /*
     * READ FUNCTIONS
     */

    /**
     * @dev getRouterAddress returns the address of the Router smart contract being used
     *
     * @return address
     */
    function getRouterAddress() external view returns (address) {
        return address(router);
    }

}

File 6 of 23 : ILandRegistry.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

interface ILandRegistry {
    function mint(
        address user,
        int16 x,
        int16 y
    ) external;
}

File 7 of 23 : LandAuction.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";

import "./interfaces/IWETH.sol";
import "./interfaces/ILockShiboshi.sol";
import "./interfaces/ILockLeash.sol";
import "./interfaces/ILandRegistry.sol";
import "./interfaces/ILandAuction.sol";

contract LandAuction is ILandAuction, AccessControl, ReentrancyGuard {
    using ECDSA for bytes32;

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

    uint32 constant clearLow = 0xffff0000;
    uint32 constant clearHigh = 0x0000ffff;
    uint32 constant factor = 0x10000;

    uint16 public constant N = 194; // xHigh + 97 + 1
    uint16 public constant M = 200; // yHigh + 100 + 1

    /*
        xLow, yHigh gets mapped to 1,1
        transform: x + 97, 100 - y

        y_mapped = 100 - y
        x_mapped = 97 + x
    */

    int16 public constant xLow = -96;
    int16 public constant yLow = -99;
    int16 public constant xHigh = 96;
    int16 public constant yHigh = 99;

    enum Stage {
        Default,
        Bidding,
        PrivateSale,
        PublicSale
    }

    struct Bid {
        uint256 amount;
        address bidder;
    }

    address public immutable weth;
    ILandRegistry public landRegistry;
    ILockLeash public lockLeash;
    ILockShiboshi public lockShiboshi;
    bool public multiBidEnabled;

    address public signerAddress;
    Stage public currentStage;

    int8[N + 10][M + 10] private _categoryBIT;

    mapping(int16 => mapping(int16 => Bid)) public getCurrentBid;
    mapping(int8 => uint256) public priceOfCategory;
    mapping(address => uint256) public winningsBidsOf;

    mapping(address => uint32[]) private _allBidsOf;
    mapping(address => mapping(uint32 => uint8)) private _statusOfBidsOf;

    event CategoryPriceSet(int8 category, uint256 price);
    event StageSet(uint256 stage);
    event SignerSet(address signer);
    event multiBidToggled(bool newValue);
    event BidCreated(
        address indexed user,
        uint32 indexed encXY,
        int16 x,
        int16 y,
        uint256 price,
        uint256 time
    );
    event LandBought(
        address indexed user,
        uint32 indexed encXY,
        int16 x,
        int16 y,
        uint256 price,
        Stage saleStage
    );

    constructor(
        address _weth,
        ILandRegistry _landRegistry,
        ILockLeash _lockLeash,
        ILockShiboshi _lockShiboshi
    ) {
        _grantRole(DEFAULT_ADMIN_ROLE, msg.sender);
        _grantRole(GRID_SETTER_ROLE, msg.sender);

        weth = _weth;
        landRegistry = _landRegistry;
        lockLeash = _lockLeash;
        lockShiboshi = _lockShiboshi;

        signerAddress = msg.sender;
    }

    modifier onlyValid(int16 x, int16 y) {
        require(xLow <= x && x <= xHigh, "ERR_X_OUT_OF_RANGE");
        require(yLow <= y && y <= yHigh, "ERR_Y_OUT_OF_RANGE");
        _;
    }

    modifier onlyStage(Stage s) {
        require(currentStage == s, "ERR_THIS_STAGE_NOT_LIVE_YET");
        _;
    }

    function weightToCapacity(uint256 weightLeash, uint256 weightShiboshi)
        public
        pure
        returns (uint256)
    {
        uint256[10] memory QRangeLeash = [
            uint256(9),
            uint256(30),
            uint256(60),
            uint256(100),
            uint256(130),
            uint256(180),
            uint256(220),
            uint256(300),
            uint256(370),
            uint256(419)
        ];
        uint256[10] memory QRangeShiboshi = [
            uint256(45),
            uint256(89),
            uint256(150),
            uint256(250),
            uint256(350),
            uint256(480),
            uint256(600),
            uint256(700),
            uint256(800),
            uint256(850)
        ];
        uint256[10] memory buckets = [
            uint256(1),
            uint256(5),
            uint256(10),
            uint256(20),
            uint256(50),
            uint256(80),
            uint256(100),
            uint256(140),
            uint256(180),
            uint256(200)
        ];
        uint256 capacity;

        if (weightLeash > 0) {
            for (uint256 i = 9; i >= 0; i = _uncheckedDec(i)) {
                if (weightLeash > QRangeLeash[i] * 1e18) {
                    capacity += buckets[i];
                    break;
                }
            }
        }

        if (weightShiboshi > 0) {
            for (uint256 i = 9; i >= 0; i = _uncheckedDec(i)) {
                if (weightShiboshi > QRangeShiboshi[i]) {
                    capacity += buckets[i];
                    break;
                }
            }
        }

        return capacity;
    }

    function getOutbidPrice(uint256 bidPrice) public pure returns (uint256) {
        // 5% more than the current price
        return (bidPrice * 21) / 20;
    }

    function availableCapacityOf(address user) public view returns (uint256) {
        uint256 weightLeash = lockLeash.weightOf(user);
        uint256 weightShiboshi = lockShiboshi.weightOf(user);

        return
            weightToCapacity(weightLeash, weightShiboshi) -
            winningsBidsOf[user];
    }

    function getReservePrice(int16 x, int16 y) public view returns (uint256) {
        uint256 price = priceOfCategory[getCategory(x, y)];
        require(price != 0, "ERR_NOT_UP_FOR_SALE");
        return price;
    }

    function getPriceOf(int16 x, int16 y) public view returns (uint256) {
        Bid storage currentBid = getCurrentBid[x][y];
        if (currentBid.amount == 0) {
            return getReservePrice(x, y);
        } else {
            // attempt to outbid
            return getOutbidPrice(currentBid.amount);
        }
    }

    function getCategory(int16 x, int16 y) public view returns (int8) {
        (uint16 x_mapped, uint16 y_mapped) = _transformXY(x, y);

        int8 category;
        for (uint16 i = x_mapped; i > 0; i = _subLowbit(i)) {
            for (uint16 j = y_mapped; j > 0; j = _subLowbit(j)) {
                unchecked {
                    category += _categoryBIT[i][j];
                }
            }
        }
        return category;
    }

    function isShiboshiZone(int16 x, int16 y) public pure returns (bool) {
        /*
            (12,99) to (48, 65)
            (49, 99) to (77, 78)
            (76, 77) to (77, 50)
            (65, 50) to (75, 50)
        */

        if (x >= 12 && x <= 48 && y <= 99 && y >= 65) {
            return true;
        }
        if (x >= 49 && x <= 77 && y <= 99 && y >= 78) {
            return true;
        }
        if (x >= 76 && x <= 77 && y <= 77 && y >= 50) {
            return true;
        }
        if (x >= 65 && x <= 75 && y == 50) {
            return true;
        }
        return false;
    }

    // List of currently winning bids of this user
    function bidInfoOf(address user)
        external
        view
        returns (int16[] memory, int16[] memory)
    {
        uint256 bidCount = winningsBidsOf[user];
        int16[] memory xs = new int16[](bidCount);
        int16[] memory ys = new int16[](bidCount);

        uint256 ptr;
        uint32[] storage allBids = _allBidsOf[user];
        uint256 length = allBids.length;

        for (uint256 i = 0; i < length; i = _uncheckedInc(i)) {
            if (_statusOfBidsOf[user][allBids[i]] == 1) {
                (int16 x, int16 y) = _decodeXY(allBids[i]);
                xs[ptr] = x;
                ys[ptr] = y;
                ptr = _uncheckedInc(ptr);
            }
        }

        return (xs, ys);
    }

    // List of all bids, ever done by this user
    function allBidInfoOf(address user)
        external
        view
        returns (int16[] memory, int16[] memory)
    {
        uint32[] storage allBids = _allBidsOf[user];
        uint256 bidCount = allBids.length;
        int16[] memory xs = new int16[](bidCount);
        int16[] memory ys = new int16[](bidCount);

        for (uint256 i = 0; i < bidCount; i = _uncheckedInc(i)) {
            (int16 x, int16 y) = _decodeXY(allBids[i]);
            xs[i] = x;
            ys[i] = y;
        }

        return (xs, ys);
    }

    function setGridVal(
        int16 x1,
        int16 y1,
        int16 x2,
        int16 y2,
        int8 val
    ) external onlyRole(GRID_SETTER_ROLE) {
        (uint16 x1_mapped, uint16 y1_mapped) = _transformXY(x1, y1);
        (uint16 x2_mapped, uint16 y2_mapped) = _transformXY(x2, y2);

        _updateGrid(x2_mapped + 1, y2_mapped + 1, val);
        _updateGrid(x1_mapped, y1_mapped, val);
        _updateGrid(x1_mapped, y2_mapped + 1, -val);
        _updateGrid(x2_mapped + 1, y1_mapped, -val);
    }

    function setPriceOfCategory(int8 category, uint256 price)
        external
        onlyRole(GRID_SETTER_ROLE)
    {
        priceOfCategory[category] = price;

        emit CategoryPriceSet(category, price);
    }

    function setStage(uint256 stage) external onlyRole(DEFAULT_ADMIN_ROLE) {
        currentStage = Stage(stage);
        emit StageSet(stage);
    }

    function setSignerAddress(address signer)
        external
        onlyRole(DEFAULT_ADMIN_ROLE)
    {
        require(signer != address(0), "ERR_CANNOT_BE_ZERO_ADDRESS");
        signerAddress = signer;
        emit SignerSet(signer);
    }

    function setLandRegistry(address _landRegistry)
        external
        onlyRole(DEFAULT_ADMIN_ROLE)
    {
        landRegistry = ILandRegistry(_landRegistry);
    }

    function setLockLeash(address _lockLeash)
        external
        onlyRole(DEFAULT_ADMIN_ROLE)
    {
        lockLeash = ILockLeash(_lockLeash);
    }

    function setLockShiboshi(address _lockShiboshi)
        external
        onlyRole(DEFAULT_ADMIN_ROLE)
    {
        lockShiboshi = ILockShiboshi(_lockShiboshi);
    }

    function setMultiBid(bool desiredValue)
        external
        onlyRole(DEFAULT_ADMIN_ROLE)
    {
        require(multiBidEnabled != desiredValue, "ERR_ALREADY_DESIRED_VALUE");
        multiBidEnabled = desiredValue;

        emit multiBidToggled(desiredValue);
    }

    function withdraw(address to, uint256 amount)
        external
        onlyRole(DEFAULT_ADMIN_ROLE)
    {
        payable(to).transfer(amount);
    }

    function bidOne(int16 x, int16 y)
        external
        payable
        onlyStage(Stage.Bidding)
        nonReentrant
    {
        address user = msg.sender;
        require(availableCapacityOf(user) != 0, "ERR_NO_BIDS_REMAINING");
        require(!isShiboshiZone(x, y), "ERR_NO_MINT_IN_SHIBOSHI_ZONE");
        _bid(user, x, y, msg.value);
    }

    function bidShiboshiZoneOne(
        int16 x,
        int16 y,
        bytes calldata signature
    ) external payable onlyStage(Stage.Bidding) nonReentrant {
        address user = msg.sender;
        require(
            _verifySigner(_hashMessage(user), signature),
            "ERR_SIGNATURE_INVALID"
        );
        require(isShiboshiZone(x, y), "ERR_NOT_IN_SHIBOSHI_ZONE");
        _bid(user, x, y, msg.value);
    }

    function bidMulti(
        int16[] calldata xs,
        int16[] calldata ys,
        uint256[] calldata prices
    ) external payable onlyStage(Stage.Bidding) nonReentrant {
        require(multiBidEnabled, "ERR_MULTI_BID_DISABLED");

        address user = msg.sender;

        uint256 length = xs.length;
        require(length != 0, "ERR_NO_INPUT");
        require(length == ys.length, "ERR_INPUT_LENGTH_MISMATCH");
        require(length == prices.length, "ERR_INPUT_LENGTH_MISMATCH");

        uint256 total;
        require(
            availableCapacityOf(user) >= length,
            "ERR_INSUFFICIENT_BIDS_REMAINING"
        );

        for (uint256 i = 0; i < length; i = _uncheckedInc(i)) {
            total += prices[i];
        }
        require(msg.value == total, "ERR_INSUFFICIENT_AMOUNT_SENT");

        for (uint256 i = 0; i < length; i = _uncheckedInc(i)) {
            int16 x = xs[i];
            int16 y = ys[i];
            require(!isShiboshiZone(x, y), "ERR_NO_MINT_IN_SHIBOSHI_ZONE");
            _bid(user, x, y, prices[i]);
        }
    }

    function bidShiboshiZoneMulti(
        int16[] calldata xs,
        int16[] calldata ys,
        uint256[] calldata prices,
        bytes calldata signature
    ) external payable onlyStage(Stage.Bidding) nonReentrant {
        require(multiBidEnabled, "ERR_MULTI_BID_DISABLED");

        address user = msg.sender;
        require(
            _verifySigner(_hashMessage(user), signature),
            "ERR_SIGNATURE_INVALID"
        );

        uint256 length = xs.length;
        require(length != 0, "ERR_NO_INPUT");
        require(length == ys.length, "ERR_INPUT_LENGTH_MISMATCH");
        require(length == prices.length, "ERR_INPUT_LENGTH_MISMATCH");

        uint256 total;
        for (uint256 i = 0; i < length; i = _uncheckedInc(i)) {
            total += prices[i];
        }
        require(msg.value == total, "ERR_INSUFFICIENT_AMOUNT_SENT");

        for (uint256 i = 0; i < length; i = _uncheckedInc(i)) {
            int16 x = xs[i];
            int16 y = ys[i];
            require(isShiboshiZone(x, y), "ERR_NOT_IN_SHIBOSHI_ZONE");
            _bid(user, x, y, prices[i]);
        }
    }

    function mintWinningBid(int16[] calldata xs, int16[] calldata ys) external {
        require(
            currentStage == Stage.PublicSale ||
                currentStage == Stage.PrivateSale,
            "ERR_MUST_WAIT_FOR_BIDDING_TO_END"
        );

        uint256 length = xs.length;
        require(length == ys.length, "ERR_INPUT_LENGTH_MISMATCH");

        for (uint256 i = 0; i < length; i = _uncheckedInc(i)) {
            int16 x = xs[i];
            int16 y = ys[i];
            require(xLow <= x && x <= xHigh, "ERR_X_OUT_OF_RANGE");
            require(yLow <= y && y <= yHigh, "ERR_Y_OUT_OF_RANGE");

            address user = getCurrentBid[x][y].bidder;
            require(user != address(0), "ERR_NO_BID_FOUND");
            landRegistry.mint(user, x, y);
        }
    }

    function mintPrivate(int16 x, int16 y)
        external
        payable
        onlyStage(Stage.PrivateSale)
        nonReentrant
    {
        require(availableCapacityOf(msg.sender) != 0, "ERR_NO_BIDS_REMAINING");
        require(!isShiboshiZone(x, y), "ERR_NO_MINT_IN_SHIBOSHI_ZONE");
        _mintPublicOrPrivate(msg.sender, x, y);
        emit LandBought(
            msg.sender,
            _encodeXY(x, y),
            x,
            y,
            msg.value,
            Stage.PrivateSale
        );
    }

    function mintPrivateShiboshiZone(
        int16 x,
        int16 y,
        bytes calldata signature
    ) external payable onlyStage(Stage.PrivateSale) nonReentrant {
        require(
            _verifySigner(_hashMessage(msg.sender), signature),
            "ERR_SIGNATURE_INVALID"
        );
        require(isShiboshiZone(x, y), "ERR_NOT_IN_SHIBOSHI_ZONE");
        _mintPublicOrPrivate(msg.sender, x, y);
        emit LandBought(
            msg.sender,
            _encodeXY(x, y),
            x,
            y,
            msg.value,
            Stage.PrivateSale
        );
    }

    function mintPublic(int16 x, int16 y)
        external
        payable
        onlyStage(Stage.PublicSale)
        nonReentrant
    {
        _mintPublicOrPrivate(msg.sender, x, y);
        emit LandBought(
            msg.sender,
            _encodeXY(x, y),
            x,
            y,
            msg.value,
            Stage.PublicSale
        );
    }

    // transform: +97, +100
    function _transformXY(int16 x, int16 y)
        internal
        pure
        onlyValid(x, y)
        returns (uint16, uint16)
    {
        return (uint16(x + 97), uint16(100 - y));
    }

    function _bid(
        address user,
        int16 x,
        int16 y,
        uint256 price
    ) internal onlyValid(x, y) {
        uint32 encXY = _encodeXY(x, y);
        Bid storage currentBid = getCurrentBid[x][y];
        if (currentBid.amount == 0) {
            // first bid on this land
            require(
                price >= getReservePrice(x, y),
                "ERR_INSUFFICIENT_AMOUNT_SENT"
            );
        } else {
            // attempt to outbid
            require(user != currentBid.bidder, "ERR_CANNOT_OUTBID_YOURSELF");
            require(
                price >= getOutbidPrice(currentBid.amount),
                "ERR_INSUFFICIENT_AMOUNT_SENT"
            );
            _safeTransferETHWithFallback(currentBid.bidder, currentBid.amount);
            winningsBidsOf[currentBid.bidder] -= 1;
            _statusOfBidsOf[currentBid.bidder][encXY] = 2;
        }

        currentBid.bidder = user;
        currentBid.amount = price;
        winningsBidsOf[user] += 1;

        if (_statusOfBidsOf[user][encXY] == 0) {
            // user has never bid on this land earlier
            _allBidsOf[user].push(encXY);
        }
        _statusOfBidsOf[user][encXY] = 1;

        emit BidCreated(user, encXY, x, y, price, block.timestamp);
    }

    function _mintPublicOrPrivate(
        address user,
        int16 x,
        int16 y
    ) internal onlyValid(x, y) {
        Bid storage currentBid = getCurrentBid[x][y];
        require(currentBid.amount == 0, "ERR_NOT_UP_FOR_SALE");
        require(
            msg.value == getReservePrice(x, y),
            "ERR_INSUFFICIENT_AMOUNT_SENT"
        );

        currentBid.bidder = user;
        currentBid.amount = msg.value;
        winningsBidsOf[user] += 1;

        uint32 encXY = _encodeXY(x, y);
        _allBidsOf[user].push(encXY);
        _statusOfBidsOf[user][encXY] = 1;

        landRegistry.mint(user, x, y);
    }

    function _hashMessage(address sender) private pure returns (bytes32) {
        return keccak256(abi.encodePacked(sender));
    }

    function _verifySigner(bytes32 messageHash, bytes memory signature)
        private
        view
        returns (bool)
    {
        return
            signerAddress ==
            messageHash.toEthSignedMessageHash().recover(signature);
    }

    /**
     * @notice Transfer ETH. If the ETH transfer fails, wrap the ETH and try send it as WETH.
     */
    function _safeTransferETHWithFallback(address to, uint256 amount) internal {
        if (!_safeTransferETH(to, amount)) {
            IWETH(weth).deposit{value: amount}();
            IERC20(weth).transfer(to, amount);
        }
    }

    /**
     * @notice Transfer ETH and return the success status.
     * @dev This function only forwards 30,000 gas to the callee.
     */
    function _safeTransferETH(address to, uint256 value)
        internal
        returns (bool)
    {
        (bool success, ) = to.call{value: value, gas: 30_000}(new bytes(0));
        return success;
    }

    function _uncheckedInc(uint256 i) internal pure returns (uint256) {
        unchecked {
            return i + 1;
        }
    }

    function _uncheckedDec(uint256 i) internal pure returns (uint256) {
        unchecked {
            return i - 1;
        }
    }

    function _encodeXY(int16 x, int16 y) internal pure returns (uint32) {
        return
            ((uint32(uint16(x)) * factor) & clearLow) |
            (uint32(uint16(y)) & clearHigh);
    }

    function _decodeXY(uint32 value) internal pure returns (int16 x, int16 y) {
        x = _expandNegative16BitCast((value & clearLow) >> 16);
        y = _expandNegative16BitCast(value & clearHigh);
    }

    function _expandNegative16BitCast(uint32 value)
        internal
        pure
        returns (int16)
    {
        if (value & (1 << 15) != 0) {
            return int16(int32(value | clearLow));
        }
        return int16(int32(value));
    }

    // Functions for BIT

    function _updateGrid(
        uint16 x,
        uint16 y,
        int8 val
    ) internal {
        for (uint16 i = x; i <= N; i = _addLowbit(i)) {
            for (uint16 j = y; j <= M; j = _addLowbit(j)) {
                unchecked {
                    _categoryBIT[i][j] += val;
                }
            }
        }
    }

    function _addLowbit(uint16 i) internal pure returns (uint16) {
        unchecked {
            return i + uint16(int16(i) & (-int16(i)));
        }
    }

    function _subLowbit(uint16 i) internal pure returns (uint16) {
        unchecked {
            return i - uint16(int16(i) & (-int16(i)));
        }
    }
}

File 8 of 23 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}

File 9 of 23 : OOOSafeMath.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Wrappers over Solidity's arithmetic operations with added overflow
 * checks.
 *
 * Arithmetic operations in Solidity wrap on overflow. This can easily result
 * in bugs, because programmers usually assume that an overflow raises an
 * error, which is the standard behavior in high level programming languages.
 * `SafeMath` restores this intuition by reverting the transaction when an
 * operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 */
library OOOSafeMath {
    /**
    * @dev Returns the addition of two unsigned integers, reverting on
    * overflow.
    *
    * Counterpart to Solidity's `+` operator.
    *
    * Requirements:
    *
    * - Addition cannot overflow.
    */
    function safeAdd(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        require(c >= a, "SafeMath: addition overflow");
        return c;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function safeSub(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b <= a, "SafeMath: subtraction overflow");
        return a - b;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function safeMul(uint256 a, uint256 b) internal pure returns (uint256) {
        if (a == 0) return 0;
        uint256 c = a * b;
        require(c / a == b, "SafeMath: multiplication overflow");
        return c;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function saveDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b > 0, "SafeMath: division by zero");
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function safeMod(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b > 0, "SafeMath: modulo by zero");
        return a % b;
    }
}

File 10 of 23 : IERC20_Ex.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20_Ex {
    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `recipient`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address recipient, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Atomically increases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function increaseAllowance(address spender, uint256 addedValue) external returns (bool);

    /**
     * @dev Atomically decreases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `spender` must have allowance for the caller of at least
     * `subtractedValue`.
     */
    function decreaseAllowance(address spender, uint256 subtractedValue) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `sender` to `recipient` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);

    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);
}

File 11 of 23 : IRouter.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

interface IRouter {
    function initialiseRequest(address, uint256, bytes32) external returns (bool);
}

File 12 of 23 : RequestIdBase.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

/**
 * @title RequestIdBase
 *
 * @dev A contract used by ConsumerBase and Router to generate requestIds
 *
 */
contract RequestIdBase {

    /**
    * @dev makeRequestId generates a requestId
    *
    * @param _dataConsumer address of consumer contract
    * @param _dataProvider address of provider
    * @param _router address of Router contract
    * @param _requestNonce uint256 request nonce
    * @param _data bytes32 hex encoded data endpoint
    *
    * @return bytes32 requestId
    */
    function makeRequestId(
        address _dataConsumer,
        address _dataProvider,
        address _router,
        uint256 _requestNonce,
        bytes32 _data) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked(_dataConsumer, _dataProvider, _router, _requestNonce, _data));
    }
}

File 13 of 23 : AccessControl.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControl.sol)

pragma solidity ^0.8.0;

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

/**
 * @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 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]{40}) is missing role (0x[0-9a-f]{64})$/
     *
     * _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 virtual 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]{40}) is missing role (0x[0-9a-f]{64})$/
     */
    function _checkRole(bytes32 role, address account) internal view virtual {
        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 virtual 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 revoked `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}.
     * ====
     *
     * NOTE: This function is deprecated in favor of {_grantRole}.
     */
    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 {
        bytes32 previousAdminRole = getRoleAdmin(role);
        _roles[role].adminRole = adminRole;
        emit RoleAdminChanged(role, previousAdminRole, adminRole);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * Internal function without access restriction.
     */
    function _grantRole(bytes32 role, address account) internal virtual {
        if (!hasRole(role, account)) {
            _roles[role].members[account] = true;
            emit RoleGranted(role, account, _msgSender());
        }
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * Internal function without access restriction.
     */
    function _revokeRole(bytes32 role, address account) internal virtual {
        if (hasRole(role, account)) {
            _roles[role].members[account] = false;
            emit RoleRevoked(role, account, _msgSender());
        }
    }
}

File 14 of 23 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)

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 15 of 23 : ECDSA.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/ECDSA.sol)

pragma solidity ^0.8.0;

import "../Strings.sol";

/**
 * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
 *
 * These functions can be used to verify that a message was signed by the holder
 * of the private keys of a given address.
 */
library ECDSA {
    enum RecoverError {
        NoError,
        InvalidSignature,
        InvalidSignatureLength,
        InvalidSignatureS,
        InvalidSignatureV
    }

    function _throwError(RecoverError error) private pure {
        if (error == RecoverError.NoError) {
            return; // no error: do nothing
        } else if (error == RecoverError.InvalidSignature) {
            revert("ECDSA: invalid signature");
        } else if (error == RecoverError.InvalidSignatureLength) {
            revert("ECDSA: invalid signature length");
        } else if (error == RecoverError.InvalidSignatureS) {
            revert("ECDSA: invalid signature 's' value");
        } else if (error == RecoverError.InvalidSignatureV) {
            revert("ECDSA: invalid signature 'v' value");
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature` or error string. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {toEthSignedMessageHash} on it.
     *
     * Documentation for signature generation:
     * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
     * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
     *
     * _Available since v4.3._
     */
    function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {
        // Check the signature length
        // - case 65: r,s,v signature (standard)
        // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._
        if (signature.length == 65) {
            bytes32 r;
            bytes32 s;
            uint8 v;
            // ecrecover takes the signature parameters, and the only way to get them
            // currently is to use assembly.
            assembly {
                r := mload(add(signature, 0x20))
                s := mload(add(signature, 0x40))
                v := byte(0, mload(add(signature, 0x60)))
            }
            return tryRecover(hash, v, r, s);
        } else if (signature.length == 64) {
            bytes32 r;
            bytes32 vs;
            // ecrecover takes the signature parameters, and the only way to get them
            // currently is to use assembly.
            assembly {
                r := mload(add(signature, 0x20))
                vs := mload(add(signature, 0x40))
            }
            return tryRecover(hash, r, vs);
        } else {
            return (address(0), RecoverError.InvalidSignatureLength);
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature`. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {toEthSignedMessageHash} on it.
     */
    function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, signature);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
     *
     * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
     *
     * _Available since v4.3._
     */
    function tryRecover(
        bytes32 hash,
        bytes32 r,
        bytes32 vs
    ) internal pure returns (address, RecoverError) {
        bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
        uint8 v = uint8((uint256(vs) >> 255) + 27);
        return tryRecover(hash, v, r, s);
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
     *
     * _Available since v4.2._
     */
    function recover(
        bytes32 hash,
        bytes32 r,
        bytes32 vs
    ) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, r, vs);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `v`,
     * `r` and `s` signature fields separately.
     *
     * _Available since v4.3._
     */
    function tryRecover(
        bytes32 hash,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal pure returns (address, RecoverError) {
        // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
        // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
        // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
        // signatures from current libraries generate a unique signature with an s-value in the lower half order.
        //
        // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
        // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
        // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
        // these malleable signatures as well.
        if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
            return (address(0), RecoverError.InvalidSignatureS);
        }
        if (v != 27 && v != 28) {
            return (address(0), RecoverError.InvalidSignatureV);
        }

        // If the signature is valid (and not malleable), return the signer address
        address signer = ecrecover(hash, v, r, s);
        if (signer == address(0)) {
            return (address(0), RecoverError.InvalidSignature);
        }

        return (signer, RecoverError.NoError);
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `v`,
     * `r` and `s` signature fields separately.
     */
    function recover(
        bytes32 hash,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, v, r, s);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Returns an Ethereum Signed Message, created from a `hash`. This
     * produces hash corresponding to the one signed with the
     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
     * JSON-RPC method as part of EIP-191.
     *
     * See {recover}.
     */
    function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {
        // 32 is the length in bytes of hash,
        // enforced by the type signature above
        return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
    }

    /**
     * @dev Returns an Ethereum Signed Message, created from `s`. This
     * produces hash corresponding to the one signed with the
     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
     * JSON-RPC method as part of EIP-191.
     *
     * See {recover}.
     */
    function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s));
    }

    /**
     * @dev Returns an Ethereum Signed Typed Data, created from a
     * `domainSeparator` and a `structHash`. This produces hash corresponding
     * to the one signed with the
     * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]
     * JSON-RPC method as part of EIP-712.
     *
     * See {recover}.
     */
    function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
    }
}

File 16 of 23 : IWETH.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.13;

interface IWETH {
    function deposit() external payable;

    function withdraw(uint256 wad) external;

    function transfer(address to, uint256 value) external returns (bool);
}

File 17 of 23 : ILockShiboshi.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

interface ILockShiboshi {
    function lockInfoOf(address user)
        external
        view
        returns (
            uint256[] memory ids,
            uint256 startTime,
            uint256 numDays,
            address ogUser
        );

    function weightOf(address user) external view returns (uint256);

    function extraShiboshiNeeded(address user, uint256 targetWeight)
        external
        view
        returns (uint256);

    function extraDaysNeeded(address user, uint256 targetWeight)
        external
        view
        returns (uint256);

    function isWinner(address user) external view returns (bool);

    function unlockAt(address user) external view returns (uint256);
}

File 18 of 23 : ILockLeash.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

interface ILockLeash {
    function lockInfoOf(address user)
        external
        view
        returns (
            uint256 amount,
            uint256 startTime,
            uint256 numDays,
            address ogUser
        );

    function weightOf(address user) external view returns (uint256);

    function extraLeashNeeded(address user, uint256 targetWeight)
        external
        view
        returns (uint256);

    function extraDaysNeeded(address user, uint256 targetWeight)
        external
        view
        returns (uint256);

    function isWinner(address user) external view returns (bool);

    function unlockAt(address user) external view returns (uint256);
}

File 19 of 23 : ILandAuction.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

interface ILandAuction {
    function winningsBidsOf(address user) external view returns (uint256);
}

File 20 of 23 : IAccessControl.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)

pragma solidity ^0.8.0;

/**
 * @dev External interface of AccessControl declared to support ERC165 detection.
 */
interface IAccessControl {
    /**
     * @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 {AccessControl-_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 Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) external view returns (bool);

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {AccessControl-_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) external view returns (bytes32);

    /**
     * @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) external;

    /**
     * @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) external;

    /**
     * @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) external;
}

File 21 of 23 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)

pragma solidity ^0.8.0;

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        // Inspired by OraclizeAPI's implementation - MIT licence
        // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol

        if (value == 0) {
            return "0";
        }
        uint256 temp = value;
        uint256 digits;
        while (temp != 0) {
            digits++;
            temp /= 10;
        }
        bytes memory buffer = new bytes(digits);
        while (value != 0) {
            digits -= 1;
            buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
            value /= 10;
        }
        return string(buffer);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        if (value == 0) {
            return "0x00";
        }
        uint256 temp = value;
        uint256 length = 0;
        while (temp != 0) {
            length++;
            temp >>= 8;
        }
        return toHexString(value, length);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
     */
    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
        bytes memory buffer = new bytes(2 * length + 2);
        buffer[0] = "0";
        buffer[1] = "x";
        for (uint256 i = 2 * length + 1; i > 1; --i) {
            buffer[i] = _HEX_SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }
}

File 22 of 23 : ERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)

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 23 of 23 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

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);
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"contract IERC20","name":"_shib","type":"address"},{"internalType":"contract LandAuction","name":"_auctionV1","type":"address"},{"internalType":"contract LandAuction","name":"_auctionV2","type":"address"},{"internalType":"contract ILandRegistry","name":"_landRegistry","type":"address"},{"internalType":"address","name":"_router","type":"address"},{"internalType":"address","name":"_xfund","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint32","name":"encXY","type":"uint32"},{"indexed":false,"internalType":"int16","name":"x","type":"int16"},{"indexed":false,"internalType":"int16","name":"y","type":"int16"},{"indexed":false,"internalType":"uint256","name":"price","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"time","type":"uint256"},{"indexed":false,"internalType":"enum LandAuctionV3.Stage","name":"saleStage","type":"uint8"}],"name":"LandBoughtWithShib","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"stage","type":"uint256"}],"name":"StageSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"newValue","type":"bool"}],"name":"multiMintToggled","type":"event"},{"inputs":[],"name":"SHIB","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"auctionV1","outputs":[{"internalType":"contract LandAuction","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"auctionV2","outputs":[{"internalType":"contract LandAuction","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"bidInfoOf","outputs":[{"internalType":"int16[]","name":"","type":"int16[]"},{"internalType":"int16[]","name":"","type":"int16[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"currentStage","outputs":[{"internalType":"enum LandAuctionV3.Stage","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ethToShib","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_provider","type":"address"},{"internalType":"uint256","name":"_fee","type":"uint256"}],"name":"getData","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"int16","name":"x","type":"int16"},{"internalType":"int16","name":"y","type":"int16"}],"name":"getReservePriceShib","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getRouterAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"increaseRouterAllowance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"landRegistry","outputs":[{"internalType":"contract ILandRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"int16","name":"x","type":"int16"},{"internalType":"int16","name":"y","type":"int16"}],"name":"mintPublicWithShib","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"int16[]","name":"xs","type":"int16[]"},{"internalType":"int16[]","name":"ys","type":"int16[]"},{"internalType":"uint256[]","name":"prices","type":"uint256[]"}],"name":"mintPublicWithShibMulti","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"multiMintEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_price","type":"uint256"},{"internalType":"bytes32","name":"_requestId","type":"bytes32"}],"name":"rawReceiveData","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract LandAuction","name":"_auctionV1","type":"address"}],"name":"setAuctionV1","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract LandAuction","name":"_auctionV2","type":"address"}],"name":"setAuctionV2","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_landRegistry","type":"address"}],"name":"setLandRegistry","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"desiredValue","type":"bool"}],"name":"setMultiMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"stage","type":"uint256"}],"name":"setStage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdrawAny","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdrawShib","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"xHigh","outputs":[{"internalType":"int16","name":"","type":"int16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"xLow","outputs":[{"internalType":"int16","name":"","type":"int16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"yHigh","outputs":[{"internalType":"int16","name":"","type":"int16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"yLow","outputs":[{"internalType":"int16","name":"","type":"int16"}],"stateMutability":"view","type":"function"}]

60c06040523480156200001157600080fd5b5060405162002276380380620022768339810160408190526200003491620001ee565b81816001600160a01b0382166200009c5760405162461bcd60e51b815260206004820152602160248201527f726f757465722063616e6e6f7420626520746865207a65726f206164647265736044820152607360f81b60648201526084015b60405180910390fd5b6001600160a01b038116620000f45760405162461bcd60e51b815260206004820181905260248201527f7866756e642063616e6e6f7420626520746865207a65726f2061646472657373604482015260640162000093565b600180546001600160a01b0319166001600160a01b039384161790551660805262000126620001203390565b62000183565b505060016003556001600160a01b0393841660a0526005805493851661010002610100600160a81b031990941693909317909255600680549184166001600160a01b03199283161790556007805492909316911617905562000282565b600280546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b0381168114620001eb57600080fd5b50565b60008060008060008060c087890312156200020857600080fd5b86516200021581620001d5565b60208801519096506200022881620001d5565b60408801519095506200023b81620001d5565b60608801519094506200024e81620001d5565b60808801519093506200026181620001d5565b60a08801519092506200027481620001d5565b809150509295509295509295565b60805160a051611fb9620002bd600039600081816103e1015281816104900152818161095a0152610df0015260006118280152611fb96000f3fe608060405234801561001057600080fd5b50600436106101cf5760003560e01c80638da5cb5b11610104578063c78daced116100a2578063dfc1a73111610071578063dfc1a731146103d3578063e24b85e7146103dc578063f2fde38b14610403578063f5ada9ad1461041657600080fd5b8063c78daced14610394578063d54f7d5e146103a7578063d598c9e9146103b8578063d5ed9cba146103c057600080fd5b8063afadcda6116100de578063afadcda614610357578063afc01ac314610360578063b3a6807c14610369578063bd4dc0241461038157600080fd5b80638da5cb5b14610320578063969890e414610331578063a47944a61461034457600080fd5b80635bf5d54c1161017157806376fa5e971161014b57806376fa5e97146102ca57806380ca56a3146102dd578063822d518a146102fa5780638a37a3791461030d57600080fd5b80635bf5d54c1461028e5780636991cf89146102af578063715018a6146102c257600080fd5b80632979d025116101ad5780632979d0251461023a5780633eb1d7771461024d57806340f19a6a1461026057806347c3593f1461027357600080fd5b80630622eb2e146101d45780630d88ecef146101e95780631963cb061461020f575b600080fd5b6101e76101e23660046119fa565b610437565b005b6101fc6101f7366004611a35565b610502565b6040519081526020015b60405180910390f35b600654610222906001600160a01b031681565b6040516001600160a01b039091168152602001610206565b6101fc6102483660046119fa565b610773565b6101e761025b366004611a6e565b6107c8565b6101e761026e366004611a35565b610862565b61027b606381565b60405160019190910b8152602001610206565b6007546102a290600160a01b900460ff1681565b6040516102069190611abf565b6101e76102bd366004611a6e565b610af8565b6101e7610b73565b6101e76102d8366004611b19565b610ba9565b6005546102ea9060ff1681565b6040519015158152602001610206565b6101e7610308366004611bb3565b611096565b6101e761031b366004611bb3565b6110e2565b6002546001600160a01b0316610222565b6101e761033f366004611bd0565b611134565b6101e7610352366004611bf2565b611192565b6101fc60045481565b61027b60621981565b6005546102229061010090046001600160a01b031681565b600754610222906001600160a01b031681565b6101e76103a2366004611c41565b611235565b6001546001600160a01b0316610222565b61027b606081565b6101e76103ce366004611bb3565b6112fa565b61027b605f1981565b6102227f000000000000000000000000000000000000000000000000000000000000000081565b6101e7610411366004611bb3565b611346565b610429610424366004611bb3565b6113de565b604051610206929190611c9c565b6002546001600160a01b0316331461046a5760405162461bcd60e51b815260040161046190611cca565b60405180910390fd5b60405163a9059cbb60e01b81526001600160a01b038381166004830152602482018390527f0000000000000000000000000000000000000000000000000000000000000000169063a9059cbb906044016020604051808303816000875af11580156104d9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104fd9190611cff565b505050565b60008282600182900b605f191380159061052157506060600183900b13155b6105625760405162461bcd60e51b81526020600482015260126024820152714552525f585f4f55545f4f465f52414e474560701b6044820152606401610461565b600181900b6062191380159061057d57506063600182900b13155b6105be5760405162461bcd60e51b81526020600482015260126024820152714552525f595f4f55545f4f465f52414e474560701b6044820152606401610461565b6005546040516324d4c0b360e21b8152600187810b600483015286900b602482015260009161010090046001600160a01b03169063935302cc90604401602060405180830381865afa158015610618573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061063c9190611d1c565b60055460405163aaf5ddcd60e01b8152600189810b600483015288900b60248201529192506000916101009091046001600160a01b03169063aaf5ddcd906044016040805180830381865afa158015610699573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106bd9190611d35565b50905080156107035760405162461bcd60e51b815260206004820152601260248201527111549497d053149150511657d093d551d21560721b6044820152606401610461565b6000670de0b6b3a76400008360045461071c9190611d70565b6107269190611d8f565b9050600081116107685760405162461bcd60e51b815260206004820152600d60248201526c4552525f4241445f505249434560981b6044820152606401610461565b979650505050505050565b6002546000906001600160a01b031633146107a05760405162461bcd60e51b815260040161046190611cca565b6e4554482e534849422e50522e41564360881b6107be848483611687565b9150505b92915050565b6002546001600160a01b031633146107f25760405162461bcd60e51b815260040161046190611cca565b80600381111561080457610804611a87565b6007805460ff60a01b1916600160a01b83600381111561082657610826611a87565b02179055506040518181527f02f604feff374725ab69a4a6b22fbfb7f79b787bc42299abdea1de38ec4ef4b6906020015b60405180910390a150565b600380600754600160a01b900460ff16600381111561088357610883611a87565b146108d05760405162461bcd60e51b815260206004820152601b60248201527f4552525f544849535f53544147455f4e4f545f4c4956455f59455400000000006044820152606401610461565b6002600354036109225760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610461565b600260035560006109338484610502565b6040516323b872dd60e01b81523360048201819052306024830152604482018390529192507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906323b872dd906064016020604051808303816000875af11580156109ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109cf9190611cff565b5060006109dc86866117d0565b6001600160a01b03838116600081815260086020818152604080842080546001808201835591865292909420928204909201805463ffffffff8881166004600795861681026101000a9182029290910219909216179091559054915162edcc2360e71b8152908101939093528a820b60248401529089900b60448301529293509116906376e6118090606401600060405180830381600087803b158015610a8257600080fd5b505af1158015610a96573d6000803e3d6000fd5b505050508063ffffffff16826001600160a01b03167f7589918db62cc3caacbb3939e0db5a02ecc62bf9c941214b6efef75379d31f89888887426003604051610ae3959493929190611db1565b60405180910390a35050600160035550505050565b6002546001600160a01b03163314610b225760405162461bcd60e51b815260040161046190611cca565b610b2b816117fc565b610b705760405162461bcd60e51b81526020600482015260166024820152754552525f4641494c45445f544f5f494e43524541534560501b6044820152606401610461565b50565b6002546001600160a01b03163314610b9d5760405162461bcd60e51b815260040161046190611cca565b610ba760006118e9565b565b600380600754600160a01b900460ff166003811115610bca57610bca611a87565b14610c175760405162461bcd60e51b815260206004820152601b60248201527f4552525f544849535f53544147455f4e4f545f4c4956455f59455400000000006044820152606401610461565b600260035403610c695760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610461565b600260035560055460ff16610cb95760405162461bcd60e51b815260206004820152601660248201527511549497d35553151257d0925117d11254d05093115160521b6044820152606401610461565b856000819003610cfa5760405162461bcd60e51b815260206004820152600c60248201526b11549497d393d7d25394155560a21b6044820152606401610461565b808514610d455760405162461bcd60e51b815260206004820152601960248201527808aa4a4be929ca0aaa8be988a9c8ea890be9a92a69a82a8869603b1b6044820152606401610461565b808314610d905760405162461bcd60e51b815260206004820152601960248201527808aa4a4be929ca0aaa8be988a9c8ea890be9a92a69a82a8869603b1b6044820152606401610461565b6000805b82811015610dca57858582818110610dae57610dae611deb565b9050602002013582610dc09190611e01565b9150600101610d94565b506040516323b872dd60e01b8152336004820181905230602483015260448201839052907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906323b872dd906064016020604051808303816000875af1158015610e41573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e659190611cff565b5060005b838110156110845760008b8b83818110610e8557610e85611deb565b9050602002016020810190610e9a9190611e19565b905060008a8a84818110610eb057610eb0611deb565b9050602002016020810190610ec59190611e19565b90506000610ed38383610502565b9050898985818110610ee757610ee7611deb565b905060200201358114610f3c5760405162461bcd60e51b815260206004820152601a60248201527f4552525f494e53554646494349454e545f534849425f53454e540000000000006044820152606401610461565b6000610f4884846117d0565b6001600160a01b03878116600081815260086020818152604080842080546001808201835591865292909420928204909201805463ffffffff8881166004600795861681026101000a9182029290910219909216179091559054915162edcc2360e71b81529081019390935288820b60248401529087900b60448301529293509116906376e6118090606401600060405180830381600087803b158015610fee57600080fd5b505af1158015611002573d6000803e3d6000fd5b505050508063ffffffff16866001600160a01b03167f7589918db62cc3caacbb3939e0db5a02ecc62bf9c941214b6efef75379d31f8986868f8f8b81811061104c5761104c611deb565b90506020020135426003604051611067959493929190611db1565b60405180910390a35050505061107d8160010190565b9050610e69565b50506001600355505050505050505050565b6002546001600160a01b031633146110c05760405162461bcd60e51b815260040161046190611cca565b600680546001600160a01b0319166001600160a01b0392909216919091179055565b6002546001600160a01b0316331461110c5760405162461bcd60e51b815260040161046190611cca565b600580546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b6001546001600160a01b031633146111855760405162461bcd60e51b81526020600482015260146024820152731bdb9b1e48149bdd5d195c8818d85b8818d85b1b60621b6044820152606401610461565b61118e82600455565b5050565b6002546001600160a01b031633146111bc5760405162461bcd60e51b815260040161046190611cca565b60405163a9059cbb60e01b81526001600160a01b0383811660048301526024820183905284169063a9059cbb906044016020604051808303816000875af115801561120b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061122f9190611cff565b50505050565b6002546001600160a01b0316331461125f5760405162461bcd60e51b815260040161046190611cca565b60055481151560ff9091161515036112b95760405162461bcd60e51b815260206004820152601960248201527f4552525f414c52454144595f444553495245445f56414c5545000000000000006044820152606401610461565b6005805460ff19168215159081179091556040519081527f81d89e0116bfd05c650b4de6b8a465c851946c4305a9552b6f757c4229df7c3b90602001610857565b6002546001600160a01b031633146113245760405162461bcd60e51b815260040161046190611cca565b600780546001600160a01b0319166001600160a01b0392909216919091179055565b6002546001600160a01b031633146113705760405162461bcd60e51b815260040161046190611cca565b6001600160a01b0381166113d55760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610461565b610b70816118e9565b60065460405163f5ada9ad60e01b81526001600160a01b03838116600483015260609283926000928392169063f5ada9ad90602401600060405180830381865afa158015611430573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526114589190810190611ef3565b81516001600160a01b03881660009081526008602052604081205493955091935091906114858383611e01565b67ffffffffffffffff81111561149d5761149d611e36565b6040519080825280602002602001820160405280156114c6578160200160208202803683370190505b50905060006114d58484611e01565b67ffffffffffffffff8111156114ed576114ed611e36565b604051908082528060200260200182016040528015611516578160200160208202803683370190505b50905060005b848110156115a65786818151811061153657611536611deb565b602002602001015183828151811061155057611550611deb565b602002602001019060010b908160010b8152505085818151811061157657611576611deb565b602002602001015182828151811061159057611590611deb565b600192830b60209182029290920101520161151c565b506001600160a01b0389166000908152600860205260408120805486925b818110156116745760008061160f8584815481106115e4576115e4611deb565b90600052602060002090600891828204019190066004029054906101000a900463ffffffff1661193b565b915091508188878151811061162657611626611deb565b602002602001019060010b908160010b815250508087878151811061164d5761164d611deb565b600192830b602091820292909201015286019550505061166d8160010190565b90506115c4565b50939b929a509198505050505050505050565b6001546001600160a01b03841660009081526020818152604080832054815130606090811b6bffffffffffffffffffffffff19908116838701528a821b8116603484015296901b9095166048860152605c850152607c80850186905281518086039091018152609c9094019052825192019190912081906001546040516001620fb3e960e11b031981526001600160a01b038881166004830152602482018890526044820187905292935091169063ffe0982e906064016020604051808303816000875af115801561175d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117819190611cff565b61178a57600080fd5b6001600160a01b0385166000908152602081905260409020546117ae906001611965565b6001600160a01b03861660009081526020819052604090205590509392505050565b600061ffff8261ffff161663ffff0000620100008561ffff166117f39190611f57565b16179392505050565b600154604051633950935160e01b81526001600160a01b039182166004820152602481018390526000917f000000000000000000000000000000000000000000000000000000000000000016906339509351906044016020604051808303816000875af1158015611871573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118959190611cff565b6118e15760405162461bcd60e51b815260206004820152601c60248201527f6661696c656420746f20696e63726561736520616c6c6f77616e6365000000006044820152606401610461565b506001919050565b600280546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60008061194f61ffff601085901c166119cb565b915061195e61ffff84166119cb565b9050915091565b6000806119728385611e01565b9050838110156119c45760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610461565b9392505050565b60006180008216156119e1575063ffff00001790565b5090565b6001600160a01b0381168114610b7057600080fd5b60008060408385031215611a0d57600080fd5b8235611a18816119e5565b946020939093013593505050565b8060010b8114610b7057600080fd5b60008060408385031215611a4857600080fd5b8235611a5381611a26565b91506020830135611a6381611a26565b809150509250929050565b600060208284031215611a8057600080fd5b5035919050565b634e487b7160e01b600052602160045260246000fd5b60048110611abb57634e487b7160e01b600052602160045260246000fd5b9052565b602081016107c28284611a9d565b60008083601f840112611adf57600080fd5b50813567ffffffffffffffff811115611af757600080fd5b6020830191508360208260051b8501011115611b1257600080fd5b9250929050565b60008060008060008060608789031215611b3257600080fd5b863567ffffffffffffffff80821115611b4a57600080fd5b611b568a838b01611acd565b90985096506020890135915080821115611b6f57600080fd5b611b7b8a838b01611acd565b90965094506040890135915080821115611b9457600080fd5b50611ba189828a01611acd565b979a9699509497509295939492505050565b600060208284031215611bc557600080fd5b81356119c4816119e5565b60008060408385031215611be357600080fd5b50508035926020909101359150565b600080600060608486031215611c0757600080fd5b8335611c12816119e5565b92506020840135611c22816119e5565b929592945050506040919091013590565b8015158114610b7057600080fd5b600060208284031215611c5357600080fd5b81356119c481611c33565b600081518084526020808501945080840160005b83811015611c91578151600190810b8852968301969183019101611c72565b509495945050505050565b604081526000611caf6040830185611c5e565b8281036020840152611cc18185611c5e565b95945050505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060208284031215611d1157600080fd5b81516119c481611c33565b600060208284031215611d2e57600080fd5b5051919050565b60008060408385031215611d4857600080fd5b825191506020830151611a63816119e5565b634e487b7160e01b600052601160045260246000fd5b6000816000190483118215151615611d8a57611d8a611d5a565b500290565b600082611dac57634e487b7160e01b600052601260045260246000fd5b500490565b600060a0820190508660010b82528560010b6020830152846040830152836060830152611de16080830184611a9d565b9695505050505050565b634e487b7160e01b600052603260045260246000fd5b60008219821115611e1457611e14611d5a565b500190565b600060208284031215611e2b57600080fd5b81356119c481611a26565b634e487b7160e01b600052604160045260246000fd5b8051611e5781611a26565b919050565b600082601f830112611e6d57600080fd5b8151602067ffffffffffffffff80831115611e8a57611e8a611e36565b8260051b604051601f19603f83011681018181108482111715611eaf57611eaf611e36565b604052938452858101830193838101925087851115611ecd57600080fd5b83870191505b8482101561076857611ee482611e4c565b83529183019190830190611ed3565b60008060408385031215611f0657600080fd5b825167ffffffffffffffff80821115611f1e57600080fd5b611f2a86838701611e5c565b93506020850151915080821115611f4057600080fd5b50611f4d85828601611e5c565b9150509250929050565b600063ffffffff80831681851681830481118215151615611f7a57611f7a611d5a565b0294935050505056fea2646970667358221220d35d0df9ff66f34dfc71856e3c4b5aae4059026cdd3d126193aa9388838a272a64736f6c634300080d003300000000000000000000000095ad61b0a150d79219dcf64e1e6cc01f0b64c4ce0000000000000000000000009ed0f787223ff1feb0cfb33a9207c646d182e9180000000000000000000000006b74c5885d2e08efd80164965f8df002608ebffa000000000000000000000000efaed650f1a94801806bb110019d9b0dc79531a80000000000000000000000009ac9ae20a17779c17b069b48a8788e3455fc6121000000000000000000000000892a6f9df0147e5f079b0993f486f9aca3c87881

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101cf5760003560e01c80638da5cb5b11610104578063c78daced116100a2578063dfc1a73111610071578063dfc1a731146103d3578063e24b85e7146103dc578063f2fde38b14610403578063f5ada9ad1461041657600080fd5b8063c78daced14610394578063d54f7d5e146103a7578063d598c9e9146103b8578063d5ed9cba146103c057600080fd5b8063afadcda6116100de578063afadcda614610357578063afc01ac314610360578063b3a6807c14610369578063bd4dc0241461038157600080fd5b80638da5cb5b14610320578063969890e414610331578063a47944a61461034457600080fd5b80635bf5d54c1161017157806376fa5e971161014b57806376fa5e97146102ca57806380ca56a3146102dd578063822d518a146102fa5780638a37a3791461030d57600080fd5b80635bf5d54c1461028e5780636991cf89146102af578063715018a6146102c257600080fd5b80632979d025116101ad5780632979d0251461023a5780633eb1d7771461024d57806340f19a6a1461026057806347c3593f1461027357600080fd5b80630622eb2e146101d45780630d88ecef146101e95780631963cb061461020f575b600080fd5b6101e76101e23660046119fa565b610437565b005b6101fc6101f7366004611a35565b610502565b6040519081526020015b60405180910390f35b600654610222906001600160a01b031681565b6040516001600160a01b039091168152602001610206565b6101fc6102483660046119fa565b610773565b6101e761025b366004611a6e565b6107c8565b6101e761026e366004611a35565b610862565b61027b606381565b60405160019190910b8152602001610206565b6007546102a290600160a01b900460ff1681565b6040516102069190611abf565b6101e76102bd366004611a6e565b610af8565b6101e7610b73565b6101e76102d8366004611b19565b610ba9565b6005546102ea9060ff1681565b6040519015158152602001610206565b6101e7610308366004611bb3565b611096565b6101e761031b366004611bb3565b6110e2565b6002546001600160a01b0316610222565b6101e761033f366004611bd0565b611134565b6101e7610352366004611bf2565b611192565b6101fc60045481565b61027b60621981565b6005546102229061010090046001600160a01b031681565b600754610222906001600160a01b031681565b6101e76103a2366004611c41565b611235565b6001546001600160a01b0316610222565b61027b606081565b6101e76103ce366004611bb3565b6112fa565b61027b605f1981565b6102227f00000000000000000000000095ad61b0a150d79219dcf64e1e6cc01f0b64c4ce81565b6101e7610411366004611bb3565b611346565b610429610424366004611bb3565b6113de565b604051610206929190611c9c565b6002546001600160a01b0316331461046a5760405162461bcd60e51b815260040161046190611cca565b60405180910390fd5b60405163a9059cbb60e01b81526001600160a01b038381166004830152602482018390527f00000000000000000000000095ad61b0a150d79219dcf64e1e6cc01f0b64c4ce169063a9059cbb906044016020604051808303816000875af11580156104d9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104fd9190611cff565b505050565b60008282600182900b605f191380159061052157506060600183900b13155b6105625760405162461bcd60e51b81526020600482015260126024820152714552525f585f4f55545f4f465f52414e474560701b6044820152606401610461565b600181900b6062191380159061057d57506063600182900b13155b6105be5760405162461bcd60e51b81526020600482015260126024820152714552525f595f4f55545f4f465f52414e474560701b6044820152606401610461565b6005546040516324d4c0b360e21b8152600187810b600483015286900b602482015260009161010090046001600160a01b03169063935302cc90604401602060405180830381865afa158015610618573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061063c9190611d1c565b60055460405163aaf5ddcd60e01b8152600189810b600483015288900b60248201529192506000916101009091046001600160a01b03169063aaf5ddcd906044016040805180830381865afa158015610699573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106bd9190611d35565b50905080156107035760405162461bcd60e51b815260206004820152601260248201527111549497d053149150511657d093d551d21560721b6044820152606401610461565b6000670de0b6b3a76400008360045461071c9190611d70565b6107269190611d8f565b9050600081116107685760405162461bcd60e51b815260206004820152600d60248201526c4552525f4241445f505249434560981b6044820152606401610461565b979650505050505050565b6002546000906001600160a01b031633146107a05760405162461bcd60e51b815260040161046190611cca565b6e4554482e534849422e50522e41564360881b6107be848483611687565b9150505b92915050565b6002546001600160a01b031633146107f25760405162461bcd60e51b815260040161046190611cca565b80600381111561080457610804611a87565b6007805460ff60a01b1916600160a01b83600381111561082657610826611a87565b02179055506040518181527f02f604feff374725ab69a4a6b22fbfb7f79b787bc42299abdea1de38ec4ef4b6906020015b60405180910390a150565b600380600754600160a01b900460ff16600381111561088357610883611a87565b146108d05760405162461bcd60e51b815260206004820152601b60248201527f4552525f544849535f53544147455f4e4f545f4c4956455f59455400000000006044820152606401610461565b6002600354036109225760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610461565b600260035560006109338484610502565b6040516323b872dd60e01b81523360048201819052306024830152604482018390529192507f00000000000000000000000095ad61b0a150d79219dcf64e1e6cc01f0b64c4ce6001600160a01b0316906323b872dd906064016020604051808303816000875af11580156109ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109cf9190611cff565b5060006109dc86866117d0565b6001600160a01b03838116600081815260086020818152604080842080546001808201835591865292909420928204909201805463ffffffff8881166004600795861681026101000a9182029290910219909216179091559054915162edcc2360e71b8152908101939093528a820b60248401529089900b60448301529293509116906376e6118090606401600060405180830381600087803b158015610a8257600080fd5b505af1158015610a96573d6000803e3d6000fd5b505050508063ffffffff16826001600160a01b03167f7589918db62cc3caacbb3939e0db5a02ecc62bf9c941214b6efef75379d31f89888887426003604051610ae3959493929190611db1565b60405180910390a35050600160035550505050565b6002546001600160a01b03163314610b225760405162461bcd60e51b815260040161046190611cca565b610b2b816117fc565b610b705760405162461bcd60e51b81526020600482015260166024820152754552525f4641494c45445f544f5f494e43524541534560501b6044820152606401610461565b50565b6002546001600160a01b03163314610b9d5760405162461bcd60e51b815260040161046190611cca565b610ba760006118e9565b565b600380600754600160a01b900460ff166003811115610bca57610bca611a87565b14610c175760405162461bcd60e51b815260206004820152601b60248201527f4552525f544849535f53544147455f4e4f545f4c4956455f59455400000000006044820152606401610461565b600260035403610c695760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610461565b600260035560055460ff16610cb95760405162461bcd60e51b815260206004820152601660248201527511549497d35553151257d0925117d11254d05093115160521b6044820152606401610461565b856000819003610cfa5760405162461bcd60e51b815260206004820152600c60248201526b11549497d393d7d25394155560a21b6044820152606401610461565b808514610d455760405162461bcd60e51b815260206004820152601960248201527808aa4a4be929ca0aaa8be988a9c8ea890be9a92a69a82a8869603b1b6044820152606401610461565b808314610d905760405162461bcd60e51b815260206004820152601960248201527808aa4a4be929ca0aaa8be988a9c8ea890be9a92a69a82a8869603b1b6044820152606401610461565b6000805b82811015610dca57858582818110610dae57610dae611deb565b9050602002013582610dc09190611e01565b9150600101610d94565b506040516323b872dd60e01b8152336004820181905230602483015260448201839052907f00000000000000000000000095ad61b0a150d79219dcf64e1e6cc01f0b64c4ce6001600160a01b0316906323b872dd906064016020604051808303816000875af1158015610e41573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e659190611cff565b5060005b838110156110845760008b8b83818110610e8557610e85611deb565b9050602002016020810190610e9a9190611e19565b905060008a8a84818110610eb057610eb0611deb565b9050602002016020810190610ec59190611e19565b90506000610ed38383610502565b9050898985818110610ee757610ee7611deb565b905060200201358114610f3c5760405162461bcd60e51b815260206004820152601a60248201527f4552525f494e53554646494349454e545f534849425f53454e540000000000006044820152606401610461565b6000610f4884846117d0565b6001600160a01b03878116600081815260086020818152604080842080546001808201835591865292909420928204909201805463ffffffff8881166004600795861681026101000a9182029290910219909216179091559054915162edcc2360e71b81529081019390935288820b60248401529087900b60448301529293509116906376e6118090606401600060405180830381600087803b158015610fee57600080fd5b505af1158015611002573d6000803e3d6000fd5b505050508063ffffffff16866001600160a01b03167f7589918db62cc3caacbb3939e0db5a02ecc62bf9c941214b6efef75379d31f8986868f8f8b81811061104c5761104c611deb565b90506020020135426003604051611067959493929190611db1565b60405180910390a35050505061107d8160010190565b9050610e69565b50506001600355505050505050505050565b6002546001600160a01b031633146110c05760405162461bcd60e51b815260040161046190611cca565b600680546001600160a01b0319166001600160a01b0392909216919091179055565b6002546001600160a01b0316331461110c5760405162461bcd60e51b815260040161046190611cca565b600580546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b6001546001600160a01b031633146111855760405162461bcd60e51b81526020600482015260146024820152731bdb9b1e48149bdd5d195c8818d85b8818d85b1b60621b6044820152606401610461565b61118e82600455565b5050565b6002546001600160a01b031633146111bc5760405162461bcd60e51b815260040161046190611cca565b60405163a9059cbb60e01b81526001600160a01b0383811660048301526024820183905284169063a9059cbb906044016020604051808303816000875af115801561120b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061122f9190611cff565b50505050565b6002546001600160a01b0316331461125f5760405162461bcd60e51b815260040161046190611cca565b60055481151560ff9091161515036112b95760405162461bcd60e51b815260206004820152601960248201527f4552525f414c52454144595f444553495245445f56414c5545000000000000006044820152606401610461565b6005805460ff19168215159081179091556040519081527f81d89e0116bfd05c650b4de6b8a465c851946c4305a9552b6f757c4229df7c3b90602001610857565b6002546001600160a01b031633146113245760405162461bcd60e51b815260040161046190611cca565b600780546001600160a01b0319166001600160a01b0392909216919091179055565b6002546001600160a01b031633146113705760405162461bcd60e51b815260040161046190611cca565b6001600160a01b0381166113d55760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610461565b610b70816118e9565b60065460405163f5ada9ad60e01b81526001600160a01b03838116600483015260609283926000928392169063f5ada9ad90602401600060405180830381865afa158015611430573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526114589190810190611ef3565b81516001600160a01b03881660009081526008602052604081205493955091935091906114858383611e01565b67ffffffffffffffff81111561149d5761149d611e36565b6040519080825280602002602001820160405280156114c6578160200160208202803683370190505b50905060006114d58484611e01565b67ffffffffffffffff8111156114ed576114ed611e36565b604051908082528060200260200182016040528015611516578160200160208202803683370190505b50905060005b848110156115a65786818151811061153657611536611deb565b602002602001015183828151811061155057611550611deb565b602002602001019060010b908160010b8152505085818151811061157657611576611deb565b602002602001015182828151811061159057611590611deb565b600192830b60209182029290920101520161151c565b506001600160a01b0389166000908152600860205260408120805486925b818110156116745760008061160f8584815481106115e4576115e4611deb565b90600052602060002090600891828204019190066004029054906101000a900463ffffffff1661193b565b915091508188878151811061162657611626611deb565b602002602001019060010b908160010b815250508087878151811061164d5761164d611deb565b600192830b602091820292909201015286019550505061166d8160010190565b90506115c4565b50939b929a509198505050505050505050565b6001546001600160a01b03841660009081526020818152604080832054815130606090811b6bffffffffffffffffffffffff19908116838701528a821b8116603484015296901b9095166048860152605c850152607c80850186905281518086039091018152609c9094019052825192019190912081906001546040516001620fb3e960e11b031981526001600160a01b038881166004830152602482018890526044820187905292935091169063ffe0982e906064016020604051808303816000875af115801561175d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117819190611cff565b61178a57600080fd5b6001600160a01b0385166000908152602081905260409020546117ae906001611965565b6001600160a01b03861660009081526020819052604090205590509392505050565b600061ffff8261ffff161663ffff0000620100008561ffff166117f39190611f57565b16179392505050565b600154604051633950935160e01b81526001600160a01b039182166004820152602481018390526000917f000000000000000000000000892a6f9df0147e5f079b0993f486f9aca3c8788116906339509351906044016020604051808303816000875af1158015611871573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118959190611cff565b6118e15760405162461bcd60e51b815260206004820152601c60248201527f6661696c656420746f20696e63726561736520616c6c6f77616e6365000000006044820152606401610461565b506001919050565b600280546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60008061194f61ffff601085901c166119cb565b915061195e61ffff84166119cb565b9050915091565b6000806119728385611e01565b9050838110156119c45760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610461565b9392505050565b60006180008216156119e1575063ffff00001790565b5090565b6001600160a01b0381168114610b7057600080fd5b60008060408385031215611a0d57600080fd5b8235611a18816119e5565b946020939093013593505050565b8060010b8114610b7057600080fd5b60008060408385031215611a4857600080fd5b8235611a5381611a26565b91506020830135611a6381611a26565b809150509250929050565b600060208284031215611a8057600080fd5b5035919050565b634e487b7160e01b600052602160045260246000fd5b60048110611abb57634e487b7160e01b600052602160045260246000fd5b9052565b602081016107c28284611a9d565b60008083601f840112611adf57600080fd5b50813567ffffffffffffffff811115611af757600080fd5b6020830191508360208260051b8501011115611b1257600080fd5b9250929050565b60008060008060008060608789031215611b3257600080fd5b863567ffffffffffffffff80821115611b4a57600080fd5b611b568a838b01611acd565b90985096506020890135915080821115611b6f57600080fd5b611b7b8a838b01611acd565b90965094506040890135915080821115611b9457600080fd5b50611ba189828a01611acd565b979a9699509497509295939492505050565b600060208284031215611bc557600080fd5b81356119c4816119e5565b60008060408385031215611be357600080fd5b50508035926020909101359150565b600080600060608486031215611c0757600080fd5b8335611c12816119e5565b92506020840135611c22816119e5565b929592945050506040919091013590565b8015158114610b7057600080fd5b600060208284031215611c5357600080fd5b81356119c481611c33565b600081518084526020808501945080840160005b83811015611c91578151600190810b8852968301969183019101611c72565b509495945050505050565b604081526000611caf6040830185611c5e565b8281036020840152611cc18185611c5e565b95945050505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060208284031215611d1157600080fd5b81516119c481611c33565b600060208284031215611d2e57600080fd5b5051919050565b60008060408385031215611d4857600080fd5b825191506020830151611a63816119e5565b634e487b7160e01b600052601160045260246000fd5b6000816000190483118215151615611d8a57611d8a611d5a565b500290565b600082611dac57634e487b7160e01b600052601260045260246000fd5b500490565b600060a0820190508660010b82528560010b6020830152846040830152836060830152611de16080830184611a9d565b9695505050505050565b634e487b7160e01b600052603260045260246000fd5b60008219821115611e1457611e14611d5a565b500190565b600060208284031215611e2b57600080fd5b81356119c481611a26565b634e487b7160e01b600052604160045260246000fd5b8051611e5781611a26565b919050565b600082601f830112611e6d57600080fd5b8151602067ffffffffffffffff80831115611e8a57611e8a611e36565b8260051b604051601f19603f83011681018181108482111715611eaf57611eaf611e36565b604052938452858101830193838101925087851115611ecd57600080fd5b83870191505b8482101561076857611ee482611e4c565b83529183019190830190611ed3565b60008060408385031215611f0657600080fd5b825167ffffffffffffffff80821115611f1e57600080fd5b611f2a86838701611e5c565b93506020850151915080821115611f4057600080fd5b50611f4d85828601611e5c565b9150509250929050565b600063ffffffff80831681851681830481118215151615611f7a57611f7a611d5a565b0294935050505056fea2646970667358221220d35d0df9ff66f34dfc71856e3c4b5aae4059026cdd3d126193aa9388838a272a64736f6c634300080d0033

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

00000000000000000000000095ad61b0a150d79219dcf64e1e6cc01f0b64c4ce0000000000000000000000009ed0f787223ff1feb0cfb33a9207c646d182e9180000000000000000000000006b74c5885d2e08efd80164965f8df002608ebffa000000000000000000000000efaed650f1a94801806bb110019d9b0dc79531a80000000000000000000000009ac9ae20a17779c17b069b48a8788e3455fc6121000000000000000000000000892a6f9df0147e5f079b0993f486f9aca3c87881

-----Decoded View---------------
Arg [0] : _shib (address): 0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE
Arg [1] : _auctionV1 (address): 0x9ed0F787223FF1FeB0cFB33a9207c646d182E918
Arg [2] : _auctionV2 (address): 0x6b74c5885d2E08eFd80164965F8df002608EbffA
Arg [3] : _landRegistry (address): 0xEfAEd650f1a94801806BB110019d9B0dc79531A8
Arg [4] : _router (address): 0x9ac9AE20a17779c17b069b48A8788e3455fC6121
Arg [5] : _xfund (address): 0x892A6f9dF0147e5f079b0993F486F9acA3c87881

-----Encoded View---------------
6 Constructor Arguments found :
Arg [0] : 00000000000000000000000095ad61b0a150d79219dcf64e1e6cc01f0b64c4ce
Arg [1] : 0000000000000000000000009ed0f787223ff1feb0cfb33a9207c646d182e918
Arg [2] : 0000000000000000000000006b74c5885d2e08efd80164965f8df002608ebffa
Arg [3] : 000000000000000000000000efaed650f1a94801806bb110019d9b0dc79531a8
Arg [4] : 0000000000000000000000009ac9ae20a17779c17b069b48a8788e3455fc6121
Arg [5] : 000000000000000000000000892a6f9df0147e5f079b0993f486f9aca3c87881


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.