Address Contract Verified
Address
0x19Fdb4fd58063eAbA7f46EBeFf5ED5bd4bBd8aF6
Balance
0 ETH
Nonce
1
Code Size
8565 bytes
Creator
0xdF4EF1a5...C632 at tx 0xc7ec4d58...b4e246
Indexed Transactions
0 (1 on-chain, 0.7% indexed)
Contract Bytecode
8565 bytes
0x608060405234801561000f575f80fd5b50600436106102b7575f3560e01c80638b5e51d211610171578063c4ae3168116100d2578063e30c397811610088578063f2fde38b1161006e578063f2fde38b14610836578063f3fef3a314610849578063f532a9e61461085c575f80fd5b8063e30c3978146107fb578063eb5a809b1461080c575f80fd5b8063ca3cccaa116100b8578063ca3cccaa146107ab578063ca9f2e8b146107be578063e131243e146107e8575f80fd5b8063c4ae316814610783578063c8a0c0b81461078b575f80fd5b8063a863e36e11610127578063adc9772e1161010d578063adc9772e146106f1578063bf9015dc14610704578063c05cce8e1461075c575f80fd5b8063a863e36e146106c6578063aa902b4d146106e6575f80fd5b80639318432911610157578063931843291461068157806397d7a49014610694578063a4cc2fa8146106b3575f80fd5b80638b5e51d21461063e5780638da5cb5b14610671575f80fd5b806348754f461161021b5780636a562978116101d1578063715018a6116101b7578063715018a61461060457806379ba50971461060c5780637aab59e714610614575f80fd5b80636a562978146105de5780636e33178d146105f1575f80fd5b80635c975abb116102015780635c975abb146105af57806366839cd2146105b85780636719416f146105cb575f80fd5b806348754f46146104ff5780635879db1d14610557575f80fd5b806332b95a6f116102705780633587c808116102565780633587c8081461047957806339bdab1514610499578063463d613d146104ec575f80fd5b806332b95a6f1461043d578063331c9bae14610452575f80fd5b80632552aa1f116102a05780632552aa1f1461038a578063280c93ef1461039d5780632df926cc146103f0575f80fd5b8063150b7a02146102bb5780631ee271e214610329575b5f80fd5b6102f36102c9366004611cac565b7f150b7a020000000000000000000000000000000000000000000000000000000095945050505050565b6040517fffffffff0000000000000000000000000000000000000000000000000000000090911681526020015b60405180910390f35b61037c610337366004611d43565b6001600160a01b037f000000000000000000000000ef0182dc0574cd5874494a120750fd222fdb909a165f908152600760209081526040808320938352929052205490565b604051908152602001610320565b61037c610398366004611d5a565b610883565b61037c6103ab366004611d43565b6001600160a01b037f00000000000000000000000063f421b24cea6765b326753f6d4e558c21ea8f76165f908152600760209081526040808320938352929052205490565b6104256103fe366004611d7c565b6001600160a01b039182165f90815260046020908152604080832093835292905220541690565b6040516001600160a01b039091168152602001610320565b61045061044b366004611dee565b610952565b005b6104257f00000000000000000000000063f421b24cea6765b326753f6d4e558c21ea8f7681565b61048c610487366004611dee565b6109b3565b6040516103209190611e55565b61037c6104a7366004611d43565b6001600160a01b037f000000000000000000000000abb95abfb3d79daf27558e5aff8bf714922ba8db165f908152600760209081526040808320938352929052205490565b6104506104fa366004611d5a565b610ba7565b61042561050d366004611d43565b6001600160a01b037f000000000000000000000000abb95abfb3d79daf27558e5aff8bf714922ba8db81165f90815260046020908152604080832094835293905291909120541690565b610425610565366004611d43565b6001600160a01b037f000000000000000000000000ef0182dc0574cd5874494a120750fd222fdb909a81165f90815260046020908152604080832094835293905291909120541690565b61037c60025481565b61048c6105c6366004611dee565b610bc8565b6104506105d9366004611d5a565b610d89565b61048c6105ec366004611dee565b610ded565b61037c6105ff366004611d43565b610fd7565b610450611002565b610450611015565b61037c610622366004611d7c565b600660209081525f928352604080842090915290825290205481565b61042561064c366004611d7c565b600460209081525f92835260408084209091529082529020546001600160a01b031681565b5f546001600160a01b0316610425565b61037c61068f366004611d7c565b611077565b61037c6106a2366004611d5a565b60036020525f908152604090205481565b61037c6106c1366004611d43565b611116565b6106d96106d4366004611dee565b611141565b6040516103209190611ef9565b61037c6302c7ea0081565b6104506106ff366004611d7c565b61134a565b610425610712366004611d43565b6001600160a01b037f00000000000000000000000063f421b24cea6765b326753f6d4e558c21ea8f7681165f90815260046020908152604080832094835293905291909120541690565b6104257f000000000000000000000000abb95abfb3d79daf27558e5aff8bf714922ba8db81565b610450611613565b61079e610799366004611d5a565b611634565b6040516103209190611f99565b61037c6107b9366004611d43565b611794565b61037c6107cc366004611fdc565b600560209081525f928352604080842090915290825290205481565b6104506107f6366004611dee565b6117bf565b6001546001600160a01b0316610425565b61037c61081a366004611d7c565b600760209081525f928352604080842090915290825290205481565b610450610844366004611d5a565b611819565b610450610857366004611d7c565b6118a1565b6104257f000000000000000000000000ef0182dc0574cd5874494a120750fd222fdb909a81565b6001600160a01b037f000000000000000000000000abb95abfb3d79daf27558e5aff8bf714922ba8db81165f908152600560208181526040808420868616808652908352818520547f00000000000000000000000063f421b24cea6765b326753f6d4e558c21ea8f76871686528484528286208287528452828620547f000000000000000000000000ef0182dc0574cd5874494a120750fd222fdb909a9097168652938352818520908552909152822054919290916109429190612040565b61094c9190612040565b92915050565b5f5b838110156109ac576109a485858381811061097157610971612053565b90506020020160208101906109869190611d5a565b84848481811061099857610998612053565b9050602002013561134a565b600101610954565b5050505050565b60605f8467ffffffffffffffff8111156109cf576109cf612080565b604051908082528060200260200182016040528015610a0257816020015b60608152602001906001900390816109ed5790505b5090505f5b85811015610b9d57848482818110610a2157610a21612053565b9050602002810190610a3391906120ad565b905067ffffffffffffffff811115610a4d57610a4d612080565b604051908082528060200260200182016040528015610a76578160200160208202803683370190505b50828281518110610a8957610a89612053565b60200260200101819052505f5b858583818110610aa857610aa8612053565b9050602002810190610aba91906120ad565b9050811015610b945760075f898985818110610ad857610ad8612053565b9050602002016020810190610aed9190611d5a565b6001600160a01b03166001600160a01b031681526020019081526020015f205f878785818110610b1f57610b1f612053565b9050602002810190610b3191906120ad565b84818110610b4157610b41612053565b9050602002013581526020019081526020015f2054838381518110610b6857610b68612053565b60200260200101518281518110610b8157610b81612053565b6020908102919091010152600101610a96565b50600101610a07565b5095945050505050565b610baf611bc0565b6001600160a01b03165f90815260036020526040812055565b60605f8467ffffffffffffffff811115610be457610be4612080565b604051908082528060200260200182016040528015610c1757816020015b6060815260200190600190039081610c025790505b5090505f5b85811015610b9d57848482818110610c3657610c36612053565b9050602002810190610c4891906120ad565b905067ffffffffffffffff811115610c6257610c62612080565b604051908082528060200260200182016040528015610c8b578160200160208202803683370190505b50828281518110610c9e57610c9e612053565b60200260200101819052505f5b858583818110610cbd57610cbd612053565b9050602002810190610ccf91906120ad565b9050811015610d8057610d42888884818110610ced57610ced612053565b9050602002016020810190610d029190611d5a565b878785818110610d1457610d14612053565b9050602002810190610d2691906120ad565b84818110610d3657610d36612053565b90506020020135611077565b838381518110610d5457610d54612053565b60200260200101518281518110610d6d57610d6d612053565b6020908102919091010152600101610cab565b50600101610c1c565b610d91611bc0565b6001600160a01b038116610dd1576040517fef945a6500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b03165f90815260036020526040902060019055565b60605f8467ffffffffffffffff811115610e0957610e09612080565b604051908082528060200260200182016040528015610e3c57816020015b6060815260200190600190039081610e275790505b5090505f5b85811015610b9d57848482818110610e5b57610e5b612053565b9050602002810190610e6d91906120ad565b905067ffffffffffffffff811115610e8757610e87612080565b604051908082528060200260200182016040528015610eb0578160200160208202803683370190505b50828281518110610ec357610ec3612053565b60200260200101819052505f5b858583818110610ee257610ee2612053565b9050602002810190610ef491906120ad565b9050811015610fce5760065f898985818110610f1257610f12612053565b9050602002016020810190610f279190611d5a565b6001600160a01b03166001600160a01b031681526020019081526020015f205f878785818110610f5957610f59612053565b9050602002810190610f6b91906120ad565b84818110610f7b57610f7b612053565b9050602002013581526020019081526020015f2054838381518110610fa257610fa2612053565b60200260200101518281518110610fbb57610fbb612053565b6020908102919091010152600101610ed0565b50600101610e41565b5f61094c7f000000000000000000000000abb95abfb3d79daf27558e5aff8bf714922ba8db83611077565b61100a611bc0565b6110135f611c05565b565b60015433906001600160a01b0316811461106b576040517f118cdaa70000000000000000000000000000000000000000000000000000000081526001600160a01b03821660048201526024015b60405180910390fd5b61107481611c05565b50565b6001600160a01b0382165f9081526006602090815260408083208484529091528120548190156110d1576001600160a01b0384165f9081526006602090815260408083208684529091529020546110ce9042612111565b90505b6001600160a01b0384165f9081526007602090815260408083208684529091529020548190611104906302c7ea00612111565b61110e9190612111565b949350505050565b5f61094c7f00000000000000000000000063f421b24cea6765b326753f6d4e558c21ea8f7683611077565b60605f8467ffffffffffffffff81111561115d5761115d612080565b60405190808252806020026020018201604052801561119057816020015b606081526020019060019003908161117b5790505b5090505f5b85811015610b9d578484828181106111af576111af612053565b90506020028101906111c191906120ad565b905067ffffffffffffffff8111156111db576111db612080565b604051908082528060200260200182016040528015611204578160200160208202803683370190505b5082828151811061121757611217612053565b60200260200101819052505f5b85858381811061123657611236612053565b905060200281019061124891906120ad565b90508110156113415760045f89898581811061126657611266612053565b905060200201602081019061127b9190611d5a565b6001600160a01b03166001600160a01b031681526020019081526020015f205f8787858181106112ad576112ad612053565b90506020028101906112bf91906120ad565b848181106112cf576112cf612053565b9050602002013581526020019081526020015f205f9054906101000a90046001600160a01b031683838151811061130857611308612053565b6020026020010151828151811061132157611321612053565b6001600160a01b0390921660209283029190910190910152600101611224565b50600101611195565b600254600103611386576040517f6d39fcd000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b0382165f9081526003602052604081205490036113d6576040517f41fbc5a700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517f6352211e0000000000000000000000000000000000000000000000000000000081526004810182905233906001600160a01b03841690636352211e90602401602060405180830381865afa158015611434573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906114589190612124565b6001600160a01b031614611498576040517f30cd747100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b0382165f9081526007602090815260408083208484529091529020546302c7ea00116114f7576040517fd432a37d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b0382165f818152600460208181526040808420868552825280842080547fffffffffffffffffffffffff00000000000000000000000000000000000000001633908117909155858552600683528185208786529092529283902042905591517f42842e0e00000000000000000000000000000000000000000000000000000000815290810191909152306024820152604481018390526342842e0e906064015f604051808303815f87803b1580156115b4575f80fd5b505af11580156115c6573d5f803e3d5ffd5b5050604080518481524260208201526001600160a01b03861693503392507f6c86f3fd5118b3aa8bb4f389a617046de0a3d3d477de1a1673d227f802f616dc910160405180910390a35050565b61161b611bc0565b60025415611629575f61162c565b60015b60ff16600255565b604080516003808252608082019092526060915f9190602082018480368337019050506001600160a01b037f000000000000000000000000ef0182dc0574cd5874494a120750fd222fdb909a81165f9081526005602090815260408083209388168352929052908120548251929350918391906116b3576116b3612053565b6020908102919091018101919091526001600160a01b037f00000000000000000000000063f421b24cea6765b326753f6d4e558c21ea8f7681165f90815260058352604080822092871682529190925290205481518290600190811061171b5761171b612053565b6020908102919091018101919091526001600160a01b037f000000000000000000000000abb95abfb3d79daf27558e5aff8bf714922ba8db81165f90815260058352604080822092871682529190925290205481518290600290811061178357611783612053565b602090810291909101015292915050565b5f61094c7f000000000000000000000000ef0182dc0574cd5874494a120750fd222fdb909a83611077565b5f5b838110156109ac576118118585838181106117de576117de612053565b90506020020160208101906117f39190611d5a565b84848481811061180557611805612053565b905060200201356118a1565b6001016117c1565b611821611bc0565b600180546001600160a01b0383167fffffffffffffffffffffffff000000000000000000000000000000000000000090911681179091556118695f546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b6002546001036118dd576040517f6d39fcd000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b0382165f9081526006602090815260408083208484529091528120549003611938576040517f039f2e1800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b038281165f908152600460209081526040808320858452909152902054163314611995576040517f30cd747100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b0382165f818152600460209081526040808320858452825280832080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055928252600681528282208483529052908120546119fa9042612111565b6001600160a01b0384165f908152600760209081526040808320868452909152812054919250906302c7ea0090611a32908490612040565b1115611a70576001600160a01b0384165f908152600760209081526040808320868452909152902054611a69906302c7ea00612111565b9050611a73565b50805b6001600160a01b0384165f90815260056020908152604080832033845290915281208054839290611aa5908490612040565b90915550506001600160a01b0384165f90815260076020908152604080832086845290915281208054839290611adc908490612040565b90915550506001600160a01b0384165f81815260066020908152604080832087845290915280822091909155517f42842e0e000000000000000000000000000000000000000000000000000000008152306004820152336024820152604481018590526342842e0e906064015f604051808303815f87803b158015611b5f575f80fd5b505af1158015611b71573d5f803e3d5ffd5b5050604080518681524260208201526001600160a01b03881693503392507f06cc7e90b4f2b554a9614b0caa84f909f3498c820ae47c731f490c28c07f7d3b910160405180910390a350505050565b5f546001600160a01b03163314611013576040517f118cdaa7000000000000000000000000000000000000000000000000000000008152336004820152602401611062565b600180547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055611074815f80546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b0381168114611074575f80fd5b5f805f805f60808688031215611cc0575f80fd5b8535611ccb81611c98565b94506020860135611cdb81611c98565b935060408601359250606086013567ffffffffffffffff80821115611cfe575f80fd5b818801915088601f830112611d11575f80fd5b813581811115611d1f575f80fd5b896020828501011115611d30575f80fd5b9699959850939650602001949392505050565b5f60208284031215611d53575f80fd5b5035919050565b5f60208284031215611d6a575f80fd5b8135611d7581611c98565b9392505050565b5f8060408385031215611d8d575f80fd5b8235611d9881611c98565b946020939093013593505050565b5f8083601f840112611db6575f80fd5b50813567ffffffffffffffff811115611dcd575f80fd5b6020830191508360208260051b8501011115611de7575f80fd5b9250929050565b5f805f8060408587031215611e01575f80fd5b843567ffffffffffffffff80821115611e18575f80fd5b611e2488838901611da6565b90965094506020870135915080821115611e3c575f80fd5b50611e4987828801611da6565b95989497509550505050565b5f602080830181845280855180835260408601915060408160051b87010192508387015f5b82811015611eec578785037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc00184528151805180875290870190878701905f5b81811015611ed657835183529289019291890191600101611eba565b5090965050509285019290850190600101611e7a565b5092979650505050505050565b5f602080830181845280855180835260408601915060408160051b87010192508387015f5b82811015611eec578785037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc00184528151805180875290870190878701905f5b81811015611f835783516001600160a01b031683529289019291890191600101611f5e565b5090965050509285019290850190600101611f1e565b602080825282518282018190525f9190848201906040850190845b81811015611fd057835183529284019291840191600101611fb4565b50909695505050505050565b5f8060408385031215611fed575f80fd5b8235611ff881611c98565b9150602083013561200881611c98565b809150509250929050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b8082018082111561094c5761094c612013565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b5f8083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18436030181126120e0575f80fd5b83018035915067ffffffffffffffff8211156120fa575f80fd5b6020019150600581901b3603821315611de7575f80fd5b8181038181111561094c5761094c612013565b5f60208284031215612134575f80fd5b8151611d7581611c9856fea264697066735822122096ef8aa904bd2447a6e03061e17a585f26ac732ba9e88112e856e697147ffc3164736f6c63430008190033
Verified Source Code Full Match
Compiler: v0.8.25+commit.b61c2a91
EVM: cancun
Optimization: Yes (10000 runs)
RKLStaker.sol 225 lines
// SPDX-License-Identifier: MIT
pragma solidity 0.8.25;
import "@openzeppelin/contracts/access/Ownable2Step.sol";
import "./interfaces/IRKLStaker.sol";
import "./interfaces/IERC721.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
contract RKLStaker is IRKLStaker, Ownable2Step, IERC721Receiver {
uint256 public paused;
uint256 public constant MAX_STAKE_DURATION = 18 * 30 days; // 18 months
address public immutable kongsAddress;
address public immutable rookiesAddress;
address public immutable clubsAddress;
mapping(address => uint256) public allowedCollections;
mapping(address => mapping(uint256 => address)) public tokenOwners;
mapping(address => mapping(address => uint256)) public accruedRewards;
mapping(address => mapping(uint256 => uint256)) public stakeStartTimestamp;
mapping(address => mapping(uint256 => uint256)) public tokenStakedTime;
constructor(address _kongsAddress, address _rookiesAddress, address _clubsAddress) Ownable(msg.sender) {
kongsAddress = _kongsAddress;
rookiesAddress = _rookiesAddress;
clubsAddress = _clubsAddress;
allowedCollections[kongsAddress] = 1;
allowedCollections[rookiesAddress] = 1;
allowedCollections[clubsAddress] = 1;
paused = 0;
}
function onERC721Received(
address _operator,
address _from,
uint256 _tokenId,
bytes calldata _data
) external pure returns (bytes4) {
return IERC721Receiver.onERC721Received.selector;
}
function batchStake(address[] calldata collections, uint256[] calldata tokenIds) public {
for (uint256 i = 0; i < collections.length; i++) {
stake(collections[i], tokenIds[i]);
}
}
function stake(address collection, uint256 tokenId) public {
if (paused == 1) {
revert ContractIsPaused();
}
if (allowedCollections[collection] == 0) {
revert CollectionNotAllowed();
}
if (IERC721(collection).ownerOf(tokenId) != msg.sender) {
revert NotOwner();
}
if (tokenStakedTime[collection][tokenId] >= MAX_STAKE_DURATION) {
revert TokenStakedForMaxDuration();
}
tokenOwners[collection][tokenId] = msg.sender;
stakeStartTimestamp[collection][tokenId] = block.timestamp;
IERC721(collection).safeTransferFrom(msg.sender, address(this), tokenId);
emit Staked(
msg.sender,
collection,
tokenId,
block.timestamp
);
}
function withdraw(address collection, uint256 tokenId) public {
if (paused == 1) {
revert ContractIsPaused();
}
if (stakeStartTimestamp[collection][tokenId] == 0) {
revert NotStaked();
}
if (tokenOwners[collection][tokenId] != msg.sender) {
revert NotOwner();
}
tokenOwners[collection][tokenId] = address(0);
uint256 currentStakedTime = (block.timestamp - stakeStartTimestamp[collection][tokenId]);
uint256 reward = 0;
if (tokenStakedTime[collection][tokenId] + currentStakedTime > MAX_STAKE_DURATION) {
reward = MAX_STAKE_DURATION - tokenStakedTime[collection][tokenId];
} else {
reward = currentStakedTime;
}
accruedRewards[collection][msg.sender] += reward;
tokenStakedTime[collection][tokenId] += reward;
stakeStartTimestamp[collection][tokenId] = 0;
IERC721(collection).safeTransferFrom(address(this), msg.sender, tokenId);
emit Unstaked(
msg.sender,
collection,
tokenId,
block.timestamp
);
}
function getAccruedRewards(address user) public view returns (uint256) {
return accruedRewards[kongsAddress][user] + accruedRewards[rookiesAddress][user] + accruedRewards[clubsAddress][user];
}
function batchWithdraw(address[] calldata collections, uint256[] calldata tokenIds) public {
for (uint256 i = 0; i < collections.length; i++) {
withdraw(collections[i], tokenIds[i]);
}
}
function allowCollection(address collection) public onlyOwner {
if (collection == address(0)) {
revert SettingZeroAddress();
}
allowedCollections[collection] = 1;
}
function disallowCollection(address collection) public onlyOwner {
allowedCollections[collection] = 0;
}
function getKongOwner(uint256 tokenId) public view returns (address) {
return tokenOwners[kongsAddress][tokenId];
}
function getRookieOwner(uint256 tokenId) public view returns (address) {
return tokenOwners[rookiesAddress][tokenId];
}
function getClubOwner(uint256 tokenId) public view returns (address) {
return tokenOwners[clubsAddress][tokenId];
}
function getKongsStakedTime(uint256 tokenId) public view returns (uint256) {
return tokenStakedTime[kongsAddress][tokenId];
}
function getRookiesStakedTime(uint256 tokenId) public view returns (uint256) {
return tokenStakedTime[rookiesAddress][tokenId];
}
function getClubsStakedTime(uint256 tokenId) public view returns (uint256) {
return tokenStakedTime[clubsAddress][tokenId];
}
function getKongRemainingStakeDuration(uint256 tokenId) public view returns (uint256) {
return getRemainingStakeDuration(kongsAddress, tokenId);
}
function getRookieRemainingStakeDuration(uint256 tokenId) public view returns (uint256) {
return getRemainingStakeDuration(rookiesAddress, tokenId);
}
function getClubRemainingStakeDuration(uint256 tokenId) public view returns (uint256) {
return getRemainingStakeDuration(clubsAddress, tokenId);
}
function getRemainingStakeDuration(address collection, uint256 tokenId) public view returns (uint256) {
uint256 currentStakedTime = 0;
if (stakeStartTimestamp[collection][tokenId] > 0) {
currentStakedTime = block.timestamp - stakeStartTimestamp[collection][tokenId];
}
return MAX_STAKE_DURATION - tokenStakedTime[collection][tokenId] - currentStakedTime;
}
function getRemainingStakeDurations(address[] calldata collections, uint256[][] calldata tokenIds) public view returns (uint256[][] memory) {
uint256[][] memory remainingStakeDurations = new uint256[][](collections.length);
for (uint256 i = 0; i < collections.length; i++) {
remainingStakeDurations[i] = new uint256[](tokenIds[i].length);
for (uint256 j = 0; j < tokenIds[i].length; j++) {
remainingStakeDurations[i][j] = getRemainingStakeDuration(collections[i], tokenIds[i][j]);
}
}
return remainingStakeDurations;
}
function getBatchTokenOwners(address[] calldata collections, uint256[][] calldata tokenIds) public view returns (address[][] memory) {
address[][] memory result = new address[][](collections.length);
for (uint256 i = 0; i < collections.length; i++) {
result[i] = new address[](tokenIds[i].length);
for (uint256 j = 0; j < tokenIds[i].length; j++) {
result[i][j] = tokenOwners[collections[i]][tokenIds[i][j]];
}
}
return result;
}
function getBatchTokenStakedTimes(address[] calldata collections, uint256[][] calldata tokenIds) public view returns (uint256[][] memory) {
uint256[][] memory tokenStakedTimes = new uint256[][](collections.length);
for (uint256 i = 0; i < collections.length; i++) {
tokenStakedTimes[i] = new uint256[](tokenIds[i].length);
for (uint256 j = 0; j < tokenIds[i].length; j++) {
tokenStakedTimes[i][j] = tokenStakedTime[collections[i]][tokenIds[i][j]];
}
}
return tokenStakedTimes;
}
function getBatchStakeStartTimestamps(address[] calldata collections, uint256[][] calldata tokenIds) public view returns (uint256[][] memory) {
uint256[][] memory stakeStartTimestamps = new uint256[][](collections.length);
for (uint256 i = 0; i < collections.length; i++) {
stakeStartTimestamps[i] = new uint256[](tokenIds[i].length);
for (uint256 j = 0; j < tokenIds[i].length; j++) {
stakeStartTimestamps[i][j] = stakeStartTimestamp[collections[i]][tokenIds[i][j]];
}
}
return stakeStartTimestamps;
}
function getSeperateAccruedRewards(address user) public view returns (uint256[] memory) {
uint256[] memory result = new uint256[](3);
result[0] = accruedRewards[kongsAddress][user];
result[1] = accruedRewards[rookiesAddress][user];
result[2] = accruedRewards[clubsAddress][user];
return result;
}
function getTokenOwner(address collection, uint256 tokenId) public view returns (address) {
return tokenOwners[collection][tokenId];
}
function togglePause() public onlyOwner {
paused = paused == 0 ? 1 : 0;
}
}
Ownable2Step.sol 59 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable2Step.sol)
pragma solidity ^0.8.20;
import {Ownable} from "./Ownable.sol";
/**
* @dev Contract module which provides access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* The initial owner is specified at deployment time in the constructor for `Ownable`. This
* can later be changed with {transferOwnership} and {acceptOwnership}.
*
* This module is used through inheritance. It will make available all functions
* from parent (Ownable).
*/
abstract contract Ownable2Step is Ownable {
address private _pendingOwner;
event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);
/**
* @dev Returns the address of the pending owner.
*/
function pendingOwner() public view virtual returns (address) {
return _pendingOwner;
}
/**
* @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual override onlyOwner {
_pendingOwner = newOwner;
emit OwnershipTransferStarted(owner(), newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual override {
delete _pendingOwner;
super._transferOwnership(newOwner);
}
/**
* @dev The new owner accepts the ownership transfer.
*/
function acceptOwnership() public virtual {
address sender = _msgSender();
if (pendingOwner() != sender) {
revert OwnableUnauthorizedAccount(sender);
}
_transferOwnership(sender);
}
}
IRKLStaker.sol 44 lines
// SPDX-License-Identifier: MIT
pragma solidity 0.8.25;
interface IRKLStaker {
error CollectionNotAllowed();
error NotOwner();
error NotStaked();
error AlreadyStaked();
error TokenStakedForMaxDuration();
error SettingZeroAddress();
error ContractIsPaused();
event Staked(
address indexed staker,
address indexed collection,
uint256 tokenId,
uint256 timestamp
);
event Unstaked(
address indexed staker,
address indexed collection,
uint256 tokenId,
uint256 timestamp
);
function stake(address collection, uint256 tokenId) external;
function withdraw(address collection, uint256 tokenId) external;
function getTokenOwner(address collection, uint256 tokenId) external view returns (address);
function getAccruedRewards(address user) external view returns (uint256);
function batchWithdraw(address[] calldata collections, uint256[] calldata tokenIds) external;
function allowCollection(address collection) external;
function disallowCollection(address collection) external;
function getKongOwner(uint256 tokenId) external view returns (address);
function getRookieOwner(uint256 tokenId) external view returns (address);
function getClubOwner(uint256 tokenId) external view returns (address);
function getKongRemainingStakeDuration(uint256 tokenId) external view returns (uint256);
function getRookieRemainingStakeDuration(uint256 tokenId) external view returns (uint256);
function getClubRemainingStakeDuration(uint256 tokenId) external view returns (uint256);
function getRemainingStakeDurations(address[] calldata collections, uint256[][] calldata tokenIds) external view returns (uint256[][] memory);
function getBatchTokenOwners(address[] calldata collections, uint256[][] calldata tokenIds) external view returns (address[][] memory);
function getBatchTokenStakedTimes(address[] calldata collections, uint256[][] calldata tokenIds) external view returns (uint256[][] memory);
function getBatchStakeStartTimestamps(address[] calldata collections, uint256[][] calldata tokenIds) external view returns (uint256[][] memory);
function getSeperateAccruedRewards(address user) external view returns (uint256[] memory);
}
IERC721.sol 12 lines
pragma solidity ^0.8.22;
interface IERC721 {
function balanceOf(address account) external view returns (uint256);
function ownerOf(uint256 tokenId) external view returns (address);
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external;
function approve(address to, uint256 tokenId) external;
}
IERC721Receiver.sol 28 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/IERC721Receiver.sol)
pragma solidity ^0.8.20;
/**
* @title ERC721 token receiver interface
* @dev Interface for any contract that wants to support safeTransfers
* from ERC721 asset contracts.
*/
interface IERC721Receiver {
/**
* @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
* by `operator` from `from`, this function is called.
*
* It must return its Solidity selector to confirm the token transfer.
* If any other value is returned or the interface is not implemented by the recipient, the transfer will be
* reverted.
*
* The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.
*/
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
Ownable.sol 100 lines
// 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);
}
}
Context.sol 28 lines
// 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;
}
}
Read Contract
MAX_STAKE_DURATION 0xaa902b4d → uint256
accruedRewards 0xca9f2e8b → uint256
allowedCollections 0x97d7a490 → uint256
clubsAddress 0xc05cce8e → address
getAccruedRewards 0x2552aa1f → uint256
getBatchStakeStartTimestamps 0x6a562978 → uint256[][]
getBatchTokenOwners 0xa863e36e → address[][]
getBatchTokenStakedTimes 0x3587c808 → uint256[][]
getClubOwner 0x48754f46 → address
getClubRemainingStakeDuration 0x6e33178d → uint256
getClubsStakedTime 0x39bdab15 → uint256
getKongOwner 0x5879db1d → address
getKongRemainingStakeDuration 0xca3cccaa → uint256
getKongsStakedTime 0x1ee271e2 → uint256
getRemainingStakeDuration 0x93184329 → uint256
getRemainingStakeDurations 0x66839cd2 → uint256[][]
getRookieOwner 0xbf9015dc → address
getRookieRemainingStakeDuration 0xa4cc2fa8 → uint256
getRookiesStakedTime 0x280c93ef → uint256
getSeperateAccruedRewards 0xc8a0c0b8 → uint256[]
getTokenOwner 0x2df926cc → address
kongsAddress 0xf532a9e6 → address
onERC721Received 0x150b7a02 → bytes4
owner 0x8da5cb5b → address
paused 0x5c975abb → uint256
pendingOwner 0xe30c3978 → address
rookiesAddress 0x331c9bae → address
stakeStartTimestamp 0x7aab59e7 → uint256
tokenOwners 0x8b5e51d2 → address
tokenStakedTime 0xeb5a809b → uint256
Write Contract 10 functions
These functions modify contract state and require a wallet transaction to execute.
acceptOwnership 0x79ba5097
No parameters
allowCollection 0x6719416f
address collection
batchStake 0x32b95a6f
address[] collections
uint256[] tokenIds
batchWithdraw 0xe131243e
address[] collections
uint256[] tokenIds
disallowCollection 0x463d613d
address collection
renounceOwnership 0x715018a6
No parameters
stake 0xadc9772e
address collection
uint256 tokenId
togglePause 0xc4ae3168
No parameters
transferOwnership 0xf2fde38b
address newOwner
withdraw 0xf3fef3a3
address collection
uint256 tokenId
Recent Transactions
This address has 1 on-chain transactions, but only 0.7% of the chain is indexed. Transactions will appear as indexing progresses. View on Etherscan →