More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 150 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Unstake | 19979054 | 220 days ago | IN | 0 ETH | 0.00107778 | ||||
Unstake | 19921160 | 229 days ago | IN | 0 ETH | 0.00067601 | ||||
Unstake | 19921107 | 229 days ago | IN | 0 ETH | 0.00049763 | ||||
Unstake | 19921056 | 229 days ago | IN | 0 ETH | 0.00050166 | ||||
Unstake | 19705763 | 259 days ago | IN | 0 ETH | 0.00058802 | ||||
Unstake | 19662800 | 265 days ago | IN | 0 ETH | 0.00111801 | ||||
Unstake | 19611464 | 272 days ago | IN | 0 ETH | 0.00266975 | ||||
Unstake | 19604357 | 273 days ago | IN | 0 ETH | 0.00134871 | ||||
Unstake | 19601951 | 273 days ago | IN | 0 ETH | 0.00025783 | ||||
Unstake | 19601951 | 273 days ago | IN | 0 ETH | 0.00087669 | ||||
Unstake | 19597286 | 274 days ago | IN | 0 ETH | 0.00113374 | ||||
Unstake | 19595822 | 274 days ago | IN | 0 ETH | 0.00076296 | ||||
Unstake | 19593576 | 274 days ago | IN | 0 ETH | 0.00027993 | ||||
Unstake | 19593575 | 274 days ago | IN | 0 ETH | 0.00074963 | ||||
Unstake | 19593563 | 274 days ago | IN | 0 ETH | 0.00066948 | ||||
Unstake | 19593082 | 274 days ago | IN | 0 ETH | 0.00069881 | ||||
Unstake | 19591956 | 275 days ago | IN | 0 ETH | 0.00169688 | ||||
Unstake | 19591843 | 275 days ago | IN | 0 ETH | 0.00125295 | ||||
Unstake | 19591504 | 275 days ago | IN | 0 ETH | 0.00229646 | ||||
Unstake | 19591493 | 275 days ago | IN | 0 ETH | 0.00159089 | ||||
Unstake | 19591488 | 275 days ago | IN | 0 ETH | 0.00198324 | ||||
Unstake | 19591461 | 275 days ago | IN | 0 ETH | 0.00234206 | ||||
Unstake | 19591338 | 275 days ago | IN | 0 ETH | 0.00132449 | ||||
Unstake | 19591015 | 275 days ago | IN | 0 ETH | 0.00125683 | ||||
Unstake | 19590932 | 275 days ago | IN | 0 ETH | 0.00231266 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
Staking
Compiler Version
v0.8.20+commit.a1b79de6
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.20; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; /// @title Staking - A simple staking contract with rewards /// @notice This contract allows users to stake a token and earn rewards over a specified duration. /// @dev This contract uses OpenZeppelin's Ownable, SafeERC20, and IERC20 contracts. contract Staking is Ownable { /// @dev The staking token being used in the contract. IERC20 public stakingToken; /// @dev Using SafeERC20 library for safe token transfers. using SafeERC20 for IERC20; /// @dev Total duration for staking and rewards distribution. uint256 public constant TOTAL_DURATION = 60 days; /// @dev Total amount of rewards to be distributed. uint256 public constant TOTAL_REWARDS = 2_000_000 * 10 ** 18; /// @dev Timestamp when the staking pool ends. uint256 public immutable poolEndTS; /// @dev Total staked amount. uint256 public totalStaked; /// @dev Total unstaked amount. uint256 public totalUnstaked; /// @dev Total claimed rewards. uint256 public totalClaimed; /// @dev Total shares issued to stakers. uint256 public totalShares; /// @dev Total number of unique stakers. uint256 public totalStakers; /// @dev Mapping to store stake information for each user. mapping(address => StakeInfo) public stakes; /// @dev Struct to store information about each staker's stake. struct StakeInfo { uint256 amount; uint256 shares; } /// @dev Event emitted when a user stakes tokens. event Staked(address indexed user, uint256 amount); /// @dev Event emitted when a user unstakes tokens. event Unstaked( address indexed user, uint256 stakingAmount, uint256 rewardAmount ); /// @dev Contract constructor sets the staking token and pool end timestamp. /// @param _stakingToken Address of the staking token. constructor(IERC20 _stakingToken) Ownable(msg.sender) { stakingToken = _stakingToken; poolEndTS = block.timestamp + TOTAL_DURATION; } /// @dev Fallback function to receive Ether when sent directly to the contract. receive() external payable {} /// @dev Function for a user to stake tokens. /// @param _amount Amount of tokens to stake. function stake(uint256 _amount) external { require(_amount > 0, "Zero Amount"); require(block.timestamp < poolEndTS, "Pool is closed"); stakingToken.safeTransferFrom(msg.sender, address(this), _amount); StakeInfo storage _stake = stakes[msg.sender]; if (_stake.amount == 0) { totalStakers++; } uint256 _shares = _amount * (poolEndTS - block.timestamp); _stake.amount += _amount; _stake.shares += _shares; totalStaked += _amount; totalShares += _shares; emit Staked(msg.sender, _amount); } /// @dev Function for a user to unstake their tokens. function unstake() external { StakeInfo storage _stake = stakes[msg.sender]; require(_stake.amount > 0, "Insufficient balance"); if (block.timestamp < poolEndTS) { stakingToken.safeTransfer(msg.sender, _stake.amount); totalShares -= _stake.shares; emit Unstaked(msg.sender, _stake.amount, 0); } else { uint256 _reward = calculateReward(msg.sender); stakingToken.safeTransfer(msg.sender, _stake.amount + _reward); totalClaimed += _reward; emit Unstaked(msg.sender, _stake.amount, _reward); } totalUnstaked += _stake.amount; totalStakers--; delete stakes[msg.sender]; } /// @dev Function to withdraw the Ether balance from the contract. function withdrawEth() external onlyOwner { uint256 amount = address(this).balance; address payable to = payable(msg.sender); to.transfer(amount); } /// @dev Function to withdraw tokens from the contract. /// @param token The address of the token being withdrawn. /// @param amount The amount of tokens being withdrawn. function withdrawToken(IERC20 token, uint256 amount) external onlyOwner { if (token == stakingToken) { require( stakingToken.balanceOf(address(this)) >= (totalStaked - totalUnstaked) + (TOTAL_REWARDS - totalClaimed) + amount, "Insufficient balance" ); } require( token.balanceOf(address(this)) >= amount, "Insufficient balance" ); token.safeTransfer(msg.sender, amount); } /// @dev Function to calculate the reward for a user. /// @param _user Address of the user. /// @return Calculated reward for the user. function calculateReward(address _user) public view returns (uint256) { StakeInfo storage _stake = stakes[_user]; if (_stake.amount == 0) { return 0; } return (TOTAL_REWARDS * _stake.shares) / totalShares; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol) pragma solidity ^0.8.20; import {Context} from "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * 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 Ownable is Context { address private _owner; /** * @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. */ constructor(address initialOwner) { 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) { 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 { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. * * ==== Security Considerations * * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be * considered as an intention to spend the allowance in any specific way. The second is that because permits have * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be * generally recommended is: * * ```solidity * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public { * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {} * doThing(..., value); * } * * function doThing(..., uint256 value) public { * token.safeTransferFrom(msg.sender, address(this), value); * ... * } * ``` * * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also * {SafeERC20-safeTransferFrom}). * * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so * contracts should have entry points that don't rely on permit. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. * * CAUTION: See Security Considerations above. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the 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.0.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.20; import {IERC20} from "../IERC20.sol"; import {IERC20Permit} from "../extensions/IERC20Permit.sol"; import {Address} from "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; /** * @dev An operation with an ERC20 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. */ 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. */ 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. */ 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 Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data); if (returndata.length != 0 && !abi.decode(returndata, (bool))) { 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 silents catches all reverts and returns a bool instead. */ function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false // and not revert is the subcall reverts. (bool success, bytes memory returndata) = address(token).call(data); return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol) pragma solidity ^0.8.20; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev The ETH balance of the account is not enough to perform the operation. */ error AddressInsufficientBalance(address account); /** * @dev There's no code at `target` (it is not a contract). */ error AddressEmptyCode(address target); /** * @dev A call to an address target failed. The target may have reverted. */ error FailedInnerCall(); /** * @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 AddressInsufficientBalance(address(this)); } (bool success, ) = recipient.call{value: amount}(""); if (!success) { revert FailedInnerCall(); } } /** * @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 * {FailedInnerCall} 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 AddressInsufficientBalance(address(this)); } (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 {FailedInnerCall}) 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 {FailedInnerCall} 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 {FailedInnerCall}. */ 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 /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert FailedInnerCall(); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol) pragma solidity ^0.8.20; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } function _contextSuffixLength() internal view virtual returns (uint256) { return 0; } }
{ "optimizer": { "enabled": true, "runs": 200 }, "evmVersion": "paris", "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"contract IERC20","name":"_stakingToken","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"AddressInsufficientBalance","type":"error"},{"inputs":[],"name":"FailedInnerCall","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":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Staked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"stakingAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"rewardAmount","type":"uint256"}],"name":"Unstaked","type":"event"},{"inputs":[],"name":"TOTAL_DURATION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TOTAL_REWARDS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"calculateReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"poolEndTS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"stake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"stakes","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"shares","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stakingToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalClaimed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalShares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalStaked","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalStakers","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalUnstaked","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unstake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawEth","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdrawToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
60a060405234801561001057600080fd5b50604051610f3d380380610f3d83398101604081905261002f916100e0565b338061005557604051631e4fbdf760e01b81526000600482015260240160405180910390fd5b61005e81610090565b50600180546001600160a01b0319166001600160a01b038316179055610087624f1a0042610110565b60805250610137565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000602082840312156100f257600080fd5b81516001600160a01b038116811461010957600080fd5b9392505050565b8082018082111561013157634e487b7160e01b600052601160045260246000fd5b92915050565b608051610dd6610167600039600081816101a60152818161039c0152818161072401526107d00152610dd66000f3fe60806040526004361061010d5760003560e01c80638698903811610095578063a694fc3a11610064578063a694fc3a146102d7578063d54ad2a1146102f7578063d82e39621461030d578063f2f3d0921461032d578063f2fde38b1461034457600080fd5b8063869890381461026e5780638da5cb5b146102845780639e281a98146102a2578063a0ef91df146102c257600080fd5b80633a98ef39116100dc5780633a98ef39146101df5780635235934d146101f5578063715018a61461020b57806372f702f314610220578063817b1cd21461025857600080fd5b806309cf60911461011957806316934fc41461014b57806321d59210146101945780632def6620146101c857600080fd5b3661011457005b600080fd5b34801561012557600080fd5b506101386a01a784379d99db4200000081565b6040519081526020015b60405180910390f35b34801561015757600080fd5b5061017f610166366004610c01565b6007602052600090815260409020805460019091015482565b60408051928352602083019190915201610142565b3480156101a057600080fd5b506101387f000000000000000000000000000000000000000000000000000000000000000081565b3480156101d457600080fd5b506101dd610364565b005b3480156101eb57600080fd5b5061013860055481565b34801561020157600080fd5b5061013860035481565b34801561021757600080fd5b506101dd61050c565b34801561022c57600080fd5b50600154610240906001600160a01b031681565b6040516001600160a01b039091168152602001610142565b34801561026457600080fd5b5061013860025481565b34801561027a57600080fd5b5061013860065481565b34801561029057600080fd5b506000546001600160a01b0316610240565b3480156102ae57600080fd5b506101dd6102bd366004610c1e565b610520565b3480156102ce57600080fd5b506101dd6106a6565b3480156102e357600080fd5b506101dd6102f2366004610c4a565b6106e4565b34801561030357600080fd5b5061013860045481565b34801561031957600080fd5b50610138610328366004610c01565b6108a0565b34801561033957600080fd5b50610138624f1a0081565b34801561035057600080fd5b506101dd61035f366004610c01565b6108f7565b336000908152600760205260409020805461039a5760405162461bcd60e51b815260040161039190610c63565b60405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000000042101561043b5780546001546103de916001600160a01b03909116903390610935565b8060010154600560008282546103f49190610ca7565b90915550508054604080519182526000602083015233917f7fc4727e062e336010f2c282598ef5f14facb3de68cf8195c2f23e1454b2b74e910160405180910390a26104c5565b6000610446336108a0565b905061046f3382846000015461045c9190610cba565b6001546001600160a01b03169190610935565b80600460008282546104819190610cba565b90915550508154604080519182526020820183905233917f7fc4727e062e336010f2c282598ef5f14facb3de68cf8195c2f23e1454b2b74e910160405180910390a2505b8054600380546000906104d9908490610cba565b9091555050600680549060006104ee83610ccd565b90915550503360009081526007602052604081208181556001015550565b610514610994565b61051e60006109c1565b565b610528610994565b6001546001600160a01b039081169083160361060657806004546a01a784379d99db420000006105589190610ca7565b6003546002546105689190610ca7565b6105729190610cba565b61057c9190610cba565b6001546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa1580156105c4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105e89190610ce4565b10156106065760405162461bcd60e51b815260040161039190610c63565b6040516370a0823160e01b815230600482015281906001600160a01b038416906370a0823190602401602060405180830381865afa15801561064c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106709190610ce4565b101561068e5760405162461bcd60e51b815260040161039190610c63565b6106a26001600160a01b0383163383610935565b5050565b6106ae610994565b60405147903390819083156108fc029084906000818181858888f193505050501580156106df573d6000803e3d6000fd5b505050565b600081116107225760405162461bcd60e51b815260206004820152600b60248201526a16995c9bc8105b5bdd5b9d60aa1b6044820152606401610391565b7f000000000000000000000000000000000000000000000000000000000000000042106107825760405162461bcd60e51b815260206004820152600e60248201526d141bdbdb081a5cc818db1bdcd95960921b6044820152606401610391565b60015461079a906001600160a01b0316333084610a11565b33600090815260076020526040812080549091036107c857600680549060006107c283610cfd565b91905055505b60006107f4427f0000000000000000000000000000000000000000000000000000000000000000610ca7565b6107fe9084610d16565b9050828260000160008282546108149190610cba565b925050819055508082600101600082825461082f9190610cba565b9250508190555082600260008282546108489190610cba565b9250508190555080600560008282546108619190610cba565b909155505060405183815233907f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d9060200160405180910390a2505050565b6001600160a01b0381166000908152600760205260408120805482036108c95750600092915050565b60055460018201546108e6906a01a784379d99db42000000610d16565b6108f09190610d2d565b9392505050565b6108ff610994565b6001600160a01b03811661092957604051631e4fbdf760e01b815260006004820152602401610391565b610932816109c1565b50565b6040516001600160a01b038381166024830152604482018390526106df91859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180516001600160e01b038381831617835250505050610a50565b6000546001600160a01b0316331461051e5760405163118cdaa760e01b8152336004820152602401610391565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6040516001600160a01b038481166024830152838116604483015260648201839052610a4a9186918216906323b872dd90608401610962565b50505050565b6000610a656001600160a01b03841683610ab3565b90508051600014158015610a8a575080806020019051810190610a889190610d4f565b155b156106df57604051635274afe760e01b81526001600160a01b0384166004820152602401610391565b6060610ac183836000610aca565b90505b92915050565b606081471015610aef5760405163cd78605960e01b8152306004820152602401610391565b600080856001600160a01b03168486604051610b0b9190610d71565b60006040518083038185875af1925050503d8060008114610b48576040519150601f19603f3d011682016040523d82523d6000602084013e610b4d565b606091505b5091509150610b5d868383610b67565b9695505050505050565b606082610b7c57610b7782610bc3565b6108f0565b8151158015610b9357506001600160a01b0384163b155b15610bbc57604051639996b31560e01b81526001600160a01b0385166004820152602401610391565b50806108f0565b805115610bd35780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b6001600160a01b038116811461093257600080fd5b600060208284031215610c1357600080fd5b81356108f081610bec565b60008060408385031215610c3157600080fd5b8235610c3c81610bec565b946020939093013593505050565b600060208284031215610c5c57600080fd5b5035919050565b602080825260149082015273496e73756666696369656e742062616c616e636560601b604082015260600190565b634e487b7160e01b600052601160045260246000fd5b81810381811115610ac457610ac4610c91565b80820180821115610ac457610ac4610c91565b600081610cdc57610cdc610c91565b506000190190565b600060208284031215610cf657600080fd5b5051919050565b600060018201610d0f57610d0f610c91565b5060010190565b8082028115828204841417610ac457610ac4610c91565b600082610d4a57634e487b7160e01b600052601260045260246000fd5b500490565b600060208284031215610d6157600080fd5b815180151581146108f057600080fd5b6000825160005b81811015610d925760208186018101518583015201610d78565b50600092019182525091905056fea2646970667358221220a9e29b2181a631af5ee7f91da2b8efc86865c348e0778559efd202253a60f09d64736f6c6343000814003300000000000000000000000021b8bfbbefc9e2b9a994871ecd742a5132b98aed
Deployed Bytecode
0x60806040526004361061010d5760003560e01c80638698903811610095578063a694fc3a11610064578063a694fc3a146102d7578063d54ad2a1146102f7578063d82e39621461030d578063f2f3d0921461032d578063f2fde38b1461034457600080fd5b8063869890381461026e5780638da5cb5b146102845780639e281a98146102a2578063a0ef91df146102c257600080fd5b80633a98ef39116100dc5780633a98ef39146101df5780635235934d146101f5578063715018a61461020b57806372f702f314610220578063817b1cd21461025857600080fd5b806309cf60911461011957806316934fc41461014b57806321d59210146101945780632def6620146101c857600080fd5b3661011457005b600080fd5b34801561012557600080fd5b506101386a01a784379d99db4200000081565b6040519081526020015b60405180910390f35b34801561015757600080fd5b5061017f610166366004610c01565b6007602052600090815260409020805460019091015482565b60408051928352602083019190915201610142565b3480156101a057600080fd5b506101387f00000000000000000000000000000000000000000000000000000000660fdb8f81565b3480156101d457600080fd5b506101dd610364565b005b3480156101eb57600080fd5b5061013860055481565b34801561020157600080fd5b5061013860035481565b34801561021757600080fd5b506101dd61050c565b34801561022c57600080fd5b50600154610240906001600160a01b031681565b6040516001600160a01b039091168152602001610142565b34801561026457600080fd5b5061013860025481565b34801561027a57600080fd5b5061013860065481565b34801561029057600080fd5b506000546001600160a01b0316610240565b3480156102ae57600080fd5b506101dd6102bd366004610c1e565b610520565b3480156102ce57600080fd5b506101dd6106a6565b3480156102e357600080fd5b506101dd6102f2366004610c4a565b6106e4565b34801561030357600080fd5b5061013860045481565b34801561031957600080fd5b50610138610328366004610c01565b6108a0565b34801561033957600080fd5b50610138624f1a0081565b34801561035057600080fd5b506101dd61035f366004610c01565b6108f7565b336000908152600760205260409020805461039a5760405162461bcd60e51b815260040161039190610c63565b60405180910390fd5b7f00000000000000000000000000000000000000000000000000000000660fdb8f42101561043b5780546001546103de916001600160a01b03909116903390610935565b8060010154600560008282546103f49190610ca7565b90915550508054604080519182526000602083015233917f7fc4727e062e336010f2c282598ef5f14facb3de68cf8195c2f23e1454b2b74e910160405180910390a26104c5565b6000610446336108a0565b905061046f3382846000015461045c9190610cba565b6001546001600160a01b03169190610935565b80600460008282546104819190610cba565b90915550508154604080519182526020820183905233917f7fc4727e062e336010f2c282598ef5f14facb3de68cf8195c2f23e1454b2b74e910160405180910390a2505b8054600380546000906104d9908490610cba565b9091555050600680549060006104ee83610ccd565b90915550503360009081526007602052604081208181556001015550565b610514610994565b61051e60006109c1565b565b610528610994565b6001546001600160a01b039081169083160361060657806004546a01a784379d99db420000006105589190610ca7565b6003546002546105689190610ca7565b6105729190610cba565b61057c9190610cba565b6001546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa1580156105c4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105e89190610ce4565b10156106065760405162461bcd60e51b815260040161039190610c63565b6040516370a0823160e01b815230600482015281906001600160a01b038416906370a0823190602401602060405180830381865afa15801561064c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106709190610ce4565b101561068e5760405162461bcd60e51b815260040161039190610c63565b6106a26001600160a01b0383163383610935565b5050565b6106ae610994565b60405147903390819083156108fc029084906000818181858888f193505050501580156106df573d6000803e3d6000fd5b505050565b600081116107225760405162461bcd60e51b815260206004820152600b60248201526a16995c9bc8105b5bdd5b9d60aa1b6044820152606401610391565b7f00000000000000000000000000000000000000000000000000000000660fdb8f42106107825760405162461bcd60e51b815260206004820152600e60248201526d141bdbdb081a5cc818db1bdcd95960921b6044820152606401610391565b60015461079a906001600160a01b0316333084610a11565b33600090815260076020526040812080549091036107c857600680549060006107c283610cfd565b91905055505b60006107f4427f00000000000000000000000000000000000000000000000000000000660fdb8f610ca7565b6107fe9084610d16565b9050828260000160008282546108149190610cba565b925050819055508082600101600082825461082f9190610cba565b9250508190555082600260008282546108489190610cba565b9250508190555080600560008282546108619190610cba565b909155505060405183815233907f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d9060200160405180910390a2505050565b6001600160a01b0381166000908152600760205260408120805482036108c95750600092915050565b60055460018201546108e6906a01a784379d99db42000000610d16565b6108f09190610d2d565b9392505050565b6108ff610994565b6001600160a01b03811661092957604051631e4fbdf760e01b815260006004820152602401610391565b610932816109c1565b50565b6040516001600160a01b038381166024830152604482018390526106df91859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180516001600160e01b038381831617835250505050610a50565b6000546001600160a01b0316331461051e5760405163118cdaa760e01b8152336004820152602401610391565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6040516001600160a01b038481166024830152838116604483015260648201839052610a4a9186918216906323b872dd90608401610962565b50505050565b6000610a656001600160a01b03841683610ab3565b90508051600014158015610a8a575080806020019051810190610a889190610d4f565b155b156106df57604051635274afe760e01b81526001600160a01b0384166004820152602401610391565b6060610ac183836000610aca565b90505b92915050565b606081471015610aef5760405163cd78605960e01b8152306004820152602401610391565b600080856001600160a01b03168486604051610b0b9190610d71565b60006040518083038185875af1925050503d8060008114610b48576040519150601f19603f3d011682016040523d82523d6000602084013e610b4d565b606091505b5091509150610b5d868383610b67565b9695505050505050565b606082610b7c57610b7782610bc3565b6108f0565b8151158015610b9357506001600160a01b0384163b155b15610bbc57604051639996b31560e01b81526001600160a01b0385166004820152602401610391565b50806108f0565b805115610bd35780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b6001600160a01b038116811461093257600080fd5b600060208284031215610c1357600080fd5b81356108f081610bec565b60008060408385031215610c3157600080fd5b8235610c3c81610bec565b946020939093013593505050565b600060208284031215610c5c57600080fd5b5035919050565b602080825260149082015273496e73756666696369656e742062616c616e636560601b604082015260600190565b634e487b7160e01b600052601160045260246000fd5b81810381811115610ac457610ac4610c91565b80820180821115610ac457610ac4610c91565b600081610cdc57610cdc610c91565b506000190190565b600060208284031215610cf657600080fd5b5051919050565b600060018201610d0f57610d0f610c91565b5060010190565b8082028115828204841417610ac457610ac4610c91565b600082610d4a57634e487b7160e01b600052601260045260246000fd5b500490565b600060208284031215610d6157600080fd5b815180151581146108f057600080fd5b6000825160005b81811015610d925760208186018101518583015201610d78565b50600092019182525091905056fea2646970667358221220a9e29b2181a631af5ee7f91da2b8efc86865c348e0778559efd202253a60f09d64736f6c63430008140033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000021b8bfbbefc9e2b9a994871ecd742a5132b98aed
-----Decoded View---------------
Arg [0] : _stakingToken (address): 0x21B8bfbbefc9E2b9A994871Ecd742A5132B98AeD
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 00000000000000000000000021b8bfbbefc9e2b9a994871ecd742a5132b98aed
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.