MATIC Price: $0.506104 (+0.58%)
Gas: 30.1 GWei
 

Overview

MATIC Balance

Polygon PoS Chain LogoPolygon PoS Chain LogoPolygon PoS Chain Logo0 MATIC

MATIC Value

$0.00

Sponsored

Transaction Hash
Method
Block
From
To
Value
0x60806040559517962024-04-18 3:18:1485 days ago1713410294IN
 Create: DeployerFacet
0 MATIC0.29014684145.45611739

Parent Transaction Hash Block From To Value
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
DeployerFacet

Compiler Version
v0.8.25+commit.b61c2a91

Optimization Enabled:
Yes with 200 runs

Other Settings:
paris EvmVersion
File 1 of 19 : DeployerFacet.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.25; 

import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { AccessControlEnumerable } from "../../common/DiamondStorage/AccessControlEnumerable.sol";
import { RAIR721_Diamond } from "../../tokens/RAIR-721/RAIR-ERC721.sol";
import { FactoryStorage } from "../AppStorage.sol";

/// @title 	ERC721 factory
/// @notice	Facet receives ERC777 tokens and deploys an ERC721 smart contract
contract DeployerFacet is AccessControlEnumerable {
	/// @notice This event stores in the blockchain when a new contract is deployed
    /// @param	deployerAddress 	Contains the address of the deployer of the contract 
    /// @param 	deploymentIndex 	Contains the corresponding ID for the deployment
    /// @param 	deploymentAddress 	Contains the address where the contract was deployed
	/// @param 	deploymentName 		Contains the name of the deployed contract
	event DeployedContract(
		address deployerAddress,
		uint deploymentIndex,
		address deploymentAddress,
		string deploymentName
	);

	function deployContract(
		string calldata contractName,
		string calldata contractSymbol
	) external {
		FactoryStorage.Layout storage store = FactoryStorage.layout();
		require(
			IERC20(store.currentERC20).allowance(msg.sender, address(this)) >= store.deploymentCostForToken[store.currentERC20],
			'Deployer: Not allowed to transfer tokens'
		);
		require(
			IERC20(store.currentERC20).transferFrom(msg.sender, address(this), store.deploymentCostForToken[store.currentERC20]),
			'Deployer: Error transferring tokens'
		);

		address[] storage deploymentsFromOwner = store.creatorToContracts[msg.sender];
		store.totalUserPoints[msg.sender] += store.deploymentCostForToken[store.currentERC20];
		
		if (deploymentsFromOwner.length == 0) {
			store.creators.push(msg.sender);
		}

		RAIR721_Diamond newToken = new RAIR721_Diamond(contractName, contractSymbol, msg.sender, 30000);
		deploymentsFromOwner.push(address(newToken));
		store.contractToCreator[address(newToken)] = msg.sender;
		emit DeployedContract(msg.sender, deploymentsFromOwner.length - 1, address(newToken), contractName);
	}
}

File 2 of 19 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.20;

/**
 * @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 value of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

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

    /**
     * @dev Moves a `value` amount of 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 value) 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 a `value` amount of tokens 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 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the
     * allowance mechanism. `value` 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 value) external returns (bool);
}

File 3 of 19 : IERC721Enumerable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/extensions/IERC721Enumerable.sol)

pragma solidity ^0.8.20;

import {IERC721} from "../IERC721.sol";

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

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

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

File 4 of 19 : IERC721Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/extensions/IERC721Metadata.sol)

pragma solidity ^0.8.20;

import {IERC721} from "../IERC721.sol";

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

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

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

File 5 of 19 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/IERC721.sol)

pragma solidity ^0.8.20;

import {IERC165} from "../../utils/introspection/IERC165.sol";

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

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

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

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

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

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

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

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721
     * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must
     * understand this adds an external call which potentially creates a reentrancy vulnerability.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address from, address to, uint256 tokenId) external;

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

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

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

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

File 6 of 19 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)

pragma solidity ^0.8.20;

/**
 * @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;
    }

    function _contextSuffixLength() internal view virtual returns (uint256) {
        return 0;
    }
}

File 7 of 19 : ERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)

pragma solidity ^0.8.20;

import {IERC165} from "./IERC165.sol";

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

File 8 of 19 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)

pragma solidity ^0.8.20;

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

File 9 of 19 : Math.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/Math.sol)

pragma solidity ^0.8.20;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    /**
     * @dev Muldiv operation overflow.
     */
    error MathOverflowedMulDiv();

    enum Rounding {
        Floor, // Toward negative infinity
        Ceil, // Toward positive infinity
        Trunc, // Toward zero
        Expand // Away from zero
    }

    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            uint256 c = a + b;
            if (c < a) return (false, 0);
            return (true, c);
        }
    }

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

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

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

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

    /**
     * @dev Returns the 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 towards infinity instead
     * of rounding towards zero.
     */
    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        if (b == 0) {
            // Guarantee the same behavior as in a regular Solidity division.
            return a / b;
        }

        // (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 = x * y; // Least significant 256 bits of the product
            uint256 prod1; // Most significant 256 bits of the product
            assembly {
                let mm := mulmod(x, y, not(0))
                prod1 := sub(sub(mm, prod0), lt(mm, prod0))
            }

            // Handle non-overflow cases, 256 by 256 division.
            if (prod1 == 0) {
                // Solidity will revert if denominator == 0, unlike the div opcode on its own.
                // The surrounding unchecked block does not change this fact.
                // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
                return prod0 / denominator;
            }

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            if (denominator <= prod1) {
                revert MathOverflowedMulDiv();
            }

            ///////////////////////////////////////////////
            // 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.

            uint256 twos = denominator & (0 - denominator);
            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 (unsignedRoundsUp(rounding) && 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
     * towards zero.
     *
     * 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 + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 2 of a positive value rounded towards zero.
     * 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 + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 10 of a positive value rounded towards zero.
     * 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 + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 256 of a positive value rounded towards zero.
     * 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 256, 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 + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0);
        }
    }

    /**
     * @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers.
     */
    function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) {
        return uint8(rounding) % 2 == 1;
    }
}

File 10 of 19 : SignedMath.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SignedMath.sol)

pragma solidity ^0.8.20;

/**
 * @dev Standard signed math utilities missing in the Solidity language.
 */
library SignedMath {
    /**
     * @dev Returns the largest of two signed numbers.
     */
    function max(int256 a, int256 b) internal pure returns (int256) {
        return a > b ? a : b;
    }

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

    /**
     * @dev Returns the average of two signed numbers without overflow.
     * The result is rounded towards zero.
     */
    function average(int256 a, int256 b) internal pure returns (int256) {
        // Formula from the book "Hacker's Delight"
        int256 x = (a & b) + ((a ^ b) >> 1);
        return x + (int256(uint256(x) >> 255) & (a ^ b));
    }

    /**
     * @dev Returns the absolute unsigned value of a signed value.
     */
    function abs(int256 n) internal pure returns (uint256) {
        unchecked {
            // must be unchecked in order to support `n = type(int256).min`
            return uint256(n >= 0 ? n : -n);
        }
    }
}

File 11 of 19 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Strings.sol)

pragma solidity ^0.8.20;

import {Math} from "./math/Math.sol";
import {SignedMath} from "./math/SignedMath.sol";

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

    /**
     * @dev The `value` string doesn't fit in the specified `length`.
     */
    error StringsInsufficientHexLength(uint256 value, uint256 length);

    /**
     * @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), HEX_DIGITS))
                }
                value /= 10;
                if (value == 0) break;
            }
            return buffer;
        }
    }

    /**
     * @dev Converts a `int256` to its ASCII `string` decimal representation.
     */
    function toStringSigned(int256 value) internal pure returns (string memory) {
        return string.concat(value < 0 ? "-" : "", toString(SignedMath.abs(value)));
    }

    /**
     * @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) {
        uint256 localValue = value;
        bytes memory buffer = new bytes(2 * length + 2);
        buffer[0] = "0";
        buffer[1] = "x";
        for (uint256 i = 2 * length + 1; i > 1; --i) {
            buffer[i] = HEX_DIGITS[localValue & 0xf];
            localValue >>= 4;
        }
        if (localValue != 0) {
            revert StringsInsufficientHexLength(value, length);
        }
        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);
    }

    /**
     * @dev Returns true if the two strings are equal.
     */
    function equal(string memory a, string memory b) internal pure returns (bool) {
        return bytes(a).length == bytes(b).length && keccak256(bytes(a)) == keccak256(bytes(b));
    }
}

File 12 of 19 : EnumerableSet.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/structs/EnumerableSet.sol)
// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.

pragma solidity ^0.8.20;

/**
 * @dev Library for managing
 * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
 * types.
 *
 * Sets have the following properties:
 *
 * - Elements are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Elements are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```solidity
 * contract Example {
 *     // Add the library methods
 *     using EnumerableSet for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressSet private mySet;
 * }
 * ```
 *
 * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
 * and `uint256` (`UintSet`) are supported.
 *
 * [WARNING]
 * ====
 * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure
 * unusable.
 * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
 *
 * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an
 * array of EnumerableSet.
 * ====
 */
library EnumerableSet {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

    struct Set {
        // Storage of set values
        bytes32[] _values;
        // Position is the index of the value in the `values` array plus 1.
        // Position 0 is used to mean a value is not in the set.
        mapping(bytes32 value => uint256) _positions;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function _add(Set storage set, bytes32 value) private returns (bool) {
        if (!_contains(set, value)) {
            set._values.push(value);
            // The value is stored at length-1, but we add 1 to all indexes
            // and use 0 as a sentinel value
            set._positions[value] = set._values.length;
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function _remove(Set storage set, bytes32 value) private returns (bool) {
        // We cache the value's position to prevent multiple reads from the same storage slot
        uint256 position = set._positions[value];

        if (position != 0) {
            // Equivalent to contains(set, value)
            // To delete an element from the _values array in O(1), we swap the element to delete with the last one in
            // the array, and then remove the last element (sometimes called as 'swap and pop').
            // This modifies the order of the array, as noted in {at}.

            uint256 valueIndex = position - 1;
            uint256 lastIndex = set._values.length - 1;

            if (valueIndex != lastIndex) {
                bytes32 lastValue = set._values[lastIndex];

                // Move the lastValue to the index where the value to delete is
                set._values[valueIndex] = lastValue;
                // Update the tracked position of the lastValue (that was just moved)
                set._positions[lastValue] = position;
            }

            // Delete the slot where the moved value was stored
            set._values.pop();

            // Delete the tracked position for the deleted slot
            delete set._positions[value];

            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function _contains(Set storage set, bytes32 value) private view returns (bool) {
        return set._positions[value] != 0;
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function _length(Set storage set) private view returns (uint256) {
        return set._values.length;
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function _at(Set storage set, uint256 index) private view returns (bytes32) {
        return set._values[index];
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function _values(Set storage set) private view returns (bytes32[] memory) {
        return set._values;
    }

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _add(set._inner, value);
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _remove(set._inner, value);
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
        return _contains(set._inner, value);
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(Bytes32Set storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
        return _at(set._inner, index);
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
        bytes32[] memory store = _values(set._inner);
        bytes32[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(AddressSet storage set, address value) internal returns (bool) {
        return _add(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(AddressSet storage set, address value) internal returns (bool) {
        return _remove(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(AddressSet storage set, address value) internal view returns (bool) {
        return _contains(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(AddressSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(AddressSet storage set, uint256 index) internal view returns (address) {
        return address(uint160(uint256(_at(set._inner, index))));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(AddressSet storage set) internal view returns (address[] memory) {
        bytes32[] memory store = _values(set._inner);
        address[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }

    // UintSet

    struct UintSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(UintSet storage set, uint256 value) internal returns (bool) {
        return _add(set._inner, bytes32(value));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(UintSet storage set, uint256 value) internal returns (bool) {
        return _remove(set._inner, bytes32(value));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(UintSet storage set, uint256 value) internal view returns (bool) {
        return _contains(set._inner, bytes32(value));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(UintSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(UintSet storage set, uint256 index) internal view returns (uint256) {
        return uint256(_at(set._inner, index));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(UintSet storage set) internal view returns (uint256[] memory) {
        bytes32[] memory store = _values(set._inner);
        uint256[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }
}

File 13 of 19 : AccessControlEnumerable.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.25;

import { Context } from "@openzeppelin/contracts/utils/Context.sol";
import { Strings } from "@openzeppelin/contracts/utils/Strings.sol";
import { EnumerableSet } from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import { AccessControlEnumerableStorage } from "./AccessControlEnumerableStorage.sol";

abstract contract AccessControlEnumerable is Context {
    using EnumerableSet for EnumerableSet.AddressSet;
    
    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);
	event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);
    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);

    modifier onlyRole(bytes32 role) {
        _checkRole(role, _msgSender());
        _;
    }

    function renounceRole(bytes32 role, address account) public {
        require(account == _msgSender(), "AccessControl: can only renounce roles for self");
        _revokeRole(role, account);
    }

    function grantRole(bytes32 role, address account) public onlyRole(getRoleAdmin(role)) {
        _grantRole(role, account);
    }

    function revokeRole(bytes32 role, address account) public onlyRole(getRoleAdmin(role)) {
        _revokeRole(role, account);
    }

    function _checkRole(bytes32 role, address account) internal view {
        if (!hasRole(role, account)) {
            revert(
                string(
                    abi.encodePacked(
                        "AccessControl: account ",
                        Strings.toHexString(uint160(account), 20),
                        " is missing role ",
                        Strings.toHexString(uint256(role), 32)
                    )
                )
            );
        }
    }

	function hasRole(bytes32 role, address account) public view returns (bool) {
		return AccessControlEnumerableStorage.layout()._roles[role].members[account];
	}

	function getRoleAdmin(bytes32 role) public view returns (bytes32) {
		return AccessControlEnumerableStorage.layout()._roles[role].adminRole;
	}

	function getRoleMember(bytes32 role, uint256 index) public view returns (address) {
		return AccessControlEnumerableStorage.layout()._roleMembers[role].at(index);
	}
	
	function getRoleMemberCount(bytes32 role) public view returns (uint256) {
		return AccessControlEnumerableStorage.layout()._roleMembers[role].length();
	}

	function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal {
		bytes32 previousAdminRole = getRoleAdmin(role);
		AccessControlEnumerableStorage.layout()._roles[role].adminRole = adminRole;
		emit RoleAdminChanged(role, previousAdminRole, adminRole);
	}

	function _grantRole(bytes32 role, address account) internal {
		if (!hasRole(role, account)) {
			AccessControlEnumerableStorage.layout()._roles[role].members[account] = true;
			emit RoleGranted(role, account, _msgSender());
			AccessControlEnumerableStorage.layout()._roleMembers[role].add(account);
		}
	}

	function _revokeRole(bytes32 role, address account) internal {
		if (hasRole(role, account)) {
			AccessControlEnumerableStorage.layout()._roles[role].members[account] = false;
			emit RoleRevoked(role, account, _msgSender());
			AccessControlEnumerableStorage.layout()._roleMembers[role].remove(account);
		}
	}
}

File 14 of 19 : AccessControlEnumerableStorage.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.25;

import { EnumerableSet } from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";

library AccessControlEnumerableStorage {
    bytes32 internal constant STORAGE_SLOT =
        keccak256('rair.contracts.storage.AccessControlEnumerable');

    struct RoleData {
        mapping(address => bool) members;
        bytes32 adminRole;
    }

    struct Layout {
        mapping(bytes32 => RoleData) _roles;
        mapping(bytes32 => EnumerableSet.AddressSet) _roleMembers;
    }

    function layout() internal pure returns (Layout storage l) {
        bytes32 slot = STORAGE_SLOT;
        assembly {
            l.slot := slot
        }
    }
}

File 15 of 19 : IDiamondLoupe.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

/******************************************************************************\
* Author: Nick Mudge <[email protected]> (https://twitter.com/mudgen)
* EIP-2535 Diamonds: https://eips.ethereum.org/EIPS/eip-2535
/******************************************************************************/

// A loupe is a small magnifying glass used to look at diamonds.
// These functions look at diamonds
interface IDiamondLoupe {
    /// These functions are expected to be called frequently
    /// by tools.

    struct Facet {
        address facetAddress;
        bytes4[] functionSelectors;
    }

    /// @notice Gets all facet addresses and their four byte function selectors.
    /// @return facets_ Facet
    function facets() external view returns (Facet[] memory facets_);

    /// @notice Gets all the function selectors supported by a specific facet.
    /// @param _facet The facet address.
    /// @return facetFunctionSelectors_
    function facetFunctionSelectors(address _facet) external view returns (bytes4[] memory facetFunctionSelectors_);

    /// @notice Get all the facet addresses used by a diamond.
    /// @return facetAddresses_
    function facetAddresses() external view returns (address[] memory facetAddresses_);

    /// @notice Gets the facet that supports the given selector.
    /// @dev If facet is not found return address(0).
    /// @param _functionSelector The function selector.
    /// @return facetAddress_ The facet address.
    function facetAddress(bytes4 _functionSelector) external view returns (address facetAddress_);
}

File 16 of 19 : AppStorage.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.25; 

import "@openzeppelin/contracts/utils/Context.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";

library FactoryStorage {
    bytes32 internal constant STORAGE_SLOT =
        keccak256('rair.contracts.storage.DiamondFactory');

    struct Layout {
        address[] creators;
		mapping(address => address[]) creatorToContracts;
		mapping(address => address) contractToCreator;
		mapping(address => uint) deploymentCostForToken;
        address currentERC20;
        mapping(address => uint) currentUserPoints;
        mapping(address => uint) totalUserPoints;
        uint transferTimeLimit;
        address facetSource;
    }

    function layout() internal pure returns (Layout storage l) {
        bytes32 slot = STORAGE_SLOT;
        assembly {
            l.slot := slot
        }
    }
}

File 17 of 19 : AccessControlRoles.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.25; 

abstract contract ERC721AccessControlRoles {
	bytes32 public constant TRADER = keccak256("TRADER");
	bytes32 public constant MINTER = keccak256("MINTER");
	bytes32 public constant CREATOR = keccak256("CREATOR");
}

File 18 of 19 : AppStorage.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.25; 

library ERC721Storage {
    bytes32 internal constant STORAGE_SLOT =
        keccak256('rair.contracts.storage.RAIR721');

    struct product {
        uint startingToken;
        uint endingToken;
        uint mintableTokens;
        string name;
        uint[] rangeList;
    }

    struct range {
        uint rangeStart;
        uint rangeEnd;
        uint tokensAllowed;
        uint mintableTokens;
        uint lockedTokens;
        uint rangePrice;
        string rangeName;
    }

    struct Layout {
        // Base ERC721
        string _name;
        string _symbol;
        mapping(uint256 tokenId => address) _owners;
        mapping(address owner => uint256) _balances;
        mapping(uint256 tokenId => address) _tokenApprovals;
        mapping(address owner => mapping(address operator => bool)) _operatorApprovals;
        // ERC721 enumerable extension
        mapping(address owner => mapping(uint256 index => uint256)) _ownedTokens;
        mapping(uint256 tokenId => uint256) _ownedTokensIndex;
        uint256[] _allTokens;
        mapping(uint256 tokenId => uint256) _allTokensIndex;
        // RAIR exclusive
        string baseURI;
        address factoryAddress;
        uint16 royaltyFee;
        product[] products;
        range[] ranges;
        mapping(uint => uint) tokenToProduct;
        mapping(uint => uint) tokenToRange;
        mapping(uint => string) uniqueTokenURI;
        mapping(uint => string) productURI;
        mapping(uint => bool) appendTokenIndexToProductURI;
        bool appendTokenIndexToBaseURI;
        mapping(uint => uint[]) tokensByProduct;
        string contractMetadataURI;
        mapping(uint => uint) rangeToProduct;
        mapping(uint => bool) _minted;
        // August 2022 - Metadata File Extension Update
        mapping(uint => string) rangeURI;
        mapping(uint => bool) appendTokenIndexToRangeURI;
        string _metadataExtension;
        // March 2024 - Optional trader role
        bool requiresTrader;
    }

    function layout() internal pure returns (Layout storage l) {
        bytes32 slot = STORAGE_SLOT;
        assembly {
            l.slot := slot
        }
    }
}

File 19 of 19 : RAIR-ERC721.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.25; 

// Interfaces
import {IERC721} from "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import {IERC721Metadata} from '@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol';
import {IERC721Enumerable} from '@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol';
import {ERC165} from '@openzeppelin/contracts/utils/introspection/ERC165.sol';

import {IDiamondLoupe} from "../../diamondStandard/interfaces/IDiamondLoupe.sol";
import {ERC721Storage} from "./AppStorage.sol";
import {ERC721AccessControlRoles} from "./AccessControlRoles.sol";
import {AccessControlEnumerable} from "../../common/DiamondStorage/AccessControlEnumerable.sol";

interface Factory {
	function getFacetSource() view external returns(address);
}

/// @title  RAIR ERC721 Diamond
/// @dev 	Fallback will get the facets from the factory
/// @author Juan M. Sanchez M.
contract RAIR721_Diamond is ERC721AccessControlRoles, ERC165, AccessControlEnumerable {
	
	constructor(
        string memory name_,
        string memory symbol,
        address creatorAddress_,
        uint16 creatorRoyalty_
    ) {
        ERC721Storage.Layout storage store = ERC721Storage.layout();

		store._name = name_;
		store._symbol = symbol;

        store.requiresTrader = true;
		store.factoryAddress = msg.sender;

		store.royaltyFee = creatorRoyalty_;
		_setRoleAdmin(MINTER, CREATOR);
		_setRoleAdmin(TRADER, CREATOR);
		_grantRole(CREATOR, creatorAddress_);
		_grantRole(MINTER, creatorAddress_);
		_grantRole(TRADER, creatorAddress_);
	}

	/// @notice Returns the address from where the contract was created
    /// @return factoryAddress Address of the factory
	function getFactoryAddress() public view returns (address factoryAddress) {
        factoryAddress = ERC721Storage.layout().factoryAddress;
	}

	/// @notice This function allows us to know the URI of the contract 
    /// @return contractMetadataURI Contains the string with all the URI, this string is saved in memory 
	function contractURI() public view returns (string memory contractMetadataURI) {
        contractMetadataURI = ERC721Storage.layout().contractMetadataURI;
	}

	/// @notice This function allows us to know if and interface is suported
	/// @param 	interfaceId Contains the facet addresses and function selectors
	/// @return bool contains the value for the interface, it could be true or false
	function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return
            interfaceId == type(IERC721).interfaceId ||
            interfaceId == type(IERC721Metadata).interfaceId ||
        	interfaceId == type(IERC721Enumerable).interfaceId ||
            super.supportsInterface(interfaceId);
    }

	fallback() external {
        Factory factory = Factory(ERC721Storage.layout().factoryAddress);
		address facet = IDiamondLoupe(factory.getFacetSource()).facetAddress(msg.sig);
		assembly {
			// copy function selector and any arguments
			calldatacopy(0, 0, calldatasize())
			// execute function call using the facet
			let result := delegatecall(gas(), facet, 0, calldatasize(), 0, 0)
			// get any return value
			returndatacopy(0, 0, returndatasize())
			// return any return value or error back to the caller
			switch result
				case 0 {
					revert(0, returndatasize())
				}
				default {
					return(0, returndatasize())
				}
		}
	}
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"length","type":"uint256"}],"name":"StringsInsufficientHexLength","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"deployerAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"deploymentIndex","type":"uint256"},{"indexed":false,"internalType":"address","name":"deploymentAddress","type":"address"},{"indexed":false,"internalType":"string","name":"deploymentName","type":"string"}],"name":"DeployedContract","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"inputs":[{"internalType":"string","name":"contractName","type":"string"},{"internalType":"string","name":"contractSymbol","type":"string"}],"name":"deployContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getRoleMember","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMemberCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"}]

6080604052348015600f57600080fd5b506123218061001f6000396000f3fe608060405234801561001057600080fd5b50600436106100885760003560e01c806391d148541161005b57806391d1485414610106578063ca15c87314610129578063d547741f1461013c578063e0bdf5831461014f57600080fd5b8063248a9ca31461008d5780632f2ff15d146100b357806336568abe146100c85780639010d07c146100db575b600080fd5b6100a061009b366004610b25565b610162565b6040519081526020015b60405180910390f35b6100c66100c1366004610b3e565b610184565b005b6100c66100d6366004610b3e565b6101a6565b6100ee6100e9366004610b7a565b610229565b6040516001600160a01b0390911681526020016100aa565b610119610114366004610b3e565b610257565b60405190151581526020016100aa565b6100a0610137366004610b25565b61028f565b6100c661014a366004610b3e565b6102b3565b6100c661015d366004610be5565b6102d0565b60009081526000805160206122ac833981519152602052604090206001015490565b61018d82610162565b610197813361065c565b6101a183836106c0565b505050565b6001600160a01b038116331461021b5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b6102258282610757565b5050565b60008281526000805160206122cc8339815191526020526040812061024e90836107ec565b90505b92915050565b60009182526000805160206122ac833981519152602090815260408084206001600160a01b0393909316845291905290205460ff1690565b60008181526000805160206122cc83398151915260205260408120610251906107f8565b6102bc82610162565b6102c6813361065c565b6101a18383610757565b7f3178d75a97455c722bbe6e3619364b9b8f446a5900d6fbcc8d92ea722276883e546001600160a01b031660008181527f3178d75a97455c722bbe6e3619364b9b8f446a5900d6fbcc8d92ea722276883d6020908152604091829020548251636eb1769f60e11b815233600482015230602482015292517f3178d75a97455c722bbe6e3619364b9b8f446a5900d6fbcc8d92ea722276883a949193919263dd62ed3e92604480820193918290030181865afa158015610393573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103b79190610c51565b10156104165760405162461bcd60e51b815260206004820152602860248201527f4465706c6f7965723a204e6f7420616c6c6f77656420746f207472616e7366656044820152677220746f6b656e7360c01b6064820152608401610212565b6004818101546001600160a01b03166000818152600384016020526040908190205490516323b872dd60e01b815233938101939093523060248401526044830152906323b872dd906064016020604051808303816000875af1158015610480573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104a49190610c6a565b6104fc5760405162461bcd60e51b815260206004820152602360248201527f4465706c6f7965723a204572726f72207472616e7366657272696e6720746f6b604482015262656e7360e81b6064820152608401610212565b336000818152600183016020908152604080832060048601546001600160a01b031684526003860183528184205494845260068601909252822080549193929091610548908490610ca9565b909155505080546000036105795781546001810183556000838152602090200180546001600160a01b031916331790555b6000868686863361753060405161058f90610b18565b61059e96959493929190610ce5565b604051809103906000f0801580156105ba573d6000803e3d6000fd5b508254600180820185556000858152602080822090930180546001600160a01b03199081166001600160a01b038716908117909255908252600288019093526040902080543393168317905584549293507fb1bf8414d7fb85ef593239c1db589dffe8753ca97f373e492a269ec8c1e97553926106379190610d34565b838a8a60405161064b959493929190610d47565b60405180910390a150505050505050565b6106668282610257565b6102255761067e816001600160a01b03166014610802565b610689836020610802565b60405160200161069a929190610daa565b60408051601f198184030181529082905262461bcd60e51b825261021291600401610e1f565b6106ca8282610257565b6102255760008281526000805160206122ac833981519152602090815260408083206001600160a01b0385168085529252808320805460ff1916600117905551339285917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9190a460008281526000805160206122cc833981519152602052604090206101a19082610982565b6107618282610257565b156102255760008281526000805160206122ac833981519152602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a460008281526000805160206122cc833981519152602052604090206101a19082610997565b600061024e83836109ac565b6000610251825490565b6060826000610812846002610e52565b61081d906002610ca9565b67ffffffffffffffff81111561083557610835610e69565b6040519080825280601f01601f19166020018201604052801561085f576020820181803683370190505b509050600360fc1b8160008151811061087a5761087a610e7f565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106108a9576108a9610e7f565b60200101906001600160f81b031916908160001a90535060006108cd856002610e52565b6108d8906001610ca9565b90505b6001811115610950576f181899199a1a9b1b9c1cb0b131b232b360811b83600f166010811061090c5761090c610e7f565b1a60f81b82828151811061092257610922610e7f565b60200101906001600160f81b031916908160001a90535060049290921c9161094981610e95565b90506108db565b50811561097a5760405163e22e27eb60e01b81526004810186905260248101859052604401610212565b949350505050565b600061024e836001600160a01b0384166109d6565b600061024e836001600160a01b038416610a25565b60008260000182815481106109c3576109c3610e7f565b9060005260206000200154905092915050565b6000818152600183016020526040812054610a1d57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610251565b506000610251565b60008181526001830160205260408120548015610b0e576000610a49600183610d34565b8554909150600090610a5d90600190610d34565b9050808214610ac2576000866000018281548110610a7d57610a7d610e7f565b9060005260206000200154905080876000018481548110610aa057610aa0610e7f565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080610ad357610ad3610eac565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610251565b6000915050610251565b6113e980610ec383390190565b600060208284031215610b3757600080fd5b5035919050565b60008060408385031215610b5157600080fd5b8235915060208301356001600160a01b0381168114610b6f57600080fd5b809150509250929050565b60008060408385031215610b8d57600080fd5b50508035926020909101359150565b60008083601f840112610bae57600080fd5b50813567ffffffffffffffff811115610bc657600080fd5b602083019150836020828501011115610bde57600080fd5b9250929050565b60008060008060408587031215610bfb57600080fd5b843567ffffffffffffffff80821115610c1357600080fd5b610c1f88838901610b9c565b90965094506020870135915080821115610c3857600080fd5b50610c4587828801610b9c565b95989497509550505050565b600060208284031215610c6357600080fd5b5051919050565b600060208284031215610c7c57600080fd5b81518015158114610c8c57600080fd5b9392505050565b634e487b7160e01b600052601160045260246000fd5b8082018082111561025157610251610c93565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b608081526000610cf960808301888a610cbc565b8281036020840152610d0c818789610cbc565b6001600160a01b03959095166040840152505061ffff91909116606090910152949350505050565b8181038181111561025157610251610c93565b6001600160a01b0386811682526020820186905284166040820152608060608201819052600090610d7b9083018486610cbc565b979650505050505050565b60005b83811015610da1578181015183820152602001610d89565b50506000910152565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351610de2816017850160208801610d86565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351610e13816028840160208801610d86565b01602801949350505050565b6020815260008251806020840152610e3e816040850160208701610d86565b601f01601f19169190910160400192915050565b808202811582820484141761025157610251610c93565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b600081610ea457610ea4610c93565b506000190190565b634e487b7160e01b600052603160045260246000fdfe608060405234801561001057600080fd5b506040516113e93803806113e983398101604081905261002f916103ac565b7f13fbb056f2602120441ced10c19d8151fd41fd4b17a6646b53bc0f944eb07a398061005b86826104d4565b506001810161006a85826104d4565b50601b81018054600160ff19909116179055600b810180546001600160b01b0319163361ffff60a01b191617600160a01b61ffff8516021790556100ca6000805160206113a9833981519152600080516020611389833981519152610142565b6100f06000805160206113c9833981519152600080516020611389833981519152610142565b6101086000805160206113898339815191528461019a565b6101206000805160206113a98339815191528461019a565b6101386000805160206113c98339815191528461019a565b5050505050610593565b60008281526000805160206113698339815191526020526040808220600101805490849055905190918391839186917fbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff9190a4505050565b6101a48282610249565b610245576000828152600080516020611369833981519152602090815260408083206001600160a01b0385168085529252808320805460ff1916600117905551339285917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9190a460008281527f4f4f658137f4e10317e1a22624c2b114af7563a20fb2e3444ae2ac2342d457d1602052604090206102439082610283565b505b5050565b6000828152600080516020611369833981519152602090815260408083206001600160a01b038516845290915290205460ff165b92915050565b6000610298836001600160a01b03841661029f565b9392505050565b60008181526001830160205260408120546102e65750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561027d565b50600061027d565b634e487b7160e01b600052604160045260246000fd5b600082601f83011261031557600080fd5b81516001600160401b038082111561032f5761032f6102ee565b604051601f8301601f19908116603f01168101908282118183101715610357576103576102ee565b816040528381526020925086602085880101111561037457600080fd5b600091505b838210156103965785820183015181830184015290820190610379565b6000602085830101528094505050505092915050565b600080600080608085870312156103c257600080fd5b84516001600160401b03808211156103d957600080fd5b6103e588838901610304565b955060208701519150808211156103fb57600080fd5b5061040887828801610304565b604087015190945090506001600160a01b038116811461042757600080fd5b606086015190925061ffff8116811461043f57600080fd5b939692955090935050565b600181811c9082168061045e57607f821691505b60208210810361047e57634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115610243576000816000526020600020601f850160051c810160208610156104ad5750805b601f850160051c820191505b818110156104cc578281556001016104b9565b505050505050565b81516001600160401b038111156104ed576104ed6102ee565b610501816104fb845461044a565b84610484565b602080601f831160018114610536576000841561051e5750858301515b600019600386901b1c1916600185901b1785556104cc565b600085815260208120601f198616915b8281101561056557888601518255948401946001909101908401610546565b50858210156105835787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b610dc7806105a26000396000f3fe608060405234801561001057600080fd5b50600436106100cf5760003560e01c806391d148541161008c578063d547741f11610066578063d547741f14610316578063e4fbb60914610329578063e8a3d48514610350578063fe6d812414610365576100cf565b806391d14854146102c0578063a9c2e36c146102d3578063ca15c87314610303576100cf565b806301ffc9a7146101ff578063175c4ef814610227578063248a9ca31461025c5780632f2ff15d1461026f57806336568abe146102825780639010d07c14610295575b7f13fbb056f2602120441ced10c19d8151fd41fd4b17a6646b53bc0f944eb07a445460408051631dbb5cf160e31b815290516001600160a01b0390921691600091839163eddae788916004808201926020929091908290030181865afa15801561013d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101619190610aed565b6040516366ffd66360e11b81526001600160e01b03196000351660048201526001600160a01b03919091169063cdffacc690602401602060405180830381865afa1580156101b3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101d79190610aed565b90503660008037600080366000845af43d6000803e8080156101f8573d6000f35b3d6000fd5b005b61021261020d366004610b0a565b61038c565b60405190151581526020015b60405180910390f35b61024e7f872340a532bdd7bb02bea115c1b0f1ba87eac982f5b79b51ac189ffaac1b6fce81565b60405190815260200161021e565b61024e61026a366004610b34565b6103f9565b6101fd61027d366004610b4d565b61041b565b6101fd610290366004610b4d565b61043d565b6102a86102a3366004610b7d565b6104c0565b6040516001600160a01b03909116815260200161021e565b6102126102ce366004610b4d565b6104ec565b7f13fbb056f2602120441ced10c19d8151fd41fd4b17a6646b53bc0f944eb07a44546001600160a01b03166102a8565b61024e610311366004610b34565b610524565b6101fd610324366004610b4d565b610548565b61024e7f3c2519c4487d47714872f92cf90a50c25f5deaec2789dc2a497b1272df611db681565b610358610565565b60405161021e9190610bc3565b61024e7ff0887ba65ee2024ea881d91b74c2450ef19e1557f03bed3ea9f16b037cbe2dc981565b60006001600160e01b031982166380ac58cd60e01b14806103bd57506001600160e01b03198216635b5e139f60e01b145b806103d857506001600160e01b0319821663780e9d6360e01b145b806103f357506301ffc9a760e01b6001600160e01b03198316145b92915050565b6000908152600080516020610d52833981519152602052604090206001015490565b610424826103f9565b61042e8133610619565b610438838361067d565b505050565b6001600160a01b03811633146104b25760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b6104bc8282610714565b5050565b6000828152600080516020610d72833981519152602052604081206104e590836107a9565b9392505050565b6000918252600080516020610d52833981519152602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6000818152600080516020610d72833981519152602052604081206103f3906107b5565b610551826103f9565b61055b8133610619565b6104388383610714565b60607f13fbb056f2602120441ced10c19d8151fd41fd4b17a6646b53bc0f944eb07a39601501805461059690610bf6565b80601f01602080910402602001604051908101604052809291908181526020018280546105c290610bf6565b801561060f5780601f106105e45761010080835404028352916020019161060f565b820191906000526020600020905b8154815290600101906020018083116105f257829003601f168201915b5050505050905090565b61062382826104ec565b6104bc5761063b816001600160a01b031660146107bf565b6106468360206107bf565b604051602001610657929190610c30565b60408051601f198184030181529082905262461bcd60e51b82526104a991600401610bc3565b61068782826104ec565b6104bc576000828152600080516020610d52833981519152602090815260408083206001600160a01b0385168085529252808320805460ff1916600117905551339285917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9190a46000828152600080516020610d7283398151915260205260409020610438908261093f565b61071e82826104ec565b156104bc576000828152600080516020610d52833981519152602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a46000828152600080516020610d72833981519152602052604090206104389082610954565b60006104e58383610969565b60006103f3825490565b60608260006107cf846002610cbb565b6107da906002610cd2565b67ffffffffffffffff8111156107f2576107f2610ce5565b6040519080825280601f01601f19166020018201604052801561081c576020820181803683370190505b509050600360fc1b8160008151811061083757610837610cfb565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061086657610866610cfb565b60200101906001600160f81b031916908160001a905350600061088a856002610cbb565b610895906001610cd2565b90505b600181111561090d576f181899199a1a9b1b9c1cb0b131b232b360811b83600f16601081106108c9576108c9610cfb565b1a60f81b8282815181106108df576108df610cfb565b60200101906001600160f81b031916908160001a90535060049290921c9161090681610d11565b9050610898565b5081156109375760405163e22e27eb60e01b815260048101869052602481018590526044016104a9565b949350505050565b60006104e5836001600160a01b038416610993565b60006104e5836001600160a01b0384166109e2565b600082600001828154811061098057610980610cfb565b9060005260206000200154905092915050565b60008181526001830160205260408120546109da575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556103f3565b5060006103f3565b60008181526001830160205260408120548015610acb576000610a06600183610d28565b8554909150600090610a1a90600190610d28565b9050808214610a7f576000866000018281548110610a3a57610a3a610cfb565b9060005260206000200154905080876000018481548110610a5d57610a5d610cfb565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080610a9057610a90610d3b565b6001900381819060005260206000200160009055905585600101600086815260200190815260200160002060009055600193505050506103f3565b60009150506103f3565b6001600160a01b0381168114610aea57600080fd5b50565b600060208284031215610aff57600080fd5b81516104e581610ad5565b600060208284031215610b1c57600080fd5b81356001600160e01b0319811681146104e557600080fd5b600060208284031215610b4657600080fd5b5035919050565b60008060408385031215610b6057600080fd5b823591506020830135610b7281610ad5565b809150509250929050565b60008060408385031215610b9057600080fd5b50508035926020909101359150565b60005b83811015610bba578181015183820152602001610ba2565b50506000910152565b6020815260008251806020840152610be2816040850160208701610b9f565b601f01601f19169190910160400192915050565b600181811c90821680610c0a57607f821691505b602082108103610c2a57634e487b7160e01b600052602260045260246000fd5b50919050565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351610c68816017850160208801610b9f565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351610c99816028840160208801610b9f565b01602801949350505050565b634e487b7160e01b600052601160045260246000fd5b80820281158282048414176103f3576103f3610ca5565b808201808211156103f3576103f3610ca5565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b600081610d2057610d20610ca5565b506000190190565b818103818111156103f3576103f3610ca5565b634e487b7160e01b600052603160045260246000fdfe4f4f658137f4e10317e1a22624c2b114af7563a20fb2e3444ae2ac2342d457d04f4f658137f4e10317e1a22624c2b114af7563a20fb2e3444ae2ac2342d457d1a26469706673582212201e1c6fa32553aa16ca4be57d28116848b5cedef970db987da13f6821b05f921264736f6c634300081900334f4f658137f4e10317e1a22624c2b114af7563a20fb2e3444ae2ac2342d457d03c2519c4487d47714872f92cf90a50c25f5deaec2789dc2a497b1272df611db6f0887ba65ee2024ea881d91b74c2450ef19e1557f03bed3ea9f16b037cbe2dc9872340a532bdd7bb02bea115c1b0f1ba87eac982f5b79b51ac189ffaac1b6fce4f4f658137f4e10317e1a22624c2b114af7563a20fb2e3444ae2ac2342d457d04f4f658137f4e10317e1a22624c2b114af7563a20fb2e3444ae2ac2342d457d1a26469706673582212204d9bf81419d17afa9998ff53ccbf51c4b8d2db6cb6e8a18dcbb8a6713ca1272264736f6c63430008190033

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106100885760003560e01c806391d148541161005b57806391d1485414610106578063ca15c87314610129578063d547741f1461013c578063e0bdf5831461014f57600080fd5b8063248a9ca31461008d5780632f2ff15d146100b357806336568abe146100c85780639010d07c146100db575b600080fd5b6100a061009b366004610b25565b610162565b6040519081526020015b60405180910390f35b6100c66100c1366004610b3e565b610184565b005b6100c66100d6366004610b3e565b6101a6565b6100ee6100e9366004610b7a565b610229565b6040516001600160a01b0390911681526020016100aa565b610119610114366004610b3e565b610257565b60405190151581526020016100aa565b6100a0610137366004610b25565b61028f565b6100c661014a366004610b3e565b6102b3565b6100c661015d366004610be5565b6102d0565b60009081526000805160206122ac833981519152602052604090206001015490565b61018d82610162565b610197813361065c565b6101a183836106c0565b505050565b6001600160a01b038116331461021b5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b6102258282610757565b5050565b60008281526000805160206122cc8339815191526020526040812061024e90836107ec565b90505b92915050565b60009182526000805160206122ac833981519152602090815260408084206001600160a01b0393909316845291905290205460ff1690565b60008181526000805160206122cc83398151915260205260408120610251906107f8565b6102bc82610162565b6102c6813361065c565b6101a18383610757565b7f3178d75a97455c722bbe6e3619364b9b8f446a5900d6fbcc8d92ea722276883e546001600160a01b031660008181527f3178d75a97455c722bbe6e3619364b9b8f446a5900d6fbcc8d92ea722276883d6020908152604091829020548251636eb1769f60e11b815233600482015230602482015292517f3178d75a97455c722bbe6e3619364b9b8f446a5900d6fbcc8d92ea722276883a949193919263dd62ed3e92604480820193918290030181865afa158015610393573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103b79190610c51565b10156104165760405162461bcd60e51b815260206004820152602860248201527f4465706c6f7965723a204e6f7420616c6c6f77656420746f207472616e7366656044820152677220746f6b656e7360c01b6064820152608401610212565b6004818101546001600160a01b03166000818152600384016020526040908190205490516323b872dd60e01b815233938101939093523060248401526044830152906323b872dd906064016020604051808303816000875af1158015610480573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104a49190610c6a565b6104fc5760405162461bcd60e51b815260206004820152602360248201527f4465706c6f7965723a204572726f72207472616e7366657272696e6720746f6b604482015262656e7360e81b6064820152608401610212565b336000818152600183016020908152604080832060048601546001600160a01b031684526003860183528184205494845260068601909252822080549193929091610548908490610ca9565b909155505080546000036105795781546001810183556000838152602090200180546001600160a01b031916331790555b6000868686863361753060405161058f90610b18565b61059e96959493929190610ce5565b604051809103906000f0801580156105ba573d6000803e3d6000fd5b508254600180820185556000858152602080822090930180546001600160a01b03199081166001600160a01b038716908117909255908252600288019093526040902080543393168317905584549293507fb1bf8414d7fb85ef593239c1db589dffe8753ca97f373e492a269ec8c1e97553926106379190610d34565b838a8a60405161064b959493929190610d47565b60405180910390a150505050505050565b6106668282610257565b6102255761067e816001600160a01b03166014610802565b610689836020610802565b60405160200161069a929190610daa565b60408051601f198184030181529082905262461bcd60e51b825261021291600401610e1f565b6106ca8282610257565b6102255760008281526000805160206122ac833981519152602090815260408083206001600160a01b0385168085529252808320805460ff1916600117905551339285917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9190a460008281526000805160206122cc833981519152602052604090206101a19082610982565b6107618282610257565b156102255760008281526000805160206122ac833981519152602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a460008281526000805160206122cc833981519152602052604090206101a19082610997565b600061024e83836109ac565b6000610251825490565b6060826000610812846002610e52565b61081d906002610ca9565b67ffffffffffffffff81111561083557610835610e69565b6040519080825280601f01601f19166020018201604052801561085f576020820181803683370190505b509050600360fc1b8160008151811061087a5761087a610e7f565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106108a9576108a9610e7f565b60200101906001600160f81b031916908160001a90535060006108cd856002610e52565b6108d8906001610ca9565b90505b6001811115610950576f181899199a1a9b1b9c1cb0b131b232b360811b83600f166010811061090c5761090c610e7f565b1a60f81b82828151811061092257610922610e7f565b60200101906001600160f81b031916908160001a90535060049290921c9161094981610e95565b90506108db565b50811561097a5760405163e22e27eb60e01b81526004810186905260248101859052604401610212565b949350505050565b600061024e836001600160a01b0384166109d6565b600061024e836001600160a01b038416610a25565b60008260000182815481106109c3576109c3610e7f565b9060005260206000200154905092915050565b6000818152600183016020526040812054610a1d57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610251565b506000610251565b60008181526001830160205260408120548015610b0e576000610a49600183610d34565b8554909150600090610a5d90600190610d34565b9050808214610ac2576000866000018281548110610a7d57610a7d610e7f565b9060005260206000200154905080876000018481548110610aa057610aa0610e7f565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080610ad357610ad3610eac565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610251565b6000915050610251565b6113e980610ec383390190565b600060208284031215610b3757600080fd5b5035919050565b60008060408385031215610b5157600080fd5b8235915060208301356001600160a01b0381168114610b6f57600080fd5b809150509250929050565b60008060408385031215610b8d57600080fd5b50508035926020909101359150565b60008083601f840112610bae57600080fd5b50813567ffffffffffffffff811115610bc657600080fd5b602083019150836020828501011115610bde57600080fd5b9250929050565b60008060008060408587031215610bfb57600080fd5b843567ffffffffffffffff80821115610c1357600080fd5b610c1f88838901610b9c565b90965094506020870135915080821115610c3857600080fd5b50610c4587828801610b9c565b95989497509550505050565b600060208284031215610c6357600080fd5b5051919050565b600060208284031215610c7c57600080fd5b81518015158114610c8c57600080fd5b9392505050565b634e487b7160e01b600052601160045260246000fd5b8082018082111561025157610251610c93565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b608081526000610cf960808301888a610cbc565b8281036020840152610d0c818789610cbc565b6001600160a01b03959095166040840152505061ffff91909116606090910152949350505050565b8181038181111561025157610251610c93565b6001600160a01b0386811682526020820186905284166040820152608060608201819052600090610d7b9083018486610cbc565b979650505050505050565b60005b83811015610da1578181015183820152602001610d89565b50506000910152565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351610de2816017850160208801610d86565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351610e13816028840160208801610d86565b01602801949350505050565b6020815260008251806020840152610e3e816040850160208701610d86565b601f01601f19169190910160400192915050565b808202811582820484141761025157610251610c93565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b600081610ea457610ea4610c93565b506000190190565b634e487b7160e01b600052603160045260246000fdfe608060405234801561001057600080fd5b506040516113e93803806113e983398101604081905261002f916103ac565b7f13fbb056f2602120441ced10c19d8151fd41fd4b17a6646b53bc0f944eb07a398061005b86826104d4565b506001810161006a85826104d4565b50601b81018054600160ff19909116179055600b810180546001600160b01b0319163361ffff60a01b191617600160a01b61ffff8516021790556100ca6000805160206113a9833981519152600080516020611389833981519152610142565b6100f06000805160206113c9833981519152600080516020611389833981519152610142565b6101086000805160206113898339815191528461019a565b6101206000805160206113a98339815191528461019a565b6101386000805160206113c98339815191528461019a565b5050505050610593565b60008281526000805160206113698339815191526020526040808220600101805490849055905190918391839186917fbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff9190a4505050565b6101a48282610249565b610245576000828152600080516020611369833981519152602090815260408083206001600160a01b0385168085529252808320805460ff1916600117905551339285917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9190a460008281527f4f4f658137f4e10317e1a22624c2b114af7563a20fb2e3444ae2ac2342d457d1602052604090206102439082610283565b505b5050565b6000828152600080516020611369833981519152602090815260408083206001600160a01b038516845290915290205460ff165b92915050565b6000610298836001600160a01b03841661029f565b9392505050565b60008181526001830160205260408120546102e65750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561027d565b50600061027d565b634e487b7160e01b600052604160045260246000fd5b600082601f83011261031557600080fd5b81516001600160401b038082111561032f5761032f6102ee565b604051601f8301601f19908116603f01168101908282118183101715610357576103576102ee565b816040528381526020925086602085880101111561037457600080fd5b600091505b838210156103965785820183015181830184015290820190610379565b6000602085830101528094505050505092915050565b600080600080608085870312156103c257600080fd5b84516001600160401b03808211156103d957600080fd5b6103e588838901610304565b955060208701519150808211156103fb57600080fd5b5061040887828801610304565b604087015190945090506001600160a01b038116811461042757600080fd5b606086015190925061ffff8116811461043f57600080fd5b939692955090935050565b600181811c9082168061045e57607f821691505b60208210810361047e57634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115610243576000816000526020600020601f850160051c810160208610156104ad5750805b601f850160051c820191505b818110156104cc578281556001016104b9565b505050505050565b81516001600160401b038111156104ed576104ed6102ee565b610501816104fb845461044a565b84610484565b602080601f831160018114610536576000841561051e5750858301515b600019600386901b1c1916600185901b1785556104cc565b600085815260208120601f198616915b8281101561056557888601518255948401946001909101908401610546565b50858210156105835787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b610dc7806105a26000396000f3fe608060405234801561001057600080fd5b50600436106100cf5760003560e01c806391d148541161008c578063d547741f11610066578063d547741f14610316578063e4fbb60914610329578063e8a3d48514610350578063fe6d812414610365576100cf565b806391d14854146102c0578063a9c2e36c146102d3578063ca15c87314610303576100cf565b806301ffc9a7146101ff578063175c4ef814610227578063248a9ca31461025c5780632f2ff15d1461026f57806336568abe146102825780639010d07c14610295575b7f13fbb056f2602120441ced10c19d8151fd41fd4b17a6646b53bc0f944eb07a445460408051631dbb5cf160e31b815290516001600160a01b0390921691600091839163eddae788916004808201926020929091908290030181865afa15801561013d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101619190610aed565b6040516366ffd66360e11b81526001600160e01b03196000351660048201526001600160a01b03919091169063cdffacc690602401602060405180830381865afa1580156101b3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101d79190610aed565b90503660008037600080366000845af43d6000803e8080156101f8573d6000f35b3d6000fd5b005b61021261020d366004610b0a565b61038c565b60405190151581526020015b60405180910390f35b61024e7f872340a532bdd7bb02bea115c1b0f1ba87eac982f5b79b51ac189ffaac1b6fce81565b60405190815260200161021e565b61024e61026a366004610b34565b6103f9565b6101fd61027d366004610b4d565b61041b565b6101fd610290366004610b4d565b61043d565b6102a86102a3366004610b7d565b6104c0565b6040516001600160a01b03909116815260200161021e565b6102126102ce366004610b4d565b6104ec565b7f13fbb056f2602120441ced10c19d8151fd41fd4b17a6646b53bc0f944eb07a44546001600160a01b03166102a8565b61024e610311366004610b34565b610524565b6101fd610324366004610b4d565b610548565b61024e7f3c2519c4487d47714872f92cf90a50c25f5deaec2789dc2a497b1272df611db681565b610358610565565b60405161021e9190610bc3565b61024e7ff0887ba65ee2024ea881d91b74c2450ef19e1557f03bed3ea9f16b037cbe2dc981565b60006001600160e01b031982166380ac58cd60e01b14806103bd57506001600160e01b03198216635b5e139f60e01b145b806103d857506001600160e01b0319821663780e9d6360e01b145b806103f357506301ffc9a760e01b6001600160e01b03198316145b92915050565b6000908152600080516020610d52833981519152602052604090206001015490565b610424826103f9565b61042e8133610619565b610438838361067d565b505050565b6001600160a01b03811633146104b25760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b6104bc8282610714565b5050565b6000828152600080516020610d72833981519152602052604081206104e590836107a9565b9392505050565b6000918252600080516020610d52833981519152602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6000818152600080516020610d72833981519152602052604081206103f3906107b5565b610551826103f9565b61055b8133610619565b6104388383610714565b60607f13fbb056f2602120441ced10c19d8151fd41fd4b17a6646b53bc0f944eb07a39601501805461059690610bf6565b80601f01602080910402602001604051908101604052809291908181526020018280546105c290610bf6565b801561060f5780601f106105e45761010080835404028352916020019161060f565b820191906000526020600020905b8154815290600101906020018083116105f257829003601f168201915b5050505050905090565b61062382826104ec565b6104bc5761063b816001600160a01b031660146107bf565b6106468360206107bf565b604051602001610657929190610c30565b60408051601f198184030181529082905262461bcd60e51b82526104a991600401610bc3565b61068782826104ec565b6104bc576000828152600080516020610d52833981519152602090815260408083206001600160a01b0385168085529252808320805460ff1916600117905551339285917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9190a46000828152600080516020610d7283398151915260205260409020610438908261093f565b61071e82826104ec565b156104bc576000828152600080516020610d52833981519152602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a46000828152600080516020610d72833981519152602052604090206104389082610954565b60006104e58383610969565b60006103f3825490565b60608260006107cf846002610cbb565b6107da906002610cd2565b67ffffffffffffffff8111156107f2576107f2610ce5565b6040519080825280601f01601f19166020018201604052801561081c576020820181803683370190505b509050600360fc1b8160008151811061083757610837610cfb565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061086657610866610cfb565b60200101906001600160f81b031916908160001a905350600061088a856002610cbb565b610895906001610cd2565b90505b600181111561090d576f181899199a1a9b1b9c1cb0b131b232b360811b83600f16601081106108c9576108c9610cfb565b1a60f81b8282815181106108df576108df610cfb565b60200101906001600160f81b031916908160001a90535060049290921c9161090681610d11565b9050610898565b5081156109375760405163e22e27eb60e01b815260048101869052602481018590526044016104a9565b949350505050565b60006104e5836001600160a01b038416610993565b60006104e5836001600160a01b0384166109e2565b600082600001828154811061098057610980610cfb565b9060005260206000200154905092915050565b60008181526001830160205260408120546109da575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556103f3565b5060006103f3565b60008181526001830160205260408120548015610acb576000610a06600183610d28565b8554909150600090610a1a90600190610d28565b9050808214610a7f576000866000018281548110610a3a57610a3a610cfb565b9060005260206000200154905080876000018481548110610a5d57610a5d610cfb565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080610a9057610a90610d3b565b6001900381819060005260206000200160009055905585600101600086815260200190815260200160002060009055600193505050506103f3565b60009150506103f3565b6001600160a01b0381168114610aea57600080fd5b50565b600060208284031215610aff57600080fd5b81516104e581610ad5565b600060208284031215610b1c57600080fd5b81356001600160e01b0319811681146104e557600080fd5b600060208284031215610b4657600080fd5b5035919050565b60008060408385031215610b6057600080fd5b823591506020830135610b7281610ad5565b809150509250929050565b60008060408385031215610b9057600080fd5b50508035926020909101359150565b60005b83811015610bba578181015183820152602001610ba2565b50506000910152565b6020815260008251806020840152610be2816040850160208701610b9f565b601f01601f19169190910160400192915050565b600181811c90821680610c0a57607f821691505b602082108103610c2a57634e487b7160e01b600052602260045260246000fd5b50919050565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351610c68816017850160208801610b9f565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351610c99816028840160208801610b9f565b01602801949350505050565b634e487b7160e01b600052601160045260246000fd5b80820281158282048414176103f3576103f3610ca5565b808201808211156103f3576103f3610ca5565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b600081610d2057610d20610ca5565b506000190190565b818103818111156103f3576103f3610ca5565b634e487b7160e01b600052603160045260246000fdfe4f4f658137f4e10317e1a22624c2b114af7563a20fb2e3444ae2ac2342d457d04f4f658137f4e10317e1a22624c2b114af7563a20fb2e3444ae2ac2342d457d1a26469706673582212201e1c6fa32553aa16ca4be57d28116848b5cedef970db987da13f6821b05f921264736f6c634300081900334f4f658137f4e10317e1a22624c2b114af7563a20fb2e3444ae2ac2342d457d03c2519c4487d47714872f92cf90a50c25f5deaec2789dc2a497b1272df611db6f0887ba65ee2024ea881d91b74c2450ef19e1557f03bed3ea9f16b037cbe2dc9872340a532bdd7bb02bea115c1b0f1ba87eac982f5b79b51ac189ffaac1b6fce4f4f658137f4e10317e1a22624c2b114af7563a20fb2e3444ae2ac2342d457d04f4f658137f4e10317e1a22624c2b114af7563a20fb2e3444ae2ac2342d457d1a26469706673582212204d9bf81419d17afa9998ff53ccbf51c4b8d2db6cb6e8a18dcbb8a6713ca1272264736f6c63430008190033

Block Transaction Gas Used Reward
view all blocks produced

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
[ 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.