编译器
0.8.11+commit.d7f03943
文件 1 的 18:Address.sol
pragma solidity ^0.8.1;
library Address {
function isContract(address account) internal view returns (bool) {
return account.code.length > 0;
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResult(success, returndata, errorMessage);
}
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResult(success, returndata, errorMessage);
}
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResult(success, returndata, errorMessage);
}
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
if (returndata.length > 0) {
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
文件 2 的 18:Context.sol
pragma solidity ^0.8.0;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
文件 3 的 18:ERC721Holder.sol
pragma solidity ^0.8.0;
import "../IERC721Receiver.sol";
contract ERC721Holder is IERC721Receiver {
function onERC721Received(
address,
address,
uint256,
bytes memory
) public virtual override returns (bytes4) {
return this.onERC721Received.selector;
}
}
文件 4 的 18:IContractUri.sol
pragma solidity ^0.8.0;
interface IContractUri {
function contractURI() external view returns (string memory);
function setContractURI(string memory _uri) external;
}
文件 5 的 18:IERC165.sol
pragma solidity ^0.8.0;
interface IERC165 {
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
文件 6 的 18:IERC20.sol
pragma solidity ^0.8.0;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address to, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address from,
address to,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
文件 7 的 18:IERC721.sol
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
interface IERC721 is IERC165 {
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
function balanceOf(address owner) external view returns (uint256 balance);
function ownerOf(uint256 tokenId) external view returns (address owner);
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external;
function transferFrom(
address from,
address to,
uint256 tokenId
) external;
function approve(address to, uint256 tokenId) external;
function getApproved(uint256 tokenId) external view returns (address operator);
function setApprovalForAll(address operator, bool _approved) external;
function isApprovedForAll(address owner, address operator) external view returns (bool);
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external;
}
文件 8 的 18:IERC721Receiver.sol
pragma solidity ^0.8.0;
interface IERC721Receiver {
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
文件 9 的 18:IMintableERC20.sol
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
interface IMintableERC20 is IERC20 {
function mint(address destination, uint256 amount) external;
}
文件 10 的 18:IRecoverable.sol
pragma solidity ^0.8.0;
interface IRecoverable {
function recoverNonFungibleToken(address _token, uint256 _tokenId) external;
function recoverToken(address _token) external;
function recoverEth(address payable _to) external;
}
文件 11 的 18:MinterAccess.sol
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "../interfaces/IContractUri.sol";
abstract contract MinterAccess is Ownable {
mapping(address => bool) private _minters;
event MinterAdded(address indexed minter);
event MinterRemoved(address indexed minter);
modifier onlyMinters() {
require(_minters[_msgSender()], "Mintable: Caller is not minter");
_;
}
function isMinter(address account) public view returns (bool) {
return _minters[account];
}
function addMinter(address minter) external onlyOwner {
require(!_minters[minter], "Mintable: Already minter");
_minters[minter] = true;
emit MinterAdded(minter);
}
function removeMinter(address minter) external onlyOwner {
require(_minters[minter], "Mintable: Not minter");
_minters[minter] = false;
emit MinterRemoved(minter);
}
}
文件 12 的 18:NftStakingPool.sol
pragma solidity ^0.8.0;
pragma abicoder v2;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "./Poolable.sol";
import "./Recoverable.sol";
contract NftStakingPool is Ownable, Poolable, Recoverable, ReentrancyGuard, ERC721Holder {
using SafeERC20 for IERC20;
struct PoolDeposit {
uint256 depositDate;
uint64 pool;
address owner;
}
IERC721 public nftCollection;
IERC20 public rewardToken;
mapping(uint256 => PoolDeposit) private _deposits;
mapping(address => uint256) private _userRewards;
event Stake(address indexed account, uint256 poolId, uint256 tokenId);
event Unstake(address indexed account, uint256 tokenId);
event BatchStake(address indexed account, uint256 poolId, uint256[] tokenIds);
event BatchUnstake(address indexed account, uint256[] tokenIds);
constructor(IERC721 _nftCollection, IERC20 _rewardToken) {
nftCollection = _nftCollection;
rewardToken = _rewardToken;
}
function _sendRewards(address destination, uint256 amount) internal virtual {
rewardToken.safeTransfer(destination, amount);
}
function _sendAndUpdateRewards(address account, uint256 amount) internal {
if (amount > 0) {
_userRewards[account] = _userRewards[account] + amount;
_sendRewards(account, amount);
}
}
function _stake(address account, uint256 poolId, uint256 tokenId) internal {
require(_deposits[tokenId].owner == address(0), "Stake: Token already staked");
_deposits[tokenId] = PoolDeposit({depositDate: block.timestamp, pool: uint64(poolId), owner: account});
nftCollection.safeTransferFrom(account, address(this), tokenId);
}
function stake(uint256 poolId, uint256 tokenId) external nonReentrant whenPoolOpened(poolId) {
address account = _msgSender();
_stake(account, poolId, tokenId);
emit Stake(account, poolId, tokenId);
}
function _unstake(address account, uint256 tokenId) internal returns (uint256) {
uint256 poolId = _deposits[tokenId].pool;
require(isUnlockable(poolId, _deposits[tokenId].depositDate), "Stake: Not yet unstakable");
bool unlocked = isUnlocked(poolId, _deposits[tokenId].depositDate);
nftCollection.safeTransferFrom(address(this), account, tokenId);
delete _deposits[tokenId];
uint256 rewards = 0;
if (unlocked) {
Pool memory pool = getPool(poolId);
rewards = pool.rewardAmount;
}
return rewards;
}
function unstake(uint256 tokenId) external nonReentrant {
require(_deposits[tokenId].owner == _msgSender(), "Stake: Not owner of token");
address account = _msgSender();
uint256 rewards = _unstake(account, tokenId);
_sendAndUpdateRewards(account, rewards);
emit Unstake(account, tokenId);
}
function _restake(uint256 newPoolId, uint256 tokenId) internal returns (uint256) {
require(isPoolOpened(newPoolId), "Stake: Pool is closed");
uint256 oldPoolId = _deposits[tokenId].pool;
require(isUnlockable(oldPoolId, _deposits[tokenId].depositDate), "Stake: Not yet unstakable");
bool unlocked = isUnlocked(oldPoolId, _deposits[tokenId].depositDate);
_deposits[tokenId].pool = uint64(newPoolId);
_deposits[tokenId].depositDate = block.timestamp;
uint256 rewards = 0;
if (unlocked) {
Pool memory pool = getPool(oldPoolId);
rewards = pool.rewardAmount;
}
return rewards;
}
function restake(uint256 newPoolId, uint256 tokenId) external nonReentrant {
require(_deposits[tokenId].owner != address(0), "Stake: Token not staked");
require(_deposits[tokenId].owner == _msgSender(), "Stake: Not owner of token");
address account = _msgSender();
uint256 rewards = _restake(newPoolId, tokenId);
_sendAndUpdateRewards(account, rewards);
emit Unstake(account, tokenId);
emit Stake(account, newPoolId, tokenId);
}
function batchStake(uint256 poolId, uint256[] calldata tokenIds) external whenPoolOpened(poolId) nonReentrant {
address account = _msgSender();
for (uint256 i = 0; i < tokenIds.length; i++) {
_stake(account, poolId, tokenIds[i]);
}
emit BatchStake(account, poolId, tokenIds);
}
function batchUnstake(uint256[] calldata tokenIds) external nonReentrant {
address account = _msgSender();
uint256 rewards = 0;
for (uint256 i = 0; i < tokenIds.length; i++) {
require(_deposits[tokenIds[i]].owner == account, "Stake: Not owner of token");
rewards = rewards + _unstake(account, tokenIds[i]);
}
_sendAndUpdateRewards(account, rewards);
emit BatchUnstake(account, tokenIds);
}
function batchRestake(uint256 poolId, uint256[] calldata tokenIds) external nonReentrant {
address account = _msgSender();
uint256 rewards = 0;
for (uint256 i = 0; i < tokenIds.length; i++) {
require(_deposits[tokenIds[i]].owner == account, "Stake: Not owner of token");
rewards = rewards + _restake(poolId, tokenIds[i]);
}
_sendAndUpdateRewards(account, rewards);
emit BatchUnstake(account, tokenIds);
emit BatchStake(account, poolId, tokenIds);
}
function isTokenUnlocked(uint256 tokenId) public view returns (bool) {
require(_deposits[tokenId].owner != address(0), "Stake: Token not staked");
return isUnlocked(_deposits[tokenId].pool, _deposits[tokenId].depositDate);
}
function getStakeInfo(uint256 tokenId)
external
view
returns (
address,
uint256,
uint256,
uint256,
uint256
)
{
require(_deposits[tokenId].owner != address(0), "Stake: Token not staked");
PoolDeposit memory deposit = _deposits[tokenId];
Pool memory pool = getPool(deposit.pool);
return (deposit.owner, deposit.pool, deposit.depositDate, deposit.depositDate + pool.minDuration, deposit.depositDate + pool.lockDuration);
}
function getUserTotalRewards(address account) external view returns (uint256) {
return _userRewards[account];
}
function recoverNonFungibleToken(address _token, uint256 _tokenId) external override onlyOwner {
require(_token != address(nftCollection), "Stake: Cannot recover staked collection");
IERC721(_token).transferFrom(address(this), address(msg.sender), _tokenId);
emit NonFungibleTokenRecovery(_token, _tokenId);
}
}
文件 13 的 18:OnnaBugeishaStaking.sol
pragma solidity ^0.8.0;
import "./interfaces/IMintableERC20.sol";
import "./libraries/NftStakingPool.sol";
import "./libraries/MinterAccess.sol";
contract OnnaBugeishaStaking is NftStakingPool, MinterAccess {
constructor(IERC721 _nftCollection, IMintableERC20 _rewardToken) NftStakingPool(_nftCollection, _rewardToken) {}
function _sendRewards(address destination, uint256 amount) internal override {
IMintableERC20(address(rewardToken)).mint(destination, amount);
}
function stakeFrom(address from, uint256 poolId, uint256 tokenId) external onlyMinters {
require(from != address(0), "Stake: address(0)");
_stake(from, poolId, tokenId);
emit Stake(from, poolId, tokenId);
}
function batchStakeFrom(address from, uint256 poolId, uint256[] calldata tokenIds) external onlyMinters {
require(from != address(0), "Stake: address(0)");
for (uint256 i = 0; i < tokenIds.length; i++) {
_stake(from, poolId, tokenIds[i]);
}
emit BatchStake(from, poolId, tokenIds);
}
}
文件 14 的 18:Ownable.sol
pragma solidity ^0.8.0;
import "../utils/Context.sol";
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
_transferOwnership(_msgSender());
}
function owner() public view virtual returns (address) {
return _owner;
}
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
文件 15 的 18:Poolable.sol
pragma solidity ^0.8.0;
pragma abicoder v2;
import "@openzeppelin/contracts/access/Ownable.sol";
abstract contract Poolable is Ownable {
struct Pool {
uint256 lockDuration;
uint256 minDuration;
bool opened;
uint256 rewardAmount;
}
uint256 public poolsLength;
mapping(uint256 => Pool) private _pools;
event PoolAdded(uint256 poolIndex, Pool pool);
event PoolUpdated(uint256 poolIndex, Pool pool);
modifier whenPoolOpened(uint256 poolIndex) {
require(poolIndex < poolsLength, "Poolable: Invalid poolIndex");
require(_pools[poolIndex].opened, "Poolable: Pool is closed");
_;
}
modifier whenUnlocked(uint256 poolIndex, uint256 depositDate) {
require(
isUnlocked(poolIndex, depositDate),
"Poolable: Not unlocked"
);
_;
}
function getPool(uint256 poolIndex) public view returns (Pool memory) {
require(poolIndex < poolsLength, "Poolable: Invalid poolIndex");
return _pools[poolIndex];
}
function addPool(Pool calldata pool) external onlyOwner {
uint256 poolIndex = poolsLength;
_pools[poolIndex] = pool;
poolsLength = poolsLength + 1;
emit PoolAdded(poolIndex, _pools[poolIndex]);
}
function updatePool(uint256 poolIndex, Pool calldata pool)
external
onlyOwner
{
require(poolIndex < poolsLength, "Poolable: Invalid poolIndex");
Pool storage editedPool = _pools[poolIndex];
editedPool.lockDuration = pool.lockDuration;
editedPool.minDuration = pool.minDuration;
editedPool.opened = pool.opened;
editedPool.rewardAmount = pool.rewardAmount;
emit PoolUpdated(poolIndex, editedPool);
}
function isUnlocked(uint256 poolIndex, uint256 depositDate) internal view returns (bool) {
require(poolIndex < poolsLength, "Poolable: Invalid poolIndex");
require(
depositDate < block.timestamp,
"Poolable: Invalid deposit date"
);
return block.timestamp - depositDate >= _pools[poolIndex].lockDuration;
}
function isUnlockable(uint256 poolIndex, uint256 depositDate) internal view returns (bool) {
require(poolIndex < poolsLength, "Poolable: Invalid poolIndex");
require(
depositDate < block.timestamp,
"Poolable: Invalid deposit date"
);
return block.timestamp - depositDate >= _pools[poolIndex].minDuration;
}
function isPoolOpened(uint256 poolIndex) public view returns (bool) {
require(poolIndex < poolsLength, "Poolable: Invalid poolIndex");
return _pools[poolIndex].opened;
}
}
文件 16 的 18:Recoverable.sol
pragma solidity ^0.8.0;
pragma abicoder v2;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "../interfaces/IRecoverable.sol";
abstract contract Recoverable is Ownable, IRecoverable {
using SafeERC20 for IERC20;
event NonFungibleTokenRecovery(address indexed token, uint256 tokenId);
event TokenRecovery(address indexed token, uint256 amount);
event EthRecovery(uint256 amount);
function recoverNonFungibleToken(address _token, uint256 _tokenId) external virtual onlyOwner {
IERC721(_token).transferFrom(address(this), address(msg.sender), _tokenId);
emit NonFungibleTokenRecovery(_token, _tokenId);
}
function recoverToken(address _token) external virtual onlyOwner {
uint256 balance = IERC20(_token).balanceOf(address(this));
require(balance != 0, "Operations: Cannot recover zero balance");
IERC20(_token).safeTransfer(address(msg.sender), balance);
emit TokenRecovery(_token, balance);
}
function recoverEth(address payable _to) external virtual onlyOwner {
uint256 balance = address(this).balance;
_to.transfer(balance);
emit EthRecovery(balance);
}
}
文件 17 的 18:ReentrancyGuard.sol
pragma solidity ^0.8.0;
abstract contract ReentrancyGuard {
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
modifier nonReentrant() {
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
_status = _ENTERED;
_;
_status = _NOT_ENTERED;
}
}
文件 18 的 18:SafeERC20.sol
pragma solidity ^0.8.0;
import "../IERC20.sol";
import "../../../utils/Address.sol";
library SafeERC20 {
using Address for address;
function safeTransfer(
IERC20 token,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(
IERC20 token,
address from,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
function safeApprove(
IERC20 token,
address spender,
uint256 value
) internal {
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
uint256 newAllowance = token.allowance(address(this), spender) + value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
uint256 newAllowance = oldAllowance - value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
}
function _callOptionalReturn(IERC20 token, bytes memory data) private {
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
if (returndata.length > 0) {
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
{
"compilationTarget": {
"contracts/OnnaBugeishaStaking.sol": "OnnaBugeishaStaking"
},
"evmVersion": "london",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs",
"useLiteralContent": true
},
"optimizer": {
"enabled": true,
"runs": 500
},
"remappings": []
}
[{"inputs":[{"internalType":"contract IERC721","name":"_nftCollection","type":"address"},{"internalType":"contract IMintableERC20","name":"_rewardToken","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"poolId","type":"uint256"},{"indexed":false,"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"BatchStake","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"BatchUnstake","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"EthRecovery","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"minter","type":"address"}],"name":"MinterAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"minter","type":"address"}],"name":"MinterRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"NonFungibleTokenRecovery","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"poolIndex","type":"uint256"},{"components":[{"internalType":"uint256","name":"lockDuration","type":"uint256"},{"internalType":"uint256","name":"minDuration","type":"uint256"},{"internalType":"bool","name":"opened","type":"bool"},{"internalType":"uint256","name":"rewardAmount","type":"uint256"}],"indexed":false,"internalType":"struct Poolable.Pool","name":"pool","type":"tuple"}],"name":"PoolAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"poolIndex","type":"uint256"},{"components":[{"internalType":"uint256","name":"lockDuration","type":"uint256"},{"internalType":"uint256","name":"minDuration","type":"uint256"},{"internalType":"bool","name":"opened","type":"bool"},{"internalType":"uint256","name":"rewardAmount","type":"uint256"}],"indexed":false,"internalType":"struct Poolable.Pool","name":"pool","type":"tuple"}],"name":"PoolUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"poolId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Stake","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"TokenRecovery","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Unstake","type":"event"},{"inputs":[{"internalType":"address","name":"minter","type":"address"}],"name":"addMinter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"lockDuration","type":"uint256"},{"internalType":"uint256","name":"minDuration","type":"uint256"},{"internalType":"bool","name":"opened","type":"bool"},{"internalType":"uint256","name":"rewardAmount","type":"uint256"}],"internalType":"struct Poolable.Pool","name":"pool","type":"tuple"}],"name":"addPool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"poolId","type":"uint256"},{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"batchRestake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"poolId","type":"uint256"},{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"batchStake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256","name":"poolId","type":"uint256"},{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"batchStakeFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"batchUnstake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"poolIndex","type":"uint256"}],"name":"getPool","outputs":[{"components":[{"internalType":"uint256","name":"lockDuration","type":"uint256"},{"internalType":"uint256","name":"minDuration","type":"uint256"},{"internalType":"bool","name":"opened","type":"bool"},{"internalType":"uint256","name":"rewardAmount","type":"uint256"}],"internalType":"struct Poolable.Pool","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getStakeInfo","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getUserTotalRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"isMinter","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"poolIndex","type":"uint256"}],"name":"isPoolOpened","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"isTokenUnlocked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nftCollection","outputs":[{"internalType":"contract IERC721","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"poolsLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address payable","name":"_to","type":"address"}],"name":"recoverEth","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"recoverNonFungibleToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"recoverToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"minter","type":"address"}],"name":"removeMinter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newPoolId","type":"uint256"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"restake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewardToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"poolId","type":"uint256"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"stake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256","name":"poolId","type":"uint256"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"stakeFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"unstake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"poolIndex","type":"uint256"},{"components":[{"internalType":"uint256","name":"lockDuration","type":"uint256"},{"internalType":"uint256","name":"minDuration","type":"uint256"},{"internalType":"bool","name":"opened","type":"bool"},{"internalType":"uint256","name":"rewardAmount","type":"uint256"}],"internalType":"struct Poolable.Pool","name":"pool","type":"tuple"}],"name":"updatePool","outputs":[],"stateMutability":"nonpayable","type":"function"}]