Overview
S Balance
S Value
$0.00More Info
Private Name Tags
ContractCreator
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
StakingCustomReward
Compiler Version
v0.8.28+commit.7893614a
Optimization Enabled:
Yes with 200 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity 0.8.28; import { StakingBase } from "./base/StakingBase.sol"; import { IStakingCustomReward } from "./../interfaces/templates/IStakingCustomReward.sol"; /// @title Based on StakingBase this contract can have another reward token /// @author 0xdEaF <[email protected]> contract StakingCustomReward is StakingBase, IStakingCustomReward { /// @inheritdoc StakingBase /// @dev also calls the parents _initialize method function _initialize(address _stakingToken, address _owner, bytes calldata _args) internal virtual override { super._initialize(_stakingToken, _owner, _args); rewardToken = abi.decode(_args, (address)); if (rewardToken == address(0)) revert StakingCustomReward__AddressZero(); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (access/Ownable2Step.sol) pragma solidity ^0.8.20; import {OwnableUpgradeable} from "./OwnableUpgradeable.sol"; import {Initializable} from "../proxy/utils/Initializable.sol"; /** * @dev Contract module which provides access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * This extension of the {Ownable} contract includes a two-step mechanism to transfer * ownership, where the new owner must call {acceptOwnership} in order to replace the * old one. This can help prevent common mistakes, such as transfers of ownership to * incorrect accounts, or to contracts that are unable to interact with the * permission system. * * The initial owner is specified at deployment time in the constructor for `Ownable`. This * can later be changed with {transferOwnership} and {acceptOwnership}. * * This module is used through inheritance. It will make available all functions * from parent (Ownable). */ abstract contract Ownable2StepUpgradeable is Initializable, OwnableUpgradeable { /// @custom:storage-location erc7201:openzeppelin.storage.Ownable2Step struct Ownable2StepStorage { address _pendingOwner; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Ownable2Step")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant Ownable2StepStorageLocation = 0x237e158222e3e6968b72b9db0d8043aacf074ad9f650f0d1606b4d82ee432c00; function _getOwnable2StepStorage() private pure returns (Ownable2StepStorage storage $) { assembly { $.slot := Ownable2StepStorageLocation } } event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner); function __Ownable2Step_init() internal onlyInitializing { } function __Ownable2Step_init_unchained() internal onlyInitializing { } /** * @dev Returns the address of the pending owner. */ function pendingOwner() public view virtual returns (address) { Ownable2StepStorage storage $ = _getOwnable2StepStorage(); return $._pendingOwner; } /** * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. * Can only be called by the current owner. * * Setting `newOwner` to the zero address is allowed; this can be used to cancel an initiated ownership transfer. */ function transferOwnership(address newOwner) public virtual override onlyOwner { Ownable2StepStorage storage $ = _getOwnable2StepStorage(); $._pendingOwner = newOwner; emit OwnershipTransferStarted(owner(), newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner. * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual override { Ownable2StepStorage storage $ = _getOwnable2StepStorage(); delete $._pendingOwner; super._transferOwnership(newOwner); } /** * @dev The new owner accepts the ownership transfer. */ function acceptOwnership() public virtual { address sender = _msgSender(); if (pendingOwner() != sender) { revert OwnableUnauthorizedAccount(sender); } _transferOwnership(sender); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol) pragma solidity ^0.8.20; import {ContextUpgradeable} from "../utils/ContextUpgradeable.sol"; import {Initializable} from "../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. * * The initial owner is set to the address provided by the deployer. 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 { /// @custom:storage-location erc7201:openzeppelin.storage.Ownable struct OwnableStorage { address _owner; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Ownable")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant OwnableStorageLocation = 0x9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300; function _getOwnableStorage() private pure returns (OwnableStorage storage $) { assembly { $.slot := OwnableStorageLocation } } /** * @dev The caller account is not authorized to perform an operation. */ error OwnableUnauthorizedAccount(address account); /** * @dev The owner is not a valid owner account. (eg. `address(0)`) */ error OwnableInvalidOwner(address owner); event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the address provided by the deployer as the initial owner. */ function __Ownable_init(address initialOwner) internal onlyInitializing { __Ownable_init_unchained(initialOwner); } function __Ownable_init_unchained(address initialOwner) internal onlyInitializing { if (initialOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _transferOwnership(initialOwner); } /** * @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) { OwnableStorage storage $ = _getOwnableStorage(); return $._owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { if (owner() != _msgSender()) { revert OwnableUnauthorizedAccount(_msgSender()); } } /** * @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 { if (newOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { OwnableStorage storage $ = _getOwnableStorage(); address oldOwner = $._owner; $._owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.20; /** * @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 Storage of the initializable contract. * * It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions * when using with upgradeable contracts. * * @custom:storage-location erc7201:openzeppelin.storage.Initializable */ struct InitializableStorage { /** * @dev Indicates that the contract has been initialized. */ uint64 _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool _initializing; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Initializable")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant INITIALIZABLE_STORAGE = 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00; /** * @dev The contract is already initialized. */ error InvalidInitialization(); /** * @dev The contract is not initializing. */ error NotInitializing(); /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint64 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 in the context of a constructor an `initializer` may be invoked any * number of times. This behavior in the constructor can be useful during testing and is not expected to be used in * production. * * Emits an {Initialized} event. */ modifier initializer() { // solhint-disable-next-line var-name-mixedcase InitializableStorage storage $ = _getInitializableStorage(); // Cache values to avoid duplicated sloads bool isTopLevelCall = !$._initializing; uint64 initialized = $._initialized; // Allowed calls: // - initialSetup: the contract is not in the initializing state and no previous version was // initialized // - construction: the contract is initialized at version 1 (no reininitialization) and the // current contract is just being deployed bool initialSetup = initialized == 0 && isTopLevelCall; bool construction = initialized == 1 && address(this).code.length == 0; if (!initialSetup && !construction) { revert InvalidInitialization(); } $._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 2**64 - 1 will prevent any future reinitialization. * * Emits an {Initialized} event. */ modifier reinitializer(uint64 version) { // solhint-disable-next-line var-name-mixedcase InitializableStorage storage $ = _getInitializableStorage(); if ($._initializing || $._initialized >= version) { revert InvalidInitialization(); } $._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() { _checkInitializing(); _; } /** * @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}. */ function _checkInitializing() internal view virtual { if (!_isInitializing()) { revert NotInitializing(); } } /** * @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 { // solhint-disable-next-line var-name-mixedcase InitializableStorage storage $ = _getInitializableStorage(); if ($._initializing) { revert InvalidInitialization(); } if ($._initialized != type(uint64).max) { $._initialized = type(uint64).max; emit Initialized(type(uint64).max); } } /** * @dev Returns the highest version that has been initialized. See {reinitializer}. */ function _getInitializedVersion() internal view returns (uint64) { return _getInitializableStorage()._initialized; } /** * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}. */ function _isInitializing() internal view returns (bool) { return _getInitializableStorage()._initializing; } /** * @dev Returns a pointer to the storage namespace. */ // solhint-disable-next-line var-name-mixedcase function _getInitializableStorage() private pure returns (InitializableStorage storage $) { assembly { $.slot := INITIALIZABLE_STORAGE } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol) pragma solidity ^0.8.20; import {Initializable} from "../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; } function _contextSuffixLength() internal view virtual returns (uint256) { return 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Pausable.sol) pragma solidity ^0.8.20; import {ContextUpgradeable} from "../utils/ContextUpgradeable.sol"; import {Initializable} from "../proxy/utils/Initializable.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract PausableUpgradeable is Initializable, ContextUpgradeable { /// @custom:storage-location erc7201:openzeppelin.storage.Pausable struct PausableStorage { bool _paused; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Pausable")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant PausableStorageLocation = 0xcd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f03300; function _getPausableStorage() private pure returns (PausableStorage storage $) { assembly { $.slot := PausableStorageLocation } } /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); /** * @dev The operation failed because the contract is paused. */ error EnforcedPause(); /** * @dev The operation failed because the contract is not paused. */ error ExpectedPause(); /** * @dev Initializes the contract in unpaused state. */ function __Pausable_init() internal onlyInitializing { __Pausable_init_unchained(); } function __Pausable_init_unchained() internal onlyInitializing { PausableStorage storage $ = _getPausableStorage(); $._paused = false; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { _requireNotPaused(); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { _requirePaused(); _; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { PausableStorage storage $ = _getPausableStorage(); return $._paused; } /** * @dev Throws if the contract is paused. */ function _requireNotPaused() internal view virtual { if (paused()) { revert EnforcedPause(); } } /** * @dev Throws if the contract is not paused. */ function _requirePaused() internal view virtual { if (!paused()) { revert ExpectedPause(); } } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { PausableStorage storage $ = _getPausableStorage(); $._paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { PausableStorage storage $ = _getPausableStorage(); $._paused = false; emit Unpaused(_msgSender()); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (utils/ReentrancyGuard.sol) pragma solidity ^0.8.20; import {Initializable} from "../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 EIP-1153 (transient storage) is available on the chain you're deploying at, * consider using {ReentrancyGuardTransient} instead. * * 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; /// @custom:storage-location erc7201:openzeppelin.storage.ReentrancyGuard struct ReentrancyGuardStorage { uint256 _status; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.ReentrancyGuard")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant ReentrancyGuardStorageLocation = 0x9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00; function _getReentrancyGuardStorage() private pure returns (ReentrancyGuardStorage storage $) { assembly { $.slot := ReentrancyGuardStorageLocation } } /** * @dev Unauthorized reentrant call. */ error ReentrancyGuardReentrantCall(); function __ReentrancyGuard_init() internal onlyInitializing { __ReentrancyGuard_init_unchained(); } function __ReentrancyGuard_init_unchained() internal onlyInitializing { ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage(); $._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 { ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage(); // On the first call to nonReentrant, _status will be NOT_ENTERED if ($._status == ENTERED) { revert ReentrancyGuardReentrantCall(); } // Any calls to nonReentrant after this point will fail $._status = ENTERED; } function _nonReentrantAfter() private { ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage(); // 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) { ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage(); return $._status == ENTERED; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (interfaces/IERC1363.sol) pragma solidity ^0.8.20; import {IERC20} from "./IERC20.sol"; import {IERC165} from "./IERC165.sol"; /** * @title IERC1363 * @dev Interface of the ERC-1363 standard as defined in the https://eips.ethereum.org/EIPS/eip-1363[ERC-1363]. * * Defines an extension interface for ERC-20 tokens that supports executing code on a recipient contract * after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction. */ interface IERC1363 is IERC20, IERC165 { /* * Note: the ERC-165 identifier for this interface is 0xb0202a11. * 0xb0202a11 === * bytes4(keccak256('transferAndCall(address,uint256)')) ^ * bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^ * bytes4(keccak256('transferFromAndCall(address,address,uint256)')) ^ * bytes4(keccak256('transferFromAndCall(address,address,uint256,bytes)')) ^ * bytes4(keccak256('approveAndCall(address,uint256)')) ^ * bytes4(keccak256('approveAndCall(address,uint256,bytes)')) */ /** * @dev Moves a `value` amount of tokens from the caller's account to `to` * and then calls {IERC1363Receiver-onTransferReceived} on `to`. * @param to The address which you want to transfer to. * @param value The amount of tokens to be transferred. * @return A boolean value indicating whether the operation succeeded unless throwing. */ function transferAndCall(address to, uint256 value) external returns (bool); /** * @dev Moves a `value` amount of tokens from the caller's account to `to` * and then calls {IERC1363Receiver-onTransferReceived} on `to`. * @param to The address which you want to transfer to. * @param value The amount of tokens to be transferred. * @param data Additional data with no specified format, sent in call to `to`. * @return A boolean value indicating whether the operation succeeded unless throwing. */ function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool); /** * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism * and then calls {IERC1363Receiver-onTransferReceived} on `to`. * @param from The address which you want to send tokens from. * @param to The address which you want to transfer to. * @param value The amount of tokens to be transferred. * @return A boolean value indicating whether the operation succeeded unless throwing. */ function transferFromAndCall(address from, address to, uint256 value) external returns (bool); /** * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism * and then calls {IERC1363Receiver-onTransferReceived} on `to`. * @param from The address which you want to send tokens from. * @param to The address which you want to transfer to. * @param value The amount of tokens to be transferred. * @param data Additional data with no specified format, sent in call to `to`. * @return A boolean value indicating whether the operation succeeded unless throwing. */ function transferFromAndCall(address from, address to, uint256 value, bytes calldata data) external returns (bool); /** * @dev Sets a `value` amount of tokens as the allowance of `spender` over the * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`. * @param spender The address which will spend the funds. * @param value The amount of tokens to be spent. * @return A boolean value indicating whether the operation succeeded unless throwing. */ function approveAndCall(address spender, uint256 value) external returns (bool); /** * @dev Sets a `value` amount of tokens as the allowance of `spender` over the * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`. * @param spender The address which will spend the funds. * @param value The amount of tokens to be spent. * @param data Additional data with no specified format, sent in call to `spender`. * @return A boolean value indicating whether the operation succeeded unless throwing. */ function approveAndCall(address spender, uint256 value, bytes calldata data) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC165.sol) pragma solidity ^0.8.20; import {IERC165} from "../utils/introspection/IERC165.sol";
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC20.sol) pragma solidity ^0.8.20; import {IERC20} from "../token/ERC20/IERC20.sol";
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC-20 standard as defined in the ERC. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the value of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the value of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves a `value` amount of tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 value) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets a `value` amount of tokens as the allowance of `spender` over the * caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 value) external returns (bool); /** * @dev Moves a `value` amount of tokens from `from` to `to` using the * allowance mechanism. `value` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 value) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.20; import {IERC20} from "../IERC20.sol"; import {IERC1363} from "../../../interfaces/IERC1363.sol"; import {Address} from "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC-20 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 { /** * @dev An operation with an ERC-20 token failed. */ error SafeERC20FailedOperation(address token); /** * @dev Indicates a failed `decreaseAllowance` request. */ error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease); /** * @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.encodeCall(token.transfer, (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.encodeCall(token.transferFrom, (from, to, 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. * * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client" * smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior. */ function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 oldAllowance = token.allowance(address(this), spender); forceApprove(token, spender, oldAllowance + value); } /** * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no * value, non-reverting calls are assumed to be successful. * * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client" * smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior. */ function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal { unchecked { uint256 currentAllowance = token.allowance(address(this), spender); if (currentAllowance < requestedDecrease) { revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease); } forceApprove(token, spender, currentAllowance - requestedDecrease); } } /** * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval * to be set to zero before setting it to a non-zero value, such as USDT. * * NOTE: If the token implements ERC-7674, this function will not modify any temporary allowance. This function * only sets the "standard" allowance. Any temporary allowance will remain active, in addition to the value being * set here. */ function forceApprove(IERC20 token, address spender, uint256 value) internal { bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value)); if (!_callOptionalReturnBool(token, approvalCall)) { _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0))); _callOptionalReturn(token, approvalCall); } } /** * @dev Performs an {ERC1363} transferAndCall, with a fallback to the simple {ERC20} transfer if the target has no * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when * targeting contracts. * * Reverts if the returned value is other than `true`. */ function transferAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal { if (to.code.length == 0) { safeTransfer(token, to, value); } else if (!token.transferAndCall(to, value, data)) { revert SafeERC20FailedOperation(address(token)); } } /** * @dev Performs an {ERC1363} transferFromAndCall, with a fallback to the simple {ERC20} transferFrom if the target * has no code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when * targeting contracts. * * Reverts if the returned value is other than `true`. */ function transferFromAndCallRelaxed( IERC1363 token, address from, address to, uint256 value, bytes memory data ) internal { if (to.code.length == 0) { safeTransferFrom(token, from, to, value); } else if (!token.transferFromAndCall(from, to, value, data)) { revert SafeERC20FailedOperation(address(token)); } } /** * @dev Performs an {ERC1363} approveAndCall, with a fallback to the simple {ERC20} approve if the target has no * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when * targeting contracts. * * NOTE: When the recipient address (`to`) has no code (i.e. is an EOA), this function behaves as {forceApprove}. * Opposedly, when the recipient address (`to`) has code, this function only attempts to call {ERC1363-approveAndCall} * once without retrying, and relies on the returned value to be true. * * Reverts if the returned value is other than `true`. */ function approveAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal { if (to.code.length == 0) { forceApprove(token, to, value); } else if (!token.approveAndCall(to, value, data)) { revert SafeERC20FailedOperation(address(token)); } } /** * @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 {_callOptionalReturnBool} that reverts if call fails to meet the requirements. */ function _callOptionalReturn(IERC20 token, bytes memory data) private { uint256 returnSize; uint256 returnValue; assembly ("memory-safe") { let success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20) // bubble errors if iszero(success) { let ptr := mload(0x40) returndatacopy(ptr, 0, returndatasize()) revert(ptr, returndatasize()) } returnSize := returndatasize() returnValue := mload(0) } if (returnSize == 0 ? address(token).code.length == 0 : returnValue != 1) { revert SafeERC20FailedOperation(address(token)); } } /** * @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 silently catches all reverts and returns a bool instead. */ function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) { bool success; uint256 returnSize; uint256 returnValue; assembly ("memory-safe") { success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20) returnSize := returndatasize() returnValue := mload(0) } return success && (returnSize == 0 ? address(token).code.length > 0 : returnValue == 1); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (utils/Address.sol) pragma solidity ^0.8.20; import {Errors} from "./Errors.sol"; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev There's no code at `target` (it is not a contract). */ error AddressEmptyCode(address target); /** * @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.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { if (address(this).balance < amount) { revert Errors.InsufficientBalance(address(this).balance, amount); } (bool success, ) = recipient.call{value: amount}(""); if (!success) { revert Errors.FailedCall(); } } /** * @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 or custom error, it is bubbled * up by this function (like regular Solidity function calls). However, if * the call reverted with no returned reason, this function reverts with a * {Errors.FailedCall} error. * * 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. */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0); } /** * @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`. */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { if (address(this).balance < value) { revert Errors.InsufficientBalance(address(this).balance, value); } (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target * was not a contract or bubbling up the revert reason (falling back to {Errors.FailedCall}) in case * of an unsuccessful call. */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata ) internal view returns (bytes memory) { if (!success) { _revert(returndata); } else { // only check if target is a contract if the call was successful and the return data is empty // otherwise we already know that it was a contract if (returndata.length == 0 && target.code.length == 0) { revert AddressEmptyCode(target); } return returndata; } } /** * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the * revert reason or with a default {Errors.FailedCall} error. */ function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) { if (!success) { _revert(returndata); } else { return returndata; } } /** * @dev Reverts with returndata if present. Otherwise reverts with {Errors.FailedCall}. */ function _revert(bytes memory returndata) 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 assembly ("memory-safe") { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert Errors.FailedCall(); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (utils/Errors.sol) pragma solidity ^0.8.20; /** * @dev Collection of common custom errors used in multiple contracts * * IMPORTANT: Backwards compatibility is not guaranteed in future versions of the library. * It is recommended to avoid relying on the error API for critical functionality. * * _Available since v5.1._ */ library Errors { /** * @dev The ETH balance of the account is not enough to perform the operation. */ error InsufficientBalance(uint256 balance, uint256 needed); /** * @dev A call to an address target failed. The target may have reverted. */ error FailedCall(); /** * @dev The deployment failed. */ error FailedDeployment(); /** * @dev A necessary precompile is missing. */ error MissingPrecompile(address); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (utils/introspection/IERC165.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC-165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[ERC]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (utils/structs/EnumerableSet.sol) // This file was procedurally generated from scripts/generate/templates/EnumerableSet.js. pragma solidity ^0.8.20; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ```solidity * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. * * [WARNING] * ==== * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure * unusable. * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info. * * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an * array of EnumerableSet. * ==== */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position is the index of the value in the `values` array plus 1. // Position 0 is used to mean a value is not in the set. mapping(bytes32 value => uint256) _positions; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._positions[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We cache the value's position to prevent multiple reads from the same storage slot uint256 position = set._positions[value]; if (position != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 valueIndex = position - 1; uint256 lastIndex = set._values.length - 1; if (valueIndex != lastIndex) { bytes32 lastValue = set._values[lastIndex]; // Move the lastValue to the index where the value to delete is set._values[valueIndex] = lastValue; // Update the tracked position of the lastValue (that was just moved) set._positions[lastValue] = position; } // Delete the slot where the moved value was stored set._values.pop(); // Delete the tracked position for the deleted slot delete set._positions[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._positions[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { return set._values[index]; } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function _values(Set storage set) private view returns (bytes32[] memory) { return set._values; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(Bytes32Set storage set) internal view returns (bytes32[] memory) { bytes32[] memory store = _values(set._inner); bytes32[] memory result; assembly ("memory-safe") { result := store } return result; } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(AddressSet storage set) internal view returns (address[] memory) { bytes32[] memory store = _values(set._inner); address[] memory result; assembly ("memory-safe") { result := store } return result; } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values in the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(UintSet storage set) internal view returns (uint256[] memory) { bytes32[] memory store = _values(set._inner); uint256[] memory result; assembly ("memory-safe") { result := store } return result; } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.28; /// @title Interface for the base function of each staking template /// @author 0xdEaF <[email protected]> interface IStakingBase { error Staking__NoStakes(); error Staking__AmountZero(); error Staking__AmountOverflow(); error Staking__AmountReceivedInsufficient(uint256 actualAmount, uint256 minAmount); error Staking__ValueNotAllowed(); error Staking__AddressZero(); error Staking__InvalidAmount(); error Staking__InsufficientStake(); /// Deposit stake event /// @param staker address of staker /// @param amount deposited amount event Deposit(address indexed staker, int256 amount); /// Withdraw stake event /// @param staker address of staker /// @param amount withdrawn amount event Withdraw(address indexed staker, int256 amount); /// Update stake event /// @param staker address of staker /// @param amount updated amount event Update(address indexed staker, int256 amount); /// Claim rewards event /// @param staker address of staker /// @param amount rewarded amount event Claim(address indexed staker, uint256 amount); /// Restake rewards event /// @param staker address of staker /// @param amount restake amount event Restaked(address indexed staker, uint256 amount); /// Rewards injected event /// @param actor address of reward injector /// @param amountInjected amount of rewards injected /// @param amountGiven amount that actually has been given (can differ from amountInjected) /// @param amountStaked staked amount (interesting value for for apr calculation) event InjectRewards(address indexed actor, uint256 amountInjected, uint256 amountGiven, uint256 amountStaked); /// Service fee event /// @param provider address of the service provide /// @param paymentAmount fee amount of the service provider (always native currency of desired chain) event ServiceFee(address indexed provider, uint256 paymentAmount); /// Service fee transfer failed event /// @param provider address of the receiver /// @param paymentAmount fee amount of the service provider (always native currency of desired chain) event ServiceFeeFailed(address indexed provider, uint256 paymentAmount); /// @dev struct for storing the stake struct Stake { /// @dev amount of stake uint128 amount; /// @dev amount of the pending stake will be stored in case of restaking uint256 pending; /// @dev scaled dividend uint256 dividend; } /// @dev struct for list response of stake struct StakersStake { /// @dev address of the staker address staker; /// @dev amount of stake uint128 amount; /// @dev amount of the pending stake will be stored in case of restaking uint256 pending; /// @dev scaled dividend uint256 dividend; } /// Initialize function for the protocol /// @param stakingToken token address that will be used for the staking token /// @param owner address of the owner of the protocol /// @param args encoded parameters that will be used for the specific template function initialize(address stakingToken, address owner, bytes calldata args) external; /// Enabled or disables a protocol /// @param enable enable/disable flag /// @param referrals address referrals that receive an evenly spread share of sent value function enable(bool enable, address[] calldata referrals) external payable; /// Deposits a stake for a given staker with a given amount /// @param staker address of the staker /// @param amount amount of staking token that should be staked /// @param minAmount min amount of expected staking tokens that will be staked /// @param referrals address referrals that receive an evenly spread share of sent value function deposit( address staker, uint256 amount, uint256 minAmount, address[] calldata referrals ) external payable returns (uint256 depositAmount); /// Withdraws to a specified receiver /// @param receiver address of the receiver of the withdrawing stake /// @param amount amount of stake that should be withdrawn /// @param referrals address referrals that receive an evenly spread share of sent value function withdraw(address receiver, uint256 amount, address[] calldata referrals) external payable returns (uint256 withdrawAmount); /// Restakes the rewards of the sender /// @param referrals address referrals that receive an evenly spread share of sent value function restake(address[] calldata referrals) external payable returns (uint256 restakeAmount); /// Claims rewards of the sender and sends it to a specified receiver /// @param receiver address of the reward receiver /// @param referrals address referrals that receive an evenly spread share of sent value function claimRewards(address receiver, address[] calldata referrals) external payable returns (uint256 claimAmount); /// Deposit and distribute rewards to stakers /// @param amount amount of reward token that should be distributed /// @param minAmount min amount of expected rewards tokens that will be distributed /// @param referrals address referrals that receive an evenly spread share of sent value function injectRewards( uint256 amount, uint256 minAmount, address[] calldata referrals ) external payable returns (uint256 injectedAmount); /// @dev total amount of staked tokens function staked() external view returns (uint128); /// Total amount of a given reward token /// @param rewardToken address of the reward token function rewarded(address rewardToken) external view returns (uint256 amount); /// @dev address of the staking token function stakingToken() external view returns (address); /// @dev address of the reward token function rewardToken() external view returns (address); /// Pending rewards of a given staker /// @param staker address of staker function getPendingRewards(address staker) external view returns (uint256 pendingRewards); /// Stake information of a given staker /// @param staker address of staker function getStakeOf(address staker) external view returns (Stake memory stake); /// Total given rewards of a given staker /// @param staker address of staker function getRewardsOf(address staker) external view returns (uint256 rewards); /// Paginated list of stakers with the total amount /// @param _limit amount of stakers /// @param _offset index to start from until limit /// @return _stakers staker information /// @return _count total amount of stakers available function getStakers(uint256 _limit, uint256 _offset) external view returns (StakersStake[] memory _stakers, uint256 _count); /// Total amount of stakers function getStakersCount() external view returns (uint256 _count); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.28; /// @title Interface of a custom reward staking protocol /// @author 0xdEaF <[email protected]> interface IStakingCustomReward { error StakingCustomReward__AddressZero(); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.28; import { Address } from "@openzeppelin/contracts/utils/Address.sol"; import { EnumerableSet } from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; import { SafeERC20, IERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import { PausableUpgradeable } from "@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol"; import { Ownable2StepUpgradeable } from "@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol"; import { ReentrancyGuardUpgradeable } from "@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol"; import { IStakingBase } from "./../../interfaces/templates/base/IStakingBase.sol"; /// @title Base contract that has to be used for all templates available /// @author 0xdEaF <[email protected]> /// @notice This contract contains the core features of the protocol abstract contract StakingBase is IStakingBase, Ownable2StepUpgradeable, PausableUpgradeable, ReentrancyGuardUpgradeable { using SafeERC20 for IERC20; using EnumerableSet for EnumerableSet.UintSet; using EnumerableSet for EnumerableSet.AddressSet; uint256 internal constant PRECISION = 1e18; /// @dev precision scaled dividend uint256 internal dividend; /// @notice total amount that has been staked uint128 public staked; /// @notice total amount that has been rewarded to a specific token mapping(address => uint256) public rewarded; /// @notice address of the token a staker has to deposit to perticipate in staking address public stakingToken; /// @notice address of the token that will get rewarded to the stakers address public rewardToken; /// @dev staker address to stake data relation mapping(address => Stake) internal stakes; /// @dev staker address => reward addresss => rewarded amount mapping(address => mapping(address => uint256)) internal rewards; /// @dev keeps track of all stakers in the protocol EnumerableSet.AddressSet internal stakers; modifier processValue(address[] calldata _receivers) { _processValue(_receivers); _; } constructor() { _disableInitializers(); _pause(); } /// @inheritdoc IStakingBase function initialize(address _stakingToken, address _owner, bytes calldata args) external virtual initializer { _initialize(_stakingToken, _owner, args); } /// Internal initialize function that can be overwritten /// @param _stakingToken staking token address /// @param _owner owner of the protocol function _initialize(address _stakingToken, address _owner, bytes calldata) internal virtual { __Ownable_init(_owner); __Pausable_init(); __Ownable2Step_init(); __ReentrancyGuard_init(); // initially paused _pause(); if (_stakingToken == address(0)) revert Staking__AddressZero(); stakingToken = _stakingToken; rewardToken = _stakingToken; } /// /// Executables /// /// @inheritdoc IStakingBase function enable(bool _enable, address[] calldata _referrals) external payable virtual onlyOwner processValue(_referrals) { if (_enable) _unpause(); else _pause(); } /// @inheritdoc IStakingBase function deposit( address _staker, uint256 _amount, uint256 _minAmount, address[] calldata _referrals ) external payable virtual whenNotPaused nonReentrant processValue(_referrals) returns (uint256 _depositAmount) { _depositAmount = _deposit(_staker, _amount, _minAmount); } /// Internal deposit function that can be overwritten /// @param _staker address of the staker /// @param _amount amount that should be staked /// @param _minAmount min amount that is expected to be staked function _deposit(address _staker, uint256 _amount, uint256 _minAmount) internal virtual returns (uint256 _depositAmount) { if (_staker == address(0)) revert Staking__AddressZero(); _depositAmount = _transferFrom(stakingToken, _msgSender(), _amount, _minAmount); _update(_staker, int256(_depositAmount)); emit Deposit(_staker, int256(_depositAmount)); } /// @inheritdoc IStakingBase function withdraw( address _receiver, uint256 _amount, address[] calldata _referrals ) external payable virtual nonReentrant processValue(_referrals) returns (uint256 _withdrawAmount) { _withdrawAmount = _withdraw(_receiver, _amount); } /// Internal withdraw function that can be overwritten /// @param _receiver address of the receiver of the withdrawn amount /// @param _amount withdraw amount function _withdraw(address _receiver, uint256 _amount) internal virtual returns (uint256 _withdrawAmount) { if (_receiver == address(0)) revert Staking__AddressZero(); if (_amount == 0) revert Staking__AmountZero(); _withdrawAmount = _amount; _update(_msgSender(), -int256(_withdrawAmount)); IERC20(stakingToken).safeTransfer(_receiver, _withdrawAmount); emit Withdraw(_receiver, -int256(_withdrawAmount)); } /// @inheritdoc IStakingBase function restake( address[] calldata _referrals ) external payable virtual whenNotPaused nonReentrant processValue(_referrals) returns (uint256 _restakeAmount) { _restakeAmount = _restake(); } /// Internal restake function that can be overwritten function _restake() internal virtual returns (uint256 _restakeAmount) { _restakeAmount = _update(_msgSender(), 0); if (_restakeAmount > 0) { stakes[_msgSender()].pending = 0; _update(_msgSender(), int256(_restakeAmount)); emit Claim(_msgSender(), _restakeAmount); emit Restaked(_msgSender(), _restakeAmount); } else revert Staking__InvalidAmount(); } /// @inheritdoc IStakingBase function claimRewards( address _receiver, address[] calldata _referrals ) external payable virtual nonReentrant processValue(_referrals) returns (uint256 _claimAmount) { _claimAmount = _claimRewards(_receiver); } /// Internal reward claiming function that can be overwritten /// @param _receiver address of the receiver of the reward tokens function _claimRewards(address _receiver) internal virtual returns (uint256 _claimAmount) { if (_receiver == address(0)) revert Staking__AddressZero(); Stake storage _stake = stakes[_msgSender()]; uint256 _pending = _update(_msgSender(), 0); if (_pending > 0) { _stake.pending = 0; rewarded[rewardToken] += _pending; rewards[_msgSender()][rewardToken] += _pending; IERC20(rewardToken).safeTransfer(_receiver, _pending); emit Claim(_msgSender(), _pending); } _claimAmount = _pending; } /// @inheritdoc IStakingBase function injectRewards( uint256 _amount, uint256 _minAmount, address[] calldata _referrals ) external payable virtual whenNotPaused nonReentrant processValue(_referrals) returns (uint256 _injectedAmount) { _injectedAmount = _injectRewards(_amount, _minAmount); } /// Internal reward injecting function that can be overwritten /// @param _amount amount of rewards that should be injected /// @param _minAmount minimum amount of reward tokens being expected to be injected function _injectRewards(uint256 _amount, uint256 _minAmount) internal virtual returns (uint256 _injectedAmount) { _injectedAmount = _transferFrom(rewardToken, _msgSender(), _amount, _minAmount); _updateReward(_injectedAmount); emit InjectRewards(_msgSender(), _injectedAmount, _amount, staked); } /// /// Viewables /// /// @inheritdoc IStakingBase function getPendingRewards(address _staker) external view virtual returns (uint256 pendingRewards) { Stake storage _stake = stakes[_staker]; pendingRewards = _stake.pending; if (_stake.amount > 0) pendingRewards += (_stake.amount * (dividend - _stake.dividend)) / PRECISION; } /// @inheritdoc IStakingBase function getStakeOf(address _staker) public view virtual returns (Stake memory _stake) { _stake = stakes[_staker]; } /// @inheritdoc IStakingBase function getRewardsOf(address _staker) public view virtual returns (uint256 _rewards) { _rewards = rewards[_staker][rewardToken]; } /// @inheritdoc IStakingBase function getStakers(uint256 _limit, uint256 _offset) external view virtual returns (StakersStake[] memory _stakers, uint256 _count) { _count = getStakersCount(); _limit = _maxLimit(_limit, _offset, _count); _stakers = new StakersStake[](_limit); for (uint256 _start = 0; _start + _offset < _limit + _offset; _start++) { address staker = stakers.at(_start + _offset); _stakers[_start].staker = staker; _stakers[_start].amount = stakes[staker].amount; _stakers[_start].pending = stakes[staker].pending; _stakers[_start].dividend = stakes[staker].dividend; } } /// @inheritdoc IStakingBase function getStakersCount() public view virtual returns (uint256 _count) { _count = stakers.length(); } /// /// Internals /// /// Updates the stake of a staker based on the given/taken amount /// @param _staker address of the staker /// @param _amount amount of the stake that should be updated (can be negative) function _update(address _staker, int256 _amount) internal virtual returns (uint256 _pending) { Stake storage _stake = stakes[_staker]; if (_stake.amount > 0) _stake.pending += (_stake.amount * (dividend - _stake.dividend)) / PRECISION; _pending = _stake.pending; _stake.dividend = dividend; uint256 totalStaked = staked; uint256 stakeAmount = _stake.amount; if (_amount != 0) { // when the current stake amount of the staker is 0, we assume that this is a new staker joining the protocol if (stakeAmount == 0) stakers.add(_staker); unchecked { stakeAmount += uint256(_amount); totalStaked += uint256(_amount); } if (int256(stakeAmount) < 0) revert Staking__InsufficientStake(); if (totalStaked > type(uint128).max) revert Staking__AmountOverflow(); // when the current stake amount of the staker is 0, we assume that this staker has withdrawn his stake and is no staker anymore if (stakeAmount == 0) stakers.remove(_staker); _stake.amount = uint128(stakeAmount); staked = uint128(totalStaked); emit Update(_staker, _amount); } } /// Updated the dividend of a token based on the amount given and available stake /// @param _amount amount that was injected /// @dev we still use PRECISION but we can have calculation differences of a really tiny amount of reward tokens function _updateReward(uint256 _amount) internal virtual { if (staked == 0) revert Staking__NoStakes(); dividend += (_amount * PRECISION) / staked; } /// Transfers a given token and respects a minimum expected amount /// @param _token token address to transfer /// @param _from address to transfer from /// @param _amount amount that should be transferred /// @param _minAmount minimum expected amount that should be receiver in order to satisfy the initiator function _transferFrom(address _token, address _from, uint256 _amount, uint256 _minAmount) internal returns (uint256 _actualAmount) { uint256 balance = IERC20(_token).balanceOf(address(this)); IERC20(_token).safeTransferFrom(_from, address(this), _amount); _actualAmount = IERC20(_token).balanceOf(address(this)) - balance; if (_actualAmount == 0) revert Staking__AmountZero(); if (_actualAmount > type(uint128).max) revert Staking__AmountOverflow(); if (_actualAmount < _minAmount) revert Staking__AmountReceivedInsufficient(_actualAmount, _minAmount); } /// /// modifier wrapper /// /// Processes the value that has been sent to the protocol /// @param _receivers addresses of msg.value receivers /// @dev is used in the modifier `processValue` function _processValue(address[] calldata _receivers) private { uint256 _value = msg.value; uint256 _recipients = _receivers.length; if (_value > 0) { if (_recipients > 0) { if (_value < _recipients) revert Staking__InvalidAmount(); uint256 _share = _value / _recipients; uint256 _shareRest = _value % _recipients; for (uint256 i = 0; i < _recipients; ) { if (_receivers[i] == address(0)) revert Staking__AddressZero(); uint256 _sendValue = _share + _shareRest; (bool successA, ) = payable(_receivers[i]).call{ value: _sendValue }(""); if (!successA) { emit ServiceFeeFailed(_receivers[i], _sendValue); Address.sendValue(payable(msg.sender), _sendValue); } emit ServiceFee(_receivers[i], _sendValue); unchecked { i++; _shareRest = 0; } } } else revert Staking__ValueNotAllowed(); } } /// Helper function to figure out the max limit of a list /// @param limit limit that has been targeted /// @param offset offset that has been targeted /// @param count the amount of entries the calculation should be based on /// @dev is used to not overflow the possible available limits of a list function _maxLimit(uint256 limit, uint256 offset, uint256 count) internal pure returns (uint256) { if (limit + offset > count && offset < count) return count - offset; else if (limit + offset <= count) return limit; else return 0; } }
{ "optimizer": { "enabled": true, "runs": 200 }, "evmVersion": "paris", "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "metadata": { "useLiteralContent": true }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[],"name":"EnforcedPause","type":"error"},{"inputs":[],"name":"ExpectedPause","type":"error"},{"inputs":[],"name":"FailedCall","type":"error"},{"inputs":[{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"InsufficientBalance","type":"error"},{"inputs":[],"name":"InvalidInitialization","type":"error"},{"inputs":[],"name":"NotInitializing","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"inputs":[],"name":"StakingCustomReward__AddressZero","type":"error"},{"inputs":[],"name":"Staking__AddressZero","type":"error"},{"inputs":[],"name":"Staking__AmountOverflow","type":"error"},{"inputs":[{"internalType":"uint256","name":"actualAmount","type":"uint256"},{"internalType":"uint256","name":"minAmount","type":"uint256"}],"name":"Staking__AmountReceivedInsufficient","type":"error"},{"inputs":[],"name":"Staking__AmountZero","type":"error"},{"inputs":[],"name":"Staking__InsufficientStake","type":"error"},{"inputs":[],"name":"Staking__InvalidAmount","type":"error"},{"inputs":[],"name":"Staking__NoStakes","type":"error"},{"inputs":[],"name":"Staking__ValueNotAllowed","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"staker","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Claim","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"staker","type":"address"},{"indexed":false,"internalType":"int256","name":"amount","type":"int256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint64","name":"version","type":"uint64"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"actor","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountInjected","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountGiven","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountStaked","type":"uint256"}],"name":"InjectRewards","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"staker","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Restaked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"provider","type":"address"},{"indexed":false,"internalType":"uint256","name":"paymentAmount","type":"uint256"}],"name":"ServiceFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"provider","type":"address"},{"indexed":false,"internalType":"uint256","name":"paymentAmount","type":"uint256"}],"name":"ServiceFeeFailed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"staker","type":"address"},{"indexed":false,"internalType":"int256","name":"amount","type":"int256"}],"name":"Update","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"staker","type":"address"},{"indexed":false,"internalType":"int256","name":"amount","type":"int256"}],"name":"Withdraw","type":"event"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_receiver","type":"address"},{"internalType":"address[]","name":"_referrals","type":"address[]"}],"name":"claimRewards","outputs":[{"internalType":"uint256","name":"_claimAmount","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_staker","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_minAmount","type":"uint256"},{"internalType":"address[]","name":"_referrals","type":"address[]"}],"name":"deposit","outputs":[{"internalType":"uint256","name":"_depositAmount","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bool","name":"_enable","type":"bool"},{"internalType":"address[]","name":"_referrals","type":"address[]"}],"name":"enable","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_staker","type":"address"}],"name":"getPendingRewards","outputs":[{"internalType":"uint256","name":"pendingRewards","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_staker","type":"address"}],"name":"getRewardsOf","outputs":[{"internalType":"uint256","name":"_rewards","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_staker","type":"address"}],"name":"getStakeOf","outputs":[{"components":[{"internalType":"uint128","name":"amount","type":"uint128"},{"internalType":"uint256","name":"pending","type":"uint256"},{"internalType":"uint256","name":"dividend","type":"uint256"}],"internalType":"struct IStakingBase.Stake","name":"_stake","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_limit","type":"uint256"},{"internalType":"uint256","name":"_offset","type":"uint256"}],"name":"getStakers","outputs":[{"components":[{"internalType":"address","name":"staker","type":"address"},{"internalType":"uint128","name":"amount","type":"uint128"},{"internalType":"uint256","name":"pending","type":"uint256"},{"internalType":"uint256","name":"dividend","type":"uint256"}],"internalType":"struct IStakingBase.StakersStake[]","name":"_stakers","type":"tuple[]"},{"internalType":"uint256","name":"_count","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getStakersCount","outputs":[{"internalType":"uint256","name":"_count","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_stakingToken","type":"address"},{"internalType":"address","name":"_owner","type":"address"},{"internalType":"bytes","name":"args","type":"bytes"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_minAmount","type":"uint256"},{"internalType":"address[]","name":"_referrals","type":"address[]"}],"name":"injectRewards","outputs":[{"internalType":"uint256","name":"_injectedAmount","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_referrals","type":"address[]"}],"name":"restake","outputs":[{"internalType":"uint256","name":"_restakeAmount","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"rewardToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"rewarded","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"staked","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stakingToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_receiver","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"address[]","name":"_referrals","type":"address[]"}],"name":"withdraw","outputs":[{"internalType":"uint256","name":"_withdrawAmount","type":"uint256"}],"stateMutability":"payable","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b50610019610026565b6100216100d9565b610182565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00805468010000000000000000900460ff16156100765760405163f92ee8a960e01b815260040160405180910390fd5b80546001600160401b03908116146100d65780546001600160401b0319166001600160401b0390811782556040519081527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2906020015b60405180910390a15b50565b6100e161013d565b7fcd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f03300805460ff191660011781556040513381527f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258906020016100cd565b7fcd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f033005460ff16156101805760405163d93c066560e01b815260040160405180910390fd5b565b6120e0806101916000396000f3fe6080604052600436106101355760003560e01c806379ba5097116100ab578063b32ec1f91161006f578063b32ec1f91461038f578063cf7a1d77146103a2578063e30c3978146103c2578063f2fde38b146103d7578063f6ed2017146103f7578063f7c618c11461041757600080fd5b806379ba5097146102dd57806384fa1f7c146102f25780638da5cb5b146103055780639684e3dc1461031a578063ad71bd361461036157600080fd5b80635f55f6f3116100fd5780635f55f6f31461020a57806361326c191461021d5780636a86550f146102305780636e5f69191461027b578063715018a61461028e57806372f702f3146102a557600080fd5b80630b76619b1461013a5780632026ffa314610177578063379f53e31461019857806348284789146101c55780635c975abb146101da575b600080fd5b34801561014657600080fd5b5060015461015a906001600160801b031681565b6040516001600160801b0390911681526020015b60405180910390f35b61018a610185366004611c36565b610437565b60405190815260200161016e565b3480156101a457600080fd5b5061018a6101b3366004611c8b565b60026020526000908152604090205481565b3480156101d157600080fd5b5061018a610478565b3480156101e657600080fd5b5060008051602061206b8339815191525460ff16604051901515815260200161016e565b61018a610218366004611ca8565b610489565b61018a61022b366004611d12565b6104d6565b34801561023c57600080fd5b5061025061024b366004611c8b565b61051d565b6040805182516001600160801b0316815260208084015190820152918101519082015260600161016e565b61018a610289366004611d54565b610595565b34801561029a57600080fd5b506102a36105d8565b005b3480156102b157600080fd5b506003546102c5906001600160a01b031681565b6040516001600160a01b03909116815260200161016e565b3480156102e957600080fd5b506102a36105ec565b6102a3610300366004611db0565b610639565b34801561031157600080fd5b506102c561066f565b34801561032657600080fd5b5061018a610335366004611c8b565b6001600160a01b0390811660009081526006602090815260408083206004549094168352929052205490565b34801561036d57600080fd5b5061038161037c366004611dd5565b6106a4565b60405161016e929190611df7565b61018a61039d366004611e79565b610895565b3480156103ae57600080fd5b506102a36103bd366004611eb4565b6108bd565b3480156103ce57600080fd5b506102c56109d3565b3480156103e357600080fd5b506102a36103f2366004611c8b565b6109fc565b34801561040357600080fd5b5061018a610412366004611c8b565b610a81565b34801561042357600080fd5b506004546102c5906001600160a01b031681565b6000610441610afe565b828261044d8282610b36565b61045686610d7c565b92505050610471600160008051602061208b83398151915255565b9392505050565b60006104846007610ea0565b905090565b6000610493610eaa565b61049b610afe565b82826104a78282610b36565b6104b2888888610edb565b925050506104cd600160008051602061208b83398151915255565b95945050505050565b60006104e0610eaa565b6104e8610afe565b82826104f48282610b36565b6104fc610f65565b92505050610517600160008051602061208b83398151915255565b92915050565b61054a604051806060016040528060006001600160801b0316815260200160008152602001600081525090565b506001600160a01b0316600090815260056020908152604091829020825160608101845281546001600160801b03168152600182015492810192909252600201549181019190915290565b600061059f610afe565b82826105ab8282610b36565b6105b5878761101c565b925050506105d0600160008051602061208b83398151915255565b949350505050565b6105e06110de565b6105ea6000611110565b565b33806105f66109d3565b6001600160a01b03161461062d5760405163118cdaa760e01b81526001600160a01b03821660048201526024015b60405180910390fd5b61063681611110565b50565b6106416110de565b818161064d8282610b36565b84156106605761065b61114c565b610668565b6106686111ac565b5050505050565b6000807f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c1993005b546001600160a01b031692915050565b606060006106b0610478565b90506106bd8484836111f5565b93508367ffffffffffffffff8111156106d8576106d8611f49565b60405190808252806020026020018201604052801561072a57816020015b6040805160808101825260008082526020808301829052928201819052606082015282526000199092019101816106f65790505b50915060005b61073a8486611f75565b6107448583611f75565b101561088d5760006107616107598684611f75565b600790611243565b90508084838151811061077657610776611f88565b6020908102919091018101516001600160a01b03928316905290821660009081526005909152604090205484516001600160801b03909116908590849081106107c1576107c1611f88565b6020026020010151602001906001600160801b031690816001600160801b03168152505060056000826001600160a01b03166001600160a01b031681526020019081526020016000206001015484838151811061082057610820611f88565b6020026020010151604001818152505060056000826001600160a01b03166001600160a01b031681526020019081526020016000206002015484838151811061086b5761086b611f88565b602090810291909101015160600152508061088581611f9e565b915050610730565b509250929050565b600061089f610eaa565b6108a7610afe565b82826108b38282610b36565b6105b5878761124f565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a008054600160401b810460ff16159067ffffffffffffffff166000811580156109035750825b905060008267ffffffffffffffff1660011480156109205750303b155b90508115801561092e575080155b1561094c5760405163f92ee8a960e01b815260040160405180910390fd5b845467ffffffffffffffff19166001178555831561097657845460ff60401b1916600160401b1785555b610982898989896112bf565b83156109c857845460ff60401b19168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b505050505050505050565b6000807f237e158222e3e6968b72b9db0d8043aacf074ad9f650f0d1606b4d82ee432c00610694565b610a046110de565b7f237e158222e3e6968b72b9db0d8043aacf074ad9f650f0d1606b4d82ee432c0080546001600160a01b0319166001600160a01b0383169081178255610a4861066f565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a35050565b6001600160a01b0381166000908152600560205260409020600181015481549091906001600160801b031615610af857670de0b6b3a76400008160020154600054610acc9190611fb7565b8254610ae191906001600160801b0316611fca565b610aeb9190611ff7565b610af59083611f75565b91505b50919050565b60008051602061208b833981519152805460011901610b3057604051633ee5aeb560e01b815260040160405180910390fd5b60029055565b34818115610d76578015610d5d5780821015610b6557604051636fe0fba360e11b815260040160405180910390fd5b6000610b718284611ff7565b90506000610b7f838561200b565b905060005b83811015610d55576000878783818110610ba057610ba0611f88565b9050602002016020810190610bb59190611c8b565b6001600160a01b031603610bdc576040516316709a1760e21b815260040160405180910390fd5b6000610be88385611f75565b90506000888884818110610bfe57610bfe611f88565b9050602002016020810190610c139190611c8b565b6001600160a01b03168260405160006040518083038185875af1925050503d8060008114610c5d576040519150601f19603f3d011682016040523d82523d6000602084013e610c62565b606091505b5050905080610cde57888884818110610c7d57610c7d611f88565b9050602002016020810190610c929190611c8b565b6001600160a01b03167fffa4ae17301d79d9f0aaae82668d39104fcd3e0ada8bc96249f642730615b51a83604051610ccc91815260200190565b60405180910390a2610cde3383611313565b888884818110610cf057610cf0611f88565b9050602002016020810190610d059190611c8b565b6001600160a01b03167f6b7bb0b92cd59ba9788b4dfc60bc3df994068312c781a7e82cfb2b9e78e8cab383604051610d3f91815260200190565b60405180910390a2506000925050600101610b84565b505050610d76565b60405163593f696160e01b815260040160405180910390fd5b50505050565b60006001600160a01b038216610da5576040516316709a1760e21b815260040160405180910390fd5b33600081815260056020526040812091610dc1905b60006113b6565b90508015610471576000600183018190556004546001600160a01b031681526002602052604081208054839290610df9908490611f75565b90915550503360009081526006602090815260408083206004546001600160a01b0316845290915281208054839290610e33908490611f75565b9091555050600454610e4f906001600160a01b03168583611555565b60405181815233907f47cee97cb7acd717b3c0aa1435d004cd5b3c8c57d70dbceb4e4458bbd60e39d4906020015b60405180910390a29392505050565b600160008051602061208b83398151915255565b6000610517825490565b60008051602061206b8339815191525460ff16156105ea5760405163d93c066560e01b815260040160405180910390fd5b60006001600160a01b038416610f04576040516316709a1760e21b815260040160405180910390fd5b600354610f1d906001600160a01b0316335b85856115b4565b9050610f2984826113b6565b50836001600160a01b03167fd8a6d38df847dcba70dfdeb4948fb1457d61a81d132801f40dc9c00d52dfd47882604051610e7d91815260200190565b6000610f7033610dba565b905080156110035733600081815260056020526040812060010155610f9590826113b6565b5060405181815233907f47cee97cb7acd717b3c0aa1435d004cd5b3c8c57d70dbceb4e4458bbd60e39d49060200160405180910390a260405181815233907ffc11547e675aec955dee8afa8fab2509420a3a91ca90e88b9b95db75bdf4c00b9060200160405180910390a290565b604051636fe0fba360e11b815260040160405180910390fd5b60006001600160a01b038316611045576040516316709a1760e21b815260040160405180910390fd5b816000036110665760405163c47a846d60e01b815260040160405180910390fd5b508061107a336110758361201f565b6113b6565b50600354611092906001600160a01b03168483611555565b6001600160a01b0383167f2d3cfd22ce461d7eafde7bb13c6af0c0d5ed08406a59166e093b4354cfd94ae26110c68361201f565b6040519081526020015b60405180910390a292915050565b336110e761066f565b6001600160a01b0316146105ea5760405163118cdaa760e01b8152336004820152602401610624565b7f237e158222e3e6968b72b9db0d8043aacf074ad9f650f0d1606b4d82ee432c0080546001600160a01b03191681556111488261172b565b5050565b61115461179c565b60008051602061206b833981519152805460ff191681557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a150565b6111b4610eaa565b60008051602061206b833981519152805460ff191660011781557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2583361118e565b6000816112028486611f75565b11801561120e57508183105b156112245761121d8383611fb7565b9050610471565b8161122f8486611f75565b1161123b575082610471565b506000610471565b600061047183836117cc565b600454600090611268906001600160a01b031633610f16565b9050611273816117f6565b60015460408051838152602081018690526001600160801b039092169082015233907fdff8c28014db33834beee8e781f6d605c9cb46451508a58468ffd33c597532d1906060016110d0565b6112cb84848484611862565b6112d781830183611c8b565b600480546001600160a01b0319166001600160a01b03929092169182179055610d7657604051635aaa870d60e11b815260040160405180910390fd5b8047101561133d5760405163cf47918160e01b815247600482015260248101829052604401610624565b6000826001600160a01b03168260405160006040518083038185875af1925050503d806000811461138a576040519150601f19603f3d011682016040523d82523d6000602084013e61138f565b606091505b50509050806113b15760405163d6bda27560e01b815260040160405180910390fd5b505050565b6001600160a01b038216600090815260056020526040812080546001600160801b03161561143157670de0b6b3a764000081600201546000546113f99190611fb7565b825461140e91906001600160801b0316611fca565b6114189190611ff7565b81600101600082825461142b9190611f75565b90915550505b6001808201546000546002840155905482549193506001600160801b039081169116841561154c578060000361146e5761146c6007876118e2565b505b9084019084016000811215611496576040516371a3b96f60e01b815260040160405180910390fd5b6001600160801b038211156114be5760405163e6b9d2cd60e01b815260040160405180910390fd5b806000036114d3576114d16007876118f7565b505b82546001600160801b038083166fffffffffffffffffffffffffffffffff1992831617855560018054918516919092161790556040516001600160a01b038716907f80cf2e80441b35f6fb6db47e95f658f5dc06cbee618ed7c8d21189f0eb8c8885906115439088815260200190565b60405180910390a25b50505092915050565b6040516001600160a01b038381166024830152604482018390526113b191859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180516001600160e01b03838183161783525050505061190c565b6040516370a0823160e01b815230600482015260009081906001600160a01b038716906370a0823190602401602060405180830381865afa1580156115fd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611621919061203b565b90506116386001600160a01b03871686308761197d565b6040516370a0823160e01b815230600482015281906001600160a01b038816906370a0823190602401602060405180830381865afa15801561167e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116a2919061203b565b6116ac9190611fb7565b9150816000036116cf5760405163c47a846d60e01b815260040160405180910390fd5b6001600160801b038211156116f75760405163e6b9d2cd60e01b815260040160405180910390fd5b82821015611722576040516312f9363160e11b81526004810183905260248101849052604401610624565b50949350505050565b7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c19930080546001600160a01b031981166001600160a01b03848116918217845560405192169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3505050565b60008051602061206b8339815191525460ff166105ea57604051638dfc202b60e01b815260040160405180910390fd5b60008260000182815481106117e3576117e3611f88565b9060005260206000200154905092915050565b6001546001600160801b03166000036118225760405163736706cd60e01b815260040160405180910390fd5b6001546001600160801b0316611840670de0b6b3a764000083611fca565b61184a9190611ff7565b60008082825461185a9190611f75565b909155505050565b61186b836119b6565b6118736119c7565b61187b6119d7565b6118836119df565b61188b6111ac565b6001600160a01b0384166118b2576040516316709a1760e21b815260040160405180910390fd5b5050600380546001600160a01b039093166001600160a01b03199384168117909155600480549093161790915550565b6000610471836001600160a01b0384166119ef565b6000610471836001600160a01b038416611a3e565b600080602060008451602086016000885af18061192f576040513d6000823e3d81fd5b50506000513d91508115611947578060011415611954565b6001600160a01b0384163b155b15610d7657604051635274afe760e01b81526001600160a01b0385166004820152602401610624565b6040516001600160a01b038481166024830152838116604483015260648201839052610d769186918216906323b872dd90608401611582565b6119be611b31565b61063681611b7a565b6119cf611b31565b6105ea611bac565b6105ea611b31565b6119e7611b31565b6105ea611bcd565b6000818152600183016020526040812054611a3657508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610517565b506000610517565b60008181526001830160205260408120548015611b27576000611a62600183611fb7565b8554909150600090611a7690600190611fb7565b9050808214611adb576000866000018281548110611a9657611a96611f88565b9060005260206000200154905080876000018481548110611ab957611ab9611f88565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080611aec57611aec612054565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610517565b6000915050610517565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0054600160401b900460ff166105ea57604051631afcd79f60e31b815260040160405180910390fd5b611b82611b31565b6001600160a01b03811661062d57604051631e4fbdf760e01b815260006004820152602401610624565b611bb4611b31565b60008051602061206b833981519152805460ff19169055565b610e8c611b31565b6001600160a01b038116811461063657600080fd5b60008083601f840112611bfc57600080fd5b50813567ffffffffffffffff811115611c1457600080fd5b6020830191508360208260051b8501011115611c2f57600080fd5b9250929050565b600080600060408486031215611c4b57600080fd5b8335611c5681611bd5565b9250602084013567ffffffffffffffff811115611c7257600080fd5b611c7e86828701611bea565b9497909650939450505050565b600060208284031215611c9d57600080fd5b813561047181611bd5565b600080600080600060808688031215611cc057600080fd5b8535611ccb81611bd5565b94506020860135935060408601359250606086013567ffffffffffffffff811115611cf557600080fd5b611d0188828901611bea565b969995985093965092949392505050565b60008060208385031215611d2557600080fd5b823567ffffffffffffffff811115611d3c57600080fd5b611d4885828601611bea565b90969095509350505050565b60008060008060608587031215611d6a57600080fd5b8435611d7581611bd5565b935060208501359250604085013567ffffffffffffffff811115611d9857600080fd5b611da487828801611bea565b95989497509550505050565b600080600060408486031215611dc557600080fd5b83358015158114611c5657600080fd5b60008060408385031215611de857600080fd5b50508035926020909101359150565b6040808252835190820181905260009060208501906060840190835b81811015611e6657835180516001600160a01b031684526020808201516001600160801b031681860152604080830151908601526060918201519185019190915290930192608090920191600101611e13565b5050602093909301939093525092915050565b60008060008060608587031215611e8f57600080fd5b8435935060208501359250604085013567ffffffffffffffff811115611d9857600080fd5b60008060008060608587031215611eca57600080fd5b8435611ed581611bd5565b93506020850135611ee581611bd5565b9250604085013567ffffffffffffffff811115611f0157600080fd5b8501601f81018713611f1257600080fd5b803567ffffffffffffffff811115611f2957600080fd5b876020828401011115611f3b57600080fd5b949793965060200194505050565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052601160045260246000fd5b8082018082111561051757610517611f5f565b634e487b7160e01b600052603260045260246000fd5b600060018201611fb057611fb0611f5f565b5060010190565b8181038181111561051757610517611f5f565b808202811582820484141761051757610517611f5f565b634e487b7160e01b600052601260045260246000fd5b60008261200657612006611fe1565b500490565b60008261201a5761201a611fe1565b500690565b6000600160ff1b820161203457612034611f5f565b5060000390565b60006020828403121561204d57600080fd5b5051919050565b634e487b7160e01b600052603160045260246000fdfecd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f033009b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00a2646970667358221220731b4d013e1817b8daa412e756e149ae5698d577a3654fc709d3baffe4a3390864736f6c634300081c0033
Deployed Bytecode
0x6080604052600436106101355760003560e01c806379ba5097116100ab578063b32ec1f91161006f578063b32ec1f91461038f578063cf7a1d77146103a2578063e30c3978146103c2578063f2fde38b146103d7578063f6ed2017146103f7578063f7c618c11461041757600080fd5b806379ba5097146102dd57806384fa1f7c146102f25780638da5cb5b146103055780639684e3dc1461031a578063ad71bd361461036157600080fd5b80635f55f6f3116100fd5780635f55f6f31461020a57806361326c191461021d5780636a86550f146102305780636e5f69191461027b578063715018a61461028e57806372f702f3146102a557600080fd5b80630b76619b1461013a5780632026ffa314610177578063379f53e31461019857806348284789146101c55780635c975abb146101da575b600080fd5b34801561014657600080fd5b5060015461015a906001600160801b031681565b6040516001600160801b0390911681526020015b60405180910390f35b61018a610185366004611c36565b610437565b60405190815260200161016e565b3480156101a457600080fd5b5061018a6101b3366004611c8b565b60026020526000908152604090205481565b3480156101d157600080fd5b5061018a610478565b3480156101e657600080fd5b5060008051602061206b8339815191525460ff16604051901515815260200161016e565b61018a610218366004611ca8565b610489565b61018a61022b366004611d12565b6104d6565b34801561023c57600080fd5b5061025061024b366004611c8b565b61051d565b6040805182516001600160801b0316815260208084015190820152918101519082015260600161016e565b61018a610289366004611d54565b610595565b34801561029a57600080fd5b506102a36105d8565b005b3480156102b157600080fd5b506003546102c5906001600160a01b031681565b6040516001600160a01b03909116815260200161016e565b3480156102e957600080fd5b506102a36105ec565b6102a3610300366004611db0565b610639565b34801561031157600080fd5b506102c561066f565b34801561032657600080fd5b5061018a610335366004611c8b565b6001600160a01b0390811660009081526006602090815260408083206004549094168352929052205490565b34801561036d57600080fd5b5061038161037c366004611dd5565b6106a4565b60405161016e929190611df7565b61018a61039d366004611e79565b610895565b3480156103ae57600080fd5b506102a36103bd366004611eb4565b6108bd565b3480156103ce57600080fd5b506102c56109d3565b3480156103e357600080fd5b506102a36103f2366004611c8b565b6109fc565b34801561040357600080fd5b5061018a610412366004611c8b565b610a81565b34801561042357600080fd5b506004546102c5906001600160a01b031681565b6000610441610afe565b828261044d8282610b36565b61045686610d7c565b92505050610471600160008051602061208b83398151915255565b9392505050565b60006104846007610ea0565b905090565b6000610493610eaa565b61049b610afe565b82826104a78282610b36565b6104b2888888610edb565b925050506104cd600160008051602061208b83398151915255565b95945050505050565b60006104e0610eaa565b6104e8610afe565b82826104f48282610b36565b6104fc610f65565b92505050610517600160008051602061208b83398151915255565b92915050565b61054a604051806060016040528060006001600160801b0316815260200160008152602001600081525090565b506001600160a01b0316600090815260056020908152604091829020825160608101845281546001600160801b03168152600182015492810192909252600201549181019190915290565b600061059f610afe565b82826105ab8282610b36565b6105b5878761101c565b925050506105d0600160008051602061208b83398151915255565b949350505050565b6105e06110de565b6105ea6000611110565b565b33806105f66109d3565b6001600160a01b03161461062d5760405163118cdaa760e01b81526001600160a01b03821660048201526024015b60405180910390fd5b61063681611110565b50565b6106416110de565b818161064d8282610b36565b84156106605761065b61114c565b610668565b6106686111ac565b5050505050565b6000807f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c1993005b546001600160a01b031692915050565b606060006106b0610478565b90506106bd8484836111f5565b93508367ffffffffffffffff8111156106d8576106d8611f49565b60405190808252806020026020018201604052801561072a57816020015b6040805160808101825260008082526020808301829052928201819052606082015282526000199092019101816106f65790505b50915060005b61073a8486611f75565b6107448583611f75565b101561088d5760006107616107598684611f75565b600790611243565b90508084838151811061077657610776611f88565b6020908102919091018101516001600160a01b03928316905290821660009081526005909152604090205484516001600160801b03909116908590849081106107c1576107c1611f88565b6020026020010151602001906001600160801b031690816001600160801b03168152505060056000826001600160a01b03166001600160a01b031681526020019081526020016000206001015484838151811061082057610820611f88565b6020026020010151604001818152505060056000826001600160a01b03166001600160a01b031681526020019081526020016000206002015484838151811061086b5761086b611f88565b602090810291909101015160600152508061088581611f9e565b915050610730565b509250929050565b600061089f610eaa565b6108a7610afe565b82826108b38282610b36565b6105b5878761124f565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a008054600160401b810460ff16159067ffffffffffffffff166000811580156109035750825b905060008267ffffffffffffffff1660011480156109205750303b155b90508115801561092e575080155b1561094c5760405163f92ee8a960e01b815260040160405180910390fd5b845467ffffffffffffffff19166001178555831561097657845460ff60401b1916600160401b1785555b610982898989896112bf565b83156109c857845460ff60401b19168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b505050505050505050565b6000807f237e158222e3e6968b72b9db0d8043aacf074ad9f650f0d1606b4d82ee432c00610694565b610a046110de565b7f237e158222e3e6968b72b9db0d8043aacf074ad9f650f0d1606b4d82ee432c0080546001600160a01b0319166001600160a01b0383169081178255610a4861066f565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a35050565b6001600160a01b0381166000908152600560205260409020600181015481549091906001600160801b031615610af857670de0b6b3a76400008160020154600054610acc9190611fb7565b8254610ae191906001600160801b0316611fca565b610aeb9190611ff7565b610af59083611f75565b91505b50919050565b60008051602061208b833981519152805460011901610b3057604051633ee5aeb560e01b815260040160405180910390fd5b60029055565b34818115610d76578015610d5d5780821015610b6557604051636fe0fba360e11b815260040160405180910390fd5b6000610b718284611ff7565b90506000610b7f838561200b565b905060005b83811015610d55576000878783818110610ba057610ba0611f88565b9050602002016020810190610bb59190611c8b565b6001600160a01b031603610bdc576040516316709a1760e21b815260040160405180910390fd5b6000610be88385611f75565b90506000888884818110610bfe57610bfe611f88565b9050602002016020810190610c139190611c8b565b6001600160a01b03168260405160006040518083038185875af1925050503d8060008114610c5d576040519150601f19603f3d011682016040523d82523d6000602084013e610c62565b606091505b5050905080610cde57888884818110610c7d57610c7d611f88565b9050602002016020810190610c929190611c8b565b6001600160a01b03167fffa4ae17301d79d9f0aaae82668d39104fcd3e0ada8bc96249f642730615b51a83604051610ccc91815260200190565b60405180910390a2610cde3383611313565b888884818110610cf057610cf0611f88565b9050602002016020810190610d059190611c8b565b6001600160a01b03167f6b7bb0b92cd59ba9788b4dfc60bc3df994068312c781a7e82cfb2b9e78e8cab383604051610d3f91815260200190565b60405180910390a2506000925050600101610b84565b505050610d76565b60405163593f696160e01b815260040160405180910390fd5b50505050565b60006001600160a01b038216610da5576040516316709a1760e21b815260040160405180910390fd5b33600081815260056020526040812091610dc1905b60006113b6565b90508015610471576000600183018190556004546001600160a01b031681526002602052604081208054839290610df9908490611f75565b90915550503360009081526006602090815260408083206004546001600160a01b0316845290915281208054839290610e33908490611f75565b9091555050600454610e4f906001600160a01b03168583611555565b60405181815233907f47cee97cb7acd717b3c0aa1435d004cd5b3c8c57d70dbceb4e4458bbd60e39d4906020015b60405180910390a29392505050565b600160008051602061208b83398151915255565b6000610517825490565b60008051602061206b8339815191525460ff16156105ea5760405163d93c066560e01b815260040160405180910390fd5b60006001600160a01b038416610f04576040516316709a1760e21b815260040160405180910390fd5b600354610f1d906001600160a01b0316335b85856115b4565b9050610f2984826113b6565b50836001600160a01b03167fd8a6d38df847dcba70dfdeb4948fb1457d61a81d132801f40dc9c00d52dfd47882604051610e7d91815260200190565b6000610f7033610dba565b905080156110035733600081815260056020526040812060010155610f9590826113b6565b5060405181815233907f47cee97cb7acd717b3c0aa1435d004cd5b3c8c57d70dbceb4e4458bbd60e39d49060200160405180910390a260405181815233907ffc11547e675aec955dee8afa8fab2509420a3a91ca90e88b9b95db75bdf4c00b9060200160405180910390a290565b604051636fe0fba360e11b815260040160405180910390fd5b60006001600160a01b038316611045576040516316709a1760e21b815260040160405180910390fd5b816000036110665760405163c47a846d60e01b815260040160405180910390fd5b508061107a336110758361201f565b6113b6565b50600354611092906001600160a01b03168483611555565b6001600160a01b0383167f2d3cfd22ce461d7eafde7bb13c6af0c0d5ed08406a59166e093b4354cfd94ae26110c68361201f565b6040519081526020015b60405180910390a292915050565b336110e761066f565b6001600160a01b0316146105ea5760405163118cdaa760e01b8152336004820152602401610624565b7f237e158222e3e6968b72b9db0d8043aacf074ad9f650f0d1606b4d82ee432c0080546001600160a01b03191681556111488261172b565b5050565b61115461179c565b60008051602061206b833981519152805460ff191681557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a150565b6111b4610eaa565b60008051602061206b833981519152805460ff191660011781557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2583361118e565b6000816112028486611f75565b11801561120e57508183105b156112245761121d8383611fb7565b9050610471565b8161122f8486611f75565b1161123b575082610471565b506000610471565b600061047183836117cc565b600454600090611268906001600160a01b031633610f16565b9050611273816117f6565b60015460408051838152602081018690526001600160801b039092169082015233907fdff8c28014db33834beee8e781f6d605c9cb46451508a58468ffd33c597532d1906060016110d0565b6112cb84848484611862565b6112d781830183611c8b565b600480546001600160a01b0319166001600160a01b03929092169182179055610d7657604051635aaa870d60e11b815260040160405180910390fd5b8047101561133d5760405163cf47918160e01b815247600482015260248101829052604401610624565b6000826001600160a01b03168260405160006040518083038185875af1925050503d806000811461138a576040519150601f19603f3d011682016040523d82523d6000602084013e61138f565b606091505b50509050806113b15760405163d6bda27560e01b815260040160405180910390fd5b505050565b6001600160a01b038216600090815260056020526040812080546001600160801b03161561143157670de0b6b3a764000081600201546000546113f99190611fb7565b825461140e91906001600160801b0316611fca565b6114189190611ff7565b81600101600082825461142b9190611f75565b90915550505b6001808201546000546002840155905482549193506001600160801b039081169116841561154c578060000361146e5761146c6007876118e2565b505b9084019084016000811215611496576040516371a3b96f60e01b815260040160405180910390fd5b6001600160801b038211156114be5760405163e6b9d2cd60e01b815260040160405180910390fd5b806000036114d3576114d16007876118f7565b505b82546001600160801b038083166fffffffffffffffffffffffffffffffff1992831617855560018054918516919092161790556040516001600160a01b038716907f80cf2e80441b35f6fb6db47e95f658f5dc06cbee618ed7c8d21189f0eb8c8885906115439088815260200190565b60405180910390a25b50505092915050565b6040516001600160a01b038381166024830152604482018390526113b191859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180516001600160e01b03838183161783525050505061190c565b6040516370a0823160e01b815230600482015260009081906001600160a01b038716906370a0823190602401602060405180830381865afa1580156115fd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611621919061203b565b90506116386001600160a01b03871686308761197d565b6040516370a0823160e01b815230600482015281906001600160a01b038816906370a0823190602401602060405180830381865afa15801561167e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116a2919061203b565b6116ac9190611fb7565b9150816000036116cf5760405163c47a846d60e01b815260040160405180910390fd5b6001600160801b038211156116f75760405163e6b9d2cd60e01b815260040160405180910390fd5b82821015611722576040516312f9363160e11b81526004810183905260248101849052604401610624565b50949350505050565b7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c19930080546001600160a01b031981166001600160a01b03848116918217845560405192169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3505050565b60008051602061206b8339815191525460ff166105ea57604051638dfc202b60e01b815260040160405180910390fd5b60008260000182815481106117e3576117e3611f88565b9060005260206000200154905092915050565b6001546001600160801b03166000036118225760405163736706cd60e01b815260040160405180910390fd5b6001546001600160801b0316611840670de0b6b3a764000083611fca565b61184a9190611ff7565b60008082825461185a9190611f75565b909155505050565b61186b836119b6565b6118736119c7565b61187b6119d7565b6118836119df565b61188b6111ac565b6001600160a01b0384166118b2576040516316709a1760e21b815260040160405180910390fd5b5050600380546001600160a01b039093166001600160a01b03199384168117909155600480549093161790915550565b6000610471836001600160a01b0384166119ef565b6000610471836001600160a01b038416611a3e565b600080602060008451602086016000885af18061192f576040513d6000823e3d81fd5b50506000513d91508115611947578060011415611954565b6001600160a01b0384163b155b15610d7657604051635274afe760e01b81526001600160a01b0385166004820152602401610624565b6040516001600160a01b038481166024830152838116604483015260648201839052610d769186918216906323b872dd90608401611582565b6119be611b31565b61063681611b7a565b6119cf611b31565b6105ea611bac565b6105ea611b31565b6119e7611b31565b6105ea611bcd565b6000818152600183016020526040812054611a3657508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610517565b506000610517565b60008181526001830160205260408120548015611b27576000611a62600183611fb7565b8554909150600090611a7690600190611fb7565b9050808214611adb576000866000018281548110611a9657611a96611f88565b9060005260206000200154905080876000018481548110611ab957611ab9611f88565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080611aec57611aec612054565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610517565b6000915050610517565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0054600160401b900460ff166105ea57604051631afcd79f60e31b815260040160405180910390fd5b611b82611b31565b6001600160a01b03811661062d57604051631e4fbdf760e01b815260006004820152602401610624565b611bb4611b31565b60008051602061206b833981519152805460ff19169055565b610e8c611b31565b6001600160a01b038116811461063657600080fd5b60008083601f840112611bfc57600080fd5b50813567ffffffffffffffff811115611c1457600080fd5b6020830191508360208260051b8501011115611c2f57600080fd5b9250929050565b600080600060408486031215611c4b57600080fd5b8335611c5681611bd5565b9250602084013567ffffffffffffffff811115611c7257600080fd5b611c7e86828701611bea565b9497909650939450505050565b600060208284031215611c9d57600080fd5b813561047181611bd5565b600080600080600060808688031215611cc057600080fd5b8535611ccb81611bd5565b94506020860135935060408601359250606086013567ffffffffffffffff811115611cf557600080fd5b611d0188828901611bea565b969995985093965092949392505050565b60008060208385031215611d2557600080fd5b823567ffffffffffffffff811115611d3c57600080fd5b611d4885828601611bea565b90969095509350505050565b60008060008060608587031215611d6a57600080fd5b8435611d7581611bd5565b935060208501359250604085013567ffffffffffffffff811115611d9857600080fd5b611da487828801611bea565b95989497509550505050565b600080600060408486031215611dc557600080fd5b83358015158114611c5657600080fd5b60008060408385031215611de857600080fd5b50508035926020909101359150565b6040808252835190820181905260009060208501906060840190835b81811015611e6657835180516001600160a01b031684526020808201516001600160801b031681860152604080830151908601526060918201519185019190915290930192608090920191600101611e13565b5050602093909301939093525092915050565b60008060008060608587031215611e8f57600080fd5b8435935060208501359250604085013567ffffffffffffffff811115611d9857600080fd5b60008060008060608587031215611eca57600080fd5b8435611ed581611bd5565b93506020850135611ee581611bd5565b9250604085013567ffffffffffffffff811115611f0157600080fd5b8501601f81018713611f1257600080fd5b803567ffffffffffffffff811115611f2957600080fd5b876020828401011115611f3b57600080fd5b949793965060200194505050565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052601160045260246000fd5b8082018082111561051757610517611f5f565b634e487b7160e01b600052603260045260246000fd5b600060018201611fb057611fb0611f5f565b5060010190565b8181038181111561051757610517611f5f565b808202811582820484141761051757610517611f5f565b634e487b7160e01b600052601260045260246000fd5b60008261200657612006611fe1565b500490565b60008261201a5761201a611fe1565b500690565b6000600160ff1b820161203457612034611f5f565b5060000390565b60006020828403121561204d57600080fd5b5051919050565b634e487b7160e01b600052603160045260246000fdfecd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f033009b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00a2646970667358221220731b4d013e1817b8daa412e756e149ae5698d577a3654fc709d3baffe4a3390864736f6c634300081c0033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 31 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
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.