ETH Price: $3,407.91 (+2.28%)

Token

Ships (SHIP)
 

Overview

Max Total Supply

622 SHIP

Holders

178

Market

Volume (24H)

N/A

Min Price (24H)

N/A

Max Price (24H)

N/A
Filtered by Token Holder
noun12.eth
Balance
2 SHIP
0x008c84421da5527f462886cec43d2717b686a7e4
Loading...
Loading
Loading...
Loading
Loading...
Loading

Click here to update the token information / general information
# Exchange Pair Price  24H Volume % Volume

Contract Source Code Verified (Exact Match)

Contract Name:
Ships

Compiler Version
v0.8.4+commit.c7e474f2

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, MIT license
File 1 of 29 : Ships.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "./ERC20Mintable.sol";
import "./ShipsHelper.sol";

// The ships
// **music**
// Sweet dreams are made of this
// Who am I to disagree
// I travel the world and the seven seas :pepe jamming:
// (fr tho, when r twitch emotes gunna be added to sol natspec standard... fukin boomers man)
// @author 1929

contract Ships is ERC721, ERC721Enumerable, Ownable {
    struct Attributes {
        uint8 name;
        uint8 expedition;
        uint32 length;
        uint32 speed;
    }

    struct Path {
        address tokenContract;
        uint256 tokenId;
    }

    struct Ship {
        uint256 tokenId;
        string name;
        string expedition;
        uint32 length;
        uint32 speed;
        Path[] route;
    }

    struct TokenHarvest {
        address resourceTokenContract;
        uint256 amount;
    }

    string[] public names = ["Canoe", "Longship", "Clipper", "Galleon", "Man-of-war"];
    string[] public expeditions = ["Trader", "Explorer", "Pirate", "Military", "Diplomat"];

    uint32[] public speedMultipliers = [10, 20, 50, 40, 40];
    uint32[] public lengthMultipliers = [5, 10, 10, 30, 40];

    ShipsHelper public helperContract;
    ERC20Mintable public goldTokenContract;

    mapping(uint256 => Attributes) public tokenIdToAttributes;
    mapping(uint256 => Path[]) public tokenIdToRoute;
    mapping(uint256 => uint256) public tokenIdToLastRouteUpdate;

    uint256 purchasedShipsCount = 1000;
    uint256 maxPurchaseLimit = 10_000;

    mapping(address => bool) permissionedMinters;

    constructor(ERC20Mintable goldTokenContract_) ERC721("Ships", "SHIP") {
        goldTokenContract = goldTokenContract_;
    }

    /** Setters */
    function setHelperContract(ShipsHelper helperContract_) public onlyOwner {
        helperContract = helperContract_;
    }

    function setMaxPurchaseLimit(uint256 maxPurchaseLimit_) public onlyOwner {
        maxPurchaseLimit = maxPurchaseLimit_;
    }

    // For L1 -> L2 bridges
    // This allows NFTs to be minted on the L2 and then bridged to the L1 as oppose
    // to just being minted on the L1 and transferred to the L2.
    function togglePermissionedMinter(address minter, bool enabled) public onlyOwner {
        permissionedMinters[minter] = enabled;
    }

    /** Getters */
    function getShipInfo(uint256 tokenId) public view returns (Ship memory) {
        require(_exists(tokenId), "Ship with that tokenId doesn't exist");

        Attributes memory attr = tokenIdToAttributes[tokenId];

        return
            Ship({
                tokenId: tokenId,
                name: names[attr.name],
                expedition: expeditions[attr.expedition],
                length: attr.length,
                speed: attr.speed,
                route: tokenIdToRoute[tokenId]
            });
    }

    function tokenURI(uint256 tokenId) public view override returns (string memory) {
        return helperContract.tokenURI(tokenId);
    }

    function getTokenIdToAttributes(uint256 tokenId) public view returns (Attributes memory) {
        return tokenIdToAttributes[tokenId];
    }

    function getRandomNumber(bytes memory seed, uint256 maxValue) public pure returns (uint256) {
        return uint256(keccak256(abi.encode(seed))) % maxValue;
    }

    function getUnharvestedTokens(uint256 tokenId) public view returns (TokenHarvest[] memory) {
        return helperContract.getUnharvestedTokens(tokenId);
    }

    function getSailingDuration(uint256 tokenId) public view returns (uint256) {
        Ship memory shipInfo = getShipInfo(tokenId);
        return helperContract.getSailingDuration(shipInfo);
    }

    /** State modifications */
    function mint(uint256 tokenId) public {
        require(!_exists(tokenId), "Ship with that id already exists");
        require(tokenId <= 999, "Ship id is invalid");

        uint256 value = getRandomNumber(abi.encode(tokenId, "n", block.timestamp), 1000);
        uint8 name = uint8(value < 900 ? value % 3 : value < 950 ? value % 4 : value % 5);

        _mintShip(name, tokenId);
    }

    // Intended for use by L2->L1 bridges
    // This is necessary since we want to allow minting on both L2 and L1.
    // In order to maintain synchronicity between both chains, the L2 withdrawal tx
    // must be able to mint new tokens on L1 if it doesn't already exist in escrow.
    function permissionedMint(
        uint256 tokenId,
        Attributes memory attr,
        Path[] memory route
    ) public {
        require(permissionedMinters[msg.sender], "You are not a permissioned minter");
        require(!_exists(tokenId), "Can't mint token that already exists");

        tokenIdToAttributes[tokenId] = attr;
        _updateRoute(route, tokenId, true);
        _safeMint(msg.sender, tokenId);
    }

    function harvest(uint256 tokenId) public {
        TokenHarvest[] memory unharvestedTokens = getUnharvestedTokens(tokenId);
        tokenIdToLastRouteUpdate[tokenId] = block.number;

        uint256 totalGoldTax = 0;
        for (uint256 i = 0; i < unharvestedTokens.length; i++) {
            ERC20Mintable(unharvestedTokens[i].resourceTokenContract).mint(
                ownerOf(tokenId),
                unharvestedTokens[i].amount
            );

            // 6% tax to the originating settlement
            totalGoldTax += (unharvestedTokens[i].amount * 6) / 100;
        }

        address taxDestination = helperContract.getTaxDestination(tokenId);
        goldTokenContract.mint(taxDestination, totalGoldTax);
    }

    function updateRoute(Path[] memory route, uint256 tokenId) public {
        _updateRoute(route, tokenId, false);
    }

    function _updateRoute(
        Path[] memory route,
        uint256 tokenId,
        bool init
    ) internal {
        require(helperContract.isValidRoute(route, tokenId, msg.sender, init), "Invalid route");

        delete tokenIdToRoute[tokenId];
        for (uint256 i = 0; i < route.length; i++) {
            tokenIdToRoute[tokenId].push(route[i]);
        }

        tokenIdToLastRouteUpdate[tokenId] = block.number;
    }

    function purchaseShip(uint8 name) public {
        require(
            purchasedShipsCount <= maxPurchaseLimit,
            "Maximum amount of ships have been purchased"
        );

        TokenHarvest[] memory cost = helperContract.getCost(name);
        for (uint256 i = 0; i < cost.length; i++) {
            ERC20Mintable(cost[i].resourceTokenContract).burnFrom(msg.sender, cost[i].amount);
        }

        purchasedShipsCount += 1;
        _mintShip(name, purchasedShipsCount);
    }

    function _mintShip(uint8 name, uint256 tokenId) internal {
        Attributes memory attr;

        attr.name = name;

        uint256 value = getRandomNumber(abi.encode(tokenId, "c"), 1000);
        attr.expedition = uint8(value % 5);

        value = getRandomNumber(abi.encode(tokenId, "l"), 50);
        attr.length = uint32((value + 1) * uint256(lengthMultipliers[attr.name])) / 10 + 2;
        attr.length = attr.length < lengthMultipliers[attr.name]
            ? lengthMultipliers[attr.name]
            : attr.length;

        value = getRandomNumber(abi.encode(tokenId, "s"), 100);
        attr.speed = uint32((value + 1) * uint256(speedMultipliers[attr.name])) / 100 + 2;
        attr.speed = attr.speed < speedMultipliers[attr.name] / 2
            ? speedMultipliers[attr.name] / 2
            : attr.speed;

        tokenIdToAttributes[tokenId] = attr;

        _updateRoute(helperContract.getInitialRoute(tokenId, attr.name), tokenId, true);
        _safeMint(msg.sender, tokenId);
    }

    /** Library overrides */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal override(ERC721, ERC721Enumerable) {
        super._beforeTokenTransfer(from, to, tokenId);
    }

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

File 2 of 29 : Ownable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

    function _setOwner(address newOwner) private {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

File 3 of 29 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

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

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

        _;

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

File 4 of 29 : ERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./IERC20.sol";
import "./extensions/IERC20Metadata.sol";
import "../../utils/Context.sol";
/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 * For a generic mechanism see {ERC20PresetMinterPauser}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * We have followed general OpenZeppelin Contracts guidelines: functions revert
 * instead returning `false` on failure. This behavior is nonetheless
 * conventional and does not conflict with the expectations of ERC20
 * applications.
 *
 * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 *
 * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
 * functions have been added to mitigate the well-known issues around setting
 * allowances. See {IERC20-approve}.
 */
contract ERC20 is Context, IERC20, IERC20Metadata {
    mapping(address => uint256) private _balances;

    mapping(address => mapping(address => uint256)) private _allowances;

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * The default value of {decimals} is 18. To select a different value for
     * {decimals} you should overload it.
     *
     * All two of these values are immutable: they can only be set once during
     * construction.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @dev Returns the name of the token.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev Returns the number of decimals used to get its user representation.
     * For example, if `decimals` equals `2`, a balance of `505` tokens should
     * be displayed to a user as `5.05` (`505 / 10 ** 2`).
     *
     * Tokens usually opt for a value of 18, imitating the relationship between
     * Ether and Wei. This is the value {ERC20} uses, unless this function is
     * overridden;
     *
     * NOTE: This information is only used for _display_ purposes: it in
     * no way affects any of the arithmetic of the contract, including
     * {IERC20-balanceOf} and {IERC20-transfer}.
     */
    function decimals() public view virtual override returns (uint8) {
        return 18;
    }

    /**
     * @dev See {IERC20-totalSupply}.
     */
    function totalSupply() public view virtual override returns (uint256) {
        return _totalSupply;
    }

    /**
     * @dev See {IERC20-balanceOf}.
     */
    function balanceOf(address account) public view virtual override returns (uint256) {
        return _balances[account];
    }

    /**
     * @dev See {IERC20-transfer}.
     *
     * Requirements:
     *
     * - `recipient` cannot be the zero address.
     * - the caller must have a balance of at least `amount`.
     */
    function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
        _transfer(_msgSender(), recipient, amount);
        return true;
    }

    /**
     * @dev See {IERC20-allowance}.
     */
    function allowance(address owner, address spender) public view virtual override returns (uint256) {
        return _allowances[owner][spender];
    }

    /**
     * @dev See {IERC20-approve}.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 amount) public virtual override returns (bool) {
        _approve(_msgSender(), spender, amount);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Emits an {Approval} event indicating the updated allowance. This is not
     * required by the EIP. See the note at the beginning of {ERC20}.
     *
     * Requirements:
     *
     * - `sender` and `recipient` cannot be the zero address.
     * - `sender` must have a balance of at least `amount`.
     * - the caller must have allowance for ``sender``'s tokens of at least
     * `amount`.
     */
    function transferFrom(
        address sender,
        address recipient,
        uint256 amount
    ) public virtual override returns (bool) {
        _transfer(sender, recipient, amount);

        uint256 currentAllowance = _allowances[sender][_msgSender()];
        require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
        unchecked {
            _approve(sender, _msgSender(), currentAllowance - amount);
        }

        return true;
    }

    /**
     * @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) public virtual returns (bool) {
        _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
        return true;
    }

    /**
     * @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) public virtual returns (bool) {
        uint256 currentAllowance = _allowances[_msgSender()][spender];
        require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
        unchecked {
            _approve(_msgSender(), spender, currentAllowance - subtractedValue);
        }

        return true;
    }

    /**
     * @dev Moves `amount` of tokens from `sender` to `recipient`.
     *
     * This internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * Requirements:
     *
     * - `sender` cannot be the zero address.
     * - `recipient` cannot be the zero address.
     * - `sender` must have a balance of at least `amount`.
     */
    function _transfer(
        address sender,
        address recipient,
        uint256 amount
    ) internal virtual {
        require(sender != address(0), "ERC20: transfer from the zero address");
        require(recipient != address(0), "ERC20: transfer to the zero address");

        _beforeTokenTransfer(sender, recipient, amount);

        uint256 senderBalance = _balances[sender];
        require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
        unchecked {
            _balances[sender] = senderBalance - amount;
        }
        _balances[recipient] += amount;

        emit Transfer(sender, recipient, amount);

        _afterTokenTransfer(sender, recipient, amount);
    }

    /** @dev Creates `amount` tokens and assigns them to `account`, increasing
     * the total supply.
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function _mint(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: mint to the zero address");

        _beforeTokenTransfer(address(0), account, amount);

        _totalSupply += amount;
        _balances[account] += amount;
        emit Transfer(address(0), account, amount);

        _afterTokenTransfer(address(0), account, amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`, reducing the
     * total supply.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     * - `account` must have at least `amount` tokens.
     */
    function _burn(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: burn from the zero address");

        _beforeTokenTransfer(account, address(0), amount);

        uint256 accountBalance = _balances[account];
        require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
        unchecked {
            _balances[account] = accountBalance - amount;
        }
        _totalSupply -= amount;

        emit Transfer(account, address(0), amount);

        _afterTokenTransfer(account, address(0), amount);
    }

    /**
     * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
     *
     * This internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     */
    function _approve(
        address owner,
        address spender,
        uint256 amount
    ) internal virtual {
        require(owner != address(0), "ERC20: approve from the zero address");
        require(spender != address(0), "ERC20: approve to the zero address");

        _allowances[owner][spender] = amount;
        emit Approval(owner, spender, amount);
    }

    /**
     * @dev Hook that is called before any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * will be transferred to `to`.
     * - when `from` is zero, `amount` tokens will be minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens will be burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {}

    /**
     * @dev Hook that is called after any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * has been transferred to `to`.
     * - when `from` is zero, `amount` tokens have been minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens have been burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {}
}

File 5 of 29 : IERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

File 6 of 29 : ERC20Burnable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

/**
 * @dev Extension of {ERC20} that allows token holders to destroy both their own
 * tokens and those that they have an allowance for, in a way that can be
 * recognized off-chain (via event analysis).
 */
abstract contract ERC20Burnable is Context, ERC20 {
    /**
     * @dev Destroys `amount` tokens from the caller.
     *
     * See {ERC20-_burn}.
     */
    function burn(uint256 amount) public virtual {
        _burn(_msgSender(), amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`, deducting from the caller's
     * allowance.
     *
     * See {ERC20-_burn} and {ERC20-allowance}.
     *
     * Requirements:
     *
     * - the caller must have allowance for ``accounts``'s tokens of at least
     * `amount`.
     */
    function burnFrom(address account, uint256 amount) public virtual {
        uint256 currentAllowance = allowance(account, _msgSender());
        require(currentAllowance >= amount, "ERC20: burn amount exceeds allowance");
        unchecked {
            _approve(account, _msgSender(), currentAllowance - amount);
        }
        _burn(account, amount);
    }
}

File 7 of 29 : IERC20Metadata.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../IERC20.sol";

/**
 * @dev Interface for the optional metadata functions from the ERC20 standard.
 *
 * _Available since v4.1._
 */
interface IERC20Metadata is IERC20 {
    /**
     * @dev Returns the name of the token.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the symbol of the token.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the decimals places of the token.
     */
    function decimals() external view returns (uint8);
}

File 8 of 29 : ERC721.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./IERC721.sol";
import "./IERC721Receiver.sol";
import "./extensions/IERC721Metadata.sol";
import "../../utils/Address.sol";
import "../../utils/Context.sol";
import "../../utils/Strings.sol";
import "../../utils/introspection/ERC165.sol";

/**
 * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
 * the Metadata extension, but not including the Enumerable extension, which is available separately as
 * {ERC721Enumerable}.
 */
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
    using Address for address;
    using Strings for uint256;

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

    // Mapping from token ID to owner address
    mapping(uint256 => address) private _owners;

    // Mapping owner address to token count
    mapping(address => uint256) private _balances;

    // Mapping from token ID to approved address
    mapping(uint256 => address) private _tokenApprovals;

    // Mapping from owner to operator approvals
    mapping(address => mapping(address => bool)) private _operatorApprovals;

    /**
     * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

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

    /**
     * @dev See {IERC721-balanceOf}.
     */
    function balanceOf(address owner) public view virtual override returns (uint256) {
        require(owner != address(0), "ERC721: balance query for the zero address");
        return _balances[owner];
    }

    /**
     * @dev See {IERC721-ownerOf}.
     */
    function ownerOf(uint256 tokenId) public view virtual override returns (address) {
        address owner = _owners[tokenId];
        require(owner != address(0), "ERC721: owner query for nonexistent token");
        return owner;
    }

    /**
     * @dev See {IERC721Metadata-name}.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }

    /**
     * @dev See {IERC721Metadata-symbol}.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev See {IERC721Metadata-tokenURI}.
     */
    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
        require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");

        string memory baseURI = _baseURI();
        return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : "";
    }

    /**
     * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
     * token will be the concatenation of the `baseURI` and the `tokenId`. Empty
     * by default, can be overriden in child contracts.
     */
    function _baseURI() internal view virtual returns (string memory) {
        return "";
    }

    /**
     * @dev See {IERC721-approve}.
     */
    function approve(address to, uint256 tokenId) public virtual override {
        address owner = ERC721.ownerOf(tokenId);
        require(to != owner, "ERC721: approval to current owner");

        require(
            _msgSender() == owner || isApprovedForAll(owner, _msgSender()),
            "ERC721: approve caller is not owner nor approved for all"
        );

        _approve(to, tokenId);
    }

    /**
     * @dev See {IERC721-getApproved}.
     */
    function getApproved(uint256 tokenId) public view virtual override returns (address) {
        require(_exists(tokenId), "ERC721: approved query for nonexistent token");

        return _tokenApprovals[tokenId];
    }

    /**
     * @dev See {IERC721-setApprovalForAll}.
     */
    function setApprovalForAll(address operator, bool approved) public virtual override {
        require(operator != _msgSender(), "ERC721: approve to caller");

        _operatorApprovals[_msgSender()][operator] = approved;
        emit ApprovalForAll(_msgSender(), operator, approved);
    }

    /**
     * @dev See {IERC721-isApprovedForAll}.
     */
    function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
        return _operatorApprovals[owner][operator];
    }

    /**
     * @dev See {IERC721-transferFrom}.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public virtual override {
        //solhint-disable-next-line max-line-length
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");

        _transfer(from, to, tokenId);
    }

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public virtual override {
        safeTransferFrom(from, to, tokenId, "");
    }

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) public virtual override {
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
        _safeTransfer(from, to, tokenId, _data);
    }

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * `_data` is additional data, it has no specified format and it is sent in call to `to`.
     *
     * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
     * implement alternative mechanisms to perform token transfer, such as signature-based.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeTransfer(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) internal virtual {
        _transfer(from, to, tokenId);
        require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
    }

    /**
     * @dev Returns whether `tokenId` exists.
     *
     * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
     *
     * Tokens start existing when they are minted (`_mint`),
     * and stop existing when they are burned (`_burn`).
     */
    function _exists(uint256 tokenId) internal view virtual returns (bool) {
        return _owners[tokenId] != address(0);
    }

    /**
     * @dev Returns whether `spender` is allowed to manage `tokenId`.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
        require(_exists(tokenId), "ERC721: operator query for nonexistent token");
        address owner = ERC721.ownerOf(tokenId);
        return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));
    }

    /**
     * @dev Safely mints `tokenId` and transfers it to `to`.
     *
     * Requirements:
     *
     * - `tokenId` must not exist.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeMint(address to, uint256 tokenId) internal virtual {
        _safeMint(to, tokenId, "");
    }

    /**
     * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
     * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
     */
    function _safeMint(
        address to,
        uint256 tokenId,
        bytes memory _data
    ) internal virtual {
        _mint(to, tokenId);
        require(
            _checkOnERC721Received(address(0), to, tokenId, _data),
            "ERC721: transfer to non ERC721Receiver implementer"
        );
    }

    /**
     * @dev Mints `tokenId` and transfers it to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
     *
     * Requirements:
     *
     * - `tokenId` must not exist.
     * - `to` cannot be the zero address.
     *
     * Emits a {Transfer} event.
     */
    function _mint(address to, uint256 tokenId) internal virtual {
        require(to != address(0), "ERC721: mint to the zero address");
        require(!_exists(tokenId), "ERC721: token already minted");

        _beforeTokenTransfer(address(0), to, tokenId);

        _balances[to] += 1;
        _owners[tokenId] = to;

        emit Transfer(address(0), to, tokenId);
    }

    /**
     * @dev Destroys `tokenId`.
     * The approval is cleared when the token is burned.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     *
     * Emits a {Transfer} event.
     */
    function _burn(uint256 tokenId) internal virtual {
        address owner = ERC721.ownerOf(tokenId);

        _beforeTokenTransfer(owner, address(0), tokenId);

        // Clear approvals
        _approve(address(0), tokenId);

        _balances[owner] -= 1;
        delete _owners[tokenId];

        emit Transfer(owner, address(0), tokenId);
    }

    /**
     * @dev Transfers `tokenId` from `from` to `to`.
     *  As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     *
     * Emits a {Transfer} event.
     */
    function _transfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual {
        require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own");
        require(to != address(0), "ERC721: transfer to the zero address");

        _beforeTokenTransfer(from, to, tokenId);

        // Clear approvals from the previous owner
        _approve(address(0), tokenId);

        _balances[from] -= 1;
        _balances[to] += 1;
        _owners[tokenId] = to;

        emit Transfer(from, to, tokenId);
    }

    /**
     * @dev Approve `to` to operate on `tokenId`
     *
     * Emits a {Approval} event.
     */
    function _approve(address to, uint256 tokenId) internal virtual {
        _tokenApprovals[tokenId] = to;
        emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
    }

    /**
     * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
     * The call is not executed if the target address is not a contract.
     *
     * @param from address representing the previous owner of the given token ID
     * @param to target address that will receive the tokens
     * @param tokenId uint256 ID of the token to be transferred
     * @param _data bytes optional data to send along with the call
     * @return bool whether the call correctly returned the expected magic value
     */
    function _checkOnERC721Received(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) private returns (bool) {
        if (to.isContract()) {
            try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
                return retval == IERC721Receiver.onERC721Received.selector;
            } catch (bytes memory reason) {
                if (reason.length == 0) {
                    revert("ERC721: transfer to non ERC721Receiver implementer");
                } else {
                    assembly {
                        revert(add(32, reason), mload(reason))
                    }
                }
            }
        } else {
            return true;
        }
    }

    /**
     * @dev Hook that is called before any token transfer. This includes minting
     * and burning.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
     * transferred to `to`.
     * - When `from` is zero, `tokenId` will be minted for `to`.
     * - When `to` is zero, ``from``'s `tokenId` will be burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual {}
}

File 9 of 29 : IERC721.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../../utils/introspection/IERC165.sol";

/**
 * @dev Required interface of an ERC721 compliant contract.
 */
interface IERC721 is IERC165 {
    /**
     * @dev Emitted when `tokenId` token is transferred from `from` to `to`.
     */
    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
     */
    event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
     */
    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);

    /**
     * @dev Returns the number of tokens in ``owner``'s account.
     */
    function balanceOf(address owner) external view returns (uint256 balance);

    /**
     * @dev Returns the owner of the `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function ownerOf(uint256 tokenId) external view returns (address owner);

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

    /**
     * @dev Gives permission to `to` to transfer `tokenId` token to another account.
     * The approval is cleared when the token is transferred.
     *
     * Only a single account can be approved at a time, so approving the zero address clears previous approvals.
     *
     * Requirements:
     *
     * - The caller must own the token or be an approved operator.
     * - `tokenId` must exist.
     *
     * Emits an {Approval} event.
     */
    function approve(address to, uint256 tokenId) external;

    /**
     * @dev Returns the account approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getApproved(uint256 tokenId) external view returns (address operator);

    /**
     * @dev Approve or remove `operator` as an operator for the caller.
     * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
     *
     * Requirements:
     *
     * - The `operator` cannot be the caller.
     *
     * Emits an {ApprovalForAll} event.
     */
    function setApprovalForAll(address operator, bool _approved) external;

    /**
     * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
     *
     * See {setApprovalForAll}
     */
    function isApprovedForAll(address owner, address operator) external view returns (bool);

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes calldata data
    ) external;
}

File 10 of 29 : IERC721Receiver.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @title ERC721 token receiver interface
 * @dev Interface for any contract that wants to support safeTransfers
 * from ERC721 asset contracts.
 */
interface IERC721Receiver {
    /**
     * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
     * by `operator` from `from`, this function is called.
     *
     * It must return its Solidity selector to confirm the token transfer.
     * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
     *
     * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.
     */
    function onERC721Received(
        address operator,
        address from,
        uint256 tokenId,
        bytes calldata data
    ) external returns (bytes4);
}

File 11 of 29 : ERC721Burnable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

/**
 * @title ERC721 Burnable Token
 * @dev ERC721 Token that can be irreversibly burned (destroyed).
 */
abstract contract ERC721Burnable is Context, ERC721 {
    /**
     * @dev Burns `tokenId`. See {ERC721-_burn}.
     *
     * Requirements:
     *
     * - The caller must own `tokenId` or be an approved operator.
     */
    function burn(uint256 tokenId) public virtual {
        //solhint-disable-next-line max-line-length
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721Burnable: caller is not owner nor approved");
        _burn(tokenId);
    }
}

File 12 of 29 : ERC721Enumerable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../ERC721.sol";
import "./IERC721Enumerable.sol";

/**
 * @dev This implements an optional extension of {ERC721} defined in the EIP that adds
 * enumerability of all the token ids in the contract as well as all token ids owned by each
 * account.
 */
abstract contract ERC721Enumerable is ERC721, IERC721Enumerable {
    // Mapping from owner to list of owned token IDs
    mapping(address => mapping(uint256 => uint256)) private _ownedTokens;

    // Mapping from token ID to index of the owner tokens list
    mapping(uint256 => uint256) private _ownedTokensIndex;

    // Array with all token ids, used for enumeration
    uint256[] private _allTokens;

    // Mapping from token id to position in the allTokens array
    mapping(uint256 => uint256) private _allTokensIndex;

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

    /**
     * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) {
        require(index < ERC721.balanceOf(owner), "ERC721Enumerable: owner index out of bounds");
        return _ownedTokens[owner][index];
    }

    /**
     * @dev See {IERC721Enumerable-totalSupply}.
     */
    function totalSupply() public view virtual override returns (uint256) {
        return _allTokens.length;
    }

    /**
     * @dev See {IERC721Enumerable-tokenByIndex}.
     */
    function tokenByIndex(uint256 index) public view virtual override returns (uint256) {
        require(index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: global index out of bounds");
        return _allTokens[index];
    }

    /**
     * @dev Hook that is called before any token transfer. This includes minting
     * and burning.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
     * transferred to `to`.
     * - When `from` is zero, `tokenId` will be minted for `to`.
     * - When `to` is zero, ``from``'s `tokenId` will be burned.
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual override {
        super._beforeTokenTransfer(from, to, tokenId);

        if (from == address(0)) {
            _addTokenToAllTokensEnumeration(tokenId);
        } else if (from != to) {
            _removeTokenFromOwnerEnumeration(from, tokenId);
        }
        if (to == address(0)) {
            _removeTokenFromAllTokensEnumeration(tokenId);
        } else if (to != from) {
            _addTokenToOwnerEnumeration(to, tokenId);
        }
    }

    /**
     * @dev Private function to add a token to this extension's ownership-tracking data structures.
     * @param to address representing the new owner of the given token ID
     * @param tokenId uint256 ID of the token to be added to the tokens list of the given address
     */
    function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {
        uint256 length = ERC721.balanceOf(to);
        _ownedTokens[to][length] = tokenId;
        _ownedTokensIndex[tokenId] = length;
    }

    /**
     * @dev Private function to add a token to this extension's token tracking data structures.
     * @param tokenId uint256 ID of the token to be added to the tokens list
     */
    function _addTokenToAllTokensEnumeration(uint256 tokenId) private {
        _allTokensIndex[tokenId] = _allTokens.length;
        _allTokens.push(tokenId);
    }

    /**
     * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that
     * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for
     * gas optimizations e.g. when performing a transfer operation (avoiding double writes).
     * This has O(1) time complexity, but alters the order of the _ownedTokens array.
     * @param from address representing the previous owner of the given token ID
     * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address
     */
    function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private {
        // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and
        // then delete the last slot (swap and pop).

        uint256 lastTokenIndex = ERC721.balanceOf(from) - 1;
        uint256 tokenIndex = _ownedTokensIndex[tokenId];

        // When the token to delete is the last token, the swap operation is unnecessary
        if (tokenIndex != lastTokenIndex) {
            uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];

            _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
            _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
        }

        // This also deletes the contents at the last position of the array
        delete _ownedTokensIndex[tokenId];
        delete _ownedTokens[from][lastTokenIndex];
    }

    /**
     * @dev Private function to remove a token from this extension's token tracking data structures.
     * This has O(1) time complexity, but alters the order of the _allTokens array.
     * @param tokenId uint256 ID of the token to be removed from the tokens list
     */
    function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {
        // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and
        // then delete the last slot (swap and pop).

        uint256 lastTokenIndex = _allTokens.length - 1;
        uint256 tokenIndex = _allTokensIndex[tokenId];

        // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so
        // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding
        // an 'if' statement (like in _removeTokenFromOwnerEnumeration)
        uint256 lastTokenId = _allTokens[lastTokenIndex];

        _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
        _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index

        // This also deletes the contents at the last position of the array
        delete _allTokensIndex[tokenId];
        _allTokens.pop();
    }
}

File 13 of 29 : IERC721Enumerable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../IERC721.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Enumerable is IERC721 {
    /**
     * @dev Returns the total amount of tokens stored by the contract.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns a token ID owned by `owner` at a given `index` of its token list.
     * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId);

    /**
     * @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
     * Use along with {totalSupply} to enumerate all tokens.
     */
    function tokenByIndex(uint256 index) external view returns (uint256);
}

File 14 of 29 : IERC721Metadata.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../IERC721.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional metadata extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Metadata is IERC721 {
    /**
     * @dev Returns the token collection name.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the token collection symbol.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
     */
    function tokenURI(uint256 tokenId) external view returns (string memory);
}

File 15 of 29 : Address.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        assembly {
            size := extcodesize(account)
        }
        return size > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCall(target, data, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        require(isContract(target), "Address: call to non-contract");

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        require(isContract(target), "Address: static call to non-contract");

        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(isContract(target), "Address: delegate call to non-contract");

        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 16 of 29 : Context.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

File 17 of 29 : Strings.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

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

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

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

File 18 of 29 : ERC165.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./IERC165.sol";

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
 * for the additional interface id that will be supported. For example:
 *
 * ```solidity
 * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
 *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
 * }
 * ```
 *
 * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
 */
abstract contract ERC165 is IERC165 {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}

File 19 of 29 : IERC165.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

File 20 of 29 : SafeMath.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.

/**
 * @dev Wrappers over Solidity's arithmetic operations.
 *
 * NOTE: `SafeMath` is no longer needed starting with Solidity 0.8. The compiler
 * now has built in overflow checking.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            uint256 c = a + b;
            if (c < a) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the substraction of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b > a) return (false, 0);
            return (true, a - b);
        }
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
            // benefit is lost if 'b' is also tested.
            // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
            if (a == 0) return (true, 0);
            uint256 c = a * b;
            if (c / a != b) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the division of two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a / b);
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a % b);
        }
    }

    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        return a + b;
    }

    /**
     * @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 sub(uint256 a, uint256 b) internal pure returns (uint256) {
        return a - b;
    }

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

    /**
     * @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.
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        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 mod(uint256 a, uint256 b) internal pure returns (uint256) {
        return a % b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {trySub}.
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b <= a, errorMessage);
            return a - b;
        }
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting with custom message 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 div(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a / b;
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting with custom message when dividing by zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryMod}.
     *
     * 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 mod(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a % b;
        }
    }
}

File 21 of 29 : base64.sol
// SPDX-License-Identifier: MIT

/// @title Base64
/// @author Brecht Devos - <[email protected]>
/// @notice Provides a function for encoding some bytes in base64
library Base64 {
    string internal constant TABLE = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';

    function encode(bytes memory data) internal pure returns (string memory) {
        if (data.length == 0) return '';
        
        // load the table into memory
        string memory table = TABLE;

        // multiply by 4/3 rounded up
        uint256 encodedLen = 4 * ((data.length + 2) / 3);

        // add some extra buffer at the end required for the writing
        string memory result = new string(encodedLen + 32);

        assembly {
            // set the actual output length
            mstore(result, encodedLen)
            
            // prepare the lookup table
            let tablePtr := add(table, 1)
            
            // input ptr
            let dataPtr := data
            let endPtr := add(dataPtr, mload(data))
            
            // result ptr, jump over length
            let resultPtr := add(result, 32)
            
            // run over the input, 3 bytes at a time
            for {} lt(dataPtr, endPtr) {}
            {
               dataPtr := add(dataPtr, 3)
               
               // read 3 bytes
               let input := mload(dataPtr)
               
               // write 4 characters
               mstore(resultPtr, shl(248, mload(add(tablePtr, and(shr(18, input), 0x3F)))))
               resultPtr := add(resultPtr, 1)
               mstore(resultPtr, shl(248, mload(add(tablePtr, and(shr(12, input), 0x3F)))))
               resultPtr := add(resultPtr, 1)
               mstore(resultPtr, shl(248, mload(add(tablePtr, and(shr( 6, input), 0x3F)))))
               resultPtr := add(resultPtr, 1)
               mstore(resultPtr, shl(248, mload(add(tablePtr, and(        input,  0x3F)))))
               resultPtr := add(resultPtr, 1)
            }
            
            // padding with '='
            switch mod(mload(data), 3)
            case 1 { mstore(sub(resultPtr, 2), shl(240, 0x3d3d)) }
            case 2 { mstore(sub(resultPtr, 1), shl(248, 0x3d)) }
        }
        
        return result;
    }
}

File 22 of 29 : ERC20Mintable.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "./SettlementsV2.sol";

contract ERC20Mintable is ERC20Burnable, Ownable {
    mapping(address => bool) public approvedMinters;
    SettlementsV2 settlements;
    uint256 public totalMinters = 0;
    bool public canToggleMints = true;

    modifier onlyMinter() {
        require(approvedMinters[msg.sender] == true, "Not an approved minter");
        _;
    }

    constructor(string memory name_, string memory symbol_)
        ERC20(name_, symbol_)
    {
        approvedMinters[msg.sender] = true;
    }

    function setSettlementsAddress(SettlementsV2 _settlements)
        public
        onlyOwner
    {
        settlements = _settlements;
    }

    function turnOffMintGovernance() public onlyOwner {
        canToggleMints = false;
    }

    function addMinter(address minter) public onlyOwner {
        require(canToggleMints, "Minting turned off");
        totalMinters += 1;
        approvedMinters[minter] = true;
    }

    function removeMinter(address minter) public onlyOwner {
        require(canToggleMints, "Minting turned off");
        approvedMinters[minter] = false;
        totalMinters -= 1;
    }

    function mint(address to, uint256 amount) public onlyMinter {
        _mint(to, amount);
    }
}

File 23 of 29 : Helper.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

import "@openzeppelin/contracts/utils/Strings.sol";
import "base64-sol/base64.sol";
import "hardhat/console.sol";
import "./SettlementsV2.sol";
import "./ERC20Mintable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

contract Helpers is Ownable {
    function _makeLegacyParts(
        string memory size,
        string memory spirit,
        string memory age,
        string memory resource,
        string memory morale,
        string memory government,
        string memory realm
    ) public pure returns (string[18] memory) {
        string[18] memory parts;

        parts[
            0
        ] = '<svg xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMinYMin meet" viewBox="0 0 350 350"><style>.txt { fill: black; font-family: monospace; font-size: 12px;}</style><rect width="100%" height="100%" fill="white" /><text x="10" y="20" class="txt">';
        parts[1] = size;
        parts[2] = '</text><text x="10" y="40" class="txt">';
        parts[3] = spirit;
        parts[4] = '</text><text x="10" y="60" class="txt">';
        parts[5] = age;
        parts[6] = '</text><text x="10" y="80" class="txt">';
        parts[7] = resource;
        parts[8] = '</text><text x="10" y="100" class="txt">';
        parts[9] = morale;
        parts[10] = '</text><text x="10" y="120" class="txt">';
        parts[11] = government;
        parts[12] = '</text><text x="10" y="140" class="txt">';
        parts[13] = realm;
        parts[14] = "</text></svg>";
        return parts;
    }

    function _makeLegacyAttributeParts(string[18] memory parts)
        public
        pure
        returns (string[18] memory)
    {
        string[18] memory attrParts;
        attrParts[0] = '[{ "trait_type": "Size", "value": "';
        attrParts[1] = parts[1];
        attrParts[2] = '" }, { "trait_type": "Spirit", "value": "';
        attrParts[3] = parts[3];
        attrParts[4] = '" }, { "trait_type": "Age", "value": "';
        attrParts[5] = parts[5];
        attrParts[6] = '" }, { "trait_type": "Resource", "value": "';
        attrParts[7] = parts[7];
        attrParts[8] = '" }, { "trait_type": "Morale", "value": "';
        attrParts[9] = parts[9];
        attrParts[10] = '" }, { "trait_type": "Government", "value": "';
        attrParts[11] = parts[11];
        attrParts[12] = '" }, { "trait_type": "Realm", "value": "';
        attrParts[13] = parts[13];
        attrParts[14] = '" }]';
        return attrParts;
    }

    function _makeParts(
        string memory size,
        string memory spirit,
        string memory age,
        string memory resource,
        string memory morale,
        string memory government,
        string memory realm,
        uint256 unharvestedTokenAmount,
        string memory tokenSymbol
    ) public pure returns (string[18] memory) {
        string[18] memory parts;
        parts[
            0
        ] = '<svg xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMinYMin meet" viewBox="0 0 350 350"><style>.txt { fill: black; font-family: monospace; font-size: 12px;}</style><rect width="100%" height="100%" fill="white" /><text x="10" y="20" class="txt">';
        parts[1] = size;
        parts[2] = '</text><text x="10" y="40" class="txt">';
        parts[3] = spirit;
        parts[4] = '</text><text x="10" y="60" class="txt">';
        parts[5] = age;
        parts[6] = '</text><text x="10" y="80" class="txt">';
        parts[7] = resource;
        parts[8] = '</text><text x="10" y="100" class="txt">';
        parts[9] = morale;
        parts[10] = '</text><text x="10" y="120" class="txt">';
        parts[11] = government;
        parts[12] = '</text><text x="10" y="140" class="txt">';
        parts[13] = realm;
        parts[14] = '</text><text x="10" y="160" class="txt">';
        parts[15] = "------------";
        parts[16] = '</text><text x="10" y="180" class="txt">';
        parts[17] = string(
            abi.encodePacked(
                "$",
                tokenSymbol,
                ": ",
                Strings.toString(unharvestedTokenAmount / 10**18),
                "</text></svg>"
            )
        );

        return parts;
    }

    function _makeAttributeParts(
        string memory size,
        string memory spirit,
        string memory age,
        string memory resource,
        string memory morale,
        string memory government,
        string memory realm,
        uint256 unharvestedTokenAmount,
        string memory tokenSymbol
    ) public pure returns (string[18] memory) {
        string[18] memory attrParts;
        attrParts[0] = '[{ "trait_type": "Size", "value": "';
        attrParts[1] = size;
        attrParts[2] = '" }, { "trait_type": "Spirit", "value": "';
        attrParts[3] = spirit;
        attrParts[4] = '" }, { "trait_type": "Age", "value": "';
        attrParts[5] = age;
        attrParts[6] = '" }, { "trait_type": "Resource", "value": "';
        attrParts[7] = resource;
        attrParts[8] = '" }, { "trait_type": "Morale", "value": "';
        attrParts[9] = morale;
        attrParts[10] = '" }, { "trait_type": "Government", "value": "';
        attrParts[11] = government;
        attrParts[12] = '" }, { "trait_type": "Realm", "value": "';
        attrParts[13] = realm;
        attrParts[14] = '" }, { "display_type": "number",  "trait_type": ';
        attrParts[15] = string(abi.encodePacked('"$', tokenSymbol, '", "value": '));
        attrParts[16] = string(abi.encodePacked(Strings.toString(unharvestedTokenAmount / 10**18)));
        attrParts[17] = " }]";
        return attrParts;
    }

    struct TokenURIInput {
        string size;
        string spirit;
        string age;
        string resource;
        string morale;
        string government;
        string realm;
    }

    function tokenURI(
        TokenURIInput memory tokenURIInput,
        uint256 unharvestedTokenAmount,
        string memory tokenSymbol,
        bool useLegacy,
        uint256 tokenId
    ) public view returns (string memory) {
        string[18] memory parts;
        string[18] memory attributesParts;

        if (useLegacy) {
            parts = _makeLegacyParts(
                tokenURIInput.size,
                tokenURIInput.spirit,
                tokenURIInput.age,
                tokenURIInput.resource,
                tokenURIInput.morale,
                tokenURIInput.government,
                tokenURIInput.realm
            );

            attributesParts = _makeLegacyAttributeParts(
                _makeLegacyParts(
                    tokenURIInput.size,
                    tokenURIInput.spirit,
                    tokenURIInput.age,
                    tokenURIInput.resource,
                    tokenURIInput.morale,
                    tokenURIInput.government,
                    tokenURIInput.realm
                )
            );
        } else {
            parts = _makeParts(
                tokenURIInput.size,
                tokenURIInput.spirit,
                tokenURIInput.age,
                tokenURIInput.resource,
                tokenURIInput.morale,
                tokenURIInput.government,
                tokenURIInput.realm,
                unharvestedTokenAmount,
                tokenSymbol
            );

            attributesParts = _makeAttributeParts(
                tokenURIInput.size,
                tokenURIInput.spirit,
                tokenURIInput.age,
                tokenURIInput.resource,
                tokenURIInput.morale,
                tokenURIInput.government,
                tokenURIInput.realm,
                unharvestedTokenAmount,
                tokenSymbol
            );
        }

        string memory output = string(
            abi.encodePacked(
                parts[0],
                parts[1],
                parts[2],
                parts[3],
                parts[4],
                parts[5],
                parts[6],
                parts[7],
                parts[8]
            )
        );
        output = string(
            abi.encodePacked(
                output,
                parts[9],
                parts[10],
                parts[11],
                parts[12],
                parts[13],
                parts[14],
                parts[15],
                parts[16]
            )
        );
        output = string(abi.encodePacked(output, parts[17]));

        string memory atrrOutput = string(
            abi.encodePacked(
                attributesParts[0],
                attributesParts[1],
                attributesParts[2],
                attributesParts[3],
                attributesParts[4],
                attributesParts[5],
                attributesParts[6],
                attributesParts[7],
                attributesParts[8]
            )
        );
        atrrOutput = string(
            abi.encodePacked(
                atrrOutput,
                attributesParts[9],
                attributesParts[10],
                attributesParts[11],
                attributesParts[12],
                attributesParts[13],
                attributesParts[14]
            )
        );

        atrrOutput = string(
            abi.encodePacked(
                atrrOutput,
                attributesParts[15],
                attributesParts[16],
                attributesParts[17]
            )
        );

        string memory json = Base64.encode(
            bytes(
                string(
                    abi.encodePacked(
                        '{"name": "Settlement #',
                        Strings.toString(tokenId),
                        '", "description": "Settlements are a turn based civilisation simulator stored entirely on chain, go forth and conquer.", "image": "data:image/svg+xml;base64,',
                        Base64.encode(bytes(output)),
                        '"',
                        ',"attributes":',
                        atrrOutput,
                        "}"
                    )
                )
            )
        );

        return string(abi.encodePacked("data:application/json;base64,", json));
    }

    uint8[] public civMultipliers;
    uint8[] public realmMultipliers;
    uint8[] public moralMultipliers;

    uint256 constant ONE = 10**18;

    function setMultipliers(
        uint8[] memory civMultipliers_,
        uint8[] memory realmMultipliers_,
        uint8[] memory moralMultipliers_
    ) public onlyOwner {
        civMultipliers = civMultipliers_;
        realmMultipliers = realmMultipliers_;
        moralMultipliers = moralMultipliers_;
    }

    function getUnharvestedTokens(uint256 tokenId, SettlementsV2.Attributes memory attributes)
        public
        view
        returns (ERC20Mintable, uint256)
    {
        SettlementsV2 caller = SettlementsV2(msg.sender);

        uint256 lastHarvest = caller.tokenIdToLastHarvest(tokenId);
        uint256 blockDelta = block.number - lastHarvest;

        ERC20Mintable tokenAddress = caller.resourceTokenAddresses(attributes.resource);

        if (blockDelta == 0 || lastHarvest == 0) {
            return (tokenAddress, 0);
        }

        uint256 realmMultiplier = realmMultipliers[attributes.turns];
        uint256 civMultiplier = civMultipliers[attributes.size];
        uint256 moralMultiplier = moralMultipliers[attributes.morale];
        uint256 tokensToMint = (civMultiplier *
            blockDelta *
            moralMultiplier *
            ONE *
            realmMultiplier) / 300;

        return (tokenAddress, tokensToMint);
    }
}

File 24 of 29 : Islands.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "./ERC20Mintable.sol";
import "./IslandsHelper.sol";

// The islands
// Travel to diff islands and harvest shit.
// @author 1929

contract Islands is ERC721, ERC721Enumerable, Ownable {
    struct Attributes {
        uint8 resource;
        uint8 climate;
        uint8 terrain;
        uint8 taxRate;
        uint32 area;
        uint32 population;
    }

    struct Island {
        uint256 tokenId;
        ERC20Mintable resourceTokenContract;
        string resource;
        string climate;
        string terrain;
        uint32 area;
        uint32 maxPopulation;
        uint32 population;
        uint8 taxRate;
    }

    string[] public resources = ["Fish", "Wood", "Iron", "Silver", "Pearl", "Oil", "Diamond"];
    string[] public climates = ["Temperate", "Rainy", "Humid", "Arid", "Tropical", "Icy"];
    string[] public terrains = ["Flatlands", "Hilly", "Canyons", "Mountainous"];

    ERC20Mintable[] public resourcesToTokenContracts;

    uint256 constant MAX_AREA = 5_000;
    uint32 constant MAX_POPULATION_PER_SQ_MI = 2_000;

    IslandsHelper public helperContract;

    mapping(uint256 => Attributes) public tokenIdToAttributes;
    mapping(uint256 => uint256) public tokenIdToLastHarvest;

    // For future use so that expansion packs can increase/decrease the population
    // Idk what this could be used for... but probably something cool
    mapping(address => bool) public populationEditors;

    modifier onlyPopulationEditor() {
        require(
            populationEditors[msg.sender] == true,
            "You don't have permission to edit the population"
        );
        _;
    }

    constructor(
        ERC20Mintable fishToken,
        ERC20Mintable woodToken,
        ERC20Mintable ironToken,
        ERC20Mintable silverToken,
        ERC20Mintable pearlToken,
        ERC20Mintable oilToken,
        ERC20Mintable diamondToken
    ) ERC721("Islands", "ILND") {
        resourcesToTokenContracts = [
            fishToken,
            woodToken,
            ironToken,
            silverToken,
            pearlToken,
            oilToken,
            diamondToken
        ];
    }

    /** Setters */
    function addPopulationEditor(address newPopulationEditor) public onlyOwner {
        populationEditors[newPopulationEditor] = true;
    }

    function removePopulationEditor(address newPopulationEditor) public onlyOwner {
        populationEditors[newPopulationEditor] = false;
    }

    function setHelperContract(IslandsHelper helperContract_) public onlyOwner {
        helperContract = helperContract_;
    }

    function setPopulation(uint256 tokenId, uint32 population) public onlyPopulationEditor {
        require(population <= getIslandInfo(tokenId).maxPopulation, "Population is over max");
        tokenIdToAttributes[tokenId].population = population;
    }

    /** Getters */
    function getTaxIncome(uint256 tokenId) public view returns (ERC20Mintable, uint256) {
        return helperContract.getTaxIncome(tokenId);
    }

    function getRandomNumber(bytes memory seed, uint256 maxValue) public pure returns (uint256) {
        return uint256(keccak256(abi.encode(seed))) % maxValue;
    }

    function getTokenIdToAttributes(uint256 tokenId) public view returns (Attributes memory) {
        return tokenIdToAttributes[tokenId];
    }

    function tokenURI(uint256 tokenId) public view override returns (string memory) {
        return helperContract.tokenURI(tokenId);
    }

    function getPopulationPerSqMi(uint256 tokenId) public pure returns (uint32) {
        return uint32(getRandomNumber(abi.encode(tokenId), MAX_POPULATION_PER_SQ_MI)) + 10;
    }

    function getIslandInfo(uint256 tokenId) public view returns (Island memory) {
        require(_exists(tokenId), "Island with that tokenId doesn't exist");

        Attributes memory attr = tokenIdToAttributes[tokenId];

        uint32 populationPerSqMi = getPopulationPerSqMi(tokenId);
        uint32 maxPopulation = populationPerSqMi * attr.area;

        return
            Island({
                tokenId: tokenId,
                resource: resources[attr.resource],
                resourceTokenContract: resourcesToTokenContracts[attr.resource],
                climate: climates[attr.climate],
                terrain: terrains[attr.terrain],
                area: attr.area,
                maxPopulation: maxPopulation,
                population: attr.population,
                taxRate: attr.taxRate
            });
    }

    /** State modifications */
    function mint(uint256 tokenId) public {
        require(!_exists(tokenId), "Island with that id already exists");
        require(
            (tokenId <= 9900) || (tokenId <= 10_000 && tokenId > 9900 && msg.sender == owner()),
            "Island id is invalid"
        );

        Attributes memory attr;

        uint256 value = getRandomNumber(abi.encode(tokenId, "r"), 1000);
        attr.resource = uint8(value < 700 ? value % 3 : value % 7);

        value = getRandomNumber(abi.encode(tokenId, "c"), 1000);
        attr.climate = uint8(value % 6);

        value = getRandomNumber(abi.encode(tokenId, "t"), 1000);
        attr.terrain = uint8(value % 4);

        value = getRandomNumber(abi.encode(tokenId, "ta"), 1000);
        attr.taxRate = uint8(value % 50) + 1;

        attr.area = uint32(getRandomNumber(abi.encode(tokenId, "a"), MAX_AREA)) + 1;

        uint32 populationPerSqMi = getPopulationPerSqMi(tokenId);
        uint32 maxPopulation = populationPerSqMi * attr.area;
        attr.population =
            (uint32(maxPopulation * getRandomNumber(abi.encode(tokenId), 100)) / 100) +
            10;

        tokenIdToAttributes[tokenId] = attr;
        tokenIdToLastHarvest[tokenId] = block.number;

        _safeMint(msg.sender, tokenId);
    }

    function harvest(uint256 tokenId) public {
        (ERC20Mintable resourceTokenContract, uint256 taxIncome) = helperContract.getTaxIncome(
            tokenId
        );

        tokenIdToLastHarvest[tokenId] = block.number;
        resourceTokenContract.mint(ownerOf(tokenId), taxIncome);
    }

    /** Library overrides */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal override(ERC721, ERC721Enumerable) {
        super._beforeTokenTransfer(from, to, tokenId);
    }

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

File 25 of 29 : IslandsHelper.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

import "./Islands.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "./ERC20Mintable.sol";
import "base64-sol/base64.sol";

contract IslandsHelper is Ownable {
    uint256 constant ONE = 10**18;

    Islands public islandContract;

    uint8[] public climateMultipliers;
    uint8[] public terrainMultipliers;

    function setIslandsContract(Islands islandContract_) public onlyOwner {
        islandContract = islandContract_;
    }

    function setMultipliers(uint8[] memory climateMultipliers_, uint8[] memory terrainMultipliers_)
        public
        onlyOwner
    {
        climateMultipliers = climateMultipliers_;
        terrainMultipliers = terrainMultipliers_;
    }

    function getImageOutput(Islands.Island memory islandInfo) public view returns (string memory) {
        string memory imageOutput = string(
            abi.encodePacked(
                '<svg xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMinYMin meet" viewBox="0 0 350 350"><style>.txt { fill: black; font-family: monospace; font-size: 12px;}</style><rect width="100%" height="100%" fill="white" /><text x="10" y="20" class="txt">',
                islandInfo.climate,
                '</text><text x="10" y="40" class="txt">',
                islandInfo.terrain,
                '</text><text x="10" y="60" class="txt">',
                islandInfo.resource,
                '</text><text x="10" y="80" class="txt">',
                string(abi.encodePacked(Strings.toString(islandInfo.area), " sq mi")),
                '</text><text x="10" y="100" class="txt">'
            )
        );

        (ERC20Mintable resourceTokenContract, uint256 taxIncome) = getTaxIncome(islandInfo.tokenId);

        imageOutput = string(
            abi.encodePacked(
                imageOutput,
                string(
                    abi.encodePacked(
                        "Pop. ",
                        Strings.toString(islandInfo.population),
                        "/",
                        Strings.toString(islandInfo.maxPopulation)
                    )
                ),
                '</text><text x="10" y="120" class="txt">',
                "------------",
                '</text><text x="10" y="140" class="txt">',
                string(abi.encodePacked("Tax Rate: ", Strings.toString(islandInfo.taxRate), "%")),
                '</text><text x="10" y="160" class="txt">',
                string(
                    abi.encodePacked(
                        "Tax Income: ",
                        Strings.toString(taxIncome / 10**18),
                        " $",
                        resourceTokenContract.symbol()
                    )
                ),
                '</text><text x="10" y="180" class="txt">',
                "</text></svg>"
            )
        );

        return imageOutput;
    }

    function getAttrOutput(Islands.Island memory islandInfo) public view returns (string memory) {
        (ERC20Mintable __, uint256 taxIncome) = getTaxIncome(islandInfo.tokenId);

        string memory attrOutput = string(
            abi.encodePacked(
                '[{ "trait_type": "Climate", "value": "',
                islandInfo.climate,
                '" }, { "trait_type": "Terain", "value": "',
                islandInfo.terrain,
                '" }, { "trait_type": "Resource", "value": "',
                islandInfo.resource,
                '" }, { "trait_type": "Area (sq mi)", "display_type": "number", "value": ',
                Strings.toString(islandInfo.area),
                ' }, { "trait_type": "Population", "display_type": "number", "value": ',
                Strings.toString(islandInfo.population),
                ' }, { "trait_type": "Tax Rate", "display_type": "boost_percentage", "value": ',
                Strings.toString(islandInfo.taxRate)
            )
        );

        attrOutput = string(
            abi.encodePacked(
                attrOutput,
                ' }, { "trait_type": "Max Population", "display_type": "number", "value": ',
                Strings.toString(islandInfo.maxPopulation),
                ' }, { "trait_type": "Tax Income", "display_type": "number", "value": ',
                Strings.toString(taxIncome / 10**18),
                " }]"
            )
        );

        return attrOutput;
    }

    function getTaxIncome(uint256 tokenId) public view returns (ERC20Mintable, uint256) {
        Islands.Attributes memory islandInfo = islandContract.getTokenIdToAttributes(tokenId);
        ERC20Mintable resourceTokenContract = islandContract.resourcesToTokenContracts(
            islandInfo.resource
        );

        uint256 lastHarvest = islandContract.tokenIdToLastHarvest(tokenId);
        uint256 blockDelta = block.number - lastHarvest;

        uint256 tokenAmount = (blockDelta *
            climateMultipliers[islandInfo.climate] *
            terrainMultipliers[islandInfo.terrain] *
            islandInfo.taxRate *
            islandInfo.population *
            ONE) / 1_000_000_000;

        return (resourceTokenContract, tokenAmount);
    }

    function tokenURI(uint256 tokenId) public view returns (string memory) {
        Islands.Island memory islandInfo = islandContract.getIslandInfo(tokenId);

        string memory imageOutput = getImageOutput(islandInfo);
        string memory attrOutput = getAttrOutput(islandInfo);

        string memory json = Base64.encode(
            bytes(
                string(
                    abi.encodePacked(
                        '{"name": "Island #',
                        Strings.toString(tokenId),
                        '", "description": "Islands can be discovered and harvested for their resources. All data is onchain.", "image": "data:image/svg+xml;base64,',
                        Base64.encode(bytes(imageOutput)),
                        '", "attributes": ',
                        attrOutput,
                        "}"
                    )
                )
            )
        );

        return string(abi.encodePacked("data:application/json;base64,", json));
    }
}

File 26 of 29 : SettlementsLegacy.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "base64-sol/base64.sol";

//
//▄████████    ▄████████     ███         ███      ▄█          ▄████████   ▄▄▄▄███▄▄▄▄      ▄████████ ███▄▄▄▄       ███        ▄████████
//███    ███   ███    ███ ▀█████████▄ ▀█████████▄ ███         ███    ███ ▄██▀▀▀███▀▀▀██▄   ███    ███ ███▀▀▀██▄ ▀█████████▄   ███    ███
//███    █▀    ███    █▀     ▀███▀▀██    ▀███▀▀██ ███         ███    █▀  ███   ███   ███   ███    █▀  ███   ███    ▀███▀▀██   ███    █▀
//███         ▄███▄▄▄         ███   ▀     ███   ▀ ███        ▄███▄▄▄     ███   ███   ███  ▄███▄▄▄     ███   ███     ███   ▀   ███
//▀███████████ ▀▀███▀▀▀         ███         ███     ███       ▀▀███▀▀▀     ███   ███   ███ ▀▀███▀▀▀     ███   ███     ███     ▀███████████
//███   ███    █▄      ███         ███     ███         ███    █▄  ███   ███   ███   ███    █▄  ███   ███     ███              ███
//▄█    ███   ███    ███     ███         ███     ███▌    ▄   ███    ███ ███   ███   ███   ███    ███ ███   ███     ███        ▄█    ███
//▄████████▀    ██████████    ▄████▀      ▄████▀   █████▄▄██   ██████████  ▀█   ███   █▀    ██████████  ▀█   █▀     ▄████▀    ▄████████▀
//▀

// @author zeth

// @notice This contract is heavily inspired by Dom Hofmann's Loot Project with game design from Sid Meirs Civilisation, DND, Settlers of Catan & Age of Empires.

// Settlements allows for the creation of settlements of which users have 5 turns to create their perfect civ.
// Randomise will pseduo randomly assign a settlement a new set of attributes & increase their turn count.
// An allocation of 100 settlements are reserved for owner & future expansion packs

contract SettlementsLegacy is
    ERC721,
    ERC721Enumerable,
    ReentrancyGuard,
    Ownable
{
    constructor() ERC721("Settlements", "STL") {}

    struct Attributes {
        uint8 size;
        uint8 spirit;
        uint8 age;
        uint8 resource;
        uint8 morale;
        uint8 government;
        uint8 turns;
    }

    string[] private _sizes = [
        "Camp",
        "Hamlet",
        "Village",
        "Town",
        "District",
        "Precinct",
        "Capitol",
        "State"
    ];
    string[] private _spirits = ["Earth", "Fire", "Water", "Air", "Astral"];
    string[] private _ages = [
        "Ancient",
        "Classical",
        "Medieval",
        "Renaissance",
        "Industrial",
        "Modern",
        "Information",
        "Future"
    ];
    string[] private _resources = [
        "Iron",
        "Gold",
        "Silver",
        "Wood",
        "Wool",
        "Water",
        "Grass",
        "Grain"
    ];
    string[] private _morales = [
        "Expectant",
        "Enlightened",
        "Dismissive",
        "Unhappy",
        "Happy",
        "Undecided",
        "Warring",
        "Scared",
        "Unruly",
        "Anarchist"
    ];
    string[] private _governments = [
        "Democracy",
        "Communism",
        "Socialism",
        "Oligarchy",
        "Aristocracy",
        "Monarchy",
        "Theocracy",
        "Colonialism",
        "Dictatorship"
    ];
    string[] private _realms = [
        "Genesis",
        "Valhalla",
        "Keskella",
        "Shadow",
        "Plains",
        "Ends"
    ];

    mapping(uint256 => Attributes) private attrIndex;

    function indexFor(string memory input, uint256 length)
        internal
        pure
        returns (uint256)
    {
        return uint256(keccak256(abi.encodePacked(input))) % length;
    }

    function _getRandomSeed(uint256 tokenId, string memory seedFor)
        internal
        view
        returns (string memory)
    {
        return
            string(
                abi.encodePacked(
                    seedFor,
                    Strings.toString(tokenId),
                    block.timestamp,
                    block.difficulty
                )
            );
    }

    function generateAttribute(string memory salt, string[] memory items)
        internal
        pure
        returns (uint8)
    {
        return uint8(indexFor(string(salt), items.length));
    }

    function _makeParts(uint256 tokenId)
        internal
        view
        returns (string[15] memory)
    {
        string[15] memory parts;
        parts[
            0
        ] = '<svg xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMinYMin meet" viewBox="0 0 350 350"><style>.txt { fill: black; font-family: monospace; font-size: 12px;}</style><rect width="100%" height="100%" fill="white" /><text x="10" y="20" class="txt">';
        parts[1] = _sizes[attrIndex[tokenId].size];
        parts[2] = '</text><text x="10" y="40" class="txt">';
        parts[3] = _spirits[attrIndex[tokenId].spirit];
        parts[4] = '</text><text x="10" y="60" class="txt">';
        parts[5] = _ages[attrIndex[tokenId].age];
        parts[6] = '</text><text x="10" y="80" class="txt">';
        parts[7] = _resources[attrIndex[tokenId].resource];
        parts[8] = '</text><text x="10" y="100" class="txt">';
        parts[9] = _morales[attrIndex[tokenId].morale];
        parts[10] = '</text><text x="10" y="120" class="txt">';
        parts[11] = _governments[attrIndex[tokenId].government];
        parts[12] = '</text><text x="10" y="140" class="txt">';
        parts[13] = _realms[attrIndex[tokenId].turns];
        parts[14] = "</text></svg>";
        return parts;
    }

    function _makeAttributeParts(string[15] memory parts)
        internal
        pure
        returns (string[15] memory)
    {
        string[15] memory attrParts;
        attrParts[0] = '[{ "trait_type": "Size", "value": "';
        attrParts[1] = parts[1];
        attrParts[2] = '" }, { "trait_type": "Spirit", "value": "';
        attrParts[3] = parts[3];
        attrParts[4] = '" }, { "trait_type": "Age", "value": "';
        attrParts[5] = parts[5];
        attrParts[6] = '" }, { "trait_type": "Resource", "value": "';
        attrParts[7] = parts[7];
        attrParts[8] = '" }, { "trait_type": "Morale", "value": "';
        attrParts[9] = parts[9];
        attrParts[10] = '" }, { "trait_type": "Government", "value": "';
        attrParts[11] = parts[11];
        attrParts[12] = '" }, { "trait_type": "Realm", "value": "';
        attrParts[13] = parts[13];
        attrParts[14] = '" }]';
        return attrParts;
    }

    function tokenURI(uint256 tokenId)
        public
        view
        virtual
        override
        returns (string memory)
    {
        require(_exists(tokenId), "Settlement does not exist");

        string[15] memory parts = _makeParts(tokenId);
        string[15] memory attributesParts = _makeAttributeParts(parts);

        string memory output = string(
            abi.encodePacked(
                parts[0],
                parts[1],
                parts[2],
                parts[3],
                parts[4],
                parts[5],
                parts[6],
                parts[7],
                parts[8]
            )
        );
        output = string(
            abi.encodePacked(
                output,
                parts[9],
                parts[10],
                parts[11],
                parts[12],
                parts[13],
                parts[14]
            )
        );

        string memory atrrOutput = string(
            abi.encodePacked(
                attributesParts[0],
                attributesParts[1],
                attributesParts[2],
                attributesParts[3],
                attributesParts[4],
                attributesParts[5],
                attributesParts[6],
                attributesParts[7],
                attributesParts[8]
            )
        );
        atrrOutput = string(
            abi.encodePacked(
                atrrOutput,
                attributesParts[9],
                attributesParts[10],
                attributesParts[11],
                attributesParts[12],
                attributesParts[13],
                attributesParts[14]
            )
        );

        string memory json = Base64.encode(
            bytes(
                string(
                    abi.encodePacked(
                        '{"name": "Settlement #',
                        Strings.toString(tokenId),
                        '", "description": "Settlements are a turn based civilisation simulator stored entirely on chain, go forth and conquer.", "image": "data:image/svg+xml;base64,',
                        Base64.encode(bytes(output)),
                        '"',
                        ',"attributes":',
                        atrrOutput,
                        "}"
                    )
                )
            )
        );
        output = string(
            abi.encodePacked("data:application/json;base64,", json)
        );

        return output;
    }

    function randomiseAttributes(uint256 tokenId, uint8 turn) internal {
        attrIndex[tokenId].size = generateAttribute(
            _getRandomSeed(tokenId, "size"),
            _sizes
        );
        attrIndex[tokenId].spirit = generateAttribute(
            _getRandomSeed(tokenId, "spirit"),
            _spirits
        );
        attrIndex[tokenId].age = generateAttribute(
            _getRandomSeed(tokenId, "age"),
            _ages
        );
        attrIndex[tokenId].resource = generateAttribute(
            _getRandomSeed(tokenId, "resource"),
            _resources
        );
        attrIndex[tokenId].morale = generateAttribute(
            _getRandomSeed(tokenId, "morale"),
            _morales
        );
        attrIndex[tokenId].government = generateAttribute(
            _getRandomSeed(tokenId, "government"),
            _governments
        );
        attrIndex[tokenId].turns = turn;
    }

    function randomise(uint256 tokenId) public nonReentrant {
        require(
            _exists(tokenId) &&
                msg.sender == ownerOf(tokenId) &&
                attrIndex[tokenId].turns < 5,
            "Settlement turns over"
        );
        randomiseAttributes(
            tokenId,
            uint8(SafeMath.add(attrIndex[tokenId].turns, 1))
        );
    }

    function settle(uint256 tokenId) public nonReentrant {
        require(
            !_exists(tokenId) && tokenId > 0 && tokenId < 9901,
            "Settlement id is invalid"
        );
        randomiseAttributes(tokenId, 0);
        _safeMint(msg.sender, tokenId);
    }

    function settleForOwner(uint256 tokenId) public nonReentrant onlyOwner {
        require(
            !_exists(tokenId) && tokenId > 9900 && tokenId < 10001,
            "Settlement id is invalid"
        );
        randomiseAttributes(tokenId, 0);
        _safeMint(msg.sender, tokenId);
    }

    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal override(ERC721, ERC721Enumerable) {
        super._beforeTokenTransfer(from, to, tokenId);
    }

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

File 27 of 29 : SettlementsV2.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "./SettlementsLegacy.sol";
import "./ERC20Mintable.sol";
import "./Helper.sol";
import "hardhat/console.sol";

// @author zeth and out.eth
// @notice This contract is heavily inspired by Dom Hofmann's Loot Project with game design from Sid Meirs Civilisation, DND, Settlers of Catan & Age of Empires.

// Lands allows for the creation of lands of which users have 5 turns to create their perfect civ.
// Randomise will pseduo randomly assign a land a new set of attributes & increase their turn count.
// An allocation of 100 lands are reserved for owner & future expansion packs

contract SettlementsV2 is ERC721, ERC721Enumerable, Ownable {
    struct Attributes {
        uint8 size;
        uint8 spirit;
        uint8 age;
        uint8 resource;
        uint8 morale;
        uint8 government;
        uint8 turns;
    }

    SettlementsLegacy public legacySettlements;
    Helpers public helpersContract;

    ERC20Mintable[] public resourceTokenAddresses;
    mapping(uint256 => uint256) public tokenIdToLastHarvest;
    mapping(uint256 => Attributes) public attrIndex;

    string[] public _sizes = [
        "Camp",
        "Hamlet",
        "Village",
        "Town",
        "District",
        "Precinct",
        "Capitol",
        "State"
    ];
    string[] public _spirits = ["Earth", "Fire", "Water", "Air", "Astral"];
    string[] public _ages = [
        "Ancient",
        "Classical",
        "Medieval",
        "Renaissance",
        "Industrial",
        "Modern",
        "Information",
        "Future"
    ];
    string[] public _resources = [
        "Iron",
        "Gold",
        "Silver",
        "Wood",
        "Wool",
        "Water",
        "Grass",
        "Grain"
    ];
    string[] public _morales = [
        "Expectant",
        "Enlightened",
        "Dismissive",
        "Unhappy",
        "Happy",
        "Undecided",
        "Warring",
        "Scared",
        "Unruly",
        "Anarchist"
    ];
    string[] public _governments = [
        "Democracy",
        "Communism",
        "Socialism",
        "Oligarchy",
        "Aristocracy",
        "Monarchy",
        "Theocracy",
        "Colonialism",
        "Dictatorship"
    ];
    string[] public _realms = ["Genesis", "Valhalla", "Keskella", "Shadow", "Plains", "Ends"];

    constructor(
        SettlementsLegacy _legacyAddress,
        ERC20Mintable ironToken_,
        ERC20Mintable goldToken_,
        ERC20Mintable silverToken_,
        ERC20Mintable woodToken_,
        ERC20Mintable woolToken_,
        ERC20Mintable waterToken_,
        ERC20Mintable grassToken_,
        ERC20Mintable grainToken_
    ) ERC721("Settlements", "STL") {
        legacySettlements = _legacyAddress;
        resourceTokenAddresses = [
            ironToken_,
            goldToken_,
            silverToken_,
            woodToken_,
            woolToken_,
            waterToken_,
            grassToken_,
            grainToken_
        ];
    }

    function setHelpersContract(Helpers helpersContract_) public onlyOwner {
        helpersContract = helpersContract_;
    }

    function indexFor(string memory input, uint256 length) internal pure returns (uint256) {
        return uint256(keccak256(abi.encodePacked(input))) % length;
    }

    function _getRandomSeed(uint256 tokenId, string memory seedFor)
        internal
        view
        returns (string memory)
    {
        return
            string(
                abi.encodePacked(
                    seedFor,
                    Strings.toString(tokenId),
                    block.timestamp,
                    block.difficulty
                )
            );
    }

    function generateAttribute(string memory salt, string[] memory items)
        internal
        pure
        returns (uint8)
    {
        return uint8(indexFor(string(salt), items.length));
    }

    function _oldTokenURI(uint256 tokenId) private view returns (string memory) {
        return _tokenURI(tokenId, true);
    }

    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
        return _tokenURI(tokenId, false);
    }

    function getUnharvestedTokens(uint256 tokenId) public view returns (ERC20Mintable, uint256) {
        Attributes memory attributes = attrIndex[tokenId];
        return helpersContract.getUnharvestedTokens(tokenId, attributes);
    }

    function _tokenURI(uint256 tokenId, bool useLegacy) private view returns (string memory) {
        require(_exists(tokenId), "Settlement does not exist");

        Helpers.TokenURIInput memory tokenURIInput;

        tokenURIInput.size = _sizes[attrIndex[tokenId].size];
        tokenURIInput.spirit = _spirits[attrIndex[tokenId].spirit];
        tokenURIInput.age = _ages[attrIndex[tokenId].age];
        tokenURIInput.resource = _resources[attrIndex[tokenId].resource];
        tokenURIInput.morale = _morales[attrIndex[tokenId].morale];
        tokenURIInput.government = _governments[attrIndex[tokenId].government];
        tokenURIInput.realm = _realms[attrIndex[tokenId].turns];

        ERC20Mintable tokenContract = resourceTokenAddresses[0];
        uint256 unharvestedTokenAmount = 0;

        if (useLegacy == false) {
            Attributes memory attributes = attrIndex[tokenId];
            (tokenContract, unharvestedTokenAmount) = getUnharvestedTokens(tokenId);
        }

        string memory output = helpersContract.tokenURI(
            tokenURIInput,
            unharvestedTokenAmount,
            tokenContract.symbol(),
            useLegacy,
            tokenId
        );

        return output;
    }

    function randomiseAttributes(uint256 tokenId, uint8 turn) internal {
        attrIndex[tokenId].size = generateAttribute(_getRandomSeed(tokenId, "size"), _sizes);
        attrIndex[tokenId].spirit = generateAttribute(_getRandomSeed(tokenId, "spirit"), _spirits);
        attrIndex[tokenId].age = generateAttribute(_getRandomSeed(tokenId, "age"), _ages);
        attrIndex[tokenId].resource = generateAttribute(
            _getRandomSeed(tokenId, "resource"),
            _resources
        );
        attrIndex[tokenId].morale = generateAttribute(_getRandomSeed(tokenId, "morale"), _morales);
        attrIndex[tokenId].government = generateAttribute(
            _getRandomSeed(tokenId, "government"),
            _governments
        );
        attrIndex[tokenId].turns = turn;
    }

    function randomise(uint256 tokenId) public {
        require(
            _exists(tokenId) && msg.sender == ownerOf(tokenId) && attrIndex[tokenId].turns < 5,
            "Settlement turns over"
        );

        harvest(tokenId);
        randomiseAttributes(tokenId, attrIndex[tokenId].turns + 1);
    }

    function harvest(uint256 tokenId) public {
        (ERC20Mintable tokenAddress, uint256 tokensToMint) = getUnharvestedTokens(tokenId);

        tokenAddress.mint(ownerOf(tokenId), tokensToMint);
        tokenIdToLastHarvest[tokenId] = block.number;
    }

    function multiClaim(uint256[] calldata tokenIds, Attributes[] memory tokenAttributes) public {
        for (uint256 i = 0; i < tokenAttributes.length; i++) {
            claim(tokenIds[i], tokenAttributes[i]);
        }
    }

    function claim(uint256 tokenId, Attributes memory attributes) public {
        legacySettlements.transferFrom(msg.sender, address(this), tokenId);
        _safeMint(msg.sender, tokenId);
        attrIndex[tokenId] = attributes;
        bytes32 v2Uri = keccak256(abi.encodePacked(_oldTokenURI(tokenId)));
        bytes32 legacyURI = keccak256(abi.encodePacked(legacySettlements.tokenURI(tokenId)));

        tokenIdToLastHarvest[tokenId] = block.number;
        require(v2Uri == legacyURI, "Attributes don't match legacy contract");
    }

    function claimAndReroll(uint256 tokenId) public {
        legacySettlements.transferFrom(msg.sender, address(this), tokenId);
        randomiseAttributes(tokenId, 3);
        _safeMint(msg.sender, tokenId);
    }

    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal override(ERC721, ERC721Enumerable) {
        super._beforeTokenTransfer(from, to, tokenId);
    }

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

    function getSettlementSize(uint256 tokenId) public view returns (string memory) {
        require(_exists(tokenId), "Settlement does not exist");
        return _sizes[attrIndex[tokenId].size];
    }

    function getSettlementSpirit(uint256 tokenId) public view returns (string memory) {
        require(_exists(tokenId), "Settlement does not exist");
        return _spirits[attrIndex[tokenId].spirit];
    }

    function getSettlementAge(uint256 tokenId) public view returns (string memory) {
        require(_exists(tokenId), "Settlement does not exist");
        return _ages[attrIndex[tokenId].age];
    }

    function getSettlementResource(uint256 tokenId) public view returns (string memory) {
        require(_exists(tokenId), "Settlement does not exist");
        return _resources[attrIndex[tokenId].resource];
    }

    function getSettlementMorale(uint256 tokenId) public view returns (string memory) {
        require(_exists(tokenId), "Settlement does not exist");
        return _morales[attrIndex[tokenId].morale];
    }

    function getSettlementGovernment(uint256 tokenId) public view returns (string memory) {
        require(_exists(tokenId), "Settlement does not exist");
        return _governments[attrIndex[tokenId].government];
    }

    function getSettlementRealm(uint256 tokenId) public view returns (string memory) {
        require(_exists(tokenId), "Settlement does not exist");
        return _realms[attrIndex[tokenId].turns];
    }
}

File 28 of 29 : ShipsHelper.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "./ERC20Mintable.sol";
import "base64-sol/base64.sol";
import "./Ships.sol";
import "./SettlementsV2.sol";
import "./Islands.sol";
import "hardhat/console.sol";

contract ShipsHelper is Ownable {
    uint256 constant ONE = 10**18;

    Ships public shipsContract;

    uint256[] public nameToMaxRouteLength = [2, 3, 4, 5, 5];
    uint256[] public expeditionMultipliers = [3, 2, 2, 1, 1];

    uint256[] public setlNameMultipliers = [1, 2, 2, 4, 4];
    uint256[] public setlExpeditionMultipliers = [1, 3, 1, 2, 2];

    Ships.TokenHarvest[][] public nameToCost;

    SettlementsV2 public settlementsContract;
    Islands public islandsContract;

    ERC20Mintable public setlTokenAddress;

    enum Status {
        Resting,
        Sailing,
        Harvesting
    }

    constructor(ERC20Mintable setlTokenAddress_) {
        setlTokenAddress = setlTokenAddress_;
    }

    /** Setters */
    function setShipsContract(Ships shipsContract_) public onlyOwner {
        shipsContract = shipsContract_;
    }

    function setSettlementsContract(SettlementsV2 settlementsContract_) public onlyOwner {
        settlementsContract = settlementsContract_;
    }

    function setIslandsContract(Islands islandsContract_) public onlyOwner {
        islandsContract = islandsContract_;
    }

    function setCosts(Ships.TokenHarvest[][] memory costs) public onlyOwner {
        delete nameToCost;

        for (uint256 i = 0; i < costs.length; i++) {
            nameToCost.push();
            for (uint256 s = 0; s < costs[i].length; s++) {
                nameToCost[i].push();
                nameToCost[i][s].resourceTokenContract = costs[i][s].resourceTokenContract;
                nameToCost[i][s].amount = costs[i][s].amount;
            }
        }
    }

    /** Getters */
    // breh the level of modulo math in the next few functions is insane nocap
    function getStatus(uint256 tokenId) public view returns (Status) {
        Ships.Ship memory shipInfo = shipsContract.getShipInfo(tokenId);

        uint256 lastRouteUpdate = shipsContract.tokenIdToLastRouteUpdate(tokenId);
        uint256 blockDelta = block.number - lastRouteUpdate;

        uint256 sailingDuration = getSailingDuration(shipInfo);
        uint256 harvestDuration = 120;

        uint256 progressIntoCurrentPath = blockDelta % (sailingDuration + harvestDuration);
        uint256 currentTargetIndex = getCurrentTargetIndex(tokenId);
        Status status = progressIntoCurrentPath >= sailingDuration
            ? currentTargetIndex == 0 ? Status.Resting : Status.Harvesting
            : Status.Sailing;

        return status;
    }

    function getCurrentTargetIndex(uint256 tokenId) public view returns (uint256) {
        Ships.Ship memory shipInfo = shipsContract.getShipInfo(tokenId);

        uint256 lastRouteUpdate = shipsContract.tokenIdToLastRouteUpdate(tokenId);
        uint256 blockDelta = block.number - lastRouteUpdate;

        uint256 sailingDuration = getSailingDuration(shipInfo);
        uint256 harvestDuration = 120;

        uint256 singlePathDuration = sailingDuration + harvestDuration;

        uint256 index = (blockDelta % (singlePathDuration * shipInfo.route.length)) /
            singlePathDuration;
        uint256 currentTargetIndex = (index + 1) % shipInfo.route.length;

        return currentTargetIndex;
    }

    function getCurrentTarget(uint256 tokenId) public view returns (Ships.Path memory) {
        uint256 currentTargetIndex = getCurrentTargetIndex(tokenId);
        Ships.Ship memory shipInfo = shipsContract.getShipInfo(tokenId);
        return shipInfo.route[currentTargetIndex];
    }

    function getSailingDuration(Ships.Ship memory shipInfo) public pure returns (uint256) {
        return (15 * 200) / shipInfo.speed;
    }

    function getBlocksUntilNextPhase(uint256 tokenId) public view returns (uint256) {
        Ships.Ship memory shipInfo = shipsContract.getShipInfo(tokenId);
        uint256 lastRouteUpdate = shipsContract.tokenIdToLastRouteUpdate(tokenId);
        uint256 blockDelta = block.number - lastRouteUpdate;

        uint256 sailingDuration = getSailingDuration(shipInfo);
        uint256 harvestDuration = 120;

        uint256 singlePathDuration = sailingDuration + harvestDuration;
        uint256 progressIntoCurrentPath = blockDelta % singlePathDuration;

        uint256 blocksUntilNextPhase = progressIntoCurrentPath < sailingDuration
            ? sailingDuration - progressIntoCurrentPath
            : singlePathDuration - progressIntoCurrentPath;

        return blocksUntilNextPhase;
    }

    function getUnharvestedTokens(uint256 tokenId)
        public
        view
        returns (Ships.TokenHarvest[] memory)
    {
        Ships.Ship memory shipInfo = shipsContract.getShipInfo(tokenId);
        Ships.Attributes memory shipAttr = shipsContract.getTokenIdToAttributes(tokenId);

        uint256 lastRouteUpdate = shipsContract.tokenIdToLastRouteUpdate(tokenId);
        uint256 blockDelta = block.number - lastRouteUpdate;

        uint256 sailingDuration = getSailingDuration(shipInfo);
        uint256 harvestDuration = 120;
        uint256 singlePathDuration = sailingDuration + harvestDuration;
        uint256 totalPathDuration = singlePathDuration * shipInfo.route.length;

        Ships.TokenHarvest[] memory listOfTokensToHarvest = new Ships.TokenHarvest[](
            shipInfo.route.length - 1
        );
        uint256 tokensSeen = 0;

        // why hasn't any of the eth big brains figured out how to do a hashmap in memory
        for (uint256 i = 1; i < shipInfo.route.length; i++) {
            // offset = totalPathDuration - singlePathDuration * i
            // amountOfTimesHarvestedTarget = (blockDelta + offset) / totalPathDuration
            uint256 tokensToHarvest = (((blockDelta +
                (totalPathDuration - singlePathDuration * i)) / totalPathDuration) *
                ONE *
                expeditionMultipliers[shipAttr.expedition]);

            (ERC20Mintable resourceTokenContract, uint256 __) = islandsContract.getTaxIncome(
                shipInfo.route[i].tokenId
            );

            uint256 index = shipInfo.route.length;
            for (uint256 s = 0; s < listOfTokensToHarvest.length; s++) {
                if (
                    listOfTokensToHarvest[s].resourceTokenContract == address(resourceTokenContract)
                ) {
                    index = s;
                }
            }

            if (tokensToHarvest > 0) {
                if (index != shipInfo.route.length) {
                    listOfTokensToHarvest[index].amount += tokensToHarvest;
                } else {
                    listOfTokensToHarvest[tokensSeen].amount += tokensToHarvest;
                    listOfTokensToHarvest[tokensSeen].resourceTokenContract = address(
                        resourceTokenContract
                    );
                    tokensSeen += 1;
                }
            }
        }

        Ships.TokenHarvest[] memory filteredListOfTokensToHarvest = new Ships.TokenHarvest[](
            tokensSeen + 1
        );
        for (uint256 i = 0; i < tokensSeen; i++) {
            filteredListOfTokensToHarvest[i] = listOfTokensToHarvest[i];
        }

        filteredListOfTokensToHarvest[tokensSeen] = Ships.TokenHarvest({
            resourceTokenContract: address(setlTokenAddress),
            amount: getUnharvestedSettlementTokens(tokenId)
        });

        return filteredListOfTokensToHarvest;
    }

    function getUnharvestedSettlementTokens(uint256 tokenId) public view returns (uint256) {
        Ships.Attributes memory shipAttr = shipsContract.getTokenIdToAttributes(tokenId);
        uint256 lastSetlHarvest = shipsContract.tokenIdToLastRouteUpdate(tokenId);
        uint256 blockDelta = block.number - lastSetlHarvest;

        // timeSinceLastSettleHarvest * expeditionMultiplier * shipMultiplier
        uint256 unharvestedSetlTokens = (setlExpeditionMultipliers[shipAttr.expedition] *
            setlNameMultipliers[shipAttr.name] *
            blockDelta *
            ONE) / 1000;

        return unharvestedSetlTokens;
    }

    function getTaxDestination(uint256 tokenId) public view returns (address) {
        Ships.Ship memory shipInfo = shipsContract.getShipInfo(tokenId);
        return settlementsContract.ownerOf(shipInfo.route[0].tokenId);
    }

    function getInitialRoute(uint256 tokenId, uint8 name)
        public
        view
        returns (Ships.Path[] memory)
    {
        uint256 routeLength = nameToMaxRouteLength[name];
        Ships.Path[] memory routes = new Ships.Path[](routeLength);

        uint256 settlementId = getRandomNumber(abi.encodePacked("s", tokenId), 9_900);
        routes[0] = Ships.Path({
            tokenId: settlementId,
            tokenContract: address(settlementsContract)
        });

        for (uint256 i = 1; i < routes.length; i++) {
            uint256 islandId = getRandomNumber(abi.encodePacked(i, tokenId), 10_000);
            routes[i] = Ships.Path({tokenId: islandId, tokenContract: address(islandsContract)});
        }

        return routes;
    }

    function getRandomNumber(bytes memory seed, uint256 maxValue) public pure returns (uint256) {
        return uint256(keccak256(abi.encode(seed))) % maxValue;
    }

    function getCost(uint8 name) public view returns (Ships.TokenHarvest[] memory) {
        return nameToCost[name];
    }

    // We'll disable trading route updates for now until the mechanics are clearer
    // It's only valid on initialisation
    function isValidRoute(
        Ships.Path[] memory route,
        uint256 tokenId,
        address sender,
        bool init
    ) public view returns (bool) {
        return init;
    }

    function getImageOutput(Ships.Ship memory shipInfo) public view returns (string memory) {
        string memory imageOutput = string(
            abi.encodePacked(
                '<svg xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMinYMin meet" viewBox="0 0 350 350"><style>.txt { fill: black; font-family: monospace; font-size: 12px;}</style><rect width="100%" height="100%" fill="white" /><text x="10" y="20" class="txt">',
                shipInfo.name,
                '</text><text x="10" y="40" class="txt">',
                shipInfo.expedition,
                '</text><text x="10" y="60" class="txt">',
                string(abi.encodePacked(Strings.toString(uint256(shipInfo.length)), " ft")),
                '</text><text x="10" y="80" class="txt">',
                string(abi.encodePacked(Strings.toString(uint256(shipInfo.speed)), " km/h")),
                '</text><text x="10" y="100" class="txt">'
            )
        );

        string memory routeStr = "";
        uint256 svgY = 160;
        for (uint256 i = 0; i < shipInfo.route.length; i++) {
            string memory symbol = shipInfo.route[i].tokenContract == address(settlementsContract)
                ? "S"
                : "I";

            string memory suffix = i == shipInfo.route.length - 1 ? "" : ",";

            routeStr = string(
                abi.encodePacked(
                    routeStr,
                    " ",
                    symbol,
                    Strings.toString(shipInfo.route[i].tokenId),
                    suffix
                )
            );

            if ((i + 1) % 4 == 0 && i + 1 != shipInfo.route.length) {
                svgY += 20;
                routeStr = string(
                    abi.encodePacked(
                        routeStr,
                        '</text><text x="10" y="',
                        Strings.toString(svgY),
                        '" class="txt">'
                    )
                );
            }
        }

        Status shipStatus = getStatus(shipInfo.tokenId);
        Ships.Path memory currentTarget = getCurrentTarget(shipInfo.tokenId);
        imageOutput = string(
            abi.encodePacked(
                imageOutput,
                "------------",
                '</text><text x="10" y="120" class="txt">',
                "Status: ",
                shipStatus == Status.Harvesting ? "Harvesting " : shipStatus == Status.Resting
                    ? "Resting at "
                    : "Sailing to ",
                currentTarget.tokenContract == address(settlementsContract) ? "S" : "I",
                Strings.toString(currentTarget.tokenId),
                '</text><text x="10" y="140" class="txt">',
                abi.encodePacked(
                    "ETA: ",
                    Strings.toString(getBlocksUntilNextPhase(shipInfo.tokenId)),
                    " blocks"
                ),
                '</text><text x="10" y="160" class="txt">',
                "Route: ",
                routeStr,
                abi.encodePacked(
                    '</text><text x="10" y="',
                    Strings.toString(svgY + 20),
                    '" class="txt">'
                ),
                "------------",
                abi.encodePacked(
                    '</text><text x="10" y="',
                    Strings.toString(svgY + 40),
                    '" class="txt">'
                )
            )
        );

        svgY += 40;
        Ships.TokenHarvest[] memory unharvestedTokens = getUnharvestedTokens(shipInfo.tokenId);
        string memory unharvestedTokenStr = "";
        for (uint256 i = 0; i < unharvestedTokens.length; i++) {
            string memory suffix = i == unharvestedTokens.length - 1 ? "" : ", ";
            unharvestedTokenStr = string(
                abi.encodePacked(
                    unharvestedTokenStr,
                    Strings.toString(unharvestedTokens[i].amount / ONE),
                    " $",
                    ERC20Mintable(unharvestedTokens[i].resourceTokenContract).symbol(),
                    suffix
                )
            );

            if ((i + 1) % 3 == 0) {
                svgY += 20;
                unharvestedTokenStr = string(
                    abi.encodePacked(
                        unharvestedTokenStr,
                        '</text><text x="10" y="',
                        Strings.toString(svgY),
                        '" class="txt">'
                    )
                );
            }
        }

        imageOutput = string(abi.encodePacked(imageOutput, unharvestedTokenStr, "</text></svg>"));

        return imageOutput;
    }

    function getAttrOutput(Ships.Ship memory shipInfo) public view returns (string memory) {
        string memory routeStr = "";
        for (uint256 i = 0; i < shipInfo.route.length; i++) {
            string memory symbol = shipInfo.route[i].tokenContract == address(settlementsContract)
                ? "S"
                : "I";

            string memory suffix = i == shipInfo.route.length - 1 ? "" : ",";

            routeStr = string(
                abi.encodePacked(
                    routeStr,
                    '"',
                    symbol,
                    Strings.toString(shipInfo.route[i].tokenId),
                    '"',
                    suffix
                )
            );
        }

        string memory attrOutput = string(
            abi.encodePacked(
                '[{ "trait_type": "Name", "value": "',
                shipInfo.name,
                '" }, { "trait_type": "Expedition", "value": "',
                shipInfo.expedition,
                '" }, { "trait_type": "Length (ft)", "display_type": "number", "value": ',
                Strings.toString(uint256(shipInfo.length)),
                ' }, { "trait_type": "Speed (km/h)", "display_type": "number", "value": ',
                Strings.toString(uint256(shipInfo.speed)),
                ' }, { "trait_type": "Trade Route", "value": [',
                routeStr,
                "]"
            )
        );

        attrOutput = string(abi.encodePacked(attrOutput, " }]"));

        return attrOutput;
    }

    function tokenURI(uint256 tokenId) external view returns (string memory) {
        Ships.Ship memory shipInfo = shipsContract.getShipInfo(tokenId);

        string memory imageOutput = getImageOutput(shipInfo);
        string memory attrOutput = getAttrOutput(shipInfo);

        string memory json = Base64.encode(
            bytes(
                string(
                    abi.encodePacked(
                        '{"name": "Ship #',
                        Strings.toString(tokenId),
                        '", "description": "Ships can sail around the Settlements world to trade, discover and attack. All data is onchain.", "image": "data:image/svg+xml;base64,',
                        Base64.encode(bytes(imageOutput)),
                        '", "attributes": ',
                        attrOutput,
                        "}"
                    )
                )
            )
        );

        return string(abi.encodePacked("data:application/json;base64,", json));
    }
}

File 29 of 29 : console.sol
// SPDX-License-Identifier: MIT
pragma solidity >= 0.4.22 <0.9.0;

library console {
	address constant CONSOLE_ADDRESS = address(0x000000000000000000636F6e736F6c652e6c6f67);

	function _sendLogPayload(bytes memory payload) private view {
		uint256 payloadLength = payload.length;
		address consoleAddress = CONSOLE_ADDRESS;
		assembly {
			let payloadStart := add(payload, 32)
			let r := staticcall(gas(), consoleAddress, payloadStart, payloadLength, 0, 0)
		}
	}

	function log() internal view {
		_sendLogPayload(abi.encodeWithSignature("log()"));
	}

	function logInt(int p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(int)", p0));
	}

	function logUint(uint p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint)", p0));
	}

	function logString(string memory p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string)", p0));
	}

	function logBool(bool p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool)", p0));
	}

	function logAddress(address p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address)", p0));
	}

	function logBytes(bytes memory p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bytes)", p0));
	}

	function logBytes1(bytes1 p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bytes1)", p0));
	}

	function logBytes2(bytes2 p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bytes2)", p0));
	}

	function logBytes3(bytes3 p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bytes3)", p0));
	}

	function logBytes4(bytes4 p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bytes4)", p0));
	}

	function logBytes5(bytes5 p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bytes5)", p0));
	}

	function logBytes6(bytes6 p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bytes6)", p0));
	}

	function logBytes7(bytes7 p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bytes7)", p0));
	}

	function logBytes8(bytes8 p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bytes8)", p0));
	}

	function logBytes9(bytes9 p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bytes9)", p0));
	}

	function logBytes10(bytes10 p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bytes10)", p0));
	}

	function logBytes11(bytes11 p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bytes11)", p0));
	}

	function logBytes12(bytes12 p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bytes12)", p0));
	}

	function logBytes13(bytes13 p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bytes13)", p0));
	}

	function logBytes14(bytes14 p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bytes14)", p0));
	}

	function logBytes15(bytes15 p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bytes15)", p0));
	}

	function logBytes16(bytes16 p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bytes16)", p0));
	}

	function logBytes17(bytes17 p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bytes17)", p0));
	}

	function logBytes18(bytes18 p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bytes18)", p0));
	}

	function logBytes19(bytes19 p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bytes19)", p0));
	}

	function logBytes20(bytes20 p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bytes20)", p0));
	}

	function logBytes21(bytes21 p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bytes21)", p0));
	}

	function logBytes22(bytes22 p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bytes22)", p0));
	}

	function logBytes23(bytes23 p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bytes23)", p0));
	}

	function logBytes24(bytes24 p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bytes24)", p0));
	}

	function logBytes25(bytes25 p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bytes25)", p0));
	}

	function logBytes26(bytes26 p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bytes26)", p0));
	}

	function logBytes27(bytes27 p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bytes27)", p0));
	}

	function logBytes28(bytes28 p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bytes28)", p0));
	}

	function logBytes29(bytes29 p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bytes29)", p0));
	}

	function logBytes30(bytes30 p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bytes30)", p0));
	}

	function logBytes31(bytes31 p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bytes31)", p0));
	}

	function logBytes32(bytes32 p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bytes32)", p0));
	}

	function log(uint p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint)", p0));
	}

	function log(string memory p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string)", p0));
	}

	function log(bool p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool)", p0));
	}

	function log(address p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address)", p0));
	}

	function log(uint p0, uint p1) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,uint)", p0, p1));
	}

	function log(uint p0, string memory p1) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,string)", p0, p1));
	}

	function log(uint p0, bool p1) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,bool)", p0, p1));
	}

	function log(uint p0, address p1) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,address)", p0, p1));
	}

	function log(string memory p0, uint p1) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,uint)", p0, p1));
	}

	function log(string memory p0, string memory p1) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,string)", p0, p1));
	}

	function log(string memory p0, bool p1) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,bool)", p0, p1));
	}

	function log(string memory p0, address p1) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,address)", p0, p1));
	}

	function log(bool p0, uint p1) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,uint)", p0, p1));
	}

	function log(bool p0, string memory p1) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,string)", p0, p1));
	}

	function log(bool p0, bool p1) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,bool)", p0, p1));
	}

	function log(bool p0, address p1) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,address)", p0, p1));
	}

	function log(address p0, uint p1) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,uint)", p0, p1));
	}

	function log(address p0, string memory p1) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,string)", p0, p1));
	}

	function log(address p0, bool p1) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,bool)", p0, p1));
	}

	function log(address p0, address p1) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,address)", p0, p1));
	}

	function log(uint p0, uint p1, uint p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,uint,uint)", p0, p1, p2));
	}

	function log(uint p0, uint p1, string memory p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,uint,string)", p0, p1, p2));
	}

	function log(uint p0, uint p1, bool p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,uint,bool)", p0, p1, p2));
	}

	function log(uint p0, uint p1, address p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,uint,address)", p0, p1, p2));
	}

	function log(uint p0, string memory p1, uint p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,string,uint)", p0, p1, p2));
	}

	function log(uint p0, string memory p1, string memory p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,string,string)", p0, p1, p2));
	}

	function log(uint p0, string memory p1, bool p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,string,bool)", p0, p1, p2));
	}

	function log(uint p0, string memory p1, address p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,string,address)", p0, p1, p2));
	}

	function log(uint p0, bool p1, uint p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,bool,uint)", p0, p1, p2));
	}

	function log(uint p0, bool p1, string memory p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,bool,string)", p0, p1, p2));
	}

	function log(uint p0, bool p1, bool p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,bool,bool)", p0, p1, p2));
	}

	function log(uint p0, bool p1, address p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,bool,address)", p0, p1, p2));
	}

	function log(uint p0, address p1, uint p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,address,uint)", p0, p1, p2));
	}

	function log(uint p0, address p1, string memory p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,address,string)", p0, p1, p2));
	}

	function log(uint p0, address p1, bool p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,address,bool)", p0, p1, p2));
	}

	function log(uint p0, address p1, address p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,address,address)", p0, p1, p2));
	}

	function log(string memory p0, uint p1, uint p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,uint,uint)", p0, p1, p2));
	}

	function log(string memory p0, uint p1, string memory p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,uint,string)", p0, p1, p2));
	}

	function log(string memory p0, uint p1, bool p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,uint,bool)", p0, p1, p2));
	}

	function log(string memory p0, uint p1, address p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,uint,address)", p0, p1, p2));
	}

	function log(string memory p0, string memory p1, uint p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,string,uint)", p0, p1, p2));
	}

	function log(string memory p0, string memory p1, string memory p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,string,string)", p0, p1, p2));
	}

	function log(string memory p0, string memory p1, bool p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,string,bool)", p0, p1, p2));
	}

	function log(string memory p0, string memory p1, address p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,string,address)", p0, p1, p2));
	}

	function log(string memory p0, bool p1, uint p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,bool,uint)", p0, p1, p2));
	}

	function log(string memory p0, bool p1, string memory p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,bool,string)", p0, p1, p2));
	}

	function log(string memory p0, bool p1, bool p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,bool,bool)", p0, p1, p2));
	}

	function log(string memory p0, bool p1, address p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,bool,address)", p0, p1, p2));
	}

	function log(string memory p0, address p1, uint p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,address,uint)", p0, p1, p2));
	}

	function log(string memory p0, address p1, string memory p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,address,string)", p0, p1, p2));
	}

	function log(string memory p0, address p1, bool p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,address,bool)", p0, p1, p2));
	}

	function log(string memory p0, address p1, address p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,address,address)", p0, p1, p2));
	}

	function log(bool p0, uint p1, uint p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,uint,uint)", p0, p1, p2));
	}

	function log(bool p0, uint p1, string memory p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,uint,string)", p0, p1, p2));
	}

	function log(bool p0, uint p1, bool p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,uint,bool)", p0, p1, p2));
	}

	function log(bool p0, uint p1, address p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,uint,address)", p0, p1, p2));
	}

	function log(bool p0, string memory p1, uint p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,string,uint)", p0, p1, p2));
	}

	function log(bool p0, string memory p1, string memory p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,string,string)", p0, p1, p2));
	}

	function log(bool p0, string memory p1, bool p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,string,bool)", p0, p1, p2));
	}

	function log(bool p0, string memory p1, address p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,string,address)", p0, p1, p2));
	}

	function log(bool p0, bool p1, uint p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint)", p0, p1, p2));
	}

	function log(bool p0, bool p1, string memory p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,bool,string)", p0, p1, p2));
	}

	function log(bool p0, bool p1, bool p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool)", p0, p1, p2));
	}

	function log(bool p0, bool p1, address p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,bool,address)", p0, p1, p2));
	}

	function log(bool p0, address p1, uint p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,address,uint)", p0, p1, p2));
	}

	function log(bool p0, address p1, string memory p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,address,string)", p0, p1, p2));
	}

	function log(bool p0, address p1, bool p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,address,bool)", p0, p1, p2));
	}

	function log(bool p0, address p1, address p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,address,address)", p0, p1, p2));
	}

	function log(address p0, uint p1, uint p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,uint,uint)", p0, p1, p2));
	}

	function log(address p0, uint p1, string memory p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,uint,string)", p0, p1, p2));
	}

	function log(address p0, uint p1, bool p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,uint,bool)", p0, p1, p2));
	}

	function log(address p0, uint p1, address p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,uint,address)", p0, p1, p2));
	}

	function log(address p0, string memory p1, uint p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,string,uint)", p0, p1, p2));
	}

	function log(address p0, string memory p1, string memory p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,string,string)", p0, p1, p2));
	}

	function log(address p0, string memory p1, bool p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,string,bool)", p0, p1, p2));
	}

	function log(address p0, string memory p1, address p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,string,address)", p0, p1, p2));
	}

	function log(address p0, bool p1, uint p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,bool,uint)", p0, p1, p2));
	}

	function log(address p0, bool p1, string memory p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,bool,string)", p0, p1, p2));
	}

	function log(address p0, bool p1, bool p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,bool,bool)", p0, p1, p2));
	}

	function log(address p0, bool p1, address p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,bool,address)", p0, p1, p2));
	}

	function log(address p0, address p1, uint p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,address,uint)", p0, p1, p2));
	}

	function log(address p0, address p1, string memory p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,address,string)", p0, p1, p2));
	}

	function log(address p0, address p1, bool p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,address,bool)", p0, p1, p2));
	}

	function log(address p0, address p1, address p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,address,address)", p0, p1, p2));
	}

	function log(uint p0, uint p1, uint p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,uint,uint,uint)", p0, p1, p2, p3));
	}

	function log(uint p0, uint p1, uint p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,uint,uint,string)", p0, p1, p2, p3));
	}

	function log(uint p0, uint p1, uint p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,uint,uint,bool)", p0, p1, p2, p3));
	}

	function log(uint p0, uint p1, uint p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,uint,uint,address)", p0, p1, p2, p3));
	}

	function log(uint p0, uint p1, string memory p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,uint,string,uint)", p0, p1, p2, p3));
	}

	function log(uint p0, uint p1, string memory p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,uint,string,string)", p0, p1, p2, p3));
	}

	function log(uint p0, uint p1, string memory p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,uint,string,bool)", p0, p1, p2, p3));
	}

	function log(uint p0, uint p1, string memory p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,uint,string,address)", p0, p1, p2, p3));
	}

	function log(uint p0, uint p1, bool p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,uint,bool,uint)", p0, p1, p2, p3));
	}

	function log(uint p0, uint p1, bool p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,uint,bool,string)", p0, p1, p2, p3));
	}

	function log(uint p0, uint p1, bool p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,uint,bool,bool)", p0, p1, p2, p3));
	}

	function log(uint p0, uint p1, bool p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,uint,bool,address)", p0, p1, p2, p3));
	}

	function log(uint p0, uint p1, address p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,uint,address,uint)", p0, p1, p2, p3));
	}

	function log(uint p0, uint p1, address p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,uint,address,string)", p0, p1, p2, p3));
	}

	function log(uint p0, uint p1, address p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,uint,address,bool)", p0, p1, p2, p3));
	}

	function log(uint p0, uint p1, address p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,uint,address,address)", p0, p1, p2, p3));
	}

	function log(uint p0, string memory p1, uint p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,string,uint,uint)", p0, p1, p2, p3));
	}

	function log(uint p0, string memory p1, uint p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,string,uint,string)", p0, p1, p2, p3));
	}

	function log(uint p0, string memory p1, uint p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,string,uint,bool)", p0, p1, p2, p3));
	}

	function log(uint p0, string memory p1, uint p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,string,uint,address)", p0, p1, p2, p3));
	}

	function log(uint p0, string memory p1, string memory p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,string,string,uint)", p0, p1, p2, p3));
	}

	function log(uint p0, string memory p1, string memory p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,string,string,string)", p0, p1, p2, p3));
	}

	function log(uint p0, string memory p1, string memory p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,string,string,bool)", p0, p1, p2, p3));
	}

	function log(uint p0, string memory p1, string memory p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,string,string,address)", p0, p1, p2, p3));
	}

	function log(uint p0, string memory p1, bool p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,string,bool,uint)", p0, p1, p2, p3));
	}

	function log(uint p0, string memory p1, bool p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,string,bool,string)", p0, p1, p2, p3));
	}

	function log(uint p0, string memory p1, bool p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,string,bool,bool)", p0, p1, p2, p3));
	}

	function log(uint p0, string memory p1, bool p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,string,bool,address)", p0, p1, p2, p3));
	}

	function log(uint p0, string memory p1, address p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,string,address,uint)", p0, p1, p2, p3));
	}

	function log(uint p0, string memory p1, address p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,string,address,string)", p0, p1, p2, p3));
	}

	function log(uint p0, string memory p1, address p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,string,address,bool)", p0, p1, p2, p3));
	}

	function log(uint p0, string memory p1, address p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,string,address,address)", p0, p1, p2, p3));
	}

	function log(uint p0, bool p1, uint p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,bool,uint,uint)", p0, p1, p2, p3));
	}

	function log(uint p0, bool p1, uint p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,bool,uint,string)", p0, p1, p2, p3));
	}

	function log(uint p0, bool p1, uint p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,bool,uint,bool)", p0, p1, p2, p3));
	}

	function log(uint p0, bool p1, uint p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,bool,uint,address)", p0, p1, p2, p3));
	}

	function log(uint p0, bool p1, string memory p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,bool,string,uint)", p0, p1, p2, p3));
	}

	function log(uint p0, bool p1, string memory p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,bool,string,string)", p0, p1, p2, p3));
	}

	function log(uint p0, bool p1, string memory p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,bool,string,bool)", p0, p1, p2, p3));
	}

	function log(uint p0, bool p1, string memory p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,bool,string,address)", p0, p1, p2, p3));
	}

	function log(uint p0, bool p1, bool p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,bool,bool,uint)", p0, p1, p2, p3));
	}

	function log(uint p0, bool p1, bool p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,bool,bool,string)", p0, p1, p2, p3));
	}

	function log(uint p0, bool p1, bool p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,bool,bool,bool)", p0, p1, p2, p3));
	}

	function log(uint p0, bool p1, bool p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,bool,bool,address)", p0, p1, p2, p3));
	}

	function log(uint p0, bool p1, address p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,bool,address,uint)", p0, p1, p2, p3));
	}

	function log(uint p0, bool p1, address p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,bool,address,string)", p0, p1, p2, p3));
	}

	function log(uint p0, bool p1, address p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,bool,address,bool)", p0, p1, p2, p3));
	}

	function log(uint p0, bool p1, address p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,bool,address,address)", p0, p1, p2, p3));
	}

	function log(uint p0, address p1, uint p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,address,uint,uint)", p0, p1, p2, p3));
	}

	function log(uint p0, address p1, uint p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,address,uint,string)", p0, p1, p2, p3));
	}

	function log(uint p0, address p1, uint p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,address,uint,bool)", p0, p1, p2, p3));
	}

	function log(uint p0, address p1, uint p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,address,uint,address)", p0, p1, p2, p3));
	}

	function log(uint p0, address p1, string memory p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,address,string,uint)", p0, p1, p2, p3));
	}

	function log(uint p0, address p1, string memory p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,address,string,string)", p0, p1, p2, p3));
	}

	function log(uint p0, address p1, string memory p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,address,string,bool)", p0, p1, p2, p3));
	}

	function log(uint p0, address p1, string memory p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,address,string,address)", p0, p1, p2, p3));
	}

	function log(uint p0, address p1, bool p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,address,bool,uint)", p0, p1, p2, p3));
	}

	function log(uint p0, address p1, bool p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,address,bool,string)", p0, p1, p2, p3));
	}

	function log(uint p0, address p1, bool p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,address,bool,bool)", p0, p1, p2, p3));
	}

	function log(uint p0, address p1, bool p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,address,bool,address)", p0, p1, p2, p3));
	}

	function log(uint p0, address p1, address p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,address,address,uint)", p0, p1, p2, p3));
	}

	function log(uint p0, address p1, address p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,address,address,string)", p0, p1, p2, p3));
	}

	function log(uint p0, address p1, address p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,address,address,bool)", p0, p1, p2, p3));
	}

	function log(uint p0, address p1, address p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,address,address,address)", p0, p1, p2, p3));
	}

	function log(string memory p0, uint p1, uint p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,uint,uint,uint)", p0, p1, p2, p3));
	}

	function log(string memory p0, uint p1, uint p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,uint,uint,string)", p0, p1, p2, p3));
	}

	function log(string memory p0, uint p1, uint p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,uint,uint,bool)", p0, p1, p2, p3));
	}

	function log(string memory p0, uint p1, uint p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,uint,uint,address)", p0, p1, p2, p3));
	}

	function log(string memory p0, uint p1, string memory p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,uint,string,uint)", p0, p1, p2, p3));
	}

	function log(string memory p0, uint p1, string memory p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,uint,string,string)", p0, p1, p2, p3));
	}

	function log(string memory p0, uint p1, string memory p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,uint,string,bool)", p0, p1, p2, p3));
	}

	function log(string memory p0, uint p1, string memory p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,uint,string,address)", p0, p1, p2, p3));
	}

	function log(string memory p0, uint p1, bool p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,uint,bool,uint)", p0, p1, p2, p3));
	}

	function log(string memory p0, uint p1, bool p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,uint,bool,string)", p0, p1, p2, p3));
	}

	function log(string memory p0, uint p1, bool p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,uint,bool,bool)", p0, p1, p2, p3));
	}

	function log(string memory p0, uint p1, bool p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,uint,bool,address)", p0, p1, p2, p3));
	}

	function log(string memory p0, uint p1, address p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,uint,address,uint)", p0, p1, p2, p3));
	}

	function log(string memory p0, uint p1, address p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,uint,address,string)", p0, p1, p2, p3));
	}

	function log(string memory p0, uint p1, address p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,uint,address,bool)", p0, p1, p2, p3));
	}

	function log(string memory p0, uint p1, address p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,uint,address,address)", p0, p1, p2, p3));
	}

	function log(string memory p0, string memory p1, uint p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,string,uint,uint)", p0, p1, p2, p3));
	}

	function log(string memory p0, string memory p1, uint p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,string,uint,string)", p0, p1, p2, p3));
	}

	function log(string memory p0, string memory p1, uint p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,string,uint,bool)", p0, p1, p2, p3));
	}

	function log(string memory p0, string memory p1, uint p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,string,uint,address)", p0, p1, p2, p3));
	}

	function log(string memory p0, string memory p1, string memory p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,string,string,uint)", p0, p1, p2, p3));
	}

	function log(string memory p0, string memory p1, string memory p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,string,string,string)", p0, p1, p2, p3));
	}

	function log(string memory p0, string memory p1, string memory p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,string,string,bool)", p0, p1, p2, p3));
	}

	function log(string memory p0, string memory p1, string memory p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,string,string,address)", p0, p1, p2, p3));
	}

	function log(string memory p0, string memory p1, bool p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,string,bool,uint)", p0, p1, p2, p3));
	}

	function log(string memory p0, string memory p1, bool p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,string,bool,string)", p0, p1, p2, p3));
	}

	function log(string memory p0, string memory p1, bool p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,string,bool,bool)", p0, p1, p2, p3));
	}

	function log(string memory p0, string memory p1, bool p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,string,bool,address)", p0, p1, p2, p3));
	}

	function log(string memory p0, string memory p1, address p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,string,address,uint)", p0, p1, p2, p3));
	}

	function log(string memory p0, string memory p1, address p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,string,address,string)", p0, p1, p2, p3));
	}

	function log(string memory p0, string memory p1, address p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,string,address,bool)", p0, p1, p2, p3));
	}

	function log(string memory p0, string memory p1, address p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,string,address,address)", p0, p1, p2, p3));
	}

	function log(string memory p0, bool p1, uint p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,bool,uint,uint)", p0, p1, p2, p3));
	}

	function log(string memory p0, bool p1, uint p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,bool,uint,string)", p0, p1, p2, p3));
	}

	function log(string memory p0, bool p1, uint p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,bool,uint,bool)", p0, p1, p2, p3));
	}

	function log(string memory p0, bool p1, uint p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,bool,uint,address)", p0, p1, p2, p3));
	}

	function log(string memory p0, bool p1, string memory p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,bool,string,uint)", p0, p1, p2, p3));
	}

	function log(string memory p0, bool p1, string memory p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,bool,string,string)", p0, p1, p2, p3));
	}

	function log(string memory p0, bool p1, string memory p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,bool,string,bool)", p0, p1, p2, p3));
	}

	function log(string memory p0, bool p1, string memory p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,bool,string,address)", p0, p1, p2, p3));
	}

	function log(string memory p0, bool p1, bool p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,bool,bool,uint)", p0, p1, p2, p3));
	}

	function log(string memory p0, bool p1, bool p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,bool,bool,string)", p0, p1, p2, p3));
	}

	function log(string memory p0, bool p1, bool p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,bool,bool,bool)", p0, p1, p2, p3));
	}

	function log(string memory p0, bool p1, bool p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,bool,bool,address)", p0, p1, p2, p3));
	}

	function log(string memory p0, bool p1, address p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,bool,address,uint)", p0, p1, p2, p3));
	}

	function log(string memory p0, bool p1, address p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,bool,address,string)", p0, p1, p2, p3));
	}

	function log(string memory p0, bool p1, address p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,bool,address,bool)", p0, p1, p2, p3));
	}

	function log(string memory p0, bool p1, address p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,bool,address,address)", p0, p1, p2, p3));
	}

	function log(string memory p0, address p1, uint p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,address,uint,uint)", p0, p1, p2, p3));
	}

	function log(string memory p0, address p1, uint p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,address,uint,string)", p0, p1, p2, p3));
	}

	function log(string memory p0, address p1, uint p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,address,uint,bool)", p0, p1, p2, p3));
	}

	function log(string memory p0, address p1, uint p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,address,uint,address)", p0, p1, p2, p3));
	}

	function log(string memory p0, address p1, string memory p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,address,string,uint)", p0, p1, p2, p3));
	}

	function log(string memory p0, address p1, string memory p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,address,string,string)", p0, p1, p2, p3));
	}

	function log(string memory p0, address p1, string memory p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,address,string,bool)", p0, p1, p2, p3));
	}

	function log(string memory p0, address p1, string memory p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,address,string,address)", p0, p1, p2, p3));
	}

	function log(string memory p0, address p1, bool p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,address,bool,uint)", p0, p1, p2, p3));
	}

	function log(string memory p0, address p1, bool p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,address,bool,string)", p0, p1, p2, p3));
	}

	function log(string memory p0, address p1, bool p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,address,bool,bool)", p0, p1, p2, p3));
	}

	function log(string memory p0, address p1, bool p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,address,bool,address)", p0, p1, p2, p3));
	}

	function log(string memory p0, address p1, address p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,address,address,uint)", p0, p1, p2, p3));
	}

	function log(string memory p0, address p1, address p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,address,address,string)", p0, p1, p2, p3));
	}

	function log(string memory p0, address p1, address p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,address,address,bool)", p0, p1, p2, p3));
	}

	function log(string memory p0, address p1, address p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,address,address,address)", p0, p1, p2, p3));
	}

	function log(bool p0, uint p1, uint p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,uint,uint,uint)", p0, p1, p2, p3));
	}

	function log(bool p0, uint p1, uint p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,uint,uint,string)", p0, p1, p2, p3));
	}

	function log(bool p0, uint p1, uint p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,uint,uint,bool)", p0, p1, p2, p3));
	}

	function log(bool p0, uint p1, uint p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,uint,uint,address)", p0, p1, p2, p3));
	}

	function log(bool p0, uint p1, string memory p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,uint,string,uint)", p0, p1, p2, p3));
	}

	function log(bool p0, uint p1, string memory p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,uint,string,string)", p0, p1, p2, p3));
	}

	function log(bool p0, uint p1, string memory p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,uint,string,bool)", p0, p1, p2, p3));
	}

	function log(bool p0, uint p1, string memory p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,uint,string,address)", p0, p1, p2, p3));
	}

	function log(bool p0, uint p1, bool p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,uint,bool,uint)", p0, p1, p2, p3));
	}

	function log(bool p0, uint p1, bool p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,uint,bool,string)", p0, p1, p2, p3));
	}

	function log(bool p0, uint p1, bool p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,uint,bool,bool)", p0, p1, p2, p3));
	}

	function log(bool p0, uint p1, bool p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,uint,bool,address)", p0, p1, p2, p3));
	}

	function log(bool p0, uint p1, address p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,uint,address,uint)", p0, p1, p2, p3));
	}

	function log(bool p0, uint p1, address p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,uint,address,string)", p0, p1, p2, p3));
	}

	function log(bool p0, uint p1, address p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,uint,address,bool)", p0, p1, p2, p3));
	}

	function log(bool p0, uint p1, address p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,uint,address,address)", p0, p1, p2, p3));
	}

	function log(bool p0, string memory p1, uint p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,string,uint,uint)", p0, p1, p2, p3));
	}

	function log(bool p0, string memory p1, uint p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,string,uint,string)", p0, p1, p2, p3));
	}

	function log(bool p0, string memory p1, uint p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,string,uint,bool)", p0, p1, p2, p3));
	}

	function log(bool p0, string memory p1, uint p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,string,uint,address)", p0, p1, p2, p3));
	}

	function log(bool p0, string memory p1, string memory p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,string,string,uint)", p0, p1, p2, p3));
	}

	function log(bool p0, string memory p1, string memory p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,string,string,string)", p0, p1, p2, p3));
	}

	function log(bool p0, string memory p1, string memory p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,string,string,bool)", p0, p1, p2, p3));
	}

	function log(bool p0, string memory p1, string memory p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,string,string,address)", p0, p1, p2, p3));
	}

	function log(bool p0, string memory p1, bool p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,string,bool,uint)", p0, p1, p2, p3));
	}

	function log(bool p0, string memory p1, bool p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,string,bool,string)", p0, p1, p2, p3));
	}

	function log(bool p0, string memory p1, bool p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,string,bool,bool)", p0, p1, p2, p3));
	}

	function log(bool p0, string memory p1, bool p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,string,bool,address)", p0, p1, p2, p3));
	}

	function log(bool p0, string memory p1, address p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,string,address,uint)", p0, p1, p2, p3));
	}

	function log(bool p0, string memory p1, address p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,string,address,string)", p0, p1, p2, p3));
	}

	function log(bool p0, string memory p1, address p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,string,address,bool)", p0, p1, p2, p3));
	}

	function log(bool p0, string memory p1, address p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,string,address,address)", p0, p1, p2, p3));
	}

	function log(bool p0, bool p1, uint p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint,uint)", p0, p1, p2, p3));
	}

	function log(bool p0, bool p1, uint p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint,string)", p0, p1, p2, p3));
	}

	function log(bool p0, bool p1, uint p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint,bool)", p0, p1, p2, p3));
	}

	function log(bool p0, bool p1, uint p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint,address)", p0, p1, p2, p3));
	}

	function log(bool p0, bool p1, string memory p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,bool,string,uint)", p0, p1, p2, p3));
	}

	function log(bool p0, bool p1, string memory p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,bool,string,string)", p0, p1, p2, p3));
	}

	function log(bool p0, bool p1, string memory p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,bool,string,bool)", p0, p1, p2, p3));
	}

	function log(bool p0, bool p1, string memory p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,bool,string,address)", p0, p1, p2, p3));
	}

	function log(bool p0, bool p1, bool p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool,uint)", p0, p1, p2, p3));
	}

	function log(bool p0, bool p1, bool p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool,string)", p0, p1, p2, p3));
	}

	function log(bool p0, bool p1, bool p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool,bool)", p0, p1, p2, p3));
	}

	function log(bool p0, bool p1, bool p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool,address)", p0, p1, p2, p3));
	}

	function log(bool p0, bool p1, address p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,bool,address,uint)", p0, p1, p2, p3));
	}

	function log(bool p0, bool p1, address p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,bool,address,string)", p0, p1, p2, p3));
	}

	function log(bool p0, bool p1, address p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,bool,address,bool)", p0, p1, p2, p3));
	}

	function log(bool p0, bool p1, address p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,bool,address,address)", p0, p1, p2, p3));
	}

	function log(bool p0, address p1, uint p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,address,uint,uint)", p0, p1, p2, p3));
	}

	function log(bool p0, address p1, uint p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,address,uint,string)", p0, p1, p2, p3));
	}

	function log(bool p0, address p1, uint p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,address,uint,bool)", p0, p1, p2, p3));
	}

	function log(bool p0, address p1, uint p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,address,uint,address)", p0, p1, p2, p3));
	}

	function log(bool p0, address p1, string memory p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,address,string,uint)", p0, p1, p2, p3));
	}

	function log(bool p0, address p1, string memory p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,address,string,string)", p0, p1, p2, p3));
	}

	function log(bool p0, address p1, string memory p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,address,string,bool)", p0, p1, p2, p3));
	}

	function log(bool p0, address p1, string memory p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,address,string,address)", p0, p1, p2, p3));
	}

	function log(bool p0, address p1, bool p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,address,bool,uint)", p0, p1, p2, p3));
	}

	function log(bool p0, address p1, bool p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,address,bool,string)", p0, p1, p2, p3));
	}

	function log(bool p0, address p1, bool p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,address,bool,bool)", p0, p1, p2, p3));
	}

	function log(bool p0, address p1, bool p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,address,bool,address)", p0, p1, p2, p3));
	}

	function log(bool p0, address p1, address p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,address,address,uint)", p0, p1, p2, p3));
	}

	function log(bool p0, address p1, address p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,address,address,string)", p0, p1, p2, p3));
	}

	function log(bool p0, address p1, address p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,address,address,bool)", p0, p1, p2, p3));
	}

	function log(bool p0, address p1, address p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,address,address,address)", p0, p1, p2, p3));
	}

	function log(address p0, uint p1, uint p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,uint,uint,uint)", p0, p1, p2, p3));
	}

	function log(address p0, uint p1, uint p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,uint,uint,string)", p0, p1, p2, p3));
	}

	function log(address p0, uint p1, uint p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,uint,uint,bool)", p0, p1, p2, p3));
	}

	function log(address p0, uint p1, uint p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,uint,uint,address)", p0, p1, p2, p3));
	}

	function log(address p0, uint p1, string memory p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,uint,string,uint)", p0, p1, p2, p3));
	}

	function log(address p0, uint p1, string memory p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,uint,string,string)", p0, p1, p2, p3));
	}

	function log(address p0, uint p1, string memory p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,uint,string,bool)", p0, p1, p2, p3));
	}

	function log(address p0, uint p1, string memory p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,uint,string,address)", p0, p1, p2, p3));
	}

	function log(address p0, uint p1, bool p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,uint,bool,uint)", p0, p1, p2, p3));
	}

	function log(address p0, uint p1, bool p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,uint,bool,string)", p0, p1, p2, p3));
	}

	function log(address p0, uint p1, bool p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,uint,bool,bool)", p0, p1, p2, p3));
	}

	function log(address p0, uint p1, bool p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,uint,bool,address)", p0, p1, p2, p3));
	}

	function log(address p0, uint p1, address p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,uint,address,uint)", p0, p1, p2, p3));
	}

	function log(address p0, uint p1, address p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,uint,address,string)", p0, p1, p2, p3));
	}

	function log(address p0, uint p1, address p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,uint,address,bool)", p0, p1, p2, p3));
	}

	function log(address p0, uint p1, address p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,uint,address,address)", p0, p1, p2, p3));
	}

	function log(address p0, string memory p1, uint p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,string,uint,uint)", p0, p1, p2, p3));
	}

	function log(address p0, string memory p1, uint p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,string,uint,string)", p0, p1, p2, p3));
	}

	function log(address p0, string memory p1, uint p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,string,uint,bool)", p0, p1, p2, p3));
	}

	function log(address p0, string memory p1, uint p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,string,uint,address)", p0, p1, p2, p3));
	}

	function log(address p0, string memory p1, string memory p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,string,string,uint)", p0, p1, p2, p3));
	}

	function log(address p0, string memory p1, string memory p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,string,string,string)", p0, p1, p2, p3));
	}

	function log(address p0, string memory p1, string memory p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,string,string,bool)", p0, p1, p2, p3));
	}

	function log(address p0, string memory p1, string memory p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,string,string,address)", p0, p1, p2, p3));
	}

	function log(address p0, string memory p1, bool p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,string,bool,uint)", p0, p1, p2, p3));
	}

	function log(address p0, string memory p1, bool p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,string,bool,string)", p0, p1, p2, p3));
	}

	function log(address p0, string memory p1, bool p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,string,bool,bool)", p0, p1, p2, p3));
	}

	function log(address p0, string memory p1, bool p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,string,bool,address)", p0, p1, p2, p3));
	}

	function log(address p0, string memory p1, address p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,string,address,uint)", p0, p1, p2, p3));
	}

	function log(address p0, string memory p1, address p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,string,address,string)", p0, p1, p2, p3));
	}

	function log(address p0, string memory p1, address p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,string,address,bool)", p0, p1, p2, p3));
	}

	function log(address p0, string memory p1, address p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,string,address,address)", p0, p1, p2, p3));
	}

	function log(address p0, bool p1, uint p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,bool,uint,uint)", p0, p1, p2, p3));
	}

	function log(address p0, bool p1, uint p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,bool,uint,string)", p0, p1, p2, p3));
	}

	function log(address p0, bool p1, uint p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,bool,uint,bool)", p0, p1, p2, p3));
	}

	function log(address p0, bool p1, uint p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,bool,uint,address)", p0, p1, p2, p3));
	}

	function log(address p0, bool p1, string memory p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,bool,string,uint)", p0, p1, p2, p3));
	}

	function log(address p0, bool p1, string memory p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,bool,string,string)", p0, p1, p2, p3));
	}

	function log(address p0, bool p1, string memory p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,bool,string,bool)", p0, p1, p2, p3));
	}

	function log(address p0, bool p1, string memory p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,bool,string,address)", p0, p1, p2, p3));
	}

	function log(address p0, bool p1, bool p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,bool,bool,uint)", p0, p1, p2, p3));
	}

	function log(address p0, bool p1, bool p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,bool,bool,string)", p0, p1, p2, p3));
	}

	function log(address p0, bool p1, bool p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,bool,bool,bool)", p0, p1, p2, p3));
	}

	function log(address p0, bool p1, bool p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,bool,bool,address)", p0, p1, p2, p3));
	}

	function log(address p0, bool p1, address p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,bool,address,uint)", p0, p1, p2, p3));
	}

	function log(address p0, bool p1, address p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,bool,address,string)", p0, p1, p2, p3));
	}

	function log(address p0, bool p1, address p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,bool,address,bool)", p0, p1, p2, p3));
	}

	function log(address p0, bool p1, address p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,bool,address,address)", p0, p1, p2, p3));
	}

	function log(address p0, address p1, uint p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,address,uint,uint)", p0, p1, p2, p3));
	}

	function log(address p0, address p1, uint p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,address,uint,string)", p0, p1, p2, p3));
	}

	function log(address p0, address p1, uint p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,address,uint,bool)", p0, p1, p2, p3));
	}

	function log(address p0, address p1, uint p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,address,uint,address)", p0, p1, p2, p3));
	}

	function log(address p0, address p1, string memory p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,address,string,uint)", p0, p1, p2, p3));
	}

	function log(address p0, address p1, string memory p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,address,string,string)", p0, p1, p2, p3));
	}

	function log(address p0, address p1, string memory p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,address,string,bool)", p0, p1, p2, p3));
	}

	function log(address p0, address p1, string memory p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,address,string,address)", p0, p1, p2, p3));
	}

	function log(address p0, address p1, bool p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,address,bool,uint)", p0, p1, p2, p3));
	}

	function log(address p0, address p1, bool p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,address,bool,string)", p0, p1, p2, p3));
	}

	function log(address p0, address p1, bool p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,address,bool,bool)", p0, p1, p2, p3));
	}

	function log(address p0, address p1, bool p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,address,bool,address)", p0, p1, p2, p3));
	}

	function log(address p0, address p1, address p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,address,address,uint)", p0, p1, p2, p3));
	}

	function log(address p0, address p1, address p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,address,address,string)", p0, p1, p2, p3));
	}

	function log(address p0, address p1, address p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,address,address,bool)", p0, p1, p2, p3));
	}

	function log(address p0, address p1, address p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,address,address,address)", p0, p1, p2, p3));
	}

}

Settings
{
  "evmVersion": "istanbul",
  "libraries": {},
  "metadata": {
    "bytecodeHash": "ipfs",
    "useLiteralContent": true
  },
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "remappings": [],
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "abi"
      ]
    }
  }
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"contract ERC20Mintable","name":"goldTokenContract_","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"expeditions","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"seed","type":"bytes"},{"internalType":"uint256","name":"maxValue","type":"uint256"}],"name":"getRandomNumber","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getSailingDuration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getShipInfo","outputs":[{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"expedition","type":"string"},{"internalType":"uint32","name":"length","type":"uint32"},{"internalType":"uint32","name":"speed","type":"uint32"},{"components":[{"internalType":"address","name":"tokenContract","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"internalType":"struct Ships.Path[]","name":"route","type":"tuple[]"}],"internalType":"struct Ships.Ship","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getTokenIdToAttributes","outputs":[{"components":[{"internalType":"uint8","name":"name","type":"uint8"},{"internalType":"uint8","name":"expedition","type":"uint8"},{"internalType":"uint32","name":"length","type":"uint32"},{"internalType":"uint32","name":"speed","type":"uint32"}],"internalType":"struct Ships.Attributes","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getUnharvestedTokens","outputs":[{"components":[{"internalType":"address","name":"resourceTokenContract","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"internalType":"struct Ships.TokenHarvest[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"goldTokenContract","outputs":[{"internalType":"contract ERC20Mintable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"harvest","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"helperContract","outputs":[{"internalType":"contract ShipsHelper","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"lengthMultipliers","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"names","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"components":[{"internalType":"uint8","name":"name","type":"uint8"},{"internalType":"uint8","name":"expedition","type":"uint8"},{"internalType":"uint32","name":"length","type":"uint32"},{"internalType":"uint32","name":"speed","type":"uint32"}],"internalType":"struct Ships.Attributes","name":"attr","type":"tuple"},{"components":[{"internalType":"address","name":"tokenContract","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"internalType":"struct Ships.Path[]","name":"route","type":"tuple[]"}],"name":"permissionedMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"name","type":"uint8"}],"name":"purchaseShip","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract ShipsHelper","name":"helperContract_","type":"address"}],"name":"setHelperContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"maxPurchaseLimit_","type":"uint256"}],"name":"setMaxPurchaseLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"speedMultipliers","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"minter","type":"address"},{"internalType":"bool","name":"enabled","type":"bool"}],"name":"togglePermissionedMinter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokenIdToAttributes","outputs":[{"internalType":"uint8","name":"name","type":"uint8"},{"internalType":"uint8","name":"expedition","type":"uint8"},{"internalType":"uint32","name":"length","type":"uint32"},{"internalType":"uint32","name":"speed","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokenIdToLastRouteUpdate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokenIdToRoute","outputs":[{"internalType":"address","name":"tokenContract","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"tokenContract","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"internalType":"struct Ships.Path[]","name":"route","type":"tuple[]"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"updateRoute","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60056101208181526443616e6f6560d81b61014052608090815260086101609081526704c6f6e67736869760c41b6101805260a05260076101a08181526621b634b83832b960c91b6101c05260c0526101e09081526623b0b63632b7b760c91b6102005260e052610260604052600a6102209081526926b0b716b7b316bbb0b960b11b61024052610100526200009991600b919062000306565b506040805160e081018252600660a08201818152652a3930b232b960d11b60c084015282528251808401845260088082526722bc383637b932b960c11b60208381019190915280850192909252845180860186529283526550697261746560d01b838301528385019290925283518085018552828152674d696c697461727960c01b818301526060840152835180850190945290835267111a5c1b1bdb585d60c21b9083015260808101919091526200015790600c90600562000306565b506040805160a081018252600a81526014602082015260329181019190915260286060820181905260808201526200019490600d9060056200036a565b506040805160a0810182526005808252600a6020830181905292820192909252601e606082015260286080820152620001d191600e91906200036a565b506103e8601455612710601555348015620001eb57600080fd5b5060405162003cbd38038062003cbd8339810160408190526200020e9162000510565b6040805180820182526005815264536869707360d81b6020808301918252835180850190945260048452630534849560e41b908401528151919291620002579160009162000419565b5080516200026d90600190602084019062000419565b5050506200028a62000284620002b060201b60201c565b620002b4565b601080546001600160a01b0319166001600160a01b03929092169190911790556200057d565b3390565b600a80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b82805482825590600052602060002090810192821562000358579160200282015b828111156200035857825180516200034791849160209091019062000419565b509160200191906001019062000327565b506200036692915062000496565b5090565b828054828255906000526020600020906007016008900481019282156200040b5791602002820160005b83821115620003d757835183826101000a81548163ffffffff021916908360ff160217905550926020019260040160208160030104928301926001030262000394565b8015620004095782816101000a81549063ffffffff0219169055600401602081600301049283019260010302620003d7565b505b5062000366929150620004b7565b828054620004279062000540565b90600052602060002090601f0160209004810192826200044b57600085556200040b565b82601f106200046657805160ff19168380011785556200040b565b828001600101855582156200040b579182015b828111156200040b57825182559160200191906001019062000479565b8082111562000366576000620004ad8282620004ce565b5060010162000496565b5b80821115620003665760008155600101620004b8565b508054620004dc9062000540565b6000825580601f10620004ed575050565b601f0160209004906000526020600020908101906200050d9190620004b7565b50565b60006020828403121562000522578081fd5b81516001600160a01b038116811462000539578182fd5b9392505050565b600181811c908216806200055557607f821691505b602082108114156200057757634e487b7160e01b600052602260045260246000fd5b50919050565b613730806200058d6000396000f3fe608060405234801561001057600080fd5b50600436106102535760003560e01c8063521e8749116101465780639bb8e4c4116100c3578063c5639cc611610087578063c5639cc614610682578063c87b56dd14610695578063d03cea6d146106a8578063ddc63262146106bb578063e985e9c5146106ce578063f2fde38b1461070a57600080fd5b80639bb8e4c414610623578063a0712d6814610636578063a22cb46514610649578063a5dc9e1b1461065c578063b88d4fde1461066f57600080fd5b80637d7f78401161010a5780637d7f7840146105c45780638c1d808c146105e45780638da5cb5b146105f757806395d89b4114610608578063965eb54a1461061057600080fd5b8063521e87491461049a5780636352211e1461056457806370a0823114610577578063715018a61461058a5780637ae349d01461059257600080fd5b80631fcefbfc116101d457806342842e0e1161019857806342842e0e1461042657806343e4abbd1461043957806345e313aa146104615780634622ab03146104745780634f6ccce71461048757600080fd5b80631fcefbfc146103ba57806323b872dd146103cd5780632f745c59146103e0578063367668d4146103f35780633f6fc50b1461041357600080fd5b8063095ea7b31161021b578063095ea7b3146103035780631177f3791461031657806314a327501461038c578063151895551461039f57806318160ddd146103b257600080fd5b806301cc05691461025857806301ffc9a71461026d578063038053e21461029557806306fdde03146102c3578063081812fc146102d8575b600080fd5b61026b6102663660046130d2565b61071d565b005b61028061027b366004612fc3565b61087f565b60405190151581526020015b60405180910390f35b6102b56102a33660046130a2565b60136020526000908152604090205481565b60405190815260200161028c565b6102cb610890565b60405161028c9190613328565b6102eb6102e63660046130a2565b610922565b6040516001600160a01b03909116815260200161028c565b61026b610311366004612e0d565b6109aa565b61035b6103243660046130a2565b60116020526000908152604090205460ff8082169161010081049091169063ffffffff620100008204811691600160301b90041684565b6040805160ff958616815294909316602085015263ffffffff9182169284019290925216606082015260800161028c565b6102cb61039a3660046130a2565b610abb565b6102b56103ad3660046130a2565b610b67565b6008546102b5565b61026b6103c8366004612de0565b610bfb565b61026b6103db366004612d36565b610c50565b6102b56103ee366004612e0d565b610c81565b6104066104013660046130a2565b610d17565b60405161028c9190613413565b61026b6104213660046131b4565b611047565b61026b610434366004612d36565b611248565b61044c6104473660046130a2565b611263565b60405163ffffffff909116815260200161028c565b61026b61046f3660046130a2565b61129d565b6102cb6104823660046130a2565b6112cc565b6102b56104953660046130a2565b6112dc565b61051a6104a83660046130a2565b604080516080808201835260008083526020808401829052838501829052606093840182905294815260118552839020835191820184525460ff80821683526101008204169482019490945263ffffffff620100008504811693820193909352600160301b9093049091169082015290565b60405161028c9190600060808201905060ff835116825260ff6020840151166020830152604083015163ffffffff8082166040850152806060860151166060850152505092915050565b6102eb6105723660046130a2565b61137d565b6102b5610585366004612cc6565b6113f4565b61026b61147b565b6105a56105a0366004613193565b6114b1565b604080516001600160a01b03909316835260208301919091520161028c565b6105d76105d23660046130a2565b6114f7565b60405161028c91906132c8565b6102b56105f2366004612ffb565b611578565b600a546001600160a01b03166102eb565b6102cb6115af565b61044c61061e3660046130a2565b6115be565b61026b610631366004612ed4565b6115ce565b61026b6106443660046130a2565b6115da565b61026b610657366004612de0565b611710565b600f546102eb906001600160a01b031681565b61026b61067d366004612d76565b6117d5565b61026b610690366004612cc6565b61180d565b6102cb6106a33660046130a2565b611859565b6010546102eb906001600160a01b031681565b61026b6106c93660046130a2565b6118da565b6102806106dc366004612cfe565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b61026b610718366004612cc6565b611b24565b3360009081526016602052604090205460ff1661078b5760405162461bcd60e51b815260206004820152602160248201527f596f7520617265206e6f742061207065726d697373696f6e6564206d696e74656044820152603960f91b60648201526084015b60405180910390fd5b61079483611bbf565b156107ed5760405162461bcd60e51b8152602060048201526024808201527f43616e2774206d696e7420746f6b656e207468617420616c72656164792065786044820152636973747360e01b6064820152608401610782565b600083815260116020908152604091829020845181549286015193860151606087015163ffffffff908116600160301b0269ffffffff000000000000199190921662010000021669ffffffffffffffff00001960ff9687166101000261ffff19909616969093169590951793909317169290921717905561087081846001611bdc565b61087a3384611d62565b505050565b600061088a82611d7c565b92915050565b60606000805461089f90613615565b80601f01602080910402602001604051908101604052809291908181526020018280546108cb90613615565b80156109185780601f106108ed57610100808354040283529160200191610918565b820191906000526020600020905b8154815290600101906020018083116108fb57829003601f168201915b5050505050905090565b600061092d82611bbf565b61098e5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610782565b506000908152600460205260409020546001600160a01b031690565b60006109b58261137d565b9050806001600160a01b0316836001600160a01b03161415610a235760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610782565b336001600160a01b0382161480610a3f5750610a3f81336106dc565b610ab15760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c00000000000000006064820152608401610782565b61087a8383611da1565b600c8181548110610acb57600080fd5b906000526020600020016000915090508054610ae690613615565b80601f0160208091040260200160405190810160405280929190818152602001828054610b1290613615565b8015610b5f5780601f10610b3457610100808354040283529160200191610b5f565b820191906000526020600020905b815481529060010190602001808311610b4257829003601f168201915b505050505081565b600080610b7383610d17565b600f5460405163524eaa7b60e11b81529192506001600160a01b03169063a49d54f690610ba4908490600401613413565b60206040518083038186803b158015610bbc57600080fd5b505afa158015610bd0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bf491906130ba565b9392505050565b600a546001600160a01b03163314610c255760405162461bcd60e51b81526004016107829061338d565b6001600160a01b03919091166000908152601660205260409020805460ff1916911515919091179055565b610c5a3382611e0f565b610c765760405162461bcd60e51b8152600401610782906133c2565b61087a838383611ef9565b6000610c8c836113f4565b8210610cee5760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b6064820152608401610782565b506001600160a01b03919091166000908152600660209081526040808320938352929052205490565b610d5c6040518060c00160405280600081526020016060815260200160608152602001600063ffffffff168152602001600063ffffffff168152602001606081525090565b610d6582611bbf565b610dbd5760405162461bcd60e51b8152602060048201526024808201527f536869702077697468207468617420746f6b656e496420646f65736e277420656044820152631e1a5cdd60e21b6064820152608401610782565b6000828152601160209081526040918290208251608081018452905460ff8082168352610100820481168385015263ffffffff620100008304811684870152600160301b9092049091166060830152835160c081019094528584528151600b8054939594850193909291909116908110610e4757634e487b7160e01b600052603260045260246000fd5b906000526020600020018054610e5c90613615565b80601f0160208091040260200160405190810160405280929190818152602001828054610e8890613615565b8015610ed55780601f10610eaa57610100808354040283529160200191610ed5565b820191906000526020600020905b815481529060010190602001808311610eb857829003601f168201915b50505050508152602001600c836020015160ff1681548110610f0757634e487b7160e01b600052603260045260246000fd5b906000526020600020018054610f1c90613615565b80601f0160208091040260200160405190810160405280929190818152602001828054610f4890613615565b8015610f955780601f10610f6a57610100808354040283529160200191610f95565b820191906000526020600020905b815481529060010190602001808311610f7857829003601f168201915b50505050508152602001826040015163ffffffff168152602001826060015163ffffffff16815260200160126000868152602001908152602001600020805480602002602001604051908101604052809291908181526020016000905b8282101561103a576000848152602090819020604080518082019091526002850290910180546001600160a01b03168252600190810154828401529083529092019101610ff2565b5050509152509392505050565b60155460145411156110af5760405162461bcd60e51b815260206004820152602b60248201527f4d6178696d756d20616d6f756e74206f6620736869707320686176652062656560448201526a1b881c1d5c98da185cd95960aa1b6064820152608401610782565b600f54604051631baf95cb60e11b815260ff831660048201526000916001600160a01b03169063375f2b969060240160006040518083038186803b1580156110f657600080fd5b505afa15801561110a573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526111329190810190612f17565b905060005b815181101561121d5781818151811061116057634e487b7160e01b600052603260045260246000fd5b6020026020010151600001516001600160a01b03166379cc67903384848151811061119b57634e487b7160e01b600052603260045260246000fd5b6020026020010151602001516040518363ffffffff1660e01b81526004016111d89291906001600160a01b03929092168252602082015260400190565b600060405180830381600087803b1580156111f257600080fd5b505af1158015611206573d6000803e3d6000fd5b50505050808061121590613650565b915050611137565b50600160146000828254611231919061353c565b92505081905550611244826014546120a4565b5050565b61087a838383604051806020016040528060008152506117d5565b600e818154811061127357600080fd5b9060005260206000209060089182820401919006600402915054906101000a900463ffffffff1681565b600a546001600160a01b031633146112c75760405162461bcd60e51b81526004016107829061338d565b601555565b600b8181548110610acb57600080fd5b60006112e760085490565b821061134a5760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b6064820152608401610782565b6008828154811061136b57634e487b7160e01b600052603260045260246000fd5b90600052602060002001549050919050565b6000818152600260205260408120546001600160a01b03168061088a5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b6064820152608401610782565b60006001600160a01b03821661145f5760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b6064820152608401610782565b506001600160a01b031660009081526003602052604090205490565b600a546001600160a01b031633146114a55760405162461bcd60e51b81526004016107829061338d565b6114af6000612565565b565b601260205281600052604060002081815481106114cd57600080fd5b6000918252602090912060029091020180546001909101546001600160a01b039091169250905082565b600f546040516301f5fde160e61b8152600481018390526060916001600160a01b031690637d7f78409060240160006040518083038186803b15801561153c57600080fd5b505afa158015611550573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261088a9190810190612f17565b6000818360405160200161158c9190613328565b6040516020818303038152906040528051906020012060001c610bf4919061366b565b60606001805461089f90613615565b600d818154811061127357600080fd5b61124482826000611bdc565b6115e381611bbf565b156116305760405162461bcd60e51b815260206004820181905260248201527f536869702077697468207468617420696420616c7265616479206578697374736044820152606401610782565b6103e78111156116775760405162461bcd60e51b815260206004820152601260248201527114da1a5c081a59081a5cc81a5b9d985b1a5960721b6044820152606401610782565b60006116c882426040516020016116b1929190918252606060208301819052600190830152603760f91b6080830152604082015260a00190565b6040516020818303038152906040526103e8611578565b9050600061038482106116f9576103b682106116ee576116e960058361366b565b611704565b6116e960048361366b565b61170460038361366b565b905061087a81846120a4565b6001600160a01b0382163314156117695760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610782565b3360008181526005602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6117df3383611e0f565b6117fb5760405162461bcd60e51b8152600401610782906133c2565b611807848484846125b7565b50505050565b600a546001600160a01b031633146118375760405162461bcd60e51b81526004016107829061338d565b600f80546001600160a01b0319166001600160a01b0392909216919091179055565b600f5460405163c87b56dd60e01b8152600481018390526060916001600160a01b03169063c87b56dd9060240160006040518083038186803b15801561189e57600080fd5b505afa1580156118b2573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261088a919081019061302f565b60006118e5826114f7565b6000838152601360205260408120439055909150805b8251811015611a385782818151811061192457634e487b7160e01b600052603260045260246000fd5b6020026020010151600001516001600160a01b03166340c10f196119478661137d565b85848151811061196757634e487b7160e01b600052603260045260246000fd5b6020026020010151602001516040518363ffffffff1660e01b81526004016119a49291906001600160a01b03929092168252602082015260400190565b600060405180830381600087803b1580156119be57600080fd5b505af11580156119d2573d6000803e3d6000fd5b5050505060648382815181106119f857634e487b7160e01b600052603260045260246000fd5b6020026020010151602001516006611a1091906135b3565b611a1a919061357c565b611a24908361353c565b915080611a3081613650565b9150506118fb565b50600f54604051632771008160e11b8152600481018590526000916001600160a01b031690634ee201029060240160206040518083038186803b158015611a7e57600080fd5b505afa158015611a92573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ab69190612ce2565b6010546040516340c10f1960e01b81526001600160a01b038084166004830152602482018690529293509116906340c10f1990604401600060405180830381600087803b158015611b0657600080fd5b505af1158015611b1a573d6000803e3d6000fd5b5050505050505050565b600a546001600160a01b03163314611b4e5760405162461bcd60e51b81526004016107829061338d565b6001600160a01b038116611bb35760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610782565b611bbc81612565565b50565b6000908152600260205260409020546001600160a01b0316151590565b600f5460405163a290d5ff60e01b81526001600160a01b039091169063a290d5ff90611c1290869086903390879060040161328e565b60206040518083038186803b158015611c2a57600080fd5b505afa158015611c3e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c629190612fa7565b611c9e5760405162461bcd60e51b815260206004820152600d60248201526c496e76616c696420726f75746560981b6044820152606401610782565b6000828152601260205260408120611cb591612b36565b60005b8351811015611d4c5760008381526012602052604090208451859083908110611cf157634e487b7160e01b600052603260045260246000fd5b602090810291909101810151825460018082018555600094855293839020825160029092020180546001600160a01b0319166001600160a01b0390921691909117815591015191015580611d4481613650565b915050611cb8565b5050600090815260136020526040902043905550565b6112448282604051806020016040528060008152506125ea565b60006001600160e01b0319821663780e9d6360e01b148061088a575061088a8261261d565b600081815260046020526040902080546001600160a01b0319166001600160a01b0384169081179091558190611dd68261137d565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000611e1a82611bbf565b611e7b5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610782565b6000611e868361137d565b9050806001600160a01b0316846001600160a01b03161480611ec15750836001600160a01b0316611eb684610922565b6001600160a01b0316145b80611ef157506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b949350505050565b826001600160a01b0316611f0c8261137d565b6001600160a01b031614611f745760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201526839903737ba1037bbb760b91b6064820152608401610782565b6001600160a01b038216611fd65760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610782565b611fe183838361266d565b611fec600082611da1565b6001600160a01b03831660009081526003602052604081208054600192906120159084906135d2565b90915550506001600160a01b038216600090815260036020526040812080546001929061204390849061353c565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b60408051608081018252600080825260208201819052918101829052606081019190915260ff8316815260408051602081018490528082019190915260016060820152606360f81b60808201526000906121009060a0016116b1565b905061210d60058261366b565b60ff16602083810191909152604080519182018590528181015260016060820152601b60fa1b60808201526121559060a0016040516020818303038152906040526032611578565b9050600a600e836000015160ff168154811061218157634e487b7160e01b600052603260045260246000fd5b6000918252602090912060088204015460079091166004026101000a900463ffffffff166121b083600161353c565b6121ba91906135b3565b6121c49190613590565b6121cf906002613554565b63ffffffff1660408301528151600e8054909160ff1690811061220257634e487b7160e01b600052603260045260246000fd5b90600052602060002090600891828204019190066004029054906101000a900463ffffffff1663ffffffff16826040015163ffffffff1610612248578160400151612297565b600e826000015160ff168154811061227057634e487b7160e01b600052603260045260246000fd5b90600052602060002090600891828204019190066004029054906101000a900463ffffffff165b63ffffffff166040838101919091528051602081018590528082019190915260016060820152607360f81b60808201526122e49060a0016040516020818303038152906040526064611578565b90506064600d836000015160ff168154811061231057634e487b7160e01b600052603260045260246000fd5b6000918252602090912060088204015460079091166004026101000a900463ffffffff1661233f83600161353c565b61234991906135b3565b6123539190613590565b61235e906002613554565b63ffffffff1660608301528151600d805460029260ff1690811061239257634e487b7160e01b600052603260045260246000fd5b90600052602060002090600891828204019190066004029054906101000a900463ffffffff166123c29190613590565b63ffffffff16826060015163ffffffff16106123e257816060015161243c565b6002600d836000015160ff168154811061240c57634e487b7160e01b600052603260045260246000fd5b90600052602060002090600891828204019190066004029054906101000a900463ffffffff1661243c9190613590565b63ffffffff9081166060840190815260008581526011602090815260409182902086518154928801518489015195518716600160301b0269ffffffff000000000000199690971662010000029590951669ffffffffffffffff00001960ff9687166101000261ffff199095169683169690961793909317949094169190911793909317909255600f5491516318f90b5d60e21b815261255b926001600160a01b0316916363e42d74916124ff91889160040191825260ff16602082015260400190565b60006040518083038186803b15801561251757600080fd5b505afa15801561252b573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526125539190810190612e38565b846001611bdc565b6118073384611d62565b600a80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6125c2848484611ef9565b6125ce84848484612678565b6118075760405162461bcd60e51b81526004016107829061333b565b6125f48383612785565b6126016000848484612678565b61087a5760405162461bcd60e51b81526004016107829061333b565b60006001600160e01b031982166380ac58cd60e01b148061264e57506001600160e01b03198216635b5e139f60e01b145b8061088a57506301ffc9a760e01b6001600160e01b031983161461088a565b61087a8383836128c4565b60006001600160a01b0384163b1561277a57604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906126bc903390899088908890600401613251565b602060405180830381600087803b1580156126d657600080fd5b505af1925050508015612706575060408051601f3d908101601f1916820190925261270391810190612fdf565b60015b612760573d808015612734576040519150601f19603f3d011682016040523d82523d6000602084013e612739565b606091505b5080516127585760405162461bcd60e51b81526004016107829061333b565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050611ef1565b506001949350505050565b6001600160a01b0382166127db5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610782565b6127e481611bbf565b156128315760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610782565b61283d6000838361266d565b6001600160a01b038216600090815260036020526040812080546001929061286690849061353c565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b6001600160a01b03831661291f5761291a81600880546000838152600960205260408120829055600182018355919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30155565b612942565b816001600160a01b0316836001600160a01b03161461294257612942838261297c565b6001600160a01b0382166129595761087a81612a19565b826001600160a01b0316826001600160a01b03161461087a5761087a8282612af2565b60006001612989846113f4565b61299391906135d2565b6000838152600760205260409020549091508082146129e6576001600160a01b03841660009081526006602090815260408083208584528252808320548484528184208190558352600790915290208190555b5060009182526007602090815260408084208490556001600160a01b039094168352600681528383209183525290812055565b600854600090612a2b906001906135d2565b60008381526009602052604081205460088054939450909284908110612a6157634e487b7160e01b600052603260045260246000fd5b906000526020600020015490508060088381548110612a9057634e487b7160e01b600052603260045260246000fd5b6000918252602080832090910192909255828152600990915260408082208490558582528120556008805480612ad657634e487b7160e01b600052603160045260246000fd5b6001900381819060005260206000200160009055905550505050565b6000612afd836113f4565b6001600160a01b039093166000908152600660209081526040808320868452825280832085905593825260079052919091209190915550565b5080546000825560020290600052602060002090810190611bbc91905b80821115612b785780546001600160a01b031916815560006001820155600201612b53565b5090565b600082601f830112612b8c578081fd5b81356020612ba1612b9c836134f0565b6134bf565b80838252828201915082860187848660061b8901011115612bc0578586fd5b855b85811015612c0957604080838b031215612bda578788fd5b612be2613496565b8335612bed816136c1565b8152838701358782015285529385019390910190600101612bc2565b5090979650505050505050565b600082601f830112612c26578081fd5b8135612c34612b9c82613514565b818152846020838601011115612c48578283fd5b816020850160208301379081016020019190915292915050565b600060408284031215612c73578081fd5b612c7b613496565b90508151612c88816136c1565b808252506020820151602082015292915050565b803563ffffffff81168114612cb057600080fd5b919050565b803560ff81168114612cb057600080fd5b600060208284031215612cd7578081fd5b8135610bf4816136c1565b600060208284031215612cf3578081fd5b8151610bf4816136c1565b60008060408385031215612d10578081fd5b8235612d1b816136c1565b91506020830135612d2b816136c1565b809150509250929050565b600080600060608486031215612d4a578081fd5b8335612d55816136c1565b92506020840135612d65816136c1565b929592945050506040919091013590565b60008060008060808587031215612d8b578182fd5b8435612d96816136c1565b93506020850135612da6816136c1565b925060408501359150606085013567ffffffffffffffff811115612dc8578182fd5b612dd487828801612c16565b91505092959194509250565b60008060408385031215612df2578182fd5b8235612dfd816136c1565b91506020830135612d2b816136d6565b60008060408385031215612e1f578182fd5b8235612e2a816136c1565b946020939093013593505050565b60006020808385031215612e4a578182fd5b825167ffffffffffffffff811115612e60578283fd5b8301601f81018513612e70578283fd5b8051612e7e612b9c826134f0565b80828252848201915084840188868560061b8701011115612e9d578687fd5b8694505b83851015612ec857612eb38982612c62565b83526001949094019391850191604001612ea1565b50979650505050505050565b60008060408385031215612ee6578182fd5b823567ffffffffffffffff811115612efc578283fd5b612f0885828601612b7c565b95602094909401359450505050565b60006020808385031215612f29578182fd5b825167ffffffffffffffff811115612f3f578283fd5b8301601f81018513612f4f578283fd5b8051612f5d612b9c826134f0565b80828252848201915084840188868560061b8701011115612f7c578687fd5b8694505b83851015612ec857612f928982612c62565b83526001949094019391850191604001612f80565b600060208284031215612fb8578081fd5b8151610bf4816136d6565b600060208284031215612fd4578081fd5b8135610bf4816136e4565b600060208284031215612ff0578081fd5b8151610bf4816136e4565b6000806040838503121561300d578182fd5b823567ffffffffffffffff811115613023578283fd5b612f0885828601612c16565b600060208284031215613040578081fd5b815167ffffffffffffffff811115613056578182fd5b8201601f81018413613066578182fd5b8051613074612b9c82613514565b818152856020838501011115613088578384fd5b6130998260208301602086016135e9565b95945050505050565b6000602082840312156130b3578081fd5b5035919050565b6000602082840312156130cb578081fd5b5051919050565b600080600083850360c08112156130e7578182fd5b843593506080601f19820112156130fc578182fd5b506040516080810167ffffffffffffffff8282108183111715613121576131216136ab565b8160405261313160208801612cb5565b835261313f60408801612cb5565b602084015261315060608801612c9c565b604084015261316160808801612c9c565b606084015291935060a0860135918083111561317b578384fd5b505061318986828701612b7c565b9150509250925092565b600080604083850312156131a5578182fd5b50508035926020909101359150565b6000602082840312156131c5578081fd5b610bf482612cb5565b6000815180845260208085019450808401835b8381101561321a5761320787835180516001600160a01b03168252602090810151910152565b60409690960195908201906001016131e1565b509495945050505050565b6000815180845261323d8160208601602086016135e9565b601f01601f19169290920160200192915050565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061328490830184613225565b9695505050505050565b6080815260006132a160808301876131ce565b6020830195909552506001600160a01b039290921660408301521515606090910152919050565b602080825282518282018190526000919060409081850190868401855b8281101561331b5761330b84835180516001600160a01b03168252602090810151910152565b92840192908501906001016132e5565b5091979650505050505050565b602081526000610bf46020830184613225565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b60208152815160208201526000602083015160c0604084015261343960e0840182613225565b90506040840151601f19808584030160608601526134578383613225565b92506060860151915063ffffffff80831660808701528060808801511660a08701525060a08601519150808584030160c08601525061309982826131ce565b6040805190810167ffffffffffffffff811182821017156134b9576134b96136ab565b60405290565b604051601f8201601f1916810167ffffffffffffffff811182821017156134e8576134e86136ab565b604052919050565b600067ffffffffffffffff82111561350a5761350a6136ab565b5060051b60200190565b600067ffffffffffffffff82111561352e5761352e6136ab565b50601f01601f191660200190565b6000821982111561354f5761354f61367f565b500190565b600063ffffffff8083168185168083038211156135735761357361367f565b01949350505050565b60008261358b5761358b613695565b500490565b600063ffffffff808416806135a7576135a7613695565b92169190910492915050565b60008160001904831182151516156135cd576135cd61367f565b500290565b6000828210156135e4576135e461367f565b500390565b60005b838110156136045781810151838201526020016135ec565b838111156118075750506000910152565b600181811c9082168061362957607f821691505b6020821081141561364a57634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156136645761366461367f565b5060010190565b60008261367a5761367a613695565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114611bbc57600080fd5b8015158114611bbc57600080fd5b6001600160e01b031981168114611bbc57600080fdfea26469706673582212208d5f7bce085eb538bea9f9b2216a0f5564078bd5d53b112e20cb518fd1b87f8f64736f6c63430008040033000000000000000000000000044011824d5cbbb788965b11bf98dc1657407644

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106102535760003560e01c8063521e8749116101465780639bb8e4c4116100c3578063c5639cc611610087578063c5639cc614610682578063c87b56dd14610695578063d03cea6d146106a8578063ddc63262146106bb578063e985e9c5146106ce578063f2fde38b1461070a57600080fd5b80639bb8e4c414610623578063a0712d6814610636578063a22cb46514610649578063a5dc9e1b1461065c578063b88d4fde1461066f57600080fd5b80637d7f78401161010a5780637d7f7840146105c45780638c1d808c146105e45780638da5cb5b146105f757806395d89b4114610608578063965eb54a1461061057600080fd5b8063521e87491461049a5780636352211e1461056457806370a0823114610577578063715018a61461058a5780637ae349d01461059257600080fd5b80631fcefbfc116101d457806342842e0e1161019857806342842e0e1461042657806343e4abbd1461043957806345e313aa146104615780634622ab03146104745780634f6ccce71461048757600080fd5b80631fcefbfc146103ba57806323b872dd146103cd5780632f745c59146103e0578063367668d4146103f35780633f6fc50b1461041357600080fd5b8063095ea7b31161021b578063095ea7b3146103035780631177f3791461031657806314a327501461038c578063151895551461039f57806318160ddd146103b257600080fd5b806301cc05691461025857806301ffc9a71461026d578063038053e21461029557806306fdde03146102c3578063081812fc146102d8575b600080fd5b61026b6102663660046130d2565b61071d565b005b61028061027b366004612fc3565b61087f565b60405190151581526020015b60405180910390f35b6102b56102a33660046130a2565b60136020526000908152604090205481565b60405190815260200161028c565b6102cb610890565b60405161028c9190613328565b6102eb6102e63660046130a2565b610922565b6040516001600160a01b03909116815260200161028c565b61026b610311366004612e0d565b6109aa565b61035b6103243660046130a2565b60116020526000908152604090205460ff8082169161010081049091169063ffffffff620100008204811691600160301b90041684565b6040805160ff958616815294909316602085015263ffffffff9182169284019290925216606082015260800161028c565b6102cb61039a3660046130a2565b610abb565b6102b56103ad3660046130a2565b610b67565b6008546102b5565b61026b6103c8366004612de0565b610bfb565b61026b6103db366004612d36565b610c50565b6102b56103ee366004612e0d565b610c81565b6104066104013660046130a2565b610d17565b60405161028c9190613413565b61026b6104213660046131b4565b611047565b61026b610434366004612d36565b611248565b61044c6104473660046130a2565b611263565b60405163ffffffff909116815260200161028c565b61026b61046f3660046130a2565b61129d565b6102cb6104823660046130a2565b6112cc565b6102b56104953660046130a2565b6112dc565b61051a6104a83660046130a2565b604080516080808201835260008083526020808401829052838501829052606093840182905294815260118552839020835191820184525460ff80821683526101008204169482019490945263ffffffff620100008504811693820193909352600160301b9093049091169082015290565b60405161028c9190600060808201905060ff835116825260ff6020840151166020830152604083015163ffffffff8082166040850152806060860151166060850152505092915050565b6102eb6105723660046130a2565b61137d565b6102b5610585366004612cc6565b6113f4565b61026b61147b565b6105a56105a0366004613193565b6114b1565b604080516001600160a01b03909316835260208301919091520161028c565b6105d76105d23660046130a2565b6114f7565b60405161028c91906132c8565b6102b56105f2366004612ffb565b611578565b600a546001600160a01b03166102eb565b6102cb6115af565b61044c61061e3660046130a2565b6115be565b61026b610631366004612ed4565b6115ce565b61026b6106443660046130a2565b6115da565b61026b610657366004612de0565b611710565b600f546102eb906001600160a01b031681565b61026b61067d366004612d76565b6117d5565b61026b610690366004612cc6565b61180d565b6102cb6106a33660046130a2565b611859565b6010546102eb906001600160a01b031681565b61026b6106c93660046130a2565b6118da565b6102806106dc366004612cfe565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b61026b610718366004612cc6565b611b24565b3360009081526016602052604090205460ff1661078b5760405162461bcd60e51b815260206004820152602160248201527f596f7520617265206e6f742061207065726d697373696f6e6564206d696e74656044820152603960f91b60648201526084015b60405180910390fd5b61079483611bbf565b156107ed5760405162461bcd60e51b8152602060048201526024808201527f43616e2774206d696e7420746f6b656e207468617420616c72656164792065786044820152636973747360e01b6064820152608401610782565b600083815260116020908152604091829020845181549286015193860151606087015163ffffffff908116600160301b0269ffffffff000000000000199190921662010000021669ffffffffffffffff00001960ff9687166101000261ffff19909616969093169590951793909317169290921717905561087081846001611bdc565b61087a3384611d62565b505050565b600061088a82611d7c565b92915050565b60606000805461089f90613615565b80601f01602080910402602001604051908101604052809291908181526020018280546108cb90613615565b80156109185780601f106108ed57610100808354040283529160200191610918565b820191906000526020600020905b8154815290600101906020018083116108fb57829003601f168201915b5050505050905090565b600061092d82611bbf565b61098e5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610782565b506000908152600460205260409020546001600160a01b031690565b60006109b58261137d565b9050806001600160a01b0316836001600160a01b03161415610a235760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610782565b336001600160a01b0382161480610a3f5750610a3f81336106dc565b610ab15760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c00000000000000006064820152608401610782565b61087a8383611da1565b600c8181548110610acb57600080fd5b906000526020600020016000915090508054610ae690613615565b80601f0160208091040260200160405190810160405280929190818152602001828054610b1290613615565b8015610b5f5780601f10610b3457610100808354040283529160200191610b5f565b820191906000526020600020905b815481529060010190602001808311610b4257829003601f168201915b505050505081565b600080610b7383610d17565b600f5460405163524eaa7b60e11b81529192506001600160a01b03169063a49d54f690610ba4908490600401613413565b60206040518083038186803b158015610bbc57600080fd5b505afa158015610bd0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bf491906130ba565b9392505050565b600a546001600160a01b03163314610c255760405162461bcd60e51b81526004016107829061338d565b6001600160a01b03919091166000908152601660205260409020805460ff1916911515919091179055565b610c5a3382611e0f565b610c765760405162461bcd60e51b8152600401610782906133c2565b61087a838383611ef9565b6000610c8c836113f4565b8210610cee5760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b6064820152608401610782565b506001600160a01b03919091166000908152600660209081526040808320938352929052205490565b610d5c6040518060c00160405280600081526020016060815260200160608152602001600063ffffffff168152602001600063ffffffff168152602001606081525090565b610d6582611bbf565b610dbd5760405162461bcd60e51b8152602060048201526024808201527f536869702077697468207468617420746f6b656e496420646f65736e277420656044820152631e1a5cdd60e21b6064820152608401610782565b6000828152601160209081526040918290208251608081018452905460ff8082168352610100820481168385015263ffffffff620100008304811684870152600160301b9092049091166060830152835160c081019094528584528151600b8054939594850193909291909116908110610e4757634e487b7160e01b600052603260045260246000fd5b906000526020600020018054610e5c90613615565b80601f0160208091040260200160405190810160405280929190818152602001828054610e8890613615565b8015610ed55780601f10610eaa57610100808354040283529160200191610ed5565b820191906000526020600020905b815481529060010190602001808311610eb857829003601f168201915b50505050508152602001600c836020015160ff1681548110610f0757634e487b7160e01b600052603260045260246000fd5b906000526020600020018054610f1c90613615565b80601f0160208091040260200160405190810160405280929190818152602001828054610f4890613615565b8015610f955780601f10610f6a57610100808354040283529160200191610f95565b820191906000526020600020905b815481529060010190602001808311610f7857829003601f168201915b50505050508152602001826040015163ffffffff168152602001826060015163ffffffff16815260200160126000868152602001908152602001600020805480602002602001604051908101604052809291908181526020016000905b8282101561103a576000848152602090819020604080518082019091526002850290910180546001600160a01b03168252600190810154828401529083529092019101610ff2565b5050509152509392505050565b60155460145411156110af5760405162461bcd60e51b815260206004820152602b60248201527f4d6178696d756d20616d6f756e74206f6620736869707320686176652062656560448201526a1b881c1d5c98da185cd95960aa1b6064820152608401610782565b600f54604051631baf95cb60e11b815260ff831660048201526000916001600160a01b03169063375f2b969060240160006040518083038186803b1580156110f657600080fd5b505afa15801561110a573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526111329190810190612f17565b905060005b815181101561121d5781818151811061116057634e487b7160e01b600052603260045260246000fd5b6020026020010151600001516001600160a01b03166379cc67903384848151811061119b57634e487b7160e01b600052603260045260246000fd5b6020026020010151602001516040518363ffffffff1660e01b81526004016111d89291906001600160a01b03929092168252602082015260400190565b600060405180830381600087803b1580156111f257600080fd5b505af1158015611206573d6000803e3d6000fd5b50505050808061121590613650565b915050611137565b50600160146000828254611231919061353c565b92505081905550611244826014546120a4565b5050565b61087a838383604051806020016040528060008152506117d5565b600e818154811061127357600080fd5b9060005260206000209060089182820401919006600402915054906101000a900463ffffffff1681565b600a546001600160a01b031633146112c75760405162461bcd60e51b81526004016107829061338d565b601555565b600b8181548110610acb57600080fd5b60006112e760085490565b821061134a5760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b6064820152608401610782565b6008828154811061136b57634e487b7160e01b600052603260045260246000fd5b90600052602060002001549050919050565b6000818152600260205260408120546001600160a01b03168061088a5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b6064820152608401610782565b60006001600160a01b03821661145f5760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b6064820152608401610782565b506001600160a01b031660009081526003602052604090205490565b600a546001600160a01b031633146114a55760405162461bcd60e51b81526004016107829061338d565b6114af6000612565565b565b601260205281600052604060002081815481106114cd57600080fd5b6000918252602090912060029091020180546001909101546001600160a01b039091169250905082565b600f546040516301f5fde160e61b8152600481018390526060916001600160a01b031690637d7f78409060240160006040518083038186803b15801561153c57600080fd5b505afa158015611550573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261088a9190810190612f17565b6000818360405160200161158c9190613328565b6040516020818303038152906040528051906020012060001c610bf4919061366b565b60606001805461089f90613615565b600d818154811061127357600080fd5b61124482826000611bdc565b6115e381611bbf565b156116305760405162461bcd60e51b815260206004820181905260248201527f536869702077697468207468617420696420616c7265616479206578697374736044820152606401610782565b6103e78111156116775760405162461bcd60e51b815260206004820152601260248201527114da1a5c081a59081a5cc81a5b9d985b1a5960721b6044820152606401610782565b60006116c882426040516020016116b1929190918252606060208301819052600190830152603760f91b6080830152604082015260a00190565b6040516020818303038152906040526103e8611578565b9050600061038482106116f9576103b682106116ee576116e960058361366b565b611704565b6116e960048361366b565b61170460038361366b565b905061087a81846120a4565b6001600160a01b0382163314156117695760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610782565b3360008181526005602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6117df3383611e0f565b6117fb5760405162461bcd60e51b8152600401610782906133c2565b611807848484846125b7565b50505050565b600a546001600160a01b031633146118375760405162461bcd60e51b81526004016107829061338d565b600f80546001600160a01b0319166001600160a01b0392909216919091179055565b600f5460405163c87b56dd60e01b8152600481018390526060916001600160a01b03169063c87b56dd9060240160006040518083038186803b15801561189e57600080fd5b505afa1580156118b2573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261088a919081019061302f565b60006118e5826114f7565b6000838152601360205260408120439055909150805b8251811015611a385782818151811061192457634e487b7160e01b600052603260045260246000fd5b6020026020010151600001516001600160a01b03166340c10f196119478661137d565b85848151811061196757634e487b7160e01b600052603260045260246000fd5b6020026020010151602001516040518363ffffffff1660e01b81526004016119a49291906001600160a01b03929092168252602082015260400190565b600060405180830381600087803b1580156119be57600080fd5b505af11580156119d2573d6000803e3d6000fd5b5050505060648382815181106119f857634e487b7160e01b600052603260045260246000fd5b6020026020010151602001516006611a1091906135b3565b611a1a919061357c565b611a24908361353c565b915080611a3081613650565b9150506118fb565b50600f54604051632771008160e11b8152600481018590526000916001600160a01b031690634ee201029060240160206040518083038186803b158015611a7e57600080fd5b505afa158015611a92573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ab69190612ce2565b6010546040516340c10f1960e01b81526001600160a01b038084166004830152602482018690529293509116906340c10f1990604401600060405180830381600087803b158015611b0657600080fd5b505af1158015611b1a573d6000803e3d6000fd5b5050505050505050565b600a546001600160a01b03163314611b4e5760405162461bcd60e51b81526004016107829061338d565b6001600160a01b038116611bb35760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610782565b611bbc81612565565b50565b6000908152600260205260409020546001600160a01b0316151590565b600f5460405163a290d5ff60e01b81526001600160a01b039091169063a290d5ff90611c1290869086903390879060040161328e565b60206040518083038186803b158015611c2a57600080fd5b505afa158015611c3e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c629190612fa7565b611c9e5760405162461bcd60e51b815260206004820152600d60248201526c496e76616c696420726f75746560981b6044820152606401610782565b6000828152601260205260408120611cb591612b36565b60005b8351811015611d4c5760008381526012602052604090208451859083908110611cf157634e487b7160e01b600052603260045260246000fd5b602090810291909101810151825460018082018555600094855293839020825160029092020180546001600160a01b0319166001600160a01b0390921691909117815591015191015580611d4481613650565b915050611cb8565b5050600090815260136020526040902043905550565b6112448282604051806020016040528060008152506125ea565b60006001600160e01b0319821663780e9d6360e01b148061088a575061088a8261261d565b600081815260046020526040902080546001600160a01b0319166001600160a01b0384169081179091558190611dd68261137d565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000611e1a82611bbf565b611e7b5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610782565b6000611e868361137d565b9050806001600160a01b0316846001600160a01b03161480611ec15750836001600160a01b0316611eb684610922565b6001600160a01b0316145b80611ef157506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b949350505050565b826001600160a01b0316611f0c8261137d565b6001600160a01b031614611f745760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201526839903737ba1037bbb760b91b6064820152608401610782565b6001600160a01b038216611fd65760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610782565b611fe183838361266d565b611fec600082611da1565b6001600160a01b03831660009081526003602052604081208054600192906120159084906135d2565b90915550506001600160a01b038216600090815260036020526040812080546001929061204390849061353c565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b60408051608081018252600080825260208201819052918101829052606081019190915260ff8316815260408051602081018490528082019190915260016060820152606360f81b60808201526000906121009060a0016116b1565b905061210d60058261366b565b60ff16602083810191909152604080519182018590528181015260016060820152601b60fa1b60808201526121559060a0016040516020818303038152906040526032611578565b9050600a600e836000015160ff168154811061218157634e487b7160e01b600052603260045260246000fd5b6000918252602090912060088204015460079091166004026101000a900463ffffffff166121b083600161353c565b6121ba91906135b3565b6121c49190613590565b6121cf906002613554565b63ffffffff1660408301528151600e8054909160ff1690811061220257634e487b7160e01b600052603260045260246000fd5b90600052602060002090600891828204019190066004029054906101000a900463ffffffff1663ffffffff16826040015163ffffffff1610612248578160400151612297565b600e826000015160ff168154811061227057634e487b7160e01b600052603260045260246000fd5b90600052602060002090600891828204019190066004029054906101000a900463ffffffff165b63ffffffff166040838101919091528051602081018590528082019190915260016060820152607360f81b60808201526122e49060a0016040516020818303038152906040526064611578565b90506064600d836000015160ff168154811061231057634e487b7160e01b600052603260045260246000fd5b6000918252602090912060088204015460079091166004026101000a900463ffffffff1661233f83600161353c565b61234991906135b3565b6123539190613590565b61235e906002613554565b63ffffffff1660608301528151600d805460029260ff1690811061239257634e487b7160e01b600052603260045260246000fd5b90600052602060002090600891828204019190066004029054906101000a900463ffffffff166123c29190613590565b63ffffffff16826060015163ffffffff16106123e257816060015161243c565b6002600d836000015160ff168154811061240c57634e487b7160e01b600052603260045260246000fd5b90600052602060002090600891828204019190066004029054906101000a900463ffffffff1661243c9190613590565b63ffffffff9081166060840190815260008581526011602090815260409182902086518154928801518489015195518716600160301b0269ffffffff000000000000199690971662010000029590951669ffffffffffffffff00001960ff9687166101000261ffff199095169683169690961793909317949094169190911793909317909255600f5491516318f90b5d60e21b815261255b926001600160a01b0316916363e42d74916124ff91889160040191825260ff16602082015260400190565b60006040518083038186803b15801561251757600080fd5b505afa15801561252b573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526125539190810190612e38565b846001611bdc565b6118073384611d62565b600a80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6125c2848484611ef9565b6125ce84848484612678565b6118075760405162461bcd60e51b81526004016107829061333b565b6125f48383612785565b6126016000848484612678565b61087a5760405162461bcd60e51b81526004016107829061333b565b60006001600160e01b031982166380ac58cd60e01b148061264e57506001600160e01b03198216635b5e139f60e01b145b8061088a57506301ffc9a760e01b6001600160e01b031983161461088a565b61087a8383836128c4565b60006001600160a01b0384163b1561277a57604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906126bc903390899088908890600401613251565b602060405180830381600087803b1580156126d657600080fd5b505af1925050508015612706575060408051601f3d908101601f1916820190925261270391810190612fdf565b60015b612760573d808015612734576040519150601f19603f3d011682016040523d82523d6000602084013e612739565b606091505b5080516127585760405162461bcd60e51b81526004016107829061333b565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050611ef1565b506001949350505050565b6001600160a01b0382166127db5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610782565b6127e481611bbf565b156128315760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610782565b61283d6000838361266d565b6001600160a01b038216600090815260036020526040812080546001929061286690849061353c565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b6001600160a01b03831661291f5761291a81600880546000838152600960205260408120829055600182018355919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30155565b612942565b816001600160a01b0316836001600160a01b03161461294257612942838261297c565b6001600160a01b0382166129595761087a81612a19565b826001600160a01b0316826001600160a01b03161461087a5761087a8282612af2565b60006001612989846113f4565b61299391906135d2565b6000838152600760205260409020549091508082146129e6576001600160a01b03841660009081526006602090815260408083208584528252808320548484528184208190558352600790915290208190555b5060009182526007602090815260408084208490556001600160a01b039094168352600681528383209183525290812055565b600854600090612a2b906001906135d2565b60008381526009602052604081205460088054939450909284908110612a6157634e487b7160e01b600052603260045260246000fd5b906000526020600020015490508060088381548110612a9057634e487b7160e01b600052603260045260246000fd5b6000918252602080832090910192909255828152600990915260408082208490558582528120556008805480612ad657634e487b7160e01b600052603160045260246000fd5b6001900381819060005260206000200160009055905550505050565b6000612afd836113f4565b6001600160a01b039093166000908152600660209081526040808320868452825280832085905593825260079052919091209190915550565b5080546000825560020290600052602060002090810190611bbc91905b80821115612b785780546001600160a01b031916815560006001820155600201612b53565b5090565b600082601f830112612b8c578081fd5b81356020612ba1612b9c836134f0565b6134bf565b80838252828201915082860187848660061b8901011115612bc0578586fd5b855b85811015612c0957604080838b031215612bda578788fd5b612be2613496565b8335612bed816136c1565b8152838701358782015285529385019390910190600101612bc2565b5090979650505050505050565b600082601f830112612c26578081fd5b8135612c34612b9c82613514565b818152846020838601011115612c48578283fd5b816020850160208301379081016020019190915292915050565b600060408284031215612c73578081fd5b612c7b613496565b90508151612c88816136c1565b808252506020820151602082015292915050565b803563ffffffff81168114612cb057600080fd5b919050565b803560ff81168114612cb057600080fd5b600060208284031215612cd7578081fd5b8135610bf4816136c1565b600060208284031215612cf3578081fd5b8151610bf4816136c1565b60008060408385031215612d10578081fd5b8235612d1b816136c1565b91506020830135612d2b816136c1565b809150509250929050565b600080600060608486031215612d4a578081fd5b8335612d55816136c1565b92506020840135612d65816136c1565b929592945050506040919091013590565b60008060008060808587031215612d8b578182fd5b8435612d96816136c1565b93506020850135612da6816136c1565b925060408501359150606085013567ffffffffffffffff811115612dc8578182fd5b612dd487828801612c16565b91505092959194509250565b60008060408385031215612df2578182fd5b8235612dfd816136c1565b91506020830135612d2b816136d6565b60008060408385031215612e1f578182fd5b8235612e2a816136c1565b946020939093013593505050565b60006020808385031215612e4a578182fd5b825167ffffffffffffffff811115612e60578283fd5b8301601f81018513612e70578283fd5b8051612e7e612b9c826134f0565b80828252848201915084840188868560061b8701011115612e9d578687fd5b8694505b83851015612ec857612eb38982612c62565b83526001949094019391850191604001612ea1565b50979650505050505050565b60008060408385031215612ee6578182fd5b823567ffffffffffffffff811115612efc578283fd5b612f0885828601612b7c565b95602094909401359450505050565b60006020808385031215612f29578182fd5b825167ffffffffffffffff811115612f3f578283fd5b8301601f81018513612f4f578283fd5b8051612f5d612b9c826134f0565b80828252848201915084840188868560061b8701011115612f7c578687fd5b8694505b83851015612ec857612f928982612c62565b83526001949094019391850191604001612f80565b600060208284031215612fb8578081fd5b8151610bf4816136d6565b600060208284031215612fd4578081fd5b8135610bf4816136e4565b600060208284031215612ff0578081fd5b8151610bf4816136e4565b6000806040838503121561300d578182fd5b823567ffffffffffffffff811115613023578283fd5b612f0885828601612c16565b600060208284031215613040578081fd5b815167ffffffffffffffff811115613056578182fd5b8201601f81018413613066578182fd5b8051613074612b9c82613514565b818152856020838501011115613088578384fd5b6130998260208301602086016135e9565b95945050505050565b6000602082840312156130b3578081fd5b5035919050565b6000602082840312156130cb578081fd5b5051919050565b600080600083850360c08112156130e7578182fd5b843593506080601f19820112156130fc578182fd5b506040516080810167ffffffffffffffff8282108183111715613121576131216136ab565b8160405261313160208801612cb5565b835261313f60408801612cb5565b602084015261315060608801612c9c565b604084015261316160808801612c9c565b606084015291935060a0860135918083111561317b578384fd5b505061318986828701612b7c565b9150509250925092565b600080604083850312156131a5578182fd5b50508035926020909101359150565b6000602082840312156131c5578081fd5b610bf482612cb5565b6000815180845260208085019450808401835b8381101561321a5761320787835180516001600160a01b03168252602090810151910152565b60409690960195908201906001016131e1565b509495945050505050565b6000815180845261323d8160208601602086016135e9565b601f01601f19169290920160200192915050565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061328490830184613225565b9695505050505050565b6080815260006132a160808301876131ce565b6020830195909552506001600160a01b039290921660408301521515606090910152919050565b602080825282518282018190526000919060409081850190868401855b8281101561331b5761330b84835180516001600160a01b03168252602090810151910152565b92840192908501906001016132e5565b5091979650505050505050565b602081526000610bf46020830184613225565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b60208152815160208201526000602083015160c0604084015261343960e0840182613225565b90506040840151601f19808584030160608601526134578383613225565b92506060860151915063ffffffff80831660808701528060808801511660a08701525060a08601519150808584030160c08601525061309982826131ce565b6040805190810167ffffffffffffffff811182821017156134b9576134b96136ab565b60405290565b604051601f8201601f1916810167ffffffffffffffff811182821017156134e8576134e86136ab565b604052919050565b600067ffffffffffffffff82111561350a5761350a6136ab565b5060051b60200190565b600067ffffffffffffffff82111561352e5761352e6136ab565b50601f01601f191660200190565b6000821982111561354f5761354f61367f565b500190565b600063ffffffff8083168185168083038211156135735761357361367f565b01949350505050565b60008261358b5761358b613695565b500490565b600063ffffffff808416806135a7576135a7613695565b92169190910492915050565b60008160001904831182151516156135cd576135cd61367f565b500290565b6000828210156135e4576135e461367f565b500390565b60005b838110156136045781810151838201526020016135ec565b838111156118075750506000910152565b600181811c9082168061362957607f821691505b6020821081141561364a57634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156136645761366461367f565b5060010190565b60008261367a5761367a613695565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114611bbc57600080fd5b8015158114611bbc57600080fd5b6001600160e01b031981168114611bbc57600080fdfea26469706673582212208d5f7bce085eb538bea9f9b2216a0f5564078bd5d53b112e20cb518fd1b87f8f64736f6c63430008040033

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

000000000000000000000000044011824d5cbbb788965b11bf98dc1657407644

-----Decoded View---------------
Arg [0] : goldTokenContract_ (address): 0x044011824D5CbBb788965B11bF98dc1657407644

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000044011824d5cbbb788965b11bf98dc1657407644


Loading...
Loading
Loading...
Loading
[ Download: CSV Export  ]
[ Download: CSV Export  ]

A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.