Source Code
More Info
Private Name Tags
ContractCreator
TokenTracker
Multichain Info
Latest 13 from a total of 13 transactions
| Transaction Hash |
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
| Send From | 24277355 | 703 days ago | IN | 0.40795762 CELO | 0.00301322 | ||||
| Set Trusted Remo... | 24244995 | 705 days ago | IN | 0 CELO | 0.00035905 | ||||
| Set Min Dst Gas | 24244057 | 705 days ago | IN | 0 CELO | 0.0002928 | ||||
| Set Dst Chain Id... | 24244056 | 705 days ago | IN | 0 CELO | 0.00028646 | ||||
| Set Dst Chain Id... | 24244055 | 705 days ago | IN | 0 CELO | 0.0002826 | ||||
| Mint | 24243985 | 705 days ago | IN | 1.3 CELO | 0.00087145 | ||||
| Set Nft State | 24210198 | 707 days ago | IN | 0 CELO | 0.00036673 | ||||
| Set Nft State | 24210147 | 707 days ago | IN | 0 CELO | 0.00093573 | ||||
| Set Trusted Remo... | 24210047 | 707 days ago | IN | 0 CELO | 0.00095469 | ||||
| Set Bridge Fee | 24209951 | 707 days ago | IN | 0 CELO | 0.00046536 | ||||
| Set Min Dst Gas | 24209920 | 707 days ago | IN | 0 CELO | 0.0004918 | ||||
| Set Dst Chain Id... | 24209919 | 707 days ago | IN | 0 CELO | 0.00048546 | ||||
| Set Dst Chain Id... | 24209917 | 707 days ago | IN | 0 CELO | 0.0004816 |
Cross-Chain Transactions
Loading...
Loading
Contract Name:
AdvancedONFT721AOpen
Compiler Version
v0.8.17+commit.8df45f5f
Optimization Enabled:
Yes with 5 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8;
import "../ONFT721AOpen.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "solmate/src/utils/MerkleProofLib.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
error saleInactive();
error zeroAmount();
error maxSupplyReached();
error insufficientValue();
error nonWhitelist();
/**
* @title AdvancedONFT721AOpen
* @notice This contract extends the functionality of ONFT721A with advanced features.
* @dev This contract should be used for high supply open editions
*/
contract AdvancedONFT721AOpen is ONFT721AOpen {
using Strings for uint;
using MerkleProofLib for bytes32[];
struct FinanceDetails {
address payable beneficiary;
address payable taxRecipient;
address token;
uint128 price;
uint128 wlPrice;
uint16 tax;
}
struct Metadata {
string baseURI;
string hiddenMetadataURI;
}
struct NFTState {
bool saleStarted;
bool revealed;
uint256 startTime; // UNIX timestampt
uint256 mintLength; // number of seconds after start time mint is available for
}
uint256 public startId;
uint256 public maxId;
uint256 public maxGlobalId;
bytes32 public merkleRoot;
FinanceDetails public financeDetails;
Metadata public metadata;
NFTState public state;
modifier onlyBeneficiaryAndOwner() {
require(msg.sender == financeDetails.beneficiary || msg.sender == owner(), "Caller is not beneficiary or owner");
_;
}
/**
* @notice Constructor for creating the AdvancedONFT721A contract.
* @param _name Name of the NFT.
* @param _symbol Symbol of the NFT.
* @param _lzEndpoint Endpoint for lazy minting.
* @param _startId Starting ID for the NFTs.
* @param _maxId Maximum ID for the NFTs.
* @param _maxGlobalId Global maximum ID.
* @param _baseTokenURI Base URI for the token metadata.
* @param _hiddenURI URI for the hidden metadata (before reveal).
* @param _tax Tax rate.
* @param _price Price of the NFT.
* @param _wlPrice Whitelist price for the NFT.
* @param token Token address for payment (if not ETH).
* @param _taxRecipient Address receiving the tax.
* @param _beneficiary Beneficiary address.
*/
constructor(
string memory _name,
string memory _symbol,
address _lzEndpoint,
uint256 _startId,
uint256 _maxId,
uint256 _maxGlobalId,
string memory _baseTokenURI,
string memory _hiddenURI,
uint16 _tax,
uint128 _price,
uint128 _wlPrice,
address token,
address _taxRecipient,
address _beneficiary
) ONFT721AOpen(_name, _symbol, 1, _lzEndpoint, _startId) {
startId = _startId;
maxGlobalId = _maxGlobalId;
maxId = _maxId;
financeDetails = FinanceDetails(payable(_beneficiary), payable(_taxRecipient),token, _price, _wlPrice, _tax );
metadata = Metadata(_baseTokenURI, _hiddenURI);
}
/**
* @notice Allows users to mint NFTs.
* @param _nbTokens Number of tokens to mint.
*/
function mint(uint256 _nbTokens) public virtual payable {
if (!state.saleStarted) _revert(saleInactive.selector);
if (_nbTokens == 0) _revert(zeroAmount.selector);
if (_nextTokenId() + _nbTokens - 1 > maxId) _revert(maxSupplyReached.selector);
if (state.startTime + state.mintLength < block.timestamp) _revert(saleInactive.selector);
if (financeDetails.token == address(0)) {
if (msg.value < financeDetails.price * _nbTokens) _revert(insufficientValue.selector);
} else {
IERC20(financeDetails.token).transferFrom(msg.sender, address(this), financeDetails.price * _nbTokens);
}
_mint(msg.sender, _nbTokens);
}
/**
* @notice Allows whitelisted users to mint NFTs at a special price.
* @param _nbTokens Number of tokens to mint.
* @param _merkleProof Merkle proof for verifying the whitelisting.
*/
function whitelistMint(uint256 _nbTokens, bytes32[] calldata _merkleProof) public virtual payable {
if (!(_merkleProof.verify(merkleRoot, keccak256(abi.encodePacked(msg.sender))))) _revert(nonWhitelist.selector);
if (!state.saleStarted) _revert(saleInactive.selector);
if (_nbTokens == 0) _revert(zeroAmount.selector);
if (_nextTokenId() + _nbTokens - 1 > maxId) _revert(maxSupplyReached.selector);
if (state.startTime + state.mintLength < block.timestamp) _revert(saleInactive.selector);
if (financeDetails.token == address(0)) {
if (msg.value < financeDetails.price * _nbTokens) _revert(insufficientValue.selector);
} else {
IERC20(financeDetails.token).transferFrom(msg.sender, address(this), financeDetails.price * _nbTokens);
}
_mint(msg.sender, _nbTokens);
}
function _getMaxGlobalId() internal view override returns (uint256) {
return maxGlobalId;
}
function _getMaxId() internal view override returns (uint256) {
return maxId;
}
function _startTokenId() internal view override returns(uint256) {
return startId;
}
function setMintRange(uint32 _start, uint32 _end) external onlyOwner {
require (_start > uint32(_totalMinted()));
require (_end > _start);
startId = _start;
maxId = _end;
}
function setFinanceDetails(FinanceDetails calldata _finance) external onlyOwner {
financeDetails = _finance;
}
function setMetadata(Metadata calldata _metadata) external onlyBeneficiaryAndOwner {
metadata = _metadata;
}
function setMerkleRoot(bytes32 _newRoot) public onlyBeneficiaryAndOwner() {
merkleRoot = _newRoot;
}
function setNftState(NFTState calldata _state) external onlyBeneficiaryAndOwner {
state = NFTState(_state.saleStarted, _state.revealed, block.timestamp, _state.mintLength);
}
/**
* @notice Allows the beneficiary or owner to withdraw funds from the contract.
* @notice If financeDetails.token is address(0) native will be withdrawn else token will be withdrawn
*/
function withdraw() external onlyBeneficiaryAndOwner {
address beneficiary = financeDetails.beneficiary;
address taxRecipient = financeDetails.taxRecipient;
address token = financeDetails.token;
require(beneficiary != address(0));
require(taxRecipient != address(0));
if (token == address(0)) {
uint balance = address(this).balance;
uint taxFee = balance * financeDetails.tax / 10000;
payable(beneficiary).transfer(balance - taxFee);
payable(taxRecipient).transfer(taxFee);
payable(beneficiary).transfer(address(this).balance);
} else {
uint balance = IERC20(token).balanceOf(address(this));
uint taxFee = balance * financeDetails.tax / 10000;
IERC20(token).transfer(beneficiary, balance - taxFee);
IERC20(token).transfer(taxRecipient, taxFee);
IERC20(token).transfer(beneficiary, IERC20(token).balanceOf(address(this)));
}
}
function _baseURI() internal view override returns (string memory) {
return metadata.baseURI;
}
function tokenURI(uint256 _tokenId) public view virtual override(ERC721ASpecific, IERC721ASpecific) returns (string memory) {
require(_exists(_tokenId));
if (!state.revealed) {
return metadata.hiddenMetadataURI;
}
return metadata.baseURI;
}
}// 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: 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: 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 "@openzeppelin/contracts/access/Ownable.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 Ownable, ILayerZeroReceiver, ILayerZeroUserApplicationConfig {
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 immutable 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(address _endpoint) {
lzEndpoint = ILayerZeroEndpoint(_endpoint);
}
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 _srcChainId, bytes calldata _path) external onlyOwner {
trustedRemoteLookup[_srcChainId] = _path;
emit SetTrustedRemote(_srcChainId, _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
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(address _endpoint) LzApp(_endpoint) {}
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: 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 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
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling 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`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @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
// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
function _nonReentrantBefore() private {
// On the first call to nonReentrant, _status will be _NOT_ENTERED
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
}
function _nonReentrantAfter() private {
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
/**
* @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
* `nonReentrant` function in the call stack.
*/
function _reentrancyGuardEntered() internal view returns (bool) {
return _status == _ENTERED;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 amount) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
pragma solidity ^0.8.0;
import "./IERC165.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
enum Rounding {
Down, // Toward negative infinity
Up, // Toward infinity
Zero // Toward zero
}
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two numbers. The result is rounded towards
* zero.
*/
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow.
return (a & b) + (a ^ b) / 2;
}
/**
* @dev Returns the ceiling of the division of two numbers.
*
* This differs from standard division with `/` in that it rounds up instead
* of rounding down.
*/
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b - 1) / b can overflow on addition, so we distribute.
return a == 0 ? 0 : (a - 1) / b + 1;
}
/**
* @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
* @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
* with further edits by Uniswap Labs also under MIT license.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
unchecked {
// 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
// use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
// variables such that product = prod1 * 2^256 + prod0.
uint256 prod0; // Least significant 256 bits of the product
uint256 prod1; // Most significant 256 bits of the product
assembly {
let mm := mulmod(x, y, not(0))
prod0 := mul(x, y)
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
// Handle non-overflow cases, 256 by 256 division.
if (prod1 == 0) {
// Solidity will revert if denominator == 0, unlike the div opcode on its own.
// The surrounding unchecked block does not change this fact.
// See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
return prod0 / denominator;
}
// Make sure the result is less than 2^256. Also prevents denominator == 0.
require(denominator > prod1, "Math: mulDiv overflow");
///////////////////////////////////////////////
// 512 by 256 division.
///////////////////////////////////////////////
// Make division exact by subtracting the remainder from [prod1 prod0].
uint256 remainder;
assembly {
// Compute remainder using mulmod.
remainder := mulmod(x, y, denominator)
// Subtract 256 bit number from 512 bit number.
prod1 := sub(prod1, gt(remainder, prod0))
prod0 := sub(prod0, remainder)
}
// Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
// See https://cs.stackexchange.com/q/138556/92363.
// Does not overflow because the denominator cannot be zero at this stage in the function.
uint256 twos = denominator & (~denominator + 1);
assembly {
// Divide denominator by twos.
denominator := div(denominator, twos)
// Divide [prod1 prod0] by twos.
prod0 := div(prod0, twos)
// Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
twos := add(div(sub(0, twos), twos), 1)
}
// Shift in bits from prod1 into prod0.
prod0 |= prod1 * twos;
// Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
// that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
// four bits. That is, denominator * inv = 1 mod 2^4.
uint256 inverse = (3 * denominator) ^ 2;
// Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
// in modular arithmetic, doubling the correct bits in each step.
inverse *= 2 - denominator * inverse; // inverse mod 2^8
inverse *= 2 - denominator * inverse; // inverse mod 2^16
inverse *= 2 - denominator * inverse; // inverse mod 2^32
inverse *= 2 - denominator * inverse; // inverse mod 2^64
inverse *= 2 - denominator * inverse; // inverse mod 2^128
inverse *= 2 - denominator * inverse; // inverse mod 2^256
// Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
// This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
// less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
// is no longer required.
result = prod0 * inverse;
return result;
}
}
/**
* @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
uint256 result = mulDiv(x, y, denominator);
if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
result += 1;
}
return result;
}
/**
* @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
*
* Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
*/
function sqrt(uint256 a) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
// For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
//
// We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
// `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
//
// This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
// → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
// → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
//
// Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
uint256 result = 1 << (log2(a) >> 1);
// At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
// since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
// every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
// into the expected uint128 result.
unchecked {
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
return min(result, a / result);
}
}
/**
* @notice Calculates sqrt(a), following the selected rounding direction.
*/
function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = sqrt(a);
return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
}
}
/**
* @dev Return the log in base 2, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 128;
}
if (value >> 64 > 0) {
value >>= 64;
result += 64;
}
if (value >> 32 > 0) {
value >>= 32;
result += 32;
}
if (value >> 16 > 0) {
value >>= 16;
result += 16;
}
if (value >> 8 > 0) {
value >>= 8;
result += 8;
}
if (value >> 4 > 0) {
value >>= 4;
result += 4;
}
if (value >> 2 > 0) {
value >>= 2;
result += 2;
}
if (value >> 1 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 2, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log2(value);
return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 10, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >= 10 ** 64) {
value /= 10 ** 64;
result += 64;
}
if (value >= 10 ** 32) {
value /= 10 ** 32;
result += 32;
}
if (value >= 10 ** 16) {
value /= 10 ** 16;
result += 16;
}
if (value >= 10 ** 8) {
value /= 10 ** 8;
result += 8;
}
if (value >= 10 ** 4) {
value /= 10 ** 4;
result += 4;
}
if (value >= 10 ** 2) {
value /= 10 ** 2;
result += 2;
}
if (value >= 10 ** 1) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 10, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log10(value);
return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 256, rounded down, of a positive value.
* Returns 0 if given 0.
*
* Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
*/
function log256(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 16;
}
if (value >> 64 > 0) {
value >>= 64;
result += 8;
}
if (value >> 32 > 0) {
value >>= 32;
result += 4;
}
if (value >> 16 > 0) {
value >>= 16;
result += 2;
}
if (value >> 8 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 256, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log256(value);
return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard signed math utilities missing in the Solidity language.
*/
library SignedMath {
/**
* @dev Returns the largest of two signed numbers.
*/
function max(int256 a, int256 b) internal pure returns (int256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two signed numbers.
*/
function min(int256 a, int256 b) internal pure returns (int256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two signed numbers without overflow.
* The result is rounded towards zero.
*/
function average(int256 a, int256 b) internal pure returns (int256) {
// Formula from the book "Hacker's Delight"
int256 x = (a & b) + ((a ^ b) >> 1);
return x + (int256(uint256(x) >> 255) & (a ^ b));
}
/**
* @dev Returns the absolute unsigned value of a signed value.
*/
function abs(int256 n) internal pure returns (uint256) {
unchecked {
// must be unchecked in order to support `n = type(int256).min`
return uint256(n >= 0 ? n : -n);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)
pragma solidity ^0.8.0;
import "./math/Math.sol";
import "./math/SignedMath.sol";
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _SYMBOLS = "0123456789abcdef";
uint8 private constant _ADDRESS_LENGTH = 20;
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
unchecked {
uint256 length = Math.log10(value) + 1;
string memory buffer = new string(length);
uint256 ptr;
/// @solidity memory-safe-assembly
assembly {
ptr := add(buffer, add(32, length))
}
while (true) {
ptr--;
/// @solidity memory-safe-assembly
assembly {
mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
}
value /= 10;
if (value == 0) break;
}
return buffer;
}
}
/**
* @dev Converts a `int256` to its ASCII `string` decimal representation.
*/
function toString(int256 value) internal pure returns (string memory) {
return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMath.abs(value))));
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
unchecked {
return toHexString(value, Math.log256(value) + 1);
}
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
/**
* @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
*/
function toHexString(address addr) internal pure returns (string memory) {
return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
}
/**
* @dev Returns true if the two strings are equal.
*/
function equal(string memory a, string memory b) internal pure returns (bool) {
return keccak256(bytes(a)) == keccak256(bytes(b));
}
}// SPDX-License-Identifier: MIT
// ERC721ASpecific Contracts v4.2.3
// Creator: Omni-X
pragma solidity ^0.8.4;
import './IERC721ASpecific.sol';
/**
* @dev Interface of ERC721 token receiver.
*/
interface ERC721A__IERC721Receiver {
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
/**
* @title ERC721ASpecific
*
* @dev Implementation of the [ERC721](https://eips.ethereum.org/EIPS/eip-721)
* Non-Fungible Token Standard, including the Metadata extension.
* Optimized for lower gas during batch mints.
*
* Token IDs in the mint range (_startTokenId <= tokenId < _getMaxId()), will be treated in storage
* as ERC721A, while tokenIds in the global range but outside the mint range will be treated as OZ 721 in storage.
* This hybrid mechanic is to allow layerZero logic to mint a specific Id on another chain if a user bridges.
*
*
* Assumptions:
*
* - An owner cannot have more than 2**64 - 1 (max value of uint64) of supply.
* - The maximum token ID cannot exceed 2**256 - 1 (max value of uint256).
*/
contract ERC721ASpecific is IERC721ASpecific {
// Bypass for a `--via-ir` bug (https://github.com/chiru-labs/ERC721A/pull/364).
struct TokenApprovalRef {
address value;
}
// =============================================================
// CONSTANTS
// =============================================================
// Mask of an entry in packed address data.
uint256 private constant _BITMASK_ADDRESS_DATA_ENTRY = (1 << 64) - 1;
// The bit position of `numberMinted` in packed address data.
uint256 private constant _BITPOS_NUMBER_MINTED = 64;
// The bit position of `numberBurned` in packed address data.
uint256 private constant _BITPOS_NUMBER_BURNED = 128;
// The bit position of `aux` in packed address data.
uint256 private constant _BITPOS_AUX = 192;
// Mask of all 256 bits in packed address data except the 64 bits for `aux`.
uint256 private constant _BITMASK_AUX_COMPLEMENT = (1 << 192) - 1;
// The bit position of `startTimestamp` in packed ownership.
uint256 private constant _BITPOS_START_TIMESTAMP = 160;
// The bit mask of the `burned` bit in packed ownership.
uint256 private constant _BITMASK_BURNED = 1 << 224;
// The bit position of the `nextInitialized` bit in packed ownership.
uint256 private constant _BITPOS_NEXT_INITIALIZED = 225;
// The bit mask of the `nextInitialized` bit in packed ownership.
uint256 private constant _BITMASK_NEXT_INITIALIZED = 1 << 225;
// The bit position of `extraData` in packed ownership.
uint256 private constant _BITPOS_EXTRA_DATA = 232;
// Mask of all 256 bits in a packed ownership except the 24 bits for `extraData`.
uint256 private constant _BITMASK_EXTRA_DATA_COMPLEMENT = (1 << 232) - 1;
// The mask of the lower 160 bits for addresses.
uint256 private constant _BITMASK_ADDRESS = (1 << 160) - 1;
// The maximum `quantity` that can be minted with {_mintERC2309}.
// This limit is to prevent overflows on the address data entries.
// For a limit of 5000, a total of 3.689e15 calls to {_mintERC2309}
// is required to cause an overflow, which is unrealistic.
uint256 private constant _MAX_MINT_ERC2309_QUANTITY_LIMIT = 5000;
// The `Transfer` event signature is given by:
// `keccak256(bytes("Transfer(address,address,uint256)"))`.
bytes32 private constant _TRANSFER_EVENT_SIGNATURE =
0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef;
// =============================================================
// STORAGE
// =============================================================
// The next token ID to be minted.
uint256 private _currentIndex;
// The number of tokens burned.
uint256 private _burnCounter;
// Token name
string private _name;
// Token symbol
string private _symbol;
// Mapping from token ID to ownership details
// An empty struct value does not necessarily mean the token is unowned.
// See {_packedOwnershipOf} implementation for details.
//
// Bits Layout:
// - [0..159] `addr`
// - [160..223] `startTimestamp`
// - [224] `burned`
// - [225] `nextInitialized`
// - [232..255] `extraData`
mapping(uint256 => uint256) private _packedOwnerships;
// Mapping owner address to address data.
//
// Bits Layout:
// - [0..63] `balance`
// - [64..127] `numberMinted`
// - [128..191] `numberBurned`
// - [192..255] `aux`
mapping(address => uint256) private _packedAddressData;
// Mapping from token ID to approved address.
mapping(uint256 => TokenApprovalRef) private _tokenApprovals;
// Mapping from owner to operator approvals
mapping(address => mapping(address => bool)) private _operatorApprovals;
// =============================================================
// CONSTRUCTOR
// =============================================================
constructor(string memory name_, string memory symbol_, uint256 _startId) {
_name = name_;
_symbol = symbol_;
_currentIndex = _startId;
}
// =============================================================
// TOKEN COUNTING OPERATIONS
// =============================================================
function _minTokenId() internal view virtual returns (uint256) {
return 0;
}
function _getMaxId() internal view virtual returns (uint256) {
return 10000;
}
function _getMaxGlobalId() internal view virtual returns (uint256) {
return 10000;
}
/**
* @dev Returns the starting token ID.
* To change the starting token ID, please override this function.
*/
function _startTokenId() internal view virtual returns (uint256) {
return 0;
}
/**
* @dev Returns the next token ID to be minted.
*/
function _nextTokenId() internal view virtual returns (uint256) {
return _currentIndex;
}
/**
* @dev Returns the total amount of tokens minted in the contract.
*/
function _totalMinted() internal view virtual returns (uint256) {
// Counter underflow is impossible as `_currentIndex` does not decrement,
// and it is initialized to `_startTokenId()`.
unchecked {
return _currentIndex - _startTokenId();
}
}
/**
* @dev Returns the total number of tokens burned.
*/
function _totalBurned() internal view virtual returns (uint256) {
return _burnCounter;
}
// =============================================================
// ADDRESS DATA OPERATIONS
// =============================================================
/**
* @dev Returns the number of tokens in `owner`'s account.
*/
function balanceOf(address owner) public view virtual override returns (uint256) {
if (owner == address(0)) _revert(BalanceQueryForZeroAddress.selector);
return _packedAddressData[owner] & _BITMASK_ADDRESS_DATA_ENTRY;
}
/**
* Returns the number of tokens minted by `owner`.
*/
function _numberMinted(address owner) internal view returns (uint256) {
return (_packedAddressData[owner] >> _BITPOS_NUMBER_MINTED) & _BITMASK_ADDRESS_DATA_ENTRY;
}
/**
* Returns the number of tokens burned by or on behalf of `owner`.
*/
function _numberBurned(address owner) internal view returns (uint256) {
return (_packedAddressData[owner] >> _BITPOS_NUMBER_BURNED) & _BITMASK_ADDRESS_DATA_ENTRY;
}
/**
* Returns the auxiliary data for `owner`. (e.g. number of whitelist mint slots used).
*/
function _getAux(address owner) internal view returns (uint64) {
return uint64(_packedAddressData[owner] >> _BITPOS_AUX);
}
/**
* Sets the auxiliary data for `owner`. (e.g. number of whitelist mint slots used).
* If there are multiple variables, please pack them into a uint64.
*/
function _setAux(address owner, uint64 aux) internal virtual {
uint256 packed = _packedAddressData[owner];
uint256 auxCasted;
// Cast `aux` with assembly to avoid redundant masking.
assembly {
auxCasted := aux
}
packed = (packed & _BITMASK_AUX_COMPLEMENT) | (auxCasted << _BITPOS_AUX);
_packedAddressData[owner] = packed;
}
// =============================================================
// IERC165
// =============================================================
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified)
* to learn more about how these ids are created.
*
* This function call must use less than 30000 gas.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
// The interface IDs are constants representing the first 4 bytes
// of the XOR of all function selectors in the interface.
// See: [ERC165](https://eips.ethereum.org/EIPS/eip-165)
// (e.g. `bytes4(i.functionA.selector ^ i.functionB.selector ^ ...)`)
return
interfaceId == 0x01ffc9a7 || // ERC165 interface ID for ERC165.
interfaceId == 0x80ac58cd || // ERC165 interface ID for ERC721.
interfaceId == 0x5b5e139f; // ERC165 interface ID for ERC721Metadata.
}
// =============================================================
// IERC721Metadata
// =============================================================
/**
* @dev Returns the token collection name.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev Returns the token collection symbol.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
*/
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
if (!_exists(tokenId)) _revert(URIQueryForNonexistentToken.selector);
string memory baseURI = _baseURI();
return bytes(baseURI).length != 0 ? string(abi.encodePacked(baseURI, _toString(tokenId))) : '';
}
/**
* @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
* token will be the concatenation of the `baseURI` and the `tokenId`. Empty
* by default, it can be overridden in child contracts.
*/
function _baseURI() internal view virtual returns (string memory) {
return '';
}
// =============================================================
// OWNERSHIPS OPERATIONS
// =============================================================
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) public view virtual override returns (address) {
return address(uint160(_packedOwnershipOf(tokenId)));
}
/**
* @dev Gas spent here starts off proportional to the maximum mint batch size.
* It gradually moves to O(1) as tokens get transferred around over time.
* This will only hold valid values for nextInitialized and burned if tokenId is within mint range (_startTokenId <= tokenId <= maxId)
*/
function _ownershipOf(uint256 tokenId) internal view virtual returns (TokenOwnership memory) {
return _unpackedOwnership(_packedOwnershipOf(tokenId));
}
/**
* @dev Returns the unpacked `TokenOwnership` struct at `index`.
*/
function _ownershipAt(uint256 index) internal view virtual returns (TokenOwnership memory) {
return _unpackedOwnership(_packedOwnerships[index]);
}
/**
* @dev Returns whether the ownership slot at `index` is initialized.
* An uninitialized slot does not necessarily mean that the slot has no owner.
*/
function _ownershipIsInitialized(uint256 index) internal view virtual returns (bool) {
return _packedOwnerships[index] != 0;
}
/**
* @dev Initializes the ownership slot minted at `index` for efficiency purposes.
*/
function _initializeOwnershipAt(uint256 index) internal virtual {
if (_packedOwnerships[index] == 0) {
_packedOwnerships[index] = _packedOwnershipOf(index);
}
}
/**
* Returns the packed ownership data of `tokenId`.
*/
function _packedOwnershipOf(uint256 tokenId) private view returns (uint256 packed) {
if (_startTokenId() <= tokenId && tokenId < _currentIndex) {
packed = _packedOwnerships[tokenId];
// If the data at the starting slot does not exist, start the scan.
if (packed == 0) {
// Invariant:
// There will always be an initialized ownership slot
// (i.e. `ownership.addr != address(0) && ownership.burned == false`)
// before an unintialized ownership slot
// (i.e. `ownership.addr == address(0) && ownership.burned == false`)
// Hence, `tokenId` will not underflow.
//
// We can directly compare the packed value.
// If the address is zero, packed will be zero.
for (;;) {
unchecked {
packed = _packedOwnerships[--tokenId];
}
if (packed == 0) continue;
if (packed & _BITMASK_BURNED == 0) return packed;
// Otherwise, the token is burned, and we must revert.
// This handles the case of batch burned tokens, where only the burned bit
// of the starting slot is set, and remaining slots are left uninitialized.
_revert(OwnerQueryForNonexistentToken.selector);
}
}
// Otherwise, the data exists and we can skip the scan.
// This is possible because we have already achieved the target condition.
// This saves 2143 gas on transfers of initialized tokens.
// If the token is not burned, return `packed`. Otherwise, revert.
if (packed & _BITMASK_BURNED == 0) return packed;
} else if (tokenId <= _getMaxGlobalId()) {
packed = _packedOwnerships[tokenId];
if (packed != 0) return packed;
}
_revert(OwnerQueryForNonexistentToken.selector);
}
/**
* @dev Returns the unpacked `TokenOwnership` struct from `packed`.
*/
function _unpackedOwnership(uint256 packed) private pure returns (TokenOwnership memory ownership) {
ownership.addr = address(uint160(packed));
ownership.startTimestamp = uint64(packed >> _BITPOS_START_TIMESTAMP);
ownership.burned = packed & _BITMASK_BURNED != 0;
ownership.extraData = uint24(packed >> _BITPOS_EXTRA_DATA);
}
/**
* @dev Packs ownership data into a single uint256.
*/
function _packOwnershipData(address owner, uint256 flags) private view returns (uint256 result) {
assembly {
// Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean.
owner := and(owner, _BITMASK_ADDRESS)
// `owner | (block.timestamp << _BITPOS_START_TIMESTAMP) | flags`.
result := or(owner, or(shl(_BITPOS_START_TIMESTAMP, timestamp()), flags))
}
}
/**
* @dev Returns the `nextInitialized` flag set if `quantity` equals 1.
*/
function _nextInitializedFlag(uint256 quantity) private pure returns (uint256 result) {
// For branchless setting of the `nextInitialized` flag.
assembly {
// `(quantity == 1) << _BITPOS_NEXT_INITIALIZED`.
result := shl(_BITPOS_NEXT_INITIALIZED, eq(quantity, 1))
}
}
// =============================================================
// APPROVAL OPERATIONS
// =============================================================
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account. See {ERC721A-_approve}.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
*/
function approve(address to, uint256 tokenId) public payable virtual override {
_approve(to, tokenId, true);
}
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) public view virtual override returns (address) {
if (!_exists(tokenId)) _revert(ApprovalQueryForNonexistentToken.selector);
return _tokenApprovals[tokenId].value;
}
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom}
* for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool approved) public virtual override {
_operatorApprovals[_msgSenderERC721A()][operator] = approved;
emit ApprovalForAll(_msgSenderERC721A(), operator, approved);
}
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}.
*/
function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
return _operatorApprovals[owner][operator];
}
/**
* @dev Returns whether `tokenId` exists.
*
* Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
*
* Tokens start existing when they are minted. See {_mint}.
*/
function _exists(uint256 tokenId) internal view virtual returns (bool result) {
if (_startTokenId() <= tokenId && tokenId < _currentIndex) {
uint256 packed;
while ((packed = _packedOwnerships[tokenId]) == 0) --tokenId;
result = packed & _BITMASK_BURNED == 0;
} else {
if (_getMaxGlobalId() >= tokenId) {
result = _packedOwnerships[tokenId] != 0;
}
}
}
/**
* @dev Returns whether `msgSender` is equal to `approvedAddress` or `owner`.
*/
function _isSenderApprovedOrOwner(
address approvedAddress,
address owner,
address msgSender
) private pure returns (bool result) {
assembly {
// Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean.
owner := and(owner, _BITMASK_ADDRESS)
// Mask `msgSender` to the lower 160 bits, in case the upper bits somehow aren't clean.
msgSender := and(msgSender, _BITMASK_ADDRESS)
// `msgSender == owner || msgSender == approvedAddress`.
result := or(eq(msgSender, owner), eq(msgSender, approvedAddress))
}
}
/**
* @dev Returns the storage slot and value for the approved address of `tokenId`.
*/
function _getApprovedSlotAndAddress(uint256 tokenId)
private
view
returns (uint256 approvedAddressSlot, address approvedAddress)
{
TokenApprovalRef storage tokenApproval = _tokenApprovals[tokenId];
// The following is equivalent to `approvedAddress = _tokenApprovals[tokenId].value`.
assembly {
approvedAddressSlot := tokenApproval.slot
approvedAddress := sload(approvedAddressSlot)
}
}
// =============================================================
// TRANSFER OPERATIONS
// =============================================================
/**
* @dev This function is called by and only by LayerZero ONFT721A
*
* This function bypasses token approvals because of the above assumption
*
* This function should act just as transferFrom (minus the approval) for tokenIds in this chains mint range
* Otherwise this function should act just as transferFrom minus adjusting nextInitialized because Ids in this
* range are treated as OZ 721.
*/
function bridgeTransfer(
address from,
address to,
uint256 tokenId
) internal {
uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId);
from = address(uint160(uint256(uint160(from)) & _BITMASK_ADDRESS));
if (address(uint160(prevOwnershipPacked)) != from) _revert(TransferFromIncorrectOwner.selector);
if (_startTokenId() <= tokenId && tokenId <= _getMaxId()) {
unchecked {
// We can directly increment and decrement the balances.
--_packedAddressData[from]; // Updates: `balance -= 1`.
++_packedAddressData[to]; // Updates: `balance += 1`.
// Updates:
// - `address` to the next owner.
// - `startTimestamp` to the timestamp of transfering.
// - `burned` to `false`.
// - `nextInitialized` to `true`.
_packedOwnerships[tokenId] = _packOwnershipData(
to,
0
);
// If the next slot may not have been initialized (i.e. `nextInitialized == false`) .
if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) {
uint256 nextTokenId = tokenId + 1;
// If the next slot's address is zero and not burned (i.e. packed value is zero).
if (_packedOwnerships[nextTokenId] == 0) {
// If the next slot is within bounds.
if (nextTokenId != _currentIndex) {
// Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`.
_packedOwnerships[nextTokenId] = prevOwnershipPacked;
}
}
}
}
} else {
unchecked {
// We can directly increment and decrement the balances.
--_packedAddressData[from]; // Updates: `balance -= 1`.
++_packedAddressData[to]; // Updates: `balance += 1`.
// Updates:
// - `address` to the next owner.
// - `startTimestamp` to the timestamp of transfering.
// - `burned` to `false`.
// - `nextInitialized` to `true`.
_packedOwnerships[tokenId] = _packOwnershipData(
to,
0
);
// no need to adjust next initialized value since tokenIds not in the mint are mapped one to one with an owner (like OZ) unlike tokenIds in the mintRange
}
}
uint256 toMasked = uint256(uint160(to)) & _BITMASK_ADDRESS;
assembly {
// Emit the `Transfer` event.
log4(
0, // Start of data (0, since no data).
0, // End of data (0, since no data).
_TRANSFER_EVENT_SIGNATURE, // Signature.
from, // `from`.
toMasked, // `to`.
tokenId // `tokenId`.
)
}
if (toMasked == 0) _revert(TransferToZeroAddress.selector);
}
/**
* @dev Transfers `tokenId` from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token
* by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) public payable virtual override {
uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId);
// Mask `from` to the lower 160 bits, in case the upper bits somehow aren't clean.
from = address(uint160(uint256(uint160(from)) & _BITMASK_ADDRESS));
if (address(uint160(prevOwnershipPacked)) != from) _revert(TransferFromIncorrectOwner.selector);
(uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId);
// The nested ifs save around 20+ gas over a compound boolean condition.
if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A()))
if (!isApprovedForAll(from, _msgSenderERC721A())) _revert(TransferCallerNotOwnerNorApproved.selector);
_beforeTokenTransfers(from, to, tokenId, 1);
// Clear approvals from the previous owner.
assembly {
if approvedAddress {
// This is equivalent to `delete _tokenApprovals[tokenId]`.
sstore(approvedAddressSlot, 0)
}
}
// Underflow of the sender's balance is impossible because we check for
// ownership above and the recipient's balance can't realistically overflow.
// Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256.
unchecked {
// We can directly increment and decrement the balances.
--_packedAddressData[from]; // Updates: `balance -= 1`.
++_packedAddressData[to]; // Updates: `balance += 1`.
// Updates:
// - `address` to the next owner.
// - `startTimestamp` to the timestamp of transfering.
// - `burned` to `false`.
// - `nextInitialized` to `true`.
_packedOwnerships[tokenId] = _packOwnershipData(
to,
_BITMASK_NEXT_INITIALIZED | _nextExtraData(from, to, prevOwnershipPacked)
);
// If the next slot may not have been initialized (i.e. `nextInitialized == false`) .
if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) {
uint256 nextTokenId = tokenId + 1;
// If the next slot's address is zero and not burned (i.e. packed value is zero).
if (_packedOwnerships[nextTokenId] == 0) {
// If the next slot is within bounds.
if (nextTokenId != _currentIndex) {
// Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`.
_packedOwnerships[nextTokenId] = prevOwnershipPacked;
}
}
}
}
// Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean.
uint256 toMasked = uint256(uint160(to)) & _BITMASK_ADDRESS;
assembly {
// Emit the `Transfer` event.
log4(
0, // Start of data (0, since no data).
0, // End of data (0, since no data).
_TRANSFER_EVENT_SIGNATURE, // Signature.
from, // `from`.
toMasked, // `to`.
tokenId // `tokenId`.
)
}
if (toMasked == 0) _revert(TransferToZeroAddress.selector);
_afterTokenTransfers(from, to, tokenId, 1);
}
/**
* @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public payable virtual override {
safeTransferFrom(from, to, tokenId, '');
}
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token
* by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement
* {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory _data
) public payable virtual override {
transferFrom(from, to, tokenId);
if (to.code.length != 0)
if (!_checkContractOnERC721Received(from, to, tokenId, _data)) {
_revert(TransferToNonERC721ReceiverImplementer.selector);
}
}
/**
* @dev Hook that is called before a set of serially-ordered token IDs
* are about to be transferred. This includes minting.
* And also called before burning one token.
*
* `startTokenId` - the first token ID to be transferred.
* `quantity` - the amount to be transferred.
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, `from`'s `tokenId` will be
* transferred to `to`.
* - When `from` is zero, `tokenId` will be minted for `to`.
* - When `to` is zero, `tokenId` will be burned by `from`.
* - `from` and `to` are never both zero.
*/
function _beforeTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
) internal virtual {}
/**
* @dev Hook that is called after a set of serially-ordered token IDs
* have been transferred. This includes minting.
* And also called after one token has been burned.
*
* `startTokenId` - the first token ID to be transferred.
* `quantity` - the amount to be transferred.
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, `from`'s `tokenId` has been
* transferred to `to`.
* - When `from` is zero, `tokenId` has been minted for `to`.
* - When `to` is zero, `tokenId` has been burned by `from`.
* - `from` and `to` are never both zero.
*/
function _afterTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
) internal virtual {}
/**
* @dev Private function to invoke {IERC721Receiver-onERC721Received} on a target contract.
*
* `from` - Previous owner of the given token ID.
* `to` - Target address that will receive the token.
* `tokenId` - Token ID to be transferred.
* `_data` - Optional data to send along with the call.
*
* Returns whether the call correctly returned the expected magic value.
*/
function _checkContractOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory _data
) private returns (bool) {
try ERC721A__IERC721Receiver(to).onERC721Received(_msgSenderERC721A(), from, tokenId, _data) returns (
bytes4 retval
) {
return retval == ERC721A__IERC721Receiver(to).onERC721Received.selector;
} catch (bytes memory reason) {
if (reason.length == 0) {
_revert(TransferToNonERC721ReceiverImplementer.selector);
}
assembly {
revert(add(32, reason), mload(reason))
}
}
}
// =============================================================
// MINT OPERATIONS
// =============================================================
/**
* @dev minting function only used by LZ ONFT721A contract. This
* function is only called in the case someone bridge to this chain
* and the tokenId doesn't already exist and is owned by the NFT contract
*
*
*/
function bridgeMint(
address to,
uint256 tokenId
) internal {
if (tokenId > _getMaxGlobalId()) _revert(TokenIdOutOfRange.selector);
if (tokenId >= _startTokenId() && tokenId <= _getMaxId()) _revert(InvalidBridgeId.selector);
unchecked {
// Updates:
// - `address` to the owner.
// - `startTimestamp` to the timestamp of minting.
// - `burned` to `false`.
// - `nextInitialized` to `quantity == 1`.
_packedOwnerships[tokenId] = _packOwnershipData(
to,
0
);
_packedAddressData[to] += 1 * ((1 << _BITPOS_NUMBER_MINTED) | 1);
// Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean.
uint256 toMasked = uint256(uint160(to)) & _BITMASK_ADDRESS;
if (toMasked == 0) _revert(MintToZeroAddress.selector);
assembly {
// Emit the `Transfer` event.
log4(
0, // Start of data (0, since no data).
0, // End of data (0, since no data).
_TRANSFER_EVENT_SIGNATURE, // Signature.
0, // `address(0)`.
toMasked, // `to`.
tokenId // `tokenId`.
)
}
}
}
/**
* @dev Mints `quantity` tokens and transfers them to `to`.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `quantity` must be greater than 0.
*
* Emits a {Transfer} event for each mint.
*/
function _mint(address to, uint256 quantity) internal virtual {
uint256 startTokenId = _currentIndex;
if (quantity == 0) _revert(MintZeroQuantity.selector);
_beforeTokenTransfers(address(0), to, startTokenId, quantity);
// Overflows are incredibly unrealistic.
// `balance` and `numberMinted` have a maximum limit of 2**64.
// `tokenId` has a maximum limit of 2**256.
unchecked {
// Updates:
// - `address` to the owner.
// - `startTimestamp` to the timestamp of minting.
// - `burned` to `false`.
// - `nextInitialized` to `quantity == 1`.
_packedOwnerships[startTokenId] = _packOwnershipData(
to,
_nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0)
);
// Updates:
// - `balance += quantity`.
// - `numberMinted += quantity`.
//
// We can directly add to the `balance` and `numberMinted`.
_packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1);
// Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean.
uint256 toMasked = uint256(uint160(to)) & _BITMASK_ADDRESS;
if (toMasked == 0) _revert(MintToZeroAddress.selector);
uint256 end = startTokenId + quantity;
uint256 tokenId = startTokenId;
do {
assembly {
// Emit the `Transfer` event.
log4(
0, // Start of data (0, since no data).
0, // End of data (0, since no data).
_TRANSFER_EVENT_SIGNATURE, // Signature.
0, // `address(0)`.
toMasked, // `to`.
tokenId // `tokenId`.
)
}
// The `!=` check ensures that large values of `quantity`
// that overflows uint256 will make the loop run out of gas.
} while (++tokenId != end);
_currentIndex = end;
}
_afterTokenTransfers(address(0), to, startTokenId, quantity);
}
/**
* @dev Mints `quantity` tokens and transfers them to `to`.
*
* This function is intended for efficient minting only during contract creation.
*
* It emits only one {ConsecutiveTransfer} as defined in
* [ERC2309](https://eips.ethereum.org/EIPS/eip-2309),
* instead of a sequence of {Transfer} event(s).
*
* Calling this function outside of contract creation WILL make your contract
* non-compliant with the ERC721 standard.
* For full ERC721 compliance, substituting ERC721 {Transfer} event(s) with the ERC2309
* {ConsecutiveTransfer} event is only permissible during contract creation.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `quantity` must be greater than 0.
*
* Emits a {ConsecutiveTransfer} event.
*/
function _mintERC2309(address to, uint256 quantity) internal virtual {
uint256 startTokenId = _currentIndex;
if (to == address(0)) _revert(MintToZeroAddress.selector);
if (quantity == 0) _revert(MintZeroQuantity.selector);
if (quantity > _MAX_MINT_ERC2309_QUANTITY_LIMIT) _revert(MintERC2309QuantityExceedsLimit.selector);
_beforeTokenTransfers(address(0), to, startTokenId, quantity);
// Overflows are unrealistic due to the above check for `quantity` to be below the limit.
unchecked {
// Updates:
// - `balance += quantity`.
// - `numberMinted += quantity`.
//
// We can directly add to the `balance` and `numberMinted`.
_packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1);
// Updates:
// - `address` to the owner.
// - `startTimestamp` to the timestamp of minting.
// - `burned` to `false`.
// - `nextInitialized` to `quantity == 1`.
_packedOwnerships[startTokenId] = _packOwnershipData(
to,
_nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0)
);
emit ConsecutiveTransfer(startTokenId, startTokenId + quantity - 1, address(0), to);
_currentIndex = startTokenId + quantity;
}
_afterTokenTransfers(address(0), to, startTokenId, quantity);
}
/**
* @dev Safely mints `quantity` tokens and transfers them to `to`.
*
* Requirements:
*
* - If `to` refers to a smart contract, it must implement
* {IERC721Receiver-onERC721Received}, which is called for each safe transfer.
* - `quantity` must be greater than 0.
*
* See {_mint}.
*
* Emits a {Transfer} event for each mint.
*/
function _safeMint(
address to,
uint256 quantity,
bytes memory _data
) internal virtual {
_mint(to, quantity);
unchecked {
if (to.code.length != 0) {
uint256 end = _currentIndex;
uint256 index = end - quantity;
do {
if (!_checkContractOnERC721Received(address(0), to, index++, _data)) {
_revert(TransferToNonERC721ReceiverImplementer.selector);
}
} while (index < end);
// Reentrancy protection.
if (_currentIndex != end) _revert(bytes4(0));
}
}
}
/**
* @dev Equivalent to `_safeMint(to, quantity, '')`.
*/
function _safeMint(address to, uint256 quantity) internal virtual {
_safeMint(to, quantity, '');
}
// =============================================================
// APPROVAL OPERATIONS
// =============================================================
/**
* @dev Equivalent to `_approve(to, tokenId, false)`.
*/
function _approve(address to, uint256 tokenId) internal virtual {
_approve(to, tokenId, false);
}
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the
* zero address clears previous approvals.
*
* Requirements:
*
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function _approve(
address to,
uint256 tokenId,
bool approvalCheck
) internal virtual {
address owner = ownerOf(tokenId);
if (approvalCheck && _msgSenderERC721A() != owner)
if (!isApprovedForAll(owner, _msgSenderERC721A())) {
_revert(ApprovalCallerNotOwnerNorApproved.selector);
}
_tokenApprovals[tokenId].value = to;
emit Approval(owner, to, tokenId);
}
// =============================================================
// BURN OPERATIONS
// =============================================================
/**
* @dev Equivalent to `_burn(tokenId, false)`.
*/
function _burn(uint256 tokenId) internal virtual {
_burn(tokenId, false);
}
/**
* @dev Destroys `tokenId`.
* The approval is cleared when the token is burned.
*
* Requirements:
*
* - `tokenId` must exist.
*
* Emits a {Transfer} event.
*/
function _burn(uint256 tokenId, bool approvalCheck) internal virtual {
uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId);
address from = address(uint160(prevOwnershipPacked));
(uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId);
if (approvalCheck) {
// The nested ifs save around 20+ gas over a compound boolean condition.
if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A()))
if (!isApprovedForAll(from, _msgSenderERC721A())) _revert(TransferCallerNotOwnerNorApproved.selector);
}
_beforeTokenTransfers(from, address(0), tokenId, 1);
// Clear approvals from the previous owner.
assembly {
if approvedAddress {
// This is equivalent to `delete _tokenApprovals[tokenId]`.
sstore(approvedAddressSlot, 0)
}
}
// Underflow of the sender's balance is impossible because we check for
// ownership above and the recipient's balance can't realistically overflow.
// Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256.
unchecked {
// Updates:
// - `balance -= 1`.
// - `numberBurned += 1`.
//
// We can directly decrement the balance, and increment the number burned.
// This is equivalent to `packed -= 1; packed += 1 << _BITPOS_NUMBER_BURNED;`.
_packedAddressData[from] += (1 << _BITPOS_NUMBER_BURNED) - 1;
// Updates:
// - `address` to the last owner.
// - `startTimestamp` to the timestamp of burning.
// - `burned` to `true`.
// - `nextInitialized` to `true`.
_packedOwnerships[tokenId] = _packOwnershipData(
from,
(_BITMASK_BURNED | _BITMASK_NEXT_INITIALIZED) | _nextExtraData(from, address(0), prevOwnershipPacked)
);
// If the next slot may not have been initialized (i.e. `nextInitialized == false`) .
if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) {
uint256 nextTokenId = tokenId + 1;
// If the next slot's address is zero and not burned (i.e. packed value is zero).
if (_packedOwnerships[nextTokenId] == 0) {
// If the next slot is within bounds.
if (nextTokenId != _currentIndex) {
// Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`.
_packedOwnerships[nextTokenId] = prevOwnershipPacked;
}
}
}
}
emit Transfer(from, address(0), tokenId);
_afterTokenTransfers(from, address(0), tokenId, 1);
// Overflow not possible, as _burnCounter cannot be exceed _currentIndex times.
unchecked {
_burnCounter++;
}
}
// =============================================================
// EXTRA DATA OPERATIONS
// =============================================================
/**
* @dev Directly sets the extra data for the ownership data `index`.
*/
function _setExtraDataAt(uint256 index, uint24 extraData) internal virtual {
uint256 packed = _packedOwnerships[index];
if (packed == 0) _revert(OwnershipNotInitializedForExtraData.selector);
uint256 extraDataCasted;
// Cast `extraData` with assembly to avoid redundant masking.
assembly {
extraDataCasted := extraData
}
packed = (packed & _BITMASK_EXTRA_DATA_COMPLEMENT) | (extraDataCasted << _BITPOS_EXTRA_DATA);
_packedOwnerships[index] = packed;
}
/**
* @dev Called during each token transfer to set the 24bit `extraData` field.
* Intended to be overridden by the cosumer contract.
*
* `previousExtraData` - the value of `extraData` before transfer.
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, `from`'s `tokenId` will be
* transferred to `to`.
* - When `from` is zero, `tokenId` will be minted for `to`.
* - When `to` is zero, `tokenId` will be burned by `from`.
* - `from` and `to` are never both zero.
*/
function _extraData(
address from,
address to,
uint24 previousExtraData
) internal view virtual returns (uint24) {}
/**
* @dev Returns the next extra data for the packed ownership data.
* The returned result is shifted into position.
*/
function _nextExtraData(
address from,
address to,
uint256 prevOwnershipPacked
) private view returns (uint256) {
uint24 extraData = uint24(prevOwnershipPacked >> _BITPOS_EXTRA_DATA);
return uint256(_extraData(from, to, extraData)) << _BITPOS_EXTRA_DATA;
}
// =============================================================
// OTHER OPERATIONS
// =============================================================
/**
* @dev Returns the message sender (defaults to `msg.sender`).
*
* If you are writing GSN compatible contracts, you need to override this function.
*/
function _msgSenderERC721A() internal view virtual returns (address) {
return msg.sender;
}
/**
* @dev Converts a uint256 to its ASCII string decimal representation.
*/
function _toString(uint256 value) internal pure virtual returns (string memory str) {
assembly {
// The maximum value of a uint256 contains 78 digits (1 byte per digit), but
// we allocate 0xa0 bytes to keep the free memory pointer 32-byte word aligned.
// We will need 1 word for the trailing zeros padding, 1 word for the length,
// and 3 words for a maximum of 78 digits. Total: 5 * 0x20 = 0xa0.
let m := add(mload(0x40), 0xa0)
// Update the free memory pointer to allocate.
mstore(0x40, m)
// Assign the `str` to the end.
str := sub(m, 0x20)
// Zeroize the slot after the string.
mstore(str, 0)
// Cache the end of the memory to calculate the length later.
let end := str
// We write the string from rightmost digit to leftmost digit.
// The following is essentially a do-while loop that also handles the zero case.
// prettier-ignore
for { let temp := value } 1 {} {
str := sub(str, 1)
// Write the character to the pointer.
// The ASCII index of the '0' character is 48.
mstore8(str, add(48, mod(temp, 10)))
// Keep dividing `temp` until zero.
temp := div(temp, 10)
// prettier-ignore
if iszero(temp) { break }
}
let length := sub(end, str)
// Move the pointer 32 bytes leftwards to make room for the length.
str := sub(str, 0x20)
// Store the length.
mstore(str, length)
}
}
/**
* @dev For more efficient reverts.
*/
function _revert(bytes4 errorSelector) internal pure {
assembly {
mstore(0x00, errorSelector)
revert(0x00, 0x04)
}
}
}// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.2.3
// Creator: Chiru Labs
pragma solidity ^0.8.4;
/**
* @dev Interface of ERC721A.
*/
interface IERC721ASpecific {
/**
* The caller must own the token or be an approved operator.
*/
error ApprovalCallerNotOwnerNorApproved();
/**
* The token does not exist.
*/
error ApprovalQueryForNonexistentToken();
/**
* Cannot query the balance for the zero address.
*/
error BalanceQueryForZeroAddress();
/**
* Bridge cannot mint tokenIds in this range
*/
error InvalidBridgeId();
/**
* When the tokenId exceeds supply cap
*/
error TokenIdOutOfRange();
/**
* Cannot mint to the zero address.
*/
error MintToZeroAddress();
/**
* The quantity of tokens minted must be more than zero.
*/
error MintZeroQuantity();
/**
* The token does not exist.
*/
error OwnerQueryForNonexistentToken();
/**
* The caller must own the token or be an approved operator.
*/
error TransferCallerNotOwnerNorApproved();
/**
* The token must be owned by `from`.
*/
error TransferFromIncorrectOwner();
/**
* Cannot safely transfer to a contract that does not implement the
* ERC721Receiver interface.
*/
error TransferToNonERC721ReceiverImplementer();
/**
* Cannot transfer to the zero address.
*/
error TransferToZeroAddress();
/**
* The token does not exist.
*/
error URIQueryForNonexistentToken();
/**
* The `quantity` minted with ERC2309 exceeds the safety limit.
*/
error MintERC2309QuantityExceedsLimit();
/**
* The `extraData` cannot be set on an unintialized ownership slot.
*/
error OwnershipNotInitializedForExtraData();
// =============================================================
// STRUCTS
// =============================================================
struct TokenOwnership {
// The address of the owner.
address addr;
// Stores the start time of ownership with minimal overhead for tokenomics.
uint64 startTimestamp;
// Whether the token has been burned.
bool burned;
// Arbitrary data similar to `startTimestamp` that can be set via {_extraData}.
uint24 extraData;
}
// =============================================================
// TOKEN COUNTERS
// =============================================================
// =============================================================
// IERC165
// =============================================================
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified)
* to learn more about how these ids are created.
*
* This function call must use less than 30000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
// =============================================================
// IERC721
// =============================================================
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables
* (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in `owner`'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`,
* checking first that contract recipients are aware of the ERC721 protocol
* to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be have been allowed to move
* this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement
* {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external payable;
/**
* @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external payable;
/**
* @dev Transfers `tokenId` from `from` to `to`.
*
* WARNING: Usage of this method is discouraged, use {safeTransferFrom}
* whenever possible.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token
* by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) external payable;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the
* zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external payable;
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom}
* for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool _approved) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}.
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
// =============================================================
// IERC721Metadata
// =============================================================
/**
* @dev Returns the token collection name.
*/
function name() external view returns (string memory);
/**
* @dev Returns the token collection symbol.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
*/
function tokenURI(uint256 tokenId) external view returns (string memory);
// =============================================================
// IERC2309
// =============================================================
/**
* @dev Emitted when tokens in `fromTokenId` to `toTokenId`
* (inclusive) is transferred from `from` to `to`, as defined in the
* [ERC2309](https://eips.ethereum.org/EIPS/eip-2309) standard.
*
* See {_mintERC2309} for more details.
*/
event ConsecutiveTransfer(uint256 indexed fromTokenId, uint256 toTokenId, address indexed from, address indexed to);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IONFT721ACore.sol";
import "./IERC721ASpecific.sol";
/**
* @dev Interface of the ONFT standard
*/
interface IONFT721A is IONFT721ACore, IERC721ASpecific {
function supportsInterface(bytes4 interfaceId) external view override(IERC165, IERC721ASpecific) returns (bool);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/introspection/IERC165.sol";
interface IONFT721ACore is IERC165 {
/**
* @dev Emitted when `_tokenIds[]` are moved from the `_sender` to (`_dstChainId`, `_toAddress`)
* `_nonce` is the outbound nonce from
*/
event SendToChain(uint16 indexed _dstChainId, address indexed _from, bytes indexed _toAddress, uint[] _tokenIds);
event ReceiveFromChain(uint16 indexed _srcChainId, bytes indexed _srcAddress, address indexed _toAddress, uint[] _tokenIds);
event SetMinGasToTransferAndStore(uint256 _minGasToTransferAndStore);
event SetDstChainIdToTransferGas(uint16 _dstChainId, uint256 _dstChainIdToTransferGas);
event SetDstChainIdToBatchLimit(uint16 _dstChainId, uint256 _dstChainIdToBatchLimit);
/**
* @dev Emitted when `_payload` was received from lz, but not enough gas to deliver all tokenIds
*/
event CreditStored(bytes32 _hashedPayload, bytes _payload);
/**
* @dev Emitted when `_hashedPayload` has been completely delivered
*/
event CreditCleared(bytes32 _hashedPayload);
/**
* @dev send token `_tokenId` to (`_dstChainId`, `_toAddress`) from `_from`
* `_toAddress` can be any size depending on the `dstChainId`.
* `_zroPaymentAddress` set to address(0x0) if not paying in ZRO (LayerZero Token)
* `_adapterParams` is a flexible bytes array to indicate messaging adapter services
*/
function sendFrom(address _from, uint16 _dstChainId, bytes calldata _toAddress, uint _tokenId, address payable _refundAddress, address _zroPaymentAddress, bytes calldata _adapterParams) external payable;
/**
* @dev send tokens `_tokenIds[]` to (`_dstChainId`, `_toAddress`) from `_from`
* `_toAddress` can be any size depending on the `dstChainId`.
* `_zroPaymentAddress` set to address(0x0) if not paying in ZRO (LayerZero Token)
* `_adapterParams` is a flexible bytes array to indicate messaging adapter services
*/
function sendBatchFrom(address _from, uint16 _dstChainId, bytes calldata _toAddress, uint[] calldata _tokenIds, address payable _refundAddress, address _zroPaymentAddress, bytes calldata _adapterParams) external payable;
/**
* @dev estimate send token `_tokenId` to (`_dstChainId`, `_toAddress`)
* _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
* _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, bool _useZro, bytes calldata _adapterParams) external view returns (uint nativeFee, uint zroFee);
/**
* @dev estimate send token `_tokenId` to (`_dstChainId`, `_toAddress`)
* _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
* _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, bool _useZro, bytes calldata _adapterParams) external view returns (uint nativeFee, uint zroFee);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IONFT721A.sol";
import "./ONFT721AOpenCore.sol";
import "./ERC721ASpecific.sol";
contract ONFT721AOpen is ONFT721AOpenCore, ERC721ASpecific, IONFT721A {
constructor(string memory _name, string memory _symbol, uint256 _minGasToTransfer, address _lzEndpoint, uint256 _startId) ERC721ASpecific(_name, _symbol, _startId) ONFT721AOpenCore(_minGasToTransfer, _lzEndpoint) {}
function supportsInterface(bytes4 interfaceId) public view virtual override(ONFT721AOpenCore, ERC721ASpecific, IONFT721A) returns (bool) {
return interfaceId == type(IONFT721A).interfaceId || super.supportsInterface(interfaceId);
}
function _debitFrom(address _from, uint16, bytes memory, uint _tokenId) internal virtual override {
bridgeTransfer(_from, address(this), _tokenId);
}
function _creditTo(uint16, address _toAddress, uint _tokenId) internal virtual override {
require(!_exists(_tokenId) || (_exists(_tokenId) && ERC721ASpecific.ownerOf(_tokenId) == address(this)));
if (!_exists(_tokenId)) {
bridgeMint(_toAddress, _tokenId);
} else {
bridgeTransfer(address(this), _toAddress, _tokenId);
}
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@layerzerolabs/solidity-examples/contracts/lzApp/NonblockingLzApp.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "./IONFT721ACore.sol";
abstract contract ONFT721AOpenCore is NonblockingLzApp, ERC165, ReentrancyGuard, IONFT721ACore {
uint16 public constant FUNCTION_TYPE_SEND = 1;
uint public bridgeFee;
struct StoredCredit {
uint16 srcChainId;
address toAddress;
uint256 index; // which index of the tokenIds remain
bool creditsRemain;
}
uint256 public minGasToTransferAndStore; // min amount of gas required to transfer, and also store the payload
mapping(uint16 => uint256) public dstChainIdToBatchLimit;
mapping(uint16 => uint256) public dstChainIdToTransferGas; // per transfer amount of gas required to mint/transfer on the dst
mapping(bytes32 => StoredCredit) public storedCredits;
constructor(uint256 _minGasToTransferAndStore, address _lzEndpoint) NonblockingLzApp(_lzEndpoint) {
require(_minGasToTransferAndStore > 0, "minGasToTransferAndStore must be > 0");
minGasToTransferAndStore = _minGasToTransferAndStore;
}
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return interfaceId == type(IONFT721ACore).interfaceId || super.supportsInterface(interfaceId);
}
function estimateSendFee(uint16 _dstChainId, bytes memory _toAddress, uint _tokenId, bool _useZro, bytes memory _adapterParams) public view virtual override returns (uint nativeFee, uint zroFee) {
return estimateSendBatchFee(_dstChainId, _toAddress, _toSingletonArray(_tokenId), _useZro, _adapterParams);
}
function estimateSendBatchFee(uint16 _dstChainId, bytes memory _toAddress, uint[] memory _tokenIds, bool _useZro, bytes memory _adapterParams) public view virtual override returns (uint, uint) {
bytes memory payload = abi.encode(_toAddress, _tokenIds);
(uint nativeFee, uint zroFee) = lzEndpoint.estimateFees(_dstChainId, address(this), payload, _useZro, _adapterParams);
return (nativeFee + bridgeFee, zroFee);
}
function sendFrom(address _from, uint16 _dstChainId, bytes memory _toAddress, uint _tokenId, address payable _refundAddress, address _zroPaymentAddress, bytes memory _adapterParams) public payable virtual override {
_send(_from, _dstChainId, _toAddress, _toSingletonArray(_tokenId), _refundAddress, _zroPaymentAddress, _adapterParams);
}
function sendBatchFrom(address _from, uint16 _dstChainId, bytes memory _toAddress, uint[] memory _tokenIds, address payable _refundAddress, address _zroPaymentAddress, bytes memory _adapterParams) public payable virtual override {
_send(_from, _dstChainId, _toAddress, _tokenIds, _refundAddress, _zroPaymentAddress, _adapterParams);
}
function _send(address _from, uint16 _dstChainId, bytes memory _toAddress, uint[] memory _tokenIds, address payable _refundAddress, address _zroPaymentAddress, bytes memory _adapterParams) internal virtual {
// allow 1 by default
require(_tokenIds.length > 0, "tokenIds[] is empty");
require(_tokenIds.length == 1 || _tokenIds.length <= dstChainIdToBatchLimit[_dstChainId], "batch size exceeds dst batch limit");
uint length = _tokenIds.length;
for (uint i; i < length;) {
_debitFrom(_from, _dstChainId, _toAddress, _tokenIds[i]);
unchecked {
i++;
}
}
bytes memory payload = abi.encode(_toAddress, _tokenIds);
_checkGasLimit(_dstChainId, FUNCTION_TYPE_SEND, _adapterParams, dstChainIdToTransferGas[_dstChainId] * _tokenIds.length);
_lzSend(_dstChainId, payload, _refundAddress, _zroPaymentAddress, _adapterParams, msg.value - bridgeFee);
require(payable(owner()).send(bridgeFee));
emit SendToChain(_dstChainId, _from, _toAddress, _tokenIds);
}
function setBridgeFee(uint _bridgeFee) external onlyOwner {
bridgeFee = _bridgeFee;
}
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) = abi.decode(_payload, (bytes, uint[]));
address toAddress;
assembly {
toAddress := mload(add(toAddressBytes, 20))
}
uint nextIndex = _creditTill(_srcChainId, toAddress, 0, tokenIds);
if (nextIndex < tokenIds.length) {
// not enough gas to complete transfers, store to be cleared in another tx
bytes32 hashedPayload = keccak256(_payload);
storedCredits[hashedPayload] = StoredCredit(_srcChainId, toAddress, nextIndex, true);
emit CreditStored(hashedPayload, _payload);
}
emit ReceiveFromChain(_srcChainId, _srcAddress, toAddress, tokenIds);
}
// Public function for anyone to clear and deliver the remaining batch sent tokenIds
function clearCredits(bytes memory _payload) external virtual nonReentrant {
bytes32 hashedPayload = keccak256(_payload);
require(storedCredits[hashedPayload].creditsRemain, "no credits stored");
(, uint[] memory tokenIds) = abi.decode(_payload, (bytes, uint[]));
uint nextIndex = _creditTill(storedCredits[hashedPayload].srcChainId, storedCredits[hashedPayload].toAddress, storedCredits[hashedPayload].index, tokenIds);
require(nextIndex > storedCredits[hashedPayload].index, "not enough gas to process credit transfer");
if (nextIndex == tokenIds.length) {
// cleared the credits, delete the element
delete storedCredits[hashedPayload];
emit CreditCleared(hashedPayload);
} else {
// store the next index to mint
storedCredits[hashedPayload] = StoredCredit(storedCredits[hashedPayload].srcChainId, storedCredits[hashedPayload].toAddress, nextIndex, true);
}
}
// When a srcChain has the ability to transfer more chainIds in a single tx than the dst can do.
// Needs the ability to iterate and stop if the minGasToTransferAndStore is not met
function _creditTill(uint16 _srcChainId, address _toAddress, uint _startIndex, uint[] memory _tokenIds) internal returns (uint256){
uint i = _startIndex;
while (i < _tokenIds.length) {
// if not enough gas to process, store this index for next loop
if (gasleft() < minGasToTransferAndStore) break;
_creditTo(_srcChainId, _toAddress, _tokenIds[i]);
i++;
}
// indicates the next index to send of tokenIds,
// if i == tokenIds.length, we are finished
return i;
}
function setMinGasToTransferAndStore(uint256 _minGasToTransferAndStore) external onlyOwner {
require(_minGasToTransferAndStore > 0, "minGasToTransferAndStore must be > 0");
minGasToTransferAndStore = _minGasToTransferAndStore;
emit SetMinGasToTransferAndStore(_minGasToTransferAndStore);
}
// ensures enough gas in adapter params to handle batch transfer gas amounts on the dst
function setDstChainIdToTransferGas(uint16 _dstChainId, uint256 _dstChainIdToTransferGas) external onlyOwner {
require(_dstChainIdToTransferGas > 0, "dstChainIdToTransferGas must be > 0");
dstChainIdToTransferGas[_dstChainId] = _dstChainIdToTransferGas;
emit SetDstChainIdToTransferGas(_dstChainId, _dstChainIdToTransferGas);
}
// limit on src the amount of tokens to batch send
function setDstChainIdToBatchLimit(uint16 _dstChainId, uint256 _dstChainIdToBatchLimit) external onlyOwner {
require(_dstChainIdToBatchLimit > 0, "dstChainIdToBatchLimit must be > 0");
dstChainIdToBatchLimit[_dstChainId] = _dstChainIdToBatchLimit;
emit SetDstChainIdToBatchLimit(_dstChainId, _dstChainIdToBatchLimit);
}
function _debitFrom(address _from, uint16 _dstChainId, bytes memory _toAddress, uint _tokenId) internal virtual;
function _creditTo(uint16 _srcChainId, address _toAddress, uint _tokenId) 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.0;
/// @notice Gas optimized merkle proof verification library.
/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/MerkleProofLib.sol)
/// @author Modified from Solady (https://github.com/Vectorized/solady/blob/main/src/utils/MerkleProofLib.sol)
library MerkleProofLib {
function verify(
bytes32[] calldata proof,
bytes32 root,
bytes32 leaf
) internal pure returns (bool isValid) {
/// @solidity memory-safe-assembly
assembly {
if proof.length {
// Left shifting by 5 is like multiplying by 32.
let end := add(proof.offset, shl(5, proof.length))
// Initialize offset to the offset of the proof in calldata.
let offset := proof.offset
// Iterate over proof elements to compute root hash.
// prettier-ignore
for {} 1 {} {
// Slot where the leaf should be put in scratch space. If
// leaf > calldataload(offset): slot 32, otherwise: slot 0.
let leafSlot := shl(5, gt(leaf, calldataload(offset)))
// Store elements to hash contiguously in scratch space.
// The xor puts calldataload(offset) in whichever slot leaf
// is not occupying, so 0 if leafSlot is 32, and 32 otherwise.
mstore(leafSlot, leaf)
mstore(xor(leafSlot, 32), calldataload(offset))
// Reuse leaf to store the hash to reduce stack operations.
leaf := keccak256(0, 64) // Hash both slots of scratch space.
offset := add(offset, 32) // Shift 1 word per cycle.
// prettier-ignore
if iszero(lt(offset, end)) { break }
}
}
isValid := eq(leaf, root) // The proof is valid if the roots match.
}
}
}{
"viaIR": true,
"optimizer": {
"enabled": true,
"runs": 5
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"metadata": {
"useLiteralContent": true
},
"remappings": [],
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"address","name":"_lzEndpoint","type":"address"},{"internalType":"uint256","name":"_startId","type":"uint256"},{"internalType":"uint256","name":"_maxId","type":"uint256"},{"internalType":"uint256","name":"_maxGlobalId","type":"uint256"},{"internalType":"string","name":"_baseTokenURI","type":"string"},{"internalType":"string","name":"_hiddenURI","type":"string"},{"internalType":"uint16","name":"_tax","type":"uint16"},{"internalType":"uint128","name":"_price","type":"uint128"},{"internalType":"uint128","name":"_wlPrice","type":"uint128"},{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"_taxRecipient","type":"address"},{"internalType":"address","name":"_beneficiary","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"ApprovalQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"BalanceQueryForZeroAddress","type":"error"},{"inputs":[],"name":"InvalidBridgeId","type":"error"},{"inputs":[],"name":"MintERC2309QuantityExceedsLimit","type":"error"},{"inputs":[],"name":"MintToZeroAddress","type":"error"},{"inputs":[],"name":"MintZeroQuantity","type":"error"},{"inputs":[],"name":"OwnerQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"OwnershipNotInitializedForExtraData","type":"error"},{"inputs":[],"name":"TokenIdOutOfRange","type":"error"},{"inputs":[],"name":"TransferCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"TransferFromIncorrectOwner","type":"error"},{"inputs":[],"name":"TransferToNonERC721ReceiverImplementer","type":"error"},{"inputs":[],"name":"TransferToZeroAddress","type":"error"},{"inputs":[],"name":"URIQueryForNonexistentToken","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","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":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"fromTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"toTokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"ConsecutiveTransfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"_hashedPayload","type":"bytes32"}],"name":"CreditCleared","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"_hashedPayload","type":"bytes32"},{"indexed":false,"internalType":"bytes","name":"_payload","type":"bytes"}],"name":"CreditStored","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":"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[]"}],"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":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[]"}],"name":"SendToChain","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"indexed":false,"internalType":"uint256","name":"_dstChainIdToBatchLimit","type":"uint256"}],"name":"SetDstChainIdToBatchLimit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"indexed":false,"internalType":"uint256","name":"_dstChainIdToTransferGas","type":"uint256"}],"name":"SetDstChainIdToTransferGas","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":"uint256","name":"_minGasToTransferAndStore","type":"uint256"}],"name":"SetMinGasToTransferAndStore","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":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"DEFAULT_PAYLOAD_SIZE_LIMIT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"FUNCTION_TYPE_SEND","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bridgeFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"_payload","type":"bytes"}],"name":"clearCredits","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"","type":"uint16"}],"name":"dstChainIdToBatchLimit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"","type":"uint16"}],"name":"dstChainIdToTransferGas","outputs":[{"internalType":"uint256","name":"","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":"bool","name":"_useZro","type":"bool"},{"internalType":"bytes","name":"_adapterParams","type":"bytes"}],"name":"estimateSendBatchFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","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":"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":[],"name":"financeDetails","outputs":[{"internalType":"address payable","name":"beneficiary","type":"address"},{"internalType":"address payable","name":"taxRecipient","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint128","name":"price","type":"uint128"},{"internalType":"uint128","name":"wlPrice","type":"uint128"},{"internalType":"uint16","name":"tax","type":"uint16"}],"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":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","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":"","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":"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":[],"name":"maxGlobalId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"merkleRoot","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"metadata","outputs":[{"internalType":"string","name":"baseURI","type":"string"},{"internalType":"string","name":"hiddenMetadataURI","type":"string"}],"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":"minGasToTransferAndStore","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_nbTokens","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"payable","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":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"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":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","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":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","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":"_tokenIds","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":"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":"uint256","name":"_bridgeFee","type":"uint256"}],"name":"setBridgeFee","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":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"uint256","name":"_dstChainIdToBatchLimit","type":"uint256"}],"name":"setDstChainIdToBatchLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"uint256","name":"_dstChainIdToTransferGas","type":"uint256"}],"name":"setDstChainIdToTransferGas","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address payable","name":"beneficiary","type":"address"},{"internalType":"address payable","name":"taxRecipient","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint128","name":"price","type":"uint128"},{"internalType":"uint128","name":"wlPrice","type":"uint128"},{"internalType":"uint16","name":"tax","type":"uint16"}],"internalType":"struct AdvancedONFT721AOpen.FinanceDetails","name":"_finance","type":"tuple"}],"name":"setFinanceDetails","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_newRoot","type":"bytes32"}],"name":"setMerkleRoot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"string","name":"baseURI","type":"string"},{"internalType":"string","name":"hiddenMetadataURI","type":"string"}],"internalType":"struct AdvancedONFT721AOpen.Metadata","name":"_metadata","type":"tuple"}],"name":"setMetadata","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":"uint256","name":"_minGasToTransferAndStore","type":"uint256"}],"name":"setMinGasToTransferAndStore","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"_start","type":"uint32"},{"internalType":"uint32","name":"_end","type":"uint32"}],"name":"setMintRange","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"bool","name":"saleStarted","type":"bool"},{"internalType":"bool","name":"revealed","type":"bool"},{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"mintLength","type":"uint256"}],"internalType":"struct AdvancedONFT721AOpen.NFTState","name":"_state","type":"tuple"}],"name":"setNftState","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":"uint16","name":"_version","type":"uint16"}],"name":"setReceiveVersion","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_version","type":"uint16"}],"name":"setSendVersion","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_srcChainId","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":[],"name":"startId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"state","outputs":[{"internalType":"bool","name":"saleStarted","type":"bool"},{"internalType":"bool","name":"revealed","type":"bool"},{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"mintLength","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"storedCredits","outputs":[{"internalType":"uint16","name":"srcChainId","type":"uint16"},{"internalType":"address","name":"toAddress","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"bool","name":"creditsRemain","type":"bool"}],"stateMutability":"view","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":"_tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","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":"_nbTokens","type":"uint256"},{"internalType":"bytes32[]","name":"_merkleProof","type":"bytes32[]"}],"name":"whitelistMint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
60a0604052346200086f57620057e0803803806200001d8162000874565b9283398101906101c0818303126200086f5780516001600160401b0381116200086f57826200004e9183016200089a565b60208201516001600160401b0381116200086f5783620000709184016200089a565b906200007f604084016200090c565b9160608401519060808501519460a08101519360c082015160018060401b0381116200086f5788620000b39184016200089a565b60e083015190986001600160401b0382116200086f57620000d69184016200089a565b966101008301519561ffff871687036200086f57620000f9610120850162000921565b9562000109610140860162000921565b956200011961016087016200090c565b94620001386101a0620001306101808a016200090c565b98016200090c565b60008054336001600160a01b0319821681178355929d92916001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09080a36001600160a01b0316608052600160068190556008558051906001600160401b0382116200058557600e5490600182811c9216801562000864575b6020831014620005645781601f84931162000803575b50602090601f8311600114620007855760009262000779575b50508160011b916000199060031b1c191617600e555b8051906001600160401b0382116200058557600f5490600182811c921680156200076e575b6020831014620005645781601f8493116200070d575b50602090601f8311600114620006935760009262000687575b50508160011b916000199060031b1c191617600f555b600c819055601455601655601555604051916001600160401b0360c0840190811190841117620005855760c0830160409081526001600160a01b0397881680855291881660208501819052929097168784018190526001600160801b039586166060850181905295851660808086019190915261ffff9790971660a0909401849052601880546001600160a01b03199081169093179055601980548316909317909255601a80549091169091179055921b6001600160801b03191617601b55601c805461ffff191690911790558051908101906001600160401b03821181831017620005855760409190915282815260200190815281516001600160401b0381116200058557601d54600181811c911680156200067c575b60208210146200056457601f811162000612575b50602092601f8211600114620005a757928192936000926200059b575b50508160011b916000199060031b1c191617601d555b5180516001600160401b0381116200058557601e54600181811c911680156200057a575b60208210146200056457601f8111620004fa575b50602091601f8211600114620004905791819260009262000484575b50508160011b916000199060031b1c191617601e555b604051614e69908162000937823960805181818161062101528181610a9101528181610d3d0152818161170f015281816126a0015281816129090152818161318b01528181613db8015261415e0152f35b0151905038806200041d565b601f19821692601e60005260206000209160005b858110620004e157508360019510620004c7575b505050811b01601e5562000433565b015160001960f88460031b161c19169055388080620004b8565b91926020600181928685015181550194019201620004a4565b601e6000527f50bb669a95c7b50b7e8a6f09454034b2b14cf2b85c730dca9a539ca82cb6e350601f830160051c8101916020841062000559575b601f0160051c01905b8181106200054c575062000401565b600081556001016200053d565b909150819062000534565b634e487b7160e01b600052602260045260246000fd5b90607f1690620003ed565b634e487b7160e01b600052604160045260246000fd5b015190503880620003b3565b601f19821693601d60005260206000209160005b868110620005f95750836001959610620005df575b505050811b01601d55620003c9565b015160001960f88460031b161c19169055388080620005d0565b91926020600181928685015181550194019201620005bb565b601d6000527f6d4407e7be21f808e6509aa9fa9143369579dd7d760fe20a2c09680fc146134f601f830160051c8101916020841062000671575b601f0160051c01905b81811062000664575062000396565b6000815560010162000655565b90915081906200064c565b90607f169062000382565b01519050388062000254565b600f6000908152600080516020620057c08339815191529350601f198516905b818110620006f45750908460019594939210620006da575b505050811b01600f556200026a565b015160001960f88460031b161c19169055388080620006cb565b92936020600181928786015181550195019301620006b3565b600f600052909150600080516020620057c0833981519152601f840160051c81016020851062000766575b90849392915b601f830160051c82018110620007565750506200023b565b600081558594506001016200073e565b508062000738565b91607f169162000225565b015190503880620001ea565b600e60009081529350600080516020620057a083398151915291905b601f1984168510620007e7576001945083601f19811610620007cd575b505050811b01600e5562000200565b015160001960f88460031b161c19169055388080620007be565b81810151835560209485019460019093019290910190620007a1565b600e600052909150600080516020620057a0833981519152601f840160051c8101602085106200085c575b90849392915b601f830160051c820181106200084c575050620001d1565b6000815585945060010162000834565b50806200082e565b91607f1691620001bb565b600080fd5b6040519190601f01601f191682016001600160401b038111838210176200058557604052565b919080601f840112156200086f5782516001600160401b0381116200058557602090620008d0601f8201601f1916830162000874565b928184528282870101116200086f5760005b818110620008f857508260009394955001015290565b8581018301518482018401528201620008e2565b51906001600160a01b03821682036200086f57565b51906001600160801b03821682036200086f5756fe60806040526004361015610013575b600080fd5b60003560e01c80621d35671461056257806301ffc9a71461055957806306a8e4d91461055057806306fdde031461054757806307e0db171461053e578063081812fc14610535578063095ea7b31461052c5780630b4cad4c146105235780630df374831461051a57806310ddb1371461051157806322a3ecf91461050857806323b872dd146104ff57806329d7e69b146104f65780632a205e3d146104ed5780632eb4a7ab146104e4578063392f37e9146104db5780633ccfd60b146104d25780633d8b38f6146104c95780633f1f4fa4146104c057806342842e0e146104b757806342d65a8d146104ae57806348288190146104a55780634ac3f4ff1461049c57806351905636146104935780635b8c41e61461048a5780636352211e1461048157806366ad5c8a146104785780636ecf80981461046f57806370a0823114610466578063715018a61461045d5780637533d78814610454578063796b0c5c1461044b5780637cb647591461044257806382b12dd7146104395780638cfd8f5c146104305780638da5cb5b146104275780638ffa1f2a1461041e578063950c8a741461041557806395d89b411461040c578063998cdf83146104035780639ea5d6b1146103fa5780639f38369a146103f1578063a0712d68146103e8578063a22cb465146103df578063a6c3d165146103d6578063ab3ffb93146103cd578063af3fb21c146103c4578063b353aaa7146103bb578063b88d4fde146103b2578063baf3292d146103a9578063c19d93fb146103a0578063c446183414610397578063c5b6d52d1461038e578063c5ea3c6514610385578063c7d8505a1461037c578063c87b56dd14610373578063cbed8b9c1461036a578063d12473a514610361578063d1deba1f14610358578063d2cab0561461034f578063df2a5b3b14610346578063e985e9c51461033d578063eb8d72b714610334578063f23536411461032b578063f2fde38b14610322578063f3218cc114610319578063f5ecbdbc146103105763fa25f9b61461030857600080fd5b61000e613200565b5061000e61311d565b5061000e613007565b5061000e612f51565b5061000e612ecc565b5061000e612d94565b5061000e612d3b565b5061000e612c4d565b5061000e612b9d565b5061000e612a74565b5061000e6129af565b5061000e6128b4565b5061000e612894565b5061000e612875565b5061000e612856565b5061000e6127f2565b5061000e6127d4565b5061000e612792565b5061000e612721565b5061000e6126cf565b5061000e612689565b5061000e61266c565b5061000e6125d2565b5061000e6123dd565b5061000e61234a565b5061000e6121cc565b5061000e612128565b5061000e61205f565b5061000e61203d565b5061000e611f98565b5061000e611f6e565b5061000e611d8d565b5061000e611d63565b5061000e611d07565b5061000e611ce8565b5061000e611cb3565b5061000e611c58565b5061000e611c00565b5061000e611b9b565b5061000e611b3d565b5061000e611aa9565b5061000e61194d565b5061000e61191d565b5061000e61189a565b5061000e6117cf565b5061000e611795565b5061000e611776565b5061000e6116f4565b5061000e6116b0565b5061000e611676565b5061000e611620565b5061000e6112a4565b5061000e6111ac565b5061000e611038565b5061000e610fac565b5061000e610e68565b5061000e610e55565b5061000e610dd0565b5061000e610d13565b5061000e610cd3565b5061000e610c2e565b5061000e610b75565b5061000e610b10565b5061000e610a67565b5061000e610986565b5061000e6107b2565b5061000e610732565b5061000e610609565b61ffff81160361000e57565b9181601f8401121561000e578235916001600160401b03831161000e576020838186019501011161000e57565b90608060031983011261000e576004356105bd8161056b565b916001600160401b039060243582811161000e57816105de91600401610577565b93909392604435818116810361000e579260643591821161000e5761060591600401610577565b9091565b503461000e57610618366105a4565b929493919291907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031633036106db5761069e6106a6926106ac9761069761067d6106788a61ffff166000526001602052604060002090565b611be5565b80519081841491826106d1575b50816106ae575b5061323a565b3691610f50565b923691610f50565b9261345f565b005b90506106bb368486610f50565b6020815191012090602081519101201438610691565b151591503861068a565b60405162461bcd60e51b815260206004820152601e60248201527f4c7a4170703a20696e76616c696420656e64706f696e742063616c6c657200006044820152606490fd5b6001600160e01b031981160361000e57565b503461000e57602036600319011261000e57602060043561075281610720565b63ffffffff60e01b166301ffc9a760e01b8114908115908161077b575b50506040519015158152f35b906107a1575b8115610790575b50388061076f565b635b5e139f60e01b14905038610788565b6380ac58cd60e01b81149150610781565b503461000e576003196020368201811361000e57600435906001600160401b039081831161000e5760408360040194843603011261000e5760185461080c90336001600160a01b0391821614908115610911575b50614a97565b6108168480614aee565b928311610904575b6108328361082d601d54611057565b61335c565b600091601f8411600114610885575092826106ac95936024936108749660009261087a575b50508160011b916000199060031b1c191617601d555b0190614aee565b90614b20565b013590503880610857565b601d60005291601f198416600080516020614d548339815191529382905b8282106108ec575050936024936108749693600193836106ac9a98106108d2575b505050811b01601d5561086d565b0135600019600384901b60f8161c191690553880806108c4565b806001859782949688013581550196019301906108a3565b61090c610e87565b61081e565b905060005416331438610806565b600091031261000e57565b60005b83811061093d5750506000910152565b818101518382015260200161092d565b906020916109668151809281855285808601910161092a565b601f01601f1916010190565b90602061098392818152019061094d565b90565b503461000e57600080600319360112610a645760405181600e546109a981611057565b80845290600190818116908115610a3c57506001146109e3575b6109df846109d381880382610ef4565b60405191829182610972565b0390f35b600e8352602094507fbb7b4a454dc3493923482f07822329ed19e8244eff582cc204f8554c3620c3fd5b828410610a2957505050816109df936109d392820101936109c3565b8054858501870152928501928101610a0d565b6109df96506109d39450602092508593915060ff191682840152151560051b820101936109c3565b80fd5b503461000e5760006020366003190112610a6457600435610a878161056b565b610a8f6137a9565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316908290823b15610b0c57602461ffff918360405195869485936307e0db1760e01b85521660048401525af18015610aff575b610af3575080f35b610afc90610e9e565b80f35b610b076132fc565b610aeb565b5080fd5b503461000e57602036600319011261000e57600435610b2e816138ea565b15610b53576000526012602052602060018060a01b0360406000205416604051908152f35b6333d1c03960e21b60005260046000fd5b6001600160a01b0381160361000e57565b50604036600319011261000e57600435610b8e81610b64565b6024356001600160a01b0380610ba383613832565b1690813303610bfe575b600083815260126020526040812080546001600160a01b0319166001600160a01b0387161790559316907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258480a480f35b81600052601360205260ff610c1733604060002061381b565b5416610bad576367d9dca160e11b60005260046000fd5b503461000e57602036600319011261000e57600435610c4b6137a9565b8015610c82576020817ffebbc4f8bb9ec2313950c718d43123124b15778efda4c1f1d529de2995b4f34d92600855604051908152a1005b60405162461bcd60e51b8152602060048201526024808201527f6d696e476173546f5472616e73666572416e6453746f7265206d7573742062656044820152630203e20360e41b6064820152608490fd5b503461000e57604036600319011261000e5761ffff600435610cf48161056b565b610cfc6137a9565b166000526003602052602435604060002055600080f35b503461000e5760006020366003190112610a6457600435610d338161056b565b610d3b6137a9565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316908290823b15610b0c57602461ffff918360405195869485936310ddb13760e01b85521660048401525af18015610aff57610af3575080f35b602090600319011261000e5760043590565b600052600b602052604060002090565b6000526010602052604060002090565b503461000e57610ddf36610d9e565b600052600b6020526080604060002080549060ff6002600183015492015416906040519261ffff8116845260018060a01b039060101c166020840152604083015215156060820152f35b606090600319011261000e57600435610e4181610b64565b90602435610e4e81610b64565b9060443590565b506106ac610e6236610e29565b91613969565b503461000e57600036600319011261000e576020601454604051908152f35b50634e487b7160e01b600052604160045260246000fd5b6001600160401b038111610eb157604052565b610eb9610e87565b604052565b608081019081106001600160401b03821117610eb157604052565b60c081019081106001600160401b03821117610eb157604052565b601f909101601f19168101906001600160401b03821190821017610eb157604052565b60405190610f2482610ebe565b565b6020906001600160401b038111610f43575b601f01601f19160190565b610f4b610e87565b610f38565b929192610f5c82610f26565b91610f6a6040519384610ef4565b82948184528183011161000e578281602093846000960137010152565b9080601f8301121561000e5781602061098393359101610f50565b8015150361000e57565b503461000e5760a036600319011261000e57600435610fca8161056b565b6001600160401b039060243582811161000e57610feb903690600401610f87565b9060643590610ff982610fa2565b60843593841161000e57611014611026943690600401610f87565b92611020604435614954565b91613d3a565b60408051928352602083019190915290f35b503461000e57600036600319011261000e576020601754604051908152f35b90600182811c92168015611087575b602083101461107157565b634e487b7160e01b600052602260045260246000fd5b91607f1691611066565b601e54600092916110a182611057565b9081815260019283811690816000146110fb57506001146110c157505050565b90929350601e6000526020928360002092846000945b8386106110e75750505050010190565b8054858701830152940193859082016110d7565b91935050602093945060ff191683830152151560051b010190565b906000929180549161112783611057565b9182825260019384811690816000146111895750600114611149575b50505050565b90919394506000526020928360002092846000945b838610611175575050505001019038808080611143565b80548587018301529401938590820161115e565b9294505050602093945060ff191683830152151560051b01019038808080611143565b503461000e57600080600319360112610a645760405181601d546111cf81611057565b8084529060019081811690811561127c5750600114611235575b611227846111f981880382610ef4565b6109df6040516112138161120c81611091565b0382610ef4565b60405193849360408552604085019061094d565b90838203602085015261094d565b601d835260209450600080516020614d548339815191525b8284106112695750505081611227936111f992820101936111e9565b805485850187015292850192810161124d565b61122796506111f99450602092508593915060ff191682840152151560051b820101936111e9565b503461000e57600080600319360112610a645760185481906001600160a01b039081169033821480156115dc575b6112db90614a97565b6019546112f8906001600160a01b03165b6001600160a01b031690565b601a546001600160a01b031691611310841515613f1b565b8082169261131f841515613f1b565b16806113da57505082809281808080809647908280808061136b61136461135c61135661134f601c5461ffff1690565b61ffff1690565b89613f08565b612710900490565b8097613452565b8b8282156113d1575bf1156113c4575b8282156113bb575bf1156113ae575b47908282156113a5575bf11561139d5780f35b610afc6132fc565b506108fc611394565b6113b66132fc565b61138a565b506108fc611383565b6113cc6132fc565b61137b565b506108fc611374565b6040516370a0823160e01b808252306004830152602096506114d7958795509093909188919061148b90879081816024818a5afa9081156115cf575b85916115b2575b5061144461143d61135c61143761134f601c5461ffff1690565b84613f08565b8092613452565b9360405183818061146463a9059cbb60e01b998a83528c60048401614c1a565b03818a8d5af180156115a5575b611588575b50604051938492839287845260048401614c1a565b038186895af1801561157b575b61155e575b506040519485523060048601528585602481875afa948515611551575b8295611522575b5060405196879586948593845260048401614c1a565b03925af18015611515575b6114eb57505080f35b8161150a92903d1061150e575b6115028183610ef4565b810190614997565b5080f35b503d6114f8565b61151d6132fc565b6114e2565b611543919550863d881161154a575b61153b8183610ef4565b810190614c0b565b93386114c1565b503d611531565b6115596132fc565b6114ba565b61157490873d891161150e576115028183610ef4565b503861149d565b6115836132fc565b611498565b61159e90843d861161150e576115028183610ef4565b5038611476565b6115ad6132fc565b611471565b6115c99150823d841161154a5761153b8183610ef4565b3861141d565b6115d76132fc565b611416565b508254811633146112d2565b90604060031983011261000e576004356116018161056b565b91602435906001600160401b03821161000e5761060591600401610577565b503461000e57602061ffff611667611637366115e8565b939091166000526001845261120c611659604060002060405192838092611116565b848151910120923691610f50565b82815191012014604051908152f35b503461000e57602036600319011261000e5761ffff6004356116978161056b565b1660005260036020526020604060002054604051908152f35b506106ac6116bd36610e29565b60405192909190602084016001600160401b038111858210176116e7575b60405260008452613ab9565b6116ef610e87565b6116db565b503461000e57611703366115e8565b919061170d6137a9565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031691823b1561000e57604051928380926342d65a8d60e01b825281611764600098899788946004850161332a565b03925af18015610aff57610af3575080f35b503461000e57600036600319011261000e576020600854604051908152f35b503461000e57602036600319011261000e5761ffff6004356117b68161056b565b1660005260096020526020604060002054604051908152f35b5060e036600319011261000e576004356117e881610b64565b6024356117f48161056b565b6001600160401b039160443583811161000e57611815903690600401610f87565b906084359061182382610b64565b60a4359261183084610b64565b60c43595861161000e5761184b6106ac963690600401610f87565b94611857606435614954565b92613f53565b60209061187792826040519483868095519384920161092a565b82019081520301902090565b9060018060401b0316600052602052604060002090565b503461000e57606036600319011261000e576004356118b88161056b565b6001600160401b0360243581811161000e576118d8903690600401610f87565b90604435908116810361000e5761190761190c9261ffff6109df9516600052600560205260406000209061185d565b611883565b546040519081529081906020820190565b503461000e57602036600319011261000e5760206001600160a01b03611944600435613832565b16604051908152f35b503461000e5761195c366105a4565b939150303303611a55576119c961199561ffff9261198d600080516020614d94833981519152956014973691610f50565b963691610f50565b9485516119aa60208089019289010182614501565b960151966119b8878961476a565b875181106119e9575b505050613f22565b936119e460405192839260018060a01b031697169482613f42565b0390a4005b611a3b600080516020614df4833981519152938351902091611a09610f17565b61ffff8d168152906001600160a01b038c1660208301525b604082015260016060820152611a3683610db0565b614597565b611a4a604051928392836145f4565b0390a13880806119c1565b60405162461bcd60e51b815260206004820152602660248201527f4e6f6e626c6f636b696e674c7a4170703a2063616c6c6572206d7573742062656044820152650204c7a4170760d41b6064820152608490fd5b503461000e57608036600319011261000e57601854611adc90336001600160a01b03918216149081156109115750614a97565b600435611ae881610fa2565b611b1760243591611af883610fa2565b611b03604051610ebe565b151560ff8019601f54169115151617601f55565b61ff00601f5491151560081b169061ff00191617601f5542602055606435602155600080f35b503461000e57602036600319011261000e57600435611b5b81610b64565b6001600160a01b03168015611b8a576000526011602052602060018060401b0360406000205416604051908152f35b6323d3ad8160e21b60005260046000fd5b503461000e57600080600319360112610a6457611bb66137a9565b80546001600160a01b03198116825581906001600160a01b0316600080516020614db48339815191528280a380f35b90610f24611bf99260405193848092611116565b0383610ef4565b503461000e57602036600319011261000e5761ffff600435611c218161056b565b1660005260016020526109df61120c611c44604060002060405192838092611116565b60405191829160208352602083019061094d565b503461000e57604036600319011261000e5760043563ffffffff9081811680910361000e576024359180831680930361000e57611c936137a9565b600c5460145490031681111561000e578082111561000e57601455601555005b503461000e57611cc236610d9e565b601854611ce390336001600160a01b03918216149081156109115750614a97565b601755005b503461000e57600036600319011261000e576020600754604051908152f35b503461000e57604036600319011261000e576020611d5a600435611d2a8161056b565b61ffff60243591611d3a8361056b565b166000526002835260406000209061ffff16600052602052604060002090565b54604051908152f35b503461000e57600036600319011261000e576000546040516001600160a01b039091168152602090f35b503461000e57602036600319011261000e576004356001600160401b03811161000e57611dbe903690600401610f87565b600260065414611f29576002600655611e038151602080840191822093611df9611df46002611dec88610db0565b015460ff1690565b6146b0565b8051010190614501565b9050611e0e82610db0565b50611e4281611e2f611e1f85610db0565b5460101c6001600160a01b031690565b6001611e3a86610db0565b015490614808565b90611e5a6001611e5185610db0565b015483116146f0565b518103611ec35750611eb581611ea5611e937fd7be02b8dd0d27bd0517a9cb4d7469ce27df4313821ae5ec1ff69acc594ba23394610db0565b60026000918281558260018201550155565b6040519081529081906020820190565b0390a15b6106ac6001600655565b611a3682611ede611ed6611f2495610db0565b5461ffff1690565b92611f13611eee611e1f84610db0565b611f03611ef9610f17565b61ffff9097168752565b6001600160a01b03166020860152565b604084015260016060840152610db0565b611eb9565b60405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606490fd5b503461000e57600036600319011261000e576004546040516001600160a01b039091168152602090f35b503461000e57600080600319360112610a645760405181600f54611fbb81611057565b80845290600190818116908115610a3c5750600114611fe4576109df846109d381880382610ef4565b600f8352602094507f8d1108e10bcb7c27dddfc02ed9d693a074039d026cf4ea4240b40f7d581ac8025b82841061202a57505050816109df936109d392820101936109c3565b805485850187015292850192810161200e565b503461000e57602036600319011261000e576120576137a9565b600435600755005b503461000e57604036600319011261000e5760043561207d8161056b565b6024356120886137a9565b80156120d8578161ffff7f7315f7654d594ead24a30160ed9ba2d23247f543016b918343591e93d7afdb6d93166000526009602052816040600020556120d36040519283928361493e565b0390a1005b60405162461bcd60e51b815260206004820152602260248201527f647374436861696e4964546f42617463684c696d6974206d757374206265203e604482015261020360f41b6064820152608490fd5b503461000e57602036600319011261000e5761ffff6004356121498161056b565b16600052600160205261120c612169604060002060405192838092611116565b805115612187576109d3816121816109df935161342c565b90613729565b60405162461bcd60e51b815260206004820152601d60248201527f4c7a4170703a206e6f20747275737465642070617468207265636f72640000006044820152606490fd5b50602036600319011261000e576106ac6004356121f26121ee601f5460ff1690565b1590565b61233d575b8015612330575b61221261220d82600c5461369f565b613443565b60155410612323575b61222a6020546021549061369f565b4211612316575b601a546001600160a01b0316806122855750601b5461226b908290612266906001600160801b03165b6001600160801b031690565b613f08565b3410612278575b336149ac565b612280613c3d565b612272565b60206122d56000926122a58561226661225a601b5460018060801b031690565b6040516323b872dd60e01b8152336004820152306024820152604481019190915293849283919082906064820190565b03925af18015612309575b6122eb575b50612272565b6123029060203d811161150e576115028183610ef4565b50386122e5565b6123116132fc565b6122e0565b61231e613c07565b612231565b61232b613c2b565b61221b565b612338613c19565b6121fe565b612345613c07565b6121f7565b503461000e57604036600319011261000e5760043561236881610b64565b6024359061237582610fa2565b3360005260136020526123a18261239083604060002061381b565b9060ff801983541691151516179055565b60405191151582526001600160a01b03169033907f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3190602090a3005b503461000e576123ec366115e8565b906123f56137a9565b604051926020928083858701376124216034868381013060601b88820152036014810188520186610ef4565b61ffff8216600090815260018086526040822087519296909291906001600160401b038311612541575b61245f836124598654611057565b866133db565b80601f84116001146124bd5750918080926124ac9695948a9b600080516020614d748339815191529b946124b2575b50501b916000199060031b1c19161790555b6040519384938461332a565b0390a180f35b01519250388061248e565b91939498601f1984166124d587600052602060002090565b938a905b82821061252a57505091600080516020614d74833981519152999a959391856124ac98969410612511575b505050811b0190556124a0565b015160001960f88460031b161c19169055388080612504565b8088869782949787015181550196019401906124d9565b612549610e87565b61244b565b6020906001600160401b038111612567575b60051b0190565b61256f610e87565b612560565b81601f8201121561000e5780359161258b8361254e565b926125996040519485610ef4565b808452602092838086019260051b82010192831161000e578301905b8282106125c3575050505090565b813581529083019083016125b5565b5060e036600319011261000e576004356125eb81610b64565b602435906125f88261056b565b6001600160401b039160443583811161000e57612619903690600401610f87565b60643584811161000e57612631903690600401612574565b6084359161263e83610b64565b60a4359361264b85610b64565b60c43596871161000e576126666106ac973690600401610f87565b95613f53565b503461000e57600036600319011261000e57602060405160018152f35b503461000e57600036600319011261000e576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b50608036600319011261000e576004356126e881610b64565b6024356126f481610b64565b606435916001600160401b03831161000e576127176106ac933690600401610f87565b9160443591613ab9565b503461000e57602036600319011261000e577f5db758e995a17ec1ad84bdef7e8c3293a0bd6179bcce400dff5d4c3d87db726b602060043561276281610b64565b61276a6137a9565b600480546001600160a01b0319166001600160a01b03929092169182179055604051908152a1005b503461000e57600036600319011261000e576080601f546020546021549060ff604051938181161515855260081c161515602084015260408301526060820152f35b503461000e57600036600319011261000e5760206040516127108152f35b503461000e57600036600319011261000e5760c060018060a01b03806018541690806019541690601a5416601b549061ffff601c5416926040519485526020850152604084015260018060801b038116606084015260801c608083015260a0820152f35b503461000e57600036600319011261000e576020601554604051908152f35b503461000e57600036600319011261000e576020601654604051908152f35b503461000e57602036600319011261000e576109df611c44600435614c35565b503461000e57608036600319011261000e576004356128d28161056b565b6024356128de8161056b565b6064356001600160401b03811161000e576128fd903690600401610577565b90926129076137a9565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690813b1561000e576000809461297e604051978896879586946332fb62e760e21b865261ffff80921660048701521660248501526044356044850152608060648501526084840191613309565b03925af180156129a2575b61298f57005b8061299c6106ac92610e9e565b8061091f565b6129aa6132fc565b612989565b503461000e57604036600319011261000e576004356129cd8161056b565b6024356129d86137a9565b8015612a23578161ffff7fc46df2983228ac2d9754e94a0d565e6671665dc8ad38602bc8e544f0685a29fb9316600052600a602052816040600020556120d36040519283928361493e565b60405162461bcd60e51b815260206004820152602360248201527f647374436861696e4964546f5472616e73666572476173206d7573742062652060448201526203e20360ec1b6064820152608490fd5b50612a7e366105a4565b9161ffff86949296166000526005602052612ab281604060002060206040518092878b833787820190815203019020611883565b54918215612b4c57612b4084612b397fc264d91f3adc5588250e1551f547752ca0cfa8f6b530d243b9f9f4cab10ea8e5996000612b2d876119078d89612b278f6120d39f8f612b06612b139236908d610f50565b6020815191012014613604565b61ffff166000526005602052604060002090565b916135eb565b5561069e36868c610f50565b908761460b565b6040519586958661365a565b60405162461bcd60e51b815260206004820152602360248201527f4e6f6e626c6f636b696e674c7a4170703a206e6f2073746f726564206d65737360448201526261676560e81b6064820152608490fd5b50604036600319011261000e576001600160401b0360043560243582811161000e573660238201121561000e57806004013592831161000e573660248460051b8301011161000e576017546040516001600160601b03193360601b1660208201908152601482526106ac95612c2c946121ee9490939092602491612c22603482610ef4565b5190209301614d08565b612c40575b6121f26121ee601f5460ff1690565b612c48613cb9565b612c31565b503461000e57606036600319011261000e57600435612c6b8161056b565b602435612c778161056b565b60443591612c836137a9565b8215612cfe576120d37f9d5c7c0b934da8fefa9c7760c98383778a12dfbfc0c3b3106518f43fb9508ac09361ffff8316600052600260205280612cd88560406000209061ffff16600052602052604060002090565b556040519384938460409194939294606082019561ffff80921683521660208201520152565b60405162461bcd60e51b81526020600482015260156024820152744c7a4170703a20696e76616c6964206d696e47617360581b6044820152606490fd5b503461000e57604036600319011261000e57602060ff612d88600435612d6081610b64565b60243590612d6d82610b64565b6001600160a01b03166000908152601385526040902061381b565b54166040519015158152f35b503461000e57612da3366115e8565b9190612dad6137a9565b61ffff82166000908152600160208181526040832092949291906001600160401b038711612ebf575b612dea87612de48554611057565b856133db565b8590601f8811600114612e3f57509186808798936124ac95600080516020614e148339815191529993612e34575b501b906000198460031b1c19161790556040519384938461332a565b880135925038612e18565b90601f198816612e5485600052602060002090565b9288905b828210612ea857505091889391600080516020614e1483398151915298996124ac969410612e8e575b505082811b0190556124a0565b870135600019600386901b60f8161c191690553880612e81565b808685968294968c01358155019501930190612e58565b612ec7610e87565b612dd6565b503461000e5760a036600319011261000e57600435612eea8161056b565b6001600160401b039060243582811161000e57612f0b903690600401610f87565b60443583811161000e57612f23903690600401612574565b60643591612f3083610fa2565b60843594851161000e57612f4b611026953690600401610f87565b93613d3a565b503461000e57602036600319011261000e57600435612f6f81610b64565b612f776137a9565b6001600160a01b039081168015612fb357600080546001600160a01b0319811683178255909216600080516020614db48339815191528380a380f35b60405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608490fd5b503461000e5760c036600319011261000e576130216137a9565b60043561302d81610b64565b601880546001600160a01b0319166001600160a01b039290921691909117905561307e60243561305c81610b64565b601980546001600160a01b0319166001600160a01b0392909216919091179055565b6130af60443561308d81610b64565b601a80546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160801b036130bf614a5f565b1660018060801b0319601b541617601b556131006130db614a75565b601b80546001600160801b031660809290921b6001600160801b031916919091179055565b6106ac61310b614a8b565b61ffff1661ffff19601c541617601c55565b503461000e57608036600319011261000e576109df60043561313e8161056b565b6024359061314b8261056b565b613156604435610b64565b604051633d7b2f6f60e21b815261ffff91821660048201529116602482015230604482015260648035908201526000816084817f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165afa9081156131f3575b6000916131d2575b5060405191829182610972565b6131ed913d8091833e6131e58183610ef4565b8101906132d7565b386131c5565b6131fb6132fc565b6131bd565b503461000e57602036600319011261000e5761ffff6004356132218161056b565b16600052600a6020526020604060002054604051908152f35b1561324157565b60405162461bcd60e51b815260206004820152602660248201527f4c7a4170703a20696e76616c696420736f757263652073656e64696e6720636f6044820152651b9d1c9858dd60d21b6064820152608490fd5b81601f8201121561000e5780516132ab81610f26565b926132b96040519485610ef4565b8184526020828401011161000e57610983916020808501910161092a565b9060208282031261000e5781516001600160401b03811161000e576109839201613295565b506040513d6000823e3d90fd5b908060209392818452848401376000828201840152601f01601f1916010190565b60409061ffff61098395931681528160208201520191613309565b818110613350575050565b60008155600101613345565b90601f8211613369575050565b610f2491601d6000526020600020906020601f840160051c83019310613397575b601f0160051c0190613345565b909150819061338a565b90601f82116133ae575050565b610f2491601e6000526020600020906020601f840160051c8301931061339757601f0160051c0190613345565b9190601f81116133ea57505050565b610f24926000526020600020906020601f840160051c8301931061339757601f0160051c0190613345565b50634e487b7160e01b600052601160045260246000fd5b60131981019190821161343b57565b610f24613415565b60001981019190821161343b57565b9190820391821161343b57565b9290915a604051633356ae4560e11b6020820190815261ffff871660248301526080604483015294916134cb826134bd61349c60a483018761094d565b6001600160401b03881660648401528281036023190160848401528861094d565b03601f198101845283610ef4565b60008091604051976134dc89610ed9565b609689528260208a019560a036883751923090f1903d9060968211613523575b6000908288523e15613510575b5050505050565b6135199461352c565b3880808080613509565b609691506134fc565b91936135d87fe183f33de2837795525b4792ca4cd60535bd77c53b7e7030060bfcf5734d6b0c956135e6939561ffff8151602083012096169586600052600560205261359e8361359060208b6040600020826040519483868095519384920161092a565b820190815203019020611883565b556135bb604051978897885260a0602089015260a088019061094d565b6001600160401b039092166040870152858203606087015261094d565b90838203608085015261094d565b0390a1565b6020919283604051948593843782019081520301902090565b1561360b57565b60405162461bcd60e51b815260206004820152602160248201527f4e6f6e626c6f636b696e674c7a4170703a20696e76616c6964207061796c6f616044820152601960fa1b6064820152608490fd5b9160609361ffff61367d9398979698168452608060208501526080840191613309565b6001600160401b0390951660408201520152565b90601f820180921161343b57565b9190820180921161343b57565b156136b357565b60405162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b6044820152606490fd5b156136f057565b60405162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b6044820152606490fd5b61373d8261373681613691565b10156136ac565b61374a82825110156136e9565b81613762575050604051600081526020810160405290565b60405191601f811691821560051b808486010193838501920101905b8084106137965750508252601f01601f191660405290565b909283518152602080910193019061377e565b6000546001600160a01b031633036137bd57565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b6001600160a01b0316600090815260116020526040902090565b9060018060a01b0316600052602052604060002090565b906000826014541115806138df575b156138b5575061385082610dc0565b5491821561386e5750600160e01b821615610f24575b610f24613c4f565b9091505b6000190161387f81610dc0565b549081156138ab57600160e01b8216156138a75761387f91506138a0613c4f565b9050613872565b5090565b61387f91506138a0565b916016548111156138c7575b50613866565b6138d2919250610dc0565b549081610f2457386138c1565b50600c548310613841565b9060008260145411158061395e575b1561393a5750905b61390a81610dc0565b548061392e57508015613921575b60001901613901565b613929613415565b613918565b600160e01b1615919050565b918060165410156139485750565b9091506000526010602052604060002054151590565b50600c5483106138f9565b91909161397582613832565b6001600160a01b0391821693909190818316859003613aac575b600084815260126020526040902080546139b86001600160a01b03881633908114908314171590565b613a68575b613a5e575b506139cc85613801565b80546000190190556139dd81613801565b8054600101905516928391600160e11b4260a01b841781176139fe86610dc0565b55811615613a2a575b50600080516020614dd4833981519152600080a415613a2257565b610f24613c84565b60018401613a3781610dc0565b5415613a44575b50613a07565b600c548114613a3e57613a5690610dc0565b553880613a3e565b60009055386139c2565b613a9a6121ee613a9333613a8e8b60018060a01b03166000526013602052604060002090565b61381b565b5460ff1690565b156139bd57613aa7613c72565b6139bd565b613ab4613c61565b61398f565b929190613ac7828286613969565b803b613ad35750505050565b613adc93613b40565b15613aea5738808080611143565b6368d2bf6b60e11b60005260046000fd5b9081602091031261000e575161098381610720565b3d15613b3b573d90613b2182610f26565b91613b2f6040519384610ef4565b82523d6000602084013e565b606090565b604051630a85bd0160e11b8082523360048301526001600160a01b03928316602483015260448201949094526080606482015292936020928492909183916000918390613b9190608483019061094d565b0393165af160009181613bd7575b50613bc957613bac613b10565b805115613bbc575b805190602001fd5b613bc4613c96565b613bb4565b6001600160e01b0319161490565b613bf991925060203d8111613c00575b613bf18183610ef4565b810190613afb565b9038613b9f565b503d613be7565b506368a608ff60e11b60005260046000fd5b50637685565760e01b60005260046000fd5b5063071ff01b60e41b60005260046000fd5b506333b2b04560e21b60005260046000fd5b50636f96cda160e11b60005260046000fd5b5062a1148160e81b60005260046000fd5b50632ce44b5f60e11b60005260046000fd5b50633a954ecd60e21b60005260046000fd5b506368d2bf6b60e11b60005260046000fd5b50622e076360e81b60005260046000fd5b50638a5ab21f60e01b60005260046000fd5b90815180825260208080930193019160005b828110613ceb575050505090565b835185529381019392810192600101613cdd565b9091613d166109839360408452604084019061094d565b916020818403910152613ccb565b919082604091031261000e576020825192015190565b9060409361ffff939695613d6a613db493613d5c88519a8b9260208401613cff565b03601f1981018a5289610ef4565b613d9b8651988996879663040a7bb160e41b885216600487015230602487015260a0604487015260a486019061094d565b911515606485015283820360031901608485015261094d565b03817f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165afa918215613e38575b6000908193613e05575b50600754613e019161369f565b9190565b613e019350613e2b915060403d8111613e31575b613e238183610ef4565b810190613d24565b92613df4565b503d613e19565b613e406132fc565b613dea565b15613e4c57565b60405162461bcd60e51b8152602060048201526013602482015272746f6b656e4964735b5d20697320656d70747960681b6044820152606490fd5b15613e8e57565b60405162461bcd60e51b815260206004820152602260248201527f62617463682073697a65206578636565647320647374206261746368206c696d6044820152611a5d60f21b6064820152608490fd5b8051821015613ef25760209160051b010190565b634e487b7160e01b600052603260045260246000fd5b8181029291811591840414171561343b57565b1561000e57565b613f3a9060206040519282848094519384920161092a565b810103902090565b906020610983928181520190613ccb565b95909493919293613f6685511515613e45565b8451613f7f60019182811490811561409f575b50613e87565b855160005b818110614083575050509261402161ffff93614056937fe1b87c47fdeb4f9cbadbca9df3af7aba453bb6e501075d0440d88125b711522a9660405192613fe084613fd28c8960208401613cff565b03601f198101865285610ef4565b61400e614007613ffe8d61ffff16600052600a602052604060002090565b548c5190613f08565b848d6142ce565b61401a60075434613452565b938b61411a565b614051600080808061403f6112ec6112ec835460018060a01b031690565b6007549082821561407a575bf1613f1b565b613f22565b60405190956001600160a01b0316949091169281906140759082613f42565b0390a4565b506108fc61404b565b8061409961409285938b613ede565b518c6143df565b01613f84565b90506140b98961ffff166000526009602052604060002090565b54101538613f79565b926140e761098397959361ffff6140f59416865260c0602087015260c086019061094d565b90848203604086015261094d565b6001600160a01b0391821660608401529316608082015280830360a09091015261094d565b946141439193929561ffff8116600052600160205261414a604060002060405194858092611116565b0384610ef4565b8251156141dd5761415c855182614370565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031693843b1561000e576000966141b191604051998a988997889662c5803160e81b8852600488016140c2565b03925af180156141d0575b6141c35750565b8061299c610f2492610e9e565b6141d86132fc565b6141bc565b60405162461bcd60e51b815260206004820152603060248201527f4c7a4170703a2064657374696e6174696f6e20636861696e206973206e6f742060448201526f61207472757374656420736f7572636560801b6064820152608490fd5b1561424257565b60405162461bcd60e51b815260206004820152601a602482015279131e905c1c0e881b5a5b91d85cd31a5b5a5d081b9bdd081cd95d60321b6044820152606490fd5b1561428b57565b60405162461bcd60e51b815260206004820152601b60248201527a4c7a4170703a20676173206c696d697420697320746f6f206c6f7760281b6044820152606490fd5b919091602283511061432c5761ffff6022610f24940151911660005260026020526040600020600160005260205260406000205491820180921161431f575b61431882151561423b565b1015614284565b614327613415565b61430d565b60405162461bcd60e51b815260206004820152601c60248201527b4c7a4170703a20696e76616c69642061646170746572506172616d7360201b6044820152606490fd5b61ffff1660005260036020526040600020549081156143d5575b1161439157565b606460405162461bcd60e51b815260206004820152602060248201527f4c7a4170703a207061796c6f61642073697a6520697320746f6f206c617267656044820152fd5b612710915061438a565b90610f249130905b9190916143f382613832565b6001600160a01b0391821693908281168590036144f4575b836014541115806144e8575b156144af5761442585613801565b805460001901905561443682613801565b805460010190554260a01b8383161761444e85610dc0565b55600160e11b81161561447b575b505b168092600080516020614dd4833981519152600080a415613a2257565b6001840161448881610dc0565b5415614495575b5061445c565b600c54811461448f576144a790610dc0565b55388061448f565b506144b984613801565b80546000190190556144ca81613801565b805460010190554260a01b828216176144e284610dc0565b5561445e565b50601554841115614417565b6144fc613c61565b61440b565b919060408382031261000e5782516001600160401b03939084811161000e578261452c918301613295565b936020918281015191821161000e57019180601f8401121561000e5782516145538161254e565b936145616040519586610ef4565b818552838086019260051b82010192831161000e578301905b828210614588575050505090565b8151815290830190830161457a565b60026060610f249361ffff8151168454908061ffff19831617865562010000600160b01b03602084015160101b169160018060b01b03191617178455604081015160018501550151151591019060ff801983541691151516179055565b60409061098393928152816020820152019061094d565b9190600080516020614d9483398151915261ffff614657601493855161463960208089019289010182614501565b96015196614647878961476a565b8751811061467257505050613f22565b9361407560405192839260018060a01b031697169482613f42565b611a3b600080516020614df48339815191529383519020916040519061469782610ebe565b8c891682526001600160a01b038c166020830152611a21565b156146b757565b60405162461bcd60e51b81526020600482015260116024820152701b9bc818dc99591a5d1cc81cdd1bdc9959607a1b6044820152606490fd5b156146f757565b60405162461bcd60e51b815260206004820152602960248201527f6e6f7420656e6f7567682067617320746f2070726f6365737320637265646974604482015268103a3930b739b332b960b91b6064820152608490fd5b600190600019811461475e570190565b614766613415565b0190565b60009291835b8151811015614802575a600854116148025761478c8183613ede565b5190614797826138ea565b1580156147d8575b156147d457816147b16147c4936138ea565b6147c9576147bf908561489a565b61474e565b614770565b6147bf9085306143e7565b8580fd5b506147e2826138ea565b801561479f57506001600160a01b036147fa83613832565b16301461479f565b93505050565b9291905b8151811015614895575a60085411614895576148288183613ede565b5190614833826138ea565b15801561486b575b1561000e578161484d61485b936138ea565b614860576147bf908661489a565b61480c565b6147bf9086306143e7565b50614875826138ea565b801561483b57506001600160a01b0361488d83613832565b16301461483b565b925050565b601654821161492d5760145482101580614921575b614910576001600160a01b038116906148d7904260a01b83176148d185610dc0565b55613801565b80546001600160401b010190558015614900576000600080516020614dd48339815191528180a4565b622e076360e81b60005260046000fd5b630b91e58760e41b60005260046000fd5b506015548211156148af565b6305033e0360e41b60005260046000fd5b6020909392919361ffff60408201951681520152565b60408051919082016001600160401b0381118382101761498a575b60405260018252602082016020368237825115613ef2575290565b614992610e87565b61496f565b9081602091031261000e575161098381610fa2565b9190600c54908015614a4e576001936001600160a01b03811691906149e1904260a01b83881460e11b1784176148d186610dc0565b80546001600160401b0183020190558115614a41575b8201919380805b614a0d575b505050600c559050565b15614a30575b600081868483600080516020614dd48339815191528180a46149fe565b80940193828503614a135780614a03565b614a49613ca8565b6149f7565b63b562e8dd60e01b60005260046000fd5b6064356001600160801b038116810361000e5790565b6084356001600160801b038116810361000e5790565b60a4356109838161056b565b15614a9e57565b60405162461bcd60e51b815260206004820152602260248201527f43616c6c6572206973206e6f742062656e6566696369617279206f72206f776e60448201526132b960f11b6064820152608490fd5b903590601e198136030182121561000e57018035906001600160401b03821161000e5760200191813603831361000e57565b91906001600160401b038111614bfe575b614b4581614b40601e54611057565b6133a1565b6000601f8211600114614b7f57819293600092614b74575b50508160011b916000199060031b1c191617601e55565b013590503880614b5d565b601e600052601f198216937f50bb669a95c7b50b7e8a6f09454034b2b14cf2b85c730dca9a539ca82cb6e35091805b868110614be65750836001959610614bcc575b505050811b01601e55565b0135600019600384901b60f8161c19169055388080614bc1565b90926020600181928686013581550194019101614bae565b614c06610e87565b614b31565b9081602091031261000e575190565b6001600160a01b039091168152602081019190915260400190565b614c3e906138ea565b1561000e5760ff601f5460081c1615614cf857604051601d54816000614c6383611057565b808352600193808516908115614cd75750600114614c89575b5061098392500382610ef4565b601d6000908152600080516020614d5483398151915294602093509091905b818310614cbf575050610983935082010138614c7c565b85548784018501529485019486945091830191614ca8565b905061098394506020925060ff191682840152151560051b82010138614c7c565b6040516109838161120c81611091565b81939293614d17575b50501490565b60059291831b8101915b8135808211851b918252602080921852604060002091019282841015614d48579290614d21565b509150503880614d1156fe6d4407e7be21f808e6509aa9fa9143369579dd7d760fe20a2c09680fc146134f8c0400cfe2d1199b1a725c78960bcc2a344d869b80590d0f2bd005db15a572ce5b821db8a46f8ecbe1941ba2f51cfeea9643268b56631f70d45e2a745d9902658be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef10e0b70d256bccc84b7027506978bd8b68984a870788b93b479def144c839ad7fa41487ad5d6728f0b19276fa1eddc16558578f5109fc39d2dc33c3230470daba26469706673582212209d1692e00f656bff38a234709db6b70e20e3056353efaa1c23da8e3619ea45f164736f6c63430008110033bb7b4a454dc3493923482f07822329ed19e8244eff582cc204f8554c3620c3fd8d1108e10bcb7c27dddfc02ed9d693a074039d026cf4ea4240b40f7d581ac80200000000000000000000000000000000000000000000000000000000000001c000000000000000000000000000000000000000000000000000000000000002000000000000000000000000003a73033c0b1407574c76bdbac67f126f6b4a9aa9000000000000000000000000000000000000000000000000000000002cb41781000000000000000000000000000000000000000000000000000000003b9aca00000000000000000000000000000000000000000000000000000000003b9aca00000000000000000000000000000000000000000000000000000000000000024000000000000000000000000000000000000000000000000000000000000002e000000000000000000000000000000000000000000000000000000000000003e8000000000000000000000000000000000000000000000000120a871cc0020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008636fa411113d1b40b5d76f6766d16b3aa829d30000000000000000000000000144c8f91bc6090ad425bc3e707f0a611534548ef00000000000000000000000000000000000000000000000000000000000000084f6d6e694761777300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000084f4d4e4947415753000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007e68747470733a2f2f74646e34663665366266626e737a63716973677a7a72786a68346e78706934717a6874797479797835687a73786c716f70356b612e617277656176652e6e65742f6d4e76432d4a344a51746c6b5545534e6e4d6270507874336f35444a35346e6a462d6e7a4b36344f6631512f63656c6f2e6a736f6e0000000000000000000000000000000000000000000000000000000000000000000e656d70747948696464656e55524c000000000000000000000000000000000000
Deployed Bytecode
0x60806040526004361015610013575b600080fd5b60003560e01c80621d35671461056257806301ffc9a71461055957806306a8e4d91461055057806306fdde031461054757806307e0db171461053e578063081812fc14610535578063095ea7b31461052c5780630b4cad4c146105235780630df374831461051a57806310ddb1371461051157806322a3ecf91461050857806323b872dd146104ff57806329d7e69b146104f65780632a205e3d146104ed5780632eb4a7ab146104e4578063392f37e9146104db5780633ccfd60b146104d25780633d8b38f6146104c95780633f1f4fa4146104c057806342842e0e146104b757806342d65a8d146104ae57806348288190146104a55780634ac3f4ff1461049c57806351905636146104935780635b8c41e61461048a5780636352211e1461048157806366ad5c8a146104785780636ecf80981461046f57806370a0823114610466578063715018a61461045d5780637533d78814610454578063796b0c5c1461044b5780637cb647591461044257806382b12dd7146104395780638cfd8f5c146104305780638da5cb5b146104275780638ffa1f2a1461041e578063950c8a741461041557806395d89b411461040c578063998cdf83146104035780639ea5d6b1146103fa5780639f38369a146103f1578063a0712d68146103e8578063a22cb465146103df578063a6c3d165146103d6578063ab3ffb93146103cd578063af3fb21c146103c4578063b353aaa7146103bb578063b88d4fde146103b2578063baf3292d146103a9578063c19d93fb146103a0578063c446183414610397578063c5b6d52d1461038e578063c5ea3c6514610385578063c7d8505a1461037c578063c87b56dd14610373578063cbed8b9c1461036a578063d12473a514610361578063d1deba1f14610358578063d2cab0561461034f578063df2a5b3b14610346578063e985e9c51461033d578063eb8d72b714610334578063f23536411461032b578063f2fde38b14610322578063f3218cc114610319578063f5ecbdbc146103105763fa25f9b61461030857600080fd5b61000e613200565b5061000e61311d565b5061000e613007565b5061000e612f51565b5061000e612ecc565b5061000e612d94565b5061000e612d3b565b5061000e612c4d565b5061000e612b9d565b5061000e612a74565b5061000e6129af565b5061000e6128b4565b5061000e612894565b5061000e612875565b5061000e612856565b5061000e6127f2565b5061000e6127d4565b5061000e612792565b5061000e612721565b5061000e6126cf565b5061000e612689565b5061000e61266c565b5061000e6125d2565b5061000e6123dd565b5061000e61234a565b5061000e6121cc565b5061000e612128565b5061000e61205f565b5061000e61203d565b5061000e611f98565b5061000e611f6e565b5061000e611d8d565b5061000e611d63565b5061000e611d07565b5061000e611ce8565b5061000e611cb3565b5061000e611c58565b5061000e611c00565b5061000e611b9b565b5061000e611b3d565b5061000e611aa9565b5061000e61194d565b5061000e61191d565b5061000e61189a565b5061000e6117cf565b5061000e611795565b5061000e611776565b5061000e6116f4565b5061000e6116b0565b5061000e611676565b5061000e611620565b5061000e6112a4565b5061000e6111ac565b5061000e611038565b5061000e610fac565b5061000e610e68565b5061000e610e55565b5061000e610dd0565b5061000e610d13565b5061000e610cd3565b5061000e610c2e565b5061000e610b75565b5061000e610b10565b5061000e610a67565b5061000e610986565b5061000e6107b2565b5061000e610732565b5061000e610609565b61ffff81160361000e57565b9181601f8401121561000e578235916001600160401b03831161000e576020838186019501011161000e57565b90608060031983011261000e576004356105bd8161056b565b916001600160401b039060243582811161000e57816105de91600401610577565b93909392604435818116810361000e579260643591821161000e5761060591600401610577565b9091565b503461000e57610618366105a4565b929493919291907f0000000000000000000000003a73033c0b1407574c76bdbac67f126f6b4a9aa96001600160a01b031633036106db5761069e6106a6926106ac9761069761067d6106788a61ffff166000526001602052604060002090565b611be5565b80519081841491826106d1575b50816106ae575b5061323a565b3691610f50565b923691610f50565b9261345f565b005b90506106bb368486610f50565b6020815191012090602081519101201438610691565b151591503861068a565b60405162461bcd60e51b815260206004820152601e60248201527f4c7a4170703a20696e76616c696420656e64706f696e742063616c6c657200006044820152606490fd5b6001600160e01b031981160361000e57565b503461000e57602036600319011261000e57602060043561075281610720565b63ffffffff60e01b166301ffc9a760e01b8114908115908161077b575b50506040519015158152f35b906107a1575b8115610790575b50388061076f565b635b5e139f60e01b14905038610788565b6380ac58cd60e01b81149150610781565b503461000e576003196020368201811361000e57600435906001600160401b039081831161000e5760408360040194843603011261000e5760185461080c90336001600160a01b0391821614908115610911575b50614a97565b6108168480614aee565b928311610904575b6108328361082d601d54611057565b61335c565b600091601f8411600114610885575092826106ac95936024936108749660009261087a575b50508160011b916000199060031b1c191617601d555b0190614aee565b90614b20565b013590503880610857565b601d60005291601f198416600080516020614d548339815191529382905b8282106108ec575050936024936108749693600193836106ac9a98106108d2575b505050811b01601d5561086d565b0135600019600384901b60f8161c191690553880806108c4565b806001859782949688013581550196019301906108a3565b61090c610e87565b61081e565b905060005416331438610806565b600091031261000e57565b60005b83811061093d5750506000910152565b818101518382015260200161092d565b906020916109668151809281855285808601910161092a565b601f01601f1916010190565b90602061098392818152019061094d565b90565b503461000e57600080600319360112610a645760405181600e546109a981611057565b80845290600190818116908115610a3c57506001146109e3575b6109df846109d381880382610ef4565b60405191829182610972565b0390f35b600e8352602094507fbb7b4a454dc3493923482f07822329ed19e8244eff582cc204f8554c3620c3fd5b828410610a2957505050816109df936109d392820101936109c3565b8054858501870152928501928101610a0d565b6109df96506109d39450602092508593915060ff191682840152151560051b820101936109c3565b80fd5b503461000e5760006020366003190112610a6457600435610a878161056b565b610a8f6137a9565b7f0000000000000000000000003a73033c0b1407574c76bdbac67f126f6b4a9aa96001600160a01b0316908290823b15610b0c57602461ffff918360405195869485936307e0db1760e01b85521660048401525af18015610aff575b610af3575080f35b610afc90610e9e565b80f35b610b076132fc565b610aeb565b5080fd5b503461000e57602036600319011261000e57600435610b2e816138ea565b15610b53576000526012602052602060018060a01b0360406000205416604051908152f35b6333d1c03960e21b60005260046000fd5b6001600160a01b0381160361000e57565b50604036600319011261000e57600435610b8e81610b64565b6024356001600160a01b0380610ba383613832565b1690813303610bfe575b600083815260126020526040812080546001600160a01b0319166001600160a01b0387161790559316907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258480a480f35b81600052601360205260ff610c1733604060002061381b565b5416610bad576367d9dca160e11b60005260046000fd5b503461000e57602036600319011261000e57600435610c4b6137a9565b8015610c82576020817ffebbc4f8bb9ec2313950c718d43123124b15778efda4c1f1d529de2995b4f34d92600855604051908152a1005b60405162461bcd60e51b8152602060048201526024808201527f6d696e476173546f5472616e73666572416e6453746f7265206d7573742062656044820152630203e20360e41b6064820152608490fd5b503461000e57604036600319011261000e5761ffff600435610cf48161056b565b610cfc6137a9565b166000526003602052602435604060002055600080f35b503461000e5760006020366003190112610a6457600435610d338161056b565b610d3b6137a9565b7f0000000000000000000000003a73033c0b1407574c76bdbac67f126f6b4a9aa96001600160a01b0316908290823b15610b0c57602461ffff918360405195869485936310ddb13760e01b85521660048401525af18015610aff57610af3575080f35b602090600319011261000e5760043590565b600052600b602052604060002090565b6000526010602052604060002090565b503461000e57610ddf36610d9e565b600052600b6020526080604060002080549060ff6002600183015492015416906040519261ffff8116845260018060a01b039060101c166020840152604083015215156060820152f35b606090600319011261000e57600435610e4181610b64565b90602435610e4e81610b64565b9060443590565b506106ac610e6236610e29565b91613969565b503461000e57600036600319011261000e576020601454604051908152f35b50634e487b7160e01b600052604160045260246000fd5b6001600160401b038111610eb157604052565b610eb9610e87565b604052565b608081019081106001600160401b03821117610eb157604052565b60c081019081106001600160401b03821117610eb157604052565b601f909101601f19168101906001600160401b03821190821017610eb157604052565b60405190610f2482610ebe565b565b6020906001600160401b038111610f43575b601f01601f19160190565b610f4b610e87565b610f38565b929192610f5c82610f26565b91610f6a6040519384610ef4565b82948184528183011161000e578281602093846000960137010152565b9080601f8301121561000e5781602061098393359101610f50565b8015150361000e57565b503461000e5760a036600319011261000e57600435610fca8161056b565b6001600160401b039060243582811161000e57610feb903690600401610f87565b9060643590610ff982610fa2565b60843593841161000e57611014611026943690600401610f87565b92611020604435614954565b91613d3a565b60408051928352602083019190915290f35b503461000e57600036600319011261000e576020601754604051908152f35b90600182811c92168015611087575b602083101461107157565b634e487b7160e01b600052602260045260246000fd5b91607f1691611066565b601e54600092916110a182611057565b9081815260019283811690816000146110fb57506001146110c157505050565b90929350601e6000526020928360002092846000945b8386106110e75750505050010190565b8054858701830152940193859082016110d7565b91935050602093945060ff191683830152151560051b010190565b906000929180549161112783611057565b9182825260019384811690816000146111895750600114611149575b50505050565b90919394506000526020928360002092846000945b838610611175575050505001019038808080611143565b80548587018301529401938590820161115e565b9294505050602093945060ff191683830152151560051b01019038808080611143565b503461000e57600080600319360112610a645760405181601d546111cf81611057565b8084529060019081811690811561127c5750600114611235575b611227846111f981880382610ef4565b6109df6040516112138161120c81611091565b0382610ef4565b60405193849360408552604085019061094d565b90838203602085015261094d565b601d835260209450600080516020614d548339815191525b8284106112695750505081611227936111f992820101936111e9565b805485850187015292850192810161124d565b61122796506111f99450602092508593915060ff191682840152151560051b820101936111e9565b503461000e57600080600319360112610a645760185481906001600160a01b039081169033821480156115dc575b6112db90614a97565b6019546112f8906001600160a01b03165b6001600160a01b031690565b601a546001600160a01b031691611310841515613f1b565b8082169261131f841515613f1b565b16806113da57505082809281808080809647908280808061136b61136461135c61135661134f601c5461ffff1690565b61ffff1690565b89613f08565b612710900490565b8097613452565b8b8282156113d1575bf1156113c4575b8282156113bb575bf1156113ae575b47908282156113a5575bf11561139d5780f35b610afc6132fc565b506108fc611394565b6113b66132fc565b61138a565b506108fc611383565b6113cc6132fc565b61137b565b506108fc611374565b6040516370a0823160e01b808252306004830152602096506114d7958795509093909188919061148b90879081816024818a5afa9081156115cf575b85916115b2575b5061144461143d61135c61143761134f601c5461ffff1690565b84613f08565b8092613452565b9360405183818061146463a9059cbb60e01b998a83528c60048401614c1a565b03818a8d5af180156115a5575b611588575b50604051938492839287845260048401614c1a565b038186895af1801561157b575b61155e575b506040519485523060048601528585602481875afa948515611551575b8295611522575b5060405196879586948593845260048401614c1a565b03925af18015611515575b6114eb57505080f35b8161150a92903d1061150e575b6115028183610ef4565b810190614997565b5080f35b503d6114f8565b61151d6132fc565b6114e2565b611543919550863d881161154a575b61153b8183610ef4565b810190614c0b565b93386114c1565b503d611531565b6115596132fc565b6114ba565b61157490873d891161150e576115028183610ef4565b503861149d565b6115836132fc565b611498565b61159e90843d861161150e576115028183610ef4565b5038611476565b6115ad6132fc565b611471565b6115c99150823d841161154a5761153b8183610ef4565b3861141d565b6115d76132fc565b611416565b508254811633146112d2565b90604060031983011261000e576004356116018161056b565b91602435906001600160401b03821161000e5761060591600401610577565b503461000e57602061ffff611667611637366115e8565b939091166000526001845261120c611659604060002060405192838092611116565b848151910120923691610f50565b82815191012014604051908152f35b503461000e57602036600319011261000e5761ffff6004356116978161056b565b1660005260036020526020604060002054604051908152f35b506106ac6116bd36610e29565b60405192909190602084016001600160401b038111858210176116e7575b60405260008452613ab9565b6116ef610e87565b6116db565b503461000e57611703366115e8565b919061170d6137a9565b7f0000000000000000000000003a73033c0b1407574c76bdbac67f126f6b4a9aa96001600160a01b031691823b1561000e57604051928380926342d65a8d60e01b825281611764600098899788946004850161332a565b03925af18015610aff57610af3575080f35b503461000e57600036600319011261000e576020600854604051908152f35b503461000e57602036600319011261000e5761ffff6004356117b68161056b565b1660005260096020526020604060002054604051908152f35b5060e036600319011261000e576004356117e881610b64565b6024356117f48161056b565b6001600160401b039160443583811161000e57611815903690600401610f87565b906084359061182382610b64565b60a4359261183084610b64565b60c43595861161000e5761184b6106ac963690600401610f87565b94611857606435614954565b92613f53565b60209061187792826040519483868095519384920161092a565b82019081520301902090565b9060018060401b0316600052602052604060002090565b503461000e57606036600319011261000e576004356118b88161056b565b6001600160401b0360243581811161000e576118d8903690600401610f87565b90604435908116810361000e5761190761190c9261ffff6109df9516600052600560205260406000209061185d565b611883565b546040519081529081906020820190565b503461000e57602036600319011261000e5760206001600160a01b03611944600435613832565b16604051908152f35b503461000e5761195c366105a4565b939150303303611a55576119c961199561ffff9261198d600080516020614d94833981519152956014973691610f50565b963691610f50565b9485516119aa60208089019289010182614501565b960151966119b8878961476a565b875181106119e9575b505050613f22565b936119e460405192839260018060a01b031697169482613f42565b0390a4005b611a3b600080516020614df4833981519152938351902091611a09610f17565b61ffff8d168152906001600160a01b038c1660208301525b604082015260016060820152611a3683610db0565b614597565b611a4a604051928392836145f4565b0390a13880806119c1565b60405162461bcd60e51b815260206004820152602660248201527f4e6f6e626c6f636b696e674c7a4170703a2063616c6c6572206d7573742062656044820152650204c7a4170760d41b6064820152608490fd5b503461000e57608036600319011261000e57601854611adc90336001600160a01b03918216149081156109115750614a97565b600435611ae881610fa2565b611b1760243591611af883610fa2565b611b03604051610ebe565b151560ff8019601f54169115151617601f55565b61ff00601f5491151560081b169061ff00191617601f5542602055606435602155600080f35b503461000e57602036600319011261000e57600435611b5b81610b64565b6001600160a01b03168015611b8a576000526011602052602060018060401b0360406000205416604051908152f35b6323d3ad8160e21b60005260046000fd5b503461000e57600080600319360112610a6457611bb66137a9565b80546001600160a01b03198116825581906001600160a01b0316600080516020614db48339815191528280a380f35b90610f24611bf99260405193848092611116565b0383610ef4565b503461000e57602036600319011261000e5761ffff600435611c218161056b565b1660005260016020526109df61120c611c44604060002060405192838092611116565b60405191829160208352602083019061094d565b503461000e57604036600319011261000e5760043563ffffffff9081811680910361000e576024359180831680930361000e57611c936137a9565b600c5460145490031681111561000e578082111561000e57601455601555005b503461000e57611cc236610d9e565b601854611ce390336001600160a01b03918216149081156109115750614a97565b601755005b503461000e57600036600319011261000e576020600754604051908152f35b503461000e57604036600319011261000e576020611d5a600435611d2a8161056b565b61ffff60243591611d3a8361056b565b166000526002835260406000209061ffff16600052602052604060002090565b54604051908152f35b503461000e57600036600319011261000e576000546040516001600160a01b039091168152602090f35b503461000e57602036600319011261000e576004356001600160401b03811161000e57611dbe903690600401610f87565b600260065414611f29576002600655611e038151602080840191822093611df9611df46002611dec88610db0565b015460ff1690565b6146b0565b8051010190614501565b9050611e0e82610db0565b50611e4281611e2f611e1f85610db0565b5460101c6001600160a01b031690565b6001611e3a86610db0565b015490614808565b90611e5a6001611e5185610db0565b015483116146f0565b518103611ec35750611eb581611ea5611e937fd7be02b8dd0d27bd0517a9cb4d7469ce27df4313821ae5ec1ff69acc594ba23394610db0565b60026000918281558260018201550155565b6040519081529081906020820190565b0390a15b6106ac6001600655565b611a3682611ede611ed6611f2495610db0565b5461ffff1690565b92611f13611eee611e1f84610db0565b611f03611ef9610f17565b61ffff9097168752565b6001600160a01b03166020860152565b604084015260016060840152610db0565b611eb9565b60405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606490fd5b503461000e57600036600319011261000e576004546040516001600160a01b039091168152602090f35b503461000e57600080600319360112610a645760405181600f54611fbb81611057565b80845290600190818116908115610a3c5750600114611fe4576109df846109d381880382610ef4565b600f8352602094507f8d1108e10bcb7c27dddfc02ed9d693a074039d026cf4ea4240b40f7d581ac8025b82841061202a57505050816109df936109d392820101936109c3565b805485850187015292850192810161200e565b503461000e57602036600319011261000e576120576137a9565b600435600755005b503461000e57604036600319011261000e5760043561207d8161056b565b6024356120886137a9565b80156120d8578161ffff7f7315f7654d594ead24a30160ed9ba2d23247f543016b918343591e93d7afdb6d93166000526009602052816040600020556120d36040519283928361493e565b0390a1005b60405162461bcd60e51b815260206004820152602260248201527f647374436861696e4964546f42617463684c696d6974206d757374206265203e604482015261020360f41b6064820152608490fd5b503461000e57602036600319011261000e5761ffff6004356121498161056b565b16600052600160205261120c612169604060002060405192838092611116565b805115612187576109d3816121816109df935161342c565b90613729565b60405162461bcd60e51b815260206004820152601d60248201527f4c7a4170703a206e6f20747275737465642070617468207265636f72640000006044820152606490fd5b50602036600319011261000e576106ac6004356121f26121ee601f5460ff1690565b1590565b61233d575b8015612330575b61221261220d82600c5461369f565b613443565b60155410612323575b61222a6020546021549061369f565b4211612316575b601a546001600160a01b0316806122855750601b5461226b908290612266906001600160801b03165b6001600160801b031690565b613f08565b3410612278575b336149ac565b612280613c3d565b612272565b60206122d56000926122a58561226661225a601b5460018060801b031690565b6040516323b872dd60e01b8152336004820152306024820152604481019190915293849283919082906064820190565b03925af18015612309575b6122eb575b50612272565b6123029060203d811161150e576115028183610ef4565b50386122e5565b6123116132fc565b6122e0565b61231e613c07565b612231565b61232b613c2b565b61221b565b612338613c19565b6121fe565b612345613c07565b6121f7565b503461000e57604036600319011261000e5760043561236881610b64565b6024359061237582610fa2565b3360005260136020526123a18261239083604060002061381b565b9060ff801983541691151516179055565b60405191151582526001600160a01b03169033907f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3190602090a3005b503461000e576123ec366115e8565b906123f56137a9565b604051926020928083858701376124216034868381013060601b88820152036014810188520186610ef4565b61ffff8216600090815260018086526040822087519296909291906001600160401b038311612541575b61245f836124598654611057565b866133db565b80601f84116001146124bd5750918080926124ac9695948a9b600080516020614d748339815191529b946124b2575b50501b916000199060031b1c19161790555b6040519384938461332a565b0390a180f35b01519250388061248e565b91939498601f1984166124d587600052602060002090565b938a905b82821061252a57505091600080516020614d74833981519152999a959391856124ac98969410612511575b505050811b0190556124a0565b015160001960f88460031b161c19169055388080612504565b8088869782949787015181550196019401906124d9565b612549610e87565b61244b565b6020906001600160401b038111612567575b60051b0190565b61256f610e87565b612560565b81601f8201121561000e5780359161258b8361254e565b926125996040519485610ef4565b808452602092838086019260051b82010192831161000e578301905b8282106125c3575050505090565b813581529083019083016125b5565b5060e036600319011261000e576004356125eb81610b64565b602435906125f88261056b565b6001600160401b039160443583811161000e57612619903690600401610f87565b60643584811161000e57612631903690600401612574565b6084359161263e83610b64565b60a4359361264b85610b64565b60c43596871161000e576126666106ac973690600401610f87565b95613f53565b503461000e57600036600319011261000e57602060405160018152f35b503461000e57600036600319011261000e576040517f0000000000000000000000003a73033c0b1407574c76bdbac67f126f6b4a9aa96001600160a01b03168152602090f35b50608036600319011261000e576004356126e881610b64565b6024356126f481610b64565b606435916001600160401b03831161000e576127176106ac933690600401610f87565b9160443591613ab9565b503461000e57602036600319011261000e577f5db758e995a17ec1ad84bdef7e8c3293a0bd6179bcce400dff5d4c3d87db726b602060043561276281610b64565b61276a6137a9565b600480546001600160a01b0319166001600160a01b03929092169182179055604051908152a1005b503461000e57600036600319011261000e576080601f546020546021549060ff604051938181161515855260081c161515602084015260408301526060820152f35b503461000e57600036600319011261000e5760206040516127108152f35b503461000e57600036600319011261000e5760c060018060a01b03806018541690806019541690601a5416601b549061ffff601c5416926040519485526020850152604084015260018060801b038116606084015260801c608083015260a0820152f35b503461000e57600036600319011261000e576020601554604051908152f35b503461000e57600036600319011261000e576020601654604051908152f35b503461000e57602036600319011261000e576109df611c44600435614c35565b503461000e57608036600319011261000e576004356128d28161056b565b6024356128de8161056b565b6064356001600160401b03811161000e576128fd903690600401610577565b90926129076137a9565b7f0000000000000000000000003a73033c0b1407574c76bdbac67f126f6b4a9aa96001600160a01b031690813b1561000e576000809461297e604051978896879586946332fb62e760e21b865261ffff80921660048701521660248501526044356044850152608060648501526084840191613309565b03925af180156129a2575b61298f57005b8061299c6106ac92610e9e565b8061091f565b6129aa6132fc565b612989565b503461000e57604036600319011261000e576004356129cd8161056b565b6024356129d86137a9565b8015612a23578161ffff7fc46df2983228ac2d9754e94a0d565e6671665dc8ad38602bc8e544f0685a29fb9316600052600a602052816040600020556120d36040519283928361493e565b60405162461bcd60e51b815260206004820152602360248201527f647374436861696e4964546f5472616e73666572476173206d7573742062652060448201526203e20360ec1b6064820152608490fd5b50612a7e366105a4565b9161ffff86949296166000526005602052612ab281604060002060206040518092878b833787820190815203019020611883565b54918215612b4c57612b4084612b397fc264d91f3adc5588250e1551f547752ca0cfa8f6b530d243b9f9f4cab10ea8e5996000612b2d876119078d89612b278f6120d39f8f612b06612b139236908d610f50565b6020815191012014613604565b61ffff166000526005602052604060002090565b916135eb565b5561069e36868c610f50565b908761460b565b6040519586958661365a565b60405162461bcd60e51b815260206004820152602360248201527f4e6f6e626c6f636b696e674c7a4170703a206e6f2073746f726564206d65737360448201526261676560e81b6064820152608490fd5b50604036600319011261000e576001600160401b0360043560243582811161000e573660238201121561000e57806004013592831161000e573660248460051b8301011161000e576017546040516001600160601b03193360601b1660208201908152601482526106ac95612c2c946121ee9490939092602491612c22603482610ef4565b5190209301614d08565b612c40575b6121f26121ee601f5460ff1690565b612c48613cb9565b612c31565b503461000e57606036600319011261000e57600435612c6b8161056b565b602435612c778161056b565b60443591612c836137a9565b8215612cfe576120d37f9d5c7c0b934da8fefa9c7760c98383778a12dfbfc0c3b3106518f43fb9508ac09361ffff8316600052600260205280612cd88560406000209061ffff16600052602052604060002090565b556040519384938460409194939294606082019561ffff80921683521660208201520152565b60405162461bcd60e51b81526020600482015260156024820152744c7a4170703a20696e76616c6964206d696e47617360581b6044820152606490fd5b503461000e57604036600319011261000e57602060ff612d88600435612d6081610b64565b60243590612d6d82610b64565b6001600160a01b03166000908152601385526040902061381b565b54166040519015158152f35b503461000e57612da3366115e8565b9190612dad6137a9565b61ffff82166000908152600160208181526040832092949291906001600160401b038711612ebf575b612dea87612de48554611057565b856133db565b8590601f8811600114612e3f57509186808798936124ac95600080516020614e148339815191529993612e34575b501b906000198460031b1c19161790556040519384938461332a565b880135925038612e18565b90601f198816612e5485600052602060002090565b9288905b828210612ea857505091889391600080516020614e1483398151915298996124ac969410612e8e575b505082811b0190556124a0565b870135600019600386901b60f8161c191690553880612e81565b808685968294968c01358155019501930190612e58565b612ec7610e87565b612dd6565b503461000e5760a036600319011261000e57600435612eea8161056b565b6001600160401b039060243582811161000e57612f0b903690600401610f87565b60443583811161000e57612f23903690600401612574565b60643591612f3083610fa2565b60843594851161000e57612f4b611026953690600401610f87565b93613d3a565b503461000e57602036600319011261000e57600435612f6f81610b64565b612f776137a9565b6001600160a01b039081168015612fb357600080546001600160a01b0319811683178255909216600080516020614db48339815191528380a380f35b60405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608490fd5b503461000e5760c036600319011261000e576130216137a9565b60043561302d81610b64565b601880546001600160a01b0319166001600160a01b039290921691909117905561307e60243561305c81610b64565b601980546001600160a01b0319166001600160a01b0392909216919091179055565b6130af60443561308d81610b64565b601a80546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160801b036130bf614a5f565b1660018060801b0319601b541617601b556131006130db614a75565b601b80546001600160801b031660809290921b6001600160801b031916919091179055565b6106ac61310b614a8b565b61ffff1661ffff19601c541617601c55565b503461000e57608036600319011261000e576109df60043561313e8161056b565b6024359061314b8261056b565b613156604435610b64565b604051633d7b2f6f60e21b815261ffff91821660048201529116602482015230604482015260648035908201526000816084817f0000000000000000000000003a73033c0b1407574c76bdbac67f126f6b4a9aa96001600160a01b03165afa9081156131f3575b6000916131d2575b5060405191829182610972565b6131ed913d8091833e6131e58183610ef4565b8101906132d7565b386131c5565b6131fb6132fc565b6131bd565b503461000e57602036600319011261000e5761ffff6004356132218161056b565b16600052600a6020526020604060002054604051908152f35b1561324157565b60405162461bcd60e51b815260206004820152602660248201527f4c7a4170703a20696e76616c696420736f757263652073656e64696e6720636f6044820152651b9d1c9858dd60d21b6064820152608490fd5b81601f8201121561000e5780516132ab81610f26565b926132b96040519485610ef4565b8184526020828401011161000e57610983916020808501910161092a565b9060208282031261000e5781516001600160401b03811161000e576109839201613295565b506040513d6000823e3d90fd5b908060209392818452848401376000828201840152601f01601f1916010190565b60409061ffff61098395931681528160208201520191613309565b818110613350575050565b60008155600101613345565b90601f8211613369575050565b610f2491601d6000526020600020906020601f840160051c83019310613397575b601f0160051c0190613345565b909150819061338a565b90601f82116133ae575050565b610f2491601e6000526020600020906020601f840160051c8301931061339757601f0160051c0190613345565b9190601f81116133ea57505050565b610f24926000526020600020906020601f840160051c8301931061339757601f0160051c0190613345565b50634e487b7160e01b600052601160045260246000fd5b60131981019190821161343b57565b610f24613415565b60001981019190821161343b57565b9190820391821161343b57565b9290915a604051633356ae4560e11b6020820190815261ffff871660248301526080604483015294916134cb826134bd61349c60a483018761094d565b6001600160401b03881660648401528281036023190160848401528861094d565b03601f198101845283610ef4565b60008091604051976134dc89610ed9565b609689528260208a019560a036883751923090f1903d9060968211613523575b6000908288523e15613510575b5050505050565b6135199461352c565b3880808080613509565b609691506134fc565b91936135d87fe183f33de2837795525b4792ca4cd60535bd77c53b7e7030060bfcf5734d6b0c956135e6939561ffff8151602083012096169586600052600560205261359e8361359060208b6040600020826040519483868095519384920161092a565b820190815203019020611883565b556135bb604051978897885260a0602089015260a088019061094d565b6001600160401b039092166040870152858203606087015261094d565b90838203608085015261094d565b0390a1565b6020919283604051948593843782019081520301902090565b1561360b57565b60405162461bcd60e51b815260206004820152602160248201527f4e6f6e626c6f636b696e674c7a4170703a20696e76616c6964207061796c6f616044820152601960fa1b6064820152608490fd5b9160609361ffff61367d9398979698168452608060208501526080840191613309565b6001600160401b0390951660408201520152565b90601f820180921161343b57565b9190820180921161343b57565b156136b357565b60405162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b6044820152606490fd5b156136f057565b60405162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b6044820152606490fd5b61373d8261373681613691565b10156136ac565b61374a82825110156136e9565b81613762575050604051600081526020810160405290565b60405191601f811691821560051b808486010193838501920101905b8084106137965750508252601f01601f191660405290565b909283518152602080910193019061377e565b6000546001600160a01b031633036137bd57565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b6001600160a01b0316600090815260116020526040902090565b9060018060a01b0316600052602052604060002090565b906000826014541115806138df575b156138b5575061385082610dc0565b5491821561386e5750600160e01b821615610f24575b610f24613c4f565b9091505b6000190161387f81610dc0565b549081156138ab57600160e01b8216156138a75761387f91506138a0613c4f565b9050613872565b5090565b61387f91506138a0565b916016548111156138c7575b50613866565b6138d2919250610dc0565b549081610f2457386138c1565b50600c548310613841565b9060008260145411158061395e575b1561393a5750905b61390a81610dc0565b548061392e57508015613921575b60001901613901565b613929613415565b613918565b600160e01b1615919050565b918060165410156139485750565b9091506000526010602052604060002054151590565b50600c5483106138f9565b91909161397582613832565b6001600160a01b0391821693909190818316859003613aac575b600084815260126020526040902080546139b86001600160a01b03881633908114908314171590565b613a68575b613a5e575b506139cc85613801565b80546000190190556139dd81613801565b8054600101905516928391600160e11b4260a01b841781176139fe86610dc0565b55811615613a2a575b50600080516020614dd4833981519152600080a415613a2257565b610f24613c84565b60018401613a3781610dc0565b5415613a44575b50613a07565b600c548114613a3e57613a5690610dc0565b553880613a3e565b60009055386139c2565b613a9a6121ee613a9333613a8e8b60018060a01b03166000526013602052604060002090565b61381b565b5460ff1690565b156139bd57613aa7613c72565b6139bd565b613ab4613c61565b61398f565b929190613ac7828286613969565b803b613ad35750505050565b613adc93613b40565b15613aea5738808080611143565b6368d2bf6b60e11b60005260046000fd5b9081602091031261000e575161098381610720565b3d15613b3b573d90613b2182610f26565b91613b2f6040519384610ef4565b82523d6000602084013e565b606090565b604051630a85bd0160e11b8082523360048301526001600160a01b03928316602483015260448201949094526080606482015292936020928492909183916000918390613b9190608483019061094d565b0393165af160009181613bd7575b50613bc957613bac613b10565b805115613bbc575b805190602001fd5b613bc4613c96565b613bb4565b6001600160e01b0319161490565b613bf991925060203d8111613c00575b613bf18183610ef4565b810190613afb565b9038613b9f565b503d613be7565b506368a608ff60e11b60005260046000fd5b50637685565760e01b60005260046000fd5b5063071ff01b60e41b60005260046000fd5b506333b2b04560e21b60005260046000fd5b50636f96cda160e11b60005260046000fd5b5062a1148160e81b60005260046000fd5b50632ce44b5f60e11b60005260046000fd5b50633a954ecd60e21b60005260046000fd5b506368d2bf6b60e11b60005260046000fd5b50622e076360e81b60005260046000fd5b50638a5ab21f60e01b60005260046000fd5b90815180825260208080930193019160005b828110613ceb575050505090565b835185529381019392810192600101613cdd565b9091613d166109839360408452604084019061094d565b916020818403910152613ccb565b919082604091031261000e576020825192015190565b9060409361ffff939695613d6a613db493613d5c88519a8b9260208401613cff565b03601f1981018a5289610ef4565b613d9b8651988996879663040a7bb160e41b885216600487015230602487015260a0604487015260a486019061094d565b911515606485015283820360031901608485015261094d565b03817f0000000000000000000000003a73033c0b1407574c76bdbac67f126f6b4a9aa96001600160a01b03165afa918215613e38575b6000908193613e05575b50600754613e019161369f565b9190565b613e019350613e2b915060403d8111613e31575b613e238183610ef4565b810190613d24565b92613df4565b503d613e19565b613e406132fc565b613dea565b15613e4c57565b60405162461bcd60e51b8152602060048201526013602482015272746f6b656e4964735b5d20697320656d70747960681b6044820152606490fd5b15613e8e57565b60405162461bcd60e51b815260206004820152602260248201527f62617463682073697a65206578636565647320647374206261746368206c696d6044820152611a5d60f21b6064820152608490fd5b8051821015613ef25760209160051b010190565b634e487b7160e01b600052603260045260246000fd5b8181029291811591840414171561343b57565b1561000e57565b613f3a9060206040519282848094519384920161092a565b810103902090565b906020610983928181520190613ccb565b95909493919293613f6685511515613e45565b8451613f7f60019182811490811561409f575b50613e87565b855160005b818110614083575050509261402161ffff93614056937fe1b87c47fdeb4f9cbadbca9df3af7aba453bb6e501075d0440d88125b711522a9660405192613fe084613fd28c8960208401613cff565b03601f198101865285610ef4565b61400e614007613ffe8d61ffff16600052600a602052604060002090565b548c5190613f08565b848d6142ce565b61401a60075434613452565b938b61411a565b614051600080808061403f6112ec6112ec835460018060a01b031690565b6007549082821561407a575bf1613f1b565b613f22565b60405190956001600160a01b0316949091169281906140759082613f42565b0390a4565b506108fc61404b565b8061409961409285938b613ede565b518c6143df565b01613f84565b90506140b98961ffff166000526009602052604060002090565b54101538613f79565b926140e761098397959361ffff6140f59416865260c0602087015260c086019061094d565b90848203604086015261094d565b6001600160a01b0391821660608401529316608082015280830360a09091015261094d565b946141439193929561ffff8116600052600160205261414a604060002060405194858092611116565b0384610ef4565b8251156141dd5761415c855182614370565b7f0000000000000000000000003a73033c0b1407574c76bdbac67f126f6b4a9aa96001600160a01b031693843b1561000e576000966141b191604051998a988997889662c5803160e81b8852600488016140c2565b03925af180156141d0575b6141c35750565b8061299c610f2492610e9e565b6141d86132fc565b6141bc565b60405162461bcd60e51b815260206004820152603060248201527f4c7a4170703a2064657374696e6174696f6e20636861696e206973206e6f742060448201526f61207472757374656420736f7572636560801b6064820152608490fd5b1561424257565b60405162461bcd60e51b815260206004820152601a602482015279131e905c1c0e881b5a5b91d85cd31a5b5a5d081b9bdd081cd95d60321b6044820152606490fd5b1561428b57565b60405162461bcd60e51b815260206004820152601b60248201527a4c7a4170703a20676173206c696d697420697320746f6f206c6f7760281b6044820152606490fd5b919091602283511061432c5761ffff6022610f24940151911660005260026020526040600020600160005260205260406000205491820180921161431f575b61431882151561423b565b1015614284565b614327613415565b61430d565b60405162461bcd60e51b815260206004820152601c60248201527b4c7a4170703a20696e76616c69642061646170746572506172616d7360201b6044820152606490fd5b61ffff1660005260036020526040600020549081156143d5575b1161439157565b606460405162461bcd60e51b815260206004820152602060248201527f4c7a4170703a207061796c6f61642073697a6520697320746f6f206c617267656044820152fd5b612710915061438a565b90610f249130905b9190916143f382613832565b6001600160a01b0391821693908281168590036144f4575b836014541115806144e8575b156144af5761442585613801565b805460001901905561443682613801565b805460010190554260a01b8383161761444e85610dc0565b55600160e11b81161561447b575b505b168092600080516020614dd4833981519152600080a415613a2257565b6001840161448881610dc0565b5415614495575b5061445c565b600c54811461448f576144a790610dc0565b55388061448f565b506144b984613801565b80546000190190556144ca81613801565b805460010190554260a01b828216176144e284610dc0565b5561445e565b50601554841115614417565b6144fc613c61565b61440b565b919060408382031261000e5782516001600160401b03939084811161000e578261452c918301613295565b936020918281015191821161000e57019180601f8401121561000e5782516145538161254e565b936145616040519586610ef4565b818552838086019260051b82010192831161000e578301905b828210614588575050505090565b8151815290830190830161457a565b60026060610f249361ffff8151168454908061ffff19831617865562010000600160b01b03602084015160101b169160018060b01b03191617178455604081015160018501550151151591019060ff801983541691151516179055565b60409061098393928152816020820152019061094d565b9190600080516020614d9483398151915261ffff614657601493855161463960208089019289010182614501565b96015196614647878961476a565b8751811061467257505050613f22565b9361407560405192839260018060a01b031697169482613f42565b611a3b600080516020614df48339815191529383519020916040519061469782610ebe565b8c891682526001600160a01b038c166020830152611a21565b156146b757565b60405162461bcd60e51b81526020600482015260116024820152701b9bc818dc99591a5d1cc81cdd1bdc9959607a1b6044820152606490fd5b156146f757565b60405162461bcd60e51b815260206004820152602960248201527f6e6f7420656e6f7567682067617320746f2070726f6365737320637265646974604482015268103a3930b739b332b960b91b6064820152608490fd5b600190600019811461475e570190565b614766613415565b0190565b60009291835b8151811015614802575a600854116148025761478c8183613ede565b5190614797826138ea565b1580156147d8575b156147d457816147b16147c4936138ea565b6147c9576147bf908561489a565b61474e565b614770565b6147bf9085306143e7565b8580fd5b506147e2826138ea565b801561479f57506001600160a01b036147fa83613832565b16301461479f565b93505050565b9291905b8151811015614895575a60085411614895576148288183613ede565b5190614833826138ea565b15801561486b575b1561000e578161484d61485b936138ea565b614860576147bf908661489a565b61480c565b6147bf9086306143e7565b50614875826138ea565b801561483b57506001600160a01b0361488d83613832565b16301461483b565b925050565b601654821161492d5760145482101580614921575b614910576001600160a01b038116906148d7904260a01b83176148d185610dc0565b55613801565b80546001600160401b010190558015614900576000600080516020614dd48339815191528180a4565b622e076360e81b60005260046000fd5b630b91e58760e41b60005260046000fd5b506015548211156148af565b6305033e0360e41b60005260046000fd5b6020909392919361ffff60408201951681520152565b60408051919082016001600160401b0381118382101761498a575b60405260018252602082016020368237825115613ef2575290565b614992610e87565b61496f565b9081602091031261000e575161098381610fa2565b9190600c54908015614a4e576001936001600160a01b03811691906149e1904260a01b83881460e11b1784176148d186610dc0565b80546001600160401b0183020190558115614a41575b8201919380805b614a0d575b505050600c559050565b15614a30575b600081868483600080516020614dd48339815191528180a46149fe565b80940193828503614a135780614a03565b614a49613ca8565b6149f7565b63b562e8dd60e01b60005260046000fd5b6064356001600160801b038116810361000e5790565b6084356001600160801b038116810361000e5790565b60a4356109838161056b565b15614a9e57565b60405162461bcd60e51b815260206004820152602260248201527f43616c6c6572206973206e6f742062656e6566696369617279206f72206f776e60448201526132b960f11b6064820152608490fd5b903590601e198136030182121561000e57018035906001600160401b03821161000e5760200191813603831361000e57565b91906001600160401b038111614bfe575b614b4581614b40601e54611057565b6133a1565b6000601f8211600114614b7f57819293600092614b74575b50508160011b916000199060031b1c191617601e55565b013590503880614b5d565b601e600052601f198216937f50bb669a95c7b50b7e8a6f09454034b2b14cf2b85c730dca9a539ca82cb6e35091805b868110614be65750836001959610614bcc575b505050811b01601e55565b0135600019600384901b60f8161c19169055388080614bc1565b90926020600181928686013581550194019101614bae565b614c06610e87565b614b31565b9081602091031261000e575190565b6001600160a01b039091168152602081019190915260400190565b614c3e906138ea565b1561000e5760ff601f5460081c1615614cf857604051601d54816000614c6383611057565b808352600193808516908115614cd75750600114614c89575b5061098392500382610ef4565b601d6000908152600080516020614d5483398151915294602093509091905b818310614cbf575050610983935082010138614c7c565b85548784018501529485019486945091830191614ca8565b905061098394506020925060ff191682840152151560051b82010138614c7c565b6040516109838161120c81611091565b81939293614d17575b50501490565b60059291831b8101915b8135808211851b918252602080921852604060002091019282841015614d48579290614d21565b509150503880614d1156fe6d4407e7be21f808e6509aa9fa9143369579dd7d760fe20a2c09680fc146134f8c0400cfe2d1199b1a725c78960bcc2a344d869b80590d0f2bd005db15a572ce5b821db8a46f8ecbe1941ba2f51cfeea9643268b56631f70d45e2a745d9902658be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef10e0b70d256bccc84b7027506978bd8b68984a870788b93b479def144c839ad7fa41487ad5d6728f0b19276fa1eddc16558578f5109fc39d2dc33c3230470daba26469706673582212209d1692e00f656bff38a234709db6b70e20e3056353efaa1c23da8e3619ea45f164736f6c63430008110033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000000000000000000000000000000000000000001c000000000000000000000000000000000000000000000000000000000000002000000000000000000000000003a73033c0b1407574c76bdbac67f126f6b4a9aa9000000000000000000000000000000000000000000000000000000002cb41781000000000000000000000000000000000000000000000000000000003b9aca00000000000000000000000000000000000000000000000000000000003b9aca00000000000000000000000000000000000000000000000000000000000000024000000000000000000000000000000000000000000000000000000000000002e000000000000000000000000000000000000000000000000000000000000003e8000000000000000000000000000000000000000000000000120a871cc0020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008636fa411113d1b40b5d76f6766d16b3aa829d30000000000000000000000000144c8f91bc6090ad425bc3e707f0a611534548ef00000000000000000000000000000000000000000000000000000000000000084f6d6e694761777300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000084f4d4e4947415753000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007e68747470733a2f2f74646e34663665366266626e737a63716973677a7a72786a68346e78706934717a6874797479797835687a73786c716f70356b612e617277656176652e6e65742f6d4e76432d4a344a51746c6b5545534e6e4d6270507874336f35444a35346e6a462d6e7a4b36344f6631512f63656c6f2e6a736f6e0000000000000000000000000000000000000000000000000000000000000000000e656d70747948696464656e55524c000000000000000000000000000000000000
-----Decoded View---------------
Arg [0] : _name (string): OmniGaws
Arg [1] : _symbol (string): OMNIGAWS
Arg [2] : _lzEndpoint (address): 0x3A73033C0b1407574C76BdBAc67f126f6b4a9AA9
Arg [3] : _startId (uint256): 750000001
Arg [4] : _maxId (uint256): 1000000000
Arg [5] : _maxGlobalId (uint256): 1000000000
Arg [6] : _baseTokenURI (string): https://tdn4f6e6bfbnszcqisgzzrxjh4nxpi4qzhtytyyx5hzsxlqop5ka.arweave.net/mNvC-J4JQtlkUESNnMbpPxt3o5DJ54njF-nzK64Of1Q/celo.json
Arg [7] : _hiddenURI (string): emptyHiddenURL
Arg [8] : _tax (uint16): 1000
Arg [9] : _price (uint128): 1300000000000000000
Arg [10] : _wlPrice (uint128): 0
Arg [11] : token (address): 0x0000000000000000000000000000000000000000
Arg [12] : _taxRecipient (address): 0x8636FA411113D1b40B5D76F6766D16b3aA829D30
Arg [13] : _beneficiary (address): 0x144C8F91Bc6090AD425BC3e707F0A611534548EF
-----Encoded View---------------
25 Constructor Arguments found :
Arg [0] : 00000000000000000000000000000000000000000000000000000000000001c0
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000200
Arg [2] : 0000000000000000000000003a73033c0b1407574c76bdbac67f126f6b4a9aa9
Arg [3] : 000000000000000000000000000000000000000000000000000000002cb41781
Arg [4] : 000000000000000000000000000000000000000000000000000000003b9aca00
Arg [5] : 000000000000000000000000000000000000000000000000000000003b9aca00
Arg [6] : 0000000000000000000000000000000000000000000000000000000000000240
Arg [7] : 00000000000000000000000000000000000000000000000000000000000002e0
Arg [8] : 00000000000000000000000000000000000000000000000000000000000003e8
Arg [9] : 000000000000000000000000000000000000000000000000120a871cc0020000
Arg [10] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [11] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [12] : 0000000000000000000000008636fa411113d1b40b5d76f6766d16b3aa829d30
Arg [13] : 000000000000000000000000144c8f91bc6090ad425bc3e707f0a611534548ef
Arg [14] : 0000000000000000000000000000000000000000000000000000000000000008
Arg [15] : 4f6d6e6947617773000000000000000000000000000000000000000000000000
Arg [16] : 0000000000000000000000000000000000000000000000000000000000000008
Arg [17] : 4f4d4e4947415753000000000000000000000000000000000000000000000000
Arg [18] : 000000000000000000000000000000000000000000000000000000000000007e
Arg [19] : 68747470733a2f2f74646e34663665366266626e737a63716973677a7a72786a
Arg [20] : 68346e78706934717a6874797479797835687a73786c716f70356b612e617277
Arg [21] : 656176652e6e65742f6d4e76432d4a344a51746c6b5545534e6e4d6270507874
Arg [22] : 336f35444a35346e6a462d6e7a4b36344f6631512f63656c6f2e6a736f6e0000
Arg [23] : 000000000000000000000000000000000000000000000000000000000000000e
Arg [24] : 656d70747948696464656e55524c000000000000000000000000000000000000
Loading...
Loading
Loading...
Loading
Loading...
Loading
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.