ETH Price: $3,308.24 (+1.80%)
Gas: 4 Gwei

Contract

0x7EFcaBEa7dAdBd99f67A92398599faCC3fB2Afa3
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Token Holdings

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Equip170001612023-04-08 0:31:23476 days ago1680913883IN
0x7EFcaBEa...C3fB2Afa3
0 ETH0.0074396221.29044582
Equip169999732023-04-07 23:52:47476 days ago1680911567IN
0x7EFcaBEa...C3fB2Afa3
0 ETH0.0083446220.20353228
Equip169998382023-04-07 23:25:11476 days ago1680909911IN
0x7EFcaBEa...C3fB2Afa3
0 ETH0.0054237124.43897965
Equip169990232023-04-07 20:39:47476 days ago1680899987IN
0x7EFcaBEa...C3fB2Afa3
0 ETH0.007814423.51130944
Equip169983632023-04-07 18:24:11476 days ago1680891851IN
0x7EFcaBEa...C3fB2Afa3
0 ETH0.0078053224.7036809
Equip169982262023-04-07 17:56:23476 days ago1680890183IN
0x7EFcaBEa...C3fB2Afa3
0 ETH0.0057238626.60146402
Equip169979972023-04-07 17:09:47476 days ago1680887387IN
0x7EFcaBEa...C3fB2Afa3
0 ETH0.0072510328.93330416
Equip169963012023-04-07 11:24:59477 days ago1680866699IN
0x7EFcaBEa...C3fB2Afa3
0 ETH0.0067462924.44292114
Equip169943732023-04-07 4:50:35477 days ago1680843035IN
0x7EFcaBEa...C3fB2Afa3
0 ETH0.0072038318.21348351
Equip169943382023-04-07 4:43:35477 days ago1680842615IN
0x7EFcaBEa...C3fB2Afa3
0 ETH0.0039252419.24959404
Equip169934502023-04-07 1:42:35477 days ago1680831755IN
0x7EFcaBEa...C3fB2Afa3
0 ETH0.004467824.17842343
Equip169912712023-04-06 18:17:59477 days ago1680805079IN
0x7EFcaBEa...C3fB2Afa3
0 ETH0.0119352429.27479997
Equip169904462023-04-06 15:28:23477 days ago1680794903IN
0x7EFcaBEa...C3fB2Afa3
0 ETH0.0098538328.27475395
Equip169884352023-04-06 8:29:47478 days ago1680769787IN
0x7EFcaBEa...C3fB2Afa3
0 ETH0.0096346928.69382166
Equip169874192023-04-06 4:58:59478 days ago1680757139IN
0x7EFcaBEa...C3fB2Afa3
0 ETH0.0073846927.02800614
Equip169818132023-04-05 9:52:59479 days ago1680688379IN
0x7EFcaBEa...C3fB2Afa3
0 ETH0.0067007432.77274358
Equip169816882023-04-05 9:27:47479 days ago1680686867IN
0x7EFcaBEa...C3fB2Afa3
0 ETH0.0071855731.97171676
Equip169816692023-04-05 9:23:47479 days ago1680686627IN
0x7EFcaBEa...C3fB2Afa3
0 ETH0.0072996130.52112228
Equip169816542023-04-05 9:20:47479 days ago1680686447IN
0x7EFcaBEa...C3fB2Afa3
0 ETH0.0064578628.74043511
Equip169791662023-04-05 0:51:23479 days ago1680655883IN
0x7EFcaBEa...C3fB2Afa3
0 ETH0.015687344.48155268
Equip169780742023-04-04 21:08:59479 days ago1680642539IN
0x7EFcaBEa...C3fB2Afa3
0 ETH0.0229578855.13261564
Equip169743142023-04-04 8:20:35480 days ago1680596435IN
0x7EFcaBEa...C3fB2Afa3
0 ETH0.0063019520.67353837
Equip169739212023-04-04 6:58:59480 days ago1680591539IN
0x7EFcaBEa...C3fB2Afa3
0 ETH0.0044492320.68267764
Equip169721922023-04-04 1:02:11480 days ago1680570131IN
0x7EFcaBEa...C3fB2Afa3
0 ETH0.0040773324.22831456
Equip169721222023-04-04 0:47:47480 days ago1680569267IN
0x7EFcaBEa...C3fB2Afa3
0 ETH0.0091791224.57688758
View all transactions

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
TraitsConstructor

Compiler Version
v0.8.12+commit.f00d7308

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 13 : TraitsConstructor.sol
// SPDX-License-Identifier: GPL-3.0
// solhint-disable-next-line
pragma solidity 0.8.12;

import "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "./interface/IApes.sol";
import "./interface/ITraits.sol";

/// @title Bulls and Apes Project - Traits Constructor
/// @author BAP Dev Team
/// @notice Contract to equip or de-equip traits from Apes
contract TraitsConstructor is ERC1155Holder, ReentrancyGuard, Ownable {
    using Strings for uint256;

    /// @notice BAP Apes contract
    IApes public apesContract;
    /// @notice BAP Traits contract
    ITraits public traitsContract;
    /// @notice Address of the signer wallet
    address public secret;

    event Equipped(uint256 tokenId, string changeCode, address operator);

    /// @notice Deploys the contract
    /// @param _apes BAP Apes address
    /// @param _traits BAP Traits address
    /// @param _secret Signer address
    constructor(
        address _apes,
        address _traits,
        address _secret
    ) {
        apesContract = IApes(_apes);
        traitsContract = ITraits(_traits);
        secret = _secret;
    }

    /// @notice Equip or remove traits for the Ape
    /// @param tokenId Id of the Ape to be equipped
    /// @param traitsIn Traits that will be equipped
    /// @param traitsOut Traits that will be removed
    /// @param traitsOGOut OG traits to be removed
    /// @param changeCode Customization code with trait changes
    /// @param signature Signature to verify above parameters
    /// @dev Transfer traitsIn from user to contract, traitsOut from contract to user and mint TraitsOGOut to user
    function equip(
        uint256 tokenId, // Ape id to be modified
        uint256[] memory traitsIn, // id of traits to be added
        uint256[] memory traitsOut, // id of traits to be removed
        uint256[] memory traitsOGOut, // id of original traits to be removed (need to be minted)
        string memory changeCode, // internal code to process image change
        bytes memory signature
    ) external nonReentrant {
        string memory traitCode; // Used to avoid unauthorized changes

        uint256[] memory InAmounts = new uint256[](traitsIn.length); // create arrays with amount 1 for safeBatchTransfer

        for (uint256 i = 0; i < traitsIn.length; i++) {
            InAmounts[i] = 1;

            traitCode = string.concat(traitCode, "I", traitsIn[i].toString()); // loop through traits to create traitCode
        }
        uint256[] memory OutAmounts = new uint256[](traitsOut.length); // create arrays with amount 1 for safeBatchTransfer

        for (uint256 i = 0; i < traitsOut.length; i++) {
            OutAmounts[i] = 1;

            traitCode = string.concat(traitCode, "O", traitsOut[i].toString()); // loop through traits to create traitCode
        }

        uint256[] memory OGOutAmouts = new uint256[](traitsOGOut.length); // create arrays with amount 1 for safeBatchTransfer

        for (uint256 i = 0; i < traitsOGOut.length; i++) {
            OGOutAmouts[i] = 1;

            traitCode = string.concat(
                traitCode,
                "OG",
                traitsOGOut[i].toString()
            ); // loop through traits to create traitCode
        }

        address tokenOwner = apesContract.ownerOf(tokenId); // Current owner of the Ape, allows SafeClaim equip/de-equip

        require(
            _verifyHashSignature(
                keccak256(
                    abi.encode(
                        tokenId,
                        traitCode,
                        changeCode,
                        msg.sender,
                        tokenOwner
                    )
                ),
                signature
            ), // Checks validity of back-end provided signatre
            "Equip: Signature is invalid"
        );

        if (traitsIn.length > 0) {
            traitsContract.safeBatchTransferFrom(
                msg.sender,
                address(this),
                traitsIn,
                InAmounts,
                ""
            ); // batch transfer traits in, from user to this contract
        }

        if (traitsOut.length > 0) {
            traitsContract.safeBatchTransferFrom(
                address(this),
                msg.sender,
                traitsOut,
                OutAmounts,
                ""
            ); // batch transfer traits in, from this contract to user
        }

        if (traitsOGOut.length > 0) {
            traitsContract.mintBatch(msg.sender, traitsOGOut, OGOutAmouts); // batch mint original traits, from traits contract to user
        }

        apesContract.confirmChange(tokenId); // Confirm the change on Apes contract (burn - mint)

        emit Equipped(tokenId + 10000, changeCode, msg.sender); // event emitted with new ID after burn - mint
    }

    /// @notice Set new contracts addresses for Apes and Traits
    /// @param _apes New address for BAP Apes
    /// @param _traits New address for BAP Traits
    /// @dev Can only be called by the contract owner
    function setContracts(address _apes, address _traits) external onlyOwner {
        apesContract = IApes(_apes);
        traitsContract = ITraits(_traits);
    }

    /// @notice Change the signer address
    /// @param _secret new signer for encrypted signatures
    /// @dev Can only be called by the contract owner
    function setSecret(address _secret) external onlyOwner {
        secret = _secret;
    }

    function _verifyHashSignature(bytes32 freshHash, bytes memory signature)
        internal
        view
        returns (bool)
    {
        bytes32 hash = keccak256(
            abi.encodePacked("\x19Ethereum Signed Message:\n32", freshHash)
        );

        bytes32 r;
        bytes32 s;
        uint8 v;

        if (signature.length != 65) {
            return false;
        }
        assembly {
            r := mload(add(signature, 32))
            s := mload(add(signature, 64))
            v := byte(0, mload(add(signature, 96)))
        }

        if (v < 27) {
            v += 27;
        }

        address signer = address(0);
        if (v == 27 || v == 28) {
            // solium-disable-next-line arg-overflow
            signer = ecrecover(hash, v, r, s);
        }
        return secret == signer;
    }
}

File 2 of 13 : ITraits.sol
// SPDX-License-Identifier: GPL-3.0
// solhint-disable-next-line
pragma solidity 0.8.12;

interface ITraits {
    function mintBatch(
        address to,
        uint256[] memory ids,
        uint256[] memory amounts
    ) external;

    function safeBatchTransferFrom(
        address from,
        address to,
        uint256[] calldata ids,
        uint256[] calldata amounts,
        bytes calldata data
    ) external;
}

File 3 of 13 : IApes.sol
// SPDX-License-Identifier: GPL-3.0
// solhint-disable-next-line
pragma solidity 0.8.12;

interface IApes {
    function confirmChange(uint256 tokenId) external;

    function ownerOf(uint256 tokenId) external view returns (address owner);
}

File 4 of 13 : Math.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    enum Rounding {
        Down, // Toward negative infinity
        Up, // Toward infinity
        Zero // Toward zero
    }

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

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

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

    /**
     * @dev Returns the ceiling of the division of two numbers.
     *
     * This differs from standard division with `/` in that it rounds up instead
     * of rounding down.
     */
    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b - 1) / b can overflow on addition, so we distribute.
        return a == 0 ? 0 : (a - 1) / b + 1;
    }

    /**
     * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
     * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
     * with further edits by Uniswap Labs also under MIT license.
     */
    function mulDiv(
        uint256 x,
        uint256 y,
        uint256 denominator
    ) internal pure returns (uint256 result) {
        unchecked {
            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
            // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
            // variables such that product = prod1 * 2^256 + prod0.
            uint256 prod0; // Least significant 256 bits of the product
            uint256 prod1; // Most significant 256 bits of the product
            assembly {
                let mm := mulmod(x, y, not(0))
                prod0 := mul(x, y)
                prod1 := sub(sub(mm, prod0), lt(mm, prod0))
            }

            // Handle non-overflow cases, 256 by 256 division.
            if (prod1 == 0) {
                return prod0 / denominator;
            }

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            require(denominator > prod1);

            ///////////////////////////////////////////////
            // 512 by 256 division.
            ///////////////////////////////////////////////

            // Make division exact by subtracting the remainder from [prod1 prod0].
            uint256 remainder;
            assembly {
                // Compute remainder using mulmod.
                remainder := mulmod(x, y, denominator)

                // Subtract 256 bit number from 512 bit number.
                prod1 := sub(prod1, gt(remainder, prod0))
                prod0 := sub(prod0, remainder)
            }

            // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
            // See https://cs.stackexchange.com/q/138556/92363.

            // Does not overflow because the denominator cannot be zero at this stage in the function.
            uint256 twos = denominator & (~denominator + 1);
            assembly {
                // Divide denominator by twos.
                denominator := div(denominator, twos)

                // Divide [prod1 prod0] by twos.
                prod0 := div(prod0, twos)

                // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
                twos := add(div(sub(0, twos), twos), 1)
            }

            // Shift in bits from prod1 into prod0.
            prod0 |= prod1 * twos;

            // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
            // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
            // four bits. That is, denominator * inv = 1 mod 2^4.
            uint256 inverse = (3 * denominator) ^ 2;

            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
            // in modular arithmetic, doubling the correct bits in each step.
            inverse *= 2 - denominator * inverse; // inverse mod 2^8
            inverse *= 2 - denominator * inverse; // inverse mod 2^16
            inverse *= 2 - denominator * inverse; // inverse mod 2^32
            inverse *= 2 - denominator * inverse; // inverse mod 2^64
            inverse *= 2 - denominator * inverse; // inverse mod 2^128
            inverse *= 2 - denominator * inverse; // inverse mod 2^256

            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
            // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
            // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
            // is no longer required.
            result = prod0 * inverse;
            return result;
        }
    }

    /**
     * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
     */
    function mulDiv(
        uint256 x,
        uint256 y,
        uint256 denominator,
        Rounding rounding
    ) internal pure returns (uint256) {
        uint256 result = mulDiv(x, y, denominator);
        if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
            result += 1;
        }
        return result;
    }

    /**
     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
     *
     * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
     */
    function sqrt(uint256 a) internal pure returns (uint256) {
        if (a == 0) {
            return 0;
        }

        // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
        //
        // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
        // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
        //
        // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
        // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
        // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
        //
        // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
        uint256 result = 1 << (log2(a) >> 1);

        // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
        // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
        // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
        // into the expected uint128 result.
        unchecked {
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            return min(result, a / result);
        }
    }

    /**
     * @notice Calculates sqrt(a), following the selected rounding direction.
     */
    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = sqrt(a);
            return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 2, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 128;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 64;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 32;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 16;
            }
            if (value >> 8 > 0) {
                value >>= 8;
                result += 8;
            }
            if (value >> 4 > 0) {
                value >>= 4;
                result += 4;
            }
            if (value >> 2 > 0) {
                value >>= 2;
                result += 2;
            }
            if (value >> 1 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log2(value);
            return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 10, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >= 10**64) {
                value /= 10**64;
                result += 64;
            }
            if (value >= 10**32) {
                value /= 10**32;
                result += 32;
            }
            if (value >= 10**16) {
                value /= 10**16;
                result += 16;
            }
            if (value >= 10**8) {
                value /= 10**8;
                result += 8;
            }
            if (value >= 10**4) {
                value /= 10**4;
                result += 4;
            }
            if (value >= 10**2) {
                value /= 10**2;
                result += 2;
            }
            if (value >= 10**1) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log10(value);
            return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 256, rounded down, of a positive value.
     * Returns 0 if given 0.
     *
     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
     */
    function log256(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 16;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 8;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 4;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 2;
            }
            if (value >> 8 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log256(value);
            return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);
        }
    }
}

File 5 of 13 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

pragma solidity ^0.8.0;

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

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

pragma solidity ^0.8.0;

import "./IERC165.sol";

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

File 7 of 13 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

import "./math/Math.sol";

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _SYMBOLS = "0123456789abcdef";
    uint8 private constant _ADDRESS_LENGTH = 20;

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        unchecked {
            uint256 length = Math.log10(value) + 1;
            string memory buffer = new string(length);
            uint256 ptr;
            /// @solidity memory-safe-assembly
            assembly {
                ptr := add(buffer, add(32, length))
            }
            while (true) {
                ptr--;
                /// @solidity memory-safe-assembly
                assembly {
                    mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
                }
                value /= 10;
                if (value == 0) break;
            }
            return buffer;
        }
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        unchecked {
            return toHexString(value, Math.log256(value) + 1);
        }
    }

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

    /**
     * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
     */
    function toHexString(address addr) internal pure returns (string memory) {
        return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
    }
}

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

pragma solidity ^0.8.0;

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

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

File 9 of 13 : ERC1155Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/utils/ERC1155Receiver.sol)

pragma solidity ^0.8.0;

import "../IERC1155Receiver.sol";
import "../../../utils/introspection/ERC165.sol";

/**
 * @dev _Available since v3.1._
 */
abstract contract ERC1155Receiver is ERC165, IERC1155Receiver {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
        return interfaceId == type(IERC1155Receiver).interfaceId || super.supportsInterface(interfaceId);
    }
}

File 10 of 13 : ERC1155Holder.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/utils/ERC1155Holder.sol)

pragma solidity ^0.8.0;

import "./ERC1155Receiver.sol";

/**
 * Simple implementation of `ERC1155Receiver` that will allow a contract to hold ERC1155 tokens.
 *
 * IMPORTANT: When inheriting this contract, you must include a way to use the received tokens, otherwise they will be
 * stuck.
 *
 * @dev _Available since v3.1._
 */
contract ERC1155Holder is ERC1155Receiver {
    function onERC1155Received(
        address,
        address,
        uint256,
        uint256,
        bytes memory
    ) public virtual override returns (bytes4) {
        return this.onERC1155Received.selector;
    }

    function onERC1155BatchReceived(
        address,
        address,
        uint256[] memory,
        uint256[] memory,
        bytes memory
    ) public virtual override returns (bytes4) {
        return this.onERC1155BatchReceived.selector;
    }
}

File 11 of 13 : IERC1155Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev _Available since v3.1._
 */
interface IERC1155Receiver is IERC165 {
    /**
     * @dev Handles the receipt of a single ERC1155 token type. This function is
     * called at the end of a `safeTransferFrom` after the balance has been updated.
     *
     * NOTE: To accept the transfer, this must return
     * `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`
     * (i.e. 0xf23a6e61, or its own function selector).
     *
     * @param operator The address which initiated the transfer (i.e. msg.sender)
     * @param from The address which previously owned the token
     * @param id The ID of the token being transferred
     * @param value The amount of tokens being transferred
     * @param data Additional data with no specified format
     * @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed
     */
    function onERC1155Received(
        address operator,
        address from,
        uint256 id,
        uint256 value,
        bytes calldata data
    ) external returns (bytes4);

    /**
     * @dev Handles the receipt of a multiple ERC1155 token types. This function
     * is called at the end of a `safeBatchTransferFrom` after the balances have
     * been updated.
     *
     * NOTE: To accept the transfer(s), this must return
     * `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`
     * (i.e. 0xbc197c81, or its own function selector).
     *
     * @param operator The address which initiated the batch transfer (i.e. msg.sender)
     * @param from The address which previously owned the token
     * @param ids An array containing ids of each token being transferred (order and length must match values array)
     * @param values An array containing amounts of each token being transferred (order and length must match ids array)
     * @param data Additional data with no specified format
     * @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed
     */
    function onERC1155BatchReceived(
        address operator,
        address from,
        uint256[] calldata ids,
        uint256[] calldata values,
        bytes calldata data
    ) external returns (bytes4);
}

File 12 of 13 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

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

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

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

    function _nonReentrantBefore() private {
        // On the first call to nonReentrant, _status will be _NOT_ENTERED
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

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

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

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

pragma solidity ^0.8.0;

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

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

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

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

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

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

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

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

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

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

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_apes","type":"address"},{"internalType":"address","name":"_traits","type":"address"},{"internalType":"address","name":"_secret","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"string","name":"changeCode","type":"string"},{"indexed":false,"internalType":"address","name":"operator","type":"address"}],"name":"Equipped","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[],"name":"apesContract","outputs":[{"internalType":"contract IApes","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256[]","name":"traitsIn","type":"uint256[]"},{"internalType":"uint256[]","name":"traitsOut","type":"uint256[]"},{"internalType":"uint256[]","name":"traitsOGOut","type":"uint256[]"},{"internalType":"string","name":"changeCode","type":"string"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"equip","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC1155BatchReceived","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC1155Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"secret","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_apes","type":"address"},{"internalType":"address","name":"_traits","type":"address"}],"name":"setContracts","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_secret","type":"address"}],"name":"setSecret","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"traitsContract","outputs":[{"internalType":"contract ITraits","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60806040523480156200001157600080fd5b5060405162001461380380620014618339810160408190526200003491620000f6565b6001600055620000443362000087565b600280546001600160a01b039485166001600160a01b03199182161790915560038054938516938216939093179092556004805491909316911617905562000140565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b80516001600160a01b0381168114620000f157600080fd5b919050565b6000806000606084860312156200010c57600080fd5b6200011784620000d9565b92506200012760208501620000d9565b91506200013760408501620000d9565b90509250925092565b61131180620001506000396000f3fe608060405234801561001057600080fd5b50600436106100b45760003560e01c8063c093afdb11610071578063c093afdb14610172578063d1efd30d14610185578063d8952a4914610198578063e9a7484c146101ab578063f23a6e61146101be578063f2fde38b146101dd57600080fd5b806301ffc9a7146100b95780630e6369af146100e1578063279a20bc146100f6578063715018a6146101215780638da5cb5b14610129578063bc197c811461013a575b600080fd5b6100cc6100c7366004610c19565b6101f0565b60405190151581526020015b60405180910390f35b6100f46100ef366004610d81565b610227565b005b600254610109906001600160a01b031681565b6040516001600160a01b0390911681526020016100d8565b6100f4610782565b6001546001600160a01b0316610109565b610159610148366004610e70565b63bc197c8160e01b95945050505050565b6040516001600160e01b031990911681526020016100d8565b600354610109906001600160a01b031681565b600454610109906001600160a01b031681565b6100f46101a6366004610f1e565b610796565b6100f46101b9366004610f57565b6107cc565b6101596101cc366004610f74565b63f23a6e6160e01b95945050505050565b6100f46101eb366004610f57565b6107f6565b60006001600160e01b03198216630271189760e51b148061022157506301ffc9a760e01b6001600160e01b03198316145b92915050565b61022f61086f565b60606000865167ffffffffffffffff81111561024d5761024d610c4a565b604051908082528060200260200182016040528015610276578160200160208202803683370190505b50905060005b87518110156102fd57600182828151811061029957610299610fdd565b602002602001018181525050826102c88983815181106102bb576102bb610fdd565b60200260200101516108c9565b6040516020016102d9929190611023565b604051602081830303815290604052925080806102f590611075565b91505061027c565b506000865167ffffffffffffffff81111561031a5761031a610c4a565b604051908082528060200260200182016040528015610343578160200160208202803683370190505b50905060005b87518110156103bd57600182828151811061036657610366610fdd565b602002602001018181525050836103888983815181106102bb576102bb610fdd565b604051602001610399929190611090565b604051602081830303815290604052935080806103b590611075565b915050610349565b506000865167ffffffffffffffff8111156103da576103da610c4a565b604051908082528060200260200182016040528015610403578160200160208202803683370190505b50905060005b875181101561047d57600182828151811061042657610426610fdd565b602002602001018181525050846104488983815181106102bb576102bb610fdd565b6040516020016104599291906110c0565b6040516020818303038152906040529450808061047590611075565b915050610409565b506002546040516331a9108f60e11b8152600481018c90526000916001600160a01b031690636352211e90602401602060405180830381865afa1580156104c8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104ec91906110fd565b90506105268b8689338560405160200161050a959493929190611146565b6040516020818303038152906040528051906020012087610966565b6105775760405162461bcd60e51b815260206004820152601b60248201527f45717569703a205369676e617475726520697320696e76616c6964000000000060448201526064015b60405180910390fd5b8951156105e757600354604051631759616b60e11b81526001600160a01b0390911690632eb2c2d6906105b490339030908f908a906004016111d2565b600060405180830381600087803b1580156105ce57600080fd5b505af11580156105e2573d6000803e3d6000fd5b505050505b88511561065757600354604051631759616b60e11b81526001600160a01b0390911690632eb2c2d69061062490309033908e9089906004016111d2565b600060405180830381600087803b15801561063e57600080fd5b505af1158015610652573d6000803e3d6000fd5b505050505b8751156106c55760035460405163d81d0a1560e01b81526001600160a01b039091169063d81d0a15906106929033908c90879060040161122d565b600060405180830381600087803b1580156106ac57600080fd5b505af11580156106c0573d6000803e3d6000fd5b505050505b60025460405163170ef8b560e01b8152600481018d90526001600160a01b039091169063170ef8b590602401600060405180830381600087803b15801561070b57600080fd5b505af115801561071f573d6000803e3d6000fd5b505050507fcf74c6d9f29f45b514cb3024f15d477ce7f767bafeb2ac4b3f6a0533b5173ec38b612710610752919061126d565b883360405161076393929190611285565b60405180910390a1505050505061077a6001600055565b505050505050565b61078a610a95565b6107946000610aef565b565b61079e610a95565b600280546001600160a01b039384166001600160a01b03199182161790915560038054929093169116179055565b6107d4610a95565b600480546001600160a01b0319166001600160a01b0392909216919091179055565b6107fe610a95565b6001600160a01b0381166108635760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161056e565b61086c81610aef565b50565b600260005414156108c25760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161056e565b6002600055565b606060006108d683610b41565b600101905060008167ffffffffffffffff8111156108f6576108f6610c4a565b6040519080825280601f01601f191660200182016040528015610920576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a85049450846109595761095e565b61092a565b509392505050565b6040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c81018390526000908190605c01604051602081830303815290604052805190602001209050600080600085516041146109d1576000945050505050610221565b50505060208301516040840151606085015160001a601b8110156109fd576109fa601b826112b6565b90505b60008160ff16601b1480610a1457508160ff16601c145b15610a795760408051600081526020810180835287905260ff841691810191909152606081018590526080810184905260019060a0016020604051602081039080840390855afa158015610a6c573d6000803e3d6000fd5b5050506020604051035190505b6004546001600160a01b03918216911614979650505050505050565b6001546001600160a01b031633146107945760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161056e565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b8310610b805772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef81000000008310610bac576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc100008310610bca57662386f26fc10000830492506010015b6305f5e1008310610be2576305f5e100830492506008015b6127108310610bf657612710830492506004015b60648310610c08576064830492506002015b600a83106102215760010192915050565b600060208284031215610c2b57600080fd5b81356001600160e01b031981168114610c4357600080fd5b9392505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715610c8957610c89610c4a565b604052919050565b600082601f830112610ca257600080fd5b8135602067ffffffffffffffff821115610cbe57610cbe610c4a565b8160051b610ccd828201610c60565b9283528481018201928281019087851115610ce757600080fd5b83870192505b84831015610d0657823582529183019190830190610ced565b979650505050505050565b600082601f830112610d2257600080fd5b813567ffffffffffffffff811115610d3c57610d3c610c4a565b610d4f601f8201601f1916602001610c60565b818152846020838601011115610d6457600080fd5b816020850160208301376000918101602001919091529392505050565b60008060008060008060c08789031215610d9a57600080fd5b86359550602087013567ffffffffffffffff80821115610db957600080fd5b610dc58a838b01610c91565b96506040890135915080821115610ddb57600080fd5b610de78a838b01610c91565b95506060890135915080821115610dfd57600080fd5b610e098a838b01610c91565b94506080890135915080821115610e1f57600080fd5b610e2b8a838b01610d11565b935060a0890135915080821115610e4157600080fd5b50610e4e89828a01610d11565b9150509295509295509295565b6001600160a01b038116811461086c57600080fd5b600080600080600060a08688031215610e8857600080fd5b8535610e9381610e5b565b94506020860135610ea381610e5b565b9350604086013567ffffffffffffffff80821115610ec057600080fd5b610ecc89838a01610c91565b94506060880135915080821115610ee257600080fd5b610eee89838a01610c91565b93506080880135915080821115610f0457600080fd5b50610f1188828901610d11565b9150509295509295909350565b60008060408385031215610f3157600080fd5b8235610f3c81610e5b565b91506020830135610f4c81610e5b565b809150509250929050565b600060208284031215610f6957600080fd5b8135610c4381610e5b565b600080600080600060a08688031215610f8c57600080fd5b8535610f9781610e5b565b94506020860135610fa781610e5b565b93506040860135925060608601359150608086013567ffffffffffffffff811115610fd157600080fd5b610f1188828901610d11565b634e487b7160e01b600052603260045260246000fd5b60005b8381101561100e578181015183820152602001610ff6565b8381111561101d576000848401525b50505050565b60008351611035818460208801610ff3565b604960f81b9083019081528351611053816001840160208801610ff3565b01600101949350505050565b634e487b7160e01b600052601160045260246000fd5b60006000198214156110895761108961105f565b5060010190565b600083516110a2818460208801610ff3565b604f60f81b9083019081528351611053816001840160208801610ff3565b600083516110d2818460208801610ff3565b614f4760f01b90830190815283516110f1816002840160208801610ff3565b01600201949350505050565b60006020828403121561110f57600080fd5b8151610c4381610e5b565b60008151808452611132816020860160208601610ff3565b601f01601f19169290920160200192915050565b85815260a06020820152600061115f60a083018761111a565b8281036040840152611171818761111a565b6001600160a01b0395861660608501529390941660809092019190915250949350505050565b600081518084526020808501945080840160005b838110156111c7578151875295820195908201906001016111ab565b509495945050505050565b6001600160a01b0385811682528416602082015260a0604082018190526000906111fe90830185611197565b82810360608401526112108185611197565b838103608090940193909352505060008152602001949350505050565b6001600160a01b038416815260606020820181905260009061125190830185611197565b82810360408401526112638185611197565b9695505050505050565b600082198211156112805761128061105f565b500190565b83815260606020820152600061129e606083018561111a565b905060018060a01b0383166040830152949350505050565b600060ff821660ff84168060ff038211156112d3576112d361105f565b01939250505056fea2646970667358221220e99325b2d7ec4e6bcc16a6b41428ab7591ddb6980d3f549081a2260a04bd39a364736f6c634300080c00330000000000000000000000007f29b85834d6a2ba4bb1c64325686c6057b1b3c5000000000000000000000000ee9e6146e635e5da5c3885b2a641321c5a50da7e000000000000000000000000c8033181079b4a920cf5a3fd1a9f15fccc8c610f

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106100b45760003560e01c8063c093afdb11610071578063c093afdb14610172578063d1efd30d14610185578063d8952a4914610198578063e9a7484c146101ab578063f23a6e61146101be578063f2fde38b146101dd57600080fd5b806301ffc9a7146100b95780630e6369af146100e1578063279a20bc146100f6578063715018a6146101215780638da5cb5b14610129578063bc197c811461013a575b600080fd5b6100cc6100c7366004610c19565b6101f0565b60405190151581526020015b60405180910390f35b6100f46100ef366004610d81565b610227565b005b600254610109906001600160a01b031681565b6040516001600160a01b0390911681526020016100d8565b6100f4610782565b6001546001600160a01b0316610109565b610159610148366004610e70565b63bc197c8160e01b95945050505050565b6040516001600160e01b031990911681526020016100d8565b600354610109906001600160a01b031681565b600454610109906001600160a01b031681565b6100f46101a6366004610f1e565b610796565b6100f46101b9366004610f57565b6107cc565b6101596101cc366004610f74565b63f23a6e6160e01b95945050505050565b6100f46101eb366004610f57565b6107f6565b60006001600160e01b03198216630271189760e51b148061022157506301ffc9a760e01b6001600160e01b03198316145b92915050565b61022f61086f565b60606000865167ffffffffffffffff81111561024d5761024d610c4a565b604051908082528060200260200182016040528015610276578160200160208202803683370190505b50905060005b87518110156102fd57600182828151811061029957610299610fdd565b602002602001018181525050826102c88983815181106102bb576102bb610fdd565b60200260200101516108c9565b6040516020016102d9929190611023565b604051602081830303815290604052925080806102f590611075565b91505061027c565b506000865167ffffffffffffffff81111561031a5761031a610c4a565b604051908082528060200260200182016040528015610343578160200160208202803683370190505b50905060005b87518110156103bd57600182828151811061036657610366610fdd565b602002602001018181525050836103888983815181106102bb576102bb610fdd565b604051602001610399929190611090565b604051602081830303815290604052935080806103b590611075565b915050610349565b506000865167ffffffffffffffff8111156103da576103da610c4a565b604051908082528060200260200182016040528015610403578160200160208202803683370190505b50905060005b875181101561047d57600182828151811061042657610426610fdd565b602002602001018181525050846104488983815181106102bb576102bb610fdd565b6040516020016104599291906110c0565b6040516020818303038152906040529450808061047590611075565b915050610409565b506002546040516331a9108f60e11b8152600481018c90526000916001600160a01b031690636352211e90602401602060405180830381865afa1580156104c8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104ec91906110fd565b90506105268b8689338560405160200161050a959493929190611146565b6040516020818303038152906040528051906020012087610966565b6105775760405162461bcd60e51b815260206004820152601b60248201527f45717569703a205369676e617475726520697320696e76616c6964000000000060448201526064015b60405180910390fd5b8951156105e757600354604051631759616b60e11b81526001600160a01b0390911690632eb2c2d6906105b490339030908f908a906004016111d2565b600060405180830381600087803b1580156105ce57600080fd5b505af11580156105e2573d6000803e3d6000fd5b505050505b88511561065757600354604051631759616b60e11b81526001600160a01b0390911690632eb2c2d69061062490309033908e9089906004016111d2565b600060405180830381600087803b15801561063e57600080fd5b505af1158015610652573d6000803e3d6000fd5b505050505b8751156106c55760035460405163d81d0a1560e01b81526001600160a01b039091169063d81d0a15906106929033908c90879060040161122d565b600060405180830381600087803b1580156106ac57600080fd5b505af11580156106c0573d6000803e3d6000fd5b505050505b60025460405163170ef8b560e01b8152600481018d90526001600160a01b039091169063170ef8b590602401600060405180830381600087803b15801561070b57600080fd5b505af115801561071f573d6000803e3d6000fd5b505050507fcf74c6d9f29f45b514cb3024f15d477ce7f767bafeb2ac4b3f6a0533b5173ec38b612710610752919061126d565b883360405161076393929190611285565b60405180910390a1505050505061077a6001600055565b505050505050565b61078a610a95565b6107946000610aef565b565b61079e610a95565b600280546001600160a01b039384166001600160a01b03199182161790915560038054929093169116179055565b6107d4610a95565b600480546001600160a01b0319166001600160a01b0392909216919091179055565b6107fe610a95565b6001600160a01b0381166108635760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161056e565b61086c81610aef565b50565b600260005414156108c25760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161056e565b6002600055565b606060006108d683610b41565b600101905060008167ffffffffffffffff8111156108f6576108f6610c4a565b6040519080825280601f01601f191660200182016040528015610920576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a85049450846109595761095e565b61092a565b509392505050565b6040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c81018390526000908190605c01604051602081830303815290604052805190602001209050600080600085516041146109d1576000945050505050610221565b50505060208301516040840151606085015160001a601b8110156109fd576109fa601b826112b6565b90505b60008160ff16601b1480610a1457508160ff16601c145b15610a795760408051600081526020810180835287905260ff841691810191909152606081018590526080810184905260019060a0016020604051602081039080840390855afa158015610a6c573d6000803e3d6000fd5b5050506020604051035190505b6004546001600160a01b03918216911614979650505050505050565b6001546001600160a01b031633146107945760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161056e565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b8310610b805772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef81000000008310610bac576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc100008310610bca57662386f26fc10000830492506010015b6305f5e1008310610be2576305f5e100830492506008015b6127108310610bf657612710830492506004015b60648310610c08576064830492506002015b600a83106102215760010192915050565b600060208284031215610c2b57600080fd5b81356001600160e01b031981168114610c4357600080fd5b9392505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715610c8957610c89610c4a565b604052919050565b600082601f830112610ca257600080fd5b8135602067ffffffffffffffff821115610cbe57610cbe610c4a565b8160051b610ccd828201610c60565b9283528481018201928281019087851115610ce757600080fd5b83870192505b84831015610d0657823582529183019190830190610ced565b979650505050505050565b600082601f830112610d2257600080fd5b813567ffffffffffffffff811115610d3c57610d3c610c4a565b610d4f601f8201601f1916602001610c60565b818152846020838601011115610d6457600080fd5b816020850160208301376000918101602001919091529392505050565b60008060008060008060c08789031215610d9a57600080fd5b86359550602087013567ffffffffffffffff80821115610db957600080fd5b610dc58a838b01610c91565b96506040890135915080821115610ddb57600080fd5b610de78a838b01610c91565b95506060890135915080821115610dfd57600080fd5b610e098a838b01610c91565b94506080890135915080821115610e1f57600080fd5b610e2b8a838b01610d11565b935060a0890135915080821115610e4157600080fd5b50610e4e89828a01610d11565b9150509295509295509295565b6001600160a01b038116811461086c57600080fd5b600080600080600060a08688031215610e8857600080fd5b8535610e9381610e5b565b94506020860135610ea381610e5b565b9350604086013567ffffffffffffffff80821115610ec057600080fd5b610ecc89838a01610c91565b94506060880135915080821115610ee257600080fd5b610eee89838a01610c91565b93506080880135915080821115610f0457600080fd5b50610f1188828901610d11565b9150509295509295909350565b60008060408385031215610f3157600080fd5b8235610f3c81610e5b565b91506020830135610f4c81610e5b565b809150509250929050565b600060208284031215610f6957600080fd5b8135610c4381610e5b565b600080600080600060a08688031215610f8c57600080fd5b8535610f9781610e5b565b94506020860135610fa781610e5b565b93506040860135925060608601359150608086013567ffffffffffffffff811115610fd157600080fd5b610f1188828901610d11565b634e487b7160e01b600052603260045260246000fd5b60005b8381101561100e578181015183820152602001610ff6565b8381111561101d576000848401525b50505050565b60008351611035818460208801610ff3565b604960f81b9083019081528351611053816001840160208801610ff3565b01600101949350505050565b634e487b7160e01b600052601160045260246000fd5b60006000198214156110895761108961105f565b5060010190565b600083516110a2818460208801610ff3565b604f60f81b9083019081528351611053816001840160208801610ff3565b600083516110d2818460208801610ff3565b614f4760f01b90830190815283516110f1816002840160208801610ff3565b01600201949350505050565b60006020828403121561110f57600080fd5b8151610c4381610e5b565b60008151808452611132816020860160208601610ff3565b601f01601f19169290920160200192915050565b85815260a06020820152600061115f60a083018761111a565b8281036040840152611171818761111a565b6001600160a01b0395861660608501529390941660809092019190915250949350505050565b600081518084526020808501945080840160005b838110156111c7578151875295820195908201906001016111ab565b509495945050505050565b6001600160a01b0385811682528416602082015260a0604082018190526000906111fe90830185611197565b82810360608401526112108185611197565b838103608090940193909352505060008152602001949350505050565b6001600160a01b038416815260606020820181905260009061125190830185611197565b82810360408401526112638185611197565b9695505050505050565b600082198211156112805761128061105f565b500190565b83815260606020820152600061129e606083018561111a565b905060018060a01b0383166040830152949350505050565b600060ff821660ff84168060ff038211156112d3576112d361105f565b01939250505056fea2646970667358221220e99325b2d7ec4e6bcc16a6b41428ab7591ddb6980d3f549081a2260a04bd39a364736f6c634300080c0033

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

0000000000000000000000007f29b85834d6a2ba4bb1c64325686c6057b1b3c5000000000000000000000000ee9e6146e635e5da5c3885b2a641321c5a50da7e000000000000000000000000c8033181079b4a920cf5a3fd1a9f15fccc8c610f

-----Decoded View---------------
Arg [0] : _apes (address): 0x7f29b85834d6A2ba4BB1c64325686C6057B1B3C5
Arg [1] : _traits (address): 0xee9e6146E635E5DA5C3885b2A641321C5A50Da7e
Arg [2] : _secret (address): 0xc8033181079b4a920cf5A3Fd1A9f15fCCC8C610F

-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 0000000000000000000000007f29b85834d6a2ba4bb1c64325686c6057b1b3c5
Arg [1] : 000000000000000000000000ee9e6146e635e5da5c3885b2a641321c5a50da7e
Arg [2] : 000000000000000000000000c8033181079b4a920cf5a3fd1a9f15fccc8c610f


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

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

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