Overview
APE Balance
APE Value
$0.00Multichain Info
Latest 25 from a total of 262 transactions
| Transaction Hash |
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
| Exit | 32580318 | 4 days ago | IN | 0 APE | 0.01491747 | ||||
| Wrap And Stake | 32451009 | 8 days ago | IN | 4,500 APE | 0.01433594 | ||||
| Exit | 32255102 | 13 days ago | IN | 0 APE | 0.01630849 | ||||
| Wrap And Stake | 31897137 | 22 days ago | IN | 12,500 APE | 0.01433594 | ||||
| Exit | 31896833 | 22 days ago | IN | 0 APE | 0.01491747 | ||||
| Wrap And Stake | 31863662 | 23 days ago | IN | 7,490 APE | 0.01433594 | ||||
| Exit | 31823276 | 24 days ago | IN | 0 APE | 0.01630849 | ||||
| Wrap And Stake | 30991268 | 40 days ago | IN | 10,600 APE | 0.01433594 | ||||
| Exit | 30991236 | 40 days ago | IN | 0 APE | 0.01491747 | ||||
| Wrap And Stake | 30973350 | 40 days ago | IN | 8,270 APE | 0.01433594 | ||||
| Exit | 30080062 | 51 days ago | IN | 0 APE | 0.00407737 | ||||
| Wrap And Stake | 29017596 | 60 days ago | IN | 10,180 APE | 0.00358426 | ||||
| Exit | 29017310 | 60 days ago | IN | 0 APE | 0.00372962 | ||||
| Wrap And Stake | 26334632 | 79 days ago | IN | 9,936 APE | 0.00358426 | ||||
| Exit | 26334342 | 79 days ago | IN | 0 APE | 0.00407737 | ||||
| Wrap And Stake | 26241846 | 80 days ago | IN | 7,890 APE | 0.00358426 | ||||
| Exit | 26237533 | 80 days ago | IN | 0 APE | 0.00407737 | ||||
| Wrap And Stake | 25739816 | 86 days ago | IN | 9,858 APE | 0.00358426 | ||||
| Exit | 25739776 | 86 days ago | IN | 0 APE | 0.00372962 | ||||
| Exit | 25739645 | 86 days ago | IN | 0 APE | 0.00372962 | ||||
| Wrap And Stake | 25519445 | 90 days ago | IN | 242 APE | 0.00358426 | ||||
| Wrap And Stake | 25449486 | 92 days ago | IN | 1,410.438 APE | 0.00358426 | ||||
| Exit | 25442993 | 92 days ago | IN | 0 APE | 0.00372962 | ||||
| Wrap And Stake | 25100795 | 99 days ago | IN | 2,900 APE | 0.00358426 | ||||
| Exit | 25100398 | 99 days ago | IN | 0 APE | 0.00372962 |
Latest 25 internal transactions (View All)
| Parent Transaction Hash | Block | From | To | |||
|---|---|---|---|---|---|---|
| 32580318 | 4 days ago | 4,499.99999999 APE | ||||
| 32580318 | 4 days ago | 4,499.99999999 APE | ||||
| 32451009 | 8 days ago | 4,500 APE | ||||
| 32255102 | 13 days ago | 12,499.99999999 APE | ||||
| 32255102 | 13 days ago | 12,499.99999999 APE | ||||
| 32106170 | 17 days ago | 1,324,750.93 APE | ||||
| 32106170 | 17 days ago | 1,324,750.93 APE | ||||
| 31897137 | 22 days ago | 12,500 APE | ||||
| 31896833 | 22 days ago | 7,489.99999999 APE | ||||
| 31896833 | 22 days ago | 7,489.99999999 APE | ||||
| 31863662 | 23 days ago | 7,490 APE | ||||
| 31823276 | 24 days ago | 8,269.99999999 APE | ||||
| 31823276 | 24 days ago | 8,269.99999999 APE | ||||
| 30991268 | 40 days ago | 10,600 APE | ||||
| 30991236 | 40 days ago | 3,035.07025054 APE | ||||
| 30991236 | 40 days ago | 3,035.07025054 APE | ||||
| 30973350 | 40 days ago | 8,270 APE | ||||
| 30080062 | 51 days ago | 10,192.68797634 APE | ||||
| 30080062 | 51 days ago | 10,192.68797634 APE | ||||
| 29017596 | 60 days ago | 10,180 APE | ||||
| 29017310 | 60 days ago | 9,961.0828052 APE | ||||
| 29017310 | 60 days ago | 9,961.0828052 APE | ||||
| 26334632 | 79 days ago | 9,936 APE | ||||
| 26334342 | 79 days ago | 7,891.13787167 APE | ||||
| 26334342 | 79 days ago | 7,891.13787167 APE |
Cross-Chain Transactions
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;
import "openzeppelin-contracts/contracts/access/Ownable.sol";
import "openzeppelin-contracts/contracts/utils/ReentrancyGuard.sol";
import "openzeppelin-contracts/contracts/token/ERC20/IERC20.sol";
import "openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol";
import "./interfaces/INrApe.sol";
import "./interfaces/IStakingReward.sol";
contract StakingRewardHelper is Ownable, ReentrancyGuard {
using SafeERC20 for IERC20;
/// @notice The nrApe address
address public immutable nrApe;
/// @notice The staking reward address
address public immutable stakingReward;
event Recovered(address token, uint256 amount);
constructor(address _nrApe, address _stakingReward, address _admin) Ownable(_admin) {
nrApe = _nrApe;
stakingReward = _stakingReward;
}
/* ========== MUTATIVE FUNCTIONS ========== */
/**
* @notice Wraps APE and stakes it in the staking reward contract.
* @return The amount of shares minted
*/
function wrapAndStake() external payable nonReentrant returns (uint256) {
// Wrap the APE to nrApe.
uint256 shares = INrApe(nrApe).wrap{value: msg.value}();
// Approve the staking reward contract to spend the nrApe.
IERC20(nrApe).safeIncreaseAllowance(stakingReward, shares);
// Stake the nrApe in the staking reward contract.
IStakingReward(stakingReward).stake(msg.sender, shares);
return shares;
}
/**
* @notice Withdraws nrApe from the staking reward contract and unwraps it to APE.
* @param shares The amount of shares to withdraw
* @return The amount of APE sent
*/
function withdrawAndUnwrap(uint256 shares) external nonReentrant returns (uint256) {
return _withdrawAndUnwrap(shares);
}
/**
* @notice Withdraws all nrApe from the staking reward contract, unwraps it to APE, and claims rewards.
* @return The amount of APE sent
*/
function exit() external nonReentrant returns (uint256) {
uint256 shares = IStakingReward(stakingReward).balanceOf(msg.sender);
uint256 amount = _withdrawAndUnwrap(shares);
// Claim rewards.
IStakingReward(stakingReward).getReward(msg.sender);
return amount;
}
/* ========== RESTRICTED FUNCTIONS ========== */
/**
* @notice Seize the accidentally deposited tokens.
* @param tokenAddress The token address
* @param tokenAmount The token amount
*/
function recoverToken(address tokenAddress, uint256 tokenAmount) external onlyOwner {
IERC20(tokenAddress).safeTransfer(owner(), tokenAmount);
emit Recovered(tokenAddress, tokenAmount);
}
/* ========== INTERNAL FUNCTIONS ========== */
/**
* @dev Withdraws nrApe from the staking reward contract and unwraps it to APE.
* @param shares The amount of shares to withdraw
* @return The amount of APE sent
*/
function _withdrawAndUnwrap(uint256 shares) private returns (uint256) {
// Withdraw the nrApe from the staking reward contract.
IStakingReward(stakingReward).withdraw(msg.sender, shares);
// Unwrap the APE from nrApe.
uint256 amount = INrApe(nrApe).unwrap(shares);
// Send the APE to the user.
(bool success,) = msg.sender.call{value: amount}("");
require(success, "failed to send ape");
return amount;
}
receive() external payable {}
}// 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.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;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC-20 standard as defined in the ERC.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the value of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the value of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 value) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the
* allowance mechanism. `value` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 value) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.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
pragma solidity ^0.8.0;
interface INrApe {
function wrap() external payable returns (uint256);
function unwrap(uint256 shares) external returns (uint256);
function balanceOf(address account) external view returns (uint256);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IStakingReward {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function lastTimeRewardApplicable() external view returns (uint256);
function rewardPerToken() external view returns (uint256);
function earned(address account) external view returns (uint256);
function getRewardForDuration() external view returns (uint256);
function getStakingToken() external view returns (address);
function stake(address account, uint256 amount) external;
function withdraw(address account, uint256 amount) external;
function getReward(address account) external;
}// 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.1.0) (interfaces/IERC1363.sol)
pragma solidity ^0.8.20;
import {IERC20} from "./IERC20.sol";
import {IERC165} from "./IERC165.sol";
/**
* @title IERC1363
* @dev Interface of the ERC-1363 standard as defined in the https://eips.ethereum.org/EIPS/eip-1363[ERC-1363].
*
* Defines an extension interface for ERC-20 tokens that supports executing code on a recipient contract
* after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction.
*/
interface IERC1363 is IERC20, IERC165 {
/*
* Note: the ERC-165 identifier for this interface is 0xb0202a11.
* 0xb0202a11 ===
* bytes4(keccak256('transferAndCall(address,uint256)')) ^
* bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^
* bytes4(keccak256('transferFromAndCall(address,address,uint256)')) ^
* bytes4(keccak256('transferFromAndCall(address,address,uint256,bytes)')) ^
* bytes4(keccak256('approveAndCall(address,uint256)')) ^
* bytes4(keccak256('approveAndCall(address,uint256,bytes)'))
*/
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferAndCall(address to, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @param data Additional data with no specified format, sent in call to `to`.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param from The address which you want to send tokens from.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferFromAndCall(address from, address to, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param from The address which you want to send tokens from.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @param data Additional data with no specified format, sent in call to `to`.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferFromAndCall(address from, address to, uint256 value, bytes calldata data) external returns (bool);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
* @param spender The address which will spend the funds.
* @param value The amount of tokens to be spent.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function approveAndCall(address spender, uint256 value) external returns (bool);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
* @param spender The address which will spend the funds.
* @param value The amount of tokens to be spent.
* @param data Additional data with no specified format, sent in call to `spender`.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function approveAndCall(address spender, uint256 value, bytes calldata data) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC20.sol)
pragma solidity ^0.8.20;
import {IERC20} from "../token/ERC20/IERC20.sol";// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC165.sol)
pragma solidity ^0.8.20;
import {IERC165} from "../utils/introspection/IERC165.sol";// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/introspection/IERC165.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC-165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[ERC].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}{
"remappings": [
"@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/",
"@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
"erc4626-tests/=lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/",
"forge-std/=lib/forge-std/src/",
"halmos-cheatcodes/=lib/openzeppelin-contracts-upgradeable/lib/halmos-cheatcodes/src/",
"openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/",
"openzeppelin-contracts/=lib/openzeppelin-contracts/"
],
"optimizer": {
"enabled": true,
"runs": 200
},
"metadata": {
"useLiteralContent": false,
"bytecodeHash": "ipfs",
"appendCBOR": true
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"evmVersion": "paris",
"viaIR": false,
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"_nrApe","type":"address"},{"internalType":"address","name":"_stakingReward","type":"address"},{"internalType":"address","name":"_admin","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":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Recovered","type":"event"},{"inputs":[],"name":"exit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"nrApe","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"uint256","name":"tokenAmount","type":"uint256"}],"name":"recoverToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stakingReward","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"name":"withdrawAndUnwrap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"wrapAndStake","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"payable","type":"function"},{"stateMutability":"payable","type":"receive"}]Contract Creation Code
60c060405234801561001057600080fd5b50604051610c76380380610c7683398101604081905261002f916100f0565b806001600160a01b03811661005e57604051631e4fbdf760e01b81526000600482015260240160405180910390fd5b61006781610084565b5050600180556001600160a01b039182166080521660a052610133565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b03811681146100eb57600080fd5b919050565b60008060006060848603121561010557600080fd5b61010e846100d4565b925061011c602085016100d4565b915061012a604085016100d4565b90509250925092565b60805160a051610ae761018f6000396000818160a80152818161029d015281816102de0152818161041e015281816104b60152610643015260008181610184015281816101e90152818161027b01526106bf0152610ae76000f3fe60806040526004361061008a5760003560e01c80638da5cb5b116100595780638da5cb5b14610134578063b29a814014610152578063bc00a67214610172578063e9fad8ee146101a6578063f2fde38b146101bb57600080fd5b8063042249bb1461009657806314038ce7146100e75780633969dfb4146100fd578063715018a61461011d57600080fd5b3661009157005b600080fd5b3480156100a257600080fd5b506100ca7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b6100ef6101db565b6040519081526020016100de565b34801561010957600080fd5b506100ef6101183660046109fb565b610351565b34801561012957600080fd5b50610132610374565b005b34801561014057600080fd5b506000546001600160a01b03166100ca565b34801561015e57600080fd5b5061013261016d366004610a2b565b610388565b34801561017e57600080fd5b506100ca7f000000000000000000000000000000000000000000000000000000000000000081565b3480156101b257600080fd5b506100ef6103fc565b3480156101c757600080fd5b506101326101d6366004610a55565b610527565b60006101e561056a565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d46eb119346040518263ffffffff1660e01b815260040160206040518083038185885af1158015610247573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061026c9190610a77565b90506102c26001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000167f000000000000000000000000000000000000000000000000000000000000000083610594565b6040516356e4bb9760e11b8152336004820152602481018290527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063adc9772e90604401600060405180830381600087803b15801561032a57600080fd5b505af115801561033e573d6000803e3d6000fd5b5092935050505061034e60018055565b90565b600061035b61056a565b61036482610624565b905061036f60018055565b919050565b61037c6107cc565b61038660006107f9565b565b6103906107cc565b6103b66103a56000546001600160a01b031690565b6001600160a01b0384169083610849565b604080516001600160a01b0384168152602081018390527f8c1256b8896378cd5044f80c202f9772b9d77dc85c8a6eb51967210b09bfaa28910160405180910390a15050565b600061040661056a565b6040516370a0823160e01b81523360048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa15801561046d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104919190610a77565b9050600061049e82610624565b604051630c00007b60e41b81523360048201529091507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063c00007b090602401600060405180830381600087803b15801561050257600080fd5b505af1158015610516573d6000803e3d6000fd5b509294505050505061034e60018055565b61052f6107cc565b6001600160a01b03811661055e57604051631e4fbdf760e01b8152600060048201526024015b60405180910390fd5b610567816107f9565b50565b60026001540361058d57604051633ee5aeb560e01b815260040160405180910390fd5b6002600155565b604051636eb1769f60e11b81523060048201526001600160a01b0383811660248301526000919085169063dd62ed3e90604401602060405180830381865afa1580156105e4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106089190610a77565b905061061e84846106198585610a90565b6108ad565b50505050565b60405163f3fef3a360e01b8152336004820152602481018290526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063f3fef3a390604401600060405180830381600087803b15801561068f57600080fd5b505af11580156106a3573d6000803e3d6000fd5b5050604051636f074d1f60e11b815260048101859052600092507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316915063de0e9a3e906024016020604051808303816000875af1158015610711573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107359190610a77565b604051909150600090339083908381818185875af1925050503d806000811461077a576040519150601f19603f3d011682016040523d82523d6000602084013e61077f565b606091505b50509050806107c55760405162461bcd60e51b81526020600482015260126024820152716661696c656420746f2073656e642061706560701b6044820152606401610555565b5092915050565b6000546001600160a01b031633146103865760405163118cdaa760e01b8152336004820152602401610555565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6040516001600160a01b038381166024830152604482018390526108a891859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180516001600160e01b038381831617835250505050610939565b505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b1790526108fe84826109aa565b61061e576040516001600160a01b0384811660248301526000604483015261093391869182169063095ea7b390606401610876565b61061e84825b600080602060008451602086016000885af18061095c576040513d6000823e3d81fd5b50506000513d91508115610974578060011415610981565b6001600160a01b0384163b155b1561061e57604051635274afe760e01b81526001600160a01b0385166004820152602401610555565b6000806000806020600086516020880160008a5af192503d915060005190508280156109ef575081156109e057806001146109ef565b6000866001600160a01b03163b115b93505050505b92915050565b600060208284031215610a0d57600080fd5b5035919050565b80356001600160a01b038116811461036f57600080fd5b60008060408385031215610a3e57600080fd5b610a4783610a14565b946020939093013593505050565b600060208284031215610a6757600080fd5b610a7082610a14565b9392505050565b600060208284031215610a8957600080fd5b5051919050565b808201808211156109f557634e487b7160e01b600052601160045260246000fdfea26469706673582212205e8dac6fbb3fca7ddce8214795f6dca57635abcafd42fdb0d4eaa01dc85e660364736f6c63430008180033000000000000000000000000cb193de9c28d275bbdb9603ca2421e6f12bfc8840000000000000000000000008bc97fff6eac06ce1d7135dd9aff493d1e73467f00000000000000000000000003ad7ede9c5fc581b0b03e0ca1ac0ebfd29b1e65
Deployed Bytecode
0x60806040526004361061008a5760003560e01c80638da5cb5b116100595780638da5cb5b14610134578063b29a814014610152578063bc00a67214610172578063e9fad8ee146101a6578063f2fde38b146101bb57600080fd5b8063042249bb1461009657806314038ce7146100e75780633969dfb4146100fd578063715018a61461011d57600080fd5b3661009157005b600080fd5b3480156100a257600080fd5b506100ca7f0000000000000000000000008bc97fff6eac06ce1d7135dd9aff493d1e73467f81565b6040516001600160a01b0390911681526020015b60405180910390f35b6100ef6101db565b6040519081526020016100de565b34801561010957600080fd5b506100ef6101183660046109fb565b610351565b34801561012957600080fd5b50610132610374565b005b34801561014057600080fd5b506000546001600160a01b03166100ca565b34801561015e57600080fd5b5061013261016d366004610a2b565b610388565b34801561017e57600080fd5b506100ca7f000000000000000000000000cb193de9c28d275bbdb9603ca2421e6f12bfc88481565b3480156101b257600080fd5b506100ef6103fc565b3480156101c757600080fd5b506101326101d6366004610a55565b610527565b60006101e561056a565b60007f000000000000000000000000cb193de9c28d275bbdb9603ca2421e6f12bfc8846001600160a01b031663d46eb119346040518263ffffffff1660e01b815260040160206040518083038185885af1158015610247573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061026c9190610a77565b90506102c26001600160a01b037f000000000000000000000000cb193de9c28d275bbdb9603ca2421e6f12bfc884167f0000000000000000000000008bc97fff6eac06ce1d7135dd9aff493d1e73467f83610594565b6040516356e4bb9760e11b8152336004820152602481018290527f0000000000000000000000008bc97fff6eac06ce1d7135dd9aff493d1e73467f6001600160a01b03169063adc9772e90604401600060405180830381600087803b15801561032a57600080fd5b505af115801561033e573d6000803e3d6000fd5b5092935050505061034e60018055565b90565b600061035b61056a565b61036482610624565b905061036f60018055565b919050565b61037c6107cc565b61038660006107f9565b565b6103906107cc565b6103b66103a56000546001600160a01b031690565b6001600160a01b0384169083610849565b604080516001600160a01b0384168152602081018390527f8c1256b8896378cd5044f80c202f9772b9d77dc85c8a6eb51967210b09bfaa28910160405180910390a15050565b600061040661056a565b6040516370a0823160e01b81523360048201526000907f0000000000000000000000008bc97fff6eac06ce1d7135dd9aff493d1e73467f6001600160a01b0316906370a0823190602401602060405180830381865afa15801561046d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104919190610a77565b9050600061049e82610624565b604051630c00007b60e41b81523360048201529091507f0000000000000000000000008bc97fff6eac06ce1d7135dd9aff493d1e73467f6001600160a01b03169063c00007b090602401600060405180830381600087803b15801561050257600080fd5b505af1158015610516573d6000803e3d6000fd5b509294505050505061034e60018055565b61052f6107cc565b6001600160a01b03811661055e57604051631e4fbdf760e01b8152600060048201526024015b60405180910390fd5b610567816107f9565b50565b60026001540361058d57604051633ee5aeb560e01b815260040160405180910390fd5b6002600155565b604051636eb1769f60e11b81523060048201526001600160a01b0383811660248301526000919085169063dd62ed3e90604401602060405180830381865afa1580156105e4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106089190610a77565b905061061e84846106198585610a90565b6108ad565b50505050565b60405163f3fef3a360e01b8152336004820152602481018290526000907f0000000000000000000000008bc97fff6eac06ce1d7135dd9aff493d1e73467f6001600160a01b03169063f3fef3a390604401600060405180830381600087803b15801561068f57600080fd5b505af11580156106a3573d6000803e3d6000fd5b5050604051636f074d1f60e11b815260048101859052600092507f000000000000000000000000cb193de9c28d275bbdb9603ca2421e6f12bfc8846001600160a01b0316915063de0e9a3e906024016020604051808303816000875af1158015610711573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107359190610a77565b604051909150600090339083908381818185875af1925050503d806000811461077a576040519150601f19603f3d011682016040523d82523d6000602084013e61077f565b606091505b50509050806107c55760405162461bcd60e51b81526020600482015260126024820152716661696c656420746f2073656e642061706560701b6044820152606401610555565b5092915050565b6000546001600160a01b031633146103865760405163118cdaa760e01b8152336004820152602401610555565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6040516001600160a01b038381166024830152604482018390526108a891859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180516001600160e01b038381831617835250505050610939565b505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b1790526108fe84826109aa565b61061e576040516001600160a01b0384811660248301526000604483015261093391869182169063095ea7b390606401610876565b61061e84825b600080602060008451602086016000885af18061095c576040513d6000823e3d81fd5b50506000513d91508115610974578060011415610981565b6001600160a01b0384163b155b1561061e57604051635274afe760e01b81526001600160a01b0385166004820152602401610555565b6000806000806020600086516020880160008a5af192503d915060005190508280156109ef575081156109e057806001146109ef565b6000866001600160a01b03163b115b93505050505b92915050565b600060208284031215610a0d57600080fd5b5035919050565b80356001600160a01b038116811461036f57600080fd5b60008060408385031215610a3e57600080fd5b610a4783610a14565b946020939093013593505050565b600060208284031215610a6757600080fd5b610a7082610a14565b9392505050565b600060208284031215610a8957600080fd5b5051919050565b808201808211156109f557634e487b7160e01b600052601160045260246000fdfea26469706673582212205e8dac6fbb3fca7ddce8214795f6dca57635abcafd42fdb0d4eaa01dc85e660364736f6c63430008180033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000cb193de9c28d275bbdb9603ca2421e6f12bfc8840000000000000000000000008bc97fff6eac06ce1d7135dd9aff493d1e73467f00000000000000000000000003ad7ede9c5fc581b0b03e0ca1ac0ebfd29b1e65
-----Decoded View---------------
Arg [0] : _nrApe (address): 0xCB193dE9C28d275bBdb9603ca2421e6F12Bfc884
Arg [1] : _stakingReward (address): 0x8bC97fff6Eac06CE1d7135Dd9aff493d1e73467f
Arg [2] : _admin (address): 0x03ad7edE9C5FC581b0B03e0CA1Ac0eBfd29b1E65
-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 000000000000000000000000cb193de9c28d275bbdb9603ca2421e6f12bfc884
Arg [1] : 0000000000000000000000008bc97fff6eac06ce1d7135dd9aff493d1e73467f
Arg [2] : 00000000000000000000000003ad7ede9c5fc581b0b03e0ca1ac0ebfd29b1e65
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.