Source Code
Overview
S Balance
0 S
More Info
ContractCreator
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
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:
TaskManager
Compiler Version
v0.8.19+commit.7dd6d404
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.19; import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; error TaskManager__AddressCannotBeZero(); error TaskManager__AddressNotWhitelisted(address nonWhitelistedAddress); error TaskManager__InvalidAmount(uint256 amount); error TaskManager__InvalidTaskId(uint256 taskId); error TaskManager__MustBeTaskAcceptor(); error TaskManager__MustBeRequestor(); error TaskManager__MustWaitRefundTime(uint256 refundTime); error TaskManager__NoBalanceToWithdraw(); error TaskManager__PaymentInsufficient(); error TaskManager__TaskAlreadyAccepted(uint256 taskId); error TaskManager__TaskAlreadyCompleted(uint256 taskId); error TaskManager__TasksDisabled(); contract TaskManager is Initializable, OwnableUpgradeable, ReentrancyGuardUpgradeable, UUPSUpgradeable { using SafeERC20 for IERC20; ///////////////////// // State Variables // ///////////////////// enum ModelType { LSTM, DIFFUSION, CUSTOM, LLM, PLACEHOLDER2, PLACEHOLDER3, PLACEHOLDER4, PLACEHOLDER5, PLACEHOLDER6, PLACEHOLDER7, PLACEHOLDER8, PLACEHOLDER9, PLACEHOLDER10 } // TODO: keep track of node completed tasks - node payment? // User struct to keep track of tasks? // Node struct to keep track of tasks? // task queue struct Task { uint256 id; uint256 payment; uint128 requestTimestamp; uint64 gpuPower; bool isCompleted; ModelType modelType; address user; address node; string description; } /** * @notice the token used for payment in this contract */ IERC20 private s_token; /** * @notice whether tasks are enabled */ bool private s_tasksEnabled; /** * @notice The percentage of the payment that node providers * receive for completing a task * @dev For precision, this is a 5 digit number that will be * divided by 10000 to get the percentage. For example, * 10000 = 100%, 5000 = 50%, 2500 = 25%, etc. */ uint256 private s_nodePaymentPercentage; /** * @notice The price per GPU power in wei */ uint256 private s_pricePerGPU; /** * @notice Time required before a refund can be issued */ uint256 private s_refundTime; /** * @notice The latest taskId */ uint256 private s_taskCount; /** * @notice The total number of tasks accepted */ uint256 private s_taskCountAccepted; /** * @notice the number of completed tasks */ uint256 private s_taskCountCompleted; /** * @notice The total GPU power completed in this contract */ uint256 private s_totalGPUPowerCompleted; /** * @notice address of node provider -> whitelisted. * @dev if node is not whitelisted, it cannot accept tasks */ mapping(address => bool) s_nodeAddressToWhitelisted; /** * @notice taskId -> IPFS Url */ mapping(uint256 => string) s_taskIdToIPFSUrl; /** * @notice taskId -> Task */ mapping(uint256 => Task) private s_taskIdToTasks; ///////////////////// // Events // ///////////////////// /** * @notice Emitted when the node payment percentage is updated */ event NodePaymentPercentageUpdated(uint256 newPercentage); /** * @notice Emitted when a payment is received for a task */ event PaymentReceived( address indexed user, uint256 indexed amount, uint256 indexed taskId ); /** * @notice Emitted when the price per GPU power is updated */ event PricePerGPUUpdated(uint256 newPrice); /** * @notice Emitted when a refund is issued */ event RefundIssued( address indexed user, uint256 indexed amount, uint256 indexed taskId ); /** * @notice Emitted when the time required to wait for a refund * is updated */ event RefundTimeUpdated(uint256 newRefundTime); /** * @notice Emitted when a task is accepted by a node */ event TaskAccepted(address indexed nodeAddress, uint256 indexed taskId); /** * @notice Emitted when a task is created */ event TaskCreated( address indexed user, uint256 indexed gpuAmount, uint256 indexed taskId ); event TaskCompleted( address indexed nodeAddress, uint256 nodePayment, uint256 indexed taskId ); /** * @notice Emitted when the ERC20 token address is updated */ event TokenAddressUpdated(address indexed newAddress); /** * @notice Emitted when an address is whitelisted */ event WhitelistUpdated(address indexed nodeAddress, bool isWhitelisted); //////////////////// // Main Functions // //////////////////// /// @custom:oz-upgrades-unsafe-allow constructor constructor() { _disableInitializers(); } function initialize(address tokenAddress) public initializer { __Ownable_init(); __ReentrancyGuard_init(); __UUPSUpgradeable_init(); s_token = IERC20(tokenAddress); s_taskCount = 0; s_taskCountCompleted = 0; s_pricePerGPU = 0.0001 ether; s_nodePaymentPercentage = 7000; s_refundTime = 1 days; } /** * @notice Creates a task to be processed by a node operator * @param payment the payment for the task * @param gpuAmount the amount of GPU power required for the task * @param modelType the type of model * @param description the description of the task */ function requestTask( uint256 payment, uint64 gpuAmount, ModelType modelType, string memory description ) external nonReentrant { if (!s_tasksEnabled) { revert TaskManager__TasksDisabled(); } if (payment == 0 || gpuAmount == 0) { revert TaskManager__InvalidAmount(0); } if (payment < s_pricePerGPU * gpuAmount) { revert TaskManager__PaymentInsufficient(); } s_token.safeTransferFrom(msg.sender, address(this), payment); s_taskCount += 1; s_taskIdToTasks[s_taskCount] = Task({ id: s_taskCount, payment: payment, gpuPower: gpuAmount, requestTimestamp: uint128(block.timestamp), description: description, user: msg.sender, node: address(0), isCompleted: false, modelType: modelType }); emit TaskCreated(msg.sender, gpuAmount, s_taskCount); emit PaymentReceived(msg.sender, payment, s_taskCount); } /** * @notice Refunds the user if the task is not completed * within the refund time * @param taskId the taskId * @dev refunding this task will mark it as complete in order * to prevent nodes from attempting the task again. The task * accepted count is also updated to keep our available tasks * accurate. */ function refundTask(uint256 taskId) external nonReentrant { Task storage task = s_taskIdToTasks[taskId]; if (task.id == 0) { revert TaskManager__InvalidTaskId(taskId); } if (task.user != msg.sender) { revert TaskManager__MustBeRequestor(); } if (task.isCompleted) { revert TaskManager__TaskAlreadyCompleted(taskId); } if (block.timestamp < task.requestTimestamp + s_refundTime) { revert TaskManager__MustWaitRefundTime(s_refundTime); } task.isCompleted = true; s_taskCountAccepted += 1; s_taskCountCompleted += 1; s_token.safeTransfer(msg.sender, task.payment); emit RefundIssued(msg.sender, task.payment, taskId); } /** * @notice A node operator calls this to accept a task to work on * @param taskId the taskId to accept * @dev the node must be whitelisted in order to accept a task */ function acceptTask(uint256 taskId) external nonReentrant { if (!s_nodeAddressToWhitelisted[msg.sender]) { revert TaskManager__AddressNotWhitelisted(msg.sender); } Task storage task = s_taskIdToTasks[taskId]; if (task.id == 0) { revert TaskManager__InvalidTaskId(taskId); } if (task.isCompleted) { revert TaskManager__TaskAlreadyCompleted(taskId); } if (task.node != address(0)) { revert TaskManager__TaskAlreadyAccepted(taskId); } task.node = msg.sender; s_taskCountAccepted += 1; emit TaskAccepted(msg.sender, taskId); } /** * @notice A node operator calls this to complete a task * @param taskId the taskId to complete * @param ipfsUrl the IPFS url of the completed task * @dev the node must be the one that accepted the task */ function completeTask( uint256 taskId, string memory ipfsUrl ) external nonReentrant { Task storage task = s_taskIdToTasks[taskId]; if (task.id == 0) { revert TaskManager__InvalidTaskId(taskId); } if (task.isCompleted) { revert TaskManager__TaskAlreadyCompleted(taskId); } if (task.node != msg.sender) { revert TaskManager__MustBeTaskAcceptor(); } task.isCompleted = true; s_taskCountCompleted += 1; s_totalGPUPowerCompleted += task.gpuPower; if (bytes(ipfsUrl).length > 0) { s_taskIdToIPFSUrl[taskId] = ipfsUrl; } uint256 nodePayAmount = (task.payment * s_nodePaymentPercentage) / 10000; s_token.transfer(task.node, nodePayAmount); emit TaskCompleted(msg.sender, nodePayAmount, taskId); } ///////////////////// // Admin Functions // ///////////////////// function _authorizeUpgrade( address newImplementation ) internal override onlyOwner {} /** * @notice Sets whether an address is whitelisted to be a node operator * @param addr the address to whitelist * @param isWhitelisted whether the address is whitelisted */ function setAddressWhitelisted( address addr, bool isWhitelisted ) external onlyOwner { if (addr == address(0)) { revert TaskManager__AddressCannotBeZero(); } s_nodeAddressToWhitelisted[addr] = isWhitelisted; emit WhitelistUpdated(addr, isWhitelisted); } /** * @notice Sets the payment percentage for node operators * @param newPercentage the new percentage in 5 digits * @dev For precision, this is a 5 digit number that will be * divided by 10000 to get the percentage. For example, * 10000 = 100%, 5000 = 50%, 2500 = 25%, etc. */ function setNodePaymentPercentage(uint256 newPercentage) external onlyOwner { if (newPercentage > 10000) { revert TaskManager__InvalidAmount(newPercentage); } s_nodePaymentPercentage = newPercentage; emit NodePaymentPercentageUpdated(newPercentage); } /** * @notice Sets the price per GPU in wei * @param newPrice the new price */ function setPricePerGPU(uint256 newPrice) external onlyOwner { s_pricePerGPU = newPrice; emit PricePerGPUUpdated(newPrice); } /** * @notice Sets the refund time * @param newRefundTime the new refund time */ function setRefundTime(uint256 newRefundTime) external onlyOwner { s_refundTime = newRefundTime; emit RefundTimeUpdated(newRefundTime); } /** * @notice Sets whether tasks are enabled * @param enabled whether tasks are enabled */ function setTasksEnabled(bool enabled) external onlyOwner { s_tasksEnabled = enabled; } /** * @notice Sets the ERC20 token address used for payment * @param newAddr the new address */ function setTokenAddress(address newAddr) external onlyOwner { if (newAddr == address(0)) { revert TaskManager__AddressCannotBeZero(); } s_token = IERC20(newAddr); emit TokenAddressUpdated(newAddr); } /** * @notice Withdraws tokens to address * @param addr the address to withdraw to * @param amount the amount to withdraw * @dev Attempting to withdraw a higher amount than the balance will not * revert, but instead withdraw the full balance. * * This contract relies on having tokens to pay out to node operators. * Therefore, this function should only be called with an amount that is * less than needed for node operators or potential refunds. */ function withdrawTokens(address addr, uint256 amount) external onlyOwner { if (addr == address(0)) { revert TaskManager__AddressCannotBeZero(); } uint256 balance = s_token.balanceOf(address(this)); if (balance == 0) { revert TaskManager__NoBalanceToWithdraw(); } if (amount < balance) { balance = amount; } s_token.safeTransfer(addr, balance); } //////////////////// // View Functions // //////////////////// /** * @notice Returns an array of the available tasks */ function getAvailableTasks() external view returns (Task[] memory) { uint256 taskCount = s_taskCount - s_taskCountAccepted; uint256[] memory taskIds = new uint256[](taskCount); uint256 count = 0; uint256 index = s_taskCount; while (count < taskCount && index > 0) { Task memory task = s_taskIdToTasks[index]; if ( task.user != address(0) && task.node == address(0) && !task.isCompleted ) { taskIds[count] = task.id; count += 1; } index -= 1; } Task[] memory tasks = new Task[](taskCount); for (uint256 i = 0; i < taskCount; i++) { tasks[i] = s_taskIdToTasks[taskIds[i]]; } return tasks; } /** * @notice Returns the IPFS url of the completed task * @param taskIndex the index of the task * @dev For privacy, only the requestor of the task can call this function */ function getIPFSUrl(uint256 taskIndex) external view returns (string memory) { Task memory task = s_taskIdToTasks[taskIndex]; if (msg.sender != task.user) { revert TaskManager__MustBeRequestor(); } return s_taskIdToIPFSUrl[taskIndex]; } /** * @notice Returns the node payment percentage in 5 digits * @dev For precision, this is a 5 digit number that will be * divided by 10000 to get the percentage. For example, * 10000 = 100%, 5000 = 50%, 2500 = 25%, etc. */ function getNodePaymentPercentage() external view returns (uint256) { return s_nodePaymentPercentage; } /** * @notice Returns the price per GPU in wei */ function getPricePerGPU() external view returns (uint256) { return s_pricePerGPU; } /** * @notice Returns the time required (in seconds) before a * refund can be issued if a task is not completed */ function getRefundTime() external view returns (uint256) { return s_refundTime; } /** * @notice Returns the task for a given taskId * @param taskId the taskId to return */ function getTask(uint256 taskId) external view returns (Task memory) { Task memory task = s_taskIdToTasks[taskId]; return (task); } /** * @notice Returns the latest taskId */ function getTaskCount() external view returns (uint256) { return s_taskCount; } /** * @notice Returns the number of completed tasks */ function getTaskCountCompleted() external view returns (uint256) { return s_taskCountCompleted; } /** * @notice Returns whether tasks are enabled */ function getTasksEnabled() external view returns (bool) { return s_tasksEnabled; } /** * @notice Returns the address of the ERC20 token used for payment */ function getTokenAddress() external view returns (address) { return address(s_token); } /** * @notice Returns the total GPU Power Completed in this contract */ function getTotalGPUPowerCompleted() external view returns (uint256) { return s_totalGPUPowerCompleted; } /** * @notice Returns an array of tasks the user has created * @param user the user address */ function getUserTasks(address user) external view returns (Task[] memory) { uint256[] memory taskIds = new uint256[](s_taskCount); uint256 count = 0; for (uint256 i = 1; i <= s_taskCount; i++) { Task memory task = s_taskIdToTasks[i]; if (task.user == user) { taskIds[count] = task.id; count += 1; } } Task[] memory userTasks = new Task[](count); for (uint256 i = 0; i < count; i++) { userTasks[i] = s_taskIdToTasks[taskIds[i]]; } return userTasks; } /** * @notice Returns whether an address is whitelisted * to be a node operator * @param nodeAddress the address to check */ function isAddressWhitelisted( address nodeAddress ) external view returns (bool) { return s_nodeAddressToWhitelisted[nodeAddress]; } /** * @notice Returns whether a task is available to accept * @param taskIndex The taskId to check */ function isTaskAvailable(uint256 taskIndex) external view returns (bool) { Task memory task = s_taskIdToTasks[taskIndex]; return task.user != address(0) && task.node == address(0) && !task.isCompleted; } /** * @notice Returns whether a task is completed * @param taskIndex The taskId to check */ function isTaskComplete(uint256 taskIndex) external view returns (bool) { return s_taskIdToTasks[taskIndex].isCompleted; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/ContextUpgradeable.sol"; import "../proxy/utils/Initializable.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 OwnableUpgradeable is Initializable, ContextUpgradeable { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ function __Ownable_init() internal onlyInitializing { __Ownable_init_unchained(); } function __Ownable_init_unchained() internal onlyInitializing { _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. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby disabling 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); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
// 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 IERC1822ProxiableUpgradeable { /** * @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.9.0) (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.8.3._ */ interface IERC1967Upgradeable { /** * @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 v4.4.1 (proxy/beacon/IBeacon.sol) pragma solidity ^0.8.0; /** * @dev This is the interface that {BeaconProxy} expects of its beacon. */ interface IBeaconUpgradeable { /** * @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 (last updated v4.9.0) (proxy/ERC1967/ERC1967Upgrade.sol) pragma solidity ^0.8.2; import "../beacon/IBeaconUpgradeable.sol"; import "../../interfaces/IERC1967Upgradeable.sol"; import "../../interfaces/draft-IERC1822Upgradeable.sol"; import "../../utils/AddressUpgradeable.sol"; import "../../utils/StorageSlotUpgradeable.sol"; import "../utils/Initializable.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._ */ abstract contract ERC1967UpgradeUpgradeable is Initializable, IERC1967Upgradeable { function __ERC1967Upgrade_init() internal onlyInitializing { } function __ERC1967Upgrade_init_unchained() internal onlyInitializing { } // 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 StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value; } /** * @dev Stores a new address in the EIP1967 implementation slot. */ function _setImplementation(address newImplementation) private { require(AddressUpgradeable.isContract(newImplementation), "ERC1967: new implementation is not a contract"); StorageSlotUpgradeable.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) { AddressUpgradeable.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 (StorageSlotUpgradeable.getBooleanSlot(_ROLLBACK_SLOT).value) { _setImplementation(newImplementation); } else { try IERC1822ProxiableUpgradeable(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 StorageSlotUpgradeable.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"); StorageSlotUpgradeable.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 StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value; } /** * @dev Stores a new beacon in the EIP1967 beacon slot. */ function _setBeacon(address newBeacon) private { require(AddressUpgradeable.isContract(newBeacon), "ERC1967: new beacon is not a contract"); require( AddressUpgradeable.isContract(IBeaconUpgradeable(newBeacon).implementation()), "ERC1967: beacon implementation is not a contract" ); StorageSlotUpgradeable.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) { AddressUpgradeable.functionDelegateCall(IBeaconUpgradeable(newBeacon).implementation(), data); } } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.2; import "../../utils/AddressUpgradeable.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in * case an upgrade adds a module that needs to be initialized. * * For example: * * [.hljs-theme-light.nopadding] * ```solidity * contract MyToken is ERC20Upgradeable { * function initialize() initializer public { * __ERC20_init("MyToken", "MTK"); * } * } * * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable { * function initializeV2() reinitializer(2) public { * __ERC20Permit_init("MyToken"); * } * } * ``` * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() { * _disableInitializers(); * } * ``` * ==== */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. * @custom:oz-retyped-from bool */ uint8 private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint8 version); /** * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope, * `onlyInitializing` functions can be used to initialize parent contracts. * * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a * constructor. * * Emits an {Initialized} event. */ modifier initializer() { bool isTopLevelCall = !_initializing; require( (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1), "Initializable: contract is already initialized" ); _initialized = 1; if (isTopLevelCall) { _initializing = true; } _; if (isTopLevelCall) { _initializing = false; emit Initialized(1); } } /** * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be * used to initialize parent contracts. * * A reinitializer may be used after the original initialization step. This is essential to configure modules that * are added through upgrades and that require initialization. * * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer` * cannot be nested. If one is invoked in the context of another, execution will revert. * * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in * a contract, executing them in the right order is up to the developer or operator. * * WARNING: setting the version to 255 will prevent any future reinitialization. * * Emits an {Initialized} event. */ modifier reinitializer(uint8 version) { require(!_initializing && _initialized < version, "Initializable: contract is already initialized"); _initialized = version; _initializing = true; _; _initializing = false; emit Initialized(version); } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} and {reinitializer} modifiers, directly or indirectly. */ modifier onlyInitializing() { require(_initializing, "Initializable: contract is not initializing"); _; } /** * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call. * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized * to any version. It is recommended to use this to lock implementation contracts that are designed to be called * through proxies. * * Emits an {Initialized} event the first time it is successfully executed. */ function _disableInitializers() internal virtual { require(!_initializing, "Initializable: contract is initializing"); if (_initialized != type(uint8).max) { _initialized = type(uint8).max; emit Initialized(type(uint8).max); } } /** * @dev Returns the highest version that has been initialized. See {reinitializer}. */ function _getInitializedVersion() internal view returns (uint8) { return _initialized; } /** * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}. */ function _isInitializing() internal view returns (bool) { return _initializing; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/UUPSUpgradeable.sol) pragma solidity ^0.8.0; import "../../interfaces/draft-IERC1822Upgradeable.sol"; import "../ERC1967/ERC1967UpgradeUpgradeable.sol"; import "./Initializable.sol"; /** * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy. * * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing * `UUPSUpgradeable` with a custom implementation of upgrades. * * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism. * * _Available since v4.1._ */ abstract contract UUPSUpgradeable is Initializable, IERC1822ProxiableUpgradeable, ERC1967UpgradeUpgradeable { function __UUPSUpgradeable_init() internal onlyInitializing { } function __UUPSUpgradeable_init_unchained() internal onlyInitializing { } /// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment address private immutable __self = address(this); /** * @dev Check that the execution is being performed through a delegatecall call and that the execution context is * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to * fail. */ modifier onlyProxy() { require(address(this) != __self, "Function must be called through delegatecall"); require(_getImplementation() == __self, "Function must be called through active proxy"); _; } /** * @dev Check that the execution is not being performed through a delegate call. This allows a function to be * callable on the implementing contract but not through proxies. */ modifier notDelegated() { require(address(this) == __self, "UUPSUpgradeable: must not be called through delegatecall"); _; } /** * @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the * implementation. It is used to validate the implementation's compatibility when performing an upgrade. * * 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. This is guaranteed by the `notDelegated` modifier. */ function proxiableUUID() external view virtual override notDelegated returns (bytes32) { return _IMPLEMENTATION_SLOT; } /** * @dev Upgrade the implementation of the proxy to `newImplementation`. * * Calls {_authorizeUpgrade}. * * Emits an {Upgraded} event. * * @custom:oz-upgrades-unsafe-allow-reachable delegatecall */ function upgradeTo(address newImplementation) public virtual onlyProxy { _authorizeUpgrade(newImplementation); _upgradeToAndCallUUPS(newImplementation, new bytes(0), false); } /** * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call * encoded in `data`. * * Calls {_authorizeUpgrade}. * * Emits an {Upgraded} event. * * @custom:oz-upgrades-unsafe-allow-reachable delegatecall */ function upgradeToAndCall(address newImplementation, bytes memory data) public payable virtual onlyProxy { _authorizeUpgrade(newImplementation); _upgradeToAndCallUUPS(newImplementation, data, true); } /** * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by * {upgradeTo} and {upgradeToAndCall}. * * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}. * * ```solidity * function _authorizeUpgrade(address) internal override onlyOwner {} * ``` */ function _authorizeUpgrade(address newImplementation) internal virtual; /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuardUpgradeable is Initializable { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; function __ReentrancyGuard_init() internal onlyInitializing { __ReentrancyGuard_init_unchained(); } function __ReentrancyGuard_init_unchained() internal onlyInitializing { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { // On the first call to nonReentrant, _status will be _NOT_ENTERED require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; } function _nonReentrantAfter() private { // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } /** * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a * `nonReentrant` function in the call stack. */ function _reentrancyGuardEntered() internal view returns (bool) { return _status == _ENTERED; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * * Furthermore, `isContract` will also return true if the target contract within * the same transaction is already scheduled for destruction by `SELFDESTRUCT`, * which only has an effect at the end of a transaction. * ==== * * [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://consensys.net/diligence/blog/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.8.0/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; import "../proxy/utils/Initializable.sol"; /** * @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 ContextUpgradeable is Initializable { function __Context_init() internal onlyInitializing { } function __Context_init_unchained() internal onlyInitializing { } function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/StorageSlot.sol) // This file was procedurally generated from scripts/generate/templates/StorageSlot.js. 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: * ```solidity * 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`, `uint256`._ * _Available since v4.9 for `string`, `bytes`._ */ library StorageSlotUpgradeable { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } struct StringSlot { string value; } struct BytesSlot { bytes 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 } } /** * @dev Returns an `StringSlot` with member `value` located at `slot`. */ function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `StringSlot` representation of the string storage pointer `store`. */ function getStringSlot(string storage store) internal pure returns (StringSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := store.slot } } /** * @dev Returns an `BytesSlot` with member `value` located at `slot`. */ function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`. */ function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := store.slot } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 amount) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/IERC20Permit.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; /** * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } /** * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful. */ function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } /** * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 oldAllowance = token.allowance(address(this), spender); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value)); } /** * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value)); } } /** * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. Compatible with tokens that require the approval to be set to * 0 before setting it to a non-zero value. */ function forceApprove(IERC20 token, address spender, uint256 value) internal { bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value); if (!_callOptionalReturnBool(token, approvalCall)) { _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0)); _callOptionalReturn(token, approvalCall); } } /** * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`. * Revert on invalid signature. */ function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). * * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead. */ function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false // and not revert is the subcall reverts. (bool success, bytes memory returndata) = address(token).call(data); return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.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 * * Furthermore, `isContract` will also return true if the target contract within * the same transaction is already scheduled for destruction by `SELFDESTRUCT`, * which only has an effect at the end of a transaction. * ==== * * [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://consensys.net/diligence/blog/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.8.0/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); } } }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"TaskManager__AddressCannotBeZero","type":"error"},{"inputs":[{"internalType":"address","name":"nonWhitelistedAddress","type":"address"}],"name":"TaskManager__AddressNotWhitelisted","type":"error"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"TaskManager__InvalidAmount","type":"error"},{"inputs":[{"internalType":"uint256","name":"taskId","type":"uint256"}],"name":"TaskManager__InvalidTaskId","type":"error"},{"inputs":[],"name":"TaskManager__MustBeRequestor","type":"error"},{"inputs":[],"name":"TaskManager__MustBeTaskAcceptor","type":"error"},{"inputs":[{"internalType":"uint256","name":"refundTime","type":"uint256"}],"name":"TaskManager__MustWaitRefundTime","type":"error"},{"inputs":[],"name":"TaskManager__NoBalanceToWithdraw","type":"error"},{"inputs":[],"name":"TaskManager__PaymentInsufficient","type":"error"},{"inputs":[{"internalType":"uint256","name":"taskId","type":"uint256"}],"name":"TaskManager__TaskAlreadyAccepted","type":"error"},{"inputs":[{"internalType":"uint256","name":"taskId","type":"uint256"}],"name":"TaskManager__TaskAlreadyCompleted","type":"error"},{"inputs":[],"name":"TaskManager__TasksDisabled","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"previousAdmin","type":"address"},{"indexed":false,"internalType":"address","name":"newAdmin","type":"address"}],"name":"AdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"beacon","type":"address"}],"name":"BeaconUpgraded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newPercentage","type":"uint256"}],"name":"NodePaymentPercentageUpdated","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"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"taskId","type":"uint256"}],"name":"PaymentReceived","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newPrice","type":"uint256"}],"name":"PricePerGPUUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"taskId","type":"uint256"}],"name":"RefundIssued","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newRefundTime","type":"uint256"}],"name":"RefundTimeUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"nodeAddress","type":"address"},{"indexed":true,"internalType":"uint256","name":"taskId","type":"uint256"}],"name":"TaskAccepted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"nodeAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"nodePayment","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"taskId","type":"uint256"}],"name":"TaskCompleted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"gpuAmount","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"taskId","type":"uint256"}],"name":"TaskCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"newAddress","type":"address"}],"name":"TokenAddressUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"implementation","type":"address"}],"name":"Upgraded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"nodeAddress","type":"address"},{"indexed":false,"internalType":"bool","name":"isWhitelisted","type":"bool"}],"name":"WhitelistUpdated","type":"event"},{"inputs":[{"internalType":"uint256","name":"taskId","type":"uint256"}],"name":"acceptTask","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"taskId","type":"uint256"},{"internalType":"string","name":"ipfsUrl","type":"string"}],"name":"completeTask","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getAvailableTasks","outputs":[{"components":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"payment","type":"uint256"},{"internalType":"uint128","name":"requestTimestamp","type":"uint128"},{"internalType":"uint64","name":"gpuPower","type":"uint64"},{"internalType":"bool","name":"isCompleted","type":"bool"},{"internalType":"enum TaskManager.ModelType","name":"modelType","type":"uint8"},{"internalType":"address","name":"user","type":"address"},{"internalType":"address","name":"node","type":"address"},{"internalType":"string","name":"description","type":"string"}],"internalType":"struct TaskManager.Task[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"taskIndex","type":"uint256"}],"name":"getIPFSUrl","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getNodePaymentPercentage","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPricePerGPU","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getRefundTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"taskId","type":"uint256"}],"name":"getTask","outputs":[{"components":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"payment","type":"uint256"},{"internalType":"uint128","name":"requestTimestamp","type":"uint128"},{"internalType":"uint64","name":"gpuPower","type":"uint64"},{"internalType":"bool","name":"isCompleted","type":"bool"},{"internalType":"enum TaskManager.ModelType","name":"modelType","type":"uint8"},{"internalType":"address","name":"user","type":"address"},{"internalType":"address","name":"node","type":"address"},{"internalType":"string","name":"description","type":"string"}],"internalType":"struct TaskManager.Task","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTaskCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTaskCountCompleted","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTasksEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTokenAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTotalGPUPowerCompleted","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"getUserTasks","outputs":[{"components":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"payment","type":"uint256"},{"internalType":"uint128","name":"requestTimestamp","type":"uint128"},{"internalType":"uint64","name":"gpuPower","type":"uint64"},{"internalType":"bool","name":"isCompleted","type":"bool"},{"internalType":"enum TaskManager.ModelType","name":"modelType","type":"uint8"},{"internalType":"address","name":"user","type":"address"},{"internalType":"address","name":"node","type":"address"},{"internalType":"string","name":"description","type":"string"}],"internalType":"struct TaskManager.Task[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"tokenAddress","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"nodeAddress","type":"address"}],"name":"isAddressWhitelisted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"taskIndex","type":"uint256"}],"name":"isTaskAvailable","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"taskIndex","type":"uint256"}],"name":"isTaskComplete","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"proxiableUUID","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"taskId","type":"uint256"}],"name":"refundTask","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"payment","type":"uint256"},{"internalType":"uint64","name":"gpuAmount","type":"uint64"},{"internalType":"enum TaskManager.ModelType","name":"modelType","type":"uint8"},{"internalType":"string","name":"description","type":"string"}],"name":"requestTask","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"},{"internalType":"bool","name":"isWhitelisted","type":"bool"}],"name":"setAddressWhitelisted","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newPercentage","type":"uint256"}],"name":"setNodePaymentPercentage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newPrice","type":"uint256"}],"name":"setPricePerGPU","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newRefundTime","type":"uint256"}],"name":"setRefundTime","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"enabled","type":"bool"}],"name":"setTasksEnabled","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newAddr","type":"address"}],"name":"setTokenAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"}],"name":"upgradeTo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"upgradeToAndCall","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdrawTokens","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60a0604052306080523480156200001557600080fd5b506200002062000026565b620000e7565b600054610100900460ff1615620000935760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff90811614620000e5576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b6080516132d96200011f600039600081816111b0015281816111f0015281816112f60152818161133601526113c901526132d96000f3fe6080604052600436106101ee5760003560e01c806352d1902d1161010d578063b6802da7116100a0578063c4d66de81161006f578063c4d66de814610591578063c9b3d3be146105b1578063d6d25b68146105d1578063d961b042146105f1578063f2fde38b1461061157600080fd5b8063b6802da71461050b578063b7b4dc1714610546578063b7be32671461055c578063c17a340e1461057c57600080fd5b8063848e96b8116100dc578063848e96b8146104805780638da5cb5b146104ad57806395d57660146104cb578063a7120f41146104eb57600080fd5b806352d1902d14610417578063715018a61461042c57806374aaa7601461044157806377273ca61461046157600080fd5b80632b07140e116101855780633b7da8f3116101545780633b7da8f3146103b9578063480e6c24146103cf5780634f1ef286146103ef5780634f229aad1461040257600080fd5b80632b07140e14610342578063322ac83d14610357578063340734e9146103775780633659cfe61461039957600080fd5b80631d65e77e116101c15780631d65e77e146102b65780631f944b85146102e357806326a4e8d214610302578063286774361461032257600080fd5b806306b091f9146101f357806310fe9ae81461021557806313f44d101461024c5780631bf6912d14610296575b600080fd5b3480156101ff57600080fd5b5061021361020e366004612af4565b610631565b005b34801561022157600080fd5b5060fb546001600160a01b03165b6040516001600160a01b0390911681526020015b60405180910390f35b34801561025857600080fd5b50610286610267366004612b1e565b6001600160a01b03166000908152610103602052604090205460ff1690565b6040519015158152602001610243565b3480156102a257600080fd5b506102136102b1366004612b39565b610717565b3480156102c257600080fd5b506102d66102d1366004612b39565b610855565b6040516102439190612c90565b3480156102ef57600080fd5b5060fc545b604051908152602001610243565b34801561030e57600080fd5b5061021361031d366004612b1e565b6109b9565b34801561032e57600080fd5b5061021361033d366004612b39565b610a32565b34801561034e57600080fd5b5060fd546102f4565b34801561036357600080fd5b50610286610372366004612b39565b610bb5565b34801561038357600080fd5b5061038c610d49565b6040516102439190612ca3565b3480156103a557600080fd5b506102136103b4366004612b1e565b6111a6565b3480156103c557600080fd5b50610102546102f4565b3480156103db57600080fd5b506102136103ea366004612b39565b611282565b6102136103fd366004612d90565b6112ec565b34801561040e57600080fd5b5060fe546102f4565b34801561042357600080fd5b506102f46113bc565b34801561043857600080fd5b5061021361146f565b34801561044d57600080fd5b5061021361045c366004612e11565b611483565b34801561046d57600080fd5b5060fb54600160a01b900460ff16610286565b34801561048c57600080fd5b506104a061049b366004612b39565b611684565b6040516102439190612e4d565b3480156104b957600080fd5b506033546001600160a01b031661022f565b3480156104d757600080fd5b5061038c6104e6366004612b1e565b6118b5565b3480156104f757600080fd5b50610213610506366004612e6e565b611cd2565b34801561051757600080fd5b50610286610526366004612b39565b60009081526101056020526040902060020154600160c01b900460ff1690565b34801561055257600080fd5b50610101546102f4565b34801561056857600080fd5b50610213610577366004612b39565b611d61565b34801561058857600080fd5b5060ff546102f4565b34801561059d57600080fd5b506102136105ac366004612b1e565b611d9e565b3480156105bd57600080fd5b506102136105cc366004612ea5565b611efc565b3480156105dd57600080fd5b506102136105ec366004612b39565b611f22565b3480156105fd57600080fd5b5061021361060c366004612ec2565b611f5f565b34801561061d57600080fd5b5061021361062c366004612b1e565b612216565b61063961228c565b6001600160a01b038216610660576040516305b179d760e11b815260040160405180910390fd5b60fb546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa1580156106a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106cd9190612f3c565b9050806000036106f057604051637ca3f17b60e11b815260040160405180910390fd5b808210156106fb5750805b60fb54610712906001600160a01b031684836122e6565b505050565b61071f612349565b336000908152610103602052604090205460ff1661075757604051635b7d813d60e01b81523360048201526024015b60405180910390fd5b600081815261010560205260408120805490910361078b57604051630c33789b60e21b81526004810183905260240161074e565b6002810154600160c01b900460ff16156107bb57604051637e34e71760e01b81526004810183905260240161074e565b60048101546001600160a01b0316156107ea576040516357b8390560e11b81526004810183905260240161074e565b6004810180546001600160a01b03191633179055610100805460019190600090610815908490612f6b565b9091555050604051829033907fa75dafd95cb29d9444b5277840b2e249bad34f0e92c59be86765d0a6566e392990600090a3506108526001606555565b50565b61085d612a8e565b6000828152610105602090815260408083208151610120810183528154815260018201549381019390935260028101546001600160801b038116928401929092526001600160401b03600160801b830416606084015260ff600160c01b8304811615156080850152909160a0840191600160c81b90910416600c8111156108e6576108e6612b52565b600c8111156108f7576108f7612b52565b815260038201546001600160a01b039081166020830152600483015416604082015260058201805460609092019161092e90612f7e565b80601f016020809104026020016040519081016040528092919081815260200182805461095a90612f7e565b80156109a75780601f1061097c576101008083540402835291602001916109a7565b820191906000526020600020905b81548152906001019060200180831161098a57829003601f168201915b50505091909252509195945050505050565b6109c161228c565b6001600160a01b0381166109e8576040516305b179d760e11b815260040160405180910390fd5b60fb80546001600160a01b0319166001600160a01b0383169081179091556040517f2f0c7f17be551d1f4566672cd67adbe50173e96632f56ff80d80acc4ac00f32890600090a250565b610a3a612349565b6000818152610105602052604081208054909103610a6e57604051630c33789b60e21b81526004810183905260240161074e565b60038101546001600160a01b03163314610a9b57604051630ce124d960e01b815260040160405180910390fd5b6002810154600160c01b900460ff1615610acb57604051637e34e71760e01b81526004810183905260240161074e565b60fe546002820154610ae691906001600160801b0316612f6b565b421015610b0c5760fe546040516350d6e8b360e01b815260040161074e91815260200190565b60028101805460ff60c01b1916600160c01b179055610100805460019190600090610b38908490612f6b565b9250508190555060016101016000828254610b539190612f6b565b9091555050600181015460fb54610b77916001600160a01b039091169033906122e6565b600181015460405183919033907f93c496f36ecab5f5583f216646cac3acb12a63aeacddb1a9251ceb81f0ee36e790600090a4506108526001606555565b6000818152610105602090815260408083208151610120810183528154815260018201549381019390935260028101546001600160801b038116928401929092526001600160401b03600160801b830416606084015260ff600160c01b830481161515608085015284939260a0840191600160c81b90910416600c811115610c3f57610c3f612b52565b600c811115610c5057610c50612b52565b815260038201546001600160a01b0390811660208301526004830154166040820152600582018054606090920191610c8790612f7e565b80601f0160208091040260200160405190810160405280929190818152602001828054610cb390612f7e565b8015610d005780601f10610cd557610100808354040283529160200191610d00565b820191906000526020600020905b815481529060010190602001808311610ce357829003601f168201915b5050509190925250505060c08101519091506001600160a01b031615801590610d34575060e08101516001600160a01b0316155b8015610d4257508060800151155b9392505050565b606060006101005460ff54610d5e9190612fb8565b90506000816001600160401b03811115610d7a57610d7a612d05565b604051908082528060200260200182016040528015610da3578160200160208202803683370190505b5060ff549091506000905b8382108015610dbd5750600081115b15610f96576000818152610105602090815260408083208151610120810183528154815260018201549381019390935260028101546001600160801b038116928401929092526001600160401b03600160801b830416606084015260ff600160c01b8304811615156080850152909160a0840191600160c81b90910416600c811115610e4b57610e4b612b52565b600c811115610e5c57610e5c612b52565b815260038201546001600160a01b0390811660208301526004830154166040820152600582018054606090920191610e9390612f7e565b80601f0160208091040260200160405190810160405280929190818152602001828054610ebf90612f7e565b8015610f0c5780601f10610ee157610100808354040283529160200191610f0c565b820191906000526020600020905b815481529060010190602001808311610eef57829003601f168201915b5050509190925250505060c08101519091506001600160a01b031615801590610f40575060e08101516001600160a01b0316155b8015610f4e57508060800151155b15610f83578060000151848481518110610f6a57610f6a612fcb565b6020908102919091010152610f80600184612f6b565b92505b610f8e600183612fb8565b915050610dae565b6000846001600160401b03811115610fb057610fb0612d05565b604051908082528060200260200182016040528015610fe957816020015b610fd6612a8e565b815260200190600190039081610fce5790505b50905060005b8581101561119c57610105600086838151811061100e5761100e612fcb565b60209081029190910181015182528181019290925260409081016000208151610120810183528154815260018201549381019390935260028101546001600160801b038116928401929092526001600160401b03600160801b830416606084015260ff600160c01b8304811615156080850152909160a0840191600160c81b90910416600c8111156110a2576110a2612b52565b600c8111156110b3576110b3612b52565b815260038201546001600160a01b03908116602083015260048301541660408201526005820180546060909201916110ea90612f7e565b80601f016020809104026020016040519081016040528092919081815260200182805461111690612f7e565b80156111635780601f1061113857610100808354040283529160200191611163565b820191906000526020600020905b81548152906001019060200180831161114657829003601f168201915b50505050508152505082828151811061117e5761117e612fcb565b6020026020010181905250808061119490612fe1565b915050610fef565b5095945050505050565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001630036111ee5760405162461bcd60e51b815260040161074e90612ffa565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661123760008051602061325d833981519152546001600160a01b031690565b6001600160a01b03161461125d5760405162461bcd60e51b815260040161074e90613046565b611266816123a9565b60408051600080825260208201909252610852918391906123b1565b61128a61228c565b6127108111156112b05760405163a912d23160e01b81526004810182905260240161074e565b60fc8190556040518181527f7da8658a825489d2f8b300edb8029d9272b28cbade68d0d11f0d046957db4ca8906020015b60405180910390a150565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001630036113345760405162461bcd60e51b815260040161074e90612ffa565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661137d60008051602061325d833981519152546001600160a01b031690565b6001600160a01b0316146113a35760405162461bcd60e51b815260040161074e90613046565b6113ac826123a9565b6113b8828260016123b1565b5050565b6000306001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461145c5760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c0000000000000000606482015260840161074e565b5060008051602061325d83398151915290565b61147761228c565b611481600061251c565b565b61148b612349565b60008281526101056020526040812080549091036114bf57604051630c33789b60e21b81526004810184905260240161074e565b6002810154600160c01b900460ff16156114ef57604051637e34e71760e01b81526004810184905260240161074e565b60048101546001600160a01b0316331461151c57604051632e5ef29b60e21b815260040160405180910390fd5b60028101805460ff60c01b1916600160c01b179055610101805460019190600090611548908490612f6b565b909155505060028101546101028054600160801b9092046001600160401b031691600090611577908490612f6b565b909155505081511561159e5760008381526101046020526040902061159c83826130e0565b505b600061271060fc5483600101546115b5919061319f565b6115bf91906131b6565b60fb5460048481015460405163a9059cbb60e01b81526001600160a01b03918216928101929092526024820184905292935091169063a9059cbb906044016020604051808303816000875af115801561161c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061164091906131d8565b50604051818152849033907f50c83292cbed2e0e82c326c455870ed0cfe292eb185581159265e76147d205ea9060200160405180910390a350506113b86001606555565b6000818152610105602090815260408083208151610120810183528154815260018201549381019390935260028101546001600160801b038116928401929092526001600160401b03600160801b83041660608481019190915260ff600160c01b84048116151560808601529094939260a0840191600160c81b90910416600c81111561171357611713612b52565b600c81111561172457611724612b52565b815260038201546001600160a01b039081166020830152600483015416604082015260058201805460609092019161175b90612f7e565b80601f016020809104026020016040519081016040528092919081815260200182805461178790612f7e565b80156117d45780601f106117a9576101008083540402835291602001916117d4565b820191906000526020600020905b8154815290600101906020018083116117b757829003601f168201915b50505050508152505090508060c001516001600160a01b0316336001600160a01b03161461181557604051630ce124d960e01b815260040160405180910390fd5b600083815261010460205260409020805461182f90612f7e565b80601f016020809104026020016040519081016040528092919081815260200182805461185b90612f7e565b80156118a85780601f1061187d576101008083540402835291602001916118a8565b820191906000526020600020905b81548152906001019060200180831161188b57829003601f168201915b5050505050915050919050565b6060600060ff546001600160401b038111156118d3576118d3612d05565b6040519080825280602002602001820160405280156118fc578160200160208202803683370190505b509050600060015b60ff548111611ac2576000818152610105602090815260408083208151610120810183528154815260018201549381019390935260028101546001600160801b038116928401929092526001600160401b03600160801b830416606084015260ff600160c01b8304811615156080850152909160a0840191600160c81b90910416600c81111561199657611996612b52565b600c8111156119a7576119a7612b52565b815260038201546001600160a01b03908116602083015260048301541660408201526005820180546060909201916119de90612f7e565b80601f0160208091040260200160405190810160405280929190818152602001828054611a0a90612f7e565b8015611a575780601f10611a2c57610100808354040283529160200191611a57565b820191906000526020600020905b815481529060010190602001808311611a3a57829003601f168201915b5050505050815250509050856001600160a01b03168160c001516001600160a01b031603611aaf578060000151848481518110611a9657611a96612fcb565b6020908102919091010152611aac600184612f6b565b92505b5080611aba81612fe1565b915050611904565b506000816001600160401b03811115611add57611add612d05565b604051908082528060200260200182016040528015611b1657816020015b611b03612a8e565b815260200190600190039081611afb5790505b50905060005b82811015611cc9576101056000858381518110611b3b57611b3b612fcb565b60209081029190910181015182528181019290925260409081016000208151610120810183528154815260018201549381019390935260028101546001600160801b038116928401929092526001600160401b03600160801b830416606084015260ff600160c01b8304811615156080850152909160a0840191600160c81b90910416600c811115611bcf57611bcf612b52565b600c811115611be057611be0612b52565b815260038201546001600160a01b0390811660208301526004830154166040820152600582018054606090920191611c1790612f7e565b80601f0160208091040260200160405190810160405280929190818152602001828054611c4390612f7e565b8015611c905780601f10611c6557610100808354040283529160200191611c90565b820191906000526020600020905b815481529060010190602001808311611c7357829003601f168201915b505050505081525050828281518110611cab57611cab612fcb565b60200260200101819052508080611cc190612fe1565b915050611b1c565b50949350505050565b611cda61228c565b6001600160a01b038216611d01576040516305b179d760e11b815260040160405180910390fd5b6001600160a01b03821660008181526101036020908152604091829020805460ff191685151590811790915591519182527ff93f9a76c1bf3444d22400a00cb9fe990e6abe9dbb333fda48859cfee864543d910160405180910390a25050565b611d6961228c565b60fe8190556040518181527faef790bb563f7c3516b8b6516e2a221a0fa18644c01e8653398601a93fcf445c906020016112e1565b600054610100900460ff1615808015611dbe5750600054600160ff909116105b80611dd85750303b158015611dd8575060005460ff166001145b611e3b5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161074e565b6000805460ff191660011790558015611e5e576000805461ff0019166101001790555b611e6661256e565b611e6e61259d565b611e766125cc565b60fb80546001600160a01b0319166001600160a01b038416179055600060ff81905561010155655af3107a400060fd55611b5860fc556201518060fe5580156113b8576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15050565b611f0461228c565b60fb8054911515600160a01b0260ff60a01b19909216919091179055565b611f2a61228c565b60fd8190556040518181527ff66fd270c0ccdc9a4c49b3ce08d6b47d3ee930bb6dbef9ab3a82c9c994e5557d906020016112e1565b611f67612349565b60fb54600160a01b900460ff16611f915760405163596f053960e11b815260040160405180910390fd5b831580611fa557506001600160401b038316155b15611fc65760405163a912d23160e01b81526000600482015260240161074e565b826001600160401b031660fd54611fdd919061319f565b841015611ffd57604051633afc0f3760e01b815260040160405180910390fd5b60fb54612015906001600160a01b03163330876125f3565b600160ff60008282546120289190612f6b565b9250508190555060405180610120016040528060ff548152602001858152602001426001600160801b03168152602001846001600160401b0316815260200160001515815260200183600c81111561208257612082612b52565b81523360208083019190915260006040808401829052606093840186905260ff548252610105835290819020845181559184015160018301558301516002820180549385015160808601511515600160c01b0260ff60c01b196001600160401b03909216600160801b026001600160c01b03199096166001600160801b0390941693909317949094179384168217815560a08501519293909160ff60c81b191661ffff60c01b1990911617600160c81b83600c81111561214457612144612b52565b021790555060c08201516003820180546001600160a01b039283166001600160a01b03199182161790915560e0840151600484018054919093169116179055610100820151600582019061219890826130e0565b505060ff546040519091506001600160401b0385169033907f68dac2ef7ff122a4dd4f78b2ef3cf6512e8079afe1bf2190c1c0ba71496825fa90600090a460ff54604051859033907f5677b5d4cf976ac32defbd95a6a5aaf0d1fee450a11fc26f3c11aae6e6c33d0690600090a46122106001606555565b50505050565b61221e61228c565b6001600160a01b0381166122835760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161074e565b6108528161251c565b6033546001600160a01b031633146114815760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161074e565b6040516001600160a01b03831660248201526044810182905261071290849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261262b565b60026065540361239b5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161074e565b6002606555565b6001606555565b61085261228c565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff16156123e45761071283612700565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa92505050801561243e575060408051601f3d908101601f1916820190925261243b91810190612f3c565b60015b6124a15760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b606482015260840161074e565b60008051602061325d83398151915281146125105760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b606482015260840161074e565b5061071283838361279c565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff166125955760405162461bcd60e51b815260040161074e906131f5565b6114816127c1565b600054610100900460ff166125c45760405162461bcd60e51b815260040161074e906131f5565b6114816127f1565b600054610100900460ff166114815760405162461bcd60e51b815260040161074e906131f5565b6040516001600160a01b03808516602483015283166044820152606481018290526122109085906323b872dd60e01b90608401612312565b6000612680826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166128189092919063ffffffff16565b90508051600014806126a15750808060200190518101906126a191906131d8565b6107125760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161074e565b6001600160a01b0381163b61276d5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b606482015260840161074e565b60008051602061325d83398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b6127a58361282f565b6000825111806127b25750805b1561071257612210838361286f565b600054610100900460ff166127e85760405162461bcd60e51b815260040161074e906131f5565b6114813361251c565b600054610100900460ff166123a25760405162461bcd60e51b815260040161074e906131f5565b6060612827848460008561289d565b949350505050565b61283881612700565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060612894838360405180606001604052806027815260200161327d60279139612978565b90505b92915050565b6060824710156128fe5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161074e565b600080866001600160a01b0316858760405161291a9190613240565b60006040518083038185875af1925050503d8060008114612957576040519150601f19603f3d011682016040523d82523d6000602084013e61295c565b606091505b509150915061296d878383876129f0565b979650505050505050565b6060600080856001600160a01b0316856040516129959190613240565b600060405180830381855af49150503d80600081146129d0576040519150601f19603f3d011682016040523d82523d6000602084013e6129d5565b606091505b50915091506129e6868383876129f0565b9695505050505050565b60608315612a5f578251600003612a58576001600160a01b0385163b612a585760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161074e565b5081612827565b6128278383815115612a745781518083602001fd5b8060405162461bcd60e51b815260040161074e9190612e4d565b604080516101208101825260008082526020820181905291810182905260608101829052608081018290529060a08201908152600060208201819052604082015260609081015290565b80356001600160a01b0381168114612aef57600080fd5b919050565b60008060408385031215612b0757600080fd5b612b1083612ad8565b946020939093013593505050565b600060208284031215612b3057600080fd5b61289482612ad8565b600060208284031215612b4b57600080fd5b5035919050565b634e487b7160e01b600052602160045260246000fd5b600d8110612b8657634e487b7160e01b600052602160045260246000fd5b9052565b60005b83811015612ba5578181015183820152602001612b8d565b50506000910152565b60008151808452612bc6816020860160208601612b8a565b601f01601f19169290920160200192915050565b600061012082518452602083015160208501526001600160801b0360408401511660408501526060830151612c1a60608601826001600160401b03169052565b506080830151612c2e608086018215159052565b5060a0830151612c4160a0860182612b68565b5060c0830151612c5c60c08601826001600160a01b03169052565b5060e0830151612c7760e08601826001600160a01b03169052565b506101008084015182828701526129e683870182612bae565b6020815260006128946020830184612bda565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015612cf857603f19888603018452612ce6858351612bda565b94509285019290850190600101612cca565b5092979650505050505050565b634e487b7160e01b600052604160045260246000fd5b60006001600160401b0380841115612d3557612d35612d05565b604051601f8501601f19908116603f01168101908282118183101715612d5d57612d5d612d05565b81604052809350858152868686011115612d7657600080fd5b858560208301376000602087830101525050509392505050565b60008060408385031215612da357600080fd5b612dac83612ad8565b915060208301356001600160401b03811115612dc757600080fd5b8301601f81018513612dd857600080fd5b612de785823560208401612d1b565b9150509250929050565b600082601f830112612e0257600080fd5b61289483833560208501612d1b565b60008060408385031215612e2457600080fd5b8235915060208301356001600160401b03811115612e4157600080fd5b612de785828601612df1565b6020815260006128946020830184612bae565b801515811461085257600080fd5b60008060408385031215612e8157600080fd5b612e8a83612ad8565b91506020830135612e9a81612e60565b809150509250929050565b600060208284031215612eb757600080fd5b8135610d4281612e60565b60008060008060808587031215612ed857600080fd5b8435935060208501356001600160401b038082168214612ef757600080fd5b909350604086013590600d8210612f0d57600080fd5b90925060608601359080821115612f2357600080fd5b50612f3087828801612df1565b91505092959194509250565b600060208284031215612f4e57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b8082018082111561289757612897612f55565b600181811c90821680612f9257607f821691505b602082108103612fb257634e487b7160e01b600052602260045260246000fd5b50919050565b8181038181111561289757612897612f55565b634e487b7160e01b600052603260045260246000fd5b600060018201612ff357612ff3612f55565b5060010190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b601f82111561071257600081815260208120601f850160051c810160208610156130b95750805b601f850160051c820191505b818110156130d8578281556001016130c5565b505050505050565b81516001600160401b038111156130f9576130f9612d05565b61310d816131078454612f7e565b84613092565b602080601f831160018114613142576000841561312a5750858301515b600019600386901b1c1916600185901b1785556130d8565b600085815260208120601f198616915b8281101561317157888601518255948401946001909101908401613152565b508582101561318f5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b808202811582820484141761289757612897612f55565b6000826131d357634e487b7160e01b600052601260045260246000fd5b500490565b6000602082840312156131ea57600080fd5b8151610d4281612e60565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60008251613252818460208701612b8a565b919091019291505056fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a264697066735822122099abed0c93e1a53b149a3bd4d50d7e0a628f49d42e4dfa77c95474d08a44a4f064736f6c63430008130033
Deployed Bytecode
0x6080604052600436106101ee5760003560e01c806352d1902d1161010d578063b6802da7116100a0578063c4d66de81161006f578063c4d66de814610591578063c9b3d3be146105b1578063d6d25b68146105d1578063d961b042146105f1578063f2fde38b1461061157600080fd5b8063b6802da71461050b578063b7b4dc1714610546578063b7be32671461055c578063c17a340e1461057c57600080fd5b8063848e96b8116100dc578063848e96b8146104805780638da5cb5b146104ad57806395d57660146104cb578063a7120f41146104eb57600080fd5b806352d1902d14610417578063715018a61461042c57806374aaa7601461044157806377273ca61461046157600080fd5b80632b07140e116101855780633b7da8f3116101545780633b7da8f3146103b9578063480e6c24146103cf5780634f1ef286146103ef5780634f229aad1461040257600080fd5b80632b07140e14610342578063322ac83d14610357578063340734e9146103775780633659cfe61461039957600080fd5b80631d65e77e116101c15780631d65e77e146102b65780631f944b85146102e357806326a4e8d214610302578063286774361461032257600080fd5b806306b091f9146101f357806310fe9ae81461021557806313f44d101461024c5780631bf6912d14610296575b600080fd5b3480156101ff57600080fd5b5061021361020e366004612af4565b610631565b005b34801561022157600080fd5b5060fb546001600160a01b03165b6040516001600160a01b0390911681526020015b60405180910390f35b34801561025857600080fd5b50610286610267366004612b1e565b6001600160a01b03166000908152610103602052604090205460ff1690565b6040519015158152602001610243565b3480156102a257600080fd5b506102136102b1366004612b39565b610717565b3480156102c257600080fd5b506102d66102d1366004612b39565b610855565b6040516102439190612c90565b3480156102ef57600080fd5b5060fc545b604051908152602001610243565b34801561030e57600080fd5b5061021361031d366004612b1e565b6109b9565b34801561032e57600080fd5b5061021361033d366004612b39565b610a32565b34801561034e57600080fd5b5060fd546102f4565b34801561036357600080fd5b50610286610372366004612b39565b610bb5565b34801561038357600080fd5b5061038c610d49565b6040516102439190612ca3565b3480156103a557600080fd5b506102136103b4366004612b1e565b6111a6565b3480156103c557600080fd5b50610102546102f4565b3480156103db57600080fd5b506102136103ea366004612b39565b611282565b6102136103fd366004612d90565b6112ec565b34801561040e57600080fd5b5060fe546102f4565b34801561042357600080fd5b506102f46113bc565b34801561043857600080fd5b5061021361146f565b34801561044d57600080fd5b5061021361045c366004612e11565b611483565b34801561046d57600080fd5b5060fb54600160a01b900460ff16610286565b34801561048c57600080fd5b506104a061049b366004612b39565b611684565b6040516102439190612e4d565b3480156104b957600080fd5b506033546001600160a01b031661022f565b3480156104d757600080fd5b5061038c6104e6366004612b1e565b6118b5565b3480156104f757600080fd5b50610213610506366004612e6e565b611cd2565b34801561051757600080fd5b50610286610526366004612b39565b60009081526101056020526040902060020154600160c01b900460ff1690565b34801561055257600080fd5b50610101546102f4565b34801561056857600080fd5b50610213610577366004612b39565b611d61565b34801561058857600080fd5b5060ff546102f4565b34801561059d57600080fd5b506102136105ac366004612b1e565b611d9e565b3480156105bd57600080fd5b506102136105cc366004612ea5565b611efc565b3480156105dd57600080fd5b506102136105ec366004612b39565b611f22565b3480156105fd57600080fd5b5061021361060c366004612ec2565b611f5f565b34801561061d57600080fd5b5061021361062c366004612b1e565b612216565b61063961228c565b6001600160a01b038216610660576040516305b179d760e11b815260040160405180910390fd5b60fb546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa1580156106a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106cd9190612f3c565b9050806000036106f057604051637ca3f17b60e11b815260040160405180910390fd5b808210156106fb5750805b60fb54610712906001600160a01b031684836122e6565b505050565b61071f612349565b336000908152610103602052604090205460ff1661075757604051635b7d813d60e01b81523360048201526024015b60405180910390fd5b600081815261010560205260408120805490910361078b57604051630c33789b60e21b81526004810183905260240161074e565b6002810154600160c01b900460ff16156107bb57604051637e34e71760e01b81526004810183905260240161074e565b60048101546001600160a01b0316156107ea576040516357b8390560e11b81526004810183905260240161074e565b6004810180546001600160a01b03191633179055610100805460019190600090610815908490612f6b565b9091555050604051829033907fa75dafd95cb29d9444b5277840b2e249bad34f0e92c59be86765d0a6566e392990600090a3506108526001606555565b50565b61085d612a8e565b6000828152610105602090815260408083208151610120810183528154815260018201549381019390935260028101546001600160801b038116928401929092526001600160401b03600160801b830416606084015260ff600160c01b8304811615156080850152909160a0840191600160c81b90910416600c8111156108e6576108e6612b52565b600c8111156108f7576108f7612b52565b815260038201546001600160a01b039081166020830152600483015416604082015260058201805460609092019161092e90612f7e565b80601f016020809104026020016040519081016040528092919081815260200182805461095a90612f7e565b80156109a75780601f1061097c576101008083540402835291602001916109a7565b820191906000526020600020905b81548152906001019060200180831161098a57829003601f168201915b50505091909252509195945050505050565b6109c161228c565b6001600160a01b0381166109e8576040516305b179d760e11b815260040160405180910390fd5b60fb80546001600160a01b0319166001600160a01b0383169081179091556040517f2f0c7f17be551d1f4566672cd67adbe50173e96632f56ff80d80acc4ac00f32890600090a250565b610a3a612349565b6000818152610105602052604081208054909103610a6e57604051630c33789b60e21b81526004810183905260240161074e565b60038101546001600160a01b03163314610a9b57604051630ce124d960e01b815260040160405180910390fd5b6002810154600160c01b900460ff1615610acb57604051637e34e71760e01b81526004810183905260240161074e565b60fe546002820154610ae691906001600160801b0316612f6b565b421015610b0c5760fe546040516350d6e8b360e01b815260040161074e91815260200190565b60028101805460ff60c01b1916600160c01b179055610100805460019190600090610b38908490612f6b565b9250508190555060016101016000828254610b539190612f6b565b9091555050600181015460fb54610b77916001600160a01b039091169033906122e6565b600181015460405183919033907f93c496f36ecab5f5583f216646cac3acb12a63aeacddb1a9251ceb81f0ee36e790600090a4506108526001606555565b6000818152610105602090815260408083208151610120810183528154815260018201549381019390935260028101546001600160801b038116928401929092526001600160401b03600160801b830416606084015260ff600160c01b830481161515608085015284939260a0840191600160c81b90910416600c811115610c3f57610c3f612b52565b600c811115610c5057610c50612b52565b815260038201546001600160a01b0390811660208301526004830154166040820152600582018054606090920191610c8790612f7e565b80601f0160208091040260200160405190810160405280929190818152602001828054610cb390612f7e565b8015610d005780601f10610cd557610100808354040283529160200191610d00565b820191906000526020600020905b815481529060010190602001808311610ce357829003601f168201915b5050509190925250505060c08101519091506001600160a01b031615801590610d34575060e08101516001600160a01b0316155b8015610d4257508060800151155b9392505050565b606060006101005460ff54610d5e9190612fb8565b90506000816001600160401b03811115610d7a57610d7a612d05565b604051908082528060200260200182016040528015610da3578160200160208202803683370190505b5060ff549091506000905b8382108015610dbd5750600081115b15610f96576000818152610105602090815260408083208151610120810183528154815260018201549381019390935260028101546001600160801b038116928401929092526001600160401b03600160801b830416606084015260ff600160c01b8304811615156080850152909160a0840191600160c81b90910416600c811115610e4b57610e4b612b52565b600c811115610e5c57610e5c612b52565b815260038201546001600160a01b0390811660208301526004830154166040820152600582018054606090920191610e9390612f7e565b80601f0160208091040260200160405190810160405280929190818152602001828054610ebf90612f7e565b8015610f0c5780601f10610ee157610100808354040283529160200191610f0c565b820191906000526020600020905b815481529060010190602001808311610eef57829003601f168201915b5050509190925250505060c08101519091506001600160a01b031615801590610f40575060e08101516001600160a01b0316155b8015610f4e57508060800151155b15610f83578060000151848481518110610f6a57610f6a612fcb565b6020908102919091010152610f80600184612f6b565b92505b610f8e600183612fb8565b915050610dae565b6000846001600160401b03811115610fb057610fb0612d05565b604051908082528060200260200182016040528015610fe957816020015b610fd6612a8e565b815260200190600190039081610fce5790505b50905060005b8581101561119c57610105600086838151811061100e5761100e612fcb565b60209081029190910181015182528181019290925260409081016000208151610120810183528154815260018201549381019390935260028101546001600160801b038116928401929092526001600160401b03600160801b830416606084015260ff600160c01b8304811615156080850152909160a0840191600160c81b90910416600c8111156110a2576110a2612b52565b600c8111156110b3576110b3612b52565b815260038201546001600160a01b03908116602083015260048301541660408201526005820180546060909201916110ea90612f7e565b80601f016020809104026020016040519081016040528092919081815260200182805461111690612f7e565b80156111635780601f1061113857610100808354040283529160200191611163565b820191906000526020600020905b81548152906001019060200180831161114657829003601f168201915b50505050508152505082828151811061117e5761117e612fcb565b6020026020010181905250808061119490612fe1565b915050610fef565b5095945050505050565b6001600160a01b037f00000000000000000000000044a94acccd11f4ac60b2b975eede381790a9274d1630036111ee5760405162461bcd60e51b815260040161074e90612ffa565b7f00000000000000000000000044a94acccd11f4ac60b2b975eede381790a9274d6001600160a01b031661123760008051602061325d833981519152546001600160a01b031690565b6001600160a01b03161461125d5760405162461bcd60e51b815260040161074e90613046565b611266816123a9565b60408051600080825260208201909252610852918391906123b1565b61128a61228c565b6127108111156112b05760405163a912d23160e01b81526004810182905260240161074e565b60fc8190556040518181527f7da8658a825489d2f8b300edb8029d9272b28cbade68d0d11f0d046957db4ca8906020015b60405180910390a150565b6001600160a01b037f00000000000000000000000044a94acccd11f4ac60b2b975eede381790a9274d1630036113345760405162461bcd60e51b815260040161074e90612ffa565b7f00000000000000000000000044a94acccd11f4ac60b2b975eede381790a9274d6001600160a01b031661137d60008051602061325d833981519152546001600160a01b031690565b6001600160a01b0316146113a35760405162461bcd60e51b815260040161074e90613046565b6113ac826123a9565b6113b8828260016123b1565b5050565b6000306001600160a01b037f00000000000000000000000044a94acccd11f4ac60b2b975eede381790a9274d161461145c5760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c0000000000000000606482015260840161074e565b5060008051602061325d83398151915290565b61147761228c565b611481600061251c565b565b61148b612349565b60008281526101056020526040812080549091036114bf57604051630c33789b60e21b81526004810184905260240161074e565b6002810154600160c01b900460ff16156114ef57604051637e34e71760e01b81526004810184905260240161074e565b60048101546001600160a01b0316331461151c57604051632e5ef29b60e21b815260040160405180910390fd5b60028101805460ff60c01b1916600160c01b179055610101805460019190600090611548908490612f6b565b909155505060028101546101028054600160801b9092046001600160401b031691600090611577908490612f6b565b909155505081511561159e5760008381526101046020526040902061159c83826130e0565b505b600061271060fc5483600101546115b5919061319f565b6115bf91906131b6565b60fb5460048481015460405163a9059cbb60e01b81526001600160a01b03918216928101929092526024820184905292935091169063a9059cbb906044016020604051808303816000875af115801561161c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061164091906131d8565b50604051818152849033907f50c83292cbed2e0e82c326c455870ed0cfe292eb185581159265e76147d205ea9060200160405180910390a350506113b86001606555565b6000818152610105602090815260408083208151610120810183528154815260018201549381019390935260028101546001600160801b038116928401929092526001600160401b03600160801b83041660608481019190915260ff600160c01b84048116151560808601529094939260a0840191600160c81b90910416600c81111561171357611713612b52565b600c81111561172457611724612b52565b815260038201546001600160a01b039081166020830152600483015416604082015260058201805460609092019161175b90612f7e565b80601f016020809104026020016040519081016040528092919081815260200182805461178790612f7e565b80156117d45780601f106117a9576101008083540402835291602001916117d4565b820191906000526020600020905b8154815290600101906020018083116117b757829003601f168201915b50505050508152505090508060c001516001600160a01b0316336001600160a01b03161461181557604051630ce124d960e01b815260040160405180910390fd5b600083815261010460205260409020805461182f90612f7e565b80601f016020809104026020016040519081016040528092919081815260200182805461185b90612f7e565b80156118a85780601f1061187d576101008083540402835291602001916118a8565b820191906000526020600020905b81548152906001019060200180831161188b57829003601f168201915b5050505050915050919050565b6060600060ff546001600160401b038111156118d3576118d3612d05565b6040519080825280602002602001820160405280156118fc578160200160208202803683370190505b509050600060015b60ff548111611ac2576000818152610105602090815260408083208151610120810183528154815260018201549381019390935260028101546001600160801b038116928401929092526001600160401b03600160801b830416606084015260ff600160c01b8304811615156080850152909160a0840191600160c81b90910416600c81111561199657611996612b52565b600c8111156119a7576119a7612b52565b815260038201546001600160a01b03908116602083015260048301541660408201526005820180546060909201916119de90612f7e565b80601f0160208091040260200160405190810160405280929190818152602001828054611a0a90612f7e565b8015611a575780601f10611a2c57610100808354040283529160200191611a57565b820191906000526020600020905b815481529060010190602001808311611a3a57829003601f168201915b5050505050815250509050856001600160a01b03168160c001516001600160a01b031603611aaf578060000151848481518110611a9657611a96612fcb565b6020908102919091010152611aac600184612f6b565b92505b5080611aba81612fe1565b915050611904565b506000816001600160401b03811115611add57611add612d05565b604051908082528060200260200182016040528015611b1657816020015b611b03612a8e565b815260200190600190039081611afb5790505b50905060005b82811015611cc9576101056000858381518110611b3b57611b3b612fcb565b60209081029190910181015182528181019290925260409081016000208151610120810183528154815260018201549381019390935260028101546001600160801b038116928401929092526001600160401b03600160801b830416606084015260ff600160c01b8304811615156080850152909160a0840191600160c81b90910416600c811115611bcf57611bcf612b52565b600c811115611be057611be0612b52565b815260038201546001600160a01b0390811660208301526004830154166040820152600582018054606090920191611c1790612f7e565b80601f0160208091040260200160405190810160405280929190818152602001828054611c4390612f7e565b8015611c905780601f10611c6557610100808354040283529160200191611c90565b820191906000526020600020905b815481529060010190602001808311611c7357829003601f168201915b505050505081525050828281518110611cab57611cab612fcb565b60200260200101819052508080611cc190612fe1565b915050611b1c565b50949350505050565b611cda61228c565b6001600160a01b038216611d01576040516305b179d760e11b815260040160405180910390fd5b6001600160a01b03821660008181526101036020908152604091829020805460ff191685151590811790915591519182527ff93f9a76c1bf3444d22400a00cb9fe990e6abe9dbb333fda48859cfee864543d910160405180910390a25050565b611d6961228c565b60fe8190556040518181527faef790bb563f7c3516b8b6516e2a221a0fa18644c01e8653398601a93fcf445c906020016112e1565b600054610100900460ff1615808015611dbe5750600054600160ff909116105b80611dd85750303b158015611dd8575060005460ff166001145b611e3b5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161074e565b6000805460ff191660011790558015611e5e576000805461ff0019166101001790555b611e6661256e565b611e6e61259d565b611e766125cc565b60fb80546001600160a01b0319166001600160a01b038416179055600060ff81905561010155655af3107a400060fd55611b5860fc556201518060fe5580156113b8576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15050565b611f0461228c565b60fb8054911515600160a01b0260ff60a01b19909216919091179055565b611f2a61228c565b60fd8190556040518181527ff66fd270c0ccdc9a4c49b3ce08d6b47d3ee930bb6dbef9ab3a82c9c994e5557d906020016112e1565b611f67612349565b60fb54600160a01b900460ff16611f915760405163596f053960e11b815260040160405180910390fd5b831580611fa557506001600160401b038316155b15611fc65760405163a912d23160e01b81526000600482015260240161074e565b826001600160401b031660fd54611fdd919061319f565b841015611ffd57604051633afc0f3760e01b815260040160405180910390fd5b60fb54612015906001600160a01b03163330876125f3565b600160ff60008282546120289190612f6b565b9250508190555060405180610120016040528060ff548152602001858152602001426001600160801b03168152602001846001600160401b0316815260200160001515815260200183600c81111561208257612082612b52565b81523360208083019190915260006040808401829052606093840186905260ff548252610105835290819020845181559184015160018301558301516002820180549385015160808601511515600160c01b0260ff60c01b196001600160401b03909216600160801b026001600160c01b03199096166001600160801b0390941693909317949094179384168217815560a08501519293909160ff60c81b191661ffff60c01b1990911617600160c81b83600c81111561214457612144612b52565b021790555060c08201516003820180546001600160a01b039283166001600160a01b03199182161790915560e0840151600484018054919093169116179055610100820151600582019061219890826130e0565b505060ff546040519091506001600160401b0385169033907f68dac2ef7ff122a4dd4f78b2ef3cf6512e8079afe1bf2190c1c0ba71496825fa90600090a460ff54604051859033907f5677b5d4cf976ac32defbd95a6a5aaf0d1fee450a11fc26f3c11aae6e6c33d0690600090a46122106001606555565b50505050565b61221e61228c565b6001600160a01b0381166122835760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161074e565b6108528161251c565b6033546001600160a01b031633146114815760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161074e565b6040516001600160a01b03831660248201526044810182905261071290849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261262b565b60026065540361239b5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161074e565b6002606555565b6001606555565b61085261228c565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff16156123e45761071283612700565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa92505050801561243e575060408051601f3d908101601f1916820190925261243b91810190612f3c565b60015b6124a15760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b606482015260840161074e565b60008051602061325d83398151915281146125105760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b606482015260840161074e565b5061071283838361279c565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff166125955760405162461bcd60e51b815260040161074e906131f5565b6114816127c1565b600054610100900460ff166125c45760405162461bcd60e51b815260040161074e906131f5565b6114816127f1565b600054610100900460ff166114815760405162461bcd60e51b815260040161074e906131f5565b6040516001600160a01b03808516602483015283166044820152606481018290526122109085906323b872dd60e01b90608401612312565b6000612680826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166128189092919063ffffffff16565b90508051600014806126a15750808060200190518101906126a191906131d8565b6107125760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161074e565b6001600160a01b0381163b61276d5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b606482015260840161074e565b60008051602061325d83398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b6127a58361282f565b6000825111806127b25750805b1561071257612210838361286f565b600054610100900460ff166127e85760405162461bcd60e51b815260040161074e906131f5565b6114813361251c565b600054610100900460ff166123a25760405162461bcd60e51b815260040161074e906131f5565b6060612827848460008561289d565b949350505050565b61283881612700565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060612894838360405180606001604052806027815260200161327d60279139612978565b90505b92915050565b6060824710156128fe5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161074e565b600080866001600160a01b0316858760405161291a9190613240565b60006040518083038185875af1925050503d8060008114612957576040519150601f19603f3d011682016040523d82523d6000602084013e61295c565b606091505b509150915061296d878383876129f0565b979650505050505050565b6060600080856001600160a01b0316856040516129959190613240565b600060405180830381855af49150503d80600081146129d0576040519150601f19603f3d011682016040523d82523d6000602084013e6129d5565b606091505b50915091506129e6868383876129f0565b9695505050505050565b60608315612a5f578251600003612a58576001600160a01b0385163b612a585760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161074e565b5081612827565b6128278383815115612a745781518083602001fd5b8060405162461bcd60e51b815260040161074e9190612e4d565b604080516101208101825260008082526020820181905291810182905260608101829052608081018290529060a08201908152600060208201819052604082015260609081015290565b80356001600160a01b0381168114612aef57600080fd5b919050565b60008060408385031215612b0757600080fd5b612b1083612ad8565b946020939093013593505050565b600060208284031215612b3057600080fd5b61289482612ad8565b600060208284031215612b4b57600080fd5b5035919050565b634e487b7160e01b600052602160045260246000fd5b600d8110612b8657634e487b7160e01b600052602160045260246000fd5b9052565b60005b83811015612ba5578181015183820152602001612b8d565b50506000910152565b60008151808452612bc6816020860160208601612b8a565b601f01601f19169290920160200192915050565b600061012082518452602083015160208501526001600160801b0360408401511660408501526060830151612c1a60608601826001600160401b03169052565b506080830151612c2e608086018215159052565b5060a0830151612c4160a0860182612b68565b5060c0830151612c5c60c08601826001600160a01b03169052565b5060e0830151612c7760e08601826001600160a01b03169052565b506101008084015182828701526129e683870182612bae565b6020815260006128946020830184612bda565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015612cf857603f19888603018452612ce6858351612bda565b94509285019290850190600101612cca565b5092979650505050505050565b634e487b7160e01b600052604160045260246000fd5b60006001600160401b0380841115612d3557612d35612d05565b604051601f8501601f19908116603f01168101908282118183101715612d5d57612d5d612d05565b81604052809350858152868686011115612d7657600080fd5b858560208301376000602087830101525050509392505050565b60008060408385031215612da357600080fd5b612dac83612ad8565b915060208301356001600160401b03811115612dc757600080fd5b8301601f81018513612dd857600080fd5b612de785823560208401612d1b565b9150509250929050565b600082601f830112612e0257600080fd5b61289483833560208501612d1b565b60008060408385031215612e2457600080fd5b8235915060208301356001600160401b03811115612e4157600080fd5b612de785828601612df1565b6020815260006128946020830184612bae565b801515811461085257600080fd5b60008060408385031215612e8157600080fd5b612e8a83612ad8565b91506020830135612e9a81612e60565b809150509250929050565b600060208284031215612eb757600080fd5b8135610d4281612e60565b60008060008060808587031215612ed857600080fd5b8435935060208501356001600160401b038082168214612ef757600080fd5b909350604086013590600d8210612f0d57600080fd5b90925060608601359080821115612f2357600080fd5b50612f3087828801612df1565b91505092959194509250565b600060208284031215612f4e57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b8082018082111561289757612897612f55565b600181811c90821680612f9257607f821691505b602082108103612fb257634e487b7160e01b600052602260045260246000fd5b50919050565b8181038181111561289757612897612f55565b634e487b7160e01b600052603260045260246000fd5b600060018201612ff357612ff3612f55565b5060010190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b601f82111561071257600081815260208120601f850160051c810160208610156130b95750805b601f850160051c820191505b818110156130d8578281556001016130c5565b505050505050565b81516001600160401b038111156130f9576130f9612d05565b61310d816131078454612f7e565b84613092565b602080601f831160018114613142576000841561312a5750858301515b600019600386901b1c1916600185901b1785556130d8565b600085815260208120601f198616915b8281101561317157888601518255948401946001909101908401613152565b508582101561318f5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b808202811582820484141761289757612897612f55565b6000826131d357634e487b7160e01b600052601260045260246000fd5b500490565b6000602082840312156131ea57600080fd5b8151610d4281612e60565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60008251613252818460208701612b8a565b919091019291505056fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a264697066735822122099abed0c93e1a53b149a3bd4d50d7e0a628f49d42e4dfa77c95474d08a44a4f064736f6c63430008130033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
[ 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.