More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 39 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Stake | 1142635 | 8 hrs ago | IN | 1 S | 0.00040752 | ||||
Stake | 1096435 | 16 hrs ago | IN | 1 S | 0.00026234 | ||||
Stake | 1094795 | 16 hrs ago | IN | 1 S | 0.00034886 | ||||
Stake | 1089433 | 17 hrs ago | IN | 1 S | 0.01204888 | ||||
Stake | 1089094 | 17 hrs ago | IN | 1 S | 0.00087413 | ||||
Stake | 1088956 | 17 hrs ago | IN | 1 S | 0.00298312 | ||||
Stake | 1088794 | 17 hrs ago | IN | 1 S | 0.01495962 | ||||
Stake | 1088596 | 17 hrs ago | IN | 1 S | 0.02365763 | ||||
Harvest | 1087700 | 17 hrs ago | IN | 1 S | 0.00058498 | ||||
Harvest | 1087081 | 17 hrs ago | IN | 1 S | 0.000567 | ||||
Stake | 1085313 | 18 hrs ago | IN | 1 S | 0.00151114 | ||||
Harvest | 1085137 | 18 hrs ago | IN | 1 S | 0.00058205 | ||||
Unstake | 1084258 | 18 hrs ago | IN | 1 S | 0.00504824 | ||||
Stake | 1084087 | 18 hrs ago | IN | 1 S | 0.00437004 | ||||
Stake | 1083437 | 18 hrs ago | IN | 1 S | 0.00043731 | ||||
Stake | 1082681 | 18 hrs ago | IN | 1 S | 0.00181125 | ||||
Harvest | 1082415 | 18 hrs ago | IN | 1 S | 0.00028289 | ||||
Harvest | 1081899 | 18 hrs ago | IN | 1 S | 0.00058496 | ||||
Stake | 1081781 | 18 hrs ago | IN | 1 S | 0.01012672 | ||||
Stake | 1081671 | 18 hrs ago | IN | 1 S | 0.00161526 | ||||
Stake | 1081581 | 18 hrs ago | IN | 1 S | 0.00071185 | ||||
Stake | 1081511 | 18 hrs ago | IN | 1 S | 0.00170513 | ||||
Stake | 1081426 | 18 hrs ago | IN | 1 S | 0.001734 | ||||
Harvest | 1081424 | 18 hrs ago | IN | 1 S | 0.00061671 | ||||
Stake | 1081296 | 18 hrs ago | IN | 1 S | 0.00167629 |
Latest 25 internal transactions (View All)
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
1142635 | 8 hrs ago | 1 S | ||||
1096435 | 16 hrs ago | 1 S | ||||
1094795 | 16 hrs ago | 1 S | ||||
1089433 | 17 hrs ago | 1 S | ||||
1089094 | 17 hrs ago | 1 S | ||||
1088956 | 17 hrs ago | 1 S | ||||
1088794 | 17 hrs ago | 1 S | ||||
1088596 | 17 hrs ago | 3 S | ||||
1085313 | 18 hrs ago | 2 S | ||||
1084258 | 18 hrs ago | 1 S | ||||
1084087 | 18 hrs ago | 1 S | ||||
1083437 | 18 hrs ago | 1 S | ||||
1082681 | 18 hrs ago | 3 S | ||||
1081781 | 18 hrs ago | 1 S | ||||
1081671 | 18 hrs ago | 1 S | ||||
1081581 | 18 hrs ago | 1 S | ||||
1081511 | 18 hrs ago | 1 S | ||||
1081426 | 18 hrs ago | 2 S | ||||
1081296 | 18 hrs ago | 1 S | ||||
1081277 | 18 hrs ago | 1 S | ||||
1081250 | 18 hrs ago | 1 S | ||||
1081215 | 18 hrs ago | 1 S | ||||
1081182 | 18 hrs ago | 1 S | ||||
1081095 | 18 hrs ago | 1 S | ||||
1080969 | 18 hrs ago | 1 S |
Loading...
Loading
Similar Match Source Code This contract matches the deployed Bytecode of the Source Code for Contract 0xff9c5178...eD575A2e9 The constructor portion of the code might be different and could alter the actual behaviour of the contract
Contract Name:
MoonBoxStaking
Compiler Version
v0.8.28+commit.7893614a
Optimization Enabled:
Yes with 1000 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT // https://t.me/moonboxsonic pragma solidity >= 0.8.20; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {Ownable} from "solady/src/auth/Ownable.sol"; import './IDyorRouter02.sol'; contract MoonBoxStaking is Ownable { address public MoonBox; address public WETH; IDyorRouter02 public router; uint256 public fee = 1 * 10**18; uint256 public rewardPerShare; uint256 public precisionFactor; uint256 public MoonBoxStaked; uint256 public totalDistributed; struct StakingInfo{ uint256 stakedAmount; uint256 pendingReward; uint256 claimedReward; uint256 totalClaimed; } mapping(address => StakingInfo) public mapStakingInfo; event Stake(address staker, uint256 amount); event Unstake(address staker, uint256 amount); event Harvest(address staker, uint256 amount); event PoolUpdated(uint256 amount); constructor(address _moonBox) { router = IDyorRouter02(0x591cf6942c422fA53E8D81c62a9692D7BeA72F61); MoonBox = address(_moonBox); WETH = router.WETH(); _initializeOwner(msg.sender); precisionFactor = 1 * 10**18; } receive() external payable {} function stake(uint256 amount) payable external { require(IERC20(MoonBox).balanceOf(msg.sender) >= amount, "Balance not available for staking"); require(msg.value >= fee, "Insufficient SONIC for staking"); if(mapStakingInfo[address(msg.sender)].stakedAmount > 0) { uint256 pending = pendingReward(address(msg.sender)); if(pending > 0) { mapStakingInfo[address(msg.sender)].pendingReward = pending; } } IERC20(MoonBox).transferFrom(address(msg.sender), address(this), amount); MoonBoxStaked += amount; mapStakingInfo[address(msg.sender)].stakedAmount += amount; mapStakingInfo[address(msg.sender)].claimedReward = mapStakingInfo[address(msg.sender)].stakedAmount * rewardPerShare / precisionFactor; emit Stake(address(msg.sender), amount); if(address(this).balance > 0) { payable(owner()).transfer(address(this).balance); } } function unstake(uint256 amount) payable external { require(mapStakingInfo[address(msg.sender)].stakedAmount >= amount, "amount is greater than available"); require(msg.value >= fee, "Insufficient SONIC for unstaking"); if(mapStakingInfo[address(msg.sender)].stakedAmount > amount) { uint256 pending = pendingReward(address(msg.sender)); if(pending > 0) { mapStakingInfo[address(msg.sender)].pendingReward = pending; } IERC20(MoonBox).transfer(address(msg.sender), amount); MoonBoxStaked -= amount; mapStakingInfo[address(msg.sender)].stakedAmount -= amount; mapStakingInfo[address(msg.sender)].claimedReward = mapStakingInfo[address(msg.sender)].stakedAmount * rewardPerShare / precisionFactor; emit Unstake(msg.sender, amount); } else { uint256 pending = pendingReward(address(msg.sender)); if(pending > 0) { _swapTokenWETHPair(pending, address(msg.sender)); } IERC20(MoonBox).transfer(address(msg.sender), amount); MoonBoxStaked -= amount; mapStakingInfo[address(msg.sender)].stakedAmount = 0; mapStakingInfo[address(msg.sender)].claimedReward = 0; mapStakingInfo[address(msg.sender)].pendingReward = 0; mapStakingInfo[address(msg.sender)].totalClaimed += pending; emit Unstake(msg.sender, amount); } if(address(this).balance > 0) { payable(owner()).transfer(address(this).balance); } } function harvest(uint256 amount) payable external { require(msg.value >= fee, "Insufficient SONIC for harvesting"); if(mapStakingInfo[address(msg.sender)].stakedAmount > 0) { uint256 pending = pendingReward(address(msg.sender)); if(pending > amount) { _swapTokenWETHPair(amount, address(msg.sender)); mapStakingInfo[address(msg.sender)].claimedReward += amount; mapStakingInfo[address(msg.sender)].totalClaimed += amount; emit Harvest(msg.sender, amount); } else { _swapTokenWETHPair(pending, address(msg.sender)); mapStakingInfo[address(msg.sender)].claimedReward += pending; mapStakingInfo[address(msg.sender)].totalClaimed += pending; emit Harvest(msg.sender, pending); } } } function pendingReward(address staker) public view returns (uint256) { if(mapStakingInfo[address(staker)].stakedAmount > 0) { uint256 pending = (((mapStakingInfo[address(staker)].stakedAmount * rewardPerShare) / precisionFactor) + mapStakingInfo[address(staker)].pendingReward) - (mapStakingInfo[address(staker)].claimedReward); return pending; } else { return 0; } } function setFee(uint256 _fee) external onlyOwner { fee = _fee; } function updatePool(uint256 amount) external { require(address(msg.sender) == address(MoonBox), "Incorrect request"); if(MoonBoxStaked > 0) { rewardPerShare = rewardPerShare + (amount * precisionFactor / MoonBoxStaked); } else { IERC20(MoonBox).transfer(address(owner()), amount); } totalDistributed += amount; emit PoolUpdated(amount); } function _swapTokenWETHPair(uint256 amount, address receiver) private { address[] memory path = new address[](2); path[0] = address(MoonBox); path[1] = address(WETH); IERC20(MoonBox).approve(address(router), amount); router.swapExactTokensForETHSupportingFeeOnTransferTokens( amount, 0, path, address(receiver), block.timestamp ); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC-20 standard as defined in the ERC. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the value of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the value of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves a `value` amount of tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 value) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets a `value` amount of tokens as the allowance of `spender` over the * caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 value) external returns (bool); /** * @dev Moves a `value` amount of tokens from `from` to `to` using the * allowance mechanism. `value` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 value) external returns (bool); }
// SPDX-License-Identifier: UNKNOWN pragma solidity >=0.6.2; interface IDyorRouter01 { function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidity( address tokenA, address tokenB, uint256 amountADesired, uint256 amountBDesired, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline ) external returns ( uint256 amountA, uint256 amountB, uint256 liquidity ); function addLiquidityETH( address token, uint256 amountTokenDesired, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline ) external payable returns ( uint256 amountToken, uint256 amountETH, uint256 liquidity ); function removeLiquidity( address tokenA, address tokenB, uint256 liquidity, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline ) external returns (uint256 amountA, uint256 amountB); function removeLiquidityETH( address token, uint256 liquidity, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline ) external returns (uint256 amountToken, uint256 amountETH); function removeLiquidityWithPermit( address tokenA, address tokenB, uint256 liquidity, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint256 amountA, uint256 amountB); function removeLiquidityETHWithPermit( address token, uint256 liquidity, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint256 amountToken, uint256 amountETH); function swapExactTokensForTokens( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external returns (uint256[] memory amounts); function swapTokensForExactTokens( uint256 amountOut, uint256 amountInMax, address[] calldata path, address to, uint256 deadline ) external returns (uint256[] memory amounts); function swapExactETHForTokens( uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external payable returns (uint256[] memory amounts); function swapTokensForExactETH( uint256 amountOut, uint256 amountInMax, address[] calldata path, address to, uint256 deadline ) external returns (uint256[] memory amounts); function swapExactTokensForETH( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external returns (uint256[] memory amounts); function swapETHForExactTokens( uint256 amountOut, address[] calldata path, address to, uint256 deadline ) external payable returns (uint256[] memory amounts); function quote( uint256 amountA, uint256 reserveA, uint256 reserveB ) external pure returns (uint256 amountB); function getAmountOut( uint256 amountIn, uint256 reserveIn, uint256 reserveOut ) external pure returns (uint256 amountOut); function getAmountIn( uint256 amountOut, uint256 reserveIn, uint256 reserveOut ) external pure returns (uint256 amountIn); function getAmountsOut(uint256 amountIn, address[] calldata path) external view returns (uint256[] memory amounts); function getAmountsIn(uint256 amountOut, address[] calldata path) external view returns (uint256[] memory amounts); }
// SPDX-License-Identifier: UNKNOWN pragma solidity >=0.6.2; import './IDyorRouter01.sol'; interface IDyorRouter02 is IDyorRouter01 { function removeLiquidityETHSupportingFeeOnTransferTokens( address token, uint256 liquidity, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline ) external returns (uint256 amountETH); function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens( address token, uint256 liquidity, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint256 amountETH); function swapExactTokensForTokensSupportingFeeOnTransferTokens( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external; function swapExactETHForTokensSupportingFeeOnTransferTokens( uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external payable; function swapExactTokensForETHSupportingFeeOnTransferTokens( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; /// @notice Simple single owner authorization mixin. /// @author Solady (https://github.com/vectorized/solady/blob/main/src/auth/Ownable.sol) /// /// @dev Note: /// This implementation does NOT auto-initialize the owner to `msg.sender`. /// You MUST call the `_initializeOwner` in the constructor / initializer. /// /// While the ownable portion follows /// [EIP-173](https://eips.ethereum.org/EIPS/eip-173) for compatibility, /// the nomenclature for the 2-step ownership handover may be unique to this codebase. abstract contract Ownable { /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* CUSTOM ERRORS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The caller is not authorized to call the function. error Unauthorized(); /// @dev The `newOwner` cannot be the zero address. error NewOwnerIsZeroAddress(); /// @dev The `pendingOwner` does not have a valid handover request. error NoHandoverRequest(); /// @dev Cannot double-initialize. error AlreadyInitialized(); /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* EVENTS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The ownership is transferred from `oldOwner` to `newOwner`. /// This event is intentionally kept the same as OpenZeppelin's Ownable to be /// compatible with indexers and [EIP-173](https://eips.ethereum.org/EIPS/eip-173), /// despite it not being as lightweight as a single argument event. event OwnershipTransferred(address indexed oldOwner, address indexed newOwner); /// @dev An ownership handover to `pendingOwner` has been requested. event OwnershipHandoverRequested(address indexed pendingOwner); /// @dev The ownership handover to `pendingOwner` has been canceled. event OwnershipHandoverCanceled(address indexed pendingOwner); /// @dev `keccak256(bytes("OwnershipTransferred(address,address)"))`. uint256 private constant _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE = 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0; /// @dev `keccak256(bytes("OwnershipHandoverRequested(address)"))`. uint256 private constant _OWNERSHIP_HANDOVER_REQUESTED_EVENT_SIGNATURE = 0xdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d; /// @dev `keccak256(bytes("OwnershipHandoverCanceled(address)"))`. uint256 private constant _OWNERSHIP_HANDOVER_CANCELED_EVENT_SIGNATURE = 0xfa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* STORAGE */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The owner slot is given by: /// `bytes32(~uint256(uint32(bytes4(keccak256("_OWNER_SLOT_NOT")))))`. /// It is intentionally chosen to be a high value /// to avoid collision with lower slots. /// The choice of manual storage layout is to enable compatibility /// with both regular and upgradeable contracts. bytes32 internal constant _OWNER_SLOT = 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffff74873927; /// The ownership handover slot of `newOwner` is given by: /// ``` /// mstore(0x00, or(shl(96, user), _HANDOVER_SLOT_SEED)) /// let handoverSlot := keccak256(0x00, 0x20) /// ``` /// It stores the expiry timestamp of the two-step ownership handover. uint256 private constant _HANDOVER_SLOT_SEED = 0x389a75e1; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* INTERNAL FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Override to return true to make `_initializeOwner` prevent double-initialization. function _guardInitializeOwner() internal pure virtual returns (bool guard) {} /// @dev Initializes the owner directly without authorization guard. /// This function must be called upon initialization, /// regardless of whether the contract is upgradeable or not. /// This is to enable generalization to both regular and upgradeable contracts, /// and to save gas in case the initial owner is not the caller. /// For performance reasons, this function will not check if there /// is an existing owner. function _initializeOwner(address newOwner) internal virtual { if (_guardInitializeOwner()) { /// @solidity memory-safe-assembly assembly { let ownerSlot := _OWNER_SLOT if sload(ownerSlot) { mstore(0x00, 0x0dc149f0) // `AlreadyInitialized()`. revert(0x1c, 0x04) } // Clean the upper 96 bits. newOwner := shr(96, shl(96, newOwner)) // Store the new value. sstore(ownerSlot, or(newOwner, shl(255, iszero(newOwner)))) // Emit the {OwnershipTransferred} event. log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, 0, newOwner) } } else { /// @solidity memory-safe-assembly assembly { // Clean the upper 96 bits. newOwner := shr(96, shl(96, newOwner)) // Store the new value. sstore(_OWNER_SLOT, newOwner) // Emit the {OwnershipTransferred} event. log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, 0, newOwner) } } } /// @dev Sets the owner directly without authorization guard. function _setOwner(address newOwner) internal virtual { if (_guardInitializeOwner()) { /// @solidity memory-safe-assembly assembly { let ownerSlot := _OWNER_SLOT // Clean the upper 96 bits. newOwner := shr(96, shl(96, newOwner)) // Emit the {OwnershipTransferred} event. log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, sload(ownerSlot), newOwner) // Store the new value. sstore(ownerSlot, or(newOwner, shl(255, iszero(newOwner)))) } } else { /// @solidity memory-safe-assembly assembly { let ownerSlot := _OWNER_SLOT // Clean the upper 96 bits. newOwner := shr(96, shl(96, newOwner)) // Emit the {OwnershipTransferred} event. log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, sload(ownerSlot), newOwner) // Store the new value. sstore(ownerSlot, newOwner) } } } /// @dev Throws if the sender is not the owner. function _checkOwner() internal view virtual { /// @solidity memory-safe-assembly assembly { // If the caller is not the stored owner, revert. if iszero(eq(caller(), sload(_OWNER_SLOT))) { mstore(0x00, 0x82b42900) // `Unauthorized()`. revert(0x1c, 0x04) } } } /// @dev Returns how long a two-step ownership handover is valid for in seconds. /// Override to return a different value if needed. /// Made internal to conserve bytecode. Wrap it in a public function if needed. function _ownershipHandoverValidFor() internal view virtual returns (uint64) { return 48 * 3600; } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* PUBLIC UPDATE FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Allows the owner to transfer the ownership to `newOwner`. function transferOwnership(address newOwner) public payable virtual onlyOwner { /// @solidity memory-safe-assembly assembly { if iszero(shl(96, newOwner)) { mstore(0x00, 0x7448fbae) // `NewOwnerIsZeroAddress()`. revert(0x1c, 0x04) } } _setOwner(newOwner); } /// @dev Allows the owner to renounce their ownership. function renounceOwnership() public payable virtual onlyOwner { _setOwner(address(0)); } /// @dev Request a two-step ownership handover to the caller. /// The request will automatically expire in 48 hours (172800 seconds) by default. function requestOwnershipHandover() public payable virtual { unchecked { uint256 expires = block.timestamp + _ownershipHandoverValidFor(); /// @solidity memory-safe-assembly assembly { // Compute and set the handover slot to `expires`. mstore(0x0c, _HANDOVER_SLOT_SEED) mstore(0x00, caller()) sstore(keccak256(0x0c, 0x20), expires) // Emit the {OwnershipHandoverRequested} event. log2(0, 0, _OWNERSHIP_HANDOVER_REQUESTED_EVENT_SIGNATURE, caller()) } } } /// @dev Cancels the two-step ownership handover to the caller, if any. function cancelOwnershipHandover() public payable virtual { /// @solidity memory-safe-assembly assembly { // Compute and set the handover slot to 0. mstore(0x0c, _HANDOVER_SLOT_SEED) mstore(0x00, caller()) sstore(keccak256(0x0c, 0x20), 0) // Emit the {OwnershipHandoverCanceled} event. log2(0, 0, _OWNERSHIP_HANDOVER_CANCELED_EVENT_SIGNATURE, caller()) } } /// @dev Allows the owner to complete the two-step ownership handover to `pendingOwner`. /// Reverts if there is no existing ownership handover requested by `pendingOwner`. function completeOwnershipHandover(address pendingOwner) public payable virtual onlyOwner { /// @solidity memory-safe-assembly assembly { // Compute and set the handover slot to 0. mstore(0x0c, _HANDOVER_SLOT_SEED) mstore(0x00, pendingOwner) let handoverSlot := keccak256(0x0c, 0x20) // If the handover does not exist, or has expired. if gt(timestamp(), sload(handoverSlot)) { mstore(0x00, 0x6f5e8818) // `NoHandoverRequest()`. revert(0x1c, 0x04) } // Set the handover slot to 0. sstore(handoverSlot, 0) } _setOwner(pendingOwner); } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* PUBLIC READ FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Returns the owner of the contract. function owner() public view virtual returns (address result) { /// @solidity memory-safe-assembly assembly { result := sload(_OWNER_SLOT) } } /// @dev Returns the expiry timestamp for the two-step ownership handover to `pendingOwner`. function ownershipHandoverExpiresAt(address pendingOwner) public view virtual returns (uint256 result) { /// @solidity memory-safe-assembly assembly { // Compute the handover slot. mstore(0x0c, _HANDOVER_SLOT_SEED) mstore(0x00, pendingOwner) // Load the handover slot. result := sload(keccak256(0x0c, 0x20)) } } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* MODIFIERS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Marks a function as only callable by the owner. modifier onlyOwner() virtual { _checkOwner(); _; } }
{ "optimizer": { "enabled": true, "runs": 1000 }, "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":"address","name":"_moonBox","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AlreadyInitialized","type":"error"},{"inputs":[],"name":"NewOwnerIsZeroAddress","type":"error"},{"inputs":[],"name":"NoHandoverRequest","type":"error"},{"inputs":[],"name":"Unauthorized","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"staker","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Harvest","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"pendingOwner","type":"address"}],"name":"OwnershipHandoverCanceled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"pendingOwner","type":"address"}],"name":"OwnershipHandoverRequested","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"PoolUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"staker","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Stake","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"staker","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Unstake","type":"event"},{"inputs":[],"name":"MoonBox","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MoonBoxStaked","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WETH","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"cancelOwnershipHandover","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"pendingOwner","type":"address"}],"name":"completeOwnershipHandover","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"fee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"harvest","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"mapStakingInfo","outputs":[{"internalType":"uint256","name":"stakedAmount","type":"uint256"},{"internalType":"uint256","name":"pendingReward","type":"uint256"},{"internalType":"uint256","name":"claimedReward","type":"uint256"},{"internalType":"uint256","name":"totalClaimed","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"result","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"pendingOwner","type":"address"}],"name":"ownershipHandoverExpiresAt","outputs":[{"internalType":"uint256","name":"result","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"staker","type":"address"}],"name":"pendingReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"precisionFactor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"requestOwnershipHandover","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"rewardPerShare","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"router","outputs":[{"internalType":"contract IDyorRouter02","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_fee","type":"uint256"}],"name":"setFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"stake","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"totalDistributed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"unstake","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"updatePool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]
Deployed Bytecode
0x6080604052600436106101795760003560e01c8063a694fc3a116100cb578063f04e283e1161007f578063f887ea4011610059578063f887ea401461039c578063fbde58b0146103bc578063fee81cf4146103d257600080fd5b8063f04e283e14610356578063f2fde38b14610369578063f40f0f521461037c57600080fd5b8063ddc63262116100b0578063ddc6326214610317578063ddca3f431461032a578063efca2eed1461034057600080fd5b8063a694fc3a146102e4578063ad5c4648146102f757600080fd5b806369fe0e2d1161012d5780638d38f82f116101075780638d38f82f1461027d5780638da5cb5b146102b55780639d902fc0146102ce57600080fd5b806369fe0e2d146101f35780636ed1e45a14610213578063715018a61461027557600080fd5b8063446a2ec81161015e578063446a2ec8146101a257806351eb05a6146101cb57806354d1f13d146101eb57600080fd5b806325692962146101855780632e17de781461018f57600080fd5b3661018057005b600080fd5b61018d610405565b005b61018d61019d36600461111e565b610455565b3480156101ae57600080fd5b506101b860045481565b6040519081526020015b60405180910390f35b3480156101d757600080fd5b5061018d6101e636600461111e565b6107e4565b61018d61096b565b3480156101ff57600080fd5b5061018d61020e36600461111e565b6109a7565b34801561021f57600080fd5b5061025561022e366004611137565b60086020526000908152604090208054600182015460028301546003909301549192909184565b6040805194855260208501939093529183015260608201526080016101c2565b61018d6109b4565b34801561028957600080fd5b5060005461029d906001600160a01b031681565b6040516001600160a01b0390911681526020016101c2565b3480156102c157600080fd5b50638b78c6d8195461029d565b3480156102da57600080fd5b506101b860055481565b61018d6102f236600461111e565b6109c8565b34801561030357600080fd5b5060015461029d906001600160a01b031681565b61018d61032536600461111e565b610c93565b34801561033657600080fd5b506101b860035481565b34801561034c57600080fd5b506101b860075481565b61018d610364366004611137565b610e44565b61018d610377366004611137565b610e81565b34801561038857600080fd5b506101b8610397366004611137565b610ea8565b3480156103a857600080fd5b5060025461029d906001600160a01b031681565b3480156103c857600080fd5b506101b860065481565b3480156103de57600080fd5b506101b86103ed366004611137565b63389a75e1600c908152600091909152602090205490565b60006202a30067ffffffffffffffff164201905063389a75e1600c5233600052806020600c2055337fdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d600080a250565b336000908152600860205260409020548111156104b95760405162461bcd60e51b815260206004820181905260248201527f616d6f756e742069732067726561746572207468616e20617661696c61626c6560448201526064015b60405180910390fd5b60035434101561050b5760405162461bcd60e51b815260206004820181905260248201527f496e73756666696369656e7420534f4e494320666f7220756e7374616b696e6760448201526064016104b0565b3360009081526008602052604090205481101561067c57600061052d33610ea8565b9050801561054b573360009081526008602052604090206001018190555b60005460405163a9059cbb60e01b8152336004820152602481018490526001600160a01b039091169063a9059cbb906044016020604051808303816000875af115801561059c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105c09190611160565b5081600660008282546105d39190611198565b909155505033600090815260086020526040812080548492906105f7908490611198565b90915550506005546004543360009081526008602052604090205461061c91906111b1565b61062691906111c8565b336000818152600860209081526040918290206002019390935580519182529181018490527f85082129d87b2fe11527cb1b3b7a520aeb5aa6913f88a3d8757fe40d1db02fdd910160405180910390a150610799565b600061068733610ea8565b90508015610699576106998133610f2c565b60005460405163a9059cbb60e01b8152336004820152602481018490526001600160a01b039091169063a9059cbb906044016020604051808303816000875af11580156106ea573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061070e9190611160565b5081600660008282546107219190611198565b9091555050336000908152600860205260408120818155600281018290556001810182905560030180548392906107599084906111ea565b909155505060408051338152602081018490527f85082129d87b2fe11527cb1b3b7a520aeb5aa6913f88a3d8757fe40d1db02fdd910160405180910390a1505b47156107e157638b78c6d819545b6001600160a01b03166108fc479081150290604051600060405180830381858888f193505050501580156107df573d6000803e3d6000fd5b505b50565b6000546001600160a01b0316331461083e5760405162461bcd60e51b815260206004820152601160248201527f496e636f7272656374207265717565737400000000000000000000000000000060448201526064016104b0565b600654156108755760065460055461085690836111b1565b61086091906111c8565b60045461086d91906111ea565b60045561091e565b6000546001600160a01b031663a9059cbb610893638b78c6d8195490565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b1681526001600160a01b039091166004820152602481018490526044016020604051808303816000875af11580156108f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061091c9190611160565b505b806007600082825461093091906111ea565b90915550506040518181527f141d729c29cc848b27c53f7dbe9f9542cedc4ed2efa7bd2aeb2a4bdce06a407f9060200160405180910390a150565b63389a75e1600c523360005260006020600c2055337ffa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92600080a2565b6109af6110c5565b600355565b6109bc6110c5565b6109c660006110e0565b565b6000546040517f70a0823100000000000000000000000000000000000000000000000000000000815233600482015282916001600160a01b0316906370a0823190602401602060405180830381865afa158015610a29573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a4d91906111fd565b1015610aa55760405162461bcd60e51b815260206004820152602160248201527f42616c616e6365206e6f7420617661696c61626c6520666f72207374616b696e6044820152606760f81b60648201526084016104b0565b600354341015610af75760405162461bcd60e51b815260206004820152601e60248201527f496e73756666696369656e7420534f4e494320666f72207374616b696e67000060448201526064016104b0565b3360009081526008602052604090205415610b37576000610b1733610ea8565b90508015610b35573360009081526008602052604090206001018190555b505b6000546040517f23b872dd000000000000000000000000000000000000000000000000000000008152336004820152306024820152604481018390526001600160a01b03909116906323b872dd906064016020604051808303816000875af1158015610ba7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bcb9190611160565b508060066000828254610bde91906111ea565b90915550503360009081526008602052604081208054839290610c029084906111ea565b909155505060055460045433600090815260086020526040902054610c2791906111b1565b610c3191906111c8565b336000818152600860209081526040918290206002019390935580519182529181018390527febedb8b3c678666e7f36970bc8f57abf6d8fa2e828c0da91ea5b75bf68ed101a910160405180910390a147156107e157638b78c6d819546107a7565b600354341015610cef5760405162461bcd60e51b815260206004820152602160248201527f496e73756666696369656e7420534f4e494320666f722068617276657374696e6044820152606760f81b60648201526084016104b0565b33600090815260086020526040902054156107e1576000610d0f33610ea8565b905081811115610daf57610d238233610f2c565b3360009081526008602052604081206002018054849290610d459084906111ea565b90915550503360009081526008602052604081206003018054849290610d6c9084906111ea565b909155505060408051338152602081018490527fc9695243a805adb74c91f28311176c65b417e842d5699893cef56d18bfa48cba910160405180910390a16107df565b610db98133610f2c565b3360009081526008602052604081206002018054839290610ddb9084906111ea565b90915550503360009081526008602052604081206003018054839290610e029084906111ea565b909155505060408051338152602081018390527fc9695243a805adb74c91f28311176c65b417e842d5699893cef56d18bfa48cba910160405180910390a15050565b610e4c6110c5565b63389a75e1600c52806000526020600c208054421115610e7457636f5e88186000526004601cfd5b600090556107e1816110e0565b610e896110c5565b8060601b610e9f57637448fbae6000526004601cfd5b6107e1816110e0565b6001600160a01b03811660009081526008602052604081205415610f24576001600160a01b0382166000908152600860205260408120600281015460018201546005546004549354929391929091610eff916111b1565b610f0991906111c8565b610f1391906111ea565b610f1d9190611198565b9392505050565b506000919050565b60408051600280825260608201835260009260208301908036833750506000805483519394506001600160a01b031692849250610f6b57610f6b611216565b6001600160a01b0392831660209182029290920101526001805483519216918391908110610f9b57610f9b611216565b6001600160a01b0392831660209182029290920101526000546002546040517f095ea7b300000000000000000000000000000000000000000000000000000000815290831660048201526024810186905291169063095ea7b3906044016020604051808303816000875af1158015611017573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061103b9190611160565b506002546040517f791ac9470000000000000000000000000000000000000000000000000000000081526001600160a01b039091169063791ac9479061108e90869060009086908890429060040161122c565b600060405180830381600087803b1580156110a857600080fd5b505af11580156110bc573d6000803e3d6000fd5b50505050505050565b638b78c6d8195433146109c6576382b429006000526004601cfd5b638b78c6d81980546001600160a01b039092169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a355565b60006020828403121561113057600080fd5b5035919050565b60006020828403121561114957600080fd5b81356001600160a01b0381168114610f1d57600080fd5b60006020828403121561117257600080fd5b81518015158114610f1d57600080fd5b634e487b7160e01b600052601160045260246000fd5b818103818111156111ab576111ab611182565b92915050565b80820281158282048414176111ab576111ab611182565b6000826111e557634e487b7160e01b600052601260045260246000fd5b500490565b808201808211156111ab576111ab611182565b60006020828403121561120f57600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b600060a0820187835286602084015260a0604084015280865180835260c08501915060208801925060005b8181101561127e5783516001600160a01b0316835260209384019390920191600101611257565b50506001600160a01b03959095166060840152505060800152939250505056fea264697066735822122091cc415d7f50d3de32a049d9cb31c8920a4370bbc9eccb6f9c8af641ffef38b664736f6c634300081c0033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.