Source Code
Latest 25 from a total of 189 transactions
| Transaction Hash |
Method
|
Block
|
From
|
|
To
|
||||
|---|---|---|---|---|---|---|---|---|---|
| Send Many To Jun... | 13872719 | 1557 days ago | IN | 0 ETH | 0.02375234 | ||||
| Send Many To Jun... | 13867942 | 1558 days ago | IN | 0 ETH | 0.01142732 | ||||
| Send Many To Jun... | 13867608 | 1558 days ago | IN | 0 ETH | 0.00967345 | ||||
| Send Many To Jun... | 13863789 | 1558 days ago | IN | 0 ETH | 0.01817497 | ||||
| Send Many To Jun... | 13862488 | 1559 days ago | IN | 0 ETH | 0.01976196 | ||||
| Send Many To Jun... | 13861887 | 1559 days ago | IN | 0 ETH | 0.010686 | ||||
| Send Many To Jun... | 13861887 | 1559 days ago | IN | 0 ETH | 0.01093916 | ||||
| Send Many To Jun... | 13861887 | 1559 days ago | IN | 0 ETH | 0.0104631 | ||||
| Send Many To Jun... | 13861887 | 1559 days ago | IN | 0 ETH | 0.0104631 | ||||
| Send Many To Jun... | 13861887 | 1559 days ago | IN | 0 ETH | 0.01093846 | ||||
| Send Many To Jun... | 13861887 | 1559 days ago | IN | 0 ETH | 0.00887887 | ||||
| Send Many To Jun... | 13861887 | 1559 days ago | IN | 0 ETH | 0.00887887 | ||||
| Send Many To Jun... | 13861886 | 1559 days ago | IN | 0 ETH | 0.00994695 | ||||
| Send Many To Jun... | 13860157 | 1559 days ago | IN | 0 ETH | 0.01428524 | ||||
| Send Many To Jun... | 13859204 | 1559 days ago | IN | 0 ETH | 0.0124482 | ||||
| Send Many To Jun... | 13859202 | 1559 days ago | IN | 0 ETH | 0.01521449 | ||||
| Send Many To Jun... | 13859202 | 1559 days ago | IN | 0 ETH | 0.01429975 | ||||
| Send Many To Jun... | 13859198 | 1559 days ago | IN | 0 ETH | 0.0018341 | ||||
| Send Many To Jun... | 13859198 | 1559 days ago | IN | 0 ETH | 0.01432889 | ||||
| Send Many To Jun... | 13859198 | 1559 days ago | IN | 0 ETH | 0.0018341 | ||||
| Send Many To Jun... | 13859194 | 1559 days ago | IN | 0 ETH | 0.01556409 | ||||
| Send Many To Jun... | 13859194 | 1559 days ago | IN | 0 ETH | 0.00199221 | ||||
| Send Many To Jun... | 13859194 | 1559 days ago | IN | 0 ETH | 0.01637225 | ||||
| Send Many To Jun... | 13859154 | 1559 days ago | IN | 0 ETH | 0.01730373 | ||||
| Send Many To Jun... | 13859154 | 1559 days ago | IN | 0 ETH | 0.01641284 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Contract Name:
Jungle
Compiler Version
v0.8.1+commit.df193b15
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// _ _ _ _ _ ____ _ _____
// | | | | | \ | |/ ___| | | ____|
// _ | | | | | \| | | _| | | _|
// | |_| | |_| | |\ | |_| | |___| |___
// \___/ \___/|_| \_|\____|_____|_____|
//
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./Ownable.sol";
import "./SafeMath.sol";
import "./IERC721Receiver.sol";
import "./Apes.sol";
import "./Bananas.sol";
contract Jungle is Ownable, IERC721Receiver {
using SafeMath for uint256;
//Establish interface for Apes
Apes apes;
//Establish interface for $BANANAS
Bananas bananas;
event ApeStolen(address previousOwner, address newOwner, uint256 tokenId);
event ApeStaked(address owner, uint256 tokenId, uint256 status);
event ApeClaimed(address owner, uint256 tokenId);
/* Struct to track token info
Status is as follows:
0 - Unstaked
1 - HungryApe
2 - GreedyApe
3 - MutantApe
*/
struct tokenInfo {
uint256 tokenId;
address owner;
uint256 status;
uint256 timeStaked;
}
// maps id to token info structure
mapping(uint256 => tokenInfo) public jungle;
//Amount token id to amount stolen
mapping(uint256 => uint256) public bananasStolen;
//Daily $BANANAS earned by HungryApes
uint256 public hungryApeBananasRate = 100 ether;
//Total number of HungryApes staked
uint256 public totalHungryApesStaked = 0;
//Percent of $BANANAS earned by HungryApes that is kept
uint256 public hungryApeShare = 50;
//Percent of $BANANAS earned by hungryApes that is stolen by GreedyApes
uint256 public greedyApeShare = 50;
//5% chance a greedyApe gets lost each time it is unstaked
uint256 public chanceGreedyApeGetsLost = 5;
//Store tokenIds of all GreedyApes staked
uint256[] public greedyApesStaked;
//Store Index of greedyApes staked
mapping(uint256 => uint256) public greedyApeIndices;
//Store tokenIds of all mutantApes staked
uint256[] public mutantApesStaked;
//Store Index of mutantApes staked
mapping(uint256 => uint256) public mutantApeIndices;
//1 day lock on staking
uint256 public minStakeTime = 1 days;
bool public staking = false;
//Used to keep track of total Apes supply
uint256 public totalSupply = 5000;
constructor(){}
//Mint Apes for bananas
function mintApeForBananas(bool stake, uint256 status) public {
require(staking, "Staking is paused");
bananas.burn(msg.sender, getBananasCost(totalSupply));
apes.mintApeForBananas();
uint256 tokenId = totalSupply;
totalSupply++;
if(stake){
jungle[tokenId] = tokenInfo({
tokenId: tokenId,
owner: msg.sender,
status: status,
timeStaked: block.timestamp
});
if (status == 1)
totalHungryApesStaked++;
else if (status == 2){
greedyApesStaked.push(tokenId);
greedyApeIndices[tokenId] = greedyApesStaked.length - 1;
}
else if (status == 3){
mutantApesStaked.push(tokenId);
mutantApeIndices[tokenId] = mutantApesStaked.length - 1;
}
} else {
apes.safeTransferFrom(address(this), msg.sender, tokenId);
}
}
function getBananasCost(uint256 supply) internal pure returns (uint256 cost){
if (supply < 6000)
return 100;
else if (supply < 8000)
return 200;
else if (supply < 10000)
return 400;
else if (supply < 12000)
return 800;
else if (supply < 14000)
return 1000;
else if (supply < 15000)
return 1200;
}
//-----------------------------------------------------------------------------//
//------------------------------Staking----------------------------------------//
//-----------------------------------------------------------------------------//
/*sends any number of Apes to the jungle
ids -> list of ape ids to stake
Status == 1 -> HungryApe
Status == 2 -> GreedyApe
Status == 3 -> MutantApe
*/
function sendManyToJungle(uint256[] calldata ids, uint256 status) external {
for(uint256 i = 0; i < ids.length; i++){
require(apes.ownerOf(ids[i]) == msg.sender, "Not your Ape");
require(staking, "Staking is paused");
jungle[ids[i]] = tokenInfo({
tokenId: ids[i],
owner: msg.sender,
status: status,
timeStaked: block.timestamp
});
emit ApeStaked(msg.sender, ids[i], status);
apes.transferFrom(msg.sender, address(this), ids[i]);
if (status == 1)
totalHungryApesStaked++;
else if (status == 2){
greedyApesStaked.push(ids[i]);
greedyApeIndices[ids[i]] = greedyApesStaked.length - 1;
}
else if (status == 3){
mutantApesStaked.push(ids[i]);
mutantApeIndices[ids[i]] = mutantApesStaked.length - 1;
}
}
}
function unstakeManyApes(uint256[] calldata ids) external {
for(uint256 i = 0; i < ids.length; i++){
tokenInfo memory token = jungle[ids[i]];
require(token.owner == msg.sender, "Not your Ape");
require(apes.ownerOf(ids[i]) == address(this), "Ape must be staked in order to claim");
require(staking, "Staking is paused");
require(block.timestamp - token.timeStaked >= minStakeTime, "1 day stake lock");
_claim(msg.sender, ids[i]);
if (token.status == 1){
totalHungryApesStaked--;
}
else if (token.status == 2){
uint256 lastGreedyApe = greedyApesStaked[greedyApesStaked.length - 1];
greedyApesStaked[greedyApeIndices[ids[i]]] = lastGreedyApe;
greedyApeIndices[lastGreedyApe] = greedyApeIndices[ids[i]];
greedyApesStaked.pop();
}
else if (token.status == 3){
uint256 lastMutantApe = mutantApesStaked[mutantApesStaked.length - 1];
mutantApesStaked[mutantApeIndices[ids[i]]] = lastMutantApe;
mutantApeIndices[lastMutantApe] = mutantApeIndices[ids[i]];
mutantApesStaked.pop();
}
emit ApeClaimed(address(this), ids[i]);
//retrieve token info again to account for stolen Apes
tokenInfo memory newToken = jungle[ids[i]];
apes.safeTransferFrom(address(this), newToken.owner, ids[i]);
jungle[ids[i]] = tokenInfo({
tokenId: ids[i],
owner: newToken.owner,
status: 0,
timeStaked: block.timestamp
});
}
}
function claimManyApes(uint256[] calldata ids) external {
for(uint256 i = 0; i < ids.length; i++){
tokenInfo memory token = jungle[ids[i]];
require(token.owner == msg.sender, "Not your Ape");
require(apes.ownerOf(ids[i]) == address(this), "Ape must be staked in order to claim");
require(staking, "Staking is paused");
_claim(msg.sender, ids[i]);
emit ApeClaimed(address(this), ids[i]);
//retrieve token info again to account for stolen Apes
tokenInfo memory newToken = jungle[ids[i]];
jungle[ids[i]] = tokenInfo({
tokenId: ids[i],
owner: newToken.owner,
status: newToken.status,
timeStaked: block.timestamp
});
}
}
function _claim(address owner, uint256 tokenId) internal {
tokenInfo memory token = jungle[tokenId];
if (token.status == 1){
if(greedyApesStaked.length > 0){
uint256 bananasGathered = getPendingBananas(tokenId);
bananas.mint(owner, bananasGathered.mul(hungryApeShare).div(100));
stealBananas(bananasGathered.mul(greedyApeShare).div(100));
}
else {
bananas.mint(owner, getPendingBananas(tokenId));
}
}
else if (token.status == 2){
uint256 roll = randomIntInRange(tokenId, 100);
if(roll > chanceGreedyApeGetsLost || mutantApesStaked.length == 0){
bananas.mint(owner, bananasStolen[tokenId]);
bananasStolen[tokenId ]= 0;
} else{
getNewOwnerForGreedyApe(roll, tokenId);
}
}
}
//Public function to view pending $BANANAS earnings for HungryApes.
function getBananasEarnings(uint256 id) public view returns(uint256) {
return getPendingBananas(id);
}
//Passive earning of $BANANAS, 100 $BANANAS per day
function getPendingBananas(uint256 id) internal view returns(uint256) {
tokenInfo memory token = jungle[id];
return (block.timestamp - token.timeStaked) * 100 ether / 1 days;
}
//Returns a pseudo-random integer between 0 - max
function randomIntInRange(uint256 seed, uint256 max) internal view returns (uint256) {
return uint256(keccak256(abi.encodePacked(
tx.origin,
blockhash(block.number - 1),
block.timestamp,
seed
))) % max;
}
//Return new owner of lost GreedyApe from current mutantApes
function stealBananas(uint256 amount) internal{
uint256 roll = randomIntInRange(amount, greedyApesStaked.length);
bananasStolen[greedyApesStaked[roll]] += amount;
}
//Return new owner of lost greedyApe from current mutantApes
function getNewOwnerForGreedyApe(uint256 seed, uint256 tokenId) internal{
tokenInfo memory greedyApe = jungle[tokenId];
uint256 roll = randomIntInRange(seed, mutantApesStaked.length);
tokenInfo memory mutantApe = jungle[mutantApesStaked[roll]];
emit ApeStolen(greedyApe.owner, mutantApe.owner, tokenId);
jungle[tokenId] = tokenInfo({
tokenId: tokenId,
owner: mutantApe.owner,
status: 2,
timeStaked: block.timestamp
});
bananas.mint(mutantApe.owner, bananasStolen[tokenId]);
bananasStolen[tokenId] = 0;
}
function getTotalMutantApesStaked() public view returns (uint256) {
return mutantApesStaked.length;
}
function getTotalGreedyApesStaked() public view returns (uint256) {
return greedyApesStaked.length;
}
//Set address for Apes
function setApeAddress(address apeAddr) external onlyOwner {
apes = Apes(apeAddr);
}
//Set address for $BANANAS
function setBananasAddress(address bananasAddr) external onlyOwner {
bananas = Bananas(bananasAddr);
}
//Start/Stop staking
function toggleStaking() public onlyOwner {
staking = !staking;
}
function onERC721Received(
address,
address,
uint256,
bytes calldata
) external pure override returns (bytes4) {
return IERC721Receiver.onERC721Received.selector;
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./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() {
_setOwner(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
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 {
_setOwner(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");
_setOwner(newOwner);
}
function _setOwner(address newOwner) private {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.
/**
* @dev Wrappers over Solidity's arithmetic operations.
*
* NOTE: `SafeMath` is no longer needed starting with Solidity 0.8. The compiler
* now has built in overflow checking.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the substraction of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator.
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
/**
* @dev Returns the integer division of two unsigned integers, reverting with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting with custom message when dividing by zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
}// SPDX-License-Identifier: MIT
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 `IERC721.onERC721Received.selector`.
*/
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}//
// _____ _ _ _____ _ ____ _____ ____ _ __ __ _____
// |_ _| | | | ____| / \ | _ \| ____| / ___| / \ | \/ | ____|
// | | | |_| | _| / _ \ | |_) | _| | | _ / _ \ | |\/| | _|
// | | | _ | |___ / ___ \| __/| |___ | |_| |/ ___ \| | | | |___
// |_| |_| |_|_____| /_/ \_\_| |_____| \____/_/ \_\_| |_|_____|
//
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./ERC721.sol";
import "./ERC721Enumerable.sol";
import "./Ownable.sol";
import "./SafeMath.sol";
import "./Counters.sol";
import "./Strings.sol";
import "./Bananas.sol";
import "./Jungle.sol";
contract Apes is ERC721Enumerable, Ownable {
using SafeMath for uint256;
using Counters for Counters.Counter;
using Strings for uint256;
Counters.Counter private _tokenIdTracker;
Bananas bananas;
uint256 public maxFreeSupply = 500;
uint256 public constant maxPublicSupply = 5000;
uint256 public constant maxTotalSupply = 15000;
uint256 public constant mintPrice = 0.029 ether;
uint256 public constant maxPerTx = 10;
uint256 public constant maxFreePerWallet = 10;
address public constant dev1Address = 0xA17555Ac424f378F6C1a296cc888607621e89A1c;
address public constant dev2Address = 0x1452f628694367d5203d48e0709b034f4da03A76;
bool mintActive = false;
bool public bananasMinting = false;
mapping(address => uint256) public freeMintsClaimed; //Track free mints claimed per wallet
string public baseTokenURI;
constructor() ERC721("The Ape Game", "TAG") {}
//-----------------------------------------------------------------------------//
//------------------------------Mint Logic-------------------------------------//
//-----------------------------------------------------------------------------//
//Resume/pause Public Sale
function toggleMint() public onlyOwner {
mintActive = !mintActive;
}
//Public Mint
function mint(address _referredBy, uint256 _count) public payable {
uint256 total = _totalSupply();
require(mintActive, "Sale has not begun");
require(total + _count <= maxPublicSupply, "No apes left");
require(_count <= maxPerTx, "10 max per tx");
require(msg.value >= price(_count), "Not enough eth sent");
for (uint256 i = 0; i < _count; i++) {
_mintApe(msg.sender);
}
uint256 balance = price(_count);
uint256 referralShare = balance.mul(10).div(100);
if(_referredBy != 0x0000000000000000000000000000000000000000 &&_referredBy != msg.sender ){
_referralbonus(_referredBy, referralShare);
}
}
function mintNow( uint256 _count) public payable {
uint256 total = _totalSupply();
require(mintActive, "Sale has not begun");
require(total + _count <= maxPublicSupply, "No apes left");
require(_count <= maxPerTx, "10 max per tx");
require(msg.value >= price(_count), "Not enough eth sent");
for (uint256 i = 0; i < _count; i++) {
_mintApe(msg.sender);
}
}
function _referralbonus(address _address, uint256 _amount) private{
payable(_address).transfer(_amount);
}
//Free Mint for first 500
function freeMint(uint256 _count) public {
uint256 total = _totalSupply();
require(mintActive, "Public Sale is not active");
require(total + _count <= maxFreeSupply, "No more free apes");
require(_count + freeMintsClaimed[msg.sender] <= maxFreePerWallet, "Only 10 free mints per wallet");
require(_count <= maxPerTx, "10 max per tx");
for (uint256 i = 0; i < _count; i++) {
freeMintsClaimed[msg.sender]++;
_mintApe(msg.sender);
}
}
//Public Mint until 5000
function mintApeForBananas() public {
uint256 total = _totalSupply();
require(total < maxTotalSupply, "No Apes left");
require(bananasMinting, "Minting with $bananas has not begun");
bananas.burn(msg.sender, getBananasCost(total));
_mintApe(msg.sender);
}
function getBananasCost(uint256 totalSupply) internal pure returns (uint256 cost){
if (totalSupply < 6000)
return 100;
else if (totalSupply < 8000)
return 200;
else if (totalSupply < 10000)
return 400;
else if (totalSupply < 12000)
return 800;
else if (totalSupply < 14000)
return 1000;
else if (totalSupply < 15000)
return 1200;
}
//Mint Ape
function _mintApe(address _to) private {
uint id = _tokenIdTracker.current();
_tokenIdTracker.increment();
_safeMint(_to, id);
}
//Function to get price of minting a ape
function price(uint256 _count) public pure returns (uint256) {
return mintPrice.mul(_count);
}
//-----------------------------------------------------------------------------//
//---------------------------Admin & Internal Logic----------------------------//
//-----------------------------------------------------------------------------//
//Set address for $Bananas
function setBananasAddress(address bananasAddr) external onlyOwner {
bananas = Bananas(bananasAddr);
}
//Internal URI function
function _baseURI() internal view virtual override returns (string memory) {
return baseTokenURI;
}
//Start/Stop minting apes for $bananas
function toggleBananasMinting() public onlyOwner {
bananasMinting = !bananasMinting;
}
//Set URI for metadata
function setBaseURI(string memory baseURI) public onlyOwner {
baseTokenURI = baseURI;
}
//Withdraw from contract
function withdrawAll() public onlyOwner {
uint256 balance = address(this).balance;
uint256 dev1Share = balance.mul(4).div(100);
uint256 dev2Share = balance.mul(96).div(100);
require(balance > 0);
_withdraw(dev1Address, dev1Share);
_withdraw(dev2Address, dev2Share);
}
//Internal withdraw
function _withdraw(address _address, uint256 _amount) private {
(bool success, ) = _address.call{value: _amount}("");
require(success, "Transfer failed.");
}
//Return total supply of apes
function _totalSupply() public view returns (uint) {
return _tokenIdTracker.current();
}
}// ____ _ _ _ _ _ _ _ ____
// | __ ) / \ | \ | | / \ | \ | | / \ / ___|
// | _ \ / _ \ | \| | / _ \ | \| | / _ \ \___ \
// | |_) / ___ \| |\ |/ ___ \| |\ |/ ___ \ ___) |
// |____/_/ \_\_| \_/_/ \_\_| \_/_/ \_\____/
//
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./ERC20.sol";
import "./Ownable.sol";
contract Bananas is ERC20, Ownable {
address public apeAddress;
address public jungleAddress;
mapping(address => bool) public allowedAddresses;
constructor() ERC20("BANANAS", "BANANAS") {}
function setApeAddress(address apeAddr) external onlyOwner {
apeAddress = apeAddr;
}
function setJungleAddress(address jungleAddr) external onlyOwner {
jungleAddress = jungleAddr;
}
function burn(address user, uint256 amount) external {
require(msg.sender == jungleAddress || msg.sender == apeAddress, "Address not authorized");
_burn(user, amount);
}
function mint(address to, uint256 value) external {
require(msg.sender == jungleAddress || msg.sender == apeAddress, "Address not authorized");
_mint(to, value);
}
}// SPDX-License-Identifier: MIT
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
pragma solidity ^0.8.0;
import "./IERC721.sol";
import "./IERC721Receiver.sol";
import "./IERC721Metadata.sol";
import "./Address.sol";
import "./Context.sol";
import "./Strings.sol";
import "./ERC165.sol";
/**
* @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
* the Metadata extension, but not including the Enumerable extension, which is available separately as
* {ERC721Enumerable}.
*/
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
using Address for address;
using Strings for uint256;
// Token name
string private _name;
// Token symbol
string private _symbol;
// Mapping from token ID to owner address
mapping(uint256 => address) private _owners;
// Mapping owner address to token count
mapping(address => uint256) private _balances;
// 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;
/**
* @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @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 virtual override returns (uint256) {
require(owner != address(0), "ERC721: balance query for the zero address");
return _balances[owner];
}
/**
* @dev See {IERC721-ownerOf}.
*/
function ownerOf(uint256 tokenId) public view virtual override returns (address) {
address owner = _owners[tokenId];
require(owner != address(0), "ERC721: owner query for nonexistent token");
return owner;
}
/**
* @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) {
require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
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 virtual override {
address owner = ERC721.ownerOf(tokenId);
require(to != owner, "ERC721: approval to current owner");
require(
_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
"ERC721: approve caller is not owner nor approved for all"
);
_approve(to, tokenId);
}
/**
* @dev See {IERC721-getApproved}.
*/
function getApproved(uint256 tokenId) public view virtual override returns (address) {
require(_exists(tokenId), "ERC721: approved query for nonexistent token");
return _tokenApprovals[tokenId];
}
/**
* @dev See {IERC721-setApprovalForAll}.
*/
function setApprovalForAll(address operator, bool approved) public virtual override {
require(operator != _msgSender(), "ERC721: approve to caller");
_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 {
//solhint-disable-next-line max-line-length
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_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 {
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_safeTransfer(from, to, tokenId, _data);
}
/**
* @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.
*
* `_data` is additional data, it has no specified format and it is sent in call to `to`.
*
* This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
* implement alternative mechanisms to perform token transfer, such as signature-based.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeTransfer(
address from,
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_transfer(from, to, tokenId);
require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
}
/**
* @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`),
* and stop existing when they are burned (`_burn`).
*/
function _exists(uint256 tokenId) internal view virtual returns (bool) {
return _owners[tokenId] != address(0);
}
/**
* @dev Returns whether `spender` is allowed to manage `tokenId`.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
require(_exists(tokenId), "ERC721: operator query for nonexistent token");
address owner = ERC721.ownerOf(tokenId);
return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));
}
/**
* @dev Safely mints `tokenId` and transfers it to `to`.
*
* Requirements:
*
* - `tokenId` must not exist.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeMint(address to, uint256 tokenId) internal virtual {
_safeMint(to, tokenId, "");
}
/**
* @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
* forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
*/
function _safeMint(
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_mint(to, tokenId);
require(
_checkOnERC721Received(address(0), to, tokenId, _data),
"ERC721: transfer to non ERC721Receiver implementer"
);
}
/**
* @dev Mints `tokenId` and transfers it to `to`.
*
* WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
*
* Requirements:
*
* - `tokenId` must not exist.
* - `to` cannot be the zero address.
*
* Emits a {Transfer} event.
*/
function _mint(address to, uint256 tokenId) internal virtual {
require(to != address(0), "ERC721: mint to the zero address");
require(!_exists(tokenId), "ERC721: token already minted");
_beforeTokenTransfer(address(0), to, tokenId);
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(address(0), to, tokenId);
}
/**
* @dev Destroys `tokenId`.
* The approval is cleared when the token is burned.
*
* Requirements:
*
* - `tokenId` must exist.
*
* Emits a {Transfer} event.
*/
function _burn(uint256 tokenId) internal virtual {
address owner = ERC721.ownerOf(tokenId);
_beforeTokenTransfer(owner, address(0), tokenId);
// Clear approvals
_approve(address(0), tokenId);
_balances[owner] -= 1;
delete _owners[tokenId];
emit Transfer(owner, address(0), tokenId);
}
/**
* @dev Transfers `tokenId` from `from` to `to`.
* As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
*
* 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
) internal virtual {
require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own");
require(to != address(0), "ERC721: transfer to the zero address");
_beforeTokenTransfer(from, to, tokenId);
// Clear approvals from the previous owner
_approve(address(0), tokenId);
_balances[from] -= 1;
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(from, to, tokenId);
}
/**
* @dev Approve `to` to operate on `tokenId`
*
* Emits a {Approval} event.
*/
function _approve(address to, uint256 tokenId) internal virtual {
_tokenApprovals[tokenId] = to;
emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
}
/**
* @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
* The call is not executed if the target address is not a 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 _checkOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory _data
) private returns (bool) {
if (to.isContract()) {
try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
return retval == IERC721Receiver.onERC721Received.selector;
} catch (bytes memory reason) {
if (reason.length == 0) {
revert("ERC721: transfer to non ERC721Receiver implementer");
} else {
assembly {
revert(add(32, reason), mload(reason))
}
}
}
} else {
return true;
}
}
/**
* @dev Hook that is called before any token transfer. This includes minting
* and burning.
*
* 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, ``from``'s `tokenId` will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual {}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./ERC721.sol";
import "./IERC721Enumerable.sol";
/**
* @dev This implements an optional extension of {ERC721} defined in the EIP that adds
* enumerability of all the token ids in the contract as well as all token ids owned by each
* account.
*/
abstract contract ERC721Enumerable is ERC721, IERC721Enumerable {
// Mapping from owner to list of owned token IDs
mapping(address => mapping(uint256 => uint256)) private _ownedTokens;
// Mapping from token ID to index of the owner tokens list
mapping(uint256 => uint256) private _ownedTokensIndex;
// Array with all token ids, used for enumeration
uint256[] private _allTokens;
// Mapping from token id to position in the allTokens array
mapping(uint256 => uint256) private _allTokensIndex;
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) {
return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.
*/
function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) {
require(index < ERC721.balanceOf(owner), "ERC721Enumerable: owner index out of bounds");
return _ownedTokens[owner][index];
}
/**
* @dev See {IERC721Enumerable-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _allTokens.length;
}
/**
* @dev See {IERC721Enumerable-tokenByIndex}.
*/
function tokenByIndex(uint256 index) public view virtual override returns (uint256) {
require(index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: global index out of bounds");
return _allTokens[index];
}
/**
* @dev Hook that is called before any token transfer. This includes minting
* and burning.
*
* 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, ``from``'s `tokenId` will be burned.
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual override {
super._beforeTokenTransfer(from, to, tokenId);
if (from == address(0)) {
_addTokenToAllTokensEnumeration(tokenId);
} else if (from != to) {
_removeTokenFromOwnerEnumeration(from, tokenId);
}
if (to == address(0)) {
_removeTokenFromAllTokensEnumeration(tokenId);
} else if (to != from) {
_addTokenToOwnerEnumeration(to, tokenId);
}
}
/**
* @dev Private function to add a token to this extension's ownership-tracking data structures.
* @param to address representing the new owner of the given token ID
* @param tokenId uint256 ID of the token to be added to the tokens list of the given address
*/
function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {
uint256 length = ERC721.balanceOf(to);
_ownedTokens[to][length] = tokenId;
_ownedTokensIndex[tokenId] = length;
}
/**
* @dev Private function to add a token to this extension's token tracking data structures.
* @param tokenId uint256 ID of the token to be added to the tokens list
*/
function _addTokenToAllTokensEnumeration(uint256 tokenId) private {
_allTokensIndex[tokenId] = _allTokens.length;
_allTokens.push(tokenId);
}
/**
* @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that
* while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for
* gas optimizations e.g. when performing a transfer operation (avoiding double writes).
* This has O(1) time complexity, but alters the order of the _ownedTokens array.
* @param from address representing the previous owner of the given token ID
* @param tokenId uint256 ID of the token to be removed from the tokens list of the given address
*/
function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private {
// To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and
// then delete the last slot (swap and pop).
uint256 lastTokenIndex = ERC721.balanceOf(from) - 1;
uint256 tokenIndex = _ownedTokensIndex[tokenId];
// When the token to delete is the last token, the swap operation is unnecessary
if (tokenIndex != lastTokenIndex) {
uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];
_ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
_ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
}
// This also deletes the contents at the last position of the array
delete _ownedTokensIndex[tokenId];
delete _ownedTokens[from][lastTokenIndex];
}
/**
* @dev Private function to remove a token from this extension's token tracking data structures.
* This has O(1) time complexity, but alters the order of the _allTokens array.
* @param tokenId uint256 ID of the token to be removed from the tokens list
*/
function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {
// To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and
// then delete the last slot (swap and pop).
uint256 lastTokenIndex = _allTokens.length - 1;
uint256 tokenIndex = _allTokensIndex[tokenId];
// When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so
// rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding
// an 'if' statement (like in _removeTokenFromOwnerEnumeration)
uint256 lastTokenId = _allTokens[lastTokenIndex];
_allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
_allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
// This also deletes the contents at the last position of the array
delete _allTokensIndex[tokenId];
_allTokens.pop();
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @title Counters
* @author Matt Condon (@shrugs)
* @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number
* of elements in a mapping, issuing ERC721 ids, or counting request ids.
*
* Include with `using Counters for Counters.Counter;`
*/
library Counters {
struct Counter {
// This variable should never be directly accessed by users of the library: interactions must be restricted to
// the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add
// this feature: see https://github.com/ethereum/solidity/issues/4637
uint256 _value; // default: 0
}
function current(Counter storage counter) internal view returns (uint256) {
return counter._value;
}
function increment(Counter storage counter) internal {
unchecked {
counter._value += 1;
}
}
function decrement(Counter storage counter) internal {
uint256 value = counter._value;
require(value > 0, "Counter: decrement overflow");
unchecked {
counter._value = value - 1;
}
}
function reset(Counter storage counter) internal {
counter._value = 0;
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @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);
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./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`, 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 be 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 Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @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 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);
/**
* @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;
}// SPDX-License-Identifier: MIT
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
pragma solidity ^0.8.0;
/**
* @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
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
assembly {
size := extcodesize(account)
}
return size > 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
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}// SPDX-License-Identifier: MIT
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
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
pragma solidity ^0.8.0;
import "./IERC721.sol";
/**
* @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Enumerable is IERC721 {
/**
* @dev Returns the total amount of tokens stored by the contract.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns a token ID owned by `owner` at a given `index` of its token list.
* Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
*/
function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId);
/**
* @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
* Use along with {totalSupply} to enumerate all tokens.
*/
function tokenByIndex(uint256 index) external view returns (uint256);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IERC20.sol";
import "./IERC20Metadata.sol";
import "./Context.sol";
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin Contracts guidelines: functions revert
* instead returning `false` on failure. This behavior is nonetheless
* conventional and does not conflict with the expectations of ERC20
* applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
contract ERC20 is Context, IERC20, IERC20Metadata {
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*
* The default value of {decimals} is 18. To select a different value for
* {decimals} you should overload it.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5.05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless this function is
* overridden;
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual override returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* Requirements:
*
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
unchecked {
_approve(sender, _msgSender(), currentAllowance - amount);
}
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
unchecked {
_approve(_msgSender(), spender, currentAllowance - subtractedValue);
}
return true;
}
/**
* @dev Moves `amount` of tokens from `sender` to `recipient`.
*
* This internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
unchecked {
_balances[sender] = senderBalance - amount;
}
_balances[recipient] += amount;
emit Transfer(sender, recipient, amount);
_afterTokenTransfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
_afterTokenTransfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
unchecked {
_balances[account] = accountBalance - amount;
}
_totalSupply -= amount;
emit Transfer(account, address(0), amount);
_afterTokenTransfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
/**
* @dev Hook that is called after any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* has been transferred to `to`.
* - when `from` is zero, `amount` tokens have been minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens have been burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _afterTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @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 `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, 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 `sender` to `recipient` 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 sender,
address recipient,
uint256 amount
) external returns (bool);
/**
* @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);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IERC20.sol";
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*
* _Available since v4.1._
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}{
"optimizer": {
"enabled": true,
"runs": 200
},
"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":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ApeClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"status","type":"uint256"}],"name":"ApeStaked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":false,"internalType":"address","name":"newOwner","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ApeStolen","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"bananasStolen","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"chanceGreedyApeGetsLost","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"ids","type":"uint256[]"}],"name":"claimManyApes","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"getBananasEarnings","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTotalGreedyApesStaked","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTotalMutantApesStaked","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"greedyApeIndices","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"greedyApeShare","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"greedyApesStaked","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"hungryApeBananasRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"hungryApeShare","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"jungle","outputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"status","type":"uint256"},{"internalType":"uint256","name":"timeStaked","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minStakeTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"stake","type":"bool"},{"internalType":"uint256","name":"status","type":"uint256"}],"name":"mintApeForBananas","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"mutantApeIndices","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"mutantApesStaked","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"uint256","name":"status","type":"uint256"}],"name":"sendManyToJungle","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"apeAddr","type":"address"}],"name":"setApeAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"bananasAddr","type":"address"}],"name":"setBananasAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"staking","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"toggleStaking","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"totalHungryApesStaked","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","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":"ids","type":"uint256[]"}],"name":"unstakeManyApes","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
608060405268056bc75e2d63100000600590815560006006556032600781905560085560095562015180600e55600f805460ff1916905561138860105534801561004857600080fd5b5061005961005461005e565b610062565b6100b2565b3390565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b61234280620000c26000396000f3fe608060405234801561001057600080fd5b50600436106101c45760003560e01c80638b3476bf116100f9578063d23eeb6f11610097578063f2fde38b11610071578063f2fde38b14610341578063f6b0559914610354578063f94abfa014610367578063fdccad551461037a576101c4565b8063d23eeb6f14610308578063da4c2cab1461031b578063ef516fd91461032e576101c4565b8063af3cea12116100d3578063af3cea12146102d2578063b770ab40146102da578063b946e79c146102ed578063cb59639414610300576101c4565b80638b3476bf146102975780638da5cb5b146102aa578063936a3467146102bf576101c4565b80633b8105b31161016657806350cfdec31161014057806350cfdec314610261578063715018a6146102695780637471e11f146102715780637d1aa13b14610284576101c4565b80633b8105b31461023c578063480f7c93146102445780634cf088d91461024c576101c4565b80631f7678ce116101a25780631f7678ce1461021c578063211b341b1461022457806336401db51461022c57806339f7b33614610234576101c4565b80630bed6aab146101c9578063150b7a02146101de57806318160ddd14610207575b600080fd5b6101dc6101d7366004611f2a565b61039d565b005b6101f16101ec366004611e90565b610a88565b6040516101fe91906120a7565b60405180910390f35b61020f610a99565b6040516101fe91906121f6565b61020f610a9f565b61020f610aa5565b61020f610aab565b61020f610ab1565b6101dc610ab7565b61020f610b0a565b610254610b10565b6040516101fe919061209c565b61020f610b19565b6101dc610b1f565b6101dc61027f366004611f6a565b610b6a565b61020f610292366004611fe3565b610f8e565b61020f6102a5366004611fe3565b610fa0565b6102b2610fc1565b6040516101fe919061202a565b61020f6102cd366004611fe3565b610fd0565b61020f610fe0565b6101dc6102e8366004611f2a565b610fe6565b61020f6102fb366004611fe3565b61135b565b61020f61136d565b6101dc610316366004611fb4565b611373565b61020f610329366004611fe3565b611643565b6101dc61033c366004611e58565b611656565b6101dc61034f366004611e58565b6116b7565b61020f610362366004611fe3565b611728565b6101dc610375366004611e58565b61173a565b61038d610388366004611fe3565b61179b565b6040516101fe94939291906121ff565b60005b81811015610a83576000600360008585858181106103ce57634e487b7160e01b600052603260045260246000fd5b6020908102929092013583525081810192909252604090810160002081516080810183528154815260018201546001600160a01b0316938101849052600282015492810192909252600301546060820152915033146104485760405162461bcd60e51b815260040161043f906121a5565b60405180910390fd5b60015430906001600160a01b0316636352211e86868681811061047b57634e487b7160e01b600052603260045260246000fd5b905060200201356040518263ffffffff1660e01b815260040161049e91906121f6565b60206040518083038186803b1580156104b657600080fd5b505afa1580156104ca573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104ee9190611e74565b6001600160a01b0316146105145760405162461bcd60e51b815260040161043f90612102565b600f5460ff166105365760405162461bcd60e51b815260040161043f906121cb565b600e546060820151610548904261226e565b10156105665760405162461bcd60e51b815260040161043f90612146565b6105963385858581811061058a57634e487b7160e01b600052603260045260246000fd5b905060200201356117cd565b8060400151600114156105bd57600680549060006105b383612285565b919050555061083b565b8060400151600214156106fe57600a8054600091906105de9060019061226e565b815481106105fc57634e487b7160e01b600052603260045260246000fd5b9060005260206000200154905080600a600b600088888881811061063057634e487b7160e01b600052603260045260246000fd5b905060200201358152602001908152602001600020548154811061066457634e487b7160e01b600052603260045260246000fd5b9060005260206000200181905550600b600086868681811061069657634e487b7160e01b600052603260045260246000fd5b90506020020135815260200190815260200160002054600b600083815260200190815260200160002081905550600a8054806106e257634e487b7160e01b600052603160045260246000fd5b600190038181906000526020600020016000905590555061083b565b80604001516003141561083b57600c80546000919061071f9060019061226e565b8154811061073d57634e487b7160e01b600052603260045260246000fd5b9060005260206000200154905080600c600d600088888881811061077157634e487b7160e01b600052603260045260246000fd5b90506020020135815260200190815260200160002054815481106107a557634e487b7160e01b600052603260045260246000fd5b9060005260206000200181905550600d60008686868181106107d757634e487b7160e01b600052603260045260246000fd5b90506020020135815260200190815260200160002054600d600083815260200190815260200160002081905550600c80548061082357634e487b7160e01b600052603160045260246000fd5b60019003818190600052602060002001600090559055505b7ff40c55f5015305e6f26299812e61b1009bd793a4eaaabc1ee308bf3f61895dfe3085858581811061087d57634e487b7160e01b600052603260045260246000fd5b90506020020135604051610892929190612062565b60405180910390a16000600360008686868181106108c057634e487b7160e01b600052603260045260246000fd5b602090810292909201358352508181019290925260409081016000208151608081018352815481526001808301546001600160a01b039081169583018690526002840154948301949094526003909201546060820152905490935016906342842e0e90309088888881811061094557634e487b7160e01b600052603260045260246000fd5b905060200201356040518463ffffffff1660e01b815260040161096a9392919061203e565b600060405180830381600087803b15801561098457600080fd5b505af1158015610998573d6000803e3d6000fd5b5050505060405180608001604052808686868181106109c757634e487b7160e01b600052603260045260246000fd5b90506020020135815260200182602001516001600160a01b03168152602001600081526020014281525060036000878787818110610a1557634e487b7160e01b600052603260045260246000fd5b6020908102929092013583525081810192909252604090810160002083518155918301516001830180546001600160a01b0319166001600160a01b03909216919091179055820151600282015560609091015160039091015550819050610a7b8161229c565b9150506103a0565b505050565b630a85bd0160e11b95945050505050565b60105481565b600e5481565b60075481565b60065481565b600c5490565b610abf611a09565b6001600160a01b0316610ad0610fc1565b6001600160a01b031614610af65760405162461bcd60e51b815260040161043f90612170565b600f805460ff19811660ff90911615179055565b60085481565b600f5460ff1681565b60055481565b610b27611a09565b6001600160a01b0316610b38610fc1565b6001600160a01b031614610b5e5760405162461bcd60e51b815260040161043f90612170565b610b686000611a0d565b565b60005b82811015610f885760015433906001600160a01b0316636352211e868685818110610ba857634e487b7160e01b600052603260045260246000fd5b905060200201356040518263ffffffff1660e01b8152600401610bcb91906121f6565b60206040518083038186803b158015610be357600080fd5b505afa158015610bf7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c1b9190611e74565b6001600160a01b031614610c415760405162461bcd60e51b815260040161043f906121a5565b600f5460ff16610c635760405162461bcd60e51b815260040161043f906121cb565b6040518060800160405280858584818110610c8e57634e487b7160e01b600052603260045260246000fd5b905060200201358152602001336001600160a01b031681526020018381526020014281525060036000868685818110610cd757634e487b7160e01b600052603260045260246000fd5b6020908102929092013583525081810192909252604090810160002083518155918301516001830180546001600160a01b0319166001600160a01b0390921691909117905582015160028201556060909101516003909101557ffda9a7545c45143148b09c92950a0163f9b7cb50f92475a93f7119a6b81cfffd33858584818110610d7257634e487b7160e01b600052603260045260246000fd5b9050602002013584604051610d899392919061207b565b60405180910390a16001546001600160a01b03166323b872dd3330878786818110610dc457634e487b7160e01b600052603260045260246000fd5b905060200201356040518463ffffffff1660e01b8152600401610de99392919061203e565b600060405180830381600087803b158015610e0357600080fd5b505af1158015610e17573d6000803e3d6000fd5b505050508160011415610e3e5760068054906000610e348361229c565b9190505550610f76565b8160021415610edc57600a848483818110610e6957634e487b7160e01b600052603260045260246000fd5b835460018082018655600095865260209586902092909502939093013592019190915550600a54610e9a919061226e565b600b6000868685818110610ebe57634e487b7160e01b600052603260045260246000fd5b90506020020135815260200190815260200160002081905550610f76565b8160031415610f7657600c848483818110610f0757634e487b7160e01b600052603260045260246000fd5b835460018082018655600095865260209586902092909502939093013592019190915550600c54610f38919061226e565b600d6000868685818110610f5c57634e487b7160e01b600052603260045260246000fd5b905060200201358152602001908152602001600020819055505b80610f808161229c565b915050610b6d565b50505050565b60046020526000908152604090205481565b600c8181548110610fb057600080fd5b600091825260209091200154905081565b6000546001600160a01b031690565b600a8181548110610fb057600080fd5b600a5490565b60005b81811015610a835760006003600085858581811061101757634e487b7160e01b600052603260045260246000fd5b6020908102929092013583525081810192909252604090810160002081516080810183528154815260018201546001600160a01b0316938101849052600282015492810192909252600301546060820152915033146110885760405162461bcd60e51b815260040161043f906121a5565b60015430906001600160a01b0316636352211e8686868181106110bb57634e487b7160e01b600052603260045260246000fd5b905060200201356040518263ffffffff1660e01b81526004016110de91906121f6565b60206040518083038186803b1580156110f657600080fd5b505afa15801561110a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061112e9190611e74565b6001600160a01b0316146111545760405162461bcd60e51b815260040161043f90612102565b600f5460ff166111765760405162461bcd60e51b815260040161043f906121cb565b61119a3385858581811061058a57634e487b7160e01b600052603260045260246000fd5b7ff40c55f5015305e6f26299812e61b1009bd793a4eaaabc1ee308bf3f61895dfe308585858181106111dc57634e487b7160e01b600052603260045260246000fd5b905060200201356040516111f1929190612062565b60405180910390a160006003600086868681811061121f57634e487b7160e01b600052603260045260246000fd5b602090810292909201358352508181019290925260409081016000208151608080820184528254825260018301546001600160a01b0316948201949094526002820154818401526003909101546060820152815192830190915291508086868681811061129c57634e487b7160e01b600052603260045260246000fd5b90506020020135815260200182602001516001600160a01b031681526020018260400151815260200142815250600360008787878181106112ed57634e487b7160e01b600052603260045260246000fd5b6020908102929092013583525081810192909252604090810160002083518155918301516001830180546001600160a01b0319166001600160a01b039092169190911790558201516002820155606090910151600390910155508190506113538161229c565b915050610fe9565b600b6020526000908152604090205481565b60095481565b600f5460ff166113955760405162461bcd60e51b815260040161043f906121cb565b6002546010546001600160a01b0390911690639dc29fac9033906113b890611a5d565b6040518363ffffffff1660e01b81526004016113d5929190612062565b600060405180830381600087803b1580156113ef57600080fd5b505af1158015611403573d6000803e3d6000fd5b50505050600160009054906101000a90046001600160a01b03166001600160a01b031663c3017a5d6040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561145757600080fd5b505af115801561146b573d6000803e3d6000fd5b505060108054925082915060006114818361229c565b919050555082156115d857604080516080810182528281523360208083019182528284018681524260608501908152600087815260039384905295909520935184559151600180850180546001600160a01b0319166001600160a01b03909316929092179091559151600284015592519190920155821415611517576006805490600061150d8361229c565b91905055506115d3565b816002141561157757600a80546001818101835560008390527fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a89091018390559054611563919061226e565b6000828152600b60205260409020556115d3565b81600314156115d357600c80546001818101835560008390527fdf6966c971051c3d54ec59162606531493a51404a002842f56009d7e5cf4a8c790910183905590546115c3919061226e565b6000828152600d60205260409020555b610a83565b600154604051632142170760e11b81526001600160a01b03909116906342842e0e9061160c9030903390869060040161203e565b600060405180830381600087803b15801561162657600080fd5b505af115801561163a573d6000803e3d6000fd5b50505050505050565b600061164e82611acf565b90505b919050565b61165e611a09565b6001600160a01b031661166f610fc1565b6001600160a01b0316146116955760405162461bcd60e51b815260040161043f90612170565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6116bf611a09565b6001600160a01b03166116d0610fc1565b6001600160a01b0316146116f65760405162461bcd60e51b815260040161043f90612170565b6001600160a01b03811661171c5760405162461bcd60e51b815260040161043f906120bc565b61172581611a0d565b50565b600d6020526000908152604090205481565b611742611a09565b6001600160a01b0316611753610fc1565b6001600160a01b0316146117795760405162461bcd60e51b815260040161043f90612170565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b6003602081905260009182526040909120805460018201546002830154929093015490926001600160a01b0316919084565b6000818152600360208181526040928390208351608081018552815481526001808301546001600160a01b031693820193909352600282015494810185905292015460608301529091141561194857600a54156118d957600061182f83611acf565b6002546007549192506001600160a01b0316906340c10f199086906118629060649061185c908790611b4b565b90611b57565b6040518363ffffffff1660e01b815260040161187f929190612062565b600060405180830381600087803b15801561189957600080fd5b505af11580156118ad573d6000803e3d6000fd5b505050506118d36118ce606461185c60085485611b4b90919063ffffffff16565b611b63565b506115d3565b6002546001600160a01b03166340c10f19846118f485611acf565b6040518363ffffffff1660e01b8152600401611911929190612062565b600060405180830381600087803b15801561192b57600080fd5b505af115801561193f573d6000803e3d6000fd5b50505050610a83565b806040015160021415610a83576000611962836064611bcd565b90506009548111806119745750600c54155b156119ff576002546000848152600460208190526040918290205491516340c10f1960e01b81526001600160a01b03909316926340c10f19926119b992899201612062565b600060405180830381600087803b1580156119d357600080fd5b505af11580156119e7573d6000803e3d6000fd5b50505060008481526004602052604081205550610f88565b610f888184611c15565b3390565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000611770821015611a7157506064611651565b611f40821015611a83575060c8611651565b612710821015611a965750610190611651565b612ee0821015611aa95750610320611651565b6136b0821015611abc57506103e8611651565b613a9882101561165157506104b0611651565b600081815260036020818152604080842081516080810183528154815260018201546001600160a01b03169381019390935260028101549183019190915290910154606082018190526201518090611b27904261226e565b611b3a9068056bc75e2d6310000061224f565b611b44919061223b565b9392505050565b6000611b44828461224f565b6000611b44828461223b565b6000611b7482600a80549050611bcd565b90508160046000600a8481548110611b9c57634e487b7160e01b600052603260045260246000fd5b906000526020600020015481526020019081526020016000206000828254611bc49190612223565b90915550505050565b60008132611bdc60014361226e565b404286604051602001611bf29493929190611ffb565b6040516020818303038152906040528051906020012060001c611b4491906122b7565b600081815260036020818152604080842081516080810183528154815260018201546001600160a01b031693810193909352600281015491830191909152909101546060820152600c54909190611c6d908590611bcd565b9050600060036000600c8481548110611c9657634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101548352828101939093526040918201902081516080810183528154815260018201546001600160a01b031681850181905260028301548285015260039092015460608201529286015191519293507f7c9a73fbec731b3a3a1295a713e1fc281055cb10f02932b178cfe84b6dcd5bf692611d20929190889061203e565b60405180910390a160408051608081018252858152602083810180516001600160a01b039081168385019081526002858701818152426060880190815260008d815260038089528a822099518a55945160018a0180546001600160a01b03191691881691909117905591518884015551969092019590955593549151600493849052938590205494516340c10f1960e01b81529116936340c10f1993611dc893909201612062565b600060405180830381600087803b158015611de257600080fd5b505af1158015611df6573d6000803e3d6000fd5b5050506000948552505060046020525050604081205550565b60008083601f840112611e20578182fd5b50813567ffffffffffffffff811115611e37578182fd5b6020830191508360208083028501011115611e5157600080fd5b9250929050565b600060208284031215611e69578081fd5b8135611b44816122f7565b600060208284031215611e85578081fd5b8151611b44816122f7565b600080600080600060808688031215611ea7578081fd5b8535611eb2816122f7565b94506020860135611ec2816122f7565b935060408601359250606086013567ffffffffffffffff80821115611ee5578283fd5b818801915088601f830112611ef8578283fd5b813581811115611f06578384fd5b896020828501011115611f17578384fd5b9699959850939650602001949392505050565b60008060208385031215611f3c578182fd5b823567ffffffffffffffff811115611f52578283fd5b611f5e85828601611e0f565b90969095509350505050565b600080600060408486031215611f7e578283fd5b833567ffffffffffffffff811115611f94578384fd5b611fa086828701611e0f565b909790965060209590950135949350505050565b60008060408385031215611fc6578182fd5b82358015158114611fd5578283fd5b946020939093013593505050565b600060208284031215611ff4578081fd5b5035919050565b60609490941b6bffffffffffffffffffffffff1916845260148401929092526034830152605482015260740190565b6001600160a01b0391909116815260200190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039390931683526020830191909152604082015260600190565b901515815260200190565b6001600160e01b031991909116815260200190565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201526564647265737360d01b606082015260800190565b60208082526024908201527f417065206d757374206265207374616b656420696e206f7264657220746f20636040820152636c61696d60e01b606082015260800190565b60208082526010908201526f3120646179207374616b65206c6f636b60801b604082015260600190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252600c908201526b4e6f7420796f75722041706560a01b604082015260600190565b60208082526011908201527014dd185ada5b99c81a5cc81c185d5cd959607a1b604082015260600190565b90815260200190565b9384526001600160a01b039290921660208401526040830152606082015260800190565b60008219821115612236576122366122cb565b500190565b60008261224a5761224a6122e1565b500490565b6000816000190483118215151615612269576122696122cb565b500290565b600082821015612280576122806122cb565b500390565b600081612294576122946122cb565b506000190190565b60006000198214156122b0576122b06122cb565b5060010190565b6000826122c6576122c66122e1565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b6001600160a01b038116811461172557600080fdfea2646970667358221220e7de9d45339cb2b1170dad6ffd2e7908e40eeef483789e9bf9b36459e405d37c64736f6c63430008010033
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106101c45760003560e01c80638b3476bf116100f9578063d23eeb6f11610097578063f2fde38b11610071578063f2fde38b14610341578063f6b0559914610354578063f94abfa014610367578063fdccad551461037a576101c4565b8063d23eeb6f14610308578063da4c2cab1461031b578063ef516fd91461032e576101c4565b8063af3cea12116100d3578063af3cea12146102d2578063b770ab40146102da578063b946e79c146102ed578063cb59639414610300576101c4565b80638b3476bf146102975780638da5cb5b146102aa578063936a3467146102bf576101c4565b80633b8105b31161016657806350cfdec31161014057806350cfdec314610261578063715018a6146102695780637471e11f146102715780637d1aa13b14610284576101c4565b80633b8105b31461023c578063480f7c93146102445780634cf088d91461024c576101c4565b80631f7678ce116101a25780631f7678ce1461021c578063211b341b1461022457806336401db51461022c57806339f7b33614610234576101c4565b80630bed6aab146101c9578063150b7a02146101de57806318160ddd14610207575b600080fd5b6101dc6101d7366004611f2a565b61039d565b005b6101f16101ec366004611e90565b610a88565b6040516101fe91906120a7565b60405180910390f35b61020f610a99565b6040516101fe91906121f6565b61020f610a9f565b61020f610aa5565b61020f610aab565b61020f610ab1565b6101dc610ab7565b61020f610b0a565b610254610b10565b6040516101fe919061209c565b61020f610b19565b6101dc610b1f565b6101dc61027f366004611f6a565b610b6a565b61020f610292366004611fe3565b610f8e565b61020f6102a5366004611fe3565b610fa0565b6102b2610fc1565b6040516101fe919061202a565b61020f6102cd366004611fe3565b610fd0565b61020f610fe0565b6101dc6102e8366004611f2a565b610fe6565b61020f6102fb366004611fe3565b61135b565b61020f61136d565b6101dc610316366004611fb4565b611373565b61020f610329366004611fe3565b611643565b6101dc61033c366004611e58565b611656565b6101dc61034f366004611e58565b6116b7565b61020f610362366004611fe3565b611728565b6101dc610375366004611e58565b61173a565b61038d610388366004611fe3565b61179b565b6040516101fe94939291906121ff565b60005b81811015610a83576000600360008585858181106103ce57634e487b7160e01b600052603260045260246000fd5b6020908102929092013583525081810192909252604090810160002081516080810183528154815260018201546001600160a01b0316938101849052600282015492810192909252600301546060820152915033146104485760405162461bcd60e51b815260040161043f906121a5565b60405180910390fd5b60015430906001600160a01b0316636352211e86868681811061047b57634e487b7160e01b600052603260045260246000fd5b905060200201356040518263ffffffff1660e01b815260040161049e91906121f6565b60206040518083038186803b1580156104b657600080fd5b505afa1580156104ca573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104ee9190611e74565b6001600160a01b0316146105145760405162461bcd60e51b815260040161043f90612102565b600f5460ff166105365760405162461bcd60e51b815260040161043f906121cb565b600e546060820151610548904261226e565b10156105665760405162461bcd60e51b815260040161043f90612146565b6105963385858581811061058a57634e487b7160e01b600052603260045260246000fd5b905060200201356117cd565b8060400151600114156105bd57600680549060006105b383612285565b919050555061083b565b8060400151600214156106fe57600a8054600091906105de9060019061226e565b815481106105fc57634e487b7160e01b600052603260045260246000fd5b9060005260206000200154905080600a600b600088888881811061063057634e487b7160e01b600052603260045260246000fd5b905060200201358152602001908152602001600020548154811061066457634e487b7160e01b600052603260045260246000fd5b9060005260206000200181905550600b600086868681811061069657634e487b7160e01b600052603260045260246000fd5b90506020020135815260200190815260200160002054600b600083815260200190815260200160002081905550600a8054806106e257634e487b7160e01b600052603160045260246000fd5b600190038181906000526020600020016000905590555061083b565b80604001516003141561083b57600c80546000919061071f9060019061226e565b8154811061073d57634e487b7160e01b600052603260045260246000fd5b9060005260206000200154905080600c600d600088888881811061077157634e487b7160e01b600052603260045260246000fd5b90506020020135815260200190815260200160002054815481106107a557634e487b7160e01b600052603260045260246000fd5b9060005260206000200181905550600d60008686868181106107d757634e487b7160e01b600052603260045260246000fd5b90506020020135815260200190815260200160002054600d600083815260200190815260200160002081905550600c80548061082357634e487b7160e01b600052603160045260246000fd5b60019003818190600052602060002001600090559055505b7ff40c55f5015305e6f26299812e61b1009bd793a4eaaabc1ee308bf3f61895dfe3085858581811061087d57634e487b7160e01b600052603260045260246000fd5b90506020020135604051610892929190612062565b60405180910390a16000600360008686868181106108c057634e487b7160e01b600052603260045260246000fd5b602090810292909201358352508181019290925260409081016000208151608081018352815481526001808301546001600160a01b039081169583018690526002840154948301949094526003909201546060820152905490935016906342842e0e90309088888881811061094557634e487b7160e01b600052603260045260246000fd5b905060200201356040518463ffffffff1660e01b815260040161096a9392919061203e565b600060405180830381600087803b15801561098457600080fd5b505af1158015610998573d6000803e3d6000fd5b5050505060405180608001604052808686868181106109c757634e487b7160e01b600052603260045260246000fd5b90506020020135815260200182602001516001600160a01b03168152602001600081526020014281525060036000878787818110610a1557634e487b7160e01b600052603260045260246000fd5b6020908102929092013583525081810192909252604090810160002083518155918301516001830180546001600160a01b0319166001600160a01b03909216919091179055820151600282015560609091015160039091015550819050610a7b8161229c565b9150506103a0565b505050565b630a85bd0160e11b95945050505050565b60105481565b600e5481565b60075481565b60065481565b600c5490565b610abf611a09565b6001600160a01b0316610ad0610fc1565b6001600160a01b031614610af65760405162461bcd60e51b815260040161043f90612170565b600f805460ff19811660ff90911615179055565b60085481565b600f5460ff1681565b60055481565b610b27611a09565b6001600160a01b0316610b38610fc1565b6001600160a01b031614610b5e5760405162461bcd60e51b815260040161043f90612170565b610b686000611a0d565b565b60005b82811015610f885760015433906001600160a01b0316636352211e868685818110610ba857634e487b7160e01b600052603260045260246000fd5b905060200201356040518263ffffffff1660e01b8152600401610bcb91906121f6565b60206040518083038186803b158015610be357600080fd5b505afa158015610bf7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c1b9190611e74565b6001600160a01b031614610c415760405162461bcd60e51b815260040161043f906121a5565b600f5460ff16610c635760405162461bcd60e51b815260040161043f906121cb565b6040518060800160405280858584818110610c8e57634e487b7160e01b600052603260045260246000fd5b905060200201358152602001336001600160a01b031681526020018381526020014281525060036000868685818110610cd757634e487b7160e01b600052603260045260246000fd5b6020908102929092013583525081810192909252604090810160002083518155918301516001830180546001600160a01b0319166001600160a01b0390921691909117905582015160028201556060909101516003909101557ffda9a7545c45143148b09c92950a0163f9b7cb50f92475a93f7119a6b81cfffd33858584818110610d7257634e487b7160e01b600052603260045260246000fd5b9050602002013584604051610d899392919061207b565b60405180910390a16001546001600160a01b03166323b872dd3330878786818110610dc457634e487b7160e01b600052603260045260246000fd5b905060200201356040518463ffffffff1660e01b8152600401610de99392919061203e565b600060405180830381600087803b158015610e0357600080fd5b505af1158015610e17573d6000803e3d6000fd5b505050508160011415610e3e5760068054906000610e348361229c565b9190505550610f76565b8160021415610edc57600a848483818110610e6957634e487b7160e01b600052603260045260246000fd5b835460018082018655600095865260209586902092909502939093013592019190915550600a54610e9a919061226e565b600b6000868685818110610ebe57634e487b7160e01b600052603260045260246000fd5b90506020020135815260200190815260200160002081905550610f76565b8160031415610f7657600c848483818110610f0757634e487b7160e01b600052603260045260246000fd5b835460018082018655600095865260209586902092909502939093013592019190915550600c54610f38919061226e565b600d6000868685818110610f5c57634e487b7160e01b600052603260045260246000fd5b905060200201358152602001908152602001600020819055505b80610f808161229c565b915050610b6d565b50505050565b60046020526000908152604090205481565b600c8181548110610fb057600080fd5b600091825260209091200154905081565b6000546001600160a01b031690565b600a8181548110610fb057600080fd5b600a5490565b60005b81811015610a835760006003600085858581811061101757634e487b7160e01b600052603260045260246000fd5b6020908102929092013583525081810192909252604090810160002081516080810183528154815260018201546001600160a01b0316938101849052600282015492810192909252600301546060820152915033146110885760405162461bcd60e51b815260040161043f906121a5565b60015430906001600160a01b0316636352211e8686868181106110bb57634e487b7160e01b600052603260045260246000fd5b905060200201356040518263ffffffff1660e01b81526004016110de91906121f6565b60206040518083038186803b1580156110f657600080fd5b505afa15801561110a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061112e9190611e74565b6001600160a01b0316146111545760405162461bcd60e51b815260040161043f90612102565b600f5460ff166111765760405162461bcd60e51b815260040161043f906121cb565b61119a3385858581811061058a57634e487b7160e01b600052603260045260246000fd5b7ff40c55f5015305e6f26299812e61b1009bd793a4eaaabc1ee308bf3f61895dfe308585858181106111dc57634e487b7160e01b600052603260045260246000fd5b905060200201356040516111f1929190612062565b60405180910390a160006003600086868681811061121f57634e487b7160e01b600052603260045260246000fd5b602090810292909201358352508181019290925260409081016000208151608080820184528254825260018301546001600160a01b0316948201949094526002820154818401526003909101546060820152815192830190915291508086868681811061129c57634e487b7160e01b600052603260045260246000fd5b90506020020135815260200182602001516001600160a01b031681526020018260400151815260200142815250600360008787878181106112ed57634e487b7160e01b600052603260045260246000fd5b6020908102929092013583525081810192909252604090810160002083518155918301516001830180546001600160a01b0319166001600160a01b039092169190911790558201516002820155606090910151600390910155508190506113538161229c565b915050610fe9565b600b6020526000908152604090205481565b60095481565b600f5460ff166113955760405162461bcd60e51b815260040161043f906121cb565b6002546010546001600160a01b0390911690639dc29fac9033906113b890611a5d565b6040518363ffffffff1660e01b81526004016113d5929190612062565b600060405180830381600087803b1580156113ef57600080fd5b505af1158015611403573d6000803e3d6000fd5b50505050600160009054906101000a90046001600160a01b03166001600160a01b031663c3017a5d6040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561145757600080fd5b505af115801561146b573d6000803e3d6000fd5b505060108054925082915060006114818361229c565b919050555082156115d857604080516080810182528281523360208083019182528284018681524260608501908152600087815260039384905295909520935184559151600180850180546001600160a01b0319166001600160a01b03909316929092179091559151600284015592519190920155821415611517576006805490600061150d8361229c565b91905055506115d3565b816002141561157757600a80546001818101835560008390527fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a89091018390559054611563919061226e565b6000828152600b60205260409020556115d3565b81600314156115d357600c80546001818101835560008390527fdf6966c971051c3d54ec59162606531493a51404a002842f56009d7e5cf4a8c790910183905590546115c3919061226e565b6000828152600d60205260409020555b610a83565b600154604051632142170760e11b81526001600160a01b03909116906342842e0e9061160c9030903390869060040161203e565b600060405180830381600087803b15801561162657600080fd5b505af115801561163a573d6000803e3d6000fd5b50505050505050565b600061164e82611acf565b90505b919050565b61165e611a09565b6001600160a01b031661166f610fc1565b6001600160a01b0316146116955760405162461bcd60e51b815260040161043f90612170565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6116bf611a09565b6001600160a01b03166116d0610fc1565b6001600160a01b0316146116f65760405162461bcd60e51b815260040161043f90612170565b6001600160a01b03811661171c5760405162461bcd60e51b815260040161043f906120bc565b61172581611a0d565b50565b600d6020526000908152604090205481565b611742611a09565b6001600160a01b0316611753610fc1565b6001600160a01b0316146117795760405162461bcd60e51b815260040161043f90612170565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b6003602081905260009182526040909120805460018201546002830154929093015490926001600160a01b0316919084565b6000818152600360208181526040928390208351608081018552815481526001808301546001600160a01b031693820193909352600282015494810185905292015460608301529091141561194857600a54156118d957600061182f83611acf565b6002546007549192506001600160a01b0316906340c10f199086906118629060649061185c908790611b4b565b90611b57565b6040518363ffffffff1660e01b815260040161187f929190612062565b600060405180830381600087803b15801561189957600080fd5b505af11580156118ad573d6000803e3d6000fd5b505050506118d36118ce606461185c60085485611b4b90919063ffffffff16565b611b63565b506115d3565b6002546001600160a01b03166340c10f19846118f485611acf565b6040518363ffffffff1660e01b8152600401611911929190612062565b600060405180830381600087803b15801561192b57600080fd5b505af115801561193f573d6000803e3d6000fd5b50505050610a83565b806040015160021415610a83576000611962836064611bcd565b90506009548111806119745750600c54155b156119ff576002546000848152600460208190526040918290205491516340c10f1960e01b81526001600160a01b03909316926340c10f19926119b992899201612062565b600060405180830381600087803b1580156119d357600080fd5b505af11580156119e7573d6000803e3d6000fd5b50505060008481526004602052604081205550610f88565b610f888184611c15565b3390565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000611770821015611a7157506064611651565b611f40821015611a83575060c8611651565b612710821015611a965750610190611651565b612ee0821015611aa95750610320611651565b6136b0821015611abc57506103e8611651565b613a9882101561165157506104b0611651565b600081815260036020818152604080842081516080810183528154815260018201546001600160a01b03169381019390935260028101549183019190915290910154606082018190526201518090611b27904261226e565b611b3a9068056bc75e2d6310000061224f565b611b44919061223b565b9392505050565b6000611b44828461224f565b6000611b44828461223b565b6000611b7482600a80549050611bcd565b90508160046000600a8481548110611b9c57634e487b7160e01b600052603260045260246000fd5b906000526020600020015481526020019081526020016000206000828254611bc49190612223565b90915550505050565b60008132611bdc60014361226e565b404286604051602001611bf29493929190611ffb565b6040516020818303038152906040528051906020012060001c611b4491906122b7565b600081815260036020818152604080842081516080810183528154815260018201546001600160a01b031693810193909352600281015491830191909152909101546060820152600c54909190611c6d908590611bcd565b9050600060036000600c8481548110611c9657634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101548352828101939093526040918201902081516080810183528154815260018201546001600160a01b031681850181905260028301548285015260039092015460608201529286015191519293507f7c9a73fbec731b3a3a1295a713e1fc281055cb10f02932b178cfe84b6dcd5bf692611d20929190889061203e565b60405180910390a160408051608081018252858152602083810180516001600160a01b039081168385019081526002858701818152426060880190815260008d815260038089528a822099518a55945160018a0180546001600160a01b03191691881691909117905591518884015551969092019590955593549151600493849052938590205494516340c10f1960e01b81529116936340c10f1993611dc893909201612062565b600060405180830381600087803b158015611de257600080fd5b505af1158015611df6573d6000803e3d6000fd5b5050506000948552505060046020525050604081205550565b60008083601f840112611e20578182fd5b50813567ffffffffffffffff811115611e37578182fd5b6020830191508360208083028501011115611e5157600080fd5b9250929050565b600060208284031215611e69578081fd5b8135611b44816122f7565b600060208284031215611e85578081fd5b8151611b44816122f7565b600080600080600060808688031215611ea7578081fd5b8535611eb2816122f7565b94506020860135611ec2816122f7565b935060408601359250606086013567ffffffffffffffff80821115611ee5578283fd5b818801915088601f830112611ef8578283fd5b813581811115611f06578384fd5b896020828501011115611f17578384fd5b9699959850939650602001949392505050565b60008060208385031215611f3c578182fd5b823567ffffffffffffffff811115611f52578283fd5b611f5e85828601611e0f565b90969095509350505050565b600080600060408486031215611f7e578283fd5b833567ffffffffffffffff811115611f94578384fd5b611fa086828701611e0f565b909790965060209590950135949350505050565b60008060408385031215611fc6578182fd5b82358015158114611fd5578283fd5b946020939093013593505050565b600060208284031215611ff4578081fd5b5035919050565b60609490941b6bffffffffffffffffffffffff1916845260148401929092526034830152605482015260740190565b6001600160a01b0391909116815260200190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039390931683526020830191909152604082015260600190565b901515815260200190565b6001600160e01b031991909116815260200190565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201526564647265737360d01b606082015260800190565b60208082526024908201527f417065206d757374206265207374616b656420696e206f7264657220746f20636040820152636c61696d60e01b606082015260800190565b60208082526010908201526f3120646179207374616b65206c6f636b60801b604082015260600190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252600c908201526b4e6f7420796f75722041706560a01b604082015260600190565b60208082526011908201527014dd185ada5b99c81a5cc81c185d5cd959607a1b604082015260600190565b90815260200190565b9384526001600160a01b039290921660208401526040830152606082015260800190565b60008219821115612236576122366122cb565b500190565b60008261224a5761224a6122e1565b500490565b6000816000190483118215151615612269576122696122cb565b500290565b600082821015612280576122806122cb565b500390565b600081612294576122946122cb565b506000190190565b60006000198214156122b0576122b06122cb565b5060010190565b6000826122c6576122c66122e1565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b6001600160a01b038116811461172557600080fdfea2646970667358221220e7de9d45339cb2b1170dad6ffd2e7908e40eeef483789e9bf9b36459e405d37c64736f6c63430008010033
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 33 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.