Feature Tip: Add private address tag to any address under My Name Tag !
ERC-721
Overview
Max Total Supply
489 NPC
Holders
237
Market
Volume (24H)
N/A
Min Price (24H)
N/A
Max Price (24H)
N/A
Other Info
Token Contract
Balance
1 NPCLoading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Name:
UniversalProxy
Compiler Version
v0.8.17+commit.8df45f5f
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
//SPDX-License-Identifier: GPL-3.0 // Creator: Metalist Labs pragma solidity ^0.8.0; import "./lib/ProxyOwnable.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/proxy/Proxy.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; /// @notice 通用代理合约 /// @dev 升级约束:新版本合约只可以在上一版本合约的基础上增加数据,且声明顺序必须位于原有数据的后面。 contract UniversalProxy is Proxy, ProxyOwnable { using Address for address; /// @dev 实际业务实现的地址位置,采用这种方式,是为了不被被代理合约中本身的数据覆盖 bytes32 private constant _IMPLEMENT_ADDRESS_POSITION = keccak256("Gaas.impl.address.84c2ce47"); /// @dev 实际存储Owner的位置 bytes32 private constant _OWNER_POSITION = keccak256("Gaas-Proxy.owner.7e2efd65"); /// @dev 设置被代理的合约地址, 仅owner调用 function setImplementAddress(address nft)public onlyProxyOwner { require(nft.isContract(), "ADDRESS SHOULD BE CONTRACT"); bytes32 position = _IMPLEMENT_ADDRESS_POSITION; assembly { sstore(position, nft) } } /// @dev 返回被代理的合约地址 function getImplementAddress() public view returns (address) { return _implementation(); } /// @dev 重载该函数,返回被代理的合约地址 function _implementation() internal view virtual override returns (address) { bytes32 position = _IMPLEMENT_ADDRESS_POSITION; address impl; assembly { impl := sload(position) } return impl; } /// @dev 存储owner function _storeProxyOwner(address _owner) internal override { bytes32 position = _OWNER_POSITION; assembly { sstore(position, _owner) } } /// @dev 读取owner function _loadProxyOwner() internal view override returns (address) { bytes32 position = _OWNER_POSITION; address _owner; assembly { _owner := sload(position) } return _owner; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol) pragma solidity ^0.8.0; /** * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to * be specified by overriding the virtual {_implementation} function. * * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a * different contract through the {_delegate} function. * * The success and return data of the delegated call will be returned back to the caller of the proxy. */ abstract contract Proxy { /** * @dev Delegates the current call to `implementation`. * * This function does not return to its internal call site, it will return directly to the external caller. */ function _delegate(address implementation) internal virtual { assembly { // Copy msg.data. We take full control of memory in this inline assembly // block because it will not return to Solidity code. We overwrite the // Solidity scratch pad at memory position 0. calldatacopy(0, 0, calldatasize()) // Call the implementation. // out and outsize are 0 because we don't know the size yet. let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0) // Copy the returned data. returndatacopy(0, 0, returndatasize()) switch result // delegatecall returns 0 on error. case 0 { revert(0, returndatasize()) } default { return(0, returndatasize()) } } } /** * @dev This is a virtual function that should be overridden so it returns the address to which the fallback function * and {_fallback} should delegate. */ function _implementation() internal view virtual returns (address); /** * @dev Delegates the current call to the address returned by `_implementation()`. * * This function does not return to its internal call site, it will return directly to the external caller. */ function _fallback() internal virtual { _beforeFallback(); _delegate(_implementation()); } /** * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other * function in the contract matches the call data. */ fallback() external payable virtual { _fallback(); } /** * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data * is empty. */ receive() external payable virtual { _fallback(); } /** * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback` * call, or as part of the Solidity `fallback` or `receive` functions. * * If overridden should call `super._beforeFallback()`. */ function _beforeFallback() internal virtual {} }
// 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 Address { /** * @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 Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(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 // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/Ownable.sol) pragma solidity ^0.8.0; import "@openzeppelin/contracts/utils/Context.sol"; /// @dev 代理合约使用owner权限管理库,函数名和被代理合约区分开来 abstract contract ProxyOwnable is Context { event ProxyOwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferProxyOwnership(_msgSender()); } /** * @dev Returns the address of the current owner. */ function proxyOwner() public view returns (address) { return _loadProxyOwner(); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyProxyOwner() { require(proxyOwner() == _msgSender(), "ProxyOwnable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceProxyOwnership() public virtual onlyProxyOwner { _transferProxyOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferProxyOwnership(address newOwner) public virtual onlyProxyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferProxyOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferProxyOwnership(address newOwner) internal virtual { address oldOwner = _loadProxyOwner(); _storeProxyOwner(newOwner); emit ProxyOwnershipTransferred(oldOwner, newOwner); } /// @dev 存储owner function _storeProxyOwner(address owner) internal virtual; /// @dev 读取owner function _loadProxyOwner() internal view virtual returns (address); }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"ProxyOwnershipTransferred","type":"event"},{"stateMutability":"payable","type":"fallback"},{"inputs":[],"name":"getImplementAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"proxyOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceProxyOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"nft","type":"address"}],"name":"setImplementAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferProxyOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
608060405234801561001057600080fd5b5061001a3361001f565b610093565b60006100376000805160206105208339815191525490565b905061004f8260008051602061052083398151915255565b816001600160a01b0316816001600160a01b03167f5a3e66efaa1e445ebd894728a69d6959842ea1e97bd79b892797106e270efcd960405160405180910390a35050565b61047e806100a26000396000f3fe60806040526004361061004e5760003560e01c8063025313a21461006557806310b2b981146100965780633d643cbe146100ab578063afe13fbc146100cb578063f1739cae146100e05761005d565b3661005d5761005b610100565b005b61005b610100565b34801561007157600080fd5b5061007a610132565b6040516001600160a01b03909116815260200160405180910390f35b3480156100a257600080fd5b5061007a610161565b3480156100b757600080fd5b5061005b6100c63660046103d3565b61018b565b3480156100d757600080fd5b5061005b61023e565b3480156100ec57600080fd5b5061005b6100fb3660046103d3565b610277565b61013061012b7f7a0f004813afd0c6ff6cc86d1e44688ffea125ec5615c65b9122b0d6f96c4bfb5490565b610317565b565b600061015c7f343ac7c562d22652d4428c979fa0f51b7d6a0af6ec7f1069d628afdccff468ba5490565b905090565b600061015c7f7a0f004813afd0c6ff6cc86d1e44688ffea125ec5615c65b9122b0d6f96c4bfb5490565b33610194610132565b6001600160a01b0316146101c35760405162461bcd60e51b81526004016101ba90610403565b60405180910390fd5b6001600160a01b0381163b61021a5760405162461bcd60e51b815260206004820152601a60248201527f414444524553532053484f554c4420424520434f4e545241435400000000000060448201526064016101ba565b7f7a0f004813afd0c6ff6cc86d1e44688ffea125ec5615c65b9122b0d6f96c4bfb55565b33610247610132565b6001600160a01b03161461026d5760405162461bcd60e51b81526004016101ba90610403565b610130600061033b565b33610280610132565b6001600160a01b0316146102a65760405162461bcd60e51b81526004016101ba90610403565b6001600160a01b03811661030b5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016101ba565b6103148161033b565b50565b3660008037600080366000845af43d6000803e808015610336573d6000f35b3d6000fd5b60006103657f343ac7c562d22652d4428c979fa0f51b7d6a0af6ec7f1069d628afdccff468ba5490565b905061038f827f343ac7c562d22652d4428c979fa0f51b7d6a0af6ec7f1069d628afdccff468ba55565b816001600160a01b0316816001600160a01b03167f5a3e66efaa1e445ebd894728a69d6959842ea1e97bd79b892797106e270efcd960405160405180910390a35050565b6000602082840312156103e557600080fd5b81356001600160a01b03811681146103fc57600080fd5b9392505050565b60208082526025908201527f50726f78794f776e61626c653a2063616c6c6572206973206e6f74207468652060408201526437bbb732b960d91b60608201526080019056fea264697066735822122048e9761ef36e6b70e79374905c39a802a24ec3ffbed51399b3652eb3fefe742a64736f6c63430008110033343ac7c562d22652d4428c979fa0f51b7d6a0af6ec7f1069d628afdccff468ba
Deployed Bytecode
0x60806040526004361061004e5760003560e01c8063025313a21461006557806310b2b981146100965780633d643cbe146100ab578063afe13fbc146100cb578063f1739cae146100e05761005d565b3661005d5761005b610100565b005b61005b610100565b34801561007157600080fd5b5061007a610132565b6040516001600160a01b03909116815260200160405180910390f35b3480156100a257600080fd5b5061007a610161565b3480156100b757600080fd5b5061005b6100c63660046103d3565b61018b565b3480156100d757600080fd5b5061005b61023e565b3480156100ec57600080fd5b5061005b6100fb3660046103d3565b610277565b61013061012b7f7a0f004813afd0c6ff6cc86d1e44688ffea125ec5615c65b9122b0d6f96c4bfb5490565b610317565b565b600061015c7f343ac7c562d22652d4428c979fa0f51b7d6a0af6ec7f1069d628afdccff468ba5490565b905090565b600061015c7f7a0f004813afd0c6ff6cc86d1e44688ffea125ec5615c65b9122b0d6f96c4bfb5490565b33610194610132565b6001600160a01b0316146101c35760405162461bcd60e51b81526004016101ba90610403565b60405180910390fd5b6001600160a01b0381163b61021a5760405162461bcd60e51b815260206004820152601a60248201527f414444524553532053484f554c4420424520434f4e545241435400000000000060448201526064016101ba565b7f7a0f004813afd0c6ff6cc86d1e44688ffea125ec5615c65b9122b0d6f96c4bfb55565b33610247610132565b6001600160a01b03161461026d5760405162461bcd60e51b81526004016101ba90610403565b610130600061033b565b33610280610132565b6001600160a01b0316146102a65760405162461bcd60e51b81526004016101ba90610403565b6001600160a01b03811661030b5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016101ba565b6103148161033b565b50565b3660008037600080366000845af43d6000803e808015610336573d6000f35b3d6000fd5b60006103657f343ac7c562d22652d4428c979fa0f51b7d6a0af6ec7f1069d628afdccff468ba5490565b905061038f827f343ac7c562d22652d4428c979fa0f51b7d6a0af6ec7f1069d628afdccff468ba55565b816001600160a01b0316816001600160a01b03167f5a3e66efaa1e445ebd894728a69d6959842ea1e97bd79b892797106e270efcd960405160405180910390a35050565b6000602082840312156103e557600080fd5b81356001600160a01b03811681146103fc57600080fd5b9392505050565b60208082526025908201527f50726f78794f776e61626c653a2063616c6c6572206973206e6f74207468652060408201526437bbb732b960d91b60608201526080019056fea264697066735822122048e9761ef36e6b70e79374905c39a802a24ec3ffbed51399b3652eb3fefe742a64736f6c63430008110033
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.