ETH Price: $2,378.54 (+0.43%)
Gas: 5.13 Gwei

Contract

0xaBA661FA1D46B03298E13862ec5e03111586BcFE
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Swap208499272024-09-28 15:07:355 days ago1727536055IN
0xaBA661FA...11586BcFE
0 ETH0.000816226.72556366
Swap206560432024-09-01 13:33:2332 days ago1725197603IN
0xaBA661FA...11586BcFE
0 ETH0.000141171.16314392
Swap203217872024-07-16 21:33:2379 days ago1721165603IN
0xaBA661FA...11586BcFE
0 ETH0.001017848.38608824
Swap203059102024-07-14 16:22:3581 days ago1720974155IN
0xaBA661FA...11586BcFE
0 ETH0.000738486.0844443
Swap201048082024-06-16 13:59:23109 days ago1718546363IN
0xaBA661FA...11586BcFE
0 ETH0.000550984.53960109
Swap200546992024-06-09 13:54:59116 days ago1717941299IN
0xaBA661FA...11586BcFE
0 ETH0.000834416.87475828
Swap200013392024-06-02 3:05:35124 days ago1717297535IN
0xaBA661FA...11586BcFE
0 ETH0.000625615.15450375
Swap199899702024-05-31 12:59:59125 days ago1717160399IN
0xaBA661FA...11586BcFE
0 ETH0.0021284314.60130389
Swap199660082024-05-28 4:34:11129 days ago1716870851IN
0xaBA661FA...11586BcFE
0 ETH0.0064111810.7007313
Swap199642112024-05-27 22:32:23129 days ago1716849143IN
0xaBA661FA...11586BcFE
0 ETH0.0015080412.42488161
Swap199518342024-05-26 5:02:23131 days ago1716699743IN
0xaBA661FA...11586BcFE
0 ETH0.000374983.08979621
Swap199413512024-05-24 17:52:11132 days ago1716573131IN
0xaBA661FA...11586BcFE
0 ETH0.000947817.80914581
Swap199395612024-05-24 11:51:47132 days ago1716551507IN
0xaBA661FA...11586BcFE
0 ETH0.000812236.69270906
Swap199257732024-05-22 13:39:35134 days ago1716385175IN
0xaBA661FA...11586BcFE
0 ETH0.0019215615.83499699
Swap199118452024-05-20 14:50:35136 days ago1716216635IN
0xaBA661FA...11586BcFE
0 ETH0.0015066112.41309005
Swap199058812024-05-19 18:50:47137 days ago1716144647IN
0xaBA661FA...11586BcFE
0 ETH0.000557483.17732272
Swap199050752024-05-19 16:08:23137 days ago1716134903IN
0xaBA661FA...11586BcFE
0 ETH0.000436563.59687649
Swap199022722024-05-19 6:43:47138 days ago1716101027IN
0xaBA661FA...11586BcFE
0 ETH0.000376763.10448489
Swap198980312024-05-18 16:30:47138 days ago1716049847IN
0xaBA661FA...11586BcFE
0 ETH0.000408123.3625586
Swap198979832024-05-18 16:21:11138 days ago1716049271IN
0xaBA661FA...11586BcFE
0 ETH0.000503944.1520465
Swap198979372024-05-18 16:11:47138 days ago1716048707IN
0xaBA661FA...11586BcFE
0 ETH0.001262053.69886161
Swap198977982024-05-18 15:43:47138 days ago1716047027IN
0xaBA661FA...11586BcFE
0 ETH0.000414533.35490348
Swap198977892024-05-18 15:41:59138 days ago1716046919IN
0xaBA661FA...11586BcFE
0 ETH0.000556953.76429824
Swap198977812024-05-18 15:40:23138 days ago1716046823IN
0xaBA661FA...11586BcFE
0 ETH0.000650313.93698173
Swap198962692024-05-18 10:35:47138 days ago1716028547IN
0xaBA661FA...11586BcFE
0 ETH0.000514282.96812344
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:
ZenSwap

Compiler Version
v0.8.18+commit.87f61d96

Optimization Enabled:
Yes with 1000 runs

Other Settings:
default evmVersion
File 1 of 8 : ZenSwap.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.17;

// Zen Swap by Zen Academy 🔮
// Use at https://swap.zenacademy.com/ 🔮
// Built by https://www.tokenpage.xyz 🚀

import '@openzeppelin/contracts/access/Ownable.sol';
import '@openzeppelin/contracts/security/Pausable.sol';
import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import '@openzeppelin/contracts/utils/Strings.sol';
import '@openzeppelin/contracts/security/ReentrancyGuard.sol';

error NoTokenSwapped();
error NotAuthorized();
error InvalidRequest();
error DelegatorMustBeApprovedForAll();


interface DenizensOfZenAcademy {
    function safeTransferFrom(address from, address to, uint256 tokenId) external;
    function isApprovedForAll(address owner, address operator) external view returns (bool);
}

contract ZenSwap is Ownable, Pausable, ReentrancyGuard {
    DenizensOfZenAcademy public denizensContract;
    address public delegator;

    constructor(address initialDenizensContractAddress, address initialDelegator)
    Ownable() {
        denizensContract = DenizensOfZenAcademy(initialDenizensContractAddress);
        delegator = initialDelegator;
    }

    // Util

    modifier onlyDelegator() {
        if (delegator != _msgSender()) {
            revert NotAuthorized();
        }
        _;
    }

    modifier onlyOwnerOrDelegator() {
        if (owner() != _msgSender() && delegator != _msgSender()) {
            revert NotAuthorized();
        }
        _;
    }

    // Admin

    function setDelegator(address newDelegator) external onlyOwner {
        if (!denizensContract.isApprovedForAll(newDelegator, address(this))) {
            revert DelegatorMustBeApprovedForAll();
        }
        delegator = newDelegator;
    }

    function pause() external onlyOwnerOrDelegator {
        _pause();
    }

    function unpause() external onlyOwnerOrDelegator {
        _unpause();
    }

    // Users

    function swap(uint256[] calldata tokenIds, uint256[] calldata outgoingTokenIds) external nonReentrant whenNotPaused {
        if (tokenIds.length == 0) {
            revert NoTokenSwapped();
        }
        if (tokenIds.length != outgoingTokenIds.length) {
            revert InvalidRequest();
        }

        for (uint256 i = 0; i < tokenIds.length; i++) {
            uint256 incomingTokenId = tokenIds[i];
            uint256 outgoingTokenId = outgoingTokenIds[i];
            denizensContract.safeTransferFrom(_msgSender(), delegator, incomingTokenId);
            denizensContract.safeTransferFrom(delegator, _msgSender(), outgoingTokenId);
        }
    }
}

File 2 of 8 : 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);
    }
}

File 3 of 8 : Pausable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract Pausable is Context {
    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    bool private _paused;

    /**
     * @dev Initializes the contract in unpaused state.
     */
    constructor() {
        _paused = false;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        _requireNotPaused();
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        _requirePaused();
        _;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }

    /**
     * @dev Throws if the contract is paused.
     */
    function _requireNotPaused() internal view virtual {
        require(!paused(), "Pausable: paused");
    }

    /**
     * @dev Throws if the contract is not paused.
     */
    function _requirePaused() internal view virtual {
        require(paused(), "Pausable: not paused");
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }
}

File 4 of 8 : 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 5 of 8 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

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

    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

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

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

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

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

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

File 6 of 8 : 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 7 of 8 : 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 8 of 8 : 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);
    }
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"initialDenizensContractAddress","type":"address"},{"internalType":"address","name":"initialDelegator","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"DelegatorMustBeApprovedForAll","type":"error"},{"inputs":[],"name":"InvalidRequest","type":"error"},{"inputs":[],"name":"NoTokenSwapped","type":"error"},{"inputs":[],"name":"NotAuthorized","type":"error"},{"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":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"delegator","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"denizensContract","outputs":[{"internalType":"contract DenizensOfZenAcademy","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newDelegator","type":"address"}],"name":"setDelegator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"},{"internalType":"uint256[]","name":"outgoingTokenIds","type":"uint256[]"}],"name":"swap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b50604051610ae3380380610ae383398101604081905261002f916100e6565b6100383361007a565b6000805460ff60a01b1916905560018055600280546001600160a01b039384166001600160a01b03199182161790915560038054929093169116179055610119565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b03811681146100e157600080fd5b919050565b600080604083850312156100f957600080fd5b610102836100ca565b9150610110602084016100ca565b90509250929050565b6109bb806101286000396000f3fe608060405234801561001057600080fd5b50600436106100be5760003560e01c80638456cb59116100765780639ce4bf771161005b5780639ce4bf771461014a578063ce9b79301461015d578063f2fde38b1461017057600080fd5b80638456cb591461011d5780638da5cb5b1461012557600080fd5b80635c975abb116100a75780635c975abb146100e0578063715018a61461010257806383cd9cc31461010a57600080fd5b80630a3cb72e146100c35780633f4ba83a146100d8575b600080fd5b6100d66100d136600461088a565b610183565b005b6100d66103a8565b600054600160a01b900460ff1660405190151581526020015b60405180910390f35b6100d66103f6565b6100d66101183660046108f6565b610408565b6100d6610502565b6000546001600160a01b03165b6040516001600160a01b0390911681526020016100f9565b600254610132906001600160a01b031681565b600354610132906001600160a01b031681565b6100d661017e3660046108f6565b61054e565b61018b6105e3565b61019361063c565b60008390036101ce576040517faa3dde0e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b828114610207576040517f41abc80100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60005b8381101561039857600085858381811061022657610226610926565b905060200201359050600084848481811061024357610243610926565b600254602090910292909201359250506001600160a01b03166342842e0e6102683390565b60035460405160e084901b7fffffffff000000000000000000000000000000000000000000000000000000001681526001600160a01b0392831660048201529116602482015260448101859052606401600060405180830381600087803b1580156102d257600080fd5b505af11580156102e6573d6000803e3d6000fd5b50506002546003546001600160a01b0391821693506342842e0e925016336040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b1681526001600160a01b0392831660048201529116602482015260448101849052606401600060405180830381600087803b15801561036b57600080fd5b505af115801561037f573d6000803e3d6000fd5b50505050505080806103909061093c565b91505061020a565b506103a260018055565b50505050565b6000546001600160a01b031633148015906103ce57506003546001600160a01b03163314155b156103ec5760405163ea8e4eb560e01b815260040160405180910390fd5b6103f4610696565b565b6103fe6106eb565b6103f46000610745565b6104106106eb565b6002546040517fe985e9c50000000000000000000000000000000000000000000000000000000081526001600160a01b0383811660048301523060248301529091169063e985e9c590604401602060405180830381865afa158015610479573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061049d9190610963565b6104d3576040517f24a3cfa300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6003805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6000546001600160a01b0316331480159061052857506003546001600160a01b03163314155b156105465760405163ea8e4eb560e01b815260040160405180910390fd5b6103f46107a2565b6105566106eb565b6001600160a01b0381166105d75760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b6105e081610745565b50565b6002600154036106355760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016105ce565b6002600155565b600054600160a01b900460ff16156103f45760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a207061757365640000000000000000000000000000000060448201526064016105ce565b61069e6107e5565b6000805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b6000546001600160a01b031633146103f45760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016105ce565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6107aa61063c565b6000805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586106ce3390565b600054600160a01b900460ff166103f45760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f742070617573656400000000000000000000000060448201526064016105ce565b60008083601f84011261085057600080fd5b50813567ffffffffffffffff81111561086857600080fd5b6020830191508360208260051b850101111561088357600080fd5b9250929050565b600080600080604085870312156108a057600080fd5b843567ffffffffffffffff808211156108b857600080fd5b6108c48883890161083e565b909650945060208701359150808211156108dd57600080fd5b506108ea8782880161083e565b95989497509550505050565b60006020828403121561090857600080fd5b81356001600160a01b038116811461091f57600080fd5b9392505050565b634e487b7160e01b600052603260045260246000fd5b60006001820161095c57634e487b7160e01b600052601160045260246000fd5b5060010190565b60006020828403121561097557600080fd5b8151801515811461091f57600080fdfea26469706673582212204840e9230570dd5fba271230e008e13d5ca2f78300e595b26b1c09d2d3ddadc664736f6c634300081200330000000000000000000000001cfb252575abbb30262b4f8ab7519c111d4199640000000000000000000000000000000000000000000000000000000000000000

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106100be5760003560e01c80638456cb59116100765780639ce4bf771161005b5780639ce4bf771461014a578063ce9b79301461015d578063f2fde38b1461017057600080fd5b80638456cb591461011d5780638da5cb5b1461012557600080fd5b80635c975abb116100a75780635c975abb146100e0578063715018a61461010257806383cd9cc31461010a57600080fd5b80630a3cb72e146100c35780633f4ba83a146100d8575b600080fd5b6100d66100d136600461088a565b610183565b005b6100d66103a8565b600054600160a01b900460ff1660405190151581526020015b60405180910390f35b6100d66103f6565b6100d66101183660046108f6565b610408565b6100d6610502565b6000546001600160a01b03165b6040516001600160a01b0390911681526020016100f9565b600254610132906001600160a01b031681565b600354610132906001600160a01b031681565b6100d661017e3660046108f6565b61054e565b61018b6105e3565b61019361063c565b60008390036101ce576040517faa3dde0e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b828114610207576040517f41abc80100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60005b8381101561039857600085858381811061022657610226610926565b905060200201359050600084848481811061024357610243610926565b600254602090910292909201359250506001600160a01b03166342842e0e6102683390565b60035460405160e084901b7fffffffff000000000000000000000000000000000000000000000000000000001681526001600160a01b0392831660048201529116602482015260448101859052606401600060405180830381600087803b1580156102d257600080fd5b505af11580156102e6573d6000803e3d6000fd5b50506002546003546001600160a01b0391821693506342842e0e925016336040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b1681526001600160a01b0392831660048201529116602482015260448101849052606401600060405180830381600087803b15801561036b57600080fd5b505af115801561037f573d6000803e3d6000fd5b50505050505080806103909061093c565b91505061020a565b506103a260018055565b50505050565b6000546001600160a01b031633148015906103ce57506003546001600160a01b03163314155b156103ec5760405163ea8e4eb560e01b815260040160405180910390fd5b6103f4610696565b565b6103fe6106eb565b6103f46000610745565b6104106106eb565b6002546040517fe985e9c50000000000000000000000000000000000000000000000000000000081526001600160a01b0383811660048301523060248301529091169063e985e9c590604401602060405180830381865afa158015610479573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061049d9190610963565b6104d3576040517f24a3cfa300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6003805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6000546001600160a01b0316331480159061052857506003546001600160a01b03163314155b156105465760405163ea8e4eb560e01b815260040160405180910390fd5b6103f46107a2565b6105566106eb565b6001600160a01b0381166105d75760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b6105e081610745565b50565b6002600154036106355760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016105ce565b6002600155565b600054600160a01b900460ff16156103f45760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a207061757365640000000000000000000000000000000060448201526064016105ce565b61069e6107e5565b6000805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b6000546001600160a01b031633146103f45760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016105ce565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6107aa61063c565b6000805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586106ce3390565b600054600160a01b900460ff166103f45760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f742070617573656400000000000000000000000060448201526064016105ce565b60008083601f84011261085057600080fd5b50813567ffffffffffffffff81111561086857600080fd5b6020830191508360208260051b850101111561088357600080fd5b9250929050565b600080600080604085870312156108a057600080fd5b843567ffffffffffffffff808211156108b857600080fd5b6108c48883890161083e565b909650945060208701359150808211156108dd57600080fd5b506108ea8782880161083e565b95989497509550505050565b60006020828403121561090857600080fd5b81356001600160a01b038116811461091f57600080fd5b9392505050565b634e487b7160e01b600052603260045260246000fd5b60006001820161095c57634e487b7160e01b600052601160045260246000fd5b5060010190565b60006020828403121561097557600080fd5b8151801515811461091f57600080fdfea26469706673582212204840e9230570dd5fba271230e008e13d5ca2f78300e595b26b1c09d2d3ddadc664736f6c63430008120033

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

0000000000000000000000001cfb252575abbb30262b4f8ab7519c111d4199640000000000000000000000000000000000000000000000000000000000000000

-----Decoded View---------------
Arg [0] : initialDenizensContractAddress (address): 0x1Cfb252575aBbb30262B4f8Ab7519C111d419964
Arg [1] : initialDelegator (address): 0x0000000000000000000000000000000000000000

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 0000000000000000000000001cfb252575abbb30262b4f8ab7519c111d419964
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000000


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.