Overview
POL Balance
0 POL
POL Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 25 internal transactions (View All)
Loading...
Loading
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:
CollectionFactory
Compiler Version
v0.8.15+commit.e14f2714
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity 0.8.15; import {Ownable2Step} from "@openzeppelin/contracts-0.8.15/access/Ownable2Step.sol"; import {UpgradeableBeacon} from "@openzeppelin/contracts-0.8.15/proxy/beacon/UpgradeableBeacon.sol"; import {EnumerableSet} from "@openzeppelin/contracts-0.8.15/utils/structs/EnumerableSet.sol"; import {Address} from "@openzeppelin/contracts-0.8.15/utils/Address.sol"; import {CollectionProxy} from "./CollectionProxy.sol"; import {IERC5313} from "../common/IERC5313.sol"; /** * @title CollectionFactory * @author qed.team x The Sandbox * @notice Collection Factory used to manage (mostly) avatar collections * * - it's purpose is to allow for easy deployment of new collections and easy upgrade of existing ones * - factory can launch (or be added to) a beacon {UpgradeableBeacon} to which collection may point * - each collection is represented by a {CollectionProxy} that points to a beacon * - collections (proxies) can have the beacon they are pointing to changed */ contract CollectionFactory is Ownable2Step { using EnumerableSet for EnumerableSet.AddressSet; using EnumerableSet for EnumerableSet.Bytes32Set; /*////////////////////////////////////////////////////////////// Global state variables //////////////////////////////////////////////////////////////*/ /// @notice list of tracked beacon addresses EnumerableSet.Bytes32Set internal aliases; /// @notice mapping alias to beacon address mapping(bytes32 => address) public aliasToBeacon; /// @notice beacon/alias count; used as a helper for off-chain operations mostly uint256 public beaconCount; /// @notice set of deployed collection addresses (Proxies) EnumerableSet.AddressSet internal collections; /// @notice collection count; used as a helper for off-chain operations mostly uint256 public collectionCount; /*////////////////////////////////////////////////////////////// Events //////////////////////////////////////////////////////////////*/ /** * @notice Event emitted when a beacon was marked as followed by the factory * @dev emitted when deployBeacon or addBeacon is called * @param beaconAlias the alias (bytes32) used for this beacon * @param beaconAddress the marked beacon address */ event BeaconAdded(bytes32 indexed beaconAlias, address indexed beaconAddress); /** * @notice Event emitted when a beacon has its implementation updated * @dev emitted when updateBeaconImplementation is called * @param oldImplementation the old beacon implementation * @param newImplementation the new beacon implementation * @param beaconAlias the alias for the used beacon * @param beaconAddress the new beacon address that is used */ event BeaconUpdated( address indexed oldImplementation, address indexed newImplementation, bytes32 indexed beaconAlias, address beaconAddress ); /** * @notice Event emitted when a beacon was removed from tracking * @dev emitted when transferBeacon is called * @param beaconAlias the alias of the removed beacon * @param beaconAddress the address of the removed beacon * @param newBeaconOwner the address of the new owner of the beacon */ event BeaconRemoved(bytes32 indexed beaconAlias, address indexed beaconAddress, address indexed newBeaconOwner); /** * @notice Event emitted when the owner of this beacon was changed * @dev emitted when transferBeacon is called * @param oldOwner the previous owner of the beacon * @param newOwner the current owner of the beacon */ event BeaconOwnershipChanged(address indexed oldOwner, address indexed newOwner); /** * @notice Event emitted when a collection (proxy) was deployed * @dev emitted when deployCollection is called * @param beaconAddress the used beacon address for the collection * @param collectionProxy the new collection proxy address */ event CollectionAdded(address indexed beaconAddress, address indexed collectionProxy); /** * @notice Event emitted when a collection (proxy) was updated (had it's implementation change) * @dev emitted when updateCollection is called * @param proxyAddress the proxy address whose beacon has changed * @param beaconAlias the alias for the used beacon * @param beaconAddress the new beacon address that is used */ event CollectionUpdated(address indexed proxyAddress, bytes32 indexed beaconAlias, address indexed beaconAddress); /** * @notice Event emitted when a collection was removed from tracking from a beacon * @dev emitted when transferCollections is called * @param beaconAddress the address of the beacon to which this collection points to * @param collectionProxy the address of the removed collection */ event CollectionRemoved(address indexed beaconAddress, address indexed collectionProxy); /** * @notice Event emitted when the admin of this proxy was changed * @dev emitted when transferCollections is called * @param oldAdmin the previous admin of the collection proxy * @param newAdmin the current admin of the collection proxy */ event CollectionProxyAdminChanged(address indexed oldAdmin, address indexed newAdmin); /*////////////////////////////////////////////////////////////// Modifiers //////////////////////////////////////////////////////////////*/ /** * @notice Modifier used to check if a beacon is actually tracked by factory * @param beaconAlias the beacon address to check */ modifier beaconIsAvailable(bytes32 beaconAlias) { require(aliasToBeacon[beaconAlias] != address(0), "CollectionFactory: beacon is not tracked"); _; } /** * @notice Modifier used to check if a collection is actually tracked by factory * @param collection the collection address to check */ modifier collectionExists(address collection) { require(collections.contains(collection), "CollectionFactory: collection is not tracked"); _; } /** * @notice Modifier used to check if caller is the owner of the specific collection or the owner of the factory * @param collection the targeted collection address */ modifier onlyOwners(address collection) { require( IERC5313(collection).owner() == msg.sender || owner() == msg.sender, "CollectionFactory: caller is not collection or factory owner" ); _; } /*////////////////////////////////////////////////////////////// External and public functions //////////////////////////////////////////////////////////////*/ /** * @notice deploys a beacon with the provided implementation address and tracks it * @dev {UpgradeableBeacon} checks that implementation is actually a contract * @custom:event {BeaconAdded} * @param implementation the beacon address to be added/tracked * @param beaconAlias the beacon alias to be attributed to the newly deployed beacon * @return beacon the newly added beacon address that was launched */ function deployBeacon(address implementation, bytes32 beaconAlias) external onlyOwner returns (address beacon) { require(beaconAlias != 0, "CollectionFactory: beacon alias cannot be empty"); require(aliasToBeacon[beaconAlias] == address(0), "CollectionFactory: beacon alias already used"); beacon = address(new UpgradeableBeacon(implementation)); _saveBeacon(beacon, beaconAlias); } /** * @notice adds, an already deployed beacon, to be tracked/used by the factory; * Beacon ownership must be transferred to this contract beforehand * @dev checks that implementation is actually a contract and not already added; * will revert if beacon owner was not transferred to the factory beforehand * @custom:event {BeaconAdded} * @custom:event {CollectionAdded} for each collection * @param beacon the beacon address to be added/tracked * @param beaconAlias the beacon address to be added/tracked */ function addBeacon(address beacon, bytes32 beaconAlias) external onlyOwner { require(beaconAlias != 0, "CollectionFactory: beacon alias cannot be empty"); require(aliasToBeacon[beaconAlias] == address(0), "CollectionFactory: beacon alias already used"); require(Address.isContract(beacon), "CollectionFactory: beacon is not a contract"); require(_isFactoryBeaconOwner(beacon), "CollectionFactory: ownership must be given to factory"); _saveBeacon(beacon, beaconAlias); } /** * @notice Changes the implementation pointed by the indicated beacon * @dev {UpgradeableBeacon.upgradeTo} checks that implementation is actually a contract * @custom:event {BeaconUpdated} * @param beaconAlias alias for the beacon for which to change the implementation * @param implementation the new implementation for the indicated beacon */ function updateBeaconImplementation(bytes32 beaconAlias, address implementation) external onlyOwner beaconIsAvailable(beaconAlias) { UpgradeableBeacon beacon = UpgradeableBeacon(aliasToBeacon[beaconAlias]); address oldImplementation = beacon.implementation(); beacon.upgradeTo(implementation); emit BeaconUpdated(oldImplementation, implementation, beaconAlias, address(beacon)); } /** * @notice Transfers a beacon from the factory. Sets the owner to the provided one. * @custom:event {BeaconOwnershipChanged} * @custom:event {BeaconRemoved} * @param beaconAlias alias for the beacon to remove * @param newBeaconOwner the new owner of the beacon. It will be changed to this before removal */ function transferBeacon(bytes32 beaconAlias, address newBeaconOwner) external onlyOwner beaconIsAvailable(beaconAlias) { // "owner not zero address" check is done in UpgradeableBeacon::Ownable::transferOwnership address beacon = aliasToBeacon[beaconAlias]; delete aliasToBeacon[beaconAlias]; beaconCount -= 1; bool success = aliases.remove(beaconAlias); require(success, "CollectionFactory: failed to remove alias"); UpgradeableBeacon(beacon).transferOwnership(address(newBeaconOwner)); emit BeaconOwnershipChanged(address(this), newBeaconOwner); emit BeaconRemoved(beaconAlias, beacon, newBeaconOwner); } /** * @notice deploys a collection, making it point to the indicated beacon address and calls any initialization function if initializationArgs is provided * @dev checks that implementation is actually a contract and not already added * @custom:event CollectionAdded * @param beaconAlias alias for the beacon from which the collection will get its implementation * @param initializationArgs (encodeWithSignature) initialization function with arguments * to be called on newly deployed collection. If not provided, * will not call any function * @return collection the newly created collection address */ function deployCollection(bytes32 beaconAlias, bytes calldata initializationArgs) public onlyOwner beaconIsAvailable(beaconAlias) returns (address collection) { address beacon = aliasToBeacon[beaconAlias]; CollectionProxy collectionProxy = new CollectionProxy(beacon, initializationArgs); collection = address(collectionProxy); collections.add(collection); collectionCount += 1; emit CollectionAdded(beacon, collection); } /** * @notice adds collections to be tracked by the factory * Collection ownership must be transferred to this contract beforehand * @dev Reverts if: * - no collections no were given, if the {collections_} list is empty * - any of the give collections is 0 address * - the collection owner is not the factory * - failed to add the collection (duplicate present) * - the owner of the beacon pointed by the proxy is not the factory * @custom:event {CollectionAdded} for each collection * @param _collections the collections to be added to the factory */ function addCollections(address[] memory _collections) external onlyOwner { require(_collections.length != 0, "CollectionFactory: empty collection list"); uint256 collectionsLength = _collections.length; collectionCount += collectionsLength; bool success; address beacon; for (uint256 index; index < collectionsLength; ) { address collectionAddress = _collections[index]; require(collectionAddress != address(0), "CollectionFactory: collection is zero address"); CollectionProxy collection = CollectionProxy(payable(collectionAddress)); require(collection.proxyAdmin() == address(this), "CollectionFactory: owner of collection must be factory"); success = collections.add(address(collection)); require(success, "CollectionFactory: failed to add collection"); beacon = collection.beacon(); require(_isFactoryBeaconOwner(beacon), "CollectionFactory: beacon ownership must be given to factory"); emit CollectionAdded(collection.beacon(), address(collection)); unchecked {++index;} } } /** * @notice change what beacon the collection is pointing to. If updateArgs are provided, * will also call the specified function * @custom:event CollectionAdded * @param collection the collection for which the beacon to be changed * @param beaconAlias alias for the beacon to be used by the collection * @param updateArgs (encodeWithSignature) update function with arguments to be called on * the newly update collection. If not provided, will not call any function */ function updateCollection( address collection, bytes32 beaconAlias, bytes memory updateArgs ) external beaconIsAvailable(beaconAlias) collectionExists(collection) onlyOwners(collection) { address beacon = aliasToBeacon[beaconAlias]; CollectionProxy(payable(collection)).changeBeacon(beacon, updateArgs); emit CollectionUpdated(collection, beaconAlias, beacon); } /** * @notice Transfers a list of collections from the factory. Sets the owner to the provided one. * @dev will revert it a collection from the list is not tracked by the factory or if new owner is 0 address * @custom:event {CollectionRemoved} for each removed collection * @custom:event {CollectionProxyAdminChanged} * @param _collections list of collections to transfer * @param newCollectionOwner the new owner of the beacon. It will be changed to this before transfer */ function transferCollections(address[] calldata _collections, address newCollectionOwner) external onlyOwner { // "owner not zero address" check done in CollectionProxy::changeCollectionProxyAdmin::_changeAdmin::_setAdmin bool success; uint256 collectionsLength = _collections.length; for (uint256 index; index < collectionsLength; ) { CollectionProxy collection = CollectionProxy(payable(_collections[index])); success = collections.remove(address(collection)); require(success, "CollectionFactory: failed to remove collection"); emit CollectionRemoved(collection.beacon(), address(collection)); collection.changeCollectionProxyAdmin(newCollectionOwner); emit CollectionProxyAdminChanged(address(this), newCollectionOwner); unchecked {++index;} } collectionCount -= collectionsLength; } /*////////////////////////////////////////////////////////////// Public/external helper functions //////////////////////////////////////////////////////////////*/ /** * @notice Helper function that retrieves all beacons tracked by the factory * @return list of beacons managed by the factory */ function getBeacons() external view returns (address[] memory) { uint256 beaconCount_ = beaconCount; address[] memory beacons_ = new address[](beaconCount_); for (uint256 index = 0; index < beaconCount_; index++) { bytes32 beaconAlias = aliases.at(index); beacons_[index] = aliasToBeacon[beaconAlias]; } return beacons_; } /** * @notice Helper function that retrieves all aliases tracked by the factory * @return list of aliases managed by the factory */ function getBeaconAliases() external view returns (bytes32[] memory) { return aliases.values(); } /** * @notice Helper function that retrieves the beacon alias from the specific index * @param index index at which to get the alias from * @return alias at that specific index */ function getBeaconAlias(uint256 index) external view returns (bytes32) { return aliases.at(index); } /** * @notice Helper function that retrieves all collections tracked by the factory * @return list of collections managed by the factory */ function getCollections() external view returns (address[] memory) { return collections.values(); } /** * @notice Helper function that retrieves the collection at a specific index * @param index index at which to get the collection from * @return collection address from specific index */ function getCollection(uint256 index) external view returns (address) { return collections.at(index); } /** * @notice Helper function that retrieves the beacon pointed to by the collection proxy * @param collection the collection for which to get the pointed beacon * @return the beacon address pointed by the collection */ function beaconOf(address collection) external view collectionExists(collection) returns (address) { return CollectionProxy(payable(collection)).beacon(); } /*////////////////////////////////////////////////////////////// Other contract logic functions //////////////////////////////////////////////////////////////*/ /** * @notice function renounces ownership of contract. Currently it is disable, * as to not risk losing the ability to manage/deploy collections * @dev reverts on call */ function renounceOwnership() public virtual override onlyOwner { revert("CollectionFactory: renounce ownership is not available"); } /*////////////////////////////////////////////////////////////// Internal and private functions //////////////////////////////////////////////////////////////*/ /** * @notice Saves the beacon address into internal tracking * @dev beacon address sanity checks must be done before calling this function * @custom:event {BeaconAdded} * @param beacon the beacon address to me marked * @param beaconAlias the beacon alias to be associated with this address */ function _saveBeacon(address beacon, bytes32 beaconAlias) internal { aliases.add(beaconAlias); aliasToBeacon[beaconAlias] = beacon; beaconCount += 1; emit BeaconAdded(beaconAlias, beacon); } function _isFactoryBeaconOwner(address beacon) internal view returns (bool) { return UpgradeableBeacon(beacon).owner() == address(this); } }
// 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.8.0) (access/Ownable2Step.sol) pragma solidity ^0.8.0; import "./Ownable.sol"; /** * @dev Contract module which provides 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} and {acceptOwnership}. * * This module is used through inheritance. It will make available all functions * from parent (Ownable). */ abstract contract Ownable2Step is Ownable { address private _pendingOwner; event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner); /** * @dev Returns the address of the pending owner. */ function pendingOwner() public view virtual returns (address) { return _pendingOwner; } /** * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual override onlyOwner { _pendingOwner = newOwner; emit OwnershipTransferStarted(owner(), newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner. * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual override { delete _pendingOwner; super._transferOwnership(newOwner); } /** * @dev The new owner accepts the ownership transfer. */ function acceptOwnership() external { address sender = _msgSender(); require(pendingOwner() == sender, "Ownable2Step: caller is not the new owner"); _transferOwnership(sender); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol) pragma solidity ^0.8.0; /** * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified * proxy whose upgrades are fully controlled by the current implementation. */ interface IERC1822Proxiable { /** * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation * address. * * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this * function revert if invoked through a proxy. */ function proxiableUUID() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.3) (interfaces/IERC1967.sol) pragma solidity ^0.8.0; /** * @dev ERC-1967: Proxy Storage Slots. This interface contains the events defined in the ERC. * * _Available since v4.9._ */ interface IERC1967 { /** * @dev Emitted when the implementation is upgraded. */ event Upgraded(address indexed implementation); /** * @dev Emitted when the admin account has changed. */ event AdminChanged(address previousAdmin, address newAdmin); /** * @dev Emitted when the beacon is changed. */ event BeaconUpgraded(address indexed beacon); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (proxy/beacon/BeaconProxy.sol) pragma solidity ^0.8.0; import "./IBeacon.sol"; import "../Proxy.sol"; import "../ERC1967/ERC1967Upgrade.sol"; /** * @dev This contract implements a proxy that gets the implementation address for each call from an {UpgradeableBeacon}. * * The beacon address is stored in storage slot `uint256(keccak256('eip1967.proxy.beacon')) - 1`, so that it doesn't * conflict with the storage layout of the implementation behind the proxy. * * _Available since v3.4._ */ contract BeaconProxy is Proxy, ERC1967Upgrade { /** * @dev Initializes the proxy with `beacon`. * * If `data` is nonempty, it's used as data in a delegate call to the implementation returned by the beacon. This * will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity * constructor. * * Requirements: * * - `beacon` must be a contract with the interface {IBeacon}. */ constructor(address beacon, bytes memory data) payable { _upgradeBeaconToAndCall(beacon, data, false); } /** * @dev Returns the current beacon address. */ function _beacon() internal view virtual returns (address) { return _getBeacon(); } /** * @dev Returns the current implementation address of the associated beacon. */ function _implementation() internal view virtual override returns (address) { return IBeacon(_getBeacon()).implementation(); } /** * @dev Changes the proxy to use a new beacon. Deprecated: see {_upgradeBeaconToAndCall}. * * If `data` is nonempty, it's used as data in a delegate call to the implementation returned by the beacon. * * Requirements: * * - `beacon` must be a contract. * - The implementation returned by `beacon` must be a contract. */ function _setBeacon(address beacon, bytes memory data) internal virtual { _upgradeBeaconToAndCall(beacon, data, false); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol) pragma solidity ^0.8.0; /** * @dev This is the interface that {BeaconProxy} expects of its beacon. */ interface IBeacon { /** * @dev Must return an address that can be used as a delegate call target. * * {BeaconProxy} will check that this address is a contract. */ function implementation() external view returns (address); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (proxy/beacon/UpgradeableBeacon.sol) pragma solidity ^0.8.0; import "./IBeacon.sol"; import "../../access/Ownable.sol"; import "../../utils/Address.sol"; /** * @dev This contract is used in conjunction with one or more instances of {BeaconProxy} to determine their * implementation contract, which is where they will delegate all function calls. * * An owner is able to change the implementation the beacon points to, thus upgrading the proxies that use this beacon. */ contract UpgradeableBeacon is IBeacon, Ownable { address private _implementation; /** * @dev Emitted when the implementation returned by the beacon is changed. */ event Upgraded(address indexed implementation); /** * @dev Sets the address of the initial implementation, and the deployer account as the owner who can upgrade the * beacon. */ constructor(address implementation_) { _setImplementation(implementation_); } /** * @dev Returns the current implementation address. */ function implementation() public view virtual override returns (address) { return _implementation; } /** * @dev Upgrades the beacon to a new implementation. * * Emits an {Upgraded} event. * * Requirements: * * - msg.sender must be the owner of the contract. * - `newImplementation` must be a contract. */ function upgradeTo(address newImplementation) public virtual onlyOwner { _setImplementation(newImplementation); emit Upgraded(newImplementation); } /** * @dev Sets the implementation contract address for this beacon * * Requirements: * * - `newImplementation` must be a contract. */ function _setImplementation(address newImplementation) private { require(Address.isContract(newImplementation), "UpgradeableBeacon: implementation is not a contract"); _implementation = newImplementation; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.3) (proxy/ERC1967/ERC1967Upgrade.sol) pragma solidity ^0.8.2; import "../beacon/IBeacon.sol"; import "../../interfaces/IERC1967.sol"; import "../../interfaces/draft-IERC1822.sol"; import "../../utils/Address.sol"; import "../../utils/StorageSlot.sol"; /** * @dev This abstract contract provides getters and event emitting update functions for * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots. * * _Available since v4.1._ * * @custom:oz-upgrades-unsafe-allow delegatecall */ abstract contract ERC1967Upgrade is IERC1967 { // This is the keccak-256 hash of "eip1967.proxy.rollback" subtracted by 1 bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143; /** * @dev Storage slot with the address of the current implementation. * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; /** * @dev Returns the current implementation address. */ function _getImplementation() internal view returns (address) { return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; } /** * @dev Stores a new address in the EIP1967 implementation slot. */ function _setImplementation(address newImplementation) private { require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; } /** * @dev Perform implementation upgrade * * Emits an {Upgraded} event. */ function _upgradeTo(address newImplementation) internal { _setImplementation(newImplementation); emit Upgraded(newImplementation); } /** * @dev Perform implementation upgrade with additional setup call. * * Emits an {Upgraded} event. */ function _upgradeToAndCall( address newImplementation, bytes memory data, bool forceCall ) internal { _upgradeTo(newImplementation); if (data.length > 0 || forceCall) { Address.functionDelegateCall(newImplementation, data); } } /** * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call. * * Emits an {Upgraded} event. */ function _upgradeToAndCallUUPS( address newImplementation, bytes memory data, bool forceCall ) internal { // Upgrades from old implementations will perform a rollback test. This test requires the new // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing // this special case will break upgrade paths from old UUPS implementation to new ones. if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) { _setImplementation(newImplementation); } else { try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) { require(slot == _IMPLEMENTATION_SLOT, "ERC1967Upgrade: unsupported proxiableUUID"); } catch { revert("ERC1967Upgrade: new implementation is not UUPS"); } _upgradeToAndCall(newImplementation, data, forceCall); } } /** * @dev Storage slot with the admin of the contract. * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103; /** * @dev Returns the current admin. */ function _getAdmin() internal view returns (address) { return StorageSlot.getAddressSlot(_ADMIN_SLOT).value; } /** * @dev Stores a new address in the EIP1967 admin slot. */ function _setAdmin(address newAdmin) private { require(newAdmin != address(0), "ERC1967: new admin is the zero address"); StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin; } /** * @dev Changes the admin of the proxy. * * Emits an {AdminChanged} event. */ function _changeAdmin(address newAdmin) internal { emit AdminChanged(_getAdmin(), newAdmin); _setAdmin(newAdmin); } /** * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy. * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor. */ bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50; /** * @dev Returns the current beacon. */ function _getBeacon() internal view returns (address) { return StorageSlot.getAddressSlot(_BEACON_SLOT).value; } /** * @dev Stores a new beacon in the EIP1967 beacon slot. */ function _setBeacon(address newBeacon) private { require(Address.isContract(newBeacon), "ERC1967: new beacon is not a contract"); require( Address.isContract(IBeacon(newBeacon).implementation()), "ERC1967: beacon implementation is not a contract" ); StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon; } /** * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that). * * Emits a {BeaconUpgraded} event. */ function _upgradeBeaconToAndCall( address newBeacon, bytes memory data, bool forceCall ) internal { _setBeacon(newBeacon); emit BeaconUpgraded(newBeacon); if (data.length > 0 || forceCall) { Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data); } } }
// 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 (last updated v4.7.0) (utils/StorageSlot.sol) pragma solidity ^0.8.0; /** * @dev Library for reading and writing primitive types to specific storage slots. * * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. * This library helps with reading and writing to such slots without the need for inline assembly. * * The functions in this library return Slot structs that contain a `value` member that can be used to read or write. * * Example usage to set ERC1967 implementation slot: * ``` * contract ERC1967 { * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; * * function _getImplementation() internal view returns (address) { * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; * } * * function _setImplementation(address newImplementation) internal { * require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` * * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._ */ library StorageSlot { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } /** * @dev Returns an `AddressSlot` with member `value` located at `slot`. */ function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BooleanSlot` with member `value` located at `slot`. */ function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Bytes32Slot` with member `value` located at `slot`. */ function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Uint256Slot` with member `value` located at `slot`. */ function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/structs/EnumerableSet.sol) // This file was procedurally generated from scripts/generate/templates/EnumerableSet.js. pragma solidity ^0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. * * [WARNING] * ==== * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure * unusable. * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info. * * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an * array of EnumerableSet. * ==== */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping(bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; if (lastIndex != toDeleteIndex) { bytes32 lastValue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastValue; // Update the index for the moved value set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex } // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { return set._values[index]; } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function _values(Set storage set) private view returns (bytes32[] memory) { return set._values; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(Bytes32Set storage set) internal view returns (bytes32[] memory) { bytes32[] memory store = _values(set._inner); bytes32[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(AddressSet storage set) internal view returns (address[] memory) { bytes32[] memory store = _values(set._inner); address[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values in the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(UintSet storage set) internal view returns (uint256[] memory) { bytes32[] memory store = _values(set._inner); uint256[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; // taken from: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/interfaces/IERC5313.sol // as of deployment, version 4.9 of OpenZeppelin/openzeppelin-contracts, that holds this interface, is not released. Will change it when it will be /** * @dev Interface for the Light Contract Ownership Standard. * * A standardized minimal interface required to identify an account that controls a contract * * _Available since v4.9._ */ interface IERC5313 { /** * @dev Gets the address of the owner. */ function owner() external view returns (address); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.15; import {BeaconProxy} from "@openzeppelin/contracts-0.8.15/proxy/beacon/BeaconProxy.sol"; /** * @title CollectionProxy * @author qed.team x The Sandbox * @notice Beacon Proxy extension that supports having an admin (owner equivalent) that can * change the beacon to which this proxy points to. Initial admin is set to the deployer * * @dev as there are several functions added directly in the proxy, any contract behind it (implementation) * must be aware that functions with the following sighash will not be reached, as they will hit the * proxy and not be delegate-called to the implementation * * Sighash | Function Signature * ========================================= * f8ab7198 => changeBeacon(address,bytes) * aac96d4b => changeCollectionProxyAdmin(address) * 59659e90 => beacon() * 3e47158c => proxyAdmin() * */ contract CollectionProxy is BeaconProxy { /*////////////////////////////////////////////////////////////// Initializers //////////////////////////////////////////////////////////////*/ /** * @notice Collection constructor; pass-through while setting the admin to the sender * see {BeaconProxy.constructor} for more details * @custom:event {ERC1967Upgrade.AdminChanged} */ constructor(address beacon_, bytes memory data_) BeaconProxy(beacon_, data_) { _changeAdmin(msg.sender); } /*////////////////////////////////////////////////////////////// External and public functions //////////////////////////////////////////////////////////////*/ /** * @notice Changes the beacon to which this proxy points to * @dev any function from implementation address with a signature hash collision of f8ab7198 will reroute here and cannot be executed * If `data` is nonempty, it's used as data in a delegate call to the implementation returned by the beacon. * Sighash | Function Signature * ========================================= * f8ab7198 => changeBeacon(address,bytes) * custom:event {ERC1967Upgrade.BeaconUpgraded} * @param newBeacon the new beacon address for this proxy to point to * @param data initialization data as an encodedWithSignature output; if exists will be called on the new implementation */ function changeBeacon(address newBeacon, bytes memory data) external { require(msg.sender == _getAdmin(), "CollectionProxy: only admin can change beacon"); _setBeacon(newBeacon, data); } /** * @notice Changes the admin of the beacon to a new provided one * @dev any function from implementation address with a signature hash collision of aac96d4b will reroute here and cannot be executed * Sighash | Function Signature * ======================== * aac96d4b => changeCollectionProxyAdmin(address) * @custom:event {ERC1967Upgrade.AdminChanged} * @param newAdmin the new admin of the proxy */ function changeCollectionProxyAdmin(address newAdmin) external { address admin = _getAdmin(); require(msg.sender == admin, "CollectionProxy: only admin can change admin"); _changeAdmin(newAdmin); // checks for "new admin is the zero address" } /** * @notice retrieves the currently pointed to beacon address * @dev any function from implementation address with a signature hash collision of 59659e90 will reroute here and cannot be executed * Sighash | Function Signature * ======================== * 59659e90 => beacon() * @return the address of the currently pointed to beacon */ function beacon() external view returns (address) { return _beacon(); } /** * @notice gets the admin of the proxy * @dev any function from implementation address with a signature hash collision of 3e47158c will reroute here and cannot be executed * Sighash | Function Signature * ======================== * 3e47158c => proxyAdmin() * @return proxy admin address */ function proxyAdmin() external view returns (address) { return _getAdmin(); } }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "metadata": { "useLiteralContent": true }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"beaconAlias","type":"bytes32"},{"indexed":true,"internalType":"address","name":"beaconAddress","type":"address"}],"name":"BeaconAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"BeaconOwnershipChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"beaconAlias","type":"bytes32"},{"indexed":true,"internalType":"address","name":"beaconAddress","type":"address"},{"indexed":true,"internalType":"address","name":"newBeaconOwner","type":"address"}],"name":"BeaconRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldImplementation","type":"address"},{"indexed":true,"internalType":"address","name":"newImplementation","type":"address"},{"indexed":true,"internalType":"bytes32","name":"beaconAlias","type":"bytes32"},{"indexed":false,"internalType":"address","name":"beaconAddress","type":"address"}],"name":"BeaconUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"beaconAddress","type":"address"},{"indexed":true,"internalType":"address","name":"collectionProxy","type":"address"}],"name":"CollectionAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldAdmin","type":"address"},{"indexed":true,"internalType":"address","name":"newAdmin","type":"address"}],"name":"CollectionProxyAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"beaconAddress","type":"address"},{"indexed":true,"internalType":"address","name":"collectionProxy","type":"address"}],"name":"CollectionRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"proxyAddress","type":"address"},{"indexed":true,"internalType":"bytes32","name":"beaconAlias","type":"bytes32"},{"indexed":true,"internalType":"address","name":"beaconAddress","type":"address"}],"name":"CollectionUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"beacon","type":"address"},{"internalType":"bytes32","name":"beaconAlias","type":"bytes32"}],"name":"addBeacon","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_collections","type":"address[]"}],"name":"addCollections","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"aliasToBeacon","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"beaconCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"collection","type":"address"}],"name":"beaconOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"collectionCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"implementation","type":"address"},{"internalType":"bytes32","name":"beaconAlias","type":"bytes32"}],"name":"deployBeacon","outputs":[{"internalType":"address","name":"beacon","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"beaconAlias","type":"bytes32"},{"internalType":"bytes","name":"initializationArgs","type":"bytes"}],"name":"deployCollection","outputs":[{"internalType":"address","name":"collection","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getBeaconAlias","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getBeaconAliases","outputs":[{"internalType":"bytes32[]","name":"","type":"bytes32[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getBeacons","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getCollection","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCollections","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"beaconAlias","type":"bytes32"},{"internalType":"address","name":"newBeaconOwner","type":"address"}],"name":"transferBeacon","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_collections","type":"address[]"},{"internalType":"address","name":"newCollectionOwner","type":"address"}],"name":"transferCollections","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"beaconAlias","type":"bytes32"},{"internalType":"address","name":"implementation","type":"address"}],"name":"updateBeaconImplementation","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"collection","type":"address"},{"internalType":"bytes32","name":"beaconAlias","type":"bytes32"},{"internalType":"bytes","name":"updateArgs","type":"bytes"}],"name":"updateCollection","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60806040523480156200001157600080fd5b506200001d3362000023565b6200009d565b600180546001600160a01b03191690556200004a816200004d602090811b6200156217901c565b50565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b61367b80620000ad6000396000f3fe60806040523480156200001157600080fd5b50600436106200015c5760003560e01c80637201fa8011620000c7578063b53cfa4f1162000086578063b53cfa4f14620002e4578063c349384c14620002fb578063d57f966b1462000312578063e30c3978146200031c578063efad289f146200032e578063f2fde38b146200034557600080fd5b80637201fa80146200029d578063790450f614620002a757806379ba509714620002b15780638da5cb5b14620002bb578063a476962c14620002cd57600080fd5b806346e63586116200012057806346e6358614620001f057806349919e62146200020957806350f55d6114620002205780635a1f3c28146200025057806366d378991462000267578063715018a6146200029357600080fd5b80621d209f146200016157806313f7e143146200017a578063208915a01462000191578063291bdd8c14620001b357806334853c8e14620001ca575b600080fd5b6200017862000172366004620019d2565b6200035c565b005b620001786200018b36600462001a5f565b6200057f565b6200019b620006d9565b604051620001aa919062001a8e565b60405180910390f35b62000178620001c436600462001ad4565b620006ec565b620001e1620001db36600462001b07565b620008c0565b604051908152602001620001aa565b620001fa620008d5565b604051620001aa919062001b21565b620001786200021a36600462001bae565b620008e3565b620002376200023136600462001c6d565b62000d13565b6040516001600160a01b039091168152602001620001aa565b620002376200026136600462001b07565b62000e24565b620002376200027836600462001b07565b6004602052600090815260409020546001600160a01b031681565b6200017862000e33565b620001e160055481565b620001fa62000ea5565b6200017862000f79565b6000546001600160a01b031662000237565b62000178620002de36600462001ad4565b62000ff7565b62000237620002f536600462001a5f565b62001164565b620001786200030c36600462001cee565b62001217565b620001e160085481565b6001546001600160a01b031662000237565b620002376200033f36600462001daa565b62001453565b620001786200035636600462001daa565b620014ee565b62000366620015b2565b600082815b818110156200055e5760008686838181106200038b576200038b62001dca565b9050602002016020810190620003a2919062001daa565b9050620003b160068262001610565b9350836200041d5760405162461bcd60e51b815260206004820152602e60248201527f436f6c6c656374696f6e466163746f72793a206661696c656420746f2072656d60448201526d37bb329031b7b63632b1ba34b7b760911b60648201526084015b60405180910390fd5b806001600160a01b0316816001600160a01b03166359659e906040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000466573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200048c919062001de0565b6001600160a01b03167fc0c5a43813fb6a7ab47689d060d1ace5e2e35c113a13dcfb6aab657d527897b160405160405180910390a36040516355ecd1bb60e11b81526001600160a01b03868116600483015282169063abd9a37690602401600060405180830381600087803b1580156200050557600080fd5b505af11580156200051a573d6000803e3d6000fd5b50506040516001600160a01b03881692503091507f1184695a70f42291154093a0912a419889d39aa9e21bd01f425e81bd2c78f75790600090a3506001016200036b565b50806008600082825462000573919062001e16565b90915550505050505050565b62000589620015b2565b6000819003620005ad5760405162461bcd60e51b8152600401620004149062001e30565b6000818152600460205260409020546001600160a01b031615620005e55760405162461bcd60e51b8152600401620004149062001e7f565b6001600160a01b0382163b620006525760405162461bcd60e51b815260206004820152602b60248201527f436f6c6c656374696f6e466163746f72793a20626561636f6e206973206e6f7460448201526a08184818dbdb9d1c9858dd60aa1b606482015260840162000414565b6200065d8262001627565b620006c95760405162461bcd60e51b815260206004820152603560248201527f436f6c6c656374696f6e466163746f72793a206f776e657273686970206d75736044820152747420626520676976656e20746f20666163746f727960581b606482015260840162000414565b620006d58282620016a8565b5050565b6060620006e7600262001731565b905090565b620006f6620015b2565b60008281526004602052604090205482906001600160a01b03166200072f5760405162461bcd60e51b8152600401620004149062001ecb565b600083815260046020526040812080546001600160a01b03198116909155600580546001600160a01b03909216926001926200076d90849062001e16565b90915550600090506200078260028662001740565b905080620007e55760405162461bcd60e51b815260206004820152602960248201527f436f6c6c656374696f6e466163746f72793a206661696c656420746f2072656d6044820152686f766520616c69617360b81b606482015260840162000414565b60405163f2fde38b60e01b81526001600160a01b03858116600483015283169063f2fde38b90602401600060405180830381600087803b1580156200082957600080fd5b505af11580156200083e573d6000803e3d6000fd5b50506040516001600160a01b03871692503091507f8d41a7e662b3e1f1b13cf1addf1c530e188422c06024f313bc06f612e2aebcdc90600090a3836001600160a01b0316826001600160a01b0316867f8ec6845bd2dfe1f8b65fddb3a645614fc7efbc66818e0e4268bbcdac951594cd60405160405180910390a45050505050565b6000620008cf6002836200174e565b92915050565b6060620006e7600662001731565b620008ed620015b2565b8051600003620009515760405162461bcd60e51b815260206004820152602860248201527f436f6c6c656374696f6e466163746f72793a20656d70747920636f6c6c6563746044820152671a5bdb881b1a5cdd60c21b606482015260840162000414565b60008151905080600860008282546200096b919062001f13565b909155506000905080805b8381101562000d0c57600085828151811062000996576200099662001dca565b6020026020010151905060006001600160a01b0316816001600160a01b03160362000a1a5760405162461bcd60e51b815260206004820152602d60248201527f436f6c6c656374696f6e466163746f72793a20636f6c6c656374696f6e20697360448201526c207a65726f206164647265737360981b606482015260840162000414565b6000819050306001600160a01b0316816001600160a01b0316633e47158c6040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000a68573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000a8e919062001de0565b6001600160a01b03161462000b055760405162461bcd60e51b815260206004820152603660248201527f436f6c6c656374696f6e466163746f72793a206f776e6572206f6620636f6c6c604482015275656374696f6e206d75737420626520666163746f727960501b606482015260840162000414565b62000b126006826200175c565b94508462000b775760405162461bcd60e51b815260206004820152602b60248201527f436f6c6c656374696f6e466163746f72793a206661696c656420746f2061646460448201526a1031b7b63632b1ba34b7b760a91b606482015260840162000414565b806001600160a01b03166359659e906040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000bb6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000bdc919062001de0565b935062000be98462001627565b62000c5d5760405162461bcd60e51b815260206004820152603c60248201527f436f6c6c656374696f6e466163746f72793a20626561636f6e206f776e65727360448201527f686970206d75737420626520676976656e20746f20666163746f727900000000606482015260840162000414565b806001600160a01b0316816001600160a01b03166359659e906040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000ca6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000ccc919062001de0565b6001600160a01b03167fde026c5319b7c35f108a6ccfc922edc8008522079b610aee3c676bb7b7b7fb3560405160405180910390a3505060010162000976565b5050505050565b600062000d1f620015b2565b60008481526004602052604090205484906001600160a01b031662000d585760405162461bcd60e51b8152600401620004149062001ecb565b6000858152600460205260408082205490516001600160a01b03909116919082908790879062000d8890620019a0565b62000d969392919062001f2e565b604051809103906000f08015801562000db3573d6000803e3d6000fd5b50935083905062000dc66006826200175c565b5060016008600082825462000ddc919062001f13565b90915550506040516001600160a01b0380861691908416907fde026c5319b7c35f108a6ccfc922edc8008522079b610aee3c676bb7b7b7fb3590600090a35050509392505050565b6000620008cf6006836200174e565b62000e3d620015b2565b60405162461bcd60e51b815260206004820152603660248201527f436f6c6c656374696f6e466163746f72793a2072656e6f756e6365206f776e656044820152757273686970206973206e6f7420617661696c61626c6560501b606482015260840162000414565b60055460609060008167ffffffffffffffff81111562000ec95762000ec962001b64565b60405190808252806020026020018201604052801562000ef3578160200160208202803683370190505b50905060005b8281101562000f7257600062000f116002836200174e565b60008181526004602052604090205484519192506001600160a01b03169084908490811062000f445762000f4462001dca565b6001600160a01b0390921660209283029190910190910152508062000f698162001f6e565b91505062000ef9565b5092915050565b60015433906001600160a01b0316811462000fe95760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b606482015260840162000414565b62000ff48162001773565b50565b62001001620015b2565b60008281526004602052604090205482906001600160a01b03166200103a5760405162461bcd60e51b8152600401620004149062001ecb565b6000838152600460208181526040808420548151635c60da1b60e01b815291516001600160a01b0390911694938593635c60da1b93808301939192908290030181865afa15801562001090573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620010b6919062001de0565b604051631b2ce7f360e11b81526001600160a01b03868116600483015291925090831690633659cfe690602401600060405180830381600087803b158015620010fe57600080fd5b505af115801562001113573d6000803e3d6000fd5b50506040516001600160a01b03858116825288935080881692508416907f7f962d5b1ad4b08cc9dd2bbbf284a9d5d542b350014ccdbc969e376051b9d1d49060200160405180910390a45050505050565b600062001170620015b2565b6000829003620011945760405162461bcd60e51b8152600401620004149062001e30565b6000828152600460205260409020546001600160a01b031615620011cc5760405162461bcd60e51b8152600401620004149062001e7f565b82604051620011db90620019ae565b6001600160a01b039091168152602001604051809103906000f08015801562001208573d6000803e3d6000fd5b509050620008cf8183620016a8565b60008281526004602052604090205482906001600160a01b0316620012505760405162461bcd60e51b8152600401620004149062001ecb565b836200125e6006826200178e565b6200127d5760405162461bcd60e51b8152600401620004149062001f8a565b84336001600160a01b0316816001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015620012c7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620012ed919062001de0565b6001600160a01b031614806200131d575033620013126000546001600160a01b031690565b6001600160a01b0316145b620013915760405162461bcd60e51b815260206004820152603c60248201527f436f6c6c656374696f6e466163746f72793a2063616c6c6572206973206e6f7460448201527f20636f6c6c656374696f6e206f7220666163746f7279206f776e657200000000606482015260840162000414565b600085815260046020819052604091829020549151631f156e3360e31b81526001600160a01b039283169289169163f8ab719891620013d59185918a910162001fd6565b600060405180830381600087803b158015620013f057600080fd5b505af115801562001405573d6000803e3d6000fd5b50505050806001600160a01b031686886001600160a01b03167f42cadebd6bb87ad30febb6d38cbf726449469f738ce81ee5c4f642a1379aa34f60405160405180910390a450505050505050565b600081620014636006826200178e565b620014825760405162461bcd60e51b8152600401620004149062001f8a565b826001600160a01b03166359659e906040518163ffffffff1660e01b8152600401602060405180830381865afa158015620014c1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620014e7919062001de0565b9392505050565b620014f8620015b2565b600180546001600160a01b0383166001600160a01b031990911681179091556200152a6000546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000546001600160a01b031633146200160e5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640162000414565b565b6000620014e7836001600160a01b038416620017b1565b6000306001600160a01b0316826001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa15801562001672573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001698919062001de0565b6001600160a01b03161492915050565b620016b5600282620018b5565b50600081815260046020526040812080546001600160a01b0319166001600160a01b0385161790556005805460019290620016f290849062001f13565b90915550506040516001600160a01b0383169082907fd990f2c9640f5d556c783bd3420387611b92f61a9ddc92c8f2eae5b35d67b80b90600090a35050565b60606000620014e783620018c3565b6000620014e78383620017b1565b6000620014e7838362001921565b6000620014e7836001600160a01b0384166200194e565b600180546001600160a01b031916905562000ff48162001562565b6001600160a01b03811660009081526001830160205260408120541515620014e7565b60008181526001830160205260408120548015620018aa576000620017d860018362001e16565b8554909150600090620017ee9060019062001e16565b90508181146200185a57600086600001828154811062001812576200181262001dca565b906000526020600020015490508087600001848154811062001838576200183862001dca565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806200186e576200186e6200203e565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050620008cf565b6000915050620008cf565b6000620014e783836200194e565b6060816000018054806020026020016040519081016040528092919081815260200182805480156200191557602002820191906000526020600020905b81548152602001906001019080831162001900575b50505050509050919050565b60008260000182815481106200193b576200193b62001dca565b9060005260206000200154905092915050565b60008181526001830160205260408120546200199757508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155620008cf565b506000620008cf565b61110d806200205583390190565b6104e4806200316283390190565b6001600160a01b038116811462000ff457600080fd5b600080600060408486031215620019e857600080fd5b833567ffffffffffffffff8082111562001a0157600080fd5b818601915086601f83011262001a1657600080fd5b81358181111562001a2657600080fd5b8760208260051b850101111562001a3c57600080fd5b6020928301955093505084013562001a5481620019bc565b809150509250925092565b6000806040838503121562001a7357600080fd5b823562001a8081620019bc565b946020939093013593505050565b6020808252825182820181905260009190848201906040850190845b8181101562001ac85783518352928401929184019160010162001aaa565b50909695505050505050565b6000806040838503121562001ae857600080fd5b82359150602083013562001afc81620019bc565b809150509250929050565b60006020828403121562001b1a57600080fd5b5035919050565b6020808252825182820181905260009190848201906040850190845b8181101562001ac85783516001600160a01b03168352928401929184019160010162001b3d565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171562001ba65762001ba662001b64565b604052919050565b6000602080838503121562001bc257600080fd5b823567ffffffffffffffff8082111562001bdb57600080fd5b818501915085601f83011262001bf057600080fd5b81358181111562001c055762001c0562001b64565b8060051b915062001c1884830162001b7a565b818152918301840191848101908884111562001c3357600080fd5b938501935b8385101562001c61578435925062001c5083620019bc565b828252938501939085019062001c38565b98975050505050505050565b60008060006040848603121562001c8357600080fd5b83359250602084013567ffffffffffffffff8082111562001ca357600080fd5b818601915086601f83011262001cb857600080fd5b81358181111562001cc857600080fd5b87602082850101111562001cdb57600080fd5b6020830194508093505050509250925092565b60008060006060848603121562001d0457600080fd5b833562001d1181620019bc565b92506020848101359250604085013567ffffffffffffffff8082111562001d3757600080fd5b818701915087601f83011262001d4c57600080fd5b81358181111562001d615762001d6162001b64565b62001d75601f8201601f1916850162001b7a565b9150808252888482850101111562001d8c57600080fd5b80848401858401376000848284010152508093505050509250925092565b60006020828403121562001dbd57600080fd5b8135620014e781620019bc565b634e487b7160e01b600052603260045260246000fd5b60006020828403121562001df357600080fd5b8151620014e781620019bc565b634e487b7160e01b600052601160045260246000fd5b60008282101562001e2b5762001e2b62001e00565b500390565b6020808252602f908201527f436f6c6c656374696f6e466163746f72793a20626561636f6e20616c6961732060408201526e63616e6e6f7420626520656d70747960881b606082015260800190565b6020808252602c908201527f436f6c6c656374696f6e466163746f72793a20626561636f6e20616c6961732060408201526b185b1c9958591e481d5cd95960a21b606082015260800190565b60208082526028908201527f436f6c6c656374696f6e466163746f72793a20626561636f6e206973206e6f74604082015267081d1c9858dad95960c21b606082015260800190565b6000821982111562001f295762001f2962001e00565b500190565b6001600160a01b03841681526040602082018190528101829052818360608301376000818301606090810191909152601f909201601f1916010192915050565b60006001820162001f835762001f8362001e00565b5060010190565b6020808252602c908201527f436f6c6c656374696f6e466163746f72793a20636f6c6c656374696f6e20697360408201526b081b9bdd081d1c9858dad95960a21b606082015260800190565b60018060a01b038316815260006020604081840152835180604085015260005b81811015620020145785810183015185820160600152820162001ff6565b8181111562002027576000606083870101525b50601f01601f191692909201606001949350505050565b634e487b7160e01b600052603160045260246000fdfe60806040523480156200001157600080fd5b506040516200110d3803806200110d8339810160408190526200003491620005dc565b818162000044828260006200005a565b50620000529050336200012f565b50506200071b565b62000065836200018a565b6040516001600160a01b038416907f1cf3b03a6cf19fa2baba4df148e9dcabedea7f8a5c07840e207e5c089be95d3e90600090a2600082511180620000a75750805b156200012a5762000128836001600160a01b0316635c60da1b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015620000f0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001169190620006aa565b836200033c60201b6200021e1760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6200015a6200036b565b604080516001600160a01b03928316815291841660208301520160405180910390a16200018781620003a4565b50565b620001a0816200043460201b6200024a1760201c565b620002005760405162461bcd60e51b815260206004820152602560248201527f455243313936373a206e657720626561636f6e206973206e6f74206120636f6e6044820152641d1c9858dd60da1b60648201526084015b60405180910390fd5b6200027a816001600160a01b0316635c60da1b6040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000243573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620002699190620006aa565b6200043460201b6200024a1760201c565b620002e15760405162461bcd60e51b815260206004820152603060248201527f455243313936373a20626561636f6e20696d706c656d656e746174696f6e206960448201526f1cc81b9bdd08184818dbdb9d1c9858dd60821b6064820152608401620001f7565b806200031b7fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d5060001b6200044360201b620002591760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b6060620003648383604051806060016040528060278152602001620010e66027913962000446565b9392505050565b600062000395600080516020620010c683398151915260001b6200044360201b620002591760201c565b546001600160a01b0316919050565b6001600160a01b0381166200040b5760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b6064820152608401620001f7565b806200031b600080516020620010c683398151915260001b6200044360201b620002591760201c565b6001600160a01b03163b151590565b90565b6060600080856001600160a01b031685604051620004659190620006c8565b600060405180830381855af49150503d8060008114620004a2576040519150601f19603f3d011682016040523d82523d6000602084013e620004a7565b606091505b509092509050620004bb86838387620004c5565b9695505050505050565b606083156200053957825160000362000531576001600160a01b0385163b620005315760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401620001f7565b508162000545565b6200054583836200054d565b949350505050565b8151156200055e5781518083602001fd5b8060405162461bcd60e51b8152600401620001f79190620006e6565b80516001600160a01b03811681146200059257600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b83811015620005ca578181015183820152602001620005b0565b83811115620001285750506000910152565b60008060408385031215620005f057600080fd5b620005fb836200057a565b60208401519092506001600160401b03808211156200061957600080fd5b818501915085601f8301126200062e57600080fd5b81518181111562000643576200064362000597565b604051601f8201601f19908116603f011681019083821181831017156200066e576200066e62000597565b816040528281528860208487010111156200068857600080fd5b6200069b836020830160208801620005ad565b80955050505050509250929050565b600060208284031215620006bd57600080fd5b62000364826200057a565b60008251620006dc818460208701620005ad565b9190910192915050565b602081526000825180602084015262000707816040850160208701620005ad565b601f01601f19169190910160400192915050565b61099b806200072b6000396000f3fe6080604052600436106100435760003560e01c80633e47158c1461005a57806359659e901461008b578063abd9a376146100a0578063f8ab7198146100c057610052565b36610052576100506100e0565b005b6100506100e0565b34801561006657600080fd5b5061006f6100f2565b6040516001600160a01b03909116815260200160405180910390f35b34801561009757600080fd5b5061006f610101565b3480156100ac57600080fd5b506100506100bb3660046107af565b61010b565b3480156100cc57600080fd5b506100506100db3660046107e2565b610196565b6100f06100eb61025c565b6102c7565b565b60006100fc6102f0565b905090565b60006100fc610323565b60006101156102f0565b9050336001600160a01b038216146101895760405162461bcd60e51b815260206004820152602c60248201527f436f6c6c656374696f6e50726f78793a206f6e6c792061646d696e2063616e2060448201526b31b430b733b29030b236b4b760a11b60648201526084015b60405180910390fd5b6101928261032d565b5050565b61019e6102f0565b6001600160a01b0316336001600160a01b0316146102145760405162461bcd60e51b815260206004820152602d60248201527f436f6c6c656374696f6e50726f78793a206f6e6c792061646d696e2063616e2060448201526c31b430b733b2903132b0b1b7b760991b6064820152608401610180565b6101928282610384565b6060610243838360405180606001604052806027815260200161093f60279139610390565b9392505050565b6001600160a01b03163b151590565b90565b6000610266610408565b6001600160a01b0316635c60da1b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156102a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100fc91906108a6565b3660008037600080366000845af43d6000803e8080156102e6573d6000f35b3d6000fd5b505050565b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b546001600160a01b0316919050565b60006100fc610408565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6103566102f0565b604080516001600160a01b03928316815291841660208301520160405180910390a161038181610430565b50565b610192828260006104d9565b6060600080856001600160a01b0316856040516103ad91906108ef565b600060405180830381855af49150503d80600081146103e8576040519150601f19603f3d011682016040523d82523d6000602084013e6103ed565b606091505b50915091506103fe86838387610599565b9695505050505050565b60007fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50610314565b6001600160a01b0381166104955760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b6064820152608401610180565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80546001600160a01b0319166001600160a01b039290921691909117905550565b6104e28361061a565b6040516001600160a01b038416907f1cf3b03a6cf19fa2baba4df148e9dcabedea7f8a5c07840e207e5c089be95d3e90600090a26000825111806105235750805b156102eb57610593836001600160a01b0316635c60da1b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610569573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061058d91906108a6565b8361021e565b50505050565b60608315610608578251600003610601576001600160a01b0385163b6106015760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610180565b5081610612565b6106128383610770565b949350505050565b6001600160a01b0381163b61067f5760405162461bcd60e51b815260206004820152602560248201527f455243313936373a206e657720626561636f6e206973206e6f74206120636f6e6044820152641d1c9858dd60da1b6064820152608401610180565b6106e4816001600160a01b0316635c60da1b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156106c0573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061024a91906108a6565b6107495760405162461bcd60e51b815260206004820152603060248201527f455243313936373a20626561636f6e20696d706c656d656e746174696f6e206960448201526f1cc81b9bdd08184818dbdb9d1c9858dd60821b6064820152608401610180565b807fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d506104b8565b8151156107805781518083602001fd5b8060405162461bcd60e51b8152600401610180919061090b565b6001600160a01b038116811461038157600080fd5b6000602082840312156107c157600080fd5b81356102438161079a565b634e487b7160e01b600052604160045260246000fd5b600080604083850312156107f557600080fd5b82356108008161079a565b9150602083013567ffffffffffffffff8082111561081d57600080fd5b818501915085601f83011261083157600080fd5b813581811115610843576108436107cc565b604051601f8201601f19908116603f0116810190838211818310171561086b5761086b6107cc565b8160405282815288602084870101111561088457600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b6000602082840312156108b857600080fd5b81516102438161079a565b60005b838110156108de5781810151838201526020016108c6565b838111156105935750506000910152565b600082516109018184602087016108c3565b9190910192915050565b602081526000825180602084015261092a8160408501602087016108c3565b601f01601f1916919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220445e710f7c3560df0fd926db3017ae4fd6bddd461422813baebb1720554f8d2864736f6c634300080f0033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564608060405234801561001057600080fd5b506040516104e43803806104e483398101604081905261002f91610151565b61003833610047565b61004181610097565b50610181565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6100aa8161014260201b6101a01760201c565b6101205760405162461bcd60e51b815260206004820152603360248201527f5570677261646561626c65426561636f6e3a20696d706c656d656e746174696f60448201527f6e206973206e6f74206120636f6e747261637400000000000000000000000000606482015260840160405180910390fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b03163b151590565b60006020828403121561016357600080fd5b81516001600160a01b038116811461017a57600080fd5b9392505050565b610354806101906000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c80633659cfe61461005c5780635c60da1b14610071578063715018a61461009a5780638da5cb5b146100a2578063f2fde38b146100b3575b600080fd5b61006f61006a3660046102ee565b6100c6565b005b6001546001600160a01b03165b6040516001600160a01b03909116815260200160405180910390f35b61006f61010e565b6000546001600160a01b031661007e565b61006f6100c13660046102ee565b610122565b6100ce6101af565b6100d781610209565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6101166101af565b610120600061029e565b565b61012a6101af565b6001600160a01b0381166101945760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b61019d8161029e565b50565b6001600160a01b03163b151590565b6000546001600160a01b031633146101205760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161018b565b6001600160a01b0381163b61027c5760405162461bcd60e51b815260206004820152603360248201527f5570677261646561626c65426561636f6e3a20696d706c656d656e746174696f6044820152721b881a5cc81b9bdd08184818dbdb9d1c9858dd606a1b606482015260840161018b565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006020828403121561030057600080fd5b81356001600160a01b038116811461031757600080fd5b939250505056fea2646970667358221220d75b7edf6cd7c239671c05d75d212d6a14e569baef2899460046123a203d7c9664736f6c634300080f0033a264697066735822122099ffd2fba5dc25c64d24805ba17182dc8ccfd0b12bfad1c4bd089252980f6e5664736f6c634300080f0033
Deployed Bytecode
0x60806040523480156200001157600080fd5b50600436106200015c5760003560e01c80637201fa8011620000c7578063b53cfa4f1162000086578063b53cfa4f14620002e4578063c349384c14620002fb578063d57f966b1462000312578063e30c3978146200031c578063efad289f146200032e578063f2fde38b146200034557600080fd5b80637201fa80146200029d578063790450f614620002a757806379ba509714620002b15780638da5cb5b14620002bb578063a476962c14620002cd57600080fd5b806346e63586116200012057806346e6358614620001f057806349919e62146200020957806350f55d6114620002205780635a1f3c28146200025057806366d378991462000267578063715018a6146200029357600080fd5b80621d209f146200016157806313f7e143146200017a578063208915a01462000191578063291bdd8c14620001b357806334853c8e14620001ca575b600080fd5b6200017862000172366004620019d2565b6200035c565b005b620001786200018b36600462001a5f565b6200057f565b6200019b620006d9565b604051620001aa919062001a8e565b60405180910390f35b62000178620001c436600462001ad4565b620006ec565b620001e1620001db36600462001b07565b620008c0565b604051908152602001620001aa565b620001fa620008d5565b604051620001aa919062001b21565b620001786200021a36600462001bae565b620008e3565b620002376200023136600462001c6d565b62000d13565b6040516001600160a01b039091168152602001620001aa565b620002376200026136600462001b07565b62000e24565b620002376200027836600462001b07565b6004602052600090815260409020546001600160a01b031681565b6200017862000e33565b620001e160055481565b620001fa62000ea5565b6200017862000f79565b6000546001600160a01b031662000237565b62000178620002de36600462001ad4565b62000ff7565b62000237620002f536600462001a5f565b62001164565b620001786200030c36600462001cee565b62001217565b620001e160085481565b6001546001600160a01b031662000237565b620002376200033f36600462001daa565b62001453565b620001786200035636600462001daa565b620014ee565b62000366620015b2565b600082815b818110156200055e5760008686838181106200038b576200038b62001dca565b9050602002016020810190620003a2919062001daa565b9050620003b160068262001610565b9350836200041d5760405162461bcd60e51b815260206004820152602e60248201527f436f6c6c656374696f6e466163746f72793a206661696c656420746f2072656d60448201526d37bb329031b7b63632b1ba34b7b760911b60648201526084015b60405180910390fd5b806001600160a01b0316816001600160a01b03166359659e906040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000466573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200048c919062001de0565b6001600160a01b03167fc0c5a43813fb6a7ab47689d060d1ace5e2e35c113a13dcfb6aab657d527897b160405160405180910390a36040516355ecd1bb60e11b81526001600160a01b03868116600483015282169063abd9a37690602401600060405180830381600087803b1580156200050557600080fd5b505af11580156200051a573d6000803e3d6000fd5b50506040516001600160a01b03881692503091507f1184695a70f42291154093a0912a419889d39aa9e21bd01f425e81bd2c78f75790600090a3506001016200036b565b50806008600082825462000573919062001e16565b90915550505050505050565b62000589620015b2565b6000819003620005ad5760405162461bcd60e51b8152600401620004149062001e30565b6000818152600460205260409020546001600160a01b031615620005e55760405162461bcd60e51b8152600401620004149062001e7f565b6001600160a01b0382163b620006525760405162461bcd60e51b815260206004820152602b60248201527f436f6c6c656374696f6e466163746f72793a20626561636f6e206973206e6f7460448201526a08184818dbdb9d1c9858dd60aa1b606482015260840162000414565b6200065d8262001627565b620006c95760405162461bcd60e51b815260206004820152603560248201527f436f6c6c656374696f6e466163746f72793a206f776e657273686970206d75736044820152747420626520676976656e20746f20666163746f727960581b606482015260840162000414565b620006d58282620016a8565b5050565b6060620006e7600262001731565b905090565b620006f6620015b2565b60008281526004602052604090205482906001600160a01b03166200072f5760405162461bcd60e51b8152600401620004149062001ecb565b600083815260046020526040812080546001600160a01b03198116909155600580546001600160a01b03909216926001926200076d90849062001e16565b90915550600090506200078260028662001740565b905080620007e55760405162461bcd60e51b815260206004820152602960248201527f436f6c6c656374696f6e466163746f72793a206661696c656420746f2072656d6044820152686f766520616c69617360b81b606482015260840162000414565b60405163f2fde38b60e01b81526001600160a01b03858116600483015283169063f2fde38b90602401600060405180830381600087803b1580156200082957600080fd5b505af11580156200083e573d6000803e3d6000fd5b50506040516001600160a01b03871692503091507f8d41a7e662b3e1f1b13cf1addf1c530e188422c06024f313bc06f612e2aebcdc90600090a3836001600160a01b0316826001600160a01b0316867f8ec6845bd2dfe1f8b65fddb3a645614fc7efbc66818e0e4268bbcdac951594cd60405160405180910390a45050505050565b6000620008cf6002836200174e565b92915050565b6060620006e7600662001731565b620008ed620015b2565b8051600003620009515760405162461bcd60e51b815260206004820152602860248201527f436f6c6c656374696f6e466163746f72793a20656d70747920636f6c6c6563746044820152671a5bdb881b1a5cdd60c21b606482015260840162000414565b60008151905080600860008282546200096b919062001f13565b909155506000905080805b8381101562000d0c57600085828151811062000996576200099662001dca565b6020026020010151905060006001600160a01b0316816001600160a01b03160362000a1a5760405162461bcd60e51b815260206004820152602d60248201527f436f6c6c656374696f6e466163746f72793a20636f6c6c656374696f6e20697360448201526c207a65726f206164647265737360981b606482015260840162000414565b6000819050306001600160a01b0316816001600160a01b0316633e47158c6040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000a68573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000a8e919062001de0565b6001600160a01b03161462000b055760405162461bcd60e51b815260206004820152603660248201527f436f6c6c656374696f6e466163746f72793a206f776e6572206f6620636f6c6c604482015275656374696f6e206d75737420626520666163746f727960501b606482015260840162000414565b62000b126006826200175c565b94508462000b775760405162461bcd60e51b815260206004820152602b60248201527f436f6c6c656374696f6e466163746f72793a206661696c656420746f2061646460448201526a1031b7b63632b1ba34b7b760a91b606482015260840162000414565b806001600160a01b03166359659e906040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000bb6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000bdc919062001de0565b935062000be98462001627565b62000c5d5760405162461bcd60e51b815260206004820152603c60248201527f436f6c6c656374696f6e466163746f72793a20626561636f6e206f776e65727360448201527f686970206d75737420626520676976656e20746f20666163746f727900000000606482015260840162000414565b806001600160a01b0316816001600160a01b03166359659e906040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000ca6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000ccc919062001de0565b6001600160a01b03167fde026c5319b7c35f108a6ccfc922edc8008522079b610aee3c676bb7b7b7fb3560405160405180910390a3505060010162000976565b5050505050565b600062000d1f620015b2565b60008481526004602052604090205484906001600160a01b031662000d585760405162461bcd60e51b8152600401620004149062001ecb565b6000858152600460205260408082205490516001600160a01b03909116919082908790879062000d8890620019a0565b62000d969392919062001f2e565b604051809103906000f08015801562000db3573d6000803e3d6000fd5b50935083905062000dc66006826200175c565b5060016008600082825462000ddc919062001f13565b90915550506040516001600160a01b0380861691908416907fde026c5319b7c35f108a6ccfc922edc8008522079b610aee3c676bb7b7b7fb3590600090a35050509392505050565b6000620008cf6006836200174e565b62000e3d620015b2565b60405162461bcd60e51b815260206004820152603660248201527f436f6c6c656374696f6e466163746f72793a2072656e6f756e6365206f776e656044820152757273686970206973206e6f7420617661696c61626c6560501b606482015260840162000414565b60055460609060008167ffffffffffffffff81111562000ec95762000ec962001b64565b60405190808252806020026020018201604052801562000ef3578160200160208202803683370190505b50905060005b8281101562000f7257600062000f116002836200174e565b60008181526004602052604090205484519192506001600160a01b03169084908490811062000f445762000f4462001dca565b6001600160a01b0390921660209283029190910190910152508062000f698162001f6e565b91505062000ef9565b5092915050565b60015433906001600160a01b0316811462000fe95760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b606482015260840162000414565b62000ff48162001773565b50565b62001001620015b2565b60008281526004602052604090205482906001600160a01b03166200103a5760405162461bcd60e51b8152600401620004149062001ecb565b6000838152600460208181526040808420548151635c60da1b60e01b815291516001600160a01b0390911694938593635c60da1b93808301939192908290030181865afa15801562001090573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620010b6919062001de0565b604051631b2ce7f360e11b81526001600160a01b03868116600483015291925090831690633659cfe690602401600060405180830381600087803b158015620010fe57600080fd5b505af115801562001113573d6000803e3d6000fd5b50506040516001600160a01b03858116825288935080881692508416907f7f962d5b1ad4b08cc9dd2bbbf284a9d5d542b350014ccdbc969e376051b9d1d49060200160405180910390a45050505050565b600062001170620015b2565b6000829003620011945760405162461bcd60e51b8152600401620004149062001e30565b6000828152600460205260409020546001600160a01b031615620011cc5760405162461bcd60e51b8152600401620004149062001e7f565b82604051620011db90620019ae565b6001600160a01b039091168152602001604051809103906000f08015801562001208573d6000803e3d6000fd5b509050620008cf8183620016a8565b60008281526004602052604090205482906001600160a01b0316620012505760405162461bcd60e51b8152600401620004149062001ecb565b836200125e6006826200178e565b6200127d5760405162461bcd60e51b8152600401620004149062001f8a565b84336001600160a01b0316816001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015620012c7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620012ed919062001de0565b6001600160a01b031614806200131d575033620013126000546001600160a01b031690565b6001600160a01b0316145b620013915760405162461bcd60e51b815260206004820152603c60248201527f436f6c6c656374696f6e466163746f72793a2063616c6c6572206973206e6f7460448201527f20636f6c6c656374696f6e206f7220666163746f7279206f776e657200000000606482015260840162000414565b600085815260046020819052604091829020549151631f156e3360e31b81526001600160a01b039283169289169163f8ab719891620013d59185918a910162001fd6565b600060405180830381600087803b158015620013f057600080fd5b505af115801562001405573d6000803e3d6000fd5b50505050806001600160a01b031686886001600160a01b03167f42cadebd6bb87ad30febb6d38cbf726449469f738ce81ee5c4f642a1379aa34f60405160405180910390a450505050505050565b600081620014636006826200178e565b620014825760405162461bcd60e51b8152600401620004149062001f8a565b826001600160a01b03166359659e906040518163ffffffff1660e01b8152600401602060405180830381865afa158015620014c1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620014e7919062001de0565b9392505050565b620014f8620015b2565b600180546001600160a01b0383166001600160a01b031990911681179091556200152a6000546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000546001600160a01b031633146200160e5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640162000414565b565b6000620014e7836001600160a01b038416620017b1565b6000306001600160a01b0316826001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa15801562001672573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001698919062001de0565b6001600160a01b03161492915050565b620016b5600282620018b5565b50600081815260046020526040812080546001600160a01b0319166001600160a01b0385161790556005805460019290620016f290849062001f13565b90915550506040516001600160a01b0383169082907fd990f2c9640f5d556c783bd3420387611b92f61a9ddc92c8f2eae5b35d67b80b90600090a35050565b60606000620014e783620018c3565b6000620014e78383620017b1565b6000620014e7838362001921565b6000620014e7836001600160a01b0384166200194e565b600180546001600160a01b031916905562000ff48162001562565b6001600160a01b03811660009081526001830160205260408120541515620014e7565b60008181526001830160205260408120548015620018aa576000620017d860018362001e16565b8554909150600090620017ee9060019062001e16565b90508181146200185a57600086600001828154811062001812576200181262001dca565b906000526020600020015490508087600001848154811062001838576200183862001dca565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806200186e576200186e6200203e565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050620008cf565b6000915050620008cf565b6000620014e783836200194e565b6060816000018054806020026020016040519081016040528092919081815260200182805480156200191557602002820191906000526020600020905b81548152602001906001019080831162001900575b50505050509050919050565b60008260000182815481106200193b576200193b62001dca565b9060005260206000200154905092915050565b60008181526001830160205260408120546200199757508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155620008cf565b506000620008cf565b61110d806200205583390190565b6104e4806200316283390190565b6001600160a01b038116811462000ff457600080fd5b600080600060408486031215620019e857600080fd5b833567ffffffffffffffff8082111562001a0157600080fd5b818601915086601f83011262001a1657600080fd5b81358181111562001a2657600080fd5b8760208260051b850101111562001a3c57600080fd5b6020928301955093505084013562001a5481620019bc565b809150509250925092565b6000806040838503121562001a7357600080fd5b823562001a8081620019bc565b946020939093013593505050565b6020808252825182820181905260009190848201906040850190845b8181101562001ac85783518352928401929184019160010162001aaa565b50909695505050505050565b6000806040838503121562001ae857600080fd5b82359150602083013562001afc81620019bc565b809150509250929050565b60006020828403121562001b1a57600080fd5b5035919050565b6020808252825182820181905260009190848201906040850190845b8181101562001ac85783516001600160a01b03168352928401929184019160010162001b3d565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171562001ba65762001ba662001b64565b604052919050565b6000602080838503121562001bc257600080fd5b823567ffffffffffffffff8082111562001bdb57600080fd5b818501915085601f83011262001bf057600080fd5b81358181111562001c055762001c0562001b64565b8060051b915062001c1884830162001b7a565b818152918301840191848101908884111562001c3357600080fd5b938501935b8385101562001c61578435925062001c5083620019bc565b828252938501939085019062001c38565b98975050505050505050565b60008060006040848603121562001c8357600080fd5b83359250602084013567ffffffffffffffff8082111562001ca357600080fd5b818601915086601f83011262001cb857600080fd5b81358181111562001cc857600080fd5b87602082850101111562001cdb57600080fd5b6020830194508093505050509250925092565b60008060006060848603121562001d0457600080fd5b833562001d1181620019bc565b92506020848101359250604085013567ffffffffffffffff8082111562001d3757600080fd5b818701915087601f83011262001d4c57600080fd5b81358181111562001d615762001d6162001b64565b62001d75601f8201601f1916850162001b7a565b9150808252888482850101111562001d8c57600080fd5b80848401858401376000848284010152508093505050509250925092565b60006020828403121562001dbd57600080fd5b8135620014e781620019bc565b634e487b7160e01b600052603260045260246000fd5b60006020828403121562001df357600080fd5b8151620014e781620019bc565b634e487b7160e01b600052601160045260246000fd5b60008282101562001e2b5762001e2b62001e00565b500390565b6020808252602f908201527f436f6c6c656374696f6e466163746f72793a20626561636f6e20616c6961732060408201526e63616e6e6f7420626520656d70747960881b606082015260800190565b6020808252602c908201527f436f6c6c656374696f6e466163746f72793a20626561636f6e20616c6961732060408201526b185b1c9958591e481d5cd95960a21b606082015260800190565b60208082526028908201527f436f6c6c656374696f6e466163746f72793a20626561636f6e206973206e6f74604082015267081d1c9858dad95960c21b606082015260800190565b6000821982111562001f295762001f2962001e00565b500190565b6001600160a01b03841681526040602082018190528101829052818360608301376000818301606090810191909152601f909201601f1916010192915050565b60006001820162001f835762001f8362001e00565b5060010190565b6020808252602c908201527f436f6c6c656374696f6e466163746f72793a20636f6c6c656374696f6e20697360408201526b081b9bdd081d1c9858dad95960a21b606082015260800190565b60018060a01b038316815260006020604081840152835180604085015260005b81811015620020145785810183015185820160600152820162001ff6565b8181111562002027576000606083870101525b50601f01601f191692909201606001949350505050565b634e487b7160e01b600052603160045260246000fdfe60806040523480156200001157600080fd5b506040516200110d3803806200110d8339810160408190526200003491620005dc565b818162000044828260006200005a565b50620000529050336200012f565b50506200071b565b62000065836200018a565b6040516001600160a01b038416907f1cf3b03a6cf19fa2baba4df148e9dcabedea7f8a5c07840e207e5c089be95d3e90600090a2600082511180620000a75750805b156200012a5762000128836001600160a01b0316635c60da1b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015620000f0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001169190620006aa565b836200033c60201b6200021e1760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6200015a6200036b565b604080516001600160a01b03928316815291841660208301520160405180910390a16200018781620003a4565b50565b620001a0816200043460201b6200024a1760201c565b620002005760405162461bcd60e51b815260206004820152602560248201527f455243313936373a206e657720626561636f6e206973206e6f74206120636f6e6044820152641d1c9858dd60da1b60648201526084015b60405180910390fd5b6200027a816001600160a01b0316635c60da1b6040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000243573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620002699190620006aa565b6200043460201b6200024a1760201c565b620002e15760405162461bcd60e51b815260206004820152603060248201527f455243313936373a20626561636f6e20696d706c656d656e746174696f6e206960448201526f1cc81b9bdd08184818dbdb9d1c9858dd60821b6064820152608401620001f7565b806200031b7fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d5060001b6200044360201b620002591760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b6060620003648383604051806060016040528060278152602001620010e66027913962000446565b9392505050565b600062000395600080516020620010c683398151915260001b6200044360201b620002591760201c565b546001600160a01b0316919050565b6001600160a01b0381166200040b5760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b6064820152608401620001f7565b806200031b600080516020620010c683398151915260001b6200044360201b620002591760201c565b6001600160a01b03163b151590565b90565b6060600080856001600160a01b031685604051620004659190620006c8565b600060405180830381855af49150503d8060008114620004a2576040519150601f19603f3d011682016040523d82523d6000602084013e620004a7565b606091505b509092509050620004bb86838387620004c5565b9695505050505050565b606083156200053957825160000362000531576001600160a01b0385163b620005315760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401620001f7565b508162000545565b6200054583836200054d565b949350505050565b8151156200055e5781518083602001fd5b8060405162461bcd60e51b8152600401620001f79190620006e6565b80516001600160a01b03811681146200059257600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b83811015620005ca578181015183820152602001620005b0565b83811115620001285750506000910152565b60008060408385031215620005f057600080fd5b620005fb836200057a565b60208401519092506001600160401b03808211156200061957600080fd5b818501915085601f8301126200062e57600080fd5b81518181111562000643576200064362000597565b604051601f8201601f19908116603f011681019083821181831017156200066e576200066e62000597565b816040528281528860208487010111156200068857600080fd5b6200069b836020830160208801620005ad565b80955050505050509250929050565b600060208284031215620006bd57600080fd5b62000364826200057a565b60008251620006dc818460208701620005ad565b9190910192915050565b602081526000825180602084015262000707816040850160208701620005ad565b601f01601f19169190910160400192915050565b61099b806200072b6000396000f3fe6080604052600436106100435760003560e01c80633e47158c1461005a57806359659e901461008b578063abd9a376146100a0578063f8ab7198146100c057610052565b36610052576100506100e0565b005b6100506100e0565b34801561006657600080fd5b5061006f6100f2565b6040516001600160a01b03909116815260200160405180910390f35b34801561009757600080fd5b5061006f610101565b3480156100ac57600080fd5b506100506100bb3660046107af565b61010b565b3480156100cc57600080fd5b506100506100db3660046107e2565b610196565b6100f06100eb61025c565b6102c7565b565b60006100fc6102f0565b905090565b60006100fc610323565b60006101156102f0565b9050336001600160a01b038216146101895760405162461bcd60e51b815260206004820152602c60248201527f436f6c6c656374696f6e50726f78793a206f6e6c792061646d696e2063616e2060448201526b31b430b733b29030b236b4b760a11b60648201526084015b60405180910390fd5b6101928261032d565b5050565b61019e6102f0565b6001600160a01b0316336001600160a01b0316146102145760405162461bcd60e51b815260206004820152602d60248201527f436f6c6c656374696f6e50726f78793a206f6e6c792061646d696e2063616e2060448201526c31b430b733b2903132b0b1b7b760991b6064820152608401610180565b6101928282610384565b6060610243838360405180606001604052806027815260200161093f60279139610390565b9392505050565b6001600160a01b03163b151590565b90565b6000610266610408565b6001600160a01b0316635c60da1b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156102a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100fc91906108a6565b3660008037600080366000845af43d6000803e8080156102e6573d6000f35b3d6000fd5b505050565b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b546001600160a01b0316919050565b60006100fc610408565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6103566102f0565b604080516001600160a01b03928316815291841660208301520160405180910390a161038181610430565b50565b610192828260006104d9565b6060600080856001600160a01b0316856040516103ad91906108ef565b600060405180830381855af49150503d80600081146103e8576040519150601f19603f3d011682016040523d82523d6000602084013e6103ed565b606091505b50915091506103fe86838387610599565b9695505050505050565b60007fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50610314565b6001600160a01b0381166104955760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b6064820152608401610180565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80546001600160a01b0319166001600160a01b039290921691909117905550565b6104e28361061a565b6040516001600160a01b038416907f1cf3b03a6cf19fa2baba4df148e9dcabedea7f8a5c07840e207e5c089be95d3e90600090a26000825111806105235750805b156102eb57610593836001600160a01b0316635c60da1b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610569573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061058d91906108a6565b8361021e565b50505050565b60608315610608578251600003610601576001600160a01b0385163b6106015760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610180565b5081610612565b6106128383610770565b949350505050565b6001600160a01b0381163b61067f5760405162461bcd60e51b815260206004820152602560248201527f455243313936373a206e657720626561636f6e206973206e6f74206120636f6e6044820152641d1c9858dd60da1b6064820152608401610180565b6106e4816001600160a01b0316635c60da1b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156106c0573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061024a91906108a6565b6107495760405162461bcd60e51b815260206004820152603060248201527f455243313936373a20626561636f6e20696d706c656d656e746174696f6e206960448201526f1cc81b9bdd08184818dbdb9d1c9858dd60821b6064820152608401610180565b807fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d506104b8565b8151156107805781518083602001fd5b8060405162461bcd60e51b8152600401610180919061090b565b6001600160a01b038116811461038157600080fd5b6000602082840312156107c157600080fd5b81356102438161079a565b634e487b7160e01b600052604160045260246000fd5b600080604083850312156107f557600080fd5b82356108008161079a565b9150602083013567ffffffffffffffff8082111561081d57600080fd5b818501915085601f83011261083157600080fd5b813581811115610843576108436107cc565b604051601f8201601f19908116603f0116810190838211818310171561086b5761086b6107cc565b8160405282815288602084870101111561088457600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b6000602082840312156108b857600080fd5b81516102438161079a565b60005b838110156108de5781810151838201526020016108c6565b838111156105935750506000910152565b600082516109018184602087016108c3565b9190910192915050565b602081526000825180602084015261092a8160408501602087016108c3565b601f01601f1916919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220445e710f7c3560df0fd926db3017ae4fd6bddd461422813baebb1720554f8d2864736f6c634300080f0033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564608060405234801561001057600080fd5b506040516104e43803806104e483398101604081905261002f91610151565b61003833610047565b61004181610097565b50610181565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6100aa8161014260201b6101a01760201c565b6101205760405162461bcd60e51b815260206004820152603360248201527f5570677261646561626c65426561636f6e3a20696d706c656d656e746174696f60448201527f6e206973206e6f74206120636f6e747261637400000000000000000000000000606482015260840160405180910390fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b03163b151590565b60006020828403121561016357600080fd5b81516001600160a01b038116811461017a57600080fd5b9392505050565b610354806101906000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c80633659cfe61461005c5780635c60da1b14610071578063715018a61461009a5780638da5cb5b146100a2578063f2fde38b146100b3575b600080fd5b61006f61006a3660046102ee565b6100c6565b005b6001546001600160a01b03165b6040516001600160a01b03909116815260200160405180910390f35b61006f61010e565b6000546001600160a01b031661007e565b61006f6100c13660046102ee565b610122565b6100ce6101af565b6100d781610209565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6101166101af565b610120600061029e565b565b61012a6101af565b6001600160a01b0381166101945760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b61019d8161029e565b50565b6001600160a01b03163b151590565b6000546001600160a01b031633146101205760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161018b565b6001600160a01b0381163b61027c5760405162461bcd60e51b815260206004820152603360248201527f5570677261646561626c65426561636f6e3a20696d706c656d656e746174696f6044820152721b881a5cc81b9bdd08184818dbdb9d1c9858dd606a1b606482015260840161018b565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006020828403121561030057600080fd5b81356001600160a01b038116811461031757600080fd5b939250505056fea2646970667358221220d75b7edf6cd7c239671c05d75d212d6a14e569baef2899460046123a203d7c9664736f6c634300080f0033a264697066735822122099ffd2fba5dc25c64d24805ba17182dc8ccfd0b12bfad1c4bd089252980f6e5664736f6c634300080f0033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.