Skip to content

Instantly share code, notes, and snippets.

@z0r0z
Last active July 12, 2023 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save z0r0z/421511ae8d286168ba5e3712494b5aa5 to your computer and use it in GitHub Desktop.
Save z0r0z/421511ae8d286168ba5e3712494b5aa5 to your computer and use it in GitHub Desktop.
Let us verify the contract source code of the most popular ERC1155 - OpenSea Shared Storefront (OPENSTORE) - 0x495f947276749ce646f68ac8c248420045cb7b5e
pragma solidity ^0.5.12;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*
* _Since v2.5.0:_ this module is now much more gas efficient, given net gas
* metering changes introduced in the Istanbul hardfork.
*/
contract ReentrancyGuard {
bool private _notEntered;
constructor () internal {
// Storing an initial non-zero value makes deployment a bit more
// expensive, but in exchange the refund on every call to nonReentrant
// will be lower in amount. Since refunds are capped to a percetange of
// the total transaction's gas, it is best to keep them low in cases
// like this one, to increase the likelihood of the full refund coming
// into effect.
_notEntered = true;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and make it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
// On the first call to nonReentrant, _notEntered will be true
require(_notEntered, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_notEntered = false;
_;
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_notEntered = true;
}
}
/*
* @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.
*/
contract Context {
// Empty internal constructor, to prevent people from mistakenly deploying
// an instance of this contract, which should be used via inheritance.
constructor () internal { }
// solhint-disable-previous-line no-empty-blocks
function _msgSender() internal view returns (address payable) {
return msg.sender;
}
function _msgData() internal view returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
/**
* @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.
*
* 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.
*/
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(isOwner(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Returns true if the caller is the current owner.
*/
function isOwner() public view returns (bool) {
return _msgSender() == _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 onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = 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 onlyOwner {
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
*/
function _transferOwnership(address newOwner) internal {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
/**
* @title SafeMath
* @dev Unsigned math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two unsigned integers, reverts on 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-solidity/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath#mul: OVERFLOW");
return c;
}
/**
* @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, "SafeMath#div: DIVISION_BY_ZERO");
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SafeMath#sub: UNDERFLOW");
uint256 c = a - b;
return c;
}
/**
* @dev Adds two unsigned integers, reverts on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath#add: OVERFLOW");
return c;
}
/**
* @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0, "SafeMath#mod: DIVISION_BY_ZERO");
return a % b;
}
}
/**
* @title ERC165
* @dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md
*/
interface IERC165 {
/**
* @notice Query if a contract implements an interface
* @dev Interface identification is specified in ERC-165. This function
* uses less than 30,000 gas
* @param _interfaceId The interface identifier, as specified in ERC-165
*/
function supportsInterface(bytes4 _interfaceId)
external
view
returns (bool);
}
/**
* @dev ERC-1155 interface for accepting safe transfers.
*/
interface IERC1155TokenReceiver {
/**
* @notice Handle the receipt of a single ERC1155 token type
* @dev An ERC1155-compliant smart contract MUST call this function on the token recipient contract, at the end of a `safeTransferFrom` after the balance has been updated
* This function MAY throw to revert and reject the transfer
* Return of other amount than the magic value MUST result in the transaction being reverted
* Note: The token contract address is always the message sender
* @param _operator The address which called the `safeTransferFrom` function
* @param _from The address which previously owned the token
* @param _id The id of the token being transferred
* @param _amount The amount of tokens being transferred
* @param _data Additional data with no specified format
* @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`
*/
function onERC1155Received(address _operator, address _from, uint256 _id, uint256 _amount, bytes calldata _data) external returns(bytes4);
/**
* @notice Handle the receipt of multiple ERC1155 token types
* @dev An ERC1155-compliant smart contract MUST call this function on the token recipient contract, at the end of a `safeBatchTransferFrom` after the balances have been updated
* This function MAY throw to revert and reject the transfer
* Return of other amount than the magic value WILL result in the transaction being reverted
* Note: The token contract address is always the message sender
* @param _operator The address which called the `safeBatchTransferFrom` function
* @param _from The address which previously owned the token
* @param _ids An array containing ids of each token being transferred
* @param _amounts An array containing amounts of each token being transferred
* @param _data Additional data with no specified format
* @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`
*/
function onERC1155BatchReceived(address _operator, address _from, uint256[] calldata _ids, uint256[] calldata _amounts, bytes calldata _data) external returns(bytes4);
/**
* @notice Indicates whether a contract implements the `ERC1155TokenReceiver` functions and so can accept ERC1155 token types.
* @param interfaceID The ERC-165 interface ID that is queried for support.s
* @dev This function MUST return true if it implements the ERC1155TokenReceiver interface and ERC-165 interface.
* This function MUST NOT consume more than 5,000 gas.
* @return Wheter ERC-165 or ERC1155TokenReceiver interfaces are supported.
*/
function supportsInterface(bytes4 interfaceID) external view returns (bool);
}
interface IERC1155 {
// Events
/**
* @dev Either TransferSingle or TransferBatch MUST emit when tokens are transferred, including zero amount transfers as well as minting or burning
* Operator MUST be msg.sender
* When minting/creating tokens, the `_from` field MUST be set to `0x0`
* When burning/destroying tokens, the `_to` field MUST be set to `0x0`
* The total amount transferred from address 0x0 minus the total amount transferred to 0x0 may be used by clients and exchanges to be added to the "circulating supply" for a given token ID
* To broadcast the existence of a token ID with no initial balance, the contract SHOULD emit the TransferSingle event from `0x0` to `0x0`, with the token creator as `_operator`, and a `_amount` of 0
*/
event TransferSingle(address indexed _operator, address indexed _from, address indexed _to, uint256 _id, uint256 _amount);
/**
* @dev Either TransferSingle or TransferBatch MUST emit when tokens are transferred, including zero amount transfers as well as minting or burning
* Operator MUST be msg.sender
* When minting/creating tokens, the `_from` field MUST be set to `0x0`
* When burning/destroying tokens, the `_to` field MUST be set to `0x0`
* The total amount transferred from address 0x0 minus the total amount transferred to 0x0 may be used by clients and exchanges to be added to the "circulating supply" for a given token ID
* To broadcast the existence of multiple token IDs with no initial balance, this SHOULD emit the TransferBatch event from `0x0` to `0x0`, with the token creator as `_operator`, and a `_amount` of 0
*/
event TransferBatch(address indexed _operator, address indexed _from, address indexed _to, uint256[] _ids, uint256[] _amounts);
/**
* @dev MUST emit when an approval is updated
*/
event ApprovalForAll(address indexed _owner, address indexed _operator, bool _approved);
/**
* @dev MUST emit when the URI is updated for a token ID
* URIs are defined in RFC 3986
* The URI MUST point a JSON file that conforms to the "ERC-1155 Metadata JSON Schema"
*/
event URI(string _amount, uint256 indexed _id);
/**
* @notice Transfers amount of an _id from the _from address to the _to address specified
* @dev MUST emit TransferSingle event on success
* Caller must be approved to manage the _from account's tokens (see isApprovedForAll)
* MUST throw if `_to` is the zero address
* MUST throw if balance of sender for token `_id` is lower than the `_amount` sent
* MUST throw on any other error
* When transfer is complete, this function MUST check if `_to` is a smart contract (code size > 0). If so, it MUST call `onERC1155Received` on `_to` and revert if the return amount is not `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`
* @param _from Source address
* @param _to Target address
* @param _id ID of the token type
* @param _amount Transfered amount
* @param _data Additional data with no specified format, sent in call to `_to`
*/
function safeTransferFrom(address _from, address _to, uint256 _id, uint256 _amount, bytes calldata _data) external;
/**
* @notice Send multiple types of Tokens from the _from address to the _to address (with safety call)
* @dev MUST emit TransferBatch event on success
* Caller must be approved to manage the _from account's tokens (see isApprovedForAll)
* MUST throw if `_to` is the zero address
* MUST throw if length of `_ids` is not the same as length of `_amounts`
* MUST throw if any of the balance of sender for token `_ids` is lower than the respective `_amounts` sent
* MUST throw on any other error
* When transfer is complete, this function MUST check if `_to` is a smart contract (code size > 0). If so, it MUST call `onERC1155BatchReceived` on `_to` and revert if the return amount is not `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`
* Transfers and events MUST occur in the array order they were submitted (_ids[0] before _ids[1], etc)
* @param _from Source addresses
* @param _to Target addresses
* @param _ids IDs of each token type
* @param _amounts Transfer amounts per token type
* @param _data Additional data with no specified format, sent in call to `_to`
*/
function safeBatchTransferFrom(address _from, address _to, uint256[] calldata _ids, uint256[] calldata _amounts, bytes calldata _data) external;
/**
* @notice Get the balance of an account's Tokens
* @param _owner The address of the token holder
* @param _id ID of the Token
* @return The _owner's balance of the Token type requested
*/
function balanceOf(address _owner, uint256 _id) external view returns (uint256);
/**
* @notice Get the balance of multiple account/token pairs
* @param _owners The addresses of the token holders
* @param _ids ID of the Tokens
* @return The _owner's balance of the Token types requested (i.e. balance for each (owner, id) pair)
*/
function balanceOfBatch(address[] calldata _owners, uint256[] calldata _ids) external view returns (uint256[] memory);
/**
* @notice Enable or disable approval for a third party ("operator") to manage all of caller's tokens
* @dev MUST emit the ApprovalForAll event on success
* @param _operator Address to add to the set of authorized operators
* @param _approved True if the operator is approved, false to revoke approval
*/
function setApprovalForAll(address _operator, bool _approved) external;
/**
* @notice Queries the approval status of an operator for a given owner
* @param _owner The owner of the Tokens
* @param _operator Address of authorized operator
* @return True if the operator is approved, false if not
*/
function isApprovedForAll(address _owner, address _operator) external view returns (bool isOperator);
}
/**
* Copyright 2018 ZeroEx Intl.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Utility library of inline functions on addresses
*/
library Address {
/**
* Returns whether the target address is a contract
* @dev This function will return false if invoked during the constructor of a contract,
* as the code is not actually created until after the constructor finishes.
* @param account address of the account to check
* @return whether the target address is a contract
*/
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// XXX Currently there is no better way to check if there is a contract in an address
// than to check the size of the code at that address.
// See https://ethereum.stackexchange.com/a/14016/36603
// for more details about how this works.
// TODO Check this again before the Serenity release, because all addresses will be
// contracts then.
assembly { codehash := extcodehash(account) }
return (codehash != 0x0 && codehash != accountHash);
}
}
/**
* @dev Implementation of Multi-Token Standard contract
*/
contract ERC1155 is IERC165 {
using SafeMath for uint256;
using Address for address;
/***********************************|
| Variables and Events |
|__________________________________*/
// onReceive function signatures
bytes4 constant internal ERC1155_RECEIVED_VALUE = 0xf23a6e61;
bytes4 constant internal ERC1155_BATCH_RECEIVED_VALUE = 0xbc197c81;
// Objects balances
mapping (address => mapping(uint256 => uint256)) internal balances;
// Operator Functions
mapping (address => mapping(address => bool)) internal operators;
// Events
event TransferSingle(address indexed _operator, address indexed _from, address indexed _to, uint256 _id, uint256 _amount);
event TransferBatch(address indexed _operator, address indexed _from, address indexed _to, uint256[] _ids, uint256[] _amounts);
event ApprovalForAll(address indexed _owner, address indexed _operator, bool _approved);
event URI(string _uri, uint256 indexed _id);
/***********************************|
| Public Transfer Functions |
|__________________________________*/
/**
* @notice Transfers amount amount of an _id from the _from address to the _to address specified
* @param _from Source address
* @param _to Target address
* @param _id ID of the token type
* @param _amount Transfered amount
* @param _data Additional data with no specified format, sent in call to `_to`
*/
function safeTransferFrom(address _from, address _to, uint256 _id, uint256 _amount, bytes memory _data)
public
{
require((msg.sender == _from) || isApprovedForAll(_from, msg.sender), "ERC1155#safeTransferFrom: INVALID_OPERATOR");
require(_to != address(0),"ERC1155#safeTransferFrom: INVALID_RECIPIENT");
// require(_amount >= balances[_from][_id]) is not necessary since checked with safemath operations
_safeTransferFrom(_from, _to, _id, _amount);
_callonERC1155Received(_from, _to, _id, _amount, _data);
}
/**
* @notice Send multiple types of Tokens from the _from address to the _to address (with safety call)
* @param _from Source addresses
* @param _to Target addresses
* @param _ids IDs of each token type
* @param _amounts Transfer amounts per token type
* @param _data Additional data with no specified format, sent in call to `_to`
*/
function safeBatchTransferFrom(address _from, address _to, uint256[] memory _ids, uint256[] memory _amounts, bytes memory _data)
public
{
// Requirements
require((msg.sender == _from) || isApprovedForAll(_from, msg.sender), "ERC1155#safeBatchTransferFrom: INVALID_OPERATOR");
require(_to != address(0), "ERC1155#safeBatchTransferFrom: INVALID_RECIPIENT");
_safeBatchTransferFrom(_from, _to, _ids, _amounts);
_callonERC1155BatchReceived(_from, _to, _ids, _amounts, _data);
}
/***********************************|
| Internal Transfer Functions |
|__________________________________*/
/**
* @notice Transfers amount amount of an _id from the _from address to the _to address specified
* @param _from Source address
* @param _to Target address
* @param _id ID of the token type
* @param _amount Transfered amount
*/
function _safeTransferFrom(address _from, address _to, uint256 _id, uint256 _amount)
internal
{
// Update balances
balances[_from][_id] = balances[_from][_id].sub(_amount); // Subtract amount
balances[_to][_id] = balances[_to][_id].add(_amount); // Add amount
// Emit event
emit TransferSingle(msg.sender, _from, _to, _id, _amount);
}
/**
* @notice Verifies if receiver is contract and if so, calls (_to).onERC1155Received(...)
*/
function _callonERC1155Received(address _from, address _to, uint256 _id, uint256 _amount, bytes memory _data)
internal
{
// Check if recipient is contract
if (_to.isContract()) {
bytes4 retval = IERC1155TokenReceiver(_to).onERC1155Received(msg.sender, _from, _id, _amount, _data);
require(retval == ERC1155_RECEIVED_VALUE, "ERC1155#_callonERC1155Received: INVALID_ON_RECEIVE_MESSAGE");
}
}
/**
* @notice Send multiple types of Tokens from the _from address to the _to address (with safety call)
* @param _from Source addresses
* @param _to Target addresses
* @param _ids IDs of each token type
* @param _amounts Transfer amounts per token type
*/
function _safeBatchTransferFrom(address _from, address _to, uint256[] memory _ids, uint256[] memory _amounts)
internal
{
require(_ids.length == _amounts.length, "ERC1155#_safeBatchTransferFrom: INVALID_ARRAYS_LENGTH");
// Number of transfer to execute
uint256 nTransfer = _ids.length;
// Executing all transfers
for (uint256 i = 0; i < nTransfer; i++) {
// Update storage balance of previous bin
balances[_from][_ids[i]] = balances[_from][_ids[i]].sub(_amounts[i]);
balances[_to][_ids[i]] = balances[_to][_ids[i]].add(_amounts[i]);
}
// Emit event
emit TransferBatch(msg.sender, _from, _to, _ids, _amounts);
}
/**
* @notice Verifies if receiver is contract and if so, calls (_to).onERC1155BatchReceived(...)
*/
function _callonERC1155BatchReceived(address _from, address _to, uint256[] memory _ids, uint256[] memory _amounts, bytes memory _data)
internal
{
// Pass data if recipient is contract
if (_to.isContract()) {
bytes4 retval = IERC1155TokenReceiver(_to).onERC1155BatchReceived(msg.sender, _from, _ids, _amounts, _data);
require(retval == ERC1155_BATCH_RECEIVED_VALUE, "ERC1155#_callonERC1155BatchReceived: INVALID_ON_RECEIVE_MESSAGE");
}
}
/***********************************|
| Operator Functions |
|__________________________________*/
/**
* @notice Enable or disable approval for a third party ("operator") to manage all of caller's tokens
* @param _operator Address to add to the set of authorized operators
* @param _approved True if the operator is approved, false to revoke approval
*/
function setApprovalForAll(address _operator, bool _approved)
external
{
// Update operator status
operators[msg.sender][_operator] = _approved;
emit ApprovalForAll(msg.sender, _operator, _approved);
}
/**
* @notice Queries the approval status of an operator for a given owner
* @param _owner The owner of the Tokens
* @param _operator Address of authorized operator
* @return True if the operator is approved, false if not
*/
function isApprovedForAll(address _owner, address _operator)
public view returns (bool isOperator)
{
return operators[_owner][_operator];
}
/***********************************|
| Balance Functions |
|__________________________________*/
/**
* @notice Get the balance of an account's Tokens
* @param _owner The address of the token holder
* @param _id ID of the Token
* @return The _owner's balance of the Token type requested
*/
function balanceOf(address _owner, uint256 _id)
public view returns (uint256)
{
return balances[_owner][_id];
}
/**
* @notice Get the balance of multiple account/token pairs
* @param _owners The addresses of the token holders
* @param _ids ID of the Tokens
* @return The _owner's balance of the Token types requested (i.e. balance for each (owner, id) pair)
*/
function balanceOfBatch(address[] memory _owners, uint256[] memory _ids)
public view returns (uint256[] memory)
{
require(_owners.length == _ids.length, "ERC1155#balanceOfBatch: INVALID_ARRAY_LENGTH");
// Variables
uint256[] memory batchBalances = new uint256[](_owners.length);
// Iterate over each owner and token ID
for (uint256 i = 0; i < _owners.length; i++) {
batchBalances[i] = balances[_owners[i]][_ids[i]];
}
return batchBalances;
}
/***********************************|
| ERC165 Functions |
|__________________________________*/
/**
* INTERFACE_SIGNATURE_ERC165 = bytes4(keccak256("supportsInterface(bytes4)"));
*/
bytes4 constant private INTERFACE_SIGNATURE_ERC165 = 0x01ffc9a7;
/**
* INTERFACE_SIGNATURE_ERC1155 =
* bytes4(keccak256("safeTransferFrom(address,address,uint256,uint256,bytes)")) ^
* bytes4(keccak256("safeBatchTransferFrom(address,address,uint256[],uint256[],bytes)")) ^
* bytes4(keccak256("balanceOf(address,uint256)")) ^
* bytes4(keccak256("balanceOfBatch(address[],uint256[])")) ^
* bytes4(keccak256("setApprovalForAll(address,bool)")) ^
* bytes4(keccak256("isApprovedForAll(address,address)"));
*/
bytes4 constant private INTERFACE_SIGNATURE_ERC1155 = 0xd9b67a26;
/**
* @notice Query if a contract implements an interface
* @param _interfaceID The interface identifier, as specified in ERC-165
* @return `true` if the contract implements `_interfaceID` and
*/
function supportsInterface(bytes4 _interfaceID) external view returns (bool) {
if (_interfaceID == INTERFACE_SIGNATURE_ERC165 ||
_interfaceID == INTERFACE_SIGNATURE_ERC1155) {
return true;
}
return false;
}
}
/**
* @notice Contract that handles metadata related methods.
* @dev Methods assume a deterministic generation of URI based on token IDs.
* Methods also assume that URI uses hex representation of token IDs.
*/
contract ERC1155Metadata {
// URI's default URI prefix
string internal baseMetadataURI;
event URI(string _uri, uint256 indexed _id);
/***********************************|
| Metadata Public Function s |
|__________________________________*/
/**
* @notice A distinct Uniform Resource Identifier (URI) for a given token.
* @dev URIs are defined in RFC 3986.
* URIs are assumed to be deterministically generated based on token ID
* Token IDs are assumed to be represented in their hex format in URIs
* @return URI string
*/
function uri(uint256 _id) public view returns (string memory) {
return string(abi.encodePacked(baseMetadataURI, _uint2str(_id), ".json"));
}
/***********************************|
| Metadata Internal Functions |
|__________________________________*/
/**
* @notice Will emit default URI log event for corresponding token _id
* @param _tokenIDs Array of IDs of tokens to log default URI
*/
function _logURIs(uint256[] memory _tokenIDs) internal {
string memory baseURL = baseMetadataURI;
string memory tokenURI;
for (uint256 i = 0; i < _tokenIDs.length; i++) {
tokenURI = string(abi.encodePacked(baseURL, _uint2str(_tokenIDs[i]), ".json"));
emit URI(tokenURI, _tokenIDs[i]);
}
}
/**
* @notice Will emit a specific URI log event for corresponding token
* @param _tokenIDs IDs of the token corresponding to the _uris logged
* @param _URIs The URIs of the specified _tokenIDs
*/
function _logURIs(uint256[] memory _tokenIDs, string[] memory _URIs) internal {
require(_tokenIDs.length == _URIs.length, "ERC1155Metadata#_logURIs: INVALID_ARRAYS_LENGTH");
for (uint256 i = 0; i < _tokenIDs.length; i++) {
emit URI(_URIs[i], _tokenIDs[i]);
}
}
/**
* @notice Will update the base URL of token's URI
* @param _newBaseMetadataURI New base URL of token's URI
*/
function _setBaseMetadataURI(string memory _newBaseMetadataURI) internal {
baseMetadataURI = _newBaseMetadataURI;
}
/***********************************|
| Utility Internal Functions |
|__________________________________*/
/**
* @notice Convert uint256 to string
* @param _i Unsigned integer to convert to string
*/
function _uint2str(uint256 _i) internal pure returns (string memory _uintAsString) {
if (_i == 0) {
return "0";
}
uint256 j = _i;
uint256 ii = _i;
uint256 len;
// Get number of bytes
while (j != 0) {
len++;
j /= 10;
}
bytes memory bstr = new bytes(len);
uint256 k = len - 1;
// Get each individual ASCII
while (ii != 0) {
bstr[k--] = byte(uint8(48 + ii % 10));
ii /= 10;
}
// Convert to string
return string(bstr);
}
}
/**
* @dev Multi-Fungible Tokens with minting and burning methods. These methods assume
* a parent contract to be executed as they are `internal` functions
*/
contract ERC1155MintBurn is ERC1155 {
/****************************************|
| Minting Functions |
|_______________________________________*/
/**
* @notice Mint _amount of tokens of a given id
* @param _to The address to mint tokens to
* @param _id Token id to mint
* @param _amount The amount to be minted
* @param _data Data to pass if receiver is contract
*/
function _mint(address _to, uint256 _id, uint256 _amount, bytes memory _data)
internal
{
// Add _amount
balances[_to][_id] = balances[_to][_id].add(_amount);
// Emit event
emit TransferSingle(msg.sender, address(0x0), _to, _id, _amount);
// Calling onReceive method if recipient is contract
_callonERC1155Received(address(0x0), _to, _id, _amount, _data);
}
/**
* @notice Mint tokens for each ids in _ids
* @param _to The address to mint tokens to
* @param _ids Array of ids to mint
* @param _amounts Array of amount of tokens to mint per id
* @param _data Data to pass if receiver is contract
*/
function _batchMint(address _to, uint256[] memory _ids, uint256[] memory _amounts, bytes memory _data)
internal
{
require(_ids.length == _amounts.length, "ERC1155MintBurn#batchMint: INVALID_ARRAYS_LENGTH");
// Number of mints to execute
uint256 nMint = _ids.length;
// Executing all minting
for (uint256 i = 0; i < nMint; i++) {
// Update storage balance
balances[_to][_ids[i]] = balances[_to][_ids[i]].add(_amounts[i]);
}
// Emit batch mint event
emit TransferBatch(msg.sender, address(0x0), _to, _ids, _amounts);
// Calling onReceive method if recipient is contract
_callonERC1155BatchReceived(address(0x0), _to, _ids, _amounts, _data);
}
/****************************************|
| Burning Functions |
|_______________________________________*/
/**
* @notice Burn _amount of tokens of a given token id
* @param _from The address to burn tokens from
* @param _id Token id to burn
* @param _amount The amount to be burned
*/
function _burn(address _from, uint256 _id, uint256 _amount)
internal
{
//Substract _amount
balances[_from][_id] = balances[_from][_id].sub(_amount);
// Emit event
emit TransferSingle(msg.sender, _from, address(0x0), _id, _amount);
}
/**
* @notice Burn tokens of given token id for each (_ids[i], _amounts[i]) pair
* @param _from The address to burn tokens from
* @param _ids Array of token ids to burn
* @param _amounts Array of the amount to be burned
*/
function _batchBurn(address _from, uint256[] memory _ids, uint256[] memory _amounts)
internal
{
require(_ids.length == _amounts.length, "ERC1155MintBurn#batchBurn: INVALID_ARRAYS_LENGTH");
// Number of mints to execute
uint256 nBurn = _ids.length;
// Executing all minting
for (uint256 i = 0; i < nBurn; i++) {
// Update storage balance
balances[_from][_ids[i]] = balances[_from][_ids[i]].sub(_amounts[i]);
}
// Emit batch mint event
emit TransferBatch(msg.sender, _from, address(0x0), _ids, _amounts);
}
}
library Strings {
// via https://github.com/oraclize/ethereum-api/blob/master/oraclizeAPI_0.5.sol
function strConcat(string memory _a, string memory _b, string memory _c, string memory _d, string memory _e) internal pure returns (string memory) {
bytes memory _ba = bytes(_a);
bytes memory _bb = bytes(_b);
bytes memory _bc = bytes(_c);
bytes memory _bd = bytes(_d);
bytes memory _be = bytes(_e);
string memory abcde = new string(_ba.length + _bb.length + _bc.length + _bd.length + _be.length);
bytes memory babcde = bytes(abcde);
uint k = 0;
for (uint i = 0; i < _ba.length; i++) babcde[k++] = _ba[i];
for (uint i = 0; i < _bb.length; i++) babcde[k++] = _bb[i];
for (uint i = 0; i < _bc.length; i++) babcde[k++] = _bc[i];
for (uint i = 0; i < _bd.length; i++) babcde[k++] = _bd[i];
for (uint i = 0; i < _be.length; i++) babcde[k++] = _be[i];
return string(babcde);
}
function strConcat(string memory _a, string memory _b, string memory _c, string memory _d) internal pure returns (string memory) {
return strConcat(_a, _b, _c, _d, "");
}
function strConcat(string memory _a, string memory _b, string memory _c) internal pure returns (string memory) {
return strConcat(_a, _b, _c, "", "");
}
function strConcat(string memory _a, string memory _b) internal pure returns (string memory) {
return strConcat(_a, _b, "", "", "");
}
function uint2str(uint _i) internal pure returns (string memory _uintAsString) {
if (_i == 0) {
return "0";
}
uint j = _i;
uint len;
while (j != 0) {
len++;
j /= 10;
}
bytes memory bstr = new bytes(len);
uint k = len - 1;
while (_i != 0) {
bstr[k--] = byte(uint8(48 + _i % 10));
_i /= 10;
}
return string(bstr);
}
}
contract OwnableDelegateProxy {}
contract ProxyRegistry {
mapping(address => OwnableDelegateProxy) public proxies;
}
/**
* @title ERC1155Tradable
* ERC1155Tradable - ERC1155 contract that whitelists an operator address, has create and mint functionality, and supports useful standards from OpenZeppelin,
like exists(), name(), symbol(), and totalSupply()
*/
contract ERC1155Tradable is ERC1155, ERC1155MintBurn, ERC1155Metadata, Ownable {
using Address for address;
// Proxy registry address
address public proxyRegistryAddress;
// Contract name
string public name;
// Contract symbol
string public symbol;
mapping(uint256 => uint256) public totalSupply;
constructor(
string memory _name,
string memory _symbol,
address _proxyRegistryAddress
) public {
name = _name;
symbol = _symbol;
proxyRegistryAddress = _proxyRegistryAddress;
}
/**
* @dev Throws if called by any account other than the owner or their proxy
*/
modifier onlyOwnerOrProxy() {
require(
_isOwnerOrProxy(_msgSender()),
"ERC1155Tradable#onlyOwner: CALLER_IS_NOT_OWNER"
);
_;
}
/**
* @dev Throws if called by any account other than _from or their proxy
*/
modifier onlyApproved(address _from) {
require(
_from == _msgSender() || isApprovedForAll(_from, _msgSender()),
"ERC1155Tradable#onlyApproved: CALLER_NOT_ALLOWED"
);
_;
}
function _isOwnerOrProxy(address _address) internal view returns (bool) {
return owner() == _address || _isProxyForUser(owner(), _address);
}
/**
* Override isApprovedForAll to whitelist user's OpenSea proxy accounts to enable gas-free listings.
*/
function isApprovedForAll(address _owner, address _operator)
public
view
returns (bool isOperator)
{
// Whitelist OpenSea proxy contracts for easy trading.
if (_isProxyForUser(_owner, _operator)) {
return true;
}
return super.isApprovedForAll(_owner, _operator);
}
/**
* @dev Mints some amount of tokens to an address
* @param _to Address of the future owner of the token
* @param _id Token ID to mint
* @param _quantity Amount of tokens to mint
* @param _data Data to pass if receiver is contract
*/
function mint(
address _to,
uint256 _id,
uint256 _quantity,
bytes memory _data
) public onlyOwnerOrProxy {
_mint(_to, _id, _quantity, _data);
}
/**
* @dev Mint tokens for each id in _ids
* @param _to The address to mint tokens to
* @param _ids Array of ids to mint
* @param _quantities Array of amounts of tokens to mint per id
* @param _data Data to pass if receiver is contract
*/
function batchMint(
address _to,
uint256[] memory _ids,
uint256[] memory _quantities,
bytes memory _data
) public onlyOwnerOrProxy {
_batchMint(_to, _ids, _quantities, _data);
}
/**
* @dev Burns amount of a given token id
* @param _from The address to burn tokens from
* @param _id Token ID to burn
* @param _quantity Amount to burn
*/
function burn(
address _from,
uint256 _id,
uint256 _quantity
) public onlyApproved(_from) {
_burn(_from, _id, _quantity);
}
/**
* @dev Burns tokens for each id in _ids
* @param _from The address to burn tokens from
* @param _ids Array of token ids to burn
* @param _quantities Array of the amount to be burned
*/
function batchBurn(
address _from,
uint256[] memory _ids,
uint256[] memory _quantities
) public onlyApproved(_from) {
_batchBurn(_from, _ids, _quantities);
}
/**
* @dev Returns whether the specified token is minted
* @param _id uint256 ID of the token to query the existence of
* @return bool whether the token exists
*/
function exists(uint256 _id) public view returns (bool) {
return totalSupply[_id] > 0;
}
// PROXY HELPER METHODS
function _isProxyForUser(address _user, address _address)
internal
view
returns (bool)
{
if (!proxyRegistryAddress.isContract()) {
return false;
}
ProxyRegistry proxyRegistry = ProxyRegistry(proxyRegistryAddress);
return address(proxyRegistry.proxies(_user)) == _address;
}
}
/**
* @title AssetContract
* AssetContract - A contract for easily creating non-fungible assets on OpenSea.
*/
contract AssetContract is ERC1155Tradable {
uint256 constant TOKEN_SUPPLY_CAP = 1;
string public templateURI;
// Optional mapping for token URIs
mapping(uint256 => string) private _tokenURI;
modifier onlyTokenAmountOwned(
address _from,
uint256 _id,
uint256 _quantity
) {
require(
_ownsTokenAmount(_from, _id, _quantity),
"AssetContract#onlyTokenAmountOwned: ONLY_TOKEN_AMOUNT_OWNED_ALLOWED"
);
_;
}
constructor(
string memory _name,
string memory _symbol,
address _proxyRegistryAddress,
string memory _templateURI
) public ERC1155Tradable(_name, _symbol, _proxyRegistryAddress) {
if (bytes(_templateURI).length > 0) {
setTemplateURI(_templateURI);
}
}
function openSeaVersion() public pure returns (string memory) {
return "2.0.0";
}
/**
* @dev Require _from to own a specified quantity of the token
*/
function _ownsTokenAmount(
address _from,
uint256 _id,
uint256 _quantity
) internal view returns (bool) {
return balanceOf(_from, _id) >= _quantity;
}
/**
* Compat for factory interfaces on OpenSea
* Indicates that this contract can return balances for
* tokens that haven't been minted yet
*/
function supportsFactoryInterface() public pure returns (bool) {
return true;
}
function setTemplateURI(string memory _uri) public onlyOwnerOrProxy {
templateURI = _uri;
}
function setURI(uint256 _id, string memory _uri)
public
onlyOwnerOrProxy
{
_setURI(_id, _uri);
}
function uri(uint256 _id) public view returns (string memory) {
string memory tokenUri = _tokenURI[_id];
if (bytes(tokenUri).length != 0) {
return tokenUri;
}
return templateURI;
}
function balanceOf(address _owner, uint256 _id)
public
view
returns (uint256)
{
uint256 balance = super.balanceOf(_owner, _id);
return
_isCreatorOrProxy(_id, _owner)
? balance + _remainingSupply(_id)
: balance;
}
function safeTransferFrom(
address _from,
address _to,
uint256 _id,
uint256 _amount,
bytes memory _data
) public {
uint256 mintedBalance = super.balanceOf(_from, _id);
if (mintedBalance < _amount) {
// Only mint what _from doesn't already have
mint(_to, _id, _amount - mintedBalance, _data);
if (mintedBalance > 0) {
super.safeTransferFrom(_from, _to, _id, mintedBalance, _data);
}
} else {
super.safeTransferFrom(_from, _to, _id, _amount, _data);
}
}
function safeBatchTransferFrom(
address _from,
address _to,
uint256[] memory _ids,
uint256[] memory _amounts,
bytes memory _data
) public {
require(
_ids.length == _amounts.length,
"AssetContract#safeBatchTransferFrom: INVALID_ARRAYS_LENGTH"
);
for (uint256 i = 0; i < _ids.length; i++) {
safeTransferFrom(_from, _to, _ids[i], _amounts[i], _data);
}
}
function _beforeMint(uint256 _id, uint256 _quantity)
internal
view
{
require(
_quantity <= _remainingSupply(_id),
"AssetContract#_beforeMint: QUANTITY_EXCEEDS_TOKEN_SUPPLY_CAP"
);
}
// Overrides ERC1155Tradable burn to check for quantity owned
function burn(
address _from,
uint256 _id,
uint256 _quantity
) public onlyTokenAmountOwned(_from, _id, _quantity) {
super.burn(_from, _id, _quantity);
}
// Overrides ERC1155Tradable batchBurn to check for quantity owned
function batchBurn(
address _from,
uint256[] memory _ids,
uint256[] memory _quantities
) public {
for (uint256 i = 0; i < _ids.length; i++) {
require(
_ownsTokenAmount(_from, _ids[i], _quantities[i]),
"AssetContract#batchBurn: ONLY_TOKEN_AMOUNT_OWNED_ALLOWED"
);
}
super.batchBurn(_from, _ids, _quantities);
}
function _mint(
address _to,
uint256 _id,
uint256 _quantity,
bytes memory _data
) internal {
super._mint(_to, _id, _quantity, _data);
if (_data.length > 1) {
_setURI(_id, string(_data));
}
}
function _isCreatorOrProxy(uint256, address _address)
internal
view
returns (bool)
{
return _isOwnerOrProxy(_address);
}
function _remainingSupply(uint256 _id)
internal
view
returns (uint256)
{
return TOKEN_SUPPLY_CAP - totalSupply[_id];
}
// Override ERC1155Tradable for birth events
function _origin(
uint256 /* _id */
) internal view returns (address) {
return owner();
}
function _batchMint(
address _to,
uint256[] memory _ids,
uint256[] memory _quantities,
bytes memory _data
) internal {
super._batchMint(_to, _ids, _quantities, _data);
if (_data.length > 1) {
for (uint256 i = 0; i < _ids.length; i++) {
_setURI(_ids[i], string(_data));
}
}
}
function _setURI(uint256 _id, string memory _uri) internal {
_tokenURI[_id] = _uri;
emit URI(_uri, _id);
}
}
/*
DESIGN NOTES:
Token ids are a concatenation of:
* creator: hex address of the creator of the token. 160 bits
* index: Index for this token (the regular ID), up to 2^56 - 1. 56 bits
* supply: Supply cap for this token, up to 2^40 - 1 (1 trillion). 40 bits
*/
/**
* @title TokenIdentifiers
* support for authentication and metadata for token ids
*/
library TokenIdentifiers {
uint8 constant INDEX_BITS = 56;
uint8 constant SUPPLY_BITS = 40;
function tokenCreator(uint256 _id) internal pure returns (address) {
return address(uint160(_id >> (INDEX_BITS + SUPPLY_BITS)));
}
}
/**
* @title AssetContractShared
* OpenSea shared asset contract - A contract for easily creating custom assets on OpenSea
*/
contract AssetContractShared is AssetContract, ReentrancyGuard {
mapping(address => bool) public sharedProxyAddresses;
struct Ownership {
uint256 id;
address owner;
}
using TokenIdentifiers for uint256;
event CreatorChanged(uint256 indexed _id, address indexed _creator);
mapping(uint256 => address) internal _creatorOverride;
/**
* @dev Require msg.sender to be the creator of the token id
*/
modifier creatorOnly(uint256 _id) {
require(
_isCreatorOrProxy(_id, _msgSender()),
"AssetContractShared#creatorOnly: ONLY_CREATOR_ALLOWED"
);
_;
}
constructor(
string memory _name,
string memory _symbol,
address _proxyRegistryAddress,
string memory _templateURI
) public AssetContract(_name, _symbol, _proxyRegistryAddress, _templateURI) {}
/**
* @dev Allows owner to change the proxy registry
*/
function setProxyRegistryAddress(address _address) public onlyOwnerOrProxy {
proxyRegistryAddress = _address;
}
/**
* @dev Allows owner to add a shared proxy address
*/
function addSharedProxyAddress(address _address) public onlyOwnerOrProxy {
sharedProxyAddresses[_address] = true;
}
/**
* @dev Allows owner to remove a shared proxy address
*/
function removeSharedProxyAddress(address _address)
public
onlyOwnerOrProxy
{
delete sharedProxyAddresses[_address];
}
function mint(
address _to,
uint256 _id,
uint256 _quantity,
bytes memory _data
) public nonReentrant creatorOnly(_id) {
_mint(_to, _id, _quantity, _data);
}
function batchMint(
address _to,
uint256[] memory _ids,
uint256[] memory _quantities,
bytes memory _data
) public nonReentrant {
for (uint256 i = 0; i < _ids.length; i++) {
require(
_isCreatorOrProxy(_ids[i], _msgSender()),
"AssetContractShared#_batchMint: ONLY_CREATOR_ALLOWED"
);
}
_batchMint(_to, _ids, _quantities, _data);
}
/////////////////////////////////
// CONVENIENCE CREATOR METHODS //
/////////////////////////////////
/**
* @dev Will update the URI for the token
* @param _id The token ID to update. msg.sender must be its creator
* @param _uri New URI for the token.
*/
function setURI(uint256 _id, string memory _uri)
public
creatorOnly(_id)
{
_setURI(_id, _uri);
}
/**
* @dev Change the creator address for given token
* @param _to Address of the new creator
* @param _id Token IDs to change creator of
*/
function setCreator(uint256 _id, address _to) public creatorOnly(_id) {
require(
_to != address(0),
"AssetContractShared#setCreator: INVALID_ADDRESS."
);
_creatorOverride[_id] = _to;
emit CreatorChanged(_id, _to);
}
/**
* @dev Get the creator for a token
* @param _id The token id to look up
*/
function creator(uint256 _id) public view returns (address) {
if (_creatorOverride[_id] != address(0)) {
return _creatorOverride[_id];
} else {
return _id.tokenCreator();
}
}
// Override ERC1155Tradable for birth events
function _origin(uint256 _id) internal view returns (address) {
return _id.tokenCreator();
}
function _requireMintable(address _address, uint256 _id) internal view {
require(
_isCreatorOrProxy(_id, _address),
"AssetContractShared#_requireMintable: ONLY_CREATOR_ALLOWED"
);
}
function _isCreatorOrProxy(uint256 _id, address _address)
internal
view
returns (bool)
{
address creator_ = creator(_id);
return creator_ == _address || _isProxyForUser(creator_, _address);
}
// Overrides ERC1155Tradable to allow a shared proxy address
function _isProxyForUser(address _user, address _address)
internal
view
returns (bool)
{
if (sharedProxyAddresses[_address]) {
return true;
}
return super._isProxyForUser(_user, _address);
}
}
@z0r0z
Copy link
Author

z0r0z commented Jul 12, 2023

0x608060405234801561001057600080fd5b50600436106101d95760003560e01c80638f32d59b11610104578063bd85b039116100a2578063e985e9c511610071578063e985e9c5146110a9578063f242432a14611125578063f2fde38b14611234578063f923e8c314611278576101d9565b8063bd85b03914610fb7578063c311c52314610ff9578063cd7c03261461101b578063d26ea6c014611065576101d9565b80639e037eea116100de5780639e037eea14610cdc578063a22cb46514610d20578063a50aa5c314610d70578063b48ab8b614610db4576101d9565b80638f32d59b14610be957806391686f5314610c0b57806395d89b4114610c59576101d9565b80634e1273f41161017c578063731133e91161014b578063731133e91461098f57806373505d3514610a7e578063862440e214610ada5780638da5cb5b14610b9f576101d9565b80634e1273f4146107305780634f558e79146108d1578063510b515814610917578063715018a614610985576101d9565b80630e89341c116101b85780630e89341c1461032857806324d88785146103cf5780632eb2c2d61461048a5780634060b25e146106ad576101d9565b8062fdd58e146101de57806301ffc9a71461024057806306fdde03146102a5575b600080fd5b61022a600480360360408110156101f457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506112fb565b6040518082815260200191505060405180910390f35b61028b6004803603602081101561025657600080fd5b8101908080357bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19169060200190929190505050611343565b604051808215151515815260200191505060405180910390f35b6102ad6113f4565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156102ed5780820151818401526020810190506102d2565b50505050905090810190601f16801561031a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103546004803603602081101561033e57600080fd5b8101908080359060200190929190505050611492565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610394578082015181840152602081019050610379565b50505050905090810190601f1680156103c15780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610488600480360360208110156103e557600080fd5b810190808035906020019064010000000081111561040257600080fd5b82018360208201111561041457600080fd5b8035906020019184600183028401116401000000008311171561043657600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505091929192905050506115f9565b005b6106ab600480360360a08110156104a057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001906401000000008111156104fd57600080fd5b82018360208201111561050f57600080fd5b8035906020019184602083028401116401000000008311171561053157600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019064010000000081111561059157600080fd5b8201836020820111156105a357600080fd5b803590602001918460208302840111640100000000831117156105c557600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019064010000000081111561062557600080fd5b82018360208201111561063757600080fd5b8035906020019184600183028401116401000000008311171561065957600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050611678565b005b6106b56117b4565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156106f55780820151818401526020810190506106da565b50505050905090810190601f1680156107225780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61087a6004803603604081101561074657600080fd5b810190808035906020019064010000000081111561076357600080fd5b82018360208201111561077557600080fd5b8035906020019184602083028401116401000000008311171561079757600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290803590602001906401000000008111156107f757600080fd5b82018360208201111561080957600080fd5b8035906020019184602083028401116401000000008311171561082b57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192905050506117f1565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156108bd5780820151818401526020810190506108a2565b505050509050019250505060405180910390f35b6108fd600480360360208110156108e757600080fd5b8101908080359060200190929190505050611937565b604051808215151515815260200191505060405180910390f35b6109436004803603602081101561092d57600080fd5b8101908080359060200190929190505050611956565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61098d611989565b005b610a7c600480360360808110156109a557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190929190803590602001906401000000008111156109f657600080fd5b820183602082011115610a0857600080fd5b80359060200191846001830284011164010000000083111715610a2a57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050611aaf565b005b610ac060048036036020811015610a9457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611b8b565b604051808215151515815260200191505060405180910390f35b610b9d60048036036040811015610af057600080fd5b810190808035906020019092919080359060200190640100000000811115610b1757600080fd5b820183602082011115610b2957600080fd5b80359060200191846001830284011164010000000083111715610b4b57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050611bab565b005b610ba7611c21565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610bf1611c4b565b604051808215151515815260200191505060405180910390f35b610c5760048036036040811015610c2157600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611caa565b005b610c61611e32565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610ca1578082015181840152602081019050610c86565b50505050905090810190601f168015610cce5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610d1e60048036036020811015610cf257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611ed0565b005b610d6e60048036036040811015610d3657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803515159060200190929190505050611f87565b005b610db260048036036020811015610d8657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612088565b005b610fb560048036036080811015610dca57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190640100000000811115610e0757600080fd5b820183602082011115610e1957600080fd5b80359060200191846020830284011164010000000083111715610e3b57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f82011690508083019250505050505050919291929080359060200190640100000000811115610e9b57600080fd5b820183602082011115610ead57600080fd5b80359060200191846020830284011164010000000083111715610ecf57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f82011690508083019250505050505050919291929080359060200190640100000000811115610f2f57600080fd5b820183602082011115610f4157600080fd5b80359060200191846001830284011164010000000083111715610f6357600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050612148565b005b610fe360048036036020811015610fcd57600080fd5b8101908080359060200190929190505050612267565b6040518082815260200191505060405180910390f35b611001612284565b604051808215151515815260200191505060405180910390f35b61102361228d565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6110a76004803603602081101561107b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506122b3565b005b61110b600480360360408110156110bf57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061235c565b604051808215151515815260200191505060405180910390f35b611232600480360360a081101561113b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190929190803590602001906401000000008111156111ac57600080fd5b8201836020820111156111be57600080fd5b803590602001918460018302840111640100000000831117156111e057600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050612389565b005b6112766004803603602081101561124a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506123ef565b005b611280612460565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156112c05780820151818401526020810190506112a5565b50505050905090810190601f1680156112ed5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b60008061130884846124fe565b90506113148385612558565b61131e578061133a565b61133961132a846126c4565b826126f090919063ffffffff16565b5b91505092915050565b60006301ffc9a760e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614806113dc575063d9b67a2660e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b156113ea57600190506113ef565b600090505b919050565b60048054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561148a5780601f1061145f5761010080835404028352916020019161148a565b820191906000526020600020905b81548152906001019060200180831161146d57829003601f168201915b505050505081565b606080600860008481526020019081526020016000208054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561153c5780601f106115115761010080835404028352916020019161153c565b820191906000526020600020905b81548152906001019060200180831161151f57829003601f168201915b50505050509050600081511461155557809150506115f4565b60078054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156115eb5780601f106115c0576101008083540402835291602001916115eb565b820191906000526020600020905b8154815290600101906020018083116115ce57829003601f168201915b50505050509150505b919050565b611609611604612778565b612780565b61165e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602e8152602001806140f5602e913960400191505060405180910390fd5b8060079080519060200190611674929190613efe565b5050565b8473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806116b857506116b7853361235c565b5b61170d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602f8152602001806141e4602f913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415611793576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260308152602001806141886030913960400191505060405180910390fd5b61179f858585856127d7565b6117ad858585855a86612b3c565b5050505050565b60606040518060400160405280600581526020017f322e302e30000000000000000000000000000000000000000000000000000000815250905090565b6060815183511461184d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602c8152602001806141b8602c913960400191505060405180910390fd5b6060835160405190808252806020026020018201604052801561187f5781602001602082028038833980820191505090505b50905060008090505b845181101561192c576000808683815181106118a057fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008583815181106118f057fe5b602002602001015181526020019081526020016000205482828151811061191357fe5b6020026020010181815250508080600101915050611888565b508091505092915050565b6000806006600084815260200190815260200160002054119050919050565b600b6020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b611999611994612778565b612780565b6119ee576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602e8152602001806140f5602e913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600960009054906101000a900460ff16611b31576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0081525060200191505060405180910390fd5b6000600960006101000a81548160ff021916908315150217905550611b5e611b57612778565b8484612dfa565b611b6a84848484612ebf565b6001600960006101000a81548160ff02191690831515021790555050505050565b600a6020528060005260406000206000915054906101000a900460ff1681565b81611bbd81611bb8612778565b612558565b611c12576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603581526020018061428c6035913960400191505060405180910390fd5b611c1c8383612ee6565b505050565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611c8e612778565b73ffffffffffffffffffffffffffffffffffffffff1614905090565b81611cbc81611cb7612778565b612558565b611d11576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603581526020018061428c6035913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611d97576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526030815260200180613ff56030913960400191505060405180910390fd5b81600b600085815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff16837f39071c63e44267bfdefc7b625c0df99d3ce2e6ff98d9f5e9e8a7ab43cdf5000d60405160405180910390a3505050565b60058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611ec85780601f10611e9d57610100808354040283529160200191611ec8565b820191906000526020600020905b815481529060010190602001808311611eab57829003601f168201915b505050505081565b611ee0611edb612778565b612780565b611f35576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602e8152602001806140f5602e913960400191505060405180910390fd5b600a60008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81549060ff021916905550565b80600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3183604051808215151515815260200191505060405180910390a35050565b612098612093612778565b612780565b6120ed576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602e8152602001806140f5602e913960400191505060405180910390fd5b6001600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600960009054906101000a900460ff166121ca576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0081525060200191505060405180910390fd5b6000600960006101000a81548160ff02191690831515021790555060008090505b83518110156122395761222c6121ff612778565b85838151811061220b57fe5b602002602001015185848151811061221f57fe5b6020026020010151612dfa565b80806001019150506121eb565b5061224684848484612faf565b6001600960006101000a81548160ff02191690831515021790555050505050565b600060066000838152602001908152602001600020549050919050565b60006001905090565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6122c36122be612778565b612780565b612318576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602e8152602001806140f5602e913960400191505060405180910390fd5b80600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60006123688383613006565b156123765760019050612383565b6123808383613076565b90505b92915050565b600061239586856124fe565b9050828110156123d9576123bd85856123b7848761310a90919063ffffffff16565b85611aaf565b60008111156123d4576123d38686868486613193565b5b6123e7565b6123e68686868686613193565b5b505050505050565b6123ff6123fa612778565b612780565b612454576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602e8152602001806140f5602e913960400191505060405180910390fd5b61245d816132cf565b50565b60078054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156124f65780601f106124cb576101008083540402835291602001916124f6565b820191906000526020600020905b8154815290600101906020018083116124d957829003601f168201915b505050505081565b60008060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002054905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff16600b600085815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461266d578173ffffffffffffffffffffffffffffffffffffffff16600b600085815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614806126665750612665600b600085815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1683613006565b5b90506126be565b600061267884613415565b90508273ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614806126ba57506126b98184613006565b5b9150505b92915050565b60006126e96126d283612267565b6126db84613429565b61310a90919063ffffffff16565b9050919050565b60008082840190508381101561276e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f536166654d617468236164643a204f564552464c4f570000000000000000000081525060200191505060405180910390fd5b8091505092915050565b600033905090565b60008173ffffffffffffffffffffffffffffffffffffffff166127a1611c21565b73ffffffffffffffffffffffffffffffffffffffff1614806127d057506127cf6127c9611c21565b83613006565b5b9050919050565b8051825114612831576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260358152602001806141236035913960400191505060405180910390fd5b60008251905060008090505b81811015612a2e576128cd83828151811061285457fe5b60200260200101516000808973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008785815181106128a857fe5b602002602001015181526020019081526020016000205461310a90919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600086848151811061291957fe5b60200260200101518152602001908152602001600020819055506129bb83828151811061294257fe5b60200260200101516000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600087858151811061299657fe5b60200260200101518152602001908152602001600020546126f090919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000868481518110612a0757fe5b6020026020010151815260200190815260200160002081905550808060010191505061283d565b508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8686604051808060200180602001838103835285818151815260200191508051906020019060200280838360005b83811015612ade578082015181840152602081019050612ac3565b50505050905001838103825284818151815260200191508051906020019060200280838360005b83811015612b20578082015181840152602081019050612b05565b5050505090500194505050505060405180910390a45050505050565b612b5b8573ffffffffffffffffffffffffffffffffffffffff16613440565b15612df25760008573ffffffffffffffffffffffffffffffffffffffff1663bc197c8184338a8989886040518763ffffffff1660e01b8152600401808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001806020018060200180602001848103845287818151815260200191508051906020019060200280838360005b83811015612c42578082015181840152602081019050612c27565b50505050905001848103835286818151815260200191508051906020019060200280838360005b83811015612c84578082015181840152602081019050612c69565b50505050905001848103825285818151815260200191508051906020019080838360005b83811015612cc3578082015181840152602081019050612ca8565b50505050905090810190601f168015612cf05780820380516001836020036101000a031916815260200191505b5098505050505050505050602060405180830381600088803b158015612d1557600080fd5b5087f1158015612d29573d6000803e3d6000fd5b50505050506040513d6020811015612d4057600080fd5b8101908080519060200190929190505050905063bc197c8160e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614612df0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603f815260200180614213603f913960400191505060405180910390fd5b505b505050505050565b612e048284612558565b612e59576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603a815260200180614086603a913960400191505060405180910390fd5b80612e63836126c4565b1015612eba576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260358152602001806140c06035913960400191505060405180910390fd5b505050565b612ecb84848484613485565b600181511115612ee057612edf8382612ee6565b5b50505050565b80600860008481526020019081526020016000209080519060200190612f0d929190613efe565b50817f6bb7ff708619ba0610cba295a58592e0451dee2622938c8755667688daf3529b826040518080602001828103825283818151815260200191508051906020019080838360005b83811015612f71578082015181840152602081019050612f56565b50505050905090810190601f168015612f9e5780820380516001836020036101000a031916815260200191505b509250505060405180910390a25050565b612fbb8484848461361d565b6001815111156130005760008090505b8351811015612ffe57612ff1848281518110612fe357fe5b602002602001015183612ee6565b8080600101915050612fcb565b505b50505050565b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156130635760019050613070565b61306d8383613993565b90505b92915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b600082821115613182576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f536166654d617468237375623a20554e444552464c4f5700000000000000000081525060200191505060405180910390fd5b600082840390508091505092915050565b8473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806131d357506131d2853361235c565b5b613228576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180614025602a913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614156132ae576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602b815260200180613fa4602b913960400191505060405180910390fd5b6132ba858585856139d4565b6132c8858585855a86613bc8565b5050505050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415613355576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180613fcf6026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000602860380160ff1682901c9050919050565b60006001602860ff166001901b0382169050919050565b600080823f90506000801b811415801561347d57507fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47060001b8114155b915050919050565b6134e7826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000868152602001908152602001600020546126f090919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000858152602001908152602001600020819055506135608260066000868152602001908152602001600020546126f090919063ffffffff16565b6006600085815260200190815260200160002081905550600061358284613e04565b90508473ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f628787604051808381526020018281526020019250505060405180910390a4613616818686865a87613bc8565b5050505050565b8151835114613677576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260308152602001806141586030913960400191505060405180910390fd5b600083519050600061369c8560008151811061368f57fe5b6020026020010151613e04565b905060008090505b828110156138765760008682815181106136ba57fe5b602002602001015190508273ffffffffffffffffffffffffffffffffffffffff166136e482613e04565b73ffffffffffffffffffffffffffffffffffffffff1614613750576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603781526020018061404f6037913960400191505060405180910390fd5b6137c586838151811061375f57fe5b60200260200101516000808b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000848152602001908152602001600020546126f090919063ffffffff16565b6000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008381526020019081526020016000208190555061385186838151811061382757fe5b602002602001015160066000848152602001908152602001600020546126f090919063ffffffff16565b60066000838152602001908152602001600020819055505080806001019150506136a4565b508573ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8888604051808060200180602001838103835285818151815260200191508051906020019060200280838360005b8381101561392657808201518184015260208101905061390b565b50505050905001838103825284818151815260200191508051906020019060200280838360005b8381101561396857808201518184015260208101905061394d565b5050505090500194505050505060405180910390a461398b818787875a88612b3c565b505050505050565b60008173ffffffffffffffffffffffffffffffffffffffff166139b584613e16565b73ffffffffffffffffffffffffffffffffffffffff1614905092915050565b613a36816000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008581526020019081526020016000205461310a90919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002081905550613aeb816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000858152602001908152602001600020546126f090919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000848152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f628585604051808381526020018281526020019250505060405180910390a450505050565b613be78573ffffffffffffffffffffffffffffffffffffffff16613440565b15613dfc5760008573ffffffffffffffffffffffffffffffffffffffff1663f23a6e6184338a8989886040518763ffffffff1660e01b8152600401808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200184815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b83811015613ccf578082015181840152602081019050613cb4565b50505050905090810190601f168015613cfc5780820380516001836020036101000a031916815260200191505b509650505050505050602060405180830381600088803b158015613d1f57600080fd5b5087f1158015613d33573d6000803e3d6000fd5b50505050506040513d6020811015613d4a57600080fd5b8101908080519060200190929190505050905063f23a6e6160e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614613dfa576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603a815260200180614252603a913960400191505060405180910390fd5b505b505050505050565b6000613e0f82613415565b9050919050565b600080600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff1663c4552791846040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015613ebb57600080fd5b505afa158015613ecf573d6000803e3d6000fd5b505050506040513d6020811015613ee557600080fd5b8101908080519060200190929190505050915050919050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10613f3f57805160ff1916838001178555613f6d565b82800160010185558215613f6d579182015b82811115613f6c578251825591602001919060010190613f51565b5b509050613f7a9190613f7e565b5090565b613fa091905b80821115613f9c576000816000905550600101613f84565b5090565b9056fe4552433131353523736166655472616e7366657246726f6d3a20494e56414c49445f524543495049454e544f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734173736574436f6e74726163745368617265642373657443726561746f723a20494e56414c49445f414444524553532e4552433131353523736166655472616e7366657246726f6d3a20494e56414c49445f4f50455241544f52455243313135355472616461626c652362617463684d696e743a204d554c5449504c455f4f524947494e535f4e4f545f414c4c4f5745444173736574436f6e7472616374536861726564235f726571756972654d696e7461626c653a204f4e4c595f43524541544f525f414c4c4f5745444173736574436f6e7472616374536861726564235f726571756972654d696e7461626c653a20535550504c595f4558434545444544455243313135355472616461626c65236f6e6c794f776e65723a2043414c4c45525f49535f4e4f545f4f574e455245524331313535235f7361666542617463685472616e7366657246726f6d3a20494e56414c49445f4152524159535f4c454e475448455243313135355472616461626c652362617463684d696e743a20494e56414c49445f4152524159535f4c454e47544845524331313535237361666542617463685472616e7366657246726f6d3a20494e56414c49445f524543495049454e54455243313135352362616c616e63654f6642617463683a20494e56414c49445f41525241595f4c454e47544845524331313535237361666542617463685472616e7366657246726f6d3a20494e56414c49445f4f50455241544f5245524331313535235f63616c6c6f6e45524331313535426174636852656365697665643a20494e56414c49445f4f4e5f524543454956455f4d45535341474545524331313535235f63616c6c6f6e4552433131353552656365697665643a20494e56414c49445f4f4e5f524543454956455f4d4553534147454173736574436f6e74726163745368617265642363726561746f724f6e6c793a204f4e4c595f43524541544f525f414c4c4f574544a265627a7a7231582028f3e529f4dff9e1217e9c5fa3987610b4f138495f1f8d6516748e8ab795168d64736f6c63430005110032

@z0r0z
Copy link
Author

z0r0z commented Jul 12, 2023

Polygon (but code is different), like compiler is >0.8.0 and I suspect using more recent 1155 from OZ: https://polygonscan.com/address/0x2953399124f0cbb46d2cbacd8a89cf0599974963#code

@z0r0z
Copy link
Author

z0r0z commented Jul 12, 2023

Also, ETH version doesn't have things like eip712, public max supply, it has safeMath and stuff as well.

I think more to get from here, https://github.com/ProjectOpenSea/opensea-erc1155/blob/master/contracts/ERC1155Tradable.sol

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment