ERC-721
Overview
Max Total Supply
10,692 SCAMMER
Holders
164
Market
Onchain Market Cap
$0.00
Circulating Supply Market Cap
-
Other Info
Token Contract
Balance
2 SCAMMERLoading...
Loading
Loading...
Loading
Loading...
Loading
Contract Name:
BasicApesToken
Compiler Version
v0.8.0+commit.c7dfd78e
Optimization Enabled:
Yes with 1000 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: WTFPL pragma solidity ^0.8.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "./interfaces/IBasicApesToken.sol"; import "./interfaces/IBank.sol"; import "./interfaces/ITraits.sol"; import "./interfaces/IBAT.sol"; import "./interfaces/ISeed.sol"; contract BasicApesToken is IBasicApesToken, ERC721Enumerable, Ownable, Pausable { // mint price //uint256 public MINT_PRICE = 29 ether; uint256 public MINT_PRICE = 29 ether; // max number of tokens that can be minted - 50000 in production uint256 public immutable MAX_TOKENS = 30000; // number of tokens that can be claimed for free - 20% of MAX_TOKENS // uint256 public PAID_TOKENS = 3500; uint256 public PAID_TOKENS = 5000; // number of tokens have been minted so far uint16 public minted; // mapping from tokenId to a struct containing the token's traits mapping(uint256 => BasicApesTokenTraits) public tokenTraits; // mapping from hashed(tokenTrait) to the tokenId it's associated with // used to ensure there are no duplicates mapping(uint256 => uint256) public existingCombinations; // reference to the Bank for choosing random scammer IBank public bank; // reference to $bat for burning on mint IBAT public bat; // reference to Traits ITraits public traits; mapping(address => uint) private airdrops; bool private _reentrant = false; modifier nonReentrant() { require(!_reentrant, "No reentrancy"); _reentrant = true; _; _reentrant = false; } /** * instantiates contract and rarity tables */ constructor( address _bat, address _traits ) ERC721("Basic Apes Token", "SCAMMER") { bat = IBAT(_bat); traits = ITraits(_traits); _pause(); } function getFreeMintOf(address account) view external returns(uint) { return airdrops[account]; } /***EXTERNAL */ /** * mint a token - 90% Chads, 10% Scammers * The first 20% are free to claim, the remaining cost $bat */ function mint(uint256 amount, bool stake) external payable nonReentrant whenNotPaused { require(tx.origin == _msgSender(), "Only EOA"); require(minted + amount <= MAX_TOKENS, "All tokens minted"); require(amount > 0 && amount <= 30, "Invalid mint amount"); if (minted < PAID_TOKENS) { require( minted + amount <= PAID_TOKENS, "All tokens on-sale already sold" ); require(amount * MINT_PRICE == msg.value, "Invalid payment amount"); } else { require(msg.value == 0); } uint256 totalbatCost = 0; uint16[] memory tokenIds = new uint16[](amount); address[] memory owners = new address[](amount); uint256 seed; uint256 firstMinted = minted; for (uint256 i = 0; i < amount; i++) { minted++; seed = random(minted); generate(minted, seed); address recipient = selectRecipient(seed); totalbatCost += mintCost(minted); if (!stake || recipient != _msgSender()) { owners[i] = recipient; } else { tokenIds[i] = minted; owners[i] = address(bank); } } if (totalbatCost > 0) bat.burn(_msgSender(), totalbatCost); for (uint256 i = 0; i < owners.length; i++) { uint256 id = firstMinted + i + 1; if (!stake || owners[i] != _msgSender()) { _safeMint(owners[i], id); } } if (stake) bank.addManyToBankAndPack(_msgSender(), tokenIds); } function freeMint(uint256 amount, bool stake) external nonReentrant whenNotPaused { require(tx.origin == _msgSender(), "Only EOA"); require(minted + amount <= MAX_TOKENS, "All tokens minted"); require(amount <= airdrops[_msgSender()], "Amount exceed airdrop"); airdrops[_msgSender()] -= amount; uint16[] memory tokenIds = new uint16[](amount); address[] memory owners = new address[](amount); uint256 seed; uint256 firstMinted = minted; for (uint256 i = 0; i < amount; i++) { minted++; seed = random(minted); generate(minted, seed); address recipient = selectRecipient(seed); if (!stake || recipient != _msgSender()) { owners[i] = recipient; } else { tokenIds[i] = minted; owners[i] = address(bank); } } for (uint256 i = 0; i < owners.length; i++) { uint256 id = firstMinted + i + 1; if (!stake || owners[i] != _msgSender()) { _safeMint(owners[i], id); } } if (stake) bank.addManyToBankAndPack(_msgSender(), tokenIds); } /** * the first 20% are paid in AVAX * the next 20% are 20000 $bat * the next 40% are 40000 $bat * the final 20% are 80000 $bat * @param tokenId the ID to check the cost of to mint * @return the cost of the given token ID */ function mintCost(uint256 tokenId) public view returns (uint256) { if (tokenId <= PAID_TOKENS) return 0; if (tokenId <= PAID_TOKENS + 5000) return 5000 ether; if (tokenId <= PAID_TOKENS + 10000) return 7500 ether; if (tokenId <= PAID_TOKENS + 15000) return 10000 ether; if (tokenId <= PAID_TOKENS + 20000) return 12500 ether; return 15000 ether; } function transferFrom( address from, address to, uint256 tokenId ) public virtual override nonReentrant { // Hardcode the Bank's approval so that users don't have to waste gas approving if (_msgSender() != address(bank)) require( _isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved" ); _transfer(from, to, tokenId); } /***INTERNAL */ /** * generates traits for a specific token, checking to make sure it's unique * @param tokenId the id of the token to generate traits for * @param seed a pseudorandom 256 bit number to derive traits from * @return t - a struct of traits for the given token ID */ function generate(uint256 tokenId, uint256 seed) internal returns (BasicApesTokenTraits memory t) { t = selectTraits(seed); if (existingCombinations[structToHash(t)] == 0) { tokenTraits[tokenId] = t; existingCombinations[structToHash(t)] = tokenId; return t; } return generate(tokenId, random(seed)); } /** * uses A.J. Walker's Alias algorithm for O(1) rarity table lookup * ensuring O(1) instead of O(n) reduces mint cost by more than 50% * probability & alias tables are generated off-chain beforehand * @param seed portion of the 256 bit seed to remove trait correlation * @param traitType the trait type to select a trait for * @return the ID of the randomly selected trait */ function selectTrait(uint16 seed, uint8 traitType) internal view returns (uint8) { return traits.selectTrait(seed, traitType); } /** * the first 20% (ETH purchases) go to the minter * the remaining 80% have a 10% chance to be given to a random staked scammer * @param seed a random value to select a recipient from * */ function selectRecipient(uint256 seed) internal view returns (address) { if (minted <= PAID_TOKENS || ((seed >> 245) % 10) != 0) return _msgSender(); // top 10 bits haven't been used address chad = bank.randomScammerOwner(seed >> 144); // 144 bits reserved for trait selection if (chad == address(0x0)) return _msgSender(); return chad; } /** * selects the species and all of its traits based on the seed value * @param seed a pseudorandom 256 bit number to derive traits from * @return t - a struct of randomly selected traits */ function selectTraits(uint256 seed) internal view returns (BasicApesTokenTraits memory t) { t.isChad = (seed & 0xFFFF) % 10 != 0; uint8 shift = t.isChad ? 0 : 10; seed >>= 16; t.uniform = selectTrait(uint16(seed & 0xFFFF), 0 + shift); seed >>= 16; t.hair = selectTrait(uint16(seed & 0xFFFF), 1 + shift); seed >>= 16; t.facialHair = selectTrait(uint16(seed & 0xFFFF), 2 + shift); seed >>= 16; t.eyes = selectTrait(uint16(seed & 0xFFFF), 3 + shift); seed >>= 16; t.accessory = selectTrait(uint16(seed & 0xFFFF), 4 + shift); seed >>= 16; t.headgear = selectTrait(uint16(seed & 0xFFFF), 5 + shift); seed >>= 16; if (!t.isChad) { t.neckGear = selectTrait(uint16(seed & 0xFFFF), 6 + shift); t.alphaIndex = selectTrait(uint16(seed & 0xFFFF), 7 + shift); } } /** * converts a struct to a 256 bit hash to check for uniqueness * @param s the struct to pack into a hash * @return the 256 bit hash of the struct */ function structToHash(BasicApesTokenTraits memory s) internal pure returns (uint256) { return uint256( keccak256( abi.encodePacked( s.isChad, s.uniform, s.hair, s.facialHair, s.eyes, s.headgear, s.accessory, s.neckGear, s.alphaIndex ) ) ); } /** * generates a pseudorandom number * @param seed a value ensure different outcomes for different sources in the same block * @return a pseudorandom value */ function random(uint256 seed) internal view returns (uint256) { return uint256( keccak256( abi.encodePacked( tx.origin, blockhash(block.number - 1), block.timestamp, seed ) ) ); } /***READ */ function getTokenTraits(uint256 tokenId) external view override returns (BasicApesTokenTraits memory) { return tokenTraits[tokenId]; } function getPaidTokens() external view override returns (uint256) { return PAID_TOKENS; } function walletOfOwner(address _owner) public view returns (uint256[] memory){ uint256 ownerTokenCount = balanceOf(_owner); uint256[] memory tokenIds = new uint256[](ownerTokenCount); for (uint256 i; i < ownerTokenCount; i++) { tokenIds[i] = tokenOfOwnerByIndex(_owner, i); } return tokenIds; } /***ADMIN */ /** * called after deployment so that the contract can get random scammer * @param _bank the address of the Bank */ function setBank(address _bank) external onlyOwner { bank = IBank(_bank); } /** * allows owner to withdraw funds from minting */ function withdraw() external onlyOwner { payable(owner()).transfer(address(this).balance); } /** * updates the number of tokens for sale */ function setPaidTokens(uint256 _paidTokens) external onlyOwner { PAID_TOKENS = _paidTokens; } /** * enables owner to pause / unpause minting */ function setPaused(bool _paused) external onlyOwner { if (_paused) _pause(); else _unpause(); } /***RENDER */ function tokenURI(uint256 tokenId) public view override returns (string memory) { require( _exists(tokenId), "ERC721Metadata: URI query for nonexistent token" ); return traits.tokenURI(tokenId); } function changePrice(uint256 _price) public onlyOwner { MINT_PRICE = _price; } function setTraits(address addr) public onlyOwner { traits = ITraits(addr); } function addAirdrops(address[] calldata accounts, uint[] calldata values) public onlyOwner { require(accounts.length == values.length, "Accounts != Values"); for (uint256 i = 0; i < values.length; i++) { airdrops[accounts[i]] = values[i]; } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev 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 { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (security/Pausable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract Pausable is Context { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ constructor() { _paused = false; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { require(!paused(), "Pausable: paused"); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { require(paused(), "Pausable: not paused"); _; } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/ERC721Enumerable.sol) 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: WTFPL pragma solidity ^0.8.0; import "../BasicApesToken.sol"; interface IBasicApesToken { // struct to store each token's traits struct BasicApesTokenTraits { bool isChad; uint8 uniform; uint8 hair; uint8 eyes; uint8 facialHair; uint8 headgear; uint8 neckGear; uint8 accessory; uint8 alphaIndex; } function getPaidTokens() external view returns (uint256); function getTokenTraits(uint256 tokenId) external view returns (BasicApesTokenTraits memory); }
// SPDX-License-Identifier: WTFPL pragma solidity ^0.8.0; import "../Bank.sol"; interface IBank { function addManyToBankAndPack(address account, uint16[] calldata tokenIds) external; function randomScammerOwner(uint256 seed) external view returns (address); function bank(uint256) external view returns ( uint16, uint80, address ); function totalLootEarned() external view returns (uint256); function lastClaimTimestamp() external view returns (uint256); function setOldTokenInfo(uint256 _tokenId) external; function pack(uint256, uint256) external view returns (Bank.Stake memory); function packIndices(uint256) external view returns (uint256); }
// SPDX-License-Identifier: MIT LICENSE pragma solidity ^0.8.0; interface ITraits { function tokenURI(uint256 tokenId) external view returns (string memory); function selectTrait(uint16 seed, uint8 traitType) external view returns (uint8); }
// SPDX-License-Identifier: WTFPL pragma solidity ^0.8.0; interface IBAT { function burn(address from, uint256 amount) external; }
// SPDX-License-Identifier: WTFPL pragma solidity ^0.8.0; interface ISeed { function seed() external view returns (uint256); function update(uint256 _seed) external returns (uint256); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/ERC721.sol) pragma solidity ^0.8.0; import "./IERC721.sol"; import "./IERC721Receiver.sol"; import "./extensions/IERC721Metadata.sol"; import "../../utils/Address.sol"; import "../../utils/Context.sol"; import "../../utils/Strings.sol"; import "../../utils/introspection/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 { _setApprovalForAll(_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 Approve `operator` to operate on all of `owner` tokens * * Emits a {ApprovalForAll} event. */ function _setApprovalForAll( address owner, address operator, bool approved ) internal virtual { require(owner != operator, "ERC721: approve to caller"); _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } /** * @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 // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Enumerable.sol) 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 // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, 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 // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol) pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol) pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Address.sol) 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 // OpenZeppelin Contracts v4.4.1 (utils/Strings.sol) 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 // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: WTFPL pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; import "./BasicApesToken.sol"; import "./BAT.sol"; import "./interfaces/IBank.sol"; contract Bank is Ownable, IERC721Receiver, Pausable { // maximum alpha score uint8 public constant MAX_ALPHA = 8; // struct to store a stake's token, owner, and earning values struct Stake { uint16 tokenId; uint80 value; address owner; } event TokenStaked(address owner, uint256 tokenId, uint256 value); event ThiefClaimed(uint256 tokenId, uint256 earned, bool unstaked); event PoliceClaimed(uint256 tokenId, uint256 earned, bool unstaked); mapping(address => uint[]) private bags; // reference to the ChadAndScammer NFT contract BasicApesToken game; // reference to the $bat contract for minting $bat earnings BAT bat; // maps tokenId to stake mapping(uint256 => Stake) public bank; // maps alpha to all Police stakes with that alpha mapping(uint256 => Stake[]) public pack; // tracks location of each Police in Pack mapping(uint256 => uint256) public packIndices; // total alpha scores staked uint256 public totalAlphaStaked = 0; // any rewards distributed when no wolves are staked uint256 public unaccountedRewards = 0; // amount of $bat due for each alpha point staked uint256 public batPerAlpha = 0; // thief earn 10000 $bat per day uint256 public DAILY_bat_RATE = 2500 ether; // thief must have 2 days worth of $bat to unstake or else it's too cold // uint256 public MINIMUM_TO_EXIT = 2 days; uint256 public MINIMUM_TO_EXIT = 2 days; // wolves take a 20% tax on all $bat claimed uint256 public constant bat_CLAIM_TAX_PERCENTAGE = 20; // there will only ever be (roughly) 2.4 billion $bat earned through staking uint256 public constant MAXIMUM_GLOBAL_bat = 1000000000 ether; // amount of $bat earned so far uint256 public totalbatEarned; // number of Thief staked in the Bank uint256 public totalThiefStaked; // the last time $bat was claimed uint256 public lastClaimTimestamp; // emergency rescue to allow unstaking without any checks but without $bat bool public rescueEnabled = false; bool private _reentrant = false; bool public canClaim = false; modifier nonReentrant() { require(!_reentrant, "No reentrancy"); _reentrant = true; _; _reentrant = false; } function _remove(address account, uint _tokenId) internal { uint[] storage bag = bags[account]; for (uint256 i = 0; i < bag.length; i++) { if(bag[i] == _tokenId) { bag[i] = bag[bag.length - 1]; bag.pop(); break; } } } function _add(address account, uint _tokenId) internal { uint[] storage bag = bags[account]; bag.push(_tokenId); } function getTokensOf(address account) view external returns(uint[] memory) { return bags[account]; } /** * @param _game reference to the ChadAndScammer NFT contract * @param _bat reference to the $bat token */ constructor( address _game, address _bat ) { game = BasicApesToken(_game); bat = BAT(_bat); _pause(); } /***STAKING */ /** * adds Thief and Polices to the Bank and Pack * @param account the address of the staker * @param tokenIds the IDs of the Thief and Polices to stake */ function addManyToBankAndPack(address account, uint16[] calldata tokenIds) external whenNotPaused nonReentrant { require( (account == _msgSender() && account == tx.origin) || _msgSender() == address(game), "DONT GIVE YOUR TOKENS AWAY" ); for (uint256 i = 0; i < tokenIds.length; i++) { if (tokenIds[i] == 0) { continue; } _add(_msgSender(), tokenIds[i]); if (_msgSender() != address(game)) { // dont do this step if its a mint + stake require(game.ownerOf(tokenIds[i]) == _msgSender(), "AINT YO TOKEN"); game.transferFrom(_msgSender(), address(this), tokenIds[i]); } if (isThief(tokenIds[i])) _addThiefToBank(account, tokenIds[i]); else _addPoliceToPack(account, tokenIds[i]); } } /** * adds a single Thief to the Bank * @param account the address of the staker * @param tokenId the ID of the Thief to add to the Bank */ function _addThiefToBank(address account, uint256 tokenId) internal whenNotPaused _updateEarnings { bank[tokenId] = Stake({ owner: account, tokenId: uint16(tokenId), value: uint80(block.timestamp) }); totalThiefStaked += 1; emit TokenStaked(account, tokenId, block.timestamp); } function _addThiefToBankWithTime( address account, uint256 tokenId, uint256 time ) internal { totalbatEarned += ((time - lastClaimTimestamp) * totalThiefStaked * DAILY_bat_RATE) / 1 days; bank[tokenId] = Stake({ owner: account, tokenId: uint16(tokenId), value: uint80(time) }); totalThiefStaked += 1; emit TokenStaked(account, tokenId, time); } /** * adds a single Police to the Pack * @param account the address of the staker * @param tokenId the ID of the Police to add to the Pack */ function _addPoliceToPack(address account, uint256 tokenId) internal { uint256 alpha = _alphaForPolice(tokenId); totalAlphaStaked += alpha; // Portion of earnings ranges from 8 to 5 packIndices[tokenId] = pack[alpha].length; // Store the location of the police in the Pack pack[alpha].push( Stake({ owner: account, tokenId: uint16(tokenId), value: uint80(batPerAlpha) }) ); // Add the police to the Pack emit TokenStaked(account, tokenId, batPerAlpha); } /***CLAIMING / UNSTAKING */ /** * realize $bat earnings and optionally unstake tokens from the Bank / Pack * to unstake a Thief it will require it has 2 days worth of $bat unclaimed * @param tokenIds the IDs of the tokens to claim earnings from * @param unstake whether or not to unstake ALL of the tokens listed in tokenIds */ function claimManyFromBankAndPack(uint16[] calldata tokenIds, bool unstake) external nonReentrant _updateEarnings { require(msg.sender == tx.origin, "Only EOA"); require(canClaim, "Claim deactive"); uint256 owed = 0; for (uint256 i = 0; i < tokenIds.length; i++) { if (isThief(tokenIds[i])) owed += _claimThiefFromBank(tokenIds[i], unstake); else owed += _claimPoliceFromPack(tokenIds[i], unstake); } if (owed == 0) return; bat.mint(_msgSender(), owed); } function estimatedRevenuesOf(uint16[] calldata tokenIds) view external returns(uint) { uint owed = 0; for (uint256 i = 0; i < tokenIds.length; i++) { if (isThief(tokenIds[i])) { Stake memory stake = bank[tokenIds[i]]; uint newOwed = 0; if (totalbatEarned < MAXIMUM_GLOBAL_bat) { newOwed = ((block.timestamp - stake.value) * DAILY_bat_RATE) / 1 days; } else if (stake.value > lastClaimTimestamp) { newOwed = 0; } else { newOwed = ((lastClaimTimestamp - stake.value) * DAILY_bat_RATE) / 1 days; } owed += (newOwed * (100 - bat_CLAIM_TAX_PERCENTAGE)) / 100; } else { uint256 alpha = _alphaForPolice(tokenIds[i]); Stake memory stake = pack[alpha][packIndices[tokenIds[i]]]; owed += (alpha) * (batPerAlpha - stake.value); } } return owed; } /** * realize $bat earnings for a single Thief and optionally unstake it * if not unstaking, pay a 20% tax to the staked Polices * if unstaking, there is a 50% chance all $bat is stolen * @param tokenId the ID of the Thief to claim earnings from * @param unstake whether or not to unstake the Thief * @return owed - the amount of $bat earned */ function _claimThiefFromBank(uint256 tokenId, bool unstake) internal returns (uint256 owed) { Stake memory stake = bank[tokenId]; require(stake.owner == _msgSender(), "SWIPER, NO SWIPING"); require( !(unstake && block.timestamp - stake.value < MINIMUM_TO_EXIT), "GONNA BE COLD WITHOUT TWO DAY'S bat" ); if (totalbatEarned < MAXIMUM_GLOBAL_bat) { owed = ((block.timestamp - stake.value) * DAILY_bat_RATE) / 1 days; } else if (stake.value > lastClaimTimestamp) { owed = 0; // $bat production stopped already } else { owed = ((lastClaimTimestamp - stake.value) * DAILY_bat_RATE) / 1 days; // stop earning additional $bat if it's all been earned } if (unstake) { _remove(_msgSender(), tokenId); if (random(tokenId) & 1 == 1) { // 50% chance of all $bat stolen _payPoliceTax(owed); owed = 0; } game.transferFrom(address(this), _msgSender(), tokenId); // send back Thief delete bank[tokenId]; totalThiefStaked -= 1; } else { _payPoliceTax((owed * bat_CLAIM_TAX_PERCENTAGE) / 100); // percentage tax to staked wolves owed = (owed * (100 - bat_CLAIM_TAX_PERCENTAGE)) / 100; // remainder goes to Thief owner bank[tokenId] = Stake({ owner: _msgSender(), tokenId: uint16(tokenId), value: uint80(block.timestamp) }); // reset stake } emit ThiefClaimed(tokenId, owed, unstake); } /** * realize $bat earnings for a single Police and optionally unstake it * Polices earn $bat proportional to their Alpha rank * @param tokenId the ID of the Police to claim earnings from * @param unstake whether or not to unstake the Police * @return owed - the amount of $bat earned */ function _claimPoliceFromPack(uint256 tokenId, bool unstake) internal returns (uint256 owed) { require(game.ownerOf(tokenId) == address(this), "AINT A PART OF THE PACK"); uint256 alpha = _alphaForPolice(tokenId); Stake memory stake = pack[alpha][packIndices[tokenId]]; require(stake.owner == _msgSender(), "SWIPER, NO SWIPING"); owed = (alpha) * (batPerAlpha - stake.value); // Calculate portion of tokens based on Alpha if (unstake) { _remove(_msgSender(), tokenId); totalAlphaStaked -= alpha; // Remove Alpha from total staked game.transferFrom(address(this), _msgSender(), tokenId); // Send back Police Stake memory lastStake = pack[alpha][pack[alpha].length - 1]; pack[alpha][packIndices[tokenId]] = lastStake; // Shuffle last Police to current position packIndices[lastStake.tokenId] = packIndices[tokenId]; pack[alpha].pop(); // Remove duplicate delete packIndices[tokenId]; // Delete old mapping } else { pack[alpha][packIndices[tokenId]] = Stake({ owner: _msgSender(), tokenId: uint16(tokenId), value: uint80(batPerAlpha) }); // reset stake } emit PoliceClaimed(tokenId, owed, unstake); } /** * emergency unstake tokens * @param tokenIds the IDs of the tokens to claim earnings from */ function rescue(uint256[] calldata tokenIds) external nonReentrant { require(rescueEnabled, "RESCUE DISABLED"); uint256 tokenId; Stake memory stake; Stake memory lastStake; uint256 alpha; for (uint256 i = 0; i < tokenIds.length; i++) { tokenId = tokenIds[i]; _remove(_msgSender(), tokenId); if (isThief(tokenId)) { stake = bank[tokenId]; require(stake.owner == _msgSender(), "SWIPER, NO SWIPING"); game.transferFrom(address(this), _msgSender(), tokenId); // send back Thief delete bank[tokenId]; totalThiefStaked -= 1; emit ThiefClaimed(tokenId, 0, true); } else { alpha = _alphaForPolice(tokenId); stake = pack[alpha][packIndices[tokenId]]; require(stake.owner == _msgSender(), "SWIPER, NO SWIPING"); totalAlphaStaked -= alpha; // Remove Alpha from total staked game.transferFrom(address(this), _msgSender(), tokenId); // Send back Police lastStake = pack[alpha][pack[alpha].length - 1]; pack[alpha][packIndices[tokenId]] = lastStake; // Shuffle last Police to current position packIndices[lastStake.tokenId] = packIndices[tokenId]; pack[alpha].pop(); // Remove duplicate delete packIndices[tokenId]; // Delete old mapping emit PoliceClaimed(tokenId, 0, true); } } } /***ACCOUNTING */ /** * add $bat to claimable pot for the Pack * @param amount $bat to add to the pot */ function _payPoliceTax(uint256 amount) internal { if (totalAlphaStaked == 0) { // if there's no staked wolves unaccountedRewards += amount; // keep track of $bat due to wolves return; } // makes sure to include any unaccounted $bat batPerAlpha += (amount + unaccountedRewards) / totalAlphaStaked; unaccountedRewards = 0; } /** * tracks $bat earnings to ensure it stops once 2.4 billion is eclipsed */ modifier _updateEarnings() { if (totalbatEarned < MAXIMUM_GLOBAL_bat) { totalbatEarned += ((block.timestamp - lastClaimTimestamp) * totalThiefStaked * DAILY_bat_RATE) / 1 days; lastClaimTimestamp = block.timestamp; } _; } /***ADMIN */ function setSettings(uint256 rate, uint256 exit) external onlyOwner { MINIMUM_TO_EXIT = exit; DAILY_bat_RATE = rate; } /** * allows owner to enable "rescue mode" * simplifies accounting, prioritizes tokens out in emergency */ function setRescueEnabled(bool _enabled) external onlyOwner { rescueEnabled = _enabled; } /** * enables owner to pause / unpause minting */ function setPaused(bool _paused) external onlyOwner { if (_paused) _pause(); else _unpause(); } /***READ ONLY */ /** * checks if a token is a Thief * @param tokenId the ID of the token to check * @return thief - whether or not a token is a Thief */ function isThief(uint256 tokenId) public view returns (bool thief) { (thief, , , , , , , , ) = game.tokenTraits(tokenId); } /** * gets the alpha score for a Police * @param tokenId the ID of the Police to get the alpha score for * @return the alpha score of the Police (5-8) */ function _alphaForPolice(uint256 tokenId) internal view returns (uint8) { (, , , , , , , , uint8 alphaIndex) = game.tokenTraits(tokenId); return MAX_ALPHA - alphaIndex; // alpha index is 0-3 } /** * chooses a random Police thief when a newly minted token is stolen * @param seed a random value to choose a Police from * @return the owner of the randomly selected Police thief */ function randomScammerOwner(uint256 seed) external view returns (address) { if (totalAlphaStaked == 0) return address(0x0); uint256 bucket = (seed & 0xFFFFFFFF) % totalAlphaStaked; // choose a value from 0 to total alpha staked uint256 cumulative; seed >>= 32; // loop through each bucket of Polices with the same alpha score for (uint256 i = MAX_ALPHA - 3; i <= MAX_ALPHA; i++) { cumulative += pack[i].length * i; // if the value is not inside of that bucket, keep going if (bucket >= cumulative) continue; // get the address of a random Police with that alpha score return pack[i][seed % pack[i].length].owner; } return address(0x0); } /** * generates a pseudorandom number * @param seed a value ensure different outcomes for different sources in the same block * @return a pseudorandom value */ function random(uint256 seed) internal view returns (uint256) { return uint256( keccak256( abi.encodePacked( tx.origin, blockhash(block.number - 1), block.timestamp, seed, totalThiefStaked, totalAlphaStaked, lastClaimTimestamp ) ) ); } function onERC721Received( address, address from, uint256, bytes calldata ) external pure override returns (bytes4) { require(from == address(0x0), "Cannot send tokens to Barn directly"); return IERC721Receiver.onERC721Received.selector; } function setGame(address _nGame) public onlyOwner { game = BasicApesToken(_nGame); } function setClaiming(bool _canClaim) public onlyOwner { canClaim = _canClaim; } }
// SPDX-License-Identifier: WTFPL pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; contract BAT is ERC20, Ownable { // a mapping from an address to whether or not it can mint / burn mapping(address => bool) controllers; constructor() ERC20("BAT", "BAT") { _mint(msg.sender, 120000*10**18); } /** * mints $BAT to a recipient * @param to the recipient of the $BAT * @param amount the amount of $BAT to mint */ function mint(address to, uint256 amount) external { require(controllers[msg.sender], "Only controllers can mint"); _mint(to, amount); } /** * burns $BAT from a holder * @param from the holder of the $BAT * @param amount the amount of $BAT to burn */ function burn(address from, uint256 amount) external { require(controllers[msg.sender], "Only controllers can burn"); _burn(from, amount); } /** * enables an address to mint / burn * @param controller the address to enable */ function addController(address controller) external onlyOwner { controllers[controller] = true; } /** * disables an address from minting / burning * @param controller the address to disbale */ function removeController(address controller) external onlyOwner { controllers[controller] = false; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/ERC20.sol) pragma solidity ^0.8.0; import "./IERC20.sol"; import "./extensions/IERC20Metadata.sol"; import "../../utils/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 // OpenZeppelin Contracts v4.4.1 (token/ERC20/IERC20.sol) 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 // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) 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": 1000 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_bat","type":"address"},{"internalType":"address","name":"_traits","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"MAX_TOKENS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINT_PRICE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PAID_TOKENS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"accounts","type":"address[]"},{"internalType":"uint256[]","name":"values","type":"uint256[]"}],"name":"addAirdrops","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bank","outputs":[{"internalType":"contract IBank","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bat","outputs":[{"internalType":"contract IBAT","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_price","type":"uint256"}],"name":"changePrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"existingCombinations","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bool","name":"stake","type":"bool"}],"name":"freeMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getFreeMintOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPaidTokens","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getTokenTraits","outputs":[{"components":[{"internalType":"bool","name":"isChad","type":"bool"},{"internalType":"uint8","name":"uniform","type":"uint8"},{"internalType":"uint8","name":"hair","type":"uint8"},{"internalType":"uint8","name":"eyes","type":"uint8"},{"internalType":"uint8","name":"facialHair","type":"uint8"},{"internalType":"uint8","name":"headgear","type":"uint8"},{"internalType":"uint8","name":"neckGear","type":"uint8"},{"internalType":"uint8","name":"accessory","type":"uint8"},{"internalType":"uint8","name":"alphaIndex","type":"uint8"}],"internalType":"struct IBasicApesToken.BasicApesTokenTraits","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bool","name":"stake","type":"bool"}],"name":"mint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"mintCost","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minted","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_bank","type":"address"}],"name":"setBank","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_paidTokens","type":"uint256"}],"name":"setPaidTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_paused","type":"bool"}],"name":"setPaused","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"setTraits","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokenTraits","outputs":[{"internalType":"bool","name":"isChad","type":"bool"},{"internalType":"uint8","name":"uniform","type":"uint8"},{"internalType":"uint8","name":"hair","type":"uint8"},{"internalType":"uint8","name":"eyes","type":"uint8"},{"internalType":"uint8","name":"facialHair","type":"uint8"},{"internalType":"uint8","name":"headgear","type":"uint8"},{"internalType":"uint8","name":"neckGear","type":"uint8"},{"internalType":"uint8","name":"accessory","type":"uint8"},{"internalType":"uint8","name":"alphaIndex","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"traits","outputs":[{"internalType":"contract ITraits","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"walletOfOwner","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60a060405268019274b259f6540000600b55617530608052611388600c556014805460ff191690553480156200003457600080fd5b506040516200427d3803806200427d8339810160408190526200005791620002e3565b604080518082018252601081526f2130b9b4b19020b832b9902a37b5b2b760811b60208083019182528351808501909452600784526629a1a0a6a6a2a960c91b908401528151919291620000ae9160009162000220565b508051620000c490600190602084019062000220565b505050620000e1620000db6200013060201b60201c565b62000134565b600a805460ff60a01b19169055601180546001600160a01b038085166001600160a01b03199283161790925560128054928416929091169190911790556200012862000186565b505062000395565b3390565b600a80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6200019062000210565b15620001b95760405162461bcd60e51b8152600401620001b0906200032e565b60405180910390fd5b600a805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258620001f762000130565b6040516200020691906200031a565b60405180910390a1565b600a54600160a01b900460ff1690565b8280546200022e9062000358565b90600052602060002090601f0160209004810192826200025257600085556200029d565b82601f106200026d57805160ff19168380011785556200029d565b828001600101855582156200029d579182015b828111156200029d57825182559160200191906001019062000280565b50620002ab929150620002af565b5090565b5b80821115620002ab5760008155600101620002b0565b80516001600160a01b0381168114620002de57600080fd5b919050565b60008060408385031215620002f6578182fd5b6200030183620002c6565b91506200031160208401620002c6565b90509250929050565b6001600160a01b0391909116815260200190565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b6002810460018216806200036d57607f821691505b602082108114156200038f57634e487b7160e01b600052602260045260246000fd5b50919050565b608051613ebe620003bf60003960008181610ad4015281816115080152611e5f0152613ebe6000f3fe6080604052600436106102dc5760003560e01c80636352211e11610184578063a2b40d19116100d6578063e05c57bf1161008a578063f2fde38b11610064578063f2fde38b146107c0578063f47c84c5146107e0578063ff72c845146107f5576102dc565b8063e05c57bf14610756578063e1fc334f1461078b578063e985e9c5146107a0576102dc565b8063c002d23d116100bb578063c002d23d1461070c578063c084f54014610721578063c87b56dd14610736576102dc565b8063a2b40d19146106cc578063b88d4fde146106ec576102dc565b806376cdb03b1161013857806395d89b411161011257806395d89b4114610677578063a1b8f3741461068c578063a22cb465146106ac576102dc565b806376cdb03b146106205780638da5cb5b1461063557806394e568471461064a576102dc565b80636f4f7366116101695780636f4f7366146105cb57806370a08231146105eb578063715018a61461060b576102dc565b80636352211e1461059857806367f68fac146105b8576102dc565b806323b872dd1161023d5780634018b1f8116101f15780634f02c420116101cb5780634f02c420146105415780634f6ccce7146105635780635c975abb14610583576102dc565b80634018b1f8146104df57806342842e0e146104f4578063438b630014610514576102dc565b80632f745c59116102225780632f745c591461048a5780633431a753146104aa5780633ccfd60b146104ca576102dc565b806323b872dd1461044a57806327de8f271461046a576102dc565b8063095ea7b3116102945780630db77dc9116102795780630db77dc9146103f557806316c38b3c1461041557806318160ddd14610435576102dc565b8063095ea7b3146103b55780630c8d6695146103d5576102dc565b806306fdde03116102c557806306fdde0314610344578063081812fc14610366578063090d23b914610393576102dc565b806301ffc9a7146102e157806302f1f0b214610317575b600080fd5b3480156102ed57600080fd5b506103016102fc366004613052565b61080a565b60405161030e919061337c565b60405180910390f35b34801561032357600080fd5b50610337610332366004612e19565b610850565b60405161030e9190613ca5565b34801561035057600080fd5b5061035961086b565b60405161030e91906133d1565b34801561037257600080fd5b506103866103813660046130fd565b6108fd565b60405161030e9190613275565b34801561039f57600080fd5b506103b36103ae366004612e19565b610949565b005b3480156103c157600080fd5b506103b36103d0366004612fa4565b6109aa565b3480156103e157600080fd5b506103b36103f0366004613115565b610a42565b34801561040157600080fd5b506103b3610410366004612fcf565b610f21565b34801561042157600080fd5b506103b3610430366004613038565b61101d565b34801561044157600080fd5b5061033761107a565b34801561045657600080fd5b506103b3610465366004612e89565b611080565b34801561047657600080fd5b506103376104853660046130fd565b611119565b34801561049657600080fd5b506103376104a5366004612fa4565b6111d5565b3480156104b657600080fd5b506103b36104c53660046130fd565b61122a565b3480156104d657600080fd5b506103b361126e565b3480156104eb57600080fd5b506103376112ed565b34801561050057600080fd5b506103b361050f366004612e89565b6112f3565b34801561052057600080fd5b5061053461052f366004612e19565b61130e565b60405161030e9190613338565b34801561054d57600080fd5b506105566113cc565b60405161030e9190613c7f565b34801561056f57600080fd5b5061033761057e3660046130fd565b6113d6565b34801561058f57600080fd5b50610301611431565b3480156105a457600080fd5b506103866105b33660046130fd565b611441565b6103b36105c6366004613115565b611476565b3480156105d757600080fd5b506103b36105e6366004612e19565b6119f4565b3480156105f757600080fd5b50610337610606366004612e19565b611a55565b34801561061757600080fd5b506103b3611a99565b34801561062c57600080fd5b50610386611ae4565b34801561064157600080fd5b50610386611af3565b34801561065657600080fd5b5061066a6106653660046130fd565b611b02565b60405161030e9190613bd6565b34801561068357600080fd5b50610359611bb5565b34801561069857600080fd5b506103376106a73660046130fd565b611bc4565b3480156106b857600080fd5b506103b36106c7366004612f70565b611bd6565b3480156106d857600080fd5b506103b36106e73660046130fd565b611bec565b3480156106f857600080fd5b506103b3610707366004612ec9565b611c30565b34801561071857600080fd5b50610337611c6f565b34801561072d57600080fd5b50610337611c75565b34801561074257600080fd5b506103596107513660046130fd565b611c7b565b34801561076257600080fd5b506107766107713660046130fd565b611d3f565b60405161030e99989796959493929190613387565b34801561079757600080fd5b50610386611db2565b3480156107ac57600080fd5b506103016107bb366004612e51565b611dc1565b3480156107cc57600080fd5b506103b36107db366004612e19565b611def565b3480156107ec57600080fd5b50610337611e5d565b34801561080157600080fd5b50610386611e81565b60006001600160e01b031982167f780e9d63000000000000000000000000000000000000000000000000000000001480610848575061084882611e90565b90505b919050565b6001600160a01b031660009081526013602052604090205490565b60606000805461087a90613d9f565b80601f01602080910402602001604051908101604052809291908181526020018280546108a690613d9f565b80156108f35780601f106108c8576101008083540402835291602001916108f3565b820191906000526020600020905b8154815290600101906020018083116108d657829003601f168201915b5050505050905090565b600061090882611f02565b61092d5760405162461bcd60e51b815260040161092490613916565b60405180910390fd5b506000908152600460205260409020546001600160a01b031690565b610951611f1f565b6001600160a01b0316610962611af3565b6001600160a01b0316146109885760405162461bcd60e51b815260040161092490613962565b601080546001600160a01b0319166001600160a01b0392909216919091179055565b60006109b582611441565b9050806001600160a01b0316836001600160a01b031614156109e95760405162461bcd60e51b815260040161092490613a51565b806001600160a01b03166109fb611f1f565b6001600160a01b03161480610a175750610a17816107bb611f1f565b610a335760405162461bcd60e51b8152600401610924906137ca565b610a3d8383611f23565b505050565b60145460ff1615610a655760405162461bcd60e51b815260040161092490613645565b6014805460ff19166001179055610a7a611431565b15610a975760405162461bcd60e51b815260040161092490613793565b610a9f611f1f565b6001600160a01b0316326001600160a01b031614610acf5760405162461bcd60e51b81526004016109249061360e565b600d547f000000000000000000000000000000000000000000000000000000000000000090610b0390849061ffff16613d00565b1115610b215760405162461bcd60e51b815260040161092490613532565b60136000610b2d611f1f565b6001600160a01b03166001600160a01b0316815260200190815260200160002054821115610b6d5760405162461bcd60e51b8152600401610924906135d7565b8160136000610b7a611f1f565b6001600160a01b03166001600160a01b031681526020019081526020016000206000828254610ba99190613d5c565b90915550600090508267ffffffffffffffff811115610bd857634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610c01578160200160208202803683370190505b50905060008367ffffffffffffffff811115610c2d57634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610c56578160200160208202803683370190505b50600d5490915060009061ffff16815b86811015610de257600d805461ffff16906000610c8283613dd4565b82546101009290920a61ffff818102199093169183160217909155600d54610cab925016611f91565b600d54909350610cbf9061ffff1684611fd3565b506000610ccb84612187565b9050861580610cf35750610cdd611f1f565b6001600160a01b0316816001600160a01b031614155b15610d3e5780858381518110610d1957634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b031681525050610dcf565b600d54865161ffff90911690879084908110610d6a57634e487b7160e01b600052603260045260246000fd5b61ffff9092166020928302919091019091015260105485516001600160a01b0390911690869084908110610dae57634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b0316815250505b5080610dda81613df6565b915050610c66565b5060005b8351811015610e9e576000610dfb8284613d00565b610e06906001613d00565b9050861580610e555750610e18611f1f565b6001600160a01b0316858381518110610e4157634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b031614155b15610e8b57610e8b858381518110610e7d57634e487b7160e01b600052603260045260246000fd5b602002602001015182612282565b5080610e9681613df6565b915050610de6565b508415610f0f576010546001600160a01b0316635b519142610ebe611f1f565b866040518363ffffffff1660e01b8152600401610edc9291906132c5565b600060405180830381600087803b158015610ef657600080fd5b505af1158015610f0a573d6000803e3d6000fd5b505050505b50506014805460ff1916905550505050565b610f29611f1f565b6001600160a01b0316610f3a611af3565b6001600160a01b031614610f605760405162461bcd60e51b815260040161092490613962565b828114610f7f5760405162461bcd60e51b815260040161092490613b0b565b60005b8181101561101657828282818110610faa57634e487b7160e01b600052603260045260246000fd5b9050602002013560136000878785818110610fd557634e487b7160e01b600052603260045260246000fd5b9050602002016020810190610fea9190612e19565b6001600160a01b031681526020810191909152604001600020558061100e81613df6565b915050610f82565b5050505050565b611025611f1f565b6001600160a01b0316611036611af3565b6001600160a01b03161461105c5760405162461bcd60e51b815260040161092490613962565b801561106f5761106a61229c565b611077565b611077612314565b50565b60085490565b60145460ff16156110a35760405162461bcd60e51b815260040161092490613645565b6014805460ff191660011790556010546001600160a01b03166110c4611f1f565b6001600160a01b0316146110ff576110e36110dd611f1f565b8261236e565b6110ff5760405162461bcd60e51b815260040161092490613aae565b61110a8383836123f3565b50506014805460ff1916905550565b6000600c54821161112c5750600061084b565b600c5461113b90611388613d00565b8211611152575069010f0cf064dd5920000061084b565b600c5461116190612710613d00565b821161117857506901969368974c05b0000061084b565b600c5461118790613a98613d00565b821161119e575069021e19e0c9bab240000061084b565b600c546111ad90614e20613d00565b82116111c457506902a5a058fc295ed0000061084b565b5069032d26d12e980b600000919050565b60006111e083611a55565b82106111fe5760405162461bcd60e51b81526004016109249061341b565b506001600160a01b03821660009081526006602090815260408083208484529091529020545b92915050565b611232611f1f565b6001600160a01b0316611243611af3565b6001600160a01b0316146112695760405162461bcd60e51b815260040161092490613962565b600c55565b611276611f1f565b6001600160a01b0316611287611af3565b6001600160a01b0316146112ad5760405162461bcd60e51b815260040161092490613962565b6112b5611af3565b6001600160a01b03166108fc479081150290604051600060405180830381858888f19350505050158015611077573d6000803e3d6000fd5b600c5490565b610a3d83838360405180602001604052806000815250611c30565b6060600061131b83611a55565b905060008167ffffffffffffffff81111561134657634e487b7160e01b600052604160045260246000fd5b60405190808252806020026020018201604052801561136f578160200160208202803683370190505b50905060005b828110156113c45761138785826111d5565b8282815181106113a757634e487b7160e01b600052603260045260246000fd5b6020908102919091010152806113bc81613df6565b915050611375565b509392505050565b600d5461ffff1681565b60006113e061107a565b82106113fe5760405162461bcd60e51b815260040161092490613b79565b6008828154811061141f57634e487b7160e01b600052603260045260246000fd5b90600052602060002001549050919050565b600a54600160a01b900460ff1690565b6000818152600260205260408120546001600160a01b0316806108485760405162461bcd60e51b815260040161092490613884565b60145460ff16156114995760405162461bcd60e51b815260040161092490613645565b6014805460ff191660011790556114ae611431565b156114cb5760405162461bcd60e51b815260040161092490613793565b6114d3611f1f565b6001600160a01b0316326001600160a01b0316146115035760405162461bcd60e51b81526004016109249061360e565b600d547f00000000000000000000000000000000000000000000000000000000000000009061153790849061ffff16613d00565b11156115555760405162461bcd60e51b815260040161092490613532565b6000821180156115665750601e8211155b6115825760405162461bcd60e51b815260040161092490613b42565b600c54600d5461ffff1610156115f657600c54600d546115a790849061ffff16613d00565b11156115c55760405162461bcd60e51b81526004016109249061375c565b34600b54836115d49190613d3d565b146115f15760405162461bcd60e51b8152600401610924906135a0565b611601565b341561160157600080fd5b6000808367ffffffffffffffff81111561162b57634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015611654578160200160208202803683370190505b50905060008467ffffffffffffffff81111561168057634e487b7160e01b600052604160045260246000fd5b6040519080825280602002602001820160405280156116a9578160200160208202803683370190505b50600d5490915060009061ffff16815b8781101561185257600d805461ffff169060006116d583613dd4565b82546101009290920a61ffff818102199093169183160217909155600d546116fe925016611f91565b600d549093506117129061ffff1684611fd3565b50600061171e84612187565b600d549091506117319061ffff16611119565b61173b9088613d00565b9650871580611763575061174d611f1f565b6001600160a01b0316816001600160a01b031614155b156117ae578085838151811061178957634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b03168152505061183f565b600d54865161ffff909116908790849081106117da57634e487b7160e01b600052603260045260246000fd5b61ffff9092166020928302919091019091015260105485516001600160a01b039091169086908490811061181e57634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b0316815250505b508061184a81613df6565b9150506116b9565b5084156118c3576011546001600160a01b0316639dc29fac611872611f1f565b876040518363ffffffff1660e01b815260040161189092919061331f565b600060405180830381600087803b1580156118aa57600080fd5b505af11580156118be573d6000803e3d6000fd5b505050505b60005b83518110156119705760006118db8284613d00565b6118e6906001613d00565b905087158061193557506118f8611f1f565b6001600160a01b031685838151811061192157634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b031614155b1561195d5761195d858381518110610e7d57634e487b7160e01b600052603260045260246000fd5b508061196881613df6565b9150506118c6565b5085156119e1576010546001600160a01b0316635b519142611990611f1f565b866040518363ffffffff1660e01b81526004016119ae9291906132c5565b600060405180830381600087803b1580156119c857600080fd5b505af11580156119dc573d6000803e3d6000fd5b505050505b50506014805460ff191690555050505050565b6119fc611f1f565b6001600160a01b0316611a0d611af3565b6001600160a01b031614611a335760405162461bcd60e51b815260040161092490613962565b601280546001600160a01b0319166001600160a01b0392909216919091179055565b60006001600160a01b038216611a7d5760405162461bcd60e51b815260040161092490613827565b506001600160a01b031660009081526003602052604090205490565b611aa1611f1f565b6001600160a01b0316611ab2611af3565b6001600160a01b031614611ad85760405162461bcd60e51b815260040161092490613962565b611ae26000612520565b565b6010546001600160a01b031681565b600a546001600160a01b031690565b611b0a612d74565b506000908152600e6020908152604091829020825161012081018452905460ff808216151583526101008083048216948401949094526201000082048116948301949094526301000000810484166060830152640100000000810484166080830152650100000000008104841660a083015266010000000000008104841660c08301526701000000000000008104841660e08301526801000000000000000090049092169082015290565b60606001805461087a90613d9f565b600f6020526000908152604090205481565b611be8611be1611f1f565b8383612572565b5050565b611bf4611f1f565b6001600160a01b0316611c05611af3565b6001600160a01b031614611c2b5760405162461bcd60e51b815260040161092490613962565b600b55565b611c41611c3b611f1f565b8361236e565b611c5d5760405162461bcd60e51b815260040161092490613aae565b611c6984848484612615565b50505050565b600b5481565b600c5481565b6060611c8682611f02565b611ca25760405162461bcd60e51b8152600401610924906139f4565b6012546040517fc87b56dd0000000000000000000000000000000000000000000000000000000081526001600160a01b039091169063c87b56dd90611ceb908590600401613ca5565b60006040518083038186803b158015611d0357600080fd5b505afa158015611d17573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610848919081019061308a565b600e6020526000908152604090205460ff808216916101008104821691620100008204811691630100000081048216916401000000008204811691650100000000008104821691660100000000000082048116916701000000000000008104821691680100000000000000009091041689565b6012546001600160a01b031681565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b611df7611f1f565b6001600160a01b0316611e08611af3565b6001600160a01b031614611e2e5760405162461bcd60e51b815260040161092490613962565b6001600160a01b038116611e545760405162461bcd60e51b8152600401610924906134d5565b61107781612520565b7f000000000000000000000000000000000000000000000000000000000000000081565b6011546001600160a01b031681565b60006001600160e01b031982167f80ac58cd000000000000000000000000000000000000000000000000000000001480611ef357506001600160e01b031982167f5b5e139f00000000000000000000000000000000000000000000000000000000145b80610848575061084882612648565b6000908152600260205260409020546001600160a01b0316151590565b3390565b600081815260046020526040902080546001600160a01b0319166001600160a01b0384169081179091558190611f5882611441565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600032611f9f600143613d5c565b404284604051602001611fb594939291906131b4565b60408051601f19818403018152919052805160209091012092915050565b611fdb612d74565b611fe48261267a565b9050600f6000611ff3836127c5565b8152602001908152602001600020546000141561216e5780600e600085815260200190815260200160002060008201518160000160006101000a81548160ff02191690831515021790555060208201518160000160016101000a81548160ff021916908360ff16021790555060408201518160000160026101000a81548160ff021916908360ff16021790555060608201518160000160036101000a81548160ff021916908360ff16021790555060808201518160000160046101000a81548160ff021916908360ff16021790555060a08201518160000160056101000a81548160ff021916908360ff16021790555060c08201518160000160066101000a81548160ff021916908360ff16021790555060e08201518160000160076101000a81548160ff021916908360ff1602179055506101008201518160000160086101000a81548160ff021916908360ff16021790555090505082600f6000612158846127c5565b8152602081019190915260400160002055611224565b6121808361217b84611f91565b611fd3565b9392505050565b600c54600d5460009161ffff9091161115806121b057506121ad600a60f584901c613e11565b15155b156121c4576121bd611f1f565b905061084b565b6010546040517fc0948d700000000000000000000000000000000000000000000000000000000081526000916001600160a01b03169063c0948d709061221290609087901c90600401613ca5565b60206040518083038186803b15801561222a57600080fd5b505afa15801561223e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122629190612e35565b90506001600160a01b0381166108485761227a611f1f565b91505061084b565b611be8828260405180602001604052806000815250612805565b6122a4611431565b156122c15760405162461bcd60e51b815260040161092490613793565b600a805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586122fd611f1f565b60405161230a9190613275565b60405180910390a1565b61231c611431565b6123385760405162461bcd60e51b8152600401610924906133e4565b600a805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6122fd611f1f565b600061237982611f02565b6123955760405162461bcd60e51b815260040161092490613710565b60006123a083611441565b9050806001600160a01b0316846001600160a01b031614806123db5750836001600160a01b03166123d0846108fd565b6001600160a01b0316145b806123eb57506123eb8185611dc1565b949350505050565b826001600160a01b031661240682611441565b6001600160a01b03161461242c5760405162461bcd60e51b815260040161092490613997565b6001600160a01b0382166124525760405162461bcd60e51b81526004016109249061367c565b61245d838383612838565b612468600082611f23565b6001600160a01b0383166000908152600360205260408120805460019290612491908490613d5c565b90915550506001600160a01b03821660009081526003602052604081208054600192906124bf908490613d00565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b600a80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b816001600160a01b0316836001600160a01b031614156125a45760405162461bcd60e51b8152600401610924906136d9565b6001600160a01b0383811660008181526005602090815260408083209487168084529490915290819020805460ff1916851515179055517f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c319061260890859061337c565b60405180910390a3505050565b6126208484846123f3565b61262c848484846128c1565b611c695760405162461bcd60e51b815260040161092490613478565b6001600160e01b031981167f01ffc9a70000000000000000000000000000000000000000000000000000000014919050565b612682612d74565b612691600a61ffff8416613e11565b15158082526000906126a457600a6126a7565b60005b60109390931c9290506126c861ffff84166126c3836000613d18565b6129f5565b60ff16602083015260109290921c916126ea61ffff84166126c3836001613d18565b60ff16604083015260109290921c9161270c61ffff84166126c3836002613d18565b60ff16608083015260109290921c9161272e61ffff84166126c3836003613d18565b60ff16606083015260109290921c9161275061ffff84166126c3836004613d18565b60ff1660e083015260109290921c9161277261ffff84166126c3836005613d18565b60ff1660a0830152815160109390931c926127bf5761279a61ffff84166126c3836006613d18565b60ff1660c08301526127b561ffff84166126c3836007613d18565b60ff166101008301525b50919050565b80516020808301516040808501516080860151606087015160a088015160e089015160c08a01516101008b0151965160009a611fb59a90999891016131e3565b61280f8383612a91565b61281c60008484846128c1565b610a3d5760405162461bcd60e51b815260040161092490613478565b612843838383610a3d565b6001600160a01b03831661285f5761285a81612b70565b612882565b816001600160a01b0316836001600160a01b031614612882576128828382612bb4565b6001600160a01b03821661289e5761289981612c51565b610a3d565b826001600160a01b0316826001600160a01b031614610a3d57610a3d8282612d2a565b60006128d5846001600160a01b0316612d6e565b156129ea57836001600160a01b031663150b7a026128f1611f1f565b8786866040518563ffffffff1660e01b81526004016129139493929190613289565b602060405180830381600087803b15801561292d57600080fd5b505af192505050801561295d575060408051601f3d908101601f1916820190925261295a9181019061306e565b60015b6129b7573d80801561298b576040519150601f19603f3d011682016040523d82523d6000602084013e612990565b606091505b5080516129af5760405162461bcd60e51b815260040161092490613478565b805181602001fd5b6001600160e01b0319167f150b7a02000000000000000000000000000000000000000000000000000000001490506123eb565b506001949350505050565b6012546040517fa6b096920000000000000000000000000000000000000000000000000000000081526000916001600160a01b03169063a6b0969290612a419086908690600401613c8e565b60206040518083038186803b158015612a5957600080fd5b505afa158015612a6d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121809190613137565b6001600160a01b038216612ab75760405162461bcd60e51b8152600401610924906138e1565b612ac081611f02565b15612add5760405162461bcd60e51b815260040161092490613569565b612ae960008383612838565b6001600160a01b0382166000908152600360205260408120805460019290612b12908490613d00565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b600880546000838152600960205260408120829055600182018355919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30155565b60006001612bc184611a55565b612bcb9190613d5c565b600083815260076020526040902054909150808214612c1e576001600160a01b03841660009081526006602090815260408083208584528252808320548484528184208190558352600790915290208190555b5060009182526007602090815260408084208490556001600160a01b039094168352600681528383209183525290812055565b600854600090612c6390600190613d5c565b60008381526009602052604081205460088054939450909284908110612c9957634e487b7160e01b600052603260045260246000fd5b906000526020600020015490508060088381548110612cc857634e487b7160e01b600052603260045260246000fd5b6000918252602080832090910192909255828152600990915260408082208490558582528120556008805480612d0e57634e487b7160e01b600052603160045260246000fd5b6001900381819060005260206000200160009055905550505050565b6000612d3583611a55565b6001600160a01b039093166000908152600660209081526040808320868452825280832085905593825260079052919091209190915550565b3b151590565b6040805161012081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e0810182905261010081019190915290565b60008083601f840112612dd1578182fd5b50813567ffffffffffffffff811115612de8578182fd5b6020830191508360208083028501011115612e0257600080fd5b9250929050565b8035801515811461084b57600080fd5b600060208284031215612e2a578081fd5b813561218081613e5d565b600060208284031215612e46578081fd5b815161218081613e5d565b60008060408385031215612e63578081fd5b8235612e6e81613e5d565b91506020830135612e7e81613e5d565b809150509250929050565b600080600060608486031215612e9d578081fd5b8335612ea881613e5d565b92506020840135612eb881613e5d565b929592945050506040919091013590565b60008060008060808587031215612ede578081fd5b8435612ee981613e5d565b93506020850135612ef981613e5d565b925060408501359150606085013567ffffffffffffffff811115612f1b578182fd5b8501601f81018713612f2b578182fd5b8035612f3e612f3982613cd8565b613cae565b818152886020838501011115612f52578384fd5b81602084016020830137908101602001929092525092959194509250565b60008060408385031215612f82578182fd5b8235612f8d81613e5d565b9150612f9b60208401612e09565b90509250929050565b60008060408385031215612fb6578182fd5b8235612fc181613e5d565b946020939093013593505050565b60008060008060408587031215612fe4578384fd5b843567ffffffffffffffff80821115612ffb578586fd5b61300788838901612dc0565b9096509450602087013591508082111561301f578384fd5b5061302c87828801612dc0565b95989497509550505050565b600060208284031215613049578081fd5b61218082612e09565b600060208284031215613063578081fd5b813561218081613e72565b60006020828403121561307f578081fd5b815161218081613e72565b60006020828403121561309b578081fd5b815167ffffffffffffffff8111156130b1578182fd5b8201601f810184136130c1578182fd5b80516130cf612f3982613cd8565b8181528560208385010111156130e3578384fd5b6130f4826020830160208601613d73565b95945050505050565b60006020828403121561310e578081fd5b5035919050565b60008060408385031215613127578182fd5b82359150612f9b60208401612e09565b600060208284031215613148578081fd5b815160ff81168114612180578182fd5b60008151808452613170816020860160208601613d73565b601f01601f19169290920160200192915050565b60ff169052565b60f81b7fff00000000000000000000000000000000000000000000000000000000000000169052565b60609490941b6bffffffffffffffffffffffff1916845260148401929092526034830152605482015260740190565b600060f88b1515811b83527fff00000000000000000000000000000000000000000000000000000000000000808c831b166001850152808b831b166002850152808a831b1660038501528089831b1660048501528088831b1660058501528087831b1660068501528086831b1660078501525050613264600883018461318b565b506009019998505050505050505050565b6001600160a01b0391909116815260200190565b60006001600160a01b038087168352808616602084015250836040830152608060608301526132bb6080830184613158565b9695505050505050565b6000604082016001600160a01b038516835260206040818501528185518084526060860191508287019350845b8181101561331257845161ffff16835293830193918301916001016132f2565b5090979650505050505050565b6001600160a01b03929092168252602082015260400190565b6020808252825182820181905260009190848201906040850190845b8181101561337057835183529284019291840191600101613354565b50909695505050505050565b901515815260200190565b981515895260ff97881660208a0152958716604089015293861660608801529185166080870152841660a0860152831660c0850152821660e0840152166101008201526101200190565b6000602082526121806020830184613158565b60208082526014908201527f5061757361626c653a206e6f7420706175736564000000000000000000000000604082015260600190565b6020808252602b908201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560408201527f74206f6620626f756e6473000000000000000000000000000000000000000000606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527f63656976657220696d706c656d656e7465720000000000000000000000000000606082015260800190565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201527f6464726573730000000000000000000000000000000000000000000000000000606082015260800190565b60208082526011908201527f416c6c20746f6b656e73206d696e746564000000000000000000000000000000604082015260600190565b6020808252601c908201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604082015260600190565b60208082526016908201527f496e76616c6964207061796d656e7420616d6f756e7400000000000000000000604082015260600190565b60208082526015908201527f416d6f756e74206578636565642061697264726f700000000000000000000000604082015260600190565b60208082526008908201527f4f6e6c7920454f41000000000000000000000000000000000000000000000000604082015260600190565b6020808252600d908201527f4e6f207265656e7472616e637900000000000000000000000000000000000000604082015260600190565b60208082526024908201527f4552433732313a207472616e7366657220746f20746865207a65726f2061646460408201527f7265737300000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526019908201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604082015260600190565b6020808252602c908201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860408201526b34b9ba32b73a103a37b5b2b760a11b606082015260800190565b6020808252601f908201527f416c6c20746f6b656e73206f6e2d73616c6520616c726561647920736f6c6400604082015260600190565b60208082526010908201527f5061757361626c653a2070617573656400000000000000000000000000000000604082015260600190565b60208082526038908201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760408201527f6e6572206e6f7220617070726f76656420666f7220616c6c0000000000000000606082015260800190565b6020808252602a908201527f4552433732313a2062616c616e636520717565727920666f7220746865207a6560408201527f726f206164647265737300000000000000000000000000000000000000000000606082015260800190565b60208082526029908201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460408201527f656e7420746f6b656e0000000000000000000000000000000000000000000000606082015260800190565b6020808252818101527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604082015260600190565b6020808252602c908201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860408201526b34b9ba32b73a103a37b5b2b760a11b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526029908201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960408201527f73206e6f74206f776e0000000000000000000000000000000000000000000000606082015260800190565b6020808252602f908201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60408201527f6e6578697374656e7420746f6b656e0000000000000000000000000000000000606082015260800190565b60208082526021908201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560408201527f7200000000000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60408201527f776e6572206e6f7220617070726f766564000000000000000000000000000000606082015260800190565b60208082526012908201527f4163636f756e747320213d2056616c7565730000000000000000000000000000604082015260600190565b60208082526013908201527f496e76616c6964206d696e7420616d6f756e7400000000000000000000000000604082015260600190565b6020808252602c908201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60408201527f7574206f6620626f756e64730000000000000000000000000000000000000000606082015260800190565b60006101208201905082511515825260ff60208401511660208301526040830151613c046040840182613184565b506060830151613c176060840182613184565b506080830151613c2a6080840182613184565b5060a0830151613c3d60a0840182613184565b5060c0830151613c5060c0840182613184565b5060e0830151613c6360e0840182613184565b5061010080840151613c7782850182613184565b505092915050565b61ffff91909116815260200190565b61ffff92909216825260ff16602082015260400190565b90815260200190565b60405181810167ffffffffffffffff81118282101715613cd057613cd0613e47565b604052919050565b600067ffffffffffffffff821115613cf257613cf2613e47565b50601f01601f191660200190565b60008219821115613d1357613d13613e31565b500190565b600060ff821660ff84168060ff03821115613d3557613d35613e31565b019392505050565b6000816000190483118215151615613d5757613d57613e31565b500290565b600082821015613d6e57613d6e613e31565b500390565b60005b83811015613d8e578181015183820152602001613d76565b83811115611c695750506000910152565b600281046001821680613db357607f821691505b602082108114156127bf57634e487b7160e01b600052602260045260246000fd5b600061ffff80831681811415613dec57613dec613e31565b6001019392505050565b6000600019821415613e0a57613e0a613e31565b5060010190565b600082613e2c57634e487b7160e01b81526012600452602481fd5b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461107757600080fd5b6001600160e01b03198116811461107757600080fdfea26469706673582212200ab2991585474468a37f13413e09a081748167c4ea8a8d7f3650a48f3392a05664736f6c63430008000033000000000000000000000000e717d4834e24a06394c61bb8cc44061fb0c2e9d6000000000000000000000000c1d57e174b9384b973a602046a7006c6aabdf93e
Deployed Bytecode
0x6080604052600436106102dc5760003560e01c80636352211e11610184578063a2b40d19116100d6578063e05c57bf1161008a578063f2fde38b11610064578063f2fde38b146107c0578063f47c84c5146107e0578063ff72c845146107f5576102dc565b8063e05c57bf14610756578063e1fc334f1461078b578063e985e9c5146107a0576102dc565b8063c002d23d116100bb578063c002d23d1461070c578063c084f54014610721578063c87b56dd14610736576102dc565b8063a2b40d19146106cc578063b88d4fde146106ec576102dc565b806376cdb03b1161013857806395d89b411161011257806395d89b4114610677578063a1b8f3741461068c578063a22cb465146106ac576102dc565b806376cdb03b146106205780638da5cb5b1461063557806394e568471461064a576102dc565b80636f4f7366116101695780636f4f7366146105cb57806370a08231146105eb578063715018a61461060b576102dc565b80636352211e1461059857806367f68fac146105b8576102dc565b806323b872dd1161023d5780634018b1f8116101f15780634f02c420116101cb5780634f02c420146105415780634f6ccce7146105635780635c975abb14610583576102dc565b80634018b1f8146104df57806342842e0e146104f4578063438b630014610514576102dc565b80632f745c59116102225780632f745c591461048a5780633431a753146104aa5780633ccfd60b146104ca576102dc565b806323b872dd1461044a57806327de8f271461046a576102dc565b8063095ea7b3116102945780630db77dc9116102795780630db77dc9146103f557806316c38b3c1461041557806318160ddd14610435576102dc565b8063095ea7b3146103b55780630c8d6695146103d5576102dc565b806306fdde03116102c557806306fdde0314610344578063081812fc14610366578063090d23b914610393576102dc565b806301ffc9a7146102e157806302f1f0b214610317575b600080fd5b3480156102ed57600080fd5b506103016102fc366004613052565b61080a565b60405161030e919061337c565b60405180910390f35b34801561032357600080fd5b50610337610332366004612e19565b610850565b60405161030e9190613ca5565b34801561035057600080fd5b5061035961086b565b60405161030e91906133d1565b34801561037257600080fd5b506103866103813660046130fd565b6108fd565b60405161030e9190613275565b34801561039f57600080fd5b506103b36103ae366004612e19565b610949565b005b3480156103c157600080fd5b506103b36103d0366004612fa4565b6109aa565b3480156103e157600080fd5b506103b36103f0366004613115565b610a42565b34801561040157600080fd5b506103b3610410366004612fcf565b610f21565b34801561042157600080fd5b506103b3610430366004613038565b61101d565b34801561044157600080fd5b5061033761107a565b34801561045657600080fd5b506103b3610465366004612e89565b611080565b34801561047657600080fd5b506103376104853660046130fd565b611119565b34801561049657600080fd5b506103376104a5366004612fa4565b6111d5565b3480156104b657600080fd5b506103b36104c53660046130fd565b61122a565b3480156104d657600080fd5b506103b361126e565b3480156104eb57600080fd5b506103376112ed565b34801561050057600080fd5b506103b361050f366004612e89565b6112f3565b34801561052057600080fd5b5061053461052f366004612e19565b61130e565b60405161030e9190613338565b34801561054d57600080fd5b506105566113cc565b60405161030e9190613c7f565b34801561056f57600080fd5b5061033761057e3660046130fd565b6113d6565b34801561058f57600080fd5b50610301611431565b3480156105a457600080fd5b506103866105b33660046130fd565b611441565b6103b36105c6366004613115565b611476565b3480156105d757600080fd5b506103b36105e6366004612e19565b6119f4565b3480156105f757600080fd5b50610337610606366004612e19565b611a55565b34801561061757600080fd5b506103b3611a99565b34801561062c57600080fd5b50610386611ae4565b34801561064157600080fd5b50610386611af3565b34801561065657600080fd5b5061066a6106653660046130fd565b611b02565b60405161030e9190613bd6565b34801561068357600080fd5b50610359611bb5565b34801561069857600080fd5b506103376106a73660046130fd565b611bc4565b3480156106b857600080fd5b506103b36106c7366004612f70565b611bd6565b3480156106d857600080fd5b506103b36106e73660046130fd565b611bec565b3480156106f857600080fd5b506103b3610707366004612ec9565b611c30565b34801561071857600080fd5b50610337611c6f565b34801561072d57600080fd5b50610337611c75565b34801561074257600080fd5b506103596107513660046130fd565b611c7b565b34801561076257600080fd5b506107766107713660046130fd565b611d3f565b60405161030e99989796959493929190613387565b34801561079757600080fd5b50610386611db2565b3480156107ac57600080fd5b506103016107bb366004612e51565b611dc1565b3480156107cc57600080fd5b506103b36107db366004612e19565b611def565b3480156107ec57600080fd5b50610337611e5d565b34801561080157600080fd5b50610386611e81565b60006001600160e01b031982167f780e9d63000000000000000000000000000000000000000000000000000000001480610848575061084882611e90565b90505b919050565b6001600160a01b031660009081526013602052604090205490565b60606000805461087a90613d9f565b80601f01602080910402602001604051908101604052809291908181526020018280546108a690613d9f565b80156108f35780601f106108c8576101008083540402835291602001916108f3565b820191906000526020600020905b8154815290600101906020018083116108d657829003601f168201915b5050505050905090565b600061090882611f02565b61092d5760405162461bcd60e51b815260040161092490613916565b60405180910390fd5b506000908152600460205260409020546001600160a01b031690565b610951611f1f565b6001600160a01b0316610962611af3565b6001600160a01b0316146109885760405162461bcd60e51b815260040161092490613962565b601080546001600160a01b0319166001600160a01b0392909216919091179055565b60006109b582611441565b9050806001600160a01b0316836001600160a01b031614156109e95760405162461bcd60e51b815260040161092490613a51565b806001600160a01b03166109fb611f1f565b6001600160a01b03161480610a175750610a17816107bb611f1f565b610a335760405162461bcd60e51b8152600401610924906137ca565b610a3d8383611f23565b505050565b60145460ff1615610a655760405162461bcd60e51b815260040161092490613645565b6014805460ff19166001179055610a7a611431565b15610a975760405162461bcd60e51b815260040161092490613793565b610a9f611f1f565b6001600160a01b0316326001600160a01b031614610acf5760405162461bcd60e51b81526004016109249061360e565b600d547f000000000000000000000000000000000000000000000000000000000000753090610b0390849061ffff16613d00565b1115610b215760405162461bcd60e51b815260040161092490613532565b60136000610b2d611f1f565b6001600160a01b03166001600160a01b0316815260200190815260200160002054821115610b6d5760405162461bcd60e51b8152600401610924906135d7565b8160136000610b7a611f1f565b6001600160a01b03166001600160a01b031681526020019081526020016000206000828254610ba99190613d5c565b90915550600090508267ffffffffffffffff811115610bd857634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610c01578160200160208202803683370190505b50905060008367ffffffffffffffff811115610c2d57634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610c56578160200160208202803683370190505b50600d5490915060009061ffff16815b86811015610de257600d805461ffff16906000610c8283613dd4565b82546101009290920a61ffff818102199093169183160217909155600d54610cab925016611f91565b600d54909350610cbf9061ffff1684611fd3565b506000610ccb84612187565b9050861580610cf35750610cdd611f1f565b6001600160a01b0316816001600160a01b031614155b15610d3e5780858381518110610d1957634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b031681525050610dcf565b600d54865161ffff90911690879084908110610d6a57634e487b7160e01b600052603260045260246000fd5b61ffff9092166020928302919091019091015260105485516001600160a01b0390911690869084908110610dae57634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b0316815250505b5080610dda81613df6565b915050610c66565b5060005b8351811015610e9e576000610dfb8284613d00565b610e06906001613d00565b9050861580610e555750610e18611f1f565b6001600160a01b0316858381518110610e4157634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b031614155b15610e8b57610e8b858381518110610e7d57634e487b7160e01b600052603260045260246000fd5b602002602001015182612282565b5080610e9681613df6565b915050610de6565b508415610f0f576010546001600160a01b0316635b519142610ebe611f1f565b866040518363ffffffff1660e01b8152600401610edc9291906132c5565b600060405180830381600087803b158015610ef657600080fd5b505af1158015610f0a573d6000803e3d6000fd5b505050505b50506014805460ff1916905550505050565b610f29611f1f565b6001600160a01b0316610f3a611af3565b6001600160a01b031614610f605760405162461bcd60e51b815260040161092490613962565b828114610f7f5760405162461bcd60e51b815260040161092490613b0b565b60005b8181101561101657828282818110610faa57634e487b7160e01b600052603260045260246000fd5b9050602002013560136000878785818110610fd557634e487b7160e01b600052603260045260246000fd5b9050602002016020810190610fea9190612e19565b6001600160a01b031681526020810191909152604001600020558061100e81613df6565b915050610f82565b5050505050565b611025611f1f565b6001600160a01b0316611036611af3565b6001600160a01b03161461105c5760405162461bcd60e51b815260040161092490613962565b801561106f5761106a61229c565b611077565b611077612314565b50565b60085490565b60145460ff16156110a35760405162461bcd60e51b815260040161092490613645565b6014805460ff191660011790556010546001600160a01b03166110c4611f1f565b6001600160a01b0316146110ff576110e36110dd611f1f565b8261236e565b6110ff5760405162461bcd60e51b815260040161092490613aae565b61110a8383836123f3565b50506014805460ff1916905550565b6000600c54821161112c5750600061084b565b600c5461113b90611388613d00565b8211611152575069010f0cf064dd5920000061084b565b600c5461116190612710613d00565b821161117857506901969368974c05b0000061084b565b600c5461118790613a98613d00565b821161119e575069021e19e0c9bab240000061084b565b600c546111ad90614e20613d00565b82116111c457506902a5a058fc295ed0000061084b565b5069032d26d12e980b600000919050565b60006111e083611a55565b82106111fe5760405162461bcd60e51b81526004016109249061341b565b506001600160a01b03821660009081526006602090815260408083208484529091529020545b92915050565b611232611f1f565b6001600160a01b0316611243611af3565b6001600160a01b0316146112695760405162461bcd60e51b815260040161092490613962565b600c55565b611276611f1f565b6001600160a01b0316611287611af3565b6001600160a01b0316146112ad5760405162461bcd60e51b815260040161092490613962565b6112b5611af3565b6001600160a01b03166108fc479081150290604051600060405180830381858888f19350505050158015611077573d6000803e3d6000fd5b600c5490565b610a3d83838360405180602001604052806000815250611c30565b6060600061131b83611a55565b905060008167ffffffffffffffff81111561134657634e487b7160e01b600052604160045260246000fd5b60405190808252806020026020018201604052801561136f578160200160208202803683370190505b50905060005b828110156113c45761138785826111d5565b8282815181106113a757634e487b7160e01b600052603260045260246000fd5b6020908102919091010152806113bc81613df6565b915050611375565b509392505050565b600d5461ffff1681565b60006113e061107a565b82106113fe5760405162461bcd60e51b815260040161092490613b79565b6008828154811061141f57634e487b7160e01b600052603260045260246000fd5b90600052602060002001549050919050565b600a54600160a01b900460ff1690565b6000818152600260205260408120546001600160a01b0316806108485760405162461bcd60e51b815260040161092490613884565b60145460ff16156114995760405162461bcd60e51b815260040161092490613645565b6014805460ff191660011790556114ae611431565b156114cb5760405162461bcd60e51b815260040161092490613793565b6114d3611f1f565b6001600160a01b0316326001600160a01b0316146115035760405162461bcd60e51b81526004016109249061360e565b600d547f00000000000000000000000000000000000000000000000000000000000075309061153790849061ffff16613d00565b11156115555760405162461bcd60e51b815260040161092490613532565b6000821180156115665750601e8211155b6115825760405162461bcd60e51b815260040161092490613b42565b600c54600d5461ffff1610156115f657600c54600d546115a790849061ffff16613d00565b11156115c55760405162461bcd60e51b81526004016109249061375c565b34600b54836115d49190613d3d565b146115f15760405162461bcd60e51b8152600401610924906135a0565b611601565b341561160157600080fd5b6000808367ffffffffffffffff81111561162b57634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015611654578160200160208202803683370190505b50905060008467ffffffffffffffff81111561168057634e487b7160e01b600052604160045260246000fd5b6040519080825280602002602001820160405280156116a9578160200160208202803683370190505b50600d5490915060009061ffff16815b8781101561185257600d805461ffff169060006116d583613dd4565b82546101009290920a61ffff818102199093169183160217909155600d546116fe925016611f91565b600d549093506117129061ffff1684611fd3565b50600061171e84612187565b600d549091506117319061ffff16611119565b61173b9088613d00565b9650871580611763575061174d611f1f565b6001600160a01b0316816001600160a01b031614155b156117ae578085838151811061178957634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b03168152505061183f565b600d54865161ffff909116908790849081106117da57634e487b7160e01b600052603260045260246000fd5b61ffff9092166020928302919091019091015260105485516001600160a01b039091169086908490811061181e57634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b0316815250505b508061184a81613df6565b9150506116b9565b5084156118c3576011546001600160a01b0316639dc29fac611872611f1f565b876040518363ffffffff1660e01b815260040161189092919061331f565b600060405180830381600087803b1580156118aa57600080fd5b505af11580156118be573d6000803e3d6000fd5b505050505b60005b83518110156119705760006118db8284613d00565b6118e6906001613d00565b905087158061193557506118f8611f1f565b6001600160a01b031685838151811061192157634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b031614155b1561195d5761195d858381518110610e7d57634e487b7160e01b600052603260045260246000fd5b508061196881613df6565b9150506118c6565b5085156119e1576010546001600160a01b0316635b519142611990611f1f565b866040518363ffffffff1660e01b81526004016119ae9291906132c5565b600060405180830381600087803b1580156119c857600080fd5b505af11580156119dc573d6000803e3d6000fd5b505050505b50506014805460ff191690555050505050565b6119fc611f1f565b6001600160a01b0316611a0d611af3565b6001600160a01b031614611a335760405162461bcd60e51b815260040161092490613962565b601280546001600160a01b0319166001600160a01b0392909216919091179055565b60006001600160a01b038216611a7d5760405162461bcd60e51b815260040161092490613827565b506001600160a01b031660009081526003602052604090205490565b611aa1611f1f565b6001600160a01b0316611ab2611af3565b6001600160a01b031614611ad85760405162461bcd60e51b815260040161092490613962565b611ae26000612520565b565b6010546001600160a01b031681565b600a546001600160a01b031690565b611b0a612d74565b506000908152600e6020908152604091829020825161012081018452905460ff808216151583526101008083048216948401949094526201000082048116948301949094526301000000810484166060830152640100000000810484166080830152650100000000008104841660a083015266010000000000008104841660c08301526701000000000000008104841660e08301526801000000000000000090049092169082015290565b60606001805461087a90613d9f565b600f6020526000908152604090205481565b611be8611be1611f1f565b8383612572565b5050565b611bf4611f1f565b6001600160a01b0316611c05611af3565b6001600160a01b031614611c2b5760405162461bcd60e51b815260040161092490613962565b600b55565b611c41611c3b611f1f565b8361236e565b611c5d5760405162461bcd60e51b815260040161092490613aae565b611c6984848484612615565b50505050565b600b5481565b600c5481565b6060611c8682611f02565b611ca25760405162461bcd60e51b8152600401610924906139f4565b6012546040517fc87b56dd0000000000000000000000000000000000000000000000000000000081526001600160a01b039091169063c87b56dd90611ceb908590600401613ca5565b60006040518083038186803b158015611d0357600080fd5b505afa158015611d17573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610848919081019061308a565b600e6020526000908152604090205460ff808216916101008104821691620100008204811691630100000081048216916401000000008204811691650100000000008104821691660100000000000082048116916701000000000000008104821691680100000000000000009091041689565b6012546001600160a01b031681565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b611df7611f1f565b6001600160a01b0316611e08611af3565b6001600160a01b031614611e2e5760405162461bcd60e51b815260040161092490613962565b6001600160a01b038116611e545760405162461bcd60e51b8152600401610924906134d5565b61107781612520565b7f000000000000000000000000000000000000000000000000000000000000753081565b6011546001600160a01b031681565b60006001600160e01b031982167f80ac58cd000000000000000000000000000000000000000000000000000000001480611ef357506001600160e01b031982167f5b5e139f00000000000000000000000000000000000000000000000000000000145b80610848575061084882612648565b6000908152600260205260409020546001600160a01b0316151590565b3390565b600081815260046020526040902080546001600160a01b0319166001600160a01b0384169081179091558190611f5882611441565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600032611f9f600143613d5c565b404284604051602001611fb594939291906131b4565b60408051601f19818403018152919052805160209091012092915050565b611fdb612d74565b611fe48261267a565b9050600f6000611ff3836127c5565b8152602001908152602001600020546000141561216e5780600e600085815260200190815260200160002060008201518160000160006101000a81548160ff02191690831515021790555060208201518160000160016101000a81548160ff021916908360ff16021790555060408201518160000160026101000a81548160ff021916908360ff16021790555060608201518160000160036101000a81548160ff021916908360ff16021790555060808201518160000160046101000a81548160ff021916908360ff16021790555060a08201518160000160056101000a81548160ff021916908360ff16021790555060c08201518160000160066101000a81548160ff021916908360ff16021790555060e08201518160000160076101000a81548160ff021916908360ff1602179055506101008201518160000160086101000a81548160ff021916908360ff16021790555090505082600f6000612158846127c5565b8152602081019190915260400160002055611224565b6121808361217b84611f91565b611fd3565b9392505050565b600c54600d5460009161ffff9091161115806121b057506121ad600a60f584901c613e11565b15155b156121c4576121bd611f1f565b905061084b565b6010546040517fc0948d700000000000000000000000000000000000000000000000000000000081526000916001600160a01b03169063c0948d709061221290609087901c90600401613ca5565b60206040518083038186803b15801561222a57600080fd5b505afa15801561223e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122629190612e35565b90506001600160a01b0381166108485761227a611f1f565b91505061084b565b611be8828260405180602001604052806000815250612805565b6122a4611431565b156122c15760405162461bcd60e51b815260040161092490613793565b600a805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586122fd611f1f565b60405161230a9190613275565b60405180910390a1565b61231c611431565b6123385760405162461bcd60e51b8152600401610924906133e4565b600a805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6122fd611f1f565b600061237982611f02565b6123955760405162461bcd60e51b815260040161092490613710565b60006123a083611441565b9050806001600160a01b0316846001600160a01b031614806123db5750836001600160a01b03166123d0846108fd565b6001600160a01b0316145b806123eb57506123eb8185611dc1565b949350505050565b826001600160a01b031661240682611441565b6001600160a01b03161461242c5760405162461bcd60e51b815260040161092490613997565b6001600160a01b0382166124525760405162461bcd60e51b81526004016109249061367c565b61245d838383612838565b612468600082611f23565b6001600160a01b0383166000908152600360205260408120805460019290612491908490613d5c565b90915550506001600160a01b03821660009081526003602052604081208054600192906124bf908490613d00565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b600a80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b816001600160a01b0316836001600160a01b031614156125a45760405162461bcd60e51b8152600401610924906136d9565b6001600160a01b0383811660008181526005602090815260408083209487168084529490915290819020805460ff1916851515179055517f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c319061260890859061337c565b60405180910390a3505050565b6126208484846123f3565b61262c848484846128c1565b611c695760405162461bcd60e51b815260040161092490613478565b6001600160e01b031981167f01ffc9a70000000000000000000000000000000000000000000000000000000014919050565b612682612d74565b612691600a61ffff8416613e11565b15158082526000906126a457600a6126a7565b60005b60109390931c9290506126c861ffff84166126c3836000613d18565b6129f5565b60ff16602083015260109290921c916126ea61ffff84166126c3836001613d18565b60ff16604083015260109290921c9161270c61ffff84166126c3836002613d18565b60ff16608083015260109290921c9161272e61ffff84166126c3836003613d18565b60ff16606083015260109290921c9161275061ffff84166126c3836004613d18565b60ff1660e083015260109290921c9161277261ffff84166126c3836005613d18565b60ff1660a0830152815160109390931c926127bf5761279a61ffff84166126c3836006613d18565b60ff1660c08301526127b561ffff84166126c3836007613d18565b60ff166101008301525b50919050565b80516020808301516040808501516080860151606087015160a088015160e089015160c08a01516101008b0151965160009a611fb59a90999891016131e3565b61280f8383612a91565b61281c60008484846128c1565b610a3d5760405162461bcd60e51b815260040161092490613478565b612843838383610a3d565b6001600160a01b03831661285f5761285a81612b70565b612882565b816001600160a01b0316836001600160a01b031614612882576128828382612bb4565b6001600160a01b03821661289e5761289981612c51565b610a3d565b826001600160a01b0316826001600160a01b031614610a3d57610a3d8282612d2a565b60006128d5846001600160a01b0316612d6e565b156129ea57836001600160a01b031663150b7a026128f1611f1f565b8786866040518563ffffffff1660e01b81526004016129139493929190613289565b602060405180830381600087803b15801561292d57600080fd5b505af192505050801561295d575060408051601f3d908101601f1916820190925261295a9181019061306e565b60015b6129b7573d80801561298b576040519150601f19603f3d011682016040523d82523d6000602084013e612990565b606091505b5080516129af5760405162461bcd60e51b815260040161092490613478565b805181602001fd5b6001600160e01b0319167f150b7a02000000000000000000000000000000000000000000000000000000001490506123eb565b506001949350505050565b6012546040517fa6b096920000000000000000000000000000000000000000000000000000000081526000916001600160a01b03169063a6b0969290612a419086908690600401613c8e565b60206040518083038186803b158015612a5957600080fd5b505afa158015612a6d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121809190613137565b6001600160a01b038216612ab75760405162461bcd60e51b8152600401610924906138e1565b612ac081611f02565b15612add5760405162461bcd60e51b815260040161092490613569565b612ae960008383612838565b6001600160a01b0382166000908152600360205260408120805460019290612b12908490613d00565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b600880546000838152600960205260408120829055600182018355919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30155565b60006001612bc184611a55565b612bcb9190613d5c565b600083815260076020526040902054909150808214612c1e576001600160a01b03841660009081526006602090815260408083208584528252808320548484528184208190558352600790915290208190555b5060009182526007602090815260408084208490556001600160a01b039094168352600681528383209183525290812055565b600854600090612c6390600190613d5c565b60008381526009602052604081205460088054939450909284908110612c9957634e487b7160e01b600052603260045260246000fd5b906000526020600020015490508060088381548110612cc857634e487b7160e01b600052603260045260246000fd5b6000918252602080832090910192909255828152600990915260408082208490558582528120556008805480612d0e57634e487b7160e01b600052603160045260246000fd5b6001900381819060005260206000200160009055905550505050565b6000612d3583611a55565b6001600160a01b039093166000908152600660209081526040808320868452825280832085905593825260079052919091209190915550565b3b151590565b6040805161012081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e0810182905261010081019190915290565b60008083601f840112612dd1578182fd5b50813567ffffffffffffffff811115612de8578182fd5b6020830191508360208083028501011115612e0257600080fd5b9250929050565b8035801515811461084b57600080fd5b600060208284031215612e2a578081fd5b813561218081613e5d565b600060208284031215612e46578081fd5b815161218081613e5d565b60008060408385031215612e63578081fd5b8235612e6e81613e5d565b91506020830135612e7e81613e5d565b809150509250929050565b600080600060608486031215612e9d578081fd5b8335612ea881613e5d565b92506020840135612eb881613e5d565b929592945050506040919091013590565b60008060008060808587031215612ede578081fd5b8435612ee981613e5d565b93506020850135612ef981613e5d565b925060408501359150606085013567ffffffffffffffff811115612f1b578182fd5b8501601f81018713612f2b578182fd5b8035612f3e612f3982613cd8565b613cae565b818152886020838501011115612f52578384fd5b81602084016020830137908101602001929092525092959194509250565b60008060408385031215612f82578182fd5b8235612f8d81613e5d565b9150612f9b60208401612e09565b90509250929050565b60008060408385031215612fb6578182fd5b8235612fc181613e5d565b946020939093013593505050565b60008060008060408587031215612fe4578384fd5b843567ffffffffffffffff80821115612ffb578586fd5b61300788838901612dc0565b9096509450602087013591508082111561301f578384fd5b5061302c87828801612dc0565b95989497509550505050565b600060208284031215613049578081fd5b61218082612e09565b600060208284031215613063578081fd5b813561218081613e72565b60006020828403121561307f578081fd5b815161218081613e72565b60006020828403121561309b578081fd5b815167ffffffffffffffff8111156130b1578182fd5b8201601f810184136130c1578182fd5b80516130cf612f3982613cd8565b8181528560208385010111156130e3578384fd5b6130f4826020830160208601613d73565b95945050505050565b60006020828403121561310e578081fd5b5035919050565b60008060408385031215613127578182fd5b82359150612f9b60208401612e09565b600060208284031215613148578081fd5b815160ff81168114612180578182fd5b60008151808452613170816020860160208601613d73565b601f01601f19169290920160200192915050565b60ff169052565b60f81b7fff00000000000000000000000000000000000000000000000000000000000000169052565b60609490941b6bffffffffffffffffffffffff1916845260148401929092526034830152605482015260740190565b600060f88b1515811b83527fff00000000000000000000000000000000000000000000000000000000000000808c831b166001850152808b831b166002850152808a831b1660038501528089831b1660048501528088831b1660058501528087831b1660068501528086831b1660078501525050613264600883018461318b565b506009019998505050505050505050565b6001600160a01b0391909116815260200190565b60006001600160a01b038087168352808616602084015250836040830152608060608301526132bb6080830184613158565b9695505050505050565b6000604082016001600160a01b038516835260206040818501528185518084526060860191508287019350845b8181101561331257845161ffff16835293830193918301916001016132f2565b5090979650505050505050565b6001600160a01b03929092168252602082015260400190565b6020808252825182820181905260009190848201906040850190845b8181101561337057835183529284019291840191600101613354565b50909695505050505050565b901515815260200190565b981515895260ff97881660208a0152958716604089015293861660608801529185166080870152841660a0860152831660c0850152821660e0840152166101008201526101200190565b6000602082526121806020830184613158565b60208082526014908201527f5061757361626c653a206e6f7420706175736564000000000000000000000000604082015260600190565b6020808252602b908201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560408201527f74206f6620626f756e6473000000000000000000000000000000000000000000606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527f63656976657220696d706c656d656e7465720000000000000000000000000000606082015260800190565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201527f6464726573730000000000000000000000000000000000000000000000000000606082015260800190565b60208082526011908201527f416c6c20746f6b656e73206d696e746564000000000000000000000000000000604082015260600190565b6020808252601c908201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604082015260600190565b60208082526016908201527f496e76616c6964207061796d656e7420616d6f756e7400000000000000000000604082015260600190565b60208082526015908201527f416d6f756e74206578636565642061697264726f700000000000000000000000604082015260600190565b60208082526008908201527f4f6e6c7920454f41000000000000000000000000000000000000000000000000604082015260600190565b6020808252600d908201527f4e6f207265656e7472616e637900000000000000000000000000000000000000604082015260600190565b60208082526024908201527f4552433732313a207472616e7366657220746f20746865207a65726f2061646460408201527f7265737300000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526019908201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604082015260600190565b6020808252602c908201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860408201526b34b9ba32b73a103a37b5b2b760a11b606082015260800190565b6020808252601f908201527f416c6c20746f6b656e73206f6e2d73616c6520616c726561647920736f6c6400604082015260600190565b60208082526010908201527f5061757361626c653a2070617573656400000000000000000000000000000000604082015260600190565b60208082526038908201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760408201527f6e6572206e6f7220617070726f76656420666f7220616c6c0000000000000000606082015260800190565b6020808252602a908201527f4552433732313a2062616c616e636520717565727920666f7220746865207a6560408201527f726f206164647265737300000000000000000000000000000000000000000000606082015260800190565b60208082526029908201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460408201527f656e7420746f6b656e0000000000000000000000000000000000000000000000606082015260800190565b6020808252818101527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604082015260600190565b6020808252602c908201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860408201526b34b9ba32b73a103a37b5b2b760a11b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526029908201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960408201527f73206e6f74206f776e0000000000000000000000000000000000000000000000606082015260800190565b6020808252602f908201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60408201527f6e6578697374656e7420746f6b656e0000000000000000000000000000000000606082015260800190565b60208082526021908201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560408201527f7200000000000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60408201527f776e6572206e6f7220617070726f766564000000000000000000000000000000606082015260800190565b60208082526012908201527f4163636f756e747320213d2056616c7565730000000000000000000000000000604082015260600190565b60208082526013908201527f496e76616c6964206d696e7420616d6f756e7400000000000000000000000000604082015260600190565b6020808252602c908201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60408201527f7574206f6620626f756e64730000000000000000000000000000000000000000606082015260800190565b60006101208201905082511515825260ff60208401511660208301526040830151613c046040840182613184565b506060830151613c176060840182613184565b506080830151613c2a6080840182613184565b5060a0830151613c3d60a0840182613184565b5060c0830151613c5060c0840182613184565b5060e0830151613c6360e0840182613184565b5061010080840151613c7782850182613184565b505092915050565b61ffff91909116815260200190565b61ffff92909216825260ff16602082015260400190565b90815260200190565b60405181810167ffffffffffffffff81118282101715613cd057613cd0613e47565b604052919050565b600067ffffffffffffffff821115613cf257613cf2613e47565b50601f01601f191660200190565b60008219821115613d1357613d13613e31565b500190565b600060ff821660ff84168060ff03821115613d3557613d35613e31565b019392505050565b6000816000190483118215151615613d5757613d57613e31565b500290565b600082821015613d6e57613d6e613e31565b500390565b60005b83811015613d8e578181015183820152602001613d76565b83811115611c695750506000910152565b600281046001821680613db357607f821691505b602082108114156127bf57634e487b7160e01b600052602260045260246000fd5b600061ffff80831681811415613dec57613dec613e31565b6001019392505050565b6000600019821415613e0a57613e0a613e31565b5060010190565b600082613e2c57634e487b7160e01b81526012600452602481fd5b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461107757600080fd5b6001600160e01b03198116811461107757600080fdfea26469706673582212200ab2991585474468a37f13413e09a081748167c4ea8a8d7f3650a48f3392a05664736f6c63430008000033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000e717d4834e24a06394c61bb8cc44061fb0c2e9d6000000000000000000000000c1d57e174b9384b973a602046a7006c6aabdf93e
-----Decoded View---------------
Arg [0] : _bat (address): 0xe717D4834E24A06394C61bb8cC44061Fb0c2e9D6
Arg [1] : _traits (address): 0xC1d57E174B9384b973a602046A7006c6aABDF93e
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000e717d4834e24a06394c61bb8cc44061fb0c2e9d6
Arg [1] : 000000000000000000000000c1d57e174b9384b973a602046a7006c6aabdf93e
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.