ERC-20
Overview
Max Total Supply
10,000 PDN
Holders
24
Market
Onchain Market Cap
$0.00
Circulating Supply Market Cap
-
Other Info
Token Contract (WITH 18 Decimals)
Balance
0.000000000000000368 PDNValue
$0.00Loading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
Contract Source Code Verified (Exact Match)
Contract Name:
PaDNora404
Compiler Version
v0.8.24+commit.e11b9ed9
Contract Source Code (Solidity Multiple files format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "./DN404.sol"; import "./DN404Mirror.sol"; import "./Ownable.sol"; import "./LibString.sol"; import "./SafeTransferLib.sol"; contract PaDNora404 is DN404, Ownable { string private _name; string private _symbol; string private _baseURI; constructor( string memory name_, string memory symbol_, uint96 initialTokenSupply, address initialSupplyOwner ) { _initializeOwner(msg.sender); _name = name_; _symbol = symbol_; address mirror = address(new DN404Mirror(msg.sender)); _initializeDN404(initialTokenSupply, initialSupplyOwner, mirror); } function name() public view override returns (string memory) { return _name; } function symbol() public view override returns (string memory) { return _symbol; } function tokenURI(uint256 tokenId) public view override returns (string memory result) { if (bytes(_baseURI).length != 0) { result = string(abi.encodePacked(_baseURI, LibString.toString(tokenId))); } } // This allows the owner of the contract to mint more tokens. function mint(address to, uint256 amount) public onlyOwner { _mint(to, amount); } function setBaseURI(string calldata baseURI_) public onlyOwner { _baseURI = baseURI_; } function withdraw() public onlyOwner { SafeTransferLib.safeTransferAllETH(msg.sender); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; /// @title DN404 /// @notice DN404 is a hybrid ERC20 and ERC721 implementation that mints /// and burns NFTs based on an account's ERC20 token balance. /// /// @author vectorized.eth (@optimizoor) /// @author Quit (@0xQuit) /// @author Michael Amadi (@AmadiMichaels) /// @author cygaar (@0xCygaar) /// @author Thomas (@0xjustadev) /// @author Harrison (@PopPunkOnChain) /// /// @dev Note: /// - The ERC721 data is stored in this base DN404 contract, however a /// DN404Mirror contract ***MUST*** be deployed and linked during /// initialization. abstract contract DN404 { /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* EVENTS */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ /// @dev Emitted when `amount` tokens is transferred from `from` to `to`. event Transfer(address indexed from, address indexed to, uint256 amount); /// @dev Emitted when `amount` tokens is approved by `owner` to be used by `spender`. event Approval(address indexed owner, address indexed spender, uint256 amount); /// @dev Emitted when `target` sets their skipNFT flag to `status`. event SkipNFTSet(address indexed target, bool status); /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* CUSTOM ERRORS */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ /// @dev Thrown when attempting to double-initialize the contract. error DNAlreadyInitialized(); /// @dev Thrown when attempting to transfer or burn more tokens than sender's balance. error InsufficientBalance(); /// @dev Thrown when a spender attempts to transfer tokens with an insufficient allowance. error InsufficientAllowance(); /// @dev Thrown when minting an amount of tokens that would overflow the max tokens. error TotalSupplyOverflow(); /// @dev Thrown when the caller for a fallback NFT function is not the mirror contract. error SenderNotMirror(); /// @dev Thrown when attempting to transfer tokens to the zero address. error TransferToZeroAddress(); /// @dev Thrown when the mirror address provided for initialization is the zero address. error MirrorAddressIsZero(); /// @dev Thrown when the link call to the mirror contract reverts. error LinkMirrorContractFailed(); /// @dev Thrown when setting an NFT token approval /// and the caller is not the owner or an approved operator. error ApprovalCallerNotOwnerNorApproved(); /// @dev Thrown when transferring an NFT /// and the caller is not the owner or an approved operator. error TransferCallerNotOwnerNorApproved(); /// @dev Thrown when transferring an NFT and the from address is not the current owner. error TransferFromIncorrectOwner(); /// @dev Thrown when checking the owner or approved address for an non-existent NFT. error TokenDoesNotExist(); /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* CONSTANTS */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ /// @dev Amount of token balance that is equal to one NFT. uint256 internal constant _WAD = 10 ** 18; /// @dev The maximum token ID allowed for an NFT. uint256 internal constant _MAX_TOKEN_ID = 0xffffffff; /// @dev The maximum possible token supply. uint256 internal constant _MAX_SUPPLY = 10 ** 18 * 0xffffffff - 1; /// @dev The flag to denote that the address data is initialized. uint8 internal constant _ADDRESS_DATA_INITIALIZED_FLAG = 1 << 0; /// @dev The flag to denote that the address should skip NFTs. uint8 internal constant _ADDRESS_DATA_SKIP_NFT_FLAG = 1 << 1; /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* STORAGE */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ /// @dev Struct containing an address's token data and settings. struct AddressData { // Auxiliary data. uint88 aux; // Flags for `initialized` and `skipNFT`. uint8 flags; // The alias for the address. Zero means absence of an alias. uint32 addressAlias; // The number of NFT tokens. uint32 ownedLength; // The token balance in wei. uint96 balance; } /// @dev A uint32 map in storage. struct Uint32Map { mapping(uint256 => uint256) map; } /// @dev Struct containing the base token contract storage. struct DN404Storage { // Current number of address aliases assigned. uint32 numAliases; // Next token ID to assign for an NFT mint. uint32 nextTokenId; // Total supply of minted NFTs. uint32 totalNFTSupply; // Total supply of tokens. uint96 totalSupply; // Address of the NFT mirror contract. address mirrorERC721; // Mapping of a user alias number to their address. mapping(uint32 => address) aliasToAddress; // Mapping of user operator approvals for NFTs. mapping(address => mapping(address => bool)) operatorApprovals; // Mapping of NFT token approvals to approved operators. mapping(uint256 => address) tokenApprovals; // Mapping of user allowances for token spenders. mapping(address => mapping(address => uint256)) allowance; // Mapping of NFT token IDs owned by an address. mapping(address => Uint32Map) owned; // Even indices: owner aliases. Odd indices: owned indices. Uint32Map oo; // Mapping of user account AddressData mapping(address => AddressData) addressData; } /// @dev Returns a storage pointer for DN404Storage. function _getDN404Storage() internal pure virtual returns (DN404Storage storage $) { /// @solidity memory-safe-assembly assembly { // `uint72(bytes9(keccak256("DN404_STORAGE")))`. $.slot := 0xa20d6e21d0e5255308 // Truncate to 9 bytes to reduce bytecode size. } } /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* INITIALIZER */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ /// @dev Initializes the DN404 contract with an /// `initialTokenSupply`, `initialTokenOwner` and `mirror` NFT contract address. function _initializeDN404( uint256 initialTokenSupply, address initialSupplyOwner, address mirror ) internal virtual { DN404Storage storage $ = _getDN404Storage(); if ($.nextTokenId != 0) revert DNAlreadyInitialized(); if (mirror == address(0)) revert MirrorAddressIsZero(); _linkMirrorContract(mirror); $.nextTokenId = 1; $.mirrorERC721 = mirror; if (initialTokenSupply > 0) { if (initialSupplyOwner == address(0)) revert TransferToZeroAddress(); if (initialTokenSupply > _MAX_SUPPLY) revert TotalSupplyOverflow(); $.totalSupply = uint96(initialTokenSupply); AddressData storage initialOwnerAddressData = _addressData(initialSupplyOwner); initialOwnerAddressData.balance = uint96(initialTokenSupply); emit Transfer(address(0), initialSupplyOwner, initialTokenSupply); _setSkipNFT(initialSupplyOwner, true); } } /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* METADATA FUNCTIONS TO OVERRIDE */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ /// @dev Returns the name of the token. function name() public view virtual returns (string memory); /// @dev Returns the symbol of the token. function symbol() public view virtual returns (string memory); /// @dev Returns the Uniform Resource Identifier (URI) for token `id`. function tokenURI(uint256 id) public view virtual returns (string memory); /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* ERC20 OPERATIONS */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ /// @dev Returns the decimals places of the token. Always 18. function decimals() public pure returns (uint8) { return 18; } /// @dev Returns the amount of tokens in existence. function totalSupply() public view virtual returns (uint256) { return uint256(_getDN404Storage().totalSupply); } /// @dev Returns the amount of tokens owned by `owner`. function balanceOf(address owner) public view virtual returns (uint256) { return _getDN404Storage().addressData[owner].balance; } /// @dev Returns the amount of tokens that `spender` can spend on behalf of `owner`. function allowance(address owner, address spender) public view returns (uint256) { return _getDN404Storage().allowance[owner][spender]; } /// @dev Sets `amount` as the allowance of `spender` over the caller's tokens. /// /// Emits a {Approval} event. function approve(address spender, uint256 amount) public virtual returns (bool) { DN404Storage storage $ = _getDN404Storage(); $.allowance[msg.sender][spender] = amount; emit Approval(msg.sender, spender, amount); return true; } /// @dev Transfer `amount` tokens from the caller to `to`. /// /// Will burn sender NFTs if balance after transfer is less than /// the amount required to support the current NFT balance. /// /// Will mint NFTs to `to` if the recipient's new balance supports /// additional NFTs ***AND*** the `to` address's skipNFT flag is /// set to false. /// /// Requirements: /// - `from` must at least have `amount`. /// /// Emits a {Transfer} event. function transfer(address to, uint256 amount) public virtual returns (bool) { _transfer(msg.sender, to, amount); return true; } /// @dev Transfers `amount` tokens from `from` to `to`. /// /// Note: Does not update the allowance if it is the maximum uint256 value. /// /// Will burn sender NFTs if balance after transfer is less than /// the amount required to support the current NFT balance. /// /// Will mint NFTs to `to` if the recipient's new balance supports /// additional NFTs ***AND*** the `to` address's skipNFT flag is /// set to false. /// /// Requirements: /// - `from` must at least have `amount`. /// - The caller must have at least `amount` of allowance to transfer the tokens of `from`. /// /// Emits a {Transfer} event. function transferFrom(address from, address to, uint256 amount) public virtual returns (bool) { DN404Storage storage $ = _getDN404Storage(); uint256 allowed = $.allowance[from][msg.sender]; if (allowed != type(uint256).max) { if (amount > allowed) revert InsufficientAllowance(); unchecked { $.allowance[from][msg.sender] = allowed - amount; } } _transfer(from, to, amount); return true; } /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* INTERNAL MINT FUNCTIONS */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ /// @dev Mints `amount` tokens to `to`, increasing the total supply. /// /// Will mint NFTs to `to` if the recipient's new balance supports /// additional NFTs ***AND*** the `to` address's skipNFT flag is /// set to false. /// /// Emits a {Transfer} event. function _mint(address to, uint256 amount) internal virtual { if (to == address(0)) revert TransferToZeroAddress(); DN404Storage storage $ = _getDN404Storage(); AddressData storage toAddressData = _addressData(to); unchecked { uint256 currentTokenSupply = uint256($.totalSupply) + amount; if (amount > _MAX_SUPPLY || currentTokenSupply > _MAX_SUPPLY) { revert TotalSupplyOverflow(); } $.totalSupply = uint96(currentTokenSupply); uint256 toBalance = toAddressData.balance + amount; toAddressData.balance = uint96(toBalance); if (toAddressData.flags & _ADDRESS_DATA_SKIP_NFT_FLAG == 0) { Uint32Map storage toOwned = $.owned[to]; uint256 toIndex = toAddressData.ownedLength; uint256 toEnd = toBalance / _WAD; _PackedLogs memory packedLogs = _packedLogsMalloc(_zeroFloorSub(toEnd, toIndex)); if (packedLogs.logs.length != 0) { uint256 maxNFTId = $.totalSupply / _WAD; uint32 toAlias = _registerAndResolveAlias(toAddressData, to); uint256 id = $.nextTokenId; $.totalNFTSupply += uint32(packedLogs.logs.length); toAddressData.ownedLength = uint32(toEnd); // Mint loop. do { while (_get($.oo, _ownershipIndex(id)) != 0) { if (++id > maxNFTId) id = 1; } _set(toOwned, toIndex, uint32(id)); _setOwnerAliasAndOwnedIndex($.oo, id, toAlias, uint32(toIndex++)); _packedLogsAppend(packedLogs, to, id, 0); if (++id > maxNFTId) id = 1; } while (toIndex != toEnd); $.nextTokenId = uint32(id); _packedLogsSend(packedLogs, $.mirrorERC721); } } } emit Transfer(address(0), to, amount); } /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* INTERNAL BURN FUNCTIONS */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ /// @dev Burns `amount` tokens from `from`, reducing the total supply. /// /// Will burn sender NFTs if balance after transfer is less than /// the amount required to support the current NFT balance. /// /// Emits a {Transfer} event. function _burn(address from, uint256 amount) internal virtual { DN404Storage storage $ = _getDN404Storage(); AddressData storage fromAddressData = _addressData(from); uint256 fromBalance = fromAddressData.balance; if (amount > fromBalance) revert InsufficientBalance(); uint256 currentTokenSupply = $.totalSupply; unchecked { fromBalance -= amount; fromAddressData.balance = uint96(fromBalance); currentTokenSupply -= amount; $.totalSupply = uint96(currentTokenSupply); Uint32Map storage fromOwned = $.owned[from]; uint256 fromIndex = fromAddressData.ownedLength; uint256 nftAmountToBurn = _zeroFloorSub(fromIndex, fromBalance / _WAD); if (nftAmountToBurn != 0) { $.totalNFTSupply -= uint32(nftAmountToBurn); _PackedLogs memory packedLogs = _packedLogsMalloc(nftAmountToBurn); uint256 fromEnd = fromIndex - nftAmountToBurn; // Burn loop. do { uint256 id = _get(fromOwned, --fromIndex); _setOwnerAliasAndOwnedIndex($.oo, id, 0, 0); delete $.tokenApprovals[id]; _packedLogsAppend(packedLogs, from, id, 1); } while (fromIndex != fromEnd); fromAddressData.ownedLength = uint32(fromIndex); _packedLogsSend(packedLogs, $.mirrorERC721); } } emit Transfer(from, address(0), amount); } /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* INTERNAL TRANSFER FUNCTIONS */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ /// @dev Moves `amount` of tokens from `from` to `to`. /// /// Will burn sender NFTs if balance after transfer is less than /// the amount required to support the current NFT balance. /// /// Will mint NFTs to `to` if the recipient's new balance supports /// additional NFTs ***AND*** the `to` address's skipNFT flag is /// set to false. /// /// Emits a {Transfer} event. function _transfer(address from, address to, uint256 amount) internal virtual { if (to == address(0)) revert TransferToZeroAddress(); DN404Storage storage $ = _getDN404Storage(); AddressData storage fromAddressData = _addressData(from); AddressData storage toAddressData = _addressData(to); _TransferTemps memory t; t.fromOwnedLength = fromAddressData.ownedLength; t.toOwnedLength = toAddressData.ownedLength; t.fromBalance = fromAddressData.balance; if (amount > t.fromBalance) revert InsufficientBalance(); unchecked { t.fromBalance -= amount; fromAddressData.balance = uint96(t.fromBalance); toAddressData.balance = uint96(t.toBalance = toAddressData.balance + amount); t.nftAmountToBurn = _zeroFloorSub(t.fromOwnedLength, t.fromBalance / _WAD); if (toAddressData.flags & _ADDRESS_DATA_SKIP_NFT_FLAG == 0) { if (from == to) t.toOwnedLength = t.fromOwnedLength - t.nftAmountToBurn; t.nftAmountToMint = _zeroFloorSub(t.toBalance / _WAD, t.toOwnedLength); } _PackedLogs memory packedLogs = _packedLogsMalloc(t.nftAmountToBurn + t.nftAmountToMint); if (t.nftAmountToBurn != 0) { Uint32Map storage fromOwned = $.owned[from]; uint256 fromIndex = t.fromOwnedLength; uint256 fromEnd = fromIndex - t.nftAmountToBurn; $.totalNFTSupply -= uint32(t.nftAmountToBurn); fromAddressData.ownedLength = uint32(fromEnd); // Burn loop. do { uint256 id = _get(fromOwned, --fromIndex); _setOwnerAliasAndOwnedIndex($.oo, id, 0, 0); delete $.tokenApprovals[id]; _packedLogsAppend(packedLogs, from, id, 1); } while (fromIndex != fromEnd); } if (t.nftAmountToMint != 0) { Uint32Map storage toOwned = $.owned[to]; uint256 toIndex = t.toOwnedLength; uint256 toEnd = toIndex + t.nftAmountToMint; uint32 toAlias = _registerAndResolveAlias(toAddressData, to); uint256 maxNFTId = $.totalSupply / _WAD; uint256 id = $.nextTokenId; $.totalNFTSupply += uint32(t.nftAmountToMint); toAddressData.ownedLength = uint32(toEnd); // Mint loop. do { while (_get($.oo, _ownershipIndex(id)) != 0) { if (++id > maxNFTId) id = 1; } _set(toOwned, toIndex, uint32(id)); _setOwnerAliasAndOwnedIndex($.oo, id, toAlias, uint32(toIndex++)); _packedLogsAppend(packedLogs, to, id, 0); if (++id > maxNFTId) id = 1; } while (toIndex != toEnd); $.nextTokenId = uint32(id); } if (packedLogs.logs.length != 0) { _packedLogsSend(packedLogs, $.mirrorERC721); } } emit Transfer(from, to, amount); } /// @dev Transfers token `id` from `from` to `to`. /// /// Requirements: /// /// - Call must originate from the mirror contract. /// - Token `id` must exist. /// - `from` must be the owner of the token. /// - `to` cannot be the zero address. /// `msgSender` must be the owner of the token, or be approved to manage the token. /// /// Emits a {Transfer} event. function _transferFromNFT(address from, address to, uint256 id, address msgSender) internal virtual { DN404Storage storage $ = _getDN404Storage(); if (to == address(0)) revert TransferToZeroAddress(); address owner = $.aliasToAddress[_get($.oo, _ownershipIndex(id))]; if (from != owner) revert TransferFromIncorrectOwner(); if (msgSender != from) { if (!$.operatorApprovals[from][msgSender]) { if (msgSender != $.tokenApprovals[id]) { revert TransferCallerNotOwnerNorApproved(); } } } AddressData storage fromAddressData = _addressData(from); AddressData storage toAddressData = _addressData(to); fromAddressData.balance -= uint96(_WAD); unchecked { toAddressData.balance += uint96(_WAD); _set($.oo, _ownershipIndex(id), _registerAndResolveAlias(toAddressData, to)); delete $.tokenApprovals[id]; uint256 updatedId = _get($.owned[from], --fromAddressData.ownedLength); _set($.owned[from], _get($.oo, _ownedIndex(id)), uint32(updatedId)); uint256 n = toAddressData.ownedLength++; _set($.oo, _ownedIndex(updatedId), _get($.oo, _ownedIndex(id))); _set($.owned[to], n, uint32(id)); _set($.oo, _ownedIndex(id), uint32(n)); } emit Transfer(from, to, _WAD); } /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* DATA HITCHHIKING FUNCTIONS */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ /// @dev Returns the auxiliary data for `owner`. /// Minting, transferring, burning the tokens of `owner` will not change the auxiliary data. /// Auxiliary data can be set for any address, even if it does not have any tokens. function _getAux(address owner) internal view virtual returns (uint88) { return _getDN404Storage().addressData[owner].aux; } /// @dev Set the auxiliary data for `owner` to `value`. /// Minting, transferring, burning the tokens of `owner` will not change the auxiliary data. /// Auxiliary data can be set for any address, even if it does not have any tokens. function _setAux(address owner, uint88 value) internal virtual { _getDN404Storage().addressData[owner].aux = value; } /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* SKIP NFT FUNCTIONS */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ /// @dev Returns true if account `a` will skip NFT minting on token mints and transfers. /// Returns false if account `a` will mint NFTs on token mints and transfers. function getSkipNFT(address a) public view virtual returns (bool) { AddressData storage d = _getDN404Storage().addressData[a]; if (d.flags & _ADDRESS_DATA_INITIALIZED_FLAG == 0) return _hasCode(a); return d.flags & _ADDRESS_DATA_SKIP_NFT_FLAG != 0; } /// @dev Sets the caller's skipNFT flag to `skipNFT` /// /// Emits a {SkipNFTSet} event. function setSkipNFT(bool skipNFT) public virtual { _setSkipNFT(msg.sender, skipNFT); } /// @dev Internal function to set account `a` skipNFT flag to `state` /// /// Initializes account `a` AddressData if it is not currently initialized. /// /// Emits a {SkipNFTSet} event. function _setSkipNFT(address a, bool state) internal virtual { AddressData storage d = _addressData(a); if ((d.flags & _ADDRESS_DATA_SKIP_NFT_FLAG != 0) != state) { d.flags ^= _ADDRESS_DATA_SKIP_NFT_FLAG; } emit SkipNFTSet(a, state); } /// @dev Returns a storage data pointer for account `a` AddressData /// /// Initializes account `a` AddressData if it is not currently initialized. function _addressData(address a) internal virtual returns (AddressData storage d) { DN404Storage storage $ = _getDN404Storage(); d = $.addressData[a]; if (d.flags & _ADDRESS_DATA_INITIALIZED_FLAG == 0) { uint8 flags = _ADDRESS_DATA_INITIALIZED_FLAG; if (_hasCode(a)) flags |= _ADDRESS_DATA_SKIP_NFT_FLAG; d.flags = flags; } } /// @dev Returns the `addressAlias` of account `to`. /// /// Assigns and registers the next alias if `to` alias was not previously registered. function _registerAndResolveAlias(AddressData storage toAddressData, address to) internal virtual returns (uint32 addressAlias) { DN404Storage storage $ = _getDN404Storage(); addressAlias = toAddressData.addressAlias; if (addressAlias == 0) { addressAlias = ++$.numAliases; toAddressData.addressAlias = addressAlias; $.aliasToAddress[addressAlias] = to; } } /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* MIRROR OPERATIONS */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ /// @dev Returns the address of the mirror NFT contract. function mirrorERC721() public view virtual returns (address) { return _getDN404Storage().mirrorERC721; } /// @dev Returns the total NFT supply. function _totalNFTSupply() internal view virtual returns (uint256) { return _getDN404Storage().totalNFTSupply; } /// @dev Returns `owner` NFT balance. function _balanceOfNFT(address owner) internal view virtual returns (uint256) { return _getDN404Storage().addressData[owner].ownedLength; } /// @dev Returns the owner of token `id`. /// Returns the zero address instead of reverting if the token does not exist. function _ownerAt(uint256 id) internal view virtual returns (address) { DN404Storage storage $ = _getDN404Storage(); return $.aliasToAddress[_get($.oo, _ownershipIndex(id))]; } /// @dev Returns the owner of token `id`. /// /// Requirements: /// - Token `id` must exist. function _ownerOf(uint256 id) internal view virtual returns (address) { if (!_exists(id)) revert TokenDoesNotExist(); return _ownerAt(id); } /// @dev Returns if token `id` exists. function _exists(uint256 id) internal view virtual returns (bool) { return _ownerAt(id) != address(0); } /// @dev Returns the account approved to manage token `id`. /// /// Requirements: /// - Token `id` must exist. function _getApproved(uint256 id) internal view virtual returns (address) { if (!_exists(id)) revert TokenDoesNotExist(); return _getDN404Storage().tokenApprovals[id]; } /// @dev Sets `spender` as the approved account to manage token `id`, using `msgSender`. /// /// Requirements: /// - `msgSender` must be the owner or an approved operator for the token owner. function _approveNFT(address spender, uint256 id, address msgSender) internal virtual returns (address) { DN404Storage storage $ = _getDN404Storage(); address owner = $.aliasToAddress[_get($.oo, _ownershipIndex(id))]; if (msgSender != owner) { if (!$.operatorApprovals[owner][msgSender]) { revert ApprovalCallerNotOwnerNorApproved(); } } $.tokenApprovals[id] = spender; return owner; } /// @dev Approve or remove the `operator` as an operator for `msgSender`, /// without authorization checks. function _setApprovalForAll(address operator, bool approved, address msgSender) internal virtual { _getDN404Storage().operatorApprovals[msgSender][operator] = approved; } /// @dev Calls the mirror contract to link it to this contract. /// /// Reverts if the call to the mirror contract reverts. function _linkMirrorContract(address mirror) internal virtual { /// @solidity memory-safe-assembly assembly { mstore(0x00, 0x0f4599e5) // `linkMirrorContract(address)`. mstore(0x20, caller()) if iszero(and(eq(mload(0x00), 1), call(gas(), mirror, 0, 0x1c, 0x24, 0x00, 0x20))) { mstore(0x00, 0xd125259c) // `LinkMirrorContractFailed()`. revert(0x1c, 0x04) } } } /// @dev Fallback modifier to dispatch calls from the mirror NFT contract /// to internal functions in this contract. modifier dn404Fallback() virtual { DN404Storage storage $ = _getDN404Storage(); uint256 fnSelector = _calldataload(0x00) >> 224; // `isApprovedForAll(address,address)`. if (fnSelector == 0xe985e9c5) { if (msg.sender != $.mirrorERC721) revert SenderNotMirror(); if (msg.data.length < 0x44) revert(); address owner = address(uint160(_calldataload(0x04))); address operator = address(uint160(_calldataload(0x24))); _return($.operatorApprovals[owner][operator] ? 1 : 0); } // `ownerOf(uint256)`. if (fnSelector == 0x6352211e) { if (msg.sender != $.mirrorERC721) revert SenderNotMirror(); if (msg.data.length < 0x24) revert(); uint256 id = _calldataload(0x04); _return(uint160(_ownerOf(id))); } // `transferFromNFT(address,address,uint256,address)`. if (fnSelector == 0xe5eb36c8) { if (msg.sender != $.mirrorERC721) revert SenderNotMirror(); if (msg.data.length < 0x84) revert(); address from = address(uint160(_calldataload(0x04))); address to = address(uint160(_calldataload(0x24))); uint256 id = _calldataload(0x44); address msgSender = address(uint160(_calldataload(0x64))); _transferFromNFT(from, to, id, msgSender); _return(1); } // `setApprovalForAll(address,bool,address)`. if (fnSelector == 0x813500fc) { if (msg.sender != $.mirrorERC721) revert SenderNotMirror(); if (msg.data.length < 0x64) revert(); address spender = address(uint160(_calldataload(0x04))); bool status = _calldataload(0x24) != 0; address msgSender = address(uint160(_calldataload(0x44))); _setApprovalForAll(spender, status, msgSender); _return(1); } // `approveNFT(address,uint256,address)`. if (fnSelector == 0xd10b6e0c) { if (msg.sender != $.mirrorERC721) revert SenderNotMirror(); if (msg.data.length < 0x64) revert(); address spender = address(uint160(_calldataload(0x04))); uint256 id = _calldataload(0x24); address msgSender = address(uint160(_calldataload(0x44))); _return(uint160(_approveNFT(spender, id, msgSender))); } // `getApproved(uint256)`. if (fnSelector == 0x081812fc) { if (msg.sender != $.mirrorERC721) revert SenderNotMirror(); if (msg.data.length < 0x24) revert(); uint256 id = _calldataload(0x04); _return(uint160(_getApproved(id))); } // `balanceOfNFT(address)`. if (fnSelector == 0xf5b100ea) { if (msg.sender != $.mirrorERC721) revert SenderNotMirror(); if (msg.data.length < 0x24) revert(); address owner = address(uint160(_calldataload(0x04))); _return(_balanceOfNFT(owner)); } // `totalNFTSupply()`. if (fnSelector == 0xe2c79281) { if (msg.sender != $.mirrorERC721) revert SenderNotMirror(); if (msg.data.length < 0x04) revert(); _return(_totalNFTSupply()); } // `implementsDN404()`. if (fnSelector == 0xb7a94eb8) { _return(1); } _; } /// @dev Fallback function for calls from mirror NFT contract. fallback() external payable virtual dn404Fallback {} receive() external payable virtual {} /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* PRIVATE HELPERS */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ /// @dev Struct containing packed log data for `Transfer` events to be /// emitted by the mirror NFT contract. struct _PackedLogs { uint256[] logs; uint256 offset; } /// @dev Initiates memory allocation for packed logs with `n` log items. function _packedLogsMalloc(uint256 n) private pure returns (_PackedLogs memory p) { /// @solidity memory-safe-assembly assembly { let logs := add(mload(0x40), 0x40) // Offset by 2 words for `_packedLogsSend`. mstore(logs, n) let offset := add(0x20, logs) mstore(0x40, add(offset, shl(5, n))) mstore(p, logs) mstore(add(0x20, p), offset) } } /// @dev Adds a packed log item to `p` with address `a`, token `id` and burn flag `burnBit`. function _packedLogsAppend(_PackedLogs memory p, address a, uint256 id, uint256 burnBit) private pure { /// @solidity memory-safe-assembly assembly { let offset := mload(add(0x20, p)) mstore(offset, or(or(shl(96, a), shl(8, id)), burnBit)) mstore(add(0x20, p), add(offset, 0x20)) } } /// @dev Calls the `mirror` NFT contract to emit Transfer events for packed logs `p`. function _packedLogsSend(_PackedLogs memory p, address mirror) private { /// @solidity memory-safe-assembly assembly { let logs := mload(p) let o := sub(logs, 0x40) // Start of calldata to send. mstore(o, 0x263c69d6) // `logTransfer(uint256[])`. mstore(add(o, 0x20), 0x20) // Offset of `logs` in the calldata to send. let n := add(0x44, shl(5, mload(logs))) // Length of calldata to send. if iszero(and(eq(mload(o), 1), call(gas(), mirror, 0, add(o, 0x1c), n, o, 0x20))) { revert(o, 0x00) } } } /// @dev Struct of temporary variables for transfers. struct _TransferTemps { uint256 nftAmountToBurn; uint256 nftAmountToMint; uint256 fromBalance; uint256 toBalance; uint256 fromOwnedLength; uint256 toOwnedLength; } /// @dev Returns if `a` has bytecode of non-zero length. function _hasCode(address a) private view returns (bool result) { /// @solidity memory-safe-assembly assembly { result := extcodesize(a) // Can handle dirty upper bits. } } /// @dev Returns the calldata value at `offset`. function _calldataload(uint256 offset) private pure returns (uint256 value) { /// @solidity memory-safe-assembly assembly { value := calldataload(offset) } } /// @dev Executes a return opcode to return `x` and end the current call frame. function _return(uint256 x) private pure { /// @solidity memory-safe-assembly assembly { mstore(0x00, x) return(0x00, 0x20) } } /// @dev Returns `max(0, x - y)`. function _zeroFloorSub(uint256 x, uint256 y) private pure returns (uint256 z) { /// @solidity memory-safe-assembly assembly { z := mul(gt(x, y), sub(x, y)) } } /// @dev Returns `i << 1`. function _ownershipIndex(uint256 i) private pure returns (uint256) { return i << 1; } /// @dev Returns `(i << 1) + 1`. function _ownedIndex(uint256 i) private pure returns (uint256) { unchecked { return (i << 1) + 1; } } /// @dev Returns the uint32 value at `index` in `map`. function _get(Uint32Map storage map, uint256 index) private view returns (uint32 result) { result = uint32(map.map[index >> 3] >> ((index & 7) << 5)); } /// @dev Updates the uint32 value at `index` in `map`. function _set(Uint32Map storage map, uint256 index, uint32 value) private { /// @solidity memory-safe-assembly assembly { mstore(0x20, map.slot) mstore(0x00, shr(3, index)) let s := keccak256(0x00, 0x40) // Storage slot. let o := shl(5, and(index, 7)) // Storage slot offset (bits). let v := sload(s) // Storage slot value. let m := 0xffffffff // Value mask. sstore(s, xor(v, shl(o, and(m, xor(shr(o, v), value))))) } } /// @dev Sets the owner alias and the owned index together. function _setOwnerAliasAndOwnedIndex( Uint32Map storage map, uint256 id, uint32 ownership, uint32 ownedIndex ) private { /// @solidity memory-safe-assembly assembly { let value := or(shl(32, ownedIndex), and(0xffffffff, ownership)) mstore(0x20, map.slot) mstore(0x00, shr(2, id)) let s := keccak256(0x00, 0x40) // Storage slot. let o := shl(6, and(id, 3)) // Storage slot offset (bits). let v := sload(s) // Storage slot value. let m := 0xffffffffffffffff // Value mask. sstore(s, xor(v, shl(o, and(m, xor(shr(o, v), value))))) } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; /// @title DN404Mirror /// @notice DN404Mirror provides an interface for interacting with the /// NFT tokens in a DN404 implementation. /// /// @author vectorized.eth (@optimizoor) /// @author Quit (@0xQuit) /// @author Michael Amadi (@AmadiMichaels) /// @author cygaar (@0xCygaar) /// @author Thomas (@0xjustadev) /// @author Harrison (@PopPunkOnChain) /// /// @dev Note: /// - The ERC721 data is stored in the base DN404 contract. contract DN404Mirror { /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* EVENTS */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ /// @dev Emitted when token `id` is transferred from `from` to `to`. event Transfer(address indexed from, address indexed to, uint256 indexed id); /// @dev Emitted when `owner` enables `account` to manage the `id` token. event Approval(address indexed owner, address indexed account, uint256 indexed id); /// @dev Emitted when `owner` enables or disables `operator` to manage all of their tokens. event ApprovalForAll(address indexed owner, address indexed operator, bool isApproved); /// @dev `keccak256(bytes("Transfer(address,address,uint256)"))`. uint256 private constant _TRANSFER_EVENT_SIGNATURE = 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef; /// @dev `keccak256(bytes("Approval(address,address,uint256)"))`. uint256 private constant _APPROVAL_EVENT_SIGNATURE = 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925; /// @dev `keccak256(bytes("ApprovalForAll(address,address,bool)"))`. uint256 private constant _APPROVAL_FOR_ALL_EVENT_SIGNATURE = 0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31; /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* CUSTOM ERRORS */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ /// @dev Thrown when a call for an NFT function did not originate /// from the base DN404 contract. error SenderNotBase(); /// @dev Thrown when a call for an NFT function did not originate from the deployer. error SenderNotDeployer(); /// @dev Thrown when transferring an NFT to a contract address that /// does not implement ERC721Receiver. error TransferToNonERC721ReceiverImplementer(); /// @dev Thrown when linking to the DN404 base contract and the /// DN404 supportsInterface check fails or the call reverts. error CannotLink(); /// @dev Thrown when a linkMirrorContract call is received and the /// NFT mirror contract has already been linked to a DN404 base contract. error AlreadyLinked(); /// @dev Thrown when retrieving the base DN404 address when a link has not /// been established. error NotLinked(); /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* STORAGE */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ /// @dev Struct contain the NFT mirror contract storage. struct DN404NFTStorage { address baseERC20; address deployer; } /// @dev Returns a storage pointer for DN404NFTStorage. function _getDN404NFTStorage() internal pure virtual returns (DN404NFTStorage storage $) { /// @solidity memory-safe-assembly assembly { // `uint72(bytes9(keccak256("DN404_MIRROR_STORAGE")))`. $.slot := 0x3602298b8c10b01230 // Truncate to 9 bytes to reduce bytecode size. } } /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* CONSTRUCTOR */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ constructor(address deployer) { // For non-proxies, we will store the deployer so that only the deployer can // link the base contract. _getDN404NFTStorage().deployer = deployer; } /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* ERC721 OPERATIONS */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ /// @dev Returns the token collection name from the base DN404 contract. function name() public view virtual returns (string memory result) { address base = baseERC20(); /// @solidity memory-safe-assembly assembly { result := mload(0x40) mstore(0x00, 0x06fdde03) // `name()`. if iszero(staticcall(gas(), base, 0x1c, 0x04, 0x00, 0x00)) { returndatacopy(result, 0x00, returndatasize()) revert(result, returndatasize()) } returndatacopy(0x00, 0x00, 0x20) returndatacopy(result, mload(0x00), 0x20) returndatacopy(add(result, 0x20), add(mload(0x00), 0x20), mload(result)) mstore(0x40, add(add(result, 0x20), mload(result))) } } /// @dev Returns the token collection symbol from the base DN404 contract. function symbol() public view virtual returns (string memory result) { address base = baseERC20(); /// @solidity memory-safe-assembly assembly { result := mload(0x40) mstore(0x00, 0x95d89b41) // `symbol()`. if iszero(staticcall(gas(), base, 0x1c, 0x04, 0x00, 0x00)) { returndatacopy(result, 0x00, returndatasize()) revert(result, returndatasize()) } returndatacopy(0x00, 0x00, 0x20) returndatacopy(result, mload(0x00), 0x20) returndatacopy(add(result, 0x20), add(mload(0x00), 0x20), mload(result)) mstore(0x40, add(add(result, 0x20), mload(result))) } } /// @dev Returns the Uniform Resource Identifier (URI) for token `id` from /// the base DN404 contract. function tokenURI(uint256 id) public view virtual returns (string memory result) { address base = baseERC20(); /// @solidity memory-safe-assembly assembly { result := mload(0x40) mstore(0x20, id) mstore(0x00, 0xc87b56dd) // `tokenURI()`. if iszero(staticcall(gas(), base, 0x1c, 0x24, 0x00, 0x00)) { returndatacopy(result, 0x00, returndatasize()) revert(result, returndatasize()) } returndatacopy(0x00, 0x00, 0x20) returndatacopy(result, mload(0x00), 0x20) returndatacopy(add(result, 0x20), add(mload(0x00), 0x20), mload(result)) mstore(0x40, add(add(result, 0x20), mload(result))) } } /// @dev Returns the total NFT supply from the base DN404 contract. function totalSupply() public view virtual returns (uint256 result) { address base = baseERC20(); /// @solidity memory-safe-assembly assembly { mstore(0x00, 0xe2c79281) // `totalNFTSupply()`. if iszero( and(gt(returndatasize(), 0x1f), staticcall(gas(), base, 0x1c, 0x04, 0x00, 0x20)) ) { returndatacopy(mload(0x40), 0x00, returndatasize()) revert(mload(0x40), returndatasize()) } result := mload(0x00) } } /// @dev Returns the number of NFT tokens owned by `owner` from the base DN404 contract. /// /// Requirements: /// - `owner` must not be the zero address. function balanceOf(address owner) public view virtual returns (uint256 result) { address base = baseERC20(); /// @solidity memory-safe-assembly assembly { mstore(0x20, shr(96, shl(96, owner))) mstore(0x00, 0xf5b100ea) // `balanceOfNFT(address)`. if iszero( and(gt(returndatasize(), 0x1f), staticcall(gas(), base, 0x1c, 0x24, 0x00, 0x20)) ) { returndatacopy(mload(0x40), 0x00, returndatasize()) revert(mload(0x40), returndatasize()) } result := mload(0x00) } } /// @dev Returns the owner of token `id` from the base DN404 contract. /// /// Requirements: /// - Token `id` must exist. function ownerOf(uint256 id) public view virtual returns (address result) { address base = baseERC20(); /// @solidity memory-safe-assembly assembly { mstore(0x00, 0x6352211e) // `ownerOf(uint256)`. mstore(0x20, id) if iszero( and(gt(returndatasize(), 0x1f), staticcall(gas(), base, 0x1c, 0x24, 0x00, 0x20)) ) { returndatacopy(mload(0x40), 0x00, returndatasize()) revert(mload(0x40), returndatasize()) } result := shr(96, mload(0x0c)) } } /// @dev Sets `spender` as the approved account to manage token `id` in /// the base DN404 contract. /// /// Requirements: /// - Token `id` must exist. /// - The caller must be the owner of the token, /// or an approved operator for the token owner. /// /// Emits an {Approval} event. function approve(address spender, uint256 id) public virtual { address base = baseERC20(); /// @solidity memory-safe-assembly assembly { spender := shr(96, shl(96, spender)) let m := mload(0x40) mstore(0x00, 0xd10b6e0c) // `approveNFT(address,uint256,address)`. mstore(0x20, spender) mstore(0x40, id) mstore(0x60, caller()) if iszero( and( gt(returndatasize(), 0x1f), call(gas(), base, callvalue(), 0x1c, 0x64, 0x00, 0x20) ) ) { returndatacopy(m, 0x00, returndatasize()) revert(m, returndatasize()) } mstore(0x40, m) // Restore the free memory pointer. mstore(0x60, 0) // Restore the zero pointer. // Emit the {Approval} event. log4(codesize(), 0x00, _APPROVAL_EVENT_SIGNATURE, shr(96, mload(0x0c)), spender, id) } } /// @dev Returns the account approved to manage token `id` from /// the base DN404 contract. /// /// Requirements: /// - Token `id` must exist. function getApproved(uint256 id) public view virtual returns (address result) { address base = baseERC20(); /// @solidity memory-safe-assembly assembly { mstore(0x00, 0x081812fc) // `getApproved(uint256)`. mstore(0x20, id) if iszero( and(gt(returndatasize(), 0x1f), staticcall(gas(), base, 0x1c, 0x24, 0x00, 0x20)) ) { returndatacopy(mload(0x40), 0x00, returndatasize()) revert(mload(0x40), returndatasize()) } result := shr(96, mload(0x0c)) } } /// @dev Sets whether `operator` is approved to manage the tokens of the caller in /// the base DN404 contract. /// /// Emits an {ApprovalForAll} event. function setApprovalForAll(address operator, bool approved) public virtual { address base = baseERC20(); /// @solidity memory-safe-assembly assembly { operator := shr(96, shl(96, operator)) let m := mload(0x40) mstore(0x00, 0x813500fc) // `setApprovalForAll(address,bool,address)`. mstore(0x20, operator) mstore(0x40, iszero(iszero(approved))) mstore(0x60, caller()) if iszero( and(eq(mload(0x00), 1), call(gas(), base, callvalue(), 0x1c, 0x64, 0x00, 0x20)) ) { returndatacopy(m, 0x00, returndatasize()) revert(m, returndatasize()) } // Emit the {ApprovalForAll} event. log3(0x40, 0x20, _APPROVAL_FOR_ALL_EVENT_SIGNATURE, caller(), operator) mstore(0x40, m) // Restore the free memory pointer. mstore(0x60, 0) // Restore the zero pointer. } } /// @dev Returns whether `operator` is approved to manage the tokens of `owner` from /// the base DN404 contract. function isApprovedForAll(address owner, address operator) public view virtual returns (bool result) { address base = baseERC20(); /// @solidity memory-safe-assembly assembly { let m := mload(0x40) mstore(0x40, operator) mstore(0x2c, shl(96, owner)) mstore(0x0c, 0xe985e9c5000000000000000000000000) // `isApprovedForAll(address,address)`. if iszero( and(gt(returndatasize(), 0x1f), staticcall(gas(), base, 0x1c, 0x44, 0x00, 0x20)) ) { returndatacopy(m, 0x00, returndatasize()) revert(m, returndatasize()) } mstore(0x40, m) // Restore the free memory pointer. result := iszero(iszero(mload(0x00))) } } /// @dev Transfers token `id` from `from` to `to`. /// /// Requirements: /// /// - Token `id` must exist. /// - `from` must be the owner of the token. /// - `to` cannot be the zero address. /// - The caller must be the owner of the token, or be approved to manage the token. /// /// Emits a {Transfer} event. function transferFrom(address from, address to, uint256 id) public virtual { address base = baseERC20(); /// @solidity memory-safe-assembly assembly { from := shr(96, shl(96, from)) to := shr(96, shl(96, to)) let m := mload(0x40) mstore(m, 0xe5eb36c8) // `transferFromNFT(address,address,uint256,address)`. mstore(add(m, 0x20), from) mstore(add(m, 0x40), to) mstore(add(m, 0x60), id) mstore(add(m, 0x80), caller()) if iszero( and(eq(mload(m), 1), call(gas(), base, callvalue(), add(m, 0x1c), 0x84, m, 0x20)) ) { returndatacopy(m, 0x00, returndatasize()) revert(m, returndatasize()) } // Emit the {Transfer} event. log4(codesize(), 0x00, _TRANSFER_EVENT_SIGNATURE, from, to, id) } } /// @dev Equivalent to `safeTransferFrom(from, to, id, "")`. function safeTransferFrom(address from, address to, uint256 id) public payable virtual { transferFrom(from, to, id); if (_hasCode(to)) _checkOnERC721Received(from, to, id, ""); } /// @dev Transfers token `id` from `from` to `to`. /// /// Requirements: /// /// - Token `id` must exist. /// - `from` must be the owner of the token. /// - `to` cannot be the zero address. /// - The caller must be the owner of the token, or be approved to manage the token. /// - 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 id, bytes calldata data) public virtual { transferFrom(from, to, id); if (_hasCode(to)) _checkOnERC721Received(from, to, id, data); } /// @dev Returns true if this contract implements the interface defined by `interfaceId`. /// See: https://eips.ethereum.org/EIPS/eip-165 /// This function call must use less than 30000 gas. function supportsInterface(bytes4 interfaceId) public view virtual returns (bool result) { /// @solidity memory-safe-assembly assembly { let s := shr(224, interfaceId) // ERC165: 0x01ffc9a7, ERC721: 0x80ac58cd, ERC721Metadata: 0x5b5e139f. result := or(or(eq(s, 0x01ffc9a7), eq(s, 0x80ac58cd)), eq(s, 0x5b5e139f)) } } /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* MIRROR OPERATIONS */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ /// @dev Returns the address of the base DN404 contract. function baseERC20() public view virtual returns (address base) { base = _getDN404NFTStorage().baseERC20; if (base == address(0)) revert NotLinked(); } /// @dev Fallback modifier to execute calls from the base DN404 contract. modifier dn404NFTFallback() virtual { DN404NFTStorage storage $ = _getDN404NFTStorage(); uint256 fnSelector = _calldataload(0x00) >> 224; // `logTransfer(uint256[])`. if (fnSelector == 0x263c69d6) { if (msg.sender != $.baseERC20) revert SenderNotBase(); /// @solidity memory-safe-assembly assembly { // When returndatacopy copies 1 or more out-of-bounds bytes, it reverts. returndatacopy(0x00, returndatasize(), lt(calldatasize(), 0x20)) let o := add(0x24, calldataload(0x04)) // Packed logs offset. returndatacopy(0x00, returndatasize(), lt(calldatasize(), o)) let end := add(o, shl(5, calldataload(sub(o, 0x20)))) returndatacopy(0x00, returndatasize(), lt(calldatasize(), end)) for {} iszero(eq(o, end)) { o := add(0x20, o) } { let d := calldataload(o) // Entry in the packed logs. let a := shr(96, d) // The address. let b := and(1, d) // Whether it is a burn. log4( codesize(), 0x00, _TRANSFER_EVENT_SIGNATURE, mul(a, b), mul(a, iszero(b)), shr(168, shl(160, d)) ) } mstore(0x00, 0x01) return(0x00, 0x20) } } // `linkMirrorContract(address)`. if (fnSelector == 0x0f4599e5) { if ($.deployer != address(0)) { if (address(uint160(_calldataload(0x04))) != $.deployer) { revert SenderNotDeployer(); } } if ($.baseERC20 != address(0)) revert AlreadyLinked(); $.baseERC20 = msg.sender; /// @solidity memory-safe-assembly assembly { mstore(0x00, 0x01) return(0x00, 0x20) } } _; } /// @dev Fallback function for calls from base DN404 contract. fallback() external payable virtual dn404NFTFallback {} receive() external payable virtual {} /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* PRIVATE HELPERS */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ /// @dev Returns the calldata value at `offset`. function _calldataload(uint256 offset) private pure returns (uint256 value) { /// @solidity memory-safe-assembly assembly { value := calldataload(offset) } } /// @dev Returns if `a` has bytecode of non-zero length. function _hasCode(address a) private view returns (bool result) { /// @solidity memory-safe-assembly assembly { result := extcodesize(a) // Can handle dirty upper bits. } } /// @dev Perform a call to invoke {IERC721Receiver-onERC721Received} on `to`. /// Reverts if the target does not support the function correctly. function _checkOnERC721Received(address from, address to, uint256 id, bytes memory data) private { /// @solidity memory-safe-assembly assembly { // Prepare the calldata. let m := mload(0x40) let onERC721ReceivedSelector := 0x150b7a02 mstore(m, onERC721ReceivedSelector) mstore(add(m, 0x20), caller()) // The `operator`, which is always `msg.sender`. mstore(add(m, 0x40), shr(96, shl(96, from))) mstore(add(m, 0x60), id) mstore(add(m, 0x80), 0x80) let n := mload(data) mstore(add(m, 0xa0), n) if n { pop(staticcall(gas(), 4, add(data, 0x20), n, add(m, 0xc0), n)) } // Revert if the call reverts. if iszero(call(gas(), to, 0, add(m, 0x1c), add(n, 0xa4), m, 0x20)) { if returndatasize() { // Bubble up the revert if the call reverts. returndatacopy(m, 0x00, returndatasize()) revert(m, returndatasize()) } } // Load the returndata and compare it. if iszero(eq(mload(m), shl(224, onERC721ReceivedSelector))) { mstore(0x00, 0xd1a57ed6) // `TransferToNonERC721ReceiverImplementer()`. revert(0x1c, 0x04) } } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; /// @notice Library for converting numbers into strings and other string operations. /// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/LibString.sol) /// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/LibString.sol) /// /// @dev Note: /// For performance and bytecode compactness, most of the string operations are restricted to /// byte strings (7-bit ASCII), except where otherwise specified. /// Usage of byte string operations on charsets with runes spanning two or more bytes /// can lead to undefined behavior. library LibString { /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* CUSTOM ERRORS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The length of the output is too small to contain all the hex digits. error HexLengthInsufficient(); /// @dev The length of the string is more than 32 bytes. error TooBigForSmallString(); /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* CONSTANTS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The constant returned when the `search` is not found in the string. uint256 internal constant NOT_FOUND = type(uint256).max; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* DECIMAL OPERATIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Returns the base 10 decimal representation of `value`. function toString(uint256 value) internal pure returns (string memory str) { /// @solidity memory-safe-assembly 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. str := add(mload(0x40), 0x80) // Update the free memory pointer to allocate. mstore(0x40, add(str, 0x20)) // Zeroize the slot after the string. mstore(str, 0) // Cache the end of the memory to calculate the length later. let end := str let w := not(0) // Tsk. // We write the string from rightmost digit to leftmost digit. // The following is essentially a do-while loop that also handles the zero case. for { let temp := value } 1 {} { str := add(str, w) // `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) 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 Returns the base 10 decimal representation of `value`. function toString(int256 value) internal pure returns (string memory str) { if (value >= 0) { return toString(uint256(value)); } unchecked { str = toString(~uint256(value) + 1); } /// @solidity memory-safe-assembly assembly { // We still have some spare memory space on the left, // as we have allocated 3 words (96 bytes) for up to 78 digits. let length := mload(str) // Load the string length. mstore(str, 0x2d) // Store the '-' character. str := sub(str, 1) // Move back the string pointer by a byte. mstore(str, add(length, 1)) // Update the string length. } } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* HEXADECIMAL OPERATIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Returns the hexadecimal representation of `value`, /// left-padded to an input length of `length` bytes. /// The output is prefixed with "0x" encoded using 2 hexadecimal digits per byte, /// giving a total length of `length * 2 + 2` bytes. /// Reverts if `length` is too small for the output to contain all the digits. function toHexString(uint256 value, uint256 length) internal pure returns (string memory str) { str = toHexStringNoPrefix(value, length); /// @solidity memory-safe-assembly assembly { let strLength := add(mload(str), 2) // Compute the length. mstore(str, 0x3078) // Write the "0x" prefix. str := sub(str, 2) // Move the pointer. mstore(str, strLength) // Write the length. } } /// @dev Returns the hexadecimal representation of `value`, /// left-padded to an input length of `length` bytes. /// The output is prefixed with "0x" encoded using 2 hexadecimal digits per byte, /// giving a total length of `length * 2` bytes. /// Reverts if `length` is too small for the output to contain all the digits. function toHexStringNoPrefix(uint256 value, uint256 length) internal pure returns (string memory str) { /// @solidity memory-safe-assembly assembly { // We need 0x20 bytes for the trailing zeros padding, `length * 2` bytes // for the digits, 0x02 bytes for the prefix, and 0x20 bytes for the length. // We add 0x20 to the total and round down to a multiple of 0x20. // (0x20 + 0x20 + 0x02 + 0x20) = 0x62. str := add(mload(0x40), and(add(shl(1, length), 0x42), not(0x1f))) // Allocate the memory. mstore(0x40, add(str, 0x20)) // Zeroize the slot after the string. mstore(str, 0) // Cache the end to calculate the length later. let end := str // Store "0123456789abcdef" in scratch space. mstore(0x0f, 0x30313233343536373839616263646566) let start := sub(str, add(length, length)) let w := not(1) // Tsk. let temp := value // We write the string from rightmost digit to leftmost digit. // The following is essentially a do-while loop that also handles the zero case. for {} 1 {} { str := add(str, w) // `sub(str, 2)`. mstore8(add(str, 1), mload(and(temp, 15))) mstore8(str, mload(and(shr(4, temp), 15))) temp := shr(8, temp) if iszero(xor(str, start)) { break } } if temp { mstore(0x00, 0x2194895a) // `HexLengthInsufficient()`. revert(0x1c, 0x04) } // Compute the string's length. let strLength := sub(end, str) // Move the pointer and write the length. str := sub(str, 0x20) mstore(str, strLength) } } /// @dev Returns the hexadecimal representation of `value`. /// The output is prefixed with "0x" and encoded using 2 hexadecimal digits per byte. /// As address are 20 bytes long, the output will left-padded to have /// a length of `20 * 2 + 2` bytes. function toHexString(uint256 value) internal pure returns (string memory str) { str = toHexStringNoPrefix(value); /// @solidity memory-safe-assembly assembly { let strLength := add(mload(str), 2) // Compute the length. mstore(str, 0x3078) // Write the "0x" prefix. str := sub(str, 2) // Move the pointer. mstore(str, strLength) // Write the length. } } /// @dev Returns the hexadecimal representation of `value`. /// The output is prefixed with "0x". /// The output excludes leading "0" from the `toHexString` output. /// `0x00: "0x0", 0x01: "0x1", 0x12: "0x12", 0x123: "0x123"`. function toMinimalHexString(uint256 value) internal pure returns (string memory str) { str = toHexStringNoPrefix(value); /// @solidity memory-safe-assembly assembly { let o := eq(byte(0, mload(add(str, 0x20))), 0x30) // Whether leading zero is present. let strLength := add(mload(str), 2) // Compute the length. mstore(add(str, o), 0x3078) // Write the "0x" prefix, accounting for leading zero. str := sub(add(str, o), 2) // Move the pointer, accounting for leading zero. mstore(str, sub(strLength, o)) // Write the length, accounting for leading zero. } } /// @dev Returns the hexadecimal representation of `value`. /// The output excludes leading "0" from the `toHexStringNoPrefix` output. /// `0x00: "0", 0x01: "1", 0x12: "12", 0x123: "123"`. function toMinimalHexStringNoPrefix(uint256 value) internal pure returns (string memory str) { str = toHexStringNoPrefix(value); /// @solidity memory-safe-assembly assembly { let o := eq(byte(0, mload(add(str, 0x20))), 0x30) // Whether leading zero is present. let strLength := mload(str) // Get the length. str := add(str, o) // Move the pointer, accounting for leading zero. mstore(str, sub(strLength, o)) // Write the length, accounting for leading zero. } } /// @dev Returns the hexadecimal representation of `value`. /// The output is encoded using 2 hexadecimal digits per byte. /// As address are 20 bytes long, the output will left-padded to have /// a length of `20 * 2` bytes. function toHexStringNoPrefix(uint256 value) internal pure returns (string memory str) { /// @solidity memory-safe-assembly assembly { // We need 0x20 bytes for the trailing zeros padding, 0x20 bytes for the length, // 0x02 bytes for the prefix, and 0x40 bytes for the digits. // The next multiple of 0x20 above (0x20 + 0x20 + 0x02 + 0x40) is 0xa0. str := add(mload(0x40), 0x80) // Allocate the memory. mstore(0x40, add(str, 0x20)) // Zeroize the slot after the string. mstore(str, 0) // Cache the end to calculate the length later. let end := str // Store "0123456789abcdef" in scratch space. mstore(0x0f, 0x30313233343536373839616263646566) let w := not(1) // Tsk. // We write the string from rightmost digit to leftmost digit. // The following is essentially a do-while loop that also handles the zero case. for { let temp := value } 1 {} { str := add(str, w) // `sub(str, 2)`. mstore8(add(str, 1), mload(and(temp, 15))) mstore8(str, mload(and(shr(4, temp), 15))) temp := shr(8, temp) if iszero(temp) { break } } // Compute the string's length. let strLength := sub(end, str) // Move the pointer and write the length. str := sub(str, 0x20) mstore(str, strLength) } } /// @dev Returns the hexadecimal representation of `value`. /// The output is prefixed with "0x", encoded using 2 hexadecimal digits per byte, /// and the alphabets are capitalized conditionally according to /// https://eips.ethereum.org/EIPS/eip-55 function toHexStringChecksummed(address value) internal pure returns (string memory str) { str = toHexString(value); /// @solidity memory-safe-assembly assembly { let mask := shl(6, div(not(0), 255)) // `0b010000000100000000 ...` let o := add(str, 0x22) let hashed := and(keccak256(o, 40), mul(34, mask)) // `0b10001000 ... ` let t := shl(240, 136) // `0b10001000 << 240` for { let i := 0 } 1 {} { mstore(add(i, i), mul(t, byte(i, hashed))) i := add(i, 1) if eq(i, 20) { break } } mstore(o, xor(mload(o), shr(1, and(mload(0x00), and(mload(o), mask))))) o := add(o, 0x20) mstore(o, xor(mload(o), shr(1, and(mload(0x20), and(mload(o), mask))))) } } /// @dev Returns the hexadecimal representation of `value`. /// The output is prefixed with "0x" and encoded using 2 hexadecimal digits per byte. function toHexString(address value) internal pure returns (string memory str) { str = toHexStringNoPrefix(value); /// @solidity memory-safe-assembly assembly { let strLength := add(mload(str), 2) // Compute the length. mstore(str, 0x3078) // Write the "0x" prefix. str := sub(str, 2) // Move the pointer. mstore(str, strLength) // Write the length. } } /// @dev Returns the hexadecimal representation of `value`. /// The output is encoded using 2 hexadecimal digits per byte. function toHexStringNoPrefix(address value) internal pure returns (string memory str) { /// @solidity memory-safe-assembly assembly { str := mload(0x40) // Allocate the memory. // We need 0x20 bytes for the trailing zeros padding, 0x20 bytes for the length, // 0x02 bytes for the prefix, and 0x28 bytes for the digits. // The next multiple of 0x20 above (0x20 + 0x20 + 0x02 + 0x28) is 0x80. mstore(0x40, add(str, 0x80)) // Store "0123456789abcdef" in scratch space. mstore(0x0f, 0x30313233343536373839616263646566) str := add(str, 2) mstore(str, 40) let o := add(str, 0x20) mstore(add(o, 40), 0) value := shl(96, value) // We write the string from rightmost digit to leftmost digit. // The following is essentially a do-while loop that also handles the zero case. for { let i := 0 } 1 {} { let p := add(o, add(i, i)) let temp := byte(i, value) mstore8(add(p, 1), mload(and(temp, 15))) mstore8(p, mload(shr(4, temp))) i := add(i, 1) if eq(i, 20) { break } } } } /// @dev Returns the hex encoded string from the raw bytes. /// The output is encoded using 2 hexadecimal digits per byte. function toHexString(bytes memory raw) internal pure returns (string memory str) { str = toHexStringNoPrefix(raw); /// @solidity memory-safe-assembly assembly { let strLength := add(mload(str), 2) // Compute the length. mstore(str, 0x3078) // Write the "0x" prefix. str := sub(str, 2) // Move the pointer. mstore(str, strLength) // Write the length. } } /// @dev Returns the hex encoded string from the raw bytes. /// The output is encoded using 2 hexadecimal digits per byte. function toHexStringNoPrefix(bytes memory raw) internal pure returns (string memory str) { /// @solidity memory-safe-assembly assembly { let length := mload(raw) str := add(mload(0x40), 2) // Skip 2 bytes for the optional prefix. mstore(str, add(length, length)) // Store the length of the output. // Store "0123456789abcdef" in scratch space. mstore(0x0f, 0x30313233343536373839616263646566) let o := add(str, 0x20) let end := add(raw, length) for {} iszero(eq(raw, end)) {} { raw := add(raw, 1) mstore8(add(o, 1), mload(and(mload(raw), 15))) mstore8(o, mload(and(shr(4, mload(raw)), 15))) o := add(o, 2) } mstore(o, 0) // Zeroize the slot after the string. mstore(0x40, add(o, 0x20)) // Allocate the memory. } } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* RUNE STRING OPERATIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Returns the number of UTF characters in the string. function runeCount(string memory s) internal pure returns (uint256 result) { /// @solidity memory-safe-assembly assembly { if mload(s) { mstore(0x00, div(not(0), 255)) mstore(0x20, 0x0202020202020202020202020202020202020202020202020303030304040506) let o := add(s, 0x20) let end := add(o, mload(s)) for { result := 1 } 1 { result := add(result, 1) } { o := add(o, byte(0, mload(shr(250, mload(o))))) if iszero(lt(o, end)) { break } } } } } /// @dev Returns if this string is a 7-bit ASCII string. /// (i.e. all characters codes are in [0..127]) function is7BitASCII(string memory s) internal pure returns (bool result) { /// @solidity memory-safe-assembly assembly { let mask := shl(7, div(not(0), 255)) result := 1 let n := mload(s) if n { let o := add(s, 0x20) let end := add(o, n) let last := mload(end) mstore(end, 0) for {} 1 {} { if and(mask, mload(o)) { result := 0 break } o := add(o, 0x20) if iszero(lt(o, end)) { break } } mstore(end, last) } } } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* BYTE STRING OPERATIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ // For performance and bytecode compactness, byte string operations are restricted // to 7-bit ASCII strings. All offsets are byte offsets, not UTF character offsets. // Usage of byte string operations on charsets with runes spanning two or more bytes // can lead to undefined behavior. /// @dev Returns `subject` all occurrences of `search` replaced with `replacement`. function replace(string memory subject, string memory search, string memory replacement) internal pure returns (string memory result) { /// @solidity memory-safe-assembly assembly { let subjectLength := mload(subject) let searchLength := mload(search) let replacementLength := mload(replacement) subject := add(subject, 0x20) search := add(search, 0x20) replacement := add(replacement, 0x20) result := add(mload(0x40), 0x20) let subjectEnd := add(subject, subjectLength) if iszero(gt(searchLength, subjectLength)) { let subjectSearchEnd := add(sub(subjectEnd, searchLength), 1) let h := 0 if iszero(lt(searchLength, 0x20)) { h := keccak256(search, searchLength) } let m := shl(3, sub(0x20, and(searchLength, 0x1f))) let s := mload(search) for {} 1 {} { let t := mload(subject) // Whether the first `searchLength % 32` bytes of // `subject` and `search` matches. if iszero(shr(m, xor(t, s))) { if h { if iszero(eq(keccak256(subject, searchLength), h)) { mstore(result, t) result := add(result, 1) subject := add(subject, 1) if iszero(lt(subject, subjectSearchEnd)) { break } continue } } // Copy the `replacement` one word at a time. for { let o := 0 } 1 {} { mstore(add(result, o), mload(add(replacement, o))) o := add(o, 0x20) if iszero(lt(o, replacementLength)) { break } } result := add(result, replacementLength) subject := add(subject, searchLength) if searchLength { if iszero(lt(subject, subjectSearchEnd)) { break } continue } } mstore(result, t) result := add(result, 1) subject := add(subject, 1) if iszero(lt(subject, subjectSearchEnd)) { break } } } let resultRemainder := result result := add(mload(0x40), 0x20) let k := add(sub(resultRemainder, result), sub(subjectEnd, subject)) // Copy the rest of the string one word at a time. for {} lt(subject, subjectEnd) {} { mstore(resultRemainder, mload(subject)) resultRemainder := add(resultRemainder, 0x20) subject := add(subject, 0x20) } result := sub(result, 0x20) let last := add(add(result, 0x20), k) // Zeroize the slot after the string. mstore(last, 0) mstore(0x40, add(last, 0x20)) // Allocate the memory. mstore(result, k) // Store the length. } } /// @dev Returns the byte index of the first location of `search` in `subject`, /// searching from left to right, starting from `from`. /// Returns `NOT_FOUND` (i.e. `type(uint256).max`) if the `search` is not found. function indexOf(string memory subject, string memory search, uint256 from) internal pure returns (uint256 result) { /// @solidity memory-safe-assembly assembly { for { let subjectLength := mload(subject) } 1 {} { if iszero(mload(search)) { if iszero(gt(from, subjectLength)) { result := from break } result := subjectLength break } let searchLength := mload(search) let subjectStart := add(subject, 0x20) result := not(0) // Initialize to `NOT_FOUND`. subject := add(subjectStart, from) let end := add(sub(add(subjectStart, subjectLength), searchLength), 1) let m := shl(3, sub(0x20, and(searchLength, 0x1f))) let s := mload(add(search, 0x20)) if iszero(and(lt(subject, end), lt(from, subjectLength))) { break } if iszero(lt(searchLength, 0x20)) { for { let h := keccak256(add(search, 0x20), searchLength) } 1 {} { if iszero(shr(m, xor(mload(subject), s))) { if eq(keccak256(subject, searchLength), h) { result := sub(subject, subjectStart) break } } subject := add(subject, 1) if iszero(lt(subject, end)) { break } } break } for {} 1 {} { if iszero(shr(m, xor(mload(subject), s))) { result := sub(subject, subjectStart) break } subject := add(subject, 1) if iszero(lt(subject, end)) { break } } break } } } /// @dev Returns the byte index of the first location of `search` in `subject`, /// searching from left to right. /// Returns `NOT_FOUND` (i.e. `type(uint256).max`) if the `search` is not found. function indexOf(string memory subject, string memory search) internal pure returns (uint256 result) { result = indexOf(subject, search, 0); } /// @dev Returns the byte index of the first location of `search` in `subject`, /// searching from right to left, starting from `from`. /// Returns `NOT_FOUND` (i.e. `type(uint256).max`) if the `search` is not found. function lastIndexOf(string memory subject, string memory search, uint256 from) internal pure returns (uint256 result) { /// @solidity memory-safe-assembly assembly { for {} 1 {} { result := not(0) // Initialize to `NOT_FOUND`. let searchLength := mload(search) if gt(searchLength, mload(subject)) { break } let w := result let fromMax := sub(mload(subject), searchLength) if iszero(gt(fromMax, from)) { from := fromMax } let end := add(add(subject, 0x20), w) subject := add(add(subject, 0x20), from) if iszero(gt(subject, end)) { break } // As this function is not too often used, // we shall simply use keccak256 for smaller bytecode size. for { let h := keccak256(add(search, 0x20), searchLength) } 1 {} { if eq(keccak256(subject, searchLength), h) { result := sub(subject, add(end, 1)) break } subject := add(subject, w) // `sub(subject, 1)`. if iszero(gt(subject, end)) { break } } break } } } /// @dev Returns the byte index of the first location of `search` in `subject`, /// searching from right to left. /// Returns `NOT_FOUND` (i.e. `type(uint256).max`) if the `search` is not found. function lastIndexOf(string memory subject, string memory search) internal pure returns (uint256 result) { result = lastIndexOf(subject, search, uint256(int256(-1))); } /// @dev Returns true if `search` is found in `subject`, false otherwise. function contains(string memory subject, string memory search) internal pure returns (bool) { return indexOf(subject, search) != NOT_FOUND; } /// @dev Returns whether `subject` starts with `search`. function startsWith(string memory subject, string memory search) internal pure returns (bool result) { /// @solidity memory-safe-assembly assembly { let searchLength := mload(search) // Just using keccak256 directly is actually cheaper. // forgefmt: disable-next-item result := and( iszero(gt(searchLength, mload(subject))), eq( keccak256(add(subject, 0x20), searchLength), keccak256(add(search, 0x20), searchLength) ) ) } } /// @dev Returns whether `subject` ends with `search`. function endsWith(string memory subject, string memory search) internal pure returns (bool result) { /// @solidity memory-safe-assembly assembly { let searchLength := mload(search) let subjectLength := mload(subject) // Whether `search` is not longer than `subject`. let withinRange := iszero(gt(searchLength, subjectLength)) // Just using keccak256 directly is actually cheaper. // forgefmt: disable-next-item result := and( withinRange, eq( keccak256( // `subject + 0x20 + max(subjectLength - searchLength, 0)`. add(add(subject, 0x20), mul(withinRange, sub(subjectLength, searchLength))), searchLength ), keccak256(add(search, 0x20), searchLength) ) ) } } /// @dev Returns `subject` repeated `times`. function repeat(string memory subject, uint256 times) internal pure returns (string memory result) { /// @solidity memory-safe-assembly assembly { let subjectLength := mload(subject) if iszero(or(iszero(times), iszero(subjectLength))) { subject := add(subject, 0x20) result := mload(0x40) let output := add(result, 0x20) for {} 1 {} { // Copy the `subject` one word at a time. for { let o := 0 } 1 {} { mstore(add(output, o), mload(add(subject, o))) o := add(o, 0x20) if iszero(lt(o, subjectLength)) { break } } output := add(output, subjectLength) times := sub(times, 1) if iszero(times) { break } } mstore(output, 0) // Zeroize the slot after the string. let resultLength := sub(output, add(result, 0x20)) mstore(result, resultLength) // Store the length. // Allocate the memory. mstore(0x40, add(result, add(resultLength, 0x20))) } } } /// @dev Returns a copy of `subject` sliced from `start` to `end` (exclusive). /// `start` and `end` are byte offsets. function slice(string memory subject, uint256 start, uint256 end) internal pure returns (string memory result) { /// @solidity memory-safe-assembly assembly { let subjectLength := mload(subject) if iszero(gt(subjectLength, end)) { end := subjectLength } if iszero(gt(subjectLength, start)) { start := subjectLength } if lt(start, end) { result := mload(0x40) let resultLength := sub(end, start) mstore(result, resultLength) subject := add(subject, start) let w := not(0x1f) // Copy the `subject` one word at a time, backwards. for { let o := and(add(resultLength, 0x1f), w) } 1 {} { mstore(add(result, o), mload(add(subject, o))) o := add(o, w) // `sub(o, 0x20)`. if iszero(o) { break } } // Zeroize the slot after the string. mstore(add(add(result, 0x20), resultLength), 0) // Allocate memory for the length and the bytes, // rounded up to a multiple of 32. mstore(0x40, add(result, and(add(resultLength, 0x3f), w))) } } } /// @dev Returns a copy of `subject` sliced from `start` to the end of the string. /// `start` is a byte offset. function slice(string memory subject, uint256 start) internal pure returns (string memory result) { result = slice(subject, start, uint256(int256(-1))); } /// @dev Returns all the indices of `search` in `subject`. /// The indices are byte offsets. function indicesOf(string memory subject, string memory search) internal pure returns (uint256[] memory result) { /// @solidity memory-safe-assembly assembly { let subjectLength := mload(subject) let searchLength := mload(search) if iszero(gt(searchLength, subjectLength)) { subject := add(subject, 0x20) search := add(search, 0x20) result := add(mload(0x40), 0x20) let subjectStart := subject let subjectSearchEnd := add(sub(add(subject, subjectLength), searchLength), 1) let h := 0 if iszero(lt(searchLength, 0x20)) { h := keccak256(search, searchLength) } let m := shl(3, sub(0x20, and(searchLength, 0x1f))) let s := mload(search) for {} 1 {} { let t := mload(subject) // Whether the first `searchLength % 32` bytes of // `subject` and `search` matches. if iszero(shr(m, xor(t, s))) { if h { if iszero(eq(keccak256(subject, searchLength), h)) { subject := add(subject, 1) if iszero(lt(subject, subjectSearchEnd)) { break } continue } } // Append to `result`. mstore(result, sub(subject, subjectStart)) result := add(result, 0x20) // Advance `subject` by `searchLength`. subject := add(subject, searchLength) if searchLength { if iszero(lt(subject, subjectSearchEnd)) { break } continue } } subject := add(subject, 1) if iszero(lt(subject, subjectSearchEnd)) { break } } let resultEnd := result // Assign `result` to the free memory pointer. result := mload(0x40) // Store the length of `result`. mstore(result, shr(5, sub(resultEnd, add(result, 0x20)))) // Allocate memory for result. // We allocate one more word, so this array can be recycled for {split}. mstore(0x40, add(resultEnd, 0x20)) } } } /// @dev Returns a arrays of strings based on the `delimiter` inside of the `subject` string. function split(string memory subject, string memory delimiter) internal pure returns (string[] memory result) { uint256[] memory indices = indicesOf(subject, delimiter); /// @solidity memory-safe-assembly assembly { let w := not(0x1f) let indexPtr := add(indices, 0x20) let indicesEnd := add(indexPtr, shl(5, add(mload(indices), 1))) mstore(add(indicesEnd, w), mload(subject)) mstore(indices, add(mload(indices), 1)) let prevIndex := 0 for {} 1 {} { let index := mload(indexPtr) mstore(indexPtr, 0x60) if iszero(eq(index, prevIndex)) { let element := mload(0x40) let elementLength := sub(index, prevIndex) mstore(element, elementLength) // Copy the `subject` one word at a time, backwards. for { let o := and(add(elementLength, 0x1f), w) } 1 {} { mstore(add(element, o), mload(add(add(subject, prevIndex), o))) o := add(o, w) // `sub(o, 0x20)`. if iszero(o) { break } } // Zeroize the slot after the string. mstore(add(add(element, 0x20), elementLength), 0) // Allocate memory for the length and the bytes, // rounded up to a multiple of 32. mstore(0x40, add(element, and(add(elementLength, 0x3f), w))) // Store the `element` into the array. mstore(indexPtr, element) } prevIndex := add(index, mload(delimiter)) indexPtr := add(indexPtr, 0x20) if iszero(lt(indexPtr, indicesEnd)) { break } } result := indices if iszero(mload(delimiter)) { result := add(indices, 0x20) mstore(result, sub(mload(indices), 2)) } } } /// @dev Returns a concatenated string of `a` and `b`. /// Cheaper than `string.concat()` and does not de-align the free memory pointer. function concat(string memory a, string memory b) internal pure returns (string memory result) { /// @solidity memory-safe-assembly assembly { let w := not(0x1f) result := mload(0x40) let aLength := mload(a) // Copy `a` one word at a time, backwards. for { let o := and(add(aLength, 0x20), w) } 1 {} { mstore(add(result, o), mload(add(a, o))) o := add(o, w) // `sub(o, 0x20)`. if iszero(o) { break } } let bLength := mload(b) let output := add(result, aLength) // Copy `b` one word at a time, backwards. for { let o := and(add(bLength, 0x20), w) } 1 {} { mstore(add(output, o), mload(add(b, o))) o := add(o, w) // `sub(o, 0x20)`. if iszero(o) { break } } let totalLength := add(aLength, bLength) let last := add(add(result, 0x20), totalLength) // Zeroize the slot after the string. mstore(last, 0) // Stores the length. mstore(result, totalLength) // Allocate memory for the length and the bytes, // rounded up to a multiple of 32. mstore(0x40, and(add(last, 0x1f), w)) } } /// @dev Returns a copy of the string in either lowercase or UPPERCASE. /// WARNING! This function is only compatible with 7-bit ASCII strings. function toCase(string memory subject, bool toUpper) internal pure returns (string memory result) { /// @solidity memory-safe-assembly assembly { let length := mload(subject) if length { result := add(mload(0x40), 0x20) subject := add(subject, 1) let flags := shl(add(70, shl(5, toUpper)), 0x3ffffff) let w := not(0) for { let o := length } 1 {} { o := add(o, w) let b := and(0xff, mload(add(subject, o))) mstore8(add(result, o), xor(b, and(shr(b, flags), 0x20))) if iszero(o) { break } } result := mload(0x40) mstore(result, length) // Store the length. let last := add(add(result, 0x20), length) mstore(last, 0) // Zeroize the slot after the string. mstore(0x40, add(last, 0x20)) // Allocate the memory. } } } /// @dev Returns a string from a small bytes32 string. /// `s` must be null-terminated, or behavior will be undefined. function fromSmallString(bytes32 s) internal pure returns (string memory result) { /// @solidity memory-safe-assembly assembly { result := mload(0x40) let n := 0 for {} byte(n, s) { n := add(n, 1) } {} // Scan for '\0'. mstore(result, n) let o := add(result, 0x20) mstore(o, s) mstore(add(o, n), 0) mstore(0x40, add(result, 0x40)) } } /// @dev Returns the small string, with all bytes after the first null byte zeroized. function normalizeSmallString(bytes32 s) internal pure returns (bytes32 result) { /// @solidity memory-safe-assembly assembly { for {} byte(result, s) { result := add(result, 1) } {} // Scan for '\0'. mstore(0x00, s) mstore(result, 0x00) result := mload(0x00) } } /// @dev Returns the string as a normalized null-terminated small string. function toSmallString(string memory s) internal pure returns (bytes32 result) { /// @solidity memory-safe-assembly assembly { result := mload(s) if iszero(lt(result, 33)) { mstore(0x00, 0xec92f9a3) // `TooBigForSmallString()`. revert(0x1c, 0x04) } result := shl(shl(3, sub(32, result)), mload(add(s, result))) } } /// @dev Returns a lowercased copy of the string. /// WARNING! This function is only compatible with 7-bit ASCII strings. function lower(string memory subject) internal pure returns (string memory result) { result = toCase(subject, false); } /// @dev Returns an UPPERCASED copy of the string. /// WARNING! This function is only compatible with 7-bit ASCII strings. function upper(string memory subject) internal pure returns (string memory result) { result = toCase(subject, true); } /// @dev Escapes the string to be used within HTML tags. function escapeHTML(string memory s) internal pure returns (string memory result) { /// @solidity memory-safe-assembly assembly { let end := add(s, mload(s)) result := add(mload(0x40), 0x20) // Store the bytes of the packed offsets and strides into the scratch space. // `packed = (stride << 5) | offset`. Max offset is 20. Max stride is 6. mstore(0x1f, 0x900094) mstore(0x08, 0xc0000000a6ab) // Store ""&'<>" into the scratch space. mstore(0x00, shl(64, 0x2671756f743b26616d703b262333393b266c743b2667743b)) for {} iszero(eq(s, end)) {} { s := add(s, 1) let c := and(mload(s), 0xff) // Not in `["\"","'","&","<",">"]`. if iszero(and(shl(c, 1), 0x500000c400000000)) { mstore8(result, c) result := add(result, 1) continue } let t := shr(248, mload(c)) mstore(result, mload(and(t, 0x1f))) result := add(result, shr(5, t)) } let last := result mstore(last, 0) // Zeroize the slot after the string. result := mload(0x40) mstore(result, sub(last, add(result, 0x20))) // Store the length. mstore(0x40, add(last, 0x20)) // Allocate the memory. } } /// @dev Escapes the string to be used within double-quotes in a JSON. /// If `addDoubleQuotes` is true, the result will be enclosed in double-quotes. function escapeJSON(string memory s, bool addDoubleQuotes) internal pure returns (string memory result) { /// @solidity memory-safe-assembly assembly { let end := add(s, mload(s)) result := add(mload(0x40), 0x20) if addDoubleQuotes { mstore8(result, 34) result := add(1, result) } // Store "\\u0000" in scratch space. // Store "0123456789abcdef" in scratch space. // Also, store `{0x08:"b", 0x09:"t", 0x0a:"n", 0x0c:"f", 0x0d:"r"}`. // into the scratch space. mstore(0x15, 0x5c75303030303031323334353637383961626364656662746e006672) // Bitmask for detecting `["\"","\\"]`. let e := or(shl(0x22, 1), shl(0x5c, 1)) for {} iszero(eq(s, end)) {} { s := add(s, 1) let c := and(mload(s), 0xff) if iszero(lt(c, 0x20)) { if iszero(and(shl(c, 1), e)) { // Not in `["\"","\\"]`. mstore8(result, c) result := add(result, 1) continue } mstore8(result, 0x5c) // "\\". mstore8(add(result, 1), c) result := add(result, 2) continue } if iszero(and(shl(c, 1), 0x3700)) { // Not in `["\b","\t","\n","\f","\d"]`. mstore8(0x1d, mload(shr(4, c))) // Hex value. mstore8(0x1e, mload(and(c, 15))) // Hex value. mstore(result, mload(0x19)) // "\\u00XX". result := add(result, 6) continue } mstore8(result, 0x5c) // "\\". mstore8(add(result, 1), mload(add(c, 8))) result := add(result, 2) } if addDoubleQuotes { mstore8(result, 34) result := add(1, result) } let last := result mstore(last, 0) // Zeroize the slot after the string. result := mload(0x40) mstore(result, sub(last, add(result, 0x20))) // Store the length. mstore(0x40, add(last, 0x20)) // Allocate the memory. } } /// @dev Escapes the string to be used within double-quotes in a JSON. function escapeJSON(string memory s) internal pure returns (string memory result) { result = escapeJSON(s, false); } /// @dev Returns whether `a` equals `b`. function eq(string memory a, string memory b) internal pure returns (bool result) { /// @solidity memory-safe-assembly assembly { result := eq(keccak256(add(a, 0x20), mload(a)), keccak256(add(b, 0x20), mload(b))) } } /// @dev Returns whether `a` equals `b`, where `b` is a null-terminated small string. function eqs(string memory a, bytes32 b) internal pure returns (bool result) { /// @solidity memory-safe-assembly assembly { // These should be evaluated on compile time, as far as possible. let m := not(shl(7, div(not(iszero(b)), 255))) // `0x7f7f ...`. let x := not(or(m, or(b, add(m, and(b, m))))) let r := shl(7, iszero(iszero(shr(128, x)))) r := or(r, shl(6, iszero(iszero(shr(64, shr(r, x)))))) r := or(r, shl(5, lt(0xffffffff, shr(r, x)))) r := or(r, shl(4, lt(0xffff, shr(r, x)))) r := or(r, shl(3, lt(0xff, shr(r, x)))) // forgefmt: disable-next-item result := gt(eq(mload(a), add(iszero(x), xor(31, shr(3, r)))), xor(shr(add(8, r), b), shr(add(8, r), mload(add(a, 0x20))))) } } /// @dev Packs a single string with its length into a single word. /// Returns `bytes32(0)` if the length is zero or greater than 31. function packOne(string memory a) internal pure returns (bytes32 result) { /// @solidity memory-safe-assembly assembly { // We don't need to zero right pad the string, // since this is our own custom non-standard packing scheme. result := mul( // Load the length and the bytes. mload(add(a, 0x1f)), // `length != 0 && length < 32`. Abuses underflow. // Assumes that the length is valid and within the block gas limit. lt(sub(mload(a), 1), 0x1f) ) } } /// @dev Unpacks a string packed using {packOne}. /// Returns the empty string if `packed` is `bytes32(0)`. /// If `packed` is not an output of {packOne}, the output behavior is undefined. function unpackOne(bytes32 packed) internal pure returns (string memory result) { /// @solidity memory-safe-assembly assembly { // Grab the free memory pointer. result := mload(0x40) // Allocate 2 words (1 for the length, 1 for the bytes). mstore(0x40, add(result, 0x40)) // Zeroize the length slot. mstore(result, 0) // Store the length and bytes. mstore(add(result, 0x1f), packed) // Right pad with zeroes. mstore(add(add(result, 0x20), mload(result)), 0) } } /// @dev Packs two strings with their lengths into a single word. /// Returns `bytes32(0)` if combined length is zero or greater than 30. function packTwo(string memory a, string memory b) internal pure returns (bytes32 result) { /// @solidity memory-safe-assembly assembly { let aLength := mload(a) // We don't need to zero right pad the strings, // since this is our own custom non-standard packing scheme. result := mul( // Load the length and the bytes of `a` and `b`. or( shl(shl(3, sub(0x1f, aLength)), mload(add(a, aLength))), mload(sub(add(b, 0x1e), aLength)) ), // `totalLength != 0 && totalLength < 31`. Abuses underflow. // Assumes that the lengths are valid and within the block gas limit. lt(sub(add(aLength, mload(b)), 1), 0x1e) ) } } /// @dev Unpacks strings packed using {packTwo}. /// Returns the empty strings if `packed` is `bytes32(0)`. /// If `packed` is not an output of {packTwo}, the output behavior is undefined. function unpackTwo(bytes32 packed) internal pure returns (string memory resultA, string memory resultB) { /// @solidity memory-safe-assembly assembly { // Grab the free memory pointer. resultA := mload(0x40) resultB := add(resultA, 0x40) // Allocate 2 words for each string (1 for the length, 1 for the byte). Total 4 words. mstore(0x40, add(resultB, 0x40)) // Zeroize the length slots. mstore(resultA, 0) mstore(resultB, 0) // Store the lengths and bytes. mstore(add(resultA, 0x1f), packed) mstore(add(resultB, 0x1f), mload(add(add(resultA, 0x20), mload(resultA)))) // Right pad with zeroes. mstore(add(add(resultA, 0x20), mload(resultA)), 0) mstore(add(add(resultB, 0x20), mload(resultB)), 0) } } /// @dev Directly returns `a` without copying. function directReturn(string memory a) internal pure { assembly { // Assumes that the string does not start from the scratch space. let retStart := sub(a, 0x20) let retSize := add(mload(a), 0x40) // Right pad with zeroes. Just in case the string is produced // by a method that doesn't zero right pad. mstore(add(retStart, retSize), 0) // Store the return offset. mstore(retStart, 0x20) // End the transaction, returning the string. return(retStart, retSize) } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; /// @notice Simple single owner authorization mixin. /// @author Solady (https://github.com/vectorized/solady/blob/main/src/auth/Ownable.sol) /// /// @dev Note: /// This implementation does NOT auto-initialize the owner to `msg.sender`. /// You MUST call the `_initializeOwner` in the constructor / initializer. /// /// While the ownable portion follows /// [EIP-173](https://eips.ethereum.org/EIPS/eip-173) for compatibility, /// the nomenclature for the 2-step ownership handover may be unique to this codebase. abstract contract Ownable { /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* CUSTOM ERRORS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The caller is not authorized to call the function. error Unauthorized(); /// @dev The `newOwner` cannot be the zero address. error NewOwnerIsZeroAddress(); /// @dev The `pendingOwner` does not have a valid handover request. error NoHandoverRequest(); /// @dev Cannot double-initialize. error AlreadyInitialized(); /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* EVENTS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The ownership is transferred from `oldOwner` to `newOwner`. /// This event is intentionally kept the same as OpenZeppelin's Ownable to be /// compatible with indexers and [EIP-173](https://eips.ethereum.org/EIPS/eip-173), /// despite it not being as lightweight as a single argument event. event OwnershipTransferred(address indexed oldOwner, address indexed newOwner); /// @dev An ownership handover to `pendingOwner` has been requested. event OwnershipHandoverRequested(address indexed pendingOwner); /// @dev The ownership handover to `pendingOwner` has been canceled. event OwnershipHandoverCanceled(address indexed pendingOwner); /// @dev `keccak256(bytes("OwnershipTransferred(address,address)"))`. uint256 private constant _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE = 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0; /// @dev `keccak256(bytes("OwnershipHandoverRequested(address)"))`. uint256 private constant _OWNERSHIP_HANDOVER_REQUESTED_EVENT_SIGNATURE = 0xdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d; /// @dev `keccak256(bytes("OwnershipHandoverCanceled(address)"))`. uint256 private constant _OWNERSHIP_HANDOVER_CANCELED_EVENT_SIGNATURE = 0xfa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* STORAGE */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The owner slot is given by: /// `bytes32(~uint256(uint32(bytes4(keccak256("_OWNER_SLOT_NOT")))))`. /// It is intentionally chosen to be a high value /// to avoid collision with lower slots. /// The choice of manual storage layout is to enable compatibility /// with both regular and upgradeable contracts. bytes32 internal constant _OWNER_SLOT = 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffff74873927; /// The ownership handover slot of `newOwner` is given by: /// ``` /// mstore(0x00, or(shl(96, user), _HANDOVER_SLOT_SEED)) /// let handoverSlot := keccak256(0x00, 0x20) /// ``` /// It stores the expiry timestamp of the two-step ownership handover. uint256 private constant _HANDOVER_SLOT_SEED = 0x389a75e1; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* INTERNAL FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Override to return true to make `_initializeOwner` prevent double-initialization. function _guardInitializeOwner() internal pure virtual returns (bool guard) {} /// @dev Initializes the owner directly without authorization guard. /// This function must be called upon initialization, /// regardless of whether the contract is upgradeable or not. /// This is to enable generalization to both regular and upgradeable contracts, /// and to save gas in case the initial owner is not the caller. /// For performance reasons, this function will not check if there /// is an existing owner. function _initializeOwner(address newOwner) internal virtual { if (_guardInitializeOwner()) { /// @solidity memory-safe-assembly assembly { let ownerSlot := _OWNER_SLOT if sload(ownerSlot) { mstore(0x00, 0x0dc149f0) // `AlreadyInitialized()`. revert(0x1c, 0x04) } // Clean the upper 96 bits. newOwner := shr(96, shl(96, newOwner)) // Store the new value. sstore(ownerSlot, or(newOwner, shl(255, iszero(newOwner)))) // Emit the {OwnershipTransferred} event. log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, 0, newOwner) } } else { /// @solidity memory-safe-assembly assembly { // Clean the upper 96 bits. newOwner := shr(96, shl(96, newOwner)) // Store the new value. sstore(_OWNER_SLOT, newOwner) // Emit the {OwnershipTransferred} event. log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, 0, newOwner) } } } /// @dev Sets the owner directly without authorization guard. function _setOwner(address newOwner) internal virtual { if (_guardInitializeOwner()) { /// @solidity memory-safe-assembly assembly { let ownerSlot := _OWNER_SLOT // Clean the upper 96 bits. newOwner := shr(96, shl(96, newOwner)) // Emit the {OwnershipTransferred} event. log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, sload(ownerSlot), newOwner) // Store the new value. sstore(ownerSlot, or(newOwner, shl(255, iszero(newOwner)))) } } else { /// @solidity memory-safe-assembly assembly { let ownerSlot := _OWNER_SLOT // Clean the upper 96 bits. newOwner := shr(96, shl(96, newOwner)) // Emit the {OwnershipTransferred} event. log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, sload(ownerSlot), newOwner) // Store the new value. sstore(ownerSlot, newOwner) } } } /// @dev Throws if the sender is not the owner. function _checkOwner() internal view virtual { /// @solidity memory-safe-assembly assembly { // If the caller is not the stored owner, revert. if iszero(eq(caller(), sload(_OWNER_SLOT))) { mstore(0x00, 0x82b42900) // `Unauthorized()`. revert(0x1c, 0x04) } } } /// @dev Returns how long a two-step ownership handover is valid for in seconds. /// Override to return a different value if needed. /// Made internal to conserve bytecode. Wrap it in a public function if needed. function _ownershipHandoverValidFor() internal view virtual returns (uint64) { return 48 * 3600; } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* PUBLIC UPDATE FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Allows the owner to transfer the ownership to `newOwner`. function transferOwnership(address newOwner) public payable virtual onlyOwner { /// @solidity memory-safe-assembly assembly { if iszero(shl(96, newOwner)) { mstore(0x00, 0x7448fbae) // `NewOwnerIsZeroAddress()`. revert(0x1c, 0x04) } } _setOwner(newOwner); } /// @dev Allows the owner to renounce their ownership. function renounceOwnership() public payable virtual onlyOwner { _setOwner(address(0)); } /// @dev Request a two-step ownership handover to the caller. /// The request will automatically expire in 48 hours (172800 seconds) by default. function requestOwnershipHandover() public payable virtual { unchecked { uint256 expires = block.timestamp + _ownershipHandoverValidFor(); /// @solidity memory-safe-assembly assembly { // Compute and set the handover slot to `expires`. mstore(0x0c, _HANDOVER_SLOT_SEED) mstore(0x00, caller()) sstore(keccak256(0x0c, 0x20), expires) // Emit the {OwnershipHandoverRequested} event. log2(0, 0, _OWNERSHIP_HANDOVER_REQUESTED_EVENT_SIGNATURE, caller()) } } } /// @dev Cancels the two-step ownership handover to the caller, if any. function cancelOwnershipHandover() public payable virtual { /// @solidity memory-safe-assembly assembly { // Compute and set the handover slot to 0. mstore(0x0c, _HANDOVER_SLOT_SEED) mstore(0x00, caller()) sstore(keccak256(0x0c, 0x20), 0) // Emit the {OwnershipHandoverCanceled} event. log2(0, 0, _OWNERSHIP_HANDOVER_CANCELED_EVENT_SIGNATURE, caller()) } } /// @dev Allows the owner to complete the two-step ownership handover to `pendingOwner`. /// Reverts if there is no existing ownership handover requested by `pendingOwner`. function completeOwnershipHandover(address pendingOwner) public payable virtual onlyOwner { /// @solidity memory-safe-assembly assembly { // Compute and set the handover slot to 0. mstore(0x0c, _HANDOVER_SLOT_SEED) mstore(0x00, pendingOwner) let handoverSlot := keccak256(0x0c, 0x20) // If the handover does not exist, or has expired. if gt(timestamp(), sload(handoverSlot)) { mstore(0x00, 0x6f5e8818) // `NoHandoverRequest()`. revert(0x1c, 0x04) } // Set the handover slot to 0. sstore(handoverSlot, 0) } _setOwner(pendingOwner); } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* PUBLIC READ FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Returns the owner of the contract. function owner() public view virtual returns (address result) { /// @solidity memory-safe-assembly assembly { result := sload(_OWNER_SLOT) } } /// @dev Returns the expiry timestamp for the two-step ownership handover to `pendingOwner`. function ownershipHandoverExpiresAt(address pendingOwner) public view virtual returns (uint256 result) { /// @solidity memory-safe-assembly assembly { // Compute the handover slot. mstore(0x0c, _HANDOVER_SLOT_SEED) mstore(0x00, pendingOwner) // Load the handover slot. result := sload(keccak256(0x0c, 0x20)) } } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* MODIFIERS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Marks a function as only callable by the owner. modifier onlyOwner() virtual { _checkOwner(); _; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; /// @notice Safe ETH and ERC20 transfer library that gracefully handles missing return values. /// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/SafeTransferLib.sol) /// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/SafeTransferLib.sol) /// /// @dev Note: /// - For ETH transfers, please use `forceSafeTransferETH` for DoS protection. /// - For ERC20s, this implementation won't check that a token has code, /// responsibility is delegated to the caller. library SafeTransferLib { /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* CUSTOM ERRORS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The ETH transfer has failed. error ETHTransferFailed(); /// @dev The ERC20 `transferFrom` has failed. error TransferFromFailed(); /// @dev The ERC20 `transfer` has failed. error TransferFailed(); /// @dev The ERC20 `approve` has failed. error ApproveFailed(); /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* CONSTANTS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Suggested gas stipend for contract receiving ETH that disallows any storage writes. uint256 internal constant GAS_STIPEND_NO_STORAGE_WRITES = 2300; /// @dev Suggested gas stipend for contract receiving ETH to perform a few /// storage reads and writes, but low enough to prevent griefing. uint256 internal constant GAS_STIPEND_NO_GRIEF = 100000; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* ETH OPERATIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ // If the ETH transfer MUST succeed with a reasonable gas budget, use the force variants. // // The regular variants: // - Forwards all remaining gas to the target. // - Reverts if the target reverts. // - Reverts if the current contract has insufficient balance. // // The force variants: // - Forwards with an optional gas stipend // (defaults to `GAS_STIPEND_NO_GRIEF`, which is sufficient for most cases). // - If the target reverts, or if the gas stipend is exhausted, // creates a temporary contract to force send the ETH via `SELFDESTRUCT`. // Future compatible with `SENDALL`: https://eips.ethereum.org/EIPS/eip-4758. // - Reverts if the current contract has insufficient balance. // // The try variants: // - Forwards with a mandatory gas stipend. // - Instead of reverting, returns whether the transfer succeeded. /// @dev Sends `amount` (in wei) ETH to `to`. function safeTransferETH(address to, uint256 amount) internal { /// @solidity memory-safe-assembly assembly { if iszero(call(gas(), to, amount, codesize(), 0x00, codesize(), 0x00)) { mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`. revert(0x1c, 0x04) } } } /// @dev Sends all the ETH in the current contract to `to`. function safeTransferAllETH(address to) internal { /// @solidity memory-safe-assembly assembly { // Transfer all the ETH and check if it succeeded or not. if iszero(call(gas(), to, selfbalance(), codesize(), 0x00, codesize(), 0x00)) { mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`. revert(0x1c, 0x04) } } } /// @dev Force sends `amount` (in wei) ETH to `to`, with a `gasStipend`. function forceSafeTransferETH(address to, uint256 amount, uint256 gasStipend) internal { /// @solidity memory-safe-assembly assembly { if lt(selfbalance(), amount) { mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`. revert(0x1c, 0x04) } if iszero(call(gasStipend, to, amount, codesize(), 0x00, codesize(), 0x00)) { mstore(0x00, to) // Store the address in scratch space. mstore8(0x0b, 0x73) // Opcode `PUSH20`. mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`. if iszero(create(amount, 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation. } } } /// @dev Force sends all the ETH in the current contract to `to`, with a `gasStipend`. function forceSafeTransferAllETH(address to, uint256 gasStipend) internal { /// @solidity memory-safe-assembly assembly { if iszero(call(gasStipend, to, selfbalance(), codesize(), 0x00, codesize(), 0x00)) { mstore(0x00, to) // Store the address in scratch space. mstore8(0x0b, 0x73) // Opcode `PUSH20`. mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`. if iszero(create(selfbalance(), 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation. } } } /// @dev Force sends `amount` (in wei) ETH to `to`, with `GAS_STIPEND_NO_GRIEF`. function forceSafeTransferETH(address to, uint256 amount) internal { /// @solidity memory-safe-assembly assembly { if lt(selfbalance(), amount) { mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`. revert(0x1c, 0x04) } if iszero(call(GAS_STIPEND_NO_GRIEF, to, amount, codesize(), 0x00, codesize(), 0x00)) { mstore(0x00, to) // Store the address in scratch space. mstore8(0x0b, 0x73) // Opcode `PUSH20`. mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`. if iszero(create(amount, 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation. } } } /// @dev Force sends all the ETH in the current contract to `to`, with `GAS_STIPEND_NO_GRIEF`. function forceSafeTransferAllETH(address to) internal { /// @solidity memory-safe-assembly assembly { // forgefmt: disable-next-item if iszero(call(GAS_STIPEND_NO_GRIEF, to, selfbalance(), codesize(), 0x00, codesize(), 0x00)) { mstore(0x00, to) // Store the address in scratch space. mstore8(0x0b, 0x73) // Opcode `PUSH20`. mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`. if iszero(create(selfbalance(), 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation. } } } /// @dev Sends `amount` (in wei) ETH to `to`, with a `gasStipend`. function trySafeTransferETH(address to, uint256 amount, uint256 gasStipend) internal returns (bool success) { /// @solidity memory-safe-assembly assembly { success := call(gasStipend, to, amount, codesize(), 0x00, codesize(), 0x00) } } /// @dev Sends all the ETH in the current contract to `to`, with a `gasStipend`. function trySafeTransferAllETH(address to, uint256 gasStipend) internal returns (bool success) { /// @solidity memory-safe-assembly assembly { success := call(gasStipend, to, selfbalance(), codesize(), 0x00, codesize(), 0x00) } } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* ERC20 OPERATIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Sends `amount` of ERC20 `token` from `from` to `to`. /// Reverts upon failure. /// /// The `from` account must have at least `amount` approved for /// the current contract to manage. function safeTransferFrom(address token, address from, address to, uint256 amount) internal { /// @solidity memory-safe-assembly assembly { let m := mload(0x40) // Cache the free memory pointer. mstore(0x60, amount) // Store the `amount` argument. mstore(0x40, to) // Store the `to` argument. mstore(0x2c, shl(96, from)) // Store the `from` argument. mstore(0x0c, 0x23b872dd000000000000000000000000) // `transferFrom(address,address,uint256)`. // Perform the transfer, reverting upon failure. if iszero( and( // The arguments of `and` are evaluated from right to left. or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing. call(gas(), token, 0, 0x1c, 0x64, 0x00, 0x20) ) ) { mstore(0x00, 0x7939f424) // `TransferFromFailed()`. revert(0x1c, 0x04) } mstore(0x60, 0) // Restore the zero slot to zero. mstore(0x40, m) // Restore the free memory pointer. } } /// @dev Sends all of ERC20 `token` from `from` to `to`. /// Reverts upon failure. /// /// The `from` account must have their entire balance approved for /// the current contract to manage. function safeTransferAllFrom(address token, address from, address to) internal returns (uint256 amount) { /// @solidity memory-safe-assembly assembly { let m := mload(0x40) // Cache the free memory pointer. mstore(0x40, to) // Store the `to` argument. mstore(0x2c, shl(96, from)) // Store the `from` argument. mstore(0x0c, 0x70a08231000000000000000000000000) // `balanceOf(address)`. // Read the balance, reverting upon failure. if iszero( and( // The arguments of `and` are evaluated from right to left. gt(returndatasize(), 0x1f), // At least 32 bytes returned. staticcall(gas(), token, 0x1c, 0x24, 0x60, 0x20) ) ) { mstore(0x00, 0x7939f424) // `TransferFromFailed()`. revert(0x1c, 0x04) } mstore(0x00, 0x23b872dd) // `transferFrom(address,address,uint256)`. amount := mload(0x60) // The `amount` is already at 0x60. We'll need to return it. // Perform the transfer, reverting upon failure. if iszero( and( // The arguments of `and` are evaluated from right to left. or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing. call(gas(), token, 0, 0x1c, 0x64, 0x00, 0x20) ) ) { mstore(0x00, 0x7939f424) // `TransferFromFailed()`. revert(0x1c, 0x04) } mstore(0x60, 0) // Restore the zero slot to zero. mstore(0x40, m) // Restore the free memory pointer. } } /// @dev Sends `amount` of ERC20 `token` from the current contract to `to`. /// Reverts upon failure. function safeTransfer(address token, address to, uint256 amount) internal { /// @solidity memory-safe-assembly assembly { mstore(0x14, to) // Store the `to` argument. mstore(0x34, amount) // Store the `amount` argument. mstore(0x00, 0xa9059cbb000000000000000000000000) // `transfer(address,uint256)`. // Perform the transfer, reverting upon failure. if iszero( and( // The arguments of `and` are evaluated from right to left. or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing. call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20) ) ) { mstore(0x00, 0x90b8ec18) // `TransferFailed()`. revert(0x1c, 0x04) } mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten. } } /// @dev Sends all of ERC20 `token` from the current contract to `to`. /// Reverts upon failure. function safeTransferAll(address token, address to) internal returns (uint256 amount) { /// @solidity memory-safe-assembly assembly { mstore(0x00, 0x70a08231) // Store the function selector of `balanceOf(address)`. mstore(0x20, address()) // Store the address of the current contract. // Read the balance, reverting upon failure. if iszero( and( // The arguments of `and` are evaluated from right to left. gt(returndatasize(), 0x1f), // At least 32 bytes returned. staticcall(gas(), token, 0x1c, 0x24, 0x34, 0x20) ) ) { mstore(0x00, 0x90b8ec18) // `TransferFailed()`. revert(0x1c, 0x04) } mstore(0x14, to) // Store the `to` argument. amount := mload(0x34) // The `amount` is already at 0x34. We'll need to return it. mstore(0x00, 0xa9059cbb000000000000000000000000) // `transfer(address,uint256)`. // Perform the transfer, reverting upon failure. if iszero( and( // The arguments of `and` are evaluated from right to left. or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing. call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20) ) ) { mstore(0x00, 0x90b8ec18) // `TransferFailed()`. revert(0x1c, 0x04) } mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten. } } /// @dev Sets `amount` of ERC20 `token` for `to` to manage on behalf of the current contract. /// Reverts upon failure. function safeApprove(address token, address to, uint256 amount) internal { /// @solidity memory-safe-assembly assembly { mstore(0x14, to) // Store the `to` argument. mstore(0x34, amount) // Store the `amount` argument. mstore(0x00, 0x095ea7b3000000000000000000000000) // `approve(address,uint256)`. // Perform the approval, reverting upon failure. if iszero( and( // The arguments of `and` are evaluated from right to left. or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing. call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20) ) ) { mstore(0x00, 0x3e3f8f73) // `ApproveFailed()`. revert(0x1c, 0x04) } mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten. } } /// @dev Sets `amount` of ERC20 `token` for `to` to manage on behalf of the current contract. /// If the initial attempt to approve fails, attempts to reset the approved amount to zero, /// then retries the approval again (some tokens, e.g. USDT, requires this). /// Reverts upon failure. function safeApproveWithRetry(address token, address to, uint256 amount) internal { /// @solidity memory-safe-assembly assembly { mstore(0x14, to) // Store the `to` argument. mstore(0x34, amount) // Store the `amount` argument. mstore(0x00, 0x095ea7b3000000000000000000000000) // `approve(address,uint256)`. // Perform the approval, retrying upon failure. if iszero( and( // The arguments of `and` are evaluated from right to left. or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing. call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20) ) ) { mstore(0x34, 0) // Store 0 for the `amount`. mstore(0x00, 0x095ea7b3000000000000000000000000) // `approve(address,uint256)`. pop(call(gas(), token, 0, 0x10, 0x44, codesize(), 0x00)) // Reset the approval. mstore(0x34, amount) // Store back the original `amount`. // Retry the approval, reverting upon failure. if iszero( and( or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing. call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20) ) ) { mstore(0x00, 0x3e3f8f73) // `ApproveFailed()`. revert(0x1c, 0x04) } } mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten. } } /// @dev Returns the amount of ERC20 `token` owned by `account`. /// Returns zero if the `token` does not exist. function balanceOf(address token, address account) internal view returns (uint256 amount) { /// @solidity memory-safe-assembly assembly { mstore(0x14, account) // Store the `account` argument. mstore(0x00, 0x70a08231000000000000000000000000) // `balanceOf(address)`. amount := mul( mload(0x20), and( // The arguments of `and` are evaluated from right to left. gt(returndatasize(), 0x1f), // At least 32 bytes returned. staticcall(gas(), token, 0x10, 0x24, 0x20, 0x20) ) ) } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"string","name":"name_","type":"string"},{"internalType":"string","name":"symbol_","type":"string"},{"internalType":"uint96","name":"initialTokenSupply","type":"uint96"},{"internalType":"address","name":"initialSupplyOwner","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AlreadyInitialized","type":"error"},{"inputs":[],"name":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"DNAlreadyInitialized","type":"error"},{"inputs":[],"name":"InsufficientAllowance","type":"error"},{"inputs":[],"name":"InsufficientBalance","type":"error"},{"inputs":[],"name":"LinkMirrorContractFailed","type":"error"},{"inputs":[],"name":"MirrorAddressIsZero","type":"error"},{"inputs":[],"name":"NewOwnerIsZeroAddress","type":"error"},{"inputs":[],"name":"NoHandoverRequest","type":"error"},{"inputs":[],"name":"SenderNotMirror","type":"error"},{"inputs":[],"name":"TokenDoesNotExist","type":"error"},{"inputs":[],"name":"TotalSupplyOverflow","type":"error"},{"inputs":[],"name":"TransferCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"TransferFromIncorrectOwner","type":"error"},{"inputs":[],"name":"TransferToZeroAddress","type":"error"},{"inputs":[],"name":"Unauthorized","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"pendingOwner","type":"address"}],"name":"OwnershipHandoverCanceled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"pendingOwner","type":"address"}],"name":"OwnershipHandoverRequested","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"target","type":"address"},{"indexed":false,"internalType":"bool","name":"status","type":"bool"}],"name":"SkipNFTSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Transfer","type":"event"},{"stateMutability":"payable","type":"fallback"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"cancelOwnershipHandover","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"pendingOwner","type":"address"}],"name":"completeOwnershipHandover","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"a","type":"address"}],"name":"getSkipNFT","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"mirrorERC721","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"result","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"pendingOwner","type":"address"}],"name":"ownershipHandoverExpiresAt","outputs":[{"internalType":"uint256","name":"result","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"requestOwnershipHandover","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"string","name":"baseURI_","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"skipNFT","type":"bool"}],"name":"setSkipNFT","outputs":[],"stateMutability":"nonpayable","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":"result","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
608060405234801562000010575f80fd5b50604051620032d4380380620032d48339810160408190526200003391620004b6565b6200003e33620000b9565b5f6200004b8582620005dc565b5060016200005a8482620005dc565b505f336040516200006b90620003e7565b6001600160a01b039091168152602001604051809103905ff08015801562000095573d5f803e3d5ffd5b509050620000ae6001600160601b0384168383620000f5565b5050505050620006a8565b6001600160a01b0316638b78c6d819819055805f7f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08180a35b50565b68a20d6e21d0e52553088054640100000000900463ffffffff16156200012e57604051633ab534b960e21b815260040160405180910390fd5b6001600160a01b03821662000156576040516339a84a7b60e01b815260040160405180910390fd5b620001618262000299565b805463ffffffff60201b19166401000000001781556001810180546001600160a01b0384166001600160a01b0319909116179055831562000293576001600160a01b038316620001c457604051633a954ecd60e21b815260040160405180910390fd5b6b0de0b6b39983494c589bffff841115620001f25760405163e5cfe95760e01b815260040160405180910390fd5b8054600160601b600160c01b0319166c010000000000000000000000006001600160601b038616021781555f6200022984620002c7565b80546001600160a01b03908116600160a01b6001600160601b038916021782556040518781529192508516905f907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a36200029184600162000344565b505b50505050565b630f4599e55f523360205260205f6024601c5f855af160015f511416620000f25763d125259c5f526004601cfd5b6001600160a01b0381165f90815268a20d6e21d0e5255310602052604081208054909168a20d6e21d0e5255308916b010000000000000000000000900460011690036200033e576001833b156200031c576002175b825460ff9091166b0100000000000000000000000260ff60581b199091161782555b50919050565b5f6200035083620002c7565b80549091506b01000000000000000000000090046002161515821515146200039c57805460ff6b01000000000000000000000080830482166002189091160260ff60581b199091161781555b826001600160a01b03167fb5a1de456fff688115a4f75380060c23c8532d14ff85f687cc871456d642039383604051620003da911515815260200190565b60405180910390a2505050565b610c3180620026a383390190565b634e487b7160e01b5f52604160045260245ffd5b5f82601f83011262000419575f80fd5b81516001600160401b0380821115620004365762000436620003f5565b604051601f8301601f19908116603f01168101908282118183101715620004615762000461620003f5565b81604052838152602092508660208588010111156200047e575f80fd5b5f91505b83821015620004a1578582018301518183018401529082019062000482565b5f602085830101528094505050505092915050565b5f805f8060808587031215620004ca575f80fd5b84516001600160401b0380821115620004e1575f80fd5b620004ef8883890162000409565b9550602087015191508082111562000505575f80fd5b50620005148782880162000409565b604087015190945090506001600160601b038116811462000533575f80fd5b60608601519092506001600160a01b038116811462000550575f80fd5b939692955090935050565b600181811c908216806200057057607f821691505b6020821081036200033e57634e487b7160e01b5f52602260045260245ffd5b601f821115620005d757805f5260205f20601f840160051c81016020851015620005b65750805b601f840160051c820191505b8181101562000291575f8155600101620005c2565b505050565b81516001600160401b03811115620005f857620005f8620003f5565b62000610816200060984546200055b565b846200058f565b602080601f83116001811462000646575f84156200062e5750858301515b5f19600386901b1c1916600185901b178555620006a0565b5f85815260208120601f198616915b82811015620006765788860151825594840194600190910190840162000655565b50858210156200069457878501515f19600388901b60f8161c191681555b505060018460011b0185555b505050505050565b611fed80620006b65f395ff3fe608060405260043610610143575f3560e01c806354d1f13d116100b5578063a9059cbb1161006e578063a9059cbb1461072f578063c87b56dd1461074e578063dd62ed3e1461076d578063f04e283e146107b9578063f2fde38b146107cc578063fee81cf4146107df5761014a565b806354d1f13d1461068857806355f804b31461069057806370a08231146106af578063715018a6146106fb5780638da5cb5b1461070357806395d89b411461071b5761014a565b8063274e430b11610107578063274e430b146105c35780632a6a935d146105e2578063313ce567146106015780633ccfd60b1461061c57806340c10f19146106305780634ef41efc1461064f5761014a565b806306fdde031461050d578063095ea7b31461053757806318160ddd1461056657806323b872dd1461059c57806325692962146105bb5761014a565b3661014a57005b68a20d6e21d0e52553085f3560e01c63e985e9c58190036101ec5760018201546001600160a01b031633146101925760405163ce5a776b60e01b815260040160405180910390fd5b604436101561019f575f80fd5b6004356001600160a01b038181165f908152600385016020908152604080832060243594851684529091529020546101e99060ff166101de575f6101e1565b60015b60ff16610810565b50505b80636352211e036102505760018201546001600160a01b031633146102245760405163ce5a776b60e01b815260040160405180910390fd5b6024361015610231575f80fd5b60043561024e61024082610818565b6001600160a01b0316610810565b505b8063e5eb36c8036102bc5760018201546001600160a01b031633146102885760405163ce5a776b60e01b815260040160405180910390fd5b6084361015610295575f80fd5b6004356024356044356064356102ad8484848461084e565b6102b76001610810565b505050505b8063813500fc036103545760018201546001600160a01b031633146102f45760405163ce5a776b60e01b815260040160405180910390fd5b6064361015610301575f80fd5b6001600160a01b036044358181165f90815268a20d6e21d0e525530b6020908152604080832060043595861684529091529020805460ff19166024351515908117909155906103506001610810565b5050505b8063d10b6e0c036103b45760018201546001600160a01b0316331461038c5760405163ce5a776b60e01b815260040160405180910390fd5b6064361015610399575f80fd5b6004356024356044356103b0610240848484610bd1565b5050505b8063081812fc0361040a5760018201546001600160a01b031633146103ec5760405163ce5a776b60e01b815260040160405180910390fd5b60243610156103f9575f80fd5b60043561040861024082610ca6565b505b8063f5b100ea036104905760018201546001600160a01b031633146104425760405163ce5a776b60e01b815260040160405180910390fd5b602436101561044f575f80fd5b60043561048e610489826001600160a01b03165f90815268a20d6e21d0e5255310602052604090205463ffffffff600160801b9091041690565b610810565b505b8063e2c79281036104f65760018201546001600160a01b031633146104c85760405163ce5a776b60e01b815260040160405180910390fd5b60043610156104d5575f80fd5b68a20d6e21d0e5255308546104f690600160401b900463ffffffff16610810565b8063b7a94eb80361050b5761050b6001610810565b005b348015610518575f80fd5b50610521610cf0565b60405161052e9190611bea565b60405180910390f35b348015610542575f80fd5b50610556610551366004611c32565b610d7f565b604051901515815260200161052e565b348015610571575f80fd5b5068a20d6e21d0e525530854600160601b90046001600160601b03165b60405190815260200161052e565b3480156105a7575f80fd5b506105566105b6366004611c5a565b610df3565b61050b610e93565b3480156105ce575f80fd5b506105566105dd366004611c93565b610ee0565b3480156105ed575f80fd5b5061050b6105fc366004611cac565b610f2e565b34801561060c575f80fd5b506040516012815260200161052e565b348015610627575f80fd5b5061050b610f3b565b34801561063b575f80fd5b5061050b61064a366004611c32565b610f4e565b34801561065a575f80fd5b5068a20d6e21d0e5255309546001600160a01b03165b6040516001600160a01b03909116815260200161052e565b61050b610f64565b34801561069b575f80fd5b5061050b6106aa366004611ccb565b610f9d565b3480156106ba575f80fd5b5061058e6106c9366004611c93565b6001600160a01b03165f90815268a20d6e21d0e52553106020526040902054600160a01b90046001600160601b031690565b61050b610fb7565b34801561070e575f80fd5b50638b78c6d81954610670565b348015610726575f80fd5b50610521610fc8565b34801561073a575f80fd5b50610556610749366004611c32565b610fd7565b348015610759575f80fd5b50610521610768366004611d37565b610fec565b348015610778575f80fd5b5061058e610787366004611d4e565b6001600160a01b039182165f90815268a20d6e21d0e525530d6020908152604080832093909416825291909152205490565b61050b6107c7366004611c93565b611035565b61050b6107da366004611c93565b61106f565b3480156107ea575f80fd5b5061058e6107f9366004611c93565b63389a75e1600c9081525f91909152602090205490565b805f5260205ff35b5f61082282611095565b61083f5760405163677510db60e11b815260040160405180910390fd5b610848826110b1565b92915050565b68a20d6e21d0e52553086001600160a01b03841661087f57604051633a954ecd60e21b815260040160405180910390fd5b5f816002015f6108b8846007016108968860011b90565b600381901c5f90815260209290925260409091205460059190911b60e0161c90565b63ffffffff16815260208101919091526040015f20546001600160a01b039081169150861681146108fb5760405162a1148160e81b815260040160405180910390fd5b856001600160a01b0316836001600160a01b03161461097d576001600160a01b038087165f90815260038401602090815260408083209387168352929052205460ff1661097d575f8481526004830160205260409020546001600160a01b0384811691161461097d57604051632ce44b5f60e11b815260040160405180910390fd5b5f61098787611104565b90505f61099387611104565b8254909150670de0b6b3a76400009083906014906109c2908490600160a01b90046001600160601b0316611d93565b82546101009290920a6001600160601b0381810219909316918316021790915582546001600160a01b038116670de0b6b3a7640000600160a01b928390048416019092160217825550610a2660078501600188901b610a21848b61116f565b61120f565b5f868152600485016020908152604080832080546001600160a01b03191690556001600160a01b038b168352600687018252808320855463ffffffff60801b198116600160801b9182900463ffffffff9081165f1901908116909202178755631fffffff600382901c168552925282205460059190911b60e0161c6001600160a01b038a165f908152600687016020526040902063ffffffff919091169150610ae790610adb6007880160018b811b01610896565b63ffffffff168361120f565b8154600163ffffffff600160801b80840482169283019091160263ffffffff60801b19909216919091178355610b3960078701610b2784600190811b0190565b610a2160078a0160018d811b01610896565b6001600160a01b0389165f9081526006870160205260409020610b5d90828a61120f565b610b706007870160018a811b018361120f565b5050866001600160a01b0316886001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef670de0b6b3a7640000604051610bbf91815260200190565b60405180910390a35050505050505050565b5f68a20d6e21d0e52553088168a20d6e21d0e525530a81610bff68a20d6e21d0e525530f600189901b610896565b63ffffffff16815260208101919091526040015f20546001600160a01b03908116915084168114610c71576001600160a01b038082165f90815260038401602090815260408083209388168352929052205460ff16610c71576040516367d9dca160e11b815260040160405180910390fd5b5f8581526004909201602052604090912080546001600160a01b0387166001600160a01b031990911617905590509392505050565b5f610cb082611095565b610ccd5760405163677510db60e11b815260040160405180910390fd5b505f90815268a20d6e21d0e525530c60205260409020546001600160a01b031690565b60605f8054610cfe90611db3565b80601f0160208091040260200160405190810160405280929190818152602001828054610d2a90611db3565b8015610d755780601f10610d4c57610100808354040283529160200191610d75565b820191905f5260205f20905b815481529060010190602001808311610d5857829003601f168201915b5050505050905090565b5f8068a20d6e21d0e5255308335f81815260058301602090815260408083206001600160a01b038a16808552908352928190208890555187815293945090927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a35060019392505050565b6001600160a01b0383165f90815268a20d6e21d0e525530d6020908152604080832033845290915281205468a20d6e21d0e5255308905f198114610e7c5780841115610e52576040516313be252b60e01b815260040160405180910390fd5b6001600160a01b0386165f9081526005830160209081526040808320338452909152902084820390555b610e87868686611241565b50600195945050505050565b5f6202a30067ffffffffffffffff164201905063389a75e1600c52335f52806020600c2055337fdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d5f80a250565b6001600160a01b0381165f90815268a20d6e21d0e5255310602052604081208054600160581b90046001168203610f1b57823b5b9392505050565b54600160581b9004600216151592915050565b610f3833826116fd565b50565b610f4361178c565b610f4c336117a6565b565b610f5661178c565b610f6082826117bf565b5050565b63389a75e1600c52335f525f6020600c2055337ffa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c925f80a2565b610fa561178c565b6002610fb2828483611e44565b505050565b610fbf61178c565b610f4c5f611ac8565b606060018054610cfe90611db3565b5f610fe3338484611241565b50600192915050565b606060028054610ffb90611db3565b15905061103057600261100d83611b05565b60405160200161101e929190611efe565b60405160208183030381529060405290505b919050565b61103d61178c565b63389a75e1600c52805f526020600c20805442111561106357636f5e88185f526004601cfd5b5f9055610f3881611ac8565b61107761178c565b8060601b61108c57637448fbae5f526004601cfd5b610f3881611ac8565b5f806110a0836110b1565b6001600160a01b0316141592915050565b5f68a20d6e21d0e525530868a20d6e21d0e525530a826110de68a20d6e21d0e525530f600187901b610896565b63ffffffff16815260208101919091526040015f20546001600160a01b03169392505050565b6001600160a01b0381165f90815268a20d6e21d0e5255310602052604081208054909168a20d6e21d0e525530891600160581b90046001169003611169576001833b1561114f576002175b825460ff909116600160581b0260ff60581b199091161782555b50919050565b8154600160601b900463ffffffff1668a20d6e21d0e52553085f82900361120857805481905f906111a59063ffffffff16611f81565b825463ffffffff8083166101009490940a848102910219909116179092558554600160601b820263ffffffff60601b199091161786555f908152600283016020526040902080546001600160a01b0386166001600160a01b031990911617905591505b5092915050565b826020528160031c5f5260405f206007831660051b815463ffffffff8482841c188116831b8218845550505050505050565b6001600160a01b03821661126857604051633a954ecd60e21b815260040160405180910390fd5b68a20d6e21d0e52553085f61127c85611104565b90505f61128885611104565b90506112bd6040518060c001604052805f81526020015f81526020015f81526020015f81526020015f81526020015f81525090565b825463ffffffff600160801b808304821660808501528454041660a08301526001600160601b03600160a01b909104166040820181905285111561131457604051631e9acf1760e31b815260040160405180910390fd5b6040810180518690039081905283546001600160601b03808316600160a01b9081026001600160a01b03938416178755855481810483168a0160608701819052909216029116178355608082015161137a91670de0b6b3a7640000900480821191030290565b81528154600160581b90046002165f036113e857856001600160a01b0316876001600160a01b0316036113b557805160808201510360a08201525b6113e2670de0b6b3a76400008260600151816113d3576113d3611fa3565b048260a0015180821191030290565b60208201525b5f61142f8260200151835f01510160408051808201909152606081525f60208201526040805101828152806020018360051b81016040528183528083602001525050919050565b825190915015611524576001600160a01b0388165f908152600686016020526040902060808301518351875463ffffffff600160401b808304821684900382160263ffffffff60401b199092169190911789558754918303908116600160801b0263ffffffff60801b199092169190911787555b5f1991909101600381901c5f90815260208490526040812054919291600584901b60e0161c63ffffffff1690506114df89600701825f80611b47565b5f81815260048a016020908152604090912080546001600160a01b0319169055858101805160089390931b60608f901b176001178352910190528082036114a3575050505b602082015115611685576001600160a01b0387165f9081526006860160209081526040822060a085015191850151909290820190611562878c61116f565b8954602088015163ffffffff60401b19821663ffffffff600160401b80850482169093018116909202178c55895463ffffffff60801b1916600160801b86831602178a55919250670de0b6b3a7640000600160601b82046001600160601b03160491640100000000909104165b6115e08b6007016108968360011b90565b63ffffffff16156115ff57600101818111156115fa575060015b6115cf565b61160a86868361120f565b61161f8b600701828588806001019950611b47565b611648878e835f8360200151818360081b8560601b171781526020810185602001525050505050565b60010181811115611657575060015b8385036115cf578a5463ffffffff9091166401000000000267ffffffff0000000019909116178a5550505050505b805151156116a65760018501546116a69082906001600160a01b0316611b8b565b50856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef876040516116ec91815260200190565b60405180910390a350505050505050565b5f61170783611104565b8054909150600160581b900460021615158215151461174257805460ff600160581b80830482166002189091160260ff60581b199091161781555b826001600160a01b03167fb5a1de456fff688115a4f75380060c23c8532d14ff85f687cc871456d64203938360405161177f911515815260200190565b60405180910390a2505050565b638b78c6d819543314610f4c576382b429005f526004601cfd5b5f385f3847855af1610f385763b12d13eb5f526004601cfd5b6001600160a01b0382166117e657604051633a954ecd60e21b815260040160405180910390fd5b68a20d6e21d0e52553085f6117fa84611104565b8254909150600160601b90046001600160601b031683016b0de0b6b39983494c589bffff84118061183657506b0de0b6b39983494c589bffff81115b156118545760405163e5cfe95760e01b815260040160405180910390fd5b82546001600160601b03808316600160601b026bffffffffffffffffffffffff60601b199092169190911784558254600160a01b80820483168701928316026001600160a01b0390911617808455600160581b90046002165f03611a80576001600160a01b0386165f908152600685016020526040812084549091600160801b90910463ffffffff1690670de0b6b3a7640000840490505f61192f8383038484110260408051808201909152606081525f60208201526040805101828152806020018360051b81016040528183528083602001525050919050565b80515190915015611a7b578754670de0b6b3a7640000600160601b9091046001600160601b0316045f611962898d61116f565b8a5484515163ffffffff60401b19821663ffffffff600160401b80850482169093018116909202178d558b5463ffffffff60801b1916600160801b88831602178c559192506401000000009004165b6119c28b6007016108968360011b90565b63ffffffff16156119e157600101828111156119dc575060015b6119b1565b6119ec87878361120f565b611a018b600701828489806001019a50611b47565b611a2a848e835f8360200151818360081b8560601b171781526020810185602001525050505050565b60010182811115611a39575060015b8486036119b1578a5467ffffffff00000000191664010000000063ffffffff831602178b5560018b0154611a779085906001600160a01b0316611b8b565b5050505b505050505b50506040518381526001600160a01b038516905f907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a350505050565b638b78c6d81980546001600160a01b039092169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a355565b60606080604051019050602081016040525f8152805f19835b928101926030600a8206018453600a900480611b1e575050819003601f19909101908152919050565b8163ffffffff168160201b17846020528360021c5f5260405f206003851660061b815467ffffffffffffffff8482841c188116831b82188455505050505050505050565b81516040810363263c69d68152602080820152815160051b604401915060208183601c84015f875af1600182511416611bc2575f81fd5b50505050565b5f5b83811015611be2578181015183820152602001611bca565b50505f910152565b602081525f8251806020840152611c08816040850160208701611bc8565b601f01601f19169190910160400192915050565b80356001600160a01b0381168114611030575f80fd5b5f8060408385031215611c43575f80fd5b611c4c83611c1c565b946020939093013593505050565b5f805f60608486031215611c6c575f80fd5b611c7584611c1c565b9250611c8360208501611c1c565b9150604084013590509250925092565b5f60208284031215611ca3575f80fd5b610f1482611c1c565b5f60208284031215611cbc575f80fd5b81358015158114610f14575f80fd5b5f8060208385031215611cdc575f80fd5b823567ffffffffffffffff80821115611cf3575f80fd5b818501915085601f830112611d06575f80fd5b813581811115611d14575f80fd5b866020828501011115611d25575f80fd5b60209290920196919550909350505050565b5f60208284031215611d47575f80fd5b5035919050565b5f8060408385031215611d5f575f80fd5b611d6883611c1c565b9150611d7660208401611c1c565b90509250929050565b634e487b7160e01b5f52601160045260245ffd5b6001600160601b0382811682821603908082111561120857611208611d7f565b600181811c90821680611dc757607f821691505b60208210810361116957634e487b7160e01b5f52602260045260245ffd5b634e487b7160e01b5f52604160045260245ffd5b601f821115610fb257805f5260205f20601f840160051c81016020851015611e1e5750805b601f840160051c820191505b81811015611e3d575f8155600101611e2a565b5050505050565b67ffffffffffffffff831115611e5c57611e5c611de5565b611e7083611e6a8354611db3565b83611df9565b5f601f841160018114611ea1575f8515611e8a5750838201355b5f19600387901b1c1916600186901b178355611e3d565b5f83815260208120601f198716915b82811015611ed05786850135825560209485019460019092019101611eb0565b5086821015611eec575f1960f88860031b161c19848701351681555b505060018560011b0183555050505050565b5f808454611f0b81611db3565b60018281168015611f235760018114611f3857611f64565b60ff1984168752821515830287019450611f64565b885f526020805f205f5b85811015611f5b5781548a820152908401908201611f42565b50505082870194505b505050508351611f78818360208801611bc8565b01949350505050565b5f63ffffffff808316818103611f9957611f99611d7f565b6001019392505050565b634e487b7160e01b5f52601260045260245ffdfea264697066735822122099a3f6470ff478c53a7d7e5366155f004e275781dd42003607ab67eae718ce2064736f6c63430008180033608060405234801561000f575f80fd5b50604051610c31380380610c3183398101604081905261002e9161005b565b683602298b8c10b0123180546001600160a01b0319166001600160a01b0392909216919091179055610088565b5f6020828403121561006b575f80fd5b81516001600160a01b0381168114610081575f80fd5b9392505050565b610b9c806100955f395ff3fe6080604052600436106100eb575f3560e01c80636352211e11610089578063a22cb46511610058578063a22cb465146103d5578063b88d4fde146103f4578063c87b56dd14610413578063e985e9c514610432576100f2565b80636352211e1461036f57806370a082311461038e57806395d89b41146103ad57806397e5311c146103c1576100f2565b8063095ea7b3116100c5578063095ea7b3146102fc57806318160ddd1461031b57806323b872dd1461033d57806342842e0e1461035c576100f2565b806301ffc9a71461025357806306fdde03146102a4578063081812fc146102c5576100f2565b366100f257005b683602298b8c10b012305f3560e01c63263c69d68190036101b75781546001600160a01b0316331461013757604051631b1e598960e11b815260040160405180910390fd5b602036103d5f3e6004356024018036103d5f3e602081033560051b81018036103d5f3e5b8082146101ac5781358060601c816001168260a01b60a81c811583028284027fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef5f38a450505081602001915061015b565b505060015f5260205ff35b80630f4599e5036102515760018201546001600160a01b03161561020d5760018201546001600160a01b03166004356001600160a01b03161461020d576040516362cf623d60e11b815260040160405180910390fd5b81546001600160a01b03161561023657604051635fb2b52360e11b815260040160405180910390fd5b81546001600160a01b0319163317825560015f908152602090f35b005b34801561025e575f80fd5b5061028f61026d366004610943565b6301ffc9a760e09190911c9081146380ac58cd821417635b5e139f9091141790565b60405190151581526020015b60405180910390f35b3480156102af575f80fd5b506102b8610451565b60405161029b9190610971565b3480156102d0575f80fd5b506102e46102df3660046109bd565b6104a4565b6040516001600160a01b03909116815260200161029b565b348015610307575f80fd5b506102516103163660046109ef565b6104e7565b348015610326575f80fd5b5061032f610567565b60405190815260200161029b565b348015610348575f80fd5b50610251610357366004610a17565b6105a0565b61025161036a366004610a17565b61062c565b34801561037a575f80fd5b506102e46103893660046109bd565b61065d565b348015610399575f80fd5b5061032f6103a8366004610a50565b610693565b3480156103b8575f80fd5b506102b86106d8565b3480156103cc575f80fd5b506102e4610706565b3480156103e0575f80fd5b506102516103ef366004610a69565b61073b565b3480156103ff575f80fd5b5061025161040e366004610aa2565b6107b8565b34801561041e575f80fd5b506102b861042d3660046109bd565b610812565b34801561043d575f80fd5b5061028f61044c366004610b35565b61086b565b60605f61045c610706565b905060405191506306fdde035f525f806004601c845afa61047f573d5f833e3d82fd5b60205f803e60205f51833e815160205f5101602084013e815160208301016040525090565b5f806104ae610706565b905063081812fc5f528260205260205f6024601c845afa601f3d11166104da573d5f6040513e3d604051fd5b5050600c5160601c919050565b5f6104f0610706565b90508260601b60601c925060405163d10b6e0c5f5283602052826040523360605260205f6064601c34865af1601f3d111661052d573d5f823e3d81fd5b80604052505f6060528183600c5160601c7f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9255f38a4505050565b5f80610571610706565b905063e2c792815f5260205f6004601c845afa601f3d1116610599573d5f6040513e3d604051fd5b50505f5190565b5f6105a9610706565b90508360601b60601c93508260601b60601c925060405163e5eb36c881528460208201528360408201528260608201523360808201526020816084601c840134865af16001825114166105fe573d5f823e3d81fd5b508183857fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef5f38a450505050565b6106378383836105a0565b813b156106585761065883838360405180602001604052805f8152506108ba565b505050565b5f80610667610706565b9050636352211e5f528260205260205f6024601c845afa601f3d11166104da573d5f6040513e3d604051fd5b5f8061069d610706565b90508260601b60601c60205263f5b100ea5f5260205f6024601c845afa601f3d11166106cf573d5f6040513e3d604051fd5b50505f51919050565b60605f6106e3610706565b905060405191506395d89b415f525f806004601c845afa61047f573d5f833e3d82fd5b683602298b8c10b01230546001600160a01b03168061073857604051632d9523d760e11b815260040160405180910390fd5b90565b5f610744610706565b90508260601b60601c925060405163813500fc5f52836020528215156040523360605260205f6064601c34865af160015f511416610784573d5f823e3d81fd5b83337f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3160206040a360405250505f60605250565b6107c38585856105a0565b833b1561080b5761080b85858585858080601f0160208091040260200160405190810160405280939291908181526020018383808284375f920191909152506108ba92505050565b5050505050565b60605f61081d610706565b905060405191508260205263c87b56dd5f525f806024601c845afa610844573d5f833e3d82fd5b60205f803e60205f51833e815160205f5101602084013e8151602083010160405250919050565b5f80610875610706565b9050604051836040528460601b602c5263e985e9c560601b600c5260205f6044601c855afa601f3d11166108ab573d5f823e3d81fd5b60405250505f51151592915050565b60405163150b7a028082523360208301528560601b60601c604083015283606083015260808083015282518060a08401528015610901578060c08401826020870160045afa505b60208360a48301601c86015f8a5af1610922573d15610922573d5f843e3d83fd5b508060e01b82511461093b5763d1a57ed65f526004601cfd5b505050505050565b5f60208284031215610953575f80fd5b81356001600160e01b03198116811461096a575f80fd5b9392505050565b5f602080835283518060208501525f5b8181101561099d57858101830151858201604001528201610981565b505f604082860101526040601f19601f8301168501019250505092915050565b5f602082840312156109cd575f80fd5b5035919050565b80356001600160a01b03811681146109ea575f80fd5b919050565b5f8060408385031215610a00575f80fd5b610a09836109d4565b946020939093013593505050565b5f805f60608486031215610a29575f80fd5b610a32846109d4565b9250610a40602085016109d4565b9150604084013590509250925092565b5f60208284031215610a60575f80fd5b61096a826109d4565b5f8060408385031215610a7a575f80fd5b610a83836109d4565b915060208301358015158114610a97575f80fd5b809150509250929050565b5f805f805f60808688031215610ab6575f80fd5b610abf866109d4565b9450610acd602087016109d4565b935060408601359250606086013567ffffffffffffffff80821115610af0575f80fd5b818801915088601f830112610b03575f80fd5b813581811115610b11575f80fd5b896020828501011115610b22575f80fd5b9699959850939650602001949392505050565b5f8060408385031215610b46575f80fd5b610b4f836109d4565b9150610b5d602084016109d4565b9050925092905056fea2646970667358221220548ffd525f31ecfe3f2b5090388831e3c437104a690b39bfa1d3e4eb2c81cc5564736f6c63430008180033000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000021e19e0c9bab24000000000000000000000000000007a6aa63b8c256d14f932c5d85f08f23557b9bbcc00000000000000000000000000000000000000000000000000000000000000075061444e6f726100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000350444e0000000000000000000000000000000000000000000000000000000000
Deployed Bytecode
0x608060405260043610610143575f3560e01c806354d1f13d116100b5578063a9059cbb1161006e578063a9059cbb1461072f578063c87b56dd1461074e578063dd62ed3e1461076d578063f04e283e146107b9578063f2fde38b146107cc578063fee81cf4146107df5761014a565b806354d1f13d1461068857806355f804b31461069057806370a08231146106af578063715018a6146106fb5780638da5cb5b1461070357806395d89b411461071b5761014a565b8063274e430b11610107578063274e430b146105c35780632a6a935d146105e2578063313ce567146106015780633ccfd60b1461061c57806340c10f19146106305780634ef41efc1461064f5761014a565b806306fdde031461050d578063095ea7b31461053757806318160ddd1461056657806323b872dd1461059c57806325692962146105bb5761014a565b3661014a57005b68a20d6e21d0e52553085f3560e01c63e985e9c58190036101ec5760018201546001600160a01b031633146101925760405163ce5a776b60e01b815260040160405180910390fd5b604436101561019f575f80fd5b6004356001600160a01b038181165f908152600385016020908152604080832060243594851684529091529020546101e99060ff166101de575f6101e1565b60015b60ff16610810565b50505b80636352211e036102505760018201546001600160a01b031633146102245760405163ce5a776b60e01b815260040160405180910390fd5b6024361015610231575f80fd5b60043561024e61024082610818565b6001600160a01b0316610810565b505b8063e5eb36c8036102bc5760018201546001600160a01b031633146102885760405163ce5a776b60e01b815260040160405180910390fd5b6084361015610295575f80fd5b6004356024356044356064356102ad8484848461084e565b6102b76001610810565b505050505b8063813500fc036103545760018201546001600160a01b031633146102f45760405163ce5a776b60e01b815260040160405180910390fd5b6064361015610301575f80fd5b6001600160a01b036044358181165f90815268a20d6e21d0e525530b6020908152604080832060043595861684529091529020805460ff19166024351515908117909155906103506001610810565b5050505b8063d10b6e0c036103b45760018201546001600160a01b0316331461038c5760405163ce5a776b60e01b815260040160405180910390fd5b6064361015610399575f80fd5b6004356024356044356103b0610240848484610bd1565b5050505b8063081812fc0361040a5760018201546001600160a01b031633146103ec5760405163ce5a776b60e01b815260040160405180910390fd5b60243610156103f9575f80fd5b60043561040861024082610ca6565b505b8063f5b100ea036104905760018201546001600160a01b031633146104425760405163ce5a776b60e01b815260040160405180910390fd5b602436101561044f575f80fd5b60043561048e610489826001600160a01b03165f90815268a20d6e21d0e5255310602052604090205463ffffffff600160801b9091041690565b610810565b505b8063e2c79281036104f65760018201546001600160a01b031633146104c85760405163ce5a776b60e01b815260040160405180910390fd5b60043610156104d5575f80fd5b68a20d6e21d0e5255308546104f690600160401b900463ffffffff16610810565b8063b7a94eb80361050b5761050b6001610810565b005b348015610518575f80fd5b50610521610cf0565b60405161052e9190611bea565b60405180910390f35b348015610542575f80fd5b50610556610551366004611c32565b610d7f565b604051901515815260200161052e565b348015610571575f80fd5b5068a20d6e21d0e525530854600160601b90046001600160601b03165b60405190815260200161052e565b3480156105a7575f80fd5b506105566105b6366004611c5a565b610df3565b61050b610e93565b3480156105ce575f80fd5b506105566105dd366004611c93565b610ee0565b3480156105ed575f80fd5b5061050b6105fc366004611cac565b610f2e565b34801561060c575f80fd5b506040516012815260200161052e565b348015610627575f80fd5b5061050b610f3b565b34801561063b575f80fd5b5061050b61064a366004611c32565b610f4e565b34801561065a575f80fd5b5068a20d6e21d0e5255309546001600160a01b03165b6040516001600160a01b03909116815260200161052e565b61050b610f64565b34801561069b575f80fd5b5061050b6106aa366004611ccb565b610f9d565b3480156106ba575f80fd5b5061058e6106c9366004611c93565b6001600160a01b03165f90815268a20d6e21d0e52553106020526040902054600160a01b90046001600160601b031690565b61050b610fb7565b34801561070e575f80fd5b50638b78c6d81954610670565b348015610726575f80fd5b50610521610fc8565b34801561073a575f80fd5b50610556610749366004611c32565b610fd7565b348015610759575f80fd5b50610521610768366004611d37565b610fec565b348015610778575f80fd5b5061058e610787366004611d4e565b6001600160a01b039182165f90815268a20d6e21d0e525530d6020908152604080832093909416825291909152205490565b61050b6107c7366004611c93565b611035565b61050b6107da366004611c93565b61106f565b3480156107ea575f80fd5b5061058e6107f9366004611c93565b63389a75e1600c9081525f91909152602090205490565b805f5260205ff35b5f61082282611095565b61083f5760405163677510db60e11b815260040160405180910390fd5b610848826110b1565b92915050565b68a20d6e21d0e52553086001600160a01b03841661087f57604051633a954ecd60e21b815260040160405180910390fd5b5f816002015f6108b8846007016108968860011b90565b600381901c5f90815260209290925260409091205460059190911b60e0161c90565b63ffffffff16815260208101919091526040015f20546001600160a01b039081169150861681146108fb5760405162a1148160e81b815260040160405180910390fd5b856001600160a01b0316836001600160a01b03161461097d576001600160a01b038087165f90815260038401602090815260408083209387168352929052205460ff1661097d575f8481526004830160205260409020546001600160a01b0384811691161461097d57604051632ce44b5f60e11b815260040160405180910390fd5b5f61098787611104565b90505f61099387611104565b8254909150670de0b6b3a76400009083906014906109c2908490600160a01b90046001600160601b0316611d93565b82546101009290920a6001600160601b0381810219909316918316021790915582546001600160a01b038116670de0b6b3a7640000600160a01b928390048416019092160217825550610a2660078501600188901b610a21848b61116f565b61120f565b5f868152600485016020908152604080832080546001600160a01b03191690556001600160a01b038b168352600687018252808320855463ffffffff60801b198116600160801b9182900463ffffffff9081165f1901908116909202178755631fffffff600382901c168552925282205460059190911b60e0161c6001600160a01b038a165f908152600687016020526040902063ffffffff919091169150610ae790610adb6007880160018b811b01610896565b63ffffffff168361120f565b8154600163ffffffff600160801b80840482169283019091160263ffffffff60801b19909216919091178355610b3960078701610b2784600190811b0190565b610a2160078a0160018d811b01610896565b6001600160a01b0389165f9081526006870160205260409020610b5d90828a61120f565b610b706007870160018a811b018361120f565b5050866001600160a01b0316886001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef670de0b6b3a7640000604051610bbf91815260200190565b60405180910390a35050505050505050565b5f68a20d6e21d0e52553088168a20d6e21d0e525530a81610bff68a20d6e21d0e525530f600189901b610896565b63ffffffff16815260208101919091526040015f20546001600160a01b03908116915084168114610c71576001600160a01b038082165f90815260038401602090815260408083209388168352929052205460ff16610c71576040516367d9dca160e11b815260040160405180910390fd5b5f8581526004909201602052604090912080546001600160a01b0387166001600160a01b031990911617905590509392505050565b5f610cb082611095565b610ccd5760405163677510db60e11b815260040160405180910390fd5b505f90815268a20d6e21d0e525530c60205260409020546001600160a01b031690565b60605f8054610cfe90611db3565b80601f0160208091040260200160405190810160405280929190818152602001828054610d2a90611db3565b8015610d755780601f10610d4c57610100808354040283529160200191610d75565b820191905f5260205f20905b815481529060010190602001808311610d5857829003601f168201915b5050505050905090565b5f8068a20d6e21d0e5255308335f81815260058301602090815260408083206001600160a01b038a16808552908352928190208890555187815293945090927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a35060019392505050565b6001600160a01b0383165f90815268a20d6e21d0e525530d6020908152604080832033845290915281205468a20d6e21d0e5255308905f198114610e7c5780841115610e52576040516313be252b60e01b815260040160405180910390fd5b6001600160a01b0386165f9081526005830160209081526040808320338452909152902084820390555b610e87868686611241565b50600195945050505050565b5f6202a30067ffffffffffffffff164201905063389a75e1600c52335f52806020600c2055337fdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d5f80a250565b6001600160a01b0381165f90815268a20d6e21d0e5255310602052604081208054600160581b90046001168203610f1b57823b5b9392505050565b54600160581b9004600216151592915050565b610f3833826116fd565b50565b610f4361178c565b610f4c336117a6565b565b610f5661178c565b610f6082826117bf565b5050565b63389a75e1600c52335f525f6020600c2055337ffa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c925f80a2565b610fa561178c565b6002610fb2828483611e44565b505050565b610fbf61178c565b610f4c5f611ac8565b606060018054610cfe90611db3565b5f610fe3338484611241565b50600192915050565b606060028054610ffb90611db3565b15905061103057600261100d83611b05565b60405160200161101e929190611efe565b60405160208183030381529060405290505b919050565b61103d61178c565b63389a75e1600c52805f526020600c20805442111561106357636f5e88185f526004601cfd5b5f9055610f3881611ac8565b61107761178c565b8060601b61108c57637448fbae5f526004601cfd5b610f3881611ac8565b5f806110a0836110b1565b6001600160a01b0316141592915050565b5f68a20d6e21d0e525530868a20d6e21d0e525530a826110de68a20d6e21d0e525530f600187901b610896565b63ffffffff16815260208101919091526040015f20546001600160a01b03169392505050565b6001600160a01b0381165f90815268a20d6e21d0e5255310602052604081208054909168a20d6e21d0e525530891600160581b90046001169003611169576001833b1561114f576002175b825460ff909116600160581b0260ff60581b199091161782555b50919050565b8154600160601b900463ffffffff1668a20d6e21d0e52553085f82900361120857805481905f906111a59063ffffffff16611f81565b825463ffffffff8083166101009490940a848102910219909116179092558554600160601b820263ffffffff60601b199091161786555f908152600283016020526040902080546001600160a01b0386166001600160a01b031990911617905591505b5092915050565b826020528160031c5f5260405f206007831660051b815463ffffffff8482841c188116831b8218845550505050505050565b6001600160a01b03821661126857604051633a954ecd60e21b815260040160405180910390fd5b68a20d6e21d0e52553085f61127c85611104565b90505f61128885611104565b90506112bd6040518060c001604052805f81526020015f81526020015f81526020015f81526020015f81526020015f81525090565b825463ffffffff600160801b808304821660808501528454041660a08301526001600160601b03600160a01b909104166040820181905285111561131457604051631e9acf1760e31b815260040160405180910390fd5b6040810180518690039081905283546001600160601b03808316600160a01b9081026001600160a01b03938416178755855481810483168a0160608701819052909216029116178355608082015161137a91670de0b6b3a7640000900480821191030290565b81528154600160581b90046002165f036113e857856001600160a01b0316876001600160a01b0316036113b557805160808201510360a08201525b6113e2670de0b6b3a76400008260600151816113d3576113d3611fa3565b048260a0015180821191030290565b60208201525b5f61142f8260200151835f01510160408051808201909152606081525f60208201526040805101828152806020018360051b81016040528183528083602001525050919050565b825190915015611524576001600160a01b0388165f908152600686016020526040902060808301518351875463ffffffff600160401b808304821684900382160263ffffffff60401b199092169190911789558754918303908116600160801b0263ffffffff60801b199092169190911787555b5f1991909101600381901c5f90815260208490526040812054919291600584901b60e0161c63ffffffff1690506114df89600701825f80611b47565b5f81815260048a016020908152604090912080546001600160a01b0319169055858101805160089390931b60608f901b176001178352910190528082036114a3575050505b602082015115611685576001600160a01b0387165f9081526006860160209081526040822060a085015191850151909290820190611562878c61116f565b8954602088015163ffffffff60401b19821663ffffffff600160401b80850482169093018116909202178c55895463ffffffff60801b1916600160801b86831602178a55919250670de0b6b3a7640000600160601b82046001600160601b03160491640100000000909104165b6115e08b6007016108968360011b90565b63ffffffff16156115ff57600101818111156115fa575060015b6115cf565b61160a86868361120f565b61161f8b600701828588806001019950611b47565b611648878e835f8360200151818360081b8560601b171781526020810185602001525050505050565b60010181811115611657575060015b8385036115cf578a5463ffffffff9091166401000000000267ffffffff0000000019909116178a5550505050505b805151156116a65760018501546116a69082906001600160a01b0316611b8b565b50856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef876040516116ec91815260200190565b60405180910390a350505050505050565b5f61170783611104565b8054909150600160581b900460021615158215151461174257805460ff600160581b80830482166002189091160260ff60581b199091161781555b826001600160a01b03167fb5a1de456fff688115a4f75380060c23c8532d14ff85f687cc871456d64203938360405161177f911515815260200190565b60405180910390a2505050565b638b78c6d819543314610f4c576382b429005f526004601cfd5b5f385f3847855af1610f385763b12d13eb5f526004601cfd5b6001600160a01b0382166117e657604051633a954ecd60e21b815260040160405180910390fd5b68a20d6e21d0e52553085f6117fa84611104565b8254909150600160601b90046001600160601b031683016b0de0b6b39983494c589bffff84118061183657506b0de0b6b39983494c589bffff81115b156118545760405163e5cfe95760e01b815260040160405180910390fd5b82546001600160601b03808316600160601b026bffffffffffffffffffffffff60601b199092169190911784558254600160a01b80820483168701928316026001600160a01b0390911617808455600160581b90046002165f03611a80576001600160a01b0386165f908152600685016020526040812084549091600160801b90910463ffffffff1690670de0b6b3a7640000840490505f61192f8383038484110260408051808201909152606081525f60208201526040805101828152806020018360051b81016040528183528083602001525050919050565b80515190915015611a7b578754670de0b6b3a7640000600160601b9091046001600160601b0316045f611962898d61116f565b8a5484515163ffffffff60401b19821663ffffffff600160401b80850482169093018116909202178d558b5463ffffffff60801b1916600160801b88831602178c559192506401000000009004165b6119c28b6007016108968360011b90565b63ffffffff16156119e157600101828111156119dc575060015b6119b1565b6119ec87878361120f565b611a018b600701828489806001019a50611b47565b611a2a848e835f8360200151818360081b8560601b171781526020810185602001525050505050565b60010182811115611a39575060015b8486036119b1578a5467ffffffff00000000191664010000000063ffffffff831602178b5560018b0154611a779085906001600160a01b0316611b8b565b5050505b505050505b50506040518381526001600160a01b038516905f907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a350505050565b638b78c6d81980546001600160a01b039092169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a355565b60606080604051019050602081016040525f8152805f19835b928101926030600a8206018453600a900480611b1e575050819003601f19909101908152919050565b8163ffffffff168160201b17846020528360021c5f5260405f206003851660061b815467ffffffffffffffff8482841c188116831b82188455505050505050505050565b81516040810363263c69d68152602080820152815160051b604401915060208183601c84015f875af1600182511416611bc2575f81fd5b50505050565b5f5b83811015611be2578181015183820152602001611bca565b50505f910152565b602081525f8251806020840152611c08816040850160208701611bc8565b601f01601f19169190910160400192915050565b80356001600160a01b0381168114611030575f80fd5b5f8060408385031215611c43575f80fd5b611c4c83611c1c565b946020939093013593505050565b5f805f60608486031215611c6c575f80fd5b611c7584611c1c565b9250611c8360208501611c1c565b9150604084013590509250925092565b5f60208284031215611ca3575f80fd5b610f1482611c1c565b5f60208284031215611cbc575f80fd5b81358015158114610f14575f80fd5b5f8060208385031215611cdc575f80fd5b823567ffffffffffffffff80821115611cf3575f80fd5b818501915085601f830112611d06575f80fd5b813581811115611d14575f80fd5b866020828501011115611d25575f80fd5b60209290920196919550909350505050565b5f60208284031215611d47575f80fd5b5035919050565b5f8060408385031215611d5f575f80fd5b611d6883611c1c565b9150611d7660208401611c1c565b90509250929050565b634e487b7160e01b5f52601160045260245ffd5b6001600160601b0382811682821603908082111561120857611208611d7f565b600181811c90821680611dc757607f821691505b60208210810361116957634e487b7160e01b5f52602260045260245ffd5b634e487b7160e01b5f52604160045260245ffd5b601f821115610fb257805f5260205f20601f840160051c81016020851015611e1e5750805b601f840160051c820191505b81811015611e3d575f8155600101611e2a565b5050505050565b67ffffffffffffffff831115611e5c57611e5c611de5565b611e7083611e6a8354611db3565b83611df9565b5f601f841160018114611ea1575f8515611e8a5750838201355b5f19600387901b1c1916600186901b178355611e3d565b5f83815260208120601f198716915b82811015611ed05786850135825560209485019460019092019101611eb0565b5086821015611eec575f1960f88860031b161c19848701351681555b505060018560011b0183555050505050565b5f808454611f0b81611db3565b60018281168015611f235760018114611f3857611f64565b60ff1984168752821515830287019450611f64565b885f526020805f205f5b85811015611f5b5781548a820152908401908201611f42565b50505082870194505b505050508351611f78818360208801611bc8565b01949350505050565b5f63ffffffff808316818103611f9957611f99611d7f565b6001019392505050565b634e487b7160e01b5f52601260045260245ffdfea264697066735822122099a3f6470ff478c53a7d7e5366155f004e275781dd42003607ab67eae718ce2064736f6c63430008180033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000021e19e0c9bab24000000000000000000000000000007a6aa63b8c256d14f932c5d85f08f23557b9bbcc00000000000000000000000000000000000000000000000000000000000000075061444e6f726100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000350444e0000000000000000000000000000000000000000000000000000000000
-----Decoded View---------------
Arg [0] : name_ (string): PaDNora
Arg [1] : symbol_ (string): PDN
Arg [2] : initialTokenSupply (uint96): 10000000000000000000000
Arg [3] : initialSupplyOwner (address): 0x7A6AA63b8C256D14f932c5d85f08f23557B9bBcC
-----Encoded View---------------
8 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000080
Arg [1] : 00000000000000000000000000000000000000000000000000000000000000c0
Arg [2] : 00000000000000000000000000000000000000000000021e19e0c9bab2400000
Arg [3] : 0000000000000000000000007a6aa63b8c256d14f932c5d85f08f23557b9bbcc
Arg [4] : 0000000000000000000000000000000000000000000000000000000000000007
Arg [5] : 5061444e6f726100000000000000000000000000000000000000000000000000
Arg [6] : 0000000000000000000000000000000000000000000000000000000000000003
Arg [7] : 50444e0000000000000000000000000000000000000000000000000000000000
Deployed Bytecode Sourcemap
199:1370:5:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6559:20:0;30451:22;37103:20;30551:3;30528:26;30634:10;30620:24;;;30616:377;;30679:14;;;;-1:-1:-1;;;;;30679:14:0;30665:10;:28;30661:58;;30702:17;;-1:-1:-1;;;30702:17:0;;;;;;;;;;;30661:58;30756:4;30738:8;:22;30734:36;;;30762:8;;;30734:36;30833:4;37103:20;-1:-1:-1;;;;;30936:26:0;;;30787:13;30936:26;;;:19;;;:26;;;;;;;;30904:4;37103:20;30936:36;;;;;;;;;;;30928:53;;30936:36;;:44;;30979:1;30936:44;;;30975:1;30936:44;30928:53;;:7;:53::i;:::-;30646:347;;30616:377;31039:10;31053;31039:24;31035:262;;31098:14;;;;-1:-1:-1;;;;;31098:14:0;31084:10;:28;31080:58;;31121:17;;-1:-1:-1;;;31121:17:0;;;;;;;;;;;31080:58;31175:4;31157:8;:22;31153:36;;;31181:8;;;31153:36;31233:4;37103:20;31255:30;31271:12;37103:20;31271:8;:12::i;:::-;-1:-1:-1;;;;;31255:30:0;:7;:30::i;:::-;31065:232;31035:262;31375:10;31389;31375:24;31371:502;;31434:14;;;;-1:-1:-1;;;;;31434:14:0;31420:10;:28;31416:58;;31457:17;;-1:-1:-1;;;31457:17:0;;;;;;;;;;;31416:58;31511:4;31493:8;:22;31489:36;;;31517:8;;;31489:36;31587:4;37103:20;31652:4;37103:20;31701:4;37103:20;31771:4;37103:20;31795:41;37103:20;;;;31795:16;:41::i;:::-;31851:10;31859:1;31851:7;:10::i;:::-;31401:472;;;;31371:502;31942:10;31956;31942:24;31938:451;;32001:14;;;;-1:-1:-1;;;;;32001:14:0;31987:10;:28;31983:58;;32024:17;;-1:-1:-1;;;32024:17:0;;;;;;;;;;;31983:58;32078:4;32060:8;:22;32056:36;;;32084:8;;;32056:36;-1:-1:-1;;;;;32282:4:0;37103:20;29571:47;;;;;;;:36;:47;;;;;;;;32157:4;37103:20;29571:57;;;;;;;;;;:68;;-1:-1:-1;;29571:68:0;32207:4;37103:20;32193:24;;29571:68;;;;;;32193:24;32367:10;32375:1;32367:7;:10::i;:::-;31968:421;;;31938:451;32454:10;32468;32454:24;32450:427;;32513:14;;;;-1:-1:-1;;;;;32513:14:0;32499:10;:28;32495:58;;32536:17;;-1:-1:-1;;;32536:17:0;;;;;;;;;;;32495:58;32590:4;32572:8;:22;32568:36;;;32596:8;;;32568:36;32669:4;37103:20;32718:4;37103:20;32788:4;37103:20;32812:53;32828:35;37103:20;;;32828:11;:35::i;32812:53::-;32480:397;;;32450:427;32927:10;32941;32927:24;32923:266;;32986:14;;;;-1:-1:-1;;;;;32986:14:0;32972:10;:28;32968:58;;33009:17;;-1:-1:-1;;;33009:17:0;;;;;;;;;;;32968:58;33063:4;33045:8;:22;33041:36;;;33069:8;;;33041:36;33121:4;37103:20;33143:34;33159:16;37103:20;33159:12;:16::i;33143:34::-;32953:236;32923:266;33240:10;33254;33240:24;33236:282;;33299:14;;;;-1:-1:-1;;;;;33299:14:0;33285:10;:28;33281:58;;33322:17;;-1:-1:-1;;;33322:17:0;;;;;;;;;;;33281:58;33376:4;33358:8;:22;33354:36;;;33382:8;;;33354:36;33453:4;37103:20;33477:29;33485:20;37103;-1:-1:-1;;;;;27387:37:0;27360:7;27387:37;;;:30;:37;;;;;:49;;-1:-1:-1;;;27387:49:0;;;;;27291:153;33485:20;33477:7;:29::i;:::-;33266:252;33236:282;33564:10;33578;33564:24;33560:209;;33623:14;;;;-1:-1:-1;;;;;33623:14:0;33609:10;:28;33605:58;;33646:17;;-1:-1:-1;;;33646:17:0;;;;;;;;;;;33605:58;33700:4;33682:8;:22;33678:36;;;33706:8;;;33678:36;6559:20;27199:33;33731:26;;-1:-1:-1;;;27199:33:0;;;;33477:7;:29::i;33731:26::-;33816:10;33830;33816:24;33812:67;;33857:10;33865:1;33857:7;:10::i;:::-;30440:3458;736:92:5;;;;;;;;;;;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;9960:275:0;;;;;;;;;;-1:-1:-1;9960:275:0;;;;;:::i;:::-;;:::i;:::-;;;1272:14:6;;1265:22;1247:41;;1235:2;1220:18;9960:275:0;1107:187:6;9237:126:0;;;;;;;;;;-1:-1:-1;6559:20:0;9324:30;-1:-1:-1;;;9324:30:0;;-1:-1:-1;;;;;9324:30:0;9237:126;;;1445:25:6;;;1433:2;1418:18;9237:126:0;1299:177:6;11595:512:0;;;;;;;;;;-1:-1:-1;11595:512:0;;;;;:::i;:::-;;:::i;9212:630:3:-;;;:::i;24386:282:0:-;;;;;;;;;;-1:-1:-1;24386:282:0;;;;;:::i;:::-;;:::i;24780:100::-;;;;;;;;;;-1:-1:-1;24780:100:0;;;;;:::i;:::-;;:::i;9096:76::-;;;;;;;;;;-1:-1:-1;9096:76:0;;9162:2;2425:36:6;;2413:2;2398:18;9096:76:0;2283:184:6;1464:102:5;;;;;;;;;;;;;:::i;1252:95::-;;;;;;;;;;-1:-1:-1;1252:95:5;;;;;:::i;:::-;;:::i;26943:119:0:-;;;;;;;;;;-1:-1:-1;27023:31:0;;-1:-1:-1;;;;;27023:31:0;26943:119;;;-1:-1:-1;;;;;2636:32:6;;;2618:51;;2606:2;2591:18;26943:119:0;2472:203:6;9927:466:3;;;:::i;1355:101:5:-;;;;;;;;;;-1:-1:-1;1355:101:5;;;;;:::i;:::-;;:::i;9432:143:0:-;;;;;;;;;;-1:-1:-1;9432:143:0;;;;;:::i;:::-;-1:-1:-1;;;;;9522:37:0;9495:7;9522:37;;;:30;:37;;;;;:45;-1:-1:-1;;;9522:45:0;;-1:-1:-1;;;;;9522:45:0;;9432:143;8947:102:3;;;:::i;11652:187::-;;;;;;;;;;-1:-1:-1;;;11803:18:3;11652:187;;836:96:5;;;;;;;;;;;;;:::i;10748:150:0:-;;;;;;;;;;-1:-1:-1;10748:150:0;;;;;:::i;:::-;;:::i;940:237:5:-;;;;;;;;;;-1:-1:-1;940:237:5;;;;;:::i;:::-;;:::i;9673:151:0:-;;;;;;;;;;-1:-1:-1;9673:151:0;;;;;:::i;:::-;-1:-1:-1;;;;;9772:35:0;;;9745:7;9772:35;;;:28;:35;;;;;;;;:44;;;;;;;;;;;;;9673:151;10584:724:3;;;;;;:::i;:::-;;:::i;8521:358::-;;;;;;:::i;:::-;;:::i;11945:449::-;;;;;;;;;;-1:-1:-1;11945:449:3;;;;;:::i;:::-;12224:19;12218:4;12211:33;;;12068:14;12258:26;;;;12370:4;12354:21;;12348:28;;11945:449;37234:185:0;37367:1;37361:4;37354:15;37396:4;37390;37383:18;27903:163;27964:7;27989:11;27997:2;27989:7;:11::i;:::-;27984:44;;28009:19;;-1:-1:-1;;;28009:19:0;;;;;;;;;;;27984:44;28046:12;28055:2;28046:8;:12::i;:::-;28039:19;27903:163;-1:-1:-1;;27903:163:0:o;21376:1507::-;6559:20;-1:-1:-1;;;;;21570:16:0;;21566:52;;21595:23;;-1:-1:-1;;;21595:23:0;;;;;;;;;;;21566:52;21631:13;21647:1;:16;;:49;21664:31;21669:1;:4;;21675:19;21691:2;37800:1;37795:6;;37710:99;21675:19;38193:1;38184:10;;;38134:13;38176:19;;;;;;;;;;;;;38215:1;38200:16;;;;;;38176:41;;38060:166;21664:31;21647:49;;;;;;;;;;;;;-1:-1:-1;21647:49:0;;-1:-1:-1;;;;;21647:49:0;;;;-1:-1:-1;21713:13:0;;;;21709:54;;21735:28;;-1:-1:-1;;;21735:28:0;;;;;;;;;;;21709:54;21793:4;-1:-1:-1;;;;;21780:17:0;:9;-1:-1:-1;;;;;21780:17:0;;21776:250;;-1:-1:-1;;;;;21819:25:0;;;;;;;:19;;;:25;;;;;;;;:36;;;;;;;;;;;;21814:201;;21893:20;;;;:16;;;:20;;;;;;-1:-1:-1;;;;;21880:33:0;;;21893:20;;21880:33;21876:124;;21945:35;;-1:-1:-1;;;21945:35:0;;;;;;;;;;;21876:124;22038:35;22076:18;22089:4;22076:12;:18::i;:::-;22038:56;;22105:33;22141:16;22154:2;22141:12;:16::i;:::-;22170:39;;22105:52;;-1:-1:-1;3616:8:0;;22170:39;;:23;;:39;;3616:8;;-1:-1:-1;;;22170:39:0;;-1:-1:-1;;;;;22170:39:0;;:::i;:::-;;;;;;;;-1:-1:-1;;;;;22170:39:0;;;;;;;;;;;;;;;22247:37;;-1:-1:-1;;;;;22247:37:0;;3616:8;-1:-1:-1;;;22247:37:0;;;;;;;;;;;;;;-1:-1:-1;22301:76:0;22306:4;;;-1:-1:-1;37795:6:0;;;22333:43;22358:13;22373:2;22333:24;:43::i;:::-;22301:4;:76::i;:::-;22399:20;;;;:16;;;:20;;;;;;;;22392:27;;-1:-1:-1;;;;;;22392:27:0;;;-1:-1:-1;;;;;22461:13:0;;;;:7;;;:13;;;;;22476:29;;-1:-1:-1;;;;22476:29:0;;-1:-1:-1;;;22476:29:0;;;;;;;;-1:-1:-1;;22476:29:0;;;;;;;;;;38184:10;38193:1;38184:10;;;;38176:19;;;;;;;38215:1;38200:16;;;;;;38176:41;-1:-1:-1;;;;;22526:13:0;;;;;;:7;;;:13;;;;;22436:70;;;;;;-1:-1:-1;22521:67:0;;22541:27;22546:4;;;37967:1;37962:6;;;37961:12;22552:15;37855:137;22541:27;22521:67;;22577:9;22521:4;:67::i;:::-;22617:27;;;;-1:-1:-1;;;22617:27:0;;;;;;;;;;;;-1:-1:-1;;;;22617:27:0;;;;;;;;;22659:63;22664:4;;;22670:22;22682:9;37967:1;37962:6;;;37961:12;;37855:137;22670:22;22694:27;22699:4;;;37967:1;37962:6;;;37961:12;22705:15;37855:137;22659:63;-1:-1:-1;;;;;22742:11:0;;;;;;:7;;;:11;;;;;22737:32;;22755:1;22765:2;22737:4;:32::i;:::-;22784:38;22789:4;;;37967:1;37962:6;;;37961:12;22819:1;22784:4;:38::i;:::-;22222:612;;22866:2;-1:-1:-1;;;;;22851:24:0;22860:4;-1:-1:-1;;;;;22851:24:0;;3616:8;22851:24;;;;1445:25:6;;1433:2;1418:18;;1299:177;22851:24:0;;;;;;;;21499:1384;;;;21376:1507;;;;:::o;28787:527::-;28909:7;6559:20;28909:7;29006:16;28909:7;29023:31;29028:4;37800:1;37795:6;;;29034:19;37710:99;29023:31;29006:49;;;;;;;;;;;;;-1:-1:-1;29006:49:0;;-1:-1:-1;;;;;29006:49:0;;;;-1:-1:-1;29072:18:0;;;;29068:171;;-1:-1:-1;;;;;29112:26:0;;;;;;;:19;;;:26;;;;;;;;:37;;;;;;;;;;;;29107:121;;29177:35;;-1:-1:-1;;;29177:35:0;;;;;;;;;;;29107:121;29251:20;;;;:16;;;;:20;;;;;;:30;;-1:-1:-1;;;;;29251:30:0;;-1:-1:-1;;;;;;29251:30:0;;;;;;29301:5;-1:-1:-1;28787:527:0;;;;;:::o;28375:192::-;28440:7;28465:11;28473:2;28465:7;:11::i;:::-;28460:44;;28485:19;;-1:-1:-1;;;28485:19:0;;;;;;;;;;;28460:44;-1:-1:-1;28522:37:0;;;;:33;:37;;;;;;-1:-1:-1;;;;;28522:37:0;;28375:192::o;736:92:5:-;782:13;815:5;808:12;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;736:92;:::o;9960:275:0:-;10034:4;;6559:20;10119:10;10107:23;;;;:11;;;:23;;;;;;;;-1:-1:-1;;;;;10107:32:0;;;;;;;;;;;;:41;;;10166:37;1445:25:6;;;10107:11:0;;-1:-1:-1;10107:32:0;;10166:37;;1418:18:6;10166:37:0;;;;;;;-1:-1:-1;10223:4:0;;9960:275;-1:-1:-1;;;9960:275:0:o;11595:512::-;-1:-1:-1;;;;;11774:17:0;;11683:4;11774:17;;;:11;:17;;;;;;;;11792:10;11774:29;;;;;;;;6559:20;;-1:-1:-1;;11820:28:0;;11816:220;;11878:7;11869:6;:16;11865:52;;;11894:23;;-1:-1:-1;;;11894:23:0;;;;;;;;;;;11865:52;-1:-1:-1;;;;;11961:17:0;;;;;;:11;;;:17;;;;;;;;11979:10;11961:29;;;;;;;11993:16;;;11961:48;;11816:220;12048:27;12058:4;12064:2;12068:6;12048:9;:27::i;:::-;-1:-1:-1;12095:4:0;;11595:512;-1:-1:-1;;;;;11595:512:0:o;9212:630:3:-;9307:15;8137:9;9325:46;;:15;:46;9307:64;;9543:19;9537:4;9530:33;9594:8;9588:4;9581:22;9651:7;9644:4;9638;9628:21;9621:38;9800:8;9753:45;9750:1;9747;9742:67;9443:381;9212:630::o;24386:282:0:-;-1:-1:-1;;;;;24487:33:0;;24446:4;24487:33;;;:30;:33;;;;;24535:7;;-1:-1:-1;;;24535:7:0;;4000:6;24535:40;:45;;24531:69;;36813:14;;24589:11;24582:18;24386:282;-1:-1:-1;;;24386:282:0:o;24531:69::-;24618:7;-1:-1:-1;;;24618:7:0;;4137:6;24618:37;:42;;;24386:282;-1:-1:-1;;24386:282:0:o;24780:100::-;24840:32;24852:10;24864:7;24840:11;:32::i;:::-;24780:100;:::o;1464:102:5:-;12791:13:3;:11;:13::i;:::-;1512:46:5::1;1547:10;1512:34;:46::i;:::-;1464:102::o:0;1252:95::-;12791:13:3;:11;:13::i;:::-;1322:17:5::1;1328:2;1332:6;1322:5;:17::i;:::-;1252:95:::0;;:::o;9927:466:3:-;10133:19;10127:4;10120:33;10180:8;10174:4;10167:22;10233:1;10226:4;10220;10210:21;10203:32;10366:8;10320:44;10317:1;10314;10309:66;9927:466::o;1355:101:5:-;12791:13:3;:11;:13::i;:::-;1429:8:5::1;:19;1440:8:::0;;1429;:19:::1;:::i;:::-;;1355:101:::0;;:::o;8947:102:3:-;12791:13;:11;:13::i;:::-;9020:21:::1;9038:1;9020:9;:21::i;836:96:5:-:0;884:13;917:7;910:14;;;;;:::i;10748:150:0:-;10818:4;10835:33;10845:10;10857:2;10861:6;10835:9;:33::i;:::-;-1:-1:-1;10886:4:0;10748:150;;;;:::o;940:237:5:-;1005:20;1048:8;1042:22;;;;;:::i;:::-;:27;;-1:-1:-1;1038:132:5;;1119:8;1129:27;1148:7;1129:18;:27::i;:::-;1102:55;;;;;;;;;:::i;:::-;;;;;;;;;;;;;1086:72;;1038:132;940:237;;;:::o;10584:724:3:-;12791:13;:11;:13::i;:::-;10822:19:::1;10816:4;10809:33;10869:12;10863:4;10856:26;10932:4;10926;10916:21;11040:12;11034:19;11021:11;11018:36;11015:160;;;11087:10;11081:4;11074:24;11155:4;11149;11142:18;11015:160;11254:1;11233:23:::0;;11277::::1;11287:12:::0;11277:9:::1;:23::i;8521:358::-:0;12791:13;:11;:13::i;:::-;8696:8:::1;8692:2;8688:17;8678:153;;8739:10;8733:4;8726:24;8811:4;8805;8798:18;8678:153;8852:19;8862:8;8852:9;:19::i;28118:118:0:-:0;28178:4;;28202:12;28211:2;28202:8;:12::i;:::-;-1:-1:-1;;;;;28202:26:0;;;;28118:118;-1:-1:-1;;28118:118:0:o;27583:199::-;27644:7;6559:20;27725:16;27644:7;27742:31;27747:4;37800:1;37795:6;;;27753:19;37710:99;27742:31;27725:49;;;;;;;;;;;;;-1:-1:-1;27725:49:0;;-1:-1:-1;;;;;27725:49:0;;27583:199;-1:-1:-1;;;27583:199:0:o;25559:407::-;-1:-1:-1;;;;;25710:16:0;;25618:21;25710:16;;;:13;:16;;;;;25743:7;;25710:16;;6559:20;;-1:-1:-1;;;25743:7:0;;4000:6;25743:40;:45;;25739:220;;4000:6;36813:14;;25864:53;;;4137:6;25881:36;25864:53;25932:15;;;;;;-1:-1:-1;;;25932:15:0;-1:-1:-1;;;;25932:15:0;;;;;;25739:220;25641:325;25559:407;;;:::o;26132:469::-;26372:26;;-1:-1:-1;;;26372:26:0;;;;6559:20;26266:19;26413:17;;;26409:185;;26462:14;;26464:1;;:12;;26462:14;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;26491:41;;-1:-1:-1;;;26491:41:0;;-1:-1:-1;;;;26491:41:0;;;;;;-1:-1:-1;26547:30:0;;;:16;;;:30;;;;;:35;;-1:-1:-1;;;;;26547:35:0;;-1:-1:-1;;;;;;26547:35:0;;;;;;26462:14;-1:-1:-1;26409:185:0;26292:309;26132:469;;;;:::o;38294:542::-;38460:8;38454:4;38447:22;38503:5;38500:1;38496:13;38490:4;38483:27;38549:4;38543;38533:21;38612:1;38605:5;38601:13;38598:1;38594:21;38675:1;38669:8;38723:10;38808:5;38804:1;38801;38797:9;38793:21;38790:1;38786:29;38783:1;38779:37;38776:1;38772:45;38769:1;38762:56;;;;;38294:542;;;:::o;17683:3268::-;-1:-1:-1;;;;;17776:16:0;;17772:52;;17801:23;;-1:-1:-1;;;17801:23:0;;;;;;;;;;;17772:52;6559:20;17837:22;17931:18;17944:4;17931:12;:18::i;:::-;17893:56;;17960:33;17996:16;18009:2;17996:12;:16::i;:::-;17960:52;;18025:23;-1:-1:-1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;18025:23:0;18079:27;;;-1:-1:-1;;;18079:27:0;;;;;18059:17;;;:47;18135:25;;;;18117:15;;;:43;-1:-1:-1;;;;;;;;18187:23:0;;;;18171:13;;;:39;;;18227:22;;18223:56;;;18258:21;;-1:-1:-1;;;18258:21:0;;;;;;;;;;;18223:56;18317:13;;;:23;;;;;;;;;18355:47;;-1:-1:-1;;;;;18355:47:0;;;-1:-1:-1;;;18355:47:0;;;-1:-1:-1;;;;;18355:47:0;;;;;;18462:21;;;;;;;:30;;18448:11;;;:44;;;18417:76;;;;;;;;;18544:17;;;;18530:54;;3616:8;;18563:20;37632:8;;;37642:9;;37628:24;;37466:204;18530:54;18510:74;;18605:19;;-1:-1:-1;;;18605:19:0;;4137:6;18605:49;18510:17;18605:54;18601:255;;18692:2;-1:-1:-1;;;;;18684:10:0;:4;-1:-1:-1;;;;;18684:10:0;;18680:71;;18734:17;;18714;;;;:37;18696:15;;;:55;18680:71;18790:50;3616:8;18804:1;:11;;;:18;;;;;:::i;:::-;;18824:1;:15;;;37632:8;;;37642:9;;37628:24;;37466:204;18790:50;18770:17;;;:70;18601:255;18872:29;18904:56;18942:1;:17;;;18922:1;:17;;;:37;-1:-1:-1;;;;;;;;;;;;;;;;;34825:4:0;34818;34812:11;34808:22;34901:1;34895:4;34888:15;34941:4;34935;34931:15;34992:1;34989;34985:9;34977:6;34973:22;34967:4;34960:36;35020:4;35017:1;35010:15;35060:6;35056:1;35050:4;35046:12;35039:28;;;34635:450;;;;18904:56;18981:17;;18872:88;;-1:-1:-1;18981:22:0;18977:703;;-1:-1:-1;;;;;19054:13:0;;19024:27;19054:13;;;:7;;;:13;;;;;19106:17;;;;19172;;19208:45;;;-1:-1:-1;;;19208:45:0;;;;;;;;;;;-1:-1:-1;;;;19208:45:0;;;;;;;;;19272;;19160:29;;;19272:45;;;-1:-1:-1;;;19272:45:0;-1:-1:-1;;;;19272:45:0;;;;;;;;;19367:298;-1:-1:-1;;19422:11:0;;;;38193:1;38184:10;;;19393;38176:19;;;;;;;;;;;19422:11;;;38215:1;38200:16;;;;;38176:41;19393;;;;19457:43;19485:1;:4;;19491:2;19495:1;19498;19457:27;:43::i;:::-;19530:20;;;;:16;;;:20;;;;;;;;19523:27;;-1:-1:-1;;;;;;19523:27:0;;;35415:12;;;35409:19;;35479:1;35475:10;;;;35467:2;35463:10;;;35460:26;-1:-1:-1;35457:39:0;35442:55;;35532:17;;35511:39;;19643:20;;;19367:298;;19005:675;;;18977:703;19700:17;;;;:22;19696:1068;;-1:-1:-1;;;;;19771:11:0;;19743:25;19771:11;;;:7;;;:11;;;;;;;19819:15;;;;19879:17;;;;19771:11;;19869:27;;;;19932:43;19957:13;19779:2;19932:24;:43::i;:::-;20013:13;;20124:17;;;;-1:-1:-1;;;;20097:45:0;;20065:13;-1:-1:-1;;;20097:45:0;;;;;;;;;;;;;;;;20161:41;;-1:-1:-1;;;;20161:41:0;-1:-1:-1;;;20161:41:0;;;;;;;19915:60;;-1:-1:-1;3616:8:0;-1:-1:-1;;;20013:13:0;;-1:-1:-1;;;;;20013:13:0;:20;;20065:13;;;;;20252:452;20285:31;20290:1;:4;;20296:19;20312:2;37800:1;37795:6;;37710:99;20285:31;:36;;;20278:123;;20354:4;;:15;;;20350:27;;;-1:-1:-1;20376:1:0;20350:27;20278:123;;;20423:34;20428:7;20437;20453:2;20423:4;:34::i;:::-;20480:65;20508:1;:4;;20514:2;20518:7;20534:9;;;;;;20480:27;:65::i;:::-;20568:40;20586:10;20598:2;20602;20606:1;35425;35419:4;35415:12;35409:19;35488:7;35482:2;35479:1;35475:10;35471:1;35467:2;35463:10;35460:26;35457:39;35449:6;35442:55;35544:4;35536:6;35532:17;35528:1;35522:4;35518:12;35511:39;;35191:377;;;;;20568:40;20635:4;;:15;;;20631:27;;;-1:-1:-1;20657:1:0;20631:27;20697:5;20686:7;:16;20252:452;;20722:26;;;;;;;;-1:-1:-1;;20722:26:0;;;;;;-1:-1:-1;;;;;19696:1068:0;20784:15;;:22;:27;20780:111;;20860:14;;;;20832:43;;20848:10;;-1:-1:-1;;;;;20860:14:0;20832:15;:43::i;:::-;18292:2610;20932:2;-1:-1:-1;;;;;20917:26:0;20926:4;-1:-1:-1;;;;;20917:26:0;;20936:6;20917:26;;;;1445:25:6;;1433:2;1418:18;;1299:177;20917:26:0;;;;;;;;17761:3190;;;;17683:3268;;;:::o;25099:289::-;25171:21;25195:15;25208:1;25195:12;:15::i;:::-;25226:7;;25171:39;;-1:-1:-1;;;;25226:7:0;;4137:6;25226:37;:42;;25225:53;;;;25221:124;;25295:38;;;-1:-1:-1;;;25295:38:0;;;;;4137:6;25295:38;;;;;-1:-1:-1;;;;25295:38:0;;;;;;25221:124;25371:1;-1:-1:-1;;;;;25360:20:0;;25374:5;25360:20;;;;1272:14:6;1265:22;1247:41;;1235:2;1220:18;;1107:187;25360:20:0;;;;;;;;25160:228;25099:289;;:::o;7442:364:3:-;-1:-1:-1;;7652:18:3;7642:8;7639:32;7629:159;;7705:10;7699:4;7692:24;7768:4;7762;7755:18;3589:415:4;3859:4;3847:10;3841:4;3829:10;3814:13;3810:2;3803:5;3798:66;3788:198;;3898:10;3892:4;3885:24;3966:4;3960;3953:18;12679:2150:0;-1:-1:-1;;;;;12754:16:0;;12750:52;;12779:23;;-1:-1:-1;;;12779:23:0;;;;;;;;;;;12750:52;6559:20;12815:22;12907:16;12920:2;12907:12;:16::i;:::-;12998:13;;12871:52;;-1:-1:-1;;;;12998:13:0;;-1:-1:-1;;;;;12998:13:0;12990:31;;3838:25;13040:20;;;:56;;;3838:25;13064:18;:32;13040:56;13036:125;;;13124:21;;-1:-1:-1;;;13124:21:0;;;;;;;;;;;13036:125;13175:42;;-1:-1:-1;;;;;13175:42:0;;;-1:-1:-1;;;13175:42:0;-1:-1:-1;;;;13175:42:0;;;;;;;;;13254:21;;-1:-1:-1;;;13254:21:0;;;;;:30;;13299:41;;;;-1:-1:-1;;;;;13299:41:0;;;;;;;-1:-1:-1;;;13361:19:0;;4137:6;13361:49;13175:13;13361:54;13357:1406;;-1:-1:-1;;;;;13464:11:0;;13436:25;13464:11;;;:7;;;:11;;;;;13512:25;;13464:11;;-1:-1:-1;;;13512:25:0;;;;;;3616:8;13572:9;:16;;-1:-1:-1;13607:29:0;13639:48;37642:9;;;37632:8;;;37628:24;-1:-1:-1;;;;;;;;;;;;;;;;;34825:4:0;34818;34812:11;34808:22;34901:1;34895:4;34888:15;34941:4;34935;34931:15;34992:1;34989;34985:9;34977:6;34973:22;34967:4;34960:36;35020:4;35017:1;35010:15;35060:6;35056:1;35050:4;35046:12;35039:28;;;34635:450;;;;13639:48;13712:15;;:22;13607:80;;-1:-1:-1;13712:27:0;13708:1040;;13783:13;;3616:8;-1:-1:-1;;;13783:13:0;;;-1:-1:-1;;;;;13783:13:0;:20;13764:16;13843:43;13868:13;13883:2;13843:24;:43::i;:::-;13922:13;;13985:15;;:22;-1:-1:-1;;;;13958:50:0;;13922:13;-1:-1:-1;;;13958:50:0;;;;;;;;;;;;;;;;14031:41;;-1:-1:-1;;;;14031:41:0;-1:-1:-1;;;14031:41:0;;;;;;;13826:60;;-1:-1:-1;13922:13:0;;;;14130:484;14167:31;14172:1;:4;;14178:19;14194:2;37800:1;37795:6;;37710:99;14167:31;:36;;;14160:131;;14240:4;;:15;;;14236:27;;;-1:-1:-1;14262:1:0;14236:27;14160:131;;;14317:34;14322:7;14331;14347:2;14317:4;:34::i;:::-;14378:65;14406:1;:4;;14412:2;14416:7;14432:9;;;;;;14378:27;:65::i;:::-;14470:40;14488:10;14500:2;14504;14508:1;35425;35419:4;35415:12;35409:19;35488:7;35482:2;35479:1;35475:10;35471:1;35467:2;35463:10;35460:26;35457:39;35449:6;35442:55;35544:4;35536:6;35532:17;35528:1;35522:4;35518:12;35511:39;;35191:377;;;;;14470:40;14541:4;;:15;;;14537:27;;;-1:-1:-1;14563:1:0;14537:27;14607:5;14596:7;:16;14130:484;;14636:26;;-1:-1:-1;;14636:26:0;;;;;;;;;-1:-1:-1;14713:14:0;;;14685:43;;14701:10;;-1:-1:-1;;;;;14713:14:0;14685:15;:43::i;:::-;13741:1007;;;13708:1040;13417:1346;;;;13357:1406;-1:-1:-1;;14789:32:0;;1445:25:6;;;-1:-1:-1;;;;;14789:32:0;;;14806:1;;14789:32;;1433:2:6;1418:18;14789:32:0;;;;;;;12739:2090;;12679:2150;;:::o;6268:1113:3:-;-1:-1:-1;;7235:16:3;;-1:-1:-1;;;;;7081:26:3;;;;;;7195:38;7192:1;;7184:78;7321:27;6268:1113::o;1981:1676:2:-;2037:17;2489:4;2482;2476:11;2472:22;2465:29;;2590:4;2585:3;2581:14;2575:4;2568:28;2673:1;2668:3;2661:14;2777:3;2809:1;2805:6;3021:5;3003:410;3060:11;;;;3244:2;3258;3248:13;;3240:22;3060:11;3227:36;3352:2;3342:13;;3373:25;3003:410;3373:25;-1:-1:-1;;3443:13:2;;;-1:-1:-1;;3558:14:2;;;3620:19;;;3558:14;1981:1676;-1:-1:-1;1981:1676:2:o;38909:708:0:-;39201:9;39189:10;39185:26;39172:10;39168:2;39164:19;39161:51;39239:8;39233:4;39226:22;39282:2;39279:1;39275:10;39269:4;39262:24;39325:4;39319;39309:21;39385:1;39381:2;39377:10;39374:1;39370:18;39448:1;39442:8;39496:18;39589:5;39585:1;39582;39578:9;39574:21;39571:1;39567:29;39564:1;39560:37;39557:1;39553:45;39550:1;39543:56;;;;;;38909:708;;;;:::o;35667:634::-;35835:1;35829:8;35870:4;35864;35860:15;35929:10;35926:1;35919:21;36004:4;35997;35994:1;35990:12;35983:26;36100:4;36094:11;36091:1;36087:19;36081:4;36077:30;36068:39;;36226:4;36223:1;36220;36213:4;36210:1;36206:12;36203:1;36195:6;36188:5;36183:48;36179:1;36175;36169:8;36166:15;36162:70;36152:131;;36263:4;36260:1;36253:15;36152:131;;;35667:634;;:::o;14:250:6:-;99:1;109:113;123:6;120:1;117:13;109:113;;;199:11;;;193:18;180:11;;;173:39;145:2;138:10;109:113;;;-1:-1:-1;;256:1:6;238:16;;231:27;14:250::o;269:396::-;418:2;407:9;400:21;381:4;450:6;444:13;493:6;488:2;477:9;473:18;466:34;509:79;581:6;576:2;565:9;561:18;556:2;548:6;544:15;509:79;:::i;:::-;649:2;628:15;-1:-1:-1;;624:29:6;609:45;;;;656:2;605:54;;269:396;-1:-1:-1;;269:396:6:o;670:173::-;738:20;;-1:-1:-1;;;;;787:31:6;;777:42;;767:70;;833:1;830;823:12;848:254;916:6;924;977:2;965:9;956:7;952:23;948:32;945:52;;;993:1;990;983:12;945:52;1016:29;1035:9;1016:29;:::i;:::-;1006:39;1092:2;1077:18;;;;1064:32;;-1:-1:-1;;;848:254:6:o;1481:328::-;1558:6;1566;1574;1627:2;1615:9;1606:7;1602:23;1598:32;1595:52;;;1643:1;1640;1633:12;1595:52;1666:29;1685:9;1666:29;:::i;:::-;1656:39;;1714:38;1748:2;1737:9;1733:18;1714:38;:::i;:::-;1704:48;;1799:2;1788:9;1784:18;1771:32;1761:42;;1481:328;;;;;:::o;1814:186::-;1873:6;1926:2;1914:9;1905:7;1901:23;1897:32;1894:52;;;1942:1;1939;1932:12;1894:52;1965:29;1984:9;1965:29;:::i;2005:273::-;2061:6;2114:2;2102:9;2093:7;2089:23;2085:32;2082:52;;;2130:1;2127;2120:12;2082:52;2169:9;2156:23;2222:5;2215:13;2208:21;2201:5;2198:32;2188:60;;2244:1;2241;2234:12;2680:592;2751:6;2759;2812:2;2800:9;2791:7;2787:23;2783:32;2780:52;;;2828:1;2825;2818:12;2780:52;2868:9;2855:23;2897:18;2938:2;2930:6;2927:14;2924:34;;;2954:1;2951;2944:12;2924:34;2992:6;2981:9;2977:22;2967:32;;3037:7;3030:4;3026:2;3022:13;3018:27;3008:55;;3059:1;3056;3049:12;3008:55;3099:2;3086:16;3125:2;3117:6;3114:14;3111:34;;;3141:1;3138;3131:12;3111:34;3186:7;3181:2;3172:6;3168:2;3164:15;3160:24;3157:37;3154:57;;;3207:1;3204;3197:12;3154:57;3238:2;3230:11;;;;;3260:6;;-1:-1:-1;2680:592:6;;-1:-1:-1;;;;2680:592:6:o;3277:180::-;3336:6;3389:2;3377:9;3368:7;3364:23;3360:32;3357:52;;;3405:1;3402;3395:12;3357:52;-1:-1:-1;3428:23:6;;3277:180;-1:-1:-1;3277:180:6:o;3462:260::-;3530:6;3538;3591:2;3579:9;3570:7;3566:23;3562:32;3559:52;;;3607:1;3604;3597:12;3559:52;3630:29;3649:9;3630:29;:::i;:::-;3620:39;;3678:38;3712:2;3701:9;3697:18;3678:38;:::i;:::-;3668:48;;3462:260;;;;;:::o;3727:127::-;3788:10;3783:3;3779:20;3776:1;3769:31;3819:4;3816:1;3809:15;3843:4;3840:1;3833:15;3859:191;-1:-1:-1;;;;;3986:10:6;;;3974;;;3970:27;;4009:12;;;4006:38;;;4024:18;;:::i;4055:380::-;4134:1;4130:12;;;;4177;;;4198:61;;4252:4;4244:6;4240:17;4230:27;;4198:61;4305:2;4297:6;4294:14;4274:18;4271:38;4268:161;;4351:10;4346:3;4342:20;4339:1;4332:31;4386:4;4383:1;4376:15;4414:4;4411:1;4404:15;4440:127;4501:10;4496:3;4492:20;4489:1;4482:31;4532:4;4529:1;4522:15;4556:4;4553:1;4546:15;4698:518;4800:2;4795:3;4792:11;4789:421;;;4836:5;4833:1;4826:16;4880:4;4877:1;4867:18;4950:2;4938:10;4934:19;4931:1;4927:27;4921:4;4917:38;4986:4;4974:10;4971:20;4968:47;;;-1:-1:-1;5009:4:6;4968:47;5064:2;5059:3;5055:12;5052:1;5048:20;5042:4;5038:31;5028:41;;5119:81;5137:2;5130:5;5127:13;5119:81;;;5196:1;5182:16;;5163:1;5152:13;5119:81;;;5123:3;;4698:518;;;:::o;5392:1198::-;5516:18;5511:3;5508:27;5505:53;;;5538:18;;:::i;:::-;5567:94;5657:3;5617:38;5649:4;5643:11;5617:38;:::i;:::-;5611:4;5567:94;:::i;:::-;5687:1;5712:2;5707:3;5704:11;5729:1;5724:608;;;;6376:1;6393:3;6390:93;;;-1:-1:-1;6449:19:6;;;6436:33;6390:93;-1:-1:-1;;5349:1:6;5345:11;;;5341:24;5337:29;5327:40;5373:1;5369:11;;;5324:57;6496:78;;5697:887;;5724:608;4645:1;4638:14;;;4682:4;4669:18;;-1:-1:-1;;5760:17:6;;;5875:229;5889:7;5886:1;5883:14;5875:229;;;5978:19;;;5965:33;5950:49;;6085:4;6070:20;;;;6038:1;6026:14;;;;5905:12;5875:229;;;5879:3;6132;6123:7;6120:16;6117:159;;;6256:1;6252:6;6246:3;6240;6237:1;6233:11;6229:21;6225:34;6221:39;6208:9;6203:3;6199:19;6186:33;6182:79;6174:6;6167:95;6117:159;;;6319:1;6313:3;6310:1;6306:11;6302:19;6296:4;6289:33;5697:887;;5392:1198;;;:::o;6595:1021::-;6771:3;6800:1;6833:6;6827:13;6863:36;6889:9;6863:36;:::i;:::-;6918:1;6935:17;;;6961:133;;;;7108:1;7103:358;;;;6928:533;;6961:133;-1:-1:-1;;6994:24:6;;6982:37;;7067:14;;7060:22;7048:35;;7039:45;;;-1:-1:-1;6961:133:6;;7103:358;7134:6;7131:1;7124:17;7164:4;7209;7206:1;7196:18;7236:1;7250:165;7264:6;7261:1;7258:13;7250:165;;;7342:14;;7329:11;;;7322:35;7385:16;;;;7279:10;;7250:165;;;7254:3;;;7444:6;7439:3;7435:16;7428:23;;6928:533;;;;;7492:6;7486:13;7508:68;7567:8;7562:3;7555:4;7547:6;7543:17;7508:68;:::i;:::-;7592:18;;6595:1021;-1:-1:-1;;;;6595:1021:6:o;7621:201::-;7659:3;7687:10;7732:2;7725:5;7721:14;7759:2;7750:7;7747:15;7744:41;;7765:18;;:::i;:::-;7814:1;7801:15;;7621:201;-1:-1:-1;;;7621:201:6:o;7827:127::-;7888:10;7883:3;7879:20;7876:1;7869:31;7919:4;7916:1;7909:15;7943:4;7940:1;7933:15
Swarm Source
ipfs://548ffd525f31ecfe3f2b5090388831e3c437104a690b39bfa1d3e4eb2c81cc55
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.