Contract Overview
My Name Tag:
Not Available, login to update
[ Download CSV Export ]
Contract Name:
CollectionStore
Compiler Version
v0.7.6+commit.7338295f
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.7.6; pragma experimental ABIEncoderV2; import "../interfaces/ICollectionManager.sol"; import "../commons/OwnableInitializable.sol"; import "../commons/NativeMetaTransaction.sol"; import "../libs/String.sol"; contract Rarities is OwnableInitializable, NativeMetaTransaction { using String for string; struct Rarity { string name; uint256 maxSupply; uint256 price; } Rarity[] public rarities; /// @dev indexes will start in 1 mapping(bytes32 => uint256) rarityIndex; event AddRarity(Rarity _rarity); event UpdatePrice(string _name, uint256 _price); /** * @notice Create the contract * @param _owner - owner of the contract */ constructor(address _owner, Rarity[] memory _rarities) { // EIP712 init _initializeEIP712('Decentraland Rarities', '1'); // Ownable init _initOwnable(); transferOwnership(_owner); for (uint256 i = 0 ; i < _rarities.length; i++) { _addRarity(_rarities[i]); } } function updatePrices(string[] calldata _names, uint256[] calldata _prices) external onlyOwner { require(_names.length == _prices.length, "Rarities#updatePrices: LENGTH_MISMATCH"); for (uint256 i = 0; i < _names.length; i++) { string memory name = _names[i]; uint256 price = _prices[i]; bytes32 rarityKey = keccak256(bytes(name.toLowerCase())); uint256 index = rarityIndex[rarityKey]; require(rarityIndex[rarityKey] > 0, "Rarities#updatePrices: INVALID_RARITY"); rarities[index - 1].price = price; emit UpdatePrice(name, price); } } function addRarities(Rarity[] memory _rarities) external onlyOwner { for (uint256 i = 0; i < _rarities.length; i++) { _addRarity(_rarities[i]); } } function _addRarity(Rarity memory _rarity) internal { uint256 rarityLength = bytes(_rarity.name).length; require(rarityLength > 0 && rarityLength <= 32, "Rarities#_addRarity: INVALID_LENGTH"); bytes32 rarityKey = keccak256(bytes(_rarity.name.toLowerCase())); require(rarityIndex[rarityKey] == 0, "Rarities#_addRarity: RARITY_ALREADY_ADDED"); rarities.push(_rarity); rarityIndex[rarityKey] = rarities.length; emit AddRarity(_rarity); } /** * @notice Returns the amount of item in the collection * @return Amount of items in the collection */ function raritiesCount() external view returns (uint256) { return rarities.length; } /** * @notice Returns a rarity * @dev will revert if the rarity is out of bounds * @return rarity for the given index */ function getRarityByName(string memory _rarity) public view returns (Rarity memory) { bytes32 rarityKey = keccak256(bytes(_rarity.toLowerCase())); uint256 index = rarityIndex[rarityKey]; require(rarityIndex[rarityKey] > 0, "Rarities#getRarityByName: INVALID_RARITY"); return rarities[index - 1]; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.7.6; pragma experimental ABIEncoderV2; interface ICollectionManager { function manageCollection(address _forwarder, address _collection, bytes calldata _data) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.7.6; import "./ContextMixin.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract OwnableInitializable is ContextMixin { address internal _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ function _initOwnable () 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(_owner == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { 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 virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.7.6; import {SafeMath} from "@openzeppelin/contracts/math/SafeMath.sol"; import { EIP712Base } from "./EIP712Base.sol"; contract NativeMetaTransaction is EIP712Base { using SafeMath for uint256; bytes32 private constant META_TRANSACTION_TYPEHASH = keccak256( bytes( "MetaTransaction(uint256 nonce,address from,bytes functionSignature)" ) ); event MetaTransactionExecuted( address userAddress, address relayerAddress, bytes functionSignature ); mapping(address => uint256) nonces; struct MetaTransaction { uint256 nonce; address from; bytes functionSignature; } function executeMetaTransaction( address userAddress, bytes memory functionSignature, bytes32 sigR, bytes32 sigS, uint8 sigV ) external payable returns (bytes memory) { MetaTransaction memory metaTx = MetaTransaction({ nonce: nonces[userAddress], from: userAddress, functionSignature: functionSignature }); require( verify(userAddress, metaTx, sigR, sigS, sigV), "NMT#executeMetaTransaction: SIGNER_AND_SIGNATURE_DO_NOT_MATCH" ); // increase nonce for user (to avoid re-use) nonces[userAddress] = nonces[userAddress].add(1); emit MetaTransactionExecuted( userAddress, msg.sender, functionSignature ); // Append userAddress and relayer address at the end to extract it from calling context (bool success, bytes memory returnData) = address(this).call{value: msg.value}( abi.encodePacked(functionSignature, userAddress) ); require(success, "NMT#executeMetaTransaction: CALL_FAILED"); return returnData; } function hashMetaTransaction(MetaTransaction memory metaTx) internal pure returns (bytes32) { return keccak256( abi.encode( META_TRANSACTION_TYPEHASH, metaTx.nonce, metaTx.from, keccak256(metaTx.functionSignature) ) ); } function getNonce(address user) external view returns (uint256 nonce) { nonce = nonces[user]; } function verify( address signer, MetaTransaction memory metaTx, bytes32 sigR, bytes32 sigS, uint8 sigV ) internal view returns (bool) { require(signer != address(0), "NMT#verify: INVALID_SIGNER"); return signer == ecrecover( toTypedMessageHash(hashMetaTransaction(metaTx)), sigV, sigR, sigS ); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.12; library String { /** * @dev Convert bytes32 to string. * @param _x - to be converted to string. * @return string */ function bytes32ToString(bytes32 _x) internal pure returns (string memory) { bytes memory bytesString = new bytes(32); uint charCount = 0; for (uint j = 0; j < 32; j++) { bytes1 currentChar = bytes1(bytes32(uint(_x) * 2 ** (8 * j))); if (currentChar != 0) { bytesString[charCount] = currentChar; charCount++; } } bytes memory bytesStringTrimmed = new bytes(charCount); for (uint j = 0; j < charCount; j++) { bytesStringTrimmed[j] = bytesString[j]; } return string(bytesStringTrimmed); } /** * @dev Convert uint to string. * @param _i - uint256 to be converted to string. * @return _uintAsString uint in string */ function uintToString(uint _i) internal pure returns (string memory _uintAsString) { uint i = _i; 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--] = bytes1(uint8(48 + i % 10)); i /= 10; } return string(bstr); } /** * @dev Convert an address to string. * @param _x - address to be converted to string. * @return string representation of the address */ function addressToString(address _x) internal pure returns (string memory) { bytes memory s = new bytes(40); for (uint i = 0; i < 20; i++) { bytes1 b = bytes1(uint8(uint160(_x) / (2**(8*(19 - i))))); bytes1 hi = bytes1(uint8(b) / 16); bytes1 lo = bytes1(uint8(b) - 16 * uint8(hi)); s[2*i] = char(hi); s[2*i+1] = char(lo); } return string(s); } function char(bytes1 b) internal pure returns (bytes1 c) { if (uint8(b) < 10) return bytes1(uint8(b) + 0x30); else return bytes1(uint8(b) + 0x57); } /** * @dev Lowercase a string. * @param _str - to be converted to string. * @return string */ function toLowerCase(string memory _str) internal pure returns (string memory) { bytes memory bStr = bytes(_str); bytes memory bLower = new bytes(bStr.length); for (uint i = 0; i < bStr.length; i++) { // Uppercase character... if ((bStr[i] >= 0x41) && (bStr[i] <= 0x5A)) { // So we add 0x20 to make it lowercase bLower[i] = bytes1(uint8(bStr[i]) + 0x20); } else { bLower[i] = bStr[i]; } } return string(bLower); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.7.6; abstract contract ContextMixin { function _msgSender() internal view virtual returns (address payable sender) { if (msg.sender == address(this)) { bytes memory array = msg.data; uint256 index = msg.data.length; assembly { // Load the 32 bytes word from memory with the address on the lower 20 bytes, and mask those. sender := and( mload(add(array, index)), 0xffffffffffffffffffffffffffffffffffffffff ) } } else { sender = msg.sender; } return sender; } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @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, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b > a) return (false, 0); return (true, a - b); } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, 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 (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a / b); } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a % b); } /** * @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) { require(b <= a, "SafeMath: subtraction overflow"); return a - b; } /** * @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) { 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, reverting 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) { require(b > 0, "SafeMath: division by zero"); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting 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) { require(b > 0, "SafeMath: modulo by zero"); return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * 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); return a - b; } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryDiv}. * * 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); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * 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; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.7.6; contract EIP712Base { struct EIP712Domain { string name; string version; address verifyingContract; bytes32 salt; } bytes32 internal constant EIP712_DOMAIN_TYPEHASH = keccak256( bytes( "EIP712Domain(string name,string version,address verifyingContract,bytes32 salt)" ) ); bytes32 public domainSeparator; // supposed to be called once while initializing. // one of the contractsa that inherits this contract follows proxy pattern // so it is not possible to do this in a constructor function _initializeEIP712( string memory name, string memory version ) internal { domainSeparator = keccak256( abi.encode( EIP712_DOMAIN_TYPEHASH, keccak256(bytes(name)), keccak256(bytes(version)), address(this), bytes32(getChainId()) ) ); } function getChainId() public pure returns (uint256) { uint256 id; assembly { id := chainid() } return id; } /** * Accept message hash and returns hash message in EIP712 compatible form * So that it can be used to recover signer from signature signed using EIP712 formatted data * https://eips.ethereum.org/EIPS/eip-712 * "\\x19" makes the encoding deterministic * "\\x01" is the version byte to make it compatible to EIP-191 */ function toTypedMessageHash(bytes32 messageHash) internal view returns (bytes32) { return keccak256( abi.encodePacked("\x19\x01", domainSeparator, messageHash) ); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.7.6; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/math/SafeMath.sol"; import "../../interfaces/IERC20.sol"; import "../../interfaces/IERC721CollectionV2.sol"; import "../../commons/OwnableInitializable.sol"; import "../../commons/NativeMetaTransaction.sol"; contract CollectionStore is OwnableInitializable, NativeMetaTransaction { using SafeMath for uint256; struct ItemToBuy { IERC721CollectionV2 collection; uint256[] ids; uint256[] prices; address[] beneficiaries; } uint256 constant public BASE_FEE = 1000000; IERC20 public acceptedToken; uint256 public fee; address public feeOwner; event Bought(ItemToBuy[] _itemsToBuy); event SetFee(uint256 _oldFee, uint256 _newFee); event SetFeeOwner(address indexed _oldFeeOwner, address indexed _newFeeOwner); /** * @notice Constructor of the contract. * @param _acceptedToken - Address of the ERC20 token accepted * @param _feeOwner - address where fees will be transferred * @param _fee - fee to charge for each sale */ constructor(address _owner, IERC20 _acceptedToken, address _feeOwner, uint256 _fee) { // EIP712 init _initializeEIP712('Decentraland Collection Store', '1'); // Ownable init _initOwnable(); acceptedToken = _acceptedToken; feeOwner = _feeOwner; setFee(_fee); transferOwnership(_owner); } /** * @notice Buy collection's items. * @dev There is a maximum amount of NFTs that can be issued per call by the block's limit. * @param _itemsToBuy - items to buy */ function buy(ItemToBuy[] memory _itemsToBuy) external { uint256 totalFee = 0; address sender = _msgSender(); for (uint256 i = 0; i < _itemsToBuy.length; i++) { ItemToBuy memory itemToBuy = _itemsToBuy[i]; IERC721CollectionV2 collection = itemToBuy.collection; uint256 amountOfItems = itemToBuy.ids.length; require(amountOfItems == itemToBuy.prices.length, "CollectionStore#buy: LENGTH_MISMATCH"); for (uint256 j = 0; j < amountOfItems; j++) { uint256 itemId = itemToBuy.ids[j]; uint256 price = itemToBuy.prices[j]; (uint256 itemPrice, address itemBeneficiary) = getItemBuyData(collection, itemId); require(price == itemPrice, "CollectionStore#buy: ITEM_PRICE_MISMATCH"); if (itemPrice > 0) { // Calculate sale share uint256 saleShareAmount = itemPrice.mul(fee).div(BASE_FEE); totalFee = totalFee.add(saleShareAmount); // Transfer sale amount to the item beneficiary require( acceptedToken.transferFrom(sender, itemBeneficiary, itemPrice.sub(saleShareAmount)), "CollectionStore#buy: TRANSFER_PRICE_FAILED" ); } } // Mint Token collection.issueTokens(itemToBuy.beneficiaries, itemToBuy.ids); } if (totalFee > 0) { // Transfer share amount for fees owner require( acceptedToken.transferFrom(sender, feeOwner, totalFee), "CollectionStore#buy: TRANSFER_FEES_FAILED" ); } emit Bought(_itemsToBuy); } /** * @notice Get item's price and beneficiary * @param _collection - collection address * @param _itemId - item id * @return uint256 of the item's price * @return address of the item's beneficiary */ function getItemBuyData(IERC721CollectionV2 _collection, uint256 _itemId) public view returns (uint256, address) { (,,,uint256 price, address beneficiary,,) = _collection.items(_itemId); return (price, beneficiary); } // Owner functions /** * @notice Sets the fee of the contract that's charged to the seller on each sale * @param _newFee - Fee from 0 to 999,999 */ function setFee(uint256 _newFee) public onlyOwner { require(_newFee < BASE_FEE, "CollectionStore#setFee: FEE_SHOULD_BE_LOWER_THAN_BASE_FEE"); require(_newFee != fee, "CollectionStore#setFee: SAME_FEE"); emit SetFee(fee, _newFee); fee = _newFee; } /** * @notice Set a new fee owner. * @param _newFeeOwner - Address of the new fee owner */ function setFeeOwner(address _newFeeOwner) external onlyOwner { require(_newFeeOwner != address(0), "CollectionStore#setFeeOwner: INVALID_ADDRESS"); require(_newFeeOwner != feeOwner, "CollectionStore#setFeeOwner: SAME_FEE_OWNER"); emit SetFeeOwner(feeOwner, _newFeeOwner); feeOwner = _newFeeOwner; } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.12; interface IERC20 { function balanceOf(address from) external view returns (uint256); function transferFrom(address from, address to, uint tokens) external returns (bool); function transfer(address to, uint tokens) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function burn(uint256 amount) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.7.6; pragma experimental ABIEncoderV2; interface IERC721CollectionV2 { function COLLECTION_HASH() external view returns (bytes32); struct ItemParam { string rarity; uint256 price; address beneficiary; string metadata; } function issueTokens(address[] calldata _beneficiaries, uint256[] calldata _itemIds) external; function setApproved(bool _value) external; /// @dev For some reason using the Struct Item as an output parameter fails, but works as an input parameter function initialize( string memory _name, string memory _symbol, string memory _baseURI, address _creator, bool _shouldComplete, bool _isApproved, address _rarities, ItemParam[] memory _items ) external; function items(uint256 _itemId) external view returns (string memory, uint256, uint256, uint256, address, string memory, string memory); }
// SPDX-License-Identifier: MIT pragma solidity ^0.7.6; pragma experimental ABIEncoderV2; import "../markets/v2/CollectionStore.sol"; interface EventsInterface { event Issue(address indexed _beneficiary, uint256 indexed _tokenId, uint256 indexed _itemId, uint256 _issuedId, address _caller); event Transfer(address indexed _from, address indexed _to, uint256 _value); } contract DummyCollectionStore is EventsInterface, CollectionStore { constructor ( address _owner, IERC20 _acceptedToken, address _feeOwner, uint256 _fee ) CollectionStore(_owner, _acceptedToken, _feeOwner, _fee) {} }
// SPDX-License-Identifier: MIT pragma solidity ^0.7.6; import "../interfaces/ICollectionManager.sol"; import "../commons/OwnableInitializable.sol"; import "../commons/NativeMetaTransaction.sol"; contract Committee is OwnableInitializable, NativeMetaTransaction { mapping(address => bool) public members; event MemberSet(address indexed _member, bool _value); /** * @notice Create the contract * @param _owner - owner of the contract * @param _members - members to be added at contract creation */ constructor(address _owner, address[] memory _members) { // EIP712 init _initializeEIP712('Decentraland Collection Committee', '1'); // Ownable init _initOwnable(); transferOwnership(_owner); for (uint256 i = 0; i < _members.length; i++) { _setMember(_members[i], true); } } /** * @notice Set members * @param _members - members to be added * @param _values - whether the members should be added or removed */ function setMembers(address[] calldata _members, bool[] calldata _values) external onlyOwner { require(_members.length == _values.length, "Committee#setMembers: LENGTH_MISMATCH"); for (uint256 i = 0; i < _members.length; i++) { _setMember(_members[i], _values[i]); } } /** * @notice Set members * @param _member - member to be added * @param _value - whether the member should be added or removed */ function _setMember(address _member, bool _value) internal { members[_member] = _value; emit MemberSet(_member, _value); } /** * @notice Manage collection * @param _collectionManager - collection manager * @param _forwarder - forwarder contract owner of the collection * @param _collection - collection to be managed * @param _data - call data to be used */ function manageCollection(ICollectionManager _collectionManager, address _forwarder, address _collection, bytes memory _data) external { require(members[_msgSender()], "Committee#manageCollection: UNAUTHORIZED_SENDER"); _collectionManager.manageCollection(_forwarder, _collection, _data); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.7.6; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/math/SafeMath.sol"; import "../interfaces/IForwarder.sol"; import "../interfaces/IERC20.sol"; import "../interfaces/IERC721CollectionV2.sol"; import "../interfaces/IERC721CollectionFactoryV2.sol"; import "../interfaces/IRarities.sol"; import "../commons/OwnableInitializable.sol"; import "../commons/NativeMetaTransaction.sol"; contract CollectionManager is OwnableInitializable, NativeMetaTransaction { using SafeMath for uint256; IERC20 public acceptedToken; IRarities public rarities; address public committee; address public feesCollector; uint256 public pricePerItem; mapping(bytes4 => bool) public allowedCommitteeMethods; event AcceptedTokenSet(IERC20 indexed _oldAcceptedToken, IERC20 indexed _newAcceptedToken); event CommitteeSet(address indexed _oldCommittee, address indexed _newCommittee); event CommitteeMethodSet(bytes4 indexed _method, bool _isAllowed); event FeesCollectorSet(address indexed _oldFeesCollector, address indexed _newFeesCollector); event RaritiesSet(IRarities indexed _oldRarities, IRarities indexed _newRarities); /** * @notice Create the contract * @param _owner - owner of the contract * @param _acceptedToken - accepted ERC20 token for collection deployment * @param _committee - committee contract * @param _feesCollector - fees collector * @param _rarities - rarities contract * @param _committeeMethods - method selectors * @param _committeeValues - whether the method is allowed or not */ constructor( address _owner, IERC20 _acceptedToken, address _committee, address _feesCollector, IRarities _rarities, bytes4[] memory _committeeMethods, bool[] memory _committeeValues ) { // EIP712 init _initializeEIP712('Decentraland Collection Manager', '1'); // Ownable init _initOwnable(); setAcceptedToken(_acceptedToken); // Committee setCommittee(_committee); setCommitteeMethods(_committeeMethods, _committeeValues); setFeesCollector(_feesCollector); setRarities(_rarities); transferOwnership(_owner); } /** * @notice Set the accepted token * @param _newAcceptedToken - accepted ERC20 token for collection deployment */ function setAcceptedToken(IERC20 _newAcceptedToken) onlyOwner public { require(address(_newAcceptedToken) != address(0), "CollectionManager#setAcceptedToken: INVALID_ACCEPTED_TOKEN"); emit AcceptedTokenSet(acceptedToken, _newAcceptedToken); acceptedToken = _newAcceptedToken; } /** * @notice Set the committee * @param _newCommittee - committee contract */ function setCommittee(address _newCommittee) onlyOwner public { require(_newCommittee != address(0), "CollectionManager#setCommittee: INVALID_COMMITTEE"); emit CommitteeSet(committee, _newCommittee); committee = _newCommittee; } /** * @notice Set methods to be allowed by the committee * @param _methods - method selectors * @param _values - whether the method is allowed or not */ function setCommitteeMethods(bytes4[] memory _methods, bool[] memory _values) onlyOwner public { uint256 length = _methods.length; require(length > 0 && length == _values.length, "CollectionManager#setCommitteeMethods: EMPTY_METHODS"); for (uint256 i = 0; i < length; i++) { bytes4 method = _methods[i]; bool value = _values[i]; allowedCommitteeMethods[method] = value; emit CommitteeMethodSet(method, value); } } /** * @notice Set the fees collector * @param _newFeesCollector - fees collector */ function setFeesCollector(address _newFeesCollector) onlyOwner public { require(_newFeesCollector != address(0), "CollectionManager#setFeesCollector: INVALID_FEES_COLLECTOR"); emit FeesCollectorSet(feesCollector, _newFeesCollector); feesCollector = _newFeesCollector; } /** * @notice Set the rarities * @param _newRarities - price per item */ function setRarities(IRarities _newRarities) onlyOwner public { require(address(_newRarities) != address(0), "CollectionManager#setRarities: INVALID_RARITIES"); emit RaritiesSet(rarities, _newRarities); rarities = _newRarities; } /** * @notice Create a collection * @param _forwarder - forwarder contract owner of the collection factory * @param _factory - collection factory * @param _salt - arbitrary 32 bytes hexa * @param _name - name of the contract * @param _symbol - symbol of the contract * @param _baseURI - base URI for token URIs * @param _creator - creator address * @param _items - items to be added */ function createCollection( IForwarder _forwarder, IERC721CollectionFactoryV2 _factory, bytes32 _salt, string memory _name, string memory _symbol, string memory _baseURI, address _creator, IERC721CollectionV2.ItemParam[] memory _items ) external { require(address(_forwarder) != address(this), "CollectionManager#createCollection: FORWARDER_CANT_BE_THIS"); uint256 amount = 0; for (uint256 i = 0; i < _items.length; i++) { IERC721CollectionV2.ItemParam memory item = _items[i]; IRarities.Rarity memory rarity = rarities.getRarityByName(item.rarity); amount = amount.add(rarity.price); } // Transfer fees to collector if (amount > 0) { require( acceptedToken.transferFrom(_msgSender(), feesCollector, amount), "CollectionManager#createCollection: TRANSFER_FEES_FAILED" ); } bytes memory data = abi.encodeWithSelector( IERC721CollectionV2.initialize.selector, _name, _symbol, _baseURI, _creator, true, // Collection should be completed false, // Collection should start disapproved rarities, _items ); (bool success,) = _forwarder.forwardCall(address(_factory), abi.encodeWithSelector(_factory.createCollection.selector, _salt, data)); require( success, "CollectionManager#createCollection: FORWARD_FAILED" ); } /** * @notice Manage a collection * @param _forwarder - forwarder contract owner of the collection factory * @param _collection - collection to be managed * @param _data - call data to be used */ function manageCollection(IForwarder _forwarder, IERC721CollectionV2 _collection, bytes calldata _data) external { require(address(_forwarder) != address(this), "CollectionManager#manageCollection: FORWARDER_CANT_BE_THIS"); require( _msgSender() == committee, "CollectionManager#manageCollection: UNAUTHORIZED_SENDER" ); (bytes4 method) = abi.decode(_data, (bytes4)); require(allowedCommitteeMethods[method], "CollectionManager#manageCollection: COMMITTEE_METHOD_NOT_ALLOWED"); bool success; bytes memory res; (success, res) = address(_collection).staticcall(abi.encodeWithSelector(_collection.COLLECTION_HASH.selector)); require( success && abi.decode(res, (bytes32)) == keccak256("Decentraland Collection"), "CollectionManager#manageCollection: INVALID_COLLECTION" ); (success,) = _forwarder.forwardCall(address(_collection), _data); require( success, "CollectionManager#manageCollection: FORWARD_FAILED" ); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.7.6; interface IForwarder { function forwardCall(address _address, bytes calldata _data) external returns (bool, bytes memory); }
// SPDX-License-Identifier: MIT pragma solidity ^0.7.6; pragma experimental ABIEncoderV2; interface IERC721CollectionFactoryV2 { function createCollection(bytes32 _salt, bytes memory _data) external returns (address addr); function transferOwnership(address newOwner) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.7.6; pragma experimental ABIEncoderV2; interface IRarities { struct Rarity { string name; uint256 maxSupply; uint256 price; } function getRarityByName(string calldata rarity) external view returns (Rarity memory); }
// SPDX-License-Identifier: MIT pragma solidity ^0.7.6; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/math/SafeMath.sol"; import "../../interfaces/IRarities.sol"; import "../../commons//OwnableInitializable.sol"; import "../../commons//NativeMetaTransaction.sol"; import "../../tokens/ERC721Initializable.sol"; import "../../libs/String.sol"; abstract contract ERC721BaseCollectionV2 is OwnableInitializable, ERC721Initializable, NativeMetaTransaction { using String for bytes32; using String for uint256; using String for address; using SafeMath for uint256; bytes32 constant public COLLECTION_HASH = keccak256("Decentraland Collection"); uint8 constant public ITEM_ID_BITS = 40; uint8 constant public ISSUED_ID_BITS = 216; uint40 constant public MAX_ITEM_ID = type(uint40).max; uint216 constant public MAX_ISSUED_ID = type(uint216).max; bytes32 constant internal EMPTY_CONTENT = bytes32(0); struct ItemParam { string rarity; uint256 price; address beneficiary; string metadata; } struct Item { string rarity; uint256 maxSupply; // max supply uint256 totalSupply; // current supply uint256 price; address beneficiary; string metadata; string contentHash; // used for safe purposes } IRarities public rarities; // Roles address public creator; mapping(address => bool) public globalMinters; mapping(address => bool) public globalManagers; mapping(uint256 => mapping (address => uint256)) public itemMinters; mapping(uint256 => mapping (address => bool)) public itemManagers; Item[] public items; // Status uint256 public createdAt; bool public isInitialized; bool public isCompleted; bool public isEditable; bool public isApproved; event BaseURI(string _oldBaseURI, string _newBaseURI); event SetGlobalMinter(address indexed _minter, bool _value); event SetGlobalManager(address indexed _manager, bool _value); event SetItemMinter(uint256 indexed _itemId, address indexed _minter, uint256 _value); event SetItemManager(uint256 indexed _itemId, address indexed _manager, bool _value); event AddItem(uint256 indexed _itemId, Item _item); event RescueItem(uint256 indexed _itemId, string _contentHash, string _metadata); event Issue(address indexed _beneficiary, uint256 indexed _tokenId, uint256 indexed _itemId, uint256 _issuedId, address _caller); event UpdateItemData(uint256 indexed _itemId, uint256 _price, address _beneficiary, string _metadata); event CreatorshipTransferred(address indexed _previousCreator, address indexed _newCreator); event SetApproved(bool _previousValue, bool _newValue); event SetEditable(bool _previousValue, bool _newValue); event Complete(); /* * Init functions */ /** * @notice Init the contract */ function initImplementation() public { require(!isInitialized, "initialize: ALREADY_INITIALIZED"); isInitialized = true; } /** * @notice Create the contract * @param _name - name of the contract * @param _symbol - symbol of the contract * @param _baseURI - base URI for token URIs * @param _creator - creator address * @param _shouldComplete - Whether the collection should be completed by the end of this call * @param _isApproved - Whether the collection should be approved by the end of this call * @param _rarities - rarities address * @param _items - items to be added */ function initialize( string memory _name, string memory _symbol, string memory _baseURI, address _creator, bool _shouldComplete, bool _isApproved, IRarities _rarities, ItemParam[] memory _items ) external virtual { initImplementation(); require(_creator != address(0), "initialize: INVALID_CREATOR"); require(address(_rarities) != address(0), "initialize: INVALID_RARITIES"); // Ownable init _initOwnable(); // EIP712 init _initializeEIP712('Decentraland Collection', '2'); // ERC721 init _initERC721(_name, _symbol); // Base URI init setBaseURI(_baseURI); // Creator init creator = _creator; // Rarities init rarities = _rarities; // Items init _addItems(_items); if (_shouldComplete) { _completeCollection(); } isApproved = _isApproved; isEditable = true; createdAt = block.timestamp; } /* * Roles checkers */ function _isCreator() internal view returns (bool) { return creator == _msgSender(); } function _isManager(uint256 _itemId) internal view returns (bool) { address sender = _msgSender(); return globalManagers[sender] || itemManagers[_itemId][sender]; } modifier onlyCreator() { require( _isCreator(), "onlyCreator: CALLER_IS_NOT_CREATOR" ); _; } /* * Role functions */ /** * @notice Set allowed account to manage items. * @param _minters - minter addresses * @param _values - values array */ function setMinters(address[] calldata _minters, bool[] calldata _values) external onlyCreator { require( _minters.length == _values.length, "setMinters: LENGTH_MISMATCH" ); for (uint256 i = 0; i < _minters.length; i++) { address minter = _minters[i]; bool value = _values[i]; require(minter != address(0), "setMinters: INVALID_MINTER_ADDRESS"); require(globalMinters[minter] != value, "setMinters: VALUE_IS_THE_SAME"); globalMinters[minter] = value; emit SetGlobalMinter(minter, value); } } /** * @notice Set allowed account to mint items. * @param _itemIds - item ids * @param _minters - minter addresses * @param _values - values array */ function setItemsMinters( uint256[] calldata _itemIds, address[] calldata _minters, uint256[] calldata _values ) external onlyCreator { require( _itemIds.length == _minters.length && _minters.length == _values.length, "setItemsMinters: LENGTH_MISMATCH" ); for (uint256 i = 0; i < _minters.length; i++) { address minter = _minters[i]; uint256 itemId = _itemIds[i]; uint256 value = _values[i]; require(minter != address(0), "setItemsMinters: INVALID_MINTER_ADDRESS"); require(itemId < items.length, "setItemsMinters: ITEM_DOES_NOT_EXIST"); require(itemMinters[itemId][minter] != value, "setItemsMinters: VALUE_IS_THE_SAME"); itemMinters[itemId][minter] = value; emit SetItemMinter(itemId, minter, value); } } /** * @notice Set allowed account to manage items. * @param _managers - Address allowed to manage items * @param _values - Whether is allowed or not */ function setManagers(address[] calldata _managers, bool[] calldata _values) external onlyCreator { require( _managers.length == _values.length, "setManagers: LENGTH_MISMATCH" ); for (uint256 i = 0; i < _managers.length; i++) { address manager = _managers[i]; bool value = _values[i]; require(manager != address(0), "setManagers: INVALID_MANAGER_ADDRESS"); require(globalManagers[manager] != value, "setManagers: VALUE_IS_THE_SAME"); globalManagers[manager] = value; emit SetGlobalManager(manager, value); } } /** * @notice Set allowed account to manage items. * @param _itemIds - item ids to set managers * @param _managers - Addresses allowed to manage items * @param _values - Whether is allowed or not */ function setItemsManagers( uint256[] calldata _itemIds, address[] calldata _managers, bool[] calldata _values ) external onlyCreator { require( _itemIds.length == _managers.length && _managers.length == _values.length, "setItemsManagers: LENGTH_MISMATCH" ); for (uint256 i = 0; i < _managers.length; i++) { address manager = _managers[i]; uint256 itemId = _itemIds[i]; bool value = _values[i]; require(manager != address(0), "setItemsManagers: INVALID_MANAGER_ADDRESS"); require(itemId < items.length, "setItemsManagers: ITEM_DOES_NOT_EXIST"); require(itemManagers[itemId][manager] != value, "setItemsManagers: VALUE_IS_THE_SAME"); itemManagers[itemId][manager] = value; emit SetItemManager(itemId, manager, value); } } /** * @notice Transfers ownership of the contract to a new account (`newOwner`). * @dev Forced owner to check against msg.sender always */ function transferCreatorship(address _newCreator) external virtual { address sender = _msgSender(); require(sender == owner() || sender == creator, "transferCreatorship: CALLER_IS_NOT_OWNER_OR_CREATOR"); require(_newCreator != address(0), "transferCreatorship: INVALID_CREATOR_ADDRESS"); emit CreatorshipTransferred(creator, _newCreator); creator = _newCreator; } /* * Items functions */ /** * @notice Add items to the collection. * @param _items - items to add */ function addItems(ItemParam[] memory _items) external virtual onlyOwner { require(!isCompleted, "_addItem: COLLECTION_COMPLETED"); _addItems(_items); } /** * @notice Edit items * @param _itemIds - items ids to edit * @param _prices - new prices * @param _beneficiaries - new beneficiaries */ function editItemsData( uint256[] calldata _itemIds, uint256[] calldata _prices, address[] calldata _beneficiaries, string[] calldata _metadatas ) external virtual { // Check lengths require( _itemIds.length == _prices.length && _prices.length == _beneficiaries.length && _beneficiaries.length == _metadatas.length, "editItemsData: LENGTH_MISMATCH" ); require( isEditable, "editItemsData: COLLECTION_NOT_EDITABLE" ); // Check item id for (uint256 i = 0; i < _itemIds.length; i++) { uint256 itemId = _itemIds[i]; uint256 price = _prices[i]; address beneficiary = _beneficiaries[i]; string memory metadata = _metadatas[i]; require(_isCreator() || _isManager(itemId), "editItemsData: CALLER_IS_NOT_CREATOR_OR_MANAGER"); require(itemId < items.length, "editItemsData: ITEM_DOES_NOT_EXIST"); require( price > 0 && beneficiary != address(0) || price == 0 && beneficiary == address(0), "editItemsData: INVALID_PRICE_AND_BENEFICIARY" ); require(bytes(metadata).length > 0, "editItemsData: EMPTY_METADATA"); Item storage item = items[itemId]; require( !isApproved || keccak256(abi.encode(item.metadata)) == keccak256(abi.encode(metadata)), "editItemsData: CAN_NOT_EDIT_METADATA" ); item.price = price; item.beneficiary = beneficiary; item.metadata = metadata; emit UpdateItemData(itemId, price, beneficiary, metadata); } } /** * @notice Add new items to the collection. * @dev The item should follow: * rarity: should be one of the RARITY enum * totalSupply: starts in 0 * metadata: shouldn't be empty * price & beneficiary: is the price is > 0, a beneficiary should be passed. If not, price and * beneficiary should be empty. * contentHash: starts empty * @param _items - items to add */ function _addItems(ItemParam[] memory _items) internal { require(_items.length > 0, "_addItems: EMPTY_ITEMS"); IRarities.Rarity memory rarity; bytes32 lastRarityKey; for (uint256 i = 0; i < _items.length; i++) { ItemParam memory _item = _items[i]; bytes32 rarityKey = keccak256(bytes(_item.rarity)); if (lastRarityKey != rarityKey) { rarity = rarities.getRarityByName(_item.rarity); lastRarityKey = rarityKey; require( rarity.maxSupply > 0 && rarity.maxSupply <= MAX_ISSUED_ID, "_addItem: INVALID_RARITY" ); } require(bytes(_item.metadata).length > 0, "_addItem: EMPTY_METADATA"); require( _item.price > 0 && _item.beneficiary != address(0) || _item.price == 0 && _item.beneficiary == address(0), "_addItem: INVALID_PRICE_AND_BENEFICIARY" ); uint256 newItemId = items.length; require(newItemId < MAX_ITEM_ID, "_addItem: MAX_ITEM_ID_REACHED"); Item memory item = Item({ rarity: rarity.name, maxSupply: rarity.maxSupply, totalSupply: 0, price: _item.price, beneficiary: _item.beneficiary, metadata: _item.metadata, contentHash: '' }); items.push(item); emit AddItem(newItemId, item); } } /** * @notice Issue tokens by item ids. * @dev Will throw if the items have reached its maximum or is invalid * @param _beneficiaries - owner of the tokens * @param _itemIds - item ids */ function issueTokens(address[] calldata _beneficiaries, uint256[] calldata _itemIds) external virtual { require(isMintingAllowed(), "issueTokens: MINT_NOT_ALLOWED"); require(_beneficiaries.length == _itemIds.length, "issueTokens: LENGTH_MISMATCH"); address sender = _msgSender(); for (uint256 i = 0; i < _itemIds.length; i++) { _issueToken(_beneficiaries[i], _itemIds[i], sender); } } /** * @notice Issue a new token of the specified item. * @dev Will throw if the item has reached its maximum or is invalid * @param _beneficiary - owner of the token * @param _itemId - item id * @param _sender - transaction sender */ function _issueToken(address _beneficiary, uint256 _itemId, address _sender) internal virtual { if (!(_isCreator() || globalMinters[_sender])) { uint256 allowance = itemMinters[_itemId][_sender]; require(allowance > 0, "_issueToken: CALLER_CAN_NOT_MINT"); if (allowance != type(uint256).max) { itemMinters[_itemId][_sender]--; } } // Check item id require(_itemId < items.length, "_issueToken: ITEM_DOES_NOT_EXIST"); Item storage item = items[_itemId]; uint256 currentIssuance = item.totalSupply.add(1); // Check issuance require(currentIssuance <= item.maxSupply, "_issueToken: ITEM_EXHAUSTED"); // Encode token id uint256 tokenId = encodeTokenId(_itemId, currentIssuance); // Increase issuance item.totalSupply = currentIssuance; // Mint token to beneficiary super._mint(_beneficiary, tokenId); // Log emit Issue(_beneficiary, tokenId, _itemId, currentIssuance, _sender); } /** * @notice Rescue an item by providing new metadata and/or content hash * @dev Only the owner can rescue an item. This function should be used * to resolve a dispute or fix a broken metadata or hashContent item * @param _itemIds - Item ids to be fixed * @param _contentHashes - New items content hash * @param _metadatas - New items metadata */ function rescueItems( uint256[] calldata _itemIds, string[] calldata _contentHashes, string[] calldata _metadatas ) external onlyOwner { // Check lengths require( _itemIds.length == _contentHashes.length && _contentHashes.length == _metadatas.length, "rescueItems: LENGTH_MISMATCH" ); for (uint256 i = 0; i < _itemIds.length; i++) { uint256 itemId = _itemIds[i]; require(itemId < items.length, "rescueItems: ITEM_DOES_NOT_EXIST"); Item storage item = items[itemId]; string memory contentHash = _contentHashes[i]; string memory metadata = _metadatas[i]; item.contentHash = contentHash; if (bytes(metadata).length > 0) { item.metadata = metadata; } emit RescueItem(itemId, contentHash, item.metadata); } } /** * @notice Returns the amount of item in the collection * @return Amount of items in the collection */ function itemsCount() external view returns (uint256) { return items.length; } /* * Status functions */ /** * @notice Get whether minting is allowed * @return boolean whether minting is allowed or not */ function isMintingAllowed() public view returns (bool) { return isCompleted && isApproved; } /** * @notice Complete the collection. * @dev Disable forever the possibility of adding new items in the collection. * The issuance is still allowed. */ function completeCollection() external onlyCreator { require(!isCompleted, "completeCollection: COLLECTION_ALREADY_COMPLETED"); _completeCollection(); } /** * @notice Complete the collection. * @dev Internal. Disable forever the possibility of adding new items in the collection. * The issuance is still allowed. */ function _completeCollection() internal { isCompleted = true; emit Complete(); } /** * @notice Approve a collection */ function setApproved(bool _value) external virtual onlyOwner { require(isApproved != _value, "setApproved: VALUE_IS_THE_SAME"); emit SetApproved(isApproved, _value); isApproved = _value; } /** * @notice Set whether the collection can be editable or not. * @dev This property is used off-chain to check whether the items of the collection * can be updated or not * @param _value - Value to set */ function setEditable(bool _value) external onlyOwner { require(isEditable != _value, "setEditable: VALUE_IS_THE_SAME"); emit SetEditable(isEditable, _value); isEditable = _value; } /* * URI functions */ /** * @notice Set Base URI * @param _baseURI - base URI for token URIs */ function setBaseURI(string memory _baseURI) public onlyOwner { emit BaseURI(baseURI(), _baseURI); _setBaseURI(_baseURI); } /** * @notice Returns an URI for a given token ID. * Throws if the token ID does not exist. May return an empty string. * @param _tokenId - uint256 ID of the token queried * @return token URI */ function tokenURI(uint256 _tokenId) public view virtual override returns (string memory) { require(_exists(_tokenId), "tokenURI: INVALID_TOKEN_ID"); (uint256 itemId, uint256 issuedId) = decodeTokenId(_tokenId); uint256 id; assembly { id := chainid() } return string( abi.encodePacked( baseURI(), id.uintToString(), "/", "0x", address(this).addressToString(), "/", itemId.uintToString(), "/", issuedId.uintToString() ) ); } /* * Batch Transfer functions */ /** * @notice Transfers the ownership of given tokens ID to another address. * Usage of this method is discouraged, use {safeBatchTransferFrom} whenever possible. * Requires the msg.sender to be the owner, approved, or operator. * @param _from current owner of the token * @param _to address to receive the ownership of the given token ID * @param _tokenIds uint256 ID of the token to be transferred */ function batchTransferFrom(address _from, address _to, uint256[] calldata _tokenIds) external { for (uint256 i = 0; i < _tokenIds.length; i++) { transferFrom(_from, _to, _tokenIds[i]); } } /** * @notice Safely transfers the ownership of given token IDs to another address * If the target address is a contract, it must implement {IERC721Receiver-onERC721Received}, * which is called upon a safe transfer, and return the magic value * `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`; otherwise, * the transfer is reverted. * Requires the msg.sender to be the owner, approved, or operator * @param _from - current owner of the token * @param _to - address to receive the ownership of the given token ID * @param _tokenIds - uint256 ID of the tokens to be transferred * @param _data bytes data to send along with a safe transfer check */ function safeBatchTransferFrom(address _from, address _to, uint256[] memory _tokenIds, bytes memory _data) external { for (uint256 i = 0; i < _tokenIds.length; i++) { safeTransferFrom(_from, _to, _tokenIds[i], _data); } } /* * Token Utils functions */ /** * @notice Encode token id * @dev itemId (`itemIdBits` bits) + issuedId (`issuedIdBits` bits) * @param _itemId - item id * @param _issuedId - issued id * @return id uint256 of the encoded id */ function encodeTokenId(uint256 _itemId, uint256 _issuedId) public pure returns (uint256 id) { require(_itemId <= MAX_ITEM_ID, "encodeTokenId: INVALID_ITEM_ID"); require(_issuedId <= MAX_ISSUED_ID, "encodeTokenId: INVALID_ISSUED_ID"); // solium-disable-next-line security/no-inline-assembly assembly { id := or(shl(ISSUED_ID_BITS, _itemId), _issuedId) } } /** * @notice Decode token id * @dev itemId (`itemIdBits` bits) + issuedId (`issuedIdBits` bits) * @param _id - token id * @return itemId uint256 of the item id * @return issuedId uint256 of the issued id */ function decodeTokenId(uint256 _id) public pure returns (uint256 itemId, uint256 issuedId) { uint256 mask = MAX_ISSUED_ID; // solium-disable-next-line security/no-inline-assembly assembly { itemId := shr(ISSUED_ID_BITS, _id) issuedId := and(mask, _id) } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.7.6; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721Metadata.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721Enumerable.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol"; import "@openzeppelin/contracts/introspection/ERC165.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/utils/EnumerableSet.sol"; import "@openzeppelin/contracts/utils/EnumerableMap.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "../commons/ContextMixin.sol"; /** * @title ERC721 Non-Fungible Token Standard basic implementation * This is the same contract at `openzeppelin/contracts 3.1.0` but `tokenURI` was changed to virtual override * @dev see https://eips.ethereum.org/EIPS/eip-721 */ abstract contract ERC721Initializable is ContextMixin, ERC165, IERC721, IERC721Metadata, IERC721Enumerable { using SafeMath for uint256; using Address for address; using EnumerableSet for EnumerableSet.UintSet; using EnumerableMap for EnumerableMap.UintToAddressMap; using Strings for uint256; // Equals to `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))` // which can be also obtained as `IERC721Receiver(0).onERC721Received.selector` bytes4 private constant _ERC721_RECEIVED = 0x150b7a02; // Mapping from holder address to their (enumerable) set of owned tokens mapping (address => EnumerableSet.UintSet) private _holderTokens; // Enumerable mapping from token ids to their owners EnumerableMap.UintToAddressMap private _tokenOwners; // Mapping from token ID to approved address mapping (uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping (address => mapping (address => bool)) private _operatorApprovals; // Token name string private _name; // Token symbol string private _symbol; // Optional mapping for token URIs mapping(uint256 => string) private _tokenURIs; // Base URI string private _baseURI; /* * bytes4(keccak256('balanceOf(address)')) == 0x70a08231 * bytes4(keccak256('ownerOf(uint256)')) == 0x6352211e * bytes4(keccak256('approve(address,uint256)')) == 0x095ea7b3 * bytes4(keccak256('getApproved(uint256)')) == 0x081812fc * bytes4(keccak256('setApprovalForAll(address,bool)')) == 0xa22cb465 * bytes4(keccak256('isApprovedForAll(address,address)')) == 0xe985e9c5 * bytes4(keccak256('transferFrom(address,address,uint256)')) == 0x23b872dd * bytes4(keccak256('safeTransferFrom(address,address,uint256)')) == 0x42842e0e * bytes4(keccak256('safeTransferFrom(address,address,uint256,bytes)')) == 0xb88d4fde * * => 0x70a08231 ^ 0x6352211e ^ 0x095ea7b3 ^ 0x081812fc ^ * 0xa22cb465 ^ 0xe985e9c ^ 0x23b872dd ^ 0x42842e0e ^ 0xb88d4fde == 0x80ac58cd */ bytes4 private constant _INTERFACE_ID_ERC721 = 0x80ac58cd; /* * bytes4(keccak256('name()')) == 0x06fdde03 * bytes4(keccak256('symbol()')) == 0x95d89b41 * bytes4(keccak256('tokenURI(uint256)')) == 0xc87b56dd * * => 0x06fdde03 ^ 0x95d89b41 ^ 0xc87b56dd == 0x5b5e139f */ bytes4 private constant _INTERFACE_ID_ERC721_METADATA = 0x5b5e139f; /* * bytes4(keccak256('totalSupply()')) == 0x18160ddd * bytes4(keccak256('tokenOfOwnerByIndex(address,uint256)')) == 0x2f745c59 * bytes4(keccak256('tokenByIndex(uint256)')) == 0x4f6ccce7 * * => 0x18160ddd ^ 0x2f745c59 ^ 0x4f6ccce7 == 0x780e9d63 */ bytes4 private constant _INTERFACE_ID_ERC721_ENUMERABLE = 0x780e9d63; constructor() {} /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ function _initERC721(string memory __name, string memory __symbol) internal { _name = __name; _symbol = __symbol; // register the supported interfaces to conform to ERC721 via ERC165 _registerInterface(_INTERFACE_ID_ERC721); _registerInterface(_INTERFACE_ID_ERC721_METADATA); _registerInterface(_INTERFACE_ID_ERC721_ENUMERABLE); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _holderTokens[owner].length(); } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view override returns (address) { return _tokenOwners.get(tokenId, "ERC721: owner query for nonexistent token"); } /** * @dev See {IERC721Metadata-name}. */ function name() public view override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory _tokenURI = _tokenURIs[tokenId]; // If there is no base URI, return the token URI. if (bytes(_baseURI).length == 0) { return _tokenURI; } // If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked). if (bytes(_tokenURI).length > 0) { return string(abi.encodePacked(_baseURI, _tokenURI)); } // If there is a baseURI but no tokenURI, concatenate the tokenID to the baseURI. return string(abi.encodePacked(_baseURI, tokenId.toString())); } /** * @dev Returns the base URI set via {_setBaseURI}. This will be * automatically added as a prefix in {tokenURI} to each token's URI, or * to the token ID if no specific URI is set for that token ID. */ function baseURI() public view returns (string memory) { return _baseURI; } /** * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view override returns (uint256) { return _holderTokens[owner].at(index); } /** * @dev See {IERC721Enumerable-totalSupply}. */ function totalSupply() public view override returns (uint256) { // _tokenOwners are indexed by tokenIds, so .length() returns the number of tokenIds return _tokenOwners.length(); } /** * @dev See {IERC721Enumerable-tokenByIndex}. */ function tokenByIndex(uint256 index) public view override returns (uint256) { (uint256 tokenId, ) = _tokenOwners.at(index); return tokenId; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require(_msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { require(operator != _msgSender(), "ERC721: approve to caller"); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom(address from, address to, uint256 tokenId) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory _data) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mecanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer(address from, address to, uint256 tokenId, bytes memory _data) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view returns (bool) { return _tokenOwners.contains(tokenId); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: d* * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint(address to, uint256 tokenId, bytes memory _data) internal virtual { _mint(to, tokenId); require(_checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _holderTokens[to].add(tokenId); _tokenOwners.set(tokenId, to); emit Transfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); // Clear metadata (if any) if (bytes(_tokenURIs[tokenId]).length != 0) { delete _tokenURIs[tokenId]; } _holderTokens[owner].remove(tokenId); _tokenOwners.remove(tokenId); emit Transfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer(address from, address to, uint256 tokenId) internal virtual { require(ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _holderTokens[from].remove(tokenId); _holderTokens[to].add(tokenId); _tokenOwners.set(tokenId, to); emit Transfer(from, to, tokenId); } /** * @dev Sets `_tokenURI` as the tokenURI of `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual { require(_exists(tokenId), "ERC721Metadata: URI set of nonexistent token"); _tokenURIs[tokenId] = _tokenURI; } /** * @dev Internal function to set the base URI for all token IDs. It is * automatically added as a prefix to the value returned in {tokenURI}, * or to the token ID if {tokenURI} is empty. */ function _setBaseURI(string memory baseURI_) internal virtual { _baseURI = baseURI_; } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory _data) private returns (bool) { if (!to.isContract()) { return true; } bytes memory returndata = to.functionCall(abi.encodeWithSelector( IERC721Receiver(to).onERC721Received.selector, _msgSender(), from, tokenId, _data ), "ERC721: transfer to non ERC721Receiver implementer"); bytes4 retval = abi.decode(returndata, (bytes4)); return (retval == _ERC721_RECEIVED); } function _approve(address to, uint256 tokenId) private { _tokenApprovals[tokenId] = to; emit Approval(ownerOf(tokenId), to, tokenId); } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` cannot be the zero address. * - `to` cannot be the zero address. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal virtual { } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.2 <0.8.0; import "../../introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom(address from, address to, uint256 tokenId) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 tokenId) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external; }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.2 <0.8.0; import "./IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.2 <0.8.0; import "./IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Enumerable is IERC721 { /** * @dev Returns the total amount of tokens stored by the contract. */ function totalSupply() external view returns (uint256); /** * @dev Returns a token ID owned by `owner` at a given `index` of its token list. * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSupply} to enumerate all tokens. */ function tokenByIndex(uint256 index) external view returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received(address operator, address from, uint256 tokenId, bytes calldata data) external returns (bytes4); }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts may inherit from this and call {_registerInterface} to declare * their support of an interface. */ abstract 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 virtual 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; } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.2 <0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; // solhint-disable-next-line no-inline-assembly assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // 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"); require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: value }(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.staticcall(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.delegatecall(data); return _verifyCallResult(success, returndata, errorMessage); } function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping (bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; // When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement. bytes32 lastvalue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastvalue; // Update the index for the moved value set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { require(set._values.length > index, "EnumerableSet: index out of bounds"); return set._values[index]; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values on the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Library for managing an enumerable variant of Solidity's * https://solidity.readthedocs.io/en/latest/types.html#mapping-types[`mapping`] * type. * * Maps have the following properties: * * - Entries are added, removed, and checked for existence in constant time * (O(1)). * - Entries are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableMap for EnumerableMap.UintToAddressMap; * * // Declare a set state variable * EnumerableMap.UintToAddressMap private myMap; * } * ``` * * As of v3.0.0, only maps of type `uint256 -> address` (`UintToAddressMap`) are * supported. */ library EnumerableMap { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Map type with // bytes32 keys and values. // The Map implementation uses private functions, and user-facing // implementations (such as Uint256ToAddressMap) are just wrappers around // the underlying Map. // This means that we can only create new EnumerableMaps for types that fit // in bytes32. struct MapEntry { bytes32 _key; bytes32 _value; } struct Map { // Storage of map keys and values MapEntry[] _entries; // Position of the entry defined by a key in the `entries` array, plus 1 // because index 0 means a key is not in the map. mapping (bytes32 => uint256) _indexes; } /** * @dev Adds a key-value pair to a map, or updates the value for an existing * key. O(1). * * Returns true if the key was added to the map, that is if it was not * already present. */ function _set(Map storage map, bytes32 key, bytes32 value) private returns (bool) { // We read and store the key's index to prevent multiple reads from the same storage slot uint256 keyIndex = map._indexes[key]; if (keyIndex == 0) { // Equivalent to !contains(map, key) map._entries.push(MapEntry({ _key: key, _value: value })); // The entry is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value map._indexes[key] = map._entries.length; return true; } else { map._entries[keyIndex - 1]._value = value; return false; } } /** * @dev Removes a key-value pair from a map. O(1). * * Returns true if the key was removed from the map, that is if it was present. */ function _remove(Map storage map, bytes32 key) private returns (bool) { // We read and store the key's index to prevent multiple reads from the same storage slot uint256 keyIndex = map._indexes[key]; if (keyIndex != 0) { // Equivalent to contains(map, key) // To delete a key-value pair from the _entries array in O(1), we swap the entry to delete with the last one // in the array, and then remove the last entry (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = keyIndex - 1; uint256 lastIndex = map._entries.length - 1; // When the entry to delete is the last one, the swap operation is unnecessary. However, since this occurs // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement. MapEntry storage lastEntry = map._entries[lastIndex]; // Move the last entry to the index where the entry to delete is map._entries[toDeleteIndex] = lastEntry; // Update the index for the moved entry map._indexes[lastEntry._key] = toDeleteIndex + 1; // All indexes are 1-based // Delete the slot where the moved entry was stored map._entries.pop(); // Delete the index for the deleted slot delete map._indexes[key]; return true; } else { return false; } } /** * @dev Returns true if the key is in the map. O(1). */ function _contains(Map storage map, bytes32 key) private view returns (bool) { return map._indexes[key] != 0; } /** * @dev Returns the number of key-value pairs in the map. O(1). */ function _length(Map storage map) private view returns (uint256) { return map._entries.length; } /** * @dev Returns the key-value pair stored at position `index` in the map. O(1). * * Note that there are no guarantees on the ordering of entries inside the * array, and it may change when more entries are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Map storage map, uint256 index) private view returns (bytes32, bytes32) { require(map._entries.length > index, "EnumerableMap: index out of bounds"); MapEntry storage entry = map._entries[index]; return (entry._key, entry._value); } /** * @dev Tries to returns the value associated with `key`. O(1). * Does not revert if `key` is not in the map. */ function _tryGet(Map storage map, bytes32 key) private view returns (bool, bytes32) { uint256 keyIndex = map._indexes[key]; if (keyIndex == 0) return (false, 0); // Equivalent to contains(map, key) return (true, map._entries[keyIndex - 1]._value); // All indexes are 1-based } /** * @dev Returns the value associated with `key`. O(1). * * Requirements: * * - `key` must be in the map. */ function _get(Map storage map, bytes32 key) private view returns (bytes32) { uint256 keyIndex = map._indexes[key]; require(keyIndex != 0, "EnumerableMap: nonexistent key"); // Equivalent to contains(map, key) return map._entries[keyIndex - 1]._value; // All indexes are 1-based } /** * @dev Same as {_get}, with a custom error message when `key` is not in the map. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {_tryGet}. */ function _get(Map storage map, bytes32 key, string memory errorMessage) private view returns (bytes32) { uint256 keyIndex = map._indexes[key]; require(keyIndex != 0, errorMessage); // Equivalent to contains(map, key) return map._entries[keyIndex - 1]._value; // All indexes are 1-based } // UintToAddressMap struct UintToAddressMap { Map _inner; } /** * @dev Adds a key-value pair to a map, or updates the value for an existing * key. O(1). * * Returns true if the key was added to the map, that is if it was not * already present. */ function set(UintToAddressMap storage map, uint256 key, address value) internal returns (bool) { return _set(map._inner, bytes32(key), bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the key was removed from the map, that is if it was present. */ function remove(UintToAddressMap storage map, uint256 key) internal returns (bool) { return _remove(map._inner, bytes32(key)); } /** * @dev Returns true if the key is in the map. O(1). */ function contains(UintToAddressMap storage map, uint256 key) internal view returns (bool) { return _contains(map._inner, bytes32(key)); } /** * @dev Returns the number of elements in the map. O(1). */ function length(UintToAddressMap storage map) internal view returns (uint256) { return _length(map._inner); } /** * @dev Returns the element stored at position `index` in the set. O(1). * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintToAddressMap storage map, uint256 index) internal view returns (uint256, address) { (bytes32 key, bytes32 value) = _at(map._inner, index); return (uint256(key), address(uint160(uint256(value)))); } /** * @dev Tries to returns the value associated with `key`. O(1). * Does not revert if `key` is not in the map. * * _Available since v3.4._ */ function tryGet(UintToAddressMap storage map, uint256 key) internal view returns (bool, address) { (bool success, bytes32 value) = _tryGet(map._inner, bytes32(key)); return (success, address(uint160(uint256(value)))); } /** * @dev Returns the value associated with `key`. O(1). * * Requirements: * * - `key` must be in the map. */ function get(UintToAddressMap storage map, uint256 key) internal view returns (address) { return address(uint160(uint256(_get(map._inner, bytes32(key))))); } /** * @dev Same as {get}, with a custom error message when `key` is not in the map. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryGet}. */ function get(UintToAddressMap storage map, uint256 key, string memory errorMessage) internal view returns (address) { return address(uint160(uint256(_get(map._inner, bytes32(key), errorMessage)))); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev String operations. */ library Strings { /** * @dev Converts a `uint256` to its ASCII `string` representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); uint256 index = digits - 1; temp = value; while (temp != 0) { buffer[index--] = bytes1(uint8(48 + temp % 10)); temp /= 10; } return string(buffer); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT pragma solidity ^0.7.6; pragma experimental ABIEncoderV2; import "./ERC721BaseCollectionV2.sol"; contract ERC721CollectionV2 is ERC721BaseCollectionV2 { constructor() {} }
// SPDX-License-Identifier: MIT pragma solidity ^0.7.6; import "@openzeppelin/contracts/utils/Address.sol"; contract MinimalProxyFactory { using Address for address; address public implementation; bytes public code; bytes32 public codeHash; event ProxyCreated(address indexed _address, bytes32 _salt); event ImplementationSet(address indexed _implementation, bytes32 _codeHash, bytes _code); /** * @notice Create the contract * @param _implementation - contract implementation */ constructor(address _implementation) { _setImplementation(_implementation); } /** * @notice Create a contract * @param _salt - arbitrary 32 bytes hexa * @param _data - call data used to call the contract already created if passed * @return addr - address of the contract created */ function _createProxy(bytes32 _salt, bytes memory _data) internal virtual returns (address addr) { bytes memory slotcode = code; bytes32 salt = keccak256(abi.encodePacked(_salt, msg.sender, _data)); // solium-disable-next-line security/no-inline-assembly assembly { addr := create2(0, add(slotcode, 0x20), mload(slotcode), salt) } require(addr != address(0), "MinimalProxyFactory#createProxy: CREATION_FAILED"); emit ProxyCreated(addr, _salt); if (_data.length > 0) { (bool success,) = addr.call(_data); require(success, "MinimalProxyFactory#createProxy: CALL_FAILED"); } } /** * @notice Get a deterministics contract address * @param _salt - arbitrary 32 bytes hexa * @param _address - supposed sender of the transaction * @return address of the deterministic contract */ function getAddress(bytes32 _salt, address _address, bytes calldata _data) external view returns (address) { return address( uint256( keccak256( abi.encodePacked( byte(0xff), address(this), keccak256(abi.encodePacked(_salt, _address, _data)), codeHash ) ) ) ); } /** * @notice Set the contract implementation * @param _implementation - contract implementation */ function _setImplementation(address _implementation) internal { require( _implementation != address(0) && _implementation.isContract(), "MinimalProxyFactoryV2#_setImplementation: INVALID_IMPLEMENTATION" ); // Adapted from https://github.com/optionality/clone-factory/blob/32782f82dfc5a00d103a7e61a17a5dedbd1e8e9d/contracts/CloneFactory.sol code = abi.encodePacked( hex"3d602d80600a3d3981f3363d3d373d3d3d363d73", _implementation, hex"5af43d82803e903d91602b57fd5bf3" ); codeHash = keccak256(code); implementation = _implementation; emit ImplementationSet(implementation, codeHash, code); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.7.6; import "@openzeppelin/contracts/access/Ownable.sol"; import "../../commons/MinimalProxyFactory.sol"; contract ERC721CollectionFactoryV2 is Ownable, MinimalProxyFactory { address[] public collections; mapping(address => bool) public isCollectionFromFactory; /** * @notice Create the contract * @param _owner - contract owner * @param _implementation - contract implementation */ constructor(address _owner, address _implementation) MinimalProxyFactory(_implementation) { transferOwnership(_owner); } /** * @notice Create a collection * @param _salt - arbitrary 32 bytes hexa * @param _data - call data used to call the contract already created if passed * @return addr - address of the contract created */ function createCollection(bytes32 _salt, bytes memory _data) external onlyOwner returns (address addr) { // Deploy a new collection addr = _createProxy(_salt, _data); // Transfer ownership to the owner after deployment Ownable(addr).transferOwnership(owner()); // Set variables for handle data faster // This use storage and therefore make deployments expensive. collections.push(addr); isCollectionFromFactory[addr] = true; } /** * @notice Get the amount of collections deployed * @return amount of collections deployed */ function collectionsSize() external view returns (uint256) { return collections.length; } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () internal { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { 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 virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with 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; } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a >= b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow, so we distribute return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.7.6; import "@openzeppelin/contracts/access/Ownable.sol"; contract Forwarder is Ownable { address public caller; event CallerSet(address indexed _oldCaller, address indexed _newCaller); /** * @notice Create the contract * @param _owner - contract owner * @param _caller - target address to call */ constructor(address _owner, address _caller) { setCaller(_caller); transferOwnership(_owner); } /** * @notice Set the caller allowed to forward calls * @param _newCaller - target address to call */ function setCaller(address _newCaller) public onlyOwner { emit CallerSet(caller, _newCaller); caller = _newCaller; } /** * @notice Forward a call * @param _target - target address to call * @param _data - call data to be used * @return whether the call was a success or not * @return response in bytes if any */ function forwardCall(address _target, bytes calldata _data) external payable returns (bool, bytes memory) { require( msg.sender == caller || msg.sender == owner(), "Owner#forwardCall: UNAUTHORIZED_SENDER" ); return _target.call{value: msg.value}(_data); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "../utils/Context.sol";
{ "optimizer": { "enabled": true, "runs": 1 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"contract IERC20","name":"_acceptedToken","type":"address"},{"internalType":"address","name":"_feeOwner","type":"address"},{"internalType":"uint256","name":"_fee","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"components":[{"internalType":"contract IERC721CollectionV2","name":"collection","type":"address"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"uint256[]","name":"prices","type":"uint256[]"},{"internalType":"address[]","name":"beneficiaries","type":"address[]"}],"indexed":false,"internalType":"struct CollectionStore.ItemToBuy[]","name":"_itemsToBuy","type":"tuple[]"}],"name":"Bought","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"userAddress","type":"address"},{"indexed":false,"internalType":"address","name":"relayerAddress","type":"address"},{"indexed":false,"internalType":"bytes","name":"functionSignature","type":"bytes"}],"name":"MetaTransactionExecuted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_oldFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_newFee","type":"uint256"}],"name":"SetFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_oldFeeOwner","type":"address"},{"indexed":true,"internalType":"address","name":"_newFeeOwner","type":"address"}],"name":"SetFeeOwner","type":"event"},{"inputs":[],"name":"BASE_FEE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"acceptedToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"contract IERC721CollectionV2","name":"collection","type":"address"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"uint256[]","name":"prices","type":"uint256[]"},{"internalType":"address[]","name":"beneficiaries","type":"address[]"}],"internalType":"struct CollectionStore.ItemToBuy[]","name":"_itemsToBuy","type":"tuple[]"}],"name":"buy","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"domainSeparator","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"userAddress","type":"address"},{"internalType":"bytes","name":"functionSignature","type":"bytes"},{"internalType":"bytes32","name":"sigR","type":"bytes32"},{"internalType":"bytes32","name":"sigS","type":"bytes32"},{"internalType":"uint8","name":"sigV","type":"uint8"}],"name":"executeMetaTransaction","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"fee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getChainId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"contract IERC721CollectionV2","name":"_collection","type":"address"},{"internalType":"uint256","name":"_itemId","type":"uint256"}],"name":"getItemBuyData","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"getNonce","outputs":[{"internalType":"uint256","name":"nonce","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_newFee","type":"uint256"}],"name":"setFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newFeeOwner","type":"address"}],"name":"setFeeOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60806040523480156200001157600080fd5b50604051620020c2380380620020c2833981016040819052620000349162000410565b620000946040518060400160405280601d81526020017f446563656e7472616c616e6420436f6c6c656374696f6e2053746f7265000000815250604051806040016040528060018152602001603160f81b815250620000ee60201b60201c565b6200009e62000188565b600380546001600160a01b038086166001600160a01b0319928316179092556005805492851692909116919091179055620000d981620001cf565b620000e484620002c0565b5050505062000522565b6040518060800160405280604f815260200162002033604f913980519060200120828051906020012082805190602001203062000130620003ad60201b60201c565b60001b60405160200180868152602001858152602001848152602001836001600160a01b0316815260200182815260200195505050505050604051602081830303815290604052805190602001206001819055505050565b600062000194620003b2565b600080546001600160a01b0319166001600160a01b038316908117825560405192935091600080516020620020a2833981519152908290a350565b620001d9620003b2565b6000546001600160a01b039081169116146200022b576040805162461bcd60e51b8152602060048201819052602482015260008051602062002082833981519152604482015290519081900360640190fd5b620f42408110620002595760405162461bcd60e51b815260040162000250906200049e565b60405180910390fd5b6004548114156200027e5760405162461bcd60e51b8152600401620002509062000469565b7f032dc6a2d839eb179729a55633fdf1c41a1fc4739394154117005db2b354b9b560045482604051620002b3929190620004fb565b60405180910390a1600455565b620002ca620003b2565b6000546001600160a01b039081169116146200031c576040805162461bcd60e51b8152602060048201819052602482015260008051602062002082833981519152604482015290519081900360640190fd5b6001600160a01b038116620003635760405162461bcd60e51b81526004018080602001828103825260268152602001806200200d6026913960400191505060405180910390fd5b600080546040516001600160a01b0380851693921691600080516020620020a283398151915291a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b465b90565b6000333014156200040b57600080368080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505050503601516001600160a01b03169150620003af9050565b503390565b6000806000806080858703121562000426578384fd5b8451620004338162000509565b6020860151909450620004468162000509565b6040860151909350620004598162000509565b6060959095015193969295505050565b6020808252818101527f436f6c6c656374696f6e53746f7265237365744665653a2053414d455f464545604082015260600190565b60208082526039908201527f436f6c6c656374696f6e53746f7265237365744665653a204645455f53484f5560408201527f4c445f42455f4c4f5745525f5448414e5f424153455f46454500000000000000606082015260800190565b918252602082015260400190565b6001600160a01b03811681146200051f57600080fd5b50565b611adb80620005326000396000f3fe6080604052600436106100b85760003560e01c80630c53c51c146100bd5780632d0335ab146100e65780633408e470146101135780633d18651e14610128578063451c3d801461013d5780634b104eff1461015f57806369fe0e2d14610181578063715018a6146101a15780638da5cb5b146101b6578063a4fdc78a146101cb578063b9818be1146101eb578063ddca3f4314610200578063e0f307c214610215578063f2fde38b14610243578063f698da2514610263575b600080fd5b6100d06100cb3660046111c1565b610278565b6040516100dd9190611632565b60405180910390f35b3480156100f257600080fd5b506101066101013660046111a5565b610565565b6040516100dd9190611629565b34801561011f57600080fd5b50610106610580565b34801561013457600080fd5b50610106610585565b34801561014957600080fd5b5061015261058c565b6040516100dd919061150f565b34801561016b57600080fd5b5061017f61017a3660046111a5565b61059b565b005b34801561018d57600080fd5b5061017f61019c366004611485565b6106ac565b3480156101ad57600080fd5b5061017f610788565b3480156101c257600080fd5b50610152610818565b3480156101d757600080fd5b5061017f6101e636600461126b565b610827565b3480156101f757600080fd5b50610152610b50565b34801561020c57600080fd5b50610106610b5f565b34801561022157600080fd5b506102356102303660046113a6565b610b65565b6040516100dd9291906118a9565b34801561024f57600080fd5b5061017f61025e3660046111a5565b610bfd565b34801561026f57600080fd5b50610106610ce3565b60408051606081810183526001600160a01b038816600081815260026020908152908590205484528301529181018690526102b68782878787610ce9565b6102f15760405162461bcd60e51b815260040180806020018281038252603d8152602001806119e1603d913960400191505060405180910390fd5b6001600160a01b038716600090815260026020526040902054610315906001610dd6565b60026000896001600160a01b03166001600160a01b03168152602001908152602001600020819055507f5845892132946850460bff5a0083f71031bc5bf9aadcd40f1de79423eac9b10b87338860405180846001600160a01b03168152602001836001600160a01b0316815260200180602001828103825283818151815260200191508051906020019080838360005b838110156103bd5781810151838201526020016103a5565b50505050905090810190601f1680156103ea5780820380516001836020036101000a031916815260200191505b5094505050505060405180910390a1600080306001600160a01b031634898b6040516020018083805190602001908083835b6020831061043b5780518252601f19909201916020918201910161041c565b6001836020036101000a038019825116818451168082178552505050505050905001826001600160a01b031660601b8152601401925050506040516020818303038152906040526040518082805190602001908083835b602083106104b15780518252601f199092019160209182019101610492565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114610513576040519150601f19603f3d011682016040523d82523d6000602084013e610518565b606091505b5091509150816105595760405162461bcd60e51b8152600401808060200182810382526027815260200180611a3f6027913960400191505060405180910390fd5b98975050505050505050565b6001600160a01b031660009081526002602052604090205490565b465b90565b620f424081565b6003546001600160a01b031681565b6105a3610e37565b6000546001600160a01b039081169116146105f3576040805162461bcd60e51b81526020600482018190526024820152600080516020611a66833981519152604482015290519081900360640190fd5b6001600160a01b0381166106225760405162461bcd60e51b81526004016106199061185d565b60405180910390fd5b6005546001600160a01b03828116911614156106505760405162461bcd60e51b815260040161061990611812565b6005546040516001600160a01b038084169216907fe0bbf1a07376101b84e5aff236bc710878c9a975168510f821b4a735c0d35e5190600090a3600580546001600160a01b0319166001600160a01b0392909216919091179055565b6106b4610e37565b6000546001600160a01b03908116911614610704576040805162461bcd60e51b81526020600482018190526024820152600080516020611a66833981519152604482015290519081900360640190fd5b620f424081106107265760405162461bcd60e51b8152600401610619906117b9565b6004548114156107485760405162461bcd60e51b81526004016106199061173b565b7f032dc6a2d839eb179729a55633fdf1c41a1fc4739394154117005db2b354b9b56004548260405161077b9291906118c0565b60405180910390a1600455565b610790610e37565b6000546001600160a01b039081169116146107e0576040805162461bcd60e51b81526020600482018190526024820152600080516020611a66833981519152604482015290519081900360640190fd5b600080546040516001600160a01b0390911690600080516020611a86833981519152908390a3600080546001600160a01b0319169055565b6000546001600160a01b031690565b600080610832610e37565b905060005b8351811015610a6657600084828151811061084e57fe5b602090810291909101810151805191810151516040820151519193509081146108895760405162461bcd60e51b8152600401610619906116f7565b60005b818110156109f0576000846020015182815181106108a657fe5b602002602001015190506000856040015183815181106108c257fe5b602002602001015190506000806108d98785610b65565b915091508183146108fc5760405162461bcd60e51b815260040161061990611665565b81156109e0576000610926620f424061092060045486610e9390919063ffffffff16565b90610eec565b90506109328c82610dd6565b600354909c506001600160a01b03166323b872dd8c846109528786610f50565b6040518463ffffffff1660e01b815260040161097093929190611523565b602060405180830381600087803b15801561098a57600080fd5b505af115801561099e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109c29190611386565b6109de5760405162461bcd60e51b8152600401610619906116ad565b505b50506001909201915061088c9050565b5060608301516020840151604051637c8f76a160e01b81526001600160a01b03851692637c8f76a192610a2592600401611547565b600060405180830381600087803b158015610a3f57600080fd5b505af1158015610a53573d6000803e3d6000fd5b5050600190950194506108379350505050565b508115610b14576003546005546040516323b872dd60e01b81526001600160a01b03928316926323b872dd92610aa6928692909116908790600401611523565b602060405180830381600087803b158015610ac057600080fd5b505af1158015610ad4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610af89190611386565b610b145760405162461bcd60e51b815260040161061990611770565b7f77cc75f8061aa168906862622e88c5b05a026a9c06c02d91ec98543e01e7ad3383604051610b439190611575565b60405180910390a1505050565b6005546001600160a01b031681565b60045481565b600080600080856001600160a01b031663bfb231d2866040518263ffffffff1660e01b8152600401610b979190611629565b60006040518083038186803b158015610baf57600080fd5b505afa158015610bc3573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610beb91908101906113d1565b50919b909a5098505050505050505050565b610c05610e37565b6000546001600160a01b03908116911614610c55576040805162461bcd60e51b81526020600482018190526024820152600080516020611a66833981519152604482015290519081900360640190fd5b6001600160a01b038116610c9a5760405162461bcd60e51b81526004018080602001828103825260268152602001806119bb6026913960400191505060405180910390fd5b600080546040516001600160a01b0380851693921691600080516020611a8683398151915291a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b60015481565b60006001600160a01b038616610d43576040805162461bcd60e51b815260206004820152601a6024820152792726aa11bb32b934b33c9d1024a72b20a624a22fa9a4a3a722a960311b604482015290519081900360640190fd5b6001610d56610d5187610fad565b611031565b83868660405160008152602001604052604051808581526020018460ff1681526020018381526020018281526020019450505050506020604051602081039080840390855afa158015610dad573d6000803e3d6000fd5b505050602060405103516001600160a01b0316866001600160a01b031614905095945050505050565b600082820183811015610e2e576040805162461bcd60e51b815260206004820152601b60248201527a536166654d6174683a206164646974696f6e206f766572666c6f7760281b604482015290519081900360640190fd5b90505b92915050565b600033301415610e8e57600080368080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505050503601516001600160a01b031691506105829050565b503390565b600082610ea257506000610e31565b82820282848281610eaf57fe5b0414610e2e5760405162461bcd60e51b8152600401808060200182810382526021815260200180611a1e6021913960400191505060405180910390fd5b6000808211610f3f576040805162461bcd60e51b815260206004820152601a602482015279536166654d6174683a206469766973696f6e206279207a65726f60301b604482015290519081900360640190fd5b818381610f4857fe5b049392505050565b600082821115610fa7576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b600060405180608001604052806043815260200161197860439139805190602001208260000151836020015184604001518051906020012060405160200180858152602001848152602001836001600160a01b031681526020018281526020019450505050506040516020818303038152906040528051906020012090505b919050565b6001546040805161190160f01b6020808301919091526022820193909352604280820194909452815180820390940184526062019052815191012090565b600082601f83011261107f578081fd5b8135602061109461108f836118f1565b6118ce565b82815281810190858301838502870184018810156110b0578586fd5b855b858110156110d75781356110c58161195f565b845292840192908401906001016110b2565b5090979650505050505050565b600082601f8301126110f4578081fd5b8135602061110461108f836118f1565b8281528181019085830183850287018401881015611120578586fd5b855b858110156110d757813584529284019290840190600101611122565b803561102c8161195f565b600082601f830112611159578081fd5b815161116761108f8261190e565b81815284602083860101111561117b578283fd5b61118c82602083016020870161192f565b949350505050565b803560ff8116811461102c57600080fd5b6000602082840312156111b6578081fd5b8135610e2e8161195f565b600080600080600060a086880312156111d8578081fd5b85356111e38161195f565b945060208601356001600160401b038111156111fd578182fd5b8601601f8101881361120d578182fd5b803561121b61108f8261190e565b81815289602083850101111561122f578384fd5b81602084016020830137908101602001839052945050604086013592506060860135915061125f60808701611194565b90509295509295909350565b6000602080838503121561127d578182fd5b82356001600160401b0380821115611293578384fd5b818501915085601f8301126112a6578384fd5b81356112b461108f826118f1565b81815284810190848601875b848110156113775781358701608080601f19838f030112156112e0578a8bfd5b6112e9816118ce565b6112f48b840161113e565b8152604083013589811115611307578c8dfd5b6113158f8d838701016110e4565b8c8301525060608301358981111561132b578c8dfd5b6113398f8d838701016110e4565b604083015250908201359088821115611350578b8cfd5b61135e8e8c8486010161106f565b60608201528652505092870192908701906001016112c0565b50909998505050505050505050565b600060208284031215611397578081fd5b81518015158114610e2e578182fd5b600080604083850312156113b8578182fd5b82356113c38161195f565b946020939093013593505050565b600080600080600080600060e0888a0312156113eb578485fd5b87516001600160401b0380821115611401578687fd5b61140d8b838c01611149565b985060208a0151975060408a0151965060608a0151955060808a015191506114348261195f565b60a08a015191945080821115611448578384fd5b6114548b838c01611149565b935060c08a0151915080821115611469578283fd5b506114768a828b01611149565b91505092959891949750929550565b600060208284031215611496578081fd5b5035919050565b6000815180845260208085019450808401835b838110156114d55781516001600160a01b0316875295820195908201906001016114b0565b509495945050505050565b6000815180845260208085019450808401835b838110156114d5578151875295820195908201906001016114f3565b6001600160a01b0391909116815260200190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b60006040825261155a604083018561149d565b828103602084015261156c81856114e0565b95945050505050565b60208082528251828201819052600091906040908185019080840286018301878501865b8381101561161b57888303603f19018552815180516001600160a01b03168452878101516080898601819052906115d2828701826114e0565b91505087820151858203898701526115ea82826114e0565b91505060608083015192508582038187015250611607818361149d565b968901969450505090860190600101611599565b509098975050505050505050565b90815260200190565b600060208252825180602084015261165181604085016020870161192f565b601f01601f19169190910160400192915050565b60208082526028908201527f436f6c6c656374696f6e53746f7265236275793a204954454d5f50524943455f60408201526709a92a69a82a886960c31b606082015260800190565b6020808252602a908201527f436f6c6c656374696f6e53746f7265236275793a205452414e534645525f50526040820152691250d157d1905253115160b21b606082015260800190565b60208082526024908201527f436f6c6c656374696f6e53746f7265236275793a204c454e4754485f4d49534d604082015263082a886960e31b606082015260800190565b6020808252818101527f436f6c6c656374696f6e53746f7265237365744665653a2053414d455f464545604082015260600190565b60208082526029908201527f436f6c6c656374696f6e53746f7265236275793a205452414e534645525f46456040820152681154d7d1905253115160ba1b606082015260800190565b60208082526039908201527f436f6c6c656374696f6e53746f7265237365744665653a204645455f53484f556040820152784c445f42455f4c4f5745525f5448414e5f424153455f46454560381b606082015260800190565b6020808252602b908201527f436f6c6c656374696f6e53746f7265237365744665654f776e65723a2053414d60408201526a22afa322a2afa7aba722a960a91b606082015260800190565b6020808252602c908201527f436f6c6c656374696f6e53746f7265237365744665654f776e65723a20494e5660408201526b414c49445f4144445245535360a01b606082015260800190565b9182526001600160a01b0316602082015260400190565b918252602082015260400190565b6040518181016001600160401b03811182821017156118e957fe5b604052919050565b60006001600160401b0382111561190457fe5b5060209081020190565b60006001600160401b0382111561192157fe5b50601f01601f191660200190565b60005b8381101561194a578181015183820152602001611932565b83811115611959576000848401525b50505050565b6001600160a01b038116811461197457600080fd5b5056fe4d6574615472616e73616374696f6e2875696e74323536206e6f6e63652c616464726573732066726f6d2c62797465732066756e6374696f6e5369676e6174757265294f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734e4d5423657865637574654d6574615472616e73616374696f6e3a205349474e45525f414e445f5349474e41545552455f444f5f4e4f545f4d41544348536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f774e4d5423657865637574654d6574615472616e73616374696f6e3a2043414c4c5f4641494c45444f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65728be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0a2646970667358221220dbed089cb70c48b92c39e3e9b1e266083fafde5e140e3a3b9d803c2437a6fcb164736f6c634300070600334f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373454950373132446f6d61696e28737472696e67206e616d652c737472696e672076657273696f6e2c6164647265737320766572696679696e67436f6e74726163742c627974657333322073616c74294f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65728be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e00000000000000000000000000e659a116e161d8e502f9036babda51334f2667e000000000000000000000000a1c57f48f0deb89f569dfbe6e2b7f46d33606fd40000000000000000000000000e659a116e161d8e502f9036babda51334f2667e00000000000000000000000000000000000000000000000000000000000061a8
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000000e659a116e161d8e502f9036babda51334f2667e000000000000000000000000a1c57f48f0deb89f569dfbe6e2b7f46d33606fd40000000000000000000000000e659a116e161d8e502f9036babda51334f2667e00000000000000000000000000000000000000000000000000000000000061a8
-----Decoded View---------------
Arg [0] : _owner (address): 0x0e659a116e161d8e502f9036babda51334f2667e
Arg [1] : _acceptedToken (address): 0xa1c57f48f0deb89f569dfbe6e2b7f46d33606fd4
Arg [2] : _feeOwner (address): 0x0e659a116e161d8e502f9036babda51334f2667e
Arg [3] : _fee (uint256): 25000
-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 0000000000000000000000000e659a116e161d8e502f9036babda51334f2667e
Arg [1] : 000000000000000000000000a1c57f48f0deb89f569dfbe6e2b7f46d33606fd4
Arg [2] : 0000000000000000000000000e659a116e161d8e502f9036babda51334f2667e
Arg [3] : 00000000000000000000000000000000000000000000000000000000000061a8
Deployed ByteCode Sourcemap
334:4542:34:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;730:1167:21;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;2305:107;;;;;;;;;;-1:-1:-1;2305:107:21;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;1043:155:18:-;;;;;;;;;;;;;:::i;598:42:34:-;;;;;;;;;;;;;:::i;646:27::-;;;;;;;;;;;;;:::i;:::-;;;;;;;:::i;4538:336::-;;;;;;;;;;-1:-1:-1;4538:336:34;;;;;:::i;:::-;;:::i;:::-;;4140:283;;;;;;;;;;-1:-1:-1;4140:283:34;;;;;:::i;:::-;;:::i;1729:145:22:-;;;;;;;;;;;;;:::i;1106:77::-;;;;;;;;;;;;;:::i;1698:1789:34:-;;;;;;;;;;-1:-1:-1;1698:1789:34;;;;;:::i;:::-;;:::i;703:23::-;;;;;;;;;;;;;:::i;679:18::-;;;;;;;;;;;;;:::i;3728:234::-;;;;;;;;;;-1:-1:-1;3728:234:34;;;;;:::i;:::-;;:::i;:::-;;;;;;;;:::i;2023:240:22:-;;;;;;;;;;-1:-1:-1;2023:240:22;;;;;:::i;:::-;;:::i;412:30:18:-;;;;;;;;;;;;;:::i;730:1167:21:-;983:148;;;927:12;983:148;;;;;-1:-1:-1;;;;;1020:19:21;;951:29;1020:19;;;:6;:19;;;;;;;;;983:148;;;;;;;;;;;1163:45;1027:11;983:148;1191:4;1197;1203;1163:6;:45::i;:::-;1142:153;;;;-1:-1:-1;;;1142:153:21;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;1381:19:21;;;;;;:6;:19;;;;;;:26;;1405:1;1381:23;:26::i;:::-;1359:6;:19;1366:11;-1:-1:-1;;;;;1359:19:21;-1:-1:-1;;;;;1359:19:21;;;;;;;;;;;;:48;;;;1423:113;1460:11;1485:10;1509:17;1423:113;;;;-1:-1:-1;;;;;1423:113:21;;;;;;-1:-1:-1;;;;;1423:113:21;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1644:12;1658:23;1693:4;-1:-1:-1;;;;;1685:18:21;1711:9;1752:17;1771:11;1735:48;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;1735:48:21;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;1735:48:21;;;;;;;;;;;;;;;;;;;;;;;1685:108;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;1685:108:21;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1643:150;;;;1811:7;1803:59;;;;-1:-1:-1;;;1803:59:21;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1880:10;730:1167;-1:-1:-1;;;;;;;;730:1167:21:o;2305:107::-;-1:-1:-1;;;;;2393:12:21;2360:13;2393:12;;;:6;:12;;;;;;;2305:107::o;1043:155:18:-;1154:9;1043:155;;:::o;598:42:34:-;633:7;598:42;:::o;646:27::-;;;-1:-1:-1;;;;;646:27:34;;:::o;4538:336::-;1320:12:22;:10;:12::i;:::-;1310:6;;-1:-1:-1;;;;;1310:6:22;;;:22;;;1302:67;;;;;-1:-1:-1;;;1302:67:22;;;;;;;;;;;;;-1:-1:-1;;;;;;;;;;;1302:67:22;;;;;;;;;;;;;;;-1:-1:-1;;;;;4618:26:34;::::1;4610:83;;;;-1:-1:-1::0;;;4610:83:34::1;;;;;;;:::i;:::-;;;;;;;;;4727:8;::::0;-1:-1:-1;;;;;4711:24:34;;::::1;4727:8:::0;::::1;4711:24;;4703:80;;;;-1:-1:-1::0;;;4703:80:34::1;;;;;;;:::i;:::-;4811:8;::::0;4799:35:::1;::::0;-1:-1:-1;;;;;4799:35:34;;::::1;::::0;4811:8:::1;::::0;4799:35:::1;::::0;4811:8:::1;::::0;4799:35:::1;4844:8;:23:::0;;-1:-1:-1;;;;;;4844:23:34::1;-1:-1:-1::0;;;;;4844:23:34;;;::::1;::::0;;;::::1;::::0;;4538:336::o;4140:283::-;1320:12:22;:10;:12::i;:::-;1310:6;;-1:-1:-1;;;;;1310:6:22;;;:22;;;1302:67;;;;;-1:-1:-1;;;1302:67:22;;;;;;;;;;;;;-1:-1:-1;;;;;;;;;;;1302:67:22;;;;;;;;;;;;;;;633:7:34::1;4208;:18;4200:88;;;;-1:-1:-1::0;;;4200:88:34::1;;;;;;;:::i;:::-;4317:3;;4306:7;:14;;4298:59;;;;-1:-1:-1::0;;;4298:59:34::1;;;;;;;:::i;:::-;4373:20;4380:3;;4385:7;4373:20;;;;;;;:::i;:::-;;;;;;;;4403:3;:13:::0;4140:283::o;1729:145:22:-;1320:12;:10;:12::i;:::-;1310:6;;-1:-1:-1;;;;;1310:6:22;;;:22;;;1302:67;;;;;-1:-1:-1;;;1302:67:22;;;;;;;;;;;;;-1:-1:-1;;;;;;;;;;;1302:67:22;;;;;;;;;;;;;;;1835:1:::1;1819:6:::0;;1798:40:::1;::::0;-1:-1:-1;;;;;1819:6:22;;::::1;::::0;-1:-1:-1;;;;;;;;;;;1798:40:22;1835:1;;1798:40:::1;1865:1;1848:19:::0;;-1:-1:-1;;;;;;1848:19:22::1;::::0;;1729:145::o;1106:77::-;1144:7;1170:6;-1:-1:-1;;;;;1170:6:22;1106:77;:::o;1698:1789:34:-;1762:16;1792:14;1809:12;:10;:12::i;:::-;1792:29;;1837:9;1832:1356;1856:11;:18;1852:1;:22;1832:1356;;;1895:26;1924:11;1936:1;1924:14;;;;;;;;;;;;;;;;;;;1985:20;;2043:13;;;;:20;2103:16;;;;:23;1924:14;;-1:-1:-1;2043:20:34;2086:40;;2078:89;;;;-1:-1:-1;;;2078:89:34;;;;;;;:::i;:::-;2187:9;2182:893;2206:13;2202:1;:17;2182:893;;;2244:14;2261:9;:13;;;2275:1;2261:16;;;;;;;;;;;;;;2244:33;;2295:13;2311:9;:16;;;2328:1;2311:19;;;;;;;;;;;;;;2295:35;;2350:17;2369:23;2396:34;2411:10;2423:6;2396:14;:34::i;:::-;2349:81;;;;2465:9;2456:5;:18;2448:71;;;;-1:-1:-1;;;2448:71:34;;;;;;;:::i;:::-;2542:13;;2538:523;;2623:23;2649:32;633:7;2649:18;2663:3;;2649:9;:13;;:18;;;;:::i;:::-;:22;;:32::i;:::-;2623:58;-1:-1:-1;2714:29:34;:8;2623:58;2714:12;:29::i;:::-;2867:13;;2703:40;;-1:-1:-1;;;;;;2867:13:34;:26;2894:6;2902:15;2919:30;:9;2933:15;2919:13;:30::i;:::-;2867:83;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;2834:208;;;;-1:-1:-1;;;2834:208:34;;;;;;;:::i;:::-;2538:523;;-1:-1:-1;;2221:3:34;;;;;-1:-1:-1;2182:893:34;;-1:-1:-1;2182:893:34;;-1:-1:-1;3138:23:34;;;;3163:13;;;;3115:62;;-1:-1:-1;;;3115:62:34;;-1:-1:-1;;;;;3115:22:34;;;;;:62;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;1876:3:34;;;;;-1:-1:-1;1832:1356:34;;-1:-1:-1;;;;1832:1356:34;;-1:-1:-1;3202:12:34;;3198:249;;3307:13;;3342:8;;3307:54;;-1:-1:-1;;;3307:54:34;;-1:-1:-1;;;;;3307:13:34;;;;:26;;:54;;3334:6;;3342:8;;;;3352;;3307:54;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;3282:154;;;;-1:-1:-1;;;3282:154:34;;;;;;;:::i;:::-;3461:19;3468:11;3461:19;;;;;;:::i;:::-;;;;;;;;1698:1789;;;:::o;703:23::-;;;-1:-1:-1;;;;;703:23:34;;:::o;679:18::-;;;;:::o;3728:234::-;3823:7;3832;3853:13;3868:19;3893:11;-1:-1:-1;;;;;3893:17:34;;3911:7;3893:26;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;3893:26:34;;;;;;;;;;;;:::i;:::-;-1:-1:-1;3849:70:34;;;;-1:-1:-1;3728:234:34;-1:-1:-1;;;;;;;;;3728:234:34:o;2023:240:22:-;1320:12;:10;:12::i;:::-;1310:6;;-1:-1:-1;;;;;1310:6:22;;;:22;;;1302:67;;;;;-1:-1:-1;;;1302:67:22;;;;;;;;;;;;;-1:-1:-1;;;;;;;;;;;1302:67:22;;;;;;;;;;;;;;;-1:-1:-1;;;;;2111:22:22;::::1;2103:73;;;;-1:-1:-1::0;;;2103:73:22::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2212:6;::::0;;2191:38:::1;::::0;-1:-1:-1;;;;;2191:38:22;;::::1;::::0;2212:6;::::1;::::0;-1:-1:-1;;;;;;;;;;;2191:38:22;::::1;2239:6;:17:::0;;-1:-1:-1;;;;;;2239:17:22::1;-1:-1:-1::0;;;;;2239:17:22;;;::::1;::::0;;;::::1;::::0;;2023:240::o;412:30:18:-;;;;:::o;2418:459:21:-;2590:4;-1:-1:-1;;;;;2614:20:21;;2606:59;;;;;-1:-1:-1;;;2606:59:21;;;;;;;;;;;;-1:-1:-1;;;2606:59:21;;;;;;;;;;;;;;;2716:154;2743:47;2762:27;2782:6;2762:19;:27::i;:::-;2743:18;:47::i;:::-;2808:4;2830;2852;2716:154;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;2694:176:21;:6;-1:-1:-1;;;;;2694:176:21;;2675:195;;2418:459;;;;;;;:::o;2690:175:5:-;2748:7;2779:5;;;2802:6;;;;2794:46;;;;;-1:-1:-1;;;2794:46:5;;;;;;;;;;;;-1:-1:-1;;;2794:46:5;;;;;;;;;;;;;;;2857:1;-1:-1:-1;2690:175:5;;;;;:::o;96:639:17:-;181:22;223:10;245:4;223:27;219:487;;;266:18;287:8;;266:29;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;325:8:17;532:17;526:24;-1:-1:-1;;;;;501:131:17;;-1:-1:-1;363:283:17;;-1:-1:-1;363:283:17;;-1:-1:-1;685:10:17;96:639;:::o;3538:215:5:-;3596:7;3619:6;3615:20;;-1:-1:-1;3634:1:5;3627:8;;3615:20;3657:5;;;3661:1;3657;:5;:1;3680:5;;;;;:10;3672:56;;;;-1:-1:-1;;;3672:56:5;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4217:150;4275:7;4306:1;4302;:5;4294:44;;;;;-1:-1:-1;;;4294:44:5;;;;;;;;;;;;-1:-1:-1;;;4294:44:5;;;;;;;;;;;;;;;4359:1;4355;:5;;;;;;;4217:150;-1:-1:-1;;;4217:150:5:o;3136:155::-;3194:7;3226:1;3221;:6;;3213:49;;;;;-1:-1:-1;;;3213:49:5;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;3279:5:5;;;3136:155::o;1903:396:21:-;2010:7;330:98;;;;;;;;;;;;;;;;;311:123;;;;;;2158:6;:12;;;2192:6;:11;;;2235:6;:24;;;2225:35;;;;;;2079:199;;;;;;;;;;;;;;;;-1:-1:-1;;;;;2079:199:21;;;;;;;;;;;;;;;;;;;;;;;;;;;;2052:240;;;;;;2033:259;;1903:396;;;;:::o;1558:244:18:-;1752:15;;1723:58;;;-1:-1:-1;;;1723:58:18;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1696:99;;;;;;1558:244::o;14:782:37:-;;127:3;120:4;112:6;108:17;104:27;94:2;;149:5;142;135:20;94:2;189:6;176:20;215:4;239:65;254:49;300:2;254:49;:::i;:::-;239:65;:::i;:::-;338:15;;;369:12;;;;401:15;;;447:11;;;435:24;;431:33;;428:42;-1:-1:-1;425:2:37;;;487:5;480;473:20;425:2;513:5;527:240;541:2;538:1;535:9;527:240;;;612:3;599:17;629:33;656:5;629:33;:::i;:::-;675:18;;713:12;;;;745;;;;559:1;552:9;527:240;;;-1:-1:-1;785:5:37;;84:712;-1:-1:-1;;;;;;;84:712:37:o;801:705::-;;914:3;907:4;899:6;895:17;891:27;881:2;;936:5;929;922:20;881:2;976:6;963:20;1002:4;1026:65;1041:49;1087:2;1041:49;:::i;1026:65::-;1125:15;;;1156:12;;;;1188:15;;;1234:11;;;1222:24;;1218:33;;1215:42;-1:-1:-1;1212:2:37;;;1274:5;1267;1260:20;1212:2;1300:5;1314:163;1328:2;1325:1;1322:9;1314:163;;;1385:17;;1373:30;;1423:12;;;;1455;;;;1346:1;1339:9;1314:163;;1511:160;1603:20;;1632:33;1603:20;1632:33;:::i;1676:448::-;;1785:3;1778:4;1770:6;1766:17;1762:27;1752:2;;1807:5;1800;1793:20;1752:2;1840:6;1834:13;1871:49;1886:33;1916:2;1886:33;:::i;1871:49::-;1945:2;1936:7;1929:19;1991:3;1984:4;1979:2;1971:6;1967:15;1963:26;1960:35;1957:2;;;2012:5;2005;1998:20;1957:2;2029:64;2090:2;2083:4;2074:7;2070:18;2063:4;2055:6;2051:17;2029:64;:::i;:::-;2111:7;1742:382;-1:-1:-1;;;;1742:382:37:o;2129:158::-;2197:20;;2257:4;2246:16;;2236:27;;2226:2;;2277:1;2274;2267:12;2292:259;;2404:2;2392:9;2383:7;2379:23;2375:32;2372:2;;;2425:6;2417;2410:22;2372:2;2469:9;2456:23;2488:33;2515:5;2488:33;:::i;2556:1064::-;;;;;;2743:3;2731:9;2722:7;2718:23;2714:33;2711:2;;;2765:6;2757;2750:22;2711:2;2809:9;2796:23;2828:33;2855:5;2828:33;:::i;:::-;2880:5;-1:-1:-1;2936:2:37;2921:18;;2908:32;-1:-1:-1;;;;;2952:30:37;;2949:2;;;3000:6;2992;2985:22;2949:2;3028:22;;3081:4;3073:13;;3069:27;-1:-1:-1;3059:2:37;;3115:6;3107;3100:22;3059:2;3156;3143:16;3181:49;3196:33;3226:2;3196:33;:::i;3181:49::-;3253:2;3246:5;3239:17;3293:7;3288:2;3283;3279;3275:11;3271:20;3268:33;3265:2;;;3319:6;3311;3304:22;3265:2;3379;3374;3370;3366:11;3361:2;3354:5;3350:14;3337:45;3402:14;;;3418:2;3398:23;3391:39;;;3406:5;-1:-1:-1;;3501:2:37;3486:18;;3473:32;;-1:-1:-1;3552:2:37;3537:18;;3524:32;;-1:-1:-1;3575:39:37;3609:3;3594:19;;3575:39;:::i;:::-;3565:49;;2701:919;;;;;;;;:::o;3625:1856::-;;3767:2;3810;3798:9;3789:7;3785:23;3781:32;3778:2;;;3831:6;3823;3816:22;3778:2;3863:23;;-1:-1:-1;;;;;3935:14:37;;;3932:2;;;3967:6;3959;3952:22;3932:2;4010:6;3999:9;3995:22;3985:32;;4055:7;4048:4;4044:2;4040:13;4036:27;4026:2;;4082:6;4074;4067:22;4026:2;4123;4110:16;4146:65;4161:49;4207:2;4161:49;:::i;4146:65::-;4245:15;;;4276:12;;;;4308:11;;;4337:6;4352:1099;4366:2;4363:1;4360:9;4352:1099;;;4442:3;4429:17;4425:2;4421:26;4470:4;4526:2;4520;4516:7;4511:2;4502:7;4498:16;4494:30;4490:39;4487:2;;;4547:6;4539;4532:22;4487:2;4582:18;4597:2;4582:18;:::i;:::-;4627:55;4678:2;4674;4670:11;4627:55;:::i;:::-;4620:5;4613:70;4733:2;4729;4725:11;4712:25;4766:2;4756:8;4753:16;4750:2;;;4787:6;4779;4772:22;4750:2;4832:71;4895:7;4890:2;4879:8;4875:2;4871:17;4867:26;4832:71;:::i;:::-;4827:2;4820:5;4816:14;4809:95;;4954:2;4950;4946:11;4933:25;4987:2;4977:8;4974:16;4971:2;;;5008:6;5000;4993:22;4971:2;5053:71;5116:7;5111:2;5100:8;5096:2;5092:17;5088:26;5053:71;:::i;:::-;5048:2;5037:14;;5030:95;-1:-1:-1;5167:11:37;;;5154:25;;5195:16;;;5192:2;;;5229:6;5221;5214:22;5192:2;5274:71;5337:7;5332:2;5321:8;5317:2;5313:17;5309:26;5274:71;:::i;:::-;5269:2;5258:14;;5251:95;5359:18;;-1:-1:-1;;5397:12:37;;;;5429;;;;4384:1;4377:9;4352:1099;;;-1:-1:-1;5470:5:37;;3747:1734;-1:-1:-1;;;;;;;;;3747:1734:37:o;5486:297::-;;5606:2;5594:9;5585:7;5581:23;5577:32;5574:2;;;5627:6;5619;5612:22;5574:2;5664:9;5658:16;5717:5;5710:13;5703:21;5696:5;5693:32;5683:2;;5744:6;5736;5729:22;5788:355;;;5945:2;5933:9;5924:7;5920:23;5916:32;5913:2;;;5966:6;5958;5951:22;5913:2;6010:9;5997:23;6029:33;6056:5;6029:33;:::i;:::-;6081:5;6133:2;6118:18;;;;6105:32;;-1:-1:-1;;;5903:240:37:o;6148:1129::-;;;;;;;;6403:3;6391:9;6382:7;6378:23;6374:33;6371:2;;;6425:6;6417;6410:22;6371:2;6457:16;;-1:-1:-1;;;;;6522:14:37;;;6519:2;;;6554:6;6546;6539:22;6519:2;6582:63;6637:7;6628:6;6617:9;6613:22;6582:63;:::i;:::-;6572:73;;6685:2;6674:9;6670:18;6664:25;6654:35;;6729:2;6718:9;6714:18;6708:25;6698:35;;6773:2;6762:9;6758:18;6752:25;6742:35;;6820:3;6809:9;6805:19;6799:26;6786:39;;6834:33;6861:5;6834:33;:::i;:::-;6937:3;6922:19;;6916:26;6886:5;;-1:-1:-1;6954:16:37;;;6951:2;;;6988:6;6980;6973:22;6951:2;7016:65;7073:7;7062:8;7051:9;7047:24;7016:65;:::i;:::-;7006:75;;7127:3;7116:9;7112:19;7106:26;7090:42;;7157:2;7147:8;7144:16;7141:2;;;7178:6;7170;7163:22;7141:2;;7206:65;7263:7;7252:8;7241:9;7237:24;7206:65;:::i;:::-;7196:75;;;6361:916;;;;;;;;;;:::o;7282:190::-;;7394:2;7382:9;7373:7;7369:23;7365:32;7362:2;;;7415:6;7407;7400:22;7362:2;-1:-1:-1;7443:23:37;;7352:120;-1:-1:-1;7352:120:37:o;7477:469::-;;7574:5;7568:12;7601:6;7596:3;7589:19;7627:4;7656:2;7651:3;7647:12;7640:19;;7693:2;7686:5;7682:14;7714:3;7726:195;7740:6;7737:1;7734:13;7726:195;;;7805:13;;-1:-1:-1;;;;;7801:39:37;7789:52;;7861:12;;;;7896:15;;;;7837:1;7755:9;7726:195;;;-1:-1:-1;7937:3:37;;7544:402;-1:-1:-1;;;;;7544:402:37:o;7951:443::-;;8048:5;8042:12;8075:6;8070:3;8063:19;8101:4;8130:2;8125:3;8121:12;8114:19;;8167:2;8160:5;8156:14;8188:3;8200:169;8214:6;8211:1;8208:13;8200:169;;;8275:13;;8263:26;;8309:12;;;;8344:15;;;;8236:1;8229:9;8200:169;;8399:203;-1:-1:-1;;;;;8563:32:37;;;;8545:51;;8533:2;8518:18;;8500:102::o;8607:375::-;-1:-1:-1;;;;;8865:15:37;;;8847:34;;8917:15;;;;8912:2;8897:18;;8890:43;8964:2;8949:18;;8942:34;;;;8797:2;8782:18;;8764:218::o;8987:477::-;;9244:2;9233:9;9226:21;9270:62;9328:2;9317:9;9313:18;9305:6;9270:62;:::i;:::-;9380:9;9372:6;9368:22;9363:2;9352:9;9348:18;9341:50;9408;9451:6;9443;9408:50;:::i;:::-;9400:58;9216:248;-1:-1:-1;;;;;9216:248:37:o;9469:1522::-;9694:2;9746:21;;;9816:13;;9719:18;;;9838:22;;;9469:1522;;9694:2;9879;;9897:18;;;;9957:15;;;9942:31;;9938:40;;10001:15;;;9469:1522;10047:915;10061:6;10058:1;10055:13;10047:915;;;10126:22;;;-1:-1:-1;;10122:36:37;10110:49;;10182:13;;10254:9;;-1:-1:-1;;;;;10250:35:37;10235:51;;10325:11;;;10319:18;10218:4;10357:15;;;10350:27;;;10218:4;10404:65;10453:15;;;10319:18;10404:65;:::i;:::-;10390:79;;;10518:2;10514;10510:11;10504:18;10571:6;10563;10559:19;10554:2;10546:6;10542:15;10535:44;10606:58;10657:6;10641:14;10606:58;:::i;:::-;10592:72;;;10687:4;10740:2;10736;10732:11;10726:18;10704:40;;10793:6;10785;10781:19;10776:2;10768:6;10764:15;10757:44;;10824:58;10875:6;10859:14;10824:58;:::i;:::-;10940:12;;;;10814:68;-1:-1:-1;;;10905:15:37;;;;10083:1;10076:9;10047:915;;;-1:-1:-1;10979:6:37;;9674:1317;-1:-1:-1;;;;;;;;9674:1317:37:o;10996:177::-;11142:25;;;11130:2;11115:18;;11097:76::o;11178:381::-;;11325:2;11314:9;11307:21;11357:6;11351:13;11400:6;11395:2;11384:9;11380:18;11373:34;11416:66;11475:6;11470:2;11459:9;11455:18;11450:2;11442:6;11438:15;11416:66;:::i;:::-;11543:2;11522:15;-1:-1:-1;;11518:29:37;11503:45;;;;11550:2;11499:54;;11297:262;-1:-1:-1;;11297:262:37:o;11787:404::-;11989:2;11971:21;;;12028:2;12008:18;;;12001:30;12067:34;12062:2;12047:18;;12040:62;-1:-1:-1;;;12133:2:37;12118:18;;12111:38;12181:3;12166:19;;11961:230::o;12196:406::-;12398:2;12380:21;;;12437:2;12417:18;;;12410:30;12476:34;12471:2;12456:18;;12449:62;-1:-1:-1;;;12542:2:37;12527:18;;12520:40;12592:3;12577:19;;12370:232::o;12607:400::-;12809:2;12791:21;;;12848:2;12828:18;;;12821:30;12887:34;12882:2;12867:18;;12860:62;-1:-1:-1;;;12953:2:37;12938:18;;12931:34;12997:3;12982:19;;12781:226::o;13012:356::-;13214:2;13196:21;;;13233:18;;;13226:30;13292:34;13287:2;13272:18;;13265:62;13359:2;13344:18;;13186:182::o;13373:405::-;13575:2;13557:21;;;13614:2;13594:18;;;13587:30;13653:34;13648:2;13633:18;;13626:62;-1:-1:-1;;;13719:2:37;13704:18;;13697:39;13768:3;13753:19;;13547:231::o;13783:421::-;13985:2;13967:21;;;14024:2;14004:18;;;13997:30;14063:34;14058:2;14043:18;;14036:62;-1:-1:-1;;;14129:2:37;14114:18;;14107:55;14194:3;14179:19;;13957:247::o;14209:407::-;14411:2;14393:21;;;14450:2;14430:18;;;14423:30;14489:34;14484:2;14469:18;;14462:62;-1:-1:-1;;;14555:2:37;14540:18;;14533:41;14606:3;14591:19;;14383:233::o;14621:408::-;14823:2;14805:21;;;14862:2;14842:18;;;14835:30;14901:34;14896:2;14881:18;;14874:62;-1:-1:-1;;;14967:2:37;14952:18;;14945:42;15019:3;15004:19;;14795:234::o;15216:274::-;15390:25;;;-1:-1:-1;;;;;15451:32:37;15446:2;15431:18;;15424:60;15378:2;15363:18;;15345:145::o;15495:248::-;15669:25;;;15725:2;15710:18;;15703:34;15657:2;15642:18;;15624:119::o;15748:242::-;15818:2;15812:9;15848:17;;;-1:-1:-1;;;;;15880:34:37;;15916:22;;;15877:62;15874:2;;;15942:9;15874:2;15969;15962:22;15792:198;;-1:-1:-1;15792:198:37:o;15995:183::-;;-1:-1:-1;;;;;16083:30:37;;16080:2;;;16116:9;16080:2;-1:-1:-1;16167:4:37;16148:17;;;16144:28;;16070:108::o;16183:181::-;;-1:-1:-1;;;;;16255:30:37;;16252:2;;;16288:9;16252:2;-1:-1:-1;16347:2:37;16324:17;-1:-1:-1;;16320:31:37;16353:4;16316:42;;16242:122::o;16369:258::-;16441:1;16451:113;16465:6;16462:1;16459:13;16451:113;;;16541:11;;;16535:18;16522:11;;;16515:39;16487:2;16480:10;16451:113;;;16582:6;16579:1;16576:13;16573:2;;;16617:1;16608:6;16603:3;16599:16;16592:27;16573:2;;16422:205;;;:::o;16632:133::-;-1:-1:-1;;;;;16709:31:37;;16699:42;;16689:2;;16755:1;16752;16745:12;16689:2;16679:86;:::o
Swarm Source
ipfs://dbed089cb70c48b92c39e3e9b1e266083fafde5e140e3a3b9d803c2437a6fcb1
Age | Block | Fee Address | BC Fee Address | Voting Power | Jailed | Incoming |
---|
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.