Source Code
Overview
ETH Balance
0 ETH
ETH Value
$0.00Latest 25 from a total of 1,281 transactions
| Transaction Hash |
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
| Zap | 181844129 | 707 days ago | IN | 0 ETH | 0.00011737 | ||||
| Zap | 181544167 | 708 days ago | IN | 0 ETH | 0.00008405 | ||||
| Zap | 181542748 | 708 days ago | IN | 0 ETH | 0.00010609 | ||||
| Zap | 181458453 | 708 days ago | IN | 0 ETH | 0.00014601 | ||||
| Zap | 181458039 | 708 days ago | IN | 0 ETH | 0.00016247 | ||||
| Zap | 181457309 | 708 days ago | IN | 0 ETH | 0.00015115 | ||||
| Zap | 181456713 | 708 days ago | IN | 0 ETH | 0.00015084 | ||||
| Zap | 181455780 | 708 days ago | IN | 0 ETH | 0.00017838 | ||||
| Zap | 181384420 | 708 days ago | IN | 0 ETH | 0.00025383 | ||||
| Zap | 181283231 | 709 days ago | IN | 0 ETH | 0.00014265 | ||||
| Zap | 180981949 | 710 days ago | IN | 0 ETH | 0.00015331 | ||||
| Zap | 180955493 | 710 days ago | IN | 0 ETH | 0.00011441 | ||||
| Zap | 180950015 | 710 days ago | IN | 0 ETH | 0.00013338 | ||||
| Zap | 180934030 | 710 days ago | IN | 0 ETH | 0.00015013 | ||||
| Zap | 180855016 | 710 days ago | IN | 0 ETH | 0.0001186 | ||||
| Zap | 180854082 | 710 days ago | IN | 0 ETH | 0.00015347 | ||||
| Zap | 180853414 | 710 days ago | IN | 0 ETH | 0.00015949 | ||||
| Zap | 180848902 | 710 days ago | IN | 0 ETH | 0.00011939 | ||||
| Zap | 180848502 | 710 days ago | IN | 0 ETH | 0.00015325 | ||||
| Zap | 180481154 | 711 days ago | IN | 0 ETH | 0.00011478 | ||||
| Zap | 180474308 | 711 days ago | IN | 0 ETH | 0.00014905 | ||||
| Zap | 180473677 | 711 days ago | IN | 0 ETH | 0.00013084 | ||||
| Zap | 180424472 | 711 days ago | IN | 0 ETH | 0.00020813 | ||||
| Zap | 180365347 | 711 days ago | IN | 0 ETH | 0.00022314 | ||||
| Zap | 180314084 | 712 days ago | IN | 0 ETH | 0.00014464 |
Cross-Chain Transactions
Loading...
Loading
Contract Name:
Zapper
Compiler Version
v0.8.17+commit.8df45f5f
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.11;
import '@openzeppelin/contracts/token/ERC20/ERC20.sol';
import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import '@openzeppelin/contracts/token/ERC721/ERC721.sol';
import '@openzeppelin/contracts/token/ERC721/IERC721.sol';
import '@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol';
import '@openzeppelin/contracts/access/Ownable.sol';
import '@openzeppelin/contracts/security/Pausable.sol';
import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import '@openzeppelin/contracts/token/ERC721/IERC721.sol';
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import './InterfaceLibrary.sol';
contract Zapper is Ownable {
using SafeERC20 for IERC20;
/*---------- CONSTANTS --------------------------------------------*/
uint256 private immutable MAX = 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff;
uint256 private immutable DIVISOR = 1000;
/*---------- STATE VARIABLES --------------------------------------*/
address public factory;
address public collectionContract;
uint256 public existingLength;
/*---------- ERRORS ------------------------------------------------*/
/*---------- EVENTS ------------------------------------------------*/
/*---------- MODIFIERS --------------------------------------------*/
/*---------- FUNCTIONS --------------------------------------------*/
struct ZapParams {
address gbtForCollection;
address tokenIn;
address tokenOut;
uint256 amountIn;
uint256 amountOut;
address affiliate;
bool swapForExact;
uint256[] ids;
}
constructor(
address _factory,
address _collection,
uint256 _existingLength
) {
factory = _factory;
collectionContract = _collection;
existingLength = _existingLength;
}
function zap(ZapParams memory params) external {
address user = msg.sender;
(uint256 index, address gbt, address gnft, , bool allowed) = ICollection(collectionContract).findCollectionByAddress(params.gbtForCollection);
address base = IGBT(gbt).BASE_TOKEN();
require(allowed, "!Allowed");
if (params.tokenIn == base && params.tokenOut == gbt) {
// BASE -> GBT
IERC20(base).safeTransferFrom(user, address(this), params.amountIn);
verifyApproval(gbt, params.amountIn, base);
if (index < existingLength) {
IGBT(gbt).buy(params.amountIn, params.amountOut, 0);
} else {
IGBT(gbt).buy(params.amountIn, params.amountOut, 0, user, params.affiliate);
}
} else if (params.tokenIn == gbt && params.tokenOut == base) {
// GBT -> BASE
IERC20(gbt).safeTransferFrom(user, address(this), params.amountIn);
verifyApproval(gbt, params.amountIn, gbt);
if (index < existingLength) {
IGBT(gbt).sell(params.amountIn, params.amountOut, 0);
} else {
IGBT(gbt).sell(params.amountIn, params.amountOut, 0, user);
}
} else if (params.tokenIn == gbt && params.tokenOut == gnft) {
// GBT -> GNFT
IERC20(gbt).safeTransferFrom(user, address(this), params.amountIn);
verifyApproval(gnft, params.amountIn, gbt);
if (params.swapForExact) {
IGNFT(gnft).swapForExact(params.ids);
} else {
IGNFT(gnft).swap(params.amountIn);
}
uint256 gnftBal = IERC721(gnft).balanceOf(address(this));
for (uint256 i = 0; i < gnftBal; i++) {
IERC721(gnft).safeTransferFrom(address(this), user, IGNFT(gnft).tokenOfOwnerByIndex(address(this), 0));
}
} else if (params.tokenIn == gnft && params.tokenOut == gbt) {
// GNFT -> GBT
for (uint256 i = 0; i < params.ids.length; i++) {
IERC721(gnft).safeTransferFrom(user, address(this), params.ids[i]);
}
if (!ERC721(gnft).isApprovedForAll(address(this), gnft)) {
ERC721(gnft).setApprovalForAll(gnft, true);
}
IGNFT(gnft).redeem(params.ids);
} else if (params.tokenIn == base && params.tokenOut == gnft) {
// BASE -> GNFT
// Transfer BASE to router
IERC20(base).safeTransferFrom(user, address(this), params.amountIn);
// Buy GBT with BASE
verifyApproval(gbt, params.amountIn, base);
if (index < existingLength) {
IGBT(gbt).buy(params.amountIn, params.amountOut, 0);
} else {
IGBT(gbt).buy(params.amountIn, params.amountOut, 0, user, params.affiliate);
}
// Swap GBT for GNFT
verifyApproval(gnft, IERC20(gbt).balanceOf(address(this)), gbt);
if (params.swapForExact) {
IGNFT(gnft).swapForExact(params.ids);
} else {
IGNFT(gnft).swap(IERC20(gbt).balanceOf(address(this)) / 1e18 * 1e18);
}
uint256 gnftBal = IERC721(gnft).balanceOf(address(this));
for (uint256 i = 0; i < gnftBal; i++) {
IERC721(gnft).safeTransferFrom(address(this), user, IGNFT(gnft).tokenOfOwnerByIndex(address(this), 0));
}
} else if (params.tokenIn == gnft && params.tokenOut == base) {
// GNFT -> BASE
// Transfer GNFT to router
for (uint256 i = 0; i < params.ids.length; i++) {
IERC721(gnft).safeTransferFrom(user, address(this), params.ids[i]);
}
// Redeem GNFT for GBT
if (!ERC721(gnft).isApprovedForAll(address(this), gnft)) {
ERC721(gnft).setApprovalForAll(gnft, true);
}
IGNFT(gnft).redeem(params.ids);
// Sell GBT for BASE
verifyApproval(gbt, IERC20(gbt).balanceOf(address(this)), gbt);
if (index < existingLength) {
IGBT(gbt).sell(IERC20(gbt).balanceOf(address(this)), params.amountOut, 0);
} else {
IGBT(gbt).sell(IERC20(gbt).balanceOf(address(this)), params.amountOut, 0, user);
}
}
IERC20(base).safeTransfer(user, IERC20(base).balanceOf(address(this)));
IERC20(gbt).safeTransfer(user, IERC20(gbt).balanceOf(address(this)));
}
function claimAllRewards() external {
uint256[] memory allCollections = ICollection(collectionContract).allowedCollections();
for (uint256 i = 0; i < allCollections.length; i++) {
if (allCollections[i] > existingLength) {
(address gbt, , address xgbt, ) = IFactory(factory).deployInfo(allCollections[i]);
if (IXGBT(xgbt).earned(msg.sender, gbt) > 0) {
IXGBT(xgbt).getReward(address(msg.sender));
}
}
}
}
/*---------- RESTRICTED FUNCTIONS ---------------------------------*/
function verifyApproval(address spender, uint256 amount, address token) internal {
if (IERC20(token).allowance(address(this), spender) < amount) {
IERC20(token).safeApprove(spender, MAX);
}
}
/*---------- VIEW FUNCTIONS ---------------------------------------*/
function quoteBuyBaseIn(address gbt, uint256 fee, uint256 input, uint256 slippageTolerance, uint256 autoSlippage) external view returns (uint256 output, uint256 slippage, uint256 minOutput, uint256 autoMinOutput) {
uint256 feeBASE = input * fee / DIVISOR;
uint256 oldReserveBASE = IGBT(gbt).reserveVirtualBASE() + IGBT(gbt).reserveRealBASE();
uint256 newReserveBASE = oldReserveBASE + input - feeBASE;
uint256 oldReserveGBT = IGBT(gbt).reserveGBT();
uint256 currentPrice = IGBT(gbt).currentPrice();
output = oldReserveGBT - (oldReserveBASE * oldReserveGBT / newReserveBASE);
slippage = 100 * (1e18 - (output * currentPrice / input));
minOutput = (input * 1e18 / currentPrice) * slippageTolerance / DIVISOR;
autoMinOutput = (input * 1e18 / currentPrice) * ((DIVISOR * 1e18) - ((slippage + autoSlippage) * 10)) / (DIVISOR * 1e18);
}
function quoteBuyGBTOut(address gbt, uint256 fee, uint256 input, uint256 slippageTolerance, uint256 autoSlippage) public view returns (uint256 output, uint256 slippage, uint256 minOutput, uint256 autoMinOutput) {
uint256 oldReserveBASE = IGBT(gbt).reserveVirtualBASE() + IGBT(gbt).reserveRealBASE();
output = DIVISOR * ((oldReserveBASE * IGBT(gbt).reserveGBT() / (IGBT(gbt).reserveGBT() - input)) - oldReserveBASE) / (DIVISOR - fee);
slippage = 100 * (1e18 - (input * IGBT(gbt).currentPrice() / output));
minOutput = input * slippageTolerance / DIVISOR;
autoMinOutput = input * ((DIVISOR * 1e18) - ((slippage + autoSlippage) * 10)) / (DIVISOR * 1e18);
}
function quoteSellGBTIn(address gbt, uint256 fee, uint256 input, uint256 slippageTolerance, uint256 autoSlippage) public view returns (uint256 output, uint256 slippage, uint256 minOutput, uint256 autoMinOutput) {
uint256 oldReserveGBT = IGBT(gbt).reserveGBT();
uint256 newReserveGBT = oldReserveGBT + input - (input * fee / DIVISOR);
uint256 oldReserveBASE = IGBT(gbt).reserveVirtualBASE() + IGBT(gbt).reserveRealBASE();
output = oldReserveBASE - (oldReserveBASE * oldReserveGBT / newReserveGBT);
slippage = 100 * (1e18 - (output * 1e18 / (input * IGBT(gbt).currentPrice() / 1e18)));
minOutput = input * IGBT(gbt).currentPrice() /1e18 * slippageTolerance / DIVISOR;
autoMinOutput = input * IGBT(gbt).currentPrice() /1e18 * ((DIVISOR * 1e18) - ((slippage + autoSlippage) * 10)) / (DIVISOR * 1e18);
}
function quoteSellBaseOut(address gbt, uint256 fee, uint256 input, uint256 slippageTolerance, uint256 autoSlippage) external view returns (uint256 output, uint256 slippage, uint256 minOutput, uint256 autoMinOutput) {
uint256 oldReserveBASE = IGBT(gbt).reserveVirtualBASE() + IGBT(gbt).reserveRealBASE();
output = DIVISOR * ((oldReserveBASE * IGBT(gbt).reserveGBT() / (oldReserveBASE - input)) - IGBT(gbt).reserveGBT()) / (DIVISOR - fee);
slippage = 100 * (1e18 - (input * 1e18 / (output * IGBT(gbt).currentPrice() / 1e18)));
minOutput = input * slippageTolerance / DIVISOR;
autoMinOutput = input * ((DIVISOR * 1e18) - ((slippage + autoSlippage) * 10)) / (DIVISOR * 1e18);
}
function quoteBASEtoNFT(address gbt, uint256 gbtFee, uint256 input, uint256 slippageTolerance, uint256 autoSlippage) external view returns (uint256 output, uint256 slippage, uint256 autoOutput) {
(output, slippage, , ) = quoteBuyGBTOut(gbt, gbtFee, input, slippageTolerance, autoSlippage);
output = output * DIVISOR / slippageTolerance;
autoOutput = output * ((DIVISOR * 1e18) + (autoSlippage * 10)) / (DIVISOR * 1e18);
}
function quoteNFTtoBASE(address gbt, uint256 gbtFee, uint256 input, uint256 slippageTolerance, uint256 autoSlippage) external view returns (uint256 output, uint256 slippage, uint256 autoOutput) {
(, , address gnft, ,) = ICollection(collectionContract).findCollectionByAddress(gbt);
uint256 gbtToSell = input * (DIVISOR - IGNFT(gnft).bFee()) / DIVISOR;
(output, slippage, , autoOutput) = quoteSellGBTIn(gbt, gbtFee, gbtToSell, slippageTolerance, autoSlippage);
}
function onERC721Received(address operator, address from, uint256 tokenId, bytes calldata data) public view returns (bytes4) {
return IERC721Receiver(address(this)).onERC721Received.selector;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (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 Modifier to make a function callable only when the contract is not paused.
*
* Requirements:
*
* - The contract must not be paused.
*/
modifier whenNotPaused() {
_requireNotPaused();
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*
* Requirements:
*
* - The contract must be paused.
*/
modifier whenPaused() {
_requirePaused();
_;
}
/**
* @dev Returns true if the contract is paused, and false otherwise.
*/
function paused() public view virtual returns (bool) {
return _paused;
}
/**
* @dev Throws if the contract is paused.
*/
function _requireNotPaused() internal view virtual {
require(!paused(), "Pausable: paused");
}
/**
* @dev Throws if the contract is not paused.
*/
function _requirePaused() internal view virtual {
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 (last updated v4.8.0) (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.openzeppelin.com/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:
*
* - `to` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address to, uint256 amount) public virtual override returns (bool) {
address owner = _msgSender();
_transfer(owner, to, 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}.
*
* NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on
* `transferFrom`. This is semantically equivalent to an infinite approval.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
address owner = _msgSender();
_approve(owner, 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}.
*
* NOTE: Does not update the allowance if the current allowance
* is the maximum `uint256`.
*
* Requirements:
*
* - `from` and `to` cannot be the zero address.
* - `from` must have a balance of at least `amount`.
* - the caller must have allowance for ``from``'s tokens of at least
* `amount`.
*/
function transferFrom(
address from,
address to,
uint256 amount
) public virtual override returns (bool) {
address spender = _msgSender();
_spendAllowance(from, spender, amount);
_transfer(from, to, 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) {
address owner = _msgSender();
_approve(owner, spender, allowance(owner, 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) {
address owner = _msgSender();
uint256 currentAllowance = allowance(owner, spender);
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
unchecked {
_approve(owner, spender, currentAllowance - subtractedValue);
}
return true;
}
/**
* @dev Moves `amount` of tokens from `from` to `to`.
*
* 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:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `from` must have a balance of at least `amount`.
*/
function _transfer(
address from,
address to,
uint256 amount
) internal virtual {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(from, to, amount);
uint256 fromBalance = _balances[from];
require(fromBalance >= amount, "ERC20: transfer amount exceeds balance");
unchecked {
_balances[from] = fromBalance - amount;
// Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by
// decrementing then incrementing.
_balances[to] += amount;
}
emit Transfer(from, to, amount);
_afterTokenTransfer(from, to, 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;
unchecked {
// Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.
_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;
// Overflow not possible: amount <= accountBalance <= totalSupply.
_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 Updates `owner` s allowance for `spender` based on spent `amount`.
*
* Does not update the allowance amount in case of infinite allowance.
* Revert if not enough allowance is available.
*
* Might emit an {Approval} event.
*/
function _spendAllowance(
address owner,
address spender,
uint256 amount
) internal virtual {
uint256 currentAllowance = allowance(owner, spender);
if (currentAllowance != type(uint256).max) {
require(currentAllowance >= amount, "ERC20: insufficient allowance");
unchecked {
_approve(owner, spender, currentAllowance - 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/extensions/draft-IERC20Permit.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
*
* Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
* presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
* need to send a transaction, and thus is not required to hold Ether at all.
*/
interface IERC20Permit {
/**
* @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
* given ``owner``'s signed approval.
*
* IMPORTANT: The same issues {IERC20-approve} has related to transaction
* ordering also apply here.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `deadline` must be a timestamp in the future.
* - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
* over the EIP712-formatted function arguments.
* - the signature must use ``owner``'s current nonce (see {nonces}).
*
* For more information on the signature format, see the
* https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
* section].
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @dev Returns the current nonce for `owner`. This value must be
* included whenever a signature is generated for {permit}.
*
* Every successful call to {permit} increases ``owner``'s nonce by one. This
* prevents a signature from being used multiple times.
*/
function nonces(address owner) external view returns (uint256);
/**
* @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts 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);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 amount
) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
import "../extensions/draft-IERC20Permit.sol";
import "../../../utils/Address.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using Address for address;
function safeTransfer(
IERC20 token,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(
IERC20 token,
address from,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(
IERC20 token,
address spender,
uint256 value
) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
uint256 newAllowance = token.allowance(address(this), spender) + value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
uint256 newAllowance = oldAllowance - value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
}
function safePermit(
IERC20Permit token,
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) internal {
uint256 nonceBefore = token.nonces(owner);
token.permit(owner, spender, value, deadline, v, r, s);
uint256 nonceAfter = token.nonces(owner);
require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
if (returndata.length > 0) {
// Return data is optional
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.2) (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: address zero is not a valid owner");
return _balances[owner];
}
/**
* @dev See {IERC721-ownerOf}.
*/
function ownerOf(uint256 tokenId) public view virtual override returns (address) {
address owner = _ownerOf(tokenId);
require(owner != address(0), "ERC721: invalid token ID");
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) {
_requireMinted(tokenId);
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 overridden 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 token owner or approved for all"
);
_approve(to, tokenId);
}
/**
* @dev See {IERC721-getApproved}.
*/
function getApproved(uint256 tokenId) public view virtual override returns (address) {
_requireMinted(tokenId);
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: caller is not token owner or 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: caller is not token owner or 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 the owner of the `tokenId`. Does NOT revert if token doesn't exist
*/
function _ownerOf(uint256 tokenId) internal view virtual returns (address) {
return _owners[tokenId];
}
/**
* @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 _ownerOf(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) {
address owner = ERC721.ownerOf(tokenId);
return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == 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, 1);
// Check that tokenId was not minted by `_beforeTokenTransfer` hook
require(!_exists(tokenId), "ERC721: token already minted");
unchecked {
// Will not overflow unless all 2**256 token ids are minted to the same owner.
// Given that tokens are minted one by one, it is impossible in practice that
// this ever happens. Might change if we allow batch minting.
// The ERC fails to describe this case.
_balances[to] += 1;
}
_owners[tokenId] = to;
emit Transfer(address(0), to, tokenId);
_afterTokenTransfer(address(0), to, tokenId, 1);
}
/**
* @dev Destroys `tokenId`.
* The approval is cleared when the token is burned.
* This is an internal function that does not check if the sender is authorized to operate on the token.
*
* Requirements:
*
* - `tokenId` must exist.
*
* Emits a {Transfer} event.
*/
function _burn(uint256 tokenId) internal virtual {
address owner = ERC721.ownerOf(tokenId);
_beforeTokenTransfer(owner, address(0), tokenId, 1);
// Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook
owner = ERC721.ownerOf(tokenId);
// Clear approvals
delete _tokenApprovals[tokenId];
unchecked {
// Cannot overflow, as that would require more tokens to be burned/transferred
// out than the owner initially received through minting and transferring in.
_balances[owner] -= 1;
}
delete _owners[tokenId];
emit Transfer(owner, address(0), tokenId);
_afterTokenTransfer(owner, address(0), tokenId, 1);
}
/**
* @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 from incorrect owner");
require(to != address(0), "ERC721: transfer to the zero address");
_beforeTokenTransfer(from, to, tokenId, 1);
// Check that tokenId was not transferred by `_beforeTokenTransfer` hook
require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner");
// Clear approvals from the previous owner
delete _tokenApprovals[tokenId];
unchecked {
// `_balances[from]` cannot overflow for the same reason as described in `_burn`:
// `from`'s balance is the number of token held, which is at least one before the current
// transfer.
// `_balances[to]` could overflow in the conditions described in `_mint`. That would require
// all 2**256 token ids to be minted, which in practice is impossible.
_balances[from] -= 1;
_balances[to] += 1;
}
_owners[tokenId] = to;
emit Transfer(from, to, tokenId);
_afterTokenTransfer(from, to, tokenId, 1);
}
/**
* @dev Approve `to` to operate on `tokenId`
*
* Emits an {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 an {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 Reverts if the `tokenId` has not been minted yet.
*/
function _requireMinted(uint256 tokenId) internal view virtual {
require(_exists(tokenId), "ERC721: invalid token ID");
}
/**
* @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 {
/// @solidity memory-safe-assembly
assembly {
revert(add(32, reason), mload(reason))
}
}
}
} else {
return true;
}
}
/**
* @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is
* used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.
* - When `from` is zero, the tokens will be minted for `to`.
* - When `to` is zero, ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
* - `batchSize` is non-zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 firstTokenId,
uint256 batchSize
) internal virtual {}
/**
* @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is
* used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.
* - When `from` is zero, the tokens were minted for `to`.
* - When `to` is zero, ``from``'s tokens were burned.
* - `from` and `to` are never both zero.
* - `batchSize` is non-zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _afterTokenTransfer(
address from,
address to,
uint256 firstTokenId,
uint256 batchSize
) internal virtual {}
/**
* @dev Unsafe write access to the balances, used by extensions that "mint" tokens using an {ownerOf} override.
*
* WARNING: Anyone calling this MUST ensure that the balances remain consistent with the ownership. The invariant
* being that for any address `a` the value returned by `balanceOf(a)` must be equal to the number of tokens such
* that `ownerOf(tokenId)` is `a`.
*/
// solhint-disable-next-line func-name-mixedcase
function __unsafe_increaseBalance(address account, uint256 amount) internal {
_balances[account] += amount;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (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 See {ERC721-_beforeTokenTransfer}.
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 firstTokenId,
uint256 batchSize
) internal virtual override {
super._beforeTokenTransfer(from, to, firstTokenId, batchSize);
if (batchSize > 1) {
// Will only trigger during construction. Batch transferring (minting) is not available afterwards.
revert("ERC721Enumerable: consecutive transfers not supported");
}
uint256 tokenId = firstTokenId;
if (from == address(0)) {
_addTokenToAllTokensEnumeration(tokenId);
} else if (from != to) {
_removeTokenFromOwnerEnumeration(from, tokenId);
}
if (to == address(0)) {
_removeTokenFromAllTokensEnumeration(tokenId);
} else if (to != from) {
_addTokenToOwnerEnumeration(to, tokenId);
}
}
/**
* @dev Private function to add a token to this extension's ownership-tracking data structures.
* @param to address representing the new owner of the given token ID
* @param tokenId uint256 ID of the token to be added to the tokens list of the given address
*/
function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {
uint256 length = ERC721.balanceOf(to);
_ownedTokens[to][length] = tokenId;
_ownedTokensIndex[tokenId] = length;
}
/**
* @dev Private function to add a token to this extension's token tracking data structures.
* @param tokenId uint256 ID of the token to be added to the tokens list
*/
function _addTokenToAllTokensEnumeration(uint256 tokenId) private {
_allTokensIndex[tokenId] = _allTokens.length;
_allTokens.push(tokenId);
}
/**
* @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that
* while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for
* gas optimizations e.g. when performing a transfer operation (avoiding double writes).
* This has O(1) time complexity, but alters the order of the _ownedTokens array.
* @param from address representing the previous owner of the given token ID
* @param tokenId uint256 ID of the token to be removed from the tokens list of the given address
*/
function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private {
// To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and
// then delete the last slot (swap and pop).
uint256 lastTokenIndex = ERC721.balanceOf(from) - 1;
uint256 tokenIndex = _ownedTokensIndex[tokenId];
// When the token to delete is the last token, the swap operation is unnecessary
if (tokenIndex != lastTokenIndex) {
uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];
_ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
_ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
}
// This also deletes the contents at the last position of the array
delete _ownedTokensIndex[tokenId];
delete _ownedTokens[from][lastTokenIndex];
}
/**
* @dev Private function to remove a token from this extension's token tracking data structures.
* This has O(1) time complexity, but alters the order of the _allTokens array.
* @param tokenId uint256 ID of the token to be removed from the tokens list
*/
function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {
// To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and
// then delete the last slot (swap and pop).
uint256 lastTokenIndex = _allTokens.length - 1;
uint256 tokenIndex = _allTokensIndex[tokenId];
// When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so
// rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding
// an 'if' statement (like in _removeTokenFromOwnerEnumeration)
uint256 lastTokenId = _allTokens[lastTokenIndex];
_allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
_allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
// This also deletes the contents at the last position of the array
delete _allTokensIndex[tokenId];
_allTokens.pop();
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (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);
/**
* @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/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 (last updated v4.8.0) (token/ERC721/IERC721.sol)
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721 is IERC165 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external;
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721
* or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must
* understand this adds an external call which potentially creates a reentrancy vulnerability.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool _approved) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)
pragma solidity ^0.8.0;
/**
* @title ERC721 token receiver interface
* @dev Interface for any contract that wants to support safeTransfers
* from ERC721 asset contracts.
*/
interface IERC721Receiver {
/**
* @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
* by `operator` from `from`, this function is called.
*
* It must return its Solidity selector to confirm the token transfer.
* If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
*
* The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.
*/
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, "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");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, 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) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, 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) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or 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 {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}// SPDX-License-Identifier: MIT
// 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 (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: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
enum Rounding {
Down, // Toward negative infinity
Up, // Toward infinity
Zero // Toward zero
}
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two numbers. The result is rounded towards
* zero.
*/
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow.
return (a & b) + (a ^ b) / 2;
}
/**
* @dev Returns the ceiling of the division of two numbers.
*
* This differs from standard division with `/` in that it rounds up instead
* of rounding down.
*/
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b - 1) / b can overflow on addition, so we distribute.
return a == 0 ? 0 : (a - 1) / b + 1;
}
/**
* @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
* @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
* with further edits by Uniswap Labs also under MIT license.
*/
function mulDiv(
uint256 x,
uint256 y,
uint256 denominator
) internal pure returns (uint256 result) {
unchecked {
// 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
// use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
// variables such that product = prod1 * 2^256 + prod0.
uint256 prod0; // Least significant 256 bits of the product
uint256 prod1; // Most significant 256 bits of the product
assembly {
let mm := mulmod(x, y, not(0))
prod0 := mul(x, y)
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
// Handle non-overflow cases, 256 by 256 division.
if (prod1 == 0) {
return prod0 / denominator;
}
// Make sure the result is less than 2^256. Also prevents denominator == 0.
require(denominator > prod1);
///////////////////////////////////////////////
// 512 by 256 division.
///////////////////////////////////////////////
// Make division exact by subtracting the remainder from [prod1 prod0].
uint256 remainder;
assembly {
// Compute remainder using mulmod.
remainder := mulmod(x, y, denominator)
// Subtract 256 bit number from 512 bit number.
prod1 := sub(prod1, gt(remainder, prod0))
prod0 := sub(prod0, remainder)
}
// Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
// See https://cs.stackexchange.com/q/138556/92363.
// Does not overflow because the denominator cannot be zero at this stage in the function.
uint256 twos = denominator & (~denominator + 1);
assembly {
// Divide denominator by twos.
denominator := div(denominator, twos)
// Divide [prod1 prod0] by twos.
prod0 := div(prod0, twos)
// Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
twos := add(div(sub(0, twos), twos), 1)
}
// Shift in bits from prod1 into prod0.
prod0 |= prod1 * twos;
// Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
// that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
// four bits. That is, denominator * inv = 1 mod 2^4.
uint256 inverse = (3 * denominator) ^ 2;
// Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
// in modular arithmetic, doubling the correct bits in each step.
inverse *= 2 - denominator * inverse; // inverse mod 2^8
inverse *= 2 - denominator * inverse; // inverse mod 2^16
inverse *= 2 - denominator * inverse; // inverse mod 2^32
inverse *= 2 - denominator * inverse; // inverse mod 2^64
inverse *= 2 - denominator * inverse; // inverse mod 2^128
inverse *= 2 - denominator * inverse; // inverse mod 2^256
// Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
// This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
// less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
// is no longer required.
result = prod0 * inverse;
return result;
}
}
/**
* @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
*/
function mulDiv(
uint256 x,
uint256 y,
uint256 denominator,
Rounding rounding
) internal pure returns (uint256) {
uint256 result = mulDiv(x, y, denominator);
if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
result += 1;
}
return result;
}
/**
* @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
*
* Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
*/
function sqrt(uint256 a) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
// For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
//
// We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
// `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
//
// This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
// → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
// → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
//
// Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
uint256 result = 1 << (log2(a) >> 1);
// At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
// since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
// every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
// into the expected uint128 result.
unchecked {
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
return min(result, a / result);
}
}
/**
* @notice Calculates sqrt(a), following the selected rounding direction.
*/
function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = sqrt(a);
return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
}
}
/**
* @dev Return the log in base 2, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 128;
}
if (value >> 64 > 0) {
value >>= 64;
result += 64;
}
if (value >> 32 > 0) {
value >>= 32;
result += 32;
}
if (value >> 16 > 0) {
value >>= 16;
result += 16;
}
if (value >> 8 > 0) {
value >>= 8;
result += 8;
}
if (value >> 4 > 0) {
value >>= 4;
result += 4;
}
if (value >> 2 > 0) {
value >>= 2;
result += 2;
}
if (value >> 1 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 2, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log2(value);
return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 10, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >= 10**64) {
value /= 10**64;
result += 64;
}
if (value >= 10**32) {
value /= 10**32;
result += 32;
}
if (value >= 10**16) {
value /= 10**16;
result += 16;
}
if (value >= 10**8) {
value /= 10**8;
result += 8;
}
if (value >= 10**4) {
value /= 10**4;
result += 4;
}
if (value >= 10**2) {
value /= 10**2;
result += 2;
}
if (value >= 10**1) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 10, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log10(value);
return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 256, rounded down, of a positive value.
* Returns 0 if given 0.
*
* Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
*/
function log256(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 16;
}
if (value >> 64 > 0) {
value >>= 64;
result += 8;
}
if (value >> 32 > 0) {
value >>= 32;
result += 4;
}
if (value >> 16 > 0) {
value >>= 16;
result += 2;
}
if (value >> 8 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 10, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log256(value);
return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)
pragma solidity ^0.8.0;
import "./math/Math.sol";
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _SYMBOLS = "0123456789abcdef";
uint8 private constant _ADDRESS_LENGTH = 20;
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
unchecked {
uint256 length = Math.log10(value) + 1;
string memory buffer = new string(length);
uint256 ptr;
/// @solidity memory-safe-assembly
assembly {
ptr := add(buffer, add(32, length))
}
while (true) {
ptr--;
/// @solidity memory-safe-assembly
assembly {
mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
}
value /= 10;
if (value == 0) break;
}
return buffer;
}
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
unchecked {
return toHexString(value, Math.log256(value) + 1);
}
}
/**
* @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] = _SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
/**
* @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
*/
function toHexString(address addr) internal pure returns (string memory) {
return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
}
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;
import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import '@openzeppelin/contracts/token/ERC721/IERC721.sol';
interface IFactory {
function totalDeployed() external view returns (uint256 length);
function deployInfo(uint256 id) external view returns (address token, address nft, address gumbar, bool _allowed);
function deployGumBall(
string calldata _name,
string calldata _symbol,
string[] calldata _URIs,
uint256 _supplyBASE,
uint256 _supplyGBT,
address _base,
address _artist,
uint256 _delay,
uint256[] memory _fees
) external;
}
interface IGBT {
function fee() external view returns (uint256);
function artist() external view returns (address);
function currentPrice() external view returns (uint256);
function buy(uint256 _amountBASE, uint256 _minGBT, uint256 expireTimestamp) external;
function buy(uint256 _amountBASE, uint256 _minGBT, uint256 expireTimestamp, address zapSender, address affiliate) external;
function sell(uint256 _amountGBT, uint256 _minETH, uint256 expireTimestamp) external;
function sell(uint256 _amountGBT, uint256 _minETH, uint256 expireTimestamp, address zapSender) external;
function BASE_TOKEN() external view returns (address);
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function XGBT() external view returns (address);
function initial_totalSupply() external view returns (uint256);
function reserveGBT() external view returns (uint256);
function borrowCredit(address user) external view returns (uint256);
function debt(address user) external view returns (uint256);
function reserveVirtualBASE() external view returns (uint256);
function reserveRealBASE() external view returns (uint256);
function floorPrice() external view returns (uint256);
function mustStayGBT(address user) external view returns (uint256);
function balanceOf(address user) external view returns (uint256);
}
interface IGNFT {
function approve(address to, uint256 tokenId) external;
function swapForExact(uint256[] memory id) external;
function swap(uint256 _amount) external;
function redeem(uint256[] memory _id) external;
function gumballs() external view returns (uint256[] memory arr);
function totalSupply() external view returns (uint256);
function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256);
function bFee() external view returns (uint256);
}
interface IXGBT {
function GBTperXGBT() external view returns (uint256);
function gumballsDeposited(address user) external view returns (uint256, uint256[] memory);
function balanceOfNFT(address user) external view returns (uint256, uint256[] memory);
function getRewardForDuration(address _rewardsToken) external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function balanceToken(address account) external view returns (uint256);
function totalSupply() external view returns (uint256);
function earned(address account, address _rewardsToken) external view returns (uint256);
function rewardTokens(uint256 index) external view returns (address);
function stakingToken() external view returns (IERC20);
function stakingNFT() external view returns (IERC721);
function getReward(address account) external;
}
interface ICollection {
function findCollectionByAddress(address gbt) external view returns (uint256 index, address token, address nft, address gumbar, bool allowed);
function allowedCollections() external view returns (uint256[] memory col);
}{
"optimizer": {
"enabled": true,
"runs": 200,
"details": {
"yul": true
}
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"_factory","type":"address"},{"internalType":"address","name":"_collection","type":"address"},{"internalType":"uint256","name":"_existingLength","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[],"name":"claimAllRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"collectionContract","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"existingLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"factory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"gbt","type":"address"},{"internalType":"uint256","name":"gbtFee","type":"uint256"},{"internalType":"uint256","name":"input","type":"uint256"},{"internalType":"uint256","name":"slippageTolerance","type":"uint256"},{"internalType":"uint256","name":"autoSlippage","type":"uint256"}],"name":"quoteBASEtoNFT","outputs":[{"internalType":"uint256","name":"output","type":"uint256"},{"internalType":"uint256","name":"slippage","type":"uint256"},{"internalType":"uint256","name":"autoOutput","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"gbt","type":"address"},{"internalType":"uint256","name":"fee","type":"uint256"},{"internalType":"uint256","name":"input","type":"uint256"},{"internalType":"uint256","name":"slippageTolerance","type":"uint256"},{"internalType":"uint256","name":"autoSlippage","type":"uint256"}],"name":"quoteBuyBaseIn","outputs":[{"internalType":"uint256","name":"output","type":"uint256"},{"internalType":"uint256","name":"slippage","type":"uint256"},{"internalType":"uint256","name":"minOutput","type":"uint256"},{"internalType":"uint256","name":"autoMinOutput","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"gbt","type":"address"},{"internalType":"uint256","name":"fee","type":"uint256"},{"internalType":"uint256","name":"input","type":"uint256"},{"internalType":"uint256","name":"slippageTolerance","type":"uint256"},{"internalType":"uint256","name":"autoSlippage","type":"uint256"}],"name":"quoteBuyGBTOut","outputs":[{"internalType":"uint256","name":"output","type":"uint256"},{"internalType":"uint256","name":"slippage","type":"uint256"},{"internalType":"uint256","name":"minOutput","type":"uint256"},{"internalType":"uint256","name":"autoMinOutput","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"gbt","type":"address"},{"internalType":"uint256","name":"gbtFee","type":"uint256"},{"internalType":"uint256","name":"input","type":"uint256"},{"internalType":"uint256","name":"slippageTolerance","type":"uint256"},{"internalType":"uint256","name":"autoSlippage","type":"uint256"}],"name":"quoteNFTtoBASE","outputs":[{"internalType":"uint256","name":"output","type":"uint256"},{"internalType":"uint256","name":"slippage","type":"uint256"},{"internalType":"uint256","name":"autoOutput","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"gbt","type":"address"},{"internalType":"uint256","name":"fee","type":"uint256"},{"internalType":"uint256","name":"input","type":"uint256"},{"internalType":"uint256","name":"slippageTolerance","type":"uint256"},{"internalType":"uint256","name":"autoSlippage","type":"uint256"}],"name":"quoteSellBaseOut","outputs":[{"internalType":"uint256","name":"output","type":"uint256"},{"internalType":"uint256","name":"slippage","type":"uint256"},{"internalType":"uint256","name":"minOutput","type":"uint256"},{"internalType":"uint256","name":"autoMinOutput","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"gbt","type":"address"},{"internalType":"uint256","name":"fee","type":"uint256"},{"internalType":"uint256","name":"input","type":"uint256"},{"internalType":"uint256","name":"slippageTolerance","type":"uint256"},{"internalType":"uint256","name":"autoSlippage","type":"uint256"}],"name":"quoteSellGBTIn","outputs":[{"internalType":"uint256","name":"output","type":"uint256"},{"internalType":"uint256","name":"slippage","type":"uint256"},{"internalType":"uint256","name":"minOutput","type":"uint256"},{"internalType":"uint256","name":"autoMinOutput","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"gbtForCollection","type":"address"},{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"address","name":"affiliate","type":"address"},{"internalType":"bool","name":"swapForExact","type":"bool"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"}],"internalType":"struct Zapper.ZapParams","name":"params","type":"tuple"}],"name":"zap","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
60c06040526000196080526103e860a0523480156200001d57600080fd5b50604051620034a8380380620034a88339810160408190526200004091620000f1565b6200004b3362000084565b600180546001600160a01b039485166001600160a01b031991821617909155600280549390941692169190911790915560035562000132565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b0381168114620000ec57600080fd5b919050565b6000806000606084860312156200010757600080fd5b6200011284620000d4565b92506200012260208501620000d4565b9150604084015190509250925092565b60805160a0516132cb620001dd6000396000818161028a015281816104cd015281816105250152818161056c015281816108f001528181610a0801528181610ad001528181610b0a01528181610b5101528181610bcb01528181610c0101528181610c3e01528181610d7401528181610e8a01528181610fca01528181611051015281816122a30152818161249b01528181612555015261259c015260006127d701526132cb6000f3fe608060405234801561001057600080fd5b50600436106100f55760003560e01c80636eeb299e116100975780638da5cb5b116100665780638da5cb5b14610234578063c45a015514610245578063d755e64a14610258578063f2fde38b1461026f57600080fd5b80636eeb299e146101db578063709263c1146101ee578063715018a6146102195780638b5c75171461022157600080fd5b806315ce973a116100d357806315ce973a146101745780632d8c7241146101875780634cfd07f8146101b557806354b189a9146101c857600080fd5b80630982a9ac146100fa5780630b83a72714610132578063150b7a021461013c575b600080fd5b61010d610108366004612c76565b610282565b6040805194855260208501939093529183015260608201526080015b60405180910390f35b61013a6105e7565b005b61015b61014a366004612cba565b630a85bd0160e11b95945050505050565b6040516001600160e01b03199091168152602001610129565b61010d610182366004612c76565b610812565b61019a610195366004612c76565b610bab565b60408051938452602084019290925290820152606001610129565b61010d6101c3366004612c76565b610c96565b61019a6101d6366004612c76565b610f4b565b61013a6101e9366004612e72565b6110ac565b600254610201906001600160a01b031681565b6040516001600160a01b039091168152602001610129565b61013a61221f565b61010d61022f366004612c76565b612233565b6000546001600160a01b0316610201565b600154610201906001600160a01b031681565b61026160035481565b604051908152602001610129565b61013a61027d366004612f49565b612677565b6000808080807f00000000000000000000000000000000000000000000000000000000000000006102b38a8a612f83565b6102bd9190612fa0565b905060008a6001600160a01b0316638d4a99896040518163ffffffff1660e01b8152600401602060405180830381865afa1580156102ff573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103239190612fc2565b8b6001600160a01b0316630a4d82ff6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610361573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103859190612fc2565b61038f9190612fdb565b905060008261039e8b84612fdb565b6103a89190612fee565b905060008c6001600160a01b031663562626876040518163ffffffff1660e01b8152600401602060405180830381865afa1580156103ea573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061040e9190612fc2565b905060008d6001600160a01b0316639d1b464a6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610450573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104749190612fc2565b9050826104818386612f83565b61048b9190612fa0565b6104959083612fee565b98508b6104a2828b612f83565b6104ac9190612fa0565b6104be90670de0b6b3a7640000612fee565b6104c9906064612f83565b97507f00000000000000000000000000000000000000000000000000000000000000008b826105008f670de0b6b3a7640000612f83565b61050a9190612fa0565b6105149190612f83565b61051e9190612fa0565b96506105527f0000000000000000000000000000000000000000000000000000000000000000670de0b6b3a7640000612f83565b61055c8b8a612fdb565b61056790600a612f83565b6105997f0000000000000000000000000000000000000000000000000000000000000000670de0b6b3a7640000612f83565b6105a39190612fee565b826105b68f670de0b6b3a7640000612f83565b6105c09190612fa0565b6105ca9190612f83565b6105d49190612fa0565b9550505050505095509550955095915050565b6002546040805163bb33085760e01b815290516000926001600160a01b03169163bb33085791600480830192869291908290030181865afa158015610630573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526106589190810190613001565b905060005b815181101561080e5760035482828151811061067b5761067b613087565b602002602001015111156107fc57600154825160009182916001600160a01b039091169063d4305c8d908690869081106106b7576106b7613087565b60200260200101516040518263ffffffff1660e01b81526004016106dd91815260200190565b608060405180830381865afa1580156106fa573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061071e919061309d565b5060405163211dc32d60e01b81523360048201526001600160a01b0380851660248301529395509093506000928416915063211dc32d90604401602060405180830381865afa158015610775573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107999190612fc2565b11156107f957604051630c00007b60e41b81523360048201526001600160a01b0382169063c00007b090602401600060405180830381600087803b1580156107e057600080fd5b505af11580156107f4573d6000803e3d6000fd5b505050505b50505b80610806816130fc565b91505061065d565b5050565b6000806000806000896001600160a01b0316638d4a99896040518163ffffffff1660e01b8152600401602060405180830381865afa158015610858573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061087c9190612fc2565b8a6001600160a01b0316630a4d82ff6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156108ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108de9190612fc2565b6108e89190612fdb565b9050610914897f0000000000000000000000000000000000000000000000000000000000000000612fee565b81898c6001600160a01b031663562626876040518163ffffffff1660e01b8152600401602060405180830381865afa158015610954573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109789190612fc2565b6109829190612fee565b8c6001600160a01b031663562626876040518163ffffffff1660e01b8152600401602060405180830381865afa1580156109c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109e49190612fc2565b6109ee9085612f83565b6109f89190612fa0565b610a029190612fee565b610a2c907f0000000000000000000000000000000000000000000000000000000000000000612f83565b610a369190612fa0565b9450848a6001600160a01b0316639d1b464a6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a77573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a9b9190612fc2565b610aa5908a612f83565b610aaf9190612fa0565b610ac190670de0b6b3a7640000612fee565b610acc906064612f83565b93507f0000000000000000000000000000000000000000000000000000000000000000610af9888a612f83565b610b039190612fa0565b9250610b377f0000000000000000000000000000000000000000000000000000000000000000670de0b6b3a7640000612f83565b610b418786612fdb565b610b4c90600a612f83565b610b7e7f0000000000000000000000000000000000000000000000000000000000000000670de0b6b3a7640000612f83565b610b889190612fee565b610b92908a612f83565b610b9c9190612fa0565b91505095509550955095915050565b6000806000610bbd8888888888610812565b509194509250859050610bf07f000000000000000000000000000000000000000000000000000000000000000085612f83565b610bfa9190612fa0565b9250610c2e7f0000000000000000000000000000000000000000000000000000000000000000670de0b6b3a7640000612f83565b610c3985600a612f83565b610c6b7f0000000000000000000000000000000000000000000000000000000000000000670de0b6b3a7640000612f83565b610c759190612fdb565b610c7f9085612f83565b610c899190612fa0565b9050955095509592505050565b6000806000806000896001600160a01b0316638d4a99896040518163ffffffff1660e01b8152600401602060405180830381865afa158015610cdc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d009190612fc2565b8a6001600160a01b0316630a4d82ff6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610d3e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d629190612fc2565b610d6c9190612fdb565b9050610d98897f0000000000000000000000000000000000000000000000000000000000000000612fee565b8a6001600160a01b031663562626876040518163ffffffff1660e01b8152600401602060405180830381865afa158015610dd6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dfa9190612fc2565b610e048a84612fee565b8c6001600160a01b031663562626876040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e42573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e669190612fc2565b610e709085612f83565b610e7a9190612fa0565b610e849190612fee565b610eae907f0000000000000000000000000000000000000000000000000000000000000000612f83565b610eb89190612fa0565b9450670de0b6b3a76400008a6001600160a01b0316639d1b464a6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610f01573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f259190612fc2565b610f2f9087612f83565b610f399190612fa0565b610aa589670de0b6b3a7640000612f83565b600254604051630e17122360e41b81526001600160a01b038781166004830152600092839283928392169063e17122309060240160a060405180830381865afa158015610f9c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fc09190613115565b50509250505060007f0000000000000000000000000000000000000000000000000000000000000000826001600160a01b03166392ec16ed6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611027573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061104b9190612fc2565b611075907f0000000000000000000000000000000000000000000000000000000000000000612fee565b61107f908a612f83565b6110899190612fa0565b90506110988a8a838a8a612233565b929d919c50919a5098505050505050505050565b6002548151604051630e17122360e41b81526001600160a01b0391821660048201523392600092839283928392169063e17122309060240160a060405180830381865afa158015611101573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111259190613115565b9450509350935093506000836001600160a01b031663210663e46040518163ffffffff1660e01b8152600401602060405180830381865afa15801561116e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111929190613180565b9050816111d15760405162461bcd60e51b815260206004820152600860248201526708505b1b1bddd95960c21b60448201526064015b60405180910390fd5b806001600160a01b031687602001516001600160a01b031614801561120b5750836001600160a01b031687604001516001600160a01b0316145b1561131957606087015161122d906001600160a01b03831690889030906126f0565b61123c8488606001518361274e565b6003548510156112bd576060870151608088015160405163204c9d9360e11b815260048101929092526024820152600060448201526001600160a01b038516906340993b26906064015b600060405180830381600087803b1580156112a057600080fd5b505af11580156112b4573d6000803e3d6000fd5b50505050612118565b6060870151608088015160a0890151604051630ba002b760e41b815260048101939093526024830191909152600060448301526001600160a01b038881166064840152908116608483015285169063ba002b709060a401611286565b836001600160a01b031687602001516001600160a01b03161480156113535750806001600160a01b031687604001516001600160a01b0316145b1561141e576060870151611375906001600160a01b03861690889030906126f0565b6113848488606001518661274e565b6003548510156113d257606087015160808801516040516334f25c9f60e21b815260048101929092526024820152600060448201526001600160a01b0385169063d3c9727c90606401611286565b60608701516080880151604051636e11a7ad60e11b815260048101929092526024820152600060448201526001600160a01b03878116606483015285169063dc234f5a90608401611286565b836001600160a01b031687602001516001600160a01b03161480156114585750826001600160a01b031687604001516001600160a01b0316145b156116b957606087015161147a906001600160a01b03861690889030906126f0565b6114898388606001518661274e565b8660c00151156114fa5760e0870151604051631a0b0f6960e01b81526001600160a01b03851691631a0b0f69916114c3919060040161319d565b600060405180830381600087803b1580156114dd57600080fd5b505af11580156114f1573d6000803e3d6000fd5b5050505061155b565b6060870151604051634a5c8c6f60e11b815260048101919091526001600160a01b038416906394b918de90602401600060405180830381600087803b15801561154257600080fd5b505af1158015611556573d6000803e3d6000fd5b505050505b6040516370a0823160e01b81523060048201526000906001600160a01b038516906370a0823190602401602060405180830381865afa1580156115a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115c69190612fc2565b905060005b818110156116b257604051632f745c5960e01b81523060048201819052600060248301526001600160a01b038716916342842e0e91908b908490632f745c5990604401602060405180830381865afa15801561162b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061164f9190612fc2565b6040518463ffffffff1660e01b815260040161166d939291906131e1565b600060405180830381600087803b15801561168757600080fd5b505af115801561169b573d6000803e3d6000fd5b5050505080806116aa906130fc565b9150506115cb565b5050612118565b826001600160a01b031687602001516001600160a01b03161480156116f35750836001600160a01b031687604001516001600160a01b0316145b156118a05760005b8760e001515181101561179a57836001600160a01b03166342842e0e88308b60e00151858151811061172f5761172f613087565b60200260200101516040518463ffffffff1660e01b8152600401611755939291906131e1565b600060405180830381600087803b15801561176f57600080fd5b505af1158015611783573d6000803e3d6000fd5b505050508080611792906130fc565b9150506116fb565b5060405163e985e9c560e01b81523060048201526001600160a01b038416602482018190529063e985e9c590604401602060405180830381865afa1580156117e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061180a9190613205565b6118705760405163a22cb46560e01b81526001600160a01b03841660048201819052600160248301529063a22cb46590604401600060405180830381600087803b15801561185757600080fd5b505af115801561186b573d6000803e3d6000fd5b505050505b60e0870151604051637cd7d93560e11b81526001600160a01b0385169163f9afb26a91611286919060040161319d565b806001600160a01b031687602001516001600160a01b03161480156118da5750826001600160a01b031687604001516001600160a01b0316145b15611d3c5760608701516118fc906001600160a01b03831690889030906126f0565b61190b8488606001518361274e565b60035485101561198b576060870151608088015160405163204c9d9360e11b815260048101929092526024820152600060448201526001600160a01b038516906340993b2690606401600060405180830381600087803b15801561196e57600080fd5b505af1158015611982573d6000803e3d6000fd5b50505050611a15565b6060870151608088015160a0890151604051630ba002b760e41b815260048101939093526024830191909152600060448301526001600160a01b038881166064840152908116608483015285169063ba002b709060a401600060405180830381600087803b1580156119fc57600080fd5b505af1158015611a10573d6000803e3d6000fd5b505050505b6040516370a0823160e01b8152306004820152611a8a9084906001600160a01b038716906370a08231906024015b602060405180830381865afa158015611a60573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a849190612fc2565b8661274e565b8660c0015115611afb5760e0870151604051631a0b0f6960e01b81526001600160a01b03851691631a0b0f6991611ac4919060040161319d565b600060405180830381600087803b158015611ade57600080fd5b505af1158015611af2573d6000803e3d6000fd5b50505050611be5565b6040516370a0823160e01b81523060048201526001600160a01b03808516916394b918de91670de0b6b3a764000091908816906370a0823190602401602060405180830381865afa158015611b54573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b789190612fc2565b611b829190612fa0565b611b9490670de0b6b3a7640000612f83565b6040518263ffffffff1660e01b8152600401611bb291815260200190565b600060405180830381600087803b158015611bcc57600080fd5b505af1158015611be0573d6000803e3d6000fd5b505050505b6040516370a0823160e01b81523060048201526000906001600160a01b038516906370a0823190602401602060405180830381865afa158015611c2c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c509190612fc2565b905060005b818110156116b257604051632f745c5960e01b81523060048201819052600060248301526001600160a01b038716916342842e0e91908b908490632f745c5990604401602060405180830381865afa158015611cb5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cd99190612fc2565b6040518463ffffffff1660e01b8152600401611cf7939291906131e1565b600060405180830381600087803b158015611d1157600080fd5b505af1158015611d25573d6000803e3d6000fd5b505050508080611d34906130fc565b915050611c55565b826001600160a01b031687602001516001600160a01b0316148015611d765750806001600160a01b031687604001516001600160a01b0316145b156121185760005b8760e0015151811015611e1d57836001600160a01b03166342842e0e88308b60e001518581518110611db257611db2613087565b60200260200101516040518463ffffffff1660e01b8152600401611dd8939291906131e1565b600060405180830381600087803b158015611df257600080fd5b505af1158015611e06573d6000803e3d6000fd5b505050508080611e15906130fc565b915050611d7e565b5060405163e985e9c560e01b81523060048201526001600160a01b038416602482018190529063e985e9c590604401602060405180830381865afa158015611e69573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e8d9190613205565b611ef35760405163a22cb46560e01b81526001600160a01b03841660048201819052600160248301529063a22cb46590604401600060405180830381600087803b158015611eda57600080fd5b505af1158015611eee573d6000803e3d6000fd5b505050505b60e0870151604051637cd7d93560e11b81526001600160a01b0385169163f9afb26a91611f23919060040161319d565b600060405180830381600087803b158015611f3d57600080fd5b505af1158015611f51573d6000803e3d6000fd5b50506040516370a0823160e01b8152306004820152611f8792508691506001600160a01b038216906370a0823190602401611a43565b600354851015612036576040516370a0823160e01b81523060048201526001600160a01b0385169063d3c9727c9082906370a0823190602401602060405180830381865afa158015611fdd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120019190612fc2565b60808a01516040516001600160e01b031960e085901b1681526004810192909252602482015260006044820152606401611286565b6040516370a0823160e01b81523060048201526001600160a01b0385169063dc234f5a9082906370a0823190602401602060405180830381865afa158015612082573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120a69190612fc2565b60808a01516040516001600160e01b031960e085901b16815260048101929092526024820152600060448201526001600160a01b0389166064820152608401600060405180830381600087803b1580156120ff57600080fd5b505af1158015612113573d6000803e3d6000fd5b505050505b6040516370a0823160e01b81523060048201526121979087906001600160a01b038416906370a0823190602401602060405180830381865afa158015612162573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121869190612fc2565b6001600160a01b0384169190612800565b6040516370a0823160e01b81523060048201526122169087906001600160a01b038716906370a0823190602401602060405180830381865afa1580156121e1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122059190612fc2565b6001600160a01b0387169190612800565b50505050505050565b612227612830565b612231600061288a565b565b6000806000806000896001600160a01b031663562626876040518163ffffffff1660e01b8152600401602060405180830381865afa158015612279573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061229d9190612fc2565b905060007f00000000000000000000000000000000000000000000000000000000000000006122cc8b8b612f83565b6122d69190612fa0565b6122e08a84612fdb565b6122ea9190612fee565b905060008b6001600160a01b0316638d4a99896040518163ffffffff1660e01b8152600401602060405180830381865afa15801561232c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123509190612fc2565b8c6001600160a01b0316630a4d82ff6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561238e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123b29190612fc2565b6123bc9190612fdb565b9050816123c98483612f83565b6123d39190612fa0565b6123dd9082612fee565b9650670de0b6b3a76400008c6001600160a01b0316639d1b464a6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612426573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061244a9190612fc2565b612454908c612f83565b61245e9190612fa0565b61247088670de0b6b3a7640000612f83565b61247a9190612fa0565b61248c90670de0b6b3a7640000612fee565b612497906064612f83565b95507f000000000000000000000000000000000000000000000000000000000000000089670de0b6b3a76400008e6001600160a01b0316639d1b464a6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612502573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125269190612fc2565b612530908e612f83565b61253a9190612fa0565b6125449190612f83565b61254e9190612fa0565b94506125827f0000000000000000000000000000000000000000000000000000000000000000670de0b6b3a7640000612f83565b61258c8988612fdb565b61259790600a612f83565b6125c97f0000000000000000000000000000000000000000000000000000000000000000670de0b6b3a7640000612f83565b6125d39190612fee565b670de0b6b3a76400008e6001600160a01b0316639d1b464a6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561261a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061263e9190612fc2565b612648908e612f83565b6126529190612fa0565b61265c9190612f83565b6126669190612fa0565b935050505095509550955095915050565b61267f612830565b6001600160a01b0381166126e45760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016111c8565b6126ed8161288a565b50565b612748846323b872dd60e01b858585604051602401612711939291906131e1565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526128da565b50505050565b604051636eb1769f60e11b81523060048201526001600160a01b03848116602483015283919083169063dd62ed3e90604401602060405180830381865afa15801561279d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127c19190612fc2565b10156127fb576127fb6001600160a01b038216847f00000000000000000000000000000000000000000000000000000000000000006129ac565b505050565b6040516001600160a01b0383166024820152604481018290526127fb90849063a9059cbb60e01b90606401612711565b6000546001600160a01b031633146122315760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016111c8565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600061292f826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612ac19092919063ffffffff16565b8051909150156127fb578080602001905181019061294d9190613205565b6127fb5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016111c8565b801580612a265750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa158015612a00573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a249190612fc2565b155b612a915760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b60648201526084016111c8565b6040516001600160a01b0383166024820152604481018290526127fb90849063095ea7b360e01b90606401612711565b6060612ad08484600085612ad8565b949350505050565b606082471015612b395760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016111c8565b600080866001600160a01b03168587604051612b559190613246565b60006040518083038185875af1925050503d8060008114612b92576040519150601f19603f3d011682016040523d82523d6000602084013e612b97565b606091505b5091509150612ba887838387612bb3565b979650505050505050565b60608315612c22578251600003612c1b576001600160a01b0385163b612c1b5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016111c8565b5081612ad0565b612ad08383815115612c375781518083602001fd5b8060405162461bcd60e51b81526004016111c89190613262565b6001600160a01b03811681146126ed57600080fd5b8035612c7181612c51565b919050565b600080600080600060a08688031215612c8e57600080fd5b8535612c9981612c51565b97602087013597506040870135966060810135965060800135945092505050565b600080600080600060808688031215612cd257600080fd5b8535612cdd81612c51565b94506020860135612ced81612c51565b935060408601359250606086013567ffffffffffffffff80821115612d1157600080fd5b818801915088601f830112612d2557600080fd5b813581811115612d3457600080fd5b896020828501011115612d4657600080fd5b9699959850939650602001949392505050565b634e487b7160e01b600052604160045260246000fd5b604051610100810167ffffffffffffffff81118282101715612d9357612d93612d59565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715612dc257612dc2612d59565b604052919050565b80151581146126ed57600080fd5b8035612c7181612dca565b600067ffffffffffffffff821115612dfd57612dfd612d59565b5060051b60200190565b600082601f830112612e1857600080fd5b81356020612e2d612e2883612de3565b612d99565b82815260059290921b84018101918181019086841115612e4c57600080fd5b8286015b84811015612e675780358352918301918301612e50565b509695505050505050565b600060208284031215612e8457600080fd5b813567ffffffffffffffff80821115612e9c57600080fd5b908301906101008286031215612eb157600080fd5b612eb9612d6f565b612ec283612c66565b8152612ed060208401612c66565b6020820152612ee160408401612c66565b60408201526060830135606082015260808301356080820152612f0660a08401612c66565b60a0820152612f1760c08401612dd8565b60c082015260e083013582811115612f2e57600080fd5b612f3a87828601612e07565b60e08301525095945050505050565b600060208284031215612f5b57600080fd5b8135612f6681612c51565b9392505050565b634e487b7160e01b600052601160045260246000fd5b8082028115828204841417612f9a57612f9a612f6d565b92915050565b600082612fbd57634e487b7160e01b600052601260045260246000fd5b500490565b600060208284031215612fd457600080fd5b5051919050565b80820180821115612f9a57612f9a612f6d565b81810381811115612f9a57612f9a612f6d565b6000602080838503121561301457600080fd5b825167ffffffffffffffff81111561302b57600080fd5b8301601f8101851361303c57600080fd5b805161304a612e2882612de3565b81815260059190911b8201830190838101908783111561306957600080fd5b928401925b82841015612ba85783518252928401929084019061306e565b634e487b7160e01b600052603260045260246000fd5b600080600080608085870312156130b357600080fd5b84516130be81612c51565b60208601519094506130cf81612c51565b60408601519093506130e081612c51565b60608601519092506130f181612dca565b939692955090935050565b60006001820161310e5761310e612f6d565b5060010190565b600080600080600060a0868803121561312d57600080fd5b85519450602086015161313f81612c51565b604087015190945061315081612c51565b606087015190935061316181612c51565b608087015190925061317281612dca565b809150509295509295909350565b60006020828403121561319257600080fd5b8151612f6681612c51565b6020808252825182820181905260009190848201906040850190845b818110156131d5578351835292840192918401916001016131b9565b50909695505050505050565b6001600160a01b039384168152919092166020820152604081019190915260600190565b60006020828403121561321757600080fd5b8151612f6681612dca565b60005b8381101561323d578181015183820152602001613225565b50506000910152565b60008251613258818460208701613222565b9190910192915050565b6020815260008251806020840152613281816040850160208701613222565b601f01601f1916919091016040019291505056fea2646970667358221220cc121ddb1b250e6708f6e170a74946a08226ac91912128fdaa08293ec2f4549f64736f6c63430008110033000000000000000000000000fa469482108bded1fe3ceb58fc440ef58708ee20000000000000000000000000a80d6d6f5a9a3dce8c9a41abe2e009a0811643d80000000000000000000000000000000000000000000000000000000000000008
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c80636eeb299e116100975780638da5cb5b116100665780638da5cb5b14610234578063c45a015514610245578063d755e64a14610258578063f2fde38b1461026f57600080fd5b80636eeb299e146101db578063709263c1146101ee578063715018a6146102195780638b5c75171461022157600080fd5b806315ce973a116100d357806315ce973a146101745780632d8c7241146101875780634cfd07f8146101b557806354b189a9146101c857600080fd5b80630982a9ac146100fa5780630b83a72714610132578063150b7a021461013c575b600080fd5b61010d610108366004612c76565b610282565b6040805194855260208501939093529183015260608201526080015b60405180910390f35b61013a6105e7565b005b61015b61014a366004612cba565b630a85bd0160e11b95945050505050565b6040516001600160e01b03199091168152602001610129565b61010d610182366004612c76565b610812565b61019a610195366004612c76565b610bab565b60408051938452602084019290925290820152606001610129565b61010d6101c3366004612c76565b610c96565b61019a6101d6366004612c76565b610f4b565b61013a6101e9366004612e72565b6110ac565b600254610201906001600160a01b031681565b6040516001600160a01b039091168152602001610129565b61013a61221f565b61010d61022f366004612c76565b612233565b6000546001600160a01b0316610201565b600154610201906001600160a01b031681565b61026160035481565b604051908152602001610129565b61013a61027d366004612f49565b612677565b6000808080807f00000000000000000000000000000000000000000000000000000000000003e86102b38a8a612f83565b6102bd9190612fa0565b905060008a6001600160a01b0316638d4a99896040518163ffffffff1660e01b8152600401602060405180830381865afa1580156102ff573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103239190612fc2565b8b6001600160a01b0316630a4d82ff6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610361573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103859190612fc2565b61038f9190612fdb565b905060008261039e8b84612fdb565b6103a89190612fee565b905060008c6001600160a01b031663562626876040518163ffffffff1660e01b8152600401602060405180830381865afa1580156103ea573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061040e9190612fc2565b905060008d6001600160a01b0316639d1b464a6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610450573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104749190612fc2565b9050826104818386612f83565b61048b9190612fa0565b6104959083612fee565b98508b6104a2828b612f83565b6104ac9190612fa0565b6104be90670de0b6b3a7640000612fee565b6104c9906064612f83565b97507f00000000000000000000000000000000000000000000000000000000000003e88b826105008f670de0b6b3a7640000612f83565b61050a9190612fa0565b6105149190612f83565b61051e9190612fa0565b96506105527f00000000000000000000000000000000000000000000000000000000000003e8670de0b6b3a7640000612f83565b61055c8b8a612fdb565b61056790600a612f83565b6105997f00000000000000000000000000000000000000000000000000000000000003e8670de0b6b3a7640000612f83565b6105a39190612fee565b826105b68f670de0b6b3a7640000612f83565b6105c09190612fa0565b6105ca9190612f83565b6105d49190612fa0565b9550505050505095509550955095915050565b6002546040805163bb33085760e01b815290516000926001600160a01b03169163bb33085791600480830192869291908290030181865afa158015610630573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526106589190810190613001565b905060005b815181101561080e5760035482828151811061067b5761067b613087565b602002602001015111156107fc57600154825160009182916001600160a01b039091169063d4305c8d908690869081106106b7576106b7613087565b60200260200101516040518263ffffffff1660e01b81526004016106dd91815260200190565b608060405180830381865afa1580156106fa573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061071e919061309d565b5060405163211dc32d60e01b81523360048201526001600160a01b0380851660248301529395509093506000928416915063211dc32d90604401602060405180830381865afa158015610775573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107999190612fc2565b11156107f957604051630c00007b60e41b81523360048201526001600160a01b0382169063c00007b090602401600060405180830381600087803b1580156107e057600080fd5b505af11580156107f4573d6000803e3d6000fd5b505050505b50505b80610806816130fc565b91505061065d565b5050565b6000806000806000896001600160a01b0316638d4a99896040518163ffffffff1660e01b8152600401602060405180830381865afa158015610858573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061087c9190612fc2565b8a6001600160a01b0316630a4d82ff6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156108ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108de9190612fc2565b6108e89190612fdb565b9050610914897f00000000000000000000000000000000000000000000000000000000000003e8612fee565b81898c6001600160a01b031663562626876040518163ffffffff1660e01b8152600401602060405180830381865afa158015610954573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109789190612fc2565b6109829190612fee565b8c6001600160a01b031663562626876040518163ffffffff1660e01b8152600401602060405180830381865afa1580156109c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109e49190612fc2565b6109ee9085612f83565b6109f89190612fa0565b610a029190612fee565b610a2c907f00000000000000000000000000000000000000000000000000000000000003e8612f83565b610a369190612fa0565b9450848a6001600160a01b0316639d1b464a6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a77573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a9b9190612fc2565b610aa5908a612f83565b610aaf9190612fa0565b610ac190670de0b6b3a7640000612fee565b610acc906064612f83565b93507f00000000000000000000000000000000000000000000000000000000000003e8610af9888a612f83565b610b039190612fa0565b9250610b377f00000000000000000000000000000000000000000000000000000000000003e8670de0b6b3a7640000612f83565b610b418786612fdb565b610b4c90600a612f83565b610b7e7f00000000000000000000000000000000000000000000000000000000000003e8670de0b6b3a7640000612f83565b610b889190612fee565b610b92908a612f83565b610b9c9190612fa0565b91505095509550955095915050565b6000806000610bbd8888888888610812565b509194509250859050610bf07f00000000000000000000000000000000000000000000000000000000000003e885612f83565b610bfa9190612fa0565b9250610c2e7f00000000000000000000000000000000000000000000000000000000000003e8670de0b6b3a7640000612f83565b610c3985600a612f83565b610c6b7f00000000000000000000000000000000000000000000000000000000000003e8670de0b6b3a7640000612f83565b610c759190612fdb565b610c7f9085612f83565b610c899190612fa0565b9050955095509592505050565b6000806000806000896001600160a01b0316638d4a99896040518163ffffffff1660e01b8152600401602060405180830381865afa158015610cdc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d009190612fc2565b8a6001600160a01b0316630a4d82ff6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610d3e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d629190612fc2565b610d6c9190612fdb565b9050610d98897f00000000000000000000000000000000000000000000000000000000000003e8612fee565b8a6001600160a01b031663562626876040518163ffffffff1660e01b8152600401602060405180830381865afa158015610dd6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dfa9190612fc2565b610e048a84612fee565b8c6001600160a01b031663562626876040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e42573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e669190612fc2565b610e709085612f83565b610e7a9190612fa0565b610e849190612fee565b610eae907f00000000000000000000000000000000000000000000000000000000000003e8612f83565b610eb89190612fa0565b9450670de0b6b3a76400008a6001600160a01b0316639d1b464a6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610f01573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f259190612fc2565b610f2f9087612f83565b610f399190612fa0565b610aa589670de0b6b3a7640000612f83565b600254604051630e17122360e41b81526001600160a01b038781166004830152600092839283928392169063e17122309060240160a060405180830381865afa158015610f9c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fc09190613115565b50509250505060007f00000000000000000000000000000000000000000000000000000000000003e8826001600160a01b03166392ec16ed6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611027573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061104b9190612fc2565b611075907f00000000000000000000000000000000000000000000000000000000000003e8612fee565b61107f908a612f83565b6110899190612fa0565b90506110988a8a838a8a612233565b929d919c50919a5098505050505050505050565b6002548151604051630e17122360e41b81526001600160a01b0391821660048201523392600092839283928392169063e17122309060240160a060405180830381865afa158015611101573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111259190613115565b9450509350935093506000836001600160a01b031663210663e46040518163ffffffff1660e01b8152600401602060405180830381865afa15801561116e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111929190613180565b9050816111d15760405162461bcd60e51b815260206004820152600860248201526708505b1b1bddd95960c21b60448201526064015b60405180910390fd5b806001600160a01b031687602001516001600160a01b031614801561120b5750836001600160a01b031687604001516001600160a01b0316145b1561131957606087015161122d906001600160a01b03831690889030906126f0565b61123c8488606001518361274e565b6003548510156112bd576060870151608088015160405163204c9d9360e11b815260048101929092526024820152600060448201526001600160a01b038516906340993b26906064015b600060405180830381600087803b1580156112a057600080fd5b505af11580156112b4573d6000803e3d6000fd5b50505050612118565b6060870151608088015160a0890151604051630ba002b760e41b815260048101939093526024830191909152600060448301526001600160a01b038881166064840152908116608483015285169063ba002b709060a401611286565b836001600160a01b031687602001516001600160a01b03161480156113535750806001600160a01b031687604001516001600160a01b0316145b1561141e576060870151611375906001600160a01b03861690889030906126f0565b6113848488606001518661274e565b6003548510156113d257606087015160808801516040516334f25c9f60e21b815260048101929092526024820152600060448201526001600160a01b0385169063d3c9727c90606401611286565b60608701516080880151604051636e11a7ad60e11b815260048101929092526024820152600060448201526001600160a01b03878116606483015285169063dc234f5a90608401611286565b836001600160a01b031687602001516001600160a01b03161480156114585750826001600160a01b031687604001516001600160a01b0316145b156116b957606087015161147a906001600160a01b03861690889030906126f0565b6114898388606001518661274e565b8660c00151156114fa5760e0870151604051631a0b0f6960e01b81526001600160a01b03851691631a0b0f69916114c3919060040161319d565b600060405180830381600087803b1580156114dd57600080fd5b505af11580156114f1573d6000803e3d6000fd5b5050505061155b565b6060870151604051634a5c8c6f60e11b815260048101919091526001600160a01b038416906394b918de90602401600060405180830381600087803b15801561154257600080fd5b505af1158015611556573d6000803e3d6000fd5b505050505b6040516370a0823160e01b81523060048201526000906001600160a01b038516906370a0823190602401602060405180830381865afa1580156115a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115c69190612fc2565b905060005b818110156116b257604051632f745c5960e01b81523060048201819052600060248301526001600160a01b038716916342842e0e91908b908490632f745c5990604401602060405180830381865afa15801561162b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061164f9190612fc2565b6040518463ffffffff1660e01b815260040161166d939291906131e1565b600060405180830381600087803b15801561168757600080fd5b505af115801561169b573d6000803e3d6000fd5b5050505080806116aa906130fc565b9150506115cb565b5050612118565b826001600160a01b031687602001516001600160a01b03161480156116f35750836001600160a01b031687604001516001600160a01b0316145b156118a05760005b8760e001515181101561179a57836001600160a01b03166342842e0e88308b60e00151858151811061172f5761172f613087565b60200260200101516040518463ffffffff1660e01b8152600401611755939291906131e1565b600060405180830381600087803b15801561176f57600080fd5b505af1158015611783573d6000803e3d6000fd5b505050508080611792906130fc565b9150506116fb565b5060405163e985e9c560e01b81523060048201526001600160a01b038416602482018190529063e985e9c590604401602060405180830381865afa1580156117e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061180a9190613205565b6118705760405163a22cb46560e01b81526001600160a01b03841660048201819052600160248301529063a22cb46590604401600060405180830381600087803b15801561185757600080fd5b505af115801561186b573d6000803e3d6000fd5b505050505b60e0870151604051637cd7d93560e11b81526001600160a01b0385169163f9afb26a91611286919060040161319d565b806001600160a01b031687602001516001600160a01b03161480156118da5750826001600160a01b031687604001516001600160a01b0316145b15611d3c5760608701516118fc906001600160a01b03831690889030906126f0565b61190b8488606001518361274e565b60035485101561198b576060870151608088015160405163204c9d9360e11b815260048101929092526024820152600060448201526001600160a01b038516906340993b2690606401600060405180830381600087803b15801561196e57600080fd5b505af1158015611982573d6000803e3d6000fd5b50505050611a15565b6060870151608088015160a0890151604051630ba002b760e41b815260048101939093526024830191909152600060448301526001600160a01b038881166064840152908116608483015285169063ba002b709060a401600060405180830381600087803b1580156119fc57600080fd5b505af1158015611a10573d6000803e3d6000fd5b505050505b6040516370a0823160e01b8152306004820152611a8a9084906001600160a01b038716906370a08231906024015b602060405180830381865afa158015611a60573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a849190612fc2565b8661274e565b8660c0015115611afb5760e0870151604051631a0b0f6960e01b81526001600160a01b03851691631a0b0f6991611ac4919060040161319d565b600060405180830381600087803b158015611ade57600080fd5b505af1158015611af2573d6000803e3d6000fd5b50505050611be5565b6040516370a0823160e01b81523060048201526001600160a01b03808516916394b918de91670de0b6b3a764000091908816906370a0823190602401602060405180830381865afa158015611b54573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b789190612fc2565b611b829190612fa0565b611b9490670de0b6b3a7640000612f83565b6040518263ffffffff1660e01b8152600401611bb291815260200190565b600060405180830381600087803b158015611bcc57600080fd5b505af1158015611be0573d6000803e3d6000fd5b505050505b6040516370a0823160e01b81523060048201526000906001600160a01b038516906370a0823190602401602060405180830381865afa158015611c2c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c509190612fc2565b905060005b818110156116b257604051632f745c5960e01b81523060048201819052600060248301526001600160a01b038716916342842e0e91908b908490632f745c5990604401602060405180830381865afa158015611cb5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cd99190612fc2565b6040518463ffffffff1660e01b8152600401611cf7939291906131e1565b600060405180830381600087803b158015611d1157600080fd5b505af1158015611d25573d6000803e3d6000fd5b505050508080611d34906130fc565b915050611c55565b826001600160a01b031687602001516001600160a01b0316148015611d765750806001600160a01b031687604001516001600160a01b0316145b156121185760005b8760e0015151811015611e1d57836001600160a01b03166342842e0e88308b60e001518581518110611db257611db2613087565b60200260200101516040518463ffffffff1660e01b8152600401611dd8939291906131e1565b600060405180830381600087803b158015611df257600080fd5b505af1158015611e06573d6000803e3d6000fd5b505050508080611e15906130fc565b915050611d7e565b5060405163e985e9c560e01b81523060048201526001600160a01b038416602482018190529063e985e9c590604401602060405180830381865afa158015611e69573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e8d9190613205565b611ef35760405163a22cb46560e01b81526001600160a01b03841660048201819052600160248301529063a22cb46590604401600060405180830381600087803b158015611eda57600080fd5b505af1158015611eee573d6000803e3d6000fd5b505050505b60e0870151604051637cd7d93560e11b81526001600160a01b0385169163f9afb26a91611f23919060040161319d565b600060405180830381600087803b158015611f3d57600080fd5b505af1158015611f51573d6000803e3d6000fd5b50506040516370a0823160e01b8152306004820152611f8792508691506001600160a01b038216906370a0823190602401611a43565b600354851015612036576040516370a0823160e01b81523060048201526001600160a01b0385169063d3c9727c9082906370a0823190602401602060405180830381865afa158015611fdd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120019190612fc2565b60808a01516040516001600160e01b031960e085901b1681526004810192909252602482015260006044820152606401611286565b6040516370a0823160e01b81523060048201526001600160a01b0385169063dc234f5a9082906370a0823190602401602060405180830381865afa158015612082573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120a69190612fc2565b60808a01516040516001600160e01b031960e085901b16815260048101929092526024820152600060448201526001600160a01b0389166064820152608401600060405180830381600087803b1580156120ff57600080fd5b505af1158015612113573d6000803e3d6000fd5b505050505b6040516370a0823160e01b81523060048201526121979087906001600160a01b038416906370a0823190602401602060405180830381865afa158015612162573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121869190612fc2565b6001600160a01b0384169190612800565b6040516370a0823160e01b81523060048201526122169087906001600160a01b038716906370a0823190602401602060405180830381865afa1580156121e1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122059190612fc2565b6001600160a01b0387169190612800565b50505050505050565b612227612830565b612231600061288a565b565b6000806000806000896001600160a01b031663562626876040518163ffffffff1660e01b8152600401602060405180830381865afa158015612279573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061229d9190612fc2565b905060007f00000000000000000000000000000000000000000000000000000000000003e86122cc8b8b612f83565b6122d69190612fa0565b6122e08a84612fdb565b6122ea9190612fee565b905060008b6001600160a01b0316638d4a99896040518163ffffffff1660e01b8152600401602060405180830381865afa15801561232c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123509190612fc2565b8c6001600160a01b0316630a4d82ff6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561238e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123b29190612fc2565b6123bc9190612fdb565b9050816123c98483612f83565b6123d39190612fa0565b6123dd9082612fee565b9650670de0b6b3a76400008c6001600160a01b0316639d1b464a6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612426573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061244a9190612fc2565b612454908c612f83565b61245e9190612fa0565b61247088670de0b6b3a7640000612f83565b61247a9190612fa0565b61248c90670de0b6b3a7640000612fee565b612497906064612f83565b95507f00000000000000000000000000000000000000000000000000000000000003e889670de0b6b3a76400008e6001600160a01b0316639d1b464a6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612502573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125269190612fc2565b612530908e612f83565b61253a9190612fa0565b6125449190612f83565b61254e9190612fa0565b94506125827f00000000000000000000000000000000000000000000000000000000000003e8670de0b6b3a7640000612f83565b61258c8988612fdb565b61259790600a612f83565b6125c97f00000000000000000000000000000000000000000000000000000000000003e8670de0b6b3a7640000612f83565b6125d39190612fee565b670de0b6b3a76400008e6001600160a01b0316639d1b464a6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561261a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061263e9190612fc2565b612648908e612f83565b6126529190612fa0565b61265c9190612f83565b6126669190612fa0565b935050505095509550955095915050565b61267f612830565b6001600160a01b0381166126e45760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016111c8565b6126ed8161288a565b50565b612748846323b872dd60e01b858585604051602401612711939291906131e1565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526128da565b50505050565b604051636eb1769f60e11b81523060048201526001600160a01b03848116602483015283919083169063dd62ed3e90604401602060405180830381865afa15801561279d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127c19190612fc2565b10156127fb576127fb6001600160a01b038216847fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6129ac565b505050565b6040516001600160a01b0383166024820152604481018290526127fb90849063a9059cbb60e01b90606401612711565b6000546001600160a01b031633146122315760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016111c8565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600061292f826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612ac19092919063ffffffff16565b8051909150156127fb578080602001905181019061294d9190613205565b6127fb5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016111c8565b801580612a265750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa158015612a00573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a249190612fc2565b155b612a915760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b60648201526084016111c8565b6040516001600160a01b0383166024820152604481018290526127fb90849063095ea7b360e01b90606401612711565b6060612ad08484600085612ad8565b949350505050565b606082471015612b395760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016111c8565b600080866001600160a01b03168587604051612b559190613246565b60006040518083038185875af1925050503d8060008114612b92576040519150601f19603f3d011682016040523d82523d6000602084013e612b97565b606091505b5091509150612ba887838387612bb3565b979650505050505050565b60608315612c22578251600003612c1b576001600160a01b0385163b612c1b5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016111c8565b5081612ad0565b612ad08383815115612c375781518083602001fd5b8060405162461bcd60e51b81526004016111c89190613262565b6001600160a01b03811681146126ed57600080fd5b8035612c7181612c51565b919050565b600080600080600060a08688031215612c8e57600080fd5b8535612c9981612c51565b97602087013597506040870135966060810135965060800135945092505050565b600080600080600060808688031215612cd257600080fd5b8535612cdd81612c51565b94506020860135612ced81612c51565b935060408601359250606086013567ffffffffffffffff80821115612d1157600080fd5b818801915088601f830112612d2557600080fd5b813581811115612d3457600080fd5b896020828501011115612d4657600080fd5b9699959850939650602001949392505050565b634e487b7160e01b600052604160045260246000fd5b604051610100810167ffffffffffffffff81118282101715612d9357612d93612d59565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715612dc257612dc2612d59565b604052919050565b80151581146126ed57600080fd5b8035612c7181612dca565b600067ffffffffffffffff821115612dfd57612dfd612d59565b5060051b60200190565b600082601f830112612e1857600080fd5b81356020612e2d612e2883612de3565b612d99565b82815260059290921b84018101918181019086841115612e4c57600080fd5b8286015b84811015612e675780358352918301918301612e50565b509695505050505050565b600060208284031215612e8457600080fd5b813567ffffffffffffffff80821115612e9c57600080fd5b908301906101008286031215612eb157600080fd5b612eb9612d6f565b612ec283612c66565b8152612ed060208401612c66565b6020820152612ee160408401612c66565b60408201526060830135606082015260808301356080820152612f0660a08401612c66565b60a0820152612f1760c08401612dd8565b60c082015260e083013582811115612f2e57600080fd5b612f3a87828601612e07565b60e08301525095945050505050565b600060208284031215612f5b57600080fd5b8135612f6681612c51565b9392505050565b634e487b7160e01b600052601160045260246000fd5b8082028115828204841417612f9a57612f9a612f6d565b92915050565b600082612fbd57634e487b7160e01b600052601260045260246000fd5b500490565b600060208284031215612fd457600080fd5b5051919050565b80820180821115612f9a57612f9a612f6d565b81810381811115612f9a57612f9a612f6d565b6000602080838503121561301457600080fd5b825167ffffffffffffffff81111561302b57600080fd5b8301601f8101851361303c57600080fd5b805161304a612e2882612de3565b81815260059190911b8201830190838101908783111561306957600080fd5b928401925b82841015612ba85783518252928401929084019061306e565b634e487b7160e01b600052603260045260246000fd5b600080600080608085870312156130b357600080fd5b84516130be81612c51565b60208601519094506130cf81612c51565b60408601519093506130e081612c51565b60608601519092506130f181612dca565b939692955090935050565b60006001820161310e5761310e612f6d565b5060010190565b600080600080600060a0868803121561312d57600080fd5b85519450602086015161313f81612c51565b604087015190945061315081612c51565b606087015190935061316181612c51565b608087015190925061317281612dca565b809150509295509295909350565b60006020828403121561319257600080fd5b8151612f6681612c51565b6020808252825182820181905260009190848201906040850190845b818110156131d5578351835292840192918401916001016131b9565b50909695505050505050565b6001600160a01b039384168152919092166020820152604081019190915260600190565b60006020828403121561321757600080fd5b8151612f6681612dca565b60005b8381101561323d578181015183820152602001613225565b50506000910152565b60008251613258818460208701613222565b9190910192915050565b6020815260008251806020840152613281816040850160208701613222565b601f01601f1916919091016040019291505056fea2646970667358221220cc121ddb1b250e6708f6e170a74946a08226ac91912128fdaa08293ec2f4549f64736f6c63430008110033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000fa469482108bded1fe3ceb58fc440ef58708ee20000000000000000000000000a80d6d6f5a9a3dce8c9a41abe2e009a0811643d80000000000000000000000000000000000000000000000000000000000000008
-----Decoded View---------------
Arg [0] : _factory (address): 0xfa469482108bDEd1FE3CEb58fC440EF58708EE20
Arg [1] : _collection (address): 0xa80D6d6f5A9A3Dce8c9A41aBe2e009a0811643D8
Arg [2] : _existingLength (uint256): 8
-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 000000000000000000000000fa469482108bded1fe3ceb58fc440ef58708ee20
Arg [1] : 000000000000000000000000a80d6d6f5a9a3dce8c9a41abe2e009a0811643d8
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000008
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$809.73
Net Worth in ETH
0.275735
Token Allocations
BERA
100.00%
Multichain Portfolio | 35 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|---|---|---|---|---|
| BERA | 100.00% | $0.677539 | 1,195.101 | $809.73 |
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.