Feature Tip: Add private address tag to any address under My Name Tag !
Source Code
Latest 25 from a total of 2,266 transactions
| Transaction Hash |
Method
|
Block
|
From
|
|
To
|
||||
|---|---|---|---|---|---|---|---|---|---|
| Multi Unstake | 21774705 | 384 days ago | IN | 0 ETH | 0.00071641 | ||||
| Multi Stake | 21620680 | 405 days ago | IN | 0 ETH | 0.00198311 | ||||
| Unstake | 21620663 | 405 days ago | IN | 0 ETH | 0.00075565 | ||||
| Multi Stake | 21049394 | 485 days ago | IN | 0 ETH | 0.0012273 | ||||
| Multi Unstake | 21049382 | 485 days ago | IN | 0 ETH | 0.0011489 | ||||
| Multi Unstake | 20726636 | 530 days ago | IN | 0 ETH | 0.00048714 | ||||
| Unstake | 20711780 | 532 days ago | IN | 0 ETH | 0.00068843 | ||||
| Unstake | 20648976 | 541 days ago | IN | 0 ETH | 0.0002416 | ||||
| Multi Unstake | 19955340 | 638 days ago | IN | 0 ETH | 0.0027053 | ||||
| Unstake | 19955337 | 638 days ago | IN | 0 ETH | 0.0020543 | ||||
| Multi Unstake | 19933284 | 641 days ago | IN | 0 ETH | 0.00708447 | ||||
| Multi Unstake | 19807596 | 659 days ago | IN | 0 ETH | 0.00563363 | ||||
| Multi Unstake | 18283892 | 872 days ago | IN | 0 ETH | 0.00674586 | ||||
| Multi Unstake | 17984825 | 914 days ago | IN | 0 ETH | 0.0040558 | ||||
| Unstake | 17857598 | 932 days ago | IN | 0 ETH | 0.00297027 | ||||
| Multi Payout Rew... | 17833785 | 935 days ago | IN | 0 ETH | 0.00397238 | ||||
| Multi Unstake | 17806034 | 939 days ago | IN | 0 ETH | 0.00815855 | ||||
| Multi Unstake | 17797165 | 940 days ago | IN | 0 ETH | 0.00856488 | ||||
| Unstake | 17573205 | 972 days ago | IN | 0 ETH | 0.00196543 | ||||
| Unstake | 17554277 | 974 days ago | IN | 0 ETH | 0.00163712 | ||||
| Multi Unstake | 17519179 | 979 days ago | IN | 0 ETH | 0.00417716 | ||||
| Unstake | 17002704 | 1052 days ago | IN | 0 ETH | 0.00246764 | ||||
| Multi Unstake | 16919989 | 1064 days ago | IN | 0 ETH | 0.00713036 | ||||
| Multi Unstake | 16861498 | 1072 days ago | IN | 0 ETH | 0.00251938 | ||||
| Multi Payout Rew... | 16837831 | 1075 days ago | IN | 0 ETH | 0.00240722 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Contract Name:
ANCApeStake
Compiler Version
v0.8.15+commit.e14f2714
Optimization Enabled:
Yes with 100 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
/***
* .';:c:,.
* ;0NNNNNNX. lNNNNNNK; .XNNNNN. .:d0XWWWWWWWWXOo'
* lXWWWWWWWWO XWWWWWWWWO. :WWWWWK ;0WWWWWWWWWWWWWWWWWK,
* .dNWWWWWWWWWWc ,WWWWWWWWWWNo kWWWWWo .0WWWWWNkc,...;oXWWXxc.
* ,kWWWWWWXWWWWWW. dWWWWWXNWWWWWX; .NWWWWW. KWWWWW0. ;.
* :KWWWWWNd.lWWWWWO XWWWWW:.xWWWWWWOdWWWWW0 cWWWWWW.
* lXWWWWWXl. 0WWWWW: ,WWWWWN '0WWWWWWWWWWWl oWWWWWW; :,
* .dNWWWWW0; 'WWWWWN. xWWWWWx :XWWWWWWWWW. .NWWWWWWkc,'';ckNWWNOc.
* 'kWWWWWWx' oWWWWWk NWWWWW, oWWWWWWW0 '0WWWWWWWWWWWWWWWWWO;
* .d000000o. k00000; ,00000k .x00000: .lkKNWWWWWWNKko;.
* .,;;'.
*/
pragma solidity ^0.8.15;
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "erc721a/contracts/ERC721A.sol";
import "./ANCStake.sol";
contract ANCApeStake is ANCStake {
struct StakedApe {
uint128 stakingStartWeek;
uint32 stakingDuration;
uint32 paidDuration;
}
IERC721A private _ancApe;
mapping(address => mapping(uint256 => StakedApe)) private _stakes;
constructor(uint256 percentPerWeek, address nftTokenAddress) ANCStake(percentPerWeek){
_ancApe = IERC721A(nftTokenAddress);
}
/* External Functions */
function onERC721Received(
address,
address,
uint256,
bytes calldata
) external pure returns (bytes4) {
return bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"));
}
function stake(uint256 tokenId, uint32 stakingDuration) external stakingGate(stakingDuration){
_ancApe.safeTransferFrom(msg.sender, address(this), tokenId);
uint256 currentWeek = getCurrentWeek();
_stakes[msg.sender][tokenId] = StakedApe(uint128(currentWeek), stakingDuration, 0);
addSharesToWeeks(currentWeek, stakingDuration, getShares(stakingDuration));
}
function multiStake(uint256[] calldata tokenIDs, uint32 stakingDuration) external stakingGate(stakingDuration){
require(tokenIDs.length>0, "No token IDs given");
require(tokenIDs.length<=20, "Can't stake more than 20 at once"); //to prevent excessive gas use
uint256 currentWeek = getCurrentWeek();
uint256 tokenId;
for (uint256 id = 0; id < tokenIDs.length; id++) {
tokenId = tokenIDs[id];
_ancApe.safeTransferFrom(msg.sender, address(this), tokenId);
_stakes[msg.sender][tokenId] = StakedApe(uint128(currentWeek), stakingDuration, 0);
}
addSharesToWeeks(currentWeek, stakingDuration, getShares(stakingDuration)*tokenIDs.length);
}
function unstake(uint256 _tokenId) external {
uint256 currentWeek = getCurrentWeek();
reserveForPastWeeks(currentWeek); // reserve reward tokens
StakedApe memory mstake = _stakes[msg.sender][_tokenId];
require(currentWeek - mstake.stakingStartWeek >= mstake.stakingDuration, "Staking period not over");
uint256 payout = _getReward(currentWeek, mstake);
_reservedTokens -= payout; // remove payout tokens from reserved
delete _stakes[msg.sender][_tokenId];
_ancApe.safeTransferFrom(address(this), msg.sender, _tokenId);
_danceSplitter.proxySend(msg.sender, payout);
}
function multiUnstake(uint256[] calldata tokenIDs) external {
require(tokenIDs.length>0, "No token IDs given");
require(tokenIDs.length<=20, "Can't unstake more than 20 at once"); //to prevent excessive gas use
uint256 currentWeek = getCurrentWeek();
reserveForPastWeeks(currentWeek); // reserve reward tokens
uint256 payout = 0;
uint256 tokenId;
StakedApe memory mstake;
for (uint256 id = 0; id < tokenIDs.length; id++) {
tokenId = tokenIDs[id];
mstake = _stakes[msg.sender][tokenId];
require(currentWeek - mstake.stakingStartWeek >= mstake.stakingDuration, "Staking period not over");
payout += _getReward(currentWeek, mstake);
delete _stakes[msg.sender][tokenId];
_ancApe.safeTransferFrom(address(this), msg.sender, tokenId);
}
_reservedTokens -= payout; // remove payout tokens from reserved
_danceSplitter.proxySend(msg.sender, payout);
}
function payoutReward(uint256 _tokenId) external override {
uint256 currentWeek = getCurrentWeek();
reserveForPastWeeks(currentWeek); // reserve reward tokens
StakedApe memory mstake = _stakes[msg.sender][_tokenId];
require(currentWeek - mstake.stakingStartWeek < mstake.stakingDuration, "Staking period is over, use unstake function instead");
require(mstake.stakingStartWeek + mstake.paidDuration < currentWeek, "Nothing to pay out");
uint256 payout = _getReward(currentWeek, mstake);
_reservedTokens -= payout;
_stakes[msg.sender][_tokenId].paidDuration = uint16(min(currentWeek - mstake.stakingStartWeek, mstake.stakingDuration));
require(payout > 0, "No reward to pay out");
_danceSplitter.proxySend(msg.sender, payout);
}
function multiPayoutRewards(uint256[] calldata tokenIDs) external {
uint256 currentWeek = getCurrentWeek();
reserveForPastWeeks(currentWeek); // reserve reward tokens
uint256 payout = 0;
uint256 tokenId;
StakedApe memory mstake;
for (uint256 id = 0; id < tokenIDs.length; id++) {
tokenId = tokenIDs[id];
mstake = _stakes[msg.sender][tokenId];
if(!canBeUnstaked(mstake, currentWeek)) {
//require(currentWeek - mstake.stakingStartWeek < mstake.stakingDuration, "Staking period is over, use unstake function");
if(mstake.stakingStartWeek + mstake.paidDuration < currentWeek){
payout += _getReward(currentWeek, mstake);
_stakes[msg.sender][tokenId].paidDuration = uint16(min(currentWeek - mstake.stakingStartWeek, mstake.stakingDuration));
}
}
}
_reservedTokens -= payout;
require(payout > 0, "No reward to pay out");
_danceSplitter.proxySend(msg.sender, payout);
}
function getIDsDoneStaking(address address_) external view returns(uint256[] memory){
uint256 currentWeek = getCurrentWeek();
uint256 numDoneStaking = 0;
uint256[] memory stakedIDs = getStakedIDs(address_);
uint256 tokenId;
// calculate how many token IDs are ready to be unstaked
for (uint256 i = 0; i < stakedIDs.length; i++) {
tokenId = stakedIDs[i];
if (canBeUnstaked(_stakes[address_][tokenId], currentWeek)) numDoneStaking += 1;
}
// select token IDs ready for unstaking
uint256[] memory doneStaking = new uint256[](numDoneStaking);
uint256 index = 0;
for (uint256 i = 0; i < stakedIDs.length; i++) {
tokenId = stakedIDs[i];
if (canBeUnstaked(_stakes[address_][tokenId], currentWeek)) {
doneStaking[index] = tokenId;
index += 1;
}
}
return doneStaking;
}
/* Public Functions */
function getNumStaked(address address_) public view override returns(uint256){
uint256 supply = _ancApe.totalSupply();
uint256 numStaked = 0;
for (uint256 id = 0; id < supply; id++) {
if(_stakes[address_][id].stakingStartWeek > 0){
numStaked += 1;
}
}
return numStaked;
}
function getStakeInfo(address address_, uint256 tokenId_) public view returns(StakedApe memory){
return _stakes[address_][tokenId_];
}
function getAvailablePayout(address address_, uint256 tokenId_) public view returns(uint256){
uint256 currentWeek = getCurrentWeek();
StakedApe memory mstake = _stakes[address_][tokenId_];
uint256 endWeek = mstake.stakingStartWeek + mstake.stakingDuration;
uint256 startWeek = mstake.stakingStartWeek + mstake.paidDuration;
uint256 shares = getShares(mstake.stakingDuration);
return _getAvailablePayout(startWeek, endWeek, currentWeek, shares);
}
function getStakedIDs(address address_) public view override returns(uint256[] memory){
uint256 supply = _ancApe.totalSupply();
uint256 numStaked = getNumStaked(address_);
uint256[] memory stakedIDs = new uint256[](numStaked);
uint256 index = 0;
for (uint256 id = 0; id < supply; id++) {
if(_stakes[address_][id].stakingStartWeek > 0){
stakedIDs[index] = id;
index += 1;
}
}
return stakedIDs;
}
function getShares(uint32 stakingDuration) public pure returns(uint256){
// max shares per nft < (2^32 -1)/8888 = 483232
uint256 sD = stakingDuration;
uint256 base = 50;
uint256 linear = 30 * sD / MAX_STAKING_DURATION;
uint256 quadratic = 20 * sD * sD / (MAX_STAKING_DURATION*MAX_STAKING_DURATION);
return base + linear + quadratic;
}
/* Internal Functions */
function _getReward(uint256 currentWeek, StakedApe memory mstake) internal view returns(uint256){
require(mstake.stakingStartWeek > 0, "Token is not staked");
uint256 payout = getStakingReward(
mstake.stakingStartWeek,
currentWeek,
mstake.stakingDuration,
mstake.paidDuration,
getShares(uint16(mstake.stakingDuration))
);
// need to update state (paidDuration) in next step
return payout;
}
function canBeUnstaked(StakedApe memory mstake, uint256 currentWeek) internal pure returns(bool){
if (mstake.stakingStartWeek == 0) return false;
return (currentWeek - mstake.stakingStartWeek >= mstake.stakingDuration);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)
pragma solidity ^0.8.0;
/**
* @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);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
import "../extensions/draft-IERC20Permit.sol";
import "../../../utils/Address.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC20 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 {
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));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(
IERC20 token,
address spender,
uint256 value
) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
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 safePermit(
IERC20Permit token,
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) internal {
uint256 nonceBefore = token.nonces(owner);
token.permit(owner, spender, value, deadline, v, r, s);
uint256 nonceAfter = token.nonces(owner);
require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
}
/**
* @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).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
if (returndata.length > 0) {
// Return data is optional
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}// SPDX-License-Identifier: MIT
// ERC721A Contracts v3.3.0
// Creator: Chiru Labs
pragma solidity ^0.8.4;
import './IERC721A.sol';
import '@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol';
import '@openzeppelin/contracts/utils/Address.sol';
import '@openzeppelin/contracts/utils/Context.sol';
import '@openzeppelin/contracts/utils/Strings.sol';
import '@openzeppelin/contracts/utils/introspection/ERC165.sol';
/**
* @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
* the Metadata extension. Built to optimize for lower gas during batch mints.
*
* Assumes serials are sequentially minted starting at _startTokenId() (defaults to 0, e.g. 0, 1, 2, 3..).
*
* Assumes that an owner cannot have more than 2**64 - 1 (max value of uint64) of supply.
*
* Assumes that the maximum token id cannot exceed 2**256 - 1 (max value of uint256).
*/
contract ERC721A is Context, ERC165, IERC721A {
using Address for address;
using Strings for uint256;
// The tokenId of the next token to be minted.
uint256 internal _currentIndex;
// The number of tokens burned.
uint256 internal _burnCounter;
// Token name
string private _name;
// Token symbol
string private _symbol;
// Mapping from token ID to ownership details
// An empty struct value does not necessarily mean the token is unowned. See _ownershipOf implementation for details.
mapping(uint256 => TokenOwnership) internal _ownerships;
// Mapping owner address to address data
mapping(address => AddressData) private _addressData;
// Mapping from token ID to approved address
mapping(uint256 => address) private _tokenApprovals;
// Mapping from owner to operator approvals
mapping(address => mapping(address => bool)) private _operatorApprovals;
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
_currentIndex = _startTokenId();
}
/**
* To change the starting tokenId, please override this function.
*/
function _startTokenId() internal view virtual returns (uint256) {
return 0;
}
/**
* @dev Burned tokens are calculated here, use _totalMinted() if you want to count just minted tokens.
*/
function totalSupply() public view override returns (uint256) {
// Counter underflow is impossible as _burnCounter cannot be incremented
// more than _currentIndex - _startTokenId() times
unchecked {
return _currentIndex - _burnCounter - _startTokenId();
}
}
/**
* Returns the total amount of tokens minted in the contract.
*/
function _totalMinted() internal view returns (uint256) {
// Counter underflow is impossible as _currentIndex does not decrement,
// and it is initialized to _startTokenId()
unchecked {
return _currentIndex - _startTokenId();
}
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return
interfaceId == type(IERC721).interfaceId ||
interfaceId == type(IERC721Metadata).interfaceId ||
super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC721-balanceOf}.
*/
function balanceOf(address owner) public view override returns (uint256) {
if (owner == address(0)) revert BalanceQueryForZeroAddress();
return uint256(_addressData[owner].balance);
}
/**
* Returns the number of tokens minted by `owner`.
*/
function _numberMinted(address owner) internal view returns (uint256) {
return uint256(_addressData[owner].numberMinted);
}
/**
* Returns the number of tokens burned by or on behalf of `owner`.
*/
function _numberBurned(address owner) internal view returns (uint256) {
return uint256(_addressData[owner].numberBurned);
}
/**
* Returns the auxillary data for `owner`. (e.g. number of whitelist mint slots used).
*/
function _getAux(address owner) internal view returns (uint64) {
return _addressData[owner].aux;
}
/**
* Sets the auxillary data for `owner`. (e.g. number of whitelist mint slots used).
* If there are multiple variables, please pack them into a uint64.
*/
function _setAux(address owner, uint64 aux) internal {
_addressData[owner].aux = aux;
}
/**
* Gas spent here starts off proportional to the maximum mint batch size.
* It gradually moves to O(1) as tokens get transferred around in the collection over time.
*/
function _ownershipOf(uint256 tokenId) internal view returns (TokenOwnership memory) {
uint256 curr = tokenId;
unchecked {
if (_startTokenId() <= curr) if (curr < _currentIndex) {
TokenOwnership memory ownership = _ownerships[curr];
if (!ownership.burned) {
if (ownership.addr != address(0)) {
return ownership;
}
// Invariant:
// There will always be an ownership that has an address and is not burned
// before an ownership that does not have an address and is not burned.
// Hence, curr will not underflow.
while (true) {
curr--;
ownership = _ownerships[curr];
if (ownership.addr != address(0)) {
return ownership;
}
}
}
}
}
revert OwnerQueryForNonexistentToken();
}
/**
* @dev See {IERC721-ownerOf}.
*/
function ownerOf(uint256 tokenId) public view override returns (address) {
return _ownershipOf(tokenId).addr;
}
/**
* @dev See {IERC721Metadata-name}.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev See {IERC721Metadata-symbol}.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev See {IERC721Metadata-tokenURI}.
*/
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
if (!_exists(tokenId)) revert URIQueryForNonexistentToken();
string memory baseURI = _baseURI();
return bytes(baseURI).length != 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : '';
}
/**
* @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
* token will be the concatenation of the `baseURI` and the `tokenId`. Empty
* by default, can be overriden in child contracts.
*/
function _baseURI() internal view virtual returns (string memory) {
return '';
}
/**
* @dev See {IERC721-approve}.
*/
function approve(address to, uint256 tokenId) public override {
address owner = ERC721A.ownerOf(tokenId);
if (to == owner) revert ApprovalToCurrentOwner();
if (_msgSender() != owner) if(!isApprovedForAll(owner, _msgSender())) {
revert ApprovalCallerNotOwnerNorApproved();
}
_approve(to, tokenId, owner);
}
/**
* @dev See {IERC721-getApproved}.
*/
function getApproved(uint256 tokenId) public view override returns (address) {
if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken();
return _tokenApprovals[tokenId];
}
/**
* @dev See {IERC721-setApprovalForAll}.
*/
function setApprovalForAll(address operator, bool approved) public virtual override {
if (operator == _msgSender()) revert ApproveToCaller();
_operatorApprovals[_msgSender()][operator] = approved;
emit ApprovalForAll(_msgSender(), operator, approved);
}
/**
* @dev See {IERC721-isApprovedForAll}.
*/
function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
return _operatorApprovals[owner][operator];
}
/**
* @dev See {IERC721-transferFrom}.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
_transfer(from, to, tokenId);
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
safeTransferFrom(from, to, tokenId, '');
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory _data
) public virtual override {
_transfer(from, to, tokenId);
if (to.isContract()) if(!_checkContractOnERC721Received(from, to, tokenId, _data)) {
revert TransferToNonERC721ReceiverImplementer();
}
}
/**
* @dev Returns whether `tokenId` exists.
*
* Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
*
* Tokens start existing when they are minted (`_mint`),
*/
function _exists(uint256 tokenId) internal view returns (bool) {
return _startTokenId() <= tokenId && tokenId < _currentIndex && !_ownerships[tokenId].burned;
}
/**
* @dev Equivalent to `_safeMint(to, quantity, '')`.
*/
function _safeMint(address to, uint256 quantity) internal {
_safeMint(to, quantity, '');
}
/**
* @dev Safely mints `quantity` tokens and transfers them to `to`.
*
* Requirements:
*
* - If `to` refers to a smart contract, it must implement
* {IERC721Receiver-onERC721Received}, which is called for each safe transfer.
* - `quantity` must be greater than 0.
*
* Emits a {Transfer} event.
*/
function _safeMint(
address to,
uint256 quantity,
bytes memory _data
) internal {
uint256 startTokenId = _currentIndex;
if (to == address(0)) revert MintToZeroAddress();
if (quantity == 0) revert MintZeroQuantity();
_beforeTokenTransfers(address(0), to, startTokenId, quantity);
// Overflows are incredibly unrealistic.
// balance or numberMinted overflow if current value of either + quantity > 1.8e19 (2**64) - 1
// updatedIndex overflows if _currentIndex + quantity > 1.2e77 (2**256) - 1
unchecked {
_addressData[to].balance += uint64(quantity);
_addressData[to].numberMinted += uint64(quantity);
_ownerships[startTokenId].addr = to;
_ownerships[startTokenId].startTimestamp = uint64(block.timestamp);
uint256 updatedIndex = startTokenId;
uint256 end = updatedIndex + quantity;
if (to.isContract()) {
do {
emit Transfer(address(0), to, updatedIndex);
if (!_checkContractOnERC721Received(address(0), to, updatedIndex++, _data)) {
revert TransferToNonERC721ReceiverImplementer();
}
} while (updatedIndex < end);
// Reentrancy protection
if (_currentIndex != startTokenId) revert();
} else {
do {
emit Transfer(address(0), to, updatedIndex++);
} while (updatedIndex < end);
}
_currentIndex = updatedIndex;
}
_afterTokenTransfers(address(0), to, startTokenId, quantity);
}
/**
* @dev Mints `quantity` tokens and transfers them to `to`.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `quantity` must be greater than 0.
*
* Emits a {Transfer} event.
*/
function _mint(address to, uint256 quantity) internal {
uint256 startTokenId = _currentIndex;
if (to == address(0)) revert MintToZeroAddress();
if (quantity == 0) revert MintZeroQuantity();
_beforeTokenTransfers(address(0), to, startTokenId, quantity);
// Overflows are incredibly unrealistic.
// balance or numberMinted overflow if current value of either + quantity > 1.8e19 (2**64) - 1
// updatedIndex overflows if _currentIndex + quantity > 1.2e77 (2**256) - 1
unchecked {
_addressData[to].balance += uint64(quantity);
_addressData[to].numberMinted += uint64(quantity);
_ownerships[startTokenId].addr = to;
_ownerships[startTokenId].startTimestamp = uint64(block.timestamp);
uint256 updatedIndex = startTokenId;
uint256 end = updatedIndex + quantity;
do {
emit Transfer(address(0), to, updatedIndex++);
} while (updatedIndex < end);
_currentIndex = updatedIndex;
}
_afterTokenTransfers(address(0), to, startTokenId, quantity);
}
/**
* @dev Transfers `tokenId` from `from` to `to`.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
*
* Emits a {Transfer} event.
*/
function _transfer(
address from,
address to,
uint256 tokenId
) private {
TokenOwnership memory prevOwnership = _ownershipOf(tokenId);
if (prevOwnership.addr != from) revert TransferFromIncorrectOwner();
bool isApprovedOrOwner = (_msgSender() == from ||
isApprovedForAll(from, _msgSender()) ||
getApproved(tokenId) == _msgSender());
if (!isApprovedOrOwner) revert TransferCallerNotOwnerNorApproved();
if (to == address(0)) revert TransferToZeroAddress();
_beforeTokenTransfers(from, to, tokenId, 1);
// Clear approvals from the previous owner
_approve(address(0), tokenId, from);
// Underflow of the sender's balance is impossible because we check for
// ownership above and the recipient's balance can't realistically overflow.
// Counter overflow is incredibly unrealistic as tokenId would have to be 2**256.
unchecked {
_addressData[from].balance -= 1;
_addressData[to].balance += 1;
TokenOwnership storage currSlot = _ownerships[tokenId];
currSlot.addr = to;
currSlot.startTimestamp = uint64(block.timestamp);
// If the ownership slot of tokenId+1 is not explicitly set, that means the transfer initiator owns it.
// Set the slot of tokenId+1 explicitly in storage to maintain correctness for ownerOf(tokenId+1) calls.
uint256 nextTokenId = tokenId + 1;
TokenOwnership storage nextSlot = _ownerships[nextTokenId];
if (nextSlot.addr == address(0)) {
// This will suffice for checking _exists(nextTokenId),
// as a burned slot cannot contain the zero address.
if (nextTokenId != _currentIndex) {
nextSlot.addr = from;
nextSlot.startTimestamp = prevOwnership.startTimestamp;
}
}
}
emit Transfer(from, to, tokenId);
_afterTokenTransfers(from, to, tokenId, 1);
}
/**
* @dev Equivalent to `_burn(tokenId, false)`.
*/
function _burn(uint256 tokenId) internal virtual {
_burn(tokenId, false);
}
/**
* @dev Destroys `tokenId`.
* The approval is cleared when the token is burned.
*
* Requirements:
*
* - `tokenId` must exist.
*
* Emits a {Transfer} event.
*/
function _burn(uint256 tokenId, bool approvalCheck) internal virtual {
TokenOwnership memory prevOwnership = _ownershipOf(tokenId);
address from = prevOwnership.addr;
if (approvalCheck) {
bool isApprovedOrOwner = (_msgSender() == from ||
isApprovedForAll(from, _msgSender()) ||
getApproved(tokenId) == _msgSender());
if (!isApprovedOrOwner) revert TransferCallerNotOwnerNorApproved();
}
_beforeTokenTransfers(from, address(0), tokenId, 1);
// Clear approvals from the previous owner
_approve(address(0), tokenId, from);
// Underflow of the sender's balance is impossible because we check for
// ownership above and the recipient's balance can't realistically overflow.
// Counter overflow is incredibly unrealistic as tokenId would have to be 2**256.
unchecked {
AddressData storage addressData = _addressData[from];
addressData.balance -= 1;
addressData.numberBurned += 1;
// Keep track of who burned the token, and the timestamp of burning.
TokenOwnership storage currSlot = _ownerships[tokenId];
currSlot.addr = from;
currSlot.startTimestamp = uint64(block.timestamp);
currSlot.burned = true;
// If the ownership slot of tokenId+1 is not explicitly set, that means the burn initiator owns it.
// Set the slot of tokenId+1 explicitly in storage to maintain correctness for ownerOf(tokenId+1) calls.
uint256 nextTokenId = tokenId + 1;
TokenOwnership storage nextSlot = _ownerships[nextTokenId];
if (nextSlot.addr == address(0)) {
// This will suffice for checking _exists(nextTokenId),
// as a burned slot cannot contain the zero address.
if (nextTokenId != _currentIndex) {
nextSlot.addr = from;
nextSlot.startTimestamp = prevOwnership.startTimestamp;
}
}
}
emit Transfer(from, address(0), tokenId);
_afterTokenTransfers(from, address(0), tokenId, 1);
// Overflow not possible, as _burnCounter cannot be exceed _currentIndex times.
unchecked {
_burnCounter++;
}
}
/**
* @dev Approve `to` to operate on `tokenId`
*
* Emits a {Approval} event.
*/
function _approve(
address to,
uint256 tokenId,
address owner
) private {
_tokenApprovals[tokenId] = to;
emit Approval(owner, to, tokenId);
}
/**
* @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target contract.
*
* @param from address representing the previous owner of the given token ID
* @param to target address that will receive the tokens
* @param tokenId uint256 ID of the token to be transferred
* @param _data bytes optional data to send along with the call
* @return bool whether the call correctly returned the expected magic value
*/
function _checkContractOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory _data
) private returns (bool) {
try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
return retval == IERC721Receiver(to).onERC721Received.selector;
} catch (bytes memory reason) {
if (reason.length == 0) {
revert TransferToNonERC721ReceiverImplementer();
} else {
assembly {
revert(add(32, reason), mload(reason))
}
}
}
}
/**
* @dev Hook that is called before a set of serially-ordered token ids are about to be transferred. This includes minting.
* And also called before burning one token.
*
* startTokenId - the first token id to be transferred
* quantity - the amount to be transferred
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, `from`'s `tokenId` will be
* transferred to `to`.
* - When `from` is zero, `tokenId` will be minted for `to`.
* - When `to` is zero, `tokenId` will be burned by `from`.
* - `from` and `to` are never both zero.
*/
function _beforeTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
) internal virtual {}
/**
* @dev Hook that is called after a set of serially-ordered token ids have been transferred. This includes
* minting.
* And also called after one token has been burned.
*
* startTokenId - the first token id to be transferred
* quantity - the amount to be transferred
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, `from`'s `tokenId` has been
* transferred to `to`.
* - When `from` is zero, `tokenId` has been minted for `to`.
* - When `to` is zero, `tokenId` has been burned by `from`.
* - `from` and `to` are never both zero.
*/
function _afterTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
) internal virtual {}
}// SPDX-License-Identifier: MIT
/***
* .';:c:,.
* ;0NNNNNNX. lNNNNNNK; .XNNNNN. .:d0XWWWWWWWWXOo'
* lXWWWWWWWWO XWWWWWWWWO. :WWWWWK ;0WWWWWWWWWWWWWWWWWK,
* .dNWWWWWWWWWWc ,WWWWWWWWWWNo kWWWWWo .0WWWWWNkc,...;oXWWXxc.
* ,kWWWWWWXWWWWWW. dWWWWWXNWWWWWX; .NWWWWW. KWWWWW0. ;.
* :KWWWWWNd.lWWWWWO XWWWWW:.xWWWWWWOdWWWWW0 cWWWWWW.
* lXWWWWWXl. 0WWWWW: ,WWWWWN '0WWWWWWWWWWWl oWWWWWW; :,
* .dNWWWWW0; 'WWWWWN. xWWWWWx :XWWWWWWWWW. .NWWWWWWkc,'';ckNWWNOc.
* 'kWWWWWWx' oWWWWWk NWWWWW, oWWWWWWW0 '0WWWWWWWWWWWWWWWWWO;
* .d000000o. k00000; ,00000k .x00000: .lkKNWWWWWWNKko;.
* .,;;'.
*/
pragma solidity ^0.8.15;
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "./FeeSplitter.sol";
abstract contract ANCStake is Ownable{
struct TwoWeekInfo{
uint96 tokensEvenWeek;
uint32 totalSharesEvenWeek;
uint96 tokensOddWeek;
uint32 totalSharesOddWeek;
}
uint256 public constant MAX_STAKING_DURATION = 52;
uint256 public constant ONE_WEEK = 604800; // 1 week = 604800
uint256 public tenthPercentPerWeek;
uint256 public stakingStart;
FeeSplitter internal _danceSplitter;
uint256 internal _reservedTokens;
mapping(uint256 => TwoWeekInfo) private _weeklyInfo;
constructor(uint256 tenthPercentPerWeek_){
tenthPercentPerWeek = tenthPercentPerWeek_;
}
modifier stakingGate(uint32 duration){
require(stakingStart > 0, "Staking has not started");
require(duration >= 1, "Minimum staking period 1 week");
require(duration <= MAX_STAKING_DURATION, "Maximum staking period 1 year");
_;
}
/* External Functions */
function payoutReward(uint256) virtual external;
function setRewardSplitter(address splitterAddress) external onlyOwner {
require(_danceSplitter == FeeSplitter(address(0)), "Splitter already set");
require(splitterAddress != address(0), "splitter cannot be 0 address");
_danceSplitter = FeeSplitter(splitterAddress);
}
function setStakingStart() external onlyOwner {
require(stakingStart == 0, "Staking has already started.");
stakingStart = block.timestamp;
}
function setTenthPercentPerWeek(uint256 tenthPercentPerWeek_) external onlyOwner {
require(tenthPercentPerWeek_ > 0, "Value must be bigger than 0");
tenthPercentPerWeek = tenthPercentPerWeek_;
}
function getFundsForWeeksLowerBound(uint256 startWeek, uint256 endWeek) external view returns(uint256){
uint256 currentWeek = getCurrentWeek();
uint256 currentFunds = getAvailableFunds();
uint256 lastUnreservedWeek = findLastUnreservedWeek(currentWeek);
uint256 fundsForWeeks = 0;
for (uint256 week = startWeek; week < lastUnreservedWeek; week++) {
fundsForWeeks += getBasePayoutForWeek(week);
}
uint256 basePayoutForWeek;
for (uint256 week = lastUnreservedWeek; week < currentWeek; week++) {
if (getSharesForWeek(week) > 0) {
basePayoutForWeek = currentFunds * tenthPercentPerWeek / 1000;
currentFunds -= basePayoutForWeek;
fundsForWeeks += basePayoutForWeek;
}
}
for (uint256 week = currentWeek; week < endWeek; week++) {
basePayoutForWeek = currentFunds * tenthPercentPerWeek / 1000;
currentFunds -= basePayoutForWeek;
fundsForWeeks += basePayoutForWeek;
}
return fundsForWeeks;
}
/* Public Functions */
function getStakedIDs(address) public view virtual returns(uint256[] memory);
function getNumStaked(address) public view virtual returns(uint256);
function getAvailableFunds() public view returns(uint256){
return _danceSplitter.balanceOf(address(this)) - _reservedTokens;
}
function getBasePayoutForWeek(uint256 week) public view returns(uint256){
if(week & 1 == 0){
return _weeklyInfo[week].tokensEvenWeek;
}else{
return _weeklyInfo[week-1].tokensOddWeek;
}
}
function getSharesForWeek(uint256 week) public view returns(uint256){
if(week & 1 == 0){
return _weeklyInfo[week].totalSharesEvenWeek;
}else{
return _weeklyInfo[week-1].totalSharesOddWeek;
}
}
function getCurrentWeek() public view returns(uint256){
return timestamp2week(block.timestamp);
}
/* Internal Functions */
function addSharesToWeeks(uint256 startWeek, uint256 duration, uint256 amount) internal{
for (uint256 i = startWeek; i < startWeek+duration; i++) {
if(i & 1 == 0){
_weeklyInfo[i].totalSharesEvenWeek += uint32(amount);
}else{
_weeklyInfo[i-1].totalSharesOddWeek += uint32(amount);
}
}
}
function reserveAndGetTokens(uint256 balance) internal returns(uint256){
//console.log("balance:", _dance.balanceOf(address(this)));
uint256 newReserved = (balance - _reservedTokens) * tenthPercentPerWeek / 1000;
_reservedTokens += newReserved;
//console.log("reserved tokens:", _reservedTokens);
return newReserved;
}
function reserveForPastWeeks(uint256 currentWeek) internal{
// find last reserved Week
uint256 lastUnreservedWeek = findLastUnreservedWeek(currentWeek);
//console.log("current week", currentWeek);
//console.log("last unreserved week ", lastUnreservedWeek);
if (lastUnreservedWeek >= currentWeek) return;
// reserved unclaimed weeks
uint256 balance = _danceSplitter.balanceOf(address(this));
for (uint256 week = lastUnreservedWeek; week < currentWeek; week++) {
if(week & 1 == 0){
if (_weeklyInfo[week].totalSharesEvenWeek > 0) {
_weeklyInfo[week].tokensEvenWeek = uint96(reserveAndGetTokens(balance));
//console.log("tokens for week", week, _weeklyInfo[week].tokensEvenWeek);
}
} else {
if (_weeklyInfo[week-1].totalSharesOddWeek > 0) {
_weeklyInfo[week-1].tokensOddWeek = uint96(reserveAndGetTokens(balance));
//console.log("tokens for week", week, _weeklyInfo[week-1].tokensOddWeek);
}
}
}
}
function findLastUnreservedWeek(uint256 currentWeek) internal view returns(uint256){
uint256 week = currentWeek;
uint256 tokensForWeek;
while(week > 1) {
week -= 1;
if(week & 1 == 0){
tokensForWeek = _weeklyInfo[week].tokensEvenWeek;
} else {
tokensForWeek = _weeklyInfo[week-1].tokensOddWeek;
}
if (tokensForWeek > 0) return week+1;
}
return 0;
}
function getStakingReward(
uint256 stakingStartWeek,
uint256 currentWeek,
uint256 duration,
uint256 paidDuration,
uint256 shares
) internal view returns(uint256){
if (stakingStartWeek + paidDuration >= currentWeek) return 0; // no weeks to pay out
return _getStakingReward(stakingStartWeek+paidDuration, min(currentWeek, stakingStartWeek+duration), shares);
}
function _getStakingReward(uint256 startWeek, uint256 endWeek, uint256 shares) internal view returns(uint256){
uint256 payout = 0;
uint256 weeklyShares;
for(uint256 i = startWeek; i < endWeek; i++){
if(i & 1 == 0){
weeklyShares = _weeklyInfo[i].totalSharesEvenWeek;
} else {
weeklyShares = _weeklyInfo[i-1].totalSharesOddWeek;
}
payout += (getBasePayoutForWeek(i) * shares) / weeklyShares;
}
return payout;
}
function _getAvailablePayout(uint256 startWeek, uint256 endWeek, uint256 currentWeek, uint256 shares)
internal
view
returns (uint256)
{
uint256 currentFunds = getAvailableFunds();
endWeek = min(endWeek, currentWeek);
uint256 lastUnreservedWeek = findLastUnreservedWeek(currentWeek);
uint256 payout = 0;
uint256 basePayoutForWeek;
uint256 sharesForWeek;
for (uint256 week = startWeek; week < endWeek; week++) {
sharesForWeek = getSharesForWeek(week);
if (sharesForWeek > 0) {
if (week < lastUnreservedWeek) { // week has funds reserved
basePayoutForWeek = getBasePayoutForWeek(week);
} else { // week does not have funds reserved
basePayoutForWeek = currentFunds * tenthPercentPerWeek / 1000;
currentFunds -= basePayoutForWeek;
}
payout += (basePayoutForWeek * shares) / sharesForWeek;
}
}
return payout;
}
function timestamp2week (uint256 timestamp) internal view returns(uint256) {
return ((timestamp - stakingStart) / ONE_WEEK)+1;
}
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return (a <= b) ? a : b;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
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 amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` 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 amount) 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 `amount` 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 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` 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 amount
) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
*
* Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
* presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
* need to send a transaction, and thus is not required to hold Ether at all.
*/
interface IERC20Permit {
/**
* @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
* given ``owner``'s signed approval.
*
* IMPORTANT: The same issues {IERC20-approve} has related to transaction
* ordering also apply here.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `deadline` must be a timestamp in the future.
* - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
* over the EIP712-formatted function arguments.
* - the signature must use ``owner``'s current nonce (see {nonces}).
*
* For more information on the signature format, see the
* https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
* section].
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @dev Returns the current nonce for `owner`. This value must be
* included whenever a signature is generated for {permit}.
*
* Every successful call to {permit} increases ``owner``'s nonce by one. This
* prevents a signature from being used multiple times.
*/
function nonces(address owner) external view returns (uint256);
/**
* @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
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");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
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");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
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);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
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);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
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);
}
/**
* @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}// SPDX-License-Identifier: MIT
// ERC721A Contracts v3.3.0
// Creator: Chiru Labs
pragma solidity ^0.8.4;
import '@openzeppelin/contracts/token/ERC721/IERC721.sol';
import '@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol';
/**
* @dev Interface of an ERC721A compliant contract.
*/
interface IERC721A is IERC721, IERC721Metadata {
/**
* The caller must own the token or be an approved operator.
*/
error ApprovalCallerNotOwnerNorApproved();
/**
* The token does not exist.
*/
error ApprovalQueryForNonexistentToken();
/**
* The caller cannot approve to their own address.
*/
error ApproveToCaller();
/**
* The caller cannot approve to the current owner.
*/
error ApprovalToCurrentOwner();
/**
* Cannot query the balance for the zero address.
*/
error BalanceQueryForZeroAddress();
/**
* Cannot mint to the zero address.
*/
error MintToZeroAddress();
/**
* The quantity of tokens minted must be more than zero.
*/
error MintZeroQuantity();
/**
* The token does not exist.
*/
error OwnerQueryForNonexistentToken();
/**
* The caller must own the token or be an approved operator.
*/
error TransferCallerNotOwnerNorApproved();
/**
* The token must be owned by `from`.
*/
error TransferFromIncorrectOwner();
/**
* Cannot safely transfer to a contract that does not implement the ERC721Receiver interface.
*/
error TransferToNonERC721ReceiverImplementer();
/**
* Cannot transfer to the zero address.
*/
error TransferToZeroAddress();
/**
* The token does not exist.
*/
error URIQueryForNonexistentToken();
// Compiler will pack this into a single 256bit word.
struct TokenOwnership {
// The address of the owner.
address addr;
// Keeps track of the start time of ownership with minimal overhead for tokenomics.
uint64 startTimestamp;
// Whether the token has been burned.
bool burned;
}
// Compiler will pack this into a single 256bit word.
struct AddressData {
// Realistically, 2**64-1 is more than enough.
uint64 balance;
// Keeps track of mint count with minimal overhead for tokenomics.
uint64 numberMinted;
// Keeps track of burn count with minimal overhead for tokenomics.
uint64 numberBurned;
// For miscellaneous variable(s) pertaining to the address
// (e.g. number of whitelist mint slots used).
// If there are multiple variables, please pack them into a uint64.
uint64 aux;
}
/**
* @dev Returns the total amount of tokens stored by the contract.
*
* Burned tokens are calculated here, use `_totalMinted()` if you want to count just minted tokens.
*/
function totalSupply() external view returns (uint256);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @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;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
uint8 private constant _ADDRESS_LENGTH = 20;
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
// Inspired by OraclizeAPI's implementation - MIT licence
// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0x00";
}
uint256 temp = value;
uint256 length = 0;
while (temp != 0) {
length++;
temp >>= 8;
}
return toHexString(value, length);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
/**
* @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
*/
function toHexString(address addr) internal pure returns (string memory) {
return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
pragma solidity ^0.8.0;
import "./IERC165.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol)
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721 is IERC165 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external;
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool _approved) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)
pragma solidity ^0.8.0;
import "../IERC721.sol";
/**
* @title ERC-721 Non-Fungible Token Standard, optional metadata extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Metadata is IERC721 {
/**
* @dev Returns the token collection name.
*/
function name() external view returns (string memory);
/**
* @dev Returns the token collection symbol.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
*/
function tokenURI(uint256 tokenId) external view returns (string memory);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* 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[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../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.
*
* By default, the owner account will be the one that deploys the contract. 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;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @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 {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing 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 {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_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
pragma solidity ^0.8.15;
interface FeeSplitter {
function proxySend(address to, uint256 amount) external;
function balanceOf(address account) external view returns (uint256);
}{
"optimizer": {
"enabled": true,
"runs": 100
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"uint256","name":"percentPerWeek","type":"uint256"},{"internalType":"address","name":"nftTokenAddress","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[],"name":"MAX_STAKING_DURATION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ONE_WEEK","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAvailableFunds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"address_","type":"address"},{"internalType":"uint256","name":"tokenId_","type":"uint256"}],"name":"getAvailablePayout","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"week","type":"uint256"}],"name":"getBasePayoutForWeek","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCurrentWeek","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"startWeek","type":"uint256"},{"internalType":"uint256","name":"endWeek","type":"uint256"}],"name":"getFundsForWeeksLowerBound","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"address_","type":"address"}],"name":"getIDsDoneStaking","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"address_","type":"address"}],"name":"getNumStaked","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"stakingDuration","type":"uint32"}],"name":"getShares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"week","type":"uint256"}],"name":"getSharesForWeek","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"address_","type":"address"},{"internalType":"uint256","name":"tokenId_","type":"uint256"}],"name":"getStakeInfo","outputs":[{"components":[{"internalType":"uint128","name":"stakingStartWeek","type":"uint128"},{"internalType":"uint32","name":"stakingDuration","type":"uint32"},{"internalType":"uint32","name":"paidDuration","type":"uint32"}],"internalType":"struct ANCApeStake.StakedApe","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"address_","type":"address"}],"name":"getStakedIDs","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIDs","type":"uint256[]"}],"name":"multiPayoutRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIDs","type":"uint256[]"},{"internalType":"uint32","name":"stakingDuration","type":"uint32"}],"name":"multiStake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIDs","type":"uint256[]"}],"name":"multiUnstake","outputs":[],"stateMutability":"nonpayable","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":"pure","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"payoutReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"splitterAddress","type":"address"}],"name":"setRewardSplitter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"setStakingStart","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tenthPercentPerWeek_","type":"uint256"}],"name":"setTenthPercentPerWeek","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint32","name":"stakingDuration","type":"uint32"}],"name":"stake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stakingStart","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tenthPercentPerWeek","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"unstake","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
60806040523480156200001157600080fd5b50604051620027c6380380620027c68339810160408190526200003491620000ba565b8162000040336200006a565b600155600680546001600160a01b0319166001600160a01b039290921691909117905550620000f9565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60008060408385031215620000ce57600080fd5b825160208401519092506001600160a01b0381168114620000ee57600080fd5b809150509250929050565b6126bd80620001096000396000f3fe608060405234801561001057600080fd5b50600436106101845760003560e01c806398d92aa9116100d9578063d6c5693611610087578063d6c5693614610348578063d771b0a61461035b578063eb76339814610364578063f15ff12714610377578063f2fde38b1461038a578063f96690b51461039d578063fd0b37b3146103b057600080fd5b806398d92aa9146102e35780639a794e66146102f65780639dcb6c8714610309578063a1ec3eac1461031c578063abcfd96414610324578063bc57b45e14610337578063bfa17ace1461033f57600080fd5b80635c7fd297116101365780635c7fd2971461026a5780636eb227ce1461028a578063715018a61461029257806378a96cc01461029a5780637f5bf03c146102ad5780638da5cb5b146102c05780638e6f6b77146102d957600080fd5b8063150b7a02146101895780632e17de78146101ba5780633b521efe146101cf57806345d0ba841461021b5780634e6311ba1461022e5780635195bd291461024f578063596be7cd14610257575b600080fd5b61019c610197366004612142565b6103c3565b6040516001600160e01b031990911681526020015b60405180910390f35b6101cd6101c83660046121dd565b6103ee565b005b6101e26101dd3660046121f6565b6105a9565b6040805182516001600160801b0316815260208084015163ffffffff9081169183019190915292820151909216908201526060016101b1565b6101cd610229366004612280565b610623565b61024161023c3660046122d4565b610863565b6040519081526020016101b1565b610241610981565b6101cd6102653660046121dd565b610a06565b61027d6102783660046122f6565b610c24565b6040516101b19190612311565b610241610d7c565b6101cd610d87565b6101cd6102a8366004612355565b610d9b565b61027d6102bb3660046122f6565b610f17565b6000546001600160a01b03166040516101b19190612381565b61024162093a8081565b6101cd6102f13660046122f6565b611105565b6101cd610304366004612395565b6111d5565b6102416103173660046121f6565b611469565b610241603481565b6102416103323660046122f6565b61153c565b6101cd61161e565b61024160015481565b6101cd6103563660046121dd565b61167c565b61024160025481565b6102416103723660046123d7565b6116d9565b6102416103853660046121dd565b61174c565b6101cd6103983660046122f6565b6117b0565b6102416103ab3660046121dd565b611829565b6101cd6103be366004612395565b611889565b7f150b7a023d4804d13e8c85fb27262cb750cf6ba9f9dd3bb30d90f482ceeb4b1f5b95945050505050565b60006103f8610d7c565b905061040381611a5b565b336000908152600760209081526040808320858452825291829020825160608101845290546001600160801b03811680835263ffffffff600160801b83048116948401859052600160a01b90920490911693820193909352916104669084612408565b101561048d5760405162461bcd60e51b81526004016104849061241f565b60405180910390fd5b60006104998383611bf1565b905080600460008282546104ad9190612408565b90915550503360008181526007602090815260408083208884529091529081902080546001600160c01b03191690556006549051632142170760e11b81526001600160a01b03909116916342842e0e9161050d9130918990600401612450565b600060405180830381600087803b15801561052757600080fd5b505af115801561053b573d6000803e3d6000fd5b5050600354604051637e90cb8960e11b81526001600160a01b03909116925063fd21971291506105719033908590600401612474565b600060405180830381600087803b15801561058b57600080fd5b505af115801561059f573d6000803e3d6000fd5b5050505050505050565b6040805160608082018352600080835260208084018290529284018190526001600160a01b038616815260078352838120858252835283902083519182018452546001600160801b038116825263ffffffff600160801b8204811693830193909352600160a01b9004909116918101919091525b92915050565b806000600254116106465760405162461bcd60e51b81526004016104849061248d565b60018163ffffffff16101561066d5760405162461bcd60e51b8152600401610484906124be565b60348163ffffffff1611156106945760405162461bcd60e51b8152600401610484906124f5565b826106b15760405162461bcd60e51b81526004016104849061252c565b60148311156107025760405162461bcd60e51b815260206004820181905260248201527f43616e2774207374616b65206d6f7265207468616e203230206174206f6e63656044820152606401610484565b600061070c610d7c565b90506000805b858110156108365786868281811061072c5761072c612558565b600654604051632142170760e11b81526020909202939093013594506001600160a01b03909216916342842e0e915061076d90339030908790600401612450565b600060405180830381600087803b15801561078757600080fd5b505af115801561079b573d6000803e3d6000fd5b5050604080516060810182526001600160801b03878116825263ffffffff8a811660208085019182526000858701818152338252600783528782208c835290925295909520935184549151955193166001600160a01b031990911617600160801b948216949094029390931763ffffffff60a01b1916600160a01b91909316029190911790555081905061082e8161256e565b915050610712565b5061085b8263ffffffff86168761084c886116d9565b6108569190612587565b611c89565b505050505050565b60008061086e610d7c565b9050600061087a610981565b9050600061088783611d66565b90506000865b828110156108bc5761089e8161174c565b6108a890836125a6565b9150806108b48161256e565b91505061088d565b506000825b858110156109225760006108d482611829565b1115610910576103e8600154866108eb9190612587565b6108f591906125be565b91506109018286612408565b945061090d82846125a6565b92505b8061091a8161256e565b9150506108c1565b50845b87811015610974576103e86001548661093e9190612587565b61094891906125be565b91506109548286612408565b945061096082846125a6565b92508061096c8161256e565b915050610925565b5090979650505050505050565b600480546003546040516370a0823160e01b81526000936001600160a01b03909216916370a08231916109b691309101612381565b602060405180830381865afa1580156109d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109f791906125e0565b610a019190612408565b905090565b6000610a10610d7c565b9050610a1b81611a5b565b336000908152600760209081526040808320858452825291829020825160608101845290546001600160801b03811680835263ffffffff600160801b83048116948401859052600160a01b9092049091169382019390935291610a7e9084612408565b10610ae85760405162461bcd60e51b815260206004820152603460248201527f5374616b696e6720706572696f64206973206f7665722c2075736520756e7374604482015273185ad948199d5b98dd1a5bdb881a5b9cdd19585960621b6064820152608401610484565b81816040015163ffffffff168260000151610b0391906125f9565b6001600160801b031610610b4e5760405162461bcd60e51b8152602060048201526012602482015271139bdd1a1a5b99c81d1bc81c185e481bdd5d60721b6044820152606401610484565b6000610b5a8383611bf1565b90508060046000828254610b6e9190612408565b90915550508151610b9c90610b8c906001600160801b031685612408565b836020015163ffffffff16611dfd565b3360009081526007602090815260408083208884529091529020805463ffffffff60a01b191661ffff92909216600160a01b0291909117905580610bf25760405162461bcd60e51b815260040161048490612624565b600354604051637e90cb8960e11b81526001600160a01b039091169063fd219712906105719033908590600401612474565b60606000600660009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610c7b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c9f91906125e0565b90506000610cac8461153c565b905060008167ffffffffffffffff811115610cc957610cc9612652565b604051908082528060200260200182016040528015610cf2578160200160208202803683370190505b5090506000805b84811015610d71576001600160a01b03871660009081526007602090815260408083208484529091529020546001600160801b031615610d5f5780838381518110610d4657610d46612558565b6020908102919091010152610d5c6001836125a6565b91505b80610d698161256e565b915050610cf9565b509095945050505050565b6000610a0142611e16565b610d8f611e3f565b610d996000611e99565b565b80600060025411610dbe5760405162461bcd60e51b81526004016104849061248d565b60018163ffffffff161015610de55760405162461bcd60e51b8152600401610484906124be565b60348163ffffffff161115610e0c5760405162461bcd60e51b8152600401610484906124f5565b600654604051632142170760e11b81526001600160a01b03909116906342842e0e90610e4090339030908890600401612450565b600060405180830381600087803b158015610e5a57600080fd5b505af1158015610e6e573d6000803e3d6000fd5b505050506000610e7c610d7c565b604080516060810182526001600160801b03808416825263ffffffff80881660208085018281526000868801818152338252600784528882208e83529093529690962094518554965191518416600160a01b0263ffffffff60a01b1992909416600160801b026001600160a01b03199097169416939093179490941791909116179055909150610f11908290610856866116d9565b50505050565b60606000610f23610d7c565b9050600080610f3185610c24565b90506000805b8251811015610fe957828181518110610f5257610f52612558565b6020908102919091018101516001600160a01b0389166000908152600783526040808220838352845290819020815160608101835290546001600160801b038116825263ffffffff600160801b8204811695830195909552600160a01b9004909316908301529250610fc49086611ee9565b15610fd757610fd46001856125a6565b93505b80610fe18161256e565b915050610f37565b5060008367ffffffffffffffff81111561100557611005612652565b60405190808252806020026020018201604052801561102e578160200160208202803683370190505b5090506000805b84518110156109745784818151811061105057611050612558565b6020908102919091018101516001600160a01b038b166000908152600783526040808220838352845290819020815160608101835290546001600160801b038116825263ffffffff600160801b8204811695830195909552600160a01b90049093169083015294506110c29088611ee9565b156110f357838383815181106110da576110da612558565b60209081029190910101526110f06001836125a6565b91505b806110fd8161256e565b915050611035565b61110d611e3f565b6003546001600160a01b03161561115d5760405162461bcd60e51b815260206004820152601460248201527314dc1b1a5d1d195c88185b1c9958591e481cd95d60621b6044820152606401610484565b6001600160a01b0381166111b35760405162461bcd60e51b815260206004820152601c60248201527f73706c69747465722063616e6e6f7420626520302061646472657373000000006044820152606401610484565b600380546001600160a01b0319166001600160a01b0392909216919091179055565b806111f25760405162461bcd60e51b81526004016104849061252c565b601481111561124e5760405162461bcd60e51b815260206004820152602260248201527f43616e277420756e7374616b65206d6f7265207468616e203230206174206f6e604482015261636560f01b6064820152608401610484565b6000611258610d7c565b905061126381611a5b565b60408051606081018252600080825260208201819052918101829052819060005b858110156113e55786868281811061129e5761129e612558565b336000908152600760209081526040808320938202959095013580835292815290849020845160608101865290546001600160801b03811680835263ffffffff600160801b83048116948401859052600160a01b9092049091169582019590955291965090945091611311915087612408565b101561132f5760405162461bcd60e51b81526004016104849061241f565b6113398583611bf1565b61134390856125a6565b3360008181526007602090815260408083208884529091529081902080546001600160c01b03191690556006549051632142170760e11b81529296506001600160a01b0316916342842e0e916113a0913091908890600401612450565b600060405180830381600087803b1580156113ba57600080fd5b505af11580156113ce573d6000803e3d6000fd5b5050505080806113dd9061256e565b915050611284565b5082600460008282546113f89190612408565b9091555050600354604051637e90cb8960e11b81526001600160a01b039091169063fd2197129061142f9033908790600401612474565b600060405180830381600087803b15801561144957600080fd5b505af115801561145d573d6000803e3d6000fd5b50505050505050505050565b600080611474610d7c565b6001600160a01b03851660009081526007602090815260408083208784528252808320815160608101835290546001600160801b03811680835263ffffffff600160801b83048116958401869052600160a01b909204909116928201929092529394506114e191906125f9565b6001600160801b031690506000826040015163ffffffff16836000015161150891906125f9565b6001600160801b03169050600061152284602001516116d9565b905061153082848784611f32565b98975050505050505050565b600080600660009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611592573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115b691906125e0565b90506000805b82811015611616576001600160a01b03851660009081526007602090815260408083208484529091529020546001600160801b031615611604576116016001836125a6565b91505b8061160e8161256e565b9150506115bc565b509392505050565b611626611e3f565b600254156116765760405162461bcd60e51b815260206004820152601c60248201527f5374616b696e672068617320616c726561647920737461727465642e000000006044820152606401610484565b42600255565b611684611e3f565b600081116116d45760405162461bcd60e51b815260206004820152601b60248201527f56616c7565206d75737420626520626967676572207468616e203000000000006044820152606401610484565b600155565b600063ffffffff821660328260346116f284601e612587565b6116fc91906125be565b9050600061170b603480612587565b84611717816014612587565b6117219190612587565b61172b91906125be565b90508061173883856125a6565b61174291906125a6565b9695505050505050565b60008160011660000361177557506000908152600560205260409020546001600160601b031690565b60056000611784600185612408565b8152602081019190915260400160002054600160801b90046001600160601b031692915050565b919050565b6117b8611e3f565b6001600160a01b03811661181d5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610484565b61182681611e99565b50565b6000816001166000036118565750600090815260056020526040902054600160601b900463ffffffff1690565b60056000611865600185612408565b8152602081019190915260400160002054600160e01b900463ffffffff1692915050565b6000611893610d7c565b905061189e81611a5b565b60408051606081018252600080825260208201819052918101829052819060005b858110156119f4578686828181106118d9576118d9612558565b336000908152600760209081526040808320938202959095013580835292815290849020845160608101865290546001600160801b038116825263ffffffff600160801b8204811693830193909352600160a01b900490911693810193909352945090925061194a90508286611ee9565b6119e25784826040015163ffffffff16836000015161196991906125f9565b6001600160801b031610156119e2576119828583611bf1565b61198c90856125a6565b82519094506119a890610b8c906001600160801b031687612408565b3360009081526007602090815260408083208784529091529020805463ffffffff60a01b191661ffff92909216600160a01b029190911790555b806119ec8161256e565b9150506118bf565b508260046000828254611a079190612408565b909155505082611a295760405162461bcd60e51b815260040161048490612624565b600354604051637e90cb8960e11b81526001600160a01b039091169063fd2197129061142f9033908790600401612474565b6000611a6682611d66565b9050818110611a73575050565b6003546040516370a0823160e01b81526000916001600160a01b0316906370a0823190611aa4903090600401612381565b602060405180830381865afa158015611ac1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ae591906125e0565b9050815b83811015610f115780600116600003611b5d57600081815260056020526040902054600160601b900463ffffffff1615611b5857611b2682611ffc565b600082815260056020526040902080546bffffffffffffffffffffffff19166001600160601b03929092169190911790555b611bdf565b6000600581611b6d600185612408565b8152602081019190915260400160002054600160e01b900463ffffffff161115611bdf57611b9a82611ffc565b60056000611ba9600185612408565b815260200190815260200160002060000160106101000a8154816001600160601b0302191690836001600160601b031602179055505b80611be98161256e565b915050611ae9565b80516000906001600160801b0316611c415760405162461bcd60e51b8152602060048201526013602482015272151bdad95b881a5cc81b9bdd081cdd185ad959606a1b6044820152606401610484565b6000611c8183600001516001600160801b031685856020015163ffffffff16866040015163ffffffff16611c7c886020015161ffff166116d9565b612047565b949350505050565b825b611c9583856125a6565b811015610f115780600116600003611cf85760008181526005602052604090208054839190600c90611cd5908490600160601b900463ffffffff16612668565b92506101000a81548163ffffffff021916908363ffffffff160217905550611d54565b8160056000611d08600185612408565b815260208101919091526040016000208054601c90611d35908490600160e01b900463ffffffff16612668565b92506101000a81548163ffffffff021916908363ffffffff1602179055505b80611d5e8161256e565b915050611c8b565b600081815b6001821115611df357611d7f600183612408565b915081600116600003611daa57506000818152600560205260409020546001600160601b0316611ddd565b60056000611db9600185612408565b8152602081019190915260400160002054600160801b90046001600160601b031690505b8015611dee57611c818260016125a6565b611d6b565b5060009392505050565b600081831115611e0d5781611e0f565b825b9392505050565b600062093a8060025483611e2a9190612408565b611e3491906125be565b61061d9060016125a6565b6000546001600160a01b03163314610d995760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610484565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b81516000906001600160801b03168103611f055750600061061d565b826020015163ffffffff1683600001516001600160801b031683611f299190612408565b10159392505050565b600080611f3d610981565b9050611f498585611dfd565b94506000611f5685611d66565b905060008080895b89811015611fed57611f6f81611829565b91508115611fdb5784811015611f8f57611f888161174c565b9250611fb9565b6103e860015487611fa09190612587565b611faa91906125be565b9250611fb68387612408565b95505b81611fc48985612587565b611fce91906125be565b611fd890856125a6565b93505b80611fe58161256e565b915050611f5e565b50919998505050505050505050565b6000806103e8600154600454856120139190612408565b61201d9190612587565b61202791906125be565b9050806004600082825461203b91906125a6565b90915550909392505050565b60008461205484886125a6565b10612061575060006103e5565b61174261206e84886125a6565b6120818761207c888b6125a6565b611dfd565b8460008080855b85811015610d7157806001166000036120be57600081815260056020526040902054600160601b900463ffffffff1691506120ee565b600560006120cd600184612408565b8152602081019190915260400160002054600160e01b900463ffffffff1691505b81856120f98361174c565b6121039190612587565b61210d91906125be565b61211790846125a6565b9250806121238161256e565b915050612088565b80356001600160a01b03811681146117ab57600080fd5b60008060008060006080868803121561215a57600080fd5b6121638661212b565b94506121716020870161212b565b935060408601359250606086013567ffffffffffffffff8082111561219557600080fd5b818801915088601f8301126121a957600080fd5b8135818111156121b857600080fd5b8960208285010111156121ca57600080fd5b9699959850939650602001949392505050565b6000602082840312156121ef57600080fd5b5035919050565b6000806040838503121561220957600080fd5b6122128361212b565b946020939093013593505050565b60008083601f84011261223257600080fd5b50813567ffffffffffffffff81111561224a57600080fd5b6020830191508360208260051b850101111561226557600080fd5b9250929050565b803563ffffffff811681146117ab57600080fd5b60008060006040848603121561229557600080fd5b833567ffffffffffffffff8111156122ac57600080fd5b6122b886828701612220565b90945092506122cb90506020850161226c565b90509250925092565b600080604083850312156122e757600080fd5b50508035926020909101359150565b60006020828403121561230857600080fd5b611e0f8261212b565b6020808252825182820181905260009190848201906040850190845b818110156123495783518352928401929184019160010161232d565b50909695505050505050565b6000806040838503121561236857600080fd5b823591506123786020840161226c565b90509250929050565b6001600160a01b0391909116815260200190565b600080602083850312156123a857600080fd5b823567ffffffffffffffff8111156123bf57600080fd5b6123cb85828601612220565b90969095509350505050565b6000602082840312156123e957600080fd5b611e0f8261226c565b634e487b7160e01b600052601160045260246000fd5b60008282101561241a5761241a6123f2565b500390565b60208082526017908201527629ba30b5b4b733903832b934b7b2103737ba1037bb32b960491b604082015260600190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03929092168252602082015260400190565b60208082526017908201527614dd185ada5b99c81a185cc81b9bdd081cdd185c9d1959604a1b604082015260600190565b6020808252601d908201527f4d696e696d756d207374616b696e6720706572696f642031207765656b000000604082015260600190565b6020808252601d908201527f4d6178696d756d207374616b696e6720706572696f6420312079656172000000604082015260600190565b6020808252601290820152712737903a37b5b2b71024a2399033b4bb32b760711b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b600060018201612580576125806123f2565b5060010190565b60008160001904831182151516156125a1576125a16123f2565b500290565b600082198211156125b9576125b96123f2565b500190565b6000826125db57634e487b7160e01b600052601260045260246000fd5b500490565b6000602082840312156125f257600080fd5b5051919050565b60006001600160801b0382811684821680830382111561261b5761261b6123f2565b01949350505050565b602080825260149082015273139bc81c995dd85c99081d1bc81c185e481bdd5d60621b604082015260600190565b634e487b7160e01b600052604160045260246000fd5b600063ffffffff80831681851680830382111561261b5761261b6123f256fea2646970667358221220baff4dcb48916777f1badfb36854552b66654ec33785abfc4398acf301e055c664736f6c634300080f00330000000000000000000000000000000000000000000000000000000000000014000000000000000000000000f853b0f7bc806d6067e42aeaa90d35c114adabfa
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106101845760003560e01c806398d92aa9116100d9578063d6c5693611610087578063d6c5693614610348578063d771b0a61461035b578063eb76339814610364578063f15ff12714610377578063f2fde38b1461038a578063f96690b51461039d578063fd0b37b3146103b057600080fd5b806398d92aa9146102e35780639a794e66146102f65780639dcb6c8714610309578063a1ec3eac1461031c578063abcfd96414610324578063bc57b45e14610337578063bfa17ace1461033f57600080fd5b80635c7fd297116101365780635c7fd2971461026a5780636eb227ce1461028a578063715018a61461029257806378a96cc01461029a5780637f5bf03c146102ad5780638da5cb5b146102c05780638e6f6b77146102d957600080fd5b8063150b7a02146101895780632e17de78146101ba5780633b521efe146101cf57806345d0ba841461021b5780634e6311ba1461022e5780635195bd291461024f578063596be7cd14610257575b600080fd5b61019c610197366004612142565b6103c3565b6040516001600160e01b031990911681526020015b60405180910390f35b6101cd6101c83660046121dd565b6103ee565b005b6101e26101dd3660046121f6565b6105a9565b6040805182516001600160801b0316815260208084015163ffffffff9081169183019190915292820151909216908201526060016101b1565b6101cd610229366004612280565b610623565b61024161023c3660046122d4565b610863565b6040519081526020016101b1565b610241610981565b6101cd6102653660046121dd565b610a06565b61027d6102783660046122f6565b610c24565b6040516101b19190612311565b610241610d7c565b6101cd610d87565b6101cd6102a8366004612355565b610d9b565b61027d6102bb3660046122f6565b610f17565b6000546001600160a01b03166040516101b19190612381565b61024162093a8081565b6101cd6102f13660046122f6565b611105565b6101cd610304366004612395565b6111d5565b6102416103173660046121f6565b611469565b610241603481565b6102416103323660046122f6565b61153c565b6101cd61161e565b61024160015481565b6101cd6103563660046121dd565b61167c565b61024160025481565b6102416103723660046123d7565b6116d9565b6102416103853660046121dd565b61174c565b6101cd6103983660046122f6565b6117b0565b6102416103ab3660046121dd565b611829565b6101cd6103be366004612395565b611889565b7f150b7a023d4804d13e8c85fb27262cb750cf6ba9f9dd3bb30d90f482ceeb4b1f5b95945050505050565b60006103f8610d7c565b905061040381611a5b565b336000908152600760209081526040808320858452825291829020825160608101845290546001600160801b03811680835263ffffffff600160801b83048116948401859052600160a01b90920490911693820193909352916104669084612408565b101561048d5760405162461bcd60e51b81526004016104849061241f565b60405180910390fd5b60006104998383611bf1565b905080600460008282546104ad9190612408565b90915550503360008181526007602090815260408083208884529091529081902080546001600160c01b03191690556006549051632142170760e11b81526001600160a01b03909116916342842e0e9161050d9130918990600401612450565b600060405180830381600087803b15801561052757600080fd5b505af115801561053b573d6000803e3d6000fd5b5050600354604051637e90cb8960e11b81526001600160a01b03909116925063fd21971291506105719033908590600401612474565b600060405180830381600087803b15801561058b57600080fd5b505af115801561059f573d6000803e3d6000fd5b5050505050505050565b6040805160608082018352600080835260208084018290529284018190526001600160a01b038616815260078352838120858252835283902083519182018452546001600160801b038116825263ffffffff600160801b8204811693830193909352600160a01b9004909116918101919091525b92915050565b806000600254116106465760405162461bcd60e51b81526004016104849061248d565b60018163ffffffff16101561066d5760405162461bcd60e51b8152600401610484906124be565b60348163ffffffff1611156106945760405162461bcd60e51b8152600401610484906124f5565b826106b15760405162461bcd60e51b81526004016104849061252c565b60148311156107025760405162461bcd60e51b815260206004820181905260248201527f43616e2774207374616b65206d6f7265207468616e203230206174206f6e63656044820152606401610484565b600061070c610d7c565b90506000805b858110156108365786868281811061072c5761072c612558565b600654604051632142170760e11b81526020909202939093013594506001600160a01b03909216916342842e0e915061076d90339030908790600401612450565b600060405180830381600087803b15801561078757600080fd5b505af115801561079b573d6000803e3d6000fd5b5050604080516060810182526001600160801b03878116825263ffffffff8a811660208085019182526000858701818152338252600783528782208c835290925295909520935184549151955193166001600160a01b031990911617600160801b948216949094029390931763ffffffff60a01b1916600160a01b91909316029190911790555081905061082e8161256e565b915050610712565b5061085b8263ffffffff86168761084c886116d9565b6108569190612587565b611c89565b505050505050565b60008061086e610d7c565b9050600061087a610981565b9050600061088783611d66565b90506000865b828110156108bc5761089e8161174c565b6108a890836125a6565b9150806108b48161256e565b91505061088d565b506000825b858110156109225760006108d482611829565b1115610910576103e8600154866108eb9190612587565b6108f591906125be565b91506109018286612408565b945061090d82846125a6565b92505b8061091a8161256e565b9150506108c1565b50845b87811015610974576103e86001548661093e9190612587565b61094891906125be565b91506109548286612408565b945061096082846125a6565b92508061096c8161256e565b915050610925565b5090979650505050505050565b600480546003546040516370a0823160e01b81526000936001600160a01b03909216916370a08231916109b691309101612381565b602060405180830381865afa1580156109d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109f791906125e0565b610a019190612408565b905090565b6000610a10610d7c565b9050610a1b81611a5b565b336000908152600760209081526040808320858452825291829020825160608101845290546001600160801b03811680835263ffffffff600160801b83048116948401859052600160a01b9092049091169382019390935291610a7e9084612408565b10610ae85760405162461bcd60e51b815260206004820152603460248201527f5374616b696e6720706572696f64206973206f7665722c2075736520756e7374604482015273185ad948199d5b98dd1a5bdb881a5b9cdd19585960621b6064820152608401610484565b81816040015163ffffffff168260000151610b0391906125f9565b6001600160801b031610610b4e5760405162461bcd60e51b8152602060048201526012602482015271139bdd1a1a5b99c81d1bc81c185e481bdd5d60721b6044820152606401610484565b6000610b5a8383611bf1565b90508060046000828254610b6e9190612408565b90915550508151610b9c90610b8c906001600160801b031685612408565b836020015163ffffffff16611dfd565b3360009081526007602090815260408083208884529091529020805463ffffffff60a01b191661ffff92909216600160a01b0291909117905580610bf25760405162461bcd60e51b815260040161048490612624565b600354604051637e90cb8960e11b81526001600160a01b039091169063fd219712906105719033908590600401612474565b60606000600660009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610c7b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c9f91906125e0565b90506000610cac8461153c565b905060008167ffffffffffffffff811115610cc957610cc9612652565b604051908082528060200260200182016040528015610cf2578160200160208202803683370190505b5090506000805b84811015610d71576001600160a01b03871660009081526007602090815260408083208484529091529020546001600160801b031615610d5f5780838381518110610d4657610d46612558565b6020908102919091010152610d5c6001836125a6565b91505b80610d698161256e565b915050610cf9565b509095945050505050565b6000610a0142611e16565b610d8f611e3f565b610d996000611e99565b565b80600060025411610dbe5760405162461bcd60e51b81526004016104849061248d565b60018163ffffffff161015610de55760405162461bcd60e51b8152600401610484906124be565b60348163ffffffff161115610e0c5760405162461bcd60e51b8152600401610484906124f5565b600654604051632142170760e11b81526001600160a01b03909116906342842e0e90610e4090339030908890600401612450565b600060405180830381600087803b158015610e5a57600080fd5b505af1158015610e6e573d6000803e3d6000fd5b505050506000610e7c610d7c565b604080516060810182526001600160801b03808416825263ffffffff80881660208085018281526000868801818152338252600784528882208e83529093529690962094518554965191518416600160a01b0263ffffffff60a01b1992909416600160801b026001600160a01b03199097169416939093179490941791909116179055909150610f11908290610856866116d9565b50505050565b60606000610f23610d7c565b9050600080610f3185610c24565b90506000805b8251811015610fe957828181518110610f5257610f52612558565b6020908102919091018101516001600160a01b0389166000908152600783526040808220838352845290819020815160608101835290546001600160801b038116825263ffffffff600160801b8204811695830195909552600160a01b9004909316908301529250610fc49086611ee9565b15610fd757610fd46001856125a6565b93505b80610fe18161256e565b915050610f37565b5060008367ffffffffffffffff81111561100557611005612652565b60405190808252806020026020018201604052801561102e578160200160208202803683370190505b5090506000805b84518110156109745784818151811061105057611050612558565b6020908102919091018101516001600160a01b038b166000908152600783526040808220838352845290819020815160608101835290546001600160801b038116825263ffffffff600160801b8204811695830195909552600160a01b90049093169083015294506110c29088611ee9565b156110f357838383815181106110da576110da612558565b60209081029190910101526110f06001836125a6565b91505b806110fd8161256e565b915050611035565b61110d611e3f565b6003546001600160a01b03161561115d5760405162461bcd60e51b815260206004820152601460248201527314dc1b1a5d1d195c88185b1c9958591e481cd95d60621b6044820152606401610484565b6001600160a01b0381166111b35760405162461bcd60e51b815260206004820152601c60248201527f73706c69747465722063616e6e6f7420626520302061646472657373000000006044820152606401610484565b600380546001600160a01b0319166001600160a01b0392909216919091179055565b806111f25760405162461bcd60e51b81526004016104849061252c565b601481111561124e5760405162461bcd60e51b815260206004820152602260248201527f43616e277420756e7374616b65206d6f7265207468616e203230206174206f6e604482015261636560f01b6064820152608401610484565b6000611258610d7c565b905061126381611a5b565b60408051606081018252600080825260208201819052918101829052819060005b858110156113e55786868281811061129e5761129e612558565b336000908152600760209081526040808320938202959095013580835292815290849020845160608101865290546001600160801b03811680835263ffffffff600160801b83048116948401859052600160a01b9092049091169582019590955291965090945091611311915087612408565b101561132f5760405162461bcd60e51b81526004016104849061241f565b6113398583611bf1565b61134390856125a6565b3360008181526007602090815260408083208884529091529081902080546001600160c01b03191690556006549051632142170760e11b81529296506001600160a01b0316916342842e0e916113a0913091908890600401612450565b600060405180830381600087803b1580156113ba57600080fd5b505af11580156113ce573d6000803e3d6000fd5b5050505080806113dd9061256e565b915050611284565b5082600460008282546113f89190612408565b9091555050600354604051637e90cb8960e11b81526001600160a01b039091169063fd2197129061142f9033908790600401612474565b600060405180830381600087803b15801561144957600080fd5b505af115801561145d573d6000803e3d6000fd5b50505050505050505050565b600080611474610d7c565b6001600160a01b03851660009081526007602090815260408083208784528252808320815160608101835290546001600160801b03811680835263ffffffff600160801b83048116958401869052600160a01b909204909116928201929092529394506114e191906125f9565b6001600160801b031690506000826040015163ffffffff16836000015161150891906125f9565b6001600160801b03169050600061152284602001516116d9565b905061153082848784611f32565b98975050505050505050565b600080600660009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611592573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115b691906125e0565b90506000805b82811015611616576001600160a01b03851660009081526007602090815260408083208484529091529020546001600160801b031615611604576116016001836125a6565b91505b8061160e8161256e565b9150506115bc565b509392505050565b611626611e3f565b600254156116765760405162461bcd60e51b815260206004820152601c60248201527f5374616b696e672068617320616c726561647920737461727465642e000000006044820152606401610484565b42600255565b611684611e3f565b600081116116d45760405162461bcd60e51b815260206004820152601b60248201527f56616c7565206d75737420626520626967676572207468616e203000000000006044820152606401610484565b600155565b600063ffffffff821660328260346116f284601e612587565b6116fc91906125be565b9050600061170b603480612587565b84611717816014612587565b6117219190612587565b61172b91906125be565b90508061173883856125a6565b61174291906125a6565b9695505050505050565b60008160011660000361177557506000908152600560205260409020546001600160601b031690565b60056000611784600185612408565b8152602081019190915260400160002054600160801b90046001600160601b031692915050565b919050565b6117b8611e3f565b6001600160a01b03811661181d5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610484565b61182681611e99565b50565b6000816001166000036118565750600090815260056020526040902054600160601b900463ffffffff1690565b60056000611865600185612408565b8152602081019190915260400160002054600160e01b900463ffffffff1692915050565b6000611893610d7c565b905061189e81611a5b565b60408051606081018252600080825260208201819052918101829052819060005b858110156119f4578686828181106118d9576118d9612558565b336000908152600760209081526040808320938202959095013580835292815290849020845160608101865290546001600160801b038116825263ffffffff600160801b8204811693830193909352600160a01b900490911693810193909352945090925061194a90508286611ee9565b6119e25784826040015163ffffffff16836000015161196991906125f9565b6001600160801b031610156119e2576119828583611bf1565b61198c90856125a6565b82519094506119a890610b8c906001600160801b031687612408565b3360009081526007602090815260408083208784529091529020805463ffffffff60a01b191661ffff92909216600160a01b029190911790555b806119ec8161256e565b9150506118bf565b508260046000828254611a079190612408565b909155505082611a295760405162461bcd60e51b815260040161048490612624565b600354604051637e90cb8960e11b81526001600160a01b039091169063fd2197129061142f9033908790600401612474565b6000611a6682611d66565b9050818110611a73575050565b6003546040516370a0823160e01b81526000916001600160a01b0316906370a0823190611aa4903090600401612381565b602060405180830381865afa158015611ac1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ae591906125e0565b9050815b83811015610f115780600116600003611b5d57600081815260056020526040902054600160601b900463ffffffff1615611b5857611b2682611ffc565b600082815260056020526040902080546bffffffffffffffffffffffff19166001600160601b03929092169190911790555b611bdf565b6000600581611b6d600185612408565b8152602081019190915260400160002054600160e01b900463ffffffff161115611bdf57611b9a82611ffc565b60056000611ba9600185612408565b815260200190815260200160002060000160106101000a8154816001600160601b0302191690836001600160601b031602179055505b80611be98161256e565b915050611ae9565b80516000906001600160801b0316611c415760405162461bcd60e51b8152602060048201526013602482015272151bdad95b881a5cc81b9bdd081cdd185ad959606a1b6044820152606401610484565b6000611c8183600001516001600160801b031685856020015163ffffffff16866040015163ffffffff16611c7c886020015161ffff166116d9565b612047565b949350505050565b825b611c9583856125a6565b811015610f115780600116600003611cf85760008181526005602052604090208054839190600c90611cd5908490600160601b900463ffffffff16612668565b92506101000a81548163ffffffff021916908363ffffffff160217905550611d54565b8160056000611d08600185612408565b815260208101919091526040016000208054601c90611d35908490600160e01b900463ffffffff16612668565b92506101000a81548163ffffffff021916908363ffffffff1602179055505b80611d5e8161256e565b915050611c8b565b600081815b6001821115611df357611d7f600183612408565b915081600116600003611daa57506000818152600560205260409020546001600160601b0316611ddd565b60056000611db9600185612408565b8152602081019190915260400160002054600160801b90046001600160601b031690505b8015611dee57611c818260016125a6565b611d6b565b5060009392505050565b600081831115611e0d5781611e0f565b825b9392505050565b600062093a8060025483611e2a9190612408565b611e3491906125be565b61061d9060016125a6565b6000546001600160a01b03163314610d995760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610484565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b81516000906001600160801b03168103611f055750600061061d565b826020015163ffffffff1683600001516001600160801b031683611f299190612408565b10159392505050565b600080611f3d610981565b9050611f498585611dfd565b94506000611f5685611d66565b905060008080895b89811015611fed57611f6f81611829565b91508115611fdb5784811015611f8f57611f888161174c565b9250611fb9565b6103e860015487611fa09190612587565b611faa91906125be565b9250611fb68387612408565b95505b81611fc48985612587565b611fce91906125be565b611fd890856125a6565b93505b80611fe58161256e565b915050611f5e565b50919998505050505050505050565b6000806103e8600154600454856120139190612408565b61201d9190612587565b61202791906125be565b9050806004600082825461203b91906125a6565b90915550909392505050565b60008461205484886125a6565b10612061575060006103e5565b61174261206e84886125a6565b6120818761207c888b6125a6565b611dfd565b8460008080855b85811015610d7157806001166000036120be57600081815260056020526040902054600160601b900463ffffffff1691506120ee565b600560006120cd600184612408565b8152602081019190915260400160002054600160e01b900463ffffffff1691505b81856120f98361174c565b6121039190612587565b61210d91906125be565b61211790846125a6565b9250806121238161256e565b915050612088565b80356001600160a01b03811681146117ab57600080fd5b60008060008060006080868803121561215a57600080fd5b6121638661212b565b94506121716020870161212b565b935060408601359250606086013567ffffffffffffffff8082111561219557600080fd5b818801915088601f8301126121a957600080fd5b8135818111156121b857600080fd5b8960208285010111156121ca57600080fd5b9699959850939650602001949392505050565b6000602082840312156121ef57600080fd5b5035919050565b6000806040838503121561220957600080fd5b6122128361212b565b946020939093013593505050565b60008083601f84011261223257600080fd5b50813567ffffffffffffffff81111561224a57600080fd5b6020830191508360208260051b850101111561226557600080fd5b9250929050565b803563ffffffff811681146117ab57600080fd5b60008060006040848603121561229557600080fd5b833567ffffffffffffffff8111156122ac57600080fd5b6122b886828701612220565b90945092506122cb90506020850161226c565b90509250925092565b600080604083850312156122e757600080fd5b50508035926020909101359150565b60006020828403121561230857600080fd5b611e0f8261212b565b6020808252825182820181905260009190848201906040850190845b818110156123495783518352928401929184019160010161232d565b50909695505050505050565b6000806040838503121561236857600080fd5b823591506123786020840161226c565b90509250929050565b6001600160a01b0391909116815260200190565b600080602083850312156123a857600080fd5b823567ffffffffffffffff8111156123bf57600080fd5b6123cb85828601612220565b90969095509350505050565b6000602082840312156123e957600080fd5b611e0f8261226c565b634e487b7160e01b600052601160045260246000fd5b60008282101561241a5761241a6123f2565b500390565b60208082526017908201527629ba30b5b4b733903832b934b7b2103737ba1037bb32b960491b604082015260600190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03929092168252602082015260400190565b60208082526017908201527614dd185ada5b99c81a185cc81b9bdd081cdd185c9d1959604a1b604082015260600190565b6020808252601d908201527f4d696e696d756d207374616b696e6720706572696f642031207765656b000000604082015260600190565b6020808252601d908201527f4d6178696d756d207374616b696e6720706572696f6420312079656172000000604082015260600190565b6020808252601290820152712737903a37b5b2b71024a2399033b4bb32b760711b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b600060018201612580576125806123f2565b5060010190565b60008160001904831182151516156125a1576125a16123f2565b500290565b600082198211156125b9576125b96123f2565b500190565b6000826125db57634e487b7160e01b600052601260045260246000fd5b500490565b6000602082840312156125f257600080fd5b5051919050565b60006001600160801b0382811684821680830382111561261b5761261b6123f2565b01949350505050565b602080825260149082015273139bc81c995dd85c99081d1bc81c185e481bdd5d60621b604082015260600190565b634e487b7160e01b600052604160045260246000fd5b600063ffffffff80831681851680830382111561261b5761261b6123f256fea2646970667358221220baff4dcb48916777f1badfb36854552b66654ec33785abfc4398acf301e055c664736f6c634300080f0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000000000000000000000000000000000000000000014000000000000000000000000f853b0f7bc806d6067e42aeaa90d35c114adabfa
-----Decoded View---------------
Arg [0] : percentPerWeek (uint256): 20
Arg [1] : nftTokenAddress (address): 0xf853b0f7bC806D6067e42AEAA90D35C114ADABfA
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000014
Arg [1] : 000000000000000000000000f853b0f7bc806d6067e42aeaa90d35c114adabfa
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 34 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.