ETH Price: $2,971.43 (+2.44%)
Gas: 1 Gwei

Contract

0xeCC094e20561001caBBE63Fe9E6C2d3081DeA271
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Token Holdings

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Value
Burn Teens202440122024-07-06 0:52:594 hrs ago1720227179IN
0xeCC094e2...081DeA271
0 ETH0.000375955.90188432
Burn Teens202065922024-06-30 19:28:235 days ago1719775703IN
0xeCC094e2...081DeA271
0 ETH0.000393516.17755526
Burn Apes202064012024-06-30 18:50:115 days ago1719773411IN
0xeCC094e2...081DeA271
0 ETH0.002054365.84883214
Burn Teens202052872024-06-30 15:06:115 days ago1719759971IN
0xeCC094e2...081DeA271
0 ETH0.000336315.27962961
Burn Apes202052802024-06-30 15:04:475 days ago1719759887IN
0xeCC094e2...081DeA271
0 ETH0.001879695.54574953
Burn Teens201377372024-06-21 4:34:3515 days ago1718944475IN
0xeCC094e2...081DeA271
0 ETH0.000319735.01933417
Burn Apes201377292024-06-21 4:32:5915 days ago1718944379IN
0xeCC094e2...081DeA271
0 ETH0.001253284.85418661
Burn Teens201232192024-06-19 3:50:2317 days ago1718769023IN
0xeCC094e2...081DeA271
0 ETH0.000442156.94110135
Burn Apes201232122024-06-19 3:48:5917 days ago1718768939IN
0xeCC094e2...081DeA271
0 ETH0.002299977.21552905
Burn Teens201224742024-06-19 1:20:2317 days ago1718760023IN
0xeCC094e2...081DeA271
0 ETH0.0006782910.64816577
Burn Apes201224642024-06-19 1:18:2317 days ago1718759903IN
0xeCC094e2...081DeA271
0 ETH0.00250349.00579875
Burn Teens201212562024-06-18 21:14:4717 days ago1718745287IN
0xeCC094e2...081DeA271
0 ETH0.0006405910.05625183
Burn Apes201212482024-06-18 21:13:1117 days ago1718745191IN
0xeCC094e2...081DeA271
0 ETH0.0042993812.3317833
Burn Teens201156922024-06-18 2:31:4718 days ago1718677907IN
0xeCC094e2...081DeA271
0 ETH0.001229719.3042572
Burn Apes201156612024-06-18 2:25:3518 days ago1718677535IN
0xeCC094e2...081DeA271
0 ETH0.0066582520.27149704
Burn Teens201070342024-06-16 21:27:3519 days ago1718573255IN
0xeCC094e2...081DeA271
0 ETH0.000373465.86282443
Burn Apes201070252024-06-16 21:25:4719 days ago1718573147IN
0xeCC094e2...081DeA271
0 ETH0.001818025.53182701
Burn Teens201064752024-06-16 19:34:5919 days ago1718566499IN
0xeCC094e2...081DeA271
0 ETH0.000369155.79512773
Burn Apes201064672024-06-16 19:33:2319 days ago1718566403IN
0xeCC094e2...081DeA271
0 ETH0.001928925.87275372
Burn Teens201064362024-06-16 19:27:1119 days ago1718566031IN
0xeCC094e2...081DeA271
0 ETH0.000340665.34781447
Burn Apes201064302024-06-16 19:25:5919 days ago1718565959IN
0xeCC094e2...081DeA271
0 ETH0.001856615.32524991
Burn Teens201018652024-06-16 4:09:1120 days ago1718510951IN
0xeCC094e2...081DeA271
0 ETH0.000320815.0362542
Burn Apes201018582024-06-16 4:07:4720 days ago1718510867IN
0xeCC094e2...081DeA271
0 ETH0.001799915.31038509
Burn Teens201000292024-06-15 21:59:2320 days ago1718488763IN
0xeCC094e2...081DeA271
0 ETH0.000338135.30809495
Burn Apes201000132024-06-15 21:56:1120 days ago1718488571IN
0xeCC094e2...081DeA271
0 ETH0.00169445.14636153
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:
AssetsInteraction

Compiler Version
v0.8.12+commit.f00d7308

Optimization Enabled:
Yes with 200 runs

Other Settings:
london EvmVersion
File 1 of 10 : AssetsInteraction.sol
// SPDX-License-Identifier: GPL-3.0
// solhint-disable-next-line
pragma solidity 0.8.12;

import "./interface/IMasterContract.sol";
import "./interface/ITraits.sol";
import "./reduced_interfaces/BAPApesInterface.sol";
import "./reduced_interfaces/BAPTeenBullsInterface.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Strings.sol";

/// @title Bulls and Apes Project - Assets Interactions
/// @author BAP Dev Team
/// @notice Handle the use of the Assets inside BAP ecosystem
contract AssetsInteraction is Ownable, IERC721Receiver {
    using Strings for uint256;
    /// @notice Master contract instance
    IMasterContract public masterContract;
    /// @notice OG Bulls contract instance
    BAPApesInterface public bapApes;
    /// @notice Teen Bulls contract instance
    BAPTeenBullsInterface public bapTeenBulls;

    /// @notice Address of the wallet that signs messages
    address public secret;

    /// @notice Last token received, Used for resurrecting
    uint256 private lastTokenReceived;

    /// @notice Boolean to prevent Teens being sent to the contract, only allowed when reviving
    bool private isReviving = false;

    /// @notice Mapping to check if a Teen has been resurrected
    mapping(uint256 => bool) public isResurrected;
    /// @notice Mapping for contracts allowed to use this contract
    mapping(address => bool) public isAuthorized;

    /// @notice Resurrection event
    event TeenResurrected(
        address user,
        uint256 sacrificed,
        uint256 resurrected,
        uint256 newlyMinted,
        uint256 offChainUtility
    );

    /// @notice Event for Utility burned off chain
    event UtilityBurnedOffChain(
        address user,
        uint256 utilityId,
        uint256 timestamp
    );

    /// @notice Event emited when assets are burned for GAC / type 1 = Teens, type 2 = Apes
    event AssetsBurned(address user, uint256[] tokenIds, uint256 typeOfAsset, uint256 timestamp);

    /// @notice Deploys the contract and sets the instances addresses
    /// @param masterContractAddress: Address of the Master Contract
    /// @param apesAddress: Address of the OG Bulls contract
    /// @param teensAddress: Address of the Teen Bulls contract
    constructor(
        address masterContractAddress,
        address apesAddress,
        address teensAddress
    ) {
        masterContract = IMasterContract(masterContractAddress);
        bapApes = BAPApesInterface(apesAddress);
        bapTeenBulls = BAPTeenBullsInterface(teensAddress);
    }

    modifier onlyAuthorized() {
        require(isAuthorized[msg.sender], "Not Authorized");
        _;
    }

    /// @notice function used to burn teens for GAC
    /// @param tokenIds: IDs of the teens to burn
    /// @dev Only the owner of the assets can burn them and first needs to approve this contract
    function burnTeens(uint256[] memory tokenIds) external {
        for (uint256 i = 0; i < tokenIds.length; i++) {
            _burnTeen(tokenIds[i]);
        }

        emit AssetsBurned(msg.sender, tokenIds, 1, block.timestamp);
    }

    // @notice function used to burn apes for GAC
    /// @param tokenIds: IDs of the apes to burn
    /// @dev Only the owner of the assets can burn them and first needs to approve this contract
    function burnApes(uint256[] memory tokenIds) external {
        for (uint256 i = 0; i < tokenIds.length; i++) {
            // transfer to dead address to burn
            bapApes.transferFrom(msg.sender, address(this), tokenIds[i]);
        }

        emit AssetsBurned(msg.sender, tokenIds, 2, block.timestamp);
    }

    function resurrectApe(uint256 tokenId, address recipient) external onlyAuthorized {
        require(recipient != address(0), "resurrectApe: Invalid recipient");
        require(bapApes.ownerOf(tokenId) == address(this), "resurrectApe: Invalid owner");        

        bapApes.transferFrom(address(this), recipient, tokenId);
    }

    /// @notice Handle the resurrection of a Teen Bull
    /// @param utilityId: ID of the utility used to resurrect
    /// @param sacrificed: ID of the Teen Bull sacrificed
    /// @param resurrected: ID of the Teen Bull to resurrect
    /// @param timeOut: Time out for the signature
    /// @param offChainUtility: Boolean to check if the utility is on-chain or off-chain
    /// @param signature: Signature to check above parameters
    function teenResurrect(
        uint256 utilityId,
        uint256 sacrificed,
        uint256 resurrected,
        uint256 timeOut,
        uint256 offChainUtility,
        bytes memory signature
    ) external {
        require(
            utilityId >= 30 && utilityId < 34,
            "teenResurrect: Wrong utilityId id"
        );
        require(
            timeOut > block.timestamp,
            "teenResurrect: Signature is expired"
        );
        require(
            _verifyHashSignature(
                keccak256(
                    abi.encode(
                        msg.sender,
                        utilityId,
                        sacrificed,
                        resurrected,
                        timeOut,
                        offChainUtility // 0 for on-chain, 1 for off-chain
                    )
                ),
                signature
            ),
            "teenResurrect: Signature is invalid"
        );
        require(
            !isResurrected[sacrificed],
            "teenResurrect: Can't sacrifice a resurrected Teen Bull"
        );
        require(
            !isResurrected[resurrected],
            "teenResurrect: Can't resurrect an already resurrected Teen Bull"
        );
        if (offChainUtility == 0) {
            masterContract.burn(utilityId, 1);
        } else {
            emit UtilityBurnedOffChain(msg.sender, utilityId, block.timestamp);
        }

        _burnTeen(sacrificed);

        isReviving = true;

        bapTeenBulls.airdrop(address(this), 1);

        isReviving = false;

        isResurrected[lastTokenReceived] = true;
        isResurrected[resurrected] = true;

        bapTeenBulls.safeTransferFrom(
            address(this),
            msg.sender,
            lastTokenReceived
        );

        emit TeenResurrected(
            msg.sender,
            sacrificed,
            resurrected,
            lastTokenReceived,
            offChainUtility
        );

        lastTokenReceived = 0;
    }

    /// @notice Handle the generation of Teen Bulls
    /// @dev Needs to pay METH and burn an Incubator
    function generateTeenBull() external {
        masterContract.pay(600, 300);
        masterContract.burn(1, 1);
        bapTeenBulls.airdrop(msg.sender, 1);
    }

    /// @notice Internal function to burn a Teen Bull
    /// @param tokenId: ID of the Teen Bull to burn
    /// @dev Only the owner of the Teen Bull can burn it and resurrected Teen Bulls cannot be burned
    function _burnTeen(uint256 tokenId) internal {
        require(
            bapTeenBulls.ownerOf(tokenId) == msg.sender,
            "Only the owner can burn"
        );
        require(!isResurrected[tokenId], "Can't burn resurrected teens");

        bapTeenBulls.burnTeenBull(tokenId);
    }

    /// @notice authorise a new address to use this contract
    /// @param operator Address to be set
    /// @param status Can use this contract or not
    /// @dev Only contract owner can call this function
    function setAuthorized(address operator, bool status) external onlyOwner {
        isAuthorized[operator] = status;
    }

    /// @notice Internal function to set isResurrected status on previously resurrected Teen Bulls
    /// @param tokenIds: Array of Teen Bull IDs to set isResurrected status
    /// @param boolean: Boolean to set isResurrected status
    /// @dev Only used to set isResurrected status on Teen Bulls resurrected before the contract deployment
    function setIsResurrected(
        uint256[] memory tokenIds,
        bool boolean
    ) external onlyOwner {
        for (uint256 i = 0; i < tokenIds.length; i++) {
            isResurrected[tokenIds[i]] = boolean;
        }
    }

    /// @notice Internal function to set a new signer
    /// @param newSigner: Address of the new signer
    /// @dev Only the owner can set a new signer
    function setSigner(address newSigner) external onlyOwner {
        require(newSigner != address(0), "Invalid address");
        secret = newSigner;
    }

    /// @notice Internal function to handle the transfer of a Teen Bull during the resurrection process
    /// @param tokenId: ID of the Teen Bull to transfer
    /// @dev Only accept transfers from BAP Teens and only while reviving
    function onERC721Received(
        address,
        address,
        uint256 tokenId,
        bytes memory
    ) external virtual override returns (bytes4) {
        require(
            msg.sender == address(bapTeenBulls),
            "Only receive from BAP Teens"
        );
        require(isReviving, "Only accept transfers while reviving");
        lastTokenReceived = tokenId;
        return this.onERC721Received.selector;
    }

    /// @notice Transfer ownership from external contracts owned by this contract
    /// @param _contract Address of the external contract
    /// @param _newOwner New owner
    /// @dev Only contract owner can call this function
    function transferOwnershipExternalContract(
        address _contract,
        address _newOwner
    ) external onlyOwner {
        Ownable(_contract).transferOwnership(_newOwner);
    }

    /// @notice Set new contracts addresses
    /// @param  masterContractAddress, Address of the new master contract
    /// @param  apesAddress, Address of the new BAP OG contract
    /// @param  teensAddress, Address of the new BAP Teens contract
    /// @dev Only contract owner can call this function
    function setContractsAddresses(
        address masterContractAddress,
        address apesAddress,
        address teensAddress
    ) external onlyOwner {
        masterContract = IMasterContract(masterContractAddress);
        bapApes = BAPApesInterface(apesAddress);
        bapTeenBulls = BAPTeenBullsInterface(teensAddress);
    }

    /// @notice Internal function to check if a signature is valid
    /// @param freshHash: Hash to check
    /// @param signature: Signature to check
    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 10 : BAPTeenBullsInterface.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.12;

interface BAPTeenBullsInterface {
    function generateTeenBull() external;

    function generateMergerOrb() external;

    function ownerOf(uint256) external view returns (address);

    function burnTeenBull(uint256) external;

    function airdrop(address, uint256) external;

    function safeTransferFrom(
        address,
        address,
        uint256
    ) external;
}

File 3 of 10 : BAPApesInterface.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.12;

interface BAPApesInterface {
    function ownerOf(uint256) external view returns (address);

   function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;
}

File 4 of 10 : 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;

    function mint(
        address to,
        uint256 tokenId,
        uint256 amount
    ) external;

    function burn(
        address account,
        uint256 id,
        uint256 value
    ) external;
}

File 5 of 10 : IMasterContract.sol
// SPDX-License-Identifier: GPL-3.0
// solhint-disable-next-line
pragma solidity 0.8.12;

interface IMasterContract {
    // METH functions

    function claim(address to, uint256 amount) external;

    function pay(uint256 payment, uint256 fee) external;

    // Teens functions

    function airdrop(address to, uint256 amount) external;

    function burnTeenBull(uint256 tokenId) external;

    // Utilities functions

    function burn(uint256 id, uint256 amount) external;

    function airdrop(
        address to,
        uint256 amount,
        uint256 id
    ) external;
}

File 6 of 10 : 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 7 of 10 : 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 10 : 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 10 : IERC721Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)

pragma solidity ^0.8.0;

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

File 10 of 10 : 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":"masterContractAddress","type":"address"},{"internalType":"address","name":"apesAddress","type":"address"},{"internalType":"address","name":"teensAddress","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"},{"indexed":false,"internalType":"uint256","name":"typeOfAsset","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"AssetsBurned","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"sacrificed","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"resurrected","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newlyMinted","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"offChainUtility","type":"uint256"}],"name":"TeenResurrected","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"utilityId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"UtilityBurnedOffChain","type":"event"},{"inputs":[],"name":"bapApes","outputs":[{"internalType":"contract BAPApesInterface","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bapTeenBulls","outputs":[{"internalType":"contract BAPTeenBullsInterface","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"burnApes","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"burnTeens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"generateTeenBull","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isAuthorized","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"isResurrected","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"masterContract","outputs":[{"internalType":"contract IMasterContract","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC721Received","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":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"}],"name":"resurrectApe","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"secret","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"status","type":"bool"}],"name":"setAuthorized","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"masterContractAddress","type":"address"},{"internalType":"address","name":"apesAddress","type":"address"},{"internalType":"address","name":"teensAddress","type":"address"}],"name":"setContractsAddresses","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"},{"internalType":"bool","name":"boolean","type":"bool"}],"name":"setIsResurrected","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newSigner","type":"address"}],"name":"setSigner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"utilityId","type":"uint256"},{"internalType":"uint256","name":"sacrificed","type":"uint256"},{"internalType":"uint256","name":"resurrected","type":"uint256"},{"internalType":"uint256","name":"timeOut","type":"uint256"},{"internalType":"uint256","name":"offChainUtility","type":"uint256"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"teenResurrect","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_contract","type":"address"},{"internalType":"address","name":"_newOwner","type":"address"}],"name":"transferOwnershipExternalContract","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60806040526006805460ff191690553480156200001b57600080fd5b50604051620018c8380380620018c88339810160408190526200003e91620000f9565b62000049336200008c565b600180546001600160a01b039485166001600160a01b03199182161790915560028054938516938216939093179092556003805491909316911617905562000143565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b0381168114620000f457600080fd5b919050565b6000806000606084860312156200010f57600080fd5b6200011a84620000dc565b92506200012a60208501620000dc565b91506200013a60408501620000dc565b90509250925092565b61177580620001536000396000f3fe608060405234801561001057600080fd5b506004361061012c5760003560e01c8063850f700e116100ad578063cd446e2211610071578063cd446e221461028e578063d1efd30d146102a1578063f2fde38b146102b4578063f81d1fd5146102c7578063fe9fbb80146102da57600080fd5b8063850f700e1461023c5780638b9eae721461024f5780638da5cb5b14610262578063b5d264a614610273578063c5577ff71461028657600080fd5b80636c19e783116100f45780636c19e783146101e8578063711bf9b2146101fb578063715018a61461020e5780637bebe4cb146102165780637f154deb1461022957600080fd5b8063150b7a021461013157806324330982146101625780632465f70314610177578063535c33ef146101a25780635fb8e56c146101d5575b600080fd5b61014461013f36600461133a565b6102fd565b6040516001600160e01b031990911681526020015b60405180910390f35b6101756101703660046113a6565b6103d0565b005b60025461018a906001600160a01b031681565b6040516001600160a01b039091168152602001610159565b6101c56101b03660046113df565b60076020526000908152604090205460ff1681565b6040519015158152602001610159565b6101756101e3366004611478565b610438565b6101756101f63660046114b5565b6104ba565b6101756102093660046114ee565b61052c565b61017561055f565b610175610224366004611523565b610573565b610175610237366004611568565b6105e3565b60035461018a906001600160a01b031681565b61017561025d366004611478565b610a81565b6000546001600160a01b031661018a565b6101756102813660046115d4565b610b76565b610175610bbd565b60015461018a906001600160a01b031681565b60045461018a906001600160a01b031681565b6101756102c23660046114b5565b610cef565b6101756102d536600461161f565b610d68565b6101c56102e83660046114b5565b60086020526000908152604090205460ff1681565b6003546000906001600160a01b0316331461035f5760405162461bcd60e51b815260206004820152601b60248201527f4f6e6c7920726563656976652066726f6d20424150205465656e73000000000060448201526064015b60405180910390fd5b60065460ff166103bd5760405162461bcd60e51b8152602060048201526024808201527f4f6e6c7920616363657074207472616e7366657273207768696c65207265766960448201526376696e6760e01b6064820152608401610356565b505060055550630a85bd0160e11b919050565b6103d8610f10565b60405163f2fde38b60e01b81526001600160a01b03828116600483015283169063f2fde38b906024015b600060405180830381600087803b15801561041c57600080fd5b505af1158015610430573d6000803e3d6000fd5b505050505050565b60005b81518110156104785761046682828151811061045957610459611644565b6020026020010151610f6a565b8061047081611670565b91505061043b565b507f89a770be46dbf61810c6a56e9a6cf40b456b35c6f409843c0186fd892e90305633826001426040516104af94939291906116c6565b60405180910390a150565b6104c2610f10565b6001600160a01b03811661050a5760405162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206164647265737360881b6044820152606401610356565b600480546001600160a01b0319166001600160a01b0392909216919091179055565b610534610f10565b6001600160a01b03919091166000908152600860205260409020805460ff1916911515919091179055565b610567610f10565b61057160006110ed565b565b61057b610f10565b60005b82518110156105de57816007600085848151811061059e5761059e611644565b6020026020010151815260200190815260200160002060006101000a81548160ff02191690831515021790555080806105d690611670565b91505061057e565b505050565b601e86101580156105f45750602286105b61064a5760405162461bcd60e51b815260206004820152602160248201527f7465656e5265737572726563743a2057726f6e67207574696c697479496420696044820152601960fa1b6064820152608401610356565b4283116106a55760405162461bcd60e51b815260206004820152602360248201527f7465656e5265737572726563743a205369676e617475726520697320657870696044820152621c995960ea1b6064820152608401610356565b60408051336020820152908101879052606081018690526080810185905260a0810184905260c081018390526106f49060e001604051602081830303815290604052805190602001208261113d565b61074c5760405162461bcd60e51b815260206004820152602360248201527f7465656e5265737572726563743a205369676e617475726520697320696e76616044820152621b1a5960ea1b6064820152608401610356565b60008581526007602052604090205460ff16156107ca5760405162461bcd60e51b815260206004820152603660248201527f7465656e5265737572726563743a2043616e2774207361637269666963652061604482015275081c995cdd5c9c9958dd1959081519595b88109d5b1b60521b6064820152608401610356565b60008481526007602052604090205460ff161561084f5760405162461bcd60e51b815260206004820152603f60248201527f7465656e5265737572726563743a2043616e277420726573757272656374206160448201527f6e20616c7265616479207265737572726563746564205465656e2042756c6c006064820152608401610356565b816108be576001805460405163b390c0ab60e01b81526004810189905260248101929092526001600160a01b03169063b390c0ab90604401600060405180830381600087803b1580156108a157600080fd5b505af11580156108b5573d6000803e3d6000fd5b505050506108fe565b6040805133815260208101889052428183015290517fbf348d57f40d5e718c36e92188472e18417442d08bda9ea3dc50a291418eea439181900360600190a15b61090785610f6a565b6006805460ff191660019081179091556003546040516322e9330f60e21b815230600482015260248101929092526001600160a01b031690638ba4cc3c90604401600060405180830381600087803b15801561096257600080fd5b505af1158015610976573d6000803e3d6000fd5b50506006805460ff19908116909155600580546000908152600760205260408082208054851660019081179091558a835291819020805490941690911790925560035490549151632142170760e11b815230600482015233602482015260448101929092526001600160a01b031692506342842e0e9150606401600060405180830381600087803b158015610a0a57600080fd5b505af1158015610a1e573d6000803e3d6000fd5b505060055460408051338152602081018a9052808201899052606081019290925260808201869052517f772a3dfb63f8a4904bc5c5c5881e63083f06959f0cd784079eb92583712fcaa793509081900360a0019150a15050600060055550505050565b60005b8151811015610b3f5760025482516001600160a01b03909116906323b872dd9033903090869086908110610aba57610aba611644565b60209081029190910101516040516001600160e01b031960e086901b1681526001600160a01b0393841660048201529290911660248301526044820152606401600060405180830381600087803b158015610b1457600080fd5b505af1158015610b28573d6000803e3d6000fd5b505050508080610b3790611670565b915050610a84565b507f89a770be46dbf61810c6a56e9a6cf40b456b35c6f409843c0186fd892e90305633826002426040516104af94939291906116c6565b610b7e610f10565b600180546001600160a01b039485166001600160a01b031991821617909155600280549385169382169390931790925560038054919093169116179055565b6001546040516377a4777360e11b8152610258600482015261012c60248201526001600160a01b039091169063ef48eee690604401600060405180830381600087803b158015610c0c57600080fd5b505af1158015610c20573d6000803e3d6000fd5b50506001805460405163b390c0ab60e01b81526004810183905260248101929092526001600160a01b0316925063b390c0ab9150604401600060405180830381600087803b158015610c7157600080fd5b505af1158015610c85573d6000803e3d6000fd5b50506003546040516322e9330f60e21b8152336004820152600160248201526001600160a01b039091169250638ba4cc3c9150604401600060405180830381600087803b158015610cd557600080fd5b505af1158015610ce9573d6000803e3d6000fd5b50505050565b610cf7610f10565b6001600160a01b038116610d5c5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610356565b610d65816110ed565b50565b3360009081526008602052604090205460ff16610db85760405162461bcd60e51b815260206004820152600e60248201526d139bdd08105d5d1a1bdc9a5e995960921b6044820152606401610356565b6001600160a01b038116610e0e5760405162461bcd60e51b815260206004820152601f60248201527f7265737572726563744170653a20496e76616c696420726563697069656e74006044820152606401610356565b6002546040516331a9108f60e11b81526004810184905230916001600160a01b031690636352211e90602401602060405180830381865afa158015610e57573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e7b91906116fd565b6001600160a01b031614610ed15760405162461bcd60e51b815260206004820152601b60248201527f7265737572726563744170653a20496e76616c6964206f776e657200000000006044820152606401610356565b6002546040516323b872dd60e01b81523060048201526001600160a01b03838116602483015260448201859052909116906323b872dd90606401610402565b6000546001600160a01b031633146105715760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610356565b6003546040516331a9108f60e11b81526004810183905233916001600160a01b031690636352211e90602401602060405180830381865afa158015610fb3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fd791906116fd565b6001600160a01b03161461102d5760405162461bcd60e51b815260206004820152601760248201527f4f6e6c7920746865206f776e65722063616e206275726e0000000000000000006044820152606401610356565b60008181526007602052604090205460ff161561108c5760405162461bcd60e51b815260206004820152601c60248201527f43616e2774206275726e207265737572726563746564207465656e73000000006044820152606401610356565b60035460405163299f537360e01b8152600481018390526001600160a01b039091169063299f537390602401600060405180830381600087803b1580156110d257600080fd5b505af11580156110e6573d6000803e3d6000fd5b5050505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c81018390526000908190605c01604051602081830303815290604052805190602001209050600080600085516041146111a8576000945050505050611268565b50505060208301516040840151606085015160001a601b8110156111d4576111d1601b8261171a565b90505b60008160ff16601b14806111eb57508160ff16601c145b156112505760408051600081526020810180835287905260ff841691810191909152606081018590526080810184905260019060a0016020604051602081039080840390855afa158015611243573d6000803e3d6000fd5b5050506020604051035190505b6004546001600160a01b039081169116149450505050505b92915050565b6001600160a01b0381168114610d6557600080fd5b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156112c2576112c2611283565b604052919050565b600082601f8301126112db57600080fd5b813567ffffffffffffffff8111156112f5576112f5611283565b611308601f8201601f1916602001611299565b81815284602083860101111561131d57600080fd5b816020850160208301376000918101602001919091529392505050565b6000806000806080858703121561135057600080fd5b843561135b8161126e565b9350602085013561136b8161126e565b925060408501359150606085013567ffffffffffffffff81111561138e57600080fd5b61139a878288016112ca565b91505092959194509250565b600080604083850312156113b957600080fd5b82356113c48161126e565b915060208301356113d48161126e565b809150509250929050565b6000602082840312156113f157600080fd5b5035919050565b600082601f83011261140957600080fd5b8135602067ffffffffffffffff82111561142557611425611283565b8160051b611434828201611299565b928352848101820192828101908785111561144e57600080fd5b83870192505b8483101561146d57823582529183019190830190611454565b979650505050505050565b60006020828403121561148a57600080fd5b813567ffffffffffffffff8111156114a157600080fd5b6114ad848285016113f8565b949350505050565b6000602082840312156114c757600080fd5b81356114d28161126e565b9392505050565b803580151581146114e957600080fd5b919050565b6000806040838503121561150157600080fd5b823561150c8161126e565b915061151a602084016114d9565b90509250929050565b6000806040838503121561153657600080fd5b823567ffffffffffffffff81111561154d57600080fd5b611559858286016113f8565b92505061151a602084016114d9565b60008060008060008060c0878903121561158157600080fd5b863595506020870135945060408701359350606087013592506080870135915060a087013567ffffffffffffffff8111156115bb57600080fd5b6115c789828a016112ca565b9150509295509295509295565b6000806000606084860312156115e957600080fd5b83356115f48161126e565b925060208401356116048161126e565b915060408401356116148161126e565b809150509250925092565b6000806040838503121561163257600080fd5b8235915060208301356113d48161126e565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006000198214156116845761168461165a565b5060010190565b600081518084526020808501945080840160005b838110156116bb5781518752958201959082019060010161169f565b509495945050505050565b6001600160a01b03851681526080602082018190526000906116ea9083018661168b565b6040830194909452506060015292915050565b60006020828403121561170f57600080fd5b81516114d28161126e565b600060ff821660ff84168060ff038211156117375761173761165a565b01939250505056fea2646970667358221220679ee5a118156b41322c19bde71f8230d52d4b85ea9a3b7ee6de33ce94f72a7464736f6c634300080c0033000000000000000000000000d8162d9703d1c13476fee3f20adf2c6468683f0e0000000000000000000000007f29b85834d6a2ba4bb1c64325686c6057b1b3c5000000000000000000000000cf099445347f0f006c19b90f1c1933eb9413682b

Deployed Bytecode

0x608060405234801561001057600080fd5b506004361061012c5760003560e01c8063850f700e116100ad578063cd446e2211610071578063cd446e221461028e578063d1efd30d146102a1578063f2fde38b146102b4578063f81d1fd5146102c7578063fe9fbb80146102da57600080fd5b8063850f700e1461023c5780638b9eae721461024f5780638da5cb5b14610262578063b5d264a614610273578063c5577ff71461028657600080fd5b80636c19e783116100f45780636c19e783146101e8578063711bf9b2146101fb578063715018a61461020e5780637bebe4cb146102165780637f154deb1461022957600080fd5b8063150b7a021461013157806324330982146101625780632465f70314610177578063535c33ef146101a25780635fb8e56c146101d5575b600080fd5b61014461013f36600461133a565b6102fd565b6040516001600160e01b031990911681526020015b60405180910390f35b6101756101703660046113a6565b6103d0565b005b60025461018a906001600160a01b031681565b6040516001600160a01b039091168152602001610159565b6101c56101b03660046113df565b60076020526000908152604090205460ff1681565b6040519015158152602001610159565b6101756101e3366004611478565b610438565b6101756101f63660046114b5565b6104ba565b6101756102093660046114ee565b61052c565b61017561055f565b610175610224366004611523565b610573565b610175610237366004611568565b6105e3565b60035461018a906001600160a01b031681565b61017561025d366004611478565b610a81565b6000546001600160a01b031661018a565b6101756102813660046115d4565b610b76565b610175610bbd565b60015461018a906001600160a01b031681565b60045461018a906001600160a01b031681565b6101756102c23660046114b5565b610cef565b6101756102d536600461161f565b610d68565b6101c56102e83660046114b5565b60086020526000908152604090205460ff1681565b6003546000906001600160a01b0316331461035f5760405162461bcd60e51b815260206004820152601b60248201527f4f6e6c7920726563656976652066726f6d20424150205465656e73000000000060448201526064015b60405180910390fd5b60065460ff166103bd5760405162461bcd60e51b8152602060048201526024808201527f4f6e6c7920616363657074207472616e7366657273207768696c65207265766960448201526376696e6760e01b6064820152608401610356565b505060055550630a85bd0160e11b919050565b6103d8610f10565b60405163f2fde38b60e01b81526001600160a01b03828116600483015283169063f2fde38b906024015b600060405180830381600087803b15801561041c57600080fd5b505af1158015610430573d6000803e3d6000fd5b505050505050565b60005b81518110156104785761046682828151811061045957610459611644565b6020026020010151610f6a565b8061047081611670565b91505061043b565b507f89a770be46dbf61810c6a56e9a6cf40b456b35c6f409843c0186fd892e90305633826001426040516104af94939291906116c6565b60405180910390a150565b6104c2610f10565b6001600160a01b03811661050a5760405162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206164647265737360881b6044820152606401610356565b600480546001600160a01b0319166001600160a01b0392909216919091179055565b610534610f10565b6001600160a01b03919091166000908152600860205260409020805460ff1916911515919091179055565b610567610f10565b61057160006110ed565b565b61057b610f10565b60005b82518110156105de57816007600085848151811061059e5761059e611644565b6020026020010151815260200190815260200160002060006101000a81548160ff02191690831515021790555080806105d690611670565b91505061057e565b505050565b601e86101580156105f45750602286105b61064a5760405162461bcd60e51b815260206004820152602160248201527f7465656e5265737572726563743a2057726f6e67207574696c697479496420696044820152601960fa1b6064820152608401610356565b4283116106a55760405162461bcd60e51b815260206004820152602360248201527f7465656e5265737572726563743a205369676e617475726520697320657870696044820152621c995960ea1b6064820152608401610356565b60408051336020820152908101879052606081018690526080810185905260a0810184905260c081018390526106f49060e001604051602081830303815290604052805190602001208261113d565b61074c5760405162461bcd60e51b815260206004820152602360248201527f7465656e5265737572726563743a205369676e617475726520697320696e76616044820152621b1a5960ea1b6064820152608401610356565b60008581526007602052604090205460ff16156107ca5760405162461bcd60e51b815260206004820152603660248201527f7465656e5265737572726563743a2043616e2774207361637269666963652061604482015275081c995cdd5c9c9958dd1959081519595b88109d5b1b60521b6064820152608401610356565b60008481526007602052604090205460ff161561084f5760405162461bcd60e51b815260206004820152603f60248201527f7465656e5265737572726563743a2043616e277420726573757272656374206160448201527f6e20616c7265616479207265737572726563746564205465656e2042756c6c006064820152608401610356565b816108be576001805460405163b390c0ab60e01b81526004810189905260248101929092526001600160a01b03169063b390c0ab90604401600060405180830381600087803b1580156108a157600080fd5b505af11580156108b5573d6000803e3d6000fd5b505050506108fe565b6040805133815260208101889052428183015290517fbf348d57f40d5e718c36e92188472e18417442d08bda9ea3dc50a291418eea439181900360600190a15b61090785610f6a565b6006805460ff191660019081179091556003546040516322e9330f60e21b815230600482015260248101929092526001600160a01b031690638ba4cc3c90604401600060405180830381600087803b15801561096257600080fd5b505af1158015610976573d6000803e3d6000fd5b50506006805460ff19908116909155600580546000908152600760205260408082208054851660019081179091558a835291819020805490941690911790925560035490549151632142170760e11b815230600482015233602482015260448101929092526001600160a01b031692506342842e0e9150606401600060405180830381600087803b158015610a0a57600080fd5b505af1158015610a1e573d6000803e3d6000fd5b505060055460408051338152602081018a9052808201899052606081019290925260808201869052517f772a3dfb63f8a4904bc5c5c5881e63083f06959f0cd784079eb92583712fcaa793509081900360a0019150a15050600060055550505050565b60005b8151811015610b3f5760025482516001600160a01b03909116906323b872dd9033903090869086908110610aba57610aba611644565b60209081029190910101516040516001600160e01b031960e086901b1681526001600160a01b0393841660048201529290911660248301526044820152606401600060405180830381600087803b158015610b1457600080fd5b505af1158015610b28573d6000803e3d6000fd5b505050508080610b3790611670565b915050610a84565b507f89a770be46dbf61810c6a56e9a6cf40b456b35c6f409843c0186fd892e90305633826002426040516104af94939291906116c6565b610b7e610f10565b600180546001600160a01b039485166001600160a01b031991821617909155600280549385169382169390931790925560038054919093169116179055565b6001546040516377a4777360e11b8152610258600482015261012c60248201526001600160a01b039091169063ef48eee690604401600060405180830381600087803b158015610c0c57600080fd5b505af1158015610c20573d6000803e3d6000fd5b50506001805460405163b390c0ab60e01b81526004810183905260248101929092526001600160a01b0316925063b390c0ab9150604401600060405180830381600087803b158015610c7157600080fd5b505af1158015610c85573d6000803e3d6000fd5b50506003546040516322e9330f60e21b8152336004820152600160248201526001600160a01b039091169250638ba4cc3c9150604401600060405180830381600087803b158015610cd557600080fd5b505af1158015610ce9573d6000803e3d6000fd5b50505050565b610cf7610f10565b6001600160a01b038116610d5c5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610356565b610d65816110ed565b50565b3360009081526008602052604090205460ff16610db85760405162461bcd60e51b815260206004820152600e60248201526d139bdd08105d5d1a1bdc9a5e995960921b6044820152606401610356565b6001600160a01b038116610e0e5760405162461bcd60e51b815260206004820152601f60248201527f7265737572726563744170653a20496e76616c696420726563697069656e74006044820152606401610356565b6002546040516331a9108f60e11b81526004810184905230916001600160a01b031690636352211e90602401602060405180830381865afa158015610e57573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e7b91906116fd565b6001600160a01b031614610ed15760405162461bcd60e51b815260206004820152601b60248201527f7265737572726563744170653a20496e76616c6964206f776e657200000000006044820152606401610356565b6002546040516323b872dd60e01b81523060048201526001600160a01b03838116602483015260448201859052909116906323b872dd90606401610402565b6000546001600160a01b031633146105715760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610356565b6003546040516331a9108f60e11b81526004810183905233916001600160a01b031690636352211e90602401602060405180830381865afa158015610fb3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fd791906116fd565b6001600160a01b03161461102d5760405162461bcd60e51b815260206004820152601760248201527f4f6e6c7920746865206f776e65722063616e206275726e0000000000000000006044820152606401610356565b60008181526007602052604090205460ff161561108c5760405162461bcd60e51b815260206004820152601c60248201527f43616e2774206275726e207265737572726563746564207465656e73000000006044820152606401610356565b60035460405163299f537360e01b8152600481018390526001600160a01b039091169063299f537390602401600060405180830381600087803b1580156110d257600080fd5b505af11580156110e6573d6000803e3d6000fd5b5050505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c81018390526000908190605c01604051602081830303815290604052805190602001209050600080600085516041146111a8576000945050505050611268565b50505060208301516040840151606085015160001a601b8110156111d4576111d1601b8261171a565b90505b60008160ff16601b14806111eb57508160ff16601c145b156112505760408051600081526020810180835287905260ff841691810191909152606081018590526080810184905260019060a0016020604051602081039080840390855afa158015611243573d6000803e3d6000fd5b5050506020604051035190505b6004546001600160a01b039081169116149450505050505b92915050565b6001600160a01b0381168114610d6557600080fd5b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156112c2576112c2611283565b604052919050565b600082601f8301126112db57600080fd5b813567ffffffffffffffff8111156112f5576112f5611283565b611308601f8201601f1916602001611299565b81815284602083860101111561131d57600080fd5b816020850160208301376000918101602001919091529392505050565b6000806000806080858703121561135057600080fd5b843561135b8161126e565b9350602085013561136b8161126e565b925060408501359150606085013567ffffffffffffffff81111561138e57600080fd5b61139a878288016112ca565b91505092959194509250565b600080604083850312156113b957600080fd5b82356113c48161126e565b915060208301356113d48161126e565b809150509250929050565b6000602082840312156113f157600080fd5b5035919050565b600082601f83011261140957600080fd5b8135602067ffffffffffffffff82111561142557611425611283565b8160051b611434828201611299565b928352848101820192828101908785111561144e57600080fd5b83870192505b8483101561146d57823582529183019190830190611454565b979650505050505050565b60006020828403121561148a57600080fd5b813567ffffffffffffffff8111156114a157600080fd5b6114ad848285016113f8565b949350505050565b6000602082840312156114c757600080fd5b81356114d28161126e565b9392505050565b803580151581146114e957600080fd5b919050565b6000806040838503121561150157600080fd5b823561150c8161126e565b915061151a602084016114d9565b90509250929050565b6000806040838503121561153657600080fd5b823567ffffffffffffffff81111561154d57600080fd5b611559858286016113f8565b92505061151a602084016114d9565b60008060008060008060c0878903121561158157600080fd5b863595506020870135945060408701359350606087013592506080870135915060a087013567ffffffffffffffff8111156115bb57600080fd5b6115c789828a016112ca565b9150509295509295509295565b6000806000606084860312156115e957600080fd5b83356115f48161126e565b925060208401356116048161126e565b915060408401356116148161126e565b809150509250925092565b6000806040838503121561163257600080fd5b8235915060208301356113d48161126e565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006000198214156116845761168461165a565b5060010190565b600081518084526020808501945080840160005b838110156116bb5781518752958201959082019060010161169f565b509495945050505050565b6001600160a01b03851681526080602082018190526000906116ea9083018661168b565b6040830194909452506060015292915050565b60006020828403121561170f57600080fd5b81516114d28161126e565b600060ff821660ff84168060ff038211156117375761173761165a565b01939250505056fea2646970667358221220679ee5a118156b41322c19bde71f8230d52d4b85ea9a3b7ee6de33ce94f72a7464736f6c634300080c0033

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

000000000000000000000000d8162d9703d1c13476fee3f20adf2c6468683f0e0000000000000000000000007f29b85834d6a2ba4bb1c64325686c6057b1b3c5000000000000000000000000cf099445347f0f006c19b90f1c1933eb9413682b

-----Decoded View---------------
Arg [0] : masterContractAddress (address): 0xD8162D9703d1c13476FEE3f20ADF2c6468683F0e
Arg [1] : apesAddress (address): 0x7f29b85834d6A2ba4BB1c64325686C6057B1B3C5
Arg [2] : teensAddress (address): 0xcf099445347F0F006c19B90F1c1933eb9413682B

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


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.