Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
- Contract name:
- Wrapped1155Factory
- Optimization enabled
- false
- Compiler version
- v0.6.12+commit.27d51765
- EVM Version
- default
- Verified at
- 2024-11-02T23:30:42.017155Z
.sol
/**
*Submitted for verification at Etherscan.io on 2020-10-02
*/
// SPDX-License-Identifier: LGPL-3.0-or-later
pragma solidity >=0.6.0;
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
/**
* @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");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(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");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
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
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
//
/*
* @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 GSN 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 payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
//
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
//
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
//
/**
* @dev Collection of functions related to the address type
*/
contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
/**
* @dev Sets the values for {name} and {symbol}, initializes {decimals} with
* a default value of 18.
*
* To select a different value for {decimals}, use {_setupDecimals}.
*
* All three of these values are immutable: they can only be set once during
* construction.
*/
constructor (string memory name, string memory symbol) public {
_name = name;
_symbol = symbol;
_decimals = 18;
}
/**
* @dev Returns the name of the token.
*/
function name() public view returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view 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 {_setupDecimals} is
* called.
*
* 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 returns (uint8) {
return _decimals;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20};
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(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) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(address sender, address recipient, uint256 amount) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements
*
* - `to` 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 = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(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);
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens.
*
* This is 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 Sets {decimals} to a value other than the default one of 18.
*
* WARNING: This function should only be called from the constructor. Most
* applications that interact with token contracts will not expect
* {decimals} to ever change, and may work incorrectly if it does.
*/
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
/**
* @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 to 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 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);
}
interface IERC1155 is IERC165 {
/**
* @dev Emitted when `value` tokens of token type `id` are transfered 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 be 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;
}
//
/**
* _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.
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. 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);
}
//
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts may inherit from this and call {_registerInterface} to declare
* their support of an interface.
*/
contract ERC165 is IERC165 {
/*
* bytes4(keccak256('supportsInterface(bytes4)')) == 0x01ffc9a7
*/
bytes4 private constant _INTERFACE_ID_ERC165 = 0x01ffc9a7;
/**
* @dev Mapping of interface ids to whether or not it's supported.
*/
mapping(bytes4 => bool) private _supportedInterfaces;
constructor () internal {
// Derived contracts need only register support for their own interfaces,
// we register support for ERC165 itself here
_registerInterface(_INTERFACE_ID_ERC165);
}
/**
* @dev See {IERC165-supportsInterface}.
*
* Time complexity O(1), guaranteed to always use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) public view override returns (bool) {
return _supportedInterfaces[interfaceId];
}
/**
* @dev Registers the contract as an implementer of the interface defined by
* `interfaceId`. Support of the actual ERC165 interface is automatic and
* registering its interface id is not required.
*
* See {IERC165-supportsInterface}.
*
* Requirements:
*
* - `interfaceId` cannot be the ERC165 invalid interface (`0xffffffff`).
*/
function _registerInterface(bytes4 interfaceId) internal virtual {
require(interfaceId != 0xffffffff, "ERC165: invalid interface id");
_supportedInterfaces[interfaceId] = true;
}
}
abstract contract ERC1155Receiver is ERC165, IERC1155Receiver {
constructor() public {
_registerInterface(
ERC1155Receiver(0).onERC1155Received.selector ^
ERC1155Receiver(0).onERC1155BatchReceived.selector
);
}
}
//
contract Wrapped1155Metadata {
// workaround which also arranges first storage slots of Wrapped1155
Wrapped1155Factory public factory;
IERC1155 public multiToken;
uint256 public tokenId;
modifier onlyFactory() {
require(msg.sender == address(factory), "Wrapped1155: only factory allowed to perform operation");
_;
}
}
contract Wrapped1155 is Wrapped1155Metadata, ERC20 {
constructor() public ERC20("Wrapped ERC-1155 Implementation", "WMT*") {}
function mint(address account, uint256 amount) external onlyFactory {
_mint(account, amount);
}
function burn(address account, uint256 amount) external onlyFactory {
_burn(account, amount);
}
}
contract Wrapped1155Factory is ERC1155Receiver {
using Address for address;
Wrapped1155 public erc20Implementation;
constructor() public {
erc20Implementation = new Wrapped1155();
}
function onERC1155Received(
address operator,
address /* from */,
uint256 id,
uint256 value,
bytes calldata data
)
external
override
returns (bytes4)
{
address recipient = data.length > 0 ?
abi.decode(data, (address)) :
operator;
Wrapped1155 wrapped1155 = requireWrapped1155(IERC1155(msg.sender), id);
wrapped1155.mint(recipient, value);
return this.onERC1155Received.selector;
}
function onERC1155BatchReceived(
address operator,
address /* from */,
uint256[] calldata ids,
uint256[] calldata values,
bytes calldata data
)
external
override
returns (bytes4)
{
address recipient = data.length > 0 ?
abi.decode(data, (address)) :
operator;
for (uint i = 0; i < ids.length; i++) {
requireWrapped1155(IERC1155(msg.sender), ids[i]).mint(recipient, values[i]);
}
return this.onERC1155BatchReceived.selector;
}
function unwrap(
IERC1155 multiToken,
uint256 tokenId,
uint256 amount,
address recipient,
bytes calldata data
)
external
{
getWrapped1155(multiToken, tokenId).burn(msg.sender, amount);
multiToken.safeTransferFrom(address(this), recipient, tokenId, amount, data);
}
function batchUnwrap(
IERC1155 multiToken,
uint256[] calldata tokenIds,
uint256[] calldata amounts,
address recipient,
bytes calldata data
)
external
{
require(tokenIds.length == amounts.length, "Wrapped1155Factory: mismatched input arrays");
for (uint i = 0; i < tokenIds.length; i++) {
getWrapped1155(multiToken, tokenIds[i]).burn(msg.sender, amounts[i]);
}
multiToken.safeBatchTransferFrom(address(this), recipient, tokenIds, amounts, data);
}
function getWrapped1155DeployBytecode(IERC1155 multiToken, uint256 tokenId)
public
view
returns (bytes memory)
{
return abi.encodePacked(
// assign factory
hex"73",
this,
hex"3d55",
// assign multiToken
hex"73",
multiToken,
hex"600155",
// assign tokenId
hex"7f",
tokenId,
hex"600255",
// assign name
hex"7f",
"Wrapped ERC-1155", uint128(32),
hex"600655",
// assign symbol
hex"7f",
"WMT", uint232(6),
hex"600755",
// assign decimals
hex"60",
uint8(18),
hex"600855",
// push 44 (length of runtime)
hex"60", uint8(44),
// load free memory pointer
hex"604051",
// dup runtime length
hex"81",
// push offset in this calldata to runtime object,
hex"60", uint8(171),
// dup free memory pointer
hex"82"
// codecopy runtime to memory and return
hex"39f3",
// greetz 0age for More-Minimal Proxy runtime bytecode:
hex"3d3d3d3d363d3d37363d73",
address(erc20Implementation),
hex"5af43d3d93803e602a57fd5bf3"
);
}
function getWrapped1155(IERC1155 multiToken, uint256 tokenId)
public
view
returns (Wrapped1155)
{
return Wrapped1155(address(uint256(keccak256(abi.encodePacked(
uint8(0xff),
this,
uint256(1155),
keccak256(getWrapped1155DeployBytecode(multiToken, tokenId))
)))));
}
event Wrapped1155Creation(
IERC1155 indexed multiToken,
uint256 indexed tokenId,
Wrapped1155 indexed wrappedToken
);
function requireWrapped1155(IERC1155 multiToken, uint256 tokenId)
public
returns (Wrapped1155)
{
bytes memory deployBytecode = getWrapped1155DeployBytecode(multiToken, tokenId);
address wrapped1155Address = address(uint256(keccak256(abi.encodePacked(
uint8(0xff),
this,
uint256(1155),
keccak256(deployBytecode)
))));
if (!wrapped1155Address.isContract()) {
address addr;
assembly {
addr := create2(0, add(deployBytecode, 0x20), mload(deployBytecode), 1155)
}
require(wrapped1155Address == addr, "Wrapped1155Factory: failed to deploy");
emit Wrapped1155Creation(
multiToken,
tokenId,
Wrapped1155(wrapped1155Address)
);
}
return Wrapped1155(wrapped1155Address);
}
}
Compiler Settings
{"outputSelection":{"*":{"*":["abi","evm.bytecode","evm.deployedBytecode","evm.methodIdentifiers"],"":["ast"]}},"optimizer":{"runs":200,"enabled":false},"metadata":{"bytecodeHash":"ipfs"},"libraries":{".sol":{}}}
Contract ABI
[{"type":"constructor","stateMutability":"nonpayable","inputs":[]},{"type":"event","name":"Wrapped1155Creation","inputs":[{"type":"address","name":"multiToken","internalType":"contract IERC1155","indexed":true},{"type":"uint256","name":"tokenId","internalType":"uint256","indexed":true},{"type":"address","name":"wrappedToken","internalType":"contract Wrapped1155","indexed":true}],"anonymous":false},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"batchUnwrap","inputs":[{"type":"address","name":"multiToken","internalType":"contract IERC1155"},{"type":"uint256[]","name":"tokenIds","internalType":"uint256[]"},{"type":"uint256[]","name":"amounts","internalType":"uint256[]"},{"type":"address","name":"recipient","internalType":"address"},{"type":"bytes","name":"data","internalType":"bytes"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract Wrapped1155"}],"name":"erc20Implementation","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract Wrapped1155"}],"name":"getWrapped1155","inputs":[{"type":"address","name":"multiToken","internalType":"contract IERC1155"},{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes","name":"","internalType":"bytes"}],"name":"getWrapped1155DeployBytecode","inputs":[{"type":"address","name":"multiToken","internalType":"contract IERC1155"},{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bytes4","name":"","internalType":"bytes4"}],"name":"onERC1155BatchReceived","inputs":[{"type":"address","name":"operator","internalType":"address"},{"type":"address","name":"","internalType":"address"},{"type":"uint256[]","name":"ids","internalType":"uint256[]"},{"type":"uint256[]","name":"values","internalType":"uint256[]"},{"type":"bytes","name":"data","internalType":"bytes"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bytes4","name":"","internalType":"bytes4"}],"name":"onERC1155Received","inputs":[{"type":"address","name":"operator","internalType":"address"},{"type":"address","name":"","internalType":"address"},{"type":"uint256","name":"id","internalType":"uint256"},{"type":"uint256","name":"value","internalType":"uint256"},{"type":"bytes","name":"data","internalType":"bytes"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"address","name":"","internalType":"contract Wrapped1155"}],"name":"requireWrapped1155","inputs":[{"type":"address","name":"multiToken","internalType":"contract IERC1155"},{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"supportsInterface","inputs":[{"type":"bytes4","name":"interfaceId","internalType":"bytes4"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"unwrap","inputs":[{"type":"address","name":"multiToken","internalType":"contract IERC1155"},{"type":"uint256","name":"tokenId","internalType":"uint256"},{"type":"uint256","name":"amount","internalType":"uint256"},{"type":"address","name":"recipient","internalType":"address"},{"type":"bytes","name":"data","internalType":"bytes"}]}]
Contract Creation Code
0x608060405234801561001057600080fd5b506100276301ffc9a760e01b6100b460201b60201c565b61004663bc197c8160e01b63f23a6e6160e01b186100b460201b60201c565b604051610052906101bc565b604051809103906000f08015801561006e573d6000803e3d6000fd5b50600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506101ca565b63ffffffff60e01b817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161415610150576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f4552433136353a20696e76616c696420696e746572666163652069640000000081525060200191505060405180910390fd5b6001600080837bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6119f2806200179683390190565b6115bc80620001da6000396000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c8063901be04111610066578063901be04114610307578063a7eaa1861461033b578063bc197c811461049e578063d533249a14610634578063f23a6e61146106ac57610093565b806301ffc9a71461009857806307662922146100fb57806352aecb24146101c25780638920e8911461028f575b600080fd5b6100e3600480360360208110156100ae57600080fd5b8101908080357bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191690602001909291905050506107ac565b60405180821515815260200191505060405180910390f35b6101476004803603604081101561011157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610813565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561018757808201518184015260208101905061016c565b50505050905090810190601f1680156101b45780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61028d600480360360a08110156101d857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019064010000000081111561024957600080fd5b82018360208201111561025b57600080fd5b8035906020019184600183028401116401000000008311171561027d57600080fd5b9091929391929390505050610c80565b005b6102db600480360360408110156102a557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610dfd565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61030f610e7b565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61049c600480360360a081101561035157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019064010000000081111561038e57600080fd5b8201836020820111156103a057600080fd5b803590602001918460208302840111640100000000831117156103c257600080fd5b9091929391929390803590602001906401000000008111156103e357600080fd5b8201836020820111156103f557600080fd5b8035906020019184602083028401116401000000008311171561041757600080fd5b9091929391929390803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019064010000000081111561045857600080fd5b82018360208201111561046a57600080fd5b8035906020019184600183028401116401000000008311171561048c57600080fd5b9091929391929390505050610ea1565b005b6105ff600480360360a08110156104b457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019064010000000081111561051157600080fd5b82018360208201111561052357600080fd5b8035906020019184602083028401116401000000008311171561054557600080fd5b90919293919293908035906020019064010000000081111561056657600080fd5b82018360208201111561057857600080fd5b8035906020019184602083028401116401000000008311171561059a57600080fd5b9091929391929390803590602001906401000000008111156105bb57600080fd5b8201836020820111156105cd57600080fd5b803590602001918460018302840111640100000000831117156105ef57600080fd5b909192939192939050505061111c565b60405180827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200191505060405180910390f35b6106806004803603604081101561064a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611253565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610777600480360360a08110156106c257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001909291908035906020019064010000000081111561073357600080fd5b82018360208201111561074557600080fd5b8035906020019184600183028401116401000000008311171561076757600080fd5b90919293919293905050506113f1565b60405180827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200191505060405180910390f35b6000806000837bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200190815260200160002060009054906101000a900460ff169050919050565b6060308383602060066012602c60ab600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660405160200180807f73000000000000000000000000000000000000000000000000000000000000008152506001018a73ffffffffffffffffffffffffffffffffffffffff1660601b8152601401807f3d55000000000000000000000000000000000000000000000000000000000000815250600201807f73000000000000000000000000000000000000000000000000000000000000008152506001018973ffffffffffffffffffffffffffffffffffffffff1660601b8152601401807f6001550000000000000000000000000000000000000000000000000000000000815250600301807f7f00000000000000000000000000000000000000000000000000000000000000815250600101888152602001807f6002550000000000000000000000000000000000000000000000000000000000815250600301807f7f00000000000000000000000000000000000000000000000000000000000000815250600101807f57726170706564204552432d3131353500000000000000000000000000000000815250601001876fffffffffffffffffffffffffffffffff1660801b8152601001807f6006550000000000000000000000000000000000000000000000000000000000815250600301807f7f00000000000000000000000000000000000000000000000000000000000000815250600101807f574d540000000000000000000000000000000000000000000000000000000000815250600301867cffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1660181b8152601d01807f6007550000000000000000000000000000000000000000000000000000000000815250600301807f60000000000000000000000000000000000000000000000000000000000000008152506001018560ff1660f81b8152600101807f6008550000000000000000000000000000000000000000000000000000000000815250600301807f60000000000000000000000000000000000000000000000000000000000000008152506001018460ff1660f81b8152600101807f6040510000000000000000000000000000000000000000000000000000000000815250600301807f8100000000000000000000000000000000000000000000000000000000000000815250600101807f60000000000000000000000000000000000000000000000000000000000000008152506001018360ff1660f81b8152600101807f8239f30000000000000000000000000000000000000000000000000000000000815250600301807f3d3d3d3d363d3d37363d73000000000000000000000000000000000000000000815250600b018273ffffffffffffffffffffffffffffffffffffffff1660601b8152601401807f5af43d3d93803e602a57fd5bf300000000000000000000000000000000000000815250600d019950505050505050505050604051602081830303815290604052905092915050565b610c8a8686610dfd565b73ffffffffffffffffffffffffffffffffffffffff16639dc29fac33866040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b158015610cfa57600080fd5b505af1158015610d0e573d6000803e3d6000fd5b505050508573ffffffffffffffffffffffffffffffffffffffff1663f242432a3085888887876040518763ffffffff1660e01b8152600401808773ffffffffffffffffffffffffffffffffffffffff1681526020018673ffffffffffffffffffffffffffffffffffffffff168152602001858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f820116905080830192505050975050505050505050600060405180830381600087803b158015610ddd57600080fd5b505af1158015610df1573d6000803e3d6000fd5b50505050505050505050565b600060ff30610483610e0f8686610813565b80519060200120604051602001808560ff1660f81b81526001018473ffffffffffffffffffffffffffffffffffffffff1660601b81526014018381526020018281526020019450505050506040516020818303038152906040528051906020012060001c905092915050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b848490508787905014610eff576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602b815260200180611538602b913960400191505060405180910390fd5b60005b87879050811015610fd057610f2989898984818110610f1d57fe5b90506020020135610dfd565b73ffffffffffffffffffffffffffffffffffffffff16639dc29fac33888885818110610f5157fe5b905060200201356040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b158015610fab57600080fd5b505af1158015610fbf573d6000803e3d6000fd5b505050508080600101915050610f02565b508773ffffffffffffffffffffffffffffffffffffffff16632eb2c2d630858a8a8a8a89896040518963ffffffff1660e01b8152600401808973ffffffffffffffffffffffffffffffffffffffff1681526020018873ffffffffffffffffffffffffffffffffffffffff16815260200180602001806020018060200184810384528a8a82818152602001925060200280828437600081840152601f19601f8201169050808301925050508481038352888882818152602001925060200280828437600081840152601f19601f8201169050808301925050508481038252868682818152602001925080828437600081840152601f19601f8201169050808301925050509b505050505050505050505050600060405180830381600087803b1580156110fa57600080fd5b505af115801561110e573d6000803e3d6000fd5b505050505050505050505050565b600080600084849050116111305789611168565b8383602081101561114057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050505b905060005b8888905081101561123b57611194338a8a8481811061118857fe5b90506020020135611253565b73ffffffffffffffffffffffffffffffffffffffff166340c10f19838989858181106111bc57fe5b905060200201356040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b15801561121657600080fd5b505af115801561122a573d6000803e3d6000fd5b50505050808060010191505061116d565b5063bc197c8160e01b91505098975050505050505050565b600060606112618484610813565b9050600060ff306104838480519060200120604051602001808560ff1660f81b81526001018473ffffffffffffffffffffffffffffffffffffffff1660601b81526014018381526020018281526020019450505050506040516020818303038152906040528051906020012060001c90506112f18173ffffffffffffffffffffffffffffffffffffffff166114ec565b6113e65760006104838351602085016000f590508073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611389576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806115636024913960400191505060405180910390fd5b8173ffffffffffffffffffffffffffffffffffffffff16858773ffffffffffffffffffffffffffffffffffffffff167f5cf3a4006b0dcb221517555192a3e5df5e19783c22ea769c1ef46dd421ae2d3260405160405180910390a4505b809250505092915050565b60008060008484905011611405578761143d565b8383602081101561141557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050505b9050600061144b3388611253565b90508073ffffffffffffffffffffffffffffffffffffffff166340c10f1983886040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b1580156114be57600080fd5b505af11580156114d2573d6000803e3d6000fd5b5050505063f23a6e6160e01b925050509695505050505050565b60008060007fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47060001b9050833f915080821415801561152e57506000801b8214155b9250505091905056fe5772617070656431313535466163746f72793a206d69736d61746368656420696e707574206172726179735772617070656431313535466163746f72793a206661696c656420746f206465706c6f79a2646970667358221220afe79dc45c511aa41f4ccd1605bfb150b6a7aabb64eec454d3aa52beb0dc404164736f6c634300060c003360806040523480156200001157600080fd5b506040518060400160405280601f81526020017f57726170706564204552432d3131353520496d706c656d656e746174696f6e008152506040518060400160405280600481526020017f574d542a00000000000000000000000000000000000000000000000000000000815250816006908051906020019062000096929190620000d4565b508060079080519060200190620000af929190620000d4565b506012600860006101000a81548160ff021916908360ff16021790555050506200017a565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200011757805160ff191683800117855562000148565b8280016001018555821562000148579182015b82811115620001475782518255916020019190600101906200012a565b5b5090506200015791906200015b565b5090565b5b80821115620001765760008160009055506001016200015c565b5090565b611868806200018a6000396000f3fe608060405234801561001057600080fd5b50600436106101005760003560e01c806340c10f1911610097578063a457c2d711610066578063a457c2d7146104dc578063a9059cbb14610540578063c45a0155146105a4578063dd62ed3e146105d857610100565b806340c10f191461036557806370a08231146103b357806395d89b411461040b5780639dc29fac1461048e57610100565b80631904e5c9116100d35780631904e5c91461022857806323b872dd1461025c578063313ce567146102e0578063395093511461030157610100565b806306fdde0314610105578063095ea7b31461018857806317d70f7c146101ec57806318160ddd1461020a575b600080fd5b61010d610650565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561014d578082015181840152602081019050610132565b50505050905090810190601f16801561017a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101d46004803603604081101561019e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106f2565b60405180821515815260200191505060405180910390f35b6101f4610710565b6040518082815260200191505060405180910390f35b610212610716565b6040518082815260200191505060405180910390f35b610230610720565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102c86004803603606081101561027257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610746565b60405180821515815260200191505060405180910390f35b6102e861081f565b604051808260ff16815260200191505060405180910390f35b61034d6004803603604081101561031757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610836565b60405180821515815260200191505060405180910390f35b6103b16004803603604081101561037b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108e9565b005b6103f5600480360360208110156103c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061099b565b6040518082815260200191505060405180910390f35b6104136109e4565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610453578082015181840152602081019050610438565b50505050905090810190601f1680156104805780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104da600480360360408110156104a457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a86565b005b610528600480360360408110156104f257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b38565b60405180821515815260200191505060405180910390f35b61058c6004803603604081101561055657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c05565b60405180821515815260200191505060405180910390f35b6105ac610c23565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61063a600480360360408110156105ee57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c47565b6040518082815260200191505060405180910390f35b606060068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106e85780601f106106bd576101008083540402835291602001916106e8565b820191906000526020600020905b8154815290600101906020018083116106cb57829003601f168201915b5050505050905090565b60006107066106ff610cce565b8484610cd6565b6001905092915050565b60025481565b6000600554905090565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000610753848484610ecd565b6108148461075f610cce565b61080f8560405180606001604052806028815260200161174660289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006107c5610cce565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546111929092919063ffffffff16565b610cd6565b600190509392505050565b6000600860009054906101000a900460ff16905090565b60006108df610843610cce565b846108da8560046000610854610cce565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461125290919063ffffffff16565b610cd6565b6001905092915050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461098d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603681526020018061178f6036913960400191505060405180910390fd5b61099782826112da565b5050565b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b606060078054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610a7c5780601f10610a5157610100808354040283529160200191610a7c565b820191906000526020600020905b815481529060010190602001808311610a5f57829003601f168201915b5050505050905090565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610b2a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603681526020018061178f6036913960400191505060405180910390fd5b610b3482826114a3565b5050565b6000610bfb610b45610cce565b84610bf68560405180606001604052806025815260200161180e6025913960046000610b6f610cce565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546111929092919063ffffffff16565b610cd6565b6001905092915050565b6000610c19610c12610cce565b8484610ecd565b6001905092915050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610d5c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806117ea6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610de2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806116fe6022913960400191505060405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610f53576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806117c56025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610fd9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806116b96023913960400191505060405180910390fd5b610fe4838383611669565b6110508160405180606001604052806026815260200161172060269139600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546111929092919063ffffffff16565b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506110e581600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461125290919063ffffffff16565b600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b600083831115829061123f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156112045780820151818401526020810190506111e9565b50505050905090810190601f1680156112315780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b6000808284019050838110156112d0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561137d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f45524332303a206d696e7420746f20746865207a65726f20616464726573730081525060200191505060405180910390fd5b61138960008383611669565b61139e8160055461125290919063ffffffff16565b6005819055506113f681600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461125290919063ffffffff16565b600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611529576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602181526020018061176e6021913960400191505060405180910390fd5b61153582600083611669565b6115a1816040518060600160405280602281526020016116dc60229139600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546111929092919063ffffffff16565b600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506115f98160055461166e90919063ffffffff16565b600581905550600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b505050565b60006116b083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611192565b90509291505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e2066726f6d20746865207a65726f206164647265737357726170706564313135353a206f6e6c7920666163746f727920616c6c6f77656420746f20706572666f726d206f7065726174696f6e45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa26469706673582212208719e2358388d64e199991ee4fa5b9a20617496b6cc780e13d5a3663de190eae64736f6c634300060c0033
Deployed ByteCode
0x608060405234801561001057600080fd5b50600436106100935760003560e01c8063901be04111610066578063901be04114610307578063a7eaa1861461033b578063bc197c811461049e578063d533249a14610634578063f23a6e61146106ac57610093565b806301ffc9a71461009857806307662922146100fb57806352aecb24146101c25780638920e8911461028f575b600080fd5b6100e3600480360360208110156100ae57600080fd5b8101908080357bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191690602001909291905050506107ac565b60405180821515815260200191505060405180910390f35b6101476004803603604081101561011157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610813565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561018757808201518184015260208101905061016c565b50505050905090810190601f1680156101b45780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61028d600480360360a08110156101d857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019064010000000081111561024957600080fd5b82018360208201111561025b57600080fd5b8035906020019184600183028401116401000000008311171561027d57600080fd5b9091929391929390505050610c80565b005b6102db600480360360408110156102a557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610dfd565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61030f610e7b565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61049c600480360360a081101561035157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019064010000000081111561038e57600080fd5b8201836020820111156103a057600080fd5b803590602001918460208302840111640100000000831117156103c257600080fd5b9091929391929390803590602001906401000000008111156103e357600080fd5b8201836020820111156103f557600080fd5b8035906020019184602083028401116401000000008311171561041757600080fd5b9091929391929390803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019064010000000081111561045857600080fd5b82018360208201111561046a57600080fd5b8035906020019184600183028401116401000000008311171561048c57600080fd5b9091929391929390505050610ea1565b005b6105ff600480360360a08110156104b457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019064010000000081111561051157600080fd5b82018360208201111561052357600080fd5b8035906020019184602083028401116401000000008311171561054557600080fd5b90919293919293908035906020019064010000000081111561056657600080fd5b82018360208201111561057857600080fd5b8035906020019184602083028401116401000000008311171561059a57600080fd5b9091929391929390803590602001906401000000008111156105bb57600080fd5b8201836020820111156105cd57600080fd5b803590602001918460018302840111640100000000831117156105ef57600080fd5b909192939192939050505061111c565b60405180827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200191505060405180910390f35b6106806004803603604081101561064a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611253565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610777600480360360a08110156106c257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001909291908035906020019064010000000081111561073357600080fd5b82018360208201111561074557600080fd5b8035906020019184600183028401116401000000008311171561076757600080fd5b90919293919293905050506113f1565b60405180827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200191505060405180910390f35b6000806000837bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200190815260200160002060009054906101000a900460ff169050919050565b6060308383602060066012602c60ab600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660405160200180807f73000000000000000000000000000000000000000000000000000000000000008152506001018a73ffffffffffffffffffffffffffffffffffffffff1660601b8152601401807f3d55000000000000000000000000000000000000000000000000000000000000815250600201807f73000000000000000000000000000000000000000000000000000000000000008152506001018973ffffffffffffffffffffffffffffffffffffffff1660601b8152601401807f6001550000000000000000000000000000000000000000000000000000000000815250600301807f7f00000000000000000000000000000000000000000000000000000000000000815250600101888152602001807f6002550000000000000000000000000000000000000000000000000000000000815250600301807f7f00000000000000000000000000000000000000000000000000000000000000815250600101807f57726170706564204552432d3131353500000000000000000000000000000000815250601001876fffffffffffffffffffffffffffffffff1660801b8152601001807f6006550000000000000000000000000000000000000000000000000000000000815250600301807f7f00000000000000000000000000000000000000000000000000000000000000815250600101807f574d540000000000000000000000000000000000000000000000000000000000815250600301867cffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1660181b8152601d01807f6007550000000000000000000000000000000000000000000000000000000000815250600301807f60000000000000000000000000000000000000000000000000000000000000008152506001018560ff1660f81b8152600101807f6008550000000000000000000000000000000000000000000000000000000000815250600301807f60000000000000000000000000000000000000000000000000000000000000008152506001018460ff1660f81b8152600101807f6040510000000000000000000000000000000000000000000000000000000000815250600301807f8100000000000000000000000000000000000000000000000000000000000000815250600101807f60000000000000000000000000000000000000000000000000000000000000008152506001018360ff1660f81b8152600101807f8239f30000000000000000000000000000000000000000000000000000000000815250600301807f3d3d3d3d363d3d37363d73000000000000000000000000000000000000000000815250600b018273ffffffffffffffffffffffffffffffffffffffff1660601b8152601401807f5af43d3d93803e602a57fd5bf300000000000000000000000000000000000000815250600d019950505050505050505050604051602081830303815290604052905092915050565b610c8a8686610dfd565b73ffffffffffffffffffffffffffffffffffffffff16639dc29fac33866040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b158015610cfa57600080fd5b505af1158015610d0e573d6000803e3d6000fd5b505050508573ffffffffffffffffffffffffffffffffffffffff1663f242432a3085888887876040518763ffffffff1660e01b8152600401808773ffffffffffffffffffffffffffffffffffffffff1681526020018673ffffffffffffffffffffffffffffffffffffffff168152602001858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f820116905080830192505050975050505050505050600060405180830381600087803b158015610ddd57600080fd5b505af1158015610df1573d6000803e3d6000fd5b50505050505050505050565b600060ff30610483610e0f8686610813565b80519060200120604051602001808560ff1660f81b81526001018473ffffffffffffffffffffffffffffffffffffffff1660601b81526014018381526020018281526020019450505050506040516020818303038152906040528051906020012060001c905092915050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b848490508787905014610eff576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602b815260200180611538602b913960400191505060405180910390fd5b60005b87879050811015610fd057610f2989898984818110610f1d57fe5b90506020020135610dfd565b73ffffffffffffffffffffffffffffffffffffffff16639dc29fac33888885818110610f5157fe5b905060200201356040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b158015610fab57600080fd5b505af1158015610fbf573d6000803e3d6000fd5b505050508080600101915050610f02565b508773ffffffffffffffffffffffffffffffffffffffff16632eb2c2d630858a8a8a8a89896040518963ffffffff1660e01b8152600401808973ffffffffffffffffffffffffffffffffffffffff1681526020018873ffffffffffffffffffffffffffffffffffffffff16815260200180602001806020018060200184810384528a8a82818152602001925060200280828437600081840152601f19601f8201169050808301925050508481038352888882818152602001925060200280828437600081840152601f19601f8201169050808301925050508481038252868682818152602001925080828437600081840152601f19601f8201169050808301925050509b505050505050505050505050600060405180830381600087803b1580156110fa57600080fd5b505af115801561110e573d6000803e3d6000fd5b505050505050505050505050565b600080600084849050116111305789611168565b8383602081101561114057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050505b905060005b8888905081101561123b57611194338a8a8481811061118857fe5b90506020020135611253565b73ffffffffffffffffffffffffffffffffffffffff166340c10f19838989858181106111bc57fe5b905060200201356040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b15801561121657600080fd5b505af115801561122a573d6000803e3d6000fd5b50505050808060010191505061116d565b5063bc197c8160e01b91505098975050505050505050565b600060606112618484610813565b9050600060ff306104838480519060200120604051602001808560ff1660f81b81526001018473ffffffffffffffffffffffffffffffffffffffff1660601b81526014018381526020018281526020019450505050506040516020818303038152906040528051906020012060001c90506112f18173ffffffffffffffffffffffffffffffffffffffff166114ec565b6113e65760006104838351602085016000f590508073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611389576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806115636024913960400191505060405180910390fd5b8173ffffffffffffffffffffffffffffffffffffffff16858773ffffffffffffffffffffffffffffffffffffffff167f5cf3a4006b0dcb221517555192a3e5df5e19783c22ea769c1ef46dd421ae2d3260405160405180910390a4505b809250505092915050565b60008060008484905011611405578761143d565b8383602081101561141557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050505b9050600061144b3388611253565b90508073ffffffffffffffffffffffffffffffffffffffff166340c10f1983886040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b1580156114be57600080fd5b505af11580156114d2573d6000803e3d6000fd5b5050505063f23a6e6160e01b925050509695505050505050565b60008060007fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47060001b9050833f915080821415801561152e57506000801b8214155b9250505091905056fe5772617070656431313535466163746f72793a206d69736d61746368656420696e707574206172726179735772617070656431313535466163746f72793a206661696c656420746f206465706c6f79a2646970667358221220afe79dc45c511aa41f4ccd1605bfb150b6a7aabb64eec454d3aa52beb0dc404164736f6c634300060c0033