Source Code
Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
TokenTracker
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Contract Name:
PhalanxV1
Compiler Version
v0.8.3+commit.8d00100c
Optimization Enabled:
No with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// contracts/PhalanxV1.sol
// SPDX-License-Identifier: MIT
/**
Phalanx NFT v1
*/
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/ERC1155URIStorageUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC1155/IERC1155ReceiverUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
contract PhalanxV1 is Initializable, ERC1155URIStorageUpgradeable, OwnableUpgradeable, IERC1155ReceiverUpgradeable, IERC721ReceiverUpgradeable {
event TokenMinted(address indexed _by, uint256 indexed _id);
enum MintType { DAO, OWNER, CONTRIBUTOR, MEMBER }
enum DAOType { GNOSIS_SAFE }
struct ValidationSignature {
bytes32 r;
bytes32 s;
uint8 v;
}
struct DAOInfo {
address _address;
DAOType _daoType;
}
address private _adminSigner;
mapping(uint256 => DAOInfo) private _daoInfo;
function initialize(address adminSigner)
public
initializer
{
__ERC1155_init("");
__ERC1155URIStorage_init();
__Ownable_init();
_adminSigner = adminSigner;
}
function mint(
MintType mintType,
string memory tokenURI,
uint256 baseId,
uint256 price,
address erc20PaymentToken,
ValidationSignature memory validationSignature
)
external
payable
returns (uint256)
{
// Verify that request is valid
bytes32 digest = keccak256(
abi.encode(mintType, tokenURI, baseId, msg.sender, price, erc20PaymentToken)
);
require(_isValidSignature(digest, validationSignature), 'Invalid validation signature');
if (erc20PaymentToken != address(0)) {
// Transfer payment ERC20 tokens
ERC20 erc20Token = ERC20(erc20PaymentToken);
erc20Token.transferFrom(msg.sender, address(this), price);
} else {
// Validate ETH payment is correct
require(msg.value == price, "Insufficient ETH supplied for transaction");
}
uint256 tokenId = _tokenIdFromType(baseId, mintType);
require(balanceOf(msg.sender, tokenId) == 0, "Cannot mint more than one Phalanx token");
if (mintType == MintType.DAO) {
require(_daoInfo[baseId]._address == address(0), "ID already claimed.");
_daoInfo[baseId] = DAOInfo(msg.sender, DAOType.GNOSIS_SAFE);
_mint(msg.sender, tokenId, 1, "");
_setURI(tokenId, tokenURI);
} else {
require(_daoInfo[baseId]._address != address(0), "DAO not listed yet.");
_mint(msg.sender, tokenId, 1, "");
}
// Emit for backend to pickup
emit TokenMinted(msg.sender, tokenId);
return tokenId;
}
function setAdminSigner(
address adminSigner
)
external
onlyOwner
{
_adminSigner = adminSigner;
}
function setURI(
uint256 tokenId,
string memory tokenURI
)
external
onlyOwner
{
_setURI(tokenId, tokenURI);
}
function name() external pure returns (string memory _name) {
return "Phalanx";
}
function symbol() external pure returns (string memory _symbol) {
return "PHNX";
}
// Internal methods
function _isValidSignature(bytes32 digest, ValidationSignature memory validationSignature)
internal
view
returns (bool)
{
address signer = ecrecover(digest, validationSignature.v, validationSignature.r, validationSignature.s);
require(signer != address(0), 'ECDSA: invalid signature');
return signer == _adminSigner;
}
function _tokenIdFromType(uint256 id, MintType mintType)
internal
pure
returns (uint256)
{
return (id << 8) | uint(mintType);
}
function _beforeTokenTransfer(
address operator,
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal override(ERC1155Upgradeable) {
if (from == address(0)) {
return super._beforeTokenTransfer(operator, from, to, ids, amounts, data);
}
return revert("Phalanx token cannot be transferred!");
}
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external override(IERC721ReceiverUpgradeable) returns (bytes4) {
return this.onERC721Received.selector;
}
function onERC1155Received(
address operator,
address from,
uint256 id,
uint256 value,
bytes calldata data
) external override(IERC1155ReceiverUpgradeable) returns (bytes4) {
return this.onERC1155Received.selector;
}
function onERC1155BatchReceived(
address operator,
address from,
uint256[] calldata ids,
uint256[] calldata values,
bytes calldata data
) external override(IERC1155ReceiverUpgradeable) returns (bytes4) {
return this.onERC1155BatchReceived.selector;
}
function uri(
uint256 tokenId
) public view virtual override(ERC1155URIStorageUpgradeable) returns (string memory) {
return super.uri(_tokenIdFromType(tokenId >> 8, MintType.DAO));
}
function withdrawETH(
address _to
)
external
onlyOwner()
{
(bool success, ) = _to.call{value: address(this).balance}('');
require(
success
, "_transferEth: Eth transfer failed"
);
}
function withdrawERC20(
address _tokenAddress
, address _to
)
external
onlyOwner()
{
IERC20(_tokenAddress).transfer(
_to
, IERC20(_tokenAddress).balanceOf(address(this))
);
}
function withdrawERC721(
address _tokenAddress
, uint256[] calldata _tokenIds
, address _to
)
external
onlyOwner()
{
for (uint256 i = 0; i < _tokenIds.length; i++) {
IERC721(_tokenAddress).transferFrom(
address(this)
, _to
, _tokenIds[i]
);
}
}
function withdrawERC1155(
address _tokenAddress
, uint256[] calldata _tokenIds
, uint256[] calldata _amounts
, address _to
)
external
onlyOwner()
{
for (uint256 i = 0; i < _tokenIds.length; i++) {
IERC1155(_tokenAddress).safeTransferFrom(
address(this)
, _to
, _tokenIds[i]
, _amounts[i]
, ""
);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.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.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin Contracts guidelines: functions revert
* instead returning `false` on failure. This behavior is nonetheless
* conventional and does not conflict with the expectations of ERC20
* applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
contract ERC20 is Context, IERC20, IERC20Metadata {
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*
* The default value of {decimals} is 18. To select a different value for
* {decimals} you should overload it.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5.05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless this function is
* overridden;
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual override returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `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;
}
_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;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
_afterTokenTransfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
unchecked {
_balances[account] = accountBalance - amount;
}
_totalSupply -= amount;
emit Transfer(account, address(0), amount);
_afterTokenTransfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev 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 (last updated v4.7.0) (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 = _owners[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 nor 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 nor approved");
_transfer(from, to, tokenId);
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
safeTransferFrom(from, to, tokenId, "");
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory data
) public virtual override {
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner nor approved");
_safeTransfer(from, to, tokenId, data);
}
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* `data` is additional data, it has no specified format and it is sent in call to `to`.
*
* This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
* implement alternative mechanisms to perform token transfer, such as signature-based.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeTransfer(
address from,
address to,
uint256 tokenId,
bytes memory data
) internal virtual {
_transfer(from, to, tokenId);
require(_checkOnERC721Received(from, to, tokenId, data), "ERC721: transfer to non ERC721Receiver implementer");
}
/**
* @dev Returns whether `tokenId` exists.
*
* Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
*
* Tokens start existing when they are minted (`_mint`),
* and stop existing when they are burned (`_burn`).
*/
function _exists(uint256 tokenId) internal view virtual returns (bool) {
return _owners[tokenId] != address(0);
}
/**
* @dev Returns whether `spender` is allowed to manage `tokenId`.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
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);
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(address(0), to, tokenId);
_afterTokenTransfer(address(0), to, tokenId);
}
/**
* @dev Destroys `tokenId`.
* The approval is cleared when the token is burned.
*
* Requirements:
*
* - `tokenId` must exist.
*
* Emits a {Transfer} event.
*/
function _burn(uint256 tokenId) internal virtual {
address owner = ERC721.ownerOf(tokenId);
_beforeTokenTransfer(owner, address(0), tokenId);
// Clear approvals
_approve(address(0), tokenId);
_balances[owner] -= 1;
delete _owners[tokenId];
emit Transfer(owner, address(0), tokenId);
_afterTokenTransfer(owner, address(0), tokenId);
}
/**
* @dev Transfers `tokenId` from `from` to `to`.
* As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
*
* Emits a {Transfer} event.
*/
function _transfer(
address from,
address to,
uint256 tokenId
) internal virtual {
require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner");
require(to != address(0), "ERC721: transfer to the zero address");
_beforeTokenTransfer(from, to, tokenId);
// Clear approvals from the previous owner
_approve(address(0), tokenId);
_balances[from] -= 1;
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(from, to, tokenId);
_afterTokenTransfer(from, to, tokenId);
}
/**
* @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.
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
* transferred to `to`.
* - When `from` is zero, `tokenId` will be minted for `to`.
* - When `to` is zero, ``from``'s `tokenId` will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual {}
/**
* @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.
* - `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 tokenId
) internal virtual {}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/ERC1155.sol)
pragma solidity ^0.8.0;
import "./IERC1155.sol";
import "./IERC1155Receiver.sol";
import "./extensions/IERC1155MetadataURI.sol";
import "../../utils/Address.sol";
import "../../utils/Context.sol";
import "../../utils/introspection/ERC165.sol";
/**
* @dev Implementation of the basic standard multi-token.
* See https://eips.ethereum.org/EIPS/eip-1155
* Originally based on code by Enjin: https://github.com/enjin/erc-1155
*
* _Available since v3.1._
*/
contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI {
using Address for address;
// Mapping from token ID to account balances
mapping(uint256 => mapping(address => uint256)) private _balances;
// Mapping from account to operator approvals
mapping(address => mapping(address => bool)) private _operatorApprovals;
// Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json
string private _uri;
/**
* @dev See {_setURI}.
*/
constructor(string memory uri_) {
_setURI(uri_);
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return
interfaceId == type(IERC1155).interfaceId ||
interfaceId == type(IERC1155MetadataURI).interfaceId ||
super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC1155MetadataURI-uri}.
*
* This implementation returns the same URI for *all* token types. It relies
* on the token type ID substitution mechanism
* https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].
*
* Clients calling this function must replace the `\{id\}` substring with the
* actual token type ID.
*/
function uri(uint256) public view virtual override returns (string memory) {
return _uri;
}
/**
* @dev See {IERC1155-balanceOf}.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function balanceOf(address account, uint256 id) public view virtual override returns (uint256) {
require(account != address(0), "ERC1155: address zero is not a valid owner");
return _balances[id][account];
}
/**
* @dev See {IERC1155-balanceOfBatch}.
*
* Requirements:
*
* - `accounts` and `ids` must have the same length.
*/
function balanceOfBatch(address[] memory accounts, uint256[] memory ids)
public
view
virtual
override
returns (uint256[] memory)
{
require(accounts.length == ids.length, "ERC1155: accounts and ids length mismatch");
uint256[] memory batchBalances = new uint256[](accounts.length);
for (uint256 i = 0; i < accounts.length; ++i) {
batchBalances[i] = balanceOf(accounts[i], ids[i]);
}
return batchBalances;
}
/**
* @dev See {IERC1155-setApprovalForAll}.
*/
function setApprovalForAll(address operator, bool approved) public virtual override {
_setApprovalForAll(_msgSender(), operator, approved);
}
/**
* @dev See {IERC1155-isApprovedForAll}.
*/
function isApprovedForAll(address account, address operator) public view virtual override returns (bool) {
return _operatorApprovals[account][operator];
}
/**
* @dev See {IERC1155-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 id,
uint256 amount,
bytes memory data
) public virtual override {
require(
from == _msgSender() || isApprovedForAll(from, _msgSender()),
"ERC1155: caller is not token owner nor approved"
);
_safeTransferFrom(from, to, id, amount, data);
}
/**
* @dev See {IERC1155-safeBatchTransferFrom}.
*/
function safeBatchTransferFrom(
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) public virtual override {
require(
from == _msgSender() || isApprovedForAll(from, _msgSender()),
"ERC1155: caller is not token owner nor approved"
);
_safeBatchTransferFrom(from, to, ids, amounts, data);
}
/**
* @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
*
* Emits a {TransferSingle} event.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `from` must have a balance of tokens of type `id` of at least `amount`.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
* acceptance magic value.
*/
function _safeTransferFrom(
address from,
address to,
uint256 id,
uint256 amount,
bytes memory data
) internal virtual {
require(to != address(0), "ERC1155: transfer to the zero address");
address operator = _msgSender();
uint256[] memory ids = _asSingletonArray(id);
uint256[] memory amounts = _asSingletonArray(amount);
_beforeTokenTransfer(operator, from, to, ids, amounts, data);
uint256 fromBalance = _balances[id][from];
require(fromBalance >= amount, "ERC1155: insufficient balance for transfer");
unchecked {
_balances[id][from] = fromBalance - amount;
}
_balances[id][to] += amount;
emit TransferSingle(operator, from, to, id, amount);
_afterTokenTransfer(operator, from, to, ids, amounts, data);
_doSafeTransferAcceptanceCheck(operator, from, to, id, amount, data);
}
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_safeTransferFrom}.
*
* Emits a {TransferBatch} event.
*
* Requirements:
*
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
* acceptance magic value.
*/
function _safeBatchTransferFrom(
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual {
require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
require(to != address(0), "ERC1155: transfer to the zero address");
address operator = _msgSender();
_beforeTokenTransfer(operator, from, to, ids, amounts, data);
for (uint256 i = 0; i < ids.length; ++i) {
uint256 id = ids[i];
uint256 amount = amounts[i];
uint256 fromBalance = _balances[id][from];
require(fromBalance >= amount, "ERC1155: insufficient balance for transfer");
unchecked {
_balances[id][from] = fromBalance - amount;
}
_balances[id][to] += amount;
}
emit TransferBatch(operator, from, to, ids, amounts);
_afterTokenTransfer(operator, from, to, ids, amounts, data);
_doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, amounts, data);
}
/**
* @dev Sets a new URI for all token types, by relying on the token type ID
* substitution mechanism
* https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].
*
* By this mechanism, any occurrence of the `\{id\}` substring in either the
* URI or any of the amounts in the JSON file at said URI will be replaced by
* clients with the token type ID.
*
* For example, the `https://token-cdn-domain/\{id\}.json` URI would be
* interpreted by clients as
* `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json`
* for token type ID 0x4cce0.
*
* See {uri}.
*
* Because these URIs cannot be meaningfully represented by the {URI} event,
* this function emits no events.
*/
function _setURI(string memory newuri) internal virtual {
_uri = newuri;
}
/**
* @dev Creates `amount` tokens of token type `id`, and assigns them to `to`.
*
* Emits a {TransferSingle} event.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
* acceptance magic value.
*/
function _mint(
address to,
uint256 id,
uint256 amount,
bytes memory data
) internal virtual {
require(to != address(0), "ERC1155: mint to the zero address");
address operator = _msgSender();
uint256[] memory ids = _asSingletonArray(id);
uint256[] memory amounts = _asSingletonArray(amount);
_beforeTokenTransfer(operator, address(0), to, ids, amounts, data);
_balances[id][to] += amount;
emit TransferSingle(operator, address(0), to, id, amount);
_afterTokenTransfer(operator, address(0), to, ids, amounts, data);
_doSafeTransferAcceptanceCheck(operator, address(0), to, id, amount, data);
}
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}.
*
* Emits a {TransferBatch} event.
*
* Requirements:
*
* - `ids` and `amounts` must have the same length.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
* acceptance magic value.
*/
function _mintBatch(
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual {
require(to != address(0), "ERC1155: mint to the zero address");
require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
address operator = _msgSender();
_beforeTokenTransfer(operator, address(0), to, ids, amounts, data);
for (uint256 i = 0; i < ids.length; i++) {
_balances[ids[i]][to] += amounts[i];
}
emit TransferBatch(operator, address(0), to, ids, amounts);
_afterTokenTransfer(operator, address(0), to, ids, amounts, data);
_doSafeBatchTransferAcceptanceCheck(operator, address(0), to, ids, amounts, data);
}
/**
* @dev Destroys `amount` tokens of token type `id` from `from`
*
* Emits a {TransferSingle} event.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `from` must have at least `amount` tokens of token type `id`.
*/
function _burn(
address from,
uint256 id,
uint256 amount
) internal virtual {
require(from != address(0), "ERC1155: burn from the zero address");
address operator = _msgSender();
uint256[] memory ids = _asSingletonArray(id);
uint256[] memory amounts = _asSingletonArray(amount);
_beforeTokenTransfer(operator, from, address(0), ids, amounts, "");
uint256 fromBalance = _balances[id][from];
require(fromBalance >= amount, "ERC1155: burn amount exceeds balance");
unchecked {
_balances[id][from] = fromBalance - amount;
}
emit TransferSingle(operator, from, address(0), id, amount);
_afterTokenTransfer(operator, from, address(0), ids, amounts, "");
}
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}.
*
* Emits a {TransferBatch} event.
*
* Requirements:
*
* - `ids` and `amounts` must have the same length.
*/
function _burnBatch(
address from,
uint256[] memory ids,
uint256[] memory amounts
) internal virtual {
require(from != address(0), "ERC1155: burn from the zero address");
require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
address operator = _msgSender();
_beforeTokenTransfer(operator, from, address(0), ids, amounts, "");
for (uint256 i = 0; i < ids.length; i++) {
uint256 id = ids[i];
uint256 amount = amounts[i];
uint256 fromBalance = _balances[id][from];
require(fromBalance >= amount, "ERC1155: burn amount exceeds balance");
unchecked {
_balances[id][from] = fromBalance - amount;
}
}
emit TransferBatch(operator, from, address(0), ids, amounts);
_afterTokenTransfer(operator, from, address(0), ids, amounts, "");
}
/**
* @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, "ERC1155: setting approval status for self");
_operatorApprovals[owner][operator] = approved;
emit ApprovalForAll(owner, operator, approved);
}
/**
* @dev Hook that is called before any token transfer. This includes minting
* and burning, as well as batched variants.
*
* The same hook is called on both single and batched variants. For single
* transfers, the length of the `ids` and `amounts` arrays will be 1.
*
* Calling conditions (for each `id` and `amount` pair):
*
* - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* of token type `id` will be transferred to `to`.
* - When `from` is zero, `amount` tokens of token type `id` will be minted
* for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens of token type `id`
* will be burned.
* - `from` and `to` are never both zero.
* - `ids` and `amounts` have the same, non-zero length.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address operator,
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual {}
/**
* @dev Hook that is called after any token transfer. This includes minting
* and burning, as well as batched variants.
*
* The same hook is called on both single and batched variants. For single
* transfers, the length of the `id` and `amount` arrays will be 1.
*
* Calling conditions (for each `id` and `amount` pair):
*
* - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* of token type `id` will be transferred to `to`.
* - When `from` is zero, `amount` tokens of token type `id` will be minted
* for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens of token type `id`
* will be burned.
* - `from` and `to` are never both zero.
* - `ids` and `amounts` have the same, non-zero length.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _afterTokenTransfer(
address operator,
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual {}
function _doSafeTransferAcceptanceCheck(
address operator,
address from,
address to,
uint256 id,
uint256 amount,
bytes memory data
) private {
if (to.isContract()) {
try IERC1155Receiver(to).onERC1155Received(operator, from, id, amount, data) returns (bytes4 response) {
if (response != IERC1155Receiver.onERC1155Received.selector) {
revert("ERC1155: ERC1155Receiver rejected tokens");
}
} catch Error(string memory reason) {
revert(reason);
} catch {
revert("ERC1155: transfer to non ERC1155Receiver implementer");
}
}
}
function _doSafeBatchTransferAcceptanceCheck(
address operator,
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) private {
if (to.isContract()) {
try IERC1155Receiver(to).onERC1155BatchReceived(operator, from, ids, amounts, data) returns (
bytes4 response
) {
if (response != IERC1155Receiver.onERC1155BatchReceived.selector) {
revert("ERC1155: ERC1155Receiver rejected tokens");
}
} catch Error(string memory reason) {
revert(reason);
} catch {
revert("ERC1155: transfer to non ERC1155Receiver implementer");
}
}
}
function _asSingletonArray(uint256 element) private pure returns (uint256[] memory) {
uint256[] memory array = new uint256[](1);
array[0] = element;
return array;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC1155/extensions/ERC1155URIStorage.sol)
pragma solidity ^0.8.0;
import "../../../utils/StringsUpgradeable.sol";
import "../ERC1155Upgradeable.sol";
import "../../../proxy/utils/Initializable.sol";
/**
* @dev ERC1155 token with storage based token URI management.
* Inspired by the ERC721URIStorage extension
*
* _Available since v4.6._
*/
abstract contract ERC1155URIStorageUpgradeable is Initializable, ERC1155Upgradeable {
function __ERC1155URIStorage_init() internal onlyInitializing {
__ERC1155URIStorage_init_unchained();
}
function __ERC1155URIStorage_init_unchained() internal onlyInitializing {
_baseURI = "";
}
using StringsUpgradeable for uint256;
// Optional base URI
string private _baseURI;
// Optional mapping for token URIs
mapping(uint256 => string) private _tokenURIs;
/**
* @dev See {IERC1155MetadataURI-uri}.
*
* This implementation returns the concatenation of the `_baseURI`
* and the token-specific uri if the latter is set
*
* This enables the following behaviors:
*
* - if `_tokenURIs[tokenId]` is set, then the result is the concatenation
* of `_baseURI` and `_tokenURIs[tokenId]` (keep in mind that `_baseURI`
* is empty per default);
*
* - if `_tokenURIs[tokenId]` is NOT set then we fallback to `super.uri()`
* which in most cases will contain `ERC1155._uri`;
*
* - if `_tokenURIs[tokenId]` is NOT set, and if the parents do not have a
* uri value set, then the result is empty.
*/
function uri(uint256 tokenId) public view virtual override returns (string memory) {
string memory tokenURI = _tokenURIs[tokenId];
// If token URI is set, concatenate base URI and tokenURI (via abi.encodePacked).
return bytes(tokenURI).length > 0 ? string(abi.encodePacked(_baseURI, tokenURI)) : super.uri(tokenId);
}
/**
* @dev Sets `tokenURI` as the tokenURI of `tokenId`.
*/
function _setURI(uint256 tokenId, string memory tokenURI) internal virtual {
_tokenURIs[tokenId] = tokenURI;
emit URI(uri(tokenId), tokenId);
}
/**
* @dev Sets `baseURI` as the `_baseURI` for all tokens
*/
function _setBaseURI(string memory baseURI) internal virtual {
_baseURI = baseURI;
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[48] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165Upgradeable.sol";
/**
* @dev _Available since v3.1._
*/
interface IERC1155ReceiverUpgradeable is IERC165Upgradeable {
/**
* @dev Handles the receipt of a single ERC1155 token type. This function is
* called at the end of a `safeTransferFrom` after the balance has been updated.
*
* NOTE: To accept the transfer, this must return
* `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`
* (i.e. 0xf23a6e61, or its own function selector).
*
* @param operator The address which initiated the transfer (i.e. msg.sender)
* @param from The address which previously owned the token
* @param id The ID of the token being transferred
* @param value The amount of tokens being transferred
* @param data Additional data with no specified format
* @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed
*/
function onERC1155Received(
address operator,
address from,
uint256 id,
uint256 value,
bytes calldata data
) external returns (bytes4);
/**
* @dev Handles the receipt of a multiple ERC1155 token types. This function
* is called at the end of a `safeBatchTransferFrom` after the balances have
* been updated.
*
* NOTE: To accept the transfer(s), this must return
* `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`
* (i.e. 0xbc197c81, or its own function selector).
*
* @param operator The address which initiated the batch transfer (i.e. msg.sender)
* @param from The address which previously owned the token
* @param ids An array containing ids of each token being transferred (order and length must match values array)
* @param values An array containing amounts of each token being transferred (order and length must match ids array)
* @param data Additional data with no specified format
* @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed
*/
function onERC1155BatchReceived(
address operator,
address from,
uint256[] calldata ids,
uint256[] calldata values,
bytes calldata data
) external returns (bytes4);
}// 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 IERC721ReceiverUpgradeable {
/**
* @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
* by `operator` from `from`, this function is called.
*
* It must return its Solidity selector to confirm the token transfer.
* If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
*
* The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.
*/
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)
pragma solidity ^0.8.2;
import "../../utils/AddressUpgradeable.sol";
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
* behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
* external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
* function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
*
* The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
* reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
* case an upgrade adds a module that needs to be initialized.
*
* For example:
*
* [.hljs-theme-light.nopadding]
* ```
* contract MyToken is ERC20Upgradeable {
* function initialize() initializer public {
* __ERC20_init("MyToken", "MTK");
* }
* }
* contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
* function initializeV2() reinitializer(2) public {
* __ERC20Permit_init("MyToken");
* }
* }
* ```
*
* TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
* possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
*
* CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
* that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
*
* [CAUTION]
* ====
* Avoid leaving a contract uninitialized.
*
* An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
* contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
* the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
*
* [.hljs-theme-light.nopadding]
* ```
* /// @custom:oz-upgrades-unsafe-allow constructor
* constructor() {
* _disableInitializers();
* }
* ```
* ====
*/
abstract contract Initializable {
/**
* @dev Indicates that the contract has been initialized.
* @custom:oz-retyped-from bool
*/
uint8 private _initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool private _initializing;
/**
* @dev Triggered when the contract has been initialized or reinitialized.
*/
event Initialized(uint8 version);
/**
* @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
* `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.
*/
modifier initializer() {
bool isTopLevelCall = !_initializing;
require(
(isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
"Initializable: contract is already initialized"
);
_initialized = 1;
if (isTopLevelCall) {
_initializing = true;
}
_;
if (isTopLevelCall) {
_initializing = false;
emit Initialized(1);
}
}
/**
* @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
* contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
* used to initialize parent contracts.
*
* `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original
* initialization step. This is essential to configure modules that are added through upgrades and that require
* initialization.
*
* Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
* a contract, executing them in the right order is up to the developer or operator.
*/
modifier reinitializer(uint8 version) {
require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
_initialized = version;
_initializing = true;
_;
_initializing = false;
emit Initialized(version);
}
/**
* @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
* {initializer} and {reinitializer} modifiers, directly or indirectly.
*/
modifier onlyInitializing() {
require(_initializing, "Initializable: contract is not initializing");
_;
}
/**
* @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
* Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
* to any version. It is recommended to use this to lock implementation contracts that are designed to be called
* through proxies.
*/
function _disableInitializers() internal virtual {
require(!_initializing, "Initializable: contract is initializing");
if (_initialized < type(uint8).max) {
_initialized = type(uint8).max;
emit Initialized(type(uint8).max);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.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 OwnableUpgradeable is Initializable, ContextUpgradeable {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
function __Ownable_init() internal onlyInitializing {
__Ownable_init_unchained();
}
function __Ownable_init_unchained() internal onlyInitializing {
_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);
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[49] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 amount
) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/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 v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol)
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721 is IERC165 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external;
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool _approved) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (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 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.7.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
uint8 private constant _ADDRESS_LENGTH = 20;
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
// Inspired by OraclizeAPI's implementation - MIT licence
// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0x00";
}
uint256 temp = value;
uint256 length = 0;
while (temp != 0) {
length++;
temp >>= 8;
}
return toHexString(value, length);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
/**
* @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
*/
function toHexString(address addr) internal pure returns (string memory) {
return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
pragma solidity ^0.8.0;
import "./IERC165.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/IERC1155.sol)
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
/**
* @dev Required interface of an ERC1155 compliant contract, as defined in the
* https://eips.ethereum.org/EIPS/eip-1155[EIP].
*
* _Available since v3.1._
*/
interface IERC1155 is IERC165 {
/**
* @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.
*/
event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);
/**
* @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all
* transfers.
*/
event TransferBatch(
address indexed operator,
address indexed from,
address indexed to,
uint256[] ids,
uint256[] values
);
/**
* @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to
* `approved`.
*/
event ApprovalForAll(address indexed account, address indexed operator, bool approved);
/**
* @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.
*
* If an {URI} event was emitted for `id`, the standard
* https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value
* returned by {IERC1155MetadataURI-uri}.
*/
event URI(string value, uint256 indexed id);
/**
* @dev Returns the amount of tokens of token type `id` owned by `account`.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function balanceOf(address account, uint256 id) external view returns (uint256);
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.
*
* Requirements:
*
* - `accounts` and `ids` must have the same length.
*/
function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)
external
view
returns (uint256[] memory);
/**
* @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,
*
* Emits an {ApprovalForAll} event.
*
* Requirements:
*
* - `operator` cannot be the caller.
*/
function setApprovalForAll(address operator, bool approved) external;
/**
* @dev Returns true if `operator` is approved to transfer ``account``'s tokens.
*
* See {setApprovalForAll}.
*/
function isApprovedForAll(address account, address operator) external view returns (bool);
/**
* @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
*
* Emits a {TransferSingle} event.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.
* - `from` must have a balance of tokens of type `id` of at least `amount`.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
* acceptance magic value.
*/
function safeTransferFrom(
address from,
address to,
uint256 id,
uint256 amount,
bytes calldata data
) external;
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.
*
* Emits a {TransferBatch} event.
*
* Requirements:
*
* - `ids` and `amounts` must have the same length.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
* acceptance magic value.
*/
function safeBatchTransferFrom(
address from,
address to,
uint256[] calldata ids,
uint256[] calldata amounts,
bytes calldata data
) external;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
/**
* @dev _Available since v3.1._
*/
interface IERC1155Receiver is IERC165 {
/**
* @dev Handles the receipt of a single ERC1155 token type. This function is
* called at the end of a `safeTransferFrom` after the balance has been updated.
*
* NOTE: To accept the transfer, this must return
* `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`
* (i.e. 0xf23a6e61, or its own function selector).
*
* @param operator The address which initiated the transfer (i.e. msg.sender)
* @param from The address which previously owned the token
* @param id The ID of the token being transferred
* @param value The amount of tokens being transferred
* @param data Additional data with no specified format
* @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed
*/
function onERC1155Received(
address operator,
address from,
uint256 id,
uint256 value,
bytes calldata data
) external returns (bytes4);
/**
* @dev Handles the receipt of a multiple ERC1155 token types. This function
* is called at the end of a `safeBatchTransferFrom` after the balances have
* been updated.
*
* NOTE: To accept the transfer(s), this must return
* `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`
* (i.e. 0xbc197c81, or its own function selector).
*
* @param operator The address which initiated the batch transfer (i.e. msg.sender)
* @param from The address which previously owned the token
* @param ids An array containing ids of each token being transferred (order and length must match values array)
* @param values An array containing amounts of each token being transferred (order and length must match ids array)
* @param data Additional data with no specified format
* @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed
*/
function onERC1155BatchReceived(
address operator,
address from,
uint256[] calldata ids,
uint256[] calldata values,
bytes calldata data
) external returns (bytes4);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)
pragma solidity ^0.8.0;
import "../IERC1155.sol";
/**
* @dev Interface of the optional ERC1155MetadataExtension interface, as defined
* in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].
*
* _Available since v3.1._
*/
interface IERC1155MetadataURI is IERC1155 {
/**
* @dev Returns the URI for token type `id`.
*
* If the `\{id\}` substring is present in the URI, it must be replaced by
* clients with the actual token type ID.
*/
function uri(uint256 id) external view returns (string memory);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library StringsUpgradeable {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
uint8 private constant _ADDRESS_LENGTH = 20;
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
// Inspired by OraclizeAPI's implementation - MIT licence
// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0x00";
}
uint256 temp = value;
uint256 length = 0;
while (temp != 0) {
length++;
temp >>= 8;
}
return toHexString(value, length);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
/**
* @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
*/
function toHexString(address addr) internal pure returns (string memory) {
return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/ERC1155.sol)
pragma solidity ^0.8.0;
import "./IERC1155Upgradeable.sol";
import "./IERC1155ReceiverUpgradeable.sol";
import "./extensions/IERC1155MetadataURIUpgradeable.sol";
import "../../utils/AddressUpgradeable.sol";
import "../../utils/ContextUpgradeable.sol";
import "../../utils/introspection/ERC165Upgradeable.sol";
import "../../proxy/utils/Initializable.sol";
/**
* @dev Implementation of the basic standard multi-token.
* See https://eips.ethereum.org/EIPS/eip-1155
* Originally based on code by Enjin: https://github.com/enjin/erc-1155
*
* _Available since v3.1._
*/
contract ERC1155Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC1155Upgradeable, IERC1155MetadataURIUpgradeable {
using AddressUpgradeable for address;
// Mapping from token ID to account balances
mapping(uint256 => mapping(address => uint256)) private _balances;
// Mapping from account to operator approvals
mapping(address => mapping(address => bool)) private _operatorApprovals;
// Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json
string private _uri;
/**
* @dev See {_setURI}.
*/
function __ERC1155_init(string memory uri_) internal onlyInitializing {
__ERC1155_init_unchained(uri_);
}
function __ERC1155_init_unchained(string memory uri_) internal onlyInitializing {
_setURI(uri_);
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {
return
interfaceId == type(IERC1155Upgradeable).interfaceId ||
interfaceId == type(IERC1155MetadataURIUpgradeable).interfaceId ||
super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC1155MetadataURI-uri}.
*
* This implementation returns the same URI for *all* token types. It relies
* on the token type ID substitution mechanism
* https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].
*
* Clients calling this function must replace the `\{id\}` substring with the
* actual token type ID.
*/
function uri(uint256) public view virtual override returns (string memory) {
return _uri;
}
/**
* @dev See {IERC1155-balanceOf}.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function balanceOf(address account, uint256 id) public view virtual override returns (uint256) {
require(account != address(0), "ERC1155: address zero is not a valid owner");
return _balances[id][account];
}
/**
* @dev See {IERC1155-balanceOfBatch}.
*
* Requirements:
*
* - `accounts` and `ids` must have the same length.
*/
function balanceOfBatch(address[] memory accounts, uint256[] memory ids)
public
view
virtual
override
returns (uint256[] memory)
{
require(accounts.length == ids.length, "ERC1155: accounts and ids length mismatch");
uint256[] memory batchBalances = new uint256[](accounts.length);
for (uint256 i = 0; i < accounts.length; ++i) {
batchBalances[i] = balanceOf(accounts[i], ids[i]);
}
return batchBalances;
}
/**
* @dev See {IERC1155-setApprovalForAll}.
*/
function setApprovalForAll(address operator, bool approved) public virtual override {
_setApprovalForAll(_msgSender(), operator, approved);
}
/**
* @dev See {IERC1155-isApprovedForAll}.
*/
function isApprovedForAll(address account, address operator) public view virtual override returns (bool) {
return _operatorApprovals[account][operator];
}
/**
* @dev See {IERC1155-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 id,
uint256 amount,
bytes memory data
) public virtual override {
require(
from == _msgSender() || isApprovedForAll(from, _msgSender()),
"ERC1155: caller is not token owner nor approved"
);
_safeTransferFrom(from, to, id, amount, data);
}
/**
* @dev See {IERC1155-safeBatchTransferFrom}.
*/
function safeBatchTransferFrom(
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) public virtual override {
require(
from == _msgSender() || isApprovedForAll(from, _msgSender()),
"ERC1155: caller is not token owner nor approved"
);
_safeBatchTransferFrom(from, to, ids, amounts, data);
}
/**
* @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
*
* Emits a {TransferSingle} event.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `from` must have a balance of tokens of type `id` of at least `amount`.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
* acceptance magic value.
*/
function _safeTransferFrom(
address from,
address to,
uint256 id,
uint256 amount,
bytes memory data
) internal virtual {
require(to != address(0), "ERC1155: transfer to the zero address");
address operator = _msgSender();
uint256[] memory ids = _asSingletonArray(id);
uint256[] memory amounts = _asSingletonArray(amount);
_beforeTokenTransfer(operator, from, to, ids, amounts, data);
uint256 fromBalance = _balances[id][from];
require(fromBalance >= amount, "ERC1155: insufficient balance for transfer");
unchecked {
_balances[id][from] = fromBalance - amount;
}
_balances[id][to] += amount;
emit TransferSingle(operator, from, to, id, amount);
_afterTokenTransfer(operator, from, to, ids, amounts, data);
_doSafeTransferAcceptanceCheck(operator, from, to, id, amount, data);
}
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_safeTransferFrom}.
*
* Emits a {TransferBatch} event.
*
* Requirements:
*
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
* acceptance magic value.
*/
function _safeBatchTransferFrom(
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual {
require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
require(to != address(0), "ERC1155: transfer to the zero address");
address operator = _msgSender();
_beforeTokenTransfer(operator, from, to, ids, amounts, data);
for (uint256 i = 0; i < ids.length; ++i) {
uint256 id = ids[i];
uint256 amount = amounts[i];
uint256 fromBalance = _balances[id][from];
require(fromBalance >= amount, "ERC1155: insufficient balance for transfer");
unchecked {
_balances[id][from] = fromBalance - amount;
}
_balances[id][to] += amount;
}
emit TransferBatch(operator, from, to, ids, amounts);
_afterTokenTransfer(operator, from, to, ids, amounts, data);
_doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, amounts, data);
}
/**
* @dev Sets a new URI for all token types, by relying on the token type ID
* substitution mechanism
* https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].
*
* By this mechanism, any occurrence of the `\{id\}` substring in either the
* URI or any of the amounts in the JSON file at said URI will be replaced by
* clients with the token type ID.
*
* For example, the `https://token-cdn-domain/\{id\}.json` URI would be
* interpreted by clients as
* `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json`
* for token type ID 0x4cce0.
*
* See {uri}.
*
* Because these URIs cannot be meaningfully represented by the {URI} event,
* this function emits no events.
*/
function _setURI(string memory newuri) internal virtual {
_uri = newuri;
}
/**
* @dev Creates `amount` tokens of token type `id`, and assigns them to `to`.
*
* Emits a {TransferSingle} event.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
* acceptance magic value.
*/
function _mint(
address to,
uint256 id,
uint256 amount,
bytes memory data
) internal virtual {
require(to != address(0), "ERC1155: mint to the zero address");
address operator = _msgSender();
uint256[] memory ids = _asSingletonArray(id);
uint256[] memory amounts = _asSingletonArray(amount);
_beforeTokenTransfer(operator, address(0), to, ids, amounts, data);
_balances[id][to] += amount;
emit TransferSingle(operator, address(0), to, id, amount);
_afterTokenTransfer(operator, address(0), to, ids, amounts, data);
_doSafeTransferAcceptanceCheck(operator, address(0), to, id, amount, data);
}
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}.
*
* Emits a {TransferBatch} event.
*
* Requirements:
*
* - `ids` and `amounts` must have the same length.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
* acceptance magic value.
*/
function _mintBatch(
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual {
require(to != address(0), "ERC1155: mint to the zero address");
require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
address operator = _msgSender();
_beforeTokenTransfer(operator, address(0), to, ids, amounts, data);
for (uint256 i = 0; i < ids.length; i++) {
_balances[ids[i]][to] += amounts[i];
}
emit TransferBatch(operator, address(0), to, ids, amounts);
_afterTokenTransfer(operator, address(0), to, ids, amounts, data);
_doSafeBatchTransferAcceptanceCheck(operator, address(0), to, ids, amounts, data);
}
/**
* @dev Destroys `amount` tokens of token type `id` from `from`
*
* Emits a {TransferSingle} event.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `from` must have at least `amount` tokens of token type `id`.
*/
function _burn(
address from,
uint256 id,
uint256 amount
) internal virtual {
require(from != address(0), "ERC1155: burn from the zero address");
address operator = _msgSender();
uint256[] memory ids = _asSingletonArray(id);
uint256[] memory amounts = _asSingletonArray(amount);
_beforeTokenTransfer(operator, from, address(0), ids, amounts, "");
uint256 fromBalance = _balances[id][from];
require(fromBalance >= amount, "ERC1155: burn amount exceeds balance");
unchecked {
_balances[id][from] = fromBalance - amount;
}
emit TransferSingle(operator, from, address(0), id, amount);
_afterTokenTransfer(operator, from, address(0), ids, amounts, "");
}
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}.
*
* Emits a {TransferBatch} event.
*
* Requirements:
*
* - `ids` and `amounts` must have the same length.
*/
function _burnBatch(
address from,
uint256[] memory ids,
uint256[] memory amounts
) internal virtual {
require(from != address(0), "ERC1155: burn from the zero address");
require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
address operator = _msgSender();
_beforeTokenTransfer(operator, from, address(0), ids, amounts, "");
for (uint256 i = 0; i < ids.length; i++) {
uint256 id = ids[i];
uint256 amount = amounts[i];
uint256 fromBalance = _balances[id][from];
require(fromBalance >= amount, "ERC1155: burn amount exceeds balance");
unchecked {
_balances[id][from] = fromBalance - amount;
}
}
emit TransferBatch(operator, from, address(0), ids, amounts);
_afterTokenTransfer(operator, from, address(0), ids, amounts, "");
}
/**
* @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, "ERC1155: setting approval status for self");
_operatorApprovals[owner][operator] = approved;
emit ApprovalForAll(owner, operator, approved);
}
/**
* @dev Hook that is called before any token transfer. This includes minting
* and burning, as well as batched variants.
*
* The same hook is called on both single and batched variants. For single
* transfers, the length of the `ids` and `amounts` arrays will be 1.
*
* Calling conditions (for each `id` and `amount` pair):
*
* - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* of token type `id` will be transferred to `to`.
* - When `from` is zero, `amount` tokens of token type `id` will be minted
* for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens of token type `id`
* will be burned.
* - `from` and `to` are never both zero.
* - `ids` and `amounts` have the same, non-zero length.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address operator,
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual {}
/**
* @dev Hook that is called after any token transfer. This includes minting
* and burning, as well as batched variants.
*
* The same hook is called on both single and batched variants. For single
* transfers, the length of the `id` and `amount` arrays will be 1.
*
* Calling conditions (for each `id` and `amount` pair):
*
* - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* of token type `id` will be transferred to `to`.
* - When `from` is zero, `amount` tokens of token type `id` will be minted
* for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens of token type `id`
* will be burned.
* - `from` and `to` are never both zero.
* - `ids` and `amounts` have the same, non-zero length.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _afterTokenTransfer(
address operator,
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual {}
function _doSafeTransferAcceptanceCheck(
address operator,
address from,
address to,
uint256 id,
uint256 amount,
bytes memory data
) private {
if (to.isContract()) {
try IERC1155ReceiverUpgradeable(to).onERC1155Received(operator, from, id, amount, data) returns (bytes4 response) {
if (response != IERC1155ReceiverUpgradeable.onERC1155Received.selector) {
revert("ERC1155: ERC1155Receiver rejected tokens");
}
} catch Error(string memory reason) {
revert(reason);
} catch {
revert("ERC1155: transfer to non ERC1155Receiver implementer");
}
}
}
function _doSafeBatchTransferAcceptanceCheck(
address operator,
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) private {
if (to.isContract()) {
try IERC1155ReceiverUpgradeable(to).onERC1155BatchReceived(operator, from, ids, amounts, data) returns (
bytes4 response
) {
if (response != IERC1155ReceiverUpgradeable.onERC1155BatchReceived.selector) {
revert("ERC1155: ERC1155Receiver rejected tokens");
}
} catch Error(string memory reason) {
revert(reason);
} catch {
revert("ERC1155: transfer to non ERC1155Receiver implementer");
}
}
}
function _asSingletonArray(uint256 element) private pure returns (uint256[] memory) {
uint256[] memory array = new uint256[](1);
array[0] = element;
return array;
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[47] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/IERC1155.sol)
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165Upgradeable.sol";
/**
* @dev Required interface of an ERC1155 compliant contract, as defined in the
* https://eips.ethereum.org/EIPS/eip-1155[EIP].
*
* _Available since v3.1._
*/
interface IERC1155Upgradeable is IERC165Upgradeable {
/**
* @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.
*/
event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);
/**
* @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all
* transfers.
*/
event TransferBatch(
address indexed operator,
address indexed from,
address indexed to,
uint256[] ids,
uint256[] values
);
/**
* @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to
* `approved`.
*/
event ApprovalForAll(address indexed account, address indexed operator, bool approved);
/**
* @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.
*
* If an {URI} event was emitted for `id`, the standard
* https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value
* returned by {IERC1155MetadataURI-uri}.
*/
event URI(string value, uint256 indexed id);
/**
* @dev Returns the amount of tokens of token type `id` owned by `account`.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function balanceOf(address account, uint256 id) external view returns (uint256);
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.
*
* Requirements:
*
* - `accounts` and `ids` must have the same length.
*/
function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)
external
view
returns (uint256[] memory);
/**
* @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,
*
* Emits an {ApprovalForAll} event.
*
* Requirements:
*
* - `operator` cannot be the caller.
*/
function setApprovalForAll(address operator, bool approved) external;
/**
* @dev Returns true if `operator` is approved to transfer ``account``'s tokens.
*
* See {setApprovalForAll}.
*/
function isApprovedForAll(address account, address operator) external view returns (bool);
/**
* @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
*
* Emits a {TransferSingle} event.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.
* - `from` must have a balance of tokens of type `id` of at least `amount`.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
* acceptance magic value.
*/
function safeTransferFrom(
address from,
address to,
uint256 id,
uint256 amount,
bytes calldata data
) external;
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.
*
* Emits a {TransferBatch} event.
*
* Requirements:
*
* - `ids` and `amounts` must have the same length.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
* acceptance magic value.
*/
function safeBatchTransferFrom(
address from,
address to,
uint256[] calldata ids,
uint256[] calldata amounts,
bytes calldata data
) external;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)
pragma solidity ^0.8.0;
import "../IERC1155Upgradeable.sol";
/**
* @dev Interface of the optional ERC1155MetadataExtension interface, as defined
* in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].
*
* _Available since v3.1._
*/
interface IERC1155MetadataURIUpgradeable is IERC1155Upgradeable {
/**
* @dev Returns the URI for token type `id`.
*
* If the `\{id\}` substring is present in the URI, it must be replaced by
* clients with the actual token type ID.
*/
function uri(uint256 id) external view returns (string memory);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library AddressUpgradeable {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";
/**
* @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 ContextUpgradeable is Initializable {
function __Context_init() internal onlyInitializing {
}
function __Context_init_unchained() internal onlyInitializing {
}
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[50] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
pragma solidity ^0.8.0;
import "./IERC165Upgradeable.sol";
import "../../proxy/utils/Initializable.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 ERC165Upgradeable is Initializable, IERC165Upgradeable {
function __ERC165_init() internal onlyInitializing {
}
function __ERC165_init_unchained() internal onlyInitializing {
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165Upgradeable).interfaceId;
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[50] private __gap;
}// 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 IERC165Upgradeable {
/**
* @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);
}{
"optimizer": {
"enabled": false,
"runs": 200
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_by","type":"address"},{"indexed":true,"internalType":"uint256","name":"_id","type":"uint256"}],"name":"TokenMinted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"indexed":false,"internalType":"uint256[]","name":"values","type":"uint256[]"}],"name":"TransferBatch","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"TransferSingle","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"value","type":"string"},{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"}],"name":"URI","type":"event"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"accounts","type":"address[]"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"}],"name":"balanceOfBatch","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"adminSigner","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"enum PhalanxV1.MintType","name":"mintType","type":"uint8"},{"internalType":"string","name":"tokenURI","type":"string"},{"internalType":"uint256","name":"baseId","type":"uint256"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"address","name":"erc20PaymentToken","type":"address"},{"components":[{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"},{"internalType":"uint8","name":"v","type":"uint8"}],"internalType":"struct PhalanxV1.ValidationSignature","name":"validationSignature","type":"tuple"}],"name":"mint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"_name","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"uint256[]","name":"values","type":"uint256[]"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"onERC1155BatchReceived","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"onERC1155Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","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":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeBatchTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"adminSigner","type":"address"}],"name":"setAdminSigner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"string","name":"tokenURI","type":"string"}],"name":"setURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"_symbol","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"uri","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_tokenAddress","type":"address"},{"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"},{"internalType":"uint256[]","name":"_amounts","type":"uint256[]"},{"internalType":"address","name":"_to","type":"address"}],"name":"withdrawERC1155","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_tokenAddress","type":"address"},{"internalType":"address","name":"_to","type":"address"}],"name":"withdrawERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_tokenAddress","type":"address"},{"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"},{"internalType":"address","name":"_to","type":"address"}],"name":"withdrawERC721","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"}],"name":"withdrawETH","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
608060405234801561001057600080fd5b5061512a806100206000396000f3fe60806040526004361061014a5760003560e01c8063862440e2116100b6578063bc197c811161006f578063bc197c8114610490578063c4d66de8146104cd578063e985e9c5146104f6578063f23a6e6114610533578063f242432a14610570578063f2fde38b146105995761014a565b8063862440e21461038f5780638da5cb5b146103b85780639456fbcc146103e357806395d89b411461040c578063a22cb46514610437578063bb46eebc146104605761014a565b80631fb8b0a1116101085780631fb8b0a1146102975780632eb2c2d6146102c05780633786ddfc146102e95780634e1273f414610312578063690d83201461034f578063715018a6146103785761014a565b8062fdd58e1461014f57806301ffc9a71461018c57806306fdde03146101c95780630e89341c146101f4578063150b7a0214610231578063183bbe801461026e575b600080fd5b34801561015b57600080fd5b5061017660048036038101906101719190613707565b6105c2565b60405161018391906144e0565b60405180910390f35b34801561019857600080fd5b506101b360048036038101906101ae91906137d8565b61068c565b6040516101c09190614100565b60405180910390f35b3480156101d557600080fd5b506101de61076e565b6040516101eb91906141fe565b60405180910390f35b34801561020057600080fd5b5061021b600480360381019061021691906138cc565b6107ab565b60405161022891906141fe565b60405180910390f35b34801561023d57600080fd5b5061025860048036038101906102539190613423565b6107cb565b6040516102659190614160565b60405180910390f35b34801561027a57600080fd5b5061029560048036038101906102909190613233565b6107e0565b005b3480156102a357600080fd5b506102be60048036038101906102b99190613630565b61082c565b005b3480156102cc57600080fd5b506102e760048036038101906102e29190613364565b61094d565b005b3480156102f557600080fd5b50610310600480360381019061030b91906135c4565b6109ee565b005b34801561031e57600080fd5b5061033960048036038101906103349190613743565b610acc565b60405161034691906140a7565b60405180910390f35b34801561035b57600080fd5b5061037660048036038101906103719190613233565b610c7d565b005b34801561038457600080fd5b5061038d610d35565b005b34801561039b57600080fd5b506103b660048036038101906103b1919061391e565b610d49565b005b3480156103c457600080fd5b506103cd610d5f565b6040516103da9190613f12565b60405180910390f35b3480156103ef57600080fd5b5061040a6004803603810190610405919061325c565b610d89565b005b34801561041857600080fd5b50610421610eab565b60405161042e91906141fe565b60405180910390f35b34801561044357600080fd5b5061045e600480360381019061045991906136cb565b610ee8565b005b61047a6004803603810190610475919061382a565b610efe565b60405161048791906144e0565b60405180910390f35b34801561049c57600080fd5b506104b760048036038101906104b29190613298565b61145e565b6040516104c49190614160565b60405180910390f35b3480156104d957600080fd5b506104f460048036038101906104ef9190613233565b611476565b005b34801561050257600080fd5b5061051d6004803603810190610518919061325c565b611616565b60405161052a9190614100565b60405180910390f35b34801561053f57600080fd5b5061055a600480360381019061055591906134a3565b6116aa565b6040516105679190614160565b60405180910390f35b34801561057c57600080fd5b5061059760048036038101906105929190613535565b6116c0565b005b3480156105a557600080fd5b506105c060048036038101906105bb9190613233565b611761565b005b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610633576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161062a906142e0565b60405180910390fd5b6065600083815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60007fd9b67a26000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061075757507f0e89341c000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b806107675750610766826117e5565b5b9050919050565b60606040518060400160405280600781526020017f5068616c616e7800000000000000000000000000000000000000000000000000815250905090565b60606107c46107bf600884901c600061184f565b611898565b9050919050565b600063150b7a0260e01b905095945050505050565b6107e861197d565b8060fb60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b61083461197d565b60005b85859050811015610944578673ffffffffffffffffffffffffffffffffffffffff1663f242432a3084898986818110610899577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b905060200201358888878181106108d9577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b905060200201356040518563ffffffff1660e01b81526004016108ff9493929190614026565b600060405180830381600087803b15801561091957600080fd5b505af115801561092d573d6000803e3d6000fd5b50505050808061093c9061485c565b915050610837565b50505050505050565b6109556119fb565b73ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16148061099b575061099a856109956119fb565b611616565b5b6109da576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109d190614260565b60405180910390fd5b6109e78585858585611a03565b5050505050565b6109f661197d565b60005b83839050811015610ac5578473ffffffffffffffffffffffffffffffffffffffff166323b872dd3084878786818110610a5b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b905060200201356040518463ffffffff1660e01b8152600401610a8093929190613f95565b600060405180830381600087803b158015610a9a57600080fd5b505af1158015610aae573d6000803e3d6000fd5b505050508080610abd9061485c565b9150506109f9565b5050505050565b60608151835114610b12576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b0990614460565b60405180910390fd5b6000835167ffffffffffffffff811115610b55577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015610b835781602001602082028036833780820191505090505b50905060005b8451811015610c7257610c1c858281518110610bce577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010151858381518110610c0f577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200260200101516105c2565b828281518110610c55577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200260200101818152505080610c6b9061485c565b9050610b89565b508091505092915050565b610c8561197d565b60008173ffffffffffffffffffffffffffffffffffffffff1647604051610cab90613efd565b60006040518083038185875af1925050503d8060008114610ce8576040519150601f19603f3d011682016040523d82523d6000602084013e610ced565b606091505b5050905080610d31576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d28906143c0565b60405180910390fd5b5050565b610d3d61197d565b610d476000611d74565b565b610d5161197d565b610d5b8282611e3a565b5050565b600060c960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610d9161197d565b8173ffffffffffffffffffffffffffffffffffffffff1663a9059cbb828473ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401610de79190613f12565b60206040518083038186803b158015610dff57600080fd5b505afa158015610e13573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e3791906138f5565b6040518363ffffffff1660e01b8152600401610e5492919061407e565b602060405180830381600087803b158015610e6e57600080fd5b505af1158015610e82573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ea691906137af565b505050565b60606040518060400160405280600481526020017f50484e5800000000000000000000000000000000000000000000000000000000815250905090565b610efa610ef36119fb565b8383611ea6565b5050565b600080878787338888604051602001610f1c9695949392919061417b565b604051602081830303815290604052805190602001209050610f3e8184612013565b610f7d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f74906144c0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161461104c5760008490508073ffffffffffffffffffffffffffffffffffffffff166323b872dd3330896040518463ffffffff1660e01b8152600401610ff393929190613f95565b602060405180830381600087803b15801561100d57600080fd5b505af1158015611021573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061104591906137af565b505061108f565b84341461108e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611085906143a0565b60405180910390fd5b5b600061109b878a61184f565b905060006110a933836105c2565b146110e9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110e090614300565b60405180910390fd5b60006003811115611123577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b89600381111561115c577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b141561134857600073ffffffffffffffffffffffffffffffffffffffff1660fc600089815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611207576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111fe906142c0565b60405180910390fd5b60405180604001604052803373ffffffffffffffffffffffffffffffffffffffff168152602001600080811115611267577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b81525060fc600089815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160000160146101000a81548160ff02191690836000811115611315577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b0217905550905050611339338260016040518060200160405280600081525061213d565b6113438189611e3a565b61140b565b600073ffffffffffffffffffffffffffffffffffffffff1660fc600089815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156113ee576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113e5906143e0565b60405180910390fd5b61140a338260016040518060200160405280600081525061213d565b5b803373ffffffffffffffffffffffffffffffffffffffff167fb9144c96c86541f6fa89c9f2f02495cccf4b08cd6643e26d34ee00aa586558a860405160405180910390a380925050509695505050505050565b600063bc197c8160e01b905098975050505050505050565b60008060019054906101000a900460ff161590508080156114a75750600160008054906101000a900460ff1660ff16105b806114d457506114b6306122ef565b1580156114d35750600160008054906101000a900460ff1660ff16145b5b611513576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161150a90614340565b60405180910390fd5b60016000806101000a81548160ff021916908360ff1602179055508015611550576001600060016101000a81548160ff0219169083151502179055505b61156860405180602001604052806000815250612312565b61157061236d565b6115786123c6565b8160fb60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080156116125760008060016101000a81548160ff0219169083151502179055507f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498600160405161160991906141e3565b60405180910390a15b5050565b6000606660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b600063f23a6e6160e01b90509695505050505050565b6116c86119fb565b73ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16148061170e575061170d856117086119fb565b611616565b5b61174d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161174490614260565b60405180910390fd5b61175a858585858561241f565b5050505050565b61176961197d565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156117d9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117d0906142a0565b60405180910390fd5b6117e281611d74565b50565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b600081600381111561188a577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b600884901b17905092915050565b606060006098600084815260200190815260200160002080546118ba906147f9565b80601f01602080910402602001604051908101604052809291908181526020018280546118e6906147f9565b80156119335780601f1061190857610100808354040283529160200191611933565b820191906000526020600020905b81548152906001019060200180831161191657829003601f168201915b5050505050905060008151116119515761194c836126be565b611975565b609781604051602001611965929190613ed9565b6040516020818303038152906040525b915050919050565b6119856119fb565b73ffffffffffffffffffffffffffffffffffffffff166119a3610d5f565b73ffffffffffffffffffffffffffffffffffffffff16146119f9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119f090614380565b60405180910390fd5b565b600033905090565b8151835114611a47576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a3e90614480565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415611ab7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611aae90614320565b60405180910390fd5b6000611ac16119fb565b9050611ad1818787878787612752565b60005b8451811015611cd1576000858281518110611b18577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015190506000858381518110611b5d577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010151905060006065600084815260200190815260200160002060008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015611bff576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611bf690614360565b60405180910390fd5b8181036065600085815260200190815260200160002060008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816065600085815260200190815260200160002060008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254611cb6919061469f565b9250508190555050505080611cca9061485c565b9050611ad4565b508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8787604051611d489291906140c9565b60405180910390a4611d5e8187878787876127dd565b611d6c8187878787876127e5565b505050505050565b600060c960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508160c960006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b80609860008481526020019081526020016000209080519060200190611e61929190612dce565b50817f6bb7ff708619ba0610cba295a58592e0451dee2622938c8755667688daf3529b611e8d846107ab565b604051611e9a91906141fe565b60405180910390a25050565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611f15576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f0c90614440565b60405180910390fd5b80606660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31836040516120069190614100565b60405180910390a3505050565b60008060018484604001518560000151866020015160405160008152602001604052604051612045949392919061411b565b6020604051602081039080840390855afa158015612067573d6000803e3d6000fd5b505050602060405103519050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156120e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120da90614220565b60405180910390fd5b60fb60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161491505092915050565b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614156121ad576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121a4906144a0565b60405180910390fd5b60006121b76119fb565b905060006121c4856129cc565b905060006121d1856129cc565b90506121e283600089858589612752565b846065600088815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254612242919061469f565b925050819055508673ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f6289896040516122c09291906144fb565b60405180910390a46122d7836000898585896127dd565b6122e683600089898989612a92565b50505050505050565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b600060019054906101000a900460ff16612361576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161235890614400565b60405180910390fd5b61236a81612c79565b50565b600060019054906101000a900460ff166123bc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123b390614400565b60405180910390fd5b6123c4612cd4565b565b600060019054906101000a900460ff16612415576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161240c90614400565b60405180910390fd5b61241d612d4b565b565b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16141561248f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161248690614320565b60405180910390fd5b60006124996119fb565b905060006124a6856129cc565b905060006124b3856129cc565b90506124c3838989858589612752565b60006065600088815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508581101561255b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161255290614360565b60405180910390fd5b8581036065600089815260200190815260200160002060008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550856065600089815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254612612919061469f565b925050819055508773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f628a8a60405161268f9291906144fb565b60405180910390a46126a5848a8a86868a6127dd565b6126b3848a8a8a8a8a612a92565b505050505050505050565b6060606780546126cd906147f9565b80601f01602080910402602001604051908101604052809291908181526020018280546126f9906147f9565b80156127465780601f1061271b57610100808354040283529160200191612746565b820191906000526020600020905b81548152906001019060200180831161272957829003601f168201915b50505050509050919050565b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16141561279a57612795868686868686612dac565b6127d5565b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127cc90614420565b60405180910390fd5b505050505050565b505050505050565b6128048473ffffffffffffffffffffffffffffffffffffffff166122ef565b156129c4578373ffffffffffffffffffffffffffffffffffffffff1663bc197c8187878686866040518663ffffffff1660e01b815260040161284a959493929190613f2d565b602060405180830381600087803b15801561286457600080fd5b505af192505050801561289557506040513d601f19601f820116820180604052508101906128929190613801565b60015b61293b576128a1614961565b806308c379a014156128fe57506128b6614fb0565b806128c15750612900565b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016128f591906141fe565b60405180910390fd5b505b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161293290614240565b60405180910390fd5b63bc197c8160e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916146129c2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016129b990614280565b60405180910390fd5b505b505050505050565b60606000600167ffffffffffffffff811115612a11577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015612a3f5781602001602082028036833780820191505090505b5090508281600081518110612a7d577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200260200101818152505080915050919050565b612ab18473ffffffffffffffffffffffffffffffffffffffff166122ef565b15612c71578373ffffffffffffffffffffffffffffffffffffffff1663f23a6e6187878686866040518663ffffffff1660e01b8152600401612af7959493929190613fcc565b602060405180830381600087803b158015612b1157600080fd5b505af1925050508015612b4257506040513d601f19601f82011682018060405250810190612b3f9190613801565b60015b612be857612b4e614961565b806308c379a01415612bab5750612b63614fb0565b80612b6e5750612bad565b806040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612ba291906141fe565b60405180910390fd5b505b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612bdf90614240565b60405180910390fd5b63f23a6e6160e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614612c6f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612c6690614280565b60405180910390fd5b505b505050505050565b600060019054906101000a900460ff16612cc8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612cbf90614400565b60405180910390fd5b612cd181612db4565b50565b600060019054906101000a900460ff16612d23576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612d1a90614400565b60405180910390fd5b6040518060200160405280600081525060979080519060200190612d48929190612dce565b50565b600060019054906101000a900460ff16612d9a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612d9190614400565b60405180910390fd5b612daa612da56119fb565b611d74565b565b505050505050565b8060679080519060200190612dca929190612dce565b5050565b828054612dda906147f9565b90600052602060002090601f016020900481019282612dfc5760008555612e43565b82601f10612e1557805160ff1916838001178555612e43565b82800160010185558215612e43579182015b82811115612e42578251825591602001919060010190612e27565b5b509050612e509190612e54565b5090565b5b80821115612e6d576000816000905550600101612e55565b5090565b6000612e84612e7f84614549565b614524565b90508083825260208201905082856020860282011115612ea357600080fd5b60005b85811015612ed35781612eb98882612fc5565b845260208401935060208301925050600181019050612ea6565b5050509392505050565b6000612ef0612eeb84614575565b614524565b90508083825260208201905082856020860282011115612f0f57600080fd5b60005b85811015612f3f5781612f2588826131f4565b845260208401935060208301925050600181019050612f12565b5050509392505050565b6000612f5c612f57846145a1565b614524565b905082815260208101848484011115612f7457600080fd5b612f7f8482856147b7565b509392505050565b6000612f9a612f95846145d2565b614524565b905082815260208101848484011115612fb257600080fd5b612fbd8482856147b7565b509392505050565b600081359050612fd48161505a565b92915050565b600082601f830112612feb57600080fd5b8135612ffb848260208601612e71565b91505092915050565b60008083601f84011261301657600080fd5b8235905067ffffffffffffffff81111561302f57600080fd5b60208301915083602082028301111561304757600080fd5b9250929050565b600082601f83011261305f57600080fd5b813561306f848260208601612edd565b91505092915050565b60008135905061308781615071565b92915050565b60008151905061309c81615071565b92915050565b6000813590506130b181615088565b92915050565b6000813590506130c68161509f565b92915050565b6000815190506130db8161509f565b92915050565b60008083601f8401126130f357600080fd5b8235905067ffffffffffffffff81111561310c57600080fd5b60208301915083600182028301111561312457600080fd5b9250929050565b600082601f83011261313c57600080fd5b813561314c848260208601612f49565b91505092915050565b600081359050613164816150b6565b92915050565b600082601f83011261317b57600080fd5b813561318b848260208601612f87565b91505092915050565b6000606082840312156131a657600080fd5b6131b06060614524565b905060006131c0848285016130a2565b60008301525060206131d4848285016130a2565b60208301525060406131e88482850161321e565b60408301525092915050565b600081359050613203816150c6565b92915050565b600081519050613218816150c6565b92915050565b60008135905061322d816150dd565b92915050565b60006020828403121561324557600080fd5b600061325384828501612fc5565b91505092915050565b6000806040838503121561326f57600080fd5b600061327d85828601612fc5565b925050602061328e85828601612fc5565b9150509250929050565b60008060008060008060008060a0898b0312156132b457600080fd5b60006132c28b828c01612fc5565b98505060206132d38b828c01612fc5565b975050604089013567ffffffffffffffff8111156132f057600080fd5b6132fc8b828c01613004565b9650965050606089013567ffffffffffffffff81111561331b57600080fd5b6133278b828c01613004565b9450945050608089013567ffffffffffffffff81111561334657600080fd5b6133528b828c016130e1565b92509250509295985092959890939650565b600080600080600060a0868803121561337c57600080fd5b600061338a88828901612fc5565b955050602061339b88828901612fc5565b945050604086013567ffffffffffffffff8111156133b857600080fd5b6133c48882890161304e565b935050606086013567ffffffffffffffff8111156133e157600080fd5b6133ed8882890161304e565b925050608086013567ffffffffffffffff81111561340a57600080fd5b6134168882890161312b565b9150509295509295909350565b60008060008060006080868803121561343b57600080fd5b600061344988828901612fc5565b955050602061345a88828901612fc5565b945050604061346b888289016131f4565b935050606086013567ffffffffffffffff81111561348857600080fd5b613494888289016130e1565b92509250509295509295909350565b60008060008060008060a087890312156134bc57600080fd5b60006134ca89828a01612fc5565b96505060206134db89828a01612fc5565b95505060406134ec89828a016131f4565b94505060606134fd89828a016131f4565b935050608087013567ffffffffffffffff81111561351a57600080fd5b61352689828a016130e1565b92509250509295509295509295565b600080600080600060a0868803121561354d57600080fd5b600061355b88828901612fc5565b955050602061356c88828901612fc5565b945050604061357d888289016131f4565b935050606061358e888289016131f4565b925050608086013567ffffffffffffffff8111156135ab57600080fd5b6135b78882890161312b565b9150509295509295909350565b600080600080606085870312156135da57600080fd5b60006135e887828801612fc5565b945050602085013567ffffffffffffffff81111561360557600080fd5b61361187828801613004565b9350935050604061362487828801612fc5565b91505092959194509250565b6000806000806000806080878903121561364957600080fd5b600061365789828a01612fc5565b965050602087013567ffffffffffffffff81111561367457600080fd5b61368089828a01613004565b9550955050604087013567ffffffffffffffff81111561369f57600080fd5b6136ab89828a01613004565b935093505060606136be89828a01612fc5565b9150509295509295509295565b600080604083850312156136de57600080fd5b60006136ec85828601612fc5565b92505060206136fd85828601613078565b9150509250929050565b6000806040838503121561371a57600080fd5b600061372885828601612fc5565b9250506020613739858286016131f4565b9150509250929050565b6000806040838503121561375657600080fd5b600083013567ffffffffffffffff81111561377057600080fd5b61377c85828601612fda565b925050602083013567ffffffffffffffff81111561379957600080fd5b6137a58582860161304e565b9150509250929050565b6000602082840312156137c157600080fd5b60006137cf8482850161308d565b91505092915050565b6000602082840312156137ea57600080fd5b60006137f8848285016130b7565b91505092915050565b60006020828403121561381357600080fd5b6000613821848285016130cc565b91505092915050565b600080600080600080610100878903121561384457600080fd5b600061385289828a01613155565b965050602087013567ffffffffffffffff81111561386f57600080fd5b61387b89828a0161316a565b955050604061388c89828a016131f4565b945050606061389d89828a016131f4565b93505060806138ae89828a01612fc5565b92505060a06138bf89828a01613194565b9150509295509295509295565b6000602082840312156138de57600080fd5b60006138ec848285016131f4565b91505092915050565b60006020828403121561390757600080fd5b600061391584828501613209565b91505092915050565b6000806040838503121561393157600080fd5b600061393f858286016131f4565b925050602083013567ffffffffffffffff81111561395c57600080fd5b6139688582860161316a565b9150509250929050565b600061397e8383613eac565b60208301905092915050565b613993816146f5565b82525050565b60006139a482614628565b6139ae8185614656565b93506139b983614603565b8060005b838110156139ea5781516139d18882613972565b97506139dc83614649565b9250506001810190506139bd565b5085935050505092915050565b613a0081614707565b82525050565b613a0f81614713565b82525050565b613a1e8161471d565b82525050565b6000613a2f82614633565b613a398185614667565b9350613a498185602086016147c6565b613a5281614983565b840191505092915050565b613a6681614793565b82525050565b613a75816147a5565b82525050565b6000613a868261463e565b613a908185614683565b9350613aa08185602086016147c6565b613aa981614983565b840191505092915050565b6000613abf8261463e565b613ac98185614694565b9350613ad98185602086016147c6565b80840191505092915050565b60008154613af2816147f9565b613afc8186614694565b94506001821660008114613b175760018114613b2857613b5b565b60ff19831686528186019350613b5b565b613b3185614613565b60005b83811015613b5357815481890152600182019150602081019050613b34565b838801955050505b50505092915050565b6000613b71601883614683565b9150613b7c826149a1565b602082019050919050565b6000613b94603483614683565b9150613b9f826149ca565b604082019050919050565b6000613bb7602f83614683565b9150613bc282614a19565b604082019050919050565b6000613bda602883614683565b9150613be582614a68565b604082019050919050565b6000613bfd602683614683565b9150613c0882614ab7565b604082019050919050565b6000613c20601383614683565b9150613c2b82614b06565b602082019050919050565b6000613c43602a83614683565b9150613c4e82614b2f565b604082019050919050565b6000613c66602783614683565b9150613c7182614b7e565b604082019050919050565b6000613c89602583614683565b9150613c9482614bcd565b604082019050919050565b6000613cac602e83614683565b9150613cb782614c1c565b604082019050919050565b6000613ccf602a83614683565b9150613cda82614c6b565b604082019050919050565b6000613cf2602083614683565b9150613cfd82614cba565b602082019050919050565b6000613d15602983614683565b9150613d2082614ce3565b604082019050919050565b6000613d38602183614683565b9150613d4382614d32565b604082019050919050565b6000613d5b600083614667565b9150613d6682614d81565b600082019050919050565b6000613d7e600083614678565b9150613d8982614d81565b600082019050919050565b6000613da1601383614683565b9150613dac82614d84565b602082019050919050565b6000613dc4602b83614683565b9150613dcf82614dad565b604082019050919050565b6000613de7602483614683565b9150613df282614dfc565b604082019050919050565b6000613e0a602983614683565b9150613e1582614e4b565b604082019050919050565b6000613e2d602983614683565b9150613e3882614e9a565b604082019050919050565b6000613e50602883614683565b9150613e5b82614ee9565b604082019050919050565b6000613e73602183614683565b9150613e7e82614f38565b604082019050919050565b6000613e96601c83614683565b9150613ea182614f87565b602082019050919050565b613eb58161477c565b82525050565b613ec48161477c565b82525050565b613ed381614786565b82525050565b6000613ee58285613ae5565b9150613ef18284613ab4565b91508190509392505050565b6000613f0882613d71565b9150819050919050565b6000602082019050613f27600083018461398a565b92915050565b600060a082019050613f42600083018861398a565b613f4f602083018761398a565b8181036040830152613f618186613999565b90508181036060830152613f758185613999565b90508181036080830152613f898184613a24565b90509695505050505050565b6000606082019050613faa600083018661398a565b613fb7602083018561398a565b613fc46040830184613ebb565b949350505050565b600060a082019050613fe1600083018861398a565b613fee602083018761398a565b613ffb6040830186613ebb565b6140086060830185613ebb565b818103608083015261401a8184613a24565b90509695505050505050565b600060a08201905061403b600083018761398a565b614048602083018661398a565b6140556040830185613ebb565b6140626060830184613ebb565b818103608083015261407381613d4e565b905095945050505050565b6000604082019050614093600083018561398a565b6140a06020830184613ebb565b9392505050565b600060208201905081810360008301526140c18184613999565b905092915050565b600060408201905081810360008301526140e38185613999565b905081810360208301526140f78184613999565b90509392505050565b600060208201905061411560008301846139f7565b92915050565b60006080820190506141306000830187613a06565b61413d6020830186613eca565b61414a6040830185613a06565b6141576060830184613a06565b95945050505050565b60006020820190506141756000830184613a15565b92915050565b600060c0820190506141906000830189613a5d565b81810360208301526141a28188613a7b565b90506141b16040830187613ebb565b6141be606083018661398a565b6141cb6080830185613ebb565b6141d860a083018461398a565b979650505050505050565b60006020820190506141f86000830184613a6c565b92915050565b600060208201905081810360008301526142188184613a7b565b905092915050565b6000602082019050818103600083015261423981613b64565b9050919050565b6000602082019050818103600083015261425981613b87565b9050919050565b6000602082019050818103600083015261427981613baa565b9050919050565b6000602082019050818103600083015261429981613bcd565b9050919050565b600060208201905081810360008301526142b981613bf0565b9050919050565b600060208201905081810360008301526142d981613c13565b9050919050565b600060208201905081810360008301526142f981613c36565b9050919050565b6000602082019050818103600083015261431981613c59565b9050919050565b6000602082019050818103600083015261433981613c7c565b9050919050565b6000602082019050818103600083015261435981613c9f565b9050919050565b6000602082019050818103600083015261437981613cc2565b9050919050565b6000602082019050818103600083015261439981613ce5565b9050919050565b600060208201905081810360008301526143b981613d08565b9050919050565b600060208201905081810360008301526143d981613d2b565b9050919050565b600060208201905081810360008301526143f981613d94565b9050919050565b6000602082019050818103600083015261441981613db7565b9050919050565b6000602082019050818103600083015261443981613dda565b9050919050565b6000602082019050818103600083015261445981613dfd565b9050919050565b6000602082019050818103600083015261447981613e20565b9050919050565b6000602082019050818103600083015261449981613e43565b9050919050565b600060208201905081810360008301526144b981613e66565b9050919050565b600060208201905081810360008301526144d981613e89565b9050919050565b60006020820190506144f56000830184613ebb565b92915050565b60006040820190506145106000830185613ebb565b61451d6020830184613ebb565b9392505050565b600061452e61453f565b905061453a828261482b565b919050565b6000604051905090565b600067ffffffffffffffff82111561456457614563614932565b5b602082029050602081019050919050565b600067ffffffffffffffff8211156145905761458f614932565b5b602082029050602081019050919050565b600067ffffffffffffffff8211156145bc576145bb614932565b5b6145c582614983565b9050602081019050919050565b600067ffffffffffffffff8211156145ed576145ec614932565b5b6145f682614983565b9050602081019050919050565b6000819050602082019050919050565b60008190508160005260206000209050919050565b600081519050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600081905092915050565b600082825260208201905092915050565b600081905092915050565b60006146aa8261477c565b91506146b58361477c565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156146ea576146e96148a5565b5b828201905092915050565b60006147008261475c565b9050919050565b60008115159050919050565b6000819050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b600081905061475782615046565b919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061479e82614749565b9050919050565b60006147b082614786565b9050919050565b82818337600083830152505050565b60005b838110156147e45780820151818401526020810190506147c9565b838111156147f3576000848401525b50505050565b6000600282049050600182168061481157607f821691505b6020821081141561482557614824614903565b5b50919050565b61483482614983565b810181811067ffffffffffffffff8211171561485357614852614932565b5b80604052505050565b60006148678261477c565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561489a576148996148a5565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600060033d11156149805760046000803e61497d600051614994565b90505b90565b6000601f19601f8301169050919050565b60008160e01c9050919050565b7f45434453413a20696e76616c6964207369676e61747572650000000000000000600082015250565b7f455243313135353a207472616e7366657220746f206e6f6e204552433131353560008201527f526563656976657220696d706c656d656e746572000000000000000000000000602082015250565b7f455243313135353a2063616c6c6572206973206e6f7420746f6b656e206f776e60008201527f6572206e6f7220617070726f7665640000000000000000000000000000000000602082015250565b7f455243313135353a204552433131353552656365697665722072656a6563746560008201527f6420746f6b656e73000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f494420616c726561647920636c61696d65642e00000000000000000000000000600082015250565b7f455243313135353a2061646472657373207a65726f206973206e6f742061207660008201527f616c6964206f776e657200000000000000000000000000000000000000000000602082015250565b7f43616e6e6f74206d696e74206d6f7265207468616e206f6e65205068616c616e60008201527f7820746f6b656e00000000000000000000000000000000000000000000000000602082015250565b7f455243313135353a207472616e7366657220746f20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160008201527f647920696e697469616c697a6564000000000000000000000000000000000000602082015250565b7f455243313135353a20696e73756666696369656e742062616c616e636520666f60008201527f72207472616e7366657200000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f496e73756666696369656e742045544820737570706c69656420666f7220747260008201527f616e73616374696f6e0000000000000000000000000000000000000000000000602082015250565b7f5f7472616e736665724574683a20457468207472616e73666572206661696c6560008201527f6400000000000000000000000000000000000000000000000000000000000000602082015250565b50565b7f44414f206e6f74206c6973746564207965742e00000000000000000000000000600082015250565b7f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960008201527f6e697469616c697a696e67000000000000000000000000000000000000000000602082015250565b7f5068616c616e7820746f6b656e2063616e6e6f74206265207472616e7366657260008201527f7265642100000000000000000000000000000000000000000000000000000000602082015250565b7f455243313135353a2073657474696e6720617070726f76616c2073746174757360008201527f20666f722073656c660000000000000000000000000000000000000000000000602082015250565b7f455243313135353a206163636f756e747320616e6420696473206c656e67746860008201527f206d69736d617463680000000000000000000000000000000000000000000000602082015250565b7f455243313135353a2069647320616e6420616d6f756e7473206c656e6774682060008201527f6d69736d61746368000000000000000000000000000000000000000000000000602082015250565b7f455243313135353a206d696e7420746f20746865207a65726f2061646472657360008201527f7300000000000000000000000000000000000000000000000000000000000000602082015250565b7f496e76616c69642076616c69646174696f6e207369676e617475726500000000600082015250565b600060443d1015614fc057615043565b614fc861453f565b60043d036004823e80513d602482011167ffffffffffffffff82111715614ff0575050615043565b808201805167ffffffffffffffff81111561500e5750505050615043565b80602083010160043d03850181111561502b575050505050615043565b61503a8260200185018661482b565b82955050505050505b90565b60048110615057576150566148d4565b5b50565b615063816146f5565b811461506e57600080fd5b50565b61507a81614707565b811461508557600080fd5b50565b61509181614713565b811461509c57600080fd5b50565b6150a88161471d565b81146150b357600080fd5b50565b600481106150c357600080fd5b50565b6150cf8161477c565b81146150da57600080fd5b50565b6150e681614786565b81146150f157600080fd5b5056fea26469706673582212208c59bded01bbe78d3b5e626e8cebcb9719b6a8a64e6e2fa4d67a3e6c8afd856a64736f6c63430008030033
Deployed Bytecode
0x60806040526004361061014a5760003560e01c8063862440e2116100b6578063bc197c811161006f578063bc197c8114610490578063c4d66de8146104cd578063e985e9c5146104f6578063f23a6e6114610533578063f242432a14610570578063f2fde38b146105995761014a565b8063862440e21461038f5780638da5cb5b146103b85780639456fbcc146103e357806395d89b411461040c578063a22cb46514610437578063bb46eebc146104605761014a565b80631fb8b0a1116101085780631fb8b0a1146102975780632eb2c2d6146102c05780633786ddfc146102e95780634e1273f414610312578063690d83201461034f578063715018a6146103785761014a565b8062fdd58e1461014f57806301ffc9a71461018c57806306fdde03146101c95780630e89341c146101f4578063150b7a0214610231578063183bbe801461026e575b600080fd5b34801561015b57600080fd5b5061017660048036038101906101719190613707565b6105c2565b60405161018391906144e0565b60405180910390f35b34801561019857600080fd5b506101b360048036038101906101ae91906137d8565b61068c565b6040516101c09190614100565b60405180910390f35b3480156101d557600080fd5b506101de61076e565b6040516101eb91906141fe565b60405180910390f35b34801561020057600080fd5b5061021b600480360381019061021691906138cc565b6107ab565b60405161022891906141fe565b60405180910390f35b34801561023d57600080fd5b5061025860048036038101906102539190613423565b6107cb565b6040516102659190614160565b60405180910390f35b34801561027a57600080fd5b5061029560048036038101906102909190613233565b6107e0565b005b3480156102a357600080fd5b506102be60048036038101906102b99190613630565b61082c565b005b3480156102cc57600080fd5b506102e760048036038101906102e29190613364565b61094d565b005b3480156102f557600080fd5b50610310600480360381019061030b91906135c4565b6109ee565b005b34801561031e57600080fd5b5061033960048036038101906103349190613743565b610acc565b60405161034691906140a7565b60405180910390f35b34801561035b57600080fd5b5061037660048036038101906103719190613233565b610c7d565b005b34801561038457600080fd5b5061038d610d35565b005b34801561039b57600080fd5b506103b660048036038101906103b1919061391e565b610d49565b005b3480156103c457600080fd5b506103cd610d5f565b6040516103da9190613f12565b60405180910390f35b3480156103ef57600080fd5b5061040a6004803603810190610405919061325c565b610d89565b005b34801561041857600080fd5b50610421610eab565b60405161042e91906141fe565b60405180910390f35b34801561044357600080fd5b5061045e600480360381019061045991906136cb565b610ee8565b005b61047a6004803603810190610475919061382a565b610efe565b60405161048791906144e0565b60405180910390f35b34801561049c57600080fd5b506104b760048036038101906104b29190613298565b61145e565b6040516104c49190614160565b60405180910390f35b3480156104d957600080fd5b506104f460048036038101906104ef9190613233565b611476565b005b34801561050257600080fd5b5061051d6004803603810190610518919061325c565b611616565b60405161052a9190614100565b60405180910390f35b34801561053f57600080fd5b5061055a600480360381019061055591906134a3565b6116aa565b6040516105679190614160565b60405180910390f35b34801561057c57600080fd5b5061059760048036038101906105929190613535565b6116c0565b005b3480156105a557600080fd5b506105c060048036038101906105bb9190613233565b611761565b005b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610633576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161062a906142e0565b60405180910390fd5b6065600083815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60007fd9b67a26000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061075757507f0e89341c000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b806107675750610766826117e5565b5b9050919050565b60606040518060400160405280600781526020017f5068616c616e7800000000000000000000000000000000000000000000000000815250905090565b60606107c46107bf600884901c600061184f565b611898565b9050919050565b600063150b7a0260e01b905095945050505050565b6107e861197d565b8060fb60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b61083461197d565b60005b85859050811015610944578673ffffffffffffffffffffffffffffffffffffffff1663f242432a3084898986818110610899577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b905060200201358888878181106108d9577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b905060200201356040518563ffffffff1660e01b81526004016108ff9493929190614026565b600060405180830381600087803b15801561091957600080fd5b505af115801561092d573d6000803e3d6000fd5b50505050808061093c9061485c565b915050610837565b50505050505050565b6109556119fb565b73ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16148061099b575061099a856109956119fb565b611616565b5b6109da576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109d190614260565b60405180910390fd5b6109e78585858585611a03565b5050505050565b6109f661197d565b60005b83839050811015610ac5578473ffffffffffffffffffffffffffffffffffffffff166323b872dd3084878786818110610a5b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b905060200201356040518463ffffffff1660e01b8152600401610a8093929190613f95565b600060405180830381600087803b158015610a9a57600080fd5b505af1158015610aae573d6000803e3d6000fd5b505050508080610abd9061485c565b9150506109f9565b5050505050565b60608151835114610b12576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b0990614460565b60405180910390fd5b6000835167ffffffffffffffff811115610b55577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015610b835781602001602082028036833780820191505090505b50905060005b8451811015610c7257610c1c858281518110610bce577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010151858381518110610c0f577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200260200101516105c2565b828281518110610c55577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200260200101818152505080610c6b9061485c565b9050610b89565b508091505092915050565b610c8561197d565b60008173ffffffffffffffffffffffffffffffffffffffff1647604051610cab90613efd565b60006040518083038185875af1925050503d8060008114610ce8576040519150601f19603f3d011682016040523d82523d6000602084013e610ced565b606091505b5050905080610d31576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d28906143c0565b60405180910390fd5b5050565b610d3d61197d565b610d476000611d74565b565b610d5161197d565b610d5b8282611e3a565b5050565b600060c960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610d9161197d565b8173ffffffffffffffffffffffffffffffffffffffff1663a9059cbb828473ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401610de79190613f12565b60206040518083038186803b158015610dff57600080fd5b505afa158015610e13573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e3791906138f5565b6040518363ffffffff1660e01b8152600401610e5492919061407e565b602060405180830381600087803b158015610e6e57600080fd5b505af1158015610e82573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ea691906137af565b505050565b60606040518060400160405280600481526020017f50484e5800000000000000000000000000000000000000000000000000000000815250905090565b610efa610ef36119fb565b8383611ea6565b5050565b600080878787338888604051602001610f1c9695949392919061417b565b604051602081830303815290604052805190602001209050610f3e8184612013565b610f7d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f74906144c0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161461104c5760008490508073ffffffffffffffffffffffffffffffffffffffff166323b872dd3330896040518463ffffffff1660e01b8152600401610ff393929190613f95565b602060405180830381600087803b15801561100d57600080fd5b505af1158015611021573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061104591906137af565b505061108f565b84341461108e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611085906143a0565b60405180910390fd5b5b600061109b878a61184f565b905060006110a933836105c2565b146110e9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110e090614300565b60405180910390fd5b60006003811115611123577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b89600381111561115c577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b141561134857600073ffffffffffffffffffffffffffffffffffffffff1660fc600089815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611207576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111fe906142c0565b60405180910390fd5b60405180604001604052803373ffffffffffffffffffffffffffffffffffffffff168152602001600080811115611267577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b81525060fc600089815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160000160146101000a81548160ff02191690836000811115611315577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b0217905550905050611339338260016040518060200160405280600081525061213d565b6113438189611e3a565b61140b565b600073ffffffffffffffffffffffffffffffffffffffff1660fc600089815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156113ee576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113e5906143e0565b60405180910390fd5b61140a338260016040518060200160405280600081525061213d565b5b803373ffffffffffffffffffffffffffffffffffffffff167fb9144c96c86541f6fa89c9f2f02495cccf4b08cd6643e26d34ee00aa586558a860405160405180910390a380925050509695505050505050565b600063bc197c8160e01b905098975050505050505050565b60008060019054906101000a900460ff161590508080156114a75750600160008054906101000a900460ff1660ff16105b806114d457506114b6306122ef565b1580156114d35750600160008054906101000a900460ff1660ff16145b5b611513576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161150a90614340565b60405180910390fd5b60016000806101000a81548160ff021916908360ff1602179055508015611550576001600060016101000a81548160ff0219169083151502179055505b61156860405180602001604052806000815250612312565b61157061236d565b6115786123c6565b8160fb60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080156116125760008060016101000a81548160ff0219169083151502179055507f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498600160405161160991906141e3565b60405180910390a15b5050565b6000606660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b600063f23a6e6160e01b90509695505050505050565b6116c86119fb565b73ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16148061170e575061170d856117086119fb565b611616565b5b61174d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161174490614260565b60405180910390fd5b61175a858585858561241f565b5050505050565b61176961197d565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156117d9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117d0906142a0565b60405180910390fd5b6117e281611d74565b50565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b600081600381111561188a577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b600884901b17905092915050565b606060006098600084815260200190815260200160002080546118ba906147f9565b80601f01602080910402602001604051908101604052809291908181526020018280546118e6906147f9565b80156119335780601f1061190857610100808354040283529160200191611933565b820191906000526020600020905b81548152906001019060200180831161191657829003601f168201915b5050505050905060008151116119515761194c836126be565b611975565b609781604051602001611965929190613ed9565b6040516020818303038152906040525b915050919050565b6119856119fb565b73ffffffffffffffffffffffffffffffffffffffff166119a3610d5f565b73ffffffffffffffffffffffffffffffffffffffff16146119f9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119f090614380565b60405180910390fd5b565b600033905090565b8151835114611a47576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a3e90614480565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415611ab7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611aae90614320565b60405180910390fd5b6000611ac16119fb565b9050611ad1818787878787612752565b60005b8451811015611cd1576000858281518110611b18577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015190506000858381518110611b5d577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010151905060006065600084815260200190815260200160002060008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015611bff576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611bf690614360565b60405180910390fd5b8181036065600085815260200190815260200160002060008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816065600085815260200190815260200160002060008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254611cb6919061469f565b9250508190555050505080611cca9061485c565b9050611ad4565b508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8787604051611d489291906140c9565b60405180910390a4611d5e8187878787876127dd565b611d6c8187878787876127e5565b505050505050565b600060c960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508160c960006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b80609860008481526020019081526020016000209080519060200190611e61929190612dce565b50817f6bb7ff708619ba0610cba295a58592e0451dee2622938c8755667688daf3529b611e8d846107ab565b604051611e9a91906141fe565b60405180910390a25050565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611f15576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f0c90614440565b60405180910390fd5b80606660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31836040516120069190614100565b60405180910390a3505050565b60008060018484604001518560000151866020015160405160008152602001604052604051612045949392919061411b565b6020604051602081039080840390855afa158015612067573d6000803e3d6000fd5b505050602060405103519050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156120e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120da90614220565b60405180910390fd5b60fb60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161491505092915050565b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614156121ad576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121a4906144a0565b60405180910390fd5b60006121b76119fb565b905060006121c4856129cc565b905060006121d1856129cc565b90506121e283600089858589612752565b846065600088815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254612242919061469f565b925050819055508673ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f6289896040516122c09291906144fb565b60405180910390a46122d7836000898585896127dd565b6122e683600089898989612a92565b50505050505050565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b600060019054906101000a900460ff16612361576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161235890614400565b60405180910390fd5b61236a81612c79565b50565b600060019054906101000a900460ff166123bc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123b390614400565b60405180910390fd5b6123c4612cd4565b565b600060019054906101000a900460ff16612415576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161240c90614400565b60405180910390fd5b61241d612d4b565b565b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16141561248f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161248690614320565b60405180910390fd5b60006124996119fb565b905060006124a6856129cc565b905060006124b3856129cc565b90506124c3838989858589612752565b60006065600088815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508581101561255b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161255290614360565b60405180910390fd5b8581036065600089815260200190815260200160002060008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550856065600089815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254612612919061469f565b925050819055508773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f628a8a60405161268f9291906144fb565b60405180910390a46126a5848a8a86868a6127dd565b6126b3848a8a8a8a8a612a92565b505050505050505050565b6060606780546126cd906147f9565b80601f01602080910402602001604051908101604052809291908181526020018280546126f9906147f9565b80156127465780601f1061271b57610100808354040283529160200191612746565b820191906000526020600020905b81548152906001019060200180831161272957829003601f168201915b50505050509050919050565b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16141561279a57612795868686868686612dac565b6127d5565b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127cc90614420565b60405180910390fd5b505050505050565b505050505050565b6128048473ffffffffffffffffffffffffffffffffffffffff166122ef565b156129c4578373ffffffffffffffffffffffffffffffffffffffff1663bc197c8187878686866040518663ffffffff1660e01b815260040161284a959493929190613f2d565b602060405180830381600087803b15801561286457600080fd5b505af192505050801561289557506040513d601f19601f820116820180604052508101906128929190613801565b60015b61293b576128a1614961565b806308c379a014156128fe57506128b6614fb0565b806128c15750612900565b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016128f591906141fe565b60405180910390fd5b505b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161293290614240565b60405180910390fd5b63bc197c8160e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916146129c2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016129b990614280565b60405180910390fd5b505b505050505050565b60606000600167ffffffffffffffff811115612a11577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015612a3f5781602001602082028036833780820191505090505b5090508281600081518110612a7d577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200260200101818152505080915050919050565b612ab18473ffffffffffffffffffffffffffffffffffffffff166122ef565b15612c71578373ffffffffffffffffffffffffffffffffffffffff1663f23a6e6187878686866040518663ffffffff1660e01b8152600401612af7959493929190613fcc565b602060405180830381600087803b158015612b1157600080fd5b505af1925050508015612b4257506040513d601f19601f82011682018060405250810190612b3f9190613801565b60015b612be857612b4e614961565b806308c379a01415612bab5750612b63614fb0565b80612b6e5750612bad565b806040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612ba291906141fe565b60405180910390fd5b505b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612bdf90614240565b60405180910390fd5b63f23a6e6160e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614612c6f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612c6690614280565b60405180910390fd5b505b505050505050565b600060019054906101000a900460ff16612cc8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612cbf90614400565b60405180910390fd5b612cd181612db4565b50565b600060019054906101000a900460ff16612d23576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612d1a90614400565b60405180910390fd5b6040518060200160405280600081525060979080519060200190612d48929190612dce565b50565b600060019054906101000a900460ff16612d9a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612d9190614400565b60405180910390fd5b612daa612da56119fb565b611d74565b565b505050505050565b8060679080519060200190612dca929190612dce565b5050565b828054612dda906147f9565b90600052602060002090601f016020900481019282612dfc5760008555612e43565b82601f10612e1557805160ff1916838001178555612e43565b82800160010185558215612e43579182015b82811115612e42578251825591602001919060010190612e27565b5b509050612e509190612e54565b5090565b5b80821115612e6d576000816000905550600101612e55565b5090565b6000612e84612e7f84614549565b614524565b90508083825260208201905082856020860282011115612ea357600080fd5b60005b85811015612ed35781612eb98882612fc5565b845260208401935060208301925050600181019050612ea6565b5050509392505050565b6000612ef0612eeb84614575565b614524565b90508083825260208201905082856020860282011115612f0f57600080fd5b60005b85811015612f3f5781612f2588826131f4565b845260208401935060208301925050600181019050612f12565b5050509392505050565b6000612f5c612f57846145a1565b614524565b905082815260208101848484011115612f7457600080fd5b612f7f8482856147b7565b509392505050565b6000612f9a612f95846145d2565b614524565b905082815260208101848484011115612fb257600080fd5b612fbd8482856147b7565b509392505050565b600081359050612fd48161505a565b92915050565b600082601f830112612feb57600080fd5b8135612ffb848260208601612e71565b91505092915050565b60008083601f84011261301657600080fd5b8235905067ffffffffffffffff81111561302f57600080fd5b60208301915083602082028301111561304757600080fd5b9250929050565b600082601f83011261305f57600080fd5b813561306f848260208601612edd565b91505092915050565b60008135905061308781615071565b92915050565b60008151905061309c81615071565b92915050565b6000813590506130b181615088565b92915050565b6000813590506130c68161509f565b92915050565b6000815190506130db8161509f565b92915050565b60008083601f8401126130f357600080fd5b8235905067ffffffffffffffff81111561310c57600080fd5b60208301915083600182028301111561312457600080fd5b9250929050565b600082601f83011261313c57600080fd5b813561314c848260208601612f49565b91505092915050565b600081359050613164816150b6565b92915050565b600082601f83011261317b57600080fd5b813561318b848260208601612f87565b91505092915050565b6000606082840312156131a657600080fd5b6131b06060614524565b905060006131c0848285016130a2565b60008301525060206131d4848285016130a2565b60208301525060406131e88482850161321e565b60408301525092915050565b600081359050613203816150c6565b92915050565b600081519050613218816150c6565b92915050565b60008135905061322d816150dd565b92915050565b60006020828403121561324557600080fd5b600061325384828501612fc5565b91505092915050565b6000806040838503121561326f57600080fd5b600061327d85828601612fc5565b925050602061328e85828601612fc5565b9150509250929050565b60008060008060008060008060a0898b0312156132b457600080fd5b60006132c28b828c01612fc5565b98505060206132d38b828c01612fc5565b975050604089013567ffffffffffffffff8111156132f057600080fd5b6132fc8b828c01613004565b9650965050606089013567ffffffffffffffff81111561331b57600080fd5b6133278b828c01613004565b9450945050608089013567ffffffffffffffff81111561334657600080fd5b6133528b828c016130e1565b92509250509295985092959890939650565b600080600080600060a0868803121561337c57600080fd5b600061338a88828901612fc5565b955050602061339b88828901612fc5565b945050604086013567ffffffffffffffff8111156133b857600080fd5b6133c48882890161304e565b935050606086013567ffffffffffffffff8111156133e157600080fd5b6133ed8882890161304e565b925050608086013567ffffffffffffffff81111561340a57600080fd5b6134168882890161312b565b9150509295509295909350565b60008060008060006080868803121561343b57600080fd5b600061344988828901612fc5565b955050602061345a88828901612fc5565b945050604061346b888289016131f4565b935050606086013567ffffffffffffffff81111561348857600080fd5b613494888289016130e1565b92509250509295509295909350565b60008060008060008060a087890312156134bc57600080fd5b60006134ca89828a01612fc5565b96505060206134db89828a01612fc5565b95505060406134ec89828a016131f4565b94505060606134fd89828a016131f4565b935050608087013567ffffffffffffffff81111561351a57600080fd5b61352689828a016130e1565b92509250509295509295509295565b600080600080600060a0868803121561354d57600080fd5b600061355b88828901612fc5565b955050602061356c88828901612fc5565b945050604061357d888289016131f4565b935050606061358e888289016131f4565b925050608086013567ffffffffffffffff8111156135ab57600080fd5b6135b78882890161312b565b9150509295509295909350565b600080600080606085870312156135da57600080fd5b60006135e887828801612fc5565b945050602085013567ffffffffffffffff81111561360557600080fd5b61361187828801613004565b9350935050604061362487828801612fc5565b91505092959194509250565b6000806000806000806080878903121561364957600080fd5b600061365789828a01612fc5565b965050602087013567ffffffffffffffff81111561367457600080fd5b61368089828a01613004565b9550955050604087013567ffffffffffffffff81111561369f57600080fd5b6136ab89828a01613004565b935093505060606136be89828a01612fc5565b9150509295509295509295565b600080604083850312156136de57600080fd5b60006136ec85828601612fc5565b92505060206136fd85828601613078565b9150509250929050565b6000806040838503121561371a57600080fd5b600061372885828601612fc5565b9250506020613739858286016131f4565b9150509250929050565b6000806040838503121561375657600080fd5b600083013567ffffffffffffffff81111561377057600080fd5b61377c85828601612fda565b925050602083013567ffffffffffffffff81111561379957600080fd5b6137a58582860161304e565b9150509250929050565b6000602082840312156137c157600080fd5b60006137cf8482850161308d565b91505092915050565b6000602082840312156137ea57600080fd5b60006137f8848285016130b7565b91505092915050565b60006020828403121561381357600080fd5b6000613821848285016130cc565b91505092915050565b600080600080600080610100878903121561384457600080fd5b600061385289828a01613155565b965050602087013567ffffffffffffffff81111561386f57600080fd5b61387b89828a0161316a565b955050604061388c89828a016131f4565b945050606061389d89828a016131f4565b93505060806138ae89828a01612fc5565b92505060a06138bf89828a01613194565b9150509295509295509295565b6000602082840312156138de57600080fd5b60006138ec848285016131f4565b91505092915050565b60006020828403121561390757600080fd5b600061391584828501613209565b91505092915050565b6000806040838503121561393157600080fd5b600061393f858286016131f4565b925050602083013567ffffffffffffffff81111561395c57600080fd5b6139688582860161316a565b9150509250929050565b600061397e8383613eac565b60208301905092915050565b613993816146f5565b82525050565b60006139a482614628565b6139ae8185614656565b93506139b983614603565b8060005b838110156139ea5781516139d18882613972565b97506139dc83614649565b9250506001810190506139bd565b5085935050505092915050565b613a0081614707565b82525050565b613a0f81614713565b82525050565b613a1e8161471d565b82525050565b6000613a2f82614633565b613a398185614667565b9350613a498185602086016147c6565b613a5281614983565b840191505092915050565b613a6681614793565b82525050565b613a75816147a5565b82525050565b6000613a868261463e565b613a908185614683565b9350613aa08185602086016147c6565b613aa981614983565b840191505092915050565b6000613abf8261463e565b613ac98185614694565b9350613ad98185602086016147c6565b80840191505092915050565b60008154613af2816147f9565b613afc8186614694565b94506001821660008114613b175760018114613b2857613b5b565b60ff19831686528186019350613b5b565b613b3185614613565b60005b83811015613b5357815481890152600182019150602081019050613b34565b838801955050505b50505092915050565b6000613b71601883614683565b9150613b7c826149a1565b602082019050919050565b6000613b94603483614683565b9150613b9f826149ca565b604082019050919050565b6000613bb7602f83614683565b9150613bc282614a19565b604082019050919050565b6000613bda602883614683565b9150613be582614a68565b604082019050919050565b6000613bfd602683614683565b9150613c0882614ab7565b604082019050919050565b6000613c20601383614683565b9150613c2b82614b06565b602082019050919050565b6000613c43602a83614683565b9150613c4e82614b2f565b604082019050919050565b6000613c66602783614683565b9150613c7182614b7e565b604082019050919050565b6000613c89602583614683565b9150613c9482614bcd565b604082019050919050565b6000613cac602e83614683565b9150613cb782614c1c565b604082019050919050565b6000613ccf602a83614683565b9150613cda82614c6b565b604082019050919050565b6000613cf2602083614683565b9150613cfd82614cba565b602082019050919050565b6000613d15602983614683565b9150613d2082614ce3565b604082019050919050565b6000613d38602183614683565b9150613d4382614d32565b604082019050919050565b6000613d5b600083614667565b9150613d6682614d81565b600082019050919050565b6000613d7e600083614678565b9150613d8982614d81565b600082019050919050565b6000613da1601383614683565b9150613dac82614d84565b602082019050919050565b6000613dc4602b83614683565b9150613dcf82614dad565b604082019050919050565b6000613de7602483614683565b9150613df282614dfc565b604082019050919050565b6000613e0a602983614683565b9150613e1582614e4b565b604082019050919050565b6000613e2d602983614683565b9150613e3882614e9a565b604082019050919050565b6000613e50602883614683565b9150613e5b82614ee9565b604082019050919050565b6000613e73602183614683565b9150613e7e82614f38565b604082019050919050565b6000613e96601c83614683565b9150613ea182614f87565b602082019050919050565b613eb58161477c565b82525050565b613ec48161477c565b82525050565b613ed381614786565b82525050565b6000613ee58285613ae5565b9150613ef18284613ab4565b91508190509392505050565b6000613f0882613d71565b9150819050919050565b6000602082019050613f27600083018461398a565b92915050565b600060a082019050613f42600083018861398a565b613f4f602083018761398a565b8181036040830152613f618186613999565b90508181036060830152613f758185613999565b90508181036080830152613f898184613a24565b90509695505050505050565b6000606082019050613faa600083018661398a565b613fb7602083018561398a565b613fc46040830184613ebb565b949350505050565b600060a082019050613fe1600083018861398a565b613fee602083018761398a565b613ffb6040830186613ebb565b6140086060830185613ebb565b818103608083015261401a8184613a24565b90509695505050505050565b600060a08201905061403b600083018761398a565b614048602083018661398a565b6140556040830185613ebb565b6140626060830184613ebb565b818103608083015261407381613d4e565b905095945050505050565b6000604082019050614093600083018561398a565b6140a06020830184613ebb565b9392505050565b600060208201905081810360008301526140c18184613999565b905092915050565b600060408201905081810360008301526140e38185613999565b905081810360208301526140f78184613999565b90509392505050565b600060208201905061411560008301846139f7565b92915050565b60006080820190506141306000830187613a06565b61413d6020830186613eca565b61414a6040830185613a06565b6141576060830184613a06565b95945050505050565b60006020820190506141756000830184613a15565b92915050565b600060c0820190506141906000830189613a5d565b81810360208301526141a28188613a7b565b90506141b16040830187613ebb565b6141be606083018661398a565b6141cb6080830185613ebb565b6141d860a083018461398a565b979650505050505050565b60006020820190506141f86000830184613a6c565b92915050565b600060208201905081810360008301526142188184613a7b565b905092915050565b6000602082019050818103600083015261423981613b64565b9050919050565b6000602082019050818103600083015261425981613b87565b9050919050565b6000602082019050818103600083015261427981613baa565b9050919050565b6000602082019050818103600083015261429981613bcd565b9050919050565b600060208201905081810360008301526142b981613bf0565b9050919050565b600060208201905081810360008301526142d981613c13565b9050919050565b600060208201905081810360008301526142f981613c36565b9050919050565b6000602082019050818103600083015261431981613c59565b9050919050565b6000602082019050818103600083015261433981613c7c565b9050919050565b6000602082019050818103600083015261435981613c9f565b9050919050565b6000602082019050818103600083015261437981613cc2565b9050919050565b6000602082019050818103600083015261439981613ce5565b9050919050565b600060208201905081810360008301526143b981613d08565b9050919050565b600060208201905081810360008301526143d981613d2b565b9050919050565b600060208201905081810360008301526143f981613d94565b9050919050565b6000602082019050818103600083015261441981613db7565b9050919050565b6000602082019050818103600083015261443981613dda565b9050919050565b6000602082019050818103600083015261445981613dfd565b9050919050565b6000602082019050818103600083015261447981613e20565b9050919050565b6000602082019050818103600083015261449981613e43565b9050919050565b600060208201905081810360008301526144b981613e66565b9050919050565b600060208201905081810360008301526144d981613e89565b9050919050565b60006020820190506144f56000830184613ebb565b92915050565b60006040820190506145106000830185613ebb565b61451d6020830184613ebb565b9392505050565b600061452e61453f565b905061453a828261482b565b919050565b6000604051905090565b600067ffffffffffffffff82111561456457614563614932565b5b602082029050602081019050919050565b600067ffffffffffffffff8211156145905761458f614932565b5b602082029050602081019050919050565b600067ffffffffffffffff8211156145bc576145bb614932565b5b6145c582614983565b9050602081019050919050565b600067ffffffffffffffff8211156145ed576145ec614932565b5b6145f682614983565b9050602081019050919050565b6000819050602082019050919050565b60008190508160005260206000209050919050565b600081519050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600081905092915050565b600082825260208201905092915050565b600081905092915050565b60006146aa8261477c565b91506146b58361477c565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156146ea576146e96148a5565b5b828201905092915050565b60006147008261475c565b9050919050565b60008115159050919050565b6000819050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b600081905061475782615046565b919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061479e82614749565b9050919050565b60006147b082614786565b9050919050565b82818337600083830152505050565b60005b838110156147e45780820151818401526020810190506147c9565b838111156147f3576000848401525b50505050565b6000600282049050600182168061481157607f821691505b6020821081141561482557614824614903565b5b50919050565b61483482614983565b810181811067ffffffffffffffff8211171561485357614852614932565b5b80604052505050565b60006148678261477c565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561489a576148996148a5565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600060033d11156149805760046000803e61497d600051614994565b90505b90565b6000601f19601f8301169050919050565b60008160e01c9050919050565b7f45434453413a20696e76616c6964207369676e61747572650000000000000000600082015250565b7f455243313135353a207472616e7366657220746f206e6f6e204552433131353560008201527f526563656976657220696d706c656d656e746572000000000000000000000000602082015250565b7f455243313135353a2063616c6c6572206973206e6f7420746f6b656e206f776e60008201527f6572206e6f7220617070726f7665640000000000000000000000000000000000602082015250565b7f455243313135353a204552433131353552656365697665722072656a6563746560008201527f6420746f6b656e73000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f494420616c726561647920636c61696d65642e00000000000000000000000000600082015250565b7f455243313135353a2061646472657373207a65726f206973206e6f742061207660008201527f616c6964206f776e657200000000000000000000000000000000000000000000602082015250565b7f43616e6e6f74206d696e74206d6f7265207468616e206f6e65205068616c616e60008201527f7820746f6b656e00000000000000000000000000000000000000000000000000602082015250565b7f455243313135353a207472616e7366657220746f20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160008201527f647920696e697469616c697a6564000000000000000000000000000000000000602082015250565b7f455243313135353a20696e73756666696369656e742062616c616e636520666f60008201527f72207472616e7366657200000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f496e73756666696369656e742045544820737570706c69656420666f7220747260008201527f616e73616374696f6e0000000000000000000000000000000000000000000000602082015250565b7f5f7472616e736665724574683a20457468207472616e73666572206661696c6560008201527f6400000000000000000000000000000000000000000000000000000000000000602082015250565b50565b7f44414f206e6f74206c6973746564207965742e00000000000000000000000000600082015250565b7f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960008201527f6e697469616c697a696e67000000000000000000000000000000000000000000602082015250565b7f5068616c616e7820746f6b656e2063616e6e6f74206265207472616e7366657260008201527f7265642100000000000000000000000000000000000000000000000000000000602082015250565b7f455243313135353a2073657474696e6720617070726f76616c2073746174757360008201527f20666f722073656c660000000000000000000000000000000000000000000000602082015250565b7f455243313135353a206163636f756e747320616e6420696473206c656e67746860008201527f206d69736d617463680000000000000000000000000000000000000000000000602082015250565b7f455243313135353a2069647320616e6420616d6f756e7473206c656e6774682060008201527f6d69736d61746368000000000000000000000000000000000000000000000000602082015250565b7f455243313135353a206d696e7420746f20746865207a65726f2061646472657360008201527f7300000000000000000000000000000000000000000000000000000000000000602082015250565b7f496e76616c69642076616c69646174696f6e207369676e617475726500000000600082015250565b600060443d1015614fc057615043565b614fc861453f565b60043d036004823e80513d602482011167ffffffffffffffff82111715614ff0575050615043565b808201805167ffffffffffffffff81111561500e5750505050615043565b80602083010160043d03850181111561502b575050505050615043565b61503a8260200185018661482b565b82955050505050505b90565b60048110615057576150566148d4565b5b50565b615063816146f5565b811461506e57600080fd5b50565b61507a81614707565b811461508557600080fd5b50565b61509181614713565b811461509c57600080fd5b50565b6150a88161471d565b81146150b357600080fd5b50565b600481106150c357600080fd5b50565b6150cf8161477c565b81146150da57600080fd5b50565b6150e681614786565b81146150f157600080fd5b5056fea26469706673582212208c59bded01bbe78d3b5e626e8cebcb9719b6a8a64e6e2fa4d67a3e6c8afd856a64736f6c63430008030033
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 33 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
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.