Feature Tip: Add private address tag to any address under My Name Tag !
ERC-1155
NFT
Overview
Max Total Supply
100,000,000 WATER
Holders
16 (0.00%)
Market
Volume (24H)
N/A
Min Price (24H)
N/A
Max Price (24H)
N/A
Other Info
Token Contract
Loading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
Contract Name:
IrrigationDiamond
Compiler Version
v0.8.17+commit.8df45f5f
Optimization Enabled:
Yes with 1000 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.17; import "./interfaces/IDiamondLoupe.sol"; import "./interfaces/IDiamondCut.sol"; import "./utils/Diamond.sol"; import "@gnus.ai/contracts-upgradeable-diamond/contracts/utils/introspection/ERC165StorageUpgradeable.sol"; import "@gnus.ai/contracts-upgradeable-diamond/contracts/token/ERC20/IERC20Upgradeable.sol"; import "@gnus.ai/contracts-upgradeable-diamond/contracts/token/ERC1155/IERC1155Upgradeable.sol"; import "./utils/EIP2535Initializable.sol"; contract IrrigationDiamond is Diamond, ERC165StorageUpgradeable, EIP2535Initializable { using LibDiamond for LibDiamond.DiamondStorage; constructor( address _contractOwner, address _diamondCutFacet ) payable EIP2535Initializer Diamond(_contractOwner, _diamondCutFacet) { __ERC165Storage_init(); // this is so that any contract deployment watchers will be able to check interfaces on deployment _registerInterface(type(IERC165Upgradeable).interfaceId); _registerInterface(type(IERC20Upgradeable).interfaceId); _registerInterface(type(IERC1155Upgradeable).interfaceId); _registerInterface(type(IDiamondCut).interfaceId); _registerInterface(type(IDiamondLoupe).interfaceId); } function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return super.supportsInterface(interfaceId) || LibDiamond.diamondStorage().supportedInterfaces[interfaceId]; } // Finalize initialization after every facet has initialized only function FinalizeInitialization() external { require(LibDiamond.diamondStorage().contractOwner == msg.sender, "Only SuperAdmin allowed"); InitializableStorage.layout()._initialized = 1; } function FinalReinitialize(uint8 version) external { require(LibDiamond.diamondStorage().contractOwner == msg.sender, "Only SuperAdmin allowed"); InitializableStorage.layout()._initialized = version; } receive() external payable {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.2; import "../../utils/AddressUpgradeable.sol"; import { InitializableStorage } from "./InitializableStorage.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in * case an upgrade adds a module that needs to be initialized. * * For example: * * [.hljs-theme-light.nopadding] * ``` * contract MyToken is ERC20Upgradeable { * function initialize() initializer public { * __ERC20_init("MyToken", "MTK"); * } * } * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable { * function initializeV2() reinitializer(2) public { * __ERC20Permit_init("MyToken"); * } * } * ``` * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() { * _disableInitializers(); * } * ``` * ==== */ abstract contract Initializable { /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint8 version); /** * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope, * `onlyInitializing` functions can be used to initialize parent contracts. * * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a * constructor. * * Emits an {Initialized} event. */ modifier initializer() { bool isTopLevelCall = !InitializableStorage.layout()._initializing; require( (isTopLevelCall && InitializableStorage.layout()._initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && InitializableStorage.layout()._initialized == 1), "Initializable: contract is already initialized" ); InitializableStorage.layout()._initialized = 1; if (isTopLevelCall) { InitializableStorage.layout()._initializing = true; } _; if (isTopLevelCall) { InitializableStorage.layout()._initializing = false; emit Initialized(1); } } /** * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be * used to initialize parent contracts. * * A reinitializer may be used after the original initialization step. This is essential to configure modules that * are added through upgrades and that require initialization. * * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer` * cannot be nested. If one is invoked in the context of another, execution will revert. * * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in * a contract, executing them in the right order is up to the developer or operator. * * WARNING: setting the version to 255 will prevent any future reinitialization. * * Emits an {Initialized} event. */ modifier reinitializer(uint8 version) { require(!InitializableStorage.layout()._initializing && InitializableStorage.layout()._initialized < version, "Initializable: contract is already initialized"); InitializableStorage.layout()._initialized = version; InitializableStorage.layout()._initializing = true; _; InitializableStorage.layout()._initializing = false; emit Initialized(version); } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} and {reinitializer} modifiers, directly or indirectly. */ modifier onlyInitializing() { require(InitializableStorage.layout()._initializing, "Initializable: contract is not initializing"); _; } /** * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call. * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized * to any version. It is recommended to use this to lock implementation contracts that are designed to be called * through proxies. * * Emits an {Initialized} event the first time it is successfully executed. */ function _disableInitializers() internal virtual { require(!InitializableStorage.layout()._initializing, "Initializable: contract is initializing"); if (InitializableStorage.layout()._initialized < type(uint8).max) { InitializableStorage.layout()._initialized = type(uint8).max; emit Initialized(type(uint8).max); } } /** * @dev Returns the highest version that has been initialized. See {reinitializer}. */ function _getInitializedVersion() internal view returns (uint8) { return InitializableStorage.layout()._initialized; } /** * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}. */ function _isInitializing() internal view returns (bool) { return InitializableStorage.layout()._initializing; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import { Initializable } from "./Initializable.sol"; library InitializableStorage { struct Layout { /* * @dev Indicates that the contract has been initialized. * @custom:oz-retyped-from bool */ uint8 _initialized; /* * @dev Indicates that the contract is in the process of being initialized. */ bool _initializing; } bytes32 internal constant STORAGE_SLOT = keccak256('openzeppelin.contracts.storage.Initializable'); function layout() internal pure returns (Layout storage l) { bytes32 slot = STORAGE_SLOT; assembly { l.slot := slot } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/IERC1155.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165Upgradeable.sol"; /** * @dev Required interface of an ERC1155 compliant contract, as defined in the * https://eips.ethereum.org/EIPS/eip-1155[EIP]. * * _Available since v3.1._ */ interface IERC1155Upgradeable is IERC165Upgradeable { /** * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`. */ event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value); /** * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all * transfers. */ event TransferBatch( address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] values ); /** * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to * `approved`. */ event ApprovalForAll(address indexed account, address indexed operator, bool approved); /** * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI. * * If an {URI} event was emitted for `id`, the standard * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value * returned by {IERC1155MetadataURI-uri}. */ event URI(string value, uint256 indexed id); /** * @dev Returns the amount of tokens of token type `id` owned by `account`. * * Requirements: * * - `account` cannot be the zero address. */ function balanceOf(address account, uint256 id) external view returns (uint256); /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}. * * Requirements: * * - `accounts` and `ids` must have the same length. */ function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids) external view returns (uint256[] memory); /** * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`, * * Emits an {ApprovalForAll} event. * * Requirements: * * - `operator` cannot be the caller. */ function setApprovalForAll(address operator, bool approved) external; /** * @dev Returns true if `operator` is approved to transfer ``account``'s tokens. * * See {setApprovalForAll}. */ function isApprovedForAll(address account, address operator) external view returns (bool); /** * @dev Transfers `amount` tokens of token type `id` from `from` to `to`. * * Emits a {TransferSingle} event. * * Requirements: * * - `to` cannot be the zero address. * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}. * - `from` must have a balance of tokens of type `id` of at least `amount`. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function safeTransferFrom( address from, address to, uint256 id, uint256 amount, bytes calldata data ) external; /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}. * * Emits a {TransferBatch} event. * * Requirements: * * - `ids` and `amounts` must have the same length. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the * acceptance magic value. */ function safeBatchTransferFrom( address from, address to, uint256[] calldata ids, uint256[] calldata amounts, bytes calldata data ) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20Upgradeable { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import { ERC165StorageUpgradeable } from "./ERC165StorageUpgradeable.sol"; library ERC165StorageStorage { struct Layout { /* * @dev Mapping of interface ids to whether or not it's supported. */ mapping(bytes4 => bool) _supportedInterfaces; } bytes32 internal constant STORAGE_SLOT = keccak256('openzeppelin.contracts.storage.ERC165Storage'); function layout() internal pure returns (Layout storage l) { bytes32 slot = STORAGE_SLOT; assembly { l.slot := slot } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165Storage.sol) pragma solidity ^0.8.0; import "./ERC165Upgradeable.sol"; import { ERC165StorageStorage } from "./ERC165StorageStorage.sol"; import "../../proxy/utils/Initializable.sol"; /** * @dev Storage based implementation of the {IERC165} interface. * * Contracts may inherit from this and call {_registerInterface} to declare * their support of an interface. */ abstract contract ERC165StorageUpgradeable is Initializable, ERC165Upgradeable { using ERC165StorageStorage for ERC165StorageStorage.Layout; function __ERC165Storage_init() internal onlyInitializing { } function __ERC165Storage_init_unchained() internal onlyInitializing { } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return super.supportsInterface(interfaceId) || ERC165StorageStorage.layout()._supportedInterfaces[interfaceId]; } /** * @dev Registers the contract as an implementer of the interface defined by * `interfaceId`. Support of the actual ERC165 interface is automatic and * registering its interface id is not required. * * See {IERC165-supportsInterface}. * * Requirements: * * - `interfaceId` cannot be the ERC165 invalid interface (`0xffffffff`). */ function _registerInterface(bytes4 interfaceId) internal virtual { require(interfaceId != 0xffffffff, "ERC165: invalid interface id"); ERC165StorageStorage.layout()._supportedInterfaces[interfaceId] = true; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165Upgradeable.sol"; import "../../proxy/utils/Initializable.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable { function __ERC165_init() internal onlyInitializing { } function __ERC165_init_unchained() internal onlyInitializing { } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165Upgradeable).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165Upgradeable { /** * @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); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.17; /******************************************************************************\ * Author: Nick Mudge <[email protected]> (https://twitter.com/mudgen) * EIP-2535 Diamonds: https://eips.ethereum.org/EIPS/eip-2535 /******************************************************************************/ interface IDiamondCut { enum FacetCutAction {Add, Replace, Remove} // Add=0, Replace=1, Remove=2 struct FacetCut { address facetAddress; FacetCutAction action; bytes4[] functionSelectors; } /// @notice Add/replace/remove any number of functions and optionally execute /// a function with delegatecall /// @param _diamondCut Contains the facet addresses and function selectors /// @param _init The address of the contract or facet to execute _calldata /// @param _calldata A function call, including function selector and arguments /// _calldata is executed with delegatecall on _init function diamondCut( FacetCut[] calldata _diamondCut, address _init, bytes calldata _calldata ) external; event DiamondCut(FacetCut[] _diamondCut, address _init, bytes _calldata); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.17; /******************************************************************************\ * 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_); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.17; /******************************************************************************\ * Author: Nick Mudge <[email protected]> (https://twitter.com/mudgen) * EIP-2535 Diamonds: https://eips.ethereum.org/EIPS/eip-2535 /******************************************************************************/ import { IDiamondCut } from "../interfaces/IDiamondCut.sol"; // Remember to add the loupe functions from DiamondLoupeFacet to the diamond. // The loupe functions are required by the EIP2535 Diamonds standard library LibDiamond { bytes32 constant DIAMOND_STORAGE_POSITION = keccak256("diamond.standard.diamond.storage"); struct DiamondStorage { // maps function selectors to the facets that execute the functions. // and maps the selectors to their position in the selectorSlots array. // func selector => address facet, selector position mapping(bytes4 => bytes32) facets; // array of slots of function selectors. // each slot holds 8 function selectors. mapping(uint256 => bytes32) selectorSlots; // The number of function selectors in selectorSlots uint16 selectorCount; // Used to query if a contract implements an interface. // Used to implement ERC-165. mapping(bytes4 => bool) supportedInterfaces; // owner of the contract address contractOwner; } function diamondStorage() internal pure returns (DiamondStorage storage ds) { bytes32 position = DIAMOND_STORAGE_POSITION; assembly { ds.slot := position } } event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); function setContractOwner(address _newOwner) internal { DiamondStorage storage ds = diamondStorage(); address previousOwner = ds.contractOwner; ds.contractOwner = _newOwner; emit OwnershipTransferred(previousOwner, _newOwner); } function contractOwner() internal view returns (address contractOwner_) { contractOwner_ = diamondStorage().contractOwner; } function enforceIsContractOwner() internal view { require(msg.sender == diamondStorage().contractOwner, "LibDiamond: Must be contract owner"); } event DiamondCut(IDiamondCut.FacetCut[] _diamondCut, address _init, bytes _calldata); bytes32 constant CLEAR_ADDRESS_MASK = bytes32(uint256(0xffffffffffffffffffffffff)); bytes32 constant CLEAR_SELECTOR_MASK = bytes32(uint256(0xffffffff << 224)); // Internal function version of diamondCut // This code is almost the same as the external diamondCut, // except it is using 'Facet[] memory _diamondCut' instead of // 'Facet[] calldata _diamondCut'. // The code is duplicated to prevent copying calldata to memory which // causes an error for a two dimensional array. function diamondCut( IDiamondCut.FacetCut[] memory _diamondCut, address _init, bytes memory _calldata ) internal { DiamondStorage storage ds = diamondStorage(); uint256 originalSelectorCount = ds.selectorCount; uint256 selectorCount = originalSelectorCount; bytes32 selectorSlot; // Check if last selector slot is not full // "selectorCount & 7" is a gas efficient modulo by eight "selectorCount % 8" if (selectorCount & 7 > 0) { // get last selectorSlot // "selectorSlot >> 3" is a gas efficient division by 8 "selectorSlot / 8" selectorSlot = ds.selectorSlots[selectorCount >> 3]; } // loop through diamond cut for (uint256 facetIndex; facetIndex < _diamondCut.length; facetIndex++) { (selectorCount, selectorSlot) = addReplaceRemoveFacetSelectors( selectorCount, selectorSlot, _diamondCut[facetIndex].facetAddress, _diamondCut[facetIndex].action, _diamondCut[facetIndex].functionSelectors ); } if (selectorCount != originalSelectorCount) { ds.selectorCount = uint16(selectorCount); } // If last selector slot is not full // "selectorCount & 7" is a gas efficient modulo by eight "selectorCount % 8" if (selectorCount & 7 > 0) { // "selectorSlot >> 3" is a gas efficient division by 8 "selectorSlot / 8" ds.selectorSlots[selectorCount >> 3] = selectorSlot; } emit DiamondCut(_diamondCut, _init, _calldata); initializeDiamondCut(_init, _calldata); } function addReplaceRemoveFacetSelectors( uint256 _selectorCount, bytes32 _selectorSlot, address _newFacetAddress, IDiamondCut.FacetCutAction _action, bytes4[] memory _selectors ) internal returns (uint256, bytes32) { DiamondStorage storage ds = diamondStorage(); require(_selectors.length > 0, "LibDiamondCut: No selectors in facet to cut"); if (_action == IDiamondCut.FacetCutAction.Add) { enforceHasContractCode(_newFacetAddress, "LibDiamondCut: Add facet has no code"); for (uint256 selectorIndex; selectorIndex < _selectors.length; selectorIndex++) { bytes4 selector = _selectors[selectorIndex]; bytes32 oldFacet = ds.facets[selector]; require(address(bytes20(oldFacet)) == address(0), "LibDiamondCut: Can't add function that already exists"); // add facet for selector ds.facets[selector] = bytes20(_newFacetAddress) | bytes32(_selectorCount); // "_selectorCount & 7" is a gas efficient modulo by eight "_selectorCount % 8" // " << 5 is the same as multiplying by 32 ( * 32) uint256 selectorInSlotPosition = (_selectorCount & 7) << 5; // clear selector position in slot and add selector _selectorSlot = (_selectorSlot & ~(CLEAR_SELECTOR_MASK >> selectorInSlotPosition)) | (bytes32(selector) >> selectorInSlotPosition); // if slot is full then write it to storage if (selectorInSlotPosition == 224) { // "_selectorSlot >> 3" is a gas efficient division by 8 "_selectorSlot / 8" ds.selectorSlots[_selectorCount >> 3] = _selectorSlot; _selectorSlot = 0; } _selectorCount++; } } else if (_action == IDiamondCut.FacetCutAction.Replace) { enforceHasContractCode(_newFacetAddress, "LibDiamondCut: Replace facet has no code"); for (uint256 selectorIndex; selectorIndex < _selectors.length; selectorIndex++) { bytes4 selector = _selectors[selectorIndex]; bytes32 oldFacet = ds.facets[selector]; address oldFacetAddress = address(bytes20(oldFacet)); // only useful if immutable functions exist require(oldFacetAddress != address(this), "LibDiamondCut: Can't replace immutable function"); require(oldFacetAddress != _newFacetAddress, "LibDiamondCut: Can't replace function with same function"); require(oldFacetAddress != address(0), "LibDiamondCut: Can't replace function that doesn't exist"); // replace old facet address ds.facets[selector] = (oldFacet & CLEAR_ADDRESS_MASK) | bytes20(_newFacetAddress); } } else if (_action == IDiamondCut.FacetCutAction.Remove) { require(_newFacetAddress == address(0), "LibDiamondCut: Remove facet address must be address(0)"); // "_selectorCount >> 3" is a gas efficient division by 8 "_selectorCount / 8" uint256 selectorSlotCount = _selectorCount >> 3; // "_selectorCount & 7" is a gas efficient modulo by eight "_selectorCount % 8" uint256 selectorInSlotIndex = _selectorCount & 7; for (uint256 selectorIndex; selectorIndex < _selectors.length; selectorIndex++) { if (_selectorSlot == 0) { // get last selectorSlot selectorSlotCount--; _selectorSlot = ds.selectorSlots[selectorSlotCount]; selectorInSlotIndex = 7; } else { selectorInSlotIndex--; } bytes4 lastSelector; uint256 oldSelectorsSlotCount; uint256 oldSelectorInSlotPosition; // adding a block here prevents stack too deep error { bytes4 selector = _selectors[selectorIndex]; bytes32 oldFacet = ds.facets[selector]; require(address(bytes20(oldFacet)) != address(0), "LibDiamondCut: Can't remove function that doesn't exist"); // only useful if immutable functions exist require(address(bytes20(oldFacet)) != address(this), "LibDiamondCut: Can't remove immutable function"); // replace selector with last selector in ds.facets // gets the last selector // " << 5 is the same as multiplying by 32 ( * 32) lastSelector = bytes4(_selectorSlot << (selectorInSlotIndex << 5)); if (lastSelector != selector) { // update last selector slot position info ds.facets[lastSelector] = (oldFacet & CLEAR_ADDRESS_MASK) | bytes20(ds.facets[lastSelector]); } delete ds.facets[selector]; uint256 oldSelectorCount = uint16(uint256(oldFacet)); // "oldSelectorCount >> 3" is a gas efficient division by 8 "oldSelectorCount / 8" oldSelectorsSlotCount = oldSelectorCount >> 3; // "oldSelectorCount & 7" is a gas efficient modulo by eight "oldSelectorCount % 8" // " << 5 is the same as multiplying by 32 ( * 32) oldSelectorInSlotPosition = (oldSelectorCount & 7) << 5; } if (oldSelectorsSlotCount != selectorSlotCount) { bytes32 oldSelectorSlot = ds.selectorSlots[oldSelectorsSlotCount]; // clears the selector we are deleting and puts the last selector in its place. oldSelectorSlot = (oldSelectorSlot & ~(CLEAR_SELECTOR_MASK >> oldSelectorInSlotPosition)) | (bytes32(lastSelector) >> oldSelectorInSlotPosition); // update storage with the modified slot ds.selectorSlots[oldSelectorsSlotCount] = oldSelectorSlot; } else { // clears the selector we are deleting and puts the last selector in its place. _selectorSlot = (_selectorSlot & ~(CLEAR_SELECTOR_MASK >> oldSelectorInSlotPosition)) | (bytes32(lastSelector) >> oldSelectorInSlotPosition); } if (selectorInSlotIndex == 0) { delete ds.selectorSlots[selectorSlotCount]; _selectorSlot = 0; } } _selectorCount = selectorSlotCount * 8 + selectorInSlotIndex; } else { revert("LibDiamondCut: Incorrect FacetCutAction"); } return (_selectorCount, _selectorSlot); } function initializeDiamondCut(address _init, bytes memory _calldata) internal { if (_init == address(0)) { return; } enforceHasContractCode(_init, "LibDiamondCut: _init address has no code"); (bool success, bytes memory error) = _init.delegatecall(_calldata); if (!success) { if (error.length > 0) { // bubble up error /// @solidity memory-safe-assembly assembly { let returndata_size := mload(error) revert(add(32, error), returndata_size) } } else { revert("InitializationFunctionReverted(address, bytes)"); } } } function enforceHasContractCode(address _contract, string memory _errorMessage) internal view { uint256 contractSize; assembly { contractSize := extcodesize(_contract) } require(contractSize > 0, _errorMessage); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.17; /******************************************************************************\ * Author: Nick Mudge <[email protected]> (https://twitter.com/mudgen) * EIP-2535 Diamonds: https://eips.ethereum.org/EIPS/eip-2535 * * Implementation of a diamond. /******************************************************************************/ import {LibDiamond} from "../libraries/LibDiamond.sol"; import {IDiamondCut} from "../interfaces/IDiamondCut.sol"; contract Diamond { constructor(address _contractOwner, address _diamondCutFacet) payable { LibDiamond.setContractOwner(_contractOwner); // Add the diamondCut external function from the diamondCutFacet IDiamondCut.FacetCut[] memory cut = new IDiamondCut.FacetCut[](1); bytes4[] memory functionSelectors = new bytes4[](1); functionSelectors[0] = IDiamondCut.diamondCut.selector; cut[0] = IDiamondCut.FacetCut({ facetAddress: _diamondCutFacet, action: IDiamondCut.FacetCutAction.Add, functionSelectors: functionSelectors }); LibDiamond.diamondCut(cut, address(0), ""); } // Find facet for function that is called and execute the // function if a facet is found and return any value. fallback() external payable { LibDiamond.DiamondStorage storage ds; bytes32 position = LibDiamond.DIAMOND_STORAGE_POSITION; // get diamond storage assembly { ds.slot := position } // get facet from function selector address facet = address(bytes20(ds.facets[msg.sig])); require(facet != address(0), "Diamond: Function does not exist"); // Execute external function from facet using delegatecall and return any value. 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()) } } } // we define receive function in IrrigationDiamond // receive() external payable {} }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.17; import "@gnus.ai/contracts-upgradeable-diamond/contracts/proxy/utils/Initializable.sol"; import "@gnus.ai/contracts-upgradeable-diamond/contracts/proxy/utils/InitializableStorage.sol"; import "../libraries/LibDiamond.sol"; abstract contract EIP2535Initializable is Initializable { // override Initializable::initializer modifier modifier EIP2535Initializer() { require(!InitializableStorage.layout()._initializing && InitializableStorage.layout()._initialized < 1, "Initializable: contract is already initialized"); InitializableStorage.layout()._initialized = 1; InitializableStorage.layout()._initializing = true; _; // multiple facet contracts needed initialization on deployment InitializableStorage.layout()._initialized = 0; InitializableStorage.layout()._initializing = false; } modifier EIP2535Reinitializer(uint8 version) { require(!InitializableStorage.layout()._initializing && InitializableStorage.layout()._initialized < version, "Initializable: contract is already initialized"); InitializableStorage.layout()._initialized = version; InitializableStorage.layout()._initializing = true; _; // multiple facet contracts needed re-initialization on ugrades for instance InitializableStorage.layout()._initialized = 0; InitializableStorage.layout()._initializing = false; } }
{ "metadata": { "bytecodeHash": "none" }, "optimizer": { "enabled": true, "runs": 1000 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_contractOwner","type":"address"},{"internalType":"address","name":"_diamondCutFacet","type":"address"}],"stateMutability":"payable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"stateMutability":"payable","type":"fallback"},{"inputs":[{"internalType":"uint8","name":"version","type":"uint8"}],"name":"FinalReinitialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"FinalizeInitialization","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
6080604052604051620025d2380380620025d283398101604081905262000026916200100b565b81816200003e826200032a60201b6200030a1760201c565b604080516001808252818301909252600091816020015b60408051606080820183526000808352602083015291810191909152815260200190600190039081620000555750506040805160018082528183019092529192506000919060208083019080368337019050509050631f931c1c60e01b81600081518110620000c857620000c862001043565b6001600160e01b031990921660209283029190910182015260408051606081019091526001600160a01b03851681529081016000815260200182815250826000815181106200011b576200011b62001043565b60200260200101819052506200014e82600060405180602001604052806000815250620003ae60201b620003b71760201c565b50505050620001676200053b60201b620005391760201c565b54610100900460ff161580156200019657506001620001906200053b60201b620005391760201c565b5460ff16105b620001ff5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b6001620002166200053b60201b620005391760201c565b60000160006101000a81548160ff021916908360ff1602179055506001620002486200053b60201b620005391760201c565b80549115156101000261ff0019909216919091179055620002686200055f565b6200027a6301ffc9a760e01b620005e1565b6200028c6336372b0760e01b620005e1565b6200029e636cdb3d1360e11b620005e1565b620002b06307e4c70760e21b620005e1565b620002c26348e2b09360e01b620005e1565b6000620002d96200053b60201b620005391760201c565b60000160006101000a81548160ff021916908360ff16021790555060006200030b6200053b60201b620005391760201c565b80549115156101000261ff001990921691909117905550620012869050565b7fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c132080546001600160a01b031981166001600160a01b038481169182179093556040516000805160206200253e833981519152939092169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3505050565b7fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131e546000805160206200253e8339815191529061ffff8116908190600090600716156200040d5750600381901c60009081526001840160205260409020545b60005b8751811015620004a9576200048f83838a848151811062000435576200043562001043565b6020026020010151600001518b858151811062000456576200045662001043565b6020026020010151602001518c868151811062000477576200047762001043565b6020026020010151604001516200068260201b60201c565b909350915080620004a08162001085565b91505062000410565b50828214620004c65760028401805461ffff191661ffff84161790555b6007821615620004e957600382901c600090815260018501602052604090208190555b7f8faa70878671ccd212d20771b795c50af8fd3ff6cf27f4bde57e5d4de0aeb6738787876040516200051e93929190620010f5565b60405180910390a162000532868662000e8d565b50505050505050565b7f706f5b3610458a854faedcfccda0d32d725b0f3daa90cb330f41cc280a9715ca90565b620005746200053b60201b620005391760201c565b54610100900460ff16620005df5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401620001f6565b565b6001600160e01b031980821690036200063d5760405162461bcd60e51b815260206004820152601c60248201527f4552433136353a20696e76616c696420696e74657266616365206964000000006044820152606401620001f6565b60016200065462000fa660201b6200055d1760201c565b6001600160e01b03199290921660009081526020929092526040909120805460ff1916911515919091179055565b600080806000805160206200253e83398151915290506000845111620006ff5760405162461bcd60e51b815260206004820152602b60248201527f4c69624469616d6f6e644375743a204e6f2073656c6563746f727320696e206660448201526a1858d95d081d1bc818dd5d60aa1b6064820152608401620001f6565b600085600281111562000716576200071662001059565b036200089c5762000741866040518060600160405280602481526020016200255e6024913962000fca565b60005b84518110156200089557600085828151811062000765576200076562001043565b6020908102919091018101516001600160e01b03198116600090815291859052604090912054909150606081901c15620008085760405162461bcd60e51b815260206004820152603560248201527f4c69624469616d6f6e644375743a2043616e2774206164642066756e6374696f60448201527f6e207468617420616c72656164792065786973747300000000000000000000006064820152608401620001f6565b6001600160e01b031980831660008181526020879052604090206001600160601b031960608d901b168e17905560e060058e901b811692831c199c909c1690821c179a8190036200086d5760038c901c600090815260018601602052604081209b909b555b8b620008798162001085565b9c505050505080806200088c9062001085565b91505062000744565b5062000e81565b6001856002811115620008b357620008b362001059565b0362000acc57620008de86604051806060016040528060288152602001620025aa6028913962000fca565b60005b84518110156200089557600085828151811062000902576200090262001043565b6020908102919091018101516001600160e01b03198116600090815291859052604090912054909150606081901c308103620009995760405162461bcd60e51b815260206004820152602f60248201527f4c69624469616d6f6e644375743a2043616e2774207265706c61636520696d6d60448201526e3aba30b1363290333ab731ba34b7b760891b6064820152608401620001f6565b896001600160a01b0316816001600160a01b03160362000a115760405162461bcd60e51b815260206004820152603860248201526000805160206200251e83398151915260448201527f6374696f6e20776974682073616d652066756e6374696f6e00000000000000006064820152608401620001f6565b6001600160a01b03811662000a7e5760405162461bcd60e51b815260206004820152603860248201526000805160206200251e83398151915260448201527f6374696f6e207468617420646f65736e277420657869737400000000000000006064820152608401620001f6565b506001600160e01b031990911660009081526020849052604090206001600160601b03919091166001600160601b031960608a901b161790558062000ac38162001085565b915050620008e1565b600285600281111562000ae35762000ae362001059565b0362000e28576001600160a01b0386161562000b685760405162461bcd60e51b815260206004820152603660248201527f4c69624469616d6f6e644375743a2052656d6f7665206661636574206164647260448201527f657373206d7573742062652061646472657373283029000000000000000000006064820152608401620001f6565b600388901c6007891660005b865181101562000e035760008a900362000bb5578262000b9481620011fc565b60008181526001870160205260409020549b5093506007925062000bc59050565b8162000bc181620011fc565b9250505b6000806000808a858151811062000be05762000be062001043565b6020908102919091018101516001600160e01b031981166000908152918a9052604090912054909150606081901c62000c825760405162461bcd60e51b815260206004820152603760248201527f4c69624469616d6f6e644375743a2043616e27742072656d6f76652066756e6360448201527f74696f6e207468617420646f65736e27742065786973740000000000000000006064820152608401620001f6565b30606082901c0362000cee5760405162461bcd60e51b815260206004820152602e60248201527f4c69624469616d6f6e644375743a2043616e27742072656d6f766520696d6d7560448201526d3a30b1363290333ab731ba34b7b760911b6064820152608401620001f6565b600587901b8f901b94506001600160e01b03198086169083161462000d40576001600160e01b03198516600090815260208a90526040902080546001600160601b0319166001600160601b0383161790555b6001600160e01b031991909116600090815260208990526040812055600381901c611fff16925060051b60e016905085821462000da7576000828152600188016020526040902080546001600160e01b031980841c19909116908516831c17905562000dcb565b80836001600160e01b031916901c816001600160e01b031960001b901c198e16179c505b8460000362000dea57600086815260018801602052604081208190559c505b505050808062000dfa9062001085565b91505062000b74565b508062000e1283600862001216565b62000e1e919062001236565b9950505062000e81565b60405162461bcd60e51b815260206004820152602760248201527f4c69624469616d6f6e644375743a20496e636f727265637420466163657443756044820152663a20b1ba34b7b760c91b6064820152608401620001f6565b50959694955050505050565b6001600160a01b03821662000ea0575050565b62000ec582604051806060016040528060288152602001620025826028913962000fca565b600080836001600160a01b03168360405162000ee291906200124c565b600060405180830381855af49150503d806000811462000f1f576040519150601f19603f3d011682016040523d82523d6000602084013e62000f24565b606091505b50915091508162000fa05780511562000f405780518082602001fd5b60405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a6174696f6e46756e6374696f6e5265766572746564286160448201526d6464726573732c2062797465732960901b6064820152608401620001f6565b50505050565b7fba2591e86e61ce57126ae72de8a76260fdb9f0fdec3f5523d3adba752f420e4b90565b813b818162000fa05760405162461bcd60e51b8152600401620001f691906200126a565b80516001600160a01b03811681146200100657600080fd5b919050565b600080604083850312156200101f57600080fd5b6200102a8362000fee565b91506200103a6020840162000fee565b90509250929050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600182016200109a576200109a6200106f565b5060010190565b60005b83811015620010be578181015183820152602001620010a4565b50506000910152565b60008151808452620010e1816020860160208601620010a1565b601f01601f19169290920160200192915050565b60006060808301818452808751808352608092508286019150828160051b8701016020808b0160005b84811015620011ca57898403607f19018652815180516001600160a01b031685528381015189860190600381106200116657634e487b7160e01b600052602160045260246000fd5b868601526040918201519186018a905281519081905290840190600090898701905b80831015620011b45783516001600160e01b031916825292860192600192909201919086019062001188565b509785019795505050908201906001016200111e565b50506001600160a01b038a16908801528681036040880152620011ee8189620010c7565b9a9950505050505050505050565b6000816200120e576200120e6200106f565b506000190190565b80820281158282048414176200123057620012306200106f565b92915050565b808201808211156200123057620012306200106f565b6000825162001260818460208701620010a1565b9190910192915050565b6020815260006200127f6020830184620010c7565b9392505050565b61128880620012966000396000f3fe6080604052600436106100385760003560e01c806301ffc9a7146100f85780631e3fd6ae1461012c5780636a8ae6ac1461014c5761003f565b3661003f57005b600080356001600160e01b03191681527fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131c6020819052604090912054819060601c806100d25760405162461bcd60e51b815260206004820181905260248201527f4469616d6f6e643a2046756e6374696f6e20646f6573206e6f7420657869737460448201526064015b60405180910390fd5b3660008037600080366000845af43d6000803e8080156100f1573d6000f35b3d6000fd5b005b34801561010457600080fd5b50610118610113366004610f99565b610161565b604051901515815260200160405180910390f35b34801561013857600080fd5b506100f6610147366004610fca565b6101b5565b34801561015857600080fd5b506100f6610263565b600061016c82610581565b806101af57506001600160e01b0319821660009081527fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131f602052604090205460ff165b92915050565b7fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c1320546001600160a01b0316331461022e5760405162461bcd60e51b815260206004820152601760248201527f4f6e6c7920537570657241646d696e20616c6c6f77656400000000000000000060448201526064016100c9565b7f706f5b3610458a854faedcfccda0d32d725b0f3daa90cb330f41cc280a9715ca805460ff191660ff92909216919091179055565b7fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c1320546001600160a01b031633146102dc5760405162461bcd60e51b815260206004820152601760248201527f4f6e6c7920537570657241646d696e20616c6c6f77656400000000000000000060448201526064016100c9565b7f706f5b3610458a854faedcfccda0d32d725b0f3daa90cb330f41cc280a9715ca805460ff19166001179055565b7fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c132080547fffffffffffffffffffffffff000000000000000000000000000000000000000081166001600160a01b038481169182179093556040517fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131c939092169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3505050565b7fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131e547fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131c9061ffff8116908190600090600716156104265750600381901c60009081526001840160205260409020545b60005b87518110156104ad5761049683838a848151811061044957610449610fed565b6020026020010151600001518b858151811061046757610467610fed565b6020026020010151602001518c868151811061048557610485610fed565b6020026020010151604001516105f5565b9093509150806104a581611019565b915050610429565b508282146104c95760028401805461ffff191661ffff84161790555b60078216156104eb57600382901c600090815260018501602052604090208190555b7f8faa70878671ccd212d20771b795c50af8fd3ff6cf27f4bde57e5d4de0aeb67387878760405161051e93929190611098565b60405180910390a16105308686610e5b565b50505050505050565b7f706f5b3610458a854faedcfccda0d32d725b0f3daa90cb330f41cc280a9715ca90565b7fba2591e86e61ce57126ae72de8a76260fdb9f0fdec3f5523d3adba752f420e4b90565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b0319831614806101af5750506001600160e01b03191660009081527fba2591e86e61ce57126ae72de8a76260fdb9f0fdec3f5523d3adba752f420e4b602052604090205460ff1690565b600080807fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131c905060008451116106935760405162461bcd60e51b815260206004820152602b60248201527f4c69624469616d6f6e644375743a204e6f2073656c6563746f727320696e206660448201527f6163657420746f2063757400000000000000000000000000000000000000000060648201526084016100c9565b60008560028111156106a7576106a7611032565b03610821576106ce8660405180606001604052806024815260200161120860249139610f78565b60005b845181101561081b5760008582815181106106ee576106ee610fed565b6020908102919091018101516001600160e01b03198116600090815291859052604090912054909150606081901c1561078f5760405162461bcd60e51b815260206004820152603560248201527f4c69624469616d6f6e644375743a2043616e2774206164642066756e6374696f60448201527f6e207468617420616c726561647920657869737473000000000000000000000060648201526084016100c9565b6001600160e01b031980831660008181526020879052604090206bffffffffffffffffffffffff1960608d901b168e17905560e060058e901b811692831c199c909c1690821c179a8190036107f85760038c901c600090815260018601602052604081209b909b555b8b61080281611019565b9c5050505050808061081390611019565b9150506106d1565b50610e4f565b600185600281111561083557610835611032565b03610a775761085c8660405180606001604052806028815260200161125460289139610f78565b60005b845181101561081b57600085828151811061087c5761087c610fed565b6020908102919091018101516001600160e01b03198116600090815291859052604090912054909150606081901c30810361091f5760405162461bcd60e51b815260206004820152602f60248201527f4c69624469616d6f6e644375743a2043616e2774207265706c61636520696d6d60448201527f757461626c652066756e6374696f6e000000000000000000000000000000000060648201526084016100c9565b896001600160a01b0316816001600160a01b0316036109a65760405162461bcd60e51b815260206004820152603860248201527f4c69624469616d6f6e644375743a2043616e2774207265706c6163652066756e60448201527f6374696f6e20776974682073616d652066756e6374696f6e000000000000000060648201526084016100c9565b6001600160a01b038116610a225760405162461bcd60e51b815260206004820152603860248201527f4c69624469616d6f6e644375743a2043616e2774207265706c6163652066756e60448201527f6374696f6e207468617420646f65736e2774206578697374000000000000000060648201526084016100c9565b506001600160e01b031990911660009081526020849052604090206bffffffffffffffffffffffff919091166bffffffffffffffffffffffff1960608a901b1617905580610a6f81611019565b91505061085f565b6002856002811115610a8b57610a8b611032565b03610de1576001600160a01b03861615610b0d5760405162461bcd60e51b815260206004820152603660248201527f4c69624469616d6f6e644375743a2052656d6f7665206661636574206164647260448201527f657373206d75737420626520616464726573732830290000000000000000000060648201526084016100c9565b600388901c6007891660005b8651811015610dc15760008a9003610b555782610b3581611197565b60008181526001870160205260409020549b50935060079250610b639050565b81610b5f81611197565b9250505b6000806000808a8581518110610b7b57610b7b610fed565b6020908102919091018101516001600160e01b031981166000908152918a9052604090912054909150606081901c610c1b5760405162461bcd60e51b815260206004820152603760248201527f4c69624469616d6f6e644375743a2043616e27742072656d6f76652066756e6360448201527f74696f6e207468617420646f65736e277420657869737400000000000000000060648201526084016100c9565b30606082901c03610c945760405162461bcd60e51b815260206004820152602e60248201527f4c69624469616d6f6e644375743a2043616e27742072656d6f766520696d6d7560448201527f7461626c652066756e6374696f6e00000000000000000000000000000000000060648201526084016100c9565b600587901b8f901b94506001600160e01b031980861690831614610cef576001600160e01b03198516600090815260208a90526040902080546bffffffffffffffffffffffff19166bffffffffffffffffffffffff83161790555b6001600160e01b031991909116600090815260208990526040812055600381901c611fff16925060051b60e0169050858214610d54576000828152600188016020526040902080546001600160e01b031980841c19909116908516831c179055610d8d565b80837bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916901c816001600160e01b031960001b901c198e16179c505b84600003610dab57600086815260018801602052604081208190559c505b5050508080610db990611019565b915050610b19565b5080610dce8360086111ae565b610dd891906111c5565b99505050610e4f565b60405162461bcd60e51b815260206004820152602760248201527f4c69624469616d6f6e644375743a20496e636f7272656374204661636574437560448201527f74416374696f6e0000000000000000000000000000000000000000000000000060648201526084016100c9565b50959694955050505050565b6001600160a01b038216610e6d575050565b610e8f8260405180606001604052806028815260200161122c60289139610f78565b600080836001600160a01b031683604051610eaa91906111d8565b600060405180830381855af49150503d8060008114610ee5576040519150601f19603f3d011682016040523d82523d6000602084013e610eea565b606091505b509150915081610f7257805115610f045780518082602001fd5b60405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a6174696f6e46756e6374696f6e5265766572746564286160448201527f6464726573732c2062797465732900000000000000000000000000000000000060648201526084016100c9565b50505050565b813b8181610f725760405162461bcd60e51b81526004016100c991906111f4565b600060208284031215610fab57600080fd5b81356001600160e01b031981168114610fc357600080fd5b9392505050565b600060208284031215610fdc57600080fd5b813560ff81168114610fc357600080fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006001820161102b5761102b611003565b5060010190565b634e487b7160e01b600052602160045260246000fd5b60005b8381101561106357818101518382015260200161104b565b50506000910152565b60008151808452611084816020860160208601611048565b601f01601f19169290920160200192915050565b60006060808301818452808751808352608092508286019150828160051b8701016020808b0160005b8481101561116757607f198a850301865281518885016001600160a01b038251168652848201516003811061110657634e487b7160e01b600052602160045260246000fd5b868601526040918201519186018a905281519081905290840190600090898701905b808310156111525783516001600160e01b0319168252928601926001929092019190860190611128565b509785019795505050908201906001016110c1565b50506001600160a01b038a16908801528681036040880152611189818961106c565b9a9950505050505050505050565b6000816111a6576111a6611003565b506000190190565b80820281158282048414176101af576101af611003565b808201808211156101af576101af611003565b600082516111ea818460208701611048565b9190910192915050565b602081526000610fc3602083018461106c56fe4c69624469616d6f6e644375743a2041646420666163657420686173206e6f20636f64654c69624469616d6f6e644375743a205f696e6974206164647265737320686173206e6f20636f64654c69624469616d6f6e644375743a205265706c61636520666163657420686173206e6f20636f6465a164736f6c6343000811000a4c69624469616d6f6e644375743a2043616e2774207265706c6163652066756ec8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131c4c69624469616d6f6e644375743a2041646420666163657420686173206e6f20636f64654c69624469616d6f6e644375743a205f696e6974206164647265737320686173206e6f20636f64654c69624469616d6f6e644375743a205265706c61636520666163657420686173206e6f20636f64650000000000000000000000009249e360dc6f4d2871187acde4fe38d4e13a770300000000000000000000000035ea7aa2b9706a05cc932a7350a5e5a7d80619bf
Deployed Bytecode
0x6080604052600436106100385760003560e01c806301ffc9a7146100f85780631e3fd6ae1461012c5780636a8ae6ac1461014c5761003f565b3661003f57005b600080356001600160e01b03191681527fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131c6020819052604090912054819060601c806100d25760405162461bcd60e51b815260206004820181905260248201527f4469616d6f6e643a2046756e6374696f6e20646f6573206e6f7420657869737460448201526064015b60405180910390fd5b3660008037600080366000845af43d6000803e8080156100f1573d6000f35b3d6000fd5b005b34801561010457600080fd5b50610118610113366004610f99565b610161565b604051901515815260200160405180910390f35b34801561013857600080fd5b506100f6610147366004610fca565b6101b5565b34801561015857600080fd5b506100f6610263565b600061016c82610581565b806101af57506001600160e01b0319821660009081527fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131f602052604090205460ff165b92915050565b7fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c1320546001600160a01b0316331461022e5760405162461bcd60e51b815260206004820152601760248201527f4f6e6c7920537570657241646d696e20616c6c6f77656400000000000000000060448201526064016100c9565b7f706f5b3610458a854faedcfccda0d32d725b0f3daa90cb330f41cc280a9715ca805460ff191660ff92909216919091179055565b7fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c1320546001600160a01b031633146102dc5760405162461bcd60e51b815260206004820152601760248201527f4f6e6c7920537570657241646d696e20616c6c6f77656400000000000000000060448201526064016100c9565b7f706f5b3610458a854faedcfccda0d32d725b0f3daa90cb330f41cc280a9715ca805460ff19166001179055565b7fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c132080547fffffffffffffffffffffffff000000000000000000000000000000000000000081166001600160a01b038481169182179093556040517fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131c939092169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3505050565b7fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131e547fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131c9061ffff8116908190600090600716156104265750600381901c60009081526001840160205260409020545b60005b87518110156104ad5761049683838a848151811061044957610449610fed565b6020026020010151600001518b858151811061046757610467610fed565b6020026020010151602001518c868151811061048557610485610fed565b6020026020010151604001516105f5565b9093509150806104a581611019565b915050610429565b508282146104c95760028401805461ffff191661ffff84161790555b60078216156104eb57600382901c600090815260018501602052604090208190555b7f8faa70878671ccd212d20771b795c50af8fd3ff6cf27f4bde57e5d4de0aeb67387878760405161051e93929190611098565b60405180910390a16105308686610e5b565b50505050505050565b7f706f5b3610458a854faedcfccda0d32d725b0f3daa90cb330f41cc280a9715ca90565b7fba2591e86e61ce57126ae72de8a76260fdb9f0fdec3f5523d3adba752f420e4b90565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b0319831614806101af5750506001600160e01b03191660009081527fba2591e86e61ce57126ae72de8a76260fdb9f0fdec3f5523d3adba752f420e4b602052604090205460ff1690565b600080807fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131c905060008451116106935760405162461bcd60e51b815260206004820152602b60248201527f4c69624469616d6f6e644375743a204e6f2073656c6563746f727320696e206660448201527f6163657420746f2063757400000000000000000000000000000000000000000060648201526084016100c9565b60008560028111156106a7576106a7611032565b03610821576106ce8660405180606001604052806024815260200161120860249139610f78565b60005b845181101561081b5760008582815181106106ee576106ee610fed565b6020908102919091018101516001600160e01b03198116600090815291859052604090912054909150606081901c1561078f5760405162461bcd60e51b815260206004820152603560248201527f4c69624469616d6f6e644375743a2043616e2774206164642066756e6374696f60448201527f6e207468617420616c726561647920657869737473000000000000000000000060648201526084016100c9565b6001600160e01b031980831660008181526020879052604090206bffffffffffffffffffffffff1960608d901b168e17905560e060058e901b811692831c199c909c1690821c179a8190036107f85760038c901c600090815260018601602052604081209b909b555b8b61080281611019565b9c5050505050808061081390611019565b9150506106d1565b50610e4f565b600185600281111561083557610835611032565b03610a775761085c8660405180606001604052806028815260200161125460289139610f78565b60005b845181101561081b57600085828151811061087c5761087c610fed565b6020908102919091018101516001600160e01b03198116600090815291859052604090912054909150606081901c30810361091f5760405162461bcd60e51b815260206004820152602f60248201527f4c69624469616d6f6e644375743a2043616e2774207265706c61636520696d6d60448201527f757461626c652066756e6374696f6e000000000000000000000000000000000060648201526084016100c9565b896001600160a01b0316816001600160a01b0316036109a65760405162461bcd60e51b815260206004820152603860248201527f4c69624469616d6f6e644375743a2043616e2774207265706c6163652066756e60448201527f6374696f6e20776974682073616d652066756e6374696f6e000000000000000060648201526084016100c9565b6001600160a01b038116610a225760405162461bcd60e51b815260206004820152603860248201527f4c69624469616d6f6e644375743a2043616e2774207265706c6163652066756e60448201527f6374696f6e207468617420646f65736e2774206578697374000000000000000060648201526084016100c9565b506001600160e01b031990911660009081526020849052604090206bffffffffffffffffffffffff919091166bffffffffffffffffffffffff1960608a901b1617905580610a6f81611019565b91505061085f565b6002856002811115610a8b57610a8b611032565b03610de1576001600160a01b03861615610b0d5760405162461bcd60e51b815260206004820152603660248201527f4c69624469616d6f6e644375743a2052656d6f7665206661636574206164647260448201527f657373206d75737420626520616464726573732830290000000000000000000060648201526084016100c9565b600388901c6007891660005b8651811015610dc15760008a9003610b555782610b3581611197565b60008181526001870160205260409020549b50935060079250610b639050565b81610b5f81611197565b9250505b6000806000808a8581518110610b7b57610b7b610fed565b6020908102919091018101516001600160e01b031981166000908152918a9052604090912054909150606081901c610c1b5760405162461bcd60e51b815260206004820152603760248201527f4c69624469616d6f6e644375743a2043616e27742072656d6f76652066756e6360448201527f74696f6e207468617420646f65736e277420657869737400000000000000000060648201526084016100c9565b30606082901c03610c945760405162461bcd60e51b815260206004820152602e60248201527f4c69624469616d6f6e644375743a2043616e27742072656d6f766520696d6d7560448201527f7461626c652066756e6374696f6e00000000000000000000000000000000000060648201526084016100c9565b600587901b8f901b94506001600160e01b031980861690831614610cef576001600160e01b03198516600090815260208a90526040902080546bffffffffffffffffffffffff19166bffffffffffffffffffffffff83161790555b6001600160e01b031991909116600090815260208990526040812055600381901c611fff16925060051b60e0169050858214610d54576000828152600188016020526040902080546001600160e01b031980841c19909116908516831c179055610d8d565b80837bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916901c816001600160e01b031960001b901c198e16179c505b84600003610dab57600086815260018801602052604081208190559c505b5050508080610db990611019565b915050610b19565b5080610dce8360086111ae565b610dd891906111c5565b99505050610e4f565b60405162461bcd60e51b815260206004820152602760248201527f4c69624469616d6f6e644375743a20496e636f7272656374204661636574437560448201527f74416374696f6e0000000000000000000000000000000000000000000000000060648201526084016100c9565b50959694955050505050565b6001600160a01b038216610e6d575050565b610e8f8260405180606001604052806028815260200161122c60289139610f78565b600080836001600160a01b031683604051610eaa91906111d8565b600060405180830381855af49150503d8060008114610ee5576040519150601f19603f3d011682016040523d82523d6000602084013e610eea565b606091505b509150915081610f7257805115610f045780518082602001fd5b60405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a6174696f6e46756e6374696f6e5265766572746564286160448201527f6464726573732c2062797465732900000000000000000000000000000000000060648201526084016100c9565b50505050565b813b8181610f725760405162461bcd60e51b81526004016100c991906111f4565b600060208284031215610fab57600080fd5b81356001600160e01b031981168114610fc357600080fd5b9392505050565b600060208284031215610fdc57600080fd5b813560ff81168114610fc357600080fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006001820161102b5761102b611003565b5060010190565b634e487b7160e01b600052602160045260246000fd5b60005b8381101561106357818101518382015260200161104b565b50506000910152565b60008151808452611084816020860160208601611048565b601f01601f19169290920160200192915050565b60006060808301818452808751808352608092508286019150828160051b8701016020808b0160005b8481101561116757607f198a850301865281518885016001600160a01b038251168652848201516003811061110657634e487b7160e01b600052602160045260246000fd5b868601526040918201519186018a905281519081905290840190600090898701905b808310156111525783516001600160e01b0319168252928601926001929092019190860190611128565b509785019795505050908201906001016110c1565b50506001600160a01b038a16908801528681036040880152611189818961106c565b9a9950505050505050505050565b6000816111a6576111a6611003565b506000190190565b80820281158282048414176101af576101af611003565b808201808211156101af576101af611003565b600082516111ea818460208701611048565b9190910192915050565b602081526000610fc3602083018461106c56fe4c69624469616d6f6e644375743a2041646420666163657420686173206e6f20636f64654c69624469616d6f6e644375743a205f696e6974206164647265737320686173206e6f20636f64654c69624469616d6f6e644375743a205265706c61636520666163657420686173206e6f20636f6465a164736f6c6343000811000a
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000009249e360dc6f4d2871187acde4fe38d4e13a770300000000000000000000000035ea7aa2b9706a05cc932a7350a5e5a7d80619bf
-----Decoded View---------------
Arg [0] : _contractOwner (address): 0x9249E360Dc6f4D2871187acDE4Fe38D4e13a7703
Arg [1] : _diamondCutFacet (address): 0x35ea7aa2b9706A05CC932a7350a5E5A7D80619BF
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 0000000000000000000000009249e360dc6f4d2871187acde4fe38d4e13a7703
Arg [1] : 00000000000000000000000035ea7aa2b9706a05cc932a7350a5e5a7d80619bf
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.