Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
TokenTracker
Latest 16 from a total of 16 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Set Max Supply | 17966197 | 521 days ago | IN | 0 ETH | 0.00045979 | ||||
Set Max Supply | 17966196 | 521 days ago | IN | 0 ETH | 0.00046592 | ||||
Set Max Supply | 17966195 | 521 days ago | IN | 0 ETH | 0.00048081 | ||||
Set Max Supply | 17966194 | 521 days ago | IN | 0 ETH | 0.00049618 | ||||
Set Max Supply | 17966193 | 521 days ago | IN | 0 ETH | 0.00048259 | ||||
Set Max Supply | 17966193 | 521 days ago | IN | 0 ETH | 0.00048236 | ||||
Update Public Dr... | 17964960 | 521 days ago | IN | 0 ETH | 0.0017026 | ||||
Update Public Dr... | 17964676 | 521 days ago | IN | 0 ETH | 0.00347327 | ||||
Update Allowed F... | 17964676 | 521 days ago | IN | 0 ETH | 0.00308105 | ||||
Update Creator P... | 17964676 | 521 days ago | IN | 0 ETH | 0.00244022 | ||||
Set Max Supply | 17964676 | 521 days ago | IN | 0 ETH | 0.00149132 | ||||
Set Max Supply | 17964676 | 521 days ago | IN | 0 ETH | 0.00149132 | ||||
Set Max Supply | 17964676 | 521 days ago | IN | 0 ETH | 0.00149132 | ||||
Set Max Supply | 17964676 | 521 days ago | IN | 0 ETH | 0.00149132 | ||||
Set Max Supply | 17964676 | 521 days ago | IN | 0 ETH | 0.00149132 | ||||
Set Max Supply | 17964676 | 521 days ago | IN | 0 ETH | 0.00149095 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Similar Match Source Code This contract matches the deployed Bytecode of the Source Code for Contract 0x95eE384C...dc56CE8e3 The constructor portion of the code might be different and could alter the actual behaviour of the contract
Contract Name:
Cassette
Compiler Version
v0.8.20+commit.a1b79de6
Optimization Enabled:
Yes with 1 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: Unlicense pragma solidity ^0.8.0; import { IONFT1155Core } from "./interfaces/IONFT1155Core.sol"; import { ILayerZeroEndpoint } from "./interfaces/ILayerZeroEndpoint.sol"; import { ICassette } from "./interfaces/ICassette.sol"; import { IKaijuMartRedeemable } from "./interfaces/IKaijuMartRedeemable.sol"; import { ONFT1155Core } from "./custom-lz/ONFT1155Core.sol"; import { ERC1155SeaDrop } from "./ERC1155SeaDrop.sol"; import { ERC1155SeaDropContractOfferer } from "./lib/ERC1155SeaDropContractOfferer.sol"; error Cassette_AlreadySetup(); error Cassette_ExceedsMaxPage(); error Cassette_InvalidConfiguration(); error Cassette_InvalidSendData(); error Cassette_NotAllowed(); error Cassette_ValueOutOfRange(); /** . :++- *##- +####* -##+ *####- :%######%. -%###* *######: =##########= .######* *#######*-#############*-*#######* *################################* *################################* *################################* *################################* *################################* :*******************************+. .:. *###%*=: .##########+-. +###############=: %##################%+ =###################### -######################++++++++++++++++++=-: =###########################################*: =#############################################. +####%#*+=-:. -#############################################: %############################################################= %############################################################## %##############################################################%=----::. %#######################################################################%: %##########################################+: :+%#######################: *########################################* *####################### -%###################################### %###################### -%###################################% ####################### =###################################- :####################### ....+##################################*. .+######################## +###########################################%*++*%########################## %#########################################################################*. %#######################################################################+ ########################################################################- *#######################################################################- .######################################################################%. :+#################################################################- :=#####################################################:..... :--:.:##############################################+ :: +###############################################%- ####%+-. %##################################################. %#######%*-. :###################################################% %###########%*=*####################################################= %#################################################################### %####################################################################+ %#####################################################################. %#####################################################################% %######################################################################- .+*********************************************************************. * @title KAIJU ORIGINS: The Journals of Stod - Cassette * @notice See https://origins.kaijukingz.io/ for more details. * @author Augminted Labs, LLC */ contract Cassette is ONFT1155Core, ERC1155SeaDrop, ICassette, IKaijuMartRedeemable { struct Setup { address kmart; address lzEndpoint; uint256 maxPage; uint256 totalChains; uint256 chainOffset; } uint16 public constant FUNCTION_TYPE_BURN = uint16(uint256(keccak256("BURN"))); uint256 public MAX_PAGE; uint256 public TOTAL_CHAINS; uint256 public CHAIN_OFFSET; address public kmart; address public replicator; uint256 public currentMaxPage; uint256 public totalMinted; bool public isSetup; constructor( address allowedConfigurer, address allowedConduit, address allowedSeaport, string memory _name, string memory _symbol ) ERC1155SeaDrop( allowedConfigurer, allowedConduit, allowedSeaport, _name, _symbol ) {} /** * @inheritdoc ONFT1155Core */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC1155SeaDropContractOfferer, ONFT1155Core) returns (bool) { return ERC1155SeaDropContractOfferer.supportsInterface(interfaceId) || super.supportsInterface(interfaceId); } /** * @notice Calculate page number of a specified token ID * @param _tokenId Token ID to return the page number of * @return uint256 A token's corresponding page number */ function page(uint256 _tokenId) public view returns (uint256) { if (_tokenId > MAX_PAGE * TOTAL_CHAINS) revert Cassette_ValueOutOfRange(); return _tokenId == 0 ? 0 : (_tokenId + TOTAL_CHAINS - 1) / TOTAL_CHAINS; } /** * @notice Calculate token ID of a specified page * @dev This will vary depending on which chain this contract is deployed to * @param _page Page to return the token ID of * @return uint256 A page's corresponding token ID */ function tokenId(uint256 _page) public view returns (uint256) { if (_page > MAX_PAGE) revert Cassette_ValueOutOfRange(); return _page == 0 ? 0 : ((_page - 1) * TOTAL_CHAINS) + CHAIN_OFFSET + 1; } /** * @notice Return an array of token balances for a specified address * @param _account Address to return the token balances of * @return uint256[] Balances for every valid token ID */ function balancesOf(address _account) public view returns (uint256[] memory) { uint256[] memory balances = new uint256[](TOTAL_CHAINS * MAX_PAGE + 1); for (uint256 i; i < balances.length;) { balances[i] = balanceOf(_account, i); unchecked { ++i; } } return balances; } /** * @notice Initialize contract state * @param _setup Parameters for initial contract state */ function setup(Setup calldata _setup) external onlyOwner() { if (isSetup) revert Cassette_AlreadySetup(); MAX_PAGE = _setup.maxPage; TOTAL_CHAINS = _setup.totalChains; CHAIN_OFFSET = _setup.chainOffset; lzEndpoint = ILayerZeroEndpoint(_setup.lzEndpoint); isSetup = true; } /** * @notice Set the address of the kmart contract * @param _kmart Address of the kmart contract */ function setKmart(address _kmart) public payable onlyOwner { kmart = _kmart; } /** * @notice Set the address of the replicator contract * @param _replicator Address of the replicator contract */ function setReplicator(address _replicator) public payable onlyOwner { replicator = _replicator; } /** * @notice Set the current maximum page * @param _currentMaxPage Current maximum page */ function setCurrentMaxPage(uint256 _currentMaxPage) public payable onlyOwner { if (_currentMaxPage > MAX_PAGE) revert Cassette_ExceedsMaxPage(); currentMaxPage = _currentMaxPage; } /** * @notice Mint a specified number of blank cassettes from a kmart lot * @param _amount Amount of blank cassettes to mint * @param _to Address receiving the blank cassettes */ function kmartRedeem(uint256, uint32 _amount, address _to) public { if (msg.sender != kmart) revert Cassette_NotAllowed(); _mint(_to, 0, _amount); } /** * @notice Mint a specified number of a specific page using a replicator * @param _to Address receiving the pages * @param _page Page to mint * @param _amount Amount of pages to mint */ function replicatorMint(address _to, uint256 _page, uint256 _amount) public payable { _mint(_to, _page, _amount); } /** * @notice Internal function for minting pages * @param _to Address receiving the pages * @param _page Page to mint * @param _amount Amount of pages to mint */ function _mint(address _to, uint256 _page, uint256 _amount) internal { if (_page > MAX_PAGE) revert Cassette_ExceedsMaxPage(); _mint(_to, tokenId(_page), _amount, ""); unchecked { totalMinted += _amount; } } /** * @inheritdoc ERC1155SeaDrop */ function burn( address, // _from, uint256 _tokenId, uint256 _amount ) external override { uint256 _page = page(_tokenId); if (_page + 1 > currentMaxPage) revert Cassette_ExceedsMaxPage(); _burn(msg.sender, msg.sender, _tokenId, _amount); _mint(msg.sender, _page + 1, _amount); } /** * @inheritdoc ERC1155SeaDrop */ function batchBurn( address, // _from, uint256[] memory _tokenIds, uint256[] memory _amounts ) external override { for (uint256 i; i < _tokenIds.length;) { uint256 _page = page(_tokenIds[i]); if (_page + 1 > currentMaxPage) revert Cassette_ExceedsMaxPage(); _burn(msg.sender, _tokenIds[i], _amounts[i]); _mint(msg.sender, _page + 1, _amounts[i]); unchecked { ++i; } } } /** * @notice Burn a token on the current chain to receive the next page in the series on a destination chain * @dev For more details see https://layerzero.gitbook.io/docs/evm-guides/master * @param _from Address to burn a token from * @param _dstChainId Destination chain's LayerZero ID * @param _toAddress Address to receive the next page in the series * @param _tokenId Token to burn * @param _amount Amount of tokens to burn * @param _refundAddress Address to send refund to if transaction is cheaper than expected * @param _zroPaymentAddress Address of $ZRO token holder that will pay for the transaction * @param _adapterParams Parameters for custom functionality */ function burnFrom( address _from, uint16 _dstChainId, bytes memory _toAddress, uint256 _tokenId, uint256 _amount, address payable _refundAddress, address _zroPaymentAddress, bytes memory _adapterParams ) public payable { if (page(_tokenId) + 1 > currentMaxPage) revert Cassette_ExceedsMaxPage(); _sendBatch( FUNCTION_TYPE_BURN, _from, _dstChainId, _toAddress, _toSingletonArray(_tokenId), _toSingletonArray(_amount), _refundAddress, _zroPaymentAddress, _adapterParams ); } /** * @notice Burn a batch of tokens on the current chain to receive the next pages in the series on a destination chain * @dev For more details see https://layerzero.gitbook.io/docs/evm-guides/master * @param _from Address to burn tokens from * @param _dstChainId Destination chain's LayerZero ID * @param _toAddress Address to receive the next pages in the series * @param _tokenIds Tokens to burn * @param _amounts Amounts of tokens to burn * @param _refundAddress Address to send refund to if transaction is cheaper than expected * @param _zroPaymentAddress Address of $ZRO token holder that will pay for the transaction * @param _adapterParams Parameters for custom functionality */ function burnBatchFrom( address _from, uint16 _dstChainId, bytes memory _toAddress, uint256[] memory _tokenIds, uint256[] memory _amounts, address payable _refundAddress, address _zroPaymentAddress, bytes memory _adapterParams ) public payable { for (uint256 i; i < _tokenIds.length;) { if (page(_tokenIds[i]) + 1 > currentMaxPage) revert Cassette_ExceedsMaxPage(); unchecked { ++i; } } _sendBatch( FUNCTION_TYPE_BURN, _from, _dstChainId, _toAddress, _tokenIds, _amounts, _refundAddress, _zroPaymentAddress, _adapterParams ); } /** * @notice Estimate the cost of sending a token to a destination chain * @param _dstChainId Destination chain's LayerZero ID * @param _toAddress Address to receive the token * @param _tokenId Token to send * @param _amount Amount of tokens to send * @param _useZro Flag indicating whether to use $ZRO for payment * @param _adapterParams Parameters for custom functionality */ function estimateSendFee( uint16 _dstChainId, bytes memory _toAddress, uint256 _tokenId, uint256 _amount, bool _useZro, bytes memory _adapterParams ) public view override returns (uint256 nativeFee, uint256 zroFee) { return estimateBatchFee( FUNCTION_TYPE_SEND, _dstChainId, _toAddress, _toSingletonArray(_tokenId), _toSingletonArray(_amount), _useZro, _adapterParams ); } /* * @notice Estimate the cost of sending a batch of tokens to a destination chain * @param _dstChainId Destination chain's LayerZero ID * @param _toAddress Address to receive the tokens * @param _tokenId Tokens to send * @param _amount Amounts of tokens to send * @param _useZro Flag indicating whether to use $ZRO for payment * @param _adapterParams Parameters for custom functionality */ function estimateSendBatchFee( uint16 _dstChainId, bytes memory _toAddress, uint256[] memory _tokenIds, uint256[] memory _amounts, bool _useZro, bytes memory _adapterParams ) public view override returns (uint256 nativeFee, uint256 zroFee) { return estimateBatchFee( FUNCTION_TYPE_SEND_BATCH, _dstChainId, _toAddress, _tokenIds, _amounts, _useZro, _adapterParams ); } /* * @notice Estimate the cost of performing a specified cross-chain function on a token * @param _functionType Cross-chain function to perform * @param _dstChainId Destination chain's LayerZero ID * @param _toAddress Address to receive the tokens * @param _tokenId Tokens to send * @param _amount Amounts of tokens to send * @param _useZro Flag indicating whether to use $ZRO for payment * @param _adapterParams Parameters for custom functionality */ function estimateFee( uint16 _functionType, uint16 _dstChainId, bytes memory _toAddress, uint256 _tokenId, uint256 _amount, bool _useZro, bytes memory _adapterParams ) public view returns (uint256 nativeFee, uint256 zroFee) { return estimateBatchFee( _functionType, _dstChainId, _toAddress, _toSingletonArray(_tokenId), _toSingletonArray(_amount), _useZro, _adapterParams ); } /* * @notice Estimate the cost of performing a specified cross-chain function on a batch of tokens * @param _functionType Cross-chain function to perform * @param _dstChainId Destination chain's LayerZero ID * @param _toAddress Address to receive the tokens * @param _tokenIds Tokens to burn * @param _amounts Amounts of tokens to burn * @param _useZro Flag indicating whether to use $ZRO for payment * @param _adapterParams Parameters for custom functionality */ function estimateBatchFee( uint16 _functionType, uint16 _dstChainId, bytes memory _toAddress, uint256[] memory _tokenIds, uint256[] memory _amounts, bool _useZro, bytes memory _adapterParams ) public view returns (uint256 nativeFee, uint256 zroFee) { bytes memory payload = abi.encode(_functionType, _toAddress, _tokenIds, _amounts); return lzEndpoint.estimateFees(_dstChainId, address(this), payload, _useZro, _adapterParams); } /** * @notice Override `ONFT1155Core` function to debit a batch of tokens from the current chain * @dev For more details see https://layerzero.gitbook.io/docs/evm-guides/master * @param _from Address to debit tokens from * @param _tokenIds Tokens to debit * @param _amounts Amounts of tokens to debit */ function _debitFrom( address _from, uint16, // _dstChainId bytes memory, // _toAddress uint256[] memory _tokenIds, uint256[] memory _amounts ) internal override { if (msg.sender != _from && !isApprovedForAll(_from, msg.sender)) revert Cassette_NotAllowed(); _batchBurn(_from, _from, _tokenIds, _amounts); } /** * @notice Override `ONFT1155Core` function to credit a batch of tokens on the current chain * @dev For more details see https://layerzero.gitbook.io/docs/evm-guides/master * @param _toAddress Address to credit tokens to * @param _tokenIds Tokens to credit * @param _amounts Amounts of tokens to credit */ function _creditTo( uint16, // _srcChainId address _toAddress, uint256[] memory _tokenIds, uint256[] memory _amounts ) internal override { _batchMint(_toAddress, _tokenIds, _amounts, ""); } /** * @notice Override `ONFT1155Core` function to send a batch of tokens from the current chain to a destination chain * @dev For more details see https://layerzero.gitbook.io/docs/evm-guides/master * @param _from Address to send tokens from * @param _dstChainId Destination chain's LayerZero ID * @param _toAddress Address to receive the tokens * @param _tokenIds Tokens to send * @param _amounts Amounts of tokens to send * @param _refundAddress Address to send refund to if transaction is cheaper than expected * @param _zroPaymentAddress Address of $ZRO token holder that will pay for the transaction * @param _adapterParams Parameters for custom functionality */ function _sendBatch( address _from, uint16 _dstChainId, bytes memory _toAddress, uint256[] memory _tokenIds, uint256[] memory _amounts, address payable _refundAddress, address _zroPaymentAddress, bytes memory _adapterParams ) internal override { _sendBatch( _tokenIds.length == 1 ? FUNCTION_TYPE_SEND : FUNCTION_TYPE_SEND_BATCH, _from, _dstChainId, _toAddress, _tokenIds, _amounts, _refundAddress, _zroPaymentAddress, _adapterParams ); } /** * @notice Send a batch of tokens from the current chain to a destination chain with a specified operation * @dev For more details see https://layerzero.gitbook.io/docs/evm-guides/master * @param _functionType Function to perform on the destination chain * @param _from Address to send tokens from * @param _dstChainId Destination chain's LayerZero ID * @param _toAddress Address to receive the tokens * @param _tokenIds Tokens to send * @param _amounts Amounts of tokens to send * @param _refundAddress Address to send refund to if transaction is cheaper than expected * @param _zroPaymentAddress Address of $ZRO token holder that will pay for the transaction * @param _adapterParams Parameters for custom functionality */ function _sendBatch( uint16 _functionType, address _from, uint16 _dstChainId, bytes memory _toAddress, uint256[] memory _tokenIds, uint256[] memory _amounts, address payable _refundAddress, address _zroPaymentAddress, bytes memory _adapterParams ) internal { if (_tokenIds.length == 0 || _tokenIds.length != _amounts.length) revert Cassette_InvalidSendData(); if (_functionType == FUNCTION_TYPE_SEND || _functionType == FUNCTION_TYPE_SEND_BATCH) { for (uint256 i; i < _tokenIds.length;) { if (_tokenIds[i] != 0) revert Cassette_InvalidSendData(); unchecked { ++i; } } } _debitFrom(_from, _dstChainId, _toAddress, _tokenIds, _amounts); bytes memory payload = abi.encode(_functionType, _toAddress, _tokenIds, _amounts); _checkGasLimit(_dstChainId, _functionType, _adapterParams, NO_EXTRA_GAS); _lzSend(_dstChainId, payload, _refundAddress, _zroPaymentAddress, _adapterParams, msg.value); if (_tokenIds.length == 1) { emit SendToChain(_dstChainId, _from, _toAddress, _tokenIds[0], _amounts[0]); } else if (_tokenIds.length > 1) { emit SendBatchToChain(_dstChainId, _from, _toAddress, _tokenIds, _amounts); } } /** * @notice Override `ONFT1155Core` function that processes a payload from a source chain * @dev For more details see https://layerzero.gitbook.io/docs/evm-guides/master * @param _srcChainId Source chain's LayerZero ID * @param _srcAddress Address that sent the payload from the source chain * @param _payload Payload to process */ function _nonblockingLzReceive( uint16 _srcChainId, bytes memory _srcAddress, uint64, // _nonce bytes memory _payload ) internal override { ( uint16 functionType, bytes memory toAddressBytes, uint256[] memory tokenIds, uint256[] memory amounts ) = abi.decode(_payload, (uint16, bytes, uint256[], uint256[])); address toAddress; assembly { toAddress := mload(add(toAddressBytes, 20)) } uint256[] memory _tokenIds = functionType == FUNCTION_TYPE_BURN ? _bumpTokenIds(tokenIds) : tokenIds; _creditTo(_srcChainId, toAddress, _tokenIds, amounts); if (tokenIds.length == 1) { emit ReceiveFromChain(_srcChainId, _srcAddress, toAddress, _tokenIds[0], amounts[0]); } else if (tokenIds.length > 1) { emit ReceiveBatchFromChain(_srcChainId, _srcAddress, toAddress, _tokenIds, amounts); } } /** * @notice Bump token IDs to those corresponding to the next page in the series * @param _tokenIds Tokens to bump to the next page * @return uint256[] Tokens corresponding to the next page in the series */ function _bumpTokenIds(uint256[] memory _tokenIds) internal view returns (uint256[] memory) { for (uint256 i; i < _tokenIds.length;) { unchecked { _tokenIds[i] = tokenId(page(_tokenIds[i]) + 1); ++i; } } return _tokenIds; } }
// SPDX-License-Identifier: MIT pragma solidity >=0.5.0; import "@openzeppelin/contracts/utils/introspection/IERC165.sol"; /** * @dev Interface of the ONFT Core standard */ interface IONFT1155Core is IERC165 { event SendToChain(uint16 indexed _dstChainId, address indexed _from, bytes indexed _toAddress, uint _tokenId, uint _amount); event SendBatchToChain(uint16 indexed _dstChainId, address indexed _from, bytes indexed _toAddress, uint[] _tokenIds, uint[] _amounts); event ReceiveFromChain(uint16 indexed _srcChainId, bytes indexed _srcAddress, address indexed _toAddress, uint _tokenId, uint _amount); event ReceiveBatchFromChain(uint16 indexed _srcChainId, bytes indexed _srcAddress, address indexed _toAddress, uint[] _tokenIds, uint[] _amounts); // _from - address where tokens should be deducted from on behalf of // _dstChainId - L0 defined chain id to send tokens too // _toAddress - dynamic bytes array which contains the address to whom you are sending tokens to on the dstChain // _tokenId - token Id to transfer // _amount - amount of the tokens to transfer // _refundAddress - address on src that will receive refund for any overpayment of L0 fees // _zroPaymentAddress - if paying in zro, pass the address to use. using 0x0 indicates not paying fees in zro // _adapterParams - flexible bytes array to indicate messaging adapter services in L0 function sendFrom(address _from, uint16 _dstChainId, bytes calldata _toAddress, uint _tokenId, uint _amount, address payable _refundAddress, address _zroPaymentAddress, bytes calldata _adapterParams) external payable; // _from - address where tokens should be deducted from on behalf of // _dstChainId - L0 defined chain id to send tokens too // _toAddress - dynamic bytes array which contains the address to whom you are sending tokens to on the dstChain // _tokenIds - token Ids to transfer // _amounts - amounts of the tokens to transfer // _refundAddress - address on src that will receive refund for any overpayment of L0 fees // _zroPaymentAddress - if paying in zro, pass the address to use. using 0x0 indicates not paying fees in zro // _adapterParams - flexible bytes array to indicate messaging adapter services in L0 function sendBatchFrom(address _from, uint16 _dstChainId, bytes calldata _toAddress, uint[] calldata _tokenIds, uint[] calldata _amounts, address payable _refundAddress, address _zroPaymentAddress, bytes calldata _adapterParams) external payable; // _dstChainId - L0 defined chain id to send tokens too // _toAddress - dynamic bytes array which contains the address to whom you are sending tokens to on the dstChain // _tokenId - token Id to transfer // _amount - amount of the tokens to transfer // _useZro - indicates to use zro to pay L0 fees // _adapterParams - flexible bytes array to indicate messaging adapter services in L0 function estimateSendFee(uint16 _dstChainId, bytes calldata _toAddress, uint _tokenId, uint _amount, bool _useZro, bytes calldata _adapterParams) external view returns (uint nativeFee, uint zroFee); // _dstChainId - L0 defined chain id to send tokens too // _toAddress - dynamic bytes array which contains the address to whom you are sending tokens to on the dstChain // _tokenIds - tokens Id to transfer // _amounts - amounts of the tokens to transfer // _useZro - indicates to use zro to pay L0 fees // _adapterParams - flexible bytes array to indicate messaging adapter services in L0 function estimateSendBatchFee(uint16 _dstChainId, bytes calldata _toAddress, uint[] calldata _tokenIds, uint[] calldata _amounts, bool _useZro, bytes calldata _adapterParams) external view returns (uint nativeFee, uint zroFee); }
// SPDX-License-Identifier: MIT pragma solidity >=0.5.0; import "./ILayerZeroUserApplicationConfig.sol"; interface ILayerZeroEndpoint is ILayerZeroUserApplicationConfig { // @notice send a LayerZero message to the specified address at a LayerZero endpoint. // @param _dstChainId - the destination chain identifier // @param _destination - the address on destination chain (in bytes). address length/format may vary by chains // @param _payload - a custom bytes payload to send to the destination contract // @param _refundAddress - if the source transaction is cheaper than the amount of value passed, refund the additional amount to this address // @param _zroPaymentAddress - the address of the ZRO token holder who would pay for the transaction // @param _adapterParams - parameters for custom functionality. e.g. receive airdropped native gas from the relayer on destination function send(uint16 _dstChainId, bytes calldata _destination, bytes calldata _payload, address payable _refundAddress, address _zroPaymentAddress, bytes calldata _adapterParams) external payable; // @notice used by the messaging library to publish verified payload // @param _srcChainId - the source chain identifier // @param _srcAddress - the source contract (as bytes) at the source chain // @param _dstAddress - the address on destination chain // @param _nonce - the unbound message ordering nonce // @param _gasLimit - the gas limit for external contract execution // @param _payload - verified payload to send to the destination contract function receivePayload(uint16 _srcChainId, bytes calldata _srcAddress, address _dstAddress, uint64 _nonce, uint _gasLimit, bytes calldata _payload) external; // @notice get the inboundNonce of a lzApp from a source chain which could be EVM or non-EVM chain // @param _srcChainId - the source chain identifier // @param _srcAddress - the source chain contract address function getInboundNonce(uint16 _srcChainId, bytes calldata _srcAddress) external view returns (uint64); // @notice get the outboundNonce from this source chain which, consequently, is always an EVM // @param _srcAddress - the source chain contract address function getOutboundNonce(uint16 _dstChainId, address _srcAddress) external view returns (uint64); // @notice gets a quote in source native gas, for the amount that send() requires to pay for message delivery // @param _dstChainId - the destination chain identifier // @param _userApplication - the user app address on this EVM chain // @param _payload - the custom message to send over LayerZero // @param _payInZRO - if false, user app pays the protocol fee in native token // @param _adapterParam - parameters for the adapter service, e.g. send some dust native token to dstChain function estimateFees(uint16 _dstChainId, address _userApplication, bytes calldata _payload, bool _payInZRO, bytes calldata _adapterParam) external view returns (uint nativeFee, uint zroFee); // @notice get this Endpoint's immutable source identifier function getChainId() external view returns (uint16); // @notice the interface to retry failed message on this Endpoint destination // @param _srcChainId - the source chain identifier // @param _srcAddress - the source chain contract address // @param _payload - the payload to be retried function retryPayload(uint16 _srcChainId, bytes calldata _srcAddress, bytes calldata _payload) external; // @notice query if any STORED payload (message blocking) at the endpoint. // @param _srcChainId - the source chain identifier // @param _srcAddress - the source chain contract address function hasStoredPayload(uint16 _srcChainId, bytes calldata _srcAddress) external view returns (bool); // @notice query if the _libraryAddress is valid for sending msgs. // @param _userApplication - the user app address on this EVM chain function getSendLibraryAddress(address _userApplication) external view returns (address); // @notice query if the _libraryAddress is valid for receiving msgs. // @param _userApplication - the user app address on this EVM chain function getReceiveLibraryAddress(address _userApplication) external view returns (address); // @notice query if the non-reentrancy guard for send() is on // @return true if the guard is on. false otherwise function isSendingPayload() external view returns (bool); // @notice query if the non-reentrancy guard for receive() is on // @return true if the guard is on. false otherwise function isReceivingPayload() external view returns (bool); // @notice get the configuration of the LayerZero messaging library of the specified version // @param _version - messaging library version // @param _chainId - the chainId for the pending config change // @param _userApplication - the contract address of the user application // @param _configType - type of configuration. every messaging library has its own convention. function getConfig(uint16 _version, uint16 _chainId, address _userApplication, uint _configType) external view returns (bytes memory); // @notice get the send() LayerZero messaging library version // @param _userApplication - the contract address of the user application function getSendVersion(address _userApplication) external view returns (uint16); // @notice get the lzReceive() LayerZero messaging library version // @param _userApplication - the contract address of the user application function getReceiveVersion(address _userApplication) external view returns (uint16); }
// SPDX-License-Identifier: Unlicense pragma solidity ^0.8.0; interface ICassette { function currentMaxPage() external view returns (uint); function replicatorMint(address to, uint256 chapter, uint256 amount) external payable; }
// SPDX-License-Identifier: Unlicense pragma solidity ^0.8.0; interface IKaijuMartRedeemable { function kmartRedeem(uint256 lotId, uint32 amount, address to) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../interfaces/IONFT1155Core.sol"; import "./lzApp/NonblockingLzApp.sol"; import "@openzeppelin/contracts/utils/introspection/ERC165.sol"; abstract contract ONFT1155Core is NonblockingLzApp, ERC165, IONFT1155Core { uint public constant NO_EXTRA_GAS = 0; uint16 public constant FUNCTION_TYPE_SEND = 1; uint16 public constant FUNCTION_TYPE_SEND_BATCH = 2; bool public useCustomAdapterParams; event SetUseCustomAdapterParams(bool _useCustomAdapterParams); constructor() {} function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IONFT1155Core).interfaceId || super.supportsInterface(interfaceId); } function estimateSendFee(uint16 _dstChainId, bytes memory _toAddress, uint _tokenId, uint _amount, bool _useZro, bytes memory _adapterParams) public view virtual override returns (uint nativeFee, uint zroFee) { return estimateSendBatchFee(_dstChainId, _toAddress, _toSingletonArray(_tokenId), _toSingletonArray(_amount), _useZro, _adapterParams); } function estimateSendBatchFee(uint16 _dstChainId, bytes memory _toAddress, uint[] memory _tokenIds, uint[] memory _amounts, bool _useZro, bytes memory _adapterParams) public view virtual override returns (uint nativeFee, uint zroFee) { bytes memory payload = abi.encode(_toAddress, _tokenIds, _amounts); return lzEndpoint.estimateFees(_dstChainId, address(this), payload, _useZro, _adapterParams); } function sendFrom(address _from, uint16 _dstChainId, bytes memory _toAddress, uint _tokenId, uint _amount, address payable _refundAddress, address _zroPaymentAddress, bytes memory _adapterParams) public payable virtual override { _sendBatch(_from, _dstChainId, _toAddress, _toSingletonArray(_tokenId), _toSingletonArray(_amount), _refundAddress, _zroPaymentAddress, _adapterParams); } function sendBatchFrom(address _from, uint16 _dstChainId, bytes memory _toAddress, uint[] memory _tokenIds, uint[] memory _amounts, address payable _refundAddress, address _zroPaymentAddress, bytes memory _adapterParams) public payable virtual override { _sendBatch(_from, _dstChainId, _toAddress, _tokenIds, _amounts, _refundAddress, _zroPaymentAddress, _adapterParams); } function _sendBatch(address _from, uint16 _dstChainId, bytes memory _toAddress, uint[] memory _tokenIds, uint[] memory _amounts, address payable _refundAddress, address _zroPaymentAddress, bytes memory _adapterParams) internal virtual { _debitFrom(_from, _dstChainId, _toAddress, _tokenIds, _amounts); bytes memory payload = abi.encode(_toAddress, _tokenIds, _amounts); if (_tokenIds.length == 1) { if (useCustomAdapterParams) { _checkGasLimit(_dstChainId, FUNCTION_TYPE_SEND, _adapterParams, NO_EXTRA_GAS); } else { require(_adapterParams.length == 0, "LzApp: _adapterParams must be empty."); } _lzSend(_dstChainId, payload, _refundAddress, _zroPaymentAddress, _adapterParams, msg.value); emit SendToChain(_dstChainId, _from, _toAddress, _tokenIds[0], _amounts[0]); } else if (_tokenIds.length > 1) { if (useCustomAdapterParams) { _checkGasLimit(_dstChainId, FUNCTION_TYPE_SEND_BATCH, _adapterParams, NO_EXTRA_GAS); } else { require(_adapterParams.length == 0, "LzApp: _adapterParams must be empty."); } _lzSend(_dstChainId, payload, _refundAddress, _zroPaymentAddress, _adapterParams, msg.value); emit SendBatchToChain(_dstChainId, _from, _toAddress, _tokenIds, _amounts); } } function _nonblockingLzReceive( uint16 _srcChainId, bytes memory _srcAddress, uint64, /*_nonce*/ bytes memory _payload ) internal virtual override { // decode and load the toAddress (bytes memory toAddressBytes, uint[] memory tokenIds, uint[] memory amounts) = abi.decode(_payload, (bytes, uint[], uint[])); address toAddress; assembly { toAddress := mload(add(toAddressBytes, 20)) } _creditTo(_srcChainId, toAddress, tokenIds, amounts); if (tokenIds.length == 1) { emit ReceiveFromChain(_srcChainId, _srcAddress, toAddress, tokenIds[0], amounts[0]); } else if (tokenIds.length > 1) { emit ReceiveBatchFromChain(_srcChainId, _srcAddress, toAddress, tokenIds, amounts); } } function setUseCustomAdapterParams(bool _useCustomAdapterParams) external onlyOwner { useCustomAdapterParams = _useCustomAdapterParams; emit SetUseCustomAdapterParams(_useCustomAdapterParams); } function _debitFrom(address _from, uint16 _dstChainId, bytes memory _toAddress, uint[] memory _tokenIds, uint[] memory _amounts) internal virtual; function _creditTo(uint16 _srcChainId, address _toAddress, uint[] memory _tokenIds, uint[] memory _amounts) internal virtual; function _toSingletonArray(uint element) internal pure returns (uint[] memory) { uint[] memory array = new uint[](1); array[0] = element; return array; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; import { ERC1155SeaDropContractOfferer } from "./lib/ERC1155SeaDropContractOfferer.sol"; import { DefaultOperatorFilterer } from "operator-filter-registry/DefaultOperatorFilterer.sol"; import { ERC1155 } from "solady/src/tokens/ERC1155.sol"; /** * @title ERC1155SeaDrop * @author James Wenzel (emo.eth) * @author Ryan Ghods (ralxz.eth) * @author Stephan Min (stephanm.eth) * @author Michael Cohen (notmichael.eth) * @notice An ERC1155 token contract that can mint as a * Seaport contract offerer. */ contract ERC1155SeaDrop is ERC1155SeaDropContractOfferer, DefaultOperatorFilterer { /** * @notice Deploy the token contract. * * @param allowedConfigurer The address of the contract allowed to * implementation code. Also contains SeaDrop * implementation code. * @param allowedConduit The address of the conduit contract allowed to * interact. * @param allowedSeaport The address of the Seaport contract allowed to * interact. * @param name_ The name of the token. * @param symbol_ The symbol of the token. */ constructor( address allowedConfigurer, address allowedConduit, address allowedSeaport, string memory name_, string memory symbol_ ) ERC1155SeaDropContractOfferer( allowedConfigurer, allowedConduit, allowedSeaport, name_, symbol_ ) {} /** * @dev See {IERC1155-setApprovalForAll}. * * The added modifier ensures that the operator is allowed * by the OperatorFilterRegistry. */ function setApprovalForAll( address operator, bool approved ) public override onlyAllowedOperatorApproval(operator) { ERC1155.setApprovalForAll(operator, approved); } /** * @dev See {IERC1155-safeTransferFrom}. * * The added modifier ensures that the operator is allowed * by the OperatorFilterRegistry. */ function safeTransferFrom( address from, address to, uint256 tokenId, uint256 amount, bytes calldata data ) public override onlyAllowedOperator(from) { ERC1155SeaDropContractOfferer.safeTransferFrom( from, to, tokenId, amount, data ); } /** * @dev See {IERC1155-safeBatchTransferFrom}. * * The added modifier ensures that the operator is allowed * by the OperatorFilterRegistry. */ function safeBatchTransferFrom( address from, address to, uint256[] calldata ids, uint256[] calldata amounts, bytes calldata data ) public virtual override onlyAllowedOperator(from) { ERC1155._safeBatchTransfer(msg.sender, from, to, ids, amounts, data); } /** * @dev Auto-approve the conduit after mint or transfer. * * @custom:param from The address to transfer from. * @param to The address to transfer to. * @custom:param ids The token ids to transfer. * @custom:param amounts The quantities to transfer. * @custom:param data The data to pass if receiver is a contract. */ function _afterTokenTransfer( address /* from */, address to, uint256[] memory /* ids */, uint256[] memory /* amounts */, bytes memory /* data */ ) internal virtual override { // Auto-approve the conduit. if (to != address(0) && !isApprovedForAll(to, _CONDUIT)) { _setApprovalForAll(to, _CONDUIT, true); } } /** * @dev Override this function to return true if `_afterTokenTransfer` is * used. The is to help the compiler avoid producing dead bytecode. */ function _useAfterTokenTransfer() internal view virtual override returns (bool) { return true; } /** * @notice Burns a token, restricted to the owner or approved operator, * and must have sufficient balance. * * @param from The address to burn from. * @param id The token id to burn. * @param amount The amount to burn. */ function burn(address from, uint256 id, uint256 amount) external virtual { // Burn the token. _burn(msg.sender, from, id, amount); } /** * @notice Burns a batch of tokens, restricted to the owner or * approved operator, and must have sufficient balance. * * @param from The address to burn from. * @param ids The token ids to burn. * @param amounts The amounts to burn per token id. */ function batchBurn( address from, uint256[] calldata ids, uint256[] calldata amounts ) external virtual { // Burn the tokens. _batchBurn(msg.sender, from, ids, amounts); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; import { IERC1155SeaDrop } from "../interfaces/IERC1155SeaDrop.sol"; import { ISeaDropToken } from "../interfaces/ISeaDropToken.sol"; import { ERC1155ContractMetadata } from "./ERC1155ContractMetadata.sol"; import { ERC1155SeaDropContractOffererStorage } from "./ERC1155SeaDropContractOffererStorage.sol"; import { ERC1155SeaDropErrorsAndEvents } from "./ERC1155SeaDropErrorsAndEvents.sol"; import { PublicDrop } from "./ERC1155SeaDropStructs.sol"; import { AllowListData } from "./SeaDropStructs.sol"; import { SpentItem } from "seaport-types/src/lib/ConsiderationStructs.sol"; import { ContractOffererInterface } from "seaport-types/src/interfaces/ContractOffererInterface.sol"; import { IERC165 } from "@openzeppelin/contracts/utils/introspection/IERC165.sol"; import { ERC1155 } from "solady/src/tokens/ERC1155.sol"; /** * @title ERC1155SeaDropContractOfferer * @author James Wenzel (emo.eth) * @author Ryan Ghods (ralxz.eth) * @author Stephan Min (stephanm.eth) * @author Michael Cohen (notmichael.eth) * @notice An ERC1155 token contract that can mint as a * Seaport contract offerer. */ contract ERC1155SeaDropContractOfferer is ERC1155ContractMetadata, ERC1155SeaDropErrorsAndEvents { using ERC1155SeaDropContractOffererStorage for ERC1155SeaDropContractOffererStorage.Layout; /// @notice The allowed conduit address that can mint. address immutable _CONDUIT; /** * @notice Deploy the token contract. * * @param allowedConfigurer The address of the contract allowed to * configure parameters. Also contains SeaDrop * implementation code. * @param allowedConduit The address of the conduit contract allowed to * interact. * @param allowedSeaport The address of the Seaport contract allowed to * interact. * @param name_ The name of the token. * @param symbol_ The symbol of the token. */ constructor( address allowedConfigurer, address allowedConduit, address allowedSeaport, string memory name_, string memory symbol_ ) ERC1155ContractMetadata(allowedConfigurer, name_, symbol_) { // Set the allowed conduit to interact with this contract. _CONDUIT = allowedConduit; // Set the allowed Seaport to interact with this contract. if (allowedSeaport == address(0)) { revert AllowedSeaportCannotBeZeroAddress(); } ERC1155SeaDropContractOffererStorage.layout()._allowedSeaport[ allowedSeaport ] = true; // Set the allowed Seaport enumeration. address[] memory enumeratedAllowedSeaport = new address[](1); enumeratedAllowedSeaport[0] = allowedSeaport; ERC1155SeaDropContractOffererStorage .layout() ._enumeratedAllowedSeaport = enumeratedAllowedSeaport; // Emit an event noting the contract deployment. emit SeaDropTokenDeployed(SEADROP_TOKEN_TYPE.ERC1155_STANDARD); } /** * @notice The fallback function is used as a dispatcher for SeaDrop * methods. */ fallback(bytes calldata) external returns (bytes memory output) { // Get the function selector. bytes4 selector = msg.sig; // Get the rest of the msg data after the selector. bytes calldata data = msg.data[4:]; // Determine if we should forward the call to the implementation // contract with SeaDrop logic. bool callSeaDropImplementation = selector == ISeaDropToken.updateAllowedSeaport.selector || selector == ISeaDropToken.updateDropURI.selector || selector == ISeaDropToken.updateAllowList.selector || selector == ISeaDropToken.updateCreatorPayouts.selector || selector == ISeaDropToken.updatePayer.selector || selector == ISeaDropToken.updateAllowedFeeRecipient.selector || selector == ISeaDropToken.updateSigner.selector || selector == IERC1155SeaDrop.updatePublicDrop.selector || selector == ContractOffererInterface.previewOrder.selector || selector == ContractOffererInterface.generateOrder.selector || selector == ContractOffererInterface.getSeaportMetadata.selector || selector == IERC1155SeaDrop.getPublicDrop.selector || selector == IERC1155SeaDrop.getPublicDropIndexes.selector || selector == ISeaDropToken.getAllowedSeaport.selector || selector == ISeaDropToken.getCreatorPayouts.selector || selector == ISeaDropToken.getAllowListMerkleRoot.selector || selector == ISeaDropToken.getAllowedFeeRecipients.selector || selector == ISeaDropToken.getSigners.selector || selector == ISeaDropToken.getDigestIsUsed.selector || selector == ISeaDropToken.getPayers.selector; // Determine if we should require only the owner or configurer calling. bool requireOnlyOwnerOrConfigurer = selector == ISeaDropToken.updateAllowedSeaport.selector || selector == ISeaDropToken.updateDropURI.selector || selector == ISeaDropToken.updateAllowList.selector || selector == ISeaDropToken.updateCreatorPayouts.selector || selector == ISeaDropToken.updatePayer.selector || selector == ISeaDropToken.updateAllowedFeeRecipient.selector || selector == IERC1155SeaDrop.updatePublicDrop.selector; if (callSeaDropImplementation) { // For update calls, ensure the sender is only the owner // or configurer contract. if (requireOnlyOwnerOrConfigurer) { _onlyOwnerOrConfigurer(); } else if (selector == ISeaDropToken.updateSigner.selector) { // For updateSigner, a signer can disallow themselves. // Get the signer parameter. address signer = address(bytes20(data[12:32])); // If the signer is not allowed, ensure sender is only owner // or configurer. if ( msg.sender != signer || (msg.sender == signer && !ERC1155SeaDropContractOffererStorage .layout() ._allowedSigners[signer]) ) { _onlyOwnerOrConfigurer(); } } // Forward the call to the implementation contract. (bool success, bytes memory returnedData) = _CONFIGURER .delegatecall(msg.data); // Require that the call was successful. if (!success) { // Bubble up the revert reason. assembly { revert(add(32, returnedData), mload(returnedData)) } } // If the call was to generateOrder, mint the tokens. if (selector == ContractOffererInterface.generateOrder.selector) { _mintOrder(data); } // Return the data from the delegate call. return returnedData; } else if (selector == IERC1155SeaDrop.getMintStats.selector) { // Get the minter and token id. (address minter, uint256 tokenId) = abi.decode( data, (address, uint256) ); // Get the mint stats. ( uint256 minterNumMinted, uint256 minterNumMintedForTokenId, uint256 totalMintedForTokenId, uint256 maxSupply ) = _getMintStats(minter, tokenId); // Encode the return data. return abi.encode( minterNumMinted, minterNumMintedForTokenId, totalMintedForTokenId, maxSupply ); } else if (selector == ContractOffererInterface.ratifyOrder.selector) { // This function is a no-op, nothing additional needs to happen here. // Utilize assembly to efficiently return the ratifyOrder magic value. assembly { mstore(0, 0xf4dd92ce) return(0x1c, 32) } } else { // Revert if the function selector is not supported. revert UnsupportedFunctionSelector(selector); } } /** * @notice Returns a set of mint stats for the address. * This assists in enforcing maxSupply, maxTotalMintableByWallet, * and maxTokenSupplyForStage checks. * * @dev NOTE: Implementing contracts should always update these numbers * before transferring any tokens with _safeMint() to mitigate * consequences of malicious onERC1155Received() hooks. * * @param minter The minter address. * @param tokenId The token id to return the stats for. */ function _getMintStats( address minter, uint256 tokenId ) internal view returns ( uint256 minterNumMinted, uint256 minterNumMintedForTokenId, uint256 totalMintedForTokenId, uint256 maxSupply ) { // Put the token supply on the stack. TokenSupply storage tokenSupply = _tokenSupply[tokenId]; // Assign the return values. totalMintedForTokenId = tokenSupply.totalMinted; maxSupply = tokenSupply.maxSupply; minterNumMinted = _totalMintedByUser[minter]; minterNumMintedForTokenId = _totalMintedByUserPerToken[minter][tokenId]; } /** * @dev Handle ERC-1155 safeTransferFrom. If "from" is this contract, * the sender can only be Seaport or the conduit. * * @param from The address to transfer from. * @param to The address to transfer to. * @param id The token id to transfer. * @param amount The amount of tokens to transfer. * @param data The data to pass to the onERC1155Received hook. */ function safeTransferFrom( address from, address to, uint256 id, uint256 amount, bytes calldata data ) public virtual override { if (from == address(this)) { // Only Seaport or the conduit can use this function // when "from" is this contract. if ( msg.sender != _CONDUIT && !ERC1155SeaDropContractOffererStorage.layout()._allowedSeaport[ msg.sender ] ) { revert InvalidCallerOnlyAllowedSeaport(msg.sender); } return; } ERC1155._safeTransfer(msg.sender, from, to, id, amount, data); } /** * @notice Returns whether the interface is supported. * * @param interfaceId The interface id to check against. */ function supportsInterface( bytes4 interfaceId ) public view virtual override(ERC1155ContractMetadata) returns (bool) { return interfaceId == type(IERC1155SeaDrop).interfaceId || interfaceId == type(ContractOffererInterface).interfaceId || interfaceId == 0x2e778efc || // SIP-5 (getSeaportMetadata) // ERC1155ContractMetadata returns supportsInterface true for // IERC1155ContractMetadata, ERC-4906, ERC-2981 // ERC1155A returns supportsInterface true for // ERC165, ERC1155, ERC1155MetadataURI ERC1155ContractMetadata.supportsInterface(interfaceId); } /** * @dev Internal function to mint tokens during a generateOrder call * from Seaport. * * @param data The original transaction calldata, without the selector. */ function _mintOrder(bytes calldata data) internal { // Decode fulfiller, minimumReceived, and context from calldata. ( address fulfiller, SpentItem[] memory minimumReceived, , bytes memory context ) = abi.decode(data, (address, SpentItem[], SpentItem[], bytes)); // Assign the minter from context[22:42]. We validate context has the // correct minimum length in the implementation's `_decodeOrder`. address minter; assembly { minter := shr(96, mload(add(add(context, 0x20), 22))) } // If the minter is the zero address, set it to the fulfiller. if (minter == address(0)) { minter = fulfiller; } // Set the token ids and quantities. uint256 minimumReceivedLength = minimumReceived.length; uint256[] memory tokenIds = new uint256[](minimumReceivedLength); uint256[] memory quantities = new uint256[](minimumReceivedLength); for (uint256 i = 0; i < minimumReceivedLength; ) { tokenIds[i] = minimumReceived[i].identifier; quantities[i] = minimumReceived[i].amount; unchecked { ++i; } } // Mint the tokens. _batchMint(minter, tokenIds, quantities, ""); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.20; /** * @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.5.0; interface ILayerZeroUserApplicationConfig { // @notice set the configuration of the LayerZero messaging library of the specified version // @param _version - messaging library version // @param _chainId - the chainId for the pending config change // @param _configType - type of configuration. every messaging library has its own convention. // @param _config - configuration in the bytes. can encode arbitrary content. function setConfig(uint16 _version, uint16 _chainId, uint _configType, bytes calldata _config) external; // @notice set the send() LayerZero messaging library version to _version // @param _version - new messaging library version function setSendVersion(uint16 _version) external; // @notice set the lzReceive() LayerZero messaging library version to _version // @param _version - new messaging library version function setReceiveVersion(uint16 _version) external; // @notice Only when the UA needs to resume the message flow in blocking mode and clear the stored payload // @param _srcChainId - the chainId of the source chain // @param _srcAddress - the contract address of the source contract at the source chain function forceResumeReceive(uint16 _srcChainId, bytes calldata _srcAddress) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./LzApp.sol"; import "../util/ExcessivelySafeCall.sol"; /* * the default LayerZero messaging behaviour is blocking, i.e. any failed message will block the channel * this abstract class try-catch all fail messages and store locally for future retry. hence, non-blocking * NOTE: if the srcAddress is not configured properly, it will still block the message pathway from (srcChainId, srcAddress) */ abstract contract NonblockingLzApp is LzApp { using ExcessivelySafeCall for address; constructor() {} mapping(uint16 => mapping(bytes => mapping(uint64 => bytes32))) public failedMessages; event MessageFailed(uint16 _srcChainId, bytes _srcAddress, uint64 _nonce, bytes _payload, bytes _reason); event RetryMessageSuccess(uint16 _srcChainId, bytes _srcAddress, uint64 _nonce, bytes32 _payloadHash); // overriding the virtual function in LzReceiver function _blockingLzReceive(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload) internal virtual override { (bool success, bytes memory reason) = address(this).excessivelySafeCall(gasleft(), 150, abi.encodeWithSelector(this.nonblockingLzReceive.selector, _srcChainId, _srcAddress, _nonce, _payload)); // try-catch all errors/exceptions if (!success) { _storeFailedMessage(_srcChainId, _srcAddress, _nonce, _payload, reason); } } function _storeFailedMessage(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload, bytes memory _reason) internal virtual { failedMessages[_srcChainId][_srcAddress][_nonce] = keccak256(_payload); emit MessageFailed(_srcChainId, _srcAddress, _nonce, _payload, _reason); } function nonblockingLzReceive(uint16 _srcChainId, bytes calldata _srcAddress, uint64 _nonce, bytes calldata _payload) public virtual { // only internal transaction require(_msgSender() == address(this), "NonblockingLzApp: caller must be LzApp"); _nonblockingLzReceive(_srcChainId, _srcAddress, _nonce, _payload); } //@notice override this function function _nonblockingLzReceive(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload) internal virtual; function retryMessage(uint16 _srcChainId, bytes calldata _srcAddress, uint64 _nonce, bytes calldata _payload) public payable virtual { // assert there is message to retry bytes32 payloadHash = failedMessages[_srcChainId][_srcAddress][_nonce]; require(payloadHash != bytes32(0), "NonblockingLzApp: no stored message"); require(keccak256(_payload) == payloadHash, "NonblockingLzApp: invalid payload"); // clear the stored message failedMessages[_srcChainId][_srcAddress][_nonce] = bytes32(0); // execute the message. revert if it fails again _nonblockingLzReceive(_srcChainId, _srcAddress, _nonce, _payload); emit RetryMessageSuccess(_srcChainId, _srcAddress, _nonce, payloadHash); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.20; import {IERC165} from "./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); * } * ``` */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; import {OperatorFilterer} from "./OperatorFilterer.sol"; import {CANONICAL_CORI_SUBSCRIPTION} from "./lib/Constants.sol"; /** * @title DefaultOperatorFilterer * @notice Inherits from OperatorFilterer and automatically subscribes to the default OpenSea subscription. * @dev Please note that if your token contract does not provide an owner with EIP-173, it must provide * administration methods on the contract itself to interact with the registry otherwise the subscription * will be locked to the options set during construction. */ abstract contract DefaultOperatorFilterer is OperatorFilterer { /// @dev The constructor that is called when the contract is being deployed. constructor() OperatorFilterer(CANONICAL_CORI_SUBSCRIPTION, true) {} }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; /// @notice Simple ERC1155 implementation. /// @author Solady (https://github.com/vectorized/solady/blob/main/src/tokens/ERC1155.sol) /// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC1155.sol) /// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/tree/master/contracts/token/ERC1155/ERC1155.sol) /// /// @dev Note: /// The ERC1155 standard allows for self-approvals. /// For performance, this implementation WILL NOT revert for such actions. /// Please add any checks with overrides if desired. abstract contract ERC1155 { /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* CUSTOM ERRORS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The lengths of the input arrays are not the same. error ArrayLengthsMismatch(); /// @dev Cannot mint or transfer to the zero address. error TransferToZeroAddress(); /// @dev The recipient's balance has overflowed. error AccountBalanceOverflow(); /// @dev Insufficient balance. error InsufficientBalance(); /// @dev Only the token owner or an approved account can manage the tokens. error NotOwnerNorApproved(); /// @dev Cannot safely transfer to a contract that does not implement /// the ERC1155Receiver interface. error TransferToNonERC1155ReceiverImplementer(); /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* EVENTS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Emitted when `amount` of token `id` is transferred /// from `from` to `to` by `operator`. event TransferSingle( address indexed operator, address indexed from, address indexed to, uint256 id, uint256 amount ); /// @dev Emitted when `amounts` of token `ids` are transferred /// from `from` to `to` by `operator`. event TransferBatch( address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] amounts ); /// @dev Emitted when `owner` enables or disables `operator` to manage all of their tokens. event ApprovalForAll(address indexed owner, address indexed operator, bool isApproved); /// @dev Emitted when the Uniform Resource Identifier (URI) for token `id` /// is updated to `value`. This event is not used in the base contract. /// You may need to emit this event depending on your URI logic. /// /// See: https://eips.ethereum.org/EIPS/eip-1155#metadata event URI(string value, uint256 indexed id); /// @dev `keccak256(bytes("TransferSingle(address,address,address,uint256,uint256)"))`. uint256 private constant _TRANSFER_SINGLE_EVENT_SIGNATURE = 0xc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62; /// @dev `keccak256(bytes("TransferBatch(address,address,address,uint256[],uint256[])"))`. uint256 private constant _TRANSFER_BATCH_EVENT_SIGNATURE = 0x4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb; /// @dev `keccak256(bytes("ApprovalForAll(address,address,bool)"))`. uint256 private constant _APPROVAL_FOR_ALL_EVENT_SIGNATURE = 0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* STORAGE */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The `ownerSlotSeed` of a given owner is given by. /// ``` /// let ownerSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, shl(96, owner)) /// ``` /// /// The balance slot of `owner` is given by. /// ``` /// mstore(0x20, ownerSlotSeed) /// mstore(0x00, id) /// let balanceSlot := keccak256(0x00, 0x40) /// ``` /// /// The operator approval slot of `owner` is given by. /// ``` /// mstore(0x20, ownerSlotSeed) /// mstore(0x00, operator) /// let operatorApprovalSlot := keccak256(0x0c, 0x34) /// ``` uint256 private constant _ERC1155_MASTER_SLOT_SEED = 0x9a31110384e0b0c9; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* ERC1155 METADATA */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Returns the URI for token `id`. /// /// You can either return the same templated URI for all token IDs, /// (e.g. "https://example.com/api/{id}.json"), /// or return a unique URI for each `id`. /// /// See: https://eips.ethereum.org/EIPS/eip-1155#metadata function uri(uint256 id) public view virtual returns (string memory); /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* ERC1155 */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Returns the amount of `id` owned by `owner`. function balanceOf(address owner, uint256 id) public view virtual returns (uint256 result) { /// @solidity memory-safe-assembly assembly { mstore(0x20, _ERC1155_MASTER_SLOT_SEED) mstore(0x14, owner) mstore(0x00, id) result := sload(keccak256(0x00, 0x40)) } } /// @dev Returns whether `operator` is approved to manage the tokens of `owner`. function isApprovedForAll(address owner, address operator) public view virtual returns (bool result) { /// @solidity memory-safe-assembly assembly { mstore(0x20, _ERC1155_MASTER_SLOT_SEED) mstore(0x14, owner) mstore(0x00, operator) result := sload(keccak256(0x0c, 0x34)) } } /// @dev Sets whether `operator` is approved to manage the tokens of the caller. /// /// Emits a {ApprovalForAll} event. function setApprovalForAll(address operator, bool isApproved) public virtual { /// @solidity memory-safe-assembly assembly { // Convert to 0 or 1. isApproved := iszero(iszero(isApproved)) // Update the `isApproved` for (`msg.sender`, `operator`). mstore(0x20, _ERC1155_MASTER_SLOT_SEED) mstore(0x14, caller()) mstore(0x00, operator) sstore(keccak256(0x0c, 0x34), isApproved) // Emit the {ApprovalForAll} event. mstore(0x00, isApproved) // forgefmt: disable-next-line log3(0x00, 0x20, _APPROVAL_FOR_ALL_EVENT_SIGNATURE, caller(), shr(96, shl(96, operator))) } } /// @dev Transfers `amount` of `id` from `from` to `to`. /// /// Requirements: /// - `to` cannot be the zero address. /// - `from` must have at least `amount` of `id`. /// - If the caller is not `from`, /// it must be approved to manage the tokens of `from`. /// - If `to` refers to a smart contract, it must implement /// {ERC1155-onERC1155Reveived}, which is called upon a batch transfer. /// /// Emits a {Transfer} event. function safeTransferFrom( address from, address to, uint256 id, uint256 amount, bytes calldata data ) public virtual { if (_useBeforeTokenTransfer()) { _beforeTokenTransfer(from, to, _single(id), _single(amount), data); } /// @solidity memory-safe-assembly assembly { let fromSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, shl(96, from)) let toSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, shl(96, to)) mstore(0x20, fromSlotSeed) // Clear the upper 96 bits. from := shr(96, fromSlotSeed) to := shr(96, toSlotSeed) // Revert if `to` is the zero address. if iszero(to) { mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`. revert(0x1c, 0x04) } // If the caller is not `from`, do the authorization check. if iszero(eq(caller(), from)) { mstore(0x00, caller()) if iszero(sload(keccak256(0x0c, 0x34))) { mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`. revert(0x1c, 0x04) } } // Subtract and store the updated balance of `from`. { mstore(0x00, id) let fromBalanceSlot := keccak256(0x00, 0x40) let fromBalance := sload(fromBalanceSlot) if gt(amount, fromBalance) { mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`. revert(0x1c, 0x04) } sstore(fromBalanceSlot, sub(fromBalance, amount)) } // Increase and store the updated balance of `to`. { mstore(0x20, toSlotSeed) let toBalanceSlot := keccak256(0x00, 0x40) let toBalanceBefore := sload(toBalanceSlot) let toBalanceAfter := add(toBalanceBefore, amount) if lt(toBalanceAfter, toBalanceBefore) { mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`. revert(0x1c, 0x04) } sstore(toBalanceSlot, toBalanceAfter) } // Emit a {TransferSingle} event. mstore(0x20, amount) log4(0x00, 0x40, _TRANSFER_SINGLE_EVENT_SIGNATURE, caller(), from, to) } if (_useAfterTokenTransfer()) { _afterTokenTransfer(from, to, _single(id), _single(amount), data); } /// @solidity memory-safe-assembly assembly { // Do the {onERC1155Received} check if `to` is a smart contract. if extcodesize(to) { // Prepare the calldata. let m := mload(0x40) // `onERC1155Received(address,address,uint256,uint256,bytes)`. mstore(m, 0xf23a6e61) mstore(add(m, 0x20), caller()) mstore(add(m, 0x40), from) mstore(add(m, 0x60), id) mstore(add(m, 0x80), amount) mstore(add(m, 0xa0), 0xa0) calldatacopy(add(m, 0xc0), sub(data.offset, 0x20), add(0x20, data.length)) // Revert if the call reverts. if iszero(call(gas(), to, 0, add(m, 0x1c), add(0xc4, data.length), m, 0x20)) { if returndatasize() { // Bubble up the revert if the call reverts. returndatacopy(0x00, 0x00, returndatasize()) revert(0x00, returndatasize()) } mstore(m, 0) } // Load the returndata and compare it with the function selector. if iszero(eq(mload(m), shl(224, 0xf23a6e61))) { mstore(0x00, 0x9c05499b) // `TransferToNonERC1155ReceiverImplementer()`. revert(0x1c, 0x04) } } } } /// @dev Transfers `amounts` of `ids` from `from` to `to`. /// /// Requirements: /// - `to` cannot be the zero address. /// - `from` must have at least `amount` of `id`. /// - `ids` and `amounts` must have the same length. /// - If the caller is not `from`, /// it must be approved to manage the tokens of `from`. /// - If `to` refers to a smart contract, it must implement /// {ERC1155-onERC1155BatchReveived}, which is called upon a batch transfer. /// /// Emits a {TransferBatch} event. function safeBatchTransferFrom( address from, address to, uint256[] calldata ids, uint256[] calldata amounts, bytes calldata data ) public virtual { if (_useBeforeTokenTransfer()) { _beforeTokenTransfer(from, to, ids, amounts, data); } /// @solidity memory-safe-assembly assembly { if iszero(eq(ids.length, amounts.length)) { mstore(0x00, 0x3b800a46) // `ArrayLengthsMismatch()`. revert(0x1c, 0x04) } let fromSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, shl(96, from)) let toSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, shl(96, to)) mstore(0x20, fromSlotSeed) // Clear the upper 96 bits. from := shr(96, fromSlotSeed) to := shr(96, toSlotSeed) // Revert if `to` is the zero address. if iszero(to) { mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`. revert(0x1c, 0x04) } // If the caller is not `from`, do the authorization check. if iszero(eq(caller(), from)) { mstore(0x00, caller()) if iszero(sload(keccak256(0x0c, 0x34))) { mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`. revert(0x1c, 0x04) } } // Loop through all the `ids` and update the balances. { let end := shl(5, ids.length) for { let i := 0 } iszero(eq(i, end)) { i := add(i, 0x20) } { let amount := calldataload(add(amounts.offset, i)) // Subtract and store the updated balance of `from`. { mstore(0x20, fromSlotSeed) mstore(0x00, calldataload(add(ids.offset, i))) let fromBalanceSlot := keccak256(0x00, 0x40) let fromBalance := sload(fromBalanceSlot) if gt(amount, fromBalance) { mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`. revert(0x1c, 0x04) } sstore(fromBalanceSlot, sub(fromBalance, amount)) } // Increase and store the updated balance of `to`. { mstore(0x20, toSlotSeed) let toBalanceSlot := keccak256(0x00, 0x40) let toBalanceBefore := sload(toBalanceSlot) let toBalanceAfter := add(toBalanceBefore, amount) if lt(toBalanceAfter, toBalanceBefore) { mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`. revert(0x1c, 0x04) } sstore(toBalanceSlot, toBalanceAfter) } } } // Emit a {TransferBatch} event. { let m := mload(0x40) // Copy the `ids`. mstore(m, 0x40) let n := add(0x20, shl(5, ids.length)) let o := add(m, 0x40) calldatacopy(o, sub(ids.offset, 0x20), n) // Copy the `amounts`. mstore(add(m, 0x20), add(0x40, n)) o := add(o, n) n := add(0x20, shl(5, amounts.length)) calldatacopy(o, sub(amounts.offset, 0x20), n) n := sub(add(o, n), m) // Do the emit. log4(m, n, _TRANSFER_BATCH_EVENT_SIGNATURE, caller(), from, to) } } if (_useAfterTokenTransfer()) { _afterTokenTransferCalldata(from, to, ids, amounts, data); } /// @solidity memory-safe-assembly assembly { // Do the {onERC1155BatchReceived} check if `to` is a smart contract. if extcodesize(to) { mstore(0x00, to) // Cache `to` to prevent stack too deep. let m := mload(0x40) // Prepare the calldata. // `onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)`. mstore(m, 0xbc197c81) mstore(add(m, 0x20), caller()) mstore(add(m, 0x40), from) // Copy the `ids`. mstore(add(m, 0x60), 0xa0) let n := add(0x20, shl(5, ids.length)) let o := add(m, 0xc0) calldatacopy(o, sub(ids.offset, 0x20), n) // Copy the `amounts`. let s := add(0xa0, n) mstore(add(m, 0x80), s) o := add(o, n) n := add(0x20, shl(5, amounts.length)) calldatacopy(o, sub(amounts.offset, 0x20), n) // Copy the `data`. mstore(add(m, 0xa0), add(s, n)) o := add(o, n) n := add(0x20, data.length) calldatacopy(o, sub(data.offset, 0x20), n) n := sub(add(o, n), add(m, 0x1c)) // Revert if the call reverts. if iszero(call(gas(), mload(0x00), 0, add(m, 0x1c), n, m, 0x20)) { if returndatasize() { // Bubble up the revert if the call reverts. returndatacopy(0x00, 0x00, returndatasize()) revert(0x00, returndatasize()) } mstore(m, 0) } // Load the returndata and compare it with the function selector. if iszero(eq(mload(m), shl(224, 0xbc197c81))) { mstore(0x00, 0x9c05499b) // `TransferToNonERC1155ReceiverImplementer()`. revert(0x1c, 0x04) } } } } /// @dev Returns the amounts of `ids` for `owners. /// /// Requirements: /// - `owners` and `ids` must have the same length. function balanceOfBatch(address[] calldata owners, uint256[] calldata ids) public view virtual returns (uint256[] memory balances) { /// @solidity memory-safe-assembly assembly { if iszero(eq(ids.length, owners.length)) { mstore(0x00, 0x3b800a46) // `ArrayLengthsMismatch()`. revert(0x1c, 0x04) } balances := mload(0x40) mstore(balances, ids.length) let o := add(balances, 0x20) let end := shl(5, ids.length) mstore(0x40, add(end, o)) // Loop through all the `ids` and load the balances. for { let i := 0 } iszero(eq(i, end)) { i := add(i, 0x20) } { let owner := calldataload(add(owners.offset, i)) mstore(0x20, or(_ERC1155_MASTER_SLOT_SEED, shl(96, owner))) mstore(0x00, calldataload(add(ids.offset, i))) mstore(add(o, i), sload(keccak256(0x00, 0x40))) } } } /// @dev Returns true if this contract implements the interface defined by `interfaceId`. /// See: https://eips.ethereum.org/EIPS/eip-165 /// This function call must use less than 30000 gas. function supportsInterface(bytes4 interfaceId) public view virtual returns (bool result) { /// @solidity memory-safe-assembly assembly { let s := shr(224, interfaceId) // ERC165: 0x01ffc9a7, ERC1155: 0xd9b67a26, ERC1155MetadataURI: 0x0e89341c. result := or(or(eq(s, 0x01ffc9a7), eq(s, 0xd9b67a26)), eq(s, 0x0e89341c)) } } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* INTERNAL MINT FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Mints `amount` of `id` to `to`. /// /// Requirements: /// - `to` cannot be the zero address. /// - If `to` refers to a smart contract, it must implement /// {ERC1155-onERC1155Reveived}, which is called upon a batch transfer. /// /// Emits a {Transfer} event. function _mint(address to, uint256 id, uint256 amount, bytes memory data) internal virtual { if (_useBeforeTokenTransfer()) { _beforeTokenTransfer(address(0), to, _single(id), _single(amount), data); } /// @solidity memory-safe-assembly assembly { let to_ := shl(96, to) // Revert if `to` is the zero address. if iszero(to_) { mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`. revert(0x1c, 0x04) } // Increase and store the updated balance of `to`. { mstore(0x20, _ERC1155_MASTER_SLOT_SEED) mstore(0x14, to) mstore(0x00, id) let toBalanceSlot := keccak256(0x00, 0x40) let toBalanceBefore := sload(toBalanceSlot) let toBalanceAfter := add(toBalanceBefore, amount) if lt(toBalanceAfter, toBalanceBefore) { mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`. revert(0x1c, 0x04) } sstore(toBalanceSlot, toBalanceAfter) } // Emit a {TransferSingle} event. mstore(0x00, id) mstore(0x20, amount) log4(0x00, 0x40, _TRANSFER_SINGLE_EVENT_SIGNATURE, caller(), 0, shr(96, to_)) } if (_useAfterTokenTransfer()) { _afterTokenTransfer(address(0), to, _single(id), _single(amount), data); } if (_hasCode(to)) _checkOnERC1155Received(address(0), to, id, amount, data); } /// @dev Mints `amounts` of `ids` to `to`. /// /// Requirements: /// - `to` cannot be the zero address. /// - `ids` and `amounts` must have the same length. /// - If `to` refers to a smart contract, it must implement /// {ERC1155-onERC1155BatchReveived}, which is called upon a batch transfer. /// /// Emits a {TransferBatch} event. function _batchMint( address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual { if (_useBeforeTokenTransfer()) { _beforeTokenTransfer(address(0), to, ids, amounts, data); } /// @solidity memory-safe-assembly assembly { if iszero(eq(mload(ids), mload(amounts))) { mstore(0x00, 0x3b800a46) // `ArrayLengthsMismatch()`. revert(0x1c, 0x04) } let to_ := shl(96, to) // Revert if `to` is the zero address. if iszero(to_) { mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`. revert(0x1c, 0x04) } // Loop through all the `ids` and update the balances. { mstore(0x20, or(_ERC1155_MASTER_SLOT_SEED, to_)) let end := shl(5, mload(ids)) for { let i := 0 } iszero(eq(i, end)) {} { i := add(i, 0x20) let amount := mload(add(amounts, i)) // Increase and store the updated balance of `to`. { mstore(0x00, mload(add(ids, i))) let toBalanceSlot := keccak256(0x00, 0x40) let toBalanceBefore := sload(toBalanceSlot) let toBalanceAfter := add(toBalanceBefore, amount) if lt(toBalanceAfter, toBalanceBefore) { mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`. revert(0x1c, 0x04) } sstore(toBalanceSlot, toBalanceAfter) } } } // Emit a {TransferBatch} event. { let m := mload(0x40) // Copy the `ids`. mstore(m, 0x40) let n := add(0x20, shl(5, mload(ids))) let o := add(m, 0x40) pop(staticcall(gas(), 4, ids, n, o, n)) // Copy the `amounts`. mstore(add(m, 0x20), add(0x40, returndatasize())) o := add(o, returndatasize()) n := add(0x20, shl(5, mload(amounts))) pop(staticcall(gas(), 4, amounts, n, o, n)) n := sub(add(o, returndatasize()), m) // Do the emit. log4(m, n, _TRANSFER_BATCH_EVENT_SIGNATURE, caller(), 0, shr(96, to_)) } } if (_useAfterTokenTransfer()) { _afterTokenTransfer(address(0), to, ids, amounts, data); } if (_hasCode(to)) _checkOnERC1155BatchReceived(address(0), to, ids, amounts, data); } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* INTERNAL BURN FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Equivalent to `_burn(address(0), from, id, amount)`. function _burn(address from, uint256 id, uint256 amount) internal virtual { _burn(address(0), from, id, amount); } /// @dev Destroys `amount` of `id` from `from`. /// /// Requirements: /// - `from` must have at least `amount` of `id`. /// - If `by` is not the zero address, it must be either `from`, /// or approved to manage the tokens of `from`. /// /// Emits a {Transfer} event. function _burn(address by, address from, uint256 id, uint256 amount) internal virtual { if (_useBeforeTokenTransfer()) { _beforeTokenTransfer(from, address(0), _single(id), _single(amount), ""); } /// @solidity memory-safe-assembly assembly { let from_ := shl(96, from) mstore(0x20, or(_ERC1155_MASTER_SLOT_SEED, from_)) // If `by` is not the zero address, and not equal to `from`, // check if it is approved to manage all the tokens of `from`. if iszero(or(iszero(shl(96, by)), eq(shl(96, by), from_))) { mstore(0x00, by) if iszero(sload(keccak256(0x0c, 0x34))) { mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`. revert(0x1c, 0x04) } } // Decrease and store the updated balance of `from`. { mstore(0x00, id) let fromBalanceSlot := keccak256(0x00, 0x40) let fromBalance := sload(fromBalanceSlot) if gt(amount, fromBalance) { mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`. revert(0x1c, 0x04) } sstore(fromBalanceSlot, sub(fromBalance, amount)) } // Emit a {TransferSingle} event. mstore(0x00, id) mstore(0x20, amount) log4(0x00, 0x40, _TRANSFER_SINGLE_EVENT_SIGNATURE, caller(), shr(96, from_), 0) } if (_useAfterTokenTransfer()) { _afterTokenTransfer(from, address(0), _single(id), _single(amount), ""); } } /// @dev Equivalent to `_batchBurn(address(0), from, ids, amounts)`. function _batchBurn(address from, uint256[] memory ids, uint256[] memory amounts) internal virtual { _batchBurn(address(0), from, ids, amounts); } /// @dev Destroys `amounts` of `ids` from `from`. /// /// Requirements: /// - `ids` and `amounts` must have the same length. /// - `from` must have at least `amounts` of `ids`. /// - If `by` is not the zero address, it must be either `from`, /// or approved to manage the tokens of `from`. /// /// Emits a {TransferBatch} event. function _batchBurn(address by, address from, uint256[] memory ids, uint256[] memory amounts) internal virtual { if (_useBeforeTokenTransfer()) { _beforeTokenTransfer(from, address(0), ids, amounts, ""); } /// @solidity memory-safe-assembly assembly { if iszero(eq(mload(ids), mload(amounts))) { mstore(0x00, 0x3b800a46) // `ArrayLengthsMismatch()`. revert(0x1c, 0x04) } let from_ := shl(96, from) mstore(0x20, or(_ERC1155_MASTER_SLOT_SEED, from_)) // If `by` is not the zero address, and not equal to `from`, // check if it is approved to manage all the tokens of `from`. let by_ := shl(96, by) if iszero(or(iszero(by_), eq(by_, from_))) { mstore(0x00, by) if iszero(sload(keccak256(0x0c, 0x34))) { mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`. revert(0x1c, 0x04) } } // Loop through all the `ids` and update the balances. { let end := shl(5, mload(ids)) for { let i := 0 } iszero(eq(i, end)) {} { i := add(i, 0x20) let amount := mload(add(amounts, i)) // Decrease and store the updated balance of `to`. { mstore(0x00, mload(add(ids, i))) let fromBalanceSlot := keccak256(0x00, 0x40) let fromBalance := sload(fromBalanceSlot) if gt(amount, fromBalance) { mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`. revert(0x1c, 0x04) } sstore(fromBalanceSlot, sub(fromBalance, amount)) } } } // Emit a {TransferBatch} event. { let m := mload(0x40) // Copy the `ids`. mstore(m, 0x40) let n := add(0x20, shl(5, mload(ids))) let o := add(m, 0x40) pop(staticcall(gas(), 4, ids, n, o, n)) // Copy the `amounts`. mstore(add(m, 0x20), add(0x40, returndatasize())) o := add(o, returndatasize()) n := add(0x20, shl(5, mload(amounts))) pop(staticcall(gas(), 4, amounts, n, o, n)) n := sub(add(o, returndatasize()), m) // Do the emit. log4(m, n, _TRANSFER_BATCH_EVENT_SIGNATURE, caller(), shr(96, from_), 0) } } if (_useAfterTokenTransfer()) { _afterTokenTransfer(from, address(0), ids, amounts, ""); } } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* INTERNAL APPROVAL FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Approve or remove the `operator` as an operator for `by`, /// without authorization checks. /// /// Emits a {ApprovalForAll} event. function _setApprovalForAll(address by, address operator, bool isApproved) internal virtual { /// @solidity memory-safe-assembly assembly { // Convert to 0 or 1. isApproved := iszero(iszero(isApproved)) // Update the `isApproved` for (`by`, `operator`). mstore(0x20, _ERC1155_MASTER_SLOT_SEED) mstore(0x14, by) mstore(0x00, operator) sstore(keccak256(0x0c, 0x34), isApproved) // Emit the {ApprovalForAll} event. mstore(0x00, isApproved) let m := shr(96, not(0)) log3(0x00, 0x20, _APPROVAL_FOR_ALL_EVENT_SIGNATURE, and(m, by), and(m, operator)) } } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* INTERNAL TRANSFER FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Equivalent to `_safeTransfer(address(0), from, to, id, amount, data)`. function _safeTransfer(address from, address to, uint256 id, uint256 amount, bytes memory data) internal virtual { _safeTransfer(address(0), from, to, id, amount, data); } /// @dev Transfers `amount` of `id` from `from` to `to`. /// /// Requirements: /// - `to` cannot be the zero address. /// - `from` must have at least `amount` of `id`. /// - If `by` is not the zero address, it must be either `from`, /// or approved to manage the tokens of `from`. /// - If `to` refers to a smart contract, it must implement /// {ERC1155-onERC1155Reveived}, which is called upon a batch transfer. /// /// Emits a {Transfer} event. function _safeTransfer( address by, address from, address to, uint256 id, uint256 amount, bytes memory data ) internal virtual { if (_useBeforeTokenTransfer()) { _beforeTokenTransfer(from, to, _single(id), _single(amount), data); } /// @solidity memory-safe-assembly assembly { let from_ := shl(96, from) let to_ := shl(96, to) // Revert if `to` is the zero address. if iszero(to_) { mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`. revert(0x1c, 0x04) } mstore(0x20, or(_ERC1155_MASTER_SLOT_SEED, from_)) // If `by` is not the zero address, and not equal to `from`, // check if it is approved to manage all the tokens of `from`. let by_ := shl(96, by) if iszero(or(iszero(by_), eq(by_, from_))) { mstore(0x00, by) if iszero(sload(keccak256(0x0c, 0x34))) { mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`. revert(0x1c, 0x04) } } // Subtract and store the updated balance of `from`. { mstore(0x00, id) let fromBalanceSlot := keccak256(0x00, 0x40) let fromBalance := sload(fromBalanceSlot) if gt(amount, fromBalance) { mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`. revert(0x1c, 0x04) } sstore(fromBalanceSlot, sub(fromBalance, amount)) } // Increase and store the updated balance of `to`. { mstore(0x20, or(_ERC1155_MASTER_SLOT_SEED, to_)) let toBalanceSlot := keccak256(0x00, 0x40) let toBalanceBefore := sload(toBalanceSlot) let toBalanceAfter := add(toBalanceBefore, amount) if lt(toBalanceAfter, toBalanceBefore) { mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`. revert(0x1c, 0x04) } sstore(toBalanceSlot, toBalanceAfter) } // Emit a {TransferSingle} event. mstore(0x20, amount) // forgefmt: disable-next-line log4(0x00, 0x40, _TRANSFER_SINGLE_EVENT_SIGNATURE, caller(), shr(96, from_), shr(96, to_)) } if (_useAfterTokenTransfer()) { _afterTokenTransfer(from, to, _single(id), _single(amount), data); } if (_hasCode(to)) _checkOnERC1155Received(from, to, id, amount, data); } /// @dev Equivalent to `_safeBatchTransfer(address(0), from, to, ids, amounts, data)`. function _safeBatchTransfer( address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual { _safeBatchTransfer(address(0), from, to, ids, amounts, data); } /// @dev Transfers `amounts` of `ids` from `from` to `to`. /// /// Requirements: /// - `to` cannot be the zero address. /// - `ids` and `amounts` must have the same length. /// - `from` must have at least `amounts` of `ids`. /// - If `by` is not the zero address, it must be either `from`, /// or approved to manage the tokens of `from`. /// - If `to` refers to a smart contract, it must implement /// {ERC1155-onERC1155BatchReveived}, which is called upon a batch transfer. /// /// Emits a {TransferBatch} event. function _safeBatchTransfer( address by, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual { if (_useBeforeTokenTransfer()) { _beforeTokenTransfer(from, to, ids, amounts, data); } /// @solidity memory-safe-assembly assembly { if iszero(eq(mload(ids), mload(amounts))) { mstore(0x00, 0x3b800a46) // `ArrayLengthsMismatch()`. revert(0x1c, 0x04) } let from_ := shl(96, from) let to_ := shl(96, to) // Revert if `to` is the zero address. if iszero(to_) { mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`. revert(0x1c, 0x04) } let fromSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, from_) let toSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, to_) mstore(0x20, fromSlotSeed) // If `by` is not the zero address, and not equal to `from`, // check if it is approved to manage all the tokens of `from`. let by_ := shl(96, by) if iszero(or(iszero(by_), eq(by_, from_))) { mstore(0x00, by) if iszero(sload(keccak256(0x0c, 0x34))) { mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`. revert(0x1c, 0x04) } } // Loop through all the `ids` and update the balances. { let end := shl(5, mload(ids)) for { let i := 0 } iszero(eq(i, end)) {} { i := add(i, 0x20) let amount := mload(add(amounts, i)) // Subtract and store the updated balance of `from`. { mstore(0x20, fromSlotSeed) mstore(0x00, mload(add(ids, i))) let fromBalanceSlot := keccak256(0x00, 0x40) let fromBalance := sload(fromBalanceSlot) if gt(amount, fromBalance) { mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`. revert(0x1c, 0x04) } sstore(fromBalanceSlot, sub(fromBalance, amount)) } // Increase and store the updated balance of `to`. { mstore(0x20, toSlotSeed) let toBalanceSlot := keccak256(0x00, 0x40) let toBalanceBefore := sload(toBalanceSlot) let toBalanceAfter := add(toBalanceBefore, amount) if lt(toBalanceAfter, toBalanceBefore) { mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`. revert(0x1c, 0x04) } sstore(toBalanceSlot, toBalanceAfter) } } } // Emit a {TransferBatch} event. { let m := mload(0x40) // Copy the `ids`. mstore(m, 0x40) let n := add(0x20, shl(5, mload(ids))) let o := add(m, 0x40) pop(staticcall(gas(), 4, ids, n, o, n)) // Copy the `amounts`. mstore(add(m, 0x20), add(0x40, returndatasize())) o := add(o, returndatasize()) n := add(0x20, shl(5, mload(amounts))) pop(staticcall(gas(), 4, amounts, n, o, n)) n := sub(add(o, returndatasize()), m) // Do the emit. log4(m, n, _TRANSFER_BATCH_EVENT_SIGNATURE, caller(), shr(96, from_), shr(96, to_)) } } if (_useAfterTokenTransfer()) { _afterTokenTransfer(from, to, ids, amounts, data); } if (_hasCode(to)) _checkOnERC1155BatchReceived(from, to, ids, amounts, data); } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* HOOKS FOR OVERRIDING */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Override this function to return true if `_beforeTokenTransfer` is used. /// The is to help the compiler avoid producing dead bytecode. function _useBeforeTokenTransfer() internal view virtual returns (bool) { return false; } /// @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 are 1. function _beforeTokenTransfer( address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual {} /// @dev Override this function to return true if `_afterTokenTransfer` is used. /// The is to help the compiler avoid producing dead bytecode. function _useAfterTokenTransfer() internal view virtual returns (bool) { return false; } /// @dev Hook that is called after any token transfer. /// This includes minting and burning, as well as batched variants. /// /// The same hook is called on both single and batched variants. /// For single transfers, the length of the `id` and `amount` arrays are 1. function _afterTokenTransfer( address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual {} /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* PRIVATE HELPERS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Helper for calling the `_afterTokenTransfer` hook. /// The is to help the compiler avoid producing dead bytecode. function _afterTokenTransferCalldata( address from, address to, uint256[] calldata ids, uint256[] calldata amounts, bytes calldata data ) private { if (_useAfterTokenTransfer()) { _afterTokenTransfer(from, to, ids, amounts, data); } } /// @dev Returns if `a` has bytecode of non-zero length. function _hasCode(address a) private view returns (bool result) { /// @solidity memory-safe-assembly assembly { result := extcodesize(a) // Can handle dirty upper bits. } } /// @dev Perform a call to invoke {IERC1155Receiver-onERC1155Received} on `to`. /// Reverts if the target does not support the function correctly. function _checkOnERC1155Received( address from, address to, uint256 id, uint256 amount, bytes memory data ) private { /// @solidity memory-safe-assembly assembly { // Prepare the calldata. let m := mload(0x40) // `onERC1155Received(address,address,uint256,uint256,bytes)`. mstore(m, 0xf23a6e61) mstore(add(m, 0x20), caller()) mstore(add(m, 0x40), shr(96, shl(96, from))) mstore(add(m, 0x60), id) mstore(add(m, 0x80), amount) mstore(add(m, 0xa0), 0xa0) let n := mload(data) mstore(add(m, 0xc0), n) if n { pop(staticcall(gas(), 4, add(data, 0x20), n, add(m, 0xe0), n)) } // Revert if the call reverts. if iszero(call(gas(), to, 0, add(m, 0x1c), add(0xc4, n), m, 0x20)) { if returndatasize() { // Bubble up the revert if the call reverts. returndatacopy(0x00, 0x00, returndatasize()) revert(0x00, returndatasize()) } mstore(m, 0) } // Load the returndata and compare it with the function selector. if iszero(eq(mload(m), shl(224, 0xf23a6e61))) { mstore(0x00, 0x9c05499b) // `TransferToNonERC1155ReceiverImplementer()`. revert(0x1c, 0x04) } } } /// @dev Perform a call to invoke {IERC1155Receiver-onERC1155BatchReceived} on `to`. /// Reverts if the target does not support the function correctly. function _checkOnERC1155BatchReceived( address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) private { /// @solidity memory-safe-assembly assembly { // Prepare the calldata. let m := mload(0x40) // `onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)`. mstore(m, 0xbc197c81) mstore(add(m, 0x20), caller()) mstore(add(m, 0x40), shr(96, shl(96, from))) // Copy the `ids`. mstore(add(m, 0x60), 0xa0) let n := add(0x20, shl(5, mload(ids))) let o := add(m, 0xc0) pop(staticcall(gas(), 4, ids, n, o, n)) // Copy the `amounts`. let s := add(0xa0, returndatasize()) mstore(add(m, 0x80), s) o := add(o, returndatasize()) n := add(0x20, shl(5, mload(amounts))) pop(staticcall(gas(), 4, amounts, n, o, n)) // Copy the `data`. mstore(add(m, 0xa0), add(s, returndatasize())) o := add(o, returndatasize()) n := add(0x20, mload(data)) pop(staticcall(gas(), 4, data, n, o, n)) n := sub(add(o, returndatasize()), add(m, 0x1c)) // Revert if the call reverts. if iszero(call(gas(), to, 0, add(m, 0x1c), n, m, 0x20)) { if returndatasize() { // Bubble up the revert if the call reverts. returndatacopy(0x00, 0x00, returndatasize()) revert(0x00, returndatasize()) } mstore(m, 0) } // Load the returndata and compare it with the function selector. if iszero(eq(mload(m), shl(224, 0xbc197c81))) { mstore(0x00, 0x9c05499b) // `TransferToNonERC1155ReceiverImplementer()`. revert(0x1c, 0x04) } } } /// @dev Returns `x` in an array with a single element. function _single(uint256 x) private pure returns (uint256[] memory result) { assembly { result := mload(0x40) mstore(0x40, add(result, 0x40)) mstore(result, 1) mstore(add(result, 0x20), x) } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; import { ISeaDropToken } from "./ISeaDropToken.sol"; import { PublicDrop } from "../lib/ERC1155SeaDropStructs.sol"; /** * @dev A helper interface to get and set parameters for ERC1155SeaDrop. * The token does not expose these methods as part of its external * interface to optimize contract size, but does implement them. */ interface IERC1155SeaDrop is ISeaDropToken { /** * @notice Update the SeaDrop public drop parameters at a given index. * * @param publicDrop The new public drop parameters. * @param index The public drop index. */ function updatePublicDrop( PublicDrop calldata publicDrop, uint256 index ) external; /** * @notice Returns the public drop stage parameters at a given index. * * @param index The index of the public drop stage. */ function getPublicDrop( uint256 index ) external view returns (PublicDrop memory); /** * @notice Returns the public drop indexes. */ function getPublicDropIndexes() external view returns (uint256[] memory); /** * @notice Returns a set of mint stats for the address. * This assists SeaDrop in enforcing maxSupply, * maxTotalMintableByWallet, maxTotalMintableByWalletPerToken, * and maxTokenSupplyForStage checks. * * @dev NOTE: Implementing contracts should always update these numbers * before transferring any tokens with _safeMint() to mitigate * consequences of malicious onERC1155Received() hooks. * * @param minter The minter address. * @param tokenId The token id to return stats for. */ function getMintStats( address minter, uint256 tokenId ) external view returns ( uint256 minterNumMinted, uint256 minterNumMintedForTokenId, uint256 totalMintedForTokenId, uint256 maxSupply ); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; import { ISeaDropTokenContractMetadata } from "./ISeaDropTokenContractMetadata.sol"; import { AllowListData, CreatorPayout } from "../lib/SeaDropStructs.sol"; /** * @dev A helper base interface for IERC721SeaDrop and IERC1155SeaDrop. * The token does not expose these methods as part of its external * interface to optimize contract size, but does implement them. */ interface ISeaDropToken is ISeaDropTokenContractMetadata { /** * @notice Update the SeaDrop allowed Seaport contracts privileged to mint. * Only the owner can use this function. * * @param allowedSeaport The allowed Seaport addresses. */ function updateAllowedSeaport(address[] calldata allowedSeaport) external; /** * @notice Update the SeaDrop allowed fee recipient. * Only the owner can use this function. * * @param feeRecipient The new fee recipient. * @param allowed Whether the fee recipient is allowed. */ function updateAllowedFeeRecipient( address feeRecipient, bool allowed ) external; /** * @notice Update the SeaDrop creator payout addresses. * The total basis points must add up to exactly 10_000. * Only the owner can use this function. * * @param creatorPayouts The new creator payouts. */ function updateCreatorPayouts( CreatorPayout[] calldata creatorPayouts ) external; /** * @notice Update the SeaDrop drop URI. * Only the owner can use this function. * * @param dropURI The new drop URI. */ function updateDropURI(string calldata dropURI) external; /** * @notice Update the SeaDrop allow list data. * Only the owner can use this function. * * @param allowListData The new allow list data. */ function updateAllowList(AllowListData calldata allowListData) external; /** * @notice Update the SeaDrop allowed payers. * Only the owner can use this function. * * @param payer The payer to update. * @param allowed Whether the payer is allowed. */ function updatePayer(address payer, bool allowed) external; /** * @notice Update the SeaDrop allowed signer. * Only the owner can use this function. * An allowed signer can also disallow themselves. * * @param signer The signer to update. * @param allowed Whether the signer is allowed. */ function updateSigner(address signer, bool allowed) external; /** * @notice Get the SeaDrop allowed Seaport contracts privileged to mint. */ function getAllowedSeaport() external view returns (address[] memory); /** * @notice Returns the SeaDrop creator payouts. */ function getCreatorPayouts() external view returns (CreatorPayout[] memory); /** * @notice Returns the SeaDrop allow list merkle root. */ function getAllowListMerkleRoot() external view returns (bytes32); /** * @notice Returns the SeaDrop allowed fee recipients. */ function getAllowedFeeRecipients() external view returns (address[] memory); /** * @notice Returns the SeaDrop allowed signers. */ function getSigners() external view returns (address[] memory); /** * @notice Returns if the signed digest has been used. * * @param digest The digest hash. */ function getDigestIsUsed(bytes32 digest) external view returns (bool); /** * @notice Returns the SeaDrop allowed payers. */ function getPayers() external view returns (address[] memory); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; import { IERC1155ContractMetadata } from "../interfaces/IERC1155ContractMetadata.sol"; import { ERC1155 } from "solady/src/tokens/ERC1155.sol"; import { ERC2981 } from "solady/src/tokens/ERC2981.sol"; import { TwoStepOwnable } from "utility-contracts/TwoStepOwnable.sol"; /** * @title ERC1155ContractMetadata * @author James Wenzel (emo.eth) * @author Ryan Ghods (ralxz.eth) * @author Stephan Min (stephanm.eth) * @author Michael Cohen (notmichael.eth) * @notice ERC1155ContractMetadata is a token contract that extends ERC-1155 * with additional metadata and ownership capabilities. */ contract ERC1155ContractMetadata is ERC1155, ERC2981, TwoStepOwnable, IERC1155ContractMetadata { /// @notice A struct containing the token supply info per token id. mapping(uint256 => TokenSupply) _tokenSupply; /// @notice The total number of tokens minted by address. mapping(address => uint256) _totalMintedByUser; /// @notice The total number of tokens minted per token id by address. mapping(address => mapping(uint256 => uint256)) _totalMintedByUserPerToken; /// @notice The name of the token. string internal _name; /// @notice The symbol of the token. string internal _symbol; /// @notice The base URI for token metadata. string internal _baseURI; /// @notice The contract URI for contract metadata. string internal _contractURI; /// @notice The provenance hash for guaranteeing metadata order /// for random reveals. bytes32 internal _provenanceHash; /// @notice The allowed contract that can configure SeaDrop parameters. address internal immutable _CONFIGURER; /** * @dev Reverts if the sender is not the owner or the allowed * configurer contract. * * This is used as a function instead of a modifier * to save contract space when used multiple times. */ function _onlyOwnerOrConfigurer() internal view { if (msg.sender != _CONFIGURER && msg.sender != owner()) { revert OnlyOwner(); } } /** * @notice Deploy the token contract. * * @param allowedConfigurer The address of the contract allowed to * configure parameters. Also contains SeaDrop * implementation code. * @param name_ The name of the token. * @param symbol_ The symbol of the token. */ constructor( address allowedConfigurer, string memory name_, string memory symbol_ ) { // Set the name of the token. _name = name_; // Set the symbol of the token. _symbol = symbol_; // Set the allowed configurer contract to interact with this contract. _CONFIGURER = allowedConfigurer; } /** * @notice Sets the base URI for the token metadata and emits an event. * * @param newBaseURI The new base URI to set. */ function setBaseURI(string calldata newBaseURI) external override { // Ensure the sender is only the owner or configurer contract. _onlyOwnerOrConfigurer(); // Set the new base URI. _baseURI = newBaseURI; // Emit an event with the update. emit BatchMetadataUpdate(0, type(uint256).max); } /** * @notice Sets the contract URI for contract metadata. * * @param newContractURI The new contract URI. */ function setContractURI(string calldata newContractURI) external override { // Ensure the sender is only the owner or configurer contract. _onlyOwnerOrConfigurer(); // Set the new contract URI. _contractURI = newContractURI; // Emit an event with the update. emit ContractURIUpdated(newContractURI); } /** * @notice Emit an event notifying metadata updates for * a range of token ids, according to EIP-4906. * * @param fromTokenId The start token id. * @param toTokenId The end token id. */ function emitBatchMetadataUpdate( uint256 fromTokenId, uint256 toTokenId ) external { // Ensure the sender is only the owner or configurer contract. _onlyOwnerOrConfigurer(); // Emit an event with the update. if (fromTokenId == toTokenId) { // If only one token is being updated, use the event // in the 1155 spec. emit URI(uri(fromTokenId), fromTokenId); } else { emit BatchMetadataUpdate(fromTokenId, toTokenId); } } /** * @notice Sets the max token supply and emits an event. * * @param tokenId The token id to set the max supply for. * @param newMaxSupply The new max supply to set. */ function setMaxSupply(uint256 tokenId, uint256 newMaxSupply) external { // Ensure the sender is only the owner or configurer contract. _onlyOwnerOrConfigurer(); // Ensure the max supply does not exceed the maximum value of uint64, // a limit due to the storage of bit-packed variables in TokenSupply, if (newMaxSupply > 2 ** 64 - 1) { revert CannotExceedMaxSupplyOfUint64(newMaxSupply); } // Set the new max supply. _tokenSupply[tokenId].maxSupply = uint64(newMaxSupply); // Emit an event with the update. emit MaxSupplyUpdated(tokenId, newMaxSupply); } /** * @notice Sets the provenance hash and emits an event. * * The provenance hash is used for random reveals, which * is a hash of the ordered metadata to show it has not been * modified after mint started. * * This function will revert if the provenance hash has already * been set, so be sure to carefully set it only once. * * @param newProvenanceHash The new provenance hash to set. */ function setProvenanceHash(bytes32 newProvenanceHash) external { // Ensure the sender is only the owner or configurer contract. _onlyOwnerOrConfigurer(); // Keep track of the old provenance hash for emitting with the event. bytes32 oldProvenanceHash = _provenanceHash; // Revert if the provenance hash has already been set. if (oldProvenanceHash != bytes32(0)) { revert ProvenanceHashCannotBeSetAfterAlreadyBeingSet(); } // Set the new provenance hash. _provenanceHash = newProvenanceHash; // Emit an event with the update. emit ProvenanceHashUpdated(oldProvenanceHash, newProvenanceHash); } /** * @notice Sets the default royalty information. * * Requirements: * * - `receiver` cannot be the zero address. * - `feeNumerator` cannot be greater than the fee denominator of 10_000 basis points. */ function setDefaultRoyalty(address receiver, uint96 feeNumerator) external { // Ensure the sender is only the owner or configurer contract. _onlyOwnerOrConfigurer(); // Set the default royalty. // ERC2981 implementation ensures feeNumerator <= feeDenominator // and receiver != address(0). _setDefaultRoyalty(receiver, feeNumerator); // Emit an event with the updated params. emit RoyaltyInfoUpdated(receiver, feeNumerator); } /** * @notice Returns the name of the token. */ function name() external view returns (string memory) { return _name; } /** * @notice Returns the symbol of the token. */ function symbol() external view returns (string memory) { return _symbol; } /** * @notice Returns the base URI for token metadata. */ function baseURI() external view override returns (string memory) { return _baseURI; } /** * @notice Returns the contract URI for contract metadata. */ function contractURI() external view override returns (string memory) { return _contractURI; } /** * @notice Returns the max token supply for a token id. */ function maxSupply(uint256 tokenId) external view returns (uint256) { return _tokenSupply[tokenId].maxSupply; } /** * @notice Returns the total supply for a token id. */ function totalSupply(uint256 tokenId) external view returns (uint256) { return _tokenSupply[tokenId].totalSupply; } /** * @notice Returns the total minted for a token id. */ function totalMinted(uint256 tokenId) external view returns (uint256) { return _tokenSupply[tokenId].totalMinted; } /** * @notice Returns the provenance hash. * The provenance hash is used for random reveals, which * is a hash of the ordered metadata to show it is unmodified * after mint has started. */ function provenanceHash() external view override returns (bytes32) { return _provenanceHash; } /** * @notice Returns the URI for token metadata. * * This implementation returns the same URI for *all* token types. * It relies on the token type ID substitution mechanism defined * in the EIP to replace {id} with the token id. * * @custom:param tokenId The token id to get the URI for. */ function uri( uint256 /* tokenId */ ) public view virtual override returns (string memory) { // Return the base URI. return _baseURI; } /** * @notice Returns whether the interface is supported. * * @param interfaceId The interface id to check against. */ function supportsInterface( bytes4 interfaceId ) public view virtual override(ERC1155, ERC2981) returns (bool) { return interfaceId == type(IERC1155ContractMetadata).interfaceId || interfaceId == 0x49064906 || // ERC-4906 (MetadataUpdate) ERC2981.supportsInterface(interfaceId) || // ERC1155 returns supportsInterface true for // ERC165, ERC1155, ERC1155MetadataURI ERC1155.supportsInterface(interfaceId); } /** * @dev Adds to the internal counters for a mint. * * @param to The address to mint to. * @param id The token id to mint. * @param amount The quantity to mint. * @param data The data to pass if receiver is a contract. */ function _mint( address to, uint256 id, uint256 amount, bytes memory data ) internal virtual override { // Increment mint counts. _incrementMintCounts(to, id, amount); ERC1155._mint(to, id, amount, data); } /** * @dev Adds to the internal counters for a batch mint. * * @param to The address to mint to. * @param ids The token ids to mint. * @param amounts The quantities to mint. * @param data The data to pass if receiver is a contract. */ function _batchMint( address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual override { // Put ids length on the stack to save MLOADs. uint256 idsLength = ids.length; for (uint256 i = 0; i < idsLength; ) { // Increment mint counts. _incrementMintCounts(to, ids[i], amounts[i]); unchecked { ++i; } } ERC1155._batchMint(to, ids, amounts, data); } /** * @dev Subtracts from the internal counters for a burn. * * @param by The address calling the burn. * @param from The address to burn from. * @param id The token id to burn. * @param amount The amount to burn. */ function _burn( address by, address from, uint256 id, uint256 amount ) internal virtual override { // Reduce the supply. _reduceSupplyOnBurn(id, amount); ERC1155._burn(by, from, id, amount); } /** * @dev Subtracts from the internal counters for a batch burn. * * @param by The address calling the burn. * @param from The address to burn from. * @param ids The token ids to burn. * @param amounts The amounts to burn. */ function _batchBurn( address by, address from, uint256[] memory ids, uint256[] memory amounts ) internal virtual override { // Put ids length on the stack to save MLOADs. uint256 idsLength = ids.length; for (uint256 i = 0; i < idsLength; ) { // Reduce the supply. _reduceSupplyOnBurn(ids[i], amounts[i]); unchecked { ++i; } } ERC1155._batchBurn(by, from, ids, amounts); } function _reduceSupplyOnBurn(uint256 id, uint256 amount) internal { // Get the current token supply. TokenSupply storage tokenSupply = _tokenSupply[id]; // Reduce the totalSupply. unchecked { tokenSupply.totalSupply -= uint64(amount); } } /** * @dev Internal function to increment mint counts. * * Note that this function does not check if the mint exceeds * maxSupply, which should be validated before this function is called. * * @param to The address to mint to. * @param id The token id to mint. * @param amount The quantity to mint. */ function _incrementMintCounts( address to, uint256 id, uint256 amount ) internal { // Get the current token supply. TokenSupply storage tokenSupply = _tokenSupply[id]; if (tokenSupply.totalMinted + amount > tokenSupply.maxSupply) { revert MintExceedsMaxSupply( tokenSupply.totalMinted + amount, tokenSupply.maxSupply ); } // Increment supply and number minted. // Can be unchecked because maxSupply cannot be set to exceed uint64. unchecked { tokenSupply.totalSupply += uint64(amount); tokenSupply.totalMinted += uint64(amount); // Increment total minted by user. _totalMintedByUser[to] += amount; // Increment total minted by user per token. _totalMintedByUserPerToken[to][id] += amount; } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; import { PublicDrop } from "./ERC1155SeaDropStructs.sol"; import { CreatorPayout } from "./SeaDropStructs.sol"; library ERC1155SeaDropContractOffererStorage { struct Layout { /// @notice The allowed Seaport addresses that can mint. mapping(address => bool) _allowedSeaport; /// @notice The enumerated allowed Seaport addresses. address[] _enumeratedAllowedSeaport; /// @notice The public drop data. mapping(uint256 => PublicDrop) _publicDrops; /// @notice The enumerated public drop indexes. uint256[] _enumeratedPublicDropIndexes; /// @notice The creator payout addresses and basis points. CreatorPayout[] _creatorPayouts; /// @notice The allow list merkle root. bytes32 _allowListMerkleRoot; /// @notice The allowed fee recipients. mapping(address => bool) _allowedFeeRecipients; /// @notice The enumerated allowed fee recipients. address[] _enumeratedFeeRecipients; /// @notice The allowed server-side signers. mapping(address => bool) _allowedSigners; /// @notice The enumerated allowed signers. address[] _enumeratedSigners; /// @notice The used signature digests. mapping(bytes32 => bool) _usedDigests; /// @notice The allowed payers. mapping(address => bool) _allowedPayers; /// @notice The enumerated allowed payers. address[] _enumeratedPayers; } bytes32 internal constant STORAGE_SLOT = bytes32( uint256( keccak256("contracts.storage.ERC1155SeaDropContractOfferer") ) - 1 ); function layout() internal pure returns (Layout storage l) { bytes32 slot = STORAGE_SLOT; assembly { l.slot := slot } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; import { PublicDrop } from "./ERC1155SeaDropStructs.sol"; import { SeaDropErrorsAndEvents } from "./SeaDropErrorsAndEvents.sol"; interface ERC1155SeaDropErrorsAndEvents is SeaDropErrorsAndEvents { /** * @dev Revert with an error if an empty PublicDrop is provided * for an already-empty public drop. */ error PublicDropStageNotPresent(); /** * @dev Revert with an error if the mint quantity exceeds the * max minted per wallet for a certain token id. */ error MintQuantityExceedsMaxMintedPerWalletForTokenId( uint256 tokenId, uint256 total, uint256 allowed ); /** * @dev Revert with an error if the target token id to mint is not within * the drop stage range. */ error TokenIdNotWithinDropStageRange( uint256 tokenId, uint256 startTokenId, uint256 endTokenId ); /** * @notice Revert with an error if the number of maxSupplyAmounts doesn't * match the number of maxSupplyTokenIds. */ error MaxSupplyMismatch(); /** * @notice Revert with an error if the mint order offer contains * a duplicate tokenId. */ error OfferContainsDuplicateTokenId(uint256 tokenId); /** * @dev Revert if the fromTokenId is greater than the toTokenId. */ error InvalidFromAndToTokenId(uint256 fromTokenId, uint256 toTokenId); /** * @notice Revert with an error if the number of publicDropIndexes doesn't * match the number of publicDrops. */ error PublicDropsMismatch(); /** * @dev An event with updated public drop data. */ event PublicDropUpdated(PublicDrop publicDrop, uint256 index); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; import { AllowListData, CreatorPayout } from "./SeaDropStructs.sol"; /** * @notice A struct defining public drop data. * Designed to fit efficiently in two storage slots. * * @param startPrice The start price per token. (Up to 1.2m * of native token, e.g. ETH, MATIC) * @param endPrice The end price per token. If this differs * from startPrice, the current price will * be calculated based on the current time. * @param startTime The start time, ensure this is not zero. * @param endTime The end time, ensure this is not zero. * @param restrictFeeRecipients If false, allow any fee recipient; * if true, check fee recipient is allowed. * @param paymentToken The payment token address. Null for * native token. * @param fromTokenId The start token id for the stage. * @param toTokenId The end token id for the stage. * @param maxTotalMintableByWallet Maximum total number of mints a user is * allowed. (The limit for this field is * 2^16 - 1) * @param maxTotalMintableByWalletPerToken Maximum total number of mints a user * is allowed for the token id. (The limit for * this field is 2^16 - 1) * @param feeBps Fee out of 10_000 basis points to be * collected. */ struct PublicDrop { // slot 1 uint80 startPrice; // 80/512 bits uint80 endPrice; // 160/512 bits uint40 startTime; // 200/512 bits uint40 endTime; // 240/512 bits bool restrictFeeRecipients; // 248/512 bits // uint8 unused; // slot 2 address paymentToken; // 408/512 bits uint24 fromTokenId; // 432/512 bits uint24 toTokenId; // 456/512 bits uint16 maxTotalMintableByWallet; // 472/512 bits uint16 maxTotalMintableByWalletPerToken; // 488/512 bits uint16 feeBps; // 504/512 bits } /** * @notice A struct defining mint params for an allow list. * An allow list leaf will be composed of `msg.sender` and * the following params. * * Note: Since feeBps is encoded in the leaf, backend should ensure * that feeBps is acceptable before generating a proof. * * @param startPrice The start price per token. (Up to 1.2m * of native token, e.g. ETH, MATIC) * @param endPrice The end price per token. If this differs * from startPrice, the current price will * be calculated based on the current time. * @param startTime The start time, ensure this is not zero. * @param endTime The end time, ensure this is not zero. * @param paymentToken The payment token for the mint. Null for * native token. * @param fromTokenId The start token id for the stage. * @param toTokenId The end token id for the stage. * @param maxTotalMintableByWallet Maximum total number of mints a user is * allowed. * @param maxTotalMintableByWalletPerToken Maximum total number of mints a user * is allowed for the token id. * @param maxTokenSupplyForStage The limit of token supply this stage can * mint within. * @param dropStageIndex The drop stage index to emit with the event * for analytical purposes. This should be * non-zero since the public mint emits with * index zero. * @param feeBps Fee out of 10_000 basis points to be * collected. * @param restrictFeeRecipients If false, allow any fee recipient; * if true, check fee recipient is allowed. */ struct MintParams { uint256 startPrice; uint256 endPrice; uint256 startTime; uint256 endTime; address paymentToken; uint256 fromTokenId; uint256 toTokenId; uint256 maxTotalMintableByWallet; uint256 maxTotalMintableByWalletPerToken; uint256 maxTokenSupplyForStage; uint256 dropStageIndex; // non-zero uint256 feeBps; bool restrictFeeRecipients; } /** * @dev Struct containing internal SeaDrop implementation logic * mint details to avoid stack too deep. * * @param feeRecipient The fee recipient. * @param payer The payer of the mint. * @param minter The mint recipient. * @param tokenIds The tokenIds to mint. * @param quantities The number of tokens to mint per tokenId. * @param withEffects Whether to apply state changes of the mint. */ struct MintDetails { address feeRecipient; address payer; address minter; uint256[] tokenIds; uint256[] quantities; bool withEffects; } /** * @notice A struct to configure multiple contract options in one transaction. */ struct MultiConfigureStruct { uint256[] maxSupplyTokenIds; uint256[] maxSupplyAmounts; string baseURI; string contractURI; PublicDrop[] publicDrops; uint256[] publicDropsIndexes; string dropURI; AllowListData allowListData; CreatorPayout[] creatorPayouts; bytes32 provenanceHash; address[] allowedFeeRecipients; address[] disallowedFeeRecipients; address[] allowedPayers; address[] disallowedPayers; // Server-signed address[] allowedSigners; address[] disallowedSigners; // ERC-2981 address royaltyReceiver; uint96 royaltyBps; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; /** * @notice A struct defining a creator payout address and basis points. * * @param payoutAddress The payout address. * @param basisPoints The basis points to pay out to the creator. * The total creator payouts must equal 10_000 bps. */ struct CreatorPayout { address payoutAddress; uint16 basisPoints; } /** * @notice A struct defining allow list data (for minting an allow list). * * @param merkleRoot The merkle root for the allow list. * @param publicKeyURIs If the allowListURI is encrypted, a list of URIs * pointing to the public keys. Empty if unencrypted. * @param allowListURI The URI for the allow list. */ struct AllowListData { bytes32 merkleRoot; string[] publicKeyURIs; string allowListURI; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; import { BasicOrderType, ItemType, OrderType, Side } from "./ConsiderationEnums.sol"; import { CalldataPointer, MemoryPointer } from "../helpers/PointerLibraries.sol"; /** * @dev An order contains eleven components: an offerer, a zone (or account that * can cancel the order or restrict who can fulfill the order depending on * the type), the order type (specifying partial fill support as well as * restricted order status), the start and end time, a hash that will be * provided to the zone when validating restricted orders, a salt, a key * corresponding to a given conduit, a counter, and an arbitrary number of * offer items that can be spent along with consideration items that must * be received by their respective recipient. */ struct OrderComponents { address offerer; address zone; OfferItem[] offer; ConsiderationItem[] consideration; OrderType orderType; uint256 startTime; uint256 endTime; bytes32 zoneHash; uint256 salt; bytes32 conduitKey; uint256 counter; } /** * @dev An offer item has five components: an item type (ETH or other native * tokens, ERC20, ERC721, and ERC1155, as well as criteria-based ERC721 and * ERC1155), a token address, a dual-purpose "identifierOrCriteria" * component that will either represent a tokenId or a merkle root * depending on the item type, and a start and end amount that support * increasing or decreasing amounts over the duration of the respective * order. */ struct OfferItem { ItemType itemType; address token; uint256 identifierOrCriteria; uint256 startAmount; uint256 endAmount; } /** * @dev A consideration item has the same five components as an offer item and * an additional sixth component designating the required recipient of the * item. */ struct ConsiderationItem { ItemType itemType; address token; uint256 identifierOrCriteria; uint256 startAmount; uint256 endAmount; address payable recipient; } /** * @dev A spent item is translated from a utilized offer item and has four * components: an item type (ETH or other native tokens, ERC20, ERC721, and * ERC1155), a token address, a tokenId, and an amount. */ struct SpentItem { ItemType itemType; address token; uint256 identifier; uint256 amount; } /** * @dev A received item is translated from a utilized consideration item and has * the same four components as a spent item, as well as an additional fifth * component designating the required recipient of the item. */ struct ReceivedItem { ItemType itemType; address token; uint256 identifier; uint256 amount; address payable recipient; } /** * @dev For basic orders involving ETH / native / ERC20 <=> ERC721 / ERC1155 * matching, a group of six functions may be called that only requires a * subset of the usual order arguments. Note the use of a "basicOrderType" * enum; this represents both the usual order type as well as the "route" * of the basic order (a simple derivation function for the basic order * type is `basicOrderType = orderType + (4 * basicOrderRoute)`.) */ struct BasicOrderParameters { // calldata offset address considerationToken; // 0x24 uint256 considerationIdentifier; // 0x44 uint256 considerationAmount; // 0x64 address payable offerer; // 0x84 address zone; // 0xa4 address offerToken; // 0xc4 uint256 offerIdentifier; // 0xe4 uint256 offerAmount; // 0x104 BasicOrderType basicOrderType; // 0x124 uint256 startTime; // 0x144 uint256 endTime; // 0x164 bytes32 zoneHash; // 0x184 uint256 salt; // 0x1a4 bytes32 offererConduitKey; // 0x1c4 bytes32 fulfillerConduitKey; // 0x1e4 uint256 totalOriginalAdditionalRecipients; // 0x204 AdditionalRecipient[] additionalRecipients; // 0x224 bytes signature; // 0x244 // Total length, excluding dynamic array data: 0x264 (580) } /** * @dev Basic orders can supply any number of additional recipients, with the * implied assumption that they are supplied from the offered ETH (or other * native token) or ERC20 token for the order. */ struct AdditionalRecipient { uint256 amount; address payable recipient; } /** * @dev The full set of order components, with the exception of the counter, * must be supplied when fulfilling more sophisticated orders or groups of * orders. The total number of original consideration items must also be * supplied, as the caller may specify additional consideration items. */ struct OrderParameters { address offerer; // 0x00 address zone; // 0x20 OfferItem[] offer; // 0x40 ConsiderationItem[] consideration; // 0x60 OrderType orderType; // 0x80 uint256 startTime; // 0xa0 uint256 endTime; // 0xc0 bytes32 zoneHash; // 0xe0 uint256 salt; // 0x100 bytes32 conduitKey; // 0x120 uint256 totalOriginalConsiderationItems; // 0x140 // offer.length // 0x160 } /** * @dev Orders require a signature in addition to the other order parameters. */ struct Order { OrderParameters parameters; bytes signature; } /** * @dev Advanced orders include a numerator (i.e. a fraction to attempt to fill) * and a denominator (the total size of the order) in addition to the * signature and other order parameters. It also supports an optional field * for supplying extra data; this data will be provided to the zone if the * order type is restricted and the zone is not the caller, or will be * provided to the offerer as context for contract order types. */ struct AdvancedOrder { OrderParameters parameters; uint120 numerator; uint120 denominator; bytes signature; bytes extraData; } /** * @dev Orders can be validated (either explicitly via `validate`, or as a * consequence of a full or partial fill), specifically cancelled (they can * also be cancelled in bulk via incrementing a per-zone counter), and * partially or fully filled (with the fraction filled represented by a * numerator and denominator). */ struct OrderStatus { bool isValidated; bool isCancelled; uint120 numerator; uint120 denominator; } /** * @dev A criteria resolver specifies an order, side (offer vs. consideration), * and item index. It then provides a chosen identifier (i.e. tokenId) * alongside a merkle proof demonstrating the identifier meets the required * criteria. */ struct CriteriaResolver { uint256 orderIndex; Side side; uint256 index; uint256 identifier; bytes32[] criteriaProof; } /** * @dev A fulfillment is applied to a group of orders. It decrements a series of * offer and consideration items, then generates a single execution * element. A given fulfillment can be applied to as many offer and * consideration items as desired, but must contain at least one offer and * at least one consideration that match. The fulfillment must also remain * consistent on all key parameters across all offer items (same offerer, * token, type, tokenId, and conduit preference) as well as across all * consideration items (token, type, tokenId, and recipient). */ struct Fulfillment { FulfillmentComponent[] offerComponents; FulfillmentComponent[] considerationComponents; } /** * @dev Each fulfillment component contains one index referencing a specific * order and another referencing a specific offer or consideration item. */ struct FulfillmentComponent { uint256 orderIndex; uint256 itemIndex; } /** * @dev An execution is triggered once all consideration items have been zeroed * out. It sends the item in question from the offerer to the item's * recipient, optionally sourcing approvals from either this contract * directly or from the offerer's chosen conduit if one is specified. An * execution is not provided as an argument, but rather is derived via * orders, criteria resolvers, and fulfillments (where the total number of * executions will be less than or equal to the total number of indicated * fulfillments) and returned as part of `matchOrders`. */ struct Execution { ReceivedItem item; address offerer; bytes32 conduitKey; } /** * @dev Restricted orders are validated post-execution by calling validateOrder * on the zone. This struct provides context about the order fulfillment * and any supplied extraData, as well as all order hashes fulfilled in a * call to a match or fulfillAvailable method. */ struct ZoneParameters { bytes32 orderHash; address fulfiller; address offerer; SpentItem[] offer; ReceivedItem[] consideration; bytes extraData; bytes32[] orderHashes; uint256 startTime; uint256 endTime; bytes32 zoneHash; } /** * @dev Zones and contract offerers can communicate which schemas they implement * along with any associated metadata related to each schema. */ struct Schema { uint256 id; bytes metadata; } using StructPointers for OrderComponents global; using StructPointers for OfferItem global; using StructPointers for ConsiderationItem global; using StructPointers for SpentItem global; using StructPointers for ReceivedItem global; using StructPointers for BasicOrderParameters global; using StructPointers for AdditionalRecipient global; using StructPointers for OrderParameters global; using StructPointers for Order global; using StructPointers for AdvancedOrder global; using StructPointers for OrderStatus global; using StructPointers for CriteriaResolver global; using StructPointers for Fulfillment global; using StructPointers for FulfillmentComponent global; using StructPointers for Execution global; using StructPointers for ZoneParameters global; /** * @dev This library provides a set of functions for converting structs to * pointers. */ library StructPointers { /** * @dev Get a MemoryPointer from OrderComponents. * * @param obj The OrderComponents object. * * @return ptr The MemoryPointer. */ function toMemoryPointer( OrderComponents memory obj ) internal pure returns (MemoryPointer ptr) { assembly { ptr := obj } } /** * @dev Get a CalldataPointer from OrderComponents. * * @param obj The OrderComponents object. * * @return ptr The CalldataPointer. */ function toCalldataPointer( OrderComponents calldata obj ) internal pure returns (CalldataPointer ptr) { assembly { ptr := obj } } /** * @dev Get a MemoryPointer from OfferItem. * * @param obj The OfferItem object. * * @return ptr The MemoryPointer. */ function toMemoryPointer( OfferItem memory obj ) internal pure returns (MemoryPointer ptr) { assembly { ptr := obj } } /** * @dev Get a CalldataPointer from OfferItem. * * @param obj The OfferItem object. * * @return ptr The CalldataPointer. */ function toCalldataPointer( OfferItem calldata obj ) internal pure returns (CalldataPointer ptr) { assembly { ptr := obj } } /** * @dev Get a MemoryPointer from ConsiderationItem. * * @param obj The ConsiderationItem object. * * @return ptr The MemoryPointer. */ function toMemoryPointer( ConsiderationItem memory obj ) internal pure returns (MemoryPointer ptr) { assembly { ptr := obj } } /** * @dev Get a CalldataPointer from ConsiderationItem. * * @param obj The ConsiderationItem object. * * @return ptr The CalldataPointer. */ function toCalldataPointer( ConsiderationItem calldata obj ) internal pure returns (CalldataPointer ptr) { assembly { ptr := obj } } /** * @dev Get a MemoryPointer from SpentItem. * * @param obj The SpentItem object. * * @return ptr The MemoryPointer. */ function toMemoryPointer( SpentItem memory obj ) internal pure returns (MemoryPointer ptr) { assembly { ptr := obj } } /** * @dev Get a CalldataPointer from SpentItem. * * @param obj The SpentItem object. * * @return ptr The CalldataPointer. */ function toCalldataPointer( SpentItem calldata obj ) internal pure returns (CalldataPointer ptr) { assembly { ptr := obj } } /** * @dev Get a MemoryPointer from ReceivedItem. * * @param obj The ReceivedItem object. * * @return ptr The MemoryPointer. */ function toMemoryPointer( ReceivedItem memory obj ) internal pure returns (MemoryPointer ptr) { assembly { ptr := obj } } /** * @dev Get a CalldataPointer from ReceivedItem. * * @param obj The ReceivedItem object. * * @return ptr The CalldataPointer. */ function toCalldataPointer( ReceivedItem calldata obj ) internal pure returns (CalldataPointer ptr) { assembly { ptr := obj } } /** * @dev Get a MemoryPointer from BasicOrderParameters. * * @param obj The BasicOrderParameters object. * * @return ptr The MemoryPointer. */ function toMemoryPointer( BasicOrderParameters memory obj ) internal pure returns (MemoryPointer ptr) { assembly { ptr := obj } } /** * @dev Get a CalldataPointer from BasicOrderParameters. * * @param obj The BasicOrderParameters object. * * @return ptr The CalldataPointer. */ function toCalldataPointer( BasicOrderParameters calldata obj ) internal pure returns (CalldataPointer ptr) { assembly { ptr := obj } } /** * @dev Get a MemoryPointer from AdditionalRecipient. * * @param obj The AdditionalRecipient object. * * @return ptr The MemoryPointer. */ function toMemoryPointer( AdditionalRecipient memory obj ) internal pure returns (MemoryPointer ptr) { assembly { ptr := obj } } /** * @dev Get a CalldataPointer from AdditionalRecipient. * * @param obj The AdditionalRecipient object. * * @return ptr The CalldataPointer. */ function toCalldataPointer( AdditionalRecipient calldata obj ) internal pure returns (CalldataPointer ptr) { assembly { ptr := obj } } /** * @dev Get a MemoryPointer from OrderParameters. * * @param obj The OrderParameters object. * * @return ptr The MemoryPointer. */ function toMemoryPointer( OrderParameters memory obj ) internal pure returns (MemoryPointer ptr) { assembly { ptr := obj } } /** * @dev Get a CalldataPointer from OrderParameters. * * @param obj The OrderParameters object. * * @return ptr The CalldataPointer. */ function toCalldataPointer( OrderParameters calldata obj ) internal pure returns (CalldataPointer ptr) { assembly { ptr := obj } } /** * @dev Get a MemoryPointer from Order. * * @param obj The Order object. * * @return ptr The MemoryPointer. */ function toMemoryPointer( Order memory obj ) internal pure returns (MemoryPointer ptr) { assembly { ptr := obj } } /** * @dev Get a CalldataPointer from Order. * * @param obj The Order object. * * @return ptr The CalldataPointer. */ function toCalldataPointer( Order calldata obj ) internal pure returns (CalldataPointer ptr) { assembly { ptr := obj } } /** * @dev Get a MemoryPointer from AdvancedOrder. * * @param obj The AdvancedOrder object. * * @return ptr The MemoryPointer. */ function toMemoryPointer( AdvancedOrder memory obj ) internal pure returns (MemoryPointer ptr) { assembly { ptr := obj } } /** * @dev Get a CalldataPointer from AdvancedOrder. * * @param obj The AdvancedOrder object. * * @return ptr The CalldataPointer. */ function toCalldataPointer( AdvancedOrder calldata obj ) internal pure returns (CalldataPointer ptr) { assembly { ptr := obj } } /** * @dev Get a MemoryPointer from OrderStatus. * * @param obj The OrderStatus object. * * @return ptr The MemoryPointer. */ function toMemoryPointer( OrderStatus memory obj ) internal pure returns (MemoryPointer ptr) { assembly { ptr := obj } } /** * @dev Get a CalldataPointer from OrderStatus. * * @param obj The OrderStatus object. * * @return ptr The CalldataPointer. */ function toCalldataPointer( OrderStatus calldata obj ) internal pure returns (CalldataPointer ptr) { assembly { ptr := obj } } /** * @dev Get a MemoryPointer from CriteriaResolver. * * @param obj The CriteriaResolver object. * * @return ptr The MemoryPointer. */ function toMemoryPointer( CriteriaResolver memory obj ) internal pure returns (MemoryPointer ptr) { assembly { ptr := obj } } /** * @dev Get a CalldataPointer from CriteriaResolver. * * @param obj The CriteriaResolver object. * * @return ptr The CalldataPointer. */ function toCalldataPointer( CriteriaResolver calldata obj ) internal pure returns (CalldataPointer ptr) { assembly { ptr := obj } } /** * @dev Get a MemoryPointer from Fulfillment. * * @param obj The Fulfillment object. * * @return ptr The MemoryPointer. */ function toMemoryPointer( Fulfillment memory obj ) internal pure returns (MemoryPointer ptr) { assembly { ptr := obj } } /** * @dev Get a CalldataPointer from Fulfillment. * * @param obj The Fulfillment object. * * @return ptr The CalldataPointer. */ function toCalldataPointer( Fulfillment calldata obj ) internal pure returns (CalldataPointer ptr) { assembly { ptr := obj } } /** * @dev Get a MemoryPointer from FulfillmentComponent. * * @param obj The FulfillmentComponent object. * * @return ptr The MemoryPointer. */ function toMemoryPointer( FulfillmentComponent memory obj ) internal pure returns (MemoryPointer ptr) { assembly { ptr := obj } } /** * @dev Get a CalldataPointer from FulfillmentComponent. * * @param obj The FulfillmentComponent object. * * @return ptr The CalldataPointer. */ function toCalldataPointer( FulfillmentComponent calldata obj ) internal pure returns (CalldataPointer ptr) { assembly { ptr := obj } } /** * @dev Get a MemoryPointer from Execution. * * @param obj The Execution object. * * @return ptr The MemoryPointer. */ function toMemoryPointer( Execution memory obj ) internal pure returns (MemoryPointer ptr) { assembly { ptr := obj } } /** * @dev Get a CalldataPointer from Execution. * * @param obj The Execution object. * * @return ptr The CalldataPointer. */ function toCalldataPointer( Execution calldata obj ) internal pure returns (CalldataPointer ptr) { assembly { ptr := obj } } /** * @dev Get a MemoryPointer from ZoneParameters. * * @param obj The ZoneParameters object. * * @return ptr The MemoryPointer. */ function toMemoryPointer( ZoneParameters memory obj ) internal pure returns (MemoryPointer ptr) { assembly { ptr := obj } } /** * @dev Get a CalldataPointer from ZoneParameters. * * @param obj The ZoneParameters object. * * @return ptr The CalldataPointer. */ function toCalldataPointer( ZoneParameters calldata obj ) internal pure returns (CalldataPointer ptr) { assembly { ptr := obj } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; import {ReceivedItem, Schema, SpentItem} from "../lib/ConsiderationStructs.sol"; import {IERC165} from "../interfaces/IERC165.sol"; /** * @title ContractOffererInterface * @notice Contains the minimum interfaces needed to interact with a contract * offerer. */ interface ContractOffererInterface is IERC165 { /** * @dev Generates an order with the specified minimum and maximum spent * items, and optional context (supplied as extraData). * * @param fulfiller The address of the fulfiller. * @param minimumReceived The minimum items that the caller is willing to * receive. * @param maximumSpent The maximum items the caller is willing to spend. * @param context Additional context of the order. * * @return offer A tuple containing the offer items. * @return consideration A tuple containing the consideration items. */ function generateOrder( address fulfiller, SpentItem[] calldata minimumReceived, SpentItem[] calldata maximumSpent, bytes calldata context // encoded based on the schemaID ) external returns (SpentItem[] memory offer, ReceivedItem[] memory consideration); /** * @dev Ratifies an order with the specified offer, consideration, and * optional context (supplied as extraData). * * @param offer The offer items. * @param consideration The consideration items. * @param context Additional context of the order. * @param orderHashes The hashes to ratify. * @param contractNonce The nonce of the contract. * * @return ratifyOrderMagicValue The magic value returned by the contract * offerer. */ function ratifyOrder( SpentItem[] calldata offer, ReceivedItem[] calldata consideration, bytes calldata context, // encoded based on the schemaID bytes32[] calldata orderHashes, uint256 contractNonce ) external returns (bytes4 ratifyOrderMagicValue); /** * @dev View function to preview an order generated in response to a minimum * set of received items, maximum set of spent items, and context * (supplied as extraData). * * @param caller The address of the caller (e.g. Seaport). * @param fulfiller The address of the fulfiller (e.g. the account * calling Seaport). * @param minimumReceived The minimum items that the caller is willing to * receive. * @param maximumSpent The maximum items the caller is willing to spend. * @param context Additional context of the order. * * @return offer A tuple containing the offer items. * @return consideration A tuple containing the consideration items. */ function previewOrder( address caller, address fulfiller, SpentItem[] calldata minimumReceived, SpentItem[] calldata maximumSpent, bytes calldata context // encoded based on the schemaID ) external view returns (SpentItem[] memory offer, ReceivedItem[] memory consideration); /** * @dev Gets the metadata for this contract offerer. * * @return name The name of the contract offerer. * @return schemas The schemas supported by the contract offerer. */ function getSeaportMetadata() external view returns (string memory name, Schema[] memory schemas); // map to Seaport Improvement Proposal IDs function supportsInterface(bytes4 interfaceId) external view override returns (bool); // Additional functions and/or events based on implemented schemaIDs }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/utils/Context.sol"; import "utility-contracts/TwoStepOwnable.sol"; import "../../interfaces/ILayerZeroReceiver.sol"; import "../../interfaces/ILayerZeroUserApplicationConfig.sol"; import "../../interfaces/ILayerZeroEndpoint.sol"; import "../util/BytesLib.sol"; /* * a generic LzReceiver implementation */ abstract contract LzApp is TwoStepOwnable, ILayerZeroReceiver, ILayerZeroUserApplicationConfig, Context { using BytesLib for bytes; // ua can not send payload larger than this by default, but it can be changed by the ua owner uint constant public DEFAULT_PAYLOAD_SIZE_LIMIT = 10000; ILayerZeroEndpoint public lzEndpoint; mapping(uint16 => bytes) public trustedRemoteLookup; mapping(uint16 => mapping(uint16 => uint)) public minDstGasLookup; mapping(uint16 => uint) public payloadSizeLimitLookup; address public precrime; event SetPrecrime(address precrime); event SetTrustedRemote(uint16 _remoteChainId, bytes _path); event SetTrustedRemoteAddress(uint16 _remoteChainId, bytes _remoteAddress); event SetMinDstGas(uint16 _dstChainId, uint16 _type, uint _minDstGas); constructor() {} function lzReceive(uint16 _srcChainId, bytes calldata _srcAddress, uint64 _nonce, bytes calldata _payload) public virtual override { // lzReceive must be called by the endpoint for security require(_msgSender() == address(lzEndpoint), "LzApp: invalid endpoint caller"); bytes memory trustedRemote = trustedRemoteLookup[_srcChainId]; // if will still block the message pathway from (srcChainId, srcAddress). should not receive message from untrusted remote. require(_srcAddress.length == trustedRemote.length && trustedRemote.length > 0 && keccak256(_srcAddress) == keccak256(trustedRemote), "LzApp: invalid source sending contract"); _blockingLzReceive(_srcChainId, _srcAddress, _nonce, _payload); } // abstract function - the default behaviour of LayerZero is blocking. See: NonblockingLzApp if you dont need to enforce ordered messaging function _blockingLzReceive(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload) internal virtual; function _lzSend(uint16 _dstChainId, bytes memory _payload, address payable _refundAddress, address _zroPaymentAddress, bytes memory _adapterParams, uint _nativeFee) internal virtual { bytes memory trustedRemote = trustedRemoteLookup[_dstChainId]; require(trustedRemote.length != 0, "LzApp: destination chain is not a trusted source"); _checkPayloadSize(_dstChainId, _payload.length); lzEndpoint.send{value: _nativeFee}(_dstChainId, trustedRemote, _payload, _refundAddress, _zroPaymentAddress, _adapterParams); } function _checkGasLimit(uint16 _dstChainId, uint16 _type, bytes memory _adapterParams, uint _extraGas) internal view virtual { uint providedGasLimit = _getGasLimit(_adapterParams); uint minGasLimit = minDstGasLookup[_dstChainId][_type] + _extraGas; require(minGasLimit > 0, "LzApp: minGasLimit not set"); require(providedGasLimit >= minGasLimit, "LzApp: gas limit is too low"); } function _getGasLimit(bytes memory _adapterParams) internal pure virtual returns (uint gasLimit) { require(_adapterParams.length >= 34, "LzApp: invalid adapterParams"); assembly { gasLimit := mload(add(_adapterParams, 34)) } } function _checkPayloadSize(uint16 _dstChainId, uint _payloadSize) internal view virtual { uint payloadSizeLimit = payloadSizeLimitLookup[_dstChainId]; if (payloadSizeLimit == 0) { // use default if not set payloadSizeLimit = DEFAULT_PAYLOAD_SIZE_LIMIT; } require(_payloadSize <= payloadSizeLimit, "LzApp: payload size is too large"); } //---------------------------UserApplication config---------------------------------------- function getConfig(uint16 _version, uint16 _chainId, address, uint _configType) external view returns (bytes memory) { return lzEndpoint.getConfig(_version, _chainId, address(this), _configType); } // generic config for LayerZero user Application function setConfig(uint16 _version, uint16 _chainId, uint _configType, bytes calldata _config) external override onlyOwner { lzEndpoint.setConfig(_version, _chainId, _configType, _config); } function setSendVersion(uint16 _version) external override onlyOwner { lzEndpoint.setSendVersion(_version); } function setReceiveVersion(uint16 _version) external override onlyOwner { lzEndpoint.setReceiveVersion(_version); } function forceResumeReceive(uint16 _srcChainId, bytes calldata _srcAddress) external override onlyOwner { lzEndpoint.forceResumeReceive(_srcChainId, _srcAddress); } // _path = abi.encodePacked(remoteAddress, localAddress) // this function set the trusted path for the cross-chain communication function setTrustedRemote(uint16 _remoteChainId, bytes calldata _path) external onlyOwner { trustedRemoteLookup[_remoteChainId] = _path; emit SetTrustedRemote(_remoteChainId, _path); } function setTrustedRemoteAddress(uint16 _remoteChainId, bytes calldata _remoteAddress) external onlyOwner { trustedRemoteLookup[_remoteChainId] = abi.encodePacked(_remoteAddress, address(this)); emit SetTrustedRemoteAddress(_remoteChainId, _remoteAddress); } function getTrustedRemoteAddress(uint16 _remoteChainId) external view returns (bytes memory) { bytes memory path = trustedRemoteLookup[_remoteChainId]; require(path.length != 0, "LzApp: no trusted path record"); return path.slice(0, path.length - 20); // the last 20 bytes should be address(this) } function setPrecrime(address _precrime) external onlyOwner { precrime = _precrime; emit SetPrecrime(_precrime); } function setMinDstGas(uint16 _dstChainId, uint16 _packetType, uint _minGas) external onlyOwner { require(_minGas > 0, "LzApp: invalid minGas"); minDstGasLookup[_dstChainId][_packetType] = _minGas; emit SetMinDstGas(_dstChainId, _packetType, _minGas); } // if the size is 0, it means default size limit function setPayloadSizeLimit(uint16 _dstChainId, uint _size) external onlyOwner { payloadSizeLimitLookup[_dstChainId] = _size; } //--------------------------- VIEW FUNCTION ---------------------------------------- function isTrustedRemote(uint16 _srcChainId, bytes calldata _srcAddress) external view returns (bool) { bytes memory trustedSource = trustedRemoteLookup[_srcChainId]; return keccak256(trustedSource) == keccak256(_srcAddress); } }
// SPDX-License-Identifier: MIT OR Apache-2.0 pragma solidity >=0.7.6; library ExcessivelySafeCall { uint256 constant LOW_28_MASK = 0x00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff; /// @notice Use when you _really_ really _really_ don't trust the called /// contract. This prevents the called contract from causing reversion of /// the caller in as many ways as we can. /// @dev The main difference between this and a solidity low-level call is /// that we limit the number of bytes that the callee can cause to be /// copied to caller memory. This prevents stupid things like malicious /// contracts returning 10,000,000 bytes causing a local OOG when copying /// to memory. /// @param _target The address to call /// @param _gas The amount of gas to forward to the remote contract /// @param _maxCopy The maximum number of bytes of returndata to copy /// to memory. /// @param _calldata The data to send to the remote contract /// @return success and returndata, as `.call()`. Returndata is capped to /// `_maxCopy` bytes. function excessivelySafeCall( address _target, uint256 _gas, uint16 _maxCopy, bytes memory _calldata ) internal returns (bool, bytes memory) { // set up for assembly call uint256 _toCopy; bool _success; bytes memory _returnData = new bytes(_maxCopy); // dispatch message to recipient // by assembly calling "handle" function // we call via assembly to avoid memcopying a very large returndata // returned by a malicious contract assembly { _success := call( _gas, // gas _target, // recipient 0, // ether value add(_calldata, 0x20), // inloc mload(_calldata), // inlen 0, // outloc 0 // outlen ) // limit our copy to 256 bytes _toCopy := returndatasize() if gt(_toCopy, _maxCopy) { _toCopy := _maxCopy } // Store the length of the copied bytes mstore(_returnData, _toCopy) // copy the bytes from returndata[0:_toCopy] returndatacopy(add(_returnData, 0x20), 0, _toCopy) } return (_success, _returnData); } /// @notice Use when you _really_ really _really_ don't trust the called /// contract. This prevents the called contract from causing reversion of /// the caller in as many ways as we can. /// @dev The main difference between this and a solidity low-level call is /// that we limit the number of bytes that the callee can cause to be /// copied to caller memory. This prevents stupid things like malicious /// contracts returning 10,000,000 bytes causing a local OOG when copying /// to memory. /// @param _target The address to call /// @param _gas The amount of gas to forward to the remote contract /// @param _maxCopy The maximum number of bytes of returndata to copy /// to memory. /// @param _calldata The data to send to the remote contract /// @return success and returndata, as `.call()`. Returndata is capped to /// `_maxCopy` bytes. function excessivelySafeStaticCall( address _target, uint256 _gas, uint16 _maxCopy, bytes memory _calldata ) internal view returns (bool, bytes memory) { // set up for assembly call uint256 _toCopy; bool _success; bytes memory _returnData = new bytes(_maxCopy); // dispatch message to recipient // by assembly calling "handle" function // we call via assembly to avoid memcopying a very large returndata // returned by a malicious contract assembly { _success := staticcall( _gas, // gas _target, // recipient add(_calldata, 0x20), // inloc mload(_calldata), // inlen 0, // outloc 0 // outlen ) // limit our copy to 256 bytes _toCopy := returndatasize() if gt(_toCopy, _maxCopy) { _toCopy := _maxCopy } // Store the length of the copied bytes mstore(_returnData, _toCopy) // copy the bytes from returndata[0:_toCopy] returndatacopy(add(_returnData, 0x20), 0, _toCopy) } return (_success, _returnData); } /** * @notice Swaps function selectors in encoded contract calls * @dev Allows reuse of encoded calldata for functions with identical * argument types but different names. It simply swaps out the first 4 bytes * for the new selector. This function modifies memory in place, and should * only be used with caution. * @param _newSelector The new 4-byte selector * @param _buf The encoded contract args */ function swapSelector(bytes4 _newSelector, bytes memory _buf) internal pure { require(_buf.length >= 4); uint256 _mask = LOW_28_MASK; assembly { // load the first word of let _word := mload(add(_buf, 0x20)) // mask out the top 4 bytes // /x _word := and(_word, _mask) _word := or(_newSelector, _word) mstore(add(_buf, 0x20), _word) } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; import {IOperatorFilterRegistry} from "./IOperatorFilterRegistry.sol"; import {CANONICAL_OPERATOR_FILTER_REGISTRY_ADDRESS} from "./lib/Constants.sol"; /** * @title OperatorFilterer * @notice Abstract contract whose constructor automatically registers and optionally subscribes to or copies another * registrant's entries in the OperatorFilterRegistry. * @dev This smart contract is meant to be inherited by token contracts so they can use the following: * - `onlyAllowedOperator` modifier for `transferFrom` and `safeTransferFrom` methods. * - `onlyAllowedOperatorApproval` modifier for `approve` and `setApprovalForAll` methods. * Please note that if your token contract does not provide an owner with EIP-173, it must provide * administration methods on the contract itself to interact with the registry otherwise the subscription * will be locked to the options set during construction. */ abstract contract OperatorFilterer { /// @dev Emitted when an operator is not allowed. error OperatorNotAllowed(address operator); IOperatorFilterRegistry public constant OPERATOR_FILTER_REGISTRY = IOperatorFilterRegistry(CANONICAL_OPERATOR_FILTER_REGISTRY_ADDRESS); /// @dev The constructor that is called when the contract is being deployed. constructor(address subscriptionOrRegistrantToCopy, bool subscribe) { // If an inheriting token contract is deployed to a network without the registry deployed, the modifier // will not revert, but the contract will need to be registered with the registry once it is deployed in // order for the modifier to filter addresses. if (address(OPERATOR_FILTER_REGISTRY).code.length > 0) { if (subscribe) { OPERATOR_FILTER_REGISTRY.registerAndSubscribe(address(this), subscriptionOrRegistrantToCopy); } else { if (subscriptionOrRegistrantToCopy != address(0)) { OPERATOR_FILTER_REGISTRY.registerAndCopyEntries(address(this), subscriptionOrRegistrantToCopy); } else { OPERATOR_FILTER_REGISTRY.register(address(this)); } } } } /** * @dev A helper function to check if an operator is allowed. */ modifier onlyAllowedOperator(address from) virtual { // Allow spending tokens from addresses with balance // Note that this still allows listings and marketplaces with escrow to transfer tokens if transferred // from an EOA. if (from != msg.sender) { _checkFilterOperator(msg.sender); } _; } /** * @dev A helper function to check if an operator approval is allowed. */ modifier onlyAllowedOperatorApproval(address operator) virtual { _checkFilterOperator(operator); _; } /** * @dev A helper function to check if an operator is allowed. */ function _checkFilterOperator(address operator) internal view virtual { // Check registry code length to facilitate testing in environments without a deployed registry. if (address(OPERATOR_FILTER_REGISTRY).code.length > 0) { // under normal circumstances, this function will revert rather than return false, but inheriting contracts // may specify their own OperatorFilterRegistry implementations, which may behave differently if (!OPERATOR_FILTER_REGISTRY.isOperatorAllowed(address(this), operator)) { revert OperatorNotAllowed(operator); } } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; address constant CANONICAL_OPERATOR_FILTER_REGISTRY_ADDRESS = 0x000000000000AAeB6D7670E522A718067333cd4E; address constant CANONICAL_CORI_SUBSCRIPTION = 0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6;
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; interface ISeaDropTokenContractMetadata { /** * @dev Emit an event for token metadata reveals/updates, * according to EIP-4906. * * @param _fromTokenId The start token id. * @param _toTokenId The end token id. */ event BatchMetadataUpdate(uint256 _fromTokenId, uint256 _toTokenId); /** * @dev Emit an event when the URI for the collection-level metadata * is updated. */ event ContractURIUpdated(string newContractURI); /** * @dev Emit an event with the previous and new provenance hash after * being updated. */ event ProvenanceHashUpdated(bytes32 previousHash, bytes32 newHash); /** * @dev Emit an event when the EIP-2981 royalty info is updated. */ event RoyaltyInfoUpdated(address receiver, uint256 basisPoints); /** * @notice Throw if the max supply exceeds uint64, a limit * due to the storage of bit-packed variables. */ error CannotExceedMaxSupplyOfUint64(uint256 got); /** * @dev Revert with an error when attempting to set the provenance * hash after the mint has started. */ error ProvenanceHashCannotBeSetAfterMintStarted(); /** * @dev Revert with an error when attempting to set the provenance * hash after it has already been set. */ error ProvenanceHashCannotBeSetAfterAlreadyBeingSet(); /** * @notice Sets the base URI for the token metadata and emits an event. * * @param tokenURI The new base URI to set. */ function setBaseURI(string calldata tokenURI) external; /** * @notice Sets the contract URI for contract metadata. * * @param newContractURI The new contract URI. */ function setContractURI(string calldata newContractURI) external; /** * @notice Sets the provenance hash and emits an event. * * The provenance hash is used for random reveals, which * is a hash of the ordered metadata to show it has not been * modified after mint started. * * This function will revert after the first item has been minted. * * @param newProvenanceHash The new provenance hash to set. */ function setProvenanceHash(bytes32 newProvenanceHash) external; /** * @notice Sets the default royalty information. * * Requirements: * * - `receiver` cannot be the zero address. * - `feeNumerator` cannot be greater than the fee denominator of * 10_000 basis points. */ function setDefaultRoyalty(address receiver, uint96 feeNumerator) external; /** * @notice Returns the base URI for token metadata. */ function baseURI() external view returns (string memory); /** * @notice Returns the contract URI. */ function contractURI() external view returns (string memory); /** * @notice Returns the provenance hash. * The provenance hash is used for random reveals, which * is a hash of the ordered metadata to show it is unmodified * after mint has started. */ function provenanceHash() external view returns (bytes32); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; import { ISeaDropTokenContractMetadata } from "./ISeaDropTokenContractMetadata.sol"; interface IERC1155ContractMetadata is ISeaDropTokenContractMetadata { /** * @dev A struct representing the supply info for a token id, * packed into one storage slot. * * @param maxSupply The max supply for the token id. * @param totalSupply The total token supply for the token id. * Subtracted when an item is burned. * @param totalMinted The total number of tokens minted for the token id. */ struct TokenSupply { uint64 maxSupply; // 64/256 bits uint64 totalSupply; // 128/256 bits uint64 totalMinted; // 192/256 bits } /** * @dev Emit an event when the max token supply for a token id is updated. */ event MaxSupplyUpdated(uint256 tokenId, uint256 newMaxSupply); /** * @dev Revert with an error if the mint quantity exceeds the max token * supply. */ error MintExceedsMaxSupply(uint256 total, uint256 maxSupply); /** * @notice Sets the max supply for a token id and emits an event. * * @param tokenId The token id to set the max supply for. * @param newMaxSupply The new max supply to set. */ function setMaxSupply(uint256 tokenId, uint256 newMaxSupply) external; /** * @notice Returns the name of the token. */ function name() external view returns (string memory); /** * @notice Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @notice Returns the max token supply for a token id. */ function maxSupply(uint256 tokenId) external view returns (uint256); /** * @notice Returns the total supply for a token id. */ function totalSupply(uint256 tokenId) external view returns (uint256); /** * @notice Returns the total minted for a token id. */ function totalMinted(uint256 tokenId) external view returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; /// @notice Simple ERC2981 NFT Royalty Standard implementation. /// @author Solady (https://github.com/vectorized/solady/blob/main/src/tokens/ERC2981.sol) /// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/common/ERC2981.sol) abstract contract ERC2981 { /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* CUSTOM ERRORS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The royalty fee numerator exceeds the fee denominator. error RoyaltyOverflow(); /// @dev The royalty receiver cannot be the zero address. error RoyaltyReceiverIsZeroAddress(); /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* STORAGE */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The default royalty info is given by: /// ``` /// let packed := sload(_ERC2981_MASTER_SLOT_SEED) /// let receiver := shr(96, packed) /// let royaltyFraction := xor(packed, shl(96, receiver)) /// ``` /// /// The per token royalty info is given by. /// ``` /// mstore(0x00, tokenId) /// mstore(0x20, _ERC2981_MASTER_SLOT_SEED) /// let packed := sload(keccak256(0x00, 0x40)) /// let receiver := shr(96, packed) /// let royaltyFraction := xor(packed, shl(96, receiver)) /// ``` uint256 private constant _ERC2981_MASTER_SLOT_SEED = 0xaa4ec00224afccfdb7; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* ERC2981 */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Checks that `_feeDenominator` is non-zero. constructor() { require(_feeDenominator() != 0, "Fee denominator cannot be zero."); } /// @dev Returns the denominator for the royalty amount. /// Defaults to 10000, which represents fees in basis points. /// Override this function to return a custom amount if needed. function _feeDenominator() internal pure virtual returns (uint96) { return 10000; } /// @dev Returns true if this contract implements the interface defined by `interfaceId`. /// See: https://eips.ethereum.org/EIPS/eip-165 /// This function call must use less than 30000 gas. function supportsInterface(bytes4 interfaceId) public view virtual returns (bool result) { /// @solidity memory-safe-assembly assembly { let s := shr(224, interfaceId) // ERC165: 0x01ffc9a7, ERC2981: 0x2a55205a. result := or(eq(s, 0x01ffc9a7), eq(s, 0x2a55205a)) } } /// @dev Returns the `receiver` and `royaltyAmount` for `tokenId` sold at `salePrice`. function royaltyInfo(uint256 tokenId, uint256 salePrice) public view virtual returns (address receiver, uint256 royaltyAmount) { uint256 feeDenominator = _feeDenominator(); /// @solidity memory-safe-assembly assembly { mstore(0x00, tokenId) mstore(0x20, _ERC2981_MASTER_SLOT_SEED) let packed := sload(keccak256(0x00, 0x40)) receiver := shr(96, packed) if iszero(receiver) { packed := sload(mload(0x20)) receiver := shr(96, packed) } let x := salePrice let y := xor(packed, shl(96, receiver)) // `feeNumerator`. // Overflow check, equivalent to `require(y == 0 || x <= type(uint256).max / y)`. // Out-of-gas revert. Should not be triggered in practice, but included for safety. returndatacopy(returndatasize(), returndatasize(), mul(y, gt(x, div(not(0), y)))) royaltyAmount := div(mul(x, y), feeDenominator) } } /// @dev Sets the default royalty `receiver` and `feeNumerator`. /// /// Requirements: /// - `receiver` must not be the zero address. /// - `feeNumerator` must not be greater than the fee denominator. function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual { uint256 feeDenominator = _feeDenominator(); /// @solidity memory-safe-assembly assembly { feeNumerator := shr(160, shl(160, feeNumerator)) if gt(feeNumerator, feeDenominator) { mstore(0x00, 0x350a88b3) // `RoyaltyOverflow()`. revert(0x1c, 0x04) } let packed := shl(96, receiver) if iszero(packed) { mstore(0x00, 0xb4457eaa) // `RoyaltyReceiverIsZeroAddress()`. revert(0x1c, 0x04) } sstore(_ERC2981_MASTER_SLOT_SEED, or(packed, feeNumerator)) } } /// @dev Sets the default royalty `receiver` and `feeNumerator` to zero. function _deleteDefaultRoyalty() internal virtual { /// @solidity memory-safe-assembly assembly { sstore(_ERC2981_MASTER_SLOT_SEED, 0) } } /// @dev Sets the royalty `receiver` and `feeNumerator` for `tokenId`. /// /// Requirements: /// - `receiver` must not be the zero address. /// - `feeNumerator` must not be greater than the fee denominator. function _setTokenRoyalty(uint256 tokenId, address receiver, uint96 feeNumerator) internal virtual { uint256 feeDenominator = _feeDenominator(); /// @solidity memory-safe-assembly assembly { feeNumerator := shr(160, shl(160, feeNumerator)) if gt(feeNumerator, feeDenominator) { mstore(0x00, 0x350a88b3) // `RoyaltyOverflow()`. revert(0x1c, 0x04) } let packed := shl(96, receiver) if iszero(packed) { mstore(0x00, 0xb4457eaa) // `RoyaltyReceiverIsZeroAddress()`. revert(0x1c, 0x04) } mstore(0x00, tokenId) mstore(0x20, _ERC2981_MASTER_SLOT_SEED) sstore(keccak256(0x00, 0x40), or(packed, feeNumerator)) } } /// @dev Sets the royalty `receiver` and `feeNumerator` for `tokenId` to zero. function _resetTokenRoyalty(uint256 tokenId) internal virtual { /// @solidity memory-safe-assembly assembly { mstore(0x00, tokenId) mstore(0x20, _ERC2981_MASTER_SLOT_SEED) sstore(keccak256(0x00, 0x40), 0) } } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.4; import {ConstructorInitializable} from "./ConstructorInitializable.sol"; /** @notice A two-step extension of Ownable, where the new owner must claim ownership of the contract after owner initiates transfer Owner can cancel the transfer at any point before the new owner claims ownership. Helpful in guarding against transferring ownership to an address that is unable to act as the Owner. */ abstract contract TwoStepOwnable is ConstructorInitializable { address private _owner; event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); address internal potentialOwner; event PotentialOwnerUpdated(address newPotentialAdministrator); error NewOwnerIsZeroAddress(); error NotNextOwner(); error OnlyOwner(); modifier onlyOwner() { _checkOwner(); _; } constructor() { _initialize(); } function _initialize() private onlyConstructor { _transferOwnership(msg.sender); } ///@notice Initiate ownership transfer to newPotentialOwner. Note: new owner will have to manually acceptOwnership ///@param newPotentialOwner address of potential new owner function transferOwnership(address newPotentialOwner) public virtual onlyOwner { if (newPotentialOwner == address(0)) { revert NewOwnerIsZeroAddress(); } potentialOwner = newPotentialOwner; emit PotentialOwnerUpdated(newPotentialOwner); } ///@notice Claim ownership of smart contract, after the current owner has initiated the process with transferOwnership function acceptOwnership() public virtual { address _potentialOwner = potentialOwner; if (msg.sender != _potentialOwner) { revert NotNextOwner(); } delete potentialOwner; emit PotentialOwnerUpdated(address(0)); _transferOwnership(_potentialOwner); } ///@notice cancel ownership transfer function cancelOwnershipTransfer() public virtual onlyOwner { delete potentialOwner; emit PotentialOwnerUpdated(address(0)); } function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { if (_owner != msg.sender) { revert OnlyOwner(); } } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; import { CreatorPayout, PublicDrop } from "./ERC721SeaDropStructs.sol"; interface SeaDropErrorsAndEvents { /** * @notice The SeaDrop token types, emitted as part of * `event SeaDropTokenDeployed`. */ enum SEADROP_TOKEN_TYPE { ERC721_STANDARD, ERC721_CLONE, ERC721_UPGRADEABLE, ERC1155_STANDARD, ERC1155_CLONE, ERC1155_UPGRADEABLE } /** * @notice An event to signify that a SeaDrop token contract was deployed. */ event SeaDropTokenDeployed(SEADROP_TOKEN_TYPE tokenType); /** * @notice Revert with an error if the function selector is not supported. */ error UnsupportedFunctionSelector(bytes4 selector); /** * @dev Revert with an error if the drop stage is not active. */ error NotActive( uint256 currentTimestamp, uint256 startTimestamp, uint256 endTimestamp ); /** * @dev Revert with an error if the mint quantity exceeds the max allowed * to be minted per wallet. */ error MintQuantityExceedsMaxMintedPerWallet(uint256 total, uint256 allowed); /** * @dev Revert with an error if the mint quantity exceeds the max token * supply. */ error MintQuantityExceedsMaxSupply(uint256 total, uint256 maxSupply); /** * @dev Revert with an error if the mint quantity exceeds the max token * supply for the stage. * Note: The `maxTokenSupplyForStage` for public mint is * always `type(uint).max`. */ error MintQuantityExceedsMaxTokenSupplyForStage( uint256 total, uint256 maxTokenSupplyForStage ); /** * @dev Revert if the fee recipient is the zero address. */ error FeeRecipientCannotBeZeroAddress(); /** * @dev Revert if the fee recipient is not already included. */ error FeeRecipientNotPresent(); /** * @dev Revert if the fee basis points is greater than 10_000. */ error InvalidFeeBps(uint256 feeBps); /** * @dev Revert if the fee recipient is already included. */ error DuplicateFeeRecipient(); /** * @dev Revert if the fee recipient is restricted and not allowed. */ error FeeRecipientNotAllowed(address got); /** * @dev Revert if the creator payout address is the zero address. */ error CreatorPayoutAddressCannotBeZeroAddress(); /** * @dev Revert if the creator payouts are not set. */ error CreatorPayoutsNotSet(); /** * @dev Revert if the creator payout basis points are zero. */ error CreatorPayoutBasisPointsCannotBeZero(); /** * @dev Revert if the total basis points for the creator payouts * don't equal exactly 10_000. */ error InvalidCreatorPayoutTotalBasisPoints( uint256 totalReceivedBasisPoints ); /** * @dev Revert if the creator payout basis points don't add up to 10_000. */ error InvalidCreatorPayoutBasisPoints(uint256 totalReceivedBasisPoints); /** * @dev Revert with an error if the allow list proof is invalid. */ error InvalidProof(); /** * @dev Revert if a supplied signer address is the zero address. */ error SignerCannotBeZeroAddress(); /** * @dev Revert with an error if a signer is not included in * the enumeration when removing. */ error SignerNotPresent(); /** * @dev Revert with an error if a payer is not included in * the enumeration when removing. */ error PayerNotPresent(); /** * @dev Revert with an error if a payer is already included in mapping * when adding. */ error DuplicatePayer(); /** * @dev Revert with an error if a signer is already included in mapping * when adding. */ error DuplicateSigner(); /** * @dev Revert with an error if the payer is not allowed. The minter must * pay for their own mint. */ error PayerNotAllowed(address got); /** * @dev Revert if a supplied payer address is the zero address. */ error PayerCannotBeZeroAddress(); /** * @dev Revert if the start time is greater than the end time. */ error InvalidStartAndEndTime(uint256 startTime, uint256 endTime); /** * @dev Revert with an error if the signer payment token is not the same. */ error InvalidSignedPaymentToken(address got, address want); /** * @dev Revert with an error if supplied signed mint price is less than * the minimum specified. */ error InvalidSignedMintPrice( address paymentToken, uint256 got, uint256 minimum ); /** * @dev Revert with an error if supplied signed maxTotalMintableByWallet * is greater than the maximum specified. */ error InvalidSignedMaxTotalMintableByWallet(uint256 got, uint256 maximum); /** * @dev Revert with an error if supplied signed * maxTotalMintableByWalletPerToken is greater than the maximum * specified. */ error InvalidSignedMaxTotalMintableByWalletPerToken( uint256 got, uint256 maximum ); /** * @dev Revert with an error if the fromTokenId is not within range. */ error InvalidSignedFromTokenId(uint256 got, uint256 minimum); /** * @dev Revert with an error if the toTokenId is not within range. */ error InvalidSignedToTokenId(uint256 got, uint256 maximum); /** * @dev Revert with an error if supplied signed start time is less than * the minimum specified. */ error InvalidSignedStartTime(uint256 got, uint256 minimum); /** * @dev Revert with an error if supplied signed end time is greater than * the maximum specified. */ error InvalidSignedEndTime(uint256 got, uint256 maximum); /** * @dev Revert with an error if supplied signed maxTokenSupplyForStage * is greater than the maximum specified. */ error InvalidSignedMaxTokenSupplyForStage(uint256 got, uint256 maximum); /** * @dev Revert with an error if supplied signed feeBps is greater than * the maximum specified, or less than the minimum. */ error InvalidSignedFeeBps(uint256 got, uint256 minimumOrMaximum); /** * @dev Revert with an error if signed mint did not specify to restrict * fee recipients. */ error SignedMintsMustRestrictFeeRecipients(); /** * @dev Revert with an error if a signature for a signed mint has already * been used. */ error SignatureAlreadyUsed(); /** * @dev Revert with an error if the contract has no balance to withdraw. */ error NoBalanceToWithdraw(); /** * @dev Revert with an error if the caller is not an allowed Seaport. */ error InvalidCallerOnlyAllowedSeaport(address caller); /** * @dev Revert with an error if the order does not have the ERC1155 magic * consideration item to signify a consecutive mint. */ error MustSpecifyERC1155ConsiderationItemForSeaDropMint(); /** * @dev Revert with an error if the extra data version is not supported. */ error UnsupportedExtraDataVersion(uint8 version); /** * @dev Revert with an error if the extra data encoding is not supported. */ error InvalidExtraDataEncoding(uint8 version); /** * @dev Revert with an error if the provided substandard is not supported. */ error InvalidSubstandard(uint8 substandard); /** * @dev Revert with an error if the implementation contract is called without * delegatecall. */ error OnlyDelegateCalled(); /** * @dev Revert with an error if the provided allowed Seaport is the * zero address. */ error AllowedSeaportCannotBeZeroAddress(); /** * @dev Emit an event when allowed Seaport contracts are updated. */ event AllowedSeaportUpdated(address[] allowedSeaport); /** * @dev An event with details of a SeaDrop mint, for analytical purposes. * * @param payer The address who payed for the tx. * @param dropStageIndex The drop stage index. Items minted through * public mint have dropStageIndex of 0 */ event SeaDropMint(address payer, uint256 dropStageIndex); /** * @dev An event with updated allow list data. * * @param previousMerkleRoot The previous allow list merkle root. * @param newMerkleRoot The new allow list merkle root. * @param publicKeyURI If the allow list is encrypted, the public key * URIs that can decrypt the list. * Empty if unencrypted. * @param allowListURI The URI for the allow list. */ event AllowListUpdated( bytes32 indexed previousMerkleRoot, bytes32 indexed newMerkleRoot, string[] publicKeyURI, string allowListURI ); /** * @dev An event with updated drop URI. */ event DropURIUpdated(string newDropURI); /** * @dev An event with the updated creator payout address. */ event CreatorPayoutsUpdated(CreatorPayout[] creatorPayouts); /** * @dev An event with the updated allowed fee recipient. */ event AllowedFeeRecipientUpdated( address indexed feeRecipient, bool indexed allowed ); /** * @dev An event with the updated signer. */ event SignerUpdated(address indexed signer, bool indexed allowed); /** * @dev An event with the updated payer. */ event PayerUpdated(address indexed payer, bool indexed allowed); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; enum OrderType { // 0: no partial fills, anyone can execute FULL_OPEN, // 1: partial fills supported, anyone can execute PARTIAL_OPEN, // 2: no partial fills, only offerer or zone can execute FULL_RESTRICTED, // 3: partial fills supported, only offerer or zone can execute PARTIAL_RESTRICTED, // 4: contract order type CONTRACT } enum BasicOrderType { // 0: no partial fills, anyone can execute ETH_TO_ERC721_FULL_OPEN, // 1: partial fills supported, anyone can execute ETH_TO_ERC721_PARTIAL_OPEN, // 2: no partial fills, only offerer or zone can execute ETH_TO_ERC721_FULL_RESTRICTED, // 3: partial fills supported, only offerer or zone can execute ETH_TO_ERC721_PARTIAL_RESTRICTED, // 4: no partial fills, anyone can execute ETH_TO_ERC1155_FULL_OPEN, // 5: partial fills supported, anyone can execute ETH_TO_ERC1155_PARTIAL_OPEN, // 6: no partial fills, only offerer or zone can execute ETH_TO_ERC1155_FULL_RESTRICTED, // 7: partial fills supported, only offerer or zone can execute ETH_TO_ERC1155_PARTIAL_RESTRICTED, // 8: no partial fills, anyone can execute ERC20_TO_ERC721_FULL_OPEN, // 9: partial fills supported, anyone can execute ERC20_TO_ERC721_PARTIAL_OPEN, // 10: no partial fills, only offerer or zone can execute ERC20_TO_ERC721_FULL_RESTRICTED, // 11: partial fills supported, only offerer or zone can execute ERC20_TO_ERC721_PARTIAL_RESTRICTED, // 12: no partial fills, anyone can execute ERC20_TO_ERC1155_FULL_OPEN, // 13: partial fills supported, anyone can execute ERC20_TO_ERC1155_PARTIAL_OPEN, // 14: no partial fills, only offerer or zone can execute ERC20_TO_ERC1155_FULL_RESTRICTED, // 15: partial fills supported, only offerer or zone can execute ERC20_TO_ERC1155_PARTIAL_RESTRICTED, // 16: no partial fills, anyone can execute ERC721_TO_ERC20_FULL_OPEN, // 17: partial fills supported, anyone can execute ERC721_TO_ERC20_PARTIAL_OPEN, // 18: no partial fills, only offerer or zone can execute ERC721_TO_ERC20_FULL_RESTRICTED, // 19: partial fills supported, only offerer or zone can execute ERC721_TO_ERC20_PARTIAL_RESTRICTED, // 20: no partial fills, anyone can execute ERC1155_TO_ERC20_FULL_OPEN, // 21: partial fills supported, anyone can execute ERC1155_TO_ERC20_PARTIAL_OPEN, // 22: no partial fills, only offerer or zone can execute ERC1155_TO_ERC20_FULL_RESTRICTED, // 23: partial fills supported, only offerer or zone can execute ERC1155_TO_ERC20_PARTIAL_RESTRICTED } enum BasicOrderRouteType { // 0: provide Ether (or other native token) to receive offered ERC721 item. ETH_TO_ERC721, // 1: provide Ether (or other native token) to receive offered ERC1155 item. ETH_TO_ERC1155, // 2: provide ERC20 item to receive offered ERC721 item. ERC20_TO_ERC721, // 3: provide ERC20 item to receive offered ERC1155 item. ERC20_TO_ERC1155, // 4: provide ERC721 item to receive offered ERC20 item. ERC721_TO_ERC20, // 5: provide ERC1155 item to receive offered ERC20 item. ERC1155_TO_ERC20 } enum ItemType { // 0: ETH on mainnet, MATIC on polygon, etc. NATIVE, // 1: ERC20 items (ERC777 and ERC20 analogues could also technically work) ERC20, // 2: ERC721 items ERC721, // 3: ERC1155 items ERC1155, // 4: ERC721 items where a number of tokenIds are supported ERC721_WITH_CRITERIA, // 5: ERC1155 items where a number of ids are supported ERC1155_WITH_CRITERIA } enum Side { // 0: Items that can be spent OFFER, // 1: Items that must be received CONSIDERATION }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; type CalldataPointer is uint256; type ReturndataPointer is uint256; type MemoryPointer is uint256; using CalldataPointerLib for CalldataPointer global; using MemoryPointerLib for MemoryPointer global; using ReturndataPointerLib for ReturndataPointer global; using CalldataReaders for CalldataPointer global; using ReturndataReaders for ReturndataPointer global; using MemoryReaders for MemoryPointer global; using MemoryWriters for MemoryPointer global; CalldataPointer constant CalldataStart = CalldataPointer.wrap(0x04); MemoryPointer constant FreeMemoryPPtr = MemoryPointer.wrap(0x40); uint256 constant IdentityPrecompileAddress = 0x4; uint256 constant OffsetOrLengthMask = 0xffffffff; uint256 constant _OneWord = 0x20; uint256 constant _FreeMemoryPointerSlot = 0x40; /// @dev Allocates `size` bytes in memory by increasing the free memory pointer /// and returns the memory pointer to the first byte of the allocated region. // (Free functions cannot have visibility.) // solhint-disable-next-line func-visibility function malloc(uint256 size) pure returns (MemoryPointer mPtr) { assembly { mPtr := mload(_FreeMemoryPointerSlot) mstore(_FreeMemoryPointerSlot, add(mPtr, size)) } } // (Free functions cannot have visibility.) // solhint-disable-next-line func-visibility function getFreeMemoryPointer() pure returns (MemoryPointer mPtr) { mPtr = FreeMemoryPPtr.readMemoryPointer(); } // (Free functions cannot have visibility.) // solhint-disable-next-line func-visibility function setFreeMemoryPointer(MemoryPointer mPtr) pure { FreeMemoryPPtr.write(mPtr); } library CalldataPointerLib { function lt( CalldataPointer a, CalldataPointer b ) internal pure returns (bool c) { assembly { c := lt(a, b) } } function gt( CalldataPointer a, CalldataPointer b ) internal pure returns (bool c) { assembly { c := gt(a, b) } } function eq( CalldataPointer a, CalldataPointer b ) internal pure returns (bool c) { assembly { c := eq(a, b) } } function isNull(CalldataPointer a) internal pure returns (bool b) { assembly { b := iszero(a) } } /// @dev Resolves an offset stored at `cdPtr + headOffset` to a calldata. /// pointer `cdPtr` must point to some parent object with a dynamic /// type's head stored at `cdPtr + headOffset`. function pptr( CalldataPointer cdPtr, uint256 headOffset ) internal pure returns (CalldataPointer cdPtrChild) { cdPtrChild = cdPtr.offset( cdPtr.offset(headOffset).readUint256() & OffsetOrLengthMask ); } /// @dev Resolves an offset stored at `cdPtr` to a calldata pointer. /// `cdPtr` must point to some parent object with a dynamic type as its /// first member, e.g. `struct { bytes data; }` function pptr( CalldataPointer cdPtr ) internal pure returns (CalldataPointer cdPtrChild) { cdPtrChild = cdPtr.offset(cdPtr.readUint256() & OffsetOrLengthMask); } /// @dev Returns the calldata pointer one word after `cdPtr`. function next( CalldataPointer cdPtr ) internal pure returns (CalldataPointer cdPtrNext) { assembly { cdPtrNext := add(cdPtr, _OneWord) } } /// @dev Returns the calldata pointer `_offset` bytes after `cdPtr`. function offset( CalldataPointer cdPtr, uint256 _offset ) internal pure returns (CalldataPointer cdPtrNext) { assembly { cdPtrNext := add(cdPtr, _offset) } } /// @dev Copies `size` bytes from calldata starting at `src` to memory at /// `dst`. function copy( CalldataPointer src, MemoryPointer dst, uint256 size ) internal pure { assembly { calldatacopy(dst, src, size) } } } library ReturndataPointerLib { function lt( ReturndataPointer a, ReturndataPointer b ) internal pure returns (bool c) { assembly { c := lt(a, b) } } function gt( ReturndataPointer a, ReturndataPointer b ) internal pure returns (bool c) { assembly { c := gt(a, b) } } function eq( ReturndataPointer a, ReturndataPointer b ) internal pure returns (bool c) { assembly { c := eq(a, b) } } function isNull(ReturndataPointer a) internal pure returns (bool b) { assembly { b := iszero(a) } } /// @dev Resolves an offset stored at `rdPtr + headOffset` to a returndata /// pointer. `rdPtr` must point to some parent object with a dynamic /// type's head stored at `rdPtr + headOffset`. function pptr( ReturndataPointer rdPtr, uint256 headOffset ) internal pure returns (ReturndataPointer rdPtrChild) { rdPtrChild = rdPtr.offset( rdPtr.offset(headOffset).readUint256() & OffsetOrLengthMask ); } /// @dev Resolves an offset stored at `rdPtr` to a returndata pointer. /// `rdPtr` must point to some parent object with a dynamic type as its /// first member, e.g. `struct { bytes data; }` function pptr( ReturndataPointer rdPtr ) internal pure returns (ReturndataPointer rdPtrChild) { rdPtrChild = rdPtr.offset(rdPtr.readUint256() & OffsetOrLengthMask); } /// @dev Returns the returndata pointer one word after `cdPtr`. function next( ReturndataPointer rdPtr ) internal pure returns (ReturndataPointer rdPtrNext) { assembly { rdPtrNext := add(rdPtr, _OneWord) } } /// @dev Returns the returndata pointer `_offset` bytes after `cdPtr`. function offset( ReturndataPointer rdPtr, uint256 _offset ) internal pure returns (ReturndataPointer rdPtrNext) { assembly { rdPtrNext := add(rdPtr, _offset) } } /// @dev Copies `size` bytes from returndata starting at `src` to memory at /// `dst`. function copy( ReturndataPointer src, MemoryPointer dst, uint256 size ) internal pure { assembly { returndatacopy(dst, src, size) } } } library MemoryPointerLib { function copy( MemoryPointer src, MemoryPointer dst, uint256 size ) internal view { assembly { let success := staticcall( gas(), IdentityPrecompileAddress, src, size, dst, size ) if or(iszero(returndatasize()), iszero(success)) { revert(0, 0) } } } function lt( MemoryPointer a, MemoryPointer b ) internal pure returns (bool c) { assembly { c := lt(a, b) } } function gt( MemoryPointer a, MemoryPointer b ) internal pure returns (bool c) { assembly { c := gt(a, b) } } function eq( MemoryPointer a, MemoryPointer b ) internal pure returns (bool c) { assembly { c := eq(a, b) } } function isNull(MemoryPointer a) internal pure returns (bool b) { assembly { b := iszero(a) } } function hash( MemoryPointer ptr, uint256 length ) internal pure returns (bytes32 _hash) { assembly { _hash := keccak256(ptr, length) } } /// @dev Returns the memory pointer one word after `mPtr`. function next( MemoryPointer mPtr ) internal pure returns (MemoryPointer mPtrNext) { assembly { mPtrNext := add(mPtr, _OneWord) } } /// @dev Returns the memory pointer `_offset` bytes after `mPtr`. function offset( MemoryPointer mPtr, uint256 _offset ) internal pure returns (MemoryPointer mPtrNext) { assembly { mPtrNext := add(mPtr, _offset) } } /// @dev Resolves a pointer at `mPtr + headOffset` to a memory /// pointer. `mPtr` must point to some parent object with a dynamic /// type's pointer stored at `mPtr + headOffset`. function pptr( MemoryPointer mPtr, uint256 headOffset ) internal pure returns (MemoryPointer mPtrChild) { mPtrChild = mPtr.offset(headOffset).readMemoryPointer(); } /// @dev Resolves a pointer stored at `mPtr` to a memory pointer. /// `mPtr` must point to some parent object with a dynamic type as its /// first member, e.g. `struct { bytes data; }` function pptr( MemoryPointer mPtr ) internal pure returns (MemoryPointer mPtrChild) { mPtrChild = mPtr.readMemoryPointer(); } } library CalldataReaders { /// @dev Reads the value at `cdPtr` and applies a mask to return only the /// last 4 bytes. function readMaskedUint256( CalldataPointer cdPtr ) internal pure returns (uint256 value) { value = cdPtr.readUint256() & OffsetOrLengthMask; } /// @dev Reads the bool at `cdPtr` in calldata. function readBool( CalldataPointer cdPtr ) internal pure returns (bool value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the address at `cdPtr` in calldata. function readAddress( CalldataPointer cdPtr ) internal pure returns (address value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the bytes1 at `cdPtr` in calldata. function readBytes1( CalldataPointer cdPtr ) internal pure returns (bytes1 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the bytes2 at `cdPtr` in calldata. function readBytes2( CalldataPointer cdPtr ) internal pure returns (bytes2 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the bytes3 at `cdPtr` in calldata. function readBytes3( CalldataPointer cdPtr ) internal pure returns (bytes3 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the bytes4 at `cdPtr` in calldata. function readBytes4( CalldataPointer cdPtr ) internal pure returns (bytes4 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the bytes5 at `cdPtr` in calldata. function readBytes5( CalldataPointer cdPtr ) internal pure returns (bytes5 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the bytes6 at `cdPtr` in calldata. function readBytes6( CalldataPointer cdPtr ) internal pure returns (bytes6 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the bytes7 at `cdPtr` in calldata. function readBytes7( CalldataPointer cdPtr ) internal pure returns (bytes7 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the bytes8 at `cdPtr` in calldata. function readBytes8( CalldataPointer cdPtr ) internal pure returns (bytes8 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the bytes9 at `cdPtr` in calldata. function readBytes9( CalldataPointer cdPtr ) internal pure returns (bytes9 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the bytes10 at `cdPtr` in calldata. function readBytes10( CalldataPointer cdPtr ) internal pure returns (bytes10 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the bytes11 at `cdPtr` in calldata. function readBytes11( CalldataPointer cdPtr ) internal pure returns (bytes11 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the bytes12 at `cdPtr` in calldata. function readBytes12( CalldataPointer cdPtr ) internal pure returns (bytes12 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the bytes13 at `cdPtr` in calldata. function readBytes13( CalldataPointer cdPtr ) internal pure returns (bytes13 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the bytes14 at `cdPtr` in calldata. function readBytes14( CalldataPointer cdPtr ) internal pure returns (bytes14 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the bytes15 at `cdPtr` in calldata. function readBytes15( CalldataPointer cdPtr ) internal pure returns (bytes15 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the bytes16 at `cdPtr` in calldata. function readBytes16( CalldataPointer cdPtr ) internal pure returns (bytes16 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the bytes17 at `cdPtr` in calldata. function readBytes17( CalldataPointer cdPtr ) internal pure returns (bytes17 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the bytes18 at `cdPtr` in calldata. function readBytes18( CalldataPointer cdPtr ) internal pure returns (bytes18 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the bytes19 at `cdPtr` in calldata. function readBytes19( CalldataPointer cdPtr ) internal pure returns (bytes19 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the bytes20 at `cdPtr` in calldata. function readBytes20( CalldataPointer cdPtr ) internal pure returns (bytes20 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the bytes21 at `cdPtr` in calldata. function readBytes21( CalldataPointer cdPtr ) internal pure returns (bytes21 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the bytes22 at `cdPtr` in calldata. function readBytes22( CalldataPointer cdPtr ) internal pure returns (bytes22 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the bytes23 at `cdPtr` in calldata. function readBytes23( CalldataPointer cdPtr ) internal pure returns (bytes23 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the bytes24 at `cdPtr` in calldata. function readBytes24( CalldataPointer cdPtr ) internal pure returns (bytes24 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the bytes25 at `cdPtr` in calldata. function readBytes25( CalldataPointer cdPtr ) internal pure returns (bytes25 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the bytes26 at `cdPtr` in calldata. function readBytes26( CalldataPointer cdPtr ) internal pure returns (bytes26 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the bytes27 at `cdPtr` in calldata. function readBytes27( CalldataPointer cdPtr ) internal pure returns (bytes27 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the bytes28 at `cdPtr` in calldata. function readBytes28( CalldataPointer cdPtr ) internal pure returns (bytes28 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the bytes29 at `cdPtr` in calldata. function readBytes29( CalldataPointer cdPtr ) internal pure returns (bytes29 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the bytes30 at `cdPtr` in calldata. function readBytes30( CalldataPointer cdPtr ) internal pure returns (bytes30 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the bytes31 at `cdPtr` in calldata. function readBytes31( CalldataPointer cdPtr ) internal pure returns (bytes31 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the bytes32 at `cdPtr` in calldata. function readBytes32( CalldataPointer cdPtr ) internal pure returns (bytes32 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the uint8 at `cdPtr` in calldata. function readUint8( CalldataPointer cdPtr ) internal pure returns (uint8 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the uint16 at `cdPtr` in calldata. function readUint16( CalldataPointer cdPtr ) internal pure returns (uint16 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the uint24 at `cdPtr` in calldata. function readUint24( CalldataPointer cdPtr ) internal pure returns (uint24 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the uint32 at `cdPtr` in calldata. function readUint32( CalldataPointer cdPtr ) internal pure returns (uint32 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the uint40 at `cdPtr` in calldata. function readUint40( CalldataPointer cdPtr ) internal pure returns (uint40 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the uint48 at `cdPtr` in calldata. function readUint48( CalldataPointer cdPtr ) internal pure returns (uint48 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the uint56 at `cdPtr` in calldata. function readUint56( CalldataPointer cdPtr ) internal pure returns (uint56 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the uint64 at `cdPtr` in calldata. function readUint64( CalldataPointer cdPtr ) internal pure returns (uint64 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the uint72 at `cdPtr` in calldata. function readUint72( CalldataPointer cdPtr ) internal pure returns (uint72 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the uint80 at `cdPtr` in calldata. function readUint80( CalldataPointer cdPtr ) internal pure returns (uint80 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the uint88 at `cdPtr` in calldata. function readUint88( CalldataPointer cdPtr ) internal pure returns (uint88 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the uint96 at `cdPtr` in calldata. function readUint96( CalldataPointer cdPtr ) internal pure returns (uint96 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the uint104 at `cdPtr` in calldata. function readUint104( CalldataPointer cdPtr ) internal pure returns (uint104 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the uint112 at `cdPtr` in calldata. function readUint112( CalldataPointer cdPtr ) internal pure returns (uint112 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the uint120 at `cdPtr` in calldata. function readUint120( CalldataPointer cdPtr ) internal pure returns (uint120 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the uint128 at `cdPtr` in calldata. function readUint128( CalldataPointer cdPtr ) internal pure returns (uint128 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the uint136 at `cdPtr` in calldata. function readUint136( CalldataPointer cdPtr ) internal pure returns (uint136 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the uint144 at `cdPtr` in calldata. function readUint144( CalldataPointer cdPtr ) internal pure returns (uint144 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the uint152 at `cdPtr` in calldata. function readUint152( CalldataPointer cdPtr ) internal pure returns (uint152 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the uint160 at `cdPtr` in calldata. function readUint160( CalldataPointer cdPtr ) internal pure returns (uint160 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the uint168 at `cdPtr` in calldata. function readUint168( CalldataPointer cdPtr ) internal pure returns (uint168 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the uint176 at `cdPtr` in calldata. function readUint176( CalldataPointer cdPtr ) internal pure returns (uint176 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the uint184 at `cdPtr` in calldata. function readUint184( CalldataPointer cdPtr ) internal pure returns (uint184 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the uint192 at `cdPtr` in calldata. function readUint192( CalldataPointer cdPtr ) internal pure returns (uint192 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the uint200 at `cdPtr` in calldata. function readUint200( CalldataPointer cdPtr ) internal pure returns (uint200 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the uint208 at `cdPtr` in calldata. function readUint208( CalldataPointer cdPtr ) internal pure returns (uint208 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the uint216 at `cdPtr` in calldata. function readUint216( CalldataPointer cdPtr ) internal pure returns (uint216 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the uint224 at `cdPtr` in calldata. function readUint224( CalldataPointer cdPtr ) internal pure returns (uint224 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the uint232 at `cdPtr` in calldata. function readUint232( CalldataPointer cdPtr ) internal pure returns (uint232 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the uint240 at `cdPtr` in calldata. function readUint240( CalldataPointer cdPtr ) internal pure returns (uint240 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the uint248 at `cdPtr` in calldata. function readUint248( CalldataPointer cdPtr ) internal pure returns (uint248 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the uint256 at `cdPtr` in calldata. function readUint256( CalldataPointer cdPtr ) internal pure returns (uint256 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the int8 at `cdPtr` in calldata. function readInt8( CalldataPointer cdPtr ) internal pure returns (int8 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the int16 at `cdPtr` in calldata. function readInt16( CalldataPointer cdPtr ) internal pure returns (int16 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the int24 at `cdPtr` in calldata. function readInt24( CalldataPointer cdPtr ) internal pure returns (int24 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the int32 at `cdPtr` in calldata. function readInt32( CalldataPointer cdPtr ) internal pure returns (int32 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the int40 at `cdPtr` in calldata. function readInt40( CalldataPointer cdPtr ) internal pure returns (int40 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the int48 at `cdPtr` in calldata. function readInt48( CalldataPointer cdPtr ) internal pure returns (int48 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the int56 at `cdPtr` in calldata. function readInt56( CalldataPointer cdPtr ) internal pure returns (int56 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the int64 at `cdPtr` in calldata. function readInt64( CalldataPointer cdPtr ) internal pure returns (int64 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the int72 at `cdPtr` in calldata. function readInt72( CalldataPointer cdPtr ) internal pure returns (int72 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the int80 at `cdPtr` in calldata. function readInt80( CalldataPointer cdPtr ) internal pure returns (int80 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the int88 at `cdPtr` in calldata. function readInt88( CalldataPointer cdPtr ) internal pure returns (int88 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the int96 at `cdPtr` in calldata. function readInt96( CalldataPointer cdPtr ) internal pure returns (int96 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the int104 at `cdPtr` in calldata. function readInt104( CalldataPointer cdPtr ) internal pure returns (int104 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the int112 at `cdPtr` in calldata. function readInt112( CalldataPointer cdPtr ) internal pure returns (int112 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the int120 at `cdPtr` in calldata. function readInt120( CalldataPointer cdPtr ) internal pure returns (int120 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the int128 at `cdPtr` in calldata. function readInt128( CalldataPointer cdPtr ) internal pure returns (int128 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the int136 at `cdPtr` in calldata. function readInt136( CalldataPointer cdPtr ) internal pure returns (int136 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the int144 at `cdPtr` in calldata. function readInt144( CalldataPointer cdPtr ) internal pure returns (int144 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the int152 at `cdPtr` in calldata. function readInt152( CalldataPointer cdPtr ) internal pure returns (int152 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the int160 at `cdPtr` in calldata. function readInt160( CalldataPointer cdPtr ) internal pure returns (int160 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the int168 at `cdPtr` in calldata. function readInt168( CalldataPointer cdPtr ) internal pure returns (int168 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the int176 at `cdPtr` in calldata. function readInt176( CalldataPointer cdPtr ) internal pure returns (int176 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the int184 at `cdPtr` in calldata. function readInt184( CalldataPointer cdPtr ) internal pure returns (int184 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the int192 at `cdPtr` in calldata. function readInt192( CalldataPointer cdPtr ) internal pure returns (int192 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the int200 at `cdPtr` in calldata. function readInt200( CalldataPointer cdPtr ) internal pure returns (int200 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the int208 at `cdPtr` in calldata. function readInt208( CalldataPointer cdPtr ) internal pure returns (int208 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the int216 at `cdPtr` in calldata. function readInt216( CalldataPointer cdPtr ) internal pure returns (int216 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the int224 at `cdPtr` in calldata. function readInt224( CalldataPointer cdPtr ) internal pure returns (int224 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the int232 at `cdPtr` in calldata. function readInt232( CalldataPointer cdPtr ) internal pure returns (int232 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the int240 at `cdPtr` in calldata. function readInt240( CalldataPointer cdPtr ) internal pure returns (int240 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the int248 at `cdPtr` in calldata. function readInt248( CalldataPointer cdPtr ) internal pure returns (int248 value) { assembly { value := calldataload(cdPtr) } } /// @dev Reads the int256 at `cdPtr` in calldata. function readInt256( CalldataPointer cdPtr ) internal pure returns (int256 value) { assembly { value := calldataload(cdPtr) } } } library ReturndataReaders { /// @dev Reads value at `rdPtr` & applies a mask to return only last 4 bytes function readMaskedUint256( ReturndataPointer rdPtr ) internal pure returns (uint256 value) { value = rdPtr.readUint256() & OffsetOrLengthMask; } /// @dev Reads the bool at `rdPtr` in returndata. function readBool( ReturndataPointer rdPtr ) internal pure returns (bool value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the address at `rdPtr` in returndata. function readAddress( ReturndataPointer rdPtr ) internal pure returns (address value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the bytes1 at `rdPtr` in returndata. function readBytes1( ReturndataPointer rdPtr ) internal pure returns (bytes1 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the bytes2 at `rdPtr` in returndata. function readBytes2( ReturndataPointer rdPtr ) internal pure returns (bytes2 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the bytes3 at `rdPtr` in returndata. function readBytes3( ReturndataPointer rdPtr ) internal pure returns (bytes3 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the bytes4 at `rdPtr` in returndata. function readBytes4( ReturndataPointer rdPtr ) internal pure returns (bytes4 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the bytes5 at `rdPtr` in returndata. function readBytes5( ReturndataPointer rdPtr ) internal pure returns (bytes5 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the bytes6 at `rdPtr` in returndata. function readBytes6( ReturndataPointer rdPtr ) internal pure returns (bytes6 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the bytes7 at `rdPtr` in returndata. function readBytes7( ReturndataPointer rdPtr ) internal pure returns (bytes7 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the bytes8 at `rdPtr` in returndata. function readBytes8( ReturndataPointer rdPtr ) internal pure returns (bytes8 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the bytes9 at `rdPtr` in returndata. function readBytes9( ReturndataPointer rdPtr ) internal pure returns (bytes9 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the bytes10 at `rdPtr` in returndata. function readBytes10( ReturndataPointer rdPtr ) internal pure returns (bytes10 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the bytes11 at `rdPtr` in returndata. function readBytes11( ReturndataPointer rdPtr ) internal pure returns (bytes11 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the bytes12 at `rdPtr` in returndata. function readBytes12( ReturndataPointer rdPtr ) internal pure returns (bytes12 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the bytes13 at `rdPtr` in returndata. function readBytes13( ReturndataPointer rdPtr ) internal pure returns (bytes13 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the bytes14 at `rdPtr` in returndata. function readBytes14( ReturndataPointer rdPtr ) internal pure returns (bytes14 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the bytes15 at `rdPtr` in returndata. function readBytes15( ReturndataPointer rdPtr ) internal pure returns (bytes15 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the bytes16 at `rdPtr` in returndata. function readBytes16( ReturndataPointer rdPtr ) internal pure returns (bytes16 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the bytes17 at `rdPtr` in returndata. function readBytes17( ReturndataPointer rdPtr ) internal pure returns (bytes17 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the bytes18 at `rdPtr` in returndata. function readBytes18( ReturndataPointer rdPtr ) internal pure returns (bytes18 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the bytes19 at `rdPtr` in returndata. function readBytes19( ReturndataPointer rdPtr ) internal pure returns (bytes19 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the bytes20 at `rdPtr` in returndata. function readBytes20( ReturndataPointer rdPtr ) internal pure returns (bytes20 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the bytes21 at `rdPtr` in returndata. function readBytes21( ReturndataPointer rdPtr ) internal pure returns (bytes21 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the bytes22 at `rdPtr` in returndata. function readBytes22( ReturndataPointer rdPtr ) internal pure returns (bytes22 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the bytes23 at `rdPtr` in returndata. function readBytes23( ReturndataPointer rdPtr ) internal pure returns (bytes23 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the bytes24 at `rdPtr` in returndata. function readBytes24( ReturndataPointer rdPtr ) internal pure returns (bytes24 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the bytes25 at `rdPtr` in returndata. function readBytes25( ReturndataPointer rdPtr ) internal pure returns (bytes25 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the bytes26 at `rdPtr` in returndata. function readBytes26( ReturndataPointer rdPtr ) internal pure returns (bytes26 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the bytes27 at `rdPtr` in returndata. function readBytes27( ReturndataPointer rdPtr ) internal pure returns (bytes27 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the bytes28 at `rdPtr` in returndata. function readBytes28( ReturndataPointer rdPtr ) internal pure returns (bytes28 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the bytes29 at `rdPtr` in returndata. function readBytes29( ReturndataPointer rdPtr ) internal pure returns (bytes29 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the bytes30 at `rdPtr` in returndata. function readBytes30( ReturndataPointer rdPtr ) internal pure returns (bytes30 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the bytes31 at `rdPtr` in returndata. function readBytes31( ReturndataPointer rdPtr ) internal pure returns (bytes31 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the bytes32 at `rdPtr` in returndata. function readBytes32( ReturndataPointer rdPtr ) internal pure returns (bytes32 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the uint8 at `rdPtr` in returndata. function readUint8( ReturndataPointer rdPtr ) internal pure returns (uint8 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the uint16 at `rdPtr` in returndata. function readUint16( ReturndataPointer rdPtr ) internal pure returns (uint16 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the uint24 at `rdPtr` in returndata. function readUint24( ReturndataPointer rdPtr ) internal pure returns (uint24 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the uint32 at `rdPtr` in returndata. function readUint32( ReturndataPointer rdPtr ) internal pure returns (uint32 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the uint40 at `rdPtr` in returndata. function readUint40( ReturndataPointer rdPtr ) internal pure returns (uint40 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the uint48 at `rdPtr` in returndata. function readUint48( ReturndataPointer rdPtr ) internal pure returns (uint48 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the uint56 at `rdPtr` in returndata. function readUint56( ReturndataPointer rdPtr ) internal pure returns (uint56 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the uint64 at `rdPtr` in returndata. function readUint64( ReturndataPointer rdPtr ) internal pure returns (uint64 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the uint72 at `rdPtr` in returndata. function readUint72( ReturndataPointer rdPtr ) internal pure returns (uint72 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the uint80 at `rdPtr` in returndata. function readUint80( ReturndataPointer rdPtr ) internal pure returns (uint80 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the uint88 at `rdPtr` in returndata. function readUint88( ReturndataPointer rdPtr ) internal pure returns (uint88 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the uint96 at `rdPtr` in returndata. function readUint96( ReturndataPointer rdPtr ) internal pure returns (uint96 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the uint104 at `rdPtr` in returndata. function readUint104( ReturndataPointer rdPtr ) internal pure returns (uint104 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the uint112 at `rdPtr` in returndata. function readUint112( ReturndataPointer rdPtr ) internal pure returns (uint112 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the uint120 at `rdPtr` in returndata. function readUint120( ReturndataPointer rdPtr ) internal pure returns (uint120 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the uint128 at `rdPtr` in returndata. function readUint128( ReturndataPointer rdPtr ) internal pure returns (uint128 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the uint136 at `rdPtr` in returndata. function readUint136( ReturndataPointer rdPtr ) internal pure returns (uint136 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the uint144 at `rdPtr` in returndata. function readUint144( ReturndataPointer rdPtr ) internal pure returns (uint144 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the uint152 at `rdPtr` in returndata. function readUint152( ReturndataPointer rdPtr ) internal pure returns (uint152 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the uint160 at `rdPtr` in returndata. function readUint160( ReturndataPointer rdPtr ) internal pure returns (uint160 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the uint168 at `rdPtr` in returndata. function readUint168( ReturndataPointer rdPtr ) internal pure returns (uint168 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the uint176 at `rdPtr` in returndata. function readUint176( ReturndataPointer rdPtr ) internal pure returns (uint176 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the uint184 at `rdPtr` in returndata. function readUint184( ReturndataPointer rdPtr ) internal pure returns (uint184 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the uint192 at `rdPtr` in returndata. function readUint192( ReturndataPointer rdPtr ) internal pure returns (uint192 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the uint200 at `rdPtr` in returndata. function readUint200( ReturndataPointer rdPtr ) internal pure returns (uint200 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the uint208 at `rdPtr` in returndata. function readUint208( ReturndataPointer rdPtr ) internal pure returns (uint208 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the uint216 at `rdPtr` in returndata. function readUint216( ReturndataPointer rdPtr ) internal pure returns (uint216 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the uint224 at `rdPtr` in returndata. function readUint224( ReturndataPointer rdPtr ) internal pure returns (uint224 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the uint232 at `rdPtr` in returndata. function readUint232( ReturndataPointer rdPtr ) internal pure returns (uint232 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the uint240 at `rdPtr` in returndata. function readUint240( ReturndataPointer rdPtr ) internal pure returns (uint240 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the uint248 at `rdPtr` in returndata. function readUint248( ReturndataPointer rdPtr ) internal pure returns (uint248 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the uint256 at `rdPtr` in returndata. function readUint256( ReturndataPointer rdPtr ) internal pure returns (uint256 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the int8 at `rdPtr` in returndata. function readInt8( ReturndataPointer rdPtr ) internal pure returns (int8 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the int16 at `rdPtr` in returndata. function readInt16( ReturndataPointer rdPtr ) internal pure returns (int16 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the int24 at `rdPtr` in returndata. function readInt24( ReturndataPointer rdPtr ) internal pure returns (int24 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the int32 at `rdPtr` in returndata. function readInt32( ReturndataPointer rdPtr ) internal pure returns (int32 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the int40 at `rdPtr` in returndata. function readInt40( ReturndataPointer rdPtr ) internal pure returns (int40 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the int48 at `rdPtr` in returndata. function readInt48( ReturndataPointer rdPtr ) internal pure returns (int48 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the int56 at `rdPtr` in returndata. function readInt56( ReturndataPointer rdPtr ) internal pure returns (int56 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the int64 at `rdPtr` in returndata. function readInt64( ReturndataPointer rdPtr ) internal pure returns (int64 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the int72 at `rdPtr` in returndata. function readInt72( ReturndataPointer rdPtr ) internal pure returns (int72 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the int80 at `rdPtr` in returndata. function readInt80( ReturndataPointer rdPtr ) internal pure returns (int80 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the int88 at `rdPtr` in returndata. function readInt88( ReturndataPointer rdPtr ) internal pure returns (int88 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the int96 at `rdPtr` in returndata. function readInt96( ReturndataPointer rdPtr ) internal pure returns (int96 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the int104 at `rdPtr` in returndata. function readInt104( ReturndataPointer rdPtr ) internal pure returns (int104 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the int112 at `rdPtr` in returndata. function readInt112( ReturndataPointer rdPtr ) internal pure returns (int112 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the int120 at `rdPtr` in returndata. function readInt120( ReturndataPointer rdPtr ) internal pure returns (int120 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the int128 at `rdPtr` in returndata. function readInt128( ReturndataPointer rdPtr ) internal pure returns (int128 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the int136 at `rdPtr` in returndata. function readInt136( ReturndataPointer rdPtr ) internal pure returns (int136 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the int144 at `rdPtr` in returndata. function readInt144( ReturndataPointer rdPtr ) internal pure returns (int144 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the int152 at `rdPtr` in returndata. function readInt152( ReturndataPointer rdPtr ) internal pure returns (int152 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the int160 at `rdPtr` in returndata. function readInt160( ReturndataPointer rdPtr ) internal pure returns (int160 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the int168 at `rdPtr` in returndata. function readInt168( ReturndataPointer rdPtr ) internal pure returns (int168 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the int176 at `rdPtr` in returndata. function readInt176( ReturndataPointer rdPtr ) internal pure returns (int176 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the int184 at `rdPtr` in returndata. function readInt184( ReturndataPointer rdPtr ) internal pure returns (int184 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the int192 at `rdPtr` in returndata. function readInt192( ReturndataPointer rdPtr ) internal pure returns (int192 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the int200 at `rdPtr` in returndata. function readInt200( ReturndataPointer rdPtr ) internal pure returns (int200 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the int208 at `rdPtr` in returndata. function readInt208( ReturndataPointer rdPtr ) internal pure returns (int208 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the int216 at `rdPtr` in returndata. function readInt216( ReturndataPointer rdPtr ) internal pure returns (int216 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the int224 at `rdPtr` in returndata. function readInt224( ReturndataPointer rdPtr ) internal pure returns (int224 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the int232 at `rdPtr` in returndata. function readInt232( ReturndataPointer rdPtr ) internal pure returns (int232 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the int240 at `rdPtr` in returndata. function readInt240( ReturndataPointer rdPtr ) internal pure returns (int240 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the int248 at `rdPtr` in returndata. function readInt248( ReturndataPointer rdPtr ) internal pure returns (int248 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } /// @dev Reads the int256 at `rdPtr` in returndata. function readInt256( ReturndataPointer rdPtr ) internal pure returns (int256 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } } } library MemoryReaders { /// @dev Reads the memory pointer at `mPtr` in memory. function readMemoryPointer( MemoryPointer mPtr ) internal pure returns (MemoryPointer value) { assembly { value := mload(mPtr) } } /// @dev Reads value at `mPtr` & applies a mask to return only last 4 bytes function readMaskedUint256( MemoryPointer mPtr ) internal pure returns (uint256 value) { value = mPtr.readUint256() & OffsetOrLengthMask; } /// @dev Reads the bool at `mPtr` in memory. function readBool(MemoryPointer mPtr) internal pure returns (bool value) { assembly { value := mload(mPtr) } } /// @dev Reads the address at `mPtr` in memory. function readAddress( MemoryPointer mPtr ) internal pure returns (address value) { assembly { value := mload(mPtr) } } /// @dev Reads the bytes1 at `mPtr` in memory. function readBytes1( MemoryPointer mPtr ) internal pure returns (bytes1 value) { assembly { value := mload(mPtr) } } /// @dev Reads the bytes2 at `mPtr` in memory. function readBytes2( MemoryPointer mPtr ) internal pure returns (bytes2 value) { assembly { value := mload(mPtr) } } /// @dev Reads the bytes3 at `mPtr` in memory. function readBytes3( MemoryPointer mPtr ) internal pure returns (bytes3 value) { assembly { value := mload(mPtr) } } /// @dev Reads the bytes4 at `mPtr` in memory. function readBytes4( MemoryPointer mPtr ) internal pure returns (bytes4 value) { assembly { value := mload(mPtr) } } /// @dev Reads the bytes5 at `mPtr` in memory. function readBytes5( MemoryPointer mPtr ) internal pure returns (bytes5 value) { assembly { value := mload(mPtr) } } /// @dev Reads the bytes6 at `mPtr` in memory. function readBytes6( MemoryPointer mPtr ) internal pure returns (bytes6 value) { assembly { value := mload(mPtr) } } /// @dev Reads the bytes7 at `mPtr` in memory. function readBytes7( MemoryPointer mPtr ) internal pure returns (bytes7 value) { assembly { value := mload(mPtr) } } /// @dev Reads the bytes8 at `mPtr` in memory. function readBytes8( MemoryPointer mPtr ) internal pure returns (bytes8 value) { assembly { value := mload(mPtr) } } /// @dev Reads the bytes9 at `mPtr` in memory. function readBytes9( MemoryPointer mPtr ) internal pure returns (bytes9 value) { assembly { value := mload(mPtr) } } /// @dev Reads the bytes10 at `mPtr` in memory. function readBytes10( MemoryPointer mPtr ) internal pure returns (bytes10 value) { assembly { value := mload(mPtr) } } /// @dev Reads the bytes11 at `mPtr` in memory. function readBytes11( MemoryPointer mPtr ) internal pure returns (bytes11 value) { assembly { value := mload(mPtr) } } /// @dev Reads the bytes12 at `mPtr` in memory. function readBytes12( MemoryPointer mPtr ) internal pure returns (bytes12 value) { assembly { value := mload(mPtr) } } /// @dev Reads the bytes13 at `mPtr` in memory. function readBytes13( MemoryPointer mPtr ) internal pure returns (bytes13 value) { assembly { value := mload(mPtr) } } /// @dev Reads the bytes14 at `mPtr` in memory. function readBytes14( MemoryPointer mPtr ) internal pure returns (bytes14 value) { assembly { value := mload(mPtr) } } /// @dev Reads the bytes15 at `mPtr` in memory. function readBytes15( MemoryPointer mPtr ) internal pure returns (bytes15 value) { assembly { value := mload(mPtr) } } /// @dev Reads the bytes16 at `mPtr` in memory. function readBytes16( MemoryPointer mPtr ) internal pure returns (bytes16 value) { assembly { value := mload(mPtr) } } /// @dev Reads the bytes17 at `mPtr` in memory. function readBytes17( MemoryPointer mPtr ) internal pure returns (bytes17 value) { assembly { value := mload(mPtr) } } /// @dev Reads the bytes18 at `mPtr` in memory. function readBytes18( MemoryPointer mPtr ) internal pure returns (bytes18 value) { assembly { value := mload(mPtr) } } /// @dev Reads the bytes19 at `mPtr` in memory. function readBytes19( MemoryPointer mPtr ) internal pure returns (bytes19 value) { assembly { value := mload(mPtr) } } /// @dev Reads the bytes20 at `mPtr` in memory. function readBytes20( MemoryPointer mPtr ) internal pure returns (bytes20 value) { assembly { value := mload(mPtr) } } /// @dev Reads the bytes21 at `mPtr` in memory. function readBytes21( MemoryPointer mPtr ) internal pure returns (bytes21 value) { assembly { value := mload(mPtr) } } /// @dev Reads the bytes22 at `mPtr` in memory. function readBytes22( MemoryPointer mPtr ) internal pure returns (bytes22 value) { assembly { value := mload(mPtr) } } /// @dev Reads the bytes23 at `mPtr` in memory. function readBytes23( MemoryPointer mPtr ) internal pure returns (bytes23 value) { assembly { value := mload(mPtr) } } /// @dev Reads the bytes24 at `mPtr` in memory. function readBytes24( MemoryPointer mPtr ) internal pure returns (bytes24 value) { assembly { value := mload(mPtr) } } /// @dev Reads the bytes25 at `mPtr` in memory. function readBytes25( MemoryPointer mPtr ) internal pure returns (bytes25 value) { assembly { value := mload(mPtr) } } /// @dev Reads the bytes26 at `mPtr` in memory. function readBytes26( MemoryPointer mPtr ) internal pure returns (bytes26 value) { assembly { value := mload(mPtr) } } /// @dev Reads the bytes27 at `mPtr` in memory. function readBytes27( MemoryPointer mPtr ) internal pure returns (bytes27 value) { assembly { value := mload(mPtr) } } /// @dev Reads the bytes28 at `mPtr` in memory. function readBytes28( MemoryPointer mPtr ) internal pure returns (bytes28 value) { assembly { value := mload(mPtr) } } /// @dev Reads the bytes29 at `mPtr` in memory. function readBytes29( MemoryPointer mPtr ) internal pure returns (bytes29 value) { assembly { value := mload(mPtr) } } /// @dev Reads the bytes30 at `mPtr` in memory. function readBytes30( MemoryPointer mPtr ) internal pure returns (bytes30 value) { assembly { value := mload(mPtr) } } /// @dev Reads the bytes31 at `mPtr` in memory. function readBytes31( MemoryPointer mPtr ) internal pure returns (bytes31 value) { assembly { value := mload(mPtr) } } /// @dev Reads the bytes32 at `mPtr` in memory. function readBytes32( MemoryPointer mPtr ) internal pure returns (bytes32 value) { assembly { value := mload(mPtr) } } /// @dev Reads the uint8 at `mPtr` in memory. function readUint8(MemoryPointer mPtr) internal pure returns (uint8 value) { assembly { value := mload(mPtr) } } /// @dev Reads the uint16 at `mPtr` in memory. function readUint16( MemoryPointer mPtr ) internal pure returns (uint16 value) { assembly { value := mload(mPtr) } } /// @dev Reads the uint24 at `mPtr` in memory. function readUint24( MemoryPointer mPtr ) internal pure returns (uint24 value) { assembly { value := mload(mPtr) } } /// @dev Reads the uint32 at `mPtr` in memory. function readUint32( MemoryPointer mPtr ) internal pure returns (uint32 value) { assembly { value := mload(mPtr) } } /// @dev Reads the uint40 at `mPtr` in memory. function readUint40( MemoryPointer mPtr ) internal pure returns (uint40 value) { assembly { value := mload(mPtr) } } /// @dev Reads the uint48 at `mPtr` in memory. function readUint48( MemoryPointer mPtr ) internal pure returns (uint48 value) { assembly { value := mload(mPtr) } } /// @dev Reads the uint56 at `mPtr` in memory. function readUint56( MemoryPointer mPtr ) internal pure returns (uint56 value) { assembly { value := mload(mPtr) } } /// @dev Reads the uint64 at `mPtr` in memory. function readUint64( MemoryPointer mPtr ) internal pure returns (uint64 value) { assembly { value := mload(mPtr) } } /// @dev Reads the uint72 at `mPtr` in memory. function readUint72( MemoryPointer mPtr ) internal pure returns (uint72 value) { assembly { value := mload(mPtr) } } /// @dev Reads the uint80 at `mPtr` in memory. function readUint80( MemoryPointer mPtr ) internal pure returns (uint80 value) { assembly { value := mload(mPtr) } } /// @dev Reads the uint88 at `mPtr` in memory. function readUint88( MemoryPointer mPtr ) internal pure returns (uint88 value) { assembly { value := mload(mPtr) } } /// @dev Reads the uint96 at `mPtr` in memory. function readUint96( MemoryPointer mPtr ) internal pure returns (uint96 value) { assembly { value := mload(mPtr) } } /// @dev Reads the uint104 at `mPtr` in memory. function readUint104( MemoryPointer mPtr ) internal pure returns (uint104 value) { assembly { value := mload(mPtr) } } /// @dev Reads the uint112 at `mPtr` in memory. function readUint112( MemoryPointer mPtr ) internal pure returns (uint112 value) { assembly { value := mload(mPtr) } } /// @dev Reads the uint120 at `mPtr` in memory. function readUint120( MemoryPointer mPtr ) internal pure returns (uint120 value) { assembly { value := mload(mPtr) } } /// @dev Reads the uint128 at `mPtr` in memory. function readUint128( MemoryPointer mPtr ) internal pure returns (uint128 value) { assembly { value := mload(mPtr) } } /// @dev Reads the uint136 at `mPtr` in memory. function readUint136( MemoryPointer mPtr ) internal pure returns (uint136 value) { assembly { value := mload(mPtr) } } /// @dev Reads the uint144 at `mPtr` in memory. function readUint144( MemoryPointer mPtr ) internal pure returns (uint144 value) { assembly { value := mload(mPtr) } } /// @dev Reads the uint152 at `mPtr` in memory. function readUint152( MemoryPointer mPtr ) internal pure returns (uint152 value) { assembly { value := mload(mPtr) } } /// @dev Reads the uint160 at `mPtr` in memory. function readUint160( MemoryPointer mPtr ) internal pure returns (uint160 value) { assembly { value := mload(mPtr) } } /// @dev Reads the uint168 at `mPtr` in memory. function readUint168( MemoryPointer mPtr ) internal pure returns (uint168 value) { assembly { value := mload(mPtr) } } /// @dev Reads the uint176 at `mPtr` in memory. function readUint176( MemoryPointer mPtr ) internal pure returns (uint176 value) { assembly { value := mload(mPtr) } } /// @dev Reads the uint184 at `mPtr` in memory. function readUint184( MemoryPointer mPtr ) internal pure returns (uint184 value) { assembly { value := mload(mPtr) } } /// @dev Reads the uint192 at `mPtr` in memory. function readUint192( MemoryPointer mPtr ) internal pure returns (uint192 value) { assembly { value := mload(mPtr) } } /// @dev Reads the uint200 at `mPtr` in memory. function readUint200( MemoryPointer mPtr ) internal pure returns (uint200 value) { assembly { value := mload(mPtr) } } /// @dev Reads the uint208 at `mPtr` in memory. function readUint208( MemoryPointer mPtr ) internal pure returns (uint208 value) { assembly { value := mload(mPtr) } } /// @dev Reads the uint216 at `mPtr` in memory. function readUint216( MemoryPointer mPtr ) internal pure returns (uint216 value) { assembly { value := mload(mPtr) } } /// @dev Reads the uint224 at `mPtr` in memory. function readUint224( MemoryPointer mPtr ) internal pure returns (uint224 value) { assembly { value := mload(mPtr) } } /// @dev Reads the uint232 at `mPtr` in memory. function readUint232( MemoryPointer mPtr ) internal pure returns (uint232 value) { assembly { value := mload(mPtr) } } /// @dev Reads the uint240 at `mPtr` in memory. function readUint240( MemoryPointer mPtr ) internal pure returns (uint240 value) { assembly { value := mload(mPtr) } } /// @dev Reads the uint248 at `mPtr` in memory. function readUint248( MemoryPointer mPtr ) internal pure returns (uint248 value) { assembly { value := mload(mPtr) } } /// @dev Reads the uint256 at `mPtr` in memory. function readUint256( MemoryPointer mPtr ) internal pure returns (uint256 value) { assembly { value := mload(mPtr) } } /// @dev Reads the int8 at `mPtr` in memory. function readInt8(MemoryPointer mPtr) internal pure returns (int8 value) { assembly { value := mload(mPtr) } } /// @dev Reads the int16 at `mPtr` in memory. function readInt16(MemoryPointer mPtr) internal pure returns (int16 value) { assembly { value := mload(mPtr) } } /// @dev Reads the int24 at `mPtr` in memory. function readInt24(MemoryPointer mPtr) internal pure returns (int24 value) { assembly { value := mload(mPtr) } } /// @dev Reads the int32 at `mPtr` in memory. function readInt32(MemoryPointer mPtr) internal pure returns (int32 value) { assembly { value := mload(mPtr) } } /// @dev Reads the int40 at `mPtr` in memory. function readInt40(MemoryPointer mPtr) internal pure returns (int40 value) { assembly { value := mload(mPtr) } } /// @dev Reads the int48 at `mPtr` in memory. function readInt48(MemoryPointer mPtr) internal pure returns (int48 value) { assembly { value := mload(mPtr) } } /// @dev Reads the int56 at `mPtr` in memory. function readInt56(MemoryPointer mPtr) internal pure returns (int56 value) { assembly { value := mload(mPtr) } } /// @dev Reads the int64 at `mPtr` in memory. function readInt64(MemoryPointer mPtr) internal pure returns (int64 value) { assembly { value := mload(mPtr) } } /// @dev Reads the int72 at `mPtr` in memory. function readInt72(MemoryPointer mPtr) internal pure returns (int72 value) { assembly { value := mload(mPtr) } } /// @dev Reads the int80 at `mPtr` in memory. function readInt80(MemoryPointer mPtr) internal pure returns (int80 value) { assembly { value := mload(mPtr) } } /// @dev Reads the int88 at `mPtr` in memory. function readInt88(MemoryPointer mPtr) internal pure returns (int88 value) { assembly { value := mload(mPtr) } } /// @dev Reads the int96 at `mPtr` in memory. function readInt96(MemoryPointer mPtr) internal pure returns (int96 value) { assembly { value := mload(mPtr) } } /// @dev Reads the int104 at `mPtr` in memory. function readInt104( MemoryPointer mPtr ) internal pure returns (int104 value) { assembly { value := mload(mPtr) } } /// @dev Reads the int112 at `mPtr` in memory. function readInt112( MemoryPointer mPtr ) internal pure returns (int112 value) { assembly { value := mload(mPtr) } } /// @dev Reads the int120 at `mPtr` in memory. function readInt120( MemoryPointer mPtr ) internal pure returns (int120 value) { assembly { value := mload(mPtr) } } /// @dev Reads the int128 at `mPtr` in memory. function readInt128( MemoryPointer mPtr ) internal pure returns (int128 value) { assembly { value := mload(mPtr) } } /// @dev Reads the int136 at `mPtr` in memory. function readInt136( MemoryPointer mPtr ) internal pure returns (int136 value) { assembly { value := mload(mPtr) } } /// @dev Reads the int144 at `mPtr` in memory. function readInt144( MemoryPointer mPtr ) internal pure returns (int144 value) { assembly { value := mload(mPtr) } } /// @dev Reads the int152 at `mPtr` in memory. function readInt152( MemoryPointer mPtr ) internal pure returns (int152 value) { assembly { value := mload(mPtr) } } /// @dev Reads the int160 at `mPtr` in memory. function readInt160( MemoryPointer mPtr ) internal pure returns (int160 value) { assembly { value := mload(mPtr) } } /// @dev Reads the int168 at `mPtr` in memory. function readInt168( MemoryPointer mPtr ) internal pure returns (int168 value) { assembly { value := mload(mPtr) } } /// @dev Reads the int176 at `mPtr` in memory. function readInt176( MemoryPointer mPtr ) internal pure returns (int176 value) { assembly { value := mload(mPtr) } } /// @dev Reads the int184 at `mPtr` in memory. function readInt184( MemoryPointer mPtr ) internal pure returns (int184 value) { assembly { value := mload(mPtr) } } /// @dev Reads the int192 at `mPtr` in memory. function readInt192( MemoryPointer mPtr ) internal pure returns (int192 value) { assembly { value := mload(mPtr) } } /// @dev Reads the int200 at `mPtr` in memory. function readInt200( MemoryPointer mPtr ) internal pure returns (int200 value) { assembly { value := mload(mPtr) } } /// @dev Reads the int208 at `mPtr` in memory. function readInt208( MemoryPointer mPtr ) internal pure returns (int208 value) { assembly { value := mload(mPtr) } } /// @dev Reads the int216 at `mPtr` in memory. function readInt216( MemoryPointer mPtr ) internal pure returns (int216 value) { assembly { value := mload(mPtr) } } /// @dev Reads the int224 at `mPtr` in memory. function readInt224( MemoryPointer mPtr ) internal pure returns (int224 value) { assembly { value := mload(mPtr) } } /// @dev Reads the int232 at `mPtr` in memory. function readInt232( MemoryPointer mPtr ) internal pure returns (int232 value) { assembly { value := mload(mPtr) } } /// @dev Reads the int240 at `mPtr` in memory. function readInt240( MemoryPointer mPtr ) internal pure returns (int240 value) { assembly { value := mload(mPtr) } } /// @dev Reads the int248 at `mPtr` in memory. function readInt248( MemoryPointer mPtr ) internal pure returns (int248 value) { assembly { value := mload(mPtr) } } /// @dev Reads the int256 at `mPtr` in memory. function readInt256( MemoryPointer mPtr ) internal pure returns (int256 value) { assembly { value := mload(mPtr) } } } library MemoryWriters { /// @dev Writes `valuePtr` to memory at `mPtr`. function write(MemoryPointer mPtr, MemoryPointer valuePtr) internal pure { assembly { mstore(mPtr, valuePtr) } } /// @dev Writes a boolean `value` to `mPtr` in memory. function write(MemoryPointer mPtr, bool value) internal pure { assembly { mstore(mPtr, value) } } /// @dev Writes an address `value` to `mPtr` in memory. function write(MemoryPointer mPtr, address value) internal pure { assembly { mstore(mPtr, value) } } /// @dev Writes a bytes32 `value` to `mPtr` in memory. /// Separate name to disambiguate literal write parameters. function writeBytes32(MemoryPointer mPtr, bytes32 value) internal pure { assembly { mstore(mPtr, value) } } /// @dev Writes a uint256 `value` to `mPtr` in memory. function write(MemoryPointer mPtr, uint256 value) internal pure { assembly { mstore(mPtr, value) } } /// @dev Writes an int256 `value` to `mPtr` in memory. /// Separate name to disambiguate literal write parameters. function writeInt(MemoryPointer mPtr, int256 value) internal pure { assembly { mstore(mPtr, value) } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.7; /** * @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`. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.20; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT pragma solidity >=0.5.0; interface ILayerZeroReceiver { // @notice LayerZero endpoint will invoke this function to deliver the message on the destination // @param _srcChainId - the source endpoint identifier // @param _srcAddress - the source sending contract address from the source chain // @param _nonce - the ordered message nonce // @param _payload - the signed payload is the UA bytes has encoded to be sent function lzReceive(uint16 _srcChainId, bytes calldata _srcAddress, uint64 _nonce, bytes calldata _payload) external; }
// SPDX-License-Identifier: Unlicense /* * @title Solidity Bytes Arrays Utils * @author Gonçalo Sá <[email protected]> * * @dev Bytes tightly packed arrays utility library for ethereum contracts written in Solidity. * The library lets you concatenate, slice and type cast bytes arrays both in memory and storage. */ pragma solidity >=0.8.0 <0.9.0; library BytesLib { function concat( bytes memory _preBytes, bytes memory _postBytes ) internal pure returns (bytes memory) { bytes memory tempBytes; assembly { // Get a location of some free memory and store it in tempBytes as // Solidity does for memory variables. tempBytes := mload(0x40) // Store the length of the first bytes array at the beginning of // the memory for tempBytes. let length := mload(_preBytes) mstore(tempBytes, length) // Maintain a memory counter for the current write location in the // temp bytes array by adding the 32 bytes for the array length to // the starting location. let mc := add(tempBytes, 0x20) // Stop copying when the memory counter reaches the length of the // first bytes array. let end := add(mc, length) for { // Initialize a copy counter to the start of the _preBytes data, // 32 bytes into its memory. let cc := add(_preBytes, 0x20) } lt(mc, end) { // Increase both counters by 32 bytes each iteration. mc := add(mc, 0x20) cc := add(cc, 0x20) } { // Write the _preBytes data into the tempBytes memory 32 bytes // at a time. mstore(mc, mload(cc)) } // Add the length of _postBytes to the current length of tempBytes // and store it as the new length in the first 32 bytes of the // tempBytes memory. length := mload(_postBytes) mstore(tempBytes, add(length, mload(tempBytes))) // Move the memory counter back from a multiple of 0x20 to the // actual end of the _preBytes data. mc := end // Stop copying when the memory counter reaches the new combined // length of the arrays. end := add(mc, length) for { let cc := add(_postBytes, 0x20) } lt(mc, end) { mc := add(mc, 0x20) cc := add(cc, 0x20) } { mstore(mc, mload(cc)) } // Update the free-memory pointer by padding our last write location // to 32 bytes: add 31 bytes to the end of tempBytes to move to the // next 32 byte block, then round down to the nearest multiple of // 32. If the sum of the length of the two arrays is zero then add // one before rounding down to leave a blank 32 bytes (the length block with 0). mstore(0x40, and( add(add(end, iszero(add(length, mload(_preBytes)))), 31), not(31) // Round down to the nearest 32 bytes. )) } return tempBytes; } function concatStorage(bytes storage _preBytes, bytes memory _postBytes) internal { assembly { // Read the first 32 bytes of _preBytes storage, which is the length // of the array. (We don't need to use the offset into the slot // because arrays use the entire slot.) let fslot := sload(_preBytes.slot) // Arrays of 31 bytes or less have an even value in their slot, // while longer arrays have an odd value. The actual length is // the slot divided by two for odd values, and the lowest order // byte divided by two for even values. // If the slot is even, bitwise and the slot with 255 and divide by // two to get the length. If the slot is odd, bitwise and the slot // with -1 and divide by two. let slength := div(and(fslot, sub(mul(0x100, iszero(and(fslot, 1))), 1)), 2) let mlength := mload(_postBytes) let newlength := add(slength, mlength) // slength can contain both the length and contents of the array // if length < 32 bytes so let's prepare for that // v. http://solidity.readthedocs.io/en/latest/miscellaneous.html#layout-of-state-variables-in-storage switch add(lt(slength, 32), lt(newlength, 32)) case 2 { // Since the new array still fits in the slot, we just need to // update the contents of the slot. // uint256(bytes_storage) = uint256(bytes_storage) + uint256(bytes_memory) + new_length sstore( _preBytes.slot, // all the modifications to the slot are inside this // next block add( // we can just add to the slot contents because the // bytes we want to change are the LSBs fslot, add( mul( div( // load the bytes from memory mload(add(_postBytes, 0x20)), // zero all bytes to the right exp(0x100, sub(32, mlength)) ), // and now shift left the number of bytes to // leave space for the length in the slot exp(0x100, sub(32, newlength)) ), // increase length by the double of the memory // bytes length mul(mlength, 2) ) ) ) } case 1 { // The stored value fits in the slot, but the combined value // will exceed it. // get the keccak hash to get the contents of the array mstore(0x0, _preBytes.slot) let sc := add(keccak256(0x0, 0x20), div(slength, 32)) // save new length sstore(_preBytes.slot, add(mul(newlength, 2), 1)) // The contents of the _postBytes array start 32 bytes into // the structure. Our first read should obtain the `submod` // bytes that can fit into the unused space in the last word // of the stored array. To get this, we read 32 bytes starting // from `submod`, so the data we read overlaps with the array // contents by `submod` bytes. Masking the lowest-order // `submod` bytes allows us to add that value directly to the // stored value. let submod := sub(32, slength) let mc := add(_postBytes, submod) let end := add(_postBytes, mlength) let mask := sub(exp(0x100, submod), 1) sstore( sc, add( and( fslot, 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00 ), and(mload(mc), mask) ) ) for { mc := add(mc, 0x20) sc := add(sc, 1) } lt(mc, end) { sc := add(sc, 1) mc := add(mc, 0x20) } { sstore(sc, mload(mc)) } mask := exp(0x100, sub(mc, end)) sstore(sc, mul(div(mload(mc), mask), mask)) } default { // get the keccak hash to get the contents of the array mstore(0x0, _preBytes.slot) // Start copying to the last used word of the stored array. let sc := add(keccak256(0x0, 0x20), div(slength, 32)) // save new length sstore(_preBytes.slot, add(mul(newlength, 2), 1)) // Copy over the first `submod` bytes of the new data as in // case 1 above. let slengthmod := mod(slength, 32) let mlengthmod := mod(mlength, 32) let submod := sub(32, slengthmod) let mc := add(_postBytes, submod) let end := add(_postBytes, mlength) let mask := sub(exp(0x100, submod), 1) sstore(sc, add(sload(sc), and(mload(mc), mask))) for { sc := add(sc, 1) mc := add(mc, 0x20) } lt(mc, end) { sc := add(sc, 1) mc := add(mc, 0x20) } { sstore(sc, mload(mc)) } mask := exp(0x100, sub(mc, end)) sstore(sc, mul(div(mload(mc), mask), mask)) } } } function slice( bytes memory _bytes, uint256 _start, uint256 _length ) internal pure returns (bytes memory) { require(_length + 31 >= _length, "slice_overflow"); require(_bytes.length >= _start + _length, "slice_outOfBounds"); bytes memory tempBytes; assembly { switch iszero(_length) case 0 { // Get a location of some free memory and store it in tempBytes as // Solidity does for memory variables. tempBytes := mload(0x40) // The first word of the slice result is potentially a partial // word read from the original array. To read it, we calculate // the length of that partial word and start copying that many // bytes into the array. The first word we copy will start with // data we don't care about, but the last `lengthmod` bytes will // land at the beginning of the contents of the new array. When // we're done copying, we overwrite the full first word with // the actual length of the slice. let lengthmod := and(_length, 31) // The multiplication in the next line is necessary // because when slicing multiples of 32 bytes (lengthmod == 0) // the following copy loop was copying the origin's length // and then ending prematurely not copying everything it should. let mc := add(add(tempBytes, lengthmod), mul(0x20, iszero(lengthmod))) let end := add(mc, _length) for { // The multiplication in the next line has the same exact purpose // as the one above. let cc := add(add(add(_bytes, lengthmod), mul(0x20, iszero(lengthmod))), _start) } lt(mc, end) { mc := add(mc, 0x20) cc := add(cc, 0x20) } { mstore(mc, mload(cc)) } mstore(tempBytes, _length) //update free-memory pointer //allocating the array padded to 32 bytes like the compiler does now mstore(0x40, and(add(mc, 31), not(31))) } //if we want a zero-length slice let's just return a zero-length array default { tempBytes := mload(0x40) //zero out the 32 bytes slice we are about to return //we need to do it because Solidity does not garbage collect mstore(tempBytes, 0) mstore(0x40, add(tempBytes, 0x20)) } } return tempBytes; } function toAddress(bytes memory _bytes, uint256 _start) internal pure returns (address) { require(_bytes.length >= _start + 20, "toAddress_outOfBounds"); address tempAddress; assembly { tempAddress := div(mload(add(add(_bytes, 0x20), _start)), 0x1000000000000000000000000) } return tempAddress; } function toUint8(bytes memory _bytes, uint256 _start) internal pure returns (uint8) { require(_bytes.length >= _start + 1 , "toUint8_outOfBounds"); uint8 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x1), _start)) } return tempUint; } function toUint16(bytes memory _bytes, uint256 _start) internal pure returns (uint16) { require(_bytes.length >= _start + 2, "toUint16_outOfBounds"); uint16 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x2), _start)) } return tempUint; } function toUint32(bytes memory _bytes, uint256 _start) internal pure returns (uint32) { require(_bytes.length >= _start + 4, "toUint32_outOfBounds"); uint32 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x4), _start)) } return tempUint; } function toUint64(bytes memory _bytes, uint256 _start) internal pure returns (uint64) { require(_bytes.length >= _start + 8, "toUint64_outOfBounds"); uint64 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x8), _start)) } return tempUint; } function toUint96(bytes memory _bytes, uint256 _start) internal pure returns (uint96) { require(_bytes.length >= _start + 12, "toUint96_outOfBounds"); uint96 tempUint; assembly { tempUint := mload(add(add(_bytes, 0xc), _start)) } return tempUint; } function toUint128(bytes memory _bytes, uint256 _start) internal pure returns (uint128) { require(_bytes.length >= _start + 16, "toUint128_outOfBounds"); uint128 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x10), _start)) } return tempUint; } function toUint256(bytes memory _bytes, uint256 _start) internal pure returns (uint256) { require(_bytes.length >= _start + 32, "toUint256_outOfBounds"); uint256 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x20), _start)) } return tempUint; } function toBytes32(bytes memory _bytes, uint256 _start) internal pure returns (bytes32) { require(_bytes.length >= _start + 32, "toBytes32_outOfBounds"); bytes32 tempBytes32; assembly { tempBytes32 := mload(add(add(_bytes, 0x20), _start)) } return tempBytes32; } function equal(bytes memory _preBytes, bytes memory _postBytes) internal pure returns (bool) { bool success = true; assembly { let length := mload(_preBytes) // if lengths don't match the arrays are not equal switch eq(length, mload(_postBytes)) case 1 { // cb is a circuit breaker in the for loop since there's // no said feature for inline assembly loops // cb = 1 - don't breaker // cb = 0 - break let cb := 1 let mc := add(_preBytes, 0x20) let end := add(mc, length) for { let cc := add(_postBytes, 0x20) // the next line is the loop condition: // while(uint256(mc < end) + cb == 2) } eq(add(lt(mc, end), cb), 2) { mc := add(mc, 0x20) cc := add(cc, 0x20) } { // if any of these checks fails then arrays are not equal if iszero(eq(mload(mc), mload(cc))) { // unsuccess: success := 0 cb := 0 } } } default { // unsuccess: success := 0 } } return success; } function equalStorage( bytes storage _preBytes, bytes memory _postBytes ) internal view returns (bool) { bool success = true; assembly { // we know _preBytes_offset is 0 let fslot := sload(_preBytes.slot) // Decode the length of the stored array like in concatStorage(). let slength := div(and(fslot, sub(mul(0x100, iszero(and(fslot, 1))), 1)), 2) let mlength := mload(_postBytes) // if lengths don't match the arrays are not equal switch eq(slength, mlength) case 1 { // slength can contain both the length and contents of the array // if length < 32 bytes so let's prepare for that // v. http://solidity.readthedocs.io/en/latest/miscellaneous.html#layout-of-state-variables-in-storage if iszero(iszero(slength)) { switch lt(slength, 32) case 1 { // blank the last byte which is the length fslot := mul(div(fslot, 0x100), 0x100) if iszero(eq(fslot, mload(add(_postBytes, 0x20)))) { // unsuccess: success := 0 } } default { // cb is a circuit breaker in the for loop since there's // no said feature for inline assembly loops // cb = 1 - don't breaker // cb = 0 - break let cb := 1 // get the keccak hash to get the contents of the array mstore(0x0, _preBytes.slot) let sc := keccak256(0x0, 0x20) let mc := add(_postBytes, 0x20) let end := add(mc, mlength) // the next line is the loop condition: // while(uint256(mc < end) + cb == 2) for {} eq(add(lt(mc, end), cb), 2) { sc := add(sc, 1) mc := add(mc, 0x20) } { if iszero(eq(sload(sc), mload(mc))) { // unsuccess: success := 0 cb := 0 } } } } } default { // unsuccess: success := 0 } } return success; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; interface IOperatorFilterRegistry { /** * @notice Returns true if operator is not filtered for a given token, either by address or codeHash. Also returns * true if supplied registrant address is not registered. */ function isOperatorAllowed(address registrant, address operator) external view returns (bool); /** * @notice Registers an address with the registry. May be called by address itself or by EIP-173 owner. */ function register(address registrant) external; /** * @notice Registers an address with the registry and "subscribes" to another address's filtered operators and codeHashes. */ function registerAndSubscribe(address registrant, address subscription) external; /** * @notice Registers an address with the registry and copies the filtered operators and codeHashes from another * address without subscribing. */ function registerAndCopyEntries(address registrant, address registrantToCopy) external; /** * @notice Unregisters an address with the registry and removes its subscription. May be called by address itself or by EIP-173 owner. * Note that this does not remove any filtered addresses or codeHashes. * Also note that any subscriptions to this registrant will still be active and follow the existing filtered addresses and codehashes. */ function unregister(address addr) external; /** * @notice Update an operator address for a registered address - when filtered is true, the operator is filtered. */ function updateOperator(address registrant, address operator, bool filtered) external; /** * @notice Update multiple operators for a registered address - when filtered is true, the operators will be filtered. Reverts on duplicates. */ function updateOperators(address registrant, address[] calldata operators, bool filtered) external; /** * @notice Update a codeHash for a registered address - when filtered is true, the codeHash is filtered. */ function updateCodeHash(address registrant, bytes32 codehash, bool filtered) external; /** * @notice Update multiple codeHashes for a registered address - when filtered is true, the codeHashes will be filtered. Reverts on duplicates. */ function updateCodeHashes(address registrant, bytes32[] calldata codeHashes, bool filtered) external; /** * @notice Subscribe an address to another registrant's filtered operators and codeHashes. Will remove previous * subscription if present. * Note that accounts with subscriptions may go on to subscribe to other accounts - in this case, * subscriptions will not be forwarded. Instead the former subscription's existing entries will still be * used. */ function subscribe(address registrant, address registrantToSubscribe) external; /** * @notice Unsubscribe an address from its current subscribed registrant, and optionally copy its filtered operators and codeHashes. */ function unsubscribe(address registrant, bool copyExistingEntries) external; /** * @notice Get the subscription address of a given registrant, if any. */ function subscriptionOf(address addr) external returns (address registrant); /** * @notice Get the set of addresses subscribed to a given registrant. * Note that order is not guaranteed as updates are made. */ function subscribers(address registrant) external returns (address[] memory); /** * @notice Get the subscriber at a given index in the set of addresses subscribed to a given registrant. * Note that order is not guaranteed as updates are made. */ function subscriberAt(address registrant, uint256 index) external returns (address); /** * @notice Copy filtered operators and codeHashes from a different registrantToCopy to addr. */ function copyEntriesOf(address registrant, address registrantToCopy) external; /** * @notice Returns true if operator is filtered by a given address or its subscription. */ function isOperatorFiltered(address registrant, address operator) external returns (bool); /** * @notice Returns true if the hash of an address's code is filtered by a given address or its subscription. */ function isCodeHashOfFiltered(address registrant, address operatorWithCode) external returns (bool); /** * @notice Returns true if a codeHash is filtered by a given address or its subscription. */ function isCodeHashFiltered(address registrant, bytes32 codeHash) external returns (bool); /** * @notice Returns a list of filtered operators for a given address or its subscription. */ function filteredOperators(address addr) external returns (address[] memory); /** * @notice Returns the set of filtered codeHashes for a given address or its subscription. * Note that order is not guaranteed as updates are made. */ function filteredCodeHashes(address addr) external returns (bytes32[] memory); /** * @notice Returns the filtered operator at the given index of the set of filtered operators for a given address or * its subscription. * Note that order is not guaranteed as updates are made. */ function filteredOperatorAt(address registrant, uint256 index) external returns (address); /** * @notice Returns the filtered codeHash at the given index of the list of filtered codeHashes for a given address or * its subscription. * Note that order is not guaranteed as updates are made. */ function filteredCodeHashAt(address registrant, uint256 index) external returns (bytes32); /** * @notice Returns true if an address has registered */ function isRegistered(address addr) external returns (bool); /** * @dev Convenience method to compute the code hash of an arbitrary contract */ function codeHashOf(address addr) external returns (bytes32); }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.4; /** * @author emo.eth * @notice Abstract smart contract that provides an onlyUninitialized modifier which only allows calling when * from within a constructor of some sort, whether directly instantiating an inherting contract, * or when delegatecalling from a proxy */ abstract contract ConstructorInitializable { error AlreadyInitialized(); modifier onlyConstructor() { if (address(this).code.length != 0) { revert AlreadyInitialized(); } _; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; import { AllowListData, CreatorPayout } from "./SeaDropStructs.sol"; /** * @notice A struct defining public drop data. * Designed to fit efficiently in two storage slots. * * @param startPrice The start price per token. (Up to 1.2m * of native token, e.g. ETH, MATIC) * @param endPrice The end price per token. If this differs * from startPrice, the current price will * be calculated based on the current time. * @param startTime The start time, ensure this is not zero. * @param endTime The end time, ensure this is not zero. * @param paymentToken The payment token address. Null for * native token. * @param maxTotalMintableByWallet Maximum total number of mints a user is * allowed. (The limit for this field is * 2^16 - 1) * @param feeBps Fee out of 10_000 basis points to be * collected. * @param restrictFeeRecipients If false, allow any fee recipient; * if true, check fee recipient is allowed. */ struct PublicDrop { uint80 startPrice; // 80/512 bits uint80 endPrice; // 160/512 bits uint40 startTime; // 200/512 bits uint40 endTime; // 240/512 bits address paymentToken; // 400/512 bits uint16 maxTotalMintableByWallet; // 416/512 bits uint16 feeBps; // 432/512 bits bool restrictFeeRecipients; // 440/512 bits } /** * @notice A struct defining mint params for an allow list. * An allow list leaf will be composed of `msg.sender` and * the following params. * * Note: Since feeBps is encoded in the leaf, backend should ensure * that feeBps is acceptable before generating a proof. * * @param startPrice The start price per token. (Up to 1.2m * of native token, e.g. ETH, MATIC) * @param endPrice The end price per token. If this differs * from startPrice, the current price will * be calculated based on the current time. * @param startTime The start time, ensure this is not zero. * @param endTime The end time, ensure this is not zero. * @param paymentToken The payment token for the mint. Null for * native token. * @param maxTotalMintableByWallet Maximum total number of mints a user is * allowed. * @param maxTokenSupplyForStage The limit of token supply this stage can * mint within. * @param dropStageIndex The drop stage index to emit with the event * for analytical purposes. This should be * non-zero since the public mint emits with * index zero. * @param feeBps Fee out of 10_000 basis points to be * collected. * @param restrictFeeRecipients If false, allow any fee recipient; * if true, check fee recipient is allowed. */ struct MintParams { uint256 startPrice; uint256 endPrice; uint256 startTime; uint256 endTime; address paymentToken; uint256 maxTotalMintableByWallet; uint256 maxTokenSupplyForStage; uint256 dropStageIndex; // non-zero uint256 feeBps; bool restrictFeeRecipients; } /** * @dev Struct containing internal SeaDrop implementation logic * mint details to avoid stack too deep. * * @param feeRecipient The fee recipient. * @param payer The payer of the mint. * @param minter The mint recipient. * @param quantity The number of tokens to mint. * @param withEffects Whether to apply state changes of the mint. */ struct MintDetails { address feeRecipient; address payer; address minter; uint256 quantity; bool withEffects; } /** * @notice A struct to configure multiple contract options in one transaction. */ struct MultiConfigureStruct { uint256 maxSupply; string baseURI; string contractURI; PublicDrop publicDrop; string dropURI; AllowListData allowListData; CreatorPayout[] creatorPayouts; bytes32 provenanceHash; address[] allowedFeeRecipients; address[] disallowedFeeRecipients; address[] allowedPayers; address[] disallowedPayers; // Server-signed address[] allowedSigners; address[] disallowedSigners; // ERC-2981 address royaltyReceiver; uint96 royaltyBps; }
{ "remappings": [ "@openzeppelin-upgradeable/contracts/=lib/openzeppelin-contracts-upgradeable/contracts/", "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/", "@rari-capital/solmate/=lib/seaport/lib/solmate/", "ERC721A-Upgradeable/=lib/ERC721A-Upgradeable/contracts/", "ERC721A/=lib/ERC721A/contracts/", "create2-scripts/=lib/create2-helpers/script/", "ds-test/=lib/forge-std/lib/ds-test/src/", "forge-std/=lib/forge-std/src/", "murky/=lib/murky/src/", "operator-filter-registry/=lib/operator-filter-registry/src/", "seadrop/=src/", "seaport-core/=lib/seaport/lib/seaport-core/", "seaport-sol/=lib/seaport/lib/seaport-sol/", "seaport-test-utils/=lib/seaport/test/foundry/utils/", "seaport-types/=lib/seaport/lib/seaport-types/", "solady/=lib/solady/", "utility-contracts/=lib/utility-contracts/src/" ], "optimizer": { "enabled": true, "runs": 1 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "none", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "paris", "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"allowedConfigurer","type":"address"},{"internalType":"address","name":"allowedConduit","type":"address"},{"internalType":"address","name":"allowedSeaport","type":"address"},{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AccountBalanceOverflow","type":"error"},{"inputs":[],"name":"AllowedSeaportCannotBeZeroAddress","type":"error"},{"inputs":[],"name":"AlreadyInitialized","type":"error"},{"inputs":[],"name":"ArrayLengthsMismatch","type":"error"},{"inputs":[{"internalType":"uint256","name":"got","type":"uint256"}],"name":"CannotExceedMaxSupplyOfUint64","type":"error"},{"inputs":[],"name":"Cassette_AlreadySetup","type":"error"},{"inputs":[],"name":"Cassette_ExceedsMaxPage","type":"error"},{"inputs":[],"name":"Cassette_InvalidSendData","type":"error"},{"inputs":[],"name":"Cassette_NotAllowed","type":"error"},{"inputs":[],"name":"Cassette_ValueOutOfRange","type":"error"},{"inputs":[],"name":"CreatorPayoutAddressCannotBeZeroAddress","type":"error"},{"inputs":[],"name":"CreatorPayoutBasisPointsCannotBeZero","type":"error"},{"inputs":[],"name":"CreatorPayoutsNotSet","type":"error"},{"inputs":[],"name":"DuplicateFeeRecipient","type":"error"},{"inputs":[],"name":"DuplicatePayer","type":"error"},{"inputs":[],"name":"DuplicateSigner","type":"error"},{"inputs":[],"name":"FeeRecipientCannotBeZeroAddress","type":"error"},{"inputs":[{"internalType":"address","name":"got","type":"address"}],"name":"FeeRecipientNotAllowed","type":"error"},{"inputs":[],"name":"FeeRecipientNotPresent","type":"error"},{"inputs":[],"name":"InsufficientBalance","type":"error"},{"inputs":[{"internalType":"address","name":"caller","type":"address"}],"name":"InvalidCallerOnlyAllowedSeaport","type":"error"},{"inputs":[{"internalType":"uint256","name":"totalReceivedBasisPoints","type":"uint256"}],"name":"InvalidCreatorPayoutBasisPoints","type":"error"},{"inputs":[{"internalType":"uint256","name":"totalReceivedBasisPoints","type":"uint256"}],"name":"InvalidCreatorPayoutTotalBasisPoints","type":"error"},{"inputs":[{"internalType":"uint8","name":"version","type":"uint8"}],"name":"InvalidExtraDataEncoding","type":"error"},{"inputs":[{"internalType":"uint256","name":"feeBps","type":"uint256"}],"name":"InvalidFeeBps","type":"error"},{"inputs":[{"internalType":"uint256","name":"fromTokenId","type":"uint256"},{"internalType":"uint256","name":"toTokenId","type":"uint256"}],"name":"InvalidFromAndToTokenId","type":"error"},{"inputs":[],"name":"InvalidProof","type":"error"},{"inputs":[{"internalType":"uint256","name":"got","type":"uint256"},{"internalType":"uint256","name":"maximum","type":"uint256"}],"name":"InvalidSignedEndTime","type":"error"},{"inputs":[{"internalType":"uint256","name":"got","type":"uint256"},{"internalType":"uint256","name":"minimumOrMaximum","type":"uint256"}],"name":"InvalidSignedFeeBps","type":"error"},{"inputs":[{"internalType":"uint256","name":"got","type":"uint256"},{"internalType":"uint256","name":"minimum","type":"uint256"}],"name":"InvalidSignedFromTokenId","type":"error"},{"inputs":[{"internalType":"uint256","name":"got","type":"uint256"},{"internalType":"uint256","name":"maximum","type":"uint256"}],"name":"InvalidSignedMaxTokenSupplyForStage","type":"error"},{"inputs":[{"internalType":"uint256","name":"got","type":"uint256"},{"internalType":"uint256","name":"maximum","type":"uint256"}],"name":"InvalidSignedMaxTotalMintableByWallet","type":"error"},{"inputs":[{"internalType":"uint256","name":"got","type":"uint256"},{"internalType":"uint256","name":"maximum","type":"uint256"}],"name":"InvalidSignedMaxTotalMintableByWalletPerToken","type":"error"},{"inputs":[{"internalType":"address","name":"paymentToken","type":"address"},{"internalType":"uint256","name":"got","type":"uint256"},{"internalType":"uint256","name":"minimum","type":"uint256"}],"name":"InvalidSignedMintPrice","type":"error"},{"inputs":[{"internalType":"address","name":"got","type":"address"},{"internalType":"address","name":"want","type":"address"}],"name":"InvalidSignedPaymentToken","type":"error"},{"inputs":[{"internalType":"uint256","name":"got","type":"uint256"},{"internalType":"uint256","name":"minimum","type":"uint256"}],"name":"InvalidSignedStartTime","type":"error"},{"inputs":[{"internalType":"uint256","name":"got","type":"uint256"},{"internalType":"uint256","name":"maximum","type":"uint256"}],"name":"InvalidSignedToTokenId","type":"error"},{"inputs":[{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"endTime","type":"uint256"}],"name":"InvalidStartAndEndTime","type":"error"},{"inputs":[{"internalType":"uint8","name":"substandard","type":"uint8"}],"name":"InvalidSubstandard","type":"error"},{"inputs":[],"name":"MaxSupplyMismatch","type":"error"},{"inputs":[{"internalType":"uint256","name":"total","type":"uint256"},{"internalType":"uint256","name":"maxSupply","type":"uint256"}],"name":"MintExceedsMaxSupply","type":"error"},{"inputs":[{"internalType":"uint256","name":"total","type":"uint256"},{"internalType":"uint256","name":"allowed","type":"uint256"}],"name":"MintQuantityExceedsMaxMintedPerWallet","type":"error"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"total","type":"uint256"},{"internalType":"uint256","name":"allowed","type":"uint256"}],"name":"MintQuantityExceedsMaxMintedPerWalletForTokenId","type":"error"},{"inputs":[{"internalType":"uint256","name":"total","type":"uint256"},{"internalType":"uint256","name":"maxSupply","type":"uint256"}],"name":"MintQuantityExceedsMaxSupply","type":"error"},{"inputs":[{"internalType":"uint256","name":"total","type":"uint256"},{"internalType":"uint256","name":"maxTokenSupplyForStage","type":"uint256"}],"name":"MintQuantityExceedsMaxTokenSupplyForStage","type":"error"},{"inputs":[],"name":"MustSpecifyERC1155ConsiderationItemForSeaDropMint","type":"error"},{"inputs":[],"name":"NewOwnerIsZeroAddress","type":"error"},{"inputs":[],"name":"NoBalanceToWithdraw","type":"error"},{"inputs":[{"internalType":"uint256","name":"currentTimestamp","type":"uint256"},{"internalType":"uint256","name":"startTimestamp","type":"uint256"},{"internalType":"uint256","name":"endTimestamp","type":"uint256"}],"name":"NotActive","type":"error"},{"inputs":[],"name":"NotNextOwner","type":"error"},{"inputs":[],"name":"NotOwnerNorApproved","type":"error"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"OfferContainsDuplicateTokenId","type":"error"},{"inputs":[],"name":"OnlyDelegateCalled","type":"error"},{"inputs":[],"name":"OnlyOwner","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"OperatorNotAllowed","type":"error"},{"inputs":[],"name":"PayerCannotBeZeroAddress","type":"error"},{"inputs":[{"internalType":"address","name":"got","type":"address"}],"name":"PayerNotAllowed","type":"error"},{"inputs":[],"name":"PayerNotPresent","type":"error"},{"inputs":[],"name":"ProvenanceHashCannotBeSetAfterAlreadyBeingSet","type":"error"},{"inputs":[],"name":"ProvenanceHashCannotBeSetAfterMintStarted","type":"error"},{"inputs":[],"name":"PublicDropStageNotPresent","type":"error"},{"inputs":[],"name":"PublicDropsMismatch","type":"error"},{"inputs":[],"name":"RoyaltyOverflow","type":"error"},{"inputs":[],"name":"RoyaltyReceiverIsZeroAddress","type":"error"},{"inputs":[],"name":"SignatureAlreadyUsed","type":"error"},{"inputs":[],"name":"SignedMintsMustRestrictFeeRecipients","type":"error"},{"inputs":[],"name":"SignerCannotBeZeroAddress","type":"error"},{"inputs":[],"name":"SignerNotPresent","type":"error"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"startTokenId","type":"uint256"},{"internalType":"uint256","name":"endTokenId","type":"uint256"}],"name":"TokenIdNotWithinDropStageRange","type":"error"},{"inputs":[],"name":"TransferToNonERC1155ReceiverImplementer","type":"error"},{"inputs":[],"name":"TransferToZeroAddress","type":"error"},{"inputs":[{"internalType":"uint8","name":"version","type":"uint8"}],"name":"UnsupportedExtraDataVersion","type":"error"},{"inputs":[{"internalType":"bytes4","name":"selector","type":"bytes4"}],"name":"UnsupportedFunctionSelector","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"previousMerkleRoot","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newMerkleRoot","type":"bytes32"},{"indexed":false,"internalType":"string[]","name":"publicKeyURI","type":"string[]"},{"indexed":false,"internalType":"string","name":"allowListURI","type":"string"}],"name":"AllowListUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"feeRecipient","type":"address"},{"indexed":true,"internalType":"bool","name":"allowed","type":"bool"}],"name":"AllowedFeeRecipientUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address[]","name":"allowedSeaport","type":"address[]"}],"name":"AllowedSeaportUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"isApproved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_fromTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_toTokenId","type":"uint256"}],"name":"BatchMetadataUpdate","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"newContractURI","type":"string"}],"name":"ContractURIUpdated","type":"event"},{"anonymous":false,"inputs":[{"components":[{"internalType":"address","name":"payoutAddress","type":"address"},{"internalType":"uint16","name":"basisPoints","type":"uint16"}],"indexed":false,"internalType":"struct CreatorPayout[]","name":"creatorPayouts","type":"tuple[]"}],"name":"CreatorPayoutsUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"newDropURI","type":"string"}],"name":"DropURIUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newMaxSupply","type":"uint256"}],"name":"MaxSupplyUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"indexed":false,"internalType":"bytes","name":"_srcAddress","type":"bytes"},{"indexed":false,"internalType":"uint64","name":"_nonce","type":"uint64"},{"indexed":false,"internalType":"bytes","name":"_payload","type":"bytes"},{"indexed":false,"internalType":"bytes","name":"_reason","type":"bytes"}],"name":"MessageFailed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"payer","type":"address"},{"indexed":true,"internalType":"bool","name":"allowed","type":"bool"}],"name":"PayerUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newPotentialAdministrator","type":"address"}],"name":"PotentialOwnerUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"previousHash","type":"bytes32"},{"indexed":false,"internalType":"bytes32","name":"newHash","type":"bytes32"}],"name":"ProvenanceHashUpdated","type":"event"},{"anonymous":false,"inputs":[{"components":[{"internalType":"uint80","name":"startPrice","type":"uint80"},{"internalType":"uint80","name":"endPrice","type":"uint80"},{"internalType":"uint40","name":"startTime","type":"uint40"},{"internalType":"uint40","name":"endTime","type":"uint40"},{"internalType":"bool","name":"restrictFeeRecipients","type":"bool"},{"internalType":"address","name":"paymentToken","type":"address"},{"internalType":"uint24","name":"fromTokenId","type":"uint24"},{"internalType":"uint24","name":"toTokenId","type":"uint24"},{"internalType":"uint16","name":"maxTotalMintableByWallet","type":"uint16"},{"internalType":"uint16","name":"maxTotalMintableByWalletPerToken","type":"uint16"},{"internalType":"uint16","name":"feeBps","type":"uint16"}],"indexed":false,"internalType":"struct PublicDrop","name":"publicDrop","type":"tuple"},{"indexed":false,"internalType":"uint256","name":"index","type":"uint256"}],"name":"PublicDropUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"indexed":true,"internalType":"bytes","name":"_srcAddress","type":"bytes"},{"indexed":true,"internalType":"address","name":"_toAddress","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"},{"indexed":false,"internalType":"uint256[]","name":"_amounts","type":"uint256[]"}],"name":"ReceiveBatchFromChain","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"indexed":true,"internalType":"bytes","name":"_srcAddress","type":"bytes"},{"indexed":true,"internalType":"address","name":"_toAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"_tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"ReceiveFromChain","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"indexed":false,"internalType":"bytes","name":"_srcAddress","type":"bytes"},{"indexed":false,"internalType":"uint64","name":"_nonce","type":"uint64"},{"indexed":false,"internalType":"bytes32","name":"_payloadHash","type":"bytes32"}],"name":"RetryMessageSuccess","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"basisPoints","type":"uint256"}],"name":"RoyaltyInfoUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"payer","type":"address"},{"indexed":false,"internalType":"uint256","name":"dropStageIndex","type":"uint256"}],"name":"SeaDropMint","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"enum SeaDropErrorsAndEvents.SEADROP_TOKEN_TYPE","name":"tokenType","type":"uint8"}],"name":"SeaDropTokenDeployed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"indexed":true,"internalType":"address","name":"_from","type":"address"},{"indexed":true,"internalType":"bytes","name":"_toAddress","type":"bytes"},{"indexed":false,"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"},{"indexed":false,"internalType":"uint256[]","name":"_amounts","type":"uint256[]"}],"name":"SendBatchToChain","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"indexed":true,"internalType":"address","name":"_from","type":"address"},{"indexed":true,"internalType":"bytes","name":"_toAddress","type":"bytes"},{"indexed":false,"internalType":"uint256","name":"_tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"SendToChain","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"indexed":false,"internalType":"uint16","name":"_type","type":"uint16"},{"indexed":false,"internalType":"uint256","name":"_minDstGas","type":"uint256"}],"name":"SetMinDstGas","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"precrime","type":"address"}],"name":"SetPrecrime","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"_remoteChainId","type":"uint16"},{"indexed":false,"internalType":"bytes","name":"_path","type":"bytes"}],"name":"SetTrustedRemote","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"_remoteChainId","type":"uint16"},{"indexed":false,"internalType":"bytes","name":"_remoteAddress","type":"bytes"}],"name":"SetTrustedRemoteAddress","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"_useCustomAdapterParams","type":"bool"}],"name":"SetUseCustomAdapterParams","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"signer","type":"address"},{"indexed":true,"internalType":"bool","name":"allowed","type":"bool"}],"name":"SignerUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"indexed":false,"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"name":"TransferBatch","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"TransferSingle","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"value","type":"string"},{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"}],"name":"URI","type":"event"},{"stateMutability":"nonpayable","type":"fallback"},{"inputs":[],"name":"CHAIN_OFFSET","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_PAYLOAD_SIZE_LIMIT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"FUNCTION_TYPE_BURN","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"FUNCTION_TYPE_SEND","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"FUNCTION_TYPE_SEND_BATCH","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_PAGE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"NO_EXTRA_GAS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"OPERATOR_FILTER_REGISTRY","outputs":[{"internalType":"contract IOperatorFilterRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TOTAL_CHAINS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"result","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"owners","type":"address[]"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"}],"name":"balanceOfBatch","outputs":[{"internalType":"uint256[]","name":"balances","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"balancesOf","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"},{"internalType":"uint256[]","name":"_amounts","type":"uint256[]"}],"name":"batchBurn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"bytes","name":"_toAddress","type":"bytes"},{"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"},{"internalType":"uint256[]","name":"_amounts","type":"uint256[]"},{"internalType":"address payable","name":"_refundAddress","type":"address"},{"internalType":"address","name":"_zroPaymentAddress","type":"address"},{"internalType":"bytes","name":"_adapterParams","type":"bytes"}],"name":"burnBatchFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"bytes","name":"_toAddress","type":"bytes"},{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"address payable","name":"_refundAddress","type":"address"},{"internalType":"address","name":"_zroPaymentAddress","type":"address"},{"internalType":"bytes","name":"_adapterParams","type":"bytes"}],"name":"burnFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"cancelOwnershipTransfer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"contractURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"currentMaxPage","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"fromTokenId","type":"uint256"},{"internalType":"uint256","name":"toTokenId","type":"uint256"}],"name":"emitBatchMetadataUpdate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_functionType","type":"uint16"},{"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"bytes","name":"_toAddress","type":"bytes"},{"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"},{"internalType":"uint256[]","name":"_amounts","type":"uint256[]"},{"internalType":"bool","name":"_useZro","type":"bool"},{"internalType":"bytes","name":"_adapterParams","type":"bytes"}],"name":"estimateBatchFee","outputs":[{"internalType":"uint256","name":"nativeFee","type":"uint256"},{"internalType":"uint256","name":"zroFee","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_functionType","type":"uint16"},{"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"bytes","name":"_toAddress","type":"bytes"},{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"bool","name":"_useZro","type":"bool"},{"internalType":"bytes","name":"_adapterParams","type":"bytes"}],"name":"estimateFee","outputs":[{"internalType":"uint256","name":"nativeFee","type":"uint256"},{"internalType":"uint256","name":"zroFee","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"bytes","name":"_toAddress","type":"bytes"},{"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"},{"internalType":"uint256[]","name":"_amounts","type":"uint256[]"},{"internalType":"bool","name":"_useZro","type":"bool"},{"internalType":"bytes","name":"_adapterParams","type":"bytes"}],"name":"estimateSendBatchFee","outputs":[{"internalType":"uint256","name":"nativeFee","type":"uint256"},{"internalType":"uint256","name":"zroFee","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"bytes","name":"_toAddress","type":"bytes"},{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"bool","name":"_useZro","type":"bool"},{"internalType":"bytes","name":"_adapterParams","type":"bytes"}],"name":"estimateSendFee","outputs":[{"internalType":"uint256","name":"nativeFee","type":"uint256"},{"internalType":"uint256","name":"zroFee","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"","type":"uint16"},{"internalType":"bytes","name":"","type":"bytes"},{"internalType":"uint64","name":"","type":"uint64"}],"name":"failedMessages","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"internalType":"bytes","name":"_srcAddress","type":"bytes"}],"name":"forceResumeReceive","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_version","type":"uint16"},{"internalType":"uint16","name":"_chainId","type":"uint16"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"_configType","type":"uint256"}],"name":"getConfig","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_remoteChainId","type":"uint16"}],"name":"getTrustedRemoteAddress","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"result","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isSetup","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"internalType":"bytes","name":"_srcAddress","type":"bytes"}],"name":"isTrustedRemote","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"kmart","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint32","name":"_amount","type":"uint32"},{"internalType":"address","name":"_to","type":"address"}],"name":"kmartRedeem","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"lzEndpoint","outputs":[{"internalType":"contract ILayerZeroEndpoint","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"internalType":"bytes","name":"_srcAddress","type":"bytes"},{"internalType":"uint64","name":"_nonce","type":"uint64"},{"internalType":"bytes","name":"_payload","type":"bytes"}],"name":"lzReceive","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"maxSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"","type":"uint16"},{"internalType":"uint16","name":"","type":"uint16"}],"name":"minDstGasLookup","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"internalType":"bytes","name":"_srcAddress","type":"bytes"},{"internalType":"uint64","name":"_nonce","type":"uint64"},{"internalType":"bytes","name":"_payload","type":"bytes"}],"name":"nonblockingLzReceive","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"page","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"","type":"uint16"}],"name":"payloadSizeLimitLookup","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"precrime","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"provenanceHash","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"replicator","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_page","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"replicatorMint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"internalType":"bytes","name":"_srcAddress","type":"bytes"},{"internalType":"uint64","name":"_nonce","type":"uint64"},{"internalType":"bytes","name":"_payload","type":"bytes"}],"name":"retryMessage","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"salePrice","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"royaltyAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeBatchTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"bytes","name":"_toAddress","type":"bytes"},{"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"},{"internalType":"uint256[]","name":"_amounts","type":"uint256[]"},{"internalType":"address payable","name":"_refundAddress","type":"address"},{"internalType":"address","name":"_zroPaymentAddress","type":"address"},{"internalType":"bytes","name":"_adapterParams","type":"bytes"}],"name":"sendBatchFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"bytes","name":"_toAddress","type":"bytes"},{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"address payable","name":"_refundAddress","type":"address"},{"internalType":"address","name":"_zroPaymentAddress","type":"address"},{"internalType":"bytes","name":"_adapterParams","type":"bytes"}],"name":"sendFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"newBaseURI","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_version","type":"uint16"},{"internalType":"uint16","name":"_chainId","type":"uint16"},{"internalType":"uint256","name":"_configType","type":"uint256"},{"internalType":"bytes","name":"_config","type":"bytes"}],"name":"setConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"newContractURI","type":"string"}],"name":"setContractURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_currentMaxPage","type":"uint256"}],"name":"setCurrentMaxPage","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint96","name":"feeNumerator","type":"uint96"}],"name":"setDefaultRoyalty","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_kmart","type":"address"}],"name":"setKmart","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"newMaxSupply","type":"uint256"}],"name":"setMaxSupply","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"uint16","name":"_packetType","type":"uint16"},{"internalType":"uint256","name":"_minGas","type":"uint256"}],"name":"setMinDstGas","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"uint256","name":"_size","type":"uint256"}],"name":"setPayloadSizeLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_precrime","type":"address"}],"name":"setPrecrime","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"newProvenanceHash","type":"bytes32"}],"name":"setProvenanceHash","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_version","type":"uint16"}],"name":"setReceiveVersion","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_replicator","type":"address"}],"name":"setReplicator","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_version","type":"uint16"}],"name":"setSendVersion","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_remoteChainId","type":"uint16"},{"internalType":"bytes","name":"_path","type":"bytes"}],"name":"setTrustedRemote","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_remoteChainId","type":"uint16"},{"internalType":"bytes","name":"_remoteAddress","type":"bytes"}],"name":"setTrustedRemoteAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_useCustomAdapterParams","type":"bool"}],"name":"setUseCustomAdapterParams","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"kmart","type":"address"},{"internalType":"address","name":"lzEndpoint","type":"address"},{"internalType":"uint256","name":"maxPage","type":"uint256"},{"internalType":"uint256","name":"totalChains","type":"uint256"},{"internalType":"uint256","name":"chainOffset","type":"uint256"}],"internalType":"struct Cassette.Setup","name":"_setup","type":"tuple"}],"name":"setup","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_page","type":"uint256"}],"name":"tokenId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"totalMinted","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalMinted","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newPotentialOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"","type":"uint16"}],"name":"trustedRemoteLookup","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"uri","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"useCustomAdapterParams","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]
Deployed Bytecode
0x6080604052600436106103ad5760003560e01c80621d356714610942578062fdd58e1461096457806301ffc9a71461099757806304634d8d146109c7578063067d6690146109e757806306fdde0314610a0757806307e0db1714610a29578063099b6bfa14610a495780630df3748314610a695780630e89341c14610a8957806310ddb13714610aa9578063149e3e1f14610ac957806318b6592814610af15780631dc2f75014610b0457806323452b9c14610b325780632447469f14610b475780632a55205a14610b5d5780632eb2c2d614610b9c57806337da577c14610bbc5780633d8b38f614610bdc5780633f1f4fa414610bfc57806341f4343414610c2957806342d65a8d14610c585780634477051514610c785780634ab4e68714610c8d5780634db8226a14610ca05780634e1273f414610cb35780634f5c83d414610ce057806355f804b314610d005780635b13db6814610d205780635b8c41e614610d335780636392a51f14610d8257806366ad5c8a14610da257806369fc09b914610dc25780636c0360eb14610dd8578063715018a614610ded57806374b6e8fd14610e025780637533d78814610e2257806378600a4f14610e4257806379ba509714610e5c5780637cfa1b4514610e715780637dcb0e5f14610e915780638608e5f814610eb1578063869f759414610ed15780638cfd8f5c14610f075780638da5cb5b14610f3f578063938e3d7b14610f54578063950c8a7414610f7457806395d89b4114610f945780639d7f4ebf14610fa95780639f38369a14610fe6578063a22cb46514611006578063a2309ff814611026578063a48301141461103c578063a6c3d1651461105c578063af3fb21c1461107c578063b253566314611091578063b2fcf6c8146110b1578063b353aaa7146110c4578063b90ad5ac146110e4578063b94bac3314611104578063baf3292d14611124578063bd85b03914611144578063c446183414611181578063c6ab67a314611197578063cbed8b9c146111ac578063d1deba1f146111cc578063d74855ac146111df578063df2a5b3b146111f2578063e8a3d48514611212578063e985e9c514611227578063eab45d9c14611247578063eb8d72b714611267578063ed629c5c14611287578063ee617261146112a1578063f242432a146112b4578063f2fde38b146112d4578063f5298aca146112f4578063f5ecbdbc14611314578063f6eb127a14611334578063f86a66fa14611354578063fa07974d1461136a578063fd8177ab1461138c578063ff565ba41461139f575b3480156103b957600080fd5b5060003660606001600160e01b031983351682846103da8260048184614740565b909250905060006001600160e01b03198416630d574a0360e31b148061041057506001600160e01b0319841663b957d0cb60e01b145b8061042b57506001600160e01b0319841663ebb4a55f60e01b145b8061044657506001600160e01b031984166307b37ee360e21b145b8061046157506001600160e01b03198416633f952e6560e11b145b8061047c57506001600160e01b03198416638e7d1e4360e01b145b8061049757506001600160e01b0319841663f460590b60e01b145b806104b257506001600160e01b031984166334f60ed560e11b145b806104cd57506001600160e01b0319841663582d424160e01b145b806104e857506001600160e01b03198416639891976560e01b145b8061050357506001600160e01b03198416630b9de3bf60e21b145b8061051e57506001600160e01b0319841663e6fd04ff60e01b145b8061053957506001600160e01b03198416632a48daf160e21b145b8061055357506001600160e01b03198416621bc51d60e11b145b8061056e57506001600160e01b03198416633119b8cb60e11b145b8061058957506001600160e01b031984166382daf2a160e01b145b806105a457506001600160e01b03198416633567fc7f60e21b145b806105bf57506001600160e01b03198416634a67bcaf60e11b145b806105da57506001600160e01b03198416633f79b95560e21b145b806105f557506001600160e01b0319841663020abae160e31b145b905060006001600160e01b03198516630d574a0360e31b148061062857506001600160e01b0319851663b957d0cb60e01b145b8061064357506001600160e01b0319851663ebb4a55f60e01b145b8061065e57506001600160e01b031985166307b37ee360e21b145b8061067957506001600160e01b03198516633f952e6560e11b145b8061069457506001600160e01b03198516638e7d1e4360e01b145b806106af57506001600160e01b031985166334f60ed560e11b145b905081156108165780156106ca576106c56113b5565b610756565b630b9fa6f560e01b6001600160e01b03198616016107565760006106f26020600c8688614740565b6106fb9161476a565b60601c905033811415806107475750336001600160a01b0382161480156107475750610725611427565b6001600160a01b0382166000908152600891909101602052604090205460ff16155b15610754576107546113b5565b505b6000807f00000000000000000000000091e22959b25e7de78877bfce471af5f7343b81216001600160a01b031660003660405161079492919061479a565b600060405180830381855af49150503d80600081146107cf576040519150601f19603f3d011682016040523d82523d6000602084013e6107d4565b606091505b5091509150816107e657805181602001fd5b63676e689b60e01b6001600160e01b031988160161080857610808868661145b565b965061093795505050505050565b63e3f34ec760e01b6001600160e01b03198616016108e75760008061083d858701876147cf565b9150915060008060008061089f86866000818152600960209081526040808320546001600160a01b039095168352600a825280832054600b835281842094845293909152902054909290916001600160401b03600160801b8204811692911690565b6040805160208101959095528481019390935260608401919091526080808401919091528151808403909101815260a090920190529b506109379a5050505050505050505050565b630591369960e11b6001600160e01b031986160161090d5763f4dd92ce6000526020601cf35b6040516367fe1ffb60e01b81526001600160e01b0319861660048201526024015b60405180910390fd5b915050805190602001f35b34801561094e57600080fd5b5061096261095d366004614875565b6115c4565b005b34801561097057600080fd5b5061098461097f3660046147cf565b6117db565b6040519081526020015b60405180910390f35b3480156109a357600080fd5b506109b76109b236600461490a565b6117fa565b604051901515815260200161098e565b3480156109d357600080fd5b506109626109e2366004614934565b611814565b3480156109f357600080fd5b50610962610a02366004614979565b611875565b348015610a1357600080fd5b50610a1c6118b7565b60405161098e9190614a14565b348015610a3557600080fd5b50610962610a44366004614a27565b611949565b348015610a5557600080fd5b50610962610a64366004614a44565b6119b6565b348015610a7557600080fd5b50610962610a84366004614a5d565b611a17565b348015610a9557600080fd5b50610a1c610aa4366004614a44565b611a36565b348015610ab557600080fd5b50610962610ac4366004614a27565b611aca565b348015610ad557600080fd5b50610ade600281565b60405161ffff909116815260200161098e565b610962610aff366004614a7b565b611b06565b348015610b1057600080fd5b50610b24610b1f366004614c25565b611b30565b60405161098e929190614d03565b348015610b3e57600080fd5b50610962611be4565b348015610b5357600080fd5b5061098460135481565b348015610b6957600080fd5b50610b7d610b78366004614d11565b611c25565b604080516001600160a01b03909316835260208301919091520161098e565b348015610ba857600080fd5b50610962610bb7366004614d77565b611c7a565b348015610bc857600080fd5b50610962610bd7366004614d11565b611d38565b348015610be857600080fd5b506109b7610bf7366004614e35565b611dc4565b348015610c0857600080fd5b50610984610c17366004614a27565b60056020526000908152604090205481565b348015610c3557600080fd5b50610c4b6daaeb6d7670e522a718067333cd4e81565b60405161098e9190614e89565b348015610c6457600080fd5b50610962610c73366004614e35565b611e90565b348015610c8457600080fd5b50610984600081565b610962610c9b366004614e9d565b611efa565b610962610cae366004614f8c565b611f14565b348015610cbf57600080fd5b50610cd3610cce366004615034565b611f34565b60405161098e91906150da565b348015610cec57600080fd5b50610962610cfb3660046150ed565b611fa4565b348015610d0c57600080fd5b50610962610d1b366004615105565b612026565b610962610d2e366004615146565b61205e565b348015610d3f57600080fd5b50610984610d4e36600461517b565b6007602090815260009384526040808520845180860184018051928152908401958401959095209452929052825290205481565b348015610d8e57600080fd5b50610cd3610d9d366004614a7b565b612069565b348015610dae57600080fd5b50610962610dbd366004614875565b61210d565b348015610dce57600080fd5b5061098460115481565b348015610de457600080fd5b50610a1c6121e9565b348015610df957600080fd5b506109626121f8565b348015610e0e57600080fd5b50610b24610e1d3660046151da565b61220a565b348015610e2e57600080fd5b50610a1c610e3d366004614a27565b61223c565b348015610e4e57600080fd5b506018546109b79060ff1681565b348015610e6857600080fd5b506109626122d6565b348015610e7d57600080fd5b50601454610c4b906001600160a01b031681565b348015610e9d57600080fd5b50610984610eac366004614a44565b612345565b348015610ebd57600080fd5b50610b24610ecc36600461526e565b6123ad565b348015610edd57600080fd5b50610984610eec366004614a44565b6000908152600960205260409020546001600160401b031690565b348015610f1357600080fd5b50610984610f2236600461530a565b600460209081526000928352604080842090915290825290205481565b348015610f4b57600080fd5b50610c4b6123cf565b348015610f6057600080fd5b50610962610f6f366004615105565b6123de565b348015610f8057600080fd5b50600654610c4b906001600160a01b031681565b348015610fa057600080fd5b50610a1c612425565b348015610fb557600080fd5b50610984610fc4366004614a44565b600090815260096020526040902054600160801b90046001600160401b031690565b348015610ff257600080fd5b50610a1c611001366004614a27565b612434565b34801561101257600080fd5b50610962611021366004615338565b61254a565b34801561103257600080fd5b5061098460175481565b34801561104857600080fd5b50610962611057366004614d11565b61255e565b34801561106857600080fd5b50610962611077366004614e35565b6125d0565b34801561108857600080fd5b50610ade600181565b34801561109d57600080fd5b50610b246110ac366004615366565b612659565b6109626110bf366004614a7b565b61266c565b3480156110d057600080fd5b50600254610c4b906001600160a01b031681565b3480156110f057600080fd5b50601554610c4b906001600160a01b031681565b34801561111057600080fd5b5061098461111f366004614a44565b612696565b34801561113057600080fd5b5061096261113f366004614a7b565b6126f1565b34801561115057600080fd5b5061098461115f366004614a44565b600090815260096020526040902054600160401b90046001600160401b031690565b34801561118d57600080fd5b5061098461271081565b3480156111a357600080fd5b50601054610984565b3480156111b857600080fd5b506109626111c7366004615418565b61274f565b6109626111da366004614875565b6127bd565b6109626111ed366004614f8c565b6129d3565b3480156111fe57600080fd5b5061096261120d36600461548a565b612a38565b34801561121e57600080fd5b50610a1c612aea565b34801561123357600080fd5b506109b76112423660046154cb565b612af9565b34801561125357600080fd5b506109626112623660046154f9565b612b17565b34801561127357600080fd5b50610962611282366004614e35565b612b60565b34801561129357600080fd5b506008546109b79060ff1681565b6109626112af366004614e9d565b612bba565b3480156112c057600080fd5b506109626112cf366004615516565b612c3d565b3480156112e057600080fd5b506109626112ef366004614a7b565b612c65565b34801561130057600080fd5b5061096261130f366004615146565b612ccd565b34801561132057600080fd5b50610a1c61132f36600461557f565b612d2f565b34801561134057600080fd5b5061096261134f3660046155d0565b612dc2565b34801561136057600080fd5b5061098460165481565b34801561137657600080fd5b50610ade600080516020615f2183398151915281565b61096261139a366004614a44565b612e89565b3480156113ab57600080fd5b5061098460125481565b336001600160a01b037f00000000000000000000000091e22959b25e7de78877bfce471af5f7343b8121161480159061140757506113f16123cf565b6001600160a01b0316336001600160a01b031614155b1561142557604051635fc483c560e01b815260040160405180910390fd5b565b60008061145560017fa1f93c45d55294e6c2e764d95774fe71c86ec26daf62930bcecf3675030e7d9b61565b565b92915050565b6000808061146b84860186615718565b60368101519396509194509092505060601c806114855750825b82516000816001600160401b038111156114a1576114a1614a98565b6040519080825280602002602001820160405280156114ca578160200160208202803683370190505b5090506000826001600160401b038111156114e7576114e7614a98565b604051908082528060200260200182016040528015611510578160200160208202803683370190505b50905060005b8381101561159d57868181518110611530576115306157b2565b60200260200101516040015183828151811061154e5761154e6157b2565b60200260200101818152505086818151811061156c5761156c6157b2565b60200260200101516060015182828151811061158a5761158a6157b2565b6020908102919091010152600101611516565b506115b984838360405180602001604052806000815250612eb9565b505050505050505050565b6002546001600160a01b0316336001600160a01b0316146116275760405162461bcd60e51b815260206004820152601e60248201527f4c7a4170703a20696e76616c696420656e64706f696e742063616c6c65720000604482015260640161092e565b61ffff861660009081526003602052604081208054611645906157c8565b80601f0160208091040260200160405190810160405280929190818152602001828054611671906157c8565b80156116be5780601f10611693576101008083540402835291602001916116be565b820191906000526020600020905b8154815290600101906020018083116116a157829003601f168201915b505050505090508051868690501480156116d9575060008151115b80156117015750805160208201206040516116f7908890889061479a565b6040518091039020145b61175c5760405162461bcd60e51b815260206004820152602660248201527f4c7a4170703a20696e76616c696420736f757263652073656e64696e6720636f6044820152651b9d1c9858dd60d21b606482015260840161092e565b6117d28787878080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020601f8a018190048102820181019092528881528a935091508890889081908401838280828437600092019190915250612f1892505050565b50505050505050565b679a31110384e0b0c96020526014919091526000908152604090205490565b600061180582612f91565b80611455575061145582612f91565b61181c6113b5565b6118268282612fec565b604080516001600160a01b03841681526001600160601b03831660208201527ff21fccf4d64d86d532c4e4eb86c007b6ad57a460c27d724188625e755ec6cf6d91015b60405180910390a15050565b6014546001600160a01b031633146118a05760405163365cccbb60e21b815260040160405180910390fd5b6118b28160008463ffffffff16613037565b505050565b6060600c80546118c6906157c8565b80601f01602080910402602001604051908101604052809291908181526020018280546118f2906157c8565b801561193f5780601f106119145761010080835404028352916020019161193f565b820191906000526020600020905b81548152906001019060200180831161192257829003601f168201915b5050505050905090565b61195161308a565b6002546040516307e0db1760e01b815261ffff831660048201526001600160a01b03909116906307e0db17906024015b600060405180830381600087803b15801561199b57600080fd5b505af11580156119af573d6000803e3d6000fd5b5050505050565b6119be6113b5565b60105480156119e05760405163050b184360e31b815260040160405180910390fd5b60108290556040517f7c22004198bf87da0f0dab623c72e66ca1200f4454aa3b9ca30f436275428b7c906118699083908590614d03565b611a1f61308a565b61ffff909116600090815260056020526040902055565b6060600e8054611a45906157c8565b80601f0160208091040260200160405190810160405280929190818152602001828054611a71906157c8565b8015611abe5780601f10611a9357610100808354040283529160200191611abe565b820191906000526020600020905b815481529060010190602001808311611aa157829003601f168201915b50505050509050919050565b611ad261308a565b6002546040516310ddb13760e01b815261ffff831660048201526001600160a01b03909116906310ddb13790602401611981565b611b0e61308a565b601480546001600160a01b0319166001600160a01b0392909216919091179055565b600080600089888888604051602001611b4c94939291906157fc565b60408051601f198184030181529082905260025463040a7bb160e41b83529092506001600160a01b0316906340a7bb1090611b93908c90309086908b908b9060040161584a565b6040805180830381865afa158015611baf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bd3919061589e565b925092505097509795505050505050565b611bec61308a565b600180546001600160a01b0319169055604051600080516020615f0183398151915290611c1b90600090614e89565b60405180910390a1565b600082815268aa4ec00224afccfdb76020526040812054606081901c91906127109083611c59576020515490508060601c93505b606084901b1884600019829004811182023d3d3e9396930204935090915050565b876001600160a01b0381163314611c9457611c94336130b5565b6115b9338a8a8a8a8080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050604080516020808e0282810182019093528d82529093508d92508c91829185019084908082843760009201919091525050604080516020601f8d018190048102820181019092528b815292508b91508a908190840183828082843760009201919091525061316592505050565b611d406113b5565b6001600160401b03811115611d6b5760405163b43e913760e01b81526004810182905260240161092e565b6000828152600960205260409081902080546001600160401b0319166001600160401b038416179055517f44ecfc706d63e347851cfd40acfa6cf2e3a41faa3e8b460210c03938e84a91ad906118699084908490614d03565b61ffff831660009081526003602052604081208054829190611de5906157c8565b80601f0160208091040260200160405190810160405280929190818152602001828054611e11906157c8565b8015611e5e5780601f10611e3357610100808354040283529160200191611e5e565b820191906000526020600020905b815481529060010190602001808311611e4157829003601f168201915b505050505090508383604051611e7592919061479a565b60405180910390208180519060200120149150509392505050565b611e9861308a565b6002546040516342d65a8d60e01b81526001600160a01b03909116906342d65a8d90611ecc908690869086906004016158eb565b600060405180830381600087803b158015611ee657600080fd5b505af11580156117d2573d6000803e3d6000fd5b611f0a88888888888888886132e8565b5050505050505050565b611f0a888888611f238961330b565b611f2c8961330b565b8888886132e8565b6060838214611f4b57633b800a466000526004601cfd5b6040519050818152602081018260051b81810160405260005b818114611f9957679a31110384e0b0c98882013560601b17602090815286820135600090815260409020548483015201611f64565b505050949350505050565b611fac61308a565b60185460ff1615611fd057604051637403dcc560e01b815260040160405180910390fd5b60408101803560115560608201356012556080820135601355611ff69060208301614a7b565b600280546001600160a01b0319166001600160a01b0392909216919091179055506018805460ff19166001179055565b61202e6113b5565b600e61203b828483615964565b50600080516020615ee18339815191526000600019604051611869929190614d03565b6118b2838383613037565b6060600060115460125461207d9190615a1d565b612088906001615a34565b6001600160401b0381111561209f5761209f614a98565b6040519080825280602002602001820160405280156120c8578160200160208202803683370190505b50905060005b8151811015612106576120e184826117db565b8282815181106120f3576120f36157b2565b60209081029190910101526001016120ce565b5092915050565b33301461216b5760405162461bcd60e51b815260206004820152602660248201527f4e6f6e626c6f636b696e674c7a4170703a2063616c6c6572206d7573742062656044820152650204c7a4170760d41b606482015260840161092e565b6121e18686868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020601f89018190048102820181019092528781528993509150879087908190840183828082843760009201919091525061335692505050565b505050505050565b6060600e80546118c6906157c8565b61220061308a565b61142560006134c0565b60008061222c89898961221c8a61330b565b6122258a61330b565b8989611b30565b9150915097509795505050505050565b60036020526000908152604090208054612255906157c8565b80601f0160208091040260200160405190810160405280929190818152602001828054612281906157c8565b80156122ce5780601f106122a3576101008083540402835291602001916122ce565b820191906000526020600020905b8154815290600101906020018083116122b157829003601f168201915b505050505081565b6001546001600160a01b031633811461230257604051636b7584e760e11b815260040160405180910390fd5b600180546001600160a01b0319169055604051600080516020615f018339815191529061233190600090614e89565b60405180910390a1612342816134c0565b50565b600060115482111561236a57604051631b50aa5360e01b815260040160405180910390fd5b81156123a55760135460125461238160018561565b565b61238b9190615a1d565b6123959190615a34565b6123a0906001615a34565b611455565b600092915050565b6000806123c06001898961221c8a61330b565b91509150965096945050505050565b6000546001600160a01b031690565b6123e66113b5565b600f6123f3828483615964565b507f905d981207a7d0b6c62cc46ab0be2a076d0298e4a86d0ab79882dbd01ac373788282604051611869929190615a47565b6060600d80546118c6906157c8565b61ffff8116600090815260036020526040812080546060929190612457906157c8565b80601f0160208091040260200160405190810160405280929190818152602001828054612483906157c8565b80156124d05780601f106124a5576101008083540402835291602001916124d0565b820191906000526020600020905b8154815290600101906020018083116124b357829003601f168201915b5050505050905080516000036125285760405162461bcd60e51b815260206004820152601d60248201527f4c7a4170703a206e6f20747275737465642070617468207265636f7264000000604482015260640161092e565b61254360006014835161253b919061565b565b839190613510565b9392505050565b81612554816130b5565b6118b2838361361d565b6125666113b5565b8082036125b157817f6bb7ff708619ba0610cba295a58592e0451dee2622938c8755667688daf3529b61259884611a36565b6040516125a59190614a14565b60405180910390a25050565b600080516020615ee18339815191528282604051611869929190614d03565b6125d861308a565b8181306040516020016125ed93929190615a63565b60408051601f1981840301815291815261ffff85166000908152600360205220906126189082615a84565b507f8c0400cfe2d1199b1a725c78960bcc2a344d869b80590d0f2bd005db15a572ce83838360405161264c939291906158eb565b60405180910390a1505050565b6000806123c06002898989898989611b30565b61267461308a565b601580546001600160a01b0319166001600160a01b0392909216919091179055565b60006012546011546126a89190615a1d565b8211156126c857604051631b50aa5360e01b815260040160405180910390fd5b81156123a55760125460016126dd8285615a34565b6126e7919061565b565b6123a09190615b3d565b6126f961308a565b600680546001600160a01b0319166001600160a01b0383161790556040517f5db758e995a17ec1ad84bdef7e8c3293a0bd6179bcce400dff5d4c3d87db726b90612744908390614e89565b60405180910390a150565b61275761308a565b6002546040516332fb62e760e21b81526001600160a01b039091169063cbed8b9c9061278f9088908890889088908890600401615b5f565b600060405180830381600087803b1580156127a957600080fd5b505af11580156115b9573d6000803e3d6000fd5b61ffff861660009081526007602052604080822090516127e0908890889061479a565b90815260408051602092819003830190206001600160401b038716600090815292529020549050806128605760405162461bcd60e51b815260206004820152602360248201527f4e6f6e626c6f636b696e674c7a4170703a206e6f2073746f726564206d65737360448201526261676560e81b606482015260840161092e565b80838360405161287192919061479a565b6040518091039020146128d05760405162461bcd60e51b815260206004820152602160248201527f4e6f6e626c6f636b696e674c7a4170703a20696e76616c6964207061796c6f616044820152601960fa1b606482015260840161092e565b61ffff871660009081526007602052604080822090516128f3908990899061479a565b90815260408051602092819003830181206001600160401b038916600090815290845282902093909355601f8801829004820283018201905286825261298b918991899089908190840183828082843760009201919091525050604080516020601f8a018190048102820181019092528881528a93509150889088908190840183828082843760009201919091525061335692505050565b7fc264d91f3adc5588250e1551f547752ca0cfa8f6b530d243b9f9f4cab10ea8e587878787856040516129c2959493929190615b8d565b60405180910390a150505050505050565b6016546129df86612696565b6129ea906001615a34565b1115612a09576040516302524f6f60e31b815260040160405180910390fd5b611f0a600080516020615f21833981519152898989612a278a61330b565b612a308a61330b565b898989613661565b612a4061308a565b60008111612a885760405162461bcd60e51b81526020600482015260156024820152744c7a4170703a20696e76616c6964206d696e47617360581b604482015260640161092e565b61ffff83811660008181526004602090815260408083209487168084529482529182902085905581519283528201929092529081018290527f9d5c7c0b934da8fefa9c7760c98383778a12dfbfc0c3b3106518f43fb9508ac09060600161264c565b6060600f80546118c6906157c8565b679a31110384e0b0c96020526014919091526000526034600c205490565b612b1f61308a565b6008805460ff19168215159081179091556040519081527f1584ad594a70cbe1e6515592e1272a987d922b097ead875069cebe8b40c004a490602001612744565b612b6861308a565b61ffff83166000908152600360205260409020612b86828483615964565b507ffa41487ad5d6728f0b19276fa1eddc16558578f5109fc39d2dc33c3230470dab83838360405161264c939291906158eb565b60005b8551811015612c1d57601654612beb878381518110612bde57612bde6157b2565b6020026020010151612696565b612bf6906001615a34565b1115612c15576040516302524f6f60e31b815260040160405180910390fd5b600101612bbd565b50611f0a600080516020615f218339815191528989898989898989613661565b856001600160a01b0381163314612c5757612c57336130b5565b6117d287878787878761382a565b612c6d61308a565b6001600160a01b038116612c9457604051633a247dd760e11b815260040160405180910390fd5b600180546001600160a01b0319166001600160a01b038316179055604051600080516020615f0183398151915290612744908390614e89565b6000612cd883612696565b601654909150612ce9826001615a34565b1115612d08576040516302524f6f60e31b815260040160405180910390fd5b612d14333385856138f5565b612d2933612d23836001615a34565b84613037565b50505050565b600254604051633d7b2f6f60e21b815261ffff808716600483015285166024820152306044820152606481018390526060916001600160a01b03169063f5ecbdbc90608401600060405180830381865afa158015612d91573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612db99190810190615c0d565b95945050505050565b60005b8251811015612d29576000612de5848381518110612bde57612bde6157b2565b601654909150612df6826001615a34565b1115612e15576040516302524f6f60e31b815260040160405180910390fd5b612e5233858481518110612e2b57612e2b6157b2565b6020026020010151858581518110612e4557612e456157b2565b602002602001015161390b565b612e8033612e61836001615a34565b858581518110612e7357612e736157b2565b6020026020010151613037565b50600101612dc5565b612e9161308a565b601154811115612eb4576040516302524f6f60e31b815260040160405180910390fd5b601655565b825160005b81811015612f0b57612f0386868381518110612edc57612edc6157b2565b6020026020010151868481518110612ef657612ef66157b2565b6020026020010151613918565b600101612ebe565b506119af85858585613a30565b600080612f7b5a60966366ad5c8a60e01b89898989604051602401612f409493929190615c41565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915230929190613b4a565b91509150816121e1576121e18686868685613bd4565b60006001600160e01b03198216630747d87560e31b1480612fc257506001600160e01b03198216631be900b160e01b145b80612fdd5750630b9de3bf60e21b6001600160e01b03198316145b80611455575061145582613c71565b6001600160601b03166127108082111561300e5763350a88b36000526004601cfd5b8260601b806130255763b4457eaa6000526004601cfd5b90911768aa4ec00224afccfdb7555050565b60115482111561305a576040516302524f6f60e31b815260040160405180910390fd5b61307d8361306784612345565b8360405180602001604052806000815250613ceb565b6017805490910190555050565b6000546001600160a01b0316331461142557604051635fc483c560e01b815260040160405180910390fd5b6daaeb6d7670e522a718067333cd4e3b1561234257604051633185c44d60e21b81523060048201526001600160a01b03821660248201526daaeb6d7670e522a718067333cd4e9063c617113490604401602060405180830381865afa158015613122573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131469190615c7f565b6123425780604051633b79c77360e21b815260040161092e9190614e89565b815183511461317c57633b800a466000526004601cfd5b8460601b8460601b806131975763ea553b346000526004601cfd5b81679a31110384e0b0c91781679a31110384e0b0c917816020528960601b8481148115176131db578a6000526034600c20546131db57634b6e7f186000526004601cfd5b50865160051b60005b818114613252576020810190508088015184602052818a0151600052604060002080548083111561321d5763f4d678b86000526004601cfd5b829003905560208490526040600020805480830181811015613247576301336cea6000526004601cfd5b909155506131e49050565b5050505060405160408152855160051b602001604082018181838a60045afa503d60400160208401523d81019050865160051b60200191508181838960045afa50823d8201039150508260601c8460601c33600080516020615e818339815191528486a4505050506132c2600190565b156132d4576132d48585858585613d02565b833b156121e1576121e18585858585613d72565b611f0a85516001146132fb5760026132fe565b60015b8989898989898989613661565b60408051600180825281830190925260609160009190602080830190803683370190505090508281600081518110613345576133456157b2565b602090810291909101015292915050565b600080600080848060200190518101906133709190615cf7565b601483015193975091955093509150600061ffff86166116a314613394578361339d565b61339d84613e34565b90506133ab8a838386613e8e565b835160010361344b57816001600160a01b0316896040516133cc9190615d86565b60405180910390208b61ffff167f1bf64e58d19fc43de4c44b3d1bb1fae313979af831a7a39f3297564294329f0f8460008151811061340d5761340d6157b2565b602002602001015187600081518110613428576134286157b2565b602002602001015160405161343e929190614d03565b60405180910390a46134b4565b6001845111156134b457816001600160a01b03168960405161346d9190615d86565b60405180910390208b61ffff167f1ae08edbbcd7baa8d064835de8593ce16b313414525ac89534e349f4da7926e484876040516134ab929190615da2565b60405180910390a45b50505050505050505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60608161351e81601f615a34565b101561355d5760405162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b604482015260640161092e565b6135678284615a34565b845110156135ab5760405162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b604482015260640161092e565b6060821580156135ca5760405191506000825260208201604052613614565b6040519150601f8416801560200281840101858101878315602002848b0101015b818310156136035780518352602092830192016135eb565b5050858452601f01601f1916604052505b50949350505050565b8015159050679a31110384e0b0c96020523360145281600052806034600c2055806000528160601b60601c33600080516020615ea183398151915260206000a35050565b8451158061367157508351855114155b1561368f5760405163166d9d2560e21b815260040160405180910390fd5b61ffff8916600114806136a6575061ffff89166002145b156136fb5760005b85518110156136f9578581815181106136c9576136c96157b2565b60200260200101516000146136f15760405163166d9d2560e21b815260040160405180910390fd5b6001016136ae565b505b6137088888888888613ea9565b60008987878760405160200161372194939291906157fc565b604051602081830303815290604052905061373f888b846000613ef3565b61374d888286868634613fcd565b85516001036137ca57866040516137649190615d86565b6040518091039020896001600160a01b03168961ffff167f968b0d61ebcf43e5d76ed87bd2c4ee2f22b4969b9f4ca49e3373c025eddd5eeb896000815181106137af576137af6157b2565b602002602001015189600081518110613428576134286157b2565b6001865111156134b457866040516137e29190615d86565b6040518091039020896001600160a01b03168961ffff167fddd15f7cfbd674ac2096d598f1650367f8a8bd72b4e3abd85591099ea3b57e3389896040516134ab929190615da2565b306001600160a01b038716036138b157336001600160a01b037f0000000000000000000000001e0049783f008a0085193e00003d00cd54003c71161480159061388c5750613876611427565b336000908152602091909152604090205460ff16155b156138ac5733604051634c6ca6f360e11b815260040161092e9190614e89565b6121e1565b6121e1338787878787878080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061415692505050565b6138ff8282614265565b612d29848484846142a7565b6118b260008484846138f5565b600082815260096020526040902080546001600160401b0380821691613947918591600160801b900416615a34565b111561399757805461396a908390600160801b90046001600160401b0316615a34565b8154604051631828a90b60e21b815260048101929092526001600160401b0316602482015260440161092e565b8054600160801b6001600160401b03600160401b80840482168601821602600160401b600160801b03198416811783900482168601909116909102600160801b600160c01b0319909116600160401b600160c01b0319909216919091171790556001600160a01b039092166000908152600a60209081526040808320805486019055600b82528083209383529290522080549091019055565b8151835114613a4757633b800a466000526004601cfd5b8360601b80613a5e5763ea553b346000526004601cfd5b80679a31110384e0b0c917602052835160051b60005b818114613ab75760208101905080850151818701516000526040600020805482810181811015613aac576301336cea6000526004601cfd5b90915550613a749050565b505060405160408152845160051b602001604082018181838960045afa503d60400160208401523d81019050855160051b60200191508181838860045afa50823d8201039150508260601c600033600080516020615e818339815191528486a4505050613b22600190565b15613b3557613b35600085858585613d02565b833b15612d2957612d29600085858585613d72565b6000606060008060008661ffff166001600160401b03811115613b6f57613b6f614a98565b6040519080825280601f01601f191660200182016040528015613b99576020820181803683370190505b50905060008087516020890160008d8df191503d925086831115613bbb578692505b828152826000602083013e909890975095505050505050565b8180519060200120600760008761ffff1661ffff16815260200190815260200160002085604051613c059190615d86565b9081526040805191829003602090810183206001600160401b0388166000908152915220919091557fe183f33de2837795525b4792ca4cd60535bd77c53b7e7030060bfcf5734d6b0c90613c629087908790879087908790615dc7565b60405180910390a15050505050565b60006001600160e01b0319821662a6a64b60e21b1480613ca15750632483248360e11b6001600160e01b03198316145b80613cbf5750632a55205a60e083901c9081146301ffc9a791909114175b806114555750611455826301ffc9a760e09190911c90811463d9b67a26821417630e89341c9091141790565b613cf6848484613918565b612d298484848461435e565b6001600160a01b03841615801590613d415750613d3f847f0000000000000000000000001e0049783f008a0085193e00003d00cd54003c71612af9565b155b156119af576119af847f0000000000000000000000001e0049783f008a0085193e00003d00cd54003c7160016143f7565b60405163bc197c8181523360208201528560601b60601c604082015260a06060820152835160051b60200160c082018181838860045afa503d60a0018060808501523d82019150855160051b60200192508282848860045afa503d0160a0840152835160200191503d018181818660045afa50601c83013d82010391505060208282601c850160008a5af1613e16573d15613e11573d6000803e3d6000fd5b600082525b50805163bc197c8160e01b146121e157639c05499b6000526004601cfd5b606060005b8251811015613e8757613e62613e5a848381518110612bde57612bde6157b2565b600101612345565b838281518110613e7457613e746157b2565b6020908102919091010152600101613e39565b5090919050565b612d2983838360405180602001604052806000815250612eb9565b336001600160a01b03861614801590613ec95750613ec78533612af9565b155b15613ee75760405163365cccbb60e21b815260040160405180910390fd5b6119af85868484614441565b6000613efe8361449f565b61ffff808716600090815260046020908152604080832093891683529290529081205491925090613f30908490615a34565b905060008111613f7f5760405162461bcd60e51b815260206004820152601a602482015279131e905c1c0e881b5a5b91d85cd31a5b5a5d081b9bdd081cd95d60321b604482015260640161092e565b808210156121e15760405162461bcd60e51b815260206004820152601b60248201527a4c7a4170703a20676173206c696d697420697320746f6f206c6f7760281b604482015260640161092e565b61ffff861660009081526003602052604081208054613feb906157c8565b80601f0160208091040260200160405190810160405280929190818152602001828054614017906157c8565b80156140645780601f1061403957610100808354040283529160200191614064565b820191906000526020600020905b81548152906001019060200180831161404757829003601f168201915b5050505050905080516000036140d55760405162461bcd60e51b815260206004820152603060248201527f4c7a4170703a2064657374696e6174696f6e20636861696e206973206e6f742060448201526f61207472757374656420736f7572636560801b606482015260840161092e565b6140e08787516144fa565b60025460405162c5803160e81b81526001600160a01b039091169063c580310090849061411b908b9086908c908c908c908c90600401615e19565b6000604051808303818588803b15801561413457600080fd5b505af1158015614148573d6000803e3d6000fd5b505050505050505050505050565b8460601b8460601b806141715763ea553b346000526004601cfd5b81679a31110384e0b0c9176020528760601b8281148115176141a957886000526034600c20546141a957634b6e7f186000526004601cfd5b508460005260406000208054808611156141cb5763f4d678b86000526004601cfd5b8590039055679a31110384e0b0c9811760205260406000208054808601818110156141fe576301336cea6000526004601cfd5b808355505050836020528060601c8260601c33600080516020615ec183398151915260406000a4505061422f600190565b156142515761425185856142428661456b565b61424b8661456b565b85613d02565b833b156121e1576121e18585858585614584565b60009182526009602052604090912080546001600160401b03600160401b80830482169490940316909202600160401b600160801b0319909216919091179055565b8260601b80679a31110384e0b0c917602052808560601b148560601b15176142e557846000526034600c20546142e557634b6e7f186000526004601cfd5b8260005260406000208054808411156143065763f4d678b86000526004601cfd5b83810382555050826000528160205260008160601c33600080516020615ec183398151915260406000a450612d298360006143408561456b565b6143498561456b565b60405180602001604052806000815250613d02565b8360601b806143755763ea553b346000526004601cfd5b679a31110384e0b0c9602052846014528360005260406000208054848101818110156143a9576301336cea6000526004601cfd5b80835550505083600052826020528060601c600033600080516020615ec183398151915260406000a4506143e26000856142428661456b565b833b15612d2957612d29600085858585614584565b8015159050679a31110384e0b0c96020528260145281600052806034600c20558060005260001960601c828116848216600080516020615ea183398151915260206000a350505050565b815160005b818110156144925761448a848281518110614463576144636157b2565b602002602001015184838151811061447d5761447d6157b2565b6020026020010151614265565b600101614446565b506119af85858585614617565b60006022825110156144f25760405162461bcd60e51b815260206004820152601c60248201527b4c7a4170703a20696e76616c69642061646170746572506172616d7360201b604482015260640161092e565b506022015190565b61ffff82166000908152600560205260408120549081900361451b57506127105b808211156118b25760405162461bcd60e51b815260206004820181905260248201527f4c7a4170703a207061796c6f61642073697a6520697320746f6f206c61726765604482015260640161092e565b6040805180820190915260018152602081019190915290565b60405163f23a6e6181523360208201528560601b60601c604082015283606082015282608082015260a08082015281518060c083015280156145d0578060e08301826020860160045afa505b6020828260c401601c850160008a5af16145f9573d156145f4573d6000803e3d6000fd5b600082525b50805163f23a6e6160e01b146121e157639c05499b6000526004601cfd5b805182511461462e57633b800a466000526004601cfd5b8260601b80679a31110384e0b0c9176020528460601b81811481151761466a57856000526034600c205461466a57634b6e7f186000526004601cfd5b50825160051b60005b8181146146b357602081019050808401518186015160005260406000208054808311156146a85763f4d678b86000526004601cfd5b919091039055614673565b505060405160408152835160051b602001604082018181838860045afa503d60400160208401523d81019050845160051b60200191508181838760045afa50823d82010391505060008360601c33600080516020615e818339815191528486a450505061471e600190565b15612d2957612d29836000848460405180602001604052806000815250613d02565b6000808585111561475057600080fd5b8386111561475d57600080fd5b5050820193919092039150565b6001600160601b031981358181169160148510156147925780818660140360031b1b83161692505b505092915050565b8183823760009101908152919050565b6001600160a01b038116811461234257600080fd5b80356147ca816147aa565b919050565b600080604083850312156147e257600080fd5b82356147ed816147aa565b946020939093013593505050565b61ffff8116811461234257600080fd5b80356147ca816147fb565b60008083601f84011261482857600080fd5b5081356001600160401b0381111561483f57600080fd5b60208301915083602082850101111561485757600080fd5b9250929050565b80356001600160401b03811681146147ca57600080fd5b6000806000806000806080878903121561488e57600080fd5b8635614899816147fb565b955060208701356001600160401b03808211156148b557600080fd5b6148c18a838b01614816565b90975095508591506148d560408a0161485e565b945060608901359150808211156148eb57600080fd5b506148f889828a01614816565b979a9699509497509295939492505050565b60006020828403121561491c57600080fd5b81356001600160e01b03198116811461254357600080fd5b6000806040838503121561494757600080fd5b8235614952816147aa565b915060208301356001600160601b038116811461496e57600080fd5b809150509250929050565b60008060006060848603121561498e57600080fd5b83359250602084013563ffffffff811681146149a957600080fd5b915060408401356149b9816147aa565b809150509250925092565b60005b838110156149df5781810151838201526020016149c7565b50506000910152565b60008151808452614a008160208601602086016149c4565b601f01601f19169290920160200192915050565b60208152600061254360208301846149e8565b600060208284031215614a3957600080fd5b8135612543816147fb565b600060208284031215614a5657600080fd5b5035919050565b60008060408385031215614a7057600080fd5b82356147ed816147fb565b600060208284031215614a8d57600080fd5b8135612543816147aa565b634e487b7160e01b600052604160045260246000fd5b604051608081016001600160401b0381118282101715614ad057614ad0614a98565b60405290565b604051601f8201601f191681016001600160401b0381118282101715614afe57614afe614a98565b604052919050565b60006001600160401b03821115614b1f57614b1f614a98565b50601f01601f191660200190565b600082601f830112614b3e57600080fd5b8135614b51614b4c82614b06565b614ad6565b818152846020838601011115614b6657600080fd5b816020850160208301376000918101602001919091529392505050565b60006001600160401b03821115614b9c57614b9c614a98565b5060051b60200190565b600082601f830112614bb757600080fd5b81356020614bc7614b4c83614b83565b82815260059290921b84018101918181019086841115614be657600080fd5b8286015b84811015614c015780358352918301918301614bea565b509695505050505050565b801515811461234257600080fd5b80356147ca81614c0c565b600080600080600080600060e0888a031215614c4057600080fd5b614c498861480b565b9650614c576020890161480b565b955060408801356001600160401b0380821115614c7357600080fd5b614c7f8b838c01614b2d565b965060608a0135915080821115614c9557600080fd5b614ca18b838c01614ba6565b955060808a0135915080821115614cb757600080fd5b614cc38b838c01614ba6565b9450614cd160a08b01614c1a565b935060c08a0135915080821115614ce757600080fd5b50614cf48a828b01614b2d565b91505092959891949750929550565b918252602082015260400190565b60008060408385031215614d2457600080fd5b50508035926020909101359150565b60008083601f840112614d4557600080fd5b5081356001600160401b03811115614d5c57600080fd5b6020830191508360208260051b850101111561485757600080fd5b60008060008060008060008060a0898b031215614d9357600080fd5b8835614d9e816147aa565b97506020890135614dae816147aa565b965060408901356001600160401b0380821115614dca57600080fd5b614dd68c838d01614d33565b909850965060608b0135915080821115614def57600080fd5b614dfb8c838d01614d33565b909650945060808b0135915080821115614e1457600080fd5b50614e218b828c01614816565b999c989b5096995094979396929594505050565b600080600060408486031215614e4a57600080fd5b8335614e55816147fb565b925060208401356001600160401b03811115614e7057600080fd5b614e7c86828701614816565b9497909650939450505050565b6001600160a01b0391909116815260200190565b600080600080600080600080610100898b031215614eba57600080fd5b614ec3896147bf565b9750614ed160208a0161480b565b965060408901356001600160401b0380821115614eed57600080fd5b614ef98c838d01614b2d565b975060608b0135915080821115614f0f57600080fd5b614f1b8c838d01614ba6565b965060808b0135915080821115614f3157600080fd5b614f3d8c838d01614ba6565b9550614f4b60a08c016147bf565b9450614f5960c08c016147bf565b935060e08b0135915080821115614f6f57600080fd5b50614f7c8b828c01614b2d565b9150509295985092959890939650565b600080600080600080600080610100898b031215614fa957600080fd5b8835614fb4816147aa565b97506020890135614fc4816147fb565b965060408901356001600160401b0380821115614fe057600080fd5b614fec8c838d01614b2d565b975060608b0135965060808b0135955060a08b0135915061500c826147aa565b90935060c08a01359061501e826147aa565b90925060e08a01359080821115614f6f57600080fd5b6000806000806040858703121561504a57600080fd5b84356001600160401b038082111561506157600080fd5b61506d88838901614d33565b9096509450602087013591508082111561508657600080fd5b5061509387828801614d33565b95989497509550505050565b600081518084526020808501945080840160005b838110156150cf578151875295820195908201906001016150b3565b509495945050505050565b602081526000612543602083018461509f565b600060a082840312156150ff57600080fd5b50919050565b6000806020838503121561511857600080fd5b82356001600160401b0381111561512e57600080fd5b61513a85828601614816565b90969095509350505050565b60008060006060848603121561515b57600080fd5b8335615166816147aa565b95602085013595506040909401359392505050565b60008060006060848603121561519057600080fd5b833561519b816147fb565b925060208401356001600160401b038111156151b657600080fd5b6151c286828701614b2d565b9250506151d16040850161485e565b90509250925092565b600080600080600080600060e0888a0312156151f557600080fd5b8735615200816147fb565b96506020880135615210816147fb565b955060408801356001600160401b038082111561522c57600080fd5b6152388b838c01614b2d565b965060608a0135955060808a0135945060a08a0135915061525882614c0c565b90925060c08901359080821115614ce757600080fd5b60008060008060008060c0878903121561528757600080fd5b8635615292816147fb565b955060208701356001600160401b03808211156152ae57600080fd5b6152ba8a838b01614b2d565b96506040890135955060608901359450608089013591506152da82614c0c565b90925060a088013590808211156152f057600080fd5b506152fd89828a01614b2d565b9150509295509295509295565b6000806040838503121561531d57600080fd5b8235615328816147fb565b9150602083013561496e816147fb565b6000806040838503121561534b57600080fd5b8235615356816147aa565b9150602083013561496e81614c0c565b60008060008060008060c0878903121561537f57600080fd5b6153888761480b565b955060208701356001600160401b03808211156153a457600080fd5b6153b08a838b01614b2d565b965060408901359150808211156153c657600080fd5b6153d28a838b01614ba6565b955060608901359150808211156153e857600080fd5b6153f48a838b01614ba6565b945061540260808a01614c1a565b935060a08901359150808211156152f057600080fd5b60008060008060006080868803121561543057600080fd5b853561543b816147fb565b9450602086013561544b816147fb565b93506040860135925060608601356001600160401b0381111561546d57600080fd5b61547988828901614816565b969995985093965092949392505050565b60008060006060848603121561549f57600080fd5b83356154aa816147fb565b925060208401356154ba816147fb565b929592945050506040919091013590565b600080604083850312156154de57600080fd5b82356154e9816147aa565b9150602083013561496e816147aa565b60006020828403121561550b57600080fd5b813561254381614c0c565b60008060008060008060a0878903121561552f57600080fd5b863561553a816147aa565b9550602087013561554a816147aa565b9450604087013593506060870135925060808701356001600160401b0381111561557357600080fd5b6148f889828a01614816565b6000806000806080858703121561559557600080fd5b84356155a0816147fb565b935060208501356155b0816147fb565b925060408501356155c0816147aa565b9396929550929360600135925050565b6000806000606084860312156155e557600080fd5b83356155f0816147aa565b925060208401356001600160401b038082111561560c57600080fd5b61561887838801614ba6565b9350604086013591508082111561562e57600080fd5b5061563b86828701614ba6565b9150509250925092565b634e487b7160e01b600052601160045260246000fd5b8181038181111561145557611455615645565b600082601f83011261567f57600080fd5b8135602061568f614b4c83614b83565b82815260079290921b840181019181810190868411156156ae57600080fd5b8286015b84811015614c0157608081890312156156cb5760008081fd5b6156d3614aae565b8135600681106156e35760008081fd5b8152818501356156f2816147aa565b8186015260408281013590820152606080830135908201528352918301916080016156b2565b6000806000806080858703121561572e57600080fd5b8435615739816147aa565b935060208501356001600160401b038082111561575557600080fd5b6157618883890161566e565b9450604087013591508082111561577757600080fd5b6157838883890161566e565b9350606087013591508082111561579957600080fd5b506157a687828801614b2d565b91505092959194509250565b634e487b7160e01b600052603260045260246000fd5b600181811c908216806157dc57607f821691505b6020821081036150ff57634e487b7160e01b600052602260045260246000fd5b61ffff8516815260806020820152600061581960808301866149e8565b828103604084015261582b818661509f565b9050828103606084015261583f818561509f565b979650505050505050565b61ffff861681526001600160a01b038516602082015260a060408201819052600090615878908301866149e8565b8415156060840152828103608084015261589281856149e8565b98975050505050505050565b600080604083850312156158b157600080fd5b505080516020909101519092909150565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b61ffff84168152604060208201526000612db96040830184866158c2565b601f8211156118b257600081815260208120601f850160051c810160208610156159305750805b601f850160051c820191505b818110156121e15782815560010161593c565b600019600383901b1c191660019190911b1790565b6001600160401b0383111561597b5761597b614a98565b61598f8361598983546157c8565b83615909565b6000601f8411600181146159bd57600085156159ab5750838201355b6159b5868261594f565b8455506119af565b600083815260209020601f19861690835b828110156159ee57868501358255602094850194600190920191016159ce565b5086821015615a0b5760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b808202811582820484141761145557611455615645565b8082018082111561145557611455615645565b602081526000615a5b6020830184866158c2565b949350505050565b8284823760609190911b6001600160601b0319169101908152601401919050565b81516001600160401b03811115615a9d57615a9d614a98565b615ab181615aab84546157c8565b84615909565b602080601f831160018114615ae05760008415615ace5750858301515b615ad8858261594f565b8655506121e1565b600085815260208120601f198616915b82811015615b0f57888601518255948401946001909101908401615af0565b5085821015615b2d5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b600082615b5a57634e487b7160e01b600052601260045260246000fd5b500490565b600061ffff80881683528087166020840152508460408301526080606083015261583f6080830184866158c2565b61ffff86168152608060208201526000615bab6080830186886158c2565b6001600160401b0394909416604083015250606001529392505050565b600082601f830112615bd957600080fd5b8151615be7614b4c82614b06565b818152846020838601011115615bfc57600080fd5b615a5b8260208301602087016149c4565b600060208284031215615c1f57600080fd5b81516001600160401b03811115615c3557600080fd5b615a5b84828501615bc8565b61ffff85168152608060208201526000615c5e60808301866149e8565b6001600160401b0385166040840152828103606084015261583f81856149e8565b600060208284031215615c9157600080fd5b815161254381614c0c565b600082601f830112615cad57600080fd5b81516020615cbd614b4c83614b83565b82815260059290921b84018101918181019086841115615cdc57600080fd5b8286015b84811015614c015780518352918301918301615ce0565b60008060008060808587031215615d0d57600080fd5b8451615d18816147fb565b60208601519094506001600160401b0380821115615d3557600080fd5b615d4188838901615bc8565b94506040870151915080821115615d5757600080fd5b615d6388838901615c9c565b93506060870151915080821115615d7957600080fd5b506157a687828801615c9c565b60008251615d988184602087016149c4565b9190910192915050565b604081526000615db5604083018561509f565b8281036020840152612db9818561509f565b61ffff8616815260a060208201526000615de460a08301876149e8565b6001600160401b03861660408401528281036060840152615e0581866149e8565b9050828103608084015261589281856149e8565b61ffff8716815260c060208201526000615e3660c08301886149e8565b8281036040840152615e4881886149e8565b6001600160a01b0387811660608601528616608085015283810360a08501529050615e7381856149e8565b999850505050505050505056fe4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31c3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f626bd5c950a8d8df17f772f5af37cb3655737899cbf903264b9795592da439661c11a3cf439fb225bfe74225716b6774765670ec1060e3796802e62139d69974da04c6a47ae7910ef8b295215a97e8495a9eaf57b7b05bfd8bf951edb3fd4a16a3a164736f6c6343000814000a
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ 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.