ETH Price: $3,835.17 (-3.41%)

Token

Chainbreakers Items (CBI)
 

Overview

Max Total Supply

2,944 CBI

Holders

1,187

Market

Volume (24H)

N/A

Min Price (24H)

N/A

Max Price (24H)

N/A

Other Info

Filtered by Token Holder
hpriv.eth
Balance
2 CBI
0x521B0fEf9CDCf250aBaF8e7BC798CBE13fa98692
Loading...
Loading
Loading...
Loading
Loading...
Loading

OVERVIEW

Chainbreakers is a strategy-rpg that integrates cryptocurrencies and digitally scarced game assets by design.

# Exchange Pair Price  24H Volume % Volume

Contract Source Code Verified (Exact Match)

Contract Name:
ChainbreakersItemsERC721

Compiler Version
v0.4.24+commit.e67f0147

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity)

/**
 *Submitted for verification at Etherscan.io on 2018-12-06
*/

pragma solidity ^0.4.24;

contract BasicAccessControl {
    address public owner;
    address[] moderatorsArray;
    uint16 public totalModerators = 0;
    mapping (address => bool) moderators;
    bool public isMaintaining = true;

    constructor() public {
        owner = msg.sender;
        AddModerator(msg.sender);
    }

    modifier onlyOwner {
        require(msg.sender == owner);
        _;
    }

    modifier onlyModerators() {
        require(moderators[msg.sender] == true);
        _;
    }

    modifier isActive {
        require(!isMaintaining);
        _;
    }

    function findInArray(address _address) internal view returns(uint8) {
        uint8 i = 0;
        while (moderatorsArray[i] != _address) {
            i++;
        }
        return i;
    }

    function ChangeOwner(address _newOwner) onlyOwner public {
        if (_newOwner != address(0)) {
            owner = _newOwner;
        }
    }

    function AddModerator(address _newModerator) onlyOwner public {
        if (moderators[_newModerator] == false) {
            moderators[_newModerator] = true;
            moderatorsArray.push(_newModerator);
            totalModerators += 1;
        }
    }

    function getModerators() public view returns(address[] memory) {
        return moderatorsArray;
    }

    function RemoveModerator(address _oldModerator) onlyOwner public {
        if (moderators[_oldModerator] == true) {
            moderators[_oldModerator] = false;
            uint8 i = findInArray(_oldModerator);
            while (i<moderatorsArray.length-1) {
                moderatorsArray[i] = moderatorsArray[i+1];
                i++;
            }
            moderatorsArray.length--;
            totalModerators -= 1;
        }
    }

    function UpdateMaintaining(bool _isMaintaining) onlyOwner public {
        isMaintaining = _isMaintaining;
    }

    function isModerator(address _address) public view returns(bool, address) {
        return (moderators[_address], _address);
    }
}

contract randomRange {
    function getRandom(uint256 minRan, uint256 maxRan, uint8 index, address priAddress) view internal returns(uint) {
        uint256 genNum = uint256(blockhash(block.number-1)) + uint256(priAddress) + uint256(keccak256(abi.encodePacked(block.timestamp, index)));
        for (uint8 i = 0; i < index && i < 6; i ++) {
            genNum /= 256;
        }
        return uint(genNum % (maxRan + 1 - minRan) + minRan);
    }
}

/*
 * @title String & slice utility library for Solidity contracts.
 * @author Nick Johnson <[email protected]>
 *
 * @dev Functionality in this library is largely implemented using an
 *      abstraction called a 'slice'. A slice represents a part of a string -
 *      anything from the entire string to a single character, or even no
 *      characters at all (a 0-length slice). Since a slice only has to specify
 *      an offset and a length, copying and manipulating slices is a lot less
 *      expensive than copying and manipulating the strings they reference.
 *
 *      To further reduce gas costs, most functions on slice that need to return
 *      a slice modify the original one instead of allocating a new one; for
 *      instance, `s.split(".")` will return the text up to the first '.',
 *      modifying s to only contain the remainder of the string after the '.'.
 *      In situations where you do not want to modify the original slice, you
 *      can make a copy first with `.copy()`, for example:
 *      `s.copy().split(".")`. Try and avoid using this idiom in loops; since
 *      Solidity has no memory management, it will result in allocating many
 *      short-lived slices that are later discarded.
 *
 *      Functions that return two slices come in two versions: a non-allocating
 *      version that takes the second slice as an argument, modifying it in
 *      place, and an allocating version that allocates and returns the second
 *      slice; see `nextRune` for example.
 *
 *      Functions that have to copy string data will return strings rather than
 *      slices; these can be cast back to slices for further processing if
 *      required.
 *
 *      For convenience, some functions are provided with non-modifying
 *      variants that create a new slice and return both; for instance,
 *      `s.splitNew('.')` leaves s unmodified, and returns two values
 *      corresponding to the left and right parts of the string.
 */



library strings {
    struct slice {
        uint _len;
        uint _ptr;
    }

    function memcpy(uint dest, uint src, uint len) private pure {
        // Copy word-length chunks while possible
        for(; len >= 32; len -= 32) {
            assembly {
                mstore(dest, mload(src))
            }
            dest += 32;
            src += 32;
        }

        // Copy remaining bytes
        uint mask = 256 ** (32 - len) - 1;
        assembly {
            let srcpart := and(mload(src), not(mask))
            let destpart := and(mload(dest), mask)
            mstore(dest, or(destpart, srcpart))
        }
    }

    /*
     * @dev Returns a slice containing the entire string.
     * @param self The string to make a slice from.
     * @return A newly allocated slice containing the entire string.
     */
    function toSlice(string memory self) internal pure returns (slice memory) {
        uint ptr;
        assembly {
            ptr := add(self, 0x20)
        }
        return slice(bytes(self).length, ptr);
    }

    /*
     * @dev Returns the length of a null-terminated bytes32 string.
     * @param self The value to find the length of.
     * @return The length of the string, from 0 to 32.
     */
    function len(bytes32 self) internal pure returns (uint) {
        uint ret;
        if (self == 0)
            return 0;
        if (self & 0xffffffffffffffffffffffffffffffff == 0) {
            ret += 16;
            self = bytes32(uint(self) / 0x100000000000000000000000000000000);
        }
        if (self & 0xffffffffffffffff == 0) {
            ret += 8;
            self = bytes32(uint(self) / 0x10000000000000000);
        }
        if (self & 0xffffffff == 0) {
            ret += 4;
            self = bytes32(uint(self) / 0x100000000);
        }
        if (self & 0xffff == 0) {
            ret += 2;
            self = bytes32(uint(self) / 0x10000);
        }
        if (self & 0xff == 0) {
            ret += 1;
        }
        return 32 - ret;
    }

    /*
     * @dev Returns a slice containing the entire bytes32, interpreted as a
     *      null-terminated utf-8 string.
     * @param self The bytes32 value to convert to a slice.
     * @return A new slice containing the value of the input argument up to the
     *         first null.
     */
    function toSliceB32(bytes32 self) internal pure returns (slice memory ret) {
        // Allocate space for `self` in memory, copy it there, and point ret at it
        assembly {
            let ptr := mload(0x40)
            mstore(0x40, add(ptr, 0x20))
            mstore(ptr, self)
            mstore(add(ret, 0x20), ptr)
        }
        ret._len = len(self);
    }

    /*
     * @dev Returns a new slice containing the same data as the current slice.
     * @param self The slice to copy.
     * @return A new slice containing the same data as `self`.
     */
    function copy(slice memory self) internal pure returns (slice memory) {
        return slice(self._len, self._ptr);
    }

    /*
     * @dev Copies a slice to a new string.
     * @param self The slice to copy.
     * @return A newly allocated string containing the slice's text.
     */
    function toString(slice memory self) internal pure returns (string memory) {
        string memory ret = new string(self._len);
        uint retptr;
        assembly { retptr := add(ret, 32) }

        memcpy(retptr, self._ptr, self._len);
        return ret;
    }

    /*
     * @dev Returns the length in runes of the slice. Note that this operation
     *      takes time proportional to the length of the slice; avoid using it
     *      in loops, and call `slice.empty()` if you only need to know whether
     *      the slice is empty or not.
     * @param self The slice to operate on.
     * @return The length of the slice in runes.
     */
    function len(slice memory self) internal pure returns (uint l) {
        // Starting at ptr-31 means the LSB will be the byte we care about
        uint ptr = self._ptr - 31;
        uint end = ptr + self._len;
        for (l = 0; ptr < end; l++) {
            uint8 b;
            assembly { b := and(mload(ptr), 0xFF) }
            if (b < 0x80) {
                ptr += 1;
            } else if(b < 0xE0) {
                ptr += 2;
            } else if(b < 0xF0) {
                ptr += 3;
            } else if(b < 0xF8) {
                ptr += 4;
            } else if(b < 0xFC) {
                ptr += 5;
            } else {
                ptr += 6;
            }
        }
    }

    /*
     * @dev Returns true if the slice is empty (has a length of 0).
     * @param self The slice to operate on.
     * @return True if the slice is empty, False otherwise.
     */
    function empty(slice memory self) internal pure returns (bool) {
        return self._len == 0;
    }

    /*
     * @dev Returns a positive number if `other` comes lexicographically after
     *      `self`, a negative number if it comes before, or zero if the
     *      contents of the two slices are equal. Comparison is done per-rune,
     *      on unicode codepoints.
     * @param self The first slice to compare.
     * @param other The second slice to compare.
     * @return The result of the comparison.
     */
    function compare(slice memory self, slice memory other) internal pure returns (int) {
        uint shortest = self._len;
        if (other._len < self._len)
            shortest = other._len;

        uint selfptr = self._ptr;
        uint otherptr = other._ptr;
        for (uint idx = 0; idx < shortest; idx += 32) {
            uint a;
            uint b;
            assembly {
                a := mload(selfptr)
                b := mload(otherptr)
            }
            if (a != b) {
                // Mask out irrelevant bytes and check again
                uint256 mask = uint256(-1); // 0xffff...
                if(shortest < 32) {
                    mask = ~(2 ** (8 * (32 - shortest + idx)) - 1);
                }
                uint256 diff = (a & mask) - (b & mask);
                if (diff != 0)
                    return int(diff);
            }
            selfptr += 32;
            otherptr += 32;
        }
        return int(self._len) - int(other._len);
    }

    /*
     * @dev Returns true if the two slices contain the same text.
     * @param self The first slice to compare.
     * @param self The second slice to compare.
     * @return True if the slices are equal, false otherwise.
     */
    function equals(slice memory self, slice memory other) internal pure returns (bool) {
        return compare(self, other) == 0;
    }

    /*
     * @dev Extracts the first rune in the slice into `rune`, advancing the
     *      slice to point to the next rune and returning `self`.
     * @param self The slice to operate on.
     * @param rune The slice that will contain the first rune.
     * @return `rune`.
     */
    function nextRune(slice memory self, slice memory rune) internal pure returns (slice memory) {
        rune._ptr = self._ptr;

        if (self._len == 0) {
            rune._len = 0;
            return rune;
        }

        uint l;
        uint b;
        // Load the first byte of the rune into the LSBs of b
        assembly { b := and(mload(sub(mload(add(self, 32)), 31)), 0xFF) }
        if (b < 0x80) {
            l = 1;
        } else if(b < 0xE0) {
            l = 2;
        } else if(b < 0xF0) {
            l = 3;
        } else {
            l = 4;
        }

        // Check for truncated codepoints
        if (l > self._len) {
            rune._len = self._len;
            self._ptr += self._len;
            self._len = 0;
            return rune;
        }

        self._ptr += l;
        self._len -= l;
        rune._len = l;
        return rune;
    }

    /*
     * @dev Returns the first rune in the slice, advancing the slice to point
     *      to the next rune.
     * @param self The slice to operate on.
     * @return A slice containing only the first rune from `self`.
     */
    function nextRune(slice memory self) internal pure returns (slice memory ret) {
        nextRune(self, ret);
    }

    /*
     * @dev Returns the number of the first codepoint in the slice.
     * @param self The slice to operate on.
     * @return The number of the first codepoint in the slice.
     */
    function ord(slice memory self) internal pure returns (uint ret) {
        if (self._len == 0) {
            return 0;
        }

        uint word;
        uint length;
        uint divisor = 2 ** 248;

        // Load the rune into the MSBs of b
        assembly { word:= mload(mload(add(self, 32))) }
        uint b = word / divisor;
        if (b < 0x80) {
            ret = b;
            length = 1;
        } else if(b < 0xE0) {
            ret = b & 0x1F;
            length = 2;
        } else if(b < 0xF0) {
            ret = b & 0x0F;
            length = 3;
        } else {
            ret = b & 0x07;
            length = 4;
        }

        // Check for truncated codepoints
        if (length > self._len) {
            return 0;
        }

        for (uint i = 1; i < length; i++) {
            divisor = divisor / 256;
            b = (word / divisor) & 0xFF;
            if (b & 0xC0 != 0x80) {
                // Invalid UTF-8 sequence
                return 0;
            }
            ret = (ret * 64) | (b & 0x3F);
        }

        return ret;
    }

    /*
     * @dev Returns the keccak-256 hash of the slice.
     * @param self The slice to hash.
     * @return The hash of the slice.
     */
    function keccak(slice memory self) internal pure returns (bytes32 ret) {
        assembly {
            ret := keccak256(mload(add(self, 32)), mload(self))
        }
    }

    /*
     * @dev Returns true if `self` starts with `needle`.
     * @param self The slice to operate on.
     * @param needle The slice to search for.
     * @return True if the slice starts with the provided text, false otherwise.
     */
    function startsWith(slice memory self, slice memory needle) internal pure returns (bool) {
        if (self._len < needle._len) {
            return false;
        }

        if (self._ptr == needle._ptr) {
            return true;
        }

        bool equal;
        assembly {
            let length := mload(needle)
            let selfptr := mload(add(self, 0x20))
            let needleptr := mload(add(needle, 0x20))
            equal := eq(keccak256(selfptr, length), keccak256(needleptr, length))
        }
        return equal;
    }

    /*
     * @dev If `self` starts with `needle`, `needle` is removed from the
     *      beginning of `self`. Otherwise, `self` is unmodified.
     * @param self The slice to operate on.
     * @param needle The slice to search for.
     * @return `self`
     */
    function beyond(slice memory self, slice memory needle) internal pure returns (slice memory) {
        if (self._len < needle._len) {
            return self;
        }

        bool equal = true;
        if (self._ptr != needle._ptr) {
            assembly {
                let length := mload(needle)
                let selfptr := mload(add(self, 0x20))
                let needleptr := mload(add(needle, 0x20))
                equal := eq(keccak256(selfptr, length), keccak256(needleptr, length))
            }
        }

        if (equal) {
            self._len -= needle._len;
            self._ptr += needle._len;
        }

        return self;
    }

    /*
     * @dev Returns true if the slice ends with `needle`.
     * @param self The slice to operate on.
     * @param needle The slice to search for.
     * @return True if the slice starts with the provided text, false otherwise.
     */
    function endsWith(slice memory self, slice memory needle) internal pure returns (bool) {
        if (self._len < needle._len) {
            return false;
        }

        uint selfptr = self._ptr + self._len - needle._len;

        if (selfptr == needle._ptr) {
            return true;
        }

        bool equal;
        assembly {
            let length := mload(needle)
            let needleptr := mload(add(needle, 0x20))
            equal := eq(keccak256(selfptr, length), keccak256(needleptr, length))
        }

        return equal;
    }

    /*
     * @dev If `self` ends with `needle`, `needle` is removed from the
     *      end of `self`. Otherwise, `self` is unmodified.
     * @param self The slice to operate on.
     * @param needle The slice to search for.
     * @return `self`
     */
    function until(slice memory self, slice memory needle) internal pure returns (slice memory) {
        if (self._len < needle._len) {
            return self;
        }

        uint selfptr = self._ptr + self._len - needle._len;
        bool equal = true;
        if (selfptr != needle._ptr) {
            assembly {
                let length := mload(needle)
                let needleptr := mload(add(needle, 0x20))
                equal := eq(keccak256(selfptr, length), keccak256(needleptr, length))
            }
        }

        if (equal) {
            self._len -= needle._len;
        }

        return self;
    }

    // Returns the memory address of the first byte of the first occurrence of
    // `needle` in `self`, or the first byte after `self` if not found.
    function findPtr(uint selflen, uint selfptr, uint needlelen, uint needleptr) private pure returns (uint) {
        uint ptr = selfptr;
        uint idx;

        if (needlelen <= selflen) {
            if (needlelen <= 32) {
                bytes32 mask = bytes32(~(2 ** (8 * (32 - needlelen)) - 1));

                bytes32 needledata;
                assembly { needledata := and(mload(needleptr), mask) }

                uint end = selfptr + selflen - needlelen;
                bytes32 ptrdata;
                assembly { ptrdata := and(mload(ptr), mask) }

                while (ptrdata != needledata) {
                    if (ptr >= end)
                        return selfptr + selflen;
                    ptr++;
                    assembly { ptrdata := and(mload(ptr), mask) }
                }
                return ptr;
            } else {
                // For long needles, use hashing
                bytes32 hash;
                assembly { hash := keccak256(needleptr, needlelen) }

                for (idx = 0; idx <= selflen - needlelen; idx++) {
                    bytes32 testHash;
                    assembly { testHash := keccak256(ptr, needlelen) }
                    if (hash == testHash)
                        return ptr;
                    ptr += 1;
                }
            }
        }
        return selfptr + selflen;
    }

    // Returns the memory address of the first byte after the last occurrence of
    // `needle` in `self`, or the address of `self` if not found.
    function rfindPtr(uint selflen, uint selfptr, uint needlelen, uint needleptr) private pure returns (uint) {
        uint ptr;

        if (needlelen <= selflen) {
            if (needlelen <= 32) {
                bytes32 mask = bytes32(~(2 ** (8 * (32 - needlelen)) - 1));

                bytes32 needledata;
                assembly { needledata := and(mload(needleptr), mask) }

                ptr = selfptr + selflen - needlelen;
                bytes32 ptrdata;
                assembly { ptrdata := and(mload(ptr), mask) }

                while (ptrdata != needledata) {
                    if (ptr <= selfptr)
                        return selfptr;
                    ptr--;
                    assembly { ptrdata := and(mload(ptr), mask) }
                }
                return ptr + needlelen;
            } else {
                // For long needles, use hashing
                bytes32 hash;
                assembly { hash := keccak256(needleptr, needlelen) }
                ptr = selfptr + (selflen - needlelen);
                while (ptr >= selfptr) {
                    bytes32 testHash;
                    assembly { testHash := keccak256(ptr, needlelen) }
                    if (hash == testHash)
                        return ptr + needlelen;
                    ptr -= 1;
                }
            }
        }
        return selfptr;
    }

    /*
     * @dev Modifies `self` to contain everything from the first occurrence of
     *      `needle` to the end of the slice. `self` is set to the empty slice
     *      if `needle` is not found.
     * @param self The slice to search and modify.
     * @param needle The text to search for.
     * @return `self`.
     */
    function find(slice memory self, slice memory needle) internal pure returns (slice memory) {
        uint ptr = findPtr(self._len, self._ptr, needle._len, needle._ptr);
        self._len -= ptr - self._ptr;
        self._ptr = ptr;
        return self;
    }

    /*
     * @dev Modifies `self` to contain the part of the string from the start of
     *      `self` to the end of the first occurrence of `needle`. If `needle`
     *      is not found, `self` is set to the empty slice.
     * @param self The slice to search and modify.
     * @param needle The text to search for.
     * @return `self`.
     */
    function rfind(slice memory self, slice memory needle) internal pure returns (slice memory) {
        uint ptr = rfindPtr(self._len, self._ptr, needle._len, needle._ptr);
        self._len = ptr - self._ptr;
        return self;
    }

    /*
     * @dev Splits the slice, setting `self` to everything after the first
     *      occurrence of `needle`, and `token` to everything before it. If
     *      `needle` does not occur in `self`, `self` is set to the empty slice,
     *      and `token` is set to the entirety of `self`.
     * @param self The slice to split.
     * @param needle The text to search for in `self`.
     * @param token An output parameter to which the first token is written.
     * @return `token`.
     */
    function split(slice memory self, slice memory needle, slice memory token) internal pure returns (slice memory) {
        uint ptr = findPtr(self._len, self._ptr, needle._len, needle._ptr);
        token._ptr = self._ptr;
        token._len = ptr - self._ptr;
        if (ptr == self._ptr + self._len) {
            // Not found
            self._len = 0;
        } else {
            self._len -= token._len + needle._len;
            self._ptr = ptr + needle._len;
        }
        return token;
    }

    /*
     * @dev Splits the slice, setting `self` to everything after the first
     *      occurrence of `needle`, and returning everything before it. If
     *      `needle` does not occur in `self`, `self` is set to the empty slice,
     *      and the entirety of `self` is returned.
     * @param self The slice to split.
     * @param needle The text to search for in `self`.
     * @return The part of `self` up to the first occurrence of `delim`.
     */
    function split(slice memory self, slice memory needle) internal pure returns (slice memory token) {
        split(self, needle, token);
    }

    /*
     * @dev Splits the slice, setting `self` to everything before the last
     *      occurrence of `needle`, and `token` to everything after it. If
     *      `needle` does not occur in `self`, `self` is set to the empty slice,
     *      and `token` is set to the entirety of `self`.
     * @param self The slice to split.
     * @param needle The text to search for in `self`.
     * @param token An output parameter to which the first token is written.
     * @return `token`.
     */
    function rsplit(slice memory self, slice memory needle, slice memory token) internal pure returns (slice memory) {
        uint ptr = rfindPtr(self._len, self._ptr, needle._len, needle._ptr);
        token._ptr = ptr;
        token._len = self._len - (ptr - self._ptr);
        if (ptr == self._ptr) {
            // Not found
            self._len = 0;
        } else {
            self._len -= token._len + needle._len;
        }
        return token;
    }

    /*
     * @dev Splits the slice, setting `self` to everything before the last
     *      occurrence of `needle`, and returning everything after it. If
     *      `needle` does not occur in `self`, `self` is set to the empty slice,
     *      and the entirety of `self` is returned.
     * @param self The slice to split.
     * @param needle The text to search for in `self`.
     * @return The part of `self` after the last occurrence of `delim`.
     */
    function rsplit(slice memory self, slice memory needle) internal pure returns (slice memory token) {
        rsplit(self, needle, token);
    }

    /*
     * @dev Counts the number of nonoverlapping occurrences of `needle` in `self`.
     * @param self The slice to search.
     * @param needle The text to search for in `self`.
     * @return The number of occurrences of `needle` found in `self`.
     */
    function count(slice memory self, slice memory needle) internal pure returns (uint cnt) {
        uint ptr = findPtr(self._len, self._ptr, needle._len, needle._ptr) + needle._len;
        while (ptr <= self._ptr + self._len) {
            cnt++;
            ptr = findPtr(self._len - (ptr - self._ptr), ptr, needle._len, needle._ptr) + needle._len;
        }
    }

    /*
     * @dev Returns True if `self` contains `needle`.
     * @param self The slice to search.
     * @param needle The text to search for in `self`.
     * @return True if `needle` is found in `self`, false otherwise.
     */
    function contains(slice memory self, slice memory needle) internal pure returns (bool) {
        return rfindPtr(self._len, self._ptr, needle._len, needle._ptr) != self._ptr;
    }

    /*
     * @dev Returns a newly allocated string containing the concatenation of
     *      `self` and `other`.
     * @param self The first slice to concatenate.
     * @param other The second slice to concatenate.
     * @return The concatenation of the two strings.
     */
    function concat(slice memory self, slice memory other) internal pure returns (string memory) {
        string memory ret = new string(self._len + other._len);
        uint retptr;
        assembly { retptr := add(ret, 32) }
        memcpy(retptr, self._ptr, self._len);
        memcpy(retptr + self._len, other._ptr, other._len);
        return ret;
    }

    /*
     * @dev Joins an array of slices, using `self` as a delimiter, returning a
     *      newly allocated string.
     * @param self The delimiter to use.
     * @param parts A list of slices to join.
     * @return A newly allocated string containing all the slices in `parts`,
     *         joined with `self`.
     */
    function join(slice memory self, slice[] memory parts) internal pure returns (string memory) {
        if (parts.length == 0)
            return "";

        uint length = self._len * (parts.length - 1);
        for(uint i = 0; i < parts.length; i++)
            length += parts[i]._len;

        string memory ret = new string(length);
        uint retptr;
        assembly { retptr := add(ret, 32) }

        for(i = 0; i < parts.length; i++) {
            memcpy(retptr, parts[i]._ptr, parts[i]._len);
            retptr += parts[i]._len;
            if (i < parts.length - 1) {
                memcpy(retptr, self._ptr, self._len);
                retptr += self._len;
            }
        }

        return ret;
    }
}

/**
 * @title ERC165
 * @dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md
 */
interface ERC165 {

  /**
   * @notice Query if a contract implements an interface
   * @param _interfaceId The interface identifier, as specified in ERC-165
   * @dev Interface identification is specified in ERC-165. This function
   * uses less than 30,000 gas.
   */
  function supportsInterface(bytes4 _interfaceId)
    external
    view
    returns (bool);
}

/**
 * @title ERC721 Non-Fungible Token Standard basic interface
 * @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
 */
contract ERC721Basic is ERC165 {

  bytes4 internal constant InterfaceId_ERC721 = 0x80ac58cd;
  /*
   * 0x80ac58cd ===
   *   bytes4(keccak256('balanceOf(address)')) ^
   *   bytes4(keccak256('ownerOf(uint256)')) ^
   *   bytes4(keccak256('approve(address,uint256)')) ^
   *   bytes4(keccak256('getApproved(uint256)')) ^
   *   bytes4(keccak256('setApprovalForAll(address,bool)')) ^
   *   bytes4(keccak256('isApprovedForAll(address,address)')) ^
   *   bytes4(keccak256('transferFrom(address,address,uint256)')) ^
   *   bytes4(keccak256('safeTransferFrom(address,address,uint256)')) ^
   *   bytes4(keccak256('safeTransferFrom(address,address,uint256,bytes)'))
   */

  bytes4 internal constant InterfaceId_ERC721Exists = 0x4f558e79;
  /*
   * 0x4f558e79 ===
   *   bytes4(keccak256('exists(uint256)'))
   */

  bytes4 internal constant InterfaceId_ERC721Enumerable = 0x780e9d63;
  /**
   * 0x780e9d63 ===
   *   bytes4(keccak256('totalSupply()')) ^
   *   bytes4(keccak256('tokenOfOwnerByIndex(address,uint256)')) ^
   *   bytes4(keccak256('tokenByIndex(uint256)'))
   */

  bytes4 internal constant InterfaceId_ERC721Metadata = 0x5b5e139f;
  /**
   * 0x5b5e139f ===
   *   bytes4(keccak256('name()')) ^
   *   bytes4(keccak256('symbol()')) ^
   *   bytes4(keccak256('tokenURI(uint256)'))
   */

  event Transfer(
    address indexed _from,
    address indexed _to,
    uint256 indexed _tokenId
  );
  event Approval(
    address indexed _owner,
    address indexed _approved,
    uint256 indexed _tokenId
  );
  event ApprovalForAll(
    address indexed _owner,
    address indexed _operator,
    bool _approved
  );

  function balanceOf(address _owner) public view returns (uint256 _balance);
  function ownerOf(uint256 _tokenId) public view returns (address _owner);
  function exists(uint256 _tokenId) public view returns (bool _exists);

  function approve(address _to, uint256 _tokenId) public;
  function getApproved(uint256 _tokenId)
    public view returns (address _operator);

  function setApprovalForAll(address _operator, bool _approved) public;
  function isApprovedForAll(address _owner, address _operator)
    public view returns (bool);

  function transferFrom(address _from, address _to, uint256 _tokenId) public;
  function safeTransferFrom(address _from, address _to, uint256 _tokenId)
    public;

  function safeTransferFrom(
    address _from,
    address _to,
    uint256 _tokenId,
    bytes _data
  )
    public;
}

/**
 * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
 * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
 */
contract ERC721Enumerable is ERC721Basic {
  function totalSupply() public view returns (uint256);
  function tokenOfOwnerByIndex(
    address _owner,
    uint256 _index
  )
    public
    view
    returns (uint256 _tokenId);

  function tokenByIndex(uint256 _index) public view returns (uint256);
}


/**
 * @title ERC-721 Non-Fungible Token Standard, optional metadata extension
 * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
 */
contract ERC721Metadata is ERC721Basic {
  function name() external view returns (string _name);
  function symbol() external view returns (string _symbol);
  function tokenURI(uint256 _tokenId) public view returns (string);
}


/**
 * @title ERC-721 Non-Fungible Token Standard, full implementation interface
 * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
 */
contract ERC721 is ERC721Basic, ERC721Enumerable, ERC721Metadata {
}

/**
 * @title ERC721 token receiver interface
 * @dev Interface for any contract that wants to support safeTransfers
 * from ERC721 asset contracts.
 */
contract ERC721Receiver {
  /**
   * @dev Magic value to be returned upon successful reception of an NFT
   *  Equals to `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`,
   *  which can be also obtained as `ERC721Receiver(0).onERC721Received.selector`
   */
  bytes4 internal constant ERC721_RECEIVED = 0x150b7a02;

  /**
   * @notice Handle the receipt of an NFT
   * @dev The ERC721 smart contract calls this function on the recipient
   * after a `safetransfer`. This function MAY throw to revert and reject the
   * transfer. Return of other than the magic value MUST result in the
   * transaction being reverted.
   * Note: the contract address is always the message sender.
   * @param _operator The address which called `safeTransferFrom` function
   * @param _from The address which previously owned the token
   * @param _tokenId The NFT identifier which is being transferred
   * @param _data Additional data with no specified format
   * @return `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`
   */
  function onERC721Received(
    address _operator,
    address _from,
    uint256 _tokenId,
    bytes _data
  )
    public
    returns(bytes4);
}

/**
 * @title SafeMath
 * @dev Math operations with safety checks that throw on error
 */
library SafeMath {

  /**
  * @dev Multiplies two numbers, throws on overflow.
  */
  function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
    // Gas optimization: this is cheaper than asserting 'a' not being zero, but the
    // benefit is lost if 'b' is also tested.
    // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
    if (_a == 0) {
      return 0;
    }

    c = _a * _b;
    assert(c / _a == _b);
    return c;
  }

  /**
  * @dev Integer division of two numbers, truncating the quotient.
  */
  function div(uint256 _a, uint256 _b) internal pure returns (uint256) {
    // assert(_b > 0); // Solidity automatically throws when dividing by 0
    // uint256 c = _a / _b;
    // assert(_a == _b * c + _a % _b); // There is no case in which this doesn't hold
    return _a / _b;
  }

  /**
  * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
  */
  function sub(uint256 _a, uint256 _b) internal pure returns (uint256) {
    assert(_b <= _a);
    return _a - _b;
  }

  /**
  * @dev Adds two numbers, throws on overflow.
  */
  function add(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
    c = _a + _b;
    assert(c >= _a);
    return c;
  }
}

/**
 * Utility library of inline functions on addresses
 */
library AddressUtils {

  /**
   * Returns whether the target address is a contract
   * @dev This function will return false if invoked during the constructor of a contract,
   * as the code is not actually created until after the constructor finishes.
   * @param _addr address to check
   * @return whether the target address is a contract
   */
  function isContract(address _addr) internal view returns (bool) {
    uint256 size;
    // XXX Currently there is no better way to check if there is a contract in an address
    // than to check the size of the code at that address.
    // See https://ethereum.stackexchange.com/a/14016/36603
    // for more details about how this works.
    // TODO Check this again before the Serenity release, because all addresses will be
    // contracts then.
    // solium-disable-next-line security/no-inline-assembly
    assembly { size := extcodesize(_addr) }
    return size > 0;
  }

}

/**
 * @title SupportsInterfaceWithLookup
 * @author Matt Condon (@shrugs)
 * @dev Implements ERC165 using a lookup table.
 */
contract SupportsInterfaceWithLookup is ERC165 {

  bytes4 public constant InterfaceId_ERC165 = 0x01ffc9a7;
  /**
   * 0x01ffc9a7 ===
   *   bytes4(keccak256('supportsInterface(bytes4)'))
   */

  /**
   * @dev a mapping of interface id to whether or not it's supported
   */
  mapping(bytes4 => bool) internal supportedInterfaces;

  /**
   * @dev A contract implementing SupportsInterfaceWithLookup
   * implement ERC165 itself
   */
  constructor()
    public
  {
    _registerInterface(InterfaceId_ERC165);
  }

  /**
   * @dev implement supportsInterface(bytes4) using a lookup table
   */
  function supportsInterface(bytes4 _interfaceId)
    external
    view
    returns (bool)
  {
    return supportedInterfaces[_interfaceId];
  }

  /**
   * @dev private method for registering an interface
   */
  function _registerInterface(bytes4 _interfaceId)
    internal
  {
    require(_interfaceId != 0xffffffff);
    supportedInterfaces[_interfaceId] = true;
  }
}

/**
 * @title ERC721 Non-Fungible Token Standard basic implementation
 * @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
 */
contract ERC721BasicToken is SupportsInterfaceWithLookup, ERC721Basic {

  using SafeMath for uint256;
  using AddressUtils for address;

  // Equals to `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`
  // which can be also obtained as `ERC721Receiver(0).onERC721Received.selector`
  bytes4 private constant ERC721_RECEIVED = 0x150b7a02;

  // Mapping from token ID to owner
  mapping (uint256 => address) internal tokenOwner;

  // Mapping from token ID to approved address
  mapping (uint256 => address) internal tokenApprovals;

  // Mapping from owner to number of owned token
  mapping (address => uint256) internal ownedTokensCount;

  // Mapping from owner to operator approvals
  mapping (address => mapping (address => bool)) internal operatorApprovals;

  constructor()
    public
  {
    // register the supported interfaces to conform to ERC721 via ERC165
    _registerInterface(InterfaceId_ERC721);
    _registerInterface(InterfaceId_ERC721Exists);
  }

  /**
   * @dev Gets the balance of the specified address
   * @param _owner address to query the balance of
   * @return uint256 representing the amount owned by the passed address
   */
  function balanceOf(address _owner) public view returns (uint256) {
    require(_owner != address(0));
    return ownedTokensCount[_owner];
  }

  /**
   * @dev Gets the owner of the specified token ID
   * @param _tokenId uint256 ID of the token to query the owner of
   * @return owner address currently marked as the owner of the given token ID
   */
  function ownerOf(uint256 _tokenId) public view returns (address) {
    address owner = tokenOwner[_tokenId];
    require(owner != address(0));
    return owner;
  }

  /**
   * @dev Returns whether the specified token exists
   * @param _tokenId uint256 ID of the token to query the existence of
   * @return whether the token exists
   */
  function exists(uint256 _tokenId) public view returns (bool) {
    address owner = tokenOwner[_tokenId];
    return owner != address(0);
  }

  /**
   * @dev Approves another address to transfer the given token ID
   * The zero address indicates there is no approved address.
   * There can only be one approved address per token at a given time.
   * Can only be called by the token owner or an approved operator.
   * @param _to address to be approved for the given token ID
   * @param _tokenId uint256 ID of the token to be approved
   */
  function approve(address _to, uint256 _tokenId) public {
    address owner = ownerOf(_tokenId);
    require(_to != owner);
    require(msg.sender == owner || isApprovedForAll(owner, msg.sender));

    tokenApprovals[_tokenId] = _to;
    emit Approval(owner, _to, _tokenId);
  }

  /**
   * @dev Gets the approved address for a token ID, or zero if no address set
   * @param _tokenId uint256 ID of the token to query the approval of
   * @return address currently approved for the given token ID
   */
  function getApproved(uint256 _tokenId) public view returns (address) {
    return tokenApprovals[_tokenId];
  }

  /**
   * @dev Sets or unsets the approval of a given operator
   * An operator is allowed to transfer all tokens of the sender on their behalf
   * @param _to operator address to set the approval
   * @param _approved representing the status of the approval to be set
   */
  function setApprovalForAll(address _to, bool _approved) public {
    require(_to != msg.sender);
    operatorApprovals[msg.sender][_to] = _approved;
    emit ApprovalForAll(msg.sender, _to, _approved);
  }

  /**
   * @dev Tells whether an operator is approved by a given owner
   * @param _owner owner address which you want to query the approval of
   * @param _operator operator address which you want to query the approval of
   * @return bool whether the given operator is approved by the given owner
   */
  function isApprovedForAll(
    address _owner,
    address _operator
  )
    public
    view
    returns (bool)
  {
    return operatorApprovals[_owner][_operator];
  }

  /**
   * @dev Transfers the ownership of a given token ID to another address
   * Usage of this method is discouraged, use `safeTransferFrom` whenever possible
   * Requires the msg sender to be the owner, approved, or operator
   * @param _from current owner of the token
   * @param _to address to receive the ownership of the given token ID
   * @param _tokenId uint256 ID of the token to be transferred
  */
  function transferFrom(
    address _from,
    address _to,
    uint256 _tokenId
  )
    public
  {
    require(isApprovedOrOwner(msg.sender, _tokenId));
    require(_from != address(0));
    require(_to != address(0));

    clearApproval(_from, _tokenId);
    removeTokenFrom(_from, _tokenId);
    addTokenTo(_to, _tokenId);

    emit Transfer(_from, _to, _tokenId);
  }

  /**
   * @dev Safely transfers the ownership of a given token ID to another address
   * If the target address is a contract, it must implement `onERC721Received`,
   * which is called upon a safe transfer, and return the magic value
   * `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`; otherwise,
   * the transfer is reverted.
   *
   * Requires the msg sender to be the owner, approved, or operator
   * @param _from current owner of the token
   * @param _to address to receive the ownership of the given token ID
   * @param _tokenId uint256 ID of the token to be transferred
  */
  function safeTransferFrom(
    address _from,
    address _to,
    uint256 _tokenId
  )
    public
  {
    // solium-disable-next-line arg-overflow
    safeTransferFrom(_from, _to, _tokenId, "");
  }

  /**
   * @dev Safely transfers the ownership of a given token ID to another address
   * If the target address is a contract, it must implement `onERC721Received`,
   * which is called upon a safe transfer, and return the magic value
   * `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`; otherwise,
   * the transfer is reverted.
   * Requires the msg sender to be the owner, approved, or operator
   * @param _from current owner of the token
   * @param _to address to receive the ownership of the given token ID
   * @param _tokenId uint256 ID of the token to be transferred
   * @param _data bytes data to send along with a safe transfer check
   */
  function safeTransferFrom(
    address _from,
    address _to,
    uint256 _tokenId,
    bytes _data
  )
    public
  {
    transferFrom(_from, _to, _tokenId);
    // solium-disable-next-line arg-overflow
    require(checkAndCallSafeTransfer(_from, _to, _tokenId, _data));
  }

  /**
   * @dev Returns whether the given spender can transfer a given token ID
   * @param _spender address of the spender to query
   * @param _tokenId uint256 ID of the token to be transferred
   * @return bool whether the msg.sender is approved for the given token ID,
   *  is an operator of the owner, or is the owner of the token
   */
  function isApprovedOrOwner(
    address _spender,
    uint256 _tokenId
  )
    internal
    view
    returns (bool)
  {
    address owner = ownerOf(_tokenId);
    // Disable solium check because of
    // https://github.com/duaraghav8/Solium/issues/175
    // solium-disable-next-line operator-whitespace
    return (
      _spender == owner ||
      getApproved(_tokenId) == _spender ||
      isApprovedForAll(owner, _spender)
    );
  }

  /**
   * @dev Internal function to mint a new token
   * Reverts if the given token ID already exists
   * @param _to The address that will own the minted token
   * @param _tokenId uint256 ID of the token to be minted by the msg.sender
   */
  function _mint(address _to, uint256 _tokenId) internal {
    require(_to != address(0));
    addTokenTo(_to, _tokenId);
    emit Transfer(address(0), _to, _tokenId);
  }

  /**
   * @dev Internal function to burn a specific token
   * Reverts if the token does not exist
   * @param _tokenId uint256 ID of the token being burned by the msg.sender
   */
  function _burn(address _owner, uint256 _tokenId) internal {
    clearApproval(_owner, _tokenId);
    removeTokenFrom(_owner, _tokenId);
    emit Transfer(_owner, address(0), _tokenId);
  }

  /**
   * @dev Internal function to clear current approval of a given token ID
   * Reverts if the given address is not indeed the owner of the token
   * @param _owner owner of the token
   * @param _tokenId uint256 ID of the token to be transferred
   */
  function clearApproval(address _owner, uint256 _tokenId) internal {
    require(ownerOf(_tokenId) == _owner);
    if (tokenApprovals[_tokenId] != address(0)) {
      tokenApprovals[_tokenId] = address(0);
    }
  }

  /**
   * @dev Internal function to add a token ID to the list of a given address
   * @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 addTokenTo(address _to, uint256 _tokenId) internal {
    require(tokenOwner[_tokenId] == address(0));
    tokenOwner[_tokenId] = _to;
    ownedTokensCount[_to] = ownedTokensCount[_to].add(1);
  }

  /**
   * @dev Internal function to remove a token ID from the list of a given address
   * @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 removeTokenFrom(address _from, uint256 _tokenId) internal {
    require(ownerOf(_tokenId) == _from);
    ownedTokensCount[_from] = ownedTokensCount[_from].sub(1);
    tokenOwner[_tokenId] = address(0);
  }

  /**
   * @dev Internal function to invoke `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 whether the call correctly returned the expected magic value
   */
  function checkAndCallSafeTransfer(
    address _from,
    address _to,
    uint256 _tokenId,
    bytes _data
  )
    internal
    returns (bool)
  {
    if (!_to.isContract()) {
      return true;
    }
    bytes4 retval = ERC721Receiver(_to).onERC721Received(
      msg.sender, _from, _tokenId, _data);
    return (retval == ERC721_RECEIVED);
  }
}

/**
 * @title Full ERC721 Token
 * This implementation includes all the required and some optional functionality of the ERC721 standard
 * Moreover, it includes approve all functionality using operator terminology
 * @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
 */
contract ERC721Token is SupportsInterfaceWithLookup, ERC721BasicToken, ERC721 {

  // Token name
  string internal name_;

  // Token symbol
  string internal symbol_;

  // Mapping from owner to list of owned token IDs
  mapping(address => uint256[]) internal ownedTokens;

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

  // Array with all token ids, used for enumeration
  uint256[] internal allTokens;

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

  // Optional mapping for token URIs
  mapping(uint256 => string) internal tokenURIs;

  /**
   * @dev Constructor function
   */
  constructor(string _name, string _symbol) public {
    name_ = _name;
    symbol_ = _symbol;

    // register the supported interfaces to conform to ERC721 via ERC165
    _registerInterface(InterfaceId_ERC721Enumerable);
    _registerInterface(InterfaceId_ERC721Metadata);
  }

  /**
   * @dev Gets the token name
   * @return string representing the token name
   */
  function name() external view returns (string) {
    return name_;
  }

  /**
   * @dev Gets the token symbol
   * @return string representing the token symbol
   */
  function symbol() external view returns (string) {
    return symbol_;
  }

  /**
   * @dev Returns an URI for a given token ID
   * Throws if the token ID does not exist. May return an empty string.
   * @param _tokenId uint256 ID of the token to query
   */
  function tokenURI(uint256 _tokenId) public view returns (string) {
    require(exists(_tokenId));
    return tokenURIs[_tokenId];
  }

  /**
   * @dev Gets the token ID at a given index of the tokens list of the requested owner
   * @param _owner address owning the tokens list to be accessed
   * @param _index uint256 representing the index to be accessed of the requested tokens list
   * @return uint256 token ID at the given index of the tokens list owned by the requested address
   */
  function tokenOfOwnerByIndex(
    address _owner,
    uint256 _index
  )
    public
    view
    returns (uint256)
  {
    require(_index < balanceOf(_owner));
    return ownedTokens[_owner][_index];
  }

  /**
   * @dev Gets the total amount of tokens stored by the contract
   * @return uint256 representing the total amount of tokens
   */
  function totalSupply() public view returns (uint256) {
    return allTokens.length;
  }

  /**
   * @dev Gets the token ID at a given index of all the tokens in this contract
   * Reverts if the index is greater or equal to the total number of tokens
   * @param _index uint256 representing the index to be accessed of the tokens list
   * @return uint256 token ID at the given index of the tokens list
   */
  function tokenByIndex(uint256 _index) public view returns (uint256) {
    require(_index < totalSupply());
    return allTokens[_index];
  }

  /**
   * @dev Internal function to set the token URI for a given token
   * Reverts if the token ID does not exist
   * @param _tokenId uint256 ID of the token to set its URI
   * @param _uri string URI to assign
   */
  function _setTokenURI(uint256 _tokenId, string _uri) internal {
    require(exists(_tokenId));
    tokenURIs[_tokenId] = _uri;
  }

  /**
   * @dev Internal function to add a token ID to the list of a given address
   * @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 addTokenTo(address _to, uint256 _tokenId) internal {
    super.addTokenTo(_to, _tokenId);
    uint256 length = ownedTokens[_to].length;
    ownedTokens[_to].push(_tokenId);
    ownedTokensIndex[_tokenId] = length;
  }

  /**
   * @dev Internal function to remove a token ID from the list of a given address
   * @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 removeTokenFrom(address _from, uint256 _tokenId) internal {
    super.removeTokenFrom(_from, _tokenId);

    // To prevent a gap in the array, we store the last token in the index of the token to delete, and
    // then delete the last slot.
    uint256 tokenIndex = ownedTokensIndex[_tokenId];
    uint256 lastTokenIndex = ownedTokens[_from].length.sub(1);
    uint256 lastToken = ownedTokens[_from][lastTokenIndex];

    ownedTokens[_from][tokenIndex] = lastToken;
    // This also deletes the contents at the last position of the array
    ownedTokens[_from].length--;

    // Note that this will handle single-element arrays. In that case, both tokenIndex and lastTokenIndex are going to
    // be zero. Then we can make sure that we will remove _tokenId from the ownedTokens list since we are first swapping
    // the lastToken to the first position, and then dropping the element placed in the last position of the list

    ownedTokensIndex[_tokenId] = 0;
    ownedTokensIndex[lastToken] = tokenIndex;
  }

  /**
   * @dev Internal function to mint a new token
   * Reverts if the given token ID already exists
   * @param _to address the beneficiary that will own the minted token
   * @param _tokenId uint256 ID of the token to be minted by the msg.sender
   */
  function _mint(address _to, uint256 _tokenId) internal {
    super._mint(_to, _tokenId);

    allTokensIndex[_tokenId] = allTokens.length;
    allTokens.push(_tokenId);
  }

  /**
   * @dev Internal function to burn a specific token
   * Reverts if the token does not exist
   * @param _owner owner of the token to burn
   * @param _tokenId uint256 ID of the token being burned by the msg.sender
   */
  function _burn(address _owner, uint256 _tokenId) internal {
    super._burn(_owner, _tokenId);

    // Clear metadata (if any)
    if (bytes(tokenURIs[_tokenId]).length != 0) {
      delete tokenURIs[_tokenId];
    }

    // Reorg all tokens array
    uint256 tokenIndex = allTokensIndex[_tokenId];
    uint256 lastTokenIndex = allTokens.length.sub(1);
    uint256 lastToken = allTokens[lastTokenIndex];

    allTokens[tokenIndex] = lastToken;
    allTokens[lastTokenIndex] = 0;

    allTokens.length--;
    allTokensIndex[_tokenId] = 0;
    allTokensIndex[lastToken] = tokenIndex;
  }

}

/// @title Contract for Chainbreakers Items (ERC721Token)
/// @author Tobias Thiele - Qwellcode GmbH - www.qwellcode.de

/*  HOSTFILE
*   0 = 3D Model (*.glb)
*   1 = Icon
*   2 = Thumbnail
*   3 = Transparent
*/

/*  RARITY
*   0 = Common
*   1 = Uncommon
*   2 = Rare
*   3 = Epic
*   4 = Legendary
*/

/*  WEAPONS
*   0 = Axe
*   1 = Mace
*   2 = Sword
*/

/*  STATS
*   0 = MQ - Motivational Quotient - Charisma
*   1 = PQ - Physical Quotient - Vitality
*   2 = IQ - Intelligence Quotient - Intellect
*   3 = EQ - Experience Quotient - Wisdom
*   4 = LQ - Learning Agility Quotient - Dexterity
*   5 = TQ - Technical Quotient - Tactics
*/







/** @dev used to manage payment in MANA */
contract MANAInterface {
    function transferFrom(address _from, address _to, uint256 _value) public returns (bool);
    function approve(address _spender, uint256 _value) public returns (bool);
    function balanceOf(address _owner) public view returns (uint256);
    function transfer(address _to, uint256 _value) public returns (bool);
}

contract OwnableDelegateProxy { }

contract ProxyRegistry {
    mapping(address => OwnableDelegateProxy) public proxies;
}

contract ChainbreakersItemsERC721 is ERC721Token("Chainbreakers Items", "CBI"), BasicAccessControl, randomRange {

    address proxyRegistryAddress;

    using SafeMath for uint256;
    using strings for *;

    uint256 public totalItems;
    uint256 public totalItemClass;
    uint256 public totalTokens;
    uint8 public currentGen;

    string _baseURI = "http://api.chainbreakers.io/api/v1/items/metadata?tokenId=";


    uint public presaleStart = 1541073600;

    // use as seed for random
    address private lastMinter;

    ItemClass[] private globalClasses;

    mapping(uint256 => ItemData) public tokenToData;
    mapping(uint256 => ItemClass) public classIdToClass;

    struct ItemClass {
        uint256 classId;
        string name;
        uint16 amount;
        string hostfile;
        uint16 minLevel;
        uint16 rarity;
        uint16 weapon;
        uint[] category;
        uint[] statsMin;
        uint[] statsMax;
        string desc;
        uint256 total;
        uint price;
        bool active;
    }

    struct ItemData {
        uint256 tokenId;
        uint256 classId;
        uint[] stats;
        uint8 gen;
    }

    event ItemMinted(uint classId, uint price, uint256 total, uint tokenId);
    event GenerationIncreased(uint8 currentGen);
    event OwnerPayed(uint amount);
    event OwnerPayedETH(uint amount);

    // declare interface for communication between smart contracts
    MANAInterface MANAContract;

    /* HELPER FUNCTIONS - START */
    /** @dev Concatenate two strings
      * @param _a The first string
      * @param _b The second string
      */
    function addToString(string _a, string _b) internal pure returns(string) {
        return _a.toSlice().concat(_b.toSlice());
    }

    /** @dev Converts an uint to a string
      * @notice used with addToString() to generate the tokenURI
      * @param i The uint you want to convert into a string
      */
    function uint2str(uint i) internal pure returns(string) {
        if (i == 0) return "0";
        uint j = i;
        uint length;
        while (j != 0){
            length++;
            j /= 10;
        }
        bytes memory bstr = new bytes(length);
        uint k = length - 1;
        while (i != 0){
            bstr[k--] = byte(48 + i % 10);
            i /= 10;
        }
        return string(bstr);
    }
    /* HELPER FUNCTIONS - END */

    constructor(address _proxyRegistryAddress) public {
        proxyRegistryAddress = _proxyRegistryAddress;
    }

    /** @dev changes the date of the start of the presale
      * @param _start Timestamp the presale starts
      */
    function changePresaleData(uint _start) public onlyModerators {
        presaleStart = _start;
    }

    /** @dev Used to init the communication between our contracts
      * @param _manaContractAddress The contract address for the currency you want to accept e.g. MANA
      */
    function setDatabase(address _manaContractAddress) public onlyModerators {
        MANAContract = MANAInterface(_manaContractAddress); // change to official MANA contract address alter (0x0f5d2fb29fb7d3cfee444a200298f468908cc942)
    }

    /** @dev changes the tokenURI of all minted items + the _baseURI value
      * @param _newBaseURI base url to the api which reads the meta data from the contract e.g. "http://api.chainbreakers.io/api/v1/items/metadata?tokenId="
      */
    function changeBaseURIAll(string _newBaseURI) public onlyModerators {
        _baseURI = _newBaseURI;

        for(uint a = 0; a < totalTokens; a++) {
            uint tokenId = tokenByIndex(a);
            _setTokenURI(tokenId, addToString(_newBaseURI, uint2str(tokenId)));
        }
    }

    /** @dev changes the _baseURI value
      * @param _newBaseURI base url to the api which reads the meta data from the contract e.g. "http://api.chainbreakers.io/api/v1/items/metadata?tokenId="
      */
    function changeBaseURI(string _newBaseURI) public onlyModerators {
        _baseURI = _newBaseURI;
    }

    /** @dev changes the active state of an item class by its class id
      * @param _classId calss id of the item class
      * @param _active active state of the item class
      */
    function editActiveFromClassId(uint256 _classId, bool _active) public onlyModerators {
        ItemClass storage _itemClass = classIdToClass[_classId];
        _itemClass.active = _active;
    }

    /** @dev Adds an item to the contract which can be minted by the user paying the selected currency (MANA)
      * @notice You will find a list of the meanings of the individual indexes on top of the document
      * @param _name The name of the item
      * @param _rarity Defines the rarity on an item
      * @param _weapon Defines which weapon this item is
      * @param _statsMin An array of integers of the lowest stats an item can have
      * @param _statsMax An array of integers of the highest stats an item can have
      * @param _amount Defines how many items can be minted in general
      * @param _hostfile A string contains links to the 3D object, the icon and the thumbnail
      * @notice All links inside the _hostfile string has to be seperated by commas. Use `.split(",")` to get an array in frontend
      * @param _minLevel The lowest level a unit has to be to equip this item
      * @param _desc An optional item description used for legendary items mostly
      * @param _price The price of the item
      */
    function addItemWithClassAndData(string _name, uint16 _rarity, uint16 _weapon, uint[] _statsMin, uint[] _statsMax, uint16 _amount, string _hostfile, uint16 _minLevel, string _desc, uint _price) public onlyModerators {
        ItemClass storage _itemClass = classIdToClass[totalItemClass];
        _itemClass.classId = totalItemClass;
        _itemClass.name = _name;
        _itemClass.amount = _amount;
        _itemClass.rarity = _rarity;
        _itemClass.weapon = _weapon;
        _itemClass.statsMin = _statsMin;
        _itemClass.statsMax = _statsMax;
        _itemClass.hostfile = _hostfile;
        _itemClass.minLevel = _minLevel;
        _itemClass.desc = _desc;
        _itemClass.total = 0;
        _itemClass.price = _price;
        _itemClass.active = true;

        totalItemClass = globalClasses.push(_itemClass);

        totalItems++;
    }

    /** @dev The function the user calls to buy the selected item for a given price
      * @notice The price of the items increases after each bought item by a given amount
      * @param _classId The class id of the item which the user wants to buy
      */
    function buyItem(uint256 _classId) public {
        require(now > presaleStart, "The presale is not started yet");

        ItemClass storage class = classIdToClass[_classId];
        require(class.active == true, "This item is not for sale");
        require(class.amount > 0);

        require(class.total < class.amount, "Sold out");
        require(class.statsMin.length == class.statsMax.length);

        if (class.price > 0) {
            require(MANAContract != address(0), "Invalid contract address for MANA. Please use the setDatabase() function first.");
            require(MANAContract.transferFrom(msg.sender, address(this), class.price) == true, "Failed transfering MANA");
        }

        _mintItem(_classId, msg.sender);
    }

    /** @dev This function mints the item on the blockchain and generates an ERC721 token
      * @notice All stats of the item are randomly generated by using the getRandom() function using min and max values
      * @param _classId The class id of the item which one will be minted
      * @param _address The address of the owner of the new item
      */
    function _mintItem(uint256 _classId, address _address) internal {
        ItemClass storage class = classIdToClass[_classId];
        uint[] memory stats = new uint[](6);
        for(uint j = 0; j < class.statsMin.length; j++) {
            if (class.statsMax[j] > 0) {
                if (stats.length == class.statsMin.length) {
                    stats[j] = getRandom(class.statsMin[j], class.statsMax[j], uint8(j + _classId + class.total), lastMinter);
                }
            } else {
                if (stats.length == class.statsMin.length) {
                    stats[j] = 0;
                }
            }
        }

        ItemData storage _itemData = tokenToData[totalTokens + 1];
        _itemData.tokenId = totalTokens + 1;
        _itemData.classId = _classId;
        _itemData.stats = stats;
        _itemData.gen = currentGen;

        class.total += 1;
        totalTokens += 1;
        _mint(_address, totalTokens);
        _setTokenURI(totalTokens, addToString(_baseURI, uint2str(totalTokens)));

        lastMinter = _address;

        emit ItemMinted(class.classId, class.price, class.total, totalTokens);
    }

    /** @dev Gets the min and the max range of stats a given class id can have
      * @param _classId The class id of the item you want to return the stats of
      * @return statsMin An array of the lowest stats the given item can have
      * @return statsMax An array of the highest stats the given item can have
      */
    function getStatsRange(uint256 _classId) public view returns(uint[] statsMin, uint[] statsMax) {
        return (classIdToClass[_classId].statsMin, classIdToClass[_classId].statsMax);
    }

    /** @dev Gets information about the item stands behind the given token
      * @param _tokenId The id of the token you want to get the item data from
      * @return tokenId The id of the token
      * @return classId The class id of the item behind the token
      * @return stats The randomly generated stats of the item behind the token
      * @return gen The generation of the item
      */
    function getItemDataByToken(uint256 _tokenId) public view returns(uint256 tokenId, uint256 classId, uint[] stats, uint8 gen) {
        return (tokenToData[_tokenId].tokenId, tokenToData[_tokenId].classId, tokenToData[_tokenId].stats, tokenToData[_tokenId].gen);
    }

    /** @dev Returns information about the item category of the given class id
      * @param _classId The class id of the item you want to return the stats of
      * @return classId The class id of the item
      * @return category An array contains information about the category of the item
      */
    function getItemCategory(uint256 _classId) public view returns(uint256 classId, uint[] category) {
        return (classIdToClass[_classId].classId, classIdToClass[_classId].category);
    }

    /** @dev Edits the item class
      * @param _classId The class id of the item you want to edit
      * @param _name The name of the item
      * @param _rarity Defines the rarity on an item
      * @param _weapon Defines which weapon this item is
      * @param _statsMin An array of integers of the lowest stats an item can have
      * @param _statsMax An array of integers of the highest stats an item can have
      * @param _amount Defines how many items can be minted in general
      * @param _hostfile A string contains links to the 3D object, the icon and the thumbnail
      * @notice All links inside the _hostfile string has to be seperated by commas. Use `.split(",")` to get an array in frontend
      * @param _minLevel The lowest level a unit has to be to equip this item
      * @param _desc An optional item description used for legendary items mostly
      * @param _price The price of the item
      */
    function editClass(uint256 _classId, string _name, uint16 _rarity, uint16 _weapon, uint[] _statsMin, uint[] _statsMax, uint16 _amount, string _hostfile, uint16 _minLevel, string _desc, uint _price) public onlyModerators {
        ItemClass storage _itemClass = classIdToClass[_classId];
        _itemClass.name = _name;
        _itemClass.rarity = _rarity;
        _itemClass.weapon = _weapon;
        _itemClass.statsMin = _statsMin;
        _itemClass.statsMax = _statsMax;
        _itemClass.amount = _amount;
        _itemClass.hostfile = _hostfile;
        _itemClass.minLevel = _minLevel;
        _itemClass.desc = _desc;
        _itemClass.price = _price;
    }

    /** @dev Returns a count of created item classes
      * @return totalClasses Integer of how many items are able to be minted
      */
    function countItemsByClass() public view returns(uint totalClasses) {
        return (globalClasses.length);
    }

    /** @dev This function mints an item as a quest reward. The quest contract needs to be added as a moderator
      * @param _classId The id of the item should be minted
      * @param _address The address of the future owner of the minted item
      */
    function mintItemFromQuest(uint256 _classId, address _address) public onlyModerators {
        _mintItem(_classId, _address);
    }

    /** @dev Changes the tokenURI from a minted item by its tokenId
      * @param _tokenId The id of the token
      * @param _uri The new URI of the token for metadata e.g. http://api.chainbreakers.io/api/v1/items/metadata?tokenId=TOKEN_ID
      */
    function changeURIFromTokenByTokenId(uint256 _tokenId, string _uri) public onlyModerators {
        _setTokenURI(_tokenId, _uri);
    }

    function increaseGen() public onlyModerators {
        currentGen += 1;

        emit GenerationIncreased(currentGen);
    }

    /** @dev Function to get a given amount of MANA from this contract.
      * @param _amount The amount of coins you want to get from this contract.
      */
    function payOwner(uint _amount) public onlyOwner {
        MANAContract.transfer(msg.sender, _amount);
        emit OwnerPayed(_amount);
    }

    /** @dev Returns all MANA from this contract to the owner of the contract. */
    function payOwnerAll() public onlyOwner {
        uint tokens = MANAContract.balanceOf(address(this));
        MANAContract.transfer(msg.sender, tokens);
        emit OwnerPayed(tokens);
    }

    /** @dev Function to get a given amount of ETH from this contract.
      * @param _amount The amount of coins you want to get from this contract.
      */
    function payOwnerETH(uint _amount) public onlyOwner {
        msg.sender.transfer(_amount);
        emit OwnerPayedETH(_amount);
    }

    /** @dev Returns all ETH from this contract to the owner of the contract. */
    function payOwnerAllETH() public onlyOwner {
        uint balance = address(this).balance;
        msg.sender.transfer(balance);
        emit OwnerPayedETH(balance);
    }

    function isApprovedForAll(address owner, address operator) public view returns (bool) {
        // Whitelist OpenSea proxy contract for easy trading.
        ProxyRegistry proxyRegistry = ProxyRegistry(proxyRegistryAddress);
        if (proxyRegistry.proxies(owner) == operator) {
            return true;
        }

        return super.isApprovedForAll(owner, operator);
    }
}

Contract Security Audit

Contract ABI

[{"constant":true,"inputs":[{"name":"_interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"classIdToClass","outputs":[{"name":"classId","type":"uint256"},{"name":"name","type":"string"},{"name":"amount","type":"uint16"},{"name":"hostfile","type":"string"},{"name":"minLevel","type":"uint16"},{"name":"rarity","type":"uint16"},{"name":"weapon","type":"uint16"},{"name":"desc","type":"string"},{"name":"total","type":"uint256"},{"name":"price","type":"uint256"},{"name":"active","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_amount","type":"uint256"}],"name":"payOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_tokenId","type":"uint256"}],"name":"approve","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_newBaseURI","type":"string"}],"name":"changeBaseURIAll","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"InterfaceId_ERC165","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalItems","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_classId","type":"uint256"}],"name":"getStatsRange","outputs":[{"name":"statsMin","type":"uint256[]"},{"name":"statsMax","type":"uint256[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getModerators","outputs":[{"name":"","type":"address[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_classId","type":"uint256"},{"name":"_active","type":"bool"}],"name":"editActiveFromClassId","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_newBaseURI","type":"string"}],"name":"changeBaseURI","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_isMaintaining","type":"bool"}],"name":"UpdateMaintaining","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"increaseGen","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalModerators","outputs":[{"name":"","type":"uint16"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"exists","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_amount","type":"uint256"}],"name":"payOwnerETH","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_newModerator","type":"address"}],"name":"AddModerator","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_classId","type":"uint256"}],"name":"getItemCategory","outputs":[{"name":"classId","type":"uint256"},{"name":"category","type":"uint256[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalTokens","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_classId","type":"uint256"},{"name":"_name","type":"string"},{"name":"_rarity","type":"uint16"},{"name":"_weapon","type":"uint16"},{"name":"_statsMin","type":"uint256[]"},{"name":"_statsMax","type":"uint256[]"},{"name":"_amount","type":"uint16"},{"name":"_hostfile","type":"string"},{"name":"_minLevel","type":"uint16"},{"name":"_desc","type":"string"},{"name":"_price","type":"uint256"}],"name":"editClass","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalItemClass","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"countItemsByClass","outputs":[{"name":"totalClasses","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getItemDataByToken","outputs":[{"name":"tokenId","type":"uint256"},{"name":"classId","type":"uint256"},{"name":"stats","type":"uint256[]"},{"name":"gen","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_start","type":"uint256"}],"name":"changePresaleData","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tokenToData","outputs":[{"name":"tokenId","type":"uint256"},{"name":"classId","type":"uint256"},{"name":"gen","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"currentGen","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_oldModerator","type":"address"}],"name":"RemoveModerator","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_tokenId","type":"uint256"},{"name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"payOwnerAllETH","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"payOwnerAll","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"presaleStart","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_uri","type":"string"}],"name":"changeURIFromTokenByTokenId","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_classId","type":"uint256"},{"name":"_address","type":"address"}],"name":"mintItemFromQuest","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_classId","type":"uint256"}],"name":"buyItem","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"owner","type":"address"},{"name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_name","type":"string"},{"name":"_rarity","type":"uint16"},{"name":"_weapon","type":"uint16"},{"name":"_statsMin","type":"uint256[]"},{"name":"_statsMax","type":"uint256[]"},{"name":"_amount","type":"uint16"},{"name":"_hostfile","type":"string"},{"name":"_minLevel","type":"uint16"},{"name":"_desc","type":"string"},{"name":"_price","type":"uint256"}],"name":"addItemWithClassAndData","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"isMaintaining","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_newOwner","type":"address"}],"name":"ChangeOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_manaContractAddress","type":"address"}],"name":"setDatabase","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_address","type":"address"}],"name":"isModerator","outputs":[{"name":"","type":"bool"},{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_proxyRegistryAddress","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"name":"classId","type":"uint256"},{"indexed":false,"name":"price","type":"uint256"},{"indexed":false,"name":"total","type":"uint256"},{"indexed":false,"name":"tokenId","type":"uint256"}],"name":"ItemMinted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"currentGen","type":"uint8"}],"name":"GenerationIncreased","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"amount","type":"uint256"}],"name":"OwnerPayed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"amount","type":"uint256"}],"name":"OwnerPayedETH","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_from","type":"address"},{"indexed":true,"name":"_to","type":"address"},{"indexed":true,"name":"_tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_owner","type":"address"},{"indexed":true,"name":"_approved","type":"address"},{"indexed":true,"name":"_tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_owner","type":"address"},{"indexed":true,"name":"_operator","type":"address"},{"indexed":false,"name":"_approved","type":"bool"}],"name":"ApprovalForAll","type":"event"}]

600e805461ffff191690556010805460ff1916600117905560e0604052603a60808190527f687474703a2f2f6170692e636861696e627265616b6572732e696f2f6170692f60a09081527f76312f6974656d732f6d657461646174613f746f6b656e49643d00000000000060c0526200007c9160159190620003c2565b50635bdaeac06016553480156200009257600080fd5b5060405160208062003bbc83398101604081815291518282018352601382527f436861696e627265616b657273204974656d73000000000000000000000000006020808401919091528351808501909452600384527f43424900000000000000000000000000000000000000000000000000000000009084015291620001417f01ffc9a70000000000000000000000000000000000000000000000000000000064010000000062000294810204565b620001757f80ac58cd0000000000000000000000000000000000000000000000000000000064010000000062000294810204565b620001a97f4f558e790000000000000000000000000000000000000000000000000000000064010000000062000294810204565b8151620001be906005906020850190620003c2565b508051620001d4906006906020840190620003c2565b50620002097f780e9d630000000000000000000000000000000000000000000000000000000064010000000062000294810204565b6200023d7f5b5e139f0000000000000000000000000000000000000000000000000000000064010000000062000294810204565b5050600c8054600160a060020a03191633908117909155620002689064010000000062000301810204565b60108054600160a060020a039092166101000261010060a860020a031990921691909117905562000467565b7fffffffff000000000000000000000000000000000000000000000000000000008082161415620002c457600080fd5b7fffffffff00000000000000000000000000000000000000000000000000000000166000908152602081905260409020805460ff19166001179055565b600c54600160a060020a031633146200031957600080fd5b600160a060020a0381166000908152600f602052604090205460ff161515620003bf57600160a060020a0381166000818152600f602052604081208054600160ff199091168117909155600d8054808301825592527fd7b6990105719101dabeb77144f2a3385c8033acd3af97e9423a695e81ad1eb59091018054600160a060020a031916909217909155600e805461ffff19811661ffff918216909301169190911790555b50565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200040557805160ff191683800117855562000435565b8280016001018555821562000435579182015b828111156200043557825182559160200191906001019062000418565b506200044392915062000447565b5090565b6200046491905b808211156200044357600081556001016200044e565b90565b61374580620004776000396000f30060806040526004361061027c5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166301ffc9a78114610281578063023eb6c4146102b757806306fdde031461046f578063081812fc146104f957806308d78c3c1461052d578063095ea7b3146105475780630c80f6561461056b57806318160ddd146105c457806319fa8f50146105eb57806323b872dd1461061d5780632799276d146106475780632ddcd2981461065c5780632f745c591461070d5780632fc3f1941461073157806338ddbd051461079657806339a0c6f9146107b357806342842e0e1461080c57806348ef5aa8146108365780634d4542af146108505780634efb023e146108655780634f558e79146108915780634f6ccce7146108a95780636352211e146108c157806363538dab146108d95780636c81fd6d146108f157806370a08231146109125780637584f759146109335780637e1c0c09146109a65780638da5cb5b146109bb5780638defe4fa146109d0578063910df49b14610b495780639340992414610b5e57806395d89b4114610b73578063a22cb46514610b88578063a4d36f9014610bae578063ace0e97e14610c35578063ae3d541414610c4d578063b753485f14610c86578063b85d627514610cb1578063b88d4fde14610cd2578063c87b56dd14610d41578063d314b64714610d59578063db0fa98914610d6e578063de8801e514610d83578063e0770a5514610d98578063e28d5fe314610df6578063e7fb74c714610e1a578063e985e9c514610e32578063ebdf975a14610e59578063ee4e441614610fcd578063f285329214610fe2578063f542037414611003578063fa6f393614611024575b600080fd5b34801561028d57600080fd5b506102a3600160e060020a031960043516611068565b604080519115158252519081900360200190f35b3480156102c357600080fd5b506102cf600435611087565b604051808c8152602001806020018b61ffff1661ffff168152602001806020018a61ffff1661ffff1681526020018961ffff1661ffff1681526020018861ffff1661ffff168152602001806020018781526020018681526020018515151515815260200184810384528e818151815260200191508051906020019080838360005b83811015610368578181015183820152602001610350565b50505050905090810190601f1680156103955780820380516001836020036101000a031916815260200191505b5084810383528c5181528c516020918201918e019080838360005b838110156103c85781810151838201526020016103b0565b50505050905090810190601f1680156103f55780820380516001836020036101000a031916815260200191505b5084810382528851815288516020918201918a019080838360005b83811015610428578181015183820152602001610410565b50505050905090810190601f1680156104555780820380516001836020036101000a031916815260200191505b509e50505050505050505050505050505060405180910390f35b34801561047b57600080fd5b50610484611294565b6040805160208082528351818301528351919283929083019185019080838360005b838110156104be5781810151838201526020016104a6565b50505050905090810190601f1680156104eb5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561050557600080fd5b5061051160043561132b565b60408051600160a060020a039092168252519081900360200190f35b34801561053957600080fd5b50610545600435611346565b005b34801561055357600080fd5b50610545600160a060020a036004351660243561142c565b34801561057757600080fd5b506040805160206004803580820135601f81018490048402850184019095528484526105459436949293602493928401919081908401838280828437509497506114d59650505050505050565b3480156105d057600080fd5b506105d9611551565b60408051918252519081900360200190f35b3480156105f757600080fd5b50610600611557565b60408051600160e060020a03199092168252519081900360200190f35b34801561062957600080fd5b50610545600160a060020a036004358116906024351660443561157b565b34801561065357600080fd5b506105d961161e565b34801561066857600080fd5b50610674600435611624565b604051808060200180602001838103835285818151815260200191508051906020019060200280838360005b838110156106b85781810151838201526020016106a0565b50505050905001838103825284818151815260200191508051906020019060200280838360005b838110156106f75781810151838201526020016106df565b5050505090500194505050505060405180910390f35b34801561071957600080fd5b506105d9600160a060020a03600435166024356116eb565b34801561073d57600080fd5b50610746611738565b60408051602080825283518183015283519192839290830191858101910280838360005b8381101561078257818101518382015260200161076a565b505050509050019250505060405180910390f35b3480156107a257600080fd5b506105456004356024351515611799565b3480156107bf57600080fd5b506040805160206004803580820135601f81018490048402850184019095528484526105459436949293602493928401919081908401838280828437509497506117de9650505050505050565b34801561081857600080fd5b50610545600160a060020a0360043581169060243516604435611816565b34801561084257600080fd5b506105456004351515611832565b34801561085c57600080fd5b5061054561185c565b34801561087157600080fd5b5061087a6118cd565b6040805161ffff9092168252519081900360200190f35b34801561089d57600080fd5b506102a36004356118d7565b3480156108b557600080fd5b506105d96004356118f4565b3480156108cd57600080fd5b50610511600435611929565b3480156108e557600080fd5b50610545600435611953565b3480156108fd57600080fd5b50610545600160a060020a03600435166119ce565b34801561091e57600080fd5b506105d9600160a060020a0360043516611a8d565b34801561093f57600080fd5b5061094b600435611ac0565b6040518083815260200180602001828103825283818151815260200191508051906020019060200280838360005b83811015610991578181015183820152602001610979565b50505050905001935050505060405180910390f35b3480156109b257600080fd5b506105d9611b30565b3480156109c757600080fd5b50610511611b36565b3480156109dc57600080fd5b5060408051602060046024803582810135601f81018590048502860185019096528585526105459583359536956044949193909101919081908401838280828437505060408051818801358901803560208181028481018201909552818452989b61ffff8b3581169c8b8d01359091169b919a90995060609091019750929550908201935091829185019084908082843750506040805187358901803560208181028481018201909552818452989b9a99890198929750908201955093508392508501908490808284375050604080516020601f818a01358b0180359182018390048302840183018552818452989b61ffff8b35169b909a90999401975091955091820193509150819084018382808284375050604080516020601f818a01358b0180359182018390048302840183018552818452989b61ffff8b35169b909a9099940197509195509182019350915081908401838280828437509497505093359450611b459350505050565b348015610b5557600080fd5b506105d9611c50565b348015610b6a57600080fd5b506105d9611c56565b348015610b7f57600080fd5b50610484611c5c565b348015610b9457600080fd5b50610545600160a060020a03600435166024351515611cbd565b348015610bba57600080fd5b50610bc6600435611d41565b60405180858152602001848152602001806020018360ff1660ff168152602001828103825284818151815260200191508051906020019060200280838360005b83811015610c1e578181015183820152602001610c06565b505050509050019550505050505060405180910390f35b348015610c4157600080fd5b50610545600435611dc9565b348015610c5957600080fd5b50610c65600435611def565b60408051938452602084019290925260ff1682820152519081900360600190f35b348015610c9257600080fd5b50610c9b611e13565b6040805160ff9092168252519081900360200190f35b348015610cbd57600080fd5b50610545600160a060020a0360043516611e1c565b348015610cde57600080fd5b50604080516020601f60643560048181013592830184900484028501840190955281845261054594600160a060020a038135811695602480359092169560443595369560849401918190840183828082843750949750611f399650505050505050565b348015610d4d57600080fd5b50610484600435611f61565b348015610d6557600080fd5b50610545612016565b348015610d7a57600080fd5b50610545612061565b348015610d8f57600080fd5b506105d961217d565b348015610da457600080fd5b5060408051602060046024803582810135601f81018590048502860185019096528585526105459583359536956044949193909101919081908401838280828437509497506121839650505050505050565b348015610e0257600080fd5b50610545600435600160a060020a03602435166121ae565b348015610e2657600080fd5b506105456004356121d9565b348015610e3e57600080fd5b506102a3600160a060020a03600435811690602435166124f7565b348015610e6557600080fd5b506040805160206004803580820135601f81018490048402850184019095528484526105459436949293602493928401919081908401838280828437505060408051818801358901803560208181028481018201909552818452989b61ffff8b3581169c8b8d01359091169b919a90995060609091019750929550908201935091829185019084908082843750506040805187358901803560208181028481018201909552818452989b9a99890198929750908201955093508392508501908490808284375050604080516020601f818a01358b0180359182018390048302840183018552818452989b61ffff8b35169b909a90999401975091955091820193509150819084018382808284375050604080516020601f818a01358b0180359182018390048302840183018552818452989b61ffff8b35169b909a90999401975091955091820193509150819084018382808284375094975050933594506125c29350505050565b348015610fd957600080fd5b506102a36128b3565b348015610fee57600080fd5b50610545600160a060020a03600435166128bc565b34801561100f57600080fd5b50610545600160a060020a0360043516612902565b34801561103057600080fd5b50611045600160a060020a0360043516612945565b604080519215158352600160a060020a0390911660208301528051918290030190f35b600160e060020a03191660009081526020819052604090205460ff1690565b601a602090815260009182526040918290208054600180830180548651600293821615610100026000190190911692909204601f8101869004860283018601909652858252919492939092908301828280156111245780601f106110f957610100808354040283529160200191611124565b820191906000526020600020905b81548152906001019060200180831161110757829003601f168201915b505050506002838101546003850180546040805160206101006001851615026000190190931695909504601f8101839004830286018301909152808552959661ffff909316959294509091908301828280156111c15780601f10611196576101008083540402835291602001916111c1565b820191906000526020600020905b8154815290600101906020018083116111a457829003601f168201915b5050506004840154600885018054604080516020601f60026000196001871615610100020190951694909404938401819004810282018101909252828152969761ffff8086169862010000870482169850640100000000909604169550939291908301828280156112735780601f1061124857610100808354040283529160200191611273565b820191906000526020600020905b81548152906001019060200180831161125657829003601f168201915b505050506009830154600a840154600b909401549293909290915060ff168b565b60058054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156113205780601f106112f557610100808354040283529160200191611320565b820191906000526020600020905b81548152906001019060200180831161130357829003601f168201915b505050505090505b90565b600090815260026020526040902054600160a060020a031690565b600c54600160a060020a0316331461135d57600080fd5b601b54604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152336004820152602481018490529051600160a060020a039092169163a9059cbb916044808201926020929091908290030181600087803b1580156113ca57600080fd5b505af11580156113de573d6000803e3d6000fd5b505050506040513d60208110156113f457600080fd5b50506040805182815290517fa9bae03c15d23dd001998395b3adf7648085bf2fba01211df19df18be3a51b4d9181900360200190a150565b600061143782611929565b9050600160a060020a03838116908216141561145257600080fd5b33600160a060020a038216148061146e575061146e81336124f7565b151561147957600080fd5b6000828152600260205260408082208054600160a060020a031916600160a060020a0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b336000908152600f6020526040812054819060ff1615156001146114f857600080fd5b825161150b906015906020860190613558565b50600091505b60135482101561154c57611524826118f4565b90506115418161153c8561153785612964565b612a8b565b612ab5565b600190910190611511565b505050565b60095490565b7f01ffc9a70000000000000000000000000000000000000000000000000000000081565b6115853382612ae8565b151561159057600080fd5b600160a060020a03831615156115a557600080fd5b600160a060020a03821615156115ba57600080fd5b6115c48382612b3f565b6115ce8382612ba1565b6115d88282612ca8565b8082600160a060020a031684600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b60115481565b6000818152601a602090815260409182902060068101805484518185028101850190955280855260609485949293600701929091849183018282801561168957602002820191906000526020600020905b815481526020019060010190808311611675575b50505050509150808054806020026020016040519081016040528092919081815260200182805480156116db57602002820191906000526020600020905b8154815260200190600101908083116116c7575b5050505050905091509150915091565b60006116f683611a8d565b821061170157600080fd5b600160a060020a038316600090815260076020526040902080548390811061172557fe5b9060005260206000200154905092915050565b6060600d80548060200260200160405190810160405280929190818152602001828054801561132057602002820191906000526020600020905b8154600160a060020a03168152600190910190602001808311611772575050505050905090565b336000908152600f602052604081205460ff1615156001146117ba57600080fd5b506000918252601a6020526040909120600b01805460ff1916911515919091179055565b336000908152600f602052604090205460ff1615156001146117ff57600080fd5b8051611812906015906020840190613558565b5050565b61154c8383836020604051908101604052806000815250611f39565b600c54600160a060020a0316331461184957600080fd5b6010805460ff1916911515919091179055565b336000908152600f602052604090205460ff16151560011461187d57600080fd5b6014805460ff198116600160ff928316018216179182905560408051929091168252517f148147481a49cf971a9e730f0170233eadf6b3a288bef9aca79cbbfa31ac3f1b916020908290030190a1565b600e5461ffff1681565b600090815260016020526040902054600160a060020a0316151590565b60006118fe611551565b821061190957600080fd5b600980548390811061191757fe5b90600052602060002001549050919050565b600081815260016020526040812054600160a060020a031680151561194d57600080fd5b92915050565b600c54600160a060020a0316331461196a57600080fd5b604051339082156108fc029083906000818181858888f19350505050158015611997573d6000803e3d6000fd5b506040805182815290517fb8d81e8a9685df2795e3bc1d17fdcf880c51c0514b8555ac8a68e2a0e9187bf29181900360200190a150565b600c54600160a060020a031633146119e557600080fd5b600160a060020a0381166000908152600f602052604090205460ff161515611a8a57600160a060020a0381166000818152600f602052604081208054600160ff199091168117909155600d8054808301825592527fd7b6990105719101dabeb77144f2a3385c8033acd3af97e9423a695e81ad1eb59091018054600160a060020a031916909217909155600e805461ffff19811661ffff918216909301169190911790555b50565b6000600160a060020a0382161515611aa457600080fd5b50600160a060020a031660009081526003602052604090205490565b6000818152601a60209081526040808320805460059091018054835181860281018601909452808452606094929391928391908301828280156116db57602002820191906000526020600020908154815260200190600101908083116116c7575050505050905091509150915091565b60135481565b600c54600160a060020a031681565b336000908152600f602052604081205460ff161515600114611b6657600080fd5b5060008b8152601a602090815260409091208b519091611b8d9160018401918e0190613558565b5060048101805461ffff8b81166401000000000265ffff0000000019918e16620100000263ffff00001990931692909217161790558751611bd790600683019060208b01906135d6565b508651611bed90600783019060208a01906135d6565b5060028101805461ffff191661ffff88161790558451611c169060038301906020880190613558565b5060048101805461ffff191661ffff86161790558251611c3f9060088301906020860190613558565b50600a015550505050505050505050565b60125481565b60185490565b60068054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156113205780601f106112f557610100808354040283529160200191611320565b600160a060020a038216331415611cd357600080fd5b336000818152600460209081526040808320600160a060020a03871680855290835292819020805460ff1916861515908117909155815190815290519293927f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31929181900390910190a35050565b6000818152601960209081526040808320805460018201546003830154600290930180548551818802810188019096528086528796606096889660ff16929091849190830182828015611db357602002820191906000526020600020905b815481526020019060010190808311611d9f575b5050505050915093509350935093509193509193565b336000908152600f602052604090205460ff161515600114611dea57600080fd5b601655565b60196020526000908152604090208054600182015460039092015490919060ff1683565b60145460ff1681565b600c54600090600160a060020a03163314611e3657600080fd5b600160a060020a0382166000908152600f602052604090205460ff1615156001141561181257600160a060020a0382166000908152600f60205260409020805460ff19169055611e8582612cf1565b90505b600d546000190160ff82161015611f0757600d805460ff6001840116908110611ead57fe5b600091825260209091200154600d8054600160a060020a039092169160ff8416908110611ed657fe5b60009182526020909120018054600160a060020a031916600160a060020a0392909216919091179055600101611e88565b600d805490611f1a906000198301613610565b5050600e805461ffff19811661ffff9182166000190190911617905550565b611f4484848461157b565b611f5084848484612d33565b1515611f5b57600080fd5b50505050565b6060611f6c826118d7565b1515611f7757600080fd5b6000828152600b602090815260409182902080548351601f60026000196101006001861615020190931692909204918201849004840281018401909452808452909183018282801561200a5780601f10611fdf5761010080835404028352916020019161200a565b820191906000526020600020905b815481529060010190602001808311611fed57829003601f168201915b50505050509050919050565b600c54600090600160a060020a0316331461203057600080fd5b50604051303190339082156108fc029083906000818181858888f19350505050158015611997573d6000803e3d6000fd5b600c54600090600160a060020a0316331461207b57600080fd5b601b54604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051600160a060020a03909216916370a08231916024808201926020929091908290030181600087803b1580156120e157600080fd5b505af11580156120f5573d6000803e3d6000fd5b505050506040513d602081101561210b57600080fd5b5051601b54604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152336004820152602481018490529051929350600160a060020a039091169163a9059cbb916044808201926020929091908290030181600087803b1580156113ca57600080fd5b60165481565b336000908152600f602052604090205460ff1615156001146121a457600080fd5b6118128282612ab5565b336000908152600f602052604090205460ff1615156001146121cf57600080fd5b6118128282612ea0565b6016546000904211612235576040805160e560020a62461bcd02815260206004820152601e60248201527f5468652070726573616c65206973206e6f742073746172746564207965740000604482015290519081900360640190fd5b506000818152601a60205260409020600b81015460ff1615156001146122a5576040805160e560020a62461bcd02815260206004820152601960248201527f54686973206974656d206973206e6f7420666f722073616c6500000000000000604482015290519081900360640190fd5b6002810154600061ffff909116116122bc57600080fd5b6002810154600982015461ffff90911611612321576040805160e560020a62461bcd02815260206004820152600860248201527f536f6c64206f7574000000000000000000000000000000000000000000000000604482015290519081900360640190fd5b600781015460068201541461233557600080fd5b600081600a015411156124ed57601b54600160a060020a031615156123f0576040805160e560020a62461bcd02815260206004820152604f60248201527f496e76616c696420636f6e7472616374206164647265737320666f72204d414e60448201527f412e20506c65617365207573652074686520736574446174616261736528292060648201527f66756e6374696f6e2066697273742e0000000000000000000000000000000000608482015290519081900360a40190fd5b601b54600a820154604080517f23b872dd000000000000000000000000000000000000000000000000000000008152336004820152306024820152604481019290925251600160a060020a03909216916323b872dd916064808201926020929091908290030181600087803b15801561246857600080fd5b505af115801561247c573d6000803e3d6000fd5b505050506040513d602081101561249257600080fd5b505115156001146124ed576040805160e560020a62461bcd02815260206004820152601760248201527f4661696c6564207472616e73666572696e67204d414e41000000000000000000604482015290519081900360640190fd5b6118128233612ea0565b601054604080517fc4552791000000000000000000000000000000000000000000000000000000008152600160a060020a03858116600483015291516000936101009004831692851691839163c45527919160248082019260209290919082900301818987803b15801561256a57600080fd5b505af115801561257e573d6000803e3d6000fd5b505050506040513d602081101561259457600080fd5b5051600160a060020a031614156125ae57600191506125bb565b6125b88484613156565b91505b5092915050565b336000908152600f602052604081205460ff1615156001146125e357600080fd5b506012546000818152601a602090815260409091209182558b5161260f916001840191908e0190613558565b5060028101805461ffff191661ffff8881169190911790915560048201805463ffff00001916620100008d8416021765ffff000000001916640100000000928c1692909202919091179055875161266f90600683019060208b01906135d6565b50865161268590600783019060208a01906135d6565b50845161269b9060038301906020880190613558565b5060048101805461ffff191661ffff861617905582516126c49060088301906020860190613558565b50600060098201819055600a8201839055600b8201805460ff1916600190811790915560188054808301808355919093528354600c9093027fb13d2d76d1f4b7be834882e410b3e3a8afaf69f83600ae24db354391d2378d2e8101938455828501805492948694909361276c937fb13d2d76d1f4b7be834882e410b3e3a8afaf69f83600ae24db354391d2378d2f019291600290821615610100026000190190911604613634565b50600282810154828201805461ffff191661ffff909216919091179055600380840180546127ae93928501926000196001831615610100020190911604613634565b5060048281018054918301805461ffff191661ffff938416178082558254620100009081900485160263ffff0000199091161780825591546401000000009081900490931690920265ffff00000000199091161790556005808301805461281892840191906136a9565b506006828101805461282d92840191906136a9565b506007828101805461284292840191906136a9565b506008820181600801908054600181600116156101000203166002900461286a929190613634565b5060098281015490820155600a8083015490820155600b918201549101805460ff191660ff90921615159190911790556012555050601180546001019055505050505050505050565b60105460ff1681565b600c54600160a060020a031633146128d357600080fd5b600160a060020a03811615611a8a57600c8054600160a060020a038316600160a060020a031990911617905550565b336000908152600f602052604090205460ff16151560011461292357600080fd5b601b8054600160a060020a031916600160a060020a0392909216919091179055565b600160a060020a0381166000908152600f602052604090205460ff1691565b606060008082818515156129ad5760408051808201909152600181527f300000000000000000000000000000000000000000000000000000000000000060208201529450612a82565b8593505b83156129c857600190920191600a840493506129b1565b826040519080825280601f01601f1916602001820160405280156129f6578160200160208202803883390190505b5091505060001982015b8515612a7e5781516000198201917f01000000000000000000000000000000000000000000000000000000000000006030600a8a060102918491908110612a4357fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a86049550612a00565b8194505b50505050919050565b6060612aae612a9983613184565b612aa285613184565b9063ffffffff6131aa16565b9392505050565b612abe826118d7565b1515612ac957600080fd5b6000828152600b60209081526040909120825161154c92840190613558565b600080612af483611929565b905080600160a060020a031684600160a060020a03161480612b2f575083600160a060020a0316612b248461132b565b600160a060020a0316145b806125b857506125b881856124f7565b81600160a060020a0316612b5282611929565b600160a060020a031614612b6557600080fd5b600081815260026020526040902054600160a060020a0316156118125760009081526002602052604090208054600160a060020a031916905550565b6000806000612bb08585613221565b600084815260086020908152604080832054600160a060020a0389168452600790925290912054909350612beb90600163ffffffff6132aa16565b600160a060020a038616600090815260076020526040902080549193509083908110612c1357fe5b90600052602060002001549050806007600087600160a060020a0316600160a060020a0316815260200190815260200160002084815481101515612c5357fe5b6000918252602080832090910192909255600160a060020a0387168152600790915260409020805490612c8a906000198301613610565b50600093845260086020526040808520859055908452909220555050565b6000612cb483836132bc565b50600160a060020a039091166000908152600760209081526040808320805460018101825590845282842081018590559383526008909152902055565b6000805b82600160a060020a0316600d8260ff16815481101515612d1157fe5b600091825260209091200154600160a060020a03161461194d57600101612cf5565b600080612d4885600160a060020a031661333f565b1515612d575760019150612e97565b6040517f150b7a020000000000000000000000000000000000000000000000000000000081523360048201818152600160a060020a03898116602485015260448401889052608060648501908152875160848601528751918a169463150b7a0294938c938b938b93909160a490910190602085019080838360005b83811015612dea578181015183820152602001612dd2565b50505050905090810190601f168015612e175780820380516001836020036101000a031916815260200191505b5095505050505050602060405180830381600087803b158015612e3957600080fd5b505af1158015612e4d573d6000803e3d6000fd5b505050506040513d6020811015612e6357600080fd5b5051600160e060020a031981167f150b7a020000000000000000000000000000000000000000000000000000000014925090505b50949350505050565b6000828152601a60205260408082208151600680825260e08201909352909260609290918291816020016020820280388339019050509250600091505b6006840154821015612fc45760008460070183815481101515612efc57fe5b90600052602060002001541115612f9157600684015483511415612f8c57612f738460060183815481101515612f2e57fe5b90600052602060002001548560070184815481101515612f4a57fe5b6000918252602090912001546009870154601754868b0190910190600160a060020a0316613347565b8383815181101515612f8157fe5b602090810290910101525b612fb9565b600684015483511415612fb95760008383815181101515612fae57fe5b602090810290910101525b600190910190612edd565b506013546001908101600081815260196020908152604090912091825591810187905583519091612ffc9160028401918601906135d6565b5060145460038201805460ff191660ff9092169190911790556009840180546001908101909155601380549091019081905561303990869061345d565b6013546015805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181526130dd949361153c93919290918301828280156130cd5780601f106130a2576101008083540402835291602001916130cd565b820191906000526020600020905b8154815290600101906020018083116130b057829003601f168201915b5050505050611537601354612964565b60178054600160a060020a031916600160a060020a0387161790558354600a8501546009860154601354604080519485526020850193909352838301919091526060830152517f20b783292d66c024794198f13faa7e7671cc3d2323d1c787416e8dfe266fdfec916080908290030190a1505050505050565b600160a060020a03918216600090815260046020908152604080832093909416825291909152205460ff1690565b61318c6136e8565b50604080518082019091528151815260209182019181019190915290565b606080600083600001518560000151016040519080825280601f01601f1916602001820160405280156131e7578160200160208202803883390190505b50915060208201905061320381866020015187600001516134ac565b84516020850151855161321992840191906134ac565b509392505050565b81600160a060020a031661323482611929565b600160a060020a03161461324757600080fd5b600160a060020a03821660009081526003602052604090205461327190600163ffffffff6132aa16565b600160a060020a039092166000908152600360209081526040808320949094559181526001909152208054600160a060020a0319169055565b6000828211156132b657fe5b50900390565b600081815260016020526040902054600160a060020a0316156132de57600080fd5b60008181526001602081815260408084208054600160a060020a031916600160a060020a038816908117909155845260039091529091205461331f916134f0565b600160a060020a0390921660009081526003602052604090209190915550565b6000903b1190565b60008060004285604051602001808381526020018260ff1660ff167f0100000000000000000000000000000000000000000000000000000000000000028152600101925050506040516020818303038152906040526040518082805190602001908083835b602083106133cb5780518252601f1990920191602091820191016133ac565b5181516000196020949094036101000a8401908116901991909116179052604051939091018390039092204390920140600160a060020a038916019091019450600093505050505b8460ff168160ff1610801561342b575060068160ff16105b1561343f5761010082049150600101613413565b868787600101038381151561345057fe5b0601979650505050505050565b61346782826134fd565b600980546000838152600a60205260408120829055600182018355919091527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af015550565b60005b602082106134d1578251845260209384019390920191601f19909101906134af565b50905182516020929092036101000a6000190180199091169116179052565b8181018281101561194d57fe5b600160a060020a038216151561351257600080fd5b61351c8282612ca8565b6040518190600160a060020a038416906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061359957805160ff19168380011785556135c6565b828001600101855582156135c6579182015b828111156135c65782518255916020019190600101906135ab565b506135d29291506136ff565b5090565b8280548282559060005260206000209081019282156135c657916020028201828111156135c65782518255916020019190600101906135ab565b81548183558181111561154c5760008381526020902061154c9181019083016136ff565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061366d57805485556135c6565b828001600101855582156135c657600052602060002091601f016020900482015b828111156135c657825482559160010191906001019061368e565b8280548282559060005260206000209081019282156135c6576000526020600020918201828111156135c657825482559160010191906001019061368e565b604080518082019091526000808252602082015290565b61132891905b808211156135d257600081556001016137055600a165627a7a72305820e5e4286c5fa413fb5cc039c3702c6e88219d707459d3dad794e99cec5573dcb70029000000000000000000000000a5409ec958c83c3f309868babaca7c86dcb077c1

Deployed Bytecode

0x60806040526004361061027c5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166301ffc9a78114610281578063023eb6c4146102b757806306fdde031461046f578063081812fc146104f957806308d78c3c1461052d578063095ea7b3146105475780630c80f6561461056b57806318160ddd146105c457806319fa8f50146105eb57806323b872dd1461061d5780632799276d146106475780632ddcd2981461065c5780632f745c591461070d5780632fc3f1941461073157806338ddbd051461079657806339a0c6f9146107b357806342842e0e1461080c57806348ef5aa8146108365780634d4542af146108505780634efb023e146108655780634f558e79146108915780634f6ccce7146108a95780636352211e146108c157806363538dab146108d95780636c81fd6d146108f157806370a08231146109125780637584f759146109335780637e1c0c09146109a65780638da5cb5b146109bb5780638defe4fa146109d0578063910df49b14610b495780639340992414610b5e57806395d89b4114610b73578063a22cb46514610b88578063a4d36f9014610bae578063ace0e97e14610c35578063ae3d541414610c4d578063b753485f14610c86578063b85d627514610cb1578063b88d4fde14610cd2578063c87b56dd14610d41578063d314b64714610d59578063db0fa98914610d6e578063de8801e514610d83578063e0770a5514610d98578063e28d5fe314610df6578063e7fb74c714610e1a578063e985e9c514610e32578063ebdf975a14610e59578063ee4e441614610fcd578063f285329214610fe2578063f542037414611003578063fa6f393614611024575b600080fd5b34801561028d57600080fd5b506102a3600160e060020a031960043516611068565b604080519115158252519081900360200190f35b3480156102c357600080fd5b506102cf600435611087565b604051808c8152602001806020018b61ffff1661ffff168152602001806020018a61ffff1661ffff1681526020018961ffff1661ffff1681526020018861ffff1661ffff168152602001806020018781526020018681526020018515151515815260200184810384528e818151815260200191508051906020019080838360005b83811015610368578181015183820152602001610350565b50505050905090810190601f1680156103955780820380516001836020036101000a031916815260200191505b5084810383528c5181528c516020918201918e019080838360005b838110156103c85781810151838201526020016103b0565b50505050905090810190601f1680156103f55780820380516001836020036101000a031916815260200191505b5084810382528851815288516020918201918a019080838360005b83811015610428578181015183820152602001610410565b50505050905090810190601f1680156104555780820380516001836020036101000a031916815260200191505b509e50505050505050505050505050505060405180910390f35b34801561047b57600080fd5b50610484611294565b6040805160208082528351818301528351919283929083019185019080838360005b838110156104be5781810151838201526020016104a6565b50505050905090810190601f1680156104eb5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561050557600080fd5b5061051160043561132b565b60408051600160a060020a039092168252519081900360200190f35b34801561053957600080fd5b50610545600435611346565b005b34801561055357600080fd5b50610545600160a060020a036004351660243561142c565b34801561057757600080fd5b506040805160206004803580820135601f81018490048402850184019095528484526105459436949293602493928401919081908401838280828437509497506114d59650505050505050565b3480156105d057600080fd5b506105d9611551565b60408051918252519081900360200190f35b3480156105f757600080fd5b50610600611557565b60408051600160e060020a03199092168252519081900360200190f35b34801561062957600080fd5b50610545600160a060020a036004358116906024351660443561157b565b34801561065357600080fd5b506105d961161e565b34801561066857600080fd5b50610674600435611624565b604051808060200180602001838103835285818151815260200191508051906020019060200280838360005b838110156106b85781810151838201526020016106a0565b50505050905001838103825284818151815260200191508051906020019060200280838360005b838110156106f75781810151838201526020016106df565b5050505090500194505050505060405180910390f35b34801561071957600080fd5b506105d9600160a060020a03600435166024356116eb565b34801561073d57600080fd5b50610746611738565b60408051602080825283518183015283519192839290830191858101910280838360005b8381101561078257818101518382015260200161076a565b505050509050019250505060405180910390f35b3480156107a257600080fd5b506105456004356024351515611799565b3480156107bf57600080fd5b506040805160206004803580820135601f81018490048402850184019095528484526105459436949293602493928401919081908401838280828437509497506117de9650505050505050565b34801561081857600080fd5b50610545600160a060020a0360043581169060243516604435611816565b34801561084257600080fd5b506105456004351515611832565b34801561085c57600080fd5b5061054561185c565b34801561087157600080fd5b5061087a6118cd565b6040805161ffff9092168252519081900360200190f35b34801561089d57600080fd5b506102a36004356118d7565b3480156108b557600080fd5b506105d96004356118f4565b3480156108cd57600080fd5b50610511600435611929565b3480156108e557600080fd5b50610545600435611953565b3480156108fd57600080fd5b50610545600160a060020a03600435166119ce565b34801561091e57600080fd5b506105d9600160a060020a0360043516611a8d565b34801561093f57600080fd5b5061094b600435611ac0565b6040518083815260200180602001828103825283818151815260200191508051906020019060200280838360005b83811015610991578181015183820152602001610979565b50505050905001935050505060405180910390f35b3480156109b257600080fd5b506105d9611b30565b3480156109c757600080fd5b50610511611b36565b3480156109dc57600080fd5b5060408051602060046024803582810135601f81018590048502860185019096528585526105459583359536956044949193909101919081908401838280828437505060408051818801358901803560208181028481018201909552818452989b61ffff8b3581169c8b8d01359091169b919a90995060609091019750929550908201935091829185019084908082843750506040805187358901803560208181028481018201909552818452989b9a99890198929750908201955093508392508501908490808284375050604080516020601f818a01358b0180359182018390048302840183018552818452989b61ffff8b35169b909a90999401975091955091820193509150819084018382808284375050604080516020601f818a01358b0180359182018390048302840183018552818452989b61ffff8b35169b909a9099940197509195509182019350915081908401838280828437509497505093359450611b459350505050565b348015610b5557600080fd5b506105d9611c50565b348015610b6a57600080fd5b506105d9611c56565b348015610b7f57600080fd5b50610484611c5c565b348015610b9457600080fd5b50610545600160a060020a03600435166024351515611cbd565b348015610bba57600080fd5b50610bc6600435611d41565b60405180858152602001848152602001806020018360ff1660ff168152602001828103825284818151815260200191508051906020019060200280838360005b83811015610c1e578181015183820152602001610c06565b505050509050019550505050505060405180910390f35b348015610c4157600080fd5b50610545600435611dc9565b348015610c5957600080fd5b50610c65600435611def565b60408051938452602084019290925260ff1682820152519081900360600190f35b348015610c9257600080fd5b50610c9b611e13565b6040805160ff9092168252519081900360200190f35b348015610cbd57600080fd5b50610545600160a060020a0360043516611e1c565b348015610cde57600080fd5b50604080516020601f60643560048181013592830184900484028501840190955281845261054594600160a060020a038135811695602480359092169560443595369560849401918190840183828082843750949750611f399650505050505050565b348015610d4d57600080fd5b50610484600435611f61565b348015610d6557600080fd5b50610545612016565b348015610d7a57600080fd5b50610545612061565b348015610d8f57600080fd5b506105d961217d565b348015610da457600080fd5b5060408051602060046024803582810135601f81018590048502860185019096528585526105459583359536956044949193909101919081908401838280828437509497506121839650505050505050565b348015610e0257600080fd5b50610545600435600160a060020a03602435166121ae565b348015610e2657600080fd5b506105456004356121d9565b348015610e3e57600080fd5b506102a3600160a060020a03600435811690602435166124f7565b348015610e6557600080fd5b506040805160206004803580820135601f81018490048402850184019095528484526105459436949293602493928401919081908401838280828437505060408051818801358901803560208181028481018201909552818452989b61ffff8b3581169c8b8d01359091169b919a90995060609091019750929550908201935091829185019084908082843750506040805187358901803560208181028481018201909552818452989b9a99890198929750908201955093508392508501908490808284375050604080516020601f818a01358b0180359182018390048302840183018552818452989b61ffff8b35169b909a90999401975091955091820193509150819084018382808284375050604080516020601f818a01358b0180359182018390048302840183018552818452989b61ffff8b35169b909a90999401975091955091820193509150819084018382808284375094975050933594506125c29350505050565b348015610fd957600080fd5b506102a36128b3565b348015610fee57600080fd5b50610545600160a060020a03600435166128bc565b34801561100f57600080fd5b50610545600160a060020a0360043516612902565b34801561103057600080fd5b50611045600160a060020a0360043516612945565b604080519215158352600160a060020a0390911660208301528051918290030190f35b600160e060020a03191660009081526020819052604090205460ff1690565b601a602090815260009182526040918290208054600180830180548651600293821615610100026000190190911692909204601f8101869004860283018601909652858252919492939092908301828280156111245780601f106110f957610100808354040283529160200191611124565b820191906000526020600020905b81548152906001019060200180831161110757829003601f168201915b505050506002838101546003850180546040805160206101006001851615026000190190931695909504601f8101839004830286018301909152808552959661ffff909316959294509091908301828280156111c15780601f10611196576101008083540402835291602001916111c1565b820191906000526020600020905b8154815290600101906020018083116111a457829003601f168201915b5050506004840154600885018054604080516020601f60026000196001871615610100020190951694909404938401819004810282018101909252828152969761ffff8086169862010000870482169850640100000000909604169550939291908301828280156112735780601f1061124857610100808354040283529160200191611273565b820191906000526020600020905b81548152906001019060200180831161125657829003601f168201915b505050506009830154600a840154600b909401549293909290915060ff168b565b60058054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156113205780601f106112f557610100808354040283529160200191611320565b820191906000526020600020905b81548152906001019060200180831161130357829003601f168201915b505050505090505b90565b600090815260026020526040902054600160a060020a031690565b600c54600160a060020a0316331461135d57600080fd5b601b54604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152336004820152602481018490529051600160a060020a039092169163a9059cbb916044808201926020929091908290030181600087803b1580156113ca57600080fd5b505af11580156113de573d6000803e3d6000fd5b505050506040513d60208110156113f457600080fd5b50506040805182815290517fa9bae03c15d23dd001998395b3adf7648085bf2fba01211df19df18be3a51b4d9181900360200190a150565b600061143782611929565b9050600160a060020a03838116908216141561145257600080fd5b33600160a060020a038216148061146e575061146e81336124f7565b151561147957600080fd5b6000828152600260205260408082208054600160a060020a031916600160a060020a0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b336000908152600f6020526040812054819060ff1615156001146114f857600080fd5b825161150b906015906020860190613558565b50600091505b60135482101561154c57611524826118f4565b90506115418161153c8561153785612964565b612a8b565b612ab5565b600190910190611511565b505050565b60095490565b7f01ffc9a70000000000000000000000000000000000000000000000000000000081565b6115853382612ae8565b151561159057600080fd5b600160a060020a03831615156115a557600080fd5b600160a060020a03821615156115ba57600080fd5b6115c48382612b3f565b6115ce8382612ba1565b6115d88282612ca8565b8082600160a060020a031684600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b60115481565b6000818152601a602090815260409182902060068101805484518185028101850190955280855260609485949293600701929091849183018282801561168957602002820191906000526020600020905b815481526020019060010190808311611675575b50505050509150808054806020026020016040519081016040528092919081815260200182805480156116db57602002820191906000526020600020905b8154815260200190600101908083116116c7575b5050505050905091509150915091565b60006116f683611a8d565b821061170157600080fd5b600160a060020a038316600090815260076020526040902080548390811061172557fe5b9060005260206000200154905092915050565b6060600d80548060200260200160405190810160405280929190818152602001828054801561132057602002820191906000526020600020905b8154600160a060020a03168152600190910190602001808311611772575050505050905090565b336000908152600f602052604081205460ff1615156001146117ba57600080fd5b506000918252601a6020526040909120600b01805460ff1916911515919091179055565b336000908152600f602052604090205460ff1615156001146117ff57600080fd5b8051611812906015906020840190613558565b5050565b61154c8383836020604051908101604052806000815250611f39565b600c54600160a060020a0316331461184957600080fd5b6010805460ff1916911515919091179055565b336000908152600f602052604090205460ff16151560011461187d57600080fd5b6014805460ff198116600160ff928316018216179182905560408051929091168252517f148147481a49cf971a9e730f0170233eadf6b3a288bef9aca79cbbfa31ac3f1b916020908290030190a1565b600e5461ffff1681565b600090815260016020526040902054600160a060020a0316151590565b60006118fe611551565b821061190957600080fd5b600980548390811061191757fe5b90600052602060002001549050919050565b600081815260016020526040812054600160a060020a031680151561194d57600080fd5b92915050565b600c54600160a060020a0316331461196a57600080fd5b604051339082156108fc029083906000818181858888f19350505050158015611997573d6000803e3d6000fd5b506040805182815290517fb8d81e8a9685df2795e3bc1d17fdcf880c51c0514b8555ac8a68e2a0e9187bf29181900360200190a150565b600c54600160a060020a031633146119e557600080fd5b600160a060020a0381166000908152600f602052604090205460ff161515611a8a57600160a060020a0381166000818152600f602052604081208054600160ff199091168117909155600d8054808301825592527fd7b6990105719101dabeb77144f2a3385c8033acd3af97e9423a695e81ad1eb59091018054600160a060020a031916909217909155600e805461ffff19811661ffff918216909301169190911790555b50565b6000600160a060020a0382161515611aa457600080fd5b50600160a060020a031660009081526003602052604090205490565b6000818152601a60209081526040808320805460059091018054835181860281018601909452808452606094929391928391908301828280156116db57602002820191906000526020600020908154815260200190600101908083116116c7575050505050905091509150915091565b60135481565b600c54600160a060020a031681565b336000908152600f602052604081205460ff161515600114611b6657600080fd5b5060008b8152601a602090815260409091208b519091611b8d9160018401918e0190613558565b5060048101805461ffff8b81166401000000000265ffff0000000019918e16620100000263ffff00001990931692909217161790558751611bd790600683019060208b01906135d6565b508651611bed90600783019060208a01906135d6565b5060028101805461ffff191661ffff88161790558451611c169060038301906020880190613558565b5060048101805461ffff191661ffff86161790558251611c3f9060088301906020860190613558565b50600a015550505050505050505050565b60125481565b60185490565b60068054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156113205780601f106112f557610100808354040283529160200191611320565b600160a060020a038216331415611cd357600080fd5b336000818152600460209081526040808320600160a060020a03871680855290835292819020805460ff1916861515908117909155815190815290519293927f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31929181900390910190a35050565b6000818152601960209081526040808320805460018201546003830154600290930180548551818802810188019096528086528796606096889660ff16929091849190830182828015611db357602002820191906000526020600020905b815481526020019060010190808311611d9f575b5050505050915093509350935093509193509193565b336000908152600f602052604090205460ff161515600114611dea57600080fd5b601655565b60196020526000908152604090208054600182015460039092015490919060ff1683565b60145460ff1681565b600c54600090600160a060020a03163314611e3657600080fd5b600160a060020a0382166000908152600f602052604090205460ff1615156001141561181257600160a060020a0382166000908152600f60205260409020805460ff19169055611e8582612cf1565b90505b600d546000190160ff82161015611f0757600d805460ff6001840116908110611ead57fe5b600091825260209091200154600d8054600160a060020a039092169160ff8416908110611ed657fe5b60009182526020909120018054600160a060020a031916600160a060020a0392909216919091179055600101611e88565b600d805490611f1a906000198301613610565b5050600e805461ffff19811661ffff9182166000190190911617905550565b611f4484848461157b565b611f5084848484612d33565b1515611f5b57600080fd5b50505050565b6060611f6c826118d7565b1515611f7757600080fd5b6000828152600b602090815260409182902080548351601f60026000196101006001861615020190931692909204918201849004840281018401909452808452909183018282801561200a5780601f10611fdf5761010080835404028352916020019161200a565b820191906000526020600020905b815481529060010190602001808311611fed57829003601f168201915b50505050509050919050565b600c54600090600160a060020a0316331461203057600080fd5b50604051303190339082156108fc029083906000818181858888f19350505050158015611997573d6000803e3d6000fd5b600c54600090600160a060020a0316331461207b57600080fd5b601b54604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051600160a060020a03909216916370a08231916024808201926020929091908290030181600087803b1580156120e157600080fd5b505af11580156120f5573d6000803e3d6000fd5b505050506040513d602081101561210b57600080fd5b5051601b54604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152336004820152602481018490529051929350600160a060020a039091169163a9059cbb916044808201926020929091908290030181600087803b1580156113ca57600080fd5b60165481565b336000908152600f602052604090205460ff1615156001146121a457600080fd5b6118128282612ab5565b336000908152600f602052604090205460ff1615156001146121cf57600080fd5b6118128282612ea0565b6016546000904211612235576040805160e560020a62461bcd02815260206004820152601e60248201527f5468652070726573616c65206973206e6f742073746172746564207965740000604482015290519081900360640190fd5b506000818152601a60205260409020600b81015460ff1615156001146122a5576040805160e560020a62461bcd02815260206004820152601960248201527f54686973206974656d206973206e6f7420666f722073616c6500000000000000604482015290519081900360640190fd5b6002810154600061ffff909116116122bc57600080fd5b6002810154600982015461ffff90911611612321576040805160e560020a62461bcd02815260206004820152600860248201527f536f6c64206f7574000000000000000000000000000000000000000000000000604482015290519081900360640190fd5b600781015460068201541461233557600080fd5b600081600a015411156124ed57601b54600160a060020a031615156123f0576040805160e560020a62461bcd02815260206004820152604f60248201527f496e76616c696420636f6e7472616374206164647265737320666f72204d414e60448201527f412e20506c65617365207573652074686520736574446174616261736528292060648201527f66756e6374696f6e2066697273742e0000000000000000000000000000000000608482015290519081900360a40190fd5b601b54600a820154604080517f23b872dd000000000000000000000000000000000000000000000000000000008152336004820152306024820152604481019290925251600160a060020a03909216916323b872dd916064808201926020929091908290030181600087803b15801561246857600080fd5b505af115801561247c573d6000803e3d6000fd5b505050506040513d602081101561249257600080fd5b505115156001146124ed576040805160e560020a62461bcd02815260206004820152601760248201527f4661696c6564207472616e73666572696e67204d414e41000000000000000000604482015290519081900360640190fd5b6118128233612ea0565b601054604080517fc4552791000000000000000000000000000000000000000000000000000000008152600160a060020a03858116600483015291516000936101009004831692851691839163c45527919160248082019260209290919082900301818987803b15801561256a57600080fd5b505af115801561257e573d6000803e3d6000fd5b505050506040513d602081101561259457600080fd5b5051600160a060020a031614156125ae57600191506125bb565b6125b88484613156565b91505b5092915050565b336000908152600f602052604081205460ff1615156001146125e357600080fd5b506012546000818152601a602090815260409091209182558b5161260f916001840191908e0190613558565b5060028101805461ffff191661ffff8881169190911790915560048201805463ffff00001916620100008d8416021765ffff000000001916640100000000928c1692909202919091179055875161266f90600683019060208b01906135d6565b50865161268590600783019060208a01906135d6565b50845161269b9060038301906020880190613558565b5060048101805461ffff191661ffff861617905582516126c49060088301906020860190613558565b50600060098201819055600a8201839055600b8201805460ff1916600190811790915560188054808301808355919093528354600c9093027fb13d2d76d1f4b7be834882e410b3e3a8afaf69f83600ae24db354391d2378d2e8101938455828501805492948694909361276c937fb13d2d76d1f4b7be834882e410b3e3a8afaf69f83600ae24db354391d2378d2f019291600290821615610100026000190190911604613634565b50600282810154828201805461ffff191661ffff909216919091179055600380840180546127ae93928501926000196001831615610100020190911604613634565b5060048281018054918301805461ffff191661ffff938416178082558254620100009081900485160263ffff0000199091161780825591546401000000009081900490931690920265ffff00000000199091161790556005808301805461281892840191906136a9565b506006828101805461282d92840191906136a9565b506007828101805461284292840191906136a9565b506008820181600801908054600181600116156101000203166002900461286a929190613634565b5060098281015490820155600a8083015490820155600b918201549101805460ff191660ff90921615159190911790556012555050601180546001019055505050505050505050565b60105460ff1681565b600c54600160a060020a031633146128d357600080fd5b600160a060020a03811615611a8a57600c8054600160a060020a038316600160a060020a031990911617905550565b336000908152600f602052604090205460ff16151560011461292357600080fd5b601b8054600160a060020a031916600160a060020a0392909216919091179055565b600160a060020a0381166000908152600f602052604090205460ff1691565b606060008082818515156129ad5760408051808201909152600181527f300000000000000000000000000000000000000000000000000000000000000060208201529450612a82565b8593505b83156129c857600190920191600a840493506129b1565b826040519080825280601f01601f1916602001820160405280156129f6578160200160208202803883390190505b5091505060001982015b8515612a7e5781516000198201917f01000000000000000000000000000000000000000000000000000000000000006030600a8a060102918491908110612a4357fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a86049550612a00565b8194505b50505050919050565b6060612aae612a9983613184565b612aa285613184565b9063ffffffff6131aa16565b9392505050565b612abe826118d7565b1515612ac957600080fd5b6000828152600b60209081526040909120825161154c92840190613558565b600080612af483611929565b905080600160a060020a031684600160a060020a03161480612b2f575083600160a060020a0316612b248461132b565b600160a060020a0316145b806125b857506125b881856124f7565b81600160a060020a0316612b5282611929565b600160a060020a031614612b6557600080fd5b600081815260026020526040902054600160a060020a0316156118125760009081526002602052604090208054600160a060020a031916905550565b6000806000612bb08585613221565b600084815260086020908152604080832054600160a060020a0389168452600790925290912054909350612beb90600163ffffffff6132aa16565b600160a060020a038616600090815260076020526040902080549193509083908110612c1357fe5b90600052602060002001549050806007600087600160a060020a0316600160a060020a0316815260200190815260200160002084815481101515612c5357fe5b6000918252602080832090910192909255600160a060020a0387168152600790915260409020805490612c8a906000198301613610565b50600093845260086020526040808520859055908452909220555050565b6000612cb483836132bc565b50600160a060020a039091166000908152600760209081526040808320805460018101825590845282842081018590559383526008909152902055565b6000805b82600160a060020a0316600d8260ff16815481101515612d1157fe5b600091825260209091200154600160a060020a03161461194d57600101612cf5565b600080612d4885600160a060020a031661333f565b1515612d575760019150612e97565b6040517f150b7a020000000000000000000000000000000000000000000000000000000081523360048201818152600160a060020a03898116602485015260448401889052608060648501908152875160848601528751918a169463150b7a0294938c938b938b93909160a490910190602085019080838360005b83811015612dea578181015183820152602001612dd2565b50505050905090810190601f168015612e175780820380516001836020036101000a031916815260200191505b5095505050505050602060405180830381600087803b158015612e3957600080fd5b505af1158015612e4d573d6000803e3d6000fd5b505050506040513d6020811015612e6357600080fd5b5051600160e060020a031981167f150b7a020000000000000000000000000000000000000000000000000000000014925090505b50949350505050565b6000828152601a60205260408082208151600680825260e08201909352909260609290918291816020016020820280388339019050509250600091505b6006840154821015612fc45760008460070183815481101515612efc57fe5b90600052602060002001541115612f9157600684015483511415612f8c57612f738460060183815481101515612f2e57fe5b90600052602060002001548560070184815481101515612f4a57fe5b6000918252602090912001546009870154601754868b0190910190600160a060020a0316613347565b8383815181101515612f8157fe5b602090810290910101525b612fb9565b600684015483511415612fb95760008383815181101515612fae57fe5b602090810290910101525b600190910190612edd565b506013546001908101600081815260196020908152604090912091825591810187905583519091612ffc9160028401918601906135d6565b5060145460038201805460ff191660ff9092169190911790556009840180546001908101909155601380549091019081905561303990869061345d565b6013546015805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181526130dd949361153c93919290918301828280156130cd5780601f106130a2576101008083540402835291602001916130cd565b820191906000526020600020905b8154815290600101906020018083116130b057829003601f168201915b5050505050611537601354612964565b60178054600160a060020a031916600160a060020a0387161790558354600a8501546009860154601354604080519485526020850193909352838301919091526060830152517f20b783292d66c024794198f13faa7e7671cc3d2323d1c787416e8dfe266fdfec916080908290030190a1505050505050565b600160a060020a03918216600090815260046020908152604080832093909416825291909152205460ff1690565b61318c6136e8565b50604080518082019091528151815260209182019181019190915290565b606080600083600001518560000151016040519080825280601f01601f1916602001820160405280156131e7578160200160208202803883390190505b50915060208201905061320381866020015187600001516134ac565b84516020850151855161321992840191906134ac565b509392505050565b81600160a060020a031661323482611929565b600160a060020a03161461324757600080fd5b600160a060020a03821660009081526003602052604090205461327190600163ffffffff6132aa16565b600160a060020a039092166000908152600360209081526040808320949094559181526001909152208054600160a060020a0319169055565b6000828211156132b657fe5b50900390565b600081815260016020526040902054600160a060020a0316156132de57600080fd5b60008181526001602081815260408084208054600160a060020a031916600160a060020a038816908117909155845260039091529091205461331f916134f0565b600160a060020a0390921660009081526003602052604090209190915550565b6000903b1190565b60008060004285604051602001808381526020018260ff1660ff167f0100000000000000000000000000000000000000000000000000000000000000028152600101925050506040516020818303038152906040526040518082805190602001908083835b602083106133cb5780518252601f1990920191602091820191016133ac565b5181516000196020949094036101000a8401908116901991909116179052604051939091018390039092204390920140600160a060020a038916019091019450600093505050505b8460ff168160ff1610801561342b575060068160ff16105b1561343f5761010082049150600101613413565b868787600101038381151561345057fe5b0601979650505050505050565b61346782826134fd565b600980546000838152600a60205260408120829055600182018355919091527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af015550565b60005b602082106134d1578251845260209384019390920191601f19909101906134af565b50905182516020929092036101000a6000190180199091169116179052565b8181018281101561194d57fe5b600160a060020a038216151561351257600080fd5b61351c8282612ca8565b6040518190600160a060020a038416906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061359957805160ff19168380011785556135c6565b828001600101855582156135c6579182015b828111156135c65782518255916020019190600101906135ab565b506135d29291506136ff565b5090565b8280548282559060005260206000209081019282156135c657916020028201828111156135c65782518255916020019190600101906135ab565b81548183558181111561154c5760008381526020902061154c9181019083016136ff565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061366d57805485556135c6565b828001600101855582156135c657600052602060002091601f016020900482015b828111156135c657825482559160010191906001019061368e565b8280548282559060005260206000209081019282156135c6576000526020600020918201828111156135c657825482559160010191906001019061368e565b604080518082019091526000808252602082015290565b61132891905b808211156135d257600081556001016137055600a165627a7a72305820e5e4286c5fa413fb5cc039c3702c6e88219d707459d3dad794e99cec5573dcb70029

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

000000000000000000000000a5409ec958c83c3f309868babaca7c86dcb077c1

-----Decoded View---------------
Arg [0] : _proxyRegistryAddress (address): 0xa5409ec958C83C3f309868babACA7c86DCB077c1

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000a5409ec958c83c3f309868babaca7c86dcb077c1


Swarm Source

bzzr://e5e4286c5fa413fb5cc039c3702c6e88219d707459d3dad794e99cec5573dcb7
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.