Feature Tip: Add private address tag to any address under My Name Tag !
Source Code
Latest 11 from a total of 11 transactions
| Transaction Hash |
Method
|
Block
|
From
|
|
To
|
||||
|---|---|---|---|---|---|---|---|---|---|
| Stake | 24451648 | 27 hrs ago | IN | 0 ETH | 0.00027531 | ||||
| Stake | 24447531 | 41 hrs ago | IN | 0 ETH | 0.00000539 | ||||
| Unstake | 24447517 | 41 hrs ago | IN | 0 ETH | 0.00000288 | ||||
| Add To Whitelist | 24446745 | 44 hrs ago | IN | 0 ETH | 0.00000281 | ||||
| Stake | 24445870 | 47 hrs ago | IN | 0 ETH | 0.00020006 | ||||
| Stake | 24414074 | 6 days ago | IN | 0 ETH | 0.00000539 | ||||
| Stake | 24414064 | 6 days ago | IN | 0 ETH | 0.00000721 | ||||
| Add To Whitelist | 24413915 | 6 days ago | IN | 0 ETH | 0.00000492 | ||||
| Stake | 24413708 | 6 days ago | IN | 0 ETH | 0.00000289 | ||||
| Stake | 24413699 | 6 days ago | IN | 0 ETH | 0.00000186 | ||||
| Deposit Rewards | 24413654 | 6 days ago | IN | 0 ETH | 0.00000521 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Contract Name:
XGoldStaking
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 "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
contract XGoldStaking is Ownable, ReentrancyGuard {
using SafeERC20 for IERC20;
IERC20 public immutable stakingToken;
uint256 public constant MAX_APY = 240; // Maximum 240% APY
uint256 public apy = 240; // Current APY, configurable by owner
uint256 public constant SECONDS_PER_YEAR = 365 days;
uint256 public constant REWARD_PRECISION = 10000; // For precision in calculations
struct StakeInfo {
uint256 amount;
uint256 stakedAt;
uint256 lastRewardClaimedAt;
uint256 unclaimedReward;
}
mapping(address => StakeInfo) public stakes;
mapping(address => bool) public whitelist;
uint256 public totalStaked;
uint256 public rewardPool;
event Staked(address indexed user, uint256 amount);
event Unstaked(address indexed user, uint256 amount);
event RewardClaimed(address indexed user, uint256 reward);
event RewardsDeposited(address indexed depositor, uint256 amount);
event RewardsWithdrawn(address indexed owner, uint256 amount);
event APYUpdated(uint256 oldAPY, uint256 newAPY);
event WhitelistAdded(address indexed account);
event WhitelistRemoved(address indexed account);
modifier onlyWhitelisted() {
require(whitelist[msg.sender], "Address is not whitelisted");
_;
}
constructor(address _stakingToken) Ownable(msg.sender) {
require(_stakingToken != address(0), "Invalid staking token address");
stakingToken = IERC20(_stakingToken);
}
function stake(uint256 amount) external nonReentrant onlyWhitelisted {
require(amount > 0, "Amount must be greater than 0");
StakeInfo storage userStake = stakes[msg.sender];
if (userStake.amount > 0) {
uint256 pendingReward = calculateReward(msg.sender);
if (pendingReward > 0) {
if (rewardPool >= pendingReward) {
_claimReward(msg.sender, pendingReward);
} else {
uint256 claimable = rewardPool;
if (claimable > 0) {
rewardPool -= claimable;
stakingToken.safeTransfer(msg.sender, claimable);
emit RewardClaimed(msg.sender, claimable);
}
userStake.unclaimedReward = pendingReward - claimable;
}
}
userStake.lastRewardClaimedAt = block.timestamp;
} else {
userStake.stakedAt = block.timestamp;
userStake.lastRewardClaimedAt = block.timestamp;
}
stakingToken.safeTransferFrom(msg.sender, address(this), amount);
userStake.amount += amount;
totalStaked += amount;
emit Staked(msg.sender, amount);
}
function unstake(uint256 amount) external nonReentrant {
StakeInfo storage userStake = stakes[msg.sender];
require(userStake.amount >= amount, "Insufficient staked amount");
require(amount > 0, "Amount must be greater than 0");
uint256 pendingReward = calculateReward(msg.sender);
if (pendingReward > 0) {
uint256 claimableReward = pendingReward > rewardPool ? rewardPool : pendingReward;
uint256 unpaidReward = pendingReward - claimableReward;
if (claimableReward > 0) {
rewardPool -= claimableReward;
stakingToken.safeTransfer(msg.sender, claimableReward);
emit RewardClaimed(msg.sender, claimableReward);
}
userStake.unclaimedReward = unpaidReward;
userStake.lastRewardClaimedAt = block.timestamp;
}
userStake.amount -= amount;
totalStaked -= amount;
if (userStake.amount == 0) {
if (userStake.unclaimedReward == 0) {
delete stakes[msg.sender];
}
} else {
userStake.lastRewardClaimedAt = block.timestamp;
}
stakingToken.safeTransfer(msg.sender, amount);
emit Unstaked(msg.sender, amount);
}
function claimReward() external nonReentrant {
uint256 reward = calculateReward(msg.sender);
require(reward > 0, "No reward to claim");
_claimReward(msg.sender, reward);
}
function _claimReward(address user, uint256 reward) internal {
require(rewardPool >= reward, "Insufficient reward pool");
StakeInfo storage userStake = stakes[user];
userStake.lastRewardClaimedAt = block.timestamp;
userStake.unclaimedReward = 0;
rewardPool -= reward;
stakingToken.safeTransfer(user, reward);
emit RewardClaimed(user, reward);
if (userStake.amount == 0) {
delete stakes[user];
}
}
function calculateReward(address user) public view returns (uint256) {
StakeInfo memory userStake = stakes[user];
if (userStake.amount == 0) {
return userStake.unclaimedReward;
}
uint256 timeElapsed = block.timestamp - userStake.lastRewardClaimedAt;
uint256 reward = 0;
if (timeElapsed > 0) {
// reward = (amount * apy * timeElapsed) / (100 * SECONDS_PER_YEAR)
// Using 100 because APY is expressed as percentage (240 = 240%)
reward = (userStake.amount * apy * timeElapsed) / (100 * SECONDS_PER_YEAR);
}
return reward + userStake.unclaimedReward;
}
function getStakeInfo(address user) external view returns (StakeInfo memory) {
return stakes[user];
}
function depositRewards(uint256 amount) external onlyOwner nonReentrant {
require(amount > 0, "Amount must be greater than 0");
stakingToken.safeTransferFrom(msg.sender, address(this), amount);
rewardPool += amount;
emit RewardsDeposited(msg.sender, amount);
}
function withdrawRewards(uint256 amount) external onlyOwner nonReentrant {
require(amount <= rewardPool, "Amount exceeds reward pool");
rewardPool -= amount;
stakingToken.safeTransfer(owner(), amount);
emit RewardsWithdrawn(owner(), amount);
}
function setAPY(uint256 _apy) external onlyOwner {
require(_apy > 0, "APY must be greater than 0");
require(_apy <= MAX_APY, "APY exceeds maximum");
uint256 oldAPY = apy;
apy = _apy;
emit APYUpdated(oldAPY, _apy);
}
function emergencyWithdraw() external onlyOwner {
uint256 balance = stakingToken.balanceOf(address(this));
rewardPool = 0;
totalStaked = 0;
stakingToken.safeTransfer(owner(), balance);
}
function addToWhitelist(address account) external onlyOwner {
require(account != address(0), "Invalid address");
require(!whitelist[account], "Address already whitelisted");
whitelist[account] = true;
emit WhitelistAdded(account);
}
function removeFromWhitelist(address account) external onlyOwner {
require(whitelist[account], "Address not whitelisted");
whitelist[account] = false;
emit WhitelistRemoved(account);
}
function batchAddToWhitelist(address[] calldata accounts) external onlyOwner {
for (uint256 i = 0; i < accounts.length; i++) {
if (accounts[i] != address(0) && !whitelist[accounts[i]]) {
whitelist[accounts[i]] = true;
emit WhitelistAdded(accounts[i]);
}
}
}
function batchRemoveFromWhitelist(address[] calldata accounts) external onlyOwner {
for (uint256 i = 0; i < accounts.length; i++) {
if (whitelist[accounts[i]]) {
whitelist[accounts[i]] = false;
emit WhitelistRemoved(accounts[i]);
}
}
}
}// 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.4.0) (interfaces/IERC1363.sol)
pragma solidity >=0.6.2;
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.4.0) (interfaces/IERC165.sol)
pragma solidity >=0.4.16;
import {IERC165} from "../utils/introspection/IERC165.sol";// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC20.sol)
pragma solidity >=0.4.16;
import {IERC20} from "../token/ERC20/IERC20.sol";// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC20/IERC20.sol)
pragma solidity >=0.4.16;
/**
* @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.3.0) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.20;
import {IERC20} from "../IERC20.sol";
import {IERC1363} from "../../../interfaces/IERC1363.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 Variant of {safeTransfer} that returns a bool instead of reverting if the operation is not successful.
*/
function trySafeTransfer(IERC20 token, address to, uint256 value) internal returns (bool) {
return _callOptionalReturnBool(token, abi.encodeCall(token.transfer, (to, value)));
}
/**
* @dev Variant of {safeTransferFrom} that returns a bool instead of reverting if the operation is not successful.
*/
function trySafeTransferFrom(IERC20 token, address from, address to, uint256 value) internal returns (bool) {
return _callOptionalReturnBool(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.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;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (utils/introspection/IERC165.sol)
pragma solidity >=0.4.16;
/**
* @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/ReentrancyGuard.sol)
pragma solidity ^0.8.20;
/**
* @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 ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant NOT_ENTERED = 1;
uint256 private constant ENTERED = 2;
uint256 private _status;
/**
* @dev Unauthorized reentrant call.
*/
error ReentrancyGuardReentrantCall();
constructor() {
_status = NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
function _nonReentrantBefore() private {
// On the first call to nonReentrant, _status will be NOT_ENTERED
if (_status == ENTERED) {
revert ReentrancyGuardReentrantCall();
}
// Any calls to nonReentrant after this point will fail
_status = ENTERED;
}
function _nonReentrantAfter() private {
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = NOT_ENTERED;
}
/**
* @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
* `nonReentrant` function in the call stack.
*/
function _reentrancyGuardEntered() internal view returns (bool) {
return _status == ENTERED;
}
}{
"optimizer": {
"enabled": true,
"runs": 200
},
"evmVersion": "paris",
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"_stakingToken","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"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"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldAPY","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newAPY","type":"uint256"}],"name":"APYUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"reward","type":"uint256"}],"name":"RewardClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"depositor","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"RewardsDeposited","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"RewardsWithdrawn","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":"amount","type":"uint256"}],"name":"Unstaked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"}],"name":"WhitelistAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"}],"name":"WhitelistRemoved","type":"event"},{"inputs":[],"name":"MAX_APY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"REWARD_PRECISION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SECONDS_PER_YEAR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"addToWhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"apy","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"accounts","type":"address[]"}],"name":"batchAddToWhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"accounts","type":"address[]"}],"name":"batchRemoveFromWhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"calculateReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"claimReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"depositRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"emergencyWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"getStakeInfo","outputs":[{"components":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"stakedAt","type":"uint256"},{"internalType":"uint256","name":"lastRewardClaimedAt","type":"uint256"},{"internalType":"uint256","name":"unclaimedReward","type":"uint256"}],"internalType":"struct XGoldStaking.StakeInfo","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"removeFromWhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewardPool","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_apy","type":"uint256"}],"name":"setAPY","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":"stakedAt","type":"uint256"},{"internalType":"uint256","name":"lastRewardClaimedAt","type":"uint256"},{"internalType":"uint256","name":"unclaimedReward","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stakingToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalStaked","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":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"unstake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"whitelist","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdrawRewards","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
60a060405260f06002553480156200001657600080fd5b50604051620018623803806200186283398101604081905262000039916200012b565b33806200006157604051631e4fbdf760e01b8152600060048201526024015b60405180910390fd5b6200006c81620000db565b50600180556001600160a01b038116620000c95760405162461bcd60e51b815260206004820152601d60248201527f496e76616c6964207374616b696e6720746f6b656e2061646472657373000000604482015260640162000058565b6001600160a01b03166080526200015d565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000602082840312156200013e57600080fd5b81516001600160a01b03811681146200015657600080fd5b9392505050565b6080516116b1620001b1600039600081816102600152818161082b0152818161091a01528181610a8e01528181610ba001528181610d0301528181610d9801528181610ff801526113af01526116b16000f3fe608060405234801561001057600080fd5b50600436106101735760003560e01c80638ab1d681116100de578063b88a802f11610097578063db2e21bc11610071578063db2e21bc14610394578063e43252d71461039c578063e6a69ab8146103af578063f2fde38b146103ba57600080fd5b8063b88a802f14610333578063c34531531461033b578063d82e39621461038157600080fd5b80638ab1d681146102a35780638bdf67f2146102b65780638da5cb5b146102c95780639342c8f4146102da5780639b19251a146102ed578063a694fc3a1461032057600080fd5b80633d6aa5e1116101305780633d6aa5e1146102395780633d92f4e21461024257806366666aa91461024a578063715018a61461025357806372f702f31461025b578063817b1cd21461029a57600080fd5b8063045fb8881461017857806316934fc41461018d57806324f45e67146101e95780632db6fa36146101fc5780632e17de781461020f5780633bcfc4b814610222575b600080fd5b61018b6101863660046114c3565b6103cd565b005b6101c461019b366004611538565b600360208190526000918252604090912080546001820154600283015492909301549092919084565b6040805194855260208501939093529183015260608201526080015b60405180910390f35b61018b6101f7366004611568565b6104f6565b61018b61020a3660046114c3565b6105df565b61018b61021d366004611568565b610740565b61022b60025481565b6040519081526020016101e0565b61022b61271081565b61022b60f081565b61022b60065481565b61018b610984565b6102827f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016101e0565b61022b60055481565b61018b6102b1366004611538565b610998565b61018b6102c4366004611568565b610a51565b6000546001600160a01b0316610282565b61018b6102e8366004611568565b610b0c565b6103106102fb366004611538565b60046020526000908152604090205460ff1681565b60405190151581526020016101e0565b61018b61032e366004611568565b610c0d565b61018b610e31565b61034e610349366004611538565b610e9f565b6040516101e091908151815260208083015190820152604080830151908201526060918201519181019190915260800190565b61022b61038f366004611538565b610f15565b61018b610fd8565b61018b6103aa366004611538565b61108c565b61022b6301e1338081565b61018b6103c8366004611538565b611191565b6103d56111cc565b60005b818110156104f157600460008484848181106103f6576103f6611581565b905060200201602081019061040b9190611538565b6001600160a01b0316815260208101919091526040016000205460ff16156104df5760006004600085858581811061044557610445611581565b905060200201602081019061045a9190611538565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905582828281811061049457610494611581565b90506020020160208101906104a99190611538565b6001600160a01b03167fde8cf212af7ce38b2840785a2768d97ff2dbf3c21b516961cec0061e134c2a1e60405160405180910390a25b806104e9816115ad565b9150506103d8565b505050565b6104fe6111cc565b600081116105535760405162461bcd60e51b815260206004820152601a60248201527f415059206d7573742062652067726561746572207468616e203000000000000060448201526064015b60405180910390fd5b60f081111561059a5760405162461bcd60e51b81526020600482015260136024820152724150592065786365656473206d6178696d756d60681b604482015260640161054a565b600280549082905560408051828152602081018490527f787a1fca55641ce34a438271930bbb9401df20db2b4f510d4f252227d85df43d910160405180910390a15050565b6105e76111cc565b60005b818110156104f157600083838381811061060657610606611581565b905060200201602081019061061b9190611538565b6001600160a01b03161415801561067757506004600084848481811061064357610643611581565b90506020020160208101906106589190611538565b6001600160a01b0316815260208101919091526040016000205460ff16155b1561072e5760016004600085858581811061069457610694611581565b90506020020160208101906106a99190611538565b6001600160a01b031681526020810191909152604001600020805460ff19169115159190911790558282828181106106e3576106e3611581565b90506020020160208101906106f89190611538565b6001600160a01b03167f4790a4adb426ca2345bb5108f6e454eae852a7bf687544cd66a7270dff3a41d660405160405180910390a25b80610738816115ad565b9150506105ea565b6107486111f9565b33600090815260036020526040902080548211156107a85760405162461bcd60e51b815260206004820152601a60248201527f496e73756666696369656e74207374616b656420616d6f756e74000000000000604482015260640161054a565b600082116107c85760405162461bcd60e51b815260040161054a906115c6565b60006107d333610f15565b9050801561089557600060065482116107ec57816107f0565b6006545b905060006107fe82846115fd565b9050811561088857816006600082825461081891906115fd565b9091555061085290506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163384611223565b60405182815233907f106f923f993c2149d49b4255ff723acafa1f2d94393f561d3eda32ae348f72419060200160405180910390a25b6003840155504260028301555b828260000160008282546108a991906115fd565b9250508190555082600560008282546108c291906115fd565b90915550508154600003610906578160030154600003610901573360009081526003602081905260408220828155600181018390556002810183905501555b61090d565b4260028301555b6109416001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163385611223565b60405183815233907f0f5bb82176feb1b5e747e28471aa92156a04d9f3ab9f45f28e2d704232b93f759060200160405180910390a2505061098160018055565b50565b61098c6111cc565b6109966000611282565b565b6109a06111cc565b6001600160a01b03811660009081526004602052604090205460ff16610a085760405162461bcd60e51b815260206004820152601760248201527f41646472657373206e6f742077686974656c6973746564000000000000000000604482015260640161054a565b6001600160a01b038116600081815260046020526040808220805460ff19169055517fde8cf212af7ce38b2840785a2768d97ff2dbf3c21b516961cec0061e134c2a1e9190a250565b610a596111cc565b610a616111f9565b60008111610a815760405162461bcd60e51b815260040161054a906115c6565b610ab66001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163330846112d2565b8060066000828254610ac89190611616565b909155505060405181815233907fb8b27d0db504fa5d914f1fd330347096e88d5ff94b6c612d32797e7c12a8f66f906020015b60405180910390a261098160018055565b610b146111cc565b610b1c6111f9565b600654811115610b6e5760405162461bcd60e51b815260206004820152601a60248201527f416d6f756e7420657863656564732072657761726420706f6f6c000000000000604482015260640161054a565b8060066000828254610b8091906115fd565b9091555050600054610bc7906001600160a01b03165b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169083611223565b6000546001600160a01b03166001600160a01b03167f8a43c4352486ec339f487f64af78ca5cbf06cd47833f073d3baf3a193e50316182604051610afb91815260200190565b610c156111f9565b3360009081526004602052604090205460ff16610c745760405162461bcd60e51b815260206004820152601a60248201527f41646472657373206973206e6f742077686974656c6973746564000000000000604482015260640161054a565b60008111610c945760405162461bcd60e51b815260040161054a906115c6565b336000908152600360205260409020805415610d7d576000610cb533610f15565b90508015610d71578060065410610cd557610cd03382611311565b610d71565b6006548015610d60578060066000828254610cf091906115fd565b90915550610d2a90506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163383611223565b60405181815233907f106f923f993c2149d49b4255ff723acafa1f2d94393f561d3eda32ae348f72419060200160405180910390a25b610d6a81836115fd565b6003840155505b50426002820155610d8b565b426001820181905560028201555b610dc06001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163330856112d2565b81816000016000828254610dd49190611616565b925050819055508160056000828254610ded9190611616565b909155505060405182815233907f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d9060200160405180910390a25061098160018055565b610e396111f9565b6000610e4433610f15565b905060008111610e8b5760405162461bcd60e51b81526020600482015260126024820152714e6f2072657761726420746f20636c61696d60701b604482015260640161054a565b610e953382611311565b5061099660018055565b610eca6040518060800160405280600081526020016000815260200160008152602001600081525090565b506001600160a01b0316600090815260036020818152604092839020835160808101855281548152600182015492810192909252600281015493820193909352910154606082015290565b6001600160a01b0381166000908152600360208181526040808420815160808101835281548082526001830154948201949094526002820154928101929092529092015460608301528203610f6e576060015192915050565b6000816040015142610f8091906115fd565b905060008115610fc057610f996301e133806064611629565b60025484518491610fa991611629565b610fb39190611629565b610fbd9190611640565b90505b6060830151610fcf9082611616565b95945050505050565b610fe06111cc565b6040516370a0823160e01b81523060048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa158015611047573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061106b9190611662565b600060068190556005559050610981610b966000546001600160a01b031690565b6110946111cc565b6001600160a01b0381166110dc5760405162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206164647265737360881b604482015260640161054a565b6001600160a01b03811660009081526004602052604090205460ff16156111455760405162461bcd60e51b815260206004820152601b60248201527f4164647265737320616c72656164792077686974656c69737465640000000000604482015260640161054a565b6001600160a01b038116600081815260046020526040808220805460ff19166001179055517f4790a4adb426ca2345bb5108f6e454eae852a7bf687544cd66a7270dff3a41d69190a250565b6111996111cc565b6001600160a01b0381166111c357604051631e4fbdf760e01b81526000600482015260240161054a565b61098181611282565b6000546001600160a01b031633146109965760405163118cdaa760e01b815233600482015260240161054a565b60026001540361121c57604051633ee5aeb560e01b815260040160405180910390fd5b6002600155565b6040516001600160a01b038381166024830152604482018390526104f191859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180516001600160e01b038381831617835250505050611452565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6040516001600160a01b03848116602483015283811660448301526064820183905261130b9186918216906323b872dd90608401611250565b50505050565b8060065410156113635760405162461bcd60e51b815260206004820152601860248201527f496e73756666696369656e742072657761726420706f6f6c0000000000000000604482015260640161054a565b6001600160a01b03821660009081526003602081905260408220426002820155908101829055600680549192849261139c9084906115fd565b909155506113d690506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168484611223565b826001600160a01b03167f106f923f993c2149d49b4255ff723acafa1f2d94393f561d3eda32ae348f72418360405161141191815260200190565b60405180910390a280546000036104f15750506001600160a01b03166000908152600360208190526040822082815560018101839055600281018390550155565b600080602060008451602086016000885af180611475576040513d6000823e3d81fd5b50506000513d9150811561148d57806001141561149a565b6001600160a01b0384163b155b1561130b57604051635274afe760e01b81526001600160a01b038516600482015260240161054a565b600080602083850312156114d657600080fd5b823567ffffffffffffffff808211156114ee57600080fd5b818501915085601f83011261150257600080fd5b81358181111561151157600080fd5b8660208260051b850101111561152657600080fd5b60209290920196919550909350505050565b60006020828403121561154a57600080fd5b81356001600160a01b038116811461156157600080fd5b9392505050565b60006020828403121561157a57600080fd5b5035919050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600182016115bf576115bf611597565b5060010190565b6020808252601d908201527f416d6f756e74206d7573742062652067726561746572207468616e2030000000604082015260600190565b8181038181111561161057611610611597565b92915050565b8082018082111561161057611610611597565b808202811582820484141761161057611610611597565b60008261165d57634e487b7160e01b600052601260045260246000fd5b500490565b60006020828403121561167457600080fd5b505191905056fea26469706673582212205afef0e8cdff802c5431d4e1e3a6b4ce601cc3ecd4a35c57251115d9c72bef1c64736f6c6343000814003300000000000000000000000068749665ff8d2d112fa859aa293f07a622782f38
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106101735760003560e01c80638ab1d681116100de578063b88a802f11610097578063db2e21bc11610071578063db2e21bc14610394578063e43252d71461039c578063e6a69ab8146103af578063f2fde38b146103ba57600080fd5b8063b88a802f14610333578063c34531531461033b578063d82e39621461038157600080fd5b80638ab1d681146102a35780638bdf67f2146102b65780638da5cb5b146102c95780639342c8f4146102da5780639b19251a146102ed578063a694fc3a1461032057600080fd5b80633d6aa5e1116101305780633d6aa5e1146102395780633d92f4e21461024257806366666aa91461024a578063715018a61461025357806372f702f31461025b578063817b1cd21461029a57600080fd5b8063045fb8881461017857806316934fc41461018d57806324f45e67146101e95780632db6fa36146101fc5780632e17de781461020f5780633bcfc4b814610222575b600080fd5b61018b6101863660046114c3565b6103cd565b005b6101c461019b366004611538565b600360208190526000918252604090912080546001820154600283015492909301549092919084565b6040805194855260208501939093529183015260608201526080015b60405180910390f35b61018b6101f7366004611568565b6104f6565b61018b61020a3660046114c3565b6105df565b61018b61021d366004611568565b610740565b61022b60025481565b6040519081526020016101e0565b61022b61271081565b61022b60f081565b61022b60065481565b61018b610984565b6102827f00000000000000000000000068749665ff8d2d112fa859aa293f07a622782f3881565b6040516001600160a01b0390911681526020016101e0565b61022b60055481565b61018b6102b1366004611538565b610998565b61018b6102c4366004611568565b610a51565b6000546001600160a01b0316610282565b61018b6102e8366004611568565b610b0c565b6103106102fb366004611538565b60046020526000908152604090205460ff1681565b60405190151581526020016101e0565b61018b61032e366004611568565b610c0d565b61018b610e31565b61034e610349366004611538565b610e9f565b6040516101e091908151815260208083015190820152604080830151908201526060918201519181019190915260800190565b61022b61038f366004611538565b610f15565b61018b610fd8565b61018b6103aa366004611538565b61108c565b61022b6301e1338081565b61018b6103c8366004611538565b611191565b6103d56111cc565b60005b818110156104f157600460008484848181106103f6576103f6611581565b905060200201602081019061040b9190611538565b6001600160a01b0316815260208101919091526040016000205460ff16156104df5760006004600085858581811061044557610445611581565b905060200201602081019061045a9190611538565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905582828281811061049457610494611581565b90506020020160208101906104a99190611538565b6001600160a01b03167fde8cf212af7ce38b2840785a2768d97ff2dbf3c21b516961cec0061e134c2a1e60405160405180910390a25b806104e9816115ad565b9150506103d8565b505050565b6104fe6111cc565b600081116105535760405162461bcd60e51b815260206004820152601a60248201527f415059206d7573742062652067726561746572207468616e203000000000000060448201526064015b60405180910390fd5b60f081111561059a5760405162461bcd60e51b81526020600482015260136024820152724150592065786365656473206d6178696d756d60681b604482015260640161054a565b600280549082905560408051828152602081018490527f787a1fca55641ce34a438271930bbb9401df20db2b4f510d4f252227d85df43d910160405180910390a15050565b6105e76111cc565b60005b818110156104f157600083838381811061060657610606611581565b905060200201602081019061061b9190611538565b6001600160a01b03161415801561067757506004600084848481811061064357610643611581565b90506020020160208101906106589190611538565b6001600160a01b0316815260208101919091526040016000205460ff16155b1561072e5760016004600085858581811061069457610694611581565b90506020020160208101906106a99190611538565b6001600160a01b031681526020810191909152604001600020805460ff19169115159190911790558282828181106106e3576106e3611581565b90506020020160208101906106f89190611538565b6001600160a01b03167f4790a4adb426ca2345bb5108f6e454eae852a7bf687544cd66a7270dff3a41d660405160405180910390a25b80610738816115ad565b9150506105ea565b6107486111f9565b33600090815260036020526040902080548211156107a85760405162461bcd60e51b815260206004820152601a60248201527f496e73756666696369656e74207374616b656420616d6f756e74000000000000604482015260640161054a565b600082116107c85760405162461bcd60e51b815260040161054a906115c6565b60006107d333610f15565b9050801561089557600060065482116107ec57816107f0565b6006545b905060006107fe82846115fd565b9050811561088857816006600082825461081891906115fd565b9091555061085290506001600160a01b037f00000000000000000000000068749665ff8d2d112fa859aa293f07a622782f38163384611223565b60405182815233907f106f923f993c2149d49b4255ff723acafa1f2d94393f561d3eda32ae348f72419060200160405180910390a25b6003840155504260028301555b828260000160008282546108a991906115fd565b9250508190555082600560008282546108c291906115fd565b90915550508154600003610906578160030154600003610901573360009081526003602081905260408220828155600181018390556002810183905501555b61090d565b4260028301555b6109416001600160a01b037f00000000000000000000000068749665ff8d2d112fa859aa293f07a622782f38163385611223565b60405183815233907f0f5bb82176feb1b5e747e28471aa92156a04d9f3ab9f45f28e2d704232b93f759060200160405180910390a2505061098160018055565b50565b61098c6111cc565b6109966000611282565b565b6109a06111cc565b6001600160a01b03811660009081526004602052604090205460ff16610a085760405162461bcd60e51b815260206004820152601760248201527f41646472657373206e6f742077686974656c6973746564000000000000000000604482015260640161054a565b6001600160a01b038116600081815260046020526040808220805460ff19169055517fde8cf212af7ce38b2840785a2768d97ff2dbf3c21b516961cec0061e134c2a1e9190a250565b610a596111cc565b610a616111f9565b60008111610a815760405162461bcd60e51b815260040161054a906115c6565b610ab66001600160a01b037f00000000000000000000000068749665ff8d2d112fa859aa293f07a622782f38163330846112d2565b8060066000828254610ac89190611616565b909155505060405181815233907fb8b27d0db504fa5d914f1fd330347096e88d5ff94b6c612d32797e7c12a8f66f906020015b60405180910390a261098160018055565b610b146111cc565b610b1c6111f9565b600654811115610b6e5760405162461bcd60e51b815260206004820152601a60248201527f416d6f756e7420657863656564732072657761726420706f6f6c000000000000604482015260640161054a565b8060066000828254610b8091906115fd565b9091555050600054610bc7906001600160a01b03165b6001600160a01b037f00000000000000000000000068749665ff8d2d112fa859aa293f07a622782f38169083611223565b6000546001600160a01b03166001600160a01b03167f8a43c4352486ec339f487f64af78ca5cbf06cd47833f073d3baf3a193e50316182604051610afb91815260200190565b610c156111f9565b3360009081526004602052604090205460ff16610c745760405162461bcd60e51b815260206004820152601a60248201527f41646472657373206973206e6f742077686974656c6973746564000000000000604482015260640161054a565b60008111610c945760405162461bcd60e51b815260040161054a906115c6565b336000908152600360205260409020805415610d7d576000610cb533610f15565b90508015610d71578060065410610cd557610cd03382611311565b610d71565b6006548015610d60578060066000828254610cf091906115fd565b90915550610d2a90506001600160a01b037f00000000000000000000000068749665ff8d2d112fa859aa293f07a622782f38163383611223565b60405181815233907f106f923f993c2149d49b4255ff723acafa1f2d94393f561d3eda32ae348f72419060200160405180910390a25b610d6a81836115fd565b6003840155505b50426002820155610d8b565b426001820181905560028201555b610dc06001600160a01b037f00000000000000000000000068749665ff8d2d112fa859aa293f07a622782f38163330856112d2565b81816000016000828254610dd49190611616565b925050819055508160056000828254610ded9190611616565b909155505060405182815233907f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d9060200160405180910390a25061098160018055565b610e396111f9565b6000610e4433610f15565b905060008111610e8b5760405162461bcd60e51b81526020600482015260126024820152714e6f2072657761726420746f20636c61696d60701b604482015260640161054a565b610e953382611311565b5061099660018055565b610eca6040518060800160405280600081526020016000815260200160008152602001600081525090565b506001600160a01b0316600090815260036020818152604092839020835160808101855281548152600182015492810192909252600281015493820193909352910154606082015290565b6001600160a01b0381166000908152600360208181526040808420815160808101835281548082526001830154948201949094526002820154928101929092529092015460608301528203610f6e576060015192915050565b6000816040015142610f8091906115fd565b905060008115610fc057610f996301e133806064611629565b60025484518491610fa991611629565b610fb39190611629565b610fbd9190611640565b90505b6060830151610fcf9082611616565b95945050505050565b610fe06111cc565b6040516370a0823160e01b81523060048201526000907f00000000000000000000000068749665ff8d2d112fa859aa293f07a622782f386001600160a01b0316906370a0823190602401602060405180830381865afa158015611047573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061106b9190611662565b600060068190556005559050610981610b966000546001600160a01b031690565b6110946111cc565b6001600160a01b0381166110dc5760405162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206164647265737360881b604482015260640161054a565b6001600160a01b03811660009081526004602052604090205460ff16156111455760405162461bcd60e51b815260206004820152601b60248201527f4164647265737320616c72656164792077686974656c69737465640000000000604482015260640161054a565b6001600160a01b038116600081815260046020526040808220805460ff19166001179055517f4790a4adb426ca2345bb5108f6e454eae852a7bf687544cd66a7270dff3a41d69190a250565b6111996111cc565b6001600160a01b0381166111c357604051631e4fbdf760e01b81526000600482015260240161054a565b61098181611282565b6000546001600160a01b031633146109965760405163118cdaa760e01b815233600482015260240161054a565b60026001540361121c57604051633ee5aeb560e01b815260040160405180910390fd5b6002600155565b6040516001600160a01b038381166024830152604482018390526104f191859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180516001600160e01b038381831617835250505050611452565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6040516001600160a01b03848116602483015283811660448301526064820183905261130b9186918216906323b872dd90608401611250565b50505050565b8060065410156113635760405162461bcd60e51b815260206004820152601860248201527f496e73756666696369656e742072657761726420706f6f6c0000000000000000604482015260640161054a565b6001600160a01b03821660009081526003602081905260408220426002820155908101829055600680549192849261139c9084906115fd565b909155506113d690506001600160a01b037f00000000000000000000000068749665ff8d2d112fa859aa293f07a622782f38168484611223565b826001600160a01b03167f106f923f993c2149d49b4255ff723acafa1f2d94393f561d3eda32ae348f72418360405161141191815260200190565b60405180910390a280546000036104f15750506001600160a01b03166000908152600360208190526040822082815560018101839055600281018390550155565b600080602060008451602086016000885af180611475576040513d6000823e3d81fd5b50506000513d9150811561148d57806001141561149a565b6001600160a01b0384163b155b1561130b57604051635274afe760e01b81526001600160a01b038516600482015260240161054a565b600080602083850312156114d657600080fd5b823567ffffffffffffffff808211156114ee57600080fd5b818501915085601f83011261150257600080fd5b81358181111561151157600080fd5b8660208260051b850101111561152657600080fd5b60209290920196919550909350505050565b60006020828403121561154a57600080fd5b81356001600160a01b038116811461156157600080fd5b9392505050565b60006020828403121561157a57600080fd5b5035919050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600182016115bf576115bf611597565b5060010190565b6020808252601d908201527f416d6f756e74206d7573742062652067726561746572207468616e2030000000604082015260600190565b8181038181111561161057611610611597565b92915050565b8082018082111561161057611610611597565b808202811582820484141761161057611610611597565b60008261165d57634e487b7160e01b600052601260045260246000fd5b500490565b60006020828403121561167457600080fd5b505191905056fea26469706673582212205afef0e8cdff802c5431d4e1e3a6b4ce601cc3ecd4a35c57251115d9c72bef1c64736f6c63430008140033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000068749665ff8d2d112fa859aa293f07a622782f38
-----Decoded View---------------
Arg [0] : _stakingToken (address): 0x68749665FF8D2d112Fa859AA293F07A622782F38
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 00000000000000000000000068749665ff8d2d112fa859aa293f07a622782f38
Loading...
Loading
Loading...
Loading
Net Worth in USD
$12.49
Net Worth in ETH
0.006005
Token Allocations
XAUT
100.00%
Multichain Portfolio | 34 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|---|---|---|---|---|
| ETH | 100.00% | $5,002.61 | 0.002496 | $12.49 |
Loading...
Loading
Loading...
Loading
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.