Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 127 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Deploy NFT721And... | 14614358 | 982 days ago | IN | 0 ETH | 0.00682492 | ||||
Deploy NFT721And... | 14603137 | 983 days ago | IN | 0 ETH | 0.01743394 | ||||
Deploy NFT721And... | 13772590 | 1112 days ago | IN | 0 ETH | 0.0460292 | ||||
Deploy NFT721And... | 13711094 | 1122 days ago | IN | 0 ETH | 0.06126408 | ||||
Deploy NFT721And... | 13706990 | 1123 days ago | IN | 0 ETH | 0.05579083 | ||||
Deploy NFT721And... | 13706136 | 1123 days ago | IN | 0 ETH | 0.0765315 | ||||
Deploy NFT1155An... | 13705181 | 1123 days ago | IN | 0 ETH | 0.06159937 | ||||
Deploy NFT721And... | 13689013 | 1125 days ago | IN | 0 ETH | 0.10718568 | ||||
Deploy NFT721And... | 13688148 | 1126 days ago | IN | 0 ETH | 0.0370988 | ||||
Deploy NFT721And... | 13688127 | 1126 days ago | IN | 0 ETH | 0.03710011 | ||||
Deploy NFT721And... | 13688117 | 1126 days ago | IN | 0 ETH | 0.03710011 | ||||
Deploy NFT721And... | 13682706 | 1126 days ago | IN | 0 ETH | 0.0613617 | ||||
Deploy NFT721And... | 13679082 | 1127 days ago | IN | 0 ETH | 0.09224298 | ||||
Deploy NFT721And... | 13679080 | 1127 days ago | IN | 0 ETH | 0.09224298 | ||||
Deploy NFT721And... | 13679024 | 1127 days ago | IN | 0 ETH | 0.09224298 | ||||
Deploy NFT721And... | 13679008 | 1127 days ago | IN | 0 ETH | 0.09224298 | ||||
Deploy NFT721And... | 13678994 | 1127 days ago | IN | 0 ETH | 0.09224298 | ||||
Deploy NFT721And... | 13678989 | 1127 days ago | IN | 0 ETH | 0.09224298 | ||||
Deploy NFT721And... | 13678986 | 1127 days ago | IN | 0 ETH | 0.09224298 | ||||
Deploy NFT721And... | 13678316 | 1127 days ago | IN | 0 ETH | 0.09218119 | ||||
Deploy NFT721And... | 13676403 | 1127 days ago | IN | 0 ETH | 0.04352568 | ||||
Deploy NFT721And... | 13676361 | 1127 days ago | IN | 0 ETH | 0.04085424 | ||||
Deploy NFT721And... | 13676322 | 1127 days ago | IN | 0 ETH | 0.04625184 | ||||
Deploy NFT721And... | 13673223 | 1128 days ago | IN | 0 ETH | 0.05466773 | ||||
Deploy NFT721And... | 13673156 | 1128 days ago | IN | 0 ETH | 0.0513865 |
Latest 25 internal transactions (View All)
Advanced mode:
Loading...
Loading
This contract contains unverified libraries: __CACHE_BREAKER__
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Name:
TokenFactory
Compiler Version
v0.8.3+commit.8d00100c
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity =0.8.3; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "./interfaces/ITokenFactory.sol"; import "./interfaces/IBaseNFT721.sol"; import "./interfaces/IBaseNFT1155.sol"; import "./interfaces/ISocialToken.sol"; import "./base/ProxyFactory.sol"; import "./libraries/Signature.sol"; contract TokenFactory is ProxyFactory, Ownable, ITokenFactory { uint8 public constant override MAX_ROYALTY_FEE = 250; // 25% uint8 public constant override MAX_OPERATIONAL_FEE = 50; // 5% // keccak256("ParkTokenIds721(address nft,uint256 toTokenId,uint256 nonce)"); bytes32 public constant override PARK_TOKEN_IDS_721_TYPEHASH = 0x3fddacac0a7d8b05f741f01ff6becadd9986be8631a2af41a675f365dd74090d; // keccak256("MintBatch721(address nft,address to,uint256[] tokenIds,bytes data,uint256 nonce)"); bytes32 public constant override MINT_BATCH_721_TYPEHASH = 0x884adba7f4e17962aed36c871036adea39c6d9f81fb25407a78db239e9731e86; // keccak256("MintBatch1155(address nft,address to,uint256[] tokenIds,uint256[] amounts,bytes data,uint256 nonce)"); bytes32 public constant override MINT_BATCH_1155_TYPEHASH = 0xb47ce0f6456fcc2f16b7d6e7b0255eb73822b401248e672a4543c2b3d7183043; // keccak256("MintSocialToken(address token,address to,uint256 amount,uint256 nonce)"); bytes32 public constant override MINT_SOCIAL_TOKEN_TYPEHASH = 0x8f4bf92e5271f5ec2f59dc3fc74368af0064fb84b40a3de9150dd26c08cda104; bytes32 internal immutable _DOMAIN_SEPARATOR; uint256 internal immutable _CACHED_CHAIN_ID; address[] internal _targets721; address[] internal _targets1155; address[] internal _targetsSocialToken; address internal _protocolFeeRecipient; uint8 internal _protocolFee; // out of 1000 address internal _operationalFeeRecipient; uint8 internal _operationalFee; // out of 1000 mapping(address => uint256) public override nonces; string public override baseURI721; string public override baseURI1155; address public override erc721Exchange; address public override erc1155Exchange; // any account can deploy proxies if isDeployerWhitelisted[0x0000000000000000000000000000000000000000] == true mapping(address => bool) public override isDeployerWhitelisted; mapping(address => bool) public override isStrategyWhitelisted; modifier onlyDeployer { require(isDeployerWhitelisted[address(0)] || isDeployerWhitelisted[msg.sender], "SHOYU: FORBIDDEN"); _; } constructor( address protocolFeeRecipient, uint8 protocolFee, address operationalFeeRecipient, uint8 operationalFee, string memory _baseURI721, string memory _baseURI1155 ) { _protocolFeeRecipient = protocolFeeRecipient; _protocolFee = protocolFee; _operationalFeeRecipient = operationalFeeRecipient; _operationalFee = operationalFee; baseURI721 = _baseURI721; baseURI1155 = _baseURI1155; _CACHED_CHAIN_ID = block.chainid; _DOMAIN_SEPARATOR = keccak256( abi.encode( // keccak256('EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)') 0x8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f, keccak256(bytes(Strings.toHexString(uint160(address(this))))), 0xc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6, // keccak256(bytes("1")) block.chainid, address(this) ) ); } function DOMAIN_SEPARATOR() public view override returns (bytes32) { bytes32 domainSeparator; if (_CACHED_CHAIN_ID == block.chainid) domainSeparator = _DOMAIN_SEPARATOR; else { domainSeparator = keccak256( abi.encode( // keccak256('EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)') 0x8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f, keccak256(bytes(Strings.toHexString(uint160(address(this))))), 0xc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6, // keccak256(bytes("1")) block.chainid, address(this) ) ); } return domainSeparator; } function protocolFeeInfo() external view override returns (address recipient, uint8 permil) { return (_protocolFeeRecipient, _protocolFee); } function operationalFeeInfo() external view override returns (address recipient, uint8 permil) { return (_operationalFeeRecipient, _operationalFee); } // This function should be called with a proper param by a multi-sig `owner` function setBaseURI721(string memory uri) external override onlyOwner { baseURI721 = uri; emit SetBaseURI721(uri); } // This function should be called with a proper param by a multi-sig `owner` function setBaseURI1155(string memory uri) external override onlyOwner { baseURI1155 = uri; emit SetBaseURI1155(uri); } // This function should be called by a multi-sig `owner`, not an EOA function setProtocolFeeRecipient(address protocolFeeRecipient) external override onlyOwner { require(protocolFeeRecipient != address(0), "SHOYU: INVALID_FEE_RECIPIENT"); _protocolFeeRecipient = protocolFeeRecipient; emit SetProtocolFeeRecipient(protocolFeeRecipient); } // This function should be called by a multi-sig `owner`, not an EOA function setOperationalFeeRecipient(address operationalFeeRecipient) external override onlyOwner { require(operationalFeeRecipient != address(0), "SHOYU: INVALID_RECIPIENT"); _operationalFeeRecipient = operationalFeeRecipient; emit SetOperationalFeeRecipient(operationalFeeRecipient); } // This function should be called by a multi-sig `owner`, not an EOA function setOperationalFee(uint8 operationalFee) external override onlyOwner { require(operationalFee <= MAX_OPERATIONAL_FEE, "SHOYU: INVALID_FEE"); _operationalFee = operationalFee; emit SetOperationalFee(operationalFee); } // This function should be called by a multi-sig `owner`, not an EOA function setDeployerWhitelisted(address deployer, bool whitelisted) external override onlyOwner { isDeployerWhitelisted[deployer] = whitelisted; emit SetDeployerWhitelisted(deployer, whitelisted); } // This function should be called by a multi-sig `owner`, not an EOA function setStrategyWhitelisted(address strategy, bool whitelisted) external override onlyOwner { require(strategy != address(0), "SHOYU: INVALID_ADDRESS"); isStrategyWhitelisted[strategy] = whitelisted; emit SetStrategyWhitelisted(strategy, whitelisted); } // This function should be called by a multi-sig `owner`, not an EOA function upgradeNFT721(address newTarget) external override onlyOwner { _targets721.push(newTarget); emit UpgradeNFT721(newTarget); } // This function should be called by a multi-sig `owner`, not an EOA function upgradeNFT1155(address newTarget) external override onlyOwner { _targets1155.push(newTarget); emit UpgradeNFT1155(newTarget); } // This function should be called by a multi-sig `owner`, not an EOA function upgradeSocialToken(address newTarget) external override onlyOwner { _targetsSocialToken.push(newTarget); emit UpgradeSocialToken(newTarget); } // This function should be called by a multi-sig `owner`, not an EOA function upgradeERC721Exchange(address exchange) external override onlyOwner { erc721Exchange = exchange; emit UpgradeERC721Exchange(exchange); } // This function should be called by a multi-sig `owner`, not an EOA function upgradeERC1155Exchange(address exchange) external override onlyOwner { erc1155Exchange = exchange; emit UpgradeERC1155Exchange(exchange); } function deployNFT721AndMintBatch( address owner, string calldata name, string calldata symbol, uint256[] memory tokenIds, address royaltyFeeRecipient, uint8 royaltyFee ) external override onlyDeployer returns (address nft) { require(bytes(name).length > 0, "SHOYU: INVALID_NAME"); require(bytes(symbol).length > 0, "SHOYU: INVALID_SYMBOL"); require(owner != address(0), "SHOYU: INVALID_ADDRESS"); nft = _createProxy( _targets721[_targets721.length - 1], abi.encodeWithSignature( "initialize(address,string,string,uint256[],address,uint8)", owner, name, symbol, tokenIds, royaltyFeeRecipient, royaltyFee ) ); emit DeployNFT721AndMintBatch(nft, owner, name, symbol, tokenIds, royaltyFeeRecipient, royaltyFee); } function deployNFT721AndPark( address owner, string calldata name, string calldata symbol, uint256 toTokenId, address royaltyFeeRecipient, uint8 royaltyFee ) external override onlyDeployer returns (address nft) { require(bytes(name).length > 0, "SHOYU: INVALID_NAME"); require(bytes(symbol).length > 0, "SHOYU: INVALID_SYMBOL"); require(owner != address(0), "SHOYU: INVALID_ADDRESS"); nft = _createProxy( _targets721[_targets721.length - 1], abi.encodeWithSignature( "initialize(address,string,string,uint256,address,uint8)", owner, name, symbol, toTokenId, royaltyFeeRecipient, royaltyFee ) ); emit DeployNFT721AndPark(nft, owner, name, symbol, toTokenId, royaltyFeeRecipient, royaltyFee); } function isNFT721(address query) external view override returns (bool result) { if (query == address(0)) return false; for (uint256 i = _targets721.length; i >= 1; i--) { if (_isProxy(_targets721[i - 1], query)) { return true; } } return false; } function deployNFT1155AndMintBatch( address owner, uint256[] memory tokenIds, uint256[] memory amounts, address royaltyFeeRecipient, uint8 royaltyFee ) external override onlyDeployer returns (address nft) { require(owner != address(0), "SHOYU: INVALID_ADDRESS"); require(tokenIds.length == amounts.length, "SHOYU: LENGTHS_NOT_EQUAL"); nft = _createProxy( _targets1155[_targets1155.length - 1], abi.encodeWithSignature( "initialize(address,uint256[],uint256[],address,uint8)", owner, tokenIds, amounts, royaltyFeeRecipient, royaltyFee ) ); emit DeployNFT1155AndMintBatch(nft, owner, tokenIds, amounts, royaltyFeeRecipient, royaltyFee); } function isNFT1155(address query) external view override returns (bool result) { if (query == address(0)) return false; for (uint256 i = _targets1155.length; i >= 1; i--) { if (_isProxy(_targets1155[i - 1], query)) { return true; } } return false; } function deploySocialToken( address owner, string memory name, string memory symbol, address dividendToken, uint256 initialSupply ) external override onlyDeployer returns (address proxy) { require(bytes(name).length > 0, "SHOYU: INVALID_NAME"); require(bytes(symbol).length > 0, "SHOYU: INVALID_SYMBOL"); require(owner != address(0), "SHOYU: INVALID_ADDRESS"); bytes memory initData = abi.encodeWithSignature( "initialize(address,string,string,address,uint256)", owner, name, symbol, dividendToken, initialSupply ); proxy = _createProxy(_targetsSocialToken[_targetsSocialToken.length - 1], initData); emit DeploySocialToken(proxy, owner, name, symbol, dividendToken, initialSupply); } function isSocialToken(address query) external view override returns (bool result) { if (query == address(0)) return false; for (uint256 i = _targetsSocialToken.length; i >= 1; i--) { if (_isProxy(_targetsSocialToken[i - 1], query)) { return true; } } return false; } function parkTokenIds721( address nft, uint256 toTokenId, uint8 v, bytes32 r, bytes32 s ) external override { address owner = IBaseNFT721(nft).owner(); bytes32 hash = keccak256(abi.encode(PARK_TOKEN_IDS_721_TYPEHASH, nft, toTokenId, nonces[owner]++)); Signature.verify(hash, owner, v, r, s, DOMAIN_SEPARATOR()); IBaseNFT721(nft).parkTokenIds(toTokenId); } function mintBatch721( address nft, address to, uint256[] calldata tokenIds, bytes calldata data, uint8 v, bytes32 r, bytes32 s ) external override { address owner = IBaseNFT721(nft).owner(); bytes32 hash = keccak256(abi.encode(MINT_BATCH_721_TYPEHASH, nft, to, tokenIds, data, nonces[owner]++)); Signature.verify(hash, owner, v, r, s, DOMAIN_SEPARATOR()); IBaseNFT721(nft).mintBatch(to, tokenIds, data); } function mintBatch1155( address nft, address to, uint256[] calldata tokenIds, uint256[] calldata amounts, bytes calldata data, uint8 v, bytes32 r, bytes32 s ) external override { address owner = IBaseNFT1155(nft).owner(); bytes32 hash = keccak256(abi.encode(MINT_BATCH_1155_TYPEHASH, nft, to, tokenIds, amounts, data, nonces[owner]++)); Signature.verify(hash, owner, v, r, s, DOMAIN_SEPARATOR()); IBaseNFT1155(nft).mintBatch(to, tokenIds, amounts, data); } function mintSocialToken( address token, address to, uint256 amount, uint8 v, bytes32 r, bytes32 s ) external override { address owner = ISocialToken(token).owner(); bytes32 hash = keccak256(abi.encode(MINT_SOCIAL_TOKEN_TYPEHASH, token, to, amount, nonces[owner]++)); Signature.verify(hash, owner, v, r, s, DOMAIN_SEPARATOR()); ISocialToken(token).mint(to, amount); } }
// SPDX-License-Identifier: MIT pragma solidity =0.8.3; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "../interfaces/IBaseExchange.sol"; import "../interfaces/ITokenFactory.sol"; import "../interfaces/IStrategy.sol"; import "../interfaces/IDividendPayingERC20.sol"; import "./ReentrancyGuardInitializable.sol"; import "../libraries/Signature.sol"; import "../interfaces/IERC2981.sol"; abstract contract BaseExchange is ReentrancyGuardInitializable, IBaseExchange { using SafeERC20 for IERC20; using Orders for Orders.Ask; using Orders for Orders.Bid; struct BestBid { address bidder; uint256 amount; uint256 price; address recipient; address referrer; uint256 timestamp; } mapping(address => mapping(bytes32 => mapping(address => bytes32))) internal _bidHashes; mapping(bytes32 => BestBid) public override bestBid; mapping(bytes32 => bool) public override isCancelledOrClaimed; mapping(bytes32 => uint256) public override amountFilled; function __BaseNFTExchange_init() internal initializer { __ReentrancyGuard_init(); } function DOMAIN_SEPARATOR() public view virtual override returns (bytes32); function factory() public view virtual override returns (address); function canTrade(address token) public view virtual override returns (bool) { return token == address(this); } function approvedBidHash( address proxy, bytes32 askHash, address bidder ) external view override returns (bytes32 bidHash) { return _bidHashes[proxy][askHash][bidder]; } function _transfer( address token, address from, address to, uint256 tokenId, uint256 amount ) internal virtual; function cancel(Orders.Ask memory order) external override { require(order.signer == msg.sender || order.proxy == msg.sender, "SHOYU: FORBIDDEN"); bytes32 hash = order.hash(); require(bestBid[hash].bidder == address(0), "SHOYU: BID_EXISTS"); isCancelledOrClaimed[hash] = true; emit Cancel(hash); } function updateApprovedBidHash( bytes32 askHash, address bidder, bytes32 bidHash ) external override { _bidHashes[msg.sender][askHash][bidder] = bidHash; emit UpdateApprovedBidHash(msg.sender, askHash, bidder, bidHash); } function bid(Orders.Ask memory askOrder, Orders.Bid memory bidOrder) external override nonReentrant returns (bool executed) { bytes32 askHash = askOrder.hash(); require(askHash == bidOrder.askHash, "SHOYU: UNMATCHED_HASH"); require(bidOrder.signer != address(0), "SHOYU: INVALID_SIGNER"); bytes32 bidHash = bidOrder.hash(); if (askOrder.proxy != address(0)) { require( askOrder.proxy == msg.sender || _bidHashes[askOrder.proxy][askHash][bidOrder.signer] == bidHash, "SHOYU: FORBIDDEN" ); delete _bidHashes[askOrder.proxy][askHash][bidOrder.signer]; emit UpdateApprovedBidHash(askOrder.proxy, askHash, bidOrder.signer, bytes32(0)); } Signature.verify(bidHash, bidOrder.signer, bidOrder.v, bidOrder.r, bidOrder.s, DOMAIN_SEPARATOR()); return _bid( askOrder, askHash, bidOrder.signer, bidOrder.amount, bidOrder.price, bidOrder.recipient, bidOrder.referrer ); } function bid( Orders.Ask memory askOrder, uint256 bidAmount, uint256 bidPrice, address bidRecipient, address bidReferrer ) external override nonReentrant returns (bool executed) { require(askOrder.proxy == address(0), "SHOYU: FORBIDDEN"); return _bid(askOrder, askOrder.hash(), msg.sender, bidAmount, bidPrice, bidRecipient, bidReferrer); } function _bid( Orders.Ask memory askOrder, bytes32 askHash, address bidder, uint256 bidAmount, uint256 bidPrice, address bidRecipient, address bidReferrer ) internal returns (bool executed) { require(canTrade(askOrder.token), "SHOYU: INVALID_EXCHANGE"); require(bidAmount > 0, "SHOYU: INVALID_AMOUNT"); uint256 _amountFilled = amountFilled[askHash]; require(_amountFilled + bidAmount <= askOrder.amount, "SHOYU: SOLD_OUT"); _validate(askOrder, askHash); Signature.verify(askHash, askOrder.signer, askOrder.v, askOrder.r, askOrder.s, DOMAIN_SEPARATOR()); BestBid storage best = bestBid[askHash]; if ( IStrategy(askOrder.strategy).canClaim( askOrder.proxy, askOrder.deadline, askOrder.params, bidder, bidPrice, best.bidder, best.price, best.timestamp ) ) { amountFilled[askHash] = _amountFilled + bidAmount; if (_amountFilled + bidAmount == askOrder.amount) isCancelledOrClaimed[askHash] = true; address recipient = askOrder.recipient; if (recipient == address(0)) recipient = askOrder.signer; require( _transferFeesAndFunds( askOrder.token, askOrder.tokenId, askOrder.currency, bidder, recipient, bidPrice * bidAmount ), "SHOYU: FAILED_TO_TRANSFER_FUNDS" ); if (bidRecipient == address(0)) bidRecipient = bidder; _transfer(askOrder.token, askOrder.signer, bidRecipient, askOrder.tokenId, bidAmount); emit Claim(askHash, bidder, bidAmount, bidPrice, bidRecipient, bidReferrer); return true; } else { if ( IStrategy(askOrder.strategy).canBid( askOrder.proxy, askOrder.deadline, askOrder.params, bidder, bidPrice, best.bidder, best.price, best.timestamp ) ) { best.bidder = bidder; best.amount = bidAmount; best.price = bidPrice; best.recipient = bidRecipient; best.referrer = bidReferrer; best.timestamp = block.timestamp; emit Bid(askHash, bidder, bidAmount, bidPrice, bidRecipient, bidReferrer); return false; } } revert("SHOYU: FAILURE"); } function claim(Orders.Ask memory askOrder) external override nonReentrant { require(canTrade(askOrder.token), "SHOYU: INVALID_EXCHANGE"); bytes32 askHash = askOrder.hash(); _validate(askOrder, askHash); Signature.verify(askHash, askOrder.signer, askOrder.v, askOrder.r, askOrder.s, DOMAIN_SEPARATOR()); BestBid memory best = bestBid[askHash]; require( IStrategy(askOrder.strategy).canClaim( askOrder.proxy, askOrder.deadline, askOrder.params, best.bidder, best.price, best.bidder, best.price, best.timestamp ), "SHOYU: FAILURE" ); address recipient = askOrder.recipient; if (recipient == address(0)) recipient = askOrder.signer; isCancelledOrClaimed[askHash] = true; require( _transferFeesAndFunds( askOrder.token, askOrder.tokenId, askOrder.currency, best.bidder, recipient, best.price * best.amount ), "SHOYU: FAILED_TO_TRANSFER_FUNDS" ); amountFilled[askHash] = amountFilled[askHash] + best.amount; address bidRecipient = best.recipient; if (bidRecipient == address(0)) bidRecipient = best.bidder; _transfer(askOrder.token, askOrder.signer, bidRecipient, askOrder.tokenId, best.amount); delete bestBid[askHash]; emit Claim(askHash, best.bidder, best.amount, best.price, bidRecipient, best.referrer); } function _validate(Orders.Ask memory askOrder, bytes32 askHash) internal view { require(!isCancelledOrClaimed[askHash], "SHOYU: CANCELLED_OR_CLAIMED"); require(askOrder.signer != address(0), "SHOYU: INVALID_MAKER"); require(askOrder.token != address(0), "SHOYU: INVALID_NFT"); require(askOrder.amount > 0, "SHOYU: INVALID_AMOUNT"); require(askOrder.strategy != address(0), "SHOYU: INVALID_STRATEGY"); require(askOrder.currency != address(0), "SHOYU: INVALID_CURRENCY"); require(ITokenFactory(factory()).isStrategyWhitelisted(askOrder.strategy), "SHOYU: STRATEGY_NOT_WHITELISTED"); } function _transferFeesAndFunds( address token, uint256 tokenId, address currency, address from, address to, uint256 amount ) internal returns (bool) { if (!_safeTransferFrom(currency, from, address(this), amount)) { return false; } address _factory = factory(); uint256 remainder = amount; { (address protocolFeeRecipient, uint8 protocolFeePermil) = ITokenFactory(_factory).protocolFeeInfo(); uint256 protocolFeeAmount = (amount * protocolFeePermil) / 1000; IERC20(currency).safeTransfer(protocolFeeRecipient, protocolFeeAmount); remainder -= protocolFeeAmount; } { (address operationalFeeRecipient, uint8 operationalFeePermil) = ITokenFactory(_factory).operationalFeeInfo(); uint256 operationalFeeAmount = (amount * operationalFeePermil) / 1000; IERC20(currency).safeTransfer(operationalFeeRecipient, operationalFeeAmount); remainder -= operationalFeeAmount; } try IERC2981(token).royaltyInfo(tokenId, amount) returns ( address royaltyFeeRecipient, uint256 royaltyFeeAmount ) { if (royaltyFeeAmount > 0) { remainder -= royaltyFeeAmount; _transferRoyaltyFee(currency, royaltyFeeRecipient, royaltyFeeAmount); } } catch {} IERC20(currency).safeTransfer(to, remainder); return true; } function _safeTransferFrom( address token, address from, address to, uint256 value ) private returns (bool) { (bool success, bytes memory returndata) = token.call(abi.encodeWithSelector(IERC20(token).transferFrom.selector, from, to, value)); return success && (returndata.length == 0 || abi.decode(returndata, (bool))); } function _transferRoyaltyFee( address currency, address to, uint256 amount ) internal { IERC20(currency).safeTransfer(to, amount); if (Address.isContract(to)) { try IDividendPayingERC20(to).sync() returns (uint256) {} catch {} } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../IERC20.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' // solhint-disable-next-line max-line-length require((value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT pragma solidity >=0.5.0; import "../libraries/Orders.sol"; interface IBaseExchange { event Cancel(bytes32 indexed hash); event Claim( bytes32 indexed hash, address bidder, uint256 amount, uint256 price, address recipient, address referrer ); event Bid(bytes32 indexed hash, address bidder, uint256 amount, uint256 price, address recipient, address referrer); event UpdateApprovedBidHash( address indexed proxy, bytes32 indexed askHash, address indexed bidder, bytes32 bidHash ); function DOMAIN_SEPARATOR() external view returns (bytes32); function factory() external view returns (address); function canTrade(address token) external view returns (bool); function bestBid(bytes32 hash) external view returns ( address bidder, uint256 amount, uint256 price, address recipient, address referrer, uint256 blockNumber ); function isCancelledOrClaimed(bytes32 hash) external view returns (bool); function amountFilled(bytes32 hash) external view returns (uint256); function approvedBidHash( address proxy, bytes32 askHash, address bidder ) external view returns (bytes32 bidHash); function cancel(Orders.Ask memory order) external; function updateApprovedBidHash( bytes32 askHash, address bidder, bytes32 bidHash ) external; function bid(Orders.Ask memory askOrder, Orders.Bid memory bidOrder) external returns (bool executed); function bid( Orders.Ask memory askOrder, uint256 bidAmount, uint256 bidPrice, address bidRecipient, address bidReferrer ) external returns (bool executed); function claim(Orders.Ask memory order) external; }
// SPDX-License-Identifier: MIT pragma solidity >=0.5.0; interface ITokenFactory { event SetBaseURI721(string uri); event SetBaseURI1155(string uri); event SetProtocolFeeRecipient(address recipient); event SetOperationalFee(uint8 fee); event SetOperationalFeeRecipient(address recipient); event SetDeployerWhitelisted(address deployer, bool whitelisted); event SetStrategyWhitelisted(address strategy, bool whitelisted); event UpgradeNFT721(address newTarget); event UpgradeNFT1155(address newTarget); event UpgradeSocialToken(address newTarget); event UpgradeERC721Exchange(address exchange); event UpgradeERC1155Exchange(address exchange); event DeployNFT721AndMintBatch( address indexed proxy, address indexed owner, string name, string symbol, uint256[] tokenIds, address royaltyFeeRecipient, uint8 royaltyFee ); event DeployNFT721AndPark( address indexed proxy, address indexed owner, string name, string symbol, uint256 toTokenId, address royaltyFeeRecipient, uint8 royaltyFee ); event DeployNFT1155AndMintBatch( address indexed proxy, address indexed owner, uint256[] tokenIds, uint256[] amounts, address royaltyFeeRecipient, uint8 royaltyFee ); event DeploySocialToken( address indexed proxy, address indexed owner, string name, string symbol, address indexed dividendToken, uint256 initialSupply ); function MAX_ROYALTY_FEE() external view returns (uint8); function MAX_OPERATIONAL_FEE() external view returns (uint8); function PARK_TOKEN_IDS_721_TYPEHASH() external view returns (bytes32); function MINT_BATCH_721_TYPEHASH() external view returns (bytes32); function MINT_BATCH_1155_TYPEHASH() external view returns (bytes32); function MINT_SOCIAL_TOKEN_TYPEHASH() external view returns (bytes32); function DOMAIN_SEPARATOR() external view returns (bytes32); function nonces(address account) external view returns (uint256); function baseURI721() external view returns (string memory); function baseURI1155() external view returns (string memory); function erc721Exchange() external view returns (address); function erc1155Exchange() external view returns (address); function protocolFeeInfo() external view returns (address recipient, uint8 permil); function operationalFeeInfo() external view returns (address recipient, uint8 permil); function isStrategyWhitelisted(address strategy) external view returns (bool); function isDeployerWhitelisted(address strategy) external view returns (bool); function setBaseURI721(string memory uri) external; function setBaseURI1155(string memory uri) external; function setProtocolFeeRecipient(address protocolFeeRecipient) external; function setOperationalFeeRecipient(address operationalFeeRecipient) external; function setOperationalFee(uint8 operationalFee) external; function setDeployerWhitelisted(address deployer, bool whitelisted) external; function setStrategyWhitelisted(address strategy, bool whitelisted) external; function upgradeNFT721(address newTarget) external; function upgradeNFT1155(address newTarget) external; function upgradeSocialToken(address newTarget) external; function upgradeERC721Exchange(address exchange) external; function upgradeERC1155Exchange(address exchange) external; function deployNFT721AndMintBatch( address owner, string calldata name, string calldata symbol, uint256[] calldata tokenIds, address royaltyFeeRecipient, uint8 royaltyFee ) external returns (address nft); function deployNFT721AndPark( address owner, string calldata name, string calldata symbol, uint256 toTokenId, address royaltyFeeRecipient, uint8 royaltyFee ) external returns (address nft); function isNFT721(address query) external view returns (bool result); function deployNFT1155AndMintBatch( address owner, uint256[] memory tokenIds, uint256[] memory amounts, address royaltyFeeRecipient, uint8 royaltyFee ) external returns (address nft); function isNFT1155(address query) external view returns (bool result); function deploySocialToken( address owner, string memory name, string memory symbol, address dividendToken, uint256 initialSupply ) external returns (address proxy); function isSocialToken(address query) external view returns (bool result); function parkTokenIds721( address nft, uint256 toTokenId, uint8 v, bytes32 r, bytes32 s ) external; function mintBatch721( address nft, address to, uint256[] calldata tokenIds, bytes calldata data, uint8 v, bytes32 r, bytes32 s ) external; function mintBatch1155( address nft, address to, uint256[] calldata tokenIds, uint256[] calldata amounts, bytes calldata data, uint8 v, bytes32 r, bytes32 s ) external; function mintSocialToken( address token, address to, uint256 amount, uint8 v, bytes32 r, bytes32 s ) external; }
// SPDX-License-Identifier: MIT pragma solidity >=0.5.0; import "../libraries/Orders.sol"; interface IStrategy { function canClaim( address proxy, uint256 deadline, bytes memory params, address bidder, uint256 bidPrice, address bestBidder, uint256 bestBidPrice, uint256 bestBidTimestamp ) external view returns (bool); function canBid( address proxy, uint256 deadline, bytes memory params, address bidder, uint256 bidPrice, address bestBidder, uint256 bestBidPrice, uint256 bestBidTimestamp ) external view returns (bool); }
// SPDX-License-Identifier: MIT pragma solidity >=0.5.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; interface IDividendPayingERC20 is IERC20, IERC20Metadata { /// @dev This event MUST emit when erc20/ether dividend is synced. /// @param increased The amount of increased erc20/ether in wei. event Sync(uint256 increased); /// @dev This event MUST emit when an address withdraws their dividend. /// @param to The address which withdraws erc20/ether from this contract. /// @param amount The amount of withdrawn erc20/ether in wei. event DividendWithdrawn(address indexed to, uint256 amount); function MAGNITUDE() external view returns (uint256); function dividendToken() external view returns (address); function totalDividend() external view returns (uint256); function sync() external payable returns (uint256 increased); function withdrawDividend() external; /// @notice View the amount of dividend in wei that an address can withdraw. /// @param account The address of a token holder. /// @return The amount of dividend in wei that `account` can withdraw. function dividendOf(address account) external view returns (uint256); /// @notice View the amount of dividend in wei that an address can withdraw. /// @param account The address of a token holder. /// @return The amount of dividend in wei that `account` can withdraw. function withdrawableDividendOf(address account) external view returns (uint256); /// @notice View the amount of dividend in wei that an address has withdrawn. /// @param account The address of a token holder. /// @return The amount of dividend in wei that `account` has withdrawn. function withdrawnDividendOf(address account) external view returns (uint256); /// @notice View the amount of dividend in wei that an address has earned in total. /// @dev accumulativeDividendOf(account) = withdrawableDividendOf(account) + withdrawnDividendOf(account) /// = (magnifiedDividendPerShare * balanceOf(account) + magnifiedDividendCorrections[account]) / magnitude /// @param account The address of a token holder. /// @return The amount of dividend in wei that `account` has earned in total. function accumulativeDividendOf(address account) external view returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity =0.8.3; import "@openzeppelin/contracts/proxy/utils/Initializable.sol"; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuardInitializable is Initializable { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. bool private constant _NOT_ENTERED = false; bool private constant _ENTERED = true; bool private _status; function __ReentrancyGuard_init() internal initializer { __ReentrancyGuard_init_unchained(); } function __ReentrancyGuard_init_unchained() internal initializer { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and make it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "SHOYU: REENTRANT"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } }
// SPDX-License-Identifier: MIT pragma solidity =0.8.3; import "../interfaces/IERC1271.sol"; import "@openzeppelin/contracts/utils/Address.sol"; library Signature { function recover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. require( uint256(s) <= 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0, "SHOYU: INVALID_SIGNATURE_S_VALUE" ); require(v == 27 || v == 28, "SHOYU: INVALID_SIGNATURE_V_VALUE"); // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); require(signer != address(0), "SHOYU: INVALID_SIGNATURE"); return signer; } function verify( bytes32 hash, address signer, uint8 v, bytes32 r, bytes32 s, bytes32 domainSeparator ) internal view { bytes32 digest = keccak256(abi.encodePacked("\x19\x01", domainSeparator, hash)); if (Address.isContract(signer)) { require( IERC1271(signer).isValidSignature(digest, abi.encodePacked(r, s, v)) == 0x1626ba7e, "SHOYU: UNAUTHORIZED" ); } else { require(recover(digest, v, r, s) == signer, "SHOYU: UNAUTHORIZED"); } } }
// SPDX-License-Identifier: MIT pragma solidity =0.8.3; import "@openzeppelin/contracts/utils/introspection/IERC165.sol"; /// /// @dev Interface for the NFT Royalty Standard /// interface IERC2981 is IERC165 { /// ERC165 bytes to add to interface array - set in parent contract /// implementing this standard /// /// bytes4(keccak256("royaltyInfo(uint256,uint256)")) == 0x2a55205a /// bytes4 private constant _INTERFACE_ID_ERC2981 = 0x2a55205a; /// _registerInterface(_INTERFACE_ID_ERC2981); /// @notice Called with the sale price to determine how much royalty // is owed and to whom. /// @param _tokenId - the NFT asset queried for royalty information /// @param _salePrice - the sale price of the NFT asset specified by _tokenId /// @return receiver - address of who should be sent the royalty payment /// @return royaltyAmount - the royalty payment amount for _salePrice function royaltyInfo(uint256 _tokenId, uint256 _salePrice) external view returns (address receiver, uint256 royaltyAmount); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
// SPDX-License-Identifier: MIT pragma solidity ^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.8.3; library Orders { // keccak256("Ask(address signer,address proxy,address token,uint256 tokenId,uint256 amount,address strategy,address currency,address recipient,uint256 deadline,bytes params)") bytes32 internal constant ASK_TYPEHASH = 0x5fbc9a24e1532fa5245d1ec2dc5592849ae97ac5475f361b1a1f7a6e2ac9b2fd; // keccak256("Bid(bytes32 askHash,address signer,uint256 amount,uint256 price,address recipient,address referrer)") bytes32 internal constant BID_TYPEHASH = 0xb98e1dc48988064e6dfb813618609d7da80a8841e5f277039788ac4b50d497b2; struct Ask { address signer; address proxy; address token; uint256 tokenId; uint256 amount; address strategy; address currency; address recipient; uint256 deadline; bytes params; uint8 v; bytes32 r; bytes32 s; } struct Bid { bytes32 askHash; address signer; uint256 amount; uint256 price; address recipient; address referrer; uint8 v; bytes32 r; bytes32 s; } function hash(Ask memory ask) internal pure returns (bytes32) { return keccak256( abi.encode( ASK_TYPEHASH, ask.signer, ask.proxy, ask.token, ask.tokenId, ask.amount, ask.strategy, ask.currency, ask.recipient, ask.deadline, keccak256(ask.params) ) ); } function hash(Bid memory bid) internal pure returns (bytes32) { return keccak256( abi.encode(BID_TYPEHASH, bid.askHash, bid.signer, bid.amount, bid.price, bid.recipient, bid.referrer) ); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: MIT // solhint-disable-next-line compiler-version pragma solidity ^0.8.0; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. */ bool private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Modifier to protect an initializer function from being invoked twice. */ modifier initializer() { require(_initializing || !_initialized, "Initializable: contract is already initialized"); bool isTopLevelCall = !_initializing; if (isTopLevelCall) { _initializing = true; _initialized = true; } _; if (isTopLevelCall) { _initializing = false; } } }
// SPDX-License-Identifier: MIT pragma solidity >=0.5.0; /// @title Interface for verifying contract-based account signatures /// @notice Interface that verifies provided signature for the data /// @dev Interface defined by EIP-1271 interface IERC1271 { /// @notice Returns whether the provided signature is valid for the provided data /// @dev MUST return the bytes4 magic value 0x1626ba7e when function passes. /// MUST NOT modify state (using STATICCALL for solc < 0.5, view modifier for solc > 0.5). /// MUST allow external calls. /// @param hash Hash of the data to be signed /// @param signature Signature byte array associated with _data /// @return magicValue The bytes4 magic value 0x1626ba7e function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4 magicValue); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT pragma solidity =0.8.3; import "./interfaces/INFT721.sol"; import "./base/BaseNFT721.sol"; import "./base/BaseExchange.sol"; contract NFT721V0 is BaseNFT721, BaseExchange, IERC2981, INFT721 { uint8 internal _MAX_ROYALTY_FEE; address internal _royaltyFeeRecipient; uint8 internal _royaltyFee; // out of 1000 function initialize( address _owner, string memory _name, string memory _symbol, uint256[] memory tokenIds, address royaltyFeeRecipient, uint8 royaltyFee ) external override initializer { __BaseNFTExchange_init(); initialize(_name, _symbol, _owner); _MAX_ROYALTY_FEE = ITokenFactory(_factory).MAX_ROYALTY_FEE(); for (uint256 i = 0; i < tokenIds.length; i++) { _safeMint(_owner, tokenIds[i]); } _setRoyaltyFeeRecipient(royaltyFeeRecipient); _royaltyFee = type(uint8).max; if (royaltyFee != 0) _setRoyaltyFee(royaltyFee); } function initialize( address _owner, string memory _name, string memory _symbol, uint256 toTokenId, address royaltyFeeRecipient, uint8 royaltyFee ) external override initializer { __BaseNFTExchange_init(); initialize(_name, _symbol, _owner); _MAX_ROYALTY_FEE = ITokenFactory(_factory).MAX_ROYALTY_FEE(); _parkTokenIds(toTokenId); emit ParkTokenIds(toTokenId); _setRoyaltyFeeRecipient(royaltyFeeRecipient); _royaltyFee = type(uint8).max; if (royaltyFee != 0) _setRoyaltyFee(royaltyFee); } function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721Initializable, IERC165) returns (bool) { return interfaceId == 0x2a55205a || super.supportsInterface(interfaceId); } function DOMAIN_SEPARATOR() public view override(BaseNFT721, BaseExchange, INFT721) returns (bytes32) { return BaseNFT721.DOMAIN_SEPARATOR(); } function factory() public view override(BaseNFT721, BaseExchange, INFT721) returns (address) { return _factory; } function royaltyInfo(uint256, uint256 _salePrice) external view override returns (address, uint256) { uint256 royaltyAmount; if (_royaltyFee != type(uint8).max) royaltyAmount = (_salePrice * _royaltyFee) / 1000; return (_royaltyFeeRecipient, royaltyAmount); } function _transfer( address, address from, address to, uint256 tokenId, uint256 ) internal override { if (from == owner() && _parked(tokenId)) { _safeMint(to, tokenId); } else { _transfer(from, to, tokenId); } } function setRoyaltyFeeRecipient(address royaltyFeeRecipient) public override onlyOwner { _setRoyaltyFeeRecipient(royaltyFeeRecipient); } function setRoyaltyFee(uint8 royaltyFee) public override onlyOwner { _setRoyaltyFee(royaltyFee); } function _setRoyaltyFeeRecipient(address royaltyFeeRecipient) internal { require(royaltyFeeRecipient != address(0), "SHOYU: INVALID_FEE_RECIPIENT"); _royaltyFeeRecipient = royaltyFeeRecipient; emit SetRoyaltyFeeRecipient(royaltyFeeRecipient); } function _setRoyaltyFee(uint8 royaltyFee) internal { if (_royaltyFee == type(uint8).max) { require(royaltyFee <= _MAX_ROYALTY_FEE, "SHOYU: INVALID_FEE"); } else { require(royaltyFee < _royaltyFee, "SHOYU: INVALID_FEE"); } _royaltyFee = royaltyFee; emit SetRoyaltyFee(royaltyFee); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.5.0; import "./IBaseNFT721.sol"; import "./IBaseExchange.sol"; interface INFT721 is IBaseNFT721, IBaseExchange { event SetRoyaltyFeeRecipient(address recipient); event SetRoyaltyFee(uint8 fee); function initialize( address _owner, string calldata _name, string calldata _symbol, uint256[] calldata tokenIds, address royaltyFeeRecipient, uint8 royaltyFee ) external; function initialize( address _owner, string calldata _name, string calldata _symbol, uint256 toTokenId, address royaltyFeeRecipient, uint8 royaltyFee ) external; function DOMAIN_SEPARATOR() external view override(IBaseNFT721, IBaseExchange) returns (bytes32); function factory() external view override(IBaseNFT721, IBaseExchange) returns (address); function setRoyaltyFeeRecipient(address _royaltyFeeRecipient) external; function setRoyaltyFee(uint8 _royaltyFee) external; }
// SPDX-License-Identifier: MIT pragma solidity =0.8.3; import "@openzeppelin/contracts/utils/Strings.sol"; import "../interfaces/IBaseNFT721.sol"; import "../interfaces/IERC1271.sol"; import "../interfaces/ITokenFactory.sol"; import "../base/ERC721Initializable.sol"; import "../base/OwnableInitializable.sol"; import "../libraries/Signature.sol"; abstract contract BaseNFT721 is ERC721Initializable, OwnableInitializable, IBaseNFT721 { // keccak256("Permit(address spender,uint256 tokenId,uint256 nonce,uint256 deadline)"); bytes32 public constant override PERMIT_TYPEHASH = 0x49ecf333e5b8c95c40fdafc95c1ad136e8914a8fb55e9dc8bb01eaa83a2df9ad; // keccak256("Permit(address owner,address spender,uint256 nonce,uint256 deadline)"); bytes32 public constant override PERMIT_ALL_TYPEHASH = 0xdaab21af31ece73a508939fedd476a5ee5129a5ed4bb091f3236ffb45394df62; bytes32 internal _DOMAIN_SEPARATOR; uint256 internal _CACHED_CHAIN_ID; address internal _factory; string internal __baseURI; mapping(uint256 => string) internal _uris; mapping(uint256 => uint256) public override nonces; mapping(address => uint256) public override noncesForAll; function initialize( string memory _name, string memory _symbol, address _owner ) public override initializer { __ERC721_init(_name, _symbol); __Ownable_init(_owner); _factory = msg.sender; _CACHED_CHAIN_ID = block.chainid; _DOMAIN_SEPARATOR = keccak256( abi.encode( // keccak256('EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)') 0x8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f, keccak256(bytes(Strings.toHexString(uint160(address(this))))), 0xc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6, // keccak256(bytes("1")) block.chainid, address(this) ) ); } function DOMAIN_SEPARATOR() public view virtual override returns (bytes32) { bytes32 domainSeparator; if (_CACHED_CHAIN_ID == block.chainid) domainSeparator = _DOMAIN_SEPARATOR; else { domainSeparator = keccak256( abi.encode( // keccak256('EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)') 0x8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f, keccak256(bytes(Strings.toHexString(uint160(address(this))))), 0xc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6, // keccak256(bytes("1")) block.chainid, address(this) ) ); } return domainSeparator; } function factory() public view virtual override returns (address) { return _factory; } function tokenURI(uint256 tokenId) public view override(ERC721Initializable, IERC721Metadata) returns (string memory) { require(_exists(tokenId) || _parked(tokenId), "SHOYU: INVALID_TOKEN_ID"); string memory _uri = _uris[tokenId]; if (bytes(_uri).length > 0) { return _uri; } else { string memory baseURI = __baseURI; if (bytes(baseURI).length > 0) { return string(abi.encodePacked(baseURI, Strings.toString(tokenId), ".json")); } else { baseURI = ITokenFactory(_factory).baseURI721(); string memory addy = Strings.toHexString(uint160(address(this)), 20); return string(abi.encodePacked(baseURI, addy, "/", Strings.toString(tokenId), ".json")); } } } function parked(uint256 tokenId) external view override returns (bool) { return _parked(tokenId); } function setTokenURI(uint256 id, string memory newURI) external override onlyOwner { _uris[id] = newURI; emit SetTokenURI(id, newURI); } function setBaseURI(string memory uri) external override onlyOwner { __baseURI = uri; emit SetBaseURI(uri); } function parkTokenIds(uint256 toTokenId) external override { require(owner() == msg.sender || _factory == msg.sender, "SHOYU: FORBIDDEN"); _parkTokenIds(toTokenId); emit ParkTokenIds(toTokenId); } function mint( address to, uint256 tokenId, bytes memory data ) external override { require(owner() == msg.sender || _factory == msg.sender, "SHOYU: FORBIDDEN"); _safeMint(to, tokenId, data); } function mintBatch( address to, uint256[] memory tokenIds, bytes memory data ) external override { require(owner() == msg.sender || _factory == msg.sender, "SHOYU: FORBIDDEN"); for (uint256 i = 0; i < tokenIds.length; i++) { _safeMint(to, tokenIds[i], data); } } function burn( uint256 tokenId, uint256 label, bytes32 data ) external override { require(ownerOf(tokenId) == msg.sender, "SHOYU: FORBIDDEN"); _burn(tokenId); emit Burn(tokenId, label, data); } function burnBatch(uint256[] memory tokenIds) external override { for (uint256 i = 0; i < tokenIds.length; i++) { uint256 tokenId = tokenIds[i]; require(ownerOf(tokenId) == msg.sender, "SHOYU: FORBIDDEN"); _burn(tokenId); } } function permit( address spender, uint256 tokenId, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external override { require(block.timestamp <= deadline, "SHOYU: EXPIRED"); address owner = ownerOf(tokenId); require(owner != address(0), "SHOYU: INVALID_TOKENID"); require(spender != owner, "SHOYU: NOT_NECESSARY"); bytes32 hash = keccak256(abi.encode(PERMIT_TYPEHASH, spender, tokenId, nonces[tokenId]++, deadline)); Signature.verify(hash, owner, v, r, s, DOMAIN_SEPARATOR()); _approve(spender, tokenId); } function permitAll( address owner, address spender, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external override { require(block.timestamp <= deadline, "SHOYU: EXPIRED"); require(owner != address(0), "SHOYU: INVALID_ADDRESS"); require(spender != owner, "SHOYU: NOT_NECESSARY"); bytes32 hash = keccak256(abi.encode(PERMIT_ALL_TYPEHASH, owner, spender, noncesForAll[owner]++, deadline)); Signature.verify(hash, owner, v, r, s, DOMAIN_SEPARATOR()); _setApprovalForAll(owner, spender, true); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.5.0; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol"; import "./IOwnable.sol"; interface IBaseNFT721 is IERC721, IERC721Metadata, IOwnable { event SetTokenURI(uint256 indexed tokenId, string uri); event SetBaseURI(string uri); event ParkTokenIds(uint256 toTokenId); event Burn(uint256 indexed tokenId, uint256 indexed label, bytes32 data); function PERMIT_TYPEHASH() external view returns (bytes32); function PERMIT_ALL_TYPEHASH() external view returns (bytes32); function DOMAIN_SEPARATOR() external view returns (bytes32); function factory() external view returns (address); function nonces(uint256 tokenId) external view returns (uint256); function noncesForAll(address account) external view returns (uint256); function parked(uint256 tokenId) external view returns (bool); function initialize( string calldata name, string calldata symbol, address _owner ) external; function setTokenURI(uint256 id, string memory uri) external; function setBaseURI(string memory uri) external; function parkTokenIds(uint256 toTokenId) external; function mint( address to, uint256 tokenId, bytes calldata data ) external; function mintBatch( address to, uint256[] calldata tokenIds, bytes calldata data ) external; function burn( uint256 tokenId, uint256 label, bytes32 data ) external; function burnBatch(uint256[] calldata tokenIds) external; function permit( address spender, uint256 tokenId, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; function permitAll( address owner, address spender, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, 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.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.5.0; interface IOwnable { event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); function owner() external view returns (address); function renounceOwnership() external; function transferOwnership(address newOwner) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant alphabet = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = alphabet[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } }
// SPDX-License-Identifier: MIT pragma solidity =0.8.3; import "@openzeppelin/contracts/proxy/utils/Initializable.sol"; import "@openzeppelin/contracts/utils/introspection/ERC165.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ contract ERC721Initializable is Initializable, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Upper bound of tokenId parked uint256 private _toTokenIdParked; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ function __ERC721_init(string memory name_, string memory symbol_) internal initializer { __ERC721_init_unchained(name_, symbol_); } function __ERC721_init_unchained(string memory name_, string memory symbol_) internal initializer { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "SHOYU: INVALID_OWNER"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { return _owners[tokenId]; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "SHOYU: INVALID_TOKEN_ID"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. Empty by default, can be overriden * in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721Initializable.ownerOf(tokenId); require(to != owner, "SHOYU: INVALID_TO"); require(msg.sender == owner || isApprovedForAll(owner, msg.sender), "SHOYU: FORBIDDEN"); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "SHOYU: INVALID_TOKEN_ID"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { _setApprovalForAll(msg.sender, operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(msg.sender, tokenId), "SHOYU: NOT_APPROVED_NOR_OWNER"); _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(msg.sender, tokenId), "SHOYU: FORBIDDEN"); _safeTransfer(from, to, tokenId, _data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "SHOYU: INVALID_RECEIVER"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "SHOYU: INVALID_TOKEN_ID"); address owner = ERC721Initializable.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } function _setApprovalForAll( address owner, address operator, bool approved ) internal { require(operator != owner, "SHOYU: INVALID_OPERATOR"); _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } function _parked(uint256 tokenId) internal view virtual returns (bool) { address owner = ERC721Initializable.ownerOf(tokenId); return owner == address(0) && tokenId < _toTokenIdParked; } function _parkTokenIds(uint256 toTokenId) internal virtual { uint256 fromTokenId = _toTokenIdParked; require(toTokenId > fromTokenId, "SHOYU: INVALID_TO_TOKEN_ID"); _toTokenIdParked = toTokenId; } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint( address to, uint256 tokenId, bytes memory _data ) internal virtual { _mint(to, tokenId); require(_checkOnERC721Received(address(0), to, tokenId, _data), "SHOYU: INVALID_RECEIVER"); } /** * @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), "SHOYU: INVALID_TO"); require(!_exists(tokenId), "SHOYU: ALREADY_MINTED"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[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 = ERC721Initializable.ownerOf(tokenId); require(owner != address(0), "SHOYU: INVALID_TOKEN_ID"); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[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(ERC721Initializable.ownerOf(tokenId) == from, "SHOYU: TRANSFER_FORBIDDEN"); require(to != address(0), "SHOYU: INVALID_RECIPIENT"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721Initializable.ownerOf(tokenId), to, tokenId); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(msg.sender, from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver(to).onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("SHOYU: INVALID_RECEIVER"); } else { // solhint-disable-next-line no-inline-assembly assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` 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.8.3; import "@openzeppelin/contracts/proxy/utils/Initializable.sol"; import "../interfaces/IOwnable.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 Initializable, IOwnable { address private _owner; /** * @dev Initializes the contract setting the deployer as the initial owner. */ function __Ownable_init(address __owner) internal initializer { __Ownable_init_unchained(__owner); } function __Ownable_init_unchained(address __owner) internal initializer { _owner = __owner; emit OwnershipTransferred(address(0), __owner); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual override returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(_owner == msg.sender, "SHOYU: FORBIDDEN"); _; } /** * @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 override 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 override onlyOwner { require(newOwner != address(0), "SHOYU: INVALID_NEW_OWNER"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received(address operator, address from, uint256 tokenId, bytes calldata data) external returns (bytes4); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () { 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.5.0; import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol"; import "@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol"; import "./IOwnable.sol"; interface IBaseNFT1155 is IERC1155, IERC1155MetadataURI, IOwnable { event SetURI(uint256 indexed id, string uri); event SetBaseURI(string uri); event Burn(uint256 indexed tokenId, uint256 amount, uint256 indexed label, bytes32 data); function PERMIT_TYPEHASH() external view returns (bytes32); function DOMAIN_SEPARATOR() external view returns (bytes32); function factory() external view returns (address); function nonces(address account) external view returns (uint256); function initialize(address _owner) external; function setURI(uint256 id, string memory uri) external; function setBaseURI(string memory baseURI) external; function mint( address to, uint256 tokenId, uint256 amount, bytes calldata data ) external; function mintBatch( address to, uint256[] calldata tokenIds, uint256[] calldata amounts, bytes calldata data ) external; function burn( uint256 tokenId, uint256 amount, uint256 label, bytes32 data ) external; function burnBatch(uint256[] calldata tokenIds, uint256[] calldata amounts) external; function permit( address owner, address spender, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; }
// SPDX-License-Identifier: MIT pragma solidity >=0.5.0; import "./IDividendPayingERC20.sol"; import "./IOwnable.sol"; interface ISocialToken is IDividendPayingERC20, IOwnable { event Burn(uint256 amount, uint256 indexed label, bytes32 data); function initialize( address owner, string memory name, string memory symbol, address dividendToken, uint256 initialSupply ) external; function PERMIT_TYPEHASH() external view returns (bytes32); function DOMAIN_SEPARATOR() external view returns (bytes32); function factory() external view returns (address); function nonces(address owner) external view returns (uint256); function mint(address account, uint256 value) external; function burn( uint256 value, uint256 id, bytes32 data ) external; function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; }
// SPDX-License-Identifier: MIT pragma solidity =0.8.3; // Reference: https://github.com/optionality/clone-factory/blob/master/contracts/CloneFactory.sol contract ProxyFactory { function _createProxy(address target, bytes memory initData) internal returns (address proxy) { bytes20 targetBytes = bytes20(target); assembly { let clone := mload(0x40) mstore(clone, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000) mstore(add(clone, 0x14), targetBytes) mstore(add(clone, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000) proxy := create(0, clone, 0x37) } if (initData.length > 0) { (bool success, ) = proxy.call(initData); require(success, "SHOYU: CALL_FAILURE"); } } function _isProxy(address target, address query) internal view returns (bool result) { bytes20 targetBytes = bytes20(target); assembly { let clone := mload(0x40) mstore(clone, 0x363d3d373d3d3d363d7300000000000000000000000000000000000000000000) mstore(add(clone, 0xa), targetBytes) mstore(add(clone, 0x1e), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000) let other := add(clone, 0x40) extcodecopy(query, other, 0, 0x2d) result := and(eq(mload(clone), mload(other)), eq(mload(add(clone, 0xd)), mload(add(other, 0xd)))) } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { 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.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC1155 compliant contract, as defined in the * https://eips.ethereum.org/EIPS/eip-1155[EIP]. * * _Available since v3.1._ */ interface IERC1155 is IERC165 { /** * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`. */ event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value); /** * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all * transfers. */ event TransferBatch(address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] values); /** * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to * `approved`. */ event ApprovalForAll(address indexed account, address indexed operator, bool approved); /** * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI. * * If an {URI} event was emitted for `id`, the standard * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value * returned by {IERC1155MetadataURI-uri}. */ event URI(string value, uint256 indexed id); /** * @dev Returns the amount of tokens of token type `id` owned by `account`. * * Requirements: * * - `account` cannot be the zero address. */ function balanceOf(address account, uint256 id) external view returns (uint256); /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}. * * Requirements: * * - `accounts` and `ids` must have the same length. */ function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids) external view returns (uint256[] memory); /** * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`, * * Emits an {ApprovalForAll} event. * * Requirements: * * - `operator` cannot be the caller. */ function setApprovalForAll(address operator, bool approved) external; /** * @dev Returns true if `operator` is approved to transfer ``account``'s tokens. * * See {setApprovalForAll}. */ function isApprovedForAll(address account, address operator) external view returns (bool); /** * @dev Transfers `amount` tokens of token type `id` from `from` to `to`. * * Emits a {TransferSingle} event. * * Requirements: * * - `to` cannot be the zero address. * - If the caller is not `from`, it must be have been approved to spend ``from``'s tokens via {setApprovalForAll}. * - `from` must have a balance of tokens of type `id` of at least `amount`. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external; /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}. * * Emits a {TransferBatch} event. * * Requirements: * * - `ids` and `amounts` must have the same length. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the * acceptance magic value. */ function safeBatchTransferFrom(address from, address to, uint256[] calldata ids, uint256[] calldata amounts, bytes calldata data) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../IERC1155.sol"; /** * @dev Interface of the optional ERC1155MetadataExtension interface, as defined * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP]. * * _Available since v3.1._ */ interface IERC1155MetadataURI is IERC1155 { /** * @dev Returns the URI for token type `id`. * * If the `\{id\}` substring is present in the URI, it must be replaced by * clients with the actual token type ID. */ function uri(uint256 id) external view returns (string memory); }
// SPDX-License-Identifier: MIT pragma solidity =0.8.3; import "./interfaces/IPaymentSplitterFactory.sol"; import "./base/ProxyFactory.sol"; import "./PaymentSplitter.sol"; contract PaymentSplitterFactory is ProxyFactory, IPaymentSplitterFactory { address internal _target; constructor() { PaymentSplitter target = new PaymentSplitter(); address[] memory payees = new address[](1); payees[0] = msg.sender; uint256[] memory shares = new uint256[](1); shares[0] = 1; target.initialize("", payees, shares); _target = address(target); } function deployPaymentSplitter( address owner, string calldata title, address[] calldata payees, uint256[] calldata shares ) external override returns (address splitter) { splitter = _createProxy( _target, abi.encodeWithSignature("initialize(string,address[],uint256[])", title, payees, shares) ); emit DeployPaymentSplitter(owner, title, payees, shares, splitter); } function isPaymentSplitter(address query) external view override returns (bool result) { return _isProxy(_target, query); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.5.0; interface IPaymentSplitterFactory { event DeployPaymentSplitter( address indexed owner, string title, address[] payees, uint256[] shares, address splitter ); function deployPaymentSplitter( address owner, string calldata title, address[] calldata payees, uint256[] calldata shares ) external returns (address splitter); function isPaymentSplitter(address query) external view returns (bool result); }
// SPDX-License-Identifier: MIT pragma solidity =0.8.3; import "@openzeppelin/contracts/proxy/utils/Initializable.sol"; import "./interfaces/IPaymentSplitter.sol"; import "./libraries/TokenHelper.sol"; // Reference: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/finance/PaymentSplitter.sol contract PaymentSplitter is Initializable, IPaymentSplitter { using TokenHelper for address; string public override title; /** * @dev Getter for the total shares held by payees. */ uint256 public override totalShares; /** * @dev Getter for the total amount of token already released. */ mapping(address => uint256) public override totalReleased; /** * @dev Getter for the amount of shares held by an account. */ mapping(address => uint256) public override shares; /** * @dev Getter for the amount of token already released to a payee. */ mapping(address => mapping(address => uint256)) public override released; /** * @dev Getter for the address of the payee number `index`. */ address[] public override payees; /** * @dev Creates an instance of `PaymentSplitter` where each account in `payees` is assigned the number of shares at * the matching position in the `shares` array. * * All addresses in `payees` must be non-zero. Both arrays must have the same non-zero length, and there must be no * duplicates in `payees`. */ function initialize( string calldata _title, address[] calldata _payees, uint256[] calldata _shares ) external override initializer { require(_payees.length == _shares.length, "SHOYU: LENGTHS_NOT_EQUAL"); require(_payees.length > 0, "SHOYU: LENGTH_TOO_SHORT"); title = _title; for (uint256 i = 0; i < _payees.length; i++) { _addPayee(_payees[i], _shares[i]); } } /** * @dev Triggers a transfer to `account` of the amount of token they are owed, according to their percentage of the * total shares and their previous withdrawals. */ function release(address token, address account) external virtual override { require(shares[account] > 0, "SHOYU: FORBIDDEN"); uint256 totalReceived = token.balanceOf(address(this)) + totalReleased[token]; uint256 payment = (totalReceived * shares[account]) / totalShares - released[token][account]; require(payment != 0, "SHOYU: NO_PAYMENT"); released[token][account] += payment; totalReleased[token] += payment; token.safeTransfer(account, payment); emit PaymentReleased(token, account, payment); } /** * @dev Add a new payee to the contract. * @param account The address of the payee to add. * @param _shares The number of shares owned by the payee. */ function _addPayee(address account, uint256 _shares) private { require(account != address(0), "SHOYU: INVALID_ADDRESS"); require(_shares > 0, "SHOYU: INVALID_SHARES"); require(shares[account] == 0, "SHOYU: ALREADY_ADDED"); payees.push(account); shares[account] = _shares; totalShares = totalShares + _shares; emit PayeeAdded(account, _shares); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.5.0; interface IPaymentSplitter { event PayeeAdded(address account, uint256 shares); event PaymentReleased(address token, address to, uint256 amount); function initialize( string calldata _title, address[] calldata _payees, uint256[] calldata _shares ) external; function title() external view returns (string memory); function totalShares() external view returns (uint256); function totalReleased(address account) external view returns (uint256); function shares(address account) external view returns (uint256); function released(address token, address account) external view returns (uint256); function payees(uint256 index) external view returns (address); function release(address token, address account) external; }
// SPDX-License-Identifier: MIT pragma solidity =0.8.3; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; library TokenHelper { using SafeERC20 for IERC20; address public constant ETH = 0x0000000000000000000000000000000000000000; function balanceOf(address token, address account) internal view returns (uint256) { if (token == ETH) { return account.balance; } else { return IERC20(token).balanceOf(account); } } function safeTransfer( address token, address to, uint256 amount ) internal { if (token == ETH) { (bool success, ) = to.call{value: amount}(""); require(success, "SHOYU: TRANSFER_FAILURE"); } else { IERC20(token).safeTransfer(to, amount); } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IERC721.sol"; import "./IERC721Receiver.sol"; import "./extensions/IERC721Metadata.sol"; import "../../utils/Address.sol"; import "../../utils/Context.sol"; import "../../utils/Strings.sol"; import "../../utils/introspection/ERC165.sol"; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping (uint256 => address) private _owners; // Mapping owner address to token count mapping (address => uint256) private _balances; // Mapping from token ID to approved address mapping (uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping (address => mapping (address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor (string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ''; } /** * @dev Base URI for computing {tokenURI}. Empty by default, can be overriden * in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require(_msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual 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 virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom(address from, address to, uint256 tokenId) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: 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 mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer(address from, address to, uint256 tokenId, bytes memory _data) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint(address to, uint256 tokenId, bytes memory _data) internal virtual { _mint(to, tokenId); require(_checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer(address from, address to, uint256 tokenId) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer 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); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory _data) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver(to).onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { // solhint-disable-next-line no-inline-assembly assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` 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.8.3; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "../interfaces/IERC2981.sol"; contract ERC721RoyaltyMock is ERC721("Mock", "MOCK") { address public owner; constructor() { owner = msg.sender; } function safeMint( address to, uint256 tokenId, bytes memory data ) external { _safeMint(to, tokenId, data); } function safeMintBatch0( address[] calldata to, uint256[] calldata tokenId, bytes memory data ) external { require(to.length == tokenId.length); for (uint256 i = 0; i < to.length; i++) { _safeMint(to[i], tokenId[i], data); } } function safeMintBatch1( address to, uint256[] calldata tokenId, bytes memory data ) external { for (uint256 i = 0; i < tokenId.length; i++) { _safeMint(to, tokenId[i], data); } } function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == 0x2a55205a || super.supportsInterface(interfaceId); } function royaltyInfo(uint256 _tokenId, uint256 _salePrice) external view returns (address, uint256) { uint256 fee = 100; if (_tokenId < 10) fee = 10; return (owner, (_salePrice * fee) / 1000); } }
// SPDX-License-Identifier: MIT pragma solidity =0.8.3; import "./interfaces/INFT1155.sol"; import "./interfaces/IERC2981.sol"; import "./base/BaseNFT1155.sol"; import "./base/BaseExchange.sol"; contract NFT1155V0 is BaseNFT1155, BaseExchange, IERC2981, INFT1155 { uint8 internal _MAX_ROYALTY_FEE; address internal _royaltyFeeRecipient; uint8 internal _royaltyFee; // out of 1000 function initialize( address _owner, uint256[] memory tokenIds, uint256[] memory amounts, address royaltyFeeRecipient, uint8 royaltyFee ) external override initializer { __BaseNFTExchange_init(); initialize(_owner); _MAX_ROYALTY_FEE = ITokenFactory(_factory).MAX_ROYALTY_FEE(); if (tokenIds.length > 0) { _mintBatch(_owner, tokenIds, amounts, ""); } _setRoyaltyFeeRecipient(royaltyFeeRecipient); _royaltyFee = type(uint8).max; if (royaltyFee != 0) _setRoyaltyFee(royaltyFee); } function supportsInterface(bytes4 interfaceId) public view virtual override(ERC1155Initializable, IERC165) returns (bool) { return interfaceId == 0x2a55205a || super.supportsInterface(interfaceId); } function DOMAIN_SEPARATOR() public view override(BaseNFT1155, BaseExchange, INFT1155) returns (bytes32) { return BaseNFT1155.DOMAIN_SEPARATOR(); } function factory() public view override(BaseNFT1155, BaseExchange, INFT1155) returns (address) { return _factory; } function royaltyInfo(uint256, uint256 _salePrice) external view override returns (address, uint256) { uint256 royaltyAmount; if (_royaltyFee != type(uint8).max) royaltyAmount = (_salePrice * _royaltyFee) / 1000; return (_royaltyFeeRecipient, royaltyAmount); } function _transfer( address, address from, address to, uint256 tokenId, uint256 amount ) internal override { _transfer(from, to, tokenId, amount); emit TransferSingle(msg.sender, from, to, tokenId, amount); } function setRoyaltyFeeRecipient(address royaltyFeeRecipient) public override onlyOwner { _setRoyaltyFeeRecipient(royaltyFeeRecipient); } function setRoyaltyFee(uint8 royaltyFee) public override onlyOwner { _setRoyaltyFee(royaltyFee); } function _setRoyaltyFeeRecipient(address royaltyFeeRecipient) internal { require(royaltyFeeRecipient != address(0), "SHOYU: INVALID_FEE_RECIPIENT"); _royaltyFeeRecipient = royaltyFeeRecipient; emit SetRoyaltyFeeRecipient(royaltyFeeRecipient); } function _setRoyaltyFee(uint8 royaltyFee) internal { if (_royaltyFee == type(uint8).max) { require(royaltyFee <= _MAX_ROYALTY_FEE, "SHOYU: INVALID_FEE"); } else { require(royaltyFee < _royaltyFee, "SHOYU: INVALID_FEE"); } _royaltyFee = royaltyFee; emit SetRoyaltyFee(royaltyFee); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.5.0; import "./IBaseNFT1155.sol"; import "./IBaseExchange.sol"; interface INFT1155 is IBaseNFT1155, IBaseExchange { event SetRoyaltyFeeRecipient(address recipient); event SetRoyaltyFee(uint8 fee); function initialize( address _owner, uint256[] calldata tokenIds, uint256[] calldata amounts, address royaltyFeeRecipient, uint8 royaltyFee ) external; function DOMAIN_SEPARATOR() external view override(IBaseNFT1155, IBaseExchange) returns (bytes32); function factory() external view override(IBaseNFT1155, IBaseExchange) returns (address); function setRoyaltyFeeRecipient(address _royaltyFeeRecipient) external; function setRoyaltyFee(uint8 _royaltyFee) external; }
// SPDX-License-Identifier: MIT pragma solidity =0.8.3; import "@openzeppelin/contracts/utils/Strings.sol"; import "../interfaces/IBaseNFT1155.sol"; import "../interfaces/IERC1271.sol"; import "../interfaces/ITokenFactory.sol"; import "../base/ERC1155Initializable.sol"; import "../base/OwnableInitializable.sol"; import "../libraries/Signature.sol"; abstract contract BaseNFT1155 is ERC1155Initializable, OwnableInitializable, IBaseNFT1155 { using Strings for uint256; // keccak256("Permit(address owner,address spender,uint256 nonce,uint256 deadline)"); bytes32 public constant override PERMIT_TYPEHASH = 0xdaab21af31ece73a508939fedd476a5ee5129a5ed4bb091f3236ffb45394df62; bytes32 internal _DOMAIN_SEPARATOR; uint256 internal _CACHED_CHAIN_ID; uint8 internal MAX_ROYALTY_FEE; address internal _factory; string internal _baseURI; mapping(uint256 => string) internal _uris; mapping(address => uint256) public override nonces; function initialize(address _owner) public override initializer { __ERC1155_init(""); __Ownable_init(_owner); _factory = msg.sender; _CACHED_CHAIN_ID = block.chainid; _DOMAIN_SEPARATOR = keccak256( abi.encode( // keccak256('EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)') 0x8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f, keccak256(bytes(Strings.toHexString(uint160(address(this))))), 0xc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6, // keccak256(bytes("1")) block.chainid, address(this) ) ); } function DOMAIN_SEPARATOR() public view virtual override returns (bytes32) { bytes32 domainSeparator; if (_CACHED_CHAIN_ID == block.chainid) domainSeparator = _DOMAIN_SEPARATOR; else { domainSeparator = keccak256( abi.encode( // keccak256('EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)') 0x8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f, keccak256(bytes(Strings.toHexString(uint160(address(this))))), 0xc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6, // keccak256(bytes("1")) block.chainid, address(this) ) ); } return domainSeparator; } function factory() public view virtual override returns (address) { return _factory; } function uri(uint256 id) public view virtual override(ERC1155Initializable, IERC1155MetadataURI) returns (string memory) { string memory _uri = _uris[id]; if (bytes(_uri).length > 0) { return _uri; } else { string memory baseURI = _baseURI; if (bytes(baseURI).length > 0) { return string(abi.encodePacked(baseURI, "{id}.json")); } else { baseURI = ITokenFactory(_factory).baseURI1155(); string memory addy = Strings.toHexString(uint160(address(this)), 20); return string(abi.encodePacked(baseURI, addy, "/{id}.json")); } } } function setURI(uint256 id, string memory newURI) external override onlyOwner { _uris[id] = newURI; emit SetURI(id, newURI); } function setBaseURI(string memory baseURI) external override onlyOwner { _baseURI = baseURI; emit SetBaseURI(baseURI); } function mint( address to, uint256 tokenId, uint256 amount, bytes memory data ) external override { require(owner() == msg.sender || _factory == msg.sender, "SHOYU: FORBIDDEN"); _mint(to, tokenId, amount, data); } function mintBatch( address to, uint256[] memory tokenIds, uint256[] memory amounts, bytes memory data ) external override { require(owner() == msg.sender || _factory == msg.sender, "SHOYU: FORBIDDEN"); _mintBatch(to, tokenIds, amounts, data); } function burn( uint256 tokenId, uint256 amount, uint256 label, bytes32 data ) external override { _burn(msg.sender, tokenId, amount); emit Burn(tokenId, amount, label, data); } function burnBatch(uint256[] calldata tokenIds, uint256[] calldata amounts) external override { _burnBatch(msg.sender, tokenIds, amounts); } function permit( address owner, address spender, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external override { require(block.timestamp <= deadline, "SHOYU: EXPIRED"); require(owner != address(0), "SHOYU: INVALID_ADDRESS"); require(spender != owner, "SHOYU: NOT_NECESSARY"); bytes32 hash = keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, nonces[owner]++, deadline)); Signature.verify(hash, owner, v, r, s, DOMAIN_SEPARATOR()); _setApprovalForAll(owner, spender, true); } }
// SPDX-License-Identifier: MIT pragma solidity =0.8.3; import "@openzeppelin/contracts/proxy/utils/Initializable.sol"; import "@openzeppelin/contracts/utils/introspection/ERC165.sol"; import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol"; import "@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol"; import "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol"; import "@openzeppelin/contracts/utils/Address.sol"; /** * @dev Implementation of the basic standard multi-token. * See https://eips.ethereum.org/EIPS/eip-1155 * Originally based on code by Enjin: https://github.com/enjin/erc-1155 * * _Available since v3.1._ */ contract ERC1155Initializable is Initializable, ERC165, IERC1155, IERC1155MetadataURI { using Address for address; // Mapping from token ID to account balances mapping(uint256 => mapping(address => uint256)) private _balances; // Mapping from account to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; // Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json string private _uri; /** * @dev See {_setURI}. */ function __ERC1155_init(string memory uri_) internal initializer { __ERC1155_init_unchained(uri_); } function __ERC1155_init_unchained(string memory uri_) internal initializer { _setURI(uri_); } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC1155).interfaceId || interfaceId == type(IERC1155MetadataURI).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC1155MetadataURI-uri}. * * This implementation returns the same URI for *all* token types. It relies * on the token type ID substitution mechanism * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP]. * * Clients calling this function must replace the `\{id\}` substring with the * actual token type ID. */ function uri(uint256) public view virtual override returns (string memory) { return _uri; } /** * @dev See {IERC1155-balanceOf}. * * Requirements: * * - `account` cannot be the zero address. */ function balanceOf(address account, uint256 id) public view virtual override returns (uint256) { require(account != address(0), "SHOYU: INVALID_ADDRESS"); return _balances[id][account]; } /** * @dev See {IERC1155-balanceOfBatch}. * * Requirements: * * - `accounts` and `ids` must have the same length. */ function balanceOfBatch(address[] memory accounts, uint256[] memory ids) public view virtual override returns (uint256[] memory) { require(accounts.length == ids.length, "SHOYU: LENGTHS_NOT_EQUAL"); uint256[] memory batchBalances = new uint256[](accounts.length); for (uint256 i = 0; i < accounts.length; ++i) { batchBalances[i] = balanceOf(accounts[i], ids[i]); } return batchBalances; } /** * @dev See {IERC1155-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { _setApprovalForAll(msg.sender, operator, approved); } /** * @dev See {IERC1155-isApprovedForAll}. */ function isApprovedForAll(address account, address operator) public view virtual override returns (bool) { return _operatorApprovals[account][operator]; } /** * @dev See {IERC1155-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 id, uint256 amount, bytes memory data ) public virtual override { require(to != address(0), "SHOYU: INVALID_ADDRESS"); require(from == msg.sender || isApprovedForAll(from, msg.sender), "SHOYU: FORBIDDEN"); address operator = msg.sender; _beforeTokenTransfer(operator, from, to, _asSingletonArray(id), _asSingletonArray(amount), data); _transfer(from, to, id, amount); emit TransferSingle(operator, from, to, id, amount); _doSafeTransferAcceptanceCheck(operator, from, to, id, amount, data); } function _transfer( address from, address to, uint256 id, uint256 amount ) internal { uint256 fromBalance = _balances[id][from]; require(fromBalance >= amount, "SHOYU: INSUFFICIENT_BALANCE"); _balances[id][from] = fromBalance - amount; _balances[id][to] += amount; } /** * @dev See {IERC1155-safeBatchTransferFrom}. */ function safeBatchTransferFrom( address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) public virtual override { require(ids.length == amounts.length, "SHOYU: LENGTHS_NOT_EQUAL"); require(to != address(0), "SHOYU: INVALID_ADDRESS"); require(from == msg.sender || isApprovedForAll(from, msg.sender), "SHOYU: FORBIDDEN"); address operator = msg.sender; _beforeTokenTransfer(operator, from, to, ids, amounts, data); for (uint256 i = 0; i < ids.length; ++i) { uint256 id = ids[i]; uint256 amount = amounts[i]; uint256 fromBalance = _balances[id][from]; require(fromBalance >= amount, "SHOYU: INSUFFICIENT_BALANCE"); _balances[id][from] = fromBalance - amount; _balances[id][to] += amount; } emit TransferBatch(operator, from, to, ids, amounts); _doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, amounts, data); } /** * @dev Sets a new URI for all token types, by relying on the token type ID * substitution mechanism * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP]. * * By this mechanism, any occurrence of the `\{id\}` substring in either the * URI or any of the amounts in the JSON file at said URI will be replaced by * clients with the token type ID. * * For example, the `https://token-cdn-domain/\{id\}.json` URI would be * interpreted by clients as * `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json` * for token type ID 0x4cce0. * * See {uri}. * * Because these URIs cannot be meaningfully represented by the {URI} event, * this function emits no events. */ function _setURI(string memory newuri) internal virtual { _uri = newuri; } function _setApprovalForAll( address account, address operator, bool approved ) internal { require(account != operator, "SHOYU: NOT_ALLOWED"); _operatorApprovals[account][operator] = approved; emit ApprovalForAll(account, operator, approved); } /** * @dev Creates `amount` tokens of token type `id`, and assigns them to `account`. * * Emits a {TransferSingle} event. * * Requirements: * * - `account` cannot be the zero address. * - If `account` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function _mint( address account, uint256 id, uint256 amount, bytes memory data ) internal virtual { require(account != address(0), "SHOYU: INVALID_ADDRESS"); address operator = msg.sender; _beforeTokenTransfer(operator, address(0), account, _asSingletonArray(id), _asSingletonArray(amount), data); _balances[id][account] += amount; emit TransferSingle(operator, address(0), account, id, amount); _doSafeTransferAcceptanceCheck(operator, address(0), account, id, amount, data); } /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}. * * Requirements: * * - `ids` and `amounts` must have the same length. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the * acceptance magic value. */ function _mintBatch( address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual { require(to != address(0), "SHOYU: INVALID_ADDRESS"); require(ids.length == amounts.length, "SHOYU: LENGTHS_NOT_EQUAL"); address operator = msg.sender; _beforeTokenTransfer(operator, address(0), to, ids, amounts, data); for (uint256 i = 0; i < ids.length; i++) { _balances[ids[i]][to] += amounts[i]; } emit TransferBatch(operator, address(0), to, ids, amounts); _doSafeBatchTransferAcceptanceCheck(operator, address(0), to, ids, amounts, data); } /** * @dev Destroys `amount` tokens of token type `id` from `account` * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens of token type `id`. */ function _burn( address account, uint256 id, uint256 amount ) internal virtual { require(account != address(0), "SHOYU: INVALID_ADDRESS"); address operator = msg.sender; _beforeTokenTransfer(operator, account, address(0), _asSingletonArray(id), _asSingletonArray(amount), ""); uint256 accountBalance = _balances[id][account]; require(accountBalance >= amount, "SHOYU: INSUFFICIENT_BALANCE"); _balances[id][account] = accountBalance - amount; emit TransferSingle(operator, account, address(0), id, amount); } /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}. * * Requirements: * * - `ids` and `amounts` must have the same length. */ function _burnBatch( address account, uint256[] memory ids, uint256[] memory amounts ) internal virtual { require(account != address(0), "SHOYU: INVALID_ADDRESS"); require(ids.length == amounts.length, "SHOYU: LENGTHS_NOT_EQUAL"); address operator = msg.sender; _beforeTokenTransfer(operator, account, address(0), ids, amounts, ""); for (uint256 i = 0; i < ids.length; i++) { uint256 id = ids[i]; uint256 amount = amounts[i]; uint256 accountBalance = _balances[id][account]; require(accountBalance >= amount, "SHOYU: INSUFFICIENT_BALANCE"); _balances[id][account] = accountBalance - amount; } emit TransferBatch(operator, account, address(0), ids, amounts); } /** * @dev Hook that is called before any token transfer. This includes minting * and burning, as well as batched variants. * * The same hook is called on both single and batched variants. For single * transfers, the length of the `id` and `amount` arrays will be 1. * * Calling conditions (for each `id` and `amount` pair): * * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens * of token type `id` will be transferred to `to`. * - When `from` is zero, `amount` tokens of token type `id` will be minted * for `to`. * - when `to` is zero, `amount` of ``from``'s tokens of token type `id` * will be burned. * - `from` and `to` are never both zero. * - `ids` and `amounts` have the same, non-zero length. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual {} function _doSafeTransferAcceptanceCheck( address operator, address from, address to, uint256 id, uint256 amount, bytes memory data ) private { if (to.isContract()) { try IERC1155Receiver(to).onERC1155Received(operator, from, id, amount, data) returns (bytes4 response) { if (response != IERC1155Receiver(to).onERC1155Received.selector) { revert("SHOYU: INVALID_RECEIVER"); } } catch Error(string memory reason) { revert(reason); } catch { revert("SHOYU: NO_RECEIVER"); } } } function _doSafeBatchTransferAcceptanceCheck( address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) private { if (to.isContract()) { try IERC1155Receiver(to).onERC1155BatchReceived(operator, from, ids, amounts, data) returns ( bytes4 response ) { if (response != IERC1155Receiver(to).onERC1155BatchReceived.selector) { revert("SHOYU: INVALID_RECEIVER"); } } catch Error(string memory reason) { revert(reason); } catch { revert("SHOYU: NO_RECEIVER"); } } } function _asSingletonArray(uint256 element) private pure returns (uint256[] memory) { uint256[] memory array = new uint256[](1); array[0] = element; return array; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev _Available since v3.1._ */ interface IERC1155Receiver is IERC165 { /** @dev Handles the receipt of a single ERC1155 token type. This function is called at the end of a `safeTransferFrom` after the balance has been updated. To accept the transfer, this must return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` (i.e. 0xf23a6e61, or its own function selector). @param operator The address which initiated the transfer (i.e. msg.sender) @param from The address which previously owned the token @param id The ID of the token being transferred @param value The amount of tokens being transferred @param data Additional data with no specified format @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed */ function onERC1155Received( address operator, address from, uint256 id, uint256 value, bytes calldata data ) external returns(bytes4); /** @dev Handles the receipt of a multiple ERC1155 token types. This function is called at the end of a `safeBatchTransferFrom` after the balances have been updated. To accept the transfer(s), this must return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` (i.e. 0xbc197c81, or its own function selector). @param operator The address which initiated the batch transfer (i.e. msg.sender) @param from The address which previously owned the token @param ids An array containing ids of each token being transferred (order and length must match values array) @param values An array containing amounts of each token being transferred (order and length must match ids array) @param data Additional data with no specified format @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed */ function onERC1155BatchReceived( address operator, address from, uint256[] calldata ids, uint256[] calldata values, bytes calldata data ) external returns(bytes4); }
// SPDX-License-Identifier: MIT pragma solidity =0.8.3; import "@openzeppelin/contracts/utils/Strings.sol"; import "./base/DividendPayingERC20.sol"; import "./base/OwnableInitializable.sol"; import "./interfaces/ISocialToken.sol"; import "./libraries/Signature.sol"; contract SocialTokenV0 is DividendPayingERC20, OwnableInitializable, ISocialToken { // keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"); bytes32 public constant override PERMIT_TYPEHASH = 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9; bytes32 internal _DOMAIN_SEPARATOR; uint256 internal _CACHED_CHAIN_ID; address internal _factory; mapping(address => uint256) public override nonces; function initialize( address _owner, string memory _name, string memory _symbol, address _dividendToken, uint256 initialSupply ) external override initializer { __Ownable_init(_owner); __DividendPayingERC20_init(_name, _symbol, _dividendToken); _factory = msg.sender; _mint(_owner, initialSupply); _CACHED_CHAIN_ID = block.chainid; _DOMAIN_SEPARATOR = keccak256( abi.encode( // keccak256('EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)') 0x8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f, keccak256(bytes(Strings.toHexString(uint160(address(this))))), 0xc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6, // keccak256(bytes("1")) block.chainid, address(this) ) ); } function DOMAIN_SEPARATOR() public view override returns (bytes32) { bytes32 domainSeparator; if (_CACHED_CHAIN_ID == block.chainid) domainSeparator = _DOMAIN_SEPARATOR; else { domainSeparator = keccak256( abi.encode( // keccak256('EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)') 0x8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f, keccak256(bytes(Strings.toHexString(uint160(address(this))))), 0xc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6, // keccak256(bytes("1")) block.chainid, address(this) ) ); } return domainSeparator; } function factory() public view override returns (address) { return _factory; } function mint(address account, uint256 value) external override { require(owner() == msg.sender || _factory == msg.sender, "SHOYU: FORBIDDEN"); _mint(account, value); } function burn( uint256 value, uint256 label, bytes32 data ) external override { _burn(msg.sender, value); emit Burn(value, label, data); } function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external override { require(block.timestamp <= deadline, "SHOYU: EXPIRED"); require(owner != address(0), "SHOYU: INVALID_ADDRESS"); require(spender != owner, "SHOYU: NOT_NECESSARY"); bytes32 hash = keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, nonces[owner]++, deadline)); Signature.verify(hash, owner, v, r, s, DOMAIN_SEPARATOR()); _approve(owner, spender, value); } }
// SPDX-License-Identifier: MIT pragma solidity =0.8.3; import "@openzeppelin/contracts/utils/math/SafeCast.sol"; import "./ERC20Initializable.sol"; import "../libraries/TokenHelper.sol"; import "../interfaces/IDividendPayingERC20.sol"; /// @dev A mintable ERC20 token that allows anyone to pay and distribute ether/erc20 /// to token holders as dividends and allows token holders to withdraw their dividends. /// Reference: https://github.com/Roger-Wu/erc1726-dividend-paying-token/blob/master/contracts/DividendPayingToken.sol abstract contract DividendPayingERC20 is ERC20Initializable, IDividendPayingERC20 { using SafeCast for uint256; using SafeCast for int256; using TokenHelper for address; // For more discussion about choosing the value of `magnitude`, // see https://github.com/ethereum/EIPs/issues/1726#issuecomment-472352728 uint256 public constant override MAGNITUDE = 2**128; address public override dividendToken; uint256 public override totalDividend; uint256 internal magnifiedDividendPerShare; function __DividendPayingERC20_init( string memory _name, string memory _symbol, address _dividendToken ) internal initializer { __ERC20_init(_name, _symbol); dividendToken = _dividendToken; } // About dividendCorrection: // If the token balance of a `_user` is never changed, the dividend of `_user` can be computed with: // `dividendOf(_user) = dividendPerShare * balanceOf(_user)`. // When `balanceOf(_user)` is changed (via minting/burning/transferring tokens), // `dividendOf(_user)` should not be changed, // but the computed value of `dividendPerShare * balanceOf(_user)` is changed. // To keep the `dividendOf(_user)` unchanged, we add a correction term: // `dividendOf(_user) = dividendPerShare * balanceOf(_user) + dividendCorrectionOf(_user)`, // where `dividendCorrectionOf(_user)` is updated whenever `balanceOf(_user)` is changed: // `dividendCorrectionOf(_user) = dividendPerShare * (old balanceOf(_user)) - (new balanceOf(_user))`. // So now `dividendOf(_user)` returns the same value before and after `balanceOf(_user)` is changed. mapping(address => int256) internal magnifiedDividendCorrections; mapping(address => uint256) internal withdrawnDividends; /// @dev Syncs dividends whenever ether is paid to this contract. receive() external payable { if (msg.value > 0) { require(dividendToken == TokenHelper.ETH, "SHOYU: UNABLE_TO_RECEIVE_ETH"); sync(); } } /// @notice Syncs the amount of ether/erc20 increased to token holders as dividends. /// @dev It reverts if the total supply of tokens is 0. /// @return increased The amount of total dividend increased /// It emits the `Sync` event if the amount of received ether/erc20 is greater than 0. /// About undistributed ether/erc20: /// In each distribution, there is a small amount of ether/erc20 not distributed, /// the magnified amount of which is /// `(msg.value * magnitude) % totalSupply()`. /// With a well-chosen `magnitude`, the amount of undistributed ether/erc20 /// (de-magnified) in a distribution can be less than 1 wei. /// We can actually keep track of the undistributed ether/erc20 in a distribution /// and try to distribute it in the next distribution, /// but keeping track of such data on-chain costs much more than /// the saved ether/erc20, so we don't do that. function sync() public payable override returns (uint256 increased) { uint256 _totalSupply = totalSupply(); require(_totalSupply > 0, "SHOYU: NO_SUPPLY"); uint256 balance = dividendToken.balanceOf(address(this)); increased = balance - totalDividend; require(increased > 0, "SHOYU: INSUFFICIENT_AMOUNT"); magnifiedDividendPerShare += (increased * MAGNITUDE) / _totalSupply; totalDividend = balance; emit Sync(increased); } /// @notice Withdraws the ether/erc20 distributed to the sender. /// @dev It emits a `DividendWithdrawn` event if the amount of withdrawn ether/erc20 is greater than 0. function withdrawDividend() public override { uint256 _withdrawableDividend = withdrawableDividendOf(msg.sender); if (_withdrawableDividend > 0) { withdrawnDividends[msg.sender] += _withdrawableDividend; emit DividendWithdrawn(msg.sender, _withdrawableDividend); totalDividend -= _withdrawableDividend; dividendToken.safeTransfer(msg.sender, _withdrawableDividend); } } /// @notice View the amount of dividend in wei that an address can withdraw. /// @param account The address of a token holder. /// @return The amount of dividend in wei that `account` can withdraw. function dividendOf(address account) public view override returns (uint256) { return withdrawableDividendOf(account); } /// @notice View the amount of dividend in wei that an address can withdraw. /// @param account The address of a token holder. /// @return The amount of dividend in wei that `account` can withdraw. function withdrawableDividendOf(address account) public view override returns (uint256) { return accumulativeDividendOf(account) - withdrawnDividends[account]; } /// @notice View the amount of dividend in wei that an address has withdrawn. /// @param account The address of a token holder. /// @return The amount of dividend in wei that `account` has withdrawn. function withdrawnDividendOf(address account) public view override returns (uint256) { return withdrawnDividends[account]; } /// @notice View the amount of dividend in wei that an address has earned in total. /// @dev accumulativeDividendOf(account) = withdrawableDividendOf(account) + withdrawnDividendOf(account) /// = (magnifiedDividendPerShare * balanceOf(account) + magnifiedDividendCorrections[account]) / magnitude /// @param account The address of a token holder. /// @return The amount of dividend in wei that `account` has earned in total. function accumulativeDividendOf(address account) public view override returns (uint256) { return ((magnifiedDividendPerShare * balanceOf(account)).toInt256() + magnifiedDividendCorrections[account]) .toUint256() / MAGNITUDE; } /// @dev Internal function that transfer tokens from one address to another. /// Update magnifiedDividendCorrections to keep dividends unchanged. /// @param from The address to transfer from. /// @param to The address to transfer to. /// @param value The amount to be transferred. function _transfer( address from, address to, uint256 value ) internal override { super._transfer(from, to, value); int256 _magCorrection = (magnifiedDividendPerShare * value).toInt256(); magnifiedDividendCorrections[from] += _magCorrection; magnifiedDividendCorrections[to] -= _magCorrection; } /// @dev Internal function that mints tokens to an account. /// Update magnifiedDividendCorrections to keep dividends unchanged. /// @param account The account that will receive the created tokens. /// @param value The amount that will be created. function _mint(address account, uint256 value) internal override { super._mint(account, value); magnifiedDividendCorrections[account] -= (magnifiedDividendPerShare * value).toInt256(); } /// @dev Internal function that burns an amount of the token of a given account. /// Update magnifiedDividendCorrections to keep dividends unchanged. /// @param account The account whose tokens will be burnt. /// @param value The amount that will be burnt. function _burn(address account, uint256 value) internal override { super._burn(account, value); magnifiedDividendCorrections[account] += (magnifiedDividendPerShare * value).toInt256(); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow * checks. * * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can * easily result in undesired exploitation or bugs, since developers usually * assume that overflows raise errors. `SafeCast` restores this intuition by * reverting the transaction when such 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. * * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing * all math on `uint256` and `int256` and then downcasting. */ library SafeCast { /** * @dev Returns the downcasted uint128 from uint256, reverting on * overflow (when the input is greater than largest uint128). * * Counterpart to Solidity's `uint128` operator. * * Requirements: * * - input must fit into 128 bits */ function toUint128(uint256 value) internal pure returns (uint128) { require(value < 2**128, "SafeCast: value doesn\'t fit in 128 bits"); return uint128(value); } /** * @dev Returns the downcasted uint64 from uint256, reverting on * overflow (when the input is greater than largest uint64). * * Counterpart to Solidity's `uint64` operator. * * Requirements: * * - input must fit into 64 bits */ function toUint64(uint256 value) internal pure returns (uint64) { require(value < 2**64, "SafeCast: value doesn\'t fit in 64 bits"); return uint64(value); } /** * @dev Returns the downcasted uint32 from uint256, reverting on * overflow (when the input is greater than largest uint32). * * Counterpart to Solidity's `uint32` operator. * * Requirements: * * - input must fit into 32 bits */ function toUint32(uint256 value) internal pure returns (uint32) { require(value < 2**32, "SafeCast: value doesn\'t fit in 32 bits"); return uint32(value); } /** * @dev Returns the downcasted uint16 from uint256, reverting on * overflow (when the input is greater than largest uint16). * * Counterpart to Solidity's `uint16` operator. * * Requirements: * * - input must fit into 16 bits */ function toUint16(uint256 value) internal pure returns (uint16) { require(value < 2**16, "SafeCast: value doesn\'t fit in 16 bits"); return uint16(value); } /** * @dev Returns the downcasted uint8 from uint256, reverting on * overflow (when the input is greater than largest uint8). * * Counterpart to Solidity's `uint8` operator. * * Requirements: * * - input must fit into 8 bits. */ function toUint8(uint256 value) internal pure returns (uint8) { require(value < 2**8, "SafeCast: value doesn\'t fit in 8 bits"); return uint8(value); } /** * @dev Converts a signed int256 into an unsigned uint256. * * Requirements: * * - input must be greater than or equal to 0. */ function toUint256(int256 value) internal pure returns (uint256) { require(value >= 0, "SafeCast: value must be positive"); return uint256(value); } /** * @dev Returns the downcasted int128 from int256, reverting on * overflow (when the input is less than smallest int128 or * greater than largest int128). * * Counterpart to Solidity's `int128` operator. * * Requirements: * * - input must fit into 128 bits * * _Available since v3.1._ */ function toInt128(int256 value) internal pure returns (int128) { require(value >= -2**127 && value < 2**127, "SafeCast: value doesn\'t fit in 128 bits"); return int128(value); } /** * @dev Returns the downcasted int64 from int256, reverting on * overflow (when the input is less than smallest int64 or * greater than largest int64). * * Counterpart to Solidity's `int64` operator. * * Requirements: * * - input must fit into 64 bits * * _Available since v3.1._ */ function toInt64(int256 value) internal pure returns (int64) { require(value >= -2**63 && value < 2**63, "SafeCast: value doesn\'t fit in 64 bits"); return int64(value); } /** * @dev Returns the downcasted int32 from int256, reverting on * overflow (when the input is less than smallest int32 or * greater than largest int32). * * Counterpart to Solidity's `int32` operator. * * Requirements: * * - input must fit into 32 bits * * _Available since v3.1._ */ function toInt32(int256 value) internal pure returns (int32) { require(value >= -2**31 && value < 2**31, "SafeCast: value doesn\'t fit in 32 bits"); return int32(value); } /** * @dev Returns the downcasted int16 from int256, reverting on * overflow (when the input is less than smallest int16 or * greater than largest int16). * * Counterpart to Solidity's `int16` operator. * * Requirements: * * - input must fit into 16 bits * * _Available since v3.1._ */ function toInt16(int256 value) internal pure returns (int16) { require(value >= -2**15 && value < 2**15, "SafeCast: value doesn\'t fit in 16 bits"); return int16(value); } /** * @dev Returns the downcasted int8 from int256, reverting on * overflow (when the input is less than smallest int8 or * greater than largest int8). * * Counterpart to Solidity's `int8` operator. * * Requirements: * * - input must fit into 8 bits. * * _Available since v3.1._ */ function toInt8(int256 value) internal pure returns (int8) { require(value >= -2**7 && value < 2**7, "SafeCast: value doesn\'t fit in 8 bits"); return int8(value); } /** * @dev Converts an unsigned uint256 into a signed int256. * * Requirements: * * - input must be less than or equal to maxInt256. */ function toInt256(uint256 value) internal pure returns (int256) { require(value < 2**255, "SafeCast: value doesn't fit in an int256"); return int256(value); } }
// SPDX-License-Identifier: MIT pragma solidity =0.8.3; import "@openzeppelin/contracts/proxy/utils/Initializable.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20Initializable is Initializable, IERC20, IERC20Metadata { mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The defaut value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ function __ERC20_init(string memory name_, string memory symbol_) internal initializer { __ERC20_init_unchained(name_, symbol_); } function __ERC20_init_unchained(string memory name_, string memory symbol_) internal initializer { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overridden; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(msg.sender, recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(msg.sender, spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom( address sender, address recipient, uint256 amount ) public virtual override returns (bool) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][msg.sender]; require(currentAllowance >= amount, "SHOYU: INSUFFICIENT_ALLOWANCE"); _approve(sender, msg.sender, currentAllowance - amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(msg.sender, spender, _allowances[msg.sender][spender] + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { uint256 currentAllowance = _allowances[msg.sender][spender]; require(currentAllowance >= subtractedValue, "SHOYU: ALLOWANCE_UNDERFLOW"); _approve(msg.sender, spender, currentAllowance - subtractedValue); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer( address sender, address recipient, uint256 amount ) internal virtual { require(sender != address(0), "SHOYU: INVALID_SENDER"); require(recipient != address(0), "SHOYU: INVALID_RECIPIENT"); _beforeTokenTransfer(sender, recipient, amount); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "SHOYU: INSUFFICIENT_BALANCE"); _balances[sender] = senderBalance - amount; _balances[recipient] += amount; emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "SHOYU: INVALID_ACCOUNT"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "SHOYU: INVALID_ACCOUNT"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "SHOYU: INSUFFICIENT_BALANCE"); _balances[account] = accountBalance - amount; _totalSupply -= amount; emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve( address owner, address spender, uint256 amount ) internal virtual { require(owner != address(0), "SHOYU: INVALID_OWNER"); require(spender != address(0), "SHOYU: INVALID_SPENDER"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual {} }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IERC1155.sol"; import "./IERC1155Receiver.sol"; import "./extensions/IERC1155MetadataURI.sol"; import "../../utils/Address.sol"; import "../../utils/Context.sol"; import "../../utils/introspection/ERC165.sol"; /** * @dev Implementation of the basic standard multi-token. * See https://eips.ethereum.org/EIPS/eip-1155 * Originally based on code by Enjin: https://github.com/enjin/erc-1155 * * _Available since v3.1._ */ contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI { using Address for address; // Mapping from token ID to account balances mapping (uint256 => mapping(address => uint256)) private _balances; // Mapping from account to operator approvals mapping (address => mapping(address => bool)) private _operatorApprovals; // Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json string private _uri; /** * @dev See {_setURI}. */ constructor (string memory uri_) { _setURI(uri_); } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC1155).interfaceId || interfaceId == type(IERC1155MetadataURI).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC1155MetadataURI-uri}. * * This implementation returns the same URI for *all* token types. It relies * on the token type ID substitution mechanism * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP]. * * Clients calling this function must replace the `\{id\}` substring with the * actual token type ID. */ function uri(uint256) public view virtual override returns (string memory) { return _uri; } /** * @dev See {IERC1155-balanceOf}. * * Requirements: * * - `account` cannot be the zero address. */ function balanceOf(address account, uint256 id) public view virtual override returns (uint256) { require(account != address(0), "ERC1155: balance query for the zero address"); return _balances[id][account]; } /** * @dev See {IERC1155-balanceOfBatch}. * * Requirements: * * - `accounts` and `ids` must have the same length. */ function balanceOfBatch( address[] memory accounts, uint256[] memory ids ) public view virtual override returns (uint256[] memory) { require(accounts.length == ids.length, "ERC1155: accounts and ids length mismatch"); uint256[] memory batchBalances = new uint256[](accounts.length); for (uint256 i = 0; i < accounts.length; ++i) { batchBalances[i] = balanceOf(accounts[i], ids[i]); } return batchBalances; } /** * @dev See {IERC1155-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { require(_msgSender() != operator, "ERC1155: setting approval status for self"); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC1155-isApprovedForAll}. */ function isApprovedForAll(address account, address operator) public view virtual override returns (bool) { return _operatorApprovals[account][operator]; } /** * @dev See {IERC1155-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 id, uint256 amount, bytes memory data ) public virtual override { require(to != address(0), "ERC1155: transfer to the zero address"); require( from == _msgSender() || isApprovedForAll(from, _msgSender()), "ERC1155: caller is not owner nor approved" ); address operator = _msgSender(); _beforeTokenTransfer(operator, from, to, _asSingletonArray(id), _asSingletonArray(amount), data); uint256 fromBalance = _balances[id][from]; require(fromBalance >= amount, "ERC1155: insufficient balance for transfer"); _balances[id][from] = fromBalance - amount; _balances[id][to] += amount; emit TransferSingle(operator, from, to, id, amount); _doSafeTransferAcceptanceCheck(operator, from, to, id, amount, data); } /** * @dev See {IERC1155-safeBatchTransferFrom}. */ function safeBatchTransferFrom( address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) public virtual override { require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch"); require(to != address(0), "ERC1155: transfer to the zero address"); require( from == _msgSender() || isApprovedForAll(from, _msgSender()), "ERC1155: transfer caller is not owner nor approved" ); address operator = _msgSender(); _beforeTokenTransfer(operator, from, to, ids, amounts, data); for (uint256 i = 0; i < ids.length; ++i) { uint256 id = ids[i]; uint256 amount = amounts[i]; uint256 fromBalance = _balances[id][from]; require(fromBalance >= amount, "ERC1155: insufficient balance for transfer"); _balances[id][from] = fromBalance - amount; _balances[id][to] += amount; } emit TransferBatch(operator, from, to, ids, amounts); _doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, amounts, data); } /** * @dev Sets a new URI for all token types, by relying on the token type ID * substitution mechanism * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP]. * * By this mechanism, any occurrence of the `\{id\}` substring in either the * URI or any of the amounts in the JSON file at said URI will be replaced by * clients with the token type ID. * * For example, the `https://token-cdn-domain/\{id\}.json` URI would be * interpreted by clients as * `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json` * for token type ID 0x4cce0. * * See {uri}. * * Because these URIs cannot be meaningfully represented by the {URI} event, * this function emits no events. */ function _setURI(string memory newuri) internal virtual { _uri = newuri; } /** * @dev Creates `amount` tokens of token type `id`, and assigns them to `account`. * * Emits a {TransferSingle} event. * * Requirements: * * - `account` cannot be the zero address. * - If `account` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function _mint(address account, uint256 id, uint256 amount, bytes memory data) internal virtual { require(account != address(0), "ERC1155: mint to the zero address"); address operator = _msgSender(); _beforeTokenTransfer(operator, address(0), account, _asSingletonArray(id), _asSingletonArray(amount), data); _balances[id][account] += amount; emit TransferSingle(operator, address(0), account, id, amount); _doSafeTransferAcceptanceCheck(operator, address(0), account, id, amount, data); } /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}. * * Requirements: * * - `ids` and `amounts` must have the same length. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the * acceptance magic value. */ function _mintBatch(address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data) internal virtual { require(to != address(0), "ERC1155: mint to the zero address"); require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch"); address operator = _msgSender(); _beforeTokenTransfer(operator, address(0), to, ids, amounts, data); for (uint i = 0; i < ids.length; i++) { _balances[ids[i]][to] += amounts[i]; } emit TransferBatch(operator, address(0), to, ids, amounts); _doSafeBatchTransferAcceptanceCheck(operator, address(0), to, ids, amounts, data); } /** * @dev Destroys `amount` tokens of token type `id` from `account` * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens of token type `id`. */ function _burn(address account, uint256 id, uint256 amount) internal virtual { require(account != address(0), "ERC1155: burn from the zero address"); address operator = _msgSender(); _beforeTokenTransfer(operator, account, address(0), _asSingletonArray(id), _asSingletonArray(amount), ""); uint256 accountBalance = _balances[id][account]; require(accountBalance >= amount, "ERC1155: burn amount exceeds balance"); _balances[id][account] = accountBalance - amount; emit TransferSingle(operator, account, address(0), id, amount); } /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}. * * Requirements: * * - `ids` and `amounts` must have the same length. */ function _burnBatch(address account, uint256[] memory ids, uint256[] memory amounts) internal virtual { require(account != address(0), "ERC1155: burn from the zero address"); require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch"); address operator = _msgSender(); _beforeTokenTransfer(operator, account, address(0), ids, amounts, ""); for (uint i = 0; i < ids.length; i++) { uint256 id = ids[i]; uint256 amount = amounts[i]; uint256 accountBalance = _balances[id][account]; require(accountBalance >= amount, "ERC1155: burn amount exceeds balance"); _balances[id][account] = accountBalance - amount; } emit TransferBatch(operator, account, address(0), ids, amounts); } /** * @dev Hook that is called before any token transfer. This includes minting * and burning, as well as batched variants. * * The same hook is called on both single and batched variants. For single * transfers, the length of the `id` and `amount` arrays will be 1. * * Calling conditions (for each `id` and `amount` pair): * * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens * of token type `id` will be transferred to `to`. * - When `from` is zero, `amount` tokens of token type `id` will be minted * for `to`. * - when `to` is zero, `amount` of ``from``'s tokens of token type `id` * will be burned. * - `from` and `to` are never both zero. * - `ids` and `amounts` have the same, non-zero length. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual { } function _doSafeTransferAcceptanceCheck( address operator, address from, address to, uint256 id, uint256 amount, bytes memory data ) private { if (to.isContract()) { try IERC1155Receiver(to).onERC1155Received(operator, from, id, amount, data) returns (bytes4 response) { if (response != IERC1155Receiver(to).onERC1155Received.selector) { revert("ERC1155: ERC1155Receiver rejected tokens"); } } catch Error(string memory reason) { revert(reason); } catch { revert("ERC1155: transfer to non ERC1155Receiver implementer"); } } } function _doSafeBatchTransferAcceptanceCheck( address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) private { if (to.isContract()) { try IERC1155Receiver(to).onERC1155BatchReceived(operator, from, ids, amounts, data) returns (bytes4 response) { if (response != IERC1155Receiver(to).onERC1155BatchReceived.selector) { revert("ERC1155: ERC1155Receiver rejected tokens"); } } catch Error(string memory reason) { revert(reason); } catch { revert("ERC1155: transfer to non ERC1155Receiver implementer"); } } } function _asSingletonArray(uint256 element) private pure returns (uint256[] memory) { uint256[] memory array = new uint256[](1); array[0] = element; return array; } }
// SPDX-License-Identifier: MIT pragma solidity =0.8.3; import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol"; import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol"; import "../interfaces/IERC2981.sol"; contract ERC1155RoyaltyMock is ERC1155("MOCK") { address public owner; constructor() { owner = msg.sender; } function mint( address account, uint256 id, uint256 amount, bytes memory data ) external { _mint(account, id, amount, data); } function mintBatch( address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) external { _mintBatch(to, ids, amounts, data); } function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == 0x2a55205a || super.supportsInterface(interfaceId); } function royaltyInfo(uint256 _tokenId, uint256 _salePrice) external view returns (address, uint256) { uint256 fee = 100; if (_tokenId < 10) fee = 10; return (owner, (_salePrice * fee) / 1000); } }
// SPDX-License-Identifier: MIT pragma solidity =0.8.3; import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol"; import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol"; contract ERC1155Mock is ERC1155("MOCK") { function mint( address account, uint256 id, uint256 amount, bytes memory data ) external { _mint(account, id, amount, data); } function mintBatch( address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) external { _mintBatch(to, ids, amounts, data); } }
// SPDX-License-Identifier: MIT pragma solidity =0.8.3; import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "./base/BaseExchange.sol"; contract ERC1155ExchangeV0 is BaseExchange { bytes32 internal immutable _DOMAIN_SEPARATOR; uint256 internal immutable _CACHED_CHAIN_ID; address internal immutable _factory; constructor(address factory_) { __BaseNFTExchange_init(); _factory = factory_; _CACHED_CHAIN_ID = block.chainid; _DOMAIN_SEPARATOR = keccak256( abi.encode( // keccak256('EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)') 0x8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f, keccak256(bytes(Strings.toHexString(uint160(address(this))))), 0xc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6, // keccak256(bytes("1")) block.chainid, address(this) ) ); } function DOMAIN_SEPARATOR() public view override returns (bytes32) { bytes32 domainSeparator; if (_CACHED_CHAIN_ID == block.chainid) domainSeparator = _DOMAIN_SEPARATOR; else { domainSeparator = keccak256( abi.encode( // keccak256('EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)') 0x8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f, keccak256(bytes(Strings.toHexString(uint160(address(this))))), 0xc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6, // keccak256(bytes("1")) block.chainid, address(this) ) ); } return domainSeparator; } function factory() public view override returns (address) { return _factory; } function canTrade(address nft) public view override returns (bool) { return !ITokenFactory(_factory).isNFT1155(nft); } function _transfer( address nft, address from, address to, uint256 tokenId, uint256 amount ) internal override { IERC1155(nft).safeTransferFrom(from, to, tokenId, amount, ""); } }
// SPDX-License-Identifier: MIT pragma solidity =0.8.3; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "./base/BaseExchange.sol"; contract ERC721ExchangeV0 is BaseExchange { bytes32 internal immutable _DOMAIN_SEPARATOR; uint256 internal immutable _CACHED_CHAIN_ID; address internal immutable _factory; constructor(address factory_) { __BaseNFTExchange_init(); _factory = factory_; _CACHED_CHAIN_ID = block.chainid; _DOMAIN_SEPARATOR = keccak256( abi.encode( // keccak256('EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)') 0x8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f, keccak256(bytes(Strings.toHexString(uint160(address(this))))), 0xc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6, // keccak256(bytes("1")) block.chainid, address(this) ) ); } function DOMAIN_SEPARATOR() public view override returns (bytes32) { bytes32 domainSeparator; if (_CACHED_CHAIN_ID == block.chainid) domainSeparator = _DOMAIN_SEPARATOR; else { domainSeparator = keccak256( abi.encode( // keccak256('EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)') 0x8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f, keccak256(bytes(Strings.toHexString(uint160(address(this))))), 0xc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6, // keccak256(bytes("1")) block.chainid, address(this) ) ); } return domainSeparator; } function factory() public view override returns (address) { return _factory; } function canTrade(address nft) public view override returns (bool) { return !ITokenFactory(_factory).isNFT721(nft); } function _transfer( address nft, address from, address to, uint256 tokenId, uint256 ) internal override { IERC721(nft).safeTransferFrom(from, to, tokenId); } }
// SPDX-License-Identifier: MIT pragma solidity =0.8.3; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; contract ERC721Mock is ERC721("Mock", "MOCK") { function safeMint( address to, uint256 tokenId, bytes memory data ) external { _safeMint(to, tokenId, data); } function safeMintBatch0( address[] calldata to, uint256[] calldata tokenId, bytes memory data ) external { require(to.length == tokenId.length); for (uint256 i = 0; i < to.length; i++) { _safeMint(to[i], tokenId[i], data); } } function safeMintBatch1( address to, uint256[] calldata tokenId, bytes memory data ) external { for (uint256 i = 0; i < tokenId.length; i++) { _safeMint(to, tokenId[i], data); } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IERC20.sol"; import "./extensions/IERC20Metadata.sol"; import "../../utils/Context.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20, IERC20Metadata { mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The defaut value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ constructor (string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overridden; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); _approve(sender, _msgSender(), currentAllowance - amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); _approve(_msgSender(), spender, currentAllowance - subtractedValue); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance"); _balances[sender] = senderBalance - amount; _balances[recipient] += amount; emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); _balances[account] = accountBalance - amount; _totalSupply -= amount; emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } }
// SPDX-License-Identifier: MIT pragma solidity =0.8.3; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; contract ERC20Mock is ERC20("Mock", "MOCK") { function mint(address to, uint256 amount) external { _mint(to, amount); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.5.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; interface IERC20Snapshot is IERC20, IERC20Metadata { function balanceOfAt(address account, uint256 snapshotId) external view returns (uint256); function totalSupplyAt(uint256 snapshotId) external view returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity =0.8.3; import "../interfaces/IStrategy.sol"; contract FixedPriceSale is IStrategy { function canClaim( address proxy, uint256 deadline, bytes memory params, address, uint256 bidPrice, address, uint256, uint256 ) external view override returns (bool) { uint256 price = abi.decode(params, (uint256)); require(price > 0, "SHOYU: INVALID_PRICE"); return (proxy != address(0) || block.timestamp <= deadline) && bidPrice == price; } function canBid( address, uint256, bytes memory, address, uint256, address, uint256, uint256 ) external pure override returns (bool) { return false; } }
// SPDX-License-Identifier: MIT pragma solidity =0.8.3; import "../interfaces/IStrategy.sol"; contract EnglishAuction is IStrategy { function canClaim( address proxy, uint256 deadline, bytes memory params, address bidder, uint256 bidPrice, address bestBidder, uint256 bestBidPrice, uint256 ) external view override returns (bool) { if (proxy == address(0)) { return bidder == bestBidder && bidPrice == bestBidPrice && deadline < block.timestamp; } else { uint256 startPrice = abi.decode(params, (uint256)); require(startPrice > 0, "SHOYU: INVALID_START_PRICE"); return bidPrice >= startPrice && deadline < block.timestamp; } } function canBid( address proxy, uint256 deadline, bytes memory params, address, uint256 bidPrice, address, uint256 bestBidPrice, uint256 ) external view override returns (bool) { if (proxy == address(0)) { uint256 startPrice = abi.decode(params, (uint256)); require(startPrice > 0, "SHOYU: INVALID_START_PRICE"); return block.timestamp <= deadline && bidPrice >= startPrice && bidPrice > bestBidPrice; } else { return false; } } }
// SPDX-License-Identifier: MIT pragma solidity =0.8.3; import "../interfaces/IStrategy.sol"; contract DutchAuction is IStrategy { function canClaim( address proxy, uint256 deadline, bytes memory params, address, uint256 bidPrice, address, uint256, uint256 ) external view override returns (bool) { (uint256 startPrice, uint256 endPrice, uint256 startedAt) = abi.decode(params, (uint256, uint256, uint256)); require(startPrice > endPrice, "SHOYU: INVALID_PRICE_RANGE"); require(startedAt < deadline, "SHOYU: INVALID_STARTED_AT"); uint256 tickPerBlock = (startPrice - endPrice) / (deadline - startedAt); uint256 currentPrice = block.timestamp >= deadline ? endPrice : startPrice - ((block.timestamp - startedAt) * tickPerBlock); return (proxy != address(0) || block.timestamp <= deadline) && bidPrice >= currentPrice; } function canBid( address, uint256, bytes memory, address, uint256, address, uint256, uint256 ) external pure override returns (bool) { return false; } }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "abi" ] } }, "metadata": { "useLiteralContent": true }, "libraries": { "": { "__CACHE_BREAKER__": "0x00000000d41867734bbee4c6863d9255b2b06ac1" } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"protocolFeeRecipient","type":"address"},{"internalType":"uint8","name":"protocolFee","type":"uint8"},{"internalType":"address","name":"operationalFeeRecipient","type":"address"},{"internalType":"uint8","name":"operationalFee","type":"uint8"},{"internalType":"string","name":"_baseURI721","type":"string"},{"internalType":"string","name":"_baseURI1155","type":"string"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"proxy","type":"address"},{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"},{"indexed":false,"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"indexed":false,"internalType":"address","name":"royaltyFeeRecipient","type":"address"},{"indexed":false,"internalType":"uint8","name":"royaltyFee","type":"uint8"}],"name":"DeployNFT1155AndMintBatch","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"proxy","type":"address"},{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"string","name":"name","type":"string"},{"indexed":false,"internalType":"string","name":"symbol","type":"string"},{"indexed":false,"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"},{"indexed":false,"internalType":"address","name":"royaltyFeeRecipient","type":"address"},{"indexed":false,"internalType":"uint8","name":"royaltyFee","type":"uint8"}],"name":"DeployNFT721AndMintBatch","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"proxy","type":"address"},{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"string","name":"name","type":"string"},{"indexed":false,"internalType":"string","name":"symbol","type":"string"},{"indexed":false,"internalType":"uint256","name":"toTokenId","type":"uint256"},{"indexed":false,"internalType":"address","name":"royaltyFeeRecipient","type":"address"},{"indexed":false,"internalType":"uint8","name":"royaltyFee","type":"uint8"}],"name":"DeployNFT721AndPark","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"proxy","type":"address"},{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"string","name":"name","type":"string"},{"indexed":false,"internalType":"string","name":"symbol","type":"string"},{"indexed":true,"internalType":"address","name":"dividendToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"initialSupply","type":"uint256"}],"name":"DeploySocialToken","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":"string","name":"uri","type":"string"}],"name":"SetBaseURI1155","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"uri","type":"string"}],"name":"SetBaseURI721","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"deployer","type":"address"},{"indexed":false,"internalType":"bool","name":"whitelisted","type":"bool"}],"name":"SetDeployerWhitelisted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"fee","type":"uint8"}],"name":"SetOperationalFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"recipient","type":"address"}],"name":"SetOperationalFeeRecipient","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"recipient","type":"address"}],"name":"SetProtocolFeeRecipient","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"strategy","type":"address"},{"indexed":false,"internalType":"bool","name":"whitelisted","type":"bool"}],"name":"SetStrategyWhitelisted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"exchange","type":"address"}],"name":"UpgradeERC1155Exchange","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"exchange","type":"address"}],"name":"UpgradeERC721Exchange","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newTarget","type":"address"}],"name":"UpgradeNFT1155","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newTarget","type":"address"}],"name":"UpgradeNFT721","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newTarget","type":"address"}],"name":"UpgradeSocialToken","type":"event"},{"inputs":[],"name":"DOMAIN_SEPARATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_OPERATIONAL_FEE","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_ROYALTY_FEE","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINT_BATCH_1155_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINT_BATCH_721_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINT_SOCIAL_TOKEN_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PARK_TOKEN_IDS_721_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseURI1155","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseURI721","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"address","name":"royaltyFeeRecipient","type":"address"},{"internalType":"uint8","name":"royaltyFee","type":"uint8"}],"name":"deployNFT1155AndMintBatch","outputs":[{"internalType":"address","name":"nft","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"},{"internalType":"address","name":"royaltyFeeRecipient","type":"address"},{"internalType":"uint8","name":"royaltyFee","type":"uint8"}],"name":"deployNFT721AndMintBatch","outputs":[{"internalType":"address","name":"nft","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"uint256","name":"toTokenId","type":"uint256"},{"internalType":"address","name":"royaltyFeeRecipient","type":"address"},{"internalType":"uint8","name":"royaltyFee","type":"uint8"}],"name":"deployNFT721AndPark","outputs":[{"internalType":"address","name":"nft","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"address","name":"dividendToken","type":"address"},{"internalType":"uint256","name":"initialSupply","type":"uint256"}],"name":"deploySocialToken","outputs":[{"internalType":"address","name":"proxy","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"erc1155Exchange","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"erc721Exchange","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isDeployerWhitelisted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"query","type":"address"}],"name":"isNFT1155","outputs":[{"internalType":"bool","name":"result","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"query","type":"address"}],"name":"isNFT721","outputs":[{"internalType":"bool","name":"result","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"query","type":"address"}],"name":"isSocialToken","outputs":[{"internalType":"bool","name":"result","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isStrategyWhitelisted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"nft","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"mintBatch1155","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"nft","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"mintBatch721","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"mintSocialToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"nonces","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"operationalFeeInfo","outputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint8","name":"permil","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"nft","type":"address"},{"internalType":"uint256","name":"toTokenId","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"parkTokenIds721","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"protocolFeeInfo","outputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint8","name":"permil","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"uri","type":"string"}],"name":"setBaseURI1155","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"uri","type":"string"}],"name":"setBaseURI721","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"deployer","type":"address"},{"internalType":"bool","name":"whitelisted","type":"bool"}],"name":"setDeployerWhitelisted","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"operationalFee","type":"uint8"}],"name":"setOperationalFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operationalFeeRecipient","type":"address"}],"name":"setOperationalFeeRecipient","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"protocolFeeRecipient","type":"address"}],"name":"setProtocolFeeRecipient","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"strategy","type":"address"},{"internalType":"bool","name":"whitelisted","type":"bool"}],"name":"setStrategyWhitelisted","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"exchange","type":"address"}],"name":"upgradeERC1155Exchange","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"exchange","type":"address"}],"name":"upgradeERC721Exchange","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newTarget","type":"address"}],"name":"upgradeNFT1155","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newTarget","type":"address"}],"name":"upgradeNFT721","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newTarget","type":"address"}],"name":"upgradeSocialToken","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60c06040523480156200001157600080fd5b5060405162003c6738038062003c67833981016040819052620000349162000587565b600080546001600160a01b031916339081178255604051909182917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a350600480546001600160a01b038881166001600160a81b031992831617600160a01b60ff8a81168202929092179094556005805492891692909316919091179086169092029190911790558151620000d490600790602085019062000404565b508051620000ea90600890602084019062000404565b504660a0527f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f62000127306200019e602090811b62001eb317901c565b80516020918201206040805192830193909352918101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260c00160408051601f1981840301815291905280516020909101206080525062000716945050505050565b606081620001c857506040805180820190915260048152630307830360e41b602082015262000200565b8160005b8115620001ef5780620001df81620006cc565b915050600882901c9150620001cc565b620001fb848262000205565b925050505b919050565b606060006200021683600262000653565b6200022390600262000638565b6001600160401b038111156200024957634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f19166020018201604052801562000274576020820181803683370190505b509050600360fc1b816000815181106200029e57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110620002dc57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a90535060006200030284600262000653565b6200030f90600162000638565b90505b6001811115620003a9576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106200035357634e487b7160e01b600052603260045260246000fd5b1a60f81b8282815181106200037857634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a90535060049490941c93620003a18162000675565b905062000312565b508315620003fd5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640160405180910390fd5b9392505050565b82805462000412906200068f565b90600052602060002090601f01602090048101928262000436576000855562000481565b82601f106200045157805160ff191683800117855562000481565b8280016001018555821562000481579182015b828111156200048157825182559160200191906001019062000464565b506200048f92915062000493565b5090565b5b808211156200048f576000815560010162000494565b80516001600160a01b03811681146200020057600080fd5b600082601f830112620004d3578081fd5b81516001600160401b0380821115620004f057620004f062000700565b604051601f8301601f19908116603f011681019082821181831017156200051b576200051b62000700565b8160405283815260209250868385880101111562000537578485fd5b8491505b838210156200055a57858201830151818301840152908201906200053b565b838211156200056b57848385830101525b9695505050505050565b805160ff811681146200020057600080fd5b60008060008060008060c08789031215620005a0578182fd5b620005ab87620004aa565b9550620005bb6020880162000575565b9450620005cb60408801620004aa565b9350620005db6060880162000575565b60808801519093506001600160401b0380821115620005f8578384fd5b620006068a838b01620004c2565b935060a08901519150808211156200061c578283fd5b506200062b89828a01620004c2565b9150509295509295509295565b600082198211156200064e576200064e620006ea565b500190565b6000816000190483118215151615620006705762000670620006ea565b500290565b600081620006875762000687620006ea565b506000190190565b600181811c90821680620006a457607f821691505b60208210811415620006c657634e487b7160e01b600052602260045260246000fd5b50919050565b6000600019821415620006e357620006e3620006ea565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b60805160a05161352b6200073c6000396000610dbc01526000610de4015261352b6000f3fe608060405234801561001057600080fd5b506004361061025e5760003560e01c8063706e1ce511610146578063aec0b543116100c3578063d1640c9e11610087578063d1640c9e146105c5578063d4ed40be146105e8578063d5f7e756146105fb578063e521cb921461060e578063e7ceca8114610621578063f2fde38b146106345761025e565b8063aec0b54314610540578063c2b11e181461057a578063c6edbca414610597578063c756db161461059f578063cb03111c146105b25761025e565b80638da5cb5b1161010a5780638da5cb5b146104ab5780638f4ac6b2146104bc57806398f66f79146104cf578063999ba27c146104f6578063a984253f146105195761025e565b8063706e1ce51461044a578063715018a61461045d57806374949588146104655780637ecebe00146104785780638518482e146104985761025e565b806334375c90116101df57806345943ee1116101a357806345943ee1146103d35780634dd5ad0b146103f65780634e3a599b146103fe57806353ebf022146104115780635ef00369146104245780636d934447146104375761025e565b806334375c901461037d5780633644e515146103905780633683a63d146103985780633869faeb146103ad57806343ae710b146103c05761025e565b80632030959811610226578063203095981461030a57806324b72fd914610331578063262b9f6314610344578063272f37bc146103575780633419b1681461036a5761025e565b806304895e021461026357806309e9e859146102785780630b3aef6f146102a85780630e309d87146102dd57806317e1f82e146102f0575b600080fd5b6102766102713660046127d7565b610647565b005b61028b610286366004612a03565b610725565b6040516001600160a01b0390911681526020015b60405180910390f35b6102cf7f884adba7f4e17962aed36c871036adea39c6d9f81fb25407a78db239e9731e8681565b60405190815260200161029f565b6102766102eb366004612a99565b6108de565b6102f860fa81565b60405160ff909116815260200161029f565b6102cf7f3fddacac0a7d8b05f741f01ff6becadd9986be8631a2af41a675f365dd74090d81565b61027661033f366004612a99565b61096c565b610276610352366004612d2a565b610a18565b61028b610365366004612ad5565b610a85565b610276610378366004612cb3565b610c35565b60095461028b906001600160a01b031681565b6102cf610db6565b6103a0610e9f565b60405161029f9190613242565b61028b6103bb366004612b99565b610f2d565b600a5461028b906001600160a01b031681565b6103e66103e13660046127d7565b6110c9565b604051901515815260200161029f565b6102f8603281565b6103e661040c3660046127d7565b611162565b61027661041f3660046127d7565b6111b7565b6103e66104323660046127d7565b61125e565b61028b610445366004612c26565b6112b2565b6102766104583660046127d7565b611467565b61027661150f565b610276610473366004612d5c565b611583565b6102cf6104863660046127d7565b60066020526000908152604090205481565b6102766104a6366004612d2a565b611644565b6000546001600160a01b031661028b565b6102766104ca36600461280f565b6116b1565b6102cf7f8f4bf92e5271f5ec2f59dc3fc74368af0064fb84b40a3de9150dd26c08cda10481565b6103e66105043660046127d7565b600c6020526000908152604090205460ff1681565b6102cf7fb47ce0f6456fcc2f16b7d6e7b0255eb73822b401248e672a4543c2b3d718304381565b6004546001600160a01b03811690600160a01b900460ff165b604080516001600160a01b03909316835260ff90911660208301520161029f565b6005546001600160a01b03811690600160a01b900460ff16610559565b6103a0611848565b6102766105ad3660046129a1565b611855565b6102766105c03660046127d7565b6119e3565b6103e66105d33660046127d7565b600b6020526000908152604090205460ff1681565b6102766105f63660046128ed565b611a5b565b6102766106093660046127d7565b611bdb565b61027661061c3660046127d7565b611c83565b61027661062f3660046127d7565b611d51565b6102766106423660046127d7565b611dc9565b6000546001600160a01b0316331461067a5760405162461bcd60e51b8152600401610671906132b5565b60405180910390fd5b6001600160a01b0381166106d05760405162461bcd60e51b815260206004820152601860248201527f53484f59553a20494e56414c49445f524543495049454e5400000000000000006044820152606401610671565b600580546001600160a01b0319166001600160a01b0383169081179091556040519081527fb1f2c36f7c5aaa531984c1dcdd8f112bd8eb5ecc3604672fcc9b9995f3d0e486906020015b60405180910390a150565b6000808052600b6020526000805160206134d68339815191525460ff168061075c5750336000908152600b602052604090205460ff165b6107785760405162461bcd60e51b81526004016106719061328b565b6001600160a01b03861661079e5760405162461bcd60e51b8152600401610671906132ea565b83518551146107ef5760405162461bcd60e51b815260206004820152601860248201527f53484f59553a204c454e475448535f4e4f545f455155414c00000000000000006044820152606401610671565b600280546108829190610804906001906133dd565b8154811061082257634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546040516001600160a01b03909116906108539089908990899089908990602401612ef5565b60408051601f198184030181529190526020810180516001600160e01b031663bff5e79d60e01b179052611f10565b9050856001600160a01b0316816001600160a01b03167fe8e548b895f4fdeb62d7c9df220d96b267c9b1333933d6d222abe97c9eb4e178878787876040516108cd949392919061305a565b60405180910390a395945050505050565b6000546001600160a01b031633146109085760405162461bcd60e51b8152600401610671906132b5565b6001600160a01b0382166000818152600b6020908152604091829020805460ff19168515159081179091558251938452908301527fb0500d86f36ef20bca6265e59730812d99c6ef06086d8a6ca2bdf7ccdeb95c7391015b60405180910390a15050565b6000546001600160a01b031633146109965760405162461bcd60e51b8152600401610671906132b5565b6001600160a01b0382166109bc5760405162461bcd60e51b8152600401610671906132ea565b6001600160a01b0382166000818152600c6020908152604091829020805460ff19168515159081179091558251938452908301527fb2db35447f3d451cf54a63218b7bbc322d945d31ad0e9c334e668a634f311c5f9101610960565b6000546001600160a01b03163314610a425760405162461bcd60e51b8152600401610671906132b5565b8051610a559060079060208401906125ae565b507ffe32390fe202bcebda4a891d2f7987611953f71dabb03177aba107c29dd061c28160405161071a9190613242565b6000808052600b6020526000805160206134d68339815191525460ff1680610abc5750336000908152600b602052604090205460ff165b610ad85760405162461bcd60e51b81526004016106719061328b565b86610af55760405162461bcd60e51b815260040161067190613349565b84610b125760405162461bcd60e51b81526004016106719061331a565b6001600160a01b038916610b385760405162461bcd60e51b8152600401610671906132ea565b60018054610bd09190610b4c9082906133dd565b81548110610b6a57634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546040516001600160a01b0390911690610ba1908c908c908c908c908c908c908c908c90602401612f47565b60408051601f198184030181529190526020810180516001600160e01b0316634f65e6d160e11b179052611f10565b9050886001600160a01b0316816001600160a01b03167ffa2a29eed800c9b77b7b93bac9b8f33afdf859cdcdc8dabed1fee5879c5b85fa8a8a8a8a8a8a8a604051610c21979695949392919061318c565b60405180910390a398975050505050505050565b6000856001600160a01b0316638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b158015610c7057600080fd5b505afa158015610c84573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ca891906127f3565b6001600160a01b0381166000908152600660205260408120805492935090917f3fddacac0a7d8b05f741f01ff6becadd9986be8631a2af41a675f365dd74090d918991899185610cf783613476565b909155506040805160208101959095526001600160a01b03909316928401929092526060830152608082015260a001604051602081830303815290604052805190602001209050610d538183878787610d4e610db6565b612013565b60405163325d78dd60e21b8152600481018790526001600160a01b0388169063c975e37490602401600060405180830381600087803b158015610d9557600080fd5b505af1158015610da9573d6000803e3d6000fd5b5050505050505050505050565b600080467f00000000000000000000000000000000000000000000000000000000000000001415610e0857507f0000000000000000000000000000000000000000000000000000000000000000610e9a565b7f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f610e3230611eb3565b80516020918201206040805192830193909352918101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260c0016040516020818303038152906040528051906020012090505b905090565b60078054610eac9061343b565b80601f0160208091040260200160405190810160405280929190818152602001828054610ed89061343b565b8015610f255780601f10610efa57610100808354040283529160200191610f25565b820191906000526020600020905b815481529060010190602001808311610f0857829003601f168201915b505050505081565b6000808052600b6020526000805160206134d68339815191525460ff1680610f645750336000908152600b602052604090205460ff165b610f805760405162461bcd60e51b81526004016106719061328b565b86610f9d5760405162461bcd60e51b815260040161067190613349565b84610fba5760405162461bcd60e51b81526004016106719061331a565b6001600160a01b038916610fe05760405162461bcd60e51b8152600401610671906132ea565b600180546110789190610ff49082906133dd565b8154811061101257634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546040516001600160a01b0390911690611049908c908c908c908c908c908c908c908c90602401612fb2565b60408051601f198184030181529190526020810180516001600160e01b031663ac9a252160e01b179052611f10565b9050886001600160a01b0316816001600160a01b03167f56a094468f3010722aa253bc3d45e75efe2a0550b929f9f0f4d4591dbca5131d8a8a8a8a8a8a8a604051610c2197969594939291906131ef565b60006001600160a01b0382166110e15750600061115d565b6002545b600181106111575761113660026110fd6001846133dd565b8154811061111b57634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b0316846121d2565b1561114557600191505061115d565b8061114f81613424565b9150506110e5565b50600090505b919050565b60006001600160a01b03821661117a5750600061115d565b6003545b600181106111575761119660036110fd6001846133dd565b156111a557600191505061115d565b806111af81613424565b91505061117e565b6000546001600160a01b031633146111e15760405162461bcd60e51b8152600401610671906132b5565b6001805480820182556000919091527fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf60180546001600160a01b0319166001600160a01b0383169081179091556040519081527f90dccdf0d0809c3f945a409a3ce4652bf2c9b283e5aad88b3e36361433132cbb9060200161071a565b60006001600160a01b0382166112765750600061115d565b6001545b600181106111575761129160016110fd81846133dd565b156112a057600191505061115d565b806112aa81613424565b91505061127a565b6000808052600b6020526000805160206134d68339815191525460ff16806112e95750336000908152600b602052604090205460ff165b6113055760405162461bcd60e51b81526004016106719061328b565b60008551116113265760405162461bcd60e51b815260040161067190613349565b60008451116113475760405162461bcd60e51b81526004016106719061331a565b6001600160a01b03861661136d5760405162461bcd60e51b8152600401610671906132ea565b60008686868686604051602401611388959493929190613010565b60408051601f198184030181529190526020810180516001600160e01b0316633ad985f360e11b17905260038054919250611402916113c9906001906133dd565b815481106113e757634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b031682611f10565b9150836001600160a01b0316876001600160a01b0316836001600160a01b03167f77f9d3ebcfb8384da9e83f3940965c11d9aa857870489f196679555bba1888d289898860405161145593929190613255565b60405180910390a45095945050505050565b6000546001600160a01b031633146114915760405162461bcd60e51b8152600401610671906132b5565b600380546001810182556000919091527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b0180546001600160a01b0319166001600160a01b0383169081179091556040519081527fe8698a9880993ca12864a4d6e8bff70e3e073d4104aa0f9a8fdb2b74576922ab9060200161071a565b6000546001600160a01b031633146115395760405162461bcd60e51b8152600401610671906132b5565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146115ad5760405162461bcd60e51b8152600401610671906132b5565b603260ff821611156115f65760405162461bcd60e51b815260206004820152601260248201527153484f59553a20494e56414c49445f46454560701b6044820152606401610671565b6005805460ff60a01b1916600160a01b60ff8416908102919091179091556040519081527ff10ae7069d1b064e9a66cbb6166a221bf43947979981ff3c61096807a9dc0c6e9060200161071a565b6000546001600160a01b0316331461166e5760405162461bcd60e51b8152600401610671906132b5565b80516116819060089060208401906125ae565b507f80718abbdddf59294c7165841ac4dfc18de474342ccc5a20bc1064120a08852a8160405161071a9190613242565b60008b6001600160a01b0316638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b1580156116ec57600080fd5b505afa158015611700573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061172491906127f3565b905060007fb47ce0f6456fcc2f16b7d6e7b0255eb73822b401248e672a4543c2b3d718304360001b8d8d8d8d8d8d8d8d600660008c6001600160a01b03166001600160a01b03168152602001908152602001600020600081548092919061178a90613476565b919050556040516020016117a79a999897969594939291906130a4565b6040516020818303038152906040528051906020012090506117cf8183878787610d4e610db6565b604051630fbfeffd60e11b81526001600160a01b038e1690631f7fdffa90611807908f908f908f908f908f908f908f90600401612e56565b600060405180830381600087803b15801561182157600080fd5b505af1158015611835573d6000803e3d6000fd5b5050505050505050505050505050505050565b60088054610eac9061343b565b6000866001600160a01b0316638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b15801561189057600080fd5b505afa1580156118a4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118c891906127f3565b6001600160a01b0381166000908152600660205260408120805492935090917f8f4bf92e5271f5ec2f59dc3fc74368af0064fb84b40a3de9150dd26c08cda104918a918a918a91908661191a83613476565b909155506040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0016040516020818303038152906040528051906020012090506119778183878787610d4e610db6565b6040516340c10f1960e01b81526001600160a01b038881166004830152602482018890528916906340c10f1990604401600060405180830381600087803b1580156119c157600080fd5b505af11580156119d5573d6000803e3d6000fd5b505050505050505050505050565b6000546001600160a01b03163314611a0d5760405162461bcd60e51b8152600401610671906132b5565b600980546001600160a01b0319166001600160a01b0383169081179091556040519081527f7906d96d0db1eb8f6805ac6930c6abd633b14b59c0b239412e1fd979ca1254669060200161071a565b6000896001600160a01b0316638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b158015611a9657600080fd5b505afa158015611aaa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ace91906127f3565b6001600160a01b0381166000908152600660205260408120805492935090917f884adba7f4e17962aed36c871036adea39c6d9f81fb25407a78db239e9731e86918d918d918d918d918d918d9189611b2583613476565b91905055604051602001611b40989796959493929190613117565b604051602081830303815290604052805190602001209050611b688183878787610d4e610db6565b604051631143124160e11b81526001600160a01b038c1690632286248290611b9c908d908d908d908d908d90600401612eb1565b600060405180830381600087803b158015611bb657600080fd5b505af1158015611bca573d6000803e3d6000fd5b505050505050505050505050505050565b6000546001600160a01b03163314611c055760405162461bcd60e51b8152600401610671906132b5565b600280546001810182556000919091527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace0180546001600160a01b0319166001600160a01b0383169081179091556040519081527f1c9e0a997b60cd0855450b5761db24330074e914ceab5b053193b28d6a3e45639060200161071a565b6000546001600160a01b03163314611cad5760405162461bcd60e51b8152600401610671906132b5565b6001600160a01b038116611d035760405162461bcd60e51b815260206004820152601c60248201527f53484f59553a20494e56414c49445f4645455f524543495049454e54000000006044820152606401610671565b600480546001600160a01b0319166001600160a01b0383169081179091556040519081527f0adecf76fa869b35236c53f76ec37546457966d5848d8be34a4508acdd51f7c39060200161071a565b6000546001600160a01b03163314611d7b5760405162461bcd60e51b8152600401610671906132b5565b600a80546001600160a01b0319166001600160a01b0383169081179091556040519081527fca237d3f5dd115a560a2d7ddcc75a87200fca9a3b55e7f78330108c92b87a99a9060200161071a565b6000546001600160a01b03163314611df35760405162461bcd60e51b8152600401610671906132b5565b6001600160a01b038116611e585760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610671565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b606081611edb57506040805180820190915260048152630307830360e41b602082015261115d565b8160005b8115611efe5780611eef81613476565b915050600882901c9150611edf565b611f088482612233565b949350505050565b6000808360601b9050604051733d602d80600a3d3981f3363d3d373d3d3d363d7360601b81528160148201526e5af43d82803e903d91602b57fd5bf360881b60288201526037816000f092505060008351111561200c576000826001600160a01b031684604051611f819190612e3a565b6000604051808303816000865af19150503d8060008114611fbe576040519150601f19603f3d011682016040523d82523d6000602084013e611fc3565b606091505b505090508061200a5760405162461bcd60e51b815260206004820152601360248201527253484f59553a2043414c4c5f4641494c55524560681b6044820152606401610671565b505b5092915050565b60405161190160f01b60208201526022810182905260428101879052600090606201604051602081830303815290604052805190602001209050612057863b151590565b1561216757604080516020810186905280820185905260f887901b6001600160f81b0319166060820152815160418183030181526061820192839052630b135d3f60e11b9092526001600160a01b03881691631626ba7e916120bd918591606501613173565b60206040518083038186803b1580156120d557600080fd5b505afa1580156120e9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061210d9190612d02565b6001600160e01b031916631626ba7e60e01b146121625760405162461bcd60e51b815260206004820152601360248201527214d213d6554e8815539055551213d492569151606a1b6044820152606401610671565b6121c9565b856001600160a01b031661217d8287878761241b565b6001600160a01b0316146121c95760405162461bcd60e51b815260206004820152601360248201527214d213d6554e8815539055551213d492569151606a1b6044820152606401610671565b50505050505050565b6000808360601b905060405169363d3d373d3d3d363d7360b01b815281600a8201526e5af43d82803e903d91602b57fd5bf360881b601e82015260408101602d600082873c600d810151600d83015114815183511416935050505092915050565b606060006122428360026133be565b61224d9060026133a6565b6001600160401b0381111561227257634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f19166020018201604052801561229c576020820181803683370190505b509050600360fc1b816000815181106122c557634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061230257634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a90535060006123268460026133be565b6123319060016133a6565b90505b60018111156123c5576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061237357634e487b7160e01b600052603260045260246000fd5b1a60f81b82828151811061239757634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a90535060049490941c936123be81613424565b9050612334565b5083156124145760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610671565b9392505050565b60007f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a082111561248d5760405162461bcd60e51b815260206004820181905260248201527f53484f59553a20494e56414c49445f5349474e41545552455f535f56414c55456044820152606401610671565b8360ff16601b14806124a257508360ff16601c145b6124ee5760405162461bcd60e51b815260206004820181905260248201527f53484f59553a20494e56414c49445f5349474e41545552455f565f56414c55456044820152606401610671565b6040805160008082526020820180845288905260ff871692820192909252606081018590526080810184905260019060a0016020604051602081039080840390855afa158015612542573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166125a55760405162461bcd60e51b815260206004820152601860248201527f53484f59553a20494e56414c49445f5349474e415455524500000000000000006044820152606401610671565b95945050505050565b8280546125ba9061343b565b90600052602060002090601f0160209004810192826125dc5760008555612622565b82601f106125f557805160ff1916838001178555612622565b82800160010185558215612622579182015b82811115612622578251825591602001919060010190612607565b5061262e929150612632565b5090565b5b8082111561262e5760008155600101612633565b803561115d816134bd565b60008083601f840112612663578182fd5b5081356001600160401b03811115612679578182fd5b6020830191508360208260051b850101111561269457600080fd5b9250929050565b600082601f8301126126ab578081fd5b813560206001600160401b038211156126c6576126c66134a7565b8160051b6126d5828201613376565b8381528281019086840183880185018910156126ef578687fd5b8693505b858410156127115780358352600193909301929184019184016126f3565b50979650505050505050565b60008083601f84011261272e578182fd5b5081356001600160401b03811115612744578182fd5b60208301915083602082850101111561269457600080fd5b600082601f83011261276c578081fd5b81356001600160401b03811115612785576127856134a7565b612798601f8201601f1916602001613376565b8181528460208386010111156127ac578283fd5b816020850160208301379081016020019190915292915050565b803560ff8116811461115d57600080fd5b6000602082840312156127e8578081fd5b8135612414816134bd565b600060208284031215612804578081fd5b8151612414816134bd565b60008060008060008060008060008060006101008c8e031215612830578687fd5b6128398c612647565b9a5061284760208d01612647565b99506001600160401b038060408e01351115612861578788fd5b6128718e60408f01358f01612652565b909a50985060608d0135811015612886578788fd5b6128968e60608f01358f01612652565b909850965060808d01358110156128ab578586fd5b506128bc8d60808e01358e0161271d565b90955093506128cd60a08d016127c6565b925060c08c0135915060e08c013590509295989b509295989b9093969950565b600080600080600080600080600060e08a8c03121561290a578485fd5b8935612915816134bd565b985060208a0135612925816134bd565b975060408a01356001600160401b0380821115612940578687fd5b61294c8d838e01612652565b909950975060608c0135915080821115612964578687fd5b506129718c828d0161271d565b9096509450612984905060808b016127c6565b925060a08a0135915060c08a013590509295985092959850929598565b60008060008060008060c087890312156129b9578182fd5b86356129c4816134bd565b955060208701356129d4816134bd565b9450604087013593506129e9606088016127c6565b92506080870135915060a087013590509295509295509295565b600080600080600060a08688031215612a1a578081fd5b8535612a25816134bd565b945060208601356001600160401b0380821115612a40578283fd5b612a4c89838a0161269b565b95506040880135915080821115612a61578283fd5b50612a6e8882890161269b565b9350506060860135612a7f816134bd565b9150612a8d608087016127c6565b90509295509295909350565b60008060408385031215612aab578182fd5b8235612ab6816134bd565b915060208301358015158114612aca578182fd5b809150509250929050565b60008060008060008060008060c0898b031215612af0578182fd5b8835612afb816134bd565b975060208901356001600160401b0380821115612b16578384fd5b612b228c838d0161271d565b909950975060408b0135915080821115612b3a578384fd5b612b468c838d0161271d565b909750955060608b0135915080821115612b5e578384fd5b50612b6b8b828c0161269b565b9350506080890135612b7c816134bd565b9150612b8a60a08a016127c6565b90509295985092959890939650565b60008060008060008060008060c0898b031215612bb4578182fd5b8835612bbf816134bd565b975060208901356001600160401b0380821115612bda578384fd5b612be68c838d0161271d565b909950975060408b0135915080821115612bfe578384fd5b50612c0b8b828c0161271d565b909650945050606089013592506080890135612b7c816134bd565b600080600080600060a08688031215612c3d578283fd5b8535612c48816134bd565b945060208601356001600160401b0380821115612c63578485fd5b612c6f89838a0161275c565b95506040880135915080821115612c84578485fd5b50612c918882890161275c565b9350506060860135612ca2816134bd565b949793965091946080013592915050565b600080600080600060a08688031215612cca578283fd5b8535612cd5816134bd565b945060208601359350612cea604087016127c6565b94979396509394606081013594506080013592915050565b600060208284031215612d13578081fd5b81516001600160e01b031981168114612414578182fd5b600060208284031215612d3b578081fd5b81356001600160401b03811115612d50578182fd5b611f088482850161275c565b600060208284031215612d6d578081fd5b612414826127c6565b81835260006001600160fb1b03831115612d8e578081fd5b8260051b80836020870137939093016020019283525090919050565b6000815180845260208085019450808401835b83811015612dd957815187529582019590820190600101612dbd565b509495945050505050565b60008284528282602086013780602084860101526020601f19601f85011685010190509392505050565b60008151808452612e268160208601602086016133f4565b601f01601f19169290920160200192915050565b60008251612e4c8184602087016133f4565b9190910192915050565b6001600160a01b0388168152608060208201819052600090612e7b908301888a612d76565b8281036040840152612e8e818789612d76565b90508281036060840152612ea3818587612de4565b9a9950505050505050505050565b6001600160a01b0386168152606060208201819052600090612ed69083018688612d76565b8281036040840152612ee9818587612de4565b98975050505050505050565b600060018060a01b03808816835260a06020840152612f1760a0840188612daa565b8381036040850152612f298188612daa565b959091166060840152505060ff919091166080909101529392505050565b600060018060a01b03808b16835260c06020840152612f6a60c084018a8c612de4565b8381036040850152612f7d81898b612de4565b90508381036060850152612f918188612daa565b959091166080840152505060ff9190911660a0909101529695505050505050565b600060018060a01b03808b16835260c06020840152612fd560c084018a8c612de4565b8381036040850152612fe881898b612de4565b92505085606084015280851660808401525060ff831660a08301529998505050505050505050565b600060018060a01b03808816835260a0602084015261303260a0840188612e0e565b83810360408501526130448188612e0e565b9590911660608401525050608001529392505050565b60006080825261306d6080830187612daa565b828103602084015261307f8187612daa565b6001600160a01b03959095166040840152505060ff9190911660609091015292915050565b8a81526001600160a01b038a811660208301528916604082015260e0606082018190526000906130d7908301898b612d76565b82810360808401526130ea81888a612d76565b905082810360a08401526130ff818688612de4565b9150508260c08301529b9a5050505050505050505050565b8881526001600160a01b0388811660208301528716604082015260c06060820181905260009061314a9083018789612d76565b828103608084015261315d818688612de4565b9150508260a08301529998505050505050505050565b600083825260406020830152611f086040830184612e0e565b600060a082526131a060a08301898b612de4565b82810360208401526131b381888a612de4565b905082810360408401526131c78187612daa565b6001600160a01b03959095166060840152505060ff9190911660809091015295945050505050565b600060a0825261320360a08301898b612de4565b828103602084015261321681888a612de4565b604084019690965250506001600160a01b0392909216606083015260ff16608090910152949350505050565b6000602082526124146020830184612e0e565b6000606082526132686060830186612e0e565b828103602084015261327a8186612e0e565b915050826040830152949350505050565b60208082526010908201526f29a427acaa9d102327a92124a22222a760811b604082015260600190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526016908201527553484f59553a20494e56414c49445f4144445245535360501b604082015260600190565b60208082526015908201527414d213d6554e881253959053125117d4d6535093d3605a1b604082015260600190565b60208082526013908201527253484f59553a20494e56414c49445f4e414d4560681b604082015260600190565b604051601f8201601f191681016001600160401b038111828210171561339e5761339e6134a7565b604052919050565b600082198211156133b9576133b9613491565b500190565b60008160001904831182151516156133d8576133d8613491565b500290565b6000828210156133ef576133ef613491565b500390565b60005b8381101561340f5781810151838201526020016133f7565b8381111561341e576000848401525b50505050565b60008161343357613433613491565b506000190190565b600181811c9082168061344f57607f821691505b6020821081141561347057634e487b7160e01b600052602260045260246000fd5b50919050565b600060001982141561348a5761348a613491565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146134d257600080fd5b5056fedf7de25b7f1fd6d0b5205f0e18f1f35bd7b8d84cce336588d184533ce43a6f76a2646970667358221220fa5bb301d18d6f142124f17e06a3bf1afa859b3ada61c3e1101483def042578364736f6c634300080300330000000000000000000000008798249c2e607446efb7ad49ec89dd1865ff4272000000000000000000000000000000000000000000000000000000000000001900000000000000000000000093c7020393df59a951217d92d982d67a34a1557d000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000002468747470733a2f2f6170692e73686f79756e66742e636f6d2f6d657461646174612f312f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002468747470733a2f2f6170692e73686f79756e66742e636f6d2f6d657461646174612f312f00000000000000000000000000000000000000000000000000000000
Deployed Bytecode
0x608060405234801561001057600080fd5b506004361061025e5760003560e01c8063706e1ce511610146578063aec0b543116100c3578063d1640c9e11610087578063d1640c9e146105c5578063d4ed40be146105e8578063d5f7e756146105fb578063e521cb921461060e578063e7ceca8114610621578063f2fde38b146106345761025e565b8063aec0b54314610540578063c2b11e181461057a578063c6edbca414610597578063c756db161461059f578063cb03111c146105b25761025e565b80638da5cb5b1161010a5780638da5cb5b146104ab5780638f4ac6b2146104bc57806398f66f79146104cf578063999ba27c146104f6578063a984253f146105195761025e565b8063706e1ce51461044a578063715018a61461045d57806374949588146104655780637ecebe00146104785780638518482e146104985761025e565b806334375c90116101df57806345943ee1116101a357806345943ee1146103d35780634dd5ad0b146103f65780634e3a599b146103fe57806353ebf022146104115780635ef00369146104245780636d934447146104375761025e565b806334375c901461037d5780633644e515146103905780633683a63d146103985780633869faeb146103ad57806343ae710b146103c05761025e565b80632030959811610226578063203095981461030a57806324b72fd914610331578063262b9f6314610344578063272f37bc146103575780633419b1681461036a5761025e565b806304895e021461026357806309e9e859146102785780630b3aef6f146102a85780630e309d87146102dd57806317e1f82e146102f0575b600080fd5b6102766102713660046127d7565b610647565b005b61028b610286366004612a03565b610725565b6040516001600160a01b0390911681526020015b60405180910390f35b6102cf7f884adba7f4e17962aed36c871036adea39c6d9f81fb25407a78db239e9731e8681565b60405190815260200161029f565b6102766102eb366004612a99565b6108de565b6102f860fa81565b60405160ff909116815260200161029f565b6102cf7f3fddacac0a7d8b05f741f01ff6becadd9986be8631a2af41a675f365dd74090d81565b61027661033f366004612a99565b61096c565b610276610352366004612d2a565b610a18565b61028b610365366004612ad5565b610a85565b610276610378366004612cb3565b610c35565b60095461028b906001600160a01b031681565b6102cf610db6565b6103a0610e9f565b60405161029f9190613242565b61028b6103bb366004612b99565b610f2d565b600a5461028b906001600160a01b031681565b6103e66103e13660046127d7565b6110c9565b604051901515815260200161029f565b6102f8603281565b6103e661040c3660046127d7565b611162565b61027661041f3660046127d7565b6111b7565b6103e66104323660046127d7565b61125e565b61028b610445366004612c26565b6112b2565b6102766104583660046127d7565b611467565b61027661150f565b610276610473366004612d5c565b611583565b6102cf6104863660046127d7565b60066020526000908152604090205481565b6102766104a6366004612d2a565b611644565b6000546001600160a01b031661028b565b6102766104ca36600461280f565b6116b1565b6102cf7f8f4bf92e5271f5ec2f59dc3fc74368af0064fb84b40a3de9150dd26c08cda10481565b6103e66105043660046127d7565b600c6020526000908152604090205460ff1681565b6102cf7fb47ce0f6456fcc2f16b7d6e7b0255eb73822b401248e672a4543c2b3d718304381565b6004546001600160a01b03811690600160a01b900460ff165b604080516001600160a01b03909316835260ff90911660208301520161029f565b6005546001600160a01b03811690600160a01b900460ff16610559565b6103a0611848565b6102766105ad3660046129a1565b611855565b6102766105c03660046127d7565b6119e3565b6103e66105d33660046127d7565b600b6020526000908152604090205460ff1681565b6102766105f63660046128ed565b611a5b565b6102766106093660046127d7565b611bdb565b61027661061c3660046127d7565b611c83565b61027661062f3660046127d7565b611d51565b6102766106423660046127d7565b611dc9565b6000546001600160a01b0316331461067a5760405162461bcd60e51b8152600401610671906132b5565b60405180910390fd5b6001600160a01b0381166106d05760405162461bcd60e51b815260206004820152601860248201527f53484f59553a20494e56414c49445f524543495049454e5400000000000000006044820152606401610671565b600580546001600160a01b0319166001600160a01b0383169081179091556040519081527fb1f2c36f7c5aaa531984c1dcdd8f112bd8eb5ecc3604672fcc9b9995f3d0e486906020015b60405180910390a150565b6000808052600b6020526000805160206134d68339815191525460ff168061075c5750336000908152600b602052604090205460ff165b6107785760405162461bcd60e51b81526004016106719061328b565b6001600160a01b03861661079e5760405162461bcd60e51b8152600401610671906132ea565b83518551146107ef5760405162461bcd60e51b815260206004820152601860248201527f53484f59553a204c454e475448535f4e4f545f455155414c00000000000000006044820152606401610671565b600280546108829190610804906001906133dd565b8154811061082257634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546040516001600160a01b03909116906108539089908990899089908990602401612ef5565b60408051601f198184030181529190526020810180516001600160e01b031663bff5e79d60e01b179052611f10565b9050856001600160a01b0316816001600160a01b03167fe8e548b895f4fdeb62d7c9df220d96b267c9b1333933d6d222abe97c9eb4e178878787876040516108cd949392919061305a565b60405180910390a395945050505050565b6000546001600160a01b031633146109085760405162461bcd60e51b8152600401610671906132b5565b6001600160a01b0382166000818152600b6020908152604091829020805460ff19168515159081179091558251938452908301527fb0500d86f36ef20bca6265e59730812d99c6ef06086d8a6ca2bdf7ccdeb95c7391015b60405180910390a15050565b6000546001600160a01b031633146109965760405162461bcd60e51b8152600401610671906132b5565b6001600160a01b0382166109bc5760405162461bcd60e51b8152600401610671906132ea565b6001600160a01b0382166000818152600c6020908152604091829020805460ff19168515159081179091558251938452908301527fb2db35447f3d451cf54a63218b7bbc322d945d31ad0e9c334e668a634f311c5f9101610960565b6000546001600160a01b03163314610a425760405162461bcd60e51b8152600401610671906132b5565b8051610a559060079060208401906125ae565b507ffe32390fe202bcebda4a891d2f7987611953f71dabb03177aba107c29dd061c28160405161071a9190613242565b6000808052600b6020526000805160206134d68339815191525460ff1680610abc5750336000908152600b602052604090205460ff165b610ad85760405162461bcd60e51b81526004016106719061328b565b86610af55760405162461bcd60e51b815260040161067190613349565b84610b125760405162461bcd60e51b81526004016106719061331a565b6001600160a01b038916610b385760405162461bcd60e51b8152600401610671906132ea565b60018054610bd09190610b4c9082906133dd565b81548110610b6a57634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546040516001600160a01b0390911690610ba1908c908c908c908c908c908c908c908c90602401612f47565b60408051601f198184030181529190526020810180516001600160e01b0316634f65e6d160e11b179052611f10565b9050886001600160a01b0316816001600160a01b03167ffa2a29eed800c9b77b7b93bac9b8f33afdf859cdcdc8dabed1fee5879c5b85fa8a8a8a8a8a8a8a604051610c21979695949392919061318c565b60405180910390a398975050505050505050565b6000856001600160a01b0316638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b158015610c7057600080fd5b505afa158015610c84573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ca891906127f3565b6001600160a01b0381166000908152600660205260408120805492935090917f3fddacac0a7d8b05f741f01ff6becadd9986be8631a2af41a675f365dd74090d918991899185610cf783613476565b909155506040805160208101959095526001600160a01b03909316928401929092526060830152608082015260a001604051602081830303815290604052805190602001209050610d538183878787610d4e610db6565b612013565b60405163325d78dd60e21b8152600481018790526001600160a01b0388169063c975e37490602401600060405180830381600087803b158015610d9557600080fd5b505af1158015610da9573d6000803e3d6000fd5b5050505050505050505050565b600080467f00000000000000000000000000000000000000000000000000000000000000011415610e0857507f084f12c5bb4283df104e8a6d0e5336a88344226e1dbc809c3782d5802a013ec2610e9a565b7f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f610e3230611eb3565b80516020918201206040805192830193909352918101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260c0016040516020818303038152906040528051906020012090505b905090565b60078054610eac9061343b565b80601f0160208091040260200160405190810160405280929190818152602001828054610ed89061343b565b8015610f255780601f10610efa57610100808354040283529160200191610f25565b820191906000526020600020905b815481529060010190602001808311610f0857829003601f168201915b505050505081565b6000808052600b6020526000805160206134d68339815191525460ff1680610f645750336000908152600b602052604090205460ff165b610f805760405162461bcd60e51b81526004016106719061328b565b86610f9d5760405162461bcd60e51b815260040161067190613349565b84610fba5760405162461bcd60e51b81526004016106719061331a565b6001600160a01b038916610fe05760405162461bcd60e51b8152600401610671906132ea565b600180546110789190610ff49082906133dd565b8154811061101257634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546040516001600160a01b0390911690611049908c908c908c908c908c908c908c908c90602401612fb2565b60408051601f198184030181529190526020810180516001600160e01b031663ac9a252160e01b179052611f10565b9050886001600160a01b0316816001600160a01b03167f56a094468f3010722aa253bc3d45e75efe2a0550b929f9f0f4d4591dbca5131d8a8a8a8a8a8a8a604051610c2197969594939291906131ef565b60006001600160a01b0382166110e15750600061115d565b6002545b600181106111575761113660026110fd6001846133dd565b8154811061111b57634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b0316846121d2565b1561114557600191505061115d565b8061114f81613424565b9150506110e5565b50600090505b919050565b60006001600160a01b03821661117a5750600061115d565b6003545b600181106111575761119660036110fd6001846133dd565b156111a557600191505061115d565b806111af81613424565b91505061117e565b6000546001600160a01b031633146111e15760405162461bcd60e51b8152600401610671906132b5565b6001805480820182556000919091527fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf60180546001600160a01b0319166001600160a01b0383169081179091556040519081527f90dccdf0d0809c3f945a409a3ce4652bf2c9b283e5aad88b3e36361433132cbb9060200161071a565b60006001600160a01b0382166112765750600061115d565b6001545b600181106111575761129160016110fd81846133dd565b156112a057600191505061115d565b806112aa81613424565b91505061127a565b6000808052600b6020526000805160206134d68339815191525460ff16806112e95750336000908152600b602052604090205460ff165b6113055760405162461bcd60e51b81526004016106719061328b565b60008551116113265760405162461bcd60e51b815260040161067190613349565b60008451116113475760405162461bcd60e51b81526004016106719061331a565b6001600160a01b03861661136d5760405162461bcd60e51b8152600401610671906132ea565b60008686868686604051602401611388959493929190613010565b60408051601f198184030181529190526020810180516001600160e01b0316633ad985f360e11b17905260038054919250611402916113c9906001906133dd565b815481106113e757634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b031682611f10565b9150836001600160a01b0316876001600160a01b0316836001600160a01b03167f77f9d3ebcfb8384da9e83f3940965c11d9aa857870489f196679555bba1888d289898860405161145593929190613255565b60405180910390a45095945050505050565b6000546001600160a01b031633146114915760405162461bcd60e51b8152600401610671906132b5565b600380546001810182556000919091527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b0180546001600160a01b0319166001600160a01b0383169081179091556040519081527fe8698a9880993ca12864a4d6e8bff70e3e073d4104aa0f9a8fdb2b74576922ab9060200161071a565b6000546001600160a01b031633146115395760405162461bcd60e51b8152600401610671906132b5565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146115ad5760405162461bcd60e51b8152600401610671906132b5565b603260ff821611156115f65760405162461bcd60e51b815260206004820152601260248201527153484f59553a20494e56414c49445f46454560701b6044820152606401610671565b6005805460ff60a01b1916600160a01b60ff8416908102919091179091556040519081527ff10ae7069d1b064e9a66cbb6166a221bf43947979981ff3c61096807a9dc0c6e9060200161071a565b6000546001600160a01b0316331461166e5760405162461bcd60e51b8152600401610671906132b5565b80516116819060089060208401906125ae565b507f80718abbdddf59294c7165841ac4dfc18de474342ccc5a20bc1064120a08852a8160405161071a9190613242565b60008b6001600160a01b0316638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b1580156116ec57600080fd5b505afa158015611700573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061172491906127f3565b905060007fb47ce0f6456fcc2f16b7d6e7b0255eb73822b401248e672a4543c2b3d718304360001b8d8d8d8d8d8d8d8d600660008c6001600160a01b03166001600160a01b03168152602001908152602001600020600081548092919061178a90613476565b919050556040516020016117a79a999897969594939291906130a4565b6040516020818303038152906040528051906020012090506117cf8183878787610d4e610db6565b604051630fbfeffd60e11b81526001600160a01b038e1690631f7fdffa90611807908f908f908f908f908f908f908f90600401612e56565b600060405180830381600087803b15801561182157600080fd5b505af1158015611835573d6000803e3d6000fd5b5050505050505050505050505050505050565b60088054610eac9061343b565b6000866001600160a01b0316638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b15801561189057600080fd5b505afa1580156118a4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118c891906127f3565b6001600160a01b0381166000908152600660205260408120805492935090917f8f4bf92e5271f5ec2f59dc3fc74368af0064fb84b40a3de9150dd26c08cda104918a918a918a91908661191a83613476565b909155506040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0016040516020818303038152906040528051906020012090506119778183878787610d4e610db6565b6040516340c10f1960e01b81526001600160a01b038881166004830152602482018890528916906340c10f1990604401600060405180830381600087803b1580156119c157600080fd5b505af11580156119d5573d6000803e3d6000fd5b505050505050505050505050565b6000546001600160a01b03163314611a0d5760405162461bcd60e51b8152600401610671906132b5565b600980546001600160a01b0319166001600160a01b0383169081179091556040519081527f7906d96d0db1eb8f6805ac6930c6abd633b14b59c0b239412e1fd979ca1254669060200161071a565b6000896001600160a01b0316638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b158015611a9657600080fd5b505afa158015611aaa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ace91906127f3565b6001600160a01b0381166000908152600660205260408120805492935090917f884adba7f4e17962aed36c871036adea39c6d9f81fb25407a78db239e9731e86918d918d918d918d918d918d9189611b2583613476565b91905055604051602001611b40989796959493929190613117565b604051602081830303815290604052805190602001209050611b688183878787610d4e610db6565b604051631143124160e11b81526001600160a01b038c1690632286248290611b9c908d908d908d908d908d90600401612eb1565b600060405180830381600087803b158015611bb657600080fd5b505af1158015611bca573d6000803e3d6000fd5b505050505050505050505050505050565b6000546001600160a01b03163314611c055760405162461bcd60e51b8152600401610671906132b5565b600280546001810182556000919091527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace0180546001600160a01b0319166001600160a01b0383169081179091556040519081527f1c9e0a997b60cd0855450b5761db24330074e914ceab5b053193b28d6a3e45639060200161071a565b6000546001600160a01b03163314611cad5760405162461bcd60e51b8152600401610671906132b5565b6001600160a01b038116611d035760405162461bcd60e51b815260206004820152601c60248201527f53484f59553a20494e56414c49445f4645455f524543495049454e54000000006044820152606401610671565b600480546001600160a01b0319166001600160a01b0383169081179091556040519081527f0adecf76fa869b35236c53f76ec37546457966d5848d8be34a4508acdd51f7c39060200161071a565b6000546001600160a01b03163314611d7b5760405162461bcd60e51b8152600401610671906132b5565b600a80546001600160a01b0319166001600160a01b0383169081179091556040519081527fca237d3f5dd115a560a2d7ddcc75a87200fca9a3b55e7f78330108c92b87a99a9060200161071a565b6000546001600160a01b03163314611df35760405162461bcd60e51b8152600401610671906132b5565b6001600160a01b038116611e585760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610671565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b606081611edb57506040805180820190915260048152630307830360e41b602082015261115d565b8160005b8115611efe5780611eef81613476565b915050600882901c9150611edf565b611f088482612233565b949350505050565b6000808360601b9050604051733d602d80600a3d3981f3363d3d373d3d3d363d7360601b81528160148201526e5af43d82803e903d91602b57fd5bf360881b60288201526037816000f092505060008351111561200c576000826001600160a01b031684604051611f819190612e3a565b6000604051808303816000865af19150503d8060008114611fbe576040519150601f19603f3d011682016040523d82523d6000602084013e611fc3565b606091505b505090508061200a5760405162461bcd60e51b815260206004820152601360248201527253484f59553a2043414c4c5f4641494c55524560681b6044820152606401610671565b505b5092915050565b60405161190160f01b60208201526022810182905260428101879052600090606201604051602081830303815290604052805190602001209050612057863b151590565b1561216757604080516020810186905280820185905260f887901b6001600160f81b0319166060820152815160418183030181526061820192839052630b135d3f60e11b9092526001600160a01b03881691631626ba7e916120bd918591606501613173565b60206040518083038186803b1580156120d557600080fd5b505afa1580156120e9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061210d9190612d02565b6001600160e01b031916631626ba7e60e01b146121625760405162461bcd60e51b815260206004820152601360248201527214d213d6554e8815539055551213d492569151606a1b6044820152606401610671565b6121c9565b856001600160a01b031661217d8287878761241b565b6001600160a01b0316146121c95760405162461bcd60e51b815260206004820152601360248201527214d213d6554e8815539055551213d492569151606a1b6044820152606401610671565b50505050505050565b6000808360601b905060405169363d3d373d3d3d363d7360b01b815281600a8201526e5af43d82803e903d91602b57fd5bf360881b601e82015260408101602d600082873c600d810151600d83015114815183511416935050505092915050565b606060006122428360026133be565b61224d9060026133a6565b6001600160401b0381111561227257634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f19166020018201604052801561229c576020820181803683370190505b509050600360fc1b816000815181106122c557634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061230257634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a90535060006123268460026133be565b6123319060016133a6565b90505b60018111156123c5576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061237357634e487b7160e01b600052603260045260246000fd5b1a60f81b82828151811061239757634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a90535060049490941c936123be81613424565b9050612334565b5083156124145760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610671565b9392505050565b60007f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a082111561248d5760405162461bcd60e51b815260206004820181905260248201527f53484f59553a20494e56414c49445f5349474e41545552455f535f56414c55456044820152606401610671565b8360ff16601b14806124a257508360ff16601c145b6124ee5760405162461bcd60e51b815260206004820181905260248201527f53484f59553a20494e56414c49445f5349474e41545552455f565f56414c55456044820152606401610671565b6040805160008082526020820180845288905260ff871692820192909252606081018590526080810184905260019060a0016020604051602081039080840390855afa158015612542573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166125a55760405162461bcd60e51b815260206004820152601860248201527f53484f59553a20494e56414c49445f5349474e415455524500000000000000006044820152606401610671565b95945050505050565b8280546125ba9061343b565b90600052602060002090601f0160209004810192826125dc5760008555612622565b82601f106125f557805160ff1916838001178555612622565b82800160010185558215612622579182015b82811115612622578251825591602001919060010190612607565b5061262e929150612632565b5090565b5b8082111561262e5760008155600101612633565b803561115d816134bd565b60008083601f840112612663578182fd5b5081356001600160401b03811115612679578182fd5b6020830191508360208260051b850101111561269457600080fd5b9250929050565b600082601f8301126126ab578081fd5b813560206001600160401b038211156126c6576126c66134a7565b8160051b6126d5828201613376565b8381528281019086840183880185018910156126ef578687fd5b8693505b858410156127115780358352600193909301929184019184016126f3565b50979650505050505050565b60008083601f84011261272e578182fd5b5081356001600160401b03811115612744578182fd5b60208301915083602082850101111561269457600080fd5b600082601f83011261276c578081fd5b81356001600160401b03811115612785576127856134a7565b612798601f8201601f1916602001613376565b8181528460208386010111156127ac578283fd5b816020850160208301379081016020019190915292915050565b803560ff8116811461115d57600080fd5b6000602082840312156127e8578081fd5b8135612414816134bd565b600060208284031215612804578081fd5b8151612414816134bd565b60008060008060008060008060008060006101008c8e031215612830578687fd5b6128398c612647565b9a5061284760208d01612647565b99506001600160401b038060408e01351115612861578788fd5b6128718e60408f01358f01612652565b909a50985060608d0135811015612886578788fd5b6128968e60608f01358f01612652565b909850965060808d01358110156128ab578586fd5b506128bc8d60808e01358e0161271d565b90955093506128cd60a08d016127c6565b925060c08c0135915060e08c013590509295989b509295989b9093969950565b600080600080600080600080600060e08a8c03121561290a578485fd5b8935612915816134bd565b985060208a0135612925816134bd565b975060408a01356001600160401b0380821115612940578687fd5b61294c8d838e01612652565b909950975060608c0135915080821115612964578687fd5b506129718c828d0161271d565b9096509450612984905060808b016127c6565b925060a08a0135915060c08a013590509295985092959850929598565b60008060008060008060c087890312156129b9578182fd5b86356129c4816134bd565b955060208701356129d4816134bd565b9450604087013593506129e9606088016127c6565b92506080870135915060a087013590509295509295509295565b600080600080600060a08688031215612a1a578081fd5b8535612a25816134bd565b945060208601356001600160401b0380821115612a40578283fd5b612a4c89838a0161269b565b95506040880135915080821115612a61578283fd5b50612a6e8882890161269b565b9350506060860135612a7f816134bd565b9150612a8d608087016127c6565b90509295509295909350565b60008060408385031215612aab578182fd5b8235612ab6816134bd565b915060208301358015158114612aca578182fd5b809150509250929050565b60008060008060008060008060c0898b031215612af0578182fd5b8835612afb816134bd565b975060208901356001600160401b0380821115612b16578384fd5b612b228c838d0161271d565b909950975060408b0135915080821115612b3a578384fd5b612b468c838d0161271d565b909750955060608b0135915080821115612b5e578384fd5b50612b6b8b828c0161269b565b9350506080890135612b7c816134bd565b9150612b8a60a08a016127c6565b90509295985092959890939650565b60008060008060008060008060c0898b031215612bb4578182fd5b8835612bbf816134bd565b975060208901356001600160401b0380821115612bda578384fd5b612be68c838d0161271d565b909950975060408b0135915080821115612bfe578384fd5b50612c0b8b828c0161271d565b909650945050606089013592506080890135612b7c816134bd565b600080600080600060a08688031215612c3d578283fd5b8535612c48816134bd565b945060208601356001600160401b0380821115612c63578485fd5b612c6f89838a0161275c565b95506040880135915080821115612c84578485fd5b50612c918882890161275c565b9350506060860135612ca2816134bd565b949793965091946080013592915050565b600080600080600060a08688031215612cca578283fd5b8535612cd5816134bd565b945060208601359350612cea604087016127c6565b94979396509394606081013594506080013592915050565b600060208284031215612d13578081fd5b81516001600160e01b031981168114612414578182fd5b600060208284031215612d3b578081fd5b81356001600160401b03811115612d50578182fd5b611f088482850161275c565b600060208284031215612d6d578081fd5b612414826127c6565b81835260006001600160fb1b03831115612d8e578081fd5b8260051b80836020870137939093016020019283525090919050565b6000815180845260208085019450808401835b83811015612dd957815187529582019590820190600101612dbd565b509495945050505050565b60008284528282602086013780602084860101526020601f19601f85011685010190509392505050565b60008151808452612e268160208601602086016133f4565b601f01601f19169290920160200192915050565b60008251612e4c8184602087016133f4565b9190910192915050565b6001600160a01b0388168152608060208201819052600090612e7b908301888a612d76565b8281036040840152612e8e818789612d76565b90508281036060840152612ea3818587612de4565b9a9950505050505050505050565b6001600160a01b0386168152606060208201819052600090612ed69083018688612d76565b8281036040840152612ee9818587612de4565b98975050505050505050565b600060018060a01b03808816835260a06020840152612f1760a0840188612daa565b8381036040850152612f298188612daa565b959091166060840152505060ff919091166080909101529392505050565b600060018060a01b03808b16835260c06020840152612f6a60c084018a8c612de4565b8381036040850152612f7d81898b612de4565b90508381036060850152612f918188612daa565b959091166080840152505060ff9190911660a0909101529695505050505050565b600060018060a01b03808b16835260c06020840152612fd560c084018a8c612de4565b8381036040850152612fe881898b612de4565b92505085606084015280851660808401525060ff831660a08301529998505050505050505050565b600060018060a01b03808816835260a0602084015261303260a0840188612e0e565b83810360408501526130448188612e0e565b9590911660608401525050608001529392505050565b60006080825261306d6080830187612daa565b828103602084015261307f8187612daa565b6001600160a01b03959095166040840152505060ff9190911660609091015292915050565b8a81526001600160a01b038a811660208301528916604082015260e0606082018190526000906130d7908301898b612d76565b82810360808401526130ea81888a612d76565b905082810360a08401526130ff818688612de4565b9150508260c08301529b9a5050505050505050505050565b8881526001600160a01b0388811660208301528716604082015260c06060820181905260009061314a9083018789612d76565b828103608084015261315d818688612de4565b9150508260a08301529998505050505050505050565b600083825260406020830152611f086040830184612e0e565b600060a082526131a060a08301898b612de4565b82810360208401526131b381888a612de4565b905082810360408401526131c78187612daa565b6001600160a01b03959095166060840152505060ff9190911660809091015295945050505050565b600060a0825261320360a08301898b612de4565b828103602084015261321681888a612de4565b604084019690965250506001600160a01b0392909216606083015260ff16608090910152949350505050565b6000602082526124146020830184612e0e565b6000606082526132686060830186612e0e565b828103602084015261327a8186612e0e565b915050826040830152949350505050565b60208082526010908201526f29a427acaa9d102327a92124a22222a760811b604082015260600190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526016908201527553484f59553a20494e56414c49445f4144445245535360501b604082015260600190565b60208082526015908201527414d213d6554e881253959053125117d4d6535093d3605a1b604082015260600190565b60208082526013908201527253484f59553a20494e56414c49445f4e414d4560681b604082015260600190565b604051601f8201601f191681016001600160401b038111828210171561339e5761339e6134a7565b604052919050565b600082198211156133b9576133b9613491565b500190565b60008160001904831182151516156133d8576133d8613491565b500290565b6000828210156133ef576133ef613491565b500390565b60005b8381101561340f5781810151838201526020016133f7565b8381111561341e576000848401525b50505050565b60008161343357613433613491565b506000190190565b600181811c9082168061344f57607f821691505b6020821081141561347057634e487b7160e01b600052602260045260246000fd5b50919050565b600060001982141561348a5761348a613491565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146134d257600080fd5b5056fedf7de25b7f1fd6d0b5205f0e18f1f35bd7b8d84cce336588d184533ce43a6f76a2646970667358221220fa5bb301d18d6f142124f17e06a3bf1afa859b3ada61c3e1101483def042578364736f6c63430008030033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000008798249c2e607446efb7ad49ec89dd1865ff4272000000000000000000000000000000000000000000000000000000000000001900000000000000000000000093c7020393df59a951217d92d982d67a34a1557d000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000002468747470733a2f2f6170692e73686f79756e66742e636f6d2f6d657461646174612f312f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002468747470733a2f2f6170692e73686f79756e66742e636f6d2f6d657461646174612f312f00000000000000000000000000000000000000000000000000000000
-----Decoded View---------------
Arg [0] : protocolFeeRecipient (address): 0x8798249c2E607446EfB7Ad49eC89dD1865Ff4272
Arg [1] : protocolFee (uint8): 25
Arg [2] : operationalFeeRecipient (address): 0x93c7020393df59A951217d92d982d67A34a1557D
Arg [3] : operationalFee (uint8): 0
Arg [4] : _baseURI721 (string): https://api.shoyunft.com/metadata/1/
Arg [5] : _baseURI1155 (string): https://api.shoyunft.com/metadata/1/
-----Encoded View---------------
12 Constructor Arguments found :
Arg [0] : 0000000000000000000000008798249c2e607446efb7ad49ec89dd1865ff4272
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000019
Arg [2] : 00000000000000000000000093c7020393df59a951217d92d982d67a34a1557d
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [4] : 00000000000000000000000000000000000000000000000000000000000000c0
Arg [5] : 0000000000000000000000000000000000000000000000000000000000000120
Arg [6] : 0000000000000000000000000000000000000000000000000000000000000024
Arg [7] : 68747470733a2f2f6170692e73686f79756e66742e636f6d2f6d657461646174
Arg [8] : 612f312f00000000000000000000000000000000000000000000000000000000
Arg [9] : 0000000000000000000000000000000000000000000000000000000000000024
Arg [10] : 68747470733a2f2f6170692e73686f79756e66742e636f6d2f6d657461646174
Arg [11] : 612f312f00000000000000000000000000000000000000000000000000000000
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.