More Info
Private Name Tags
ContractCreator
TokenTracker
Latest 25 from a total of 221 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Approve | 20213300 | 140 days ago | IN | 0 ETH | 0.0004968 | ||||
Approve | 20177900 | 145 days ago | IN | 0 ETH | 0.00042179 | ||||
Approve | 19696538 | 212 days ago | IN | 0 ETH | 0.00029744 | ||||
Approve | 19683978 | 214 days ago | IN | 0 ETH | 0.00058768 | ||||
Approve | 19683449 | 214 days ago | IN | 0 ETH | 0.0008207 | ||||
Transfer Ownersh... | 19501311 | 240 days ago | IN | 0 ETH | 0.00051025 | ||||
Approve | 19487446 | 242 days ago | IN | 0 ETH | 0.00098238 | ||||
Approve | 19468433 | 244 days ago | IN | 0 ETH | 0.00210492 | ||||
Approve | 19456501 | 246 days ago | IN | 0 ETH | 0.00149646 | ||||
Transfer | 19456019 | 246 days ago | IN | 0 ETH | 0.00137008 | ||||
Transfer | 19456010 | 246 days ago | IN | 0 ETH | 0.00138331 | ||||
Approve | 19435663 | 249 days ago | IN | 0 ETH | 0.00187457 | ||||
Approve | 19435653 | 249 days ago | IN | 0 ETH | 0.00263122 | ||||
Collect Taxes | 19421197 | 251 days ago | IN | 0 ETH | 0.0085442 | ||||
Transfer | 19391512 | 255 days ago | IN | 0 ETH | 0.00658813 | ||||
Approve | 19390507 | 255 days ago | IN | 0 ETH | 0.00264335 | ||||
Approve | 19387741 | 256 days ago | IN | 0 ETH | 0.00243454 | ||||
Approve | 19387572 | 256 days ago | IN | 0 ETH | 0.00262849 | ||||
Approve | 19385659 | 256 days ago | IN | 0 ETH | 0.00343794 | ||||
Set Restricted | 19381012 | 257 days ago | IN | 0 ETH | 0.00170549 | ||||
Approve | 19380051 | 257 days ago | IN | 0 ETH | 0.00306598 | ||||
Approve | 19379403 | 257 days ago | IN | 0 ETH | 0.00325981 | ||||
Set Desc | 19379109 | 257 days ago | IN | 0 ETH | 0.01149567 | ||||
Set Pre URI | 19379092 | 257 days ago | IN | 0 ETH | 0.00931375 | ||||
Approve | 19378721 | 257 days ago | IN | 0 ETH | 0.00490165 |
Latest 1 internal transaction
Advanced mode:
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
19377466 | 257 days ago | Contract Creation | 0 ETH |
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
GENAI404
Compiler Version
v0.8.24+commit.e11b9ed9
Contract Source Code (Solidity)
/** *Submitted for verification at Etherscan.io on 2024-03-06 */ // SPDX-License-Identifier: MIT pragma solidity ^0.8.24; /// @title DN404MS2(GENAI) /// @notice DN404 is a hybrid ERC20 and ERC721 implementation that mints /// and burns NFTs based on an account's ERC20 token balance. /// /// Modified by arthurt for MiladyStation2 to have an erc20 unit bias /// as well as make setSkipNFT defaulted and adding balanceMint function /// /// @author vectorized.eth (@optimizoor) /// @author Quit (@0xQuit) /// @author Michael Amadi (@AmadiMichaels) /// @author cygaar (@0xCygaar) /// @author Thomas (@0xjustadev) /// @author Harrison (@PopPunkOnChain) /// /// @author arthurt (@MiladyStation) /// /// @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 DN404MS2 { /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* 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 GetNFTSet(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 immutable _WAD = 100 * 10 ** 18; //100 GENAI tokens per 1 GENPAL /// @dev The maximum token ID allowed for an NFT. uint256 internal constant _MAX_TOKEN_ID = 0xffffffff; /// @dev The maximum possible token supply. uint256 internal immutable _MAX_SUPPLY = _WAD * 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 get NFTs. uint8 internal constant _ADDRESS_DATA_GET_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); } } /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* 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 getNFT flag is /// set to true. /// /// 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 getNFT flag is /// set to true. /// /// 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 getNFT flag is /// set to true. /// /// 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_GET_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 getNFT flag is /// set to true. /// /// 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); //GETNFT TRUE BEHAVIOR if (toAddressData.flags & _ADDRESS_DATA_GET_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; } /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* GET NFT FUNCTIONS */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ /// @dev Allows token holders to choose to mint their NFTs on their own time /// without having to mint all of the NFTs for their balance. /// !!! Wallets who elect to setGetNFT to true will automatically mint their entire balance /// whenever they transfer and their holding is greater than WAD /// This function allows them to remain getNFT false and choose to mint their nfts function balanceMint(uint256 amount) public { DN404Storage storage $ = _getDN404Storage(); AddressData storage toAddressData = _addressData(msg.sender); uint256 toOwnedLength = toAddressData.ownedLength; _PackedLogs memory packedLogs = _packedLogsMalloc(amount); if (amount > (toAddressData.balance / _WAD) - toOwnedLength) { revert InsufficientBalance();} else { Uint32Map storage toOwned = $.owned[msg.sender]; uint256 toIndex = toOwnedLength; uint256 toEnd = toIndex + amount; uint32 toAlias = _registerAndResolveAlias(toAddressData, msg.sender); uint256 maxNFTId = $.totalSupply / _WAD; uint256 id = $.nextTokenId; $.totalNFTSupply += uint32(amount); 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, msg.sender, id, 0); if (++id > maxNFTId) id = 1; } while (toIndex != toEnd); $.nextTokenId = uint32(id); } if (packedLogs.logs.length != 0) { _packedLogsSend(packedLogs, $.mirrorERC721); } } /// @dev Returns true if account `a` will get NFT minting on token mints and transfers. /// Returns false if account `a` will not mint NFTs on token mints and transfers. /// Inverted from skipNFT by arthurt function getGetNFT(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_GET_NFT_FLAG != 0; } /// @dev Sets the caller's getNFT flag to `getNFT` /// /// Emits a {GetNFTSet} event. /// A holder in possession of tokens > than a WAD without NFTS function setGetNFT(bool getNFT) public virtual { _setGetNFT(msg.sender, getNFT); } /// @dev Internal function to set account `a` getNFT flag to `state` /// /// Initializes account `a` AddressData if it is not currently initialized. /// /// Emits a {GetNFTSet} event. function _setGetNFT(address a, bool state) internal virtual { AddressData storage d = _addressData(a); if ((d.flags & _ADDRESS_DATA_GET_NFT_FLAG != 0) != state) { d.flags ^= _ADDRESS_DATA_GET_NFT_FLAG; } emit GetNFTSet(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; 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) internal 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) internal 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) internal { /// @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) internal 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) internal 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) internal 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) internal { /// @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 ) internal { /// @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))))) } } } /// @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) } } } } /// @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(); _; } } /// @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) } } } /// @notice Arithmetic library with operations for fixed-point numbers. /// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/FixedPointMathLib.sol) /// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/FixedPointMathLib.sol) library FixedPointMathLib { /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* CUSTOM ERRORS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The operation failed, as the output exceeds the maximum value of uint256. error ExpOverflow(); /// @dev The operation failed, as the output exceeds the maximum value of uint256. error FactorialOverflow(); /// @dev The operation failed, due to an overflow. error RPowOverflow(); /// @dev The mantissa is too big to fit. error MantissaOverflow(); /// @dev The operation failed, due to an multiplication overflow. error MulWadFailed(); /// @dev The operation failed, due to an multiplication overflow. error SMulWadFailed(); /// @dev The operation failed, either due to a multiplication overflow, or a division by a zero. error DivWadFailed(); /// @dev The operation failed, either due to a multiplication overflow, or a division by a zero. error SDivWadFailed(); /// @dev The operation failed, either due to a multiplication overflow, or a division by a zero. error MulDivFailed(); /// @dev The division failed, as the denominator is zero. error DivFailed(); /// @dev The full precision multiply-divide operation failed, either due /// to the result being larger than 256 bits, or a division by a zero. error FullMulDivFailed(); /// @dev The output is undefined, as the input is less-than-or-equal to zero. error LnWadUndefined(); /// @dev The input outside the acceptable domain. error OutOfDomain(); /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* CONSTANTS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The scalar of ETH and most ERC20s. uint256 internal constant WAD = 1e18; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* SIMPLIFIED FIXED POINT OPERATIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Equivalent to `(x * y) / WAD` rounded down. function mulWad(uint256 x, uint256 y) internal pure returns (uint256 z) { /// @solidity memory-safe-assembly assembly { // Equivalent to `require(y == 0 || x <= type(uint256).max / y)`. if mul(y, gt(x, div(not(0), y))) { mstore(0x00, 0xbac65e5b) // `MulWadFailed()`. revert(0x1c, 0x04) } z := div(mul(x, y), WAD) } } /// @dev Equivalent to `(x * y) / WAD` rounded down. function sMulWad(int256 x, int256 y) internal pure returns (int256 z) { /// @solidity memory-safe-assembly assembly { z := mul(x, y) // Equivalent to `require((x == 0 || z / x == y) && !(x == -1 && y == type(int256).min))`. if iszero(gt(or(iszero(x), eq(sdiv(z, x), y)), lt(not(x), eq(y, shl(255, 1))))) { mstore(0x00, 0xedcd4dd4) // `SMulWadFailed()`. revert(0x1c, 0x04) } z := sdiv(z, WAD) } } /// @dev Equivalent to `(x * y) / WAD` rounded down, but without overflow checks. function rawMulWad(uint256 x, uint256 y) internal pure returns (uint256 z) { /// @solidity memory-safe-assembly assembly { z := div(mul(x, y), WAD) } } /// @dev Equivalent to `(x * y) / WAD` rounded down, but without overflow checks. function rawSMulWad(int256 x, int256 y) internal pure returns (int256 z) { /// @solidity memory-safe-assembly assembly { z := sdiv(mul(x, y), WAD) } } /// @dev Equivalent to `(x * y) / WAD` rounded up. function mulWadUp(uint256 x, uint256 y) internal pure returns (uint256 z) { /// @solidity memory-safe-assembly assembly { // Equivalent to `require(y == 0 || x <= type(uint256).max / y)`. if mul(y, gt(x, div(not(0), y))) { mstore(0x00, 0xbac65e5b) // `MulWadFailed()`. revert(0x1c, 0x04) } z := add(iszero(iszero(mod(mul(x, y), WAD))), div(mul(x, y), WAD)) } } /// @dev Equivalent to `(x * y) / WAD` rounded up, but without overflow checks. function rawMulWadUp(uint256 x, uint256 y) internal pure returns (uint256 z) { /// @solidity memory-safe-assembly assembly { z := add(iszero(iszero(mod(mul(x, y), WAD))), div(mul(x, y), WAD)) } } /// @dev Equivalent to `(x * WAD) / y` rounded down. function divWad(uint256 x, uint256 y) internal pure returns (uint256 z) { /// @solidity memory-safe-assembly assembly { // Equivalent to `require(y != 0 && (WAD == 0 || x <= type(uint256).max / WAD))`. if iszero(mul(y, iszero(mul(WAD, gt(x, div(not(0), WAD)))))) { mstore(0x00, 0x7c5f487d) // `DivWadFailed()`. revert(0x1c, 0x04) } z := div(mul(x, WAD), y) } } /// @dev Equivalent to `(x * WAD) / y` rounded down. function sDivWad(int256 x, int256 y) internal pure returns (int256 z) { /// @solidity memory-safe-assembly assembly { z := mul(x, WAD) // Equivalent to `require(y != 0 && ((x * WAD) / WAD == x))`. if iszero(and(iszero(iszero(y)), eq(sdiv(z, WAD), x))) { mstore(0x00, 0x5c43740d) // `SDivWadFailed()`. revert(0x1c, 0x04) } z := sdiv(mul(x, WAD), y) } } /// @dev Equivalent to `(x * WAD) / y` rounded down, but without overflow and divide by zero checks. function rawDivWad(uint256 x, uint256 y) internal pure returns (uint256 z) { /// @solidity memory-safe-assembly assembly { z := div(mul(x, WAD), y) } } /// @dev Equivalent to `(x * WAD) / y` rounded down, but without overflow and divide by zero checks. function rawSDivWad(int256 x, int256 y) internal pure returns (int256 z) { /// @solidity memory-safe-assembly assembly { z := sdiv(mul(x, WAD), y) } } /// @dev Equivalent to `(x * WAD) / y` rounded up. function divWadUp(uint256 x, uint256 y) internal pure returns (uint256 z) { /// @solidity memory-safe-assembly assembly { // Equivalent to `require(y != 0 && (WAD == 0 || x <= type(uint256).max / WAD))`. if iszero(mul(y, iszero(mul(WAD, gt(x, div(not(0), WAD)))))) { mstore(0x00, 0x7c5f487d) // `DivWadFailed()`. revert(0x1c, 0x04) } z := add(iszero(iszero(mod(mul(x, WAD), y))), div(mul(x, WAD), y)) } } /// @dev Equivalent to `(x * WAD) / y` rounded up, but without overflow and divide by zero checks. function rawDivWadUp(uint256 x, uint256 y) internal pure returns (uint256 z) { /// @solidity memory-safe-assembly assembly { z := add(iszero(iszero(mod(mul(x, WAD), y))), div(mul(x, WAD), y)) } } /// @dev Equivalent to `x` to the power of `y`. /// because `x ** y = (e ** ln(x)) ** y = e ** (ln(x) * y)`. function powWad(int256 x, int256 y) internal pure returns (int256) { // Using `ln(x)` means `x` must be greater than 0. return expWad((lnWad(x) * y) / int256(WAD)); } /// @dev Returns `exp(x)`, denominated in `WAD`. /// Credit to Remco Bloemen under MIT license: https://2π.com/22/exp-ln function expWad(int256 x) internal pure returns (int256 r) { unchecked { // When the result is less than 0.5 we return zero. // This happens when `x <= (log(1e-18) * 1e18) ~ -4.15e19`. if (x <= -41446531673892822313) return r; /// @solidity memory-safe-assembly assembly { // When the result is greater than `(2**255 - 1) / 1e18` we can not represent it as // an int. This happens when `x >= floor(log((2**255 - 1) / 1e18) * 1e18) ≈ 135`. if iszero(slt(x, 135305999368893231589)) { mstore(0x00, 0xa37bfec9) // `ExpOverflow()`. revert(0x1c, 0x04) } } // `x` is now in the range `(-42, 136) * 1e18`. Convert to `(-42, 136) * 2**96` // for more intermediate precision and a binary basis. This base conversion // is a multiplication by 1e18 / 2**96 = 5**18 / 2**78. x = (x << 78) / 5 ** 18; // Reduce range of x to (-½ ln 2, ½ ln 2) * 2**96 by factoring out powers // of two such that exp(x) = exp(x') * 2**k, where k is an integer. // Solving this gives k = round(x / log(2)) and x' = x - k * log(2). int256 k = ((x << 96) / 54916777467707473351141471128 + 2 ** 95) >> 96; x = x - k * 54916777467707473351141471128; // `k` is in the range `[-61, 195]`. // Evaluate using a (6, 7)-term rational approximation. // `p` is made monic, we'll multiply by a scale factor later. int256 y = x + 1346386616545796478920950773328; y = ((y * x) >> 96) + 57155421227552351082224309758442; int256 p = y + x - 94201549194550492254356042504812; p = ((p * y) >> 96) + 28719021644029726153956944680412240; p = p * x + (4385272521454847904659076985693276 << 96); // We leave `p` in `2**192` basis so we don't need to scale it back up for the division. int256 q = x - 2855989394907223263936484059900; q = ((q * x) >> 96) + 50020603652535783019961831881945; q = ((q * x) >> 96) - 533845033583426703283633433725380; q = ((q * x) >> 96) + 3604857256930695427073651918091429; q = ((q * x) >> 96) - 14423608567350463180887372962807573; q = ((q * x) >> 96) + 26449188498355588339934803723976023; /// @solidity memory-safe-assembly assembly { // Div in assembly because solidity adds a zero check despite the unchecked. // The q polynomial won't have zeros in the domain as all its roots are complex. // No scaling is necessary because p is already `2**96` too large. r := sdiv(p, q) } // r should be in the range `(0.09, 0.25) * 2**96`. // We now need to multiply r by: // - The scale factor `s ≈ 6.031367120`. // - The `2**k` factor from the range reduction. // - The `1e18 / 2**96` factor for base conversion. // We do this all at once, with an intermediate result in `2**213` // basis, so the final right shift is always by a positive amount. r = int256( (uint256(r) * 3822833074963236453042738258902158003155416615667) >> uint256(195 - k) ); } } /// @dev Returns `ln(x)`, denominated in `WAD`. /// Credit to Remco Bloemen under MIT license: https://2π.com/22/exp-ln function lnWad(int256 x) internal pure returns (int256 r) { /// @solidity memory-safe-assembly assembly { // We want to convert `x` from `10**18` fixed point to `2**96` fixed point. // We do this by multiplying by `2**96 / 10**18`. But since // `ln(x * C) = ln(x) + ln(C)`, we can simply do nothing here // and add `ln(2**96 / 10**18)` at the end. // Compute `k = log2(x) - 96`, `r = 159 - k = 255 - log2(x) = 255 ^ log2(x)`. r := shl(7, lt(0xffffffffffffffffffffffffffffffff, x)) r := or(r, shl(6, lt(0xffffffffffffffff, 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)))) // We place the check here for more optimal stack operations. if iszero(sgt(x, 0)) { mstore(0x00, 0x1615e638) // `LnWadUndefined()`. revert(0x1c, 0x04) } // forgefmt: disable-next-item r := xor(r, byte(and(0x1f, shr(shr(r, x), 0x8421084210842108cc6318c6db6d54be)), 0xf8f9f9faf9fdfafbf9fdfcfdfafbfcfef9fafdfafcfcfbfefafafcfbffffffff)) // Reduce range of x to (1, 2) * 2**96 // ln(2^k * x) = k * ln(2) + ln(x) x := shr(159, shl(r, x)) // Evaluate using a (8, 8)-term rational approximation. // `p` is made monic, we will multiply by a scale factor later. // forgefmt: disable-next-item let p := sub( // This heavily nested expression is to avoid stack-too-deep for via-ir. sar(96, mul(add(43456485725739037958740375743393, sar(96, mul(add(24828157081833163892658089445524, sar(96, mul(add(3273285459638523848632254066296, x), x))), x))), x)), 11111509109440967052023855526967) p := sub(sar(96, mul(p, x)), 45023709667254063763336534515857) p := sub(sar(96, mul(p, x)), 14706773417378608786704636184526) p := sub(mul(p, x), shl(96, 795164235651350426258249787498)) // We leave `p` in `2**192` basis so we don't need to scale it back up for the division. // `q` is monic by convention. let q := add(5573035233440673466300451813936, x) q := add(71694874799317883764090561454958, sar(96, mul(x, q))) q := add(283447036172924575727196451306956, sar(96, mul(x, q))) q := add(401686690394027663651624208769553, sar(96, mul(x, q))) q := add(204048457590392012362485061816622, sar(96, mul(x, q))) q := add(31853899698501571402653359427138, sar(96, mul(x, q))) q := add(909429971244387300277376558375, sar(96, mul(x, q))) // `p / q` is in the range `(0, 0.125) * 2**96`. // Finalization, we need to: // - Multiply by the scale factor `s = 5.549…`. // - Add `ln(2**96 / 10**18)`. // - Add `k * ln(2)`. // - Multiply by `10**18 / 2**96 = 5**18 >> 78`. // The q polynomial is known not to have zeros in the domain. // No scaling required because p is already `2**96` too large. p := sdiv(p, q) // Multiply by the scaling factor: `s * 5**18 * 2**96`, base is now `5**18 * 2**192`. p := mul(1677202110996718588342820967067443963516166, p) // Add `ln(2) * k * 5**18 * 2**192`. // forgefmt: disable-next-item p := add(mul(16597577552685614221487285958193947469193820559219878177908093499208371, sub(159, r)), p) // Add `ln(2**96 / 10**18) * 5**18 * 2**192`. p := add(600920179829731861736702779321621459595472258049074101567377883020018308, p) // Base conversion: mul `2**18 / 2**192`. r := sar(174, p) } } /// @dev Returns `W_0(x)`, denominated in `WAD`. /// See: https://en.wikipedia.org/wiki/Lambert_W_function /// a.k.a. Product log function. This is an approximation of the principal branch. function lambertW0Wad(int256 x) internal pure returns (int256 w) { // forgefmt: disable-next-item unchecked { if ((w = x) <= -367879441171442322) revert OutOfDomain(); // `x` less than `-1/e`. int256 wad = int256(WAD); int256 p = x; uint256 c; // Whether we need to avoid catastrophic cancellation. uint256 i = 4; // Number of iterations. if (w <= 0x1ffffffffffff) { if (-0x4000000000000 <= w) { i = 1; // Inputs near zero only take one step to converge. } else if (w <= -0x3ffffffffffffff) { i = 32; // Inputs near `-1/e` take very long to converge. } } else if (w >> 63 == 0) { /// @solidity memory-safe-assembly assembly { // Inline log2 for more performance, since the range is small. let v := shr(49, w) let l := shl(3, lt(0xff, v)) l := add(or(l, byte(and(0x1f, shr(shr(l, v), 0x8421084210842108cc6318c6db6d54be)), 0x0706060506020504060203020504030106050205030304010505030400000000)), 49) w := sdiv(shl(l, 7), byte(sub(l, 31), 0x0303030303030303040506080c13)) c := gt(l, 60) i := add(2, add(gt(l, 53), c)) } } else { int256 ll = lnWad(w = lnWad(w)); /// @solidity memory-safe-assembly assembly { // `w = ln(x) - ln(ln(x)) + b * ln(ln(x)) / ln(x)`. w := add(sdiv(mul(ll, 1023715080943847266), w), sub(w, ll)) i := add(3, iszero(shr(68, x))) c := iszero(shr(143, x)) } if (c == 0) { do { // If `x` is big, use Newton's so that intermediate values won't overflow. int256 e = expWad(w); /// @solidity memory-safe-assembly assembly { let t := mul(w, div(e, wad)) w := sub(w, sdiv(sub(t, x), div(add(e, t), wad))) } if (p <= w) break; p = w; } while (--i != 0); /// @solidity memory-safe-assembly assembly { w := sub(w, sgt(w, 2)) } return w; } } do { // Otherwise, use Halley's for faster convergence. int256 e = expWad(w); /// @solidity memory-safe-assembly assembly { let t := add(w, wad) let s := sub(mul(w, e), mul(x, wad)) w := sub(w, sdiv(mul(s, wad), sub(mul(e, t), sdiv(mul(add(t, wad), s), add(t, t))))) } if (p <= w) break; p = w; } while (--i != c); /// @solidity memory-safe-assembly assembly { w := sub(w, sgt(w, 2)) } // For certain ranges of `x`, we'll use the quadratic-rate recursive formula of // R. Iacono and J.P. Boyd for the last iteration, to avoid catastrophic cancellation. if (c != 0) { int256 t = w | 1; /// @solidity memory-safe-assembly assembly { x := sdiv(mul(x, wad), t) } x = (t * (wad + lnWad(x))); /// @solidity memory-safe-assembly assembly { w := sdiv(x, add(wad, t)) } } } } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* GENERAL NUMBER UTILITIES */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Calculates `floor(x * y / d)` with full precision. /// Throws if result overflows a uint256 or when `d` is zero. /// Credit to Remco Bloemen under MIT license: https://2π.com/21/muldiv function fullMulDiv(uint256 x, uint256 y, uint256 d) internal pure returns (uint256 result) { /// @solidity memory-safe-assembly assembly { for {} 1 {} { // 512-bit multiply `[p1 p0] = x * y`. // Compute the product mod `2**256` and mod `2**256 - 1` // then use the Chinese Remainder Theorem to reconstruct // the 512 bit result. The result is stored in two 256 // variables such that `product = p1 * 2**256 + p0`. // Least significant 256 bits of the product. result := mul(x, y) // Temporarily use `result` as `p0` to save gas. let mm := mulmod(x, y, not(0)) // Most significant 256 bits of the product. let p1 := sub(mm, add(result, lt(mm, result))) // Handle non-overflow cases, 256 by 256 division. if iszero(p1) { if iszero(d) { mstore(0x00, 0xae47f702) // `FullMulDivFailed()`. revert(0x1c, 0x04) } result := div(result, d) break } // Make sure the result is less than `2**256`. Also prevents `d == 0`. if iszero(gt(d, p1)) { mstore(0x00, 0xae47f702) // `FullMulDivFailed()`. revert(0x1c, 0x04) } /*------------------- 512 by 256 division --------------------*/ // Make division exact by subtracting the remainder from `[p1 p0]`. // Compute remainder using mulmod. let r := mulmod(x, y, d) // `t` is the least significant bit of `d`. // Always greater or equal to 1. let t := and(d, sub(0, d)) // Divide `d` by `t`, which is a power of two. d := div(d, t) // Invert `d mod 2**256` // Now that `d` is an odd number, it has an inverse // modulo `2**256` such that `d * inv = 1 mod 2**256`. // Compute the inverse by starting with a seed that is correct // correct for four bits. That is, `d * inv = 1 mod 2**4`. let inv := xor(2, mul(3, d)) // Now use Newton-Raphson iteration to improve the precision. // Thanks to Hensel's lifting lemma, this also works in modular // arithmetic, doubling the correct bits in each step. inv := mul(inv, sub(2, mul(d, inv))) // inverse mod 2**8 inv := mul(inv, sub(2, mul(d, inv))) // inverse mod 2**16 inv := mul(inv, sub(2, mul(d, inv))) // inverse mod 2**32 inv := mul(inv, sub(2, mul(d, inv))) // inverse mod 2**64 inv := mul(inv, sub(2, mul(d, inv))) // inverse mod 2**128 result := mul( // Divide [p1 p0] by the factors of two. // Shift in bits from `p1` into `p0`. For this we need // to flip `t` such that it is `2**256 / t`. or( mul(sub(p1, gt(r, result)), add(div(sub(0, t), t), 1)), div(sub(result, r), t) ), // inverse mod 2**256 mul(inv, sub(2, mul(d, inv))) ) break } } } /// @dev Calculates `floor(x * y / d)` with full precision, rounded up. /// Throws if result overflows a uint256 or when `d` is zero. /// Credit to Uniswap-v3-core under MIT license: /// https://github.com/Uniswap/v3-core/blob/main/contracts/libraries/FullMath.sol function fullMulDivUp(uint256 x, uint256 y, uint256 d) internal pure returns (uint256 result) { result = fullMulDiv(x, y, d); /// @solidity memory-safe-assembly assembly { if mulmod(x, y, d) { result := add(result, 1) if iszero(result) { mstore(0x00, 0xae47f702) // `FullMulDivFailed()`. revert(0x1c, 0x04) } } } } /// @dev Returns `floor(x * y / d)`. /// Reverts if `x * y` overflows, or `d` is zero. function mulDiv(uint256 x, uint256 y, uint256 d) internal pure returns (uint256 z) { /// @solidity memory-safe-assembly assembly { // Equivalent to require(d != 0 && (y == 0 || x <= type(uint256).max / y)) if iszero(mul(d, iszero(mul(y, gt(x, div(not(0), y)))))) { mstore(0x00, 0xad251c27) // `MulDivFailed()`. revert(0x1c, 0x04) } z := div(mul(x, y), d) } } /// @dev Returns `ceil(x * y / d)`. /// Reverts if `x * y` overflows, or `d` is zero. function mulDivUp(uint256 x, uint256 y, uint256 d) internal pure returns (uint256 z) { /// @solidity memory-safe-assembly assembly { // Equivalent to require(d != 0 && (y == 0 || x <= type(uint256).max / y)) if iszero(mul(d, iszero(mul(y, gt(x, div(not(0), y)))))) { mstore(0x00, 0xad251c27) // `MulDivFailed()`. revert(0x1c, 0x04) } z := add(iszero(iszero(mod(mul(x, y), d))), div(mul(x, y), d)) } } /// @dev Returns `ceil(x / d)`. /// Reverts if `d` is zero. function divUp(uint256 x, uint256 d) internal pure returns (uint256 z) { /// @solidity memory-safe-assembly assembly { if iszero(d) { mstore(0x00, 0x65244e4e) // `DivFailed()`. revert(0x1c, 0x04) } z := add(iszero(iszero(mod(x, d))), div(x, d)) } } /// @dev Returns `max(0, x - y)`. function zeroFloorSub(uint256 x, uint256 y) internal pure returns (uint256 z) { /// @solidity memory-safe-assembly assembly { z := mul(gt(x, y), sub(x, y)) } } /// @dev Exponentiate `x` to `y` by squaring, denominated in base `b`. /// Reverts if the computation overflows. function rpow(uint256 x, uint256 y, uint256 b) internal pure returns (uint256 z) { /// @solidity memory-safe-assembly assembly { z := mul(b, iszero(y)) // `0 ** 0 = 1`. Otherwise, `0 ** n = 0`. if x { z := xor(b, mul(xor(b, x), and(y, 1))) // `z = isEven(y) ? scale : x` let half := shr(1, b) // Divide `b` by 2. // Divide `y` by 2 every iteration. for { y := shr(1, y) } y { y := shr(1, y) } { let xx := mul(x, x) // Store x squared. let xxRound := add(xx, half) // Round to the nearest number. // Revert if `xx + half` overflowed, or if `x ** 2` overflows. if or(lt(xxRound, xx), shr(128, x)) { mstore(0x00, 0x49f7642b) // `RPowOverflow()`. revert(0x1c, 0x04) } x := div(xxRound, b) // Set `x` to scaled `xxRound`. // If `y` is odd: if and(y, 1) { let zx := mul(z, x) // Compute `z * x`. let zxRound := add(zx, half) // Round to the nearest number. // If `z * x` overflowed or `zx + half` overflowed: if or(xor(div(zx, x), z), lt(zxRound, zx)) { // Revert if `x` is non-zero. if iszero(iszero(x)) { mstore(0x00, 0x49f7642b) // `RPowOverflow()`. revert(0x1c, 0x04) } } z := div(zxRound, b) // Return properly scaled `zxRound`. } } } } } /// @dev Returns the square root of `x`. function sqrt(uint256 x) internal pure returns (uint256 z) { /// @solidity memory-safe-assembly assembly { // `floor(sqrt(2**15)) = 181`. `sqrt(2**15) - 181 = 2.84`. z := 181 // The "correct" value is 1, but this saves a multiplication later. // This segment is to get a reasonable initial estimate for the Babylonian method. With a bad // start, the correct # of bits increases ~linearly each iteration instead of ~quadratically. // Let `y = x / 2**r`. We check `y >= 2**(k + 8)` // but shift right by `k` bits to ensure that if `x >= 256`, then `y >= 256`. let r := shl(7, lt(0xffffffffffffffffffffffffffffffffff, x)) r := or(r, shl(6, lt(0xffffffffffffffffff, shr(r, x)))) r := or(r, shl(5, lt(0xffffffffff, shr(r, x)))) r := or(r, shl(4, lt(0xffffff, shr(r, x)))) z := shl(shr(1, r), z) // Goal was to get `z*z*y` within a small factor of `x`. More iterations could // get y in a tighter range. Currently, we will have y in `[256, 256*(2**16))`. // We ensured `y >= 256` so that the relative difference between `y` and `y+1` is small. // That's not possible if `x < 256` but we can just verify those cases exhaustively. // Now, `z*z*y <= x < z*z*(y+1)`, and `y <= 2**(16+8)`, and either `y >= 256`, or `x < 256`. // Correctness can be checked exhaustively for `x < 256`, so we assume `y >= 256`. // Then `z*sqrt(y)` is within `sqrt(257)/sqrt(256)` of `sqrt(x)`, or about 20bps. // For `s` in the range `[1/256, 256]`, the estimate `f(s) = (181/1024) * (s+1)` // is in the range `(1/2.84 * sqrt(s), 2.84 * sqrt(s))`, // with largest error when `s = 1` and when `s = 256` or `1/256`. // Since `y` is in `[256, 256*(2**16))`, let `a = y/65536`, so that `a` is in `[1/256, 256)`. // Then we can estimate `sqrt(y)` using // `sqrt(65536) * 181/1024 * (a + 1) = 181/4 * (y + 65536)/65536 = 181 * (y + 65536)/2**18`. // There is no overflow risk here since `y < 2**136` after the first branch above. z := shr(18, mul(z, add(shr(r, x), 65536))) // A `mul()` is saved from starting `z` at 181. // Given the worst case multiplicative error of 2.84 above, 7 iterations should be enough. z := shr(1, add(z, div(x, z))) z := shr(1, add(z, div(x, z))) z := shr(1, add(z, div(x, z))) z := shr(1, add(z, div(x, z))) z := shr(1, add(z, div(x, z))) z := shr(1, add(z, div(x, z))) z := shr(1, add(z, div(x, z))) // If `x+1` is a perfect square, the Babylonian method cycles between // `floor(sqrt(x))` and `ceil(sqrt(x))`. This statement ensures we return floor. // See: https://en.wikipedia.org/wiki/Integer_square_root#Using_only_integer_division z := sub(z, lt(div(x, z), z)) } } /// @dev Returns the cube root of `x`. /// Credit to bout3fiddy and pcaversaccio under AGPLv3 license: /// https://github.com/pcaversaccio/snekmate/blob/main/src/utils/Math.vy function cbrt(uint256 x) internal pure returns (uint256 z) { /// @solidity memory-safe-assembly assembly { let r := shl(7, lt(0xffffffffffffffffffffffffffffffff, x)) r := or(r, shl(6, lt(0xffffffffffffffff, 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)))) z := div(shl(div(r, 3), shl(lt(0xf, shr(r, x)), 0xf)), xor(7, mod(r, 3))) z := div(add(add(div(x, mul(z, z)), z), z), 3) z := div(add(add(div(x, mul(z, z)), z), z), 3) z := div(add(add(div(x, mul(z, z)), z), z), 3) z := div(add(add(div(x, mul(z, z)), z), z), 3) z := div(add(add(div(x, mul(z, z)), z), z), 3) z := div(add(add(div(x, mul(z, z)), z), z), 3) z := div(add(add(div(x, mul(z, z)), z), z), 3) z := sub(z, lt(div(x, mul(z, z)), z)) } } /// @dev Returns the square root of `x`, denominated in `WAD`. function sqrtWad(uint256 x) internal pure returns (uint256 z) { unchecked { z = 10 ** 9; if (x <= type(uint256).max / 10 ** 36 - 1) { x *= 10 ** 18; z = 1; } z *= sqrt(x); } } /// @dev Returns the cube root of `x`, denominated in `WAD`. function cbrtWad(uint256 x) internal pure returns (uint256 z) { unchecked { z = 10 ** 12; if (x <= (type(uint256).max / 10 ** 36) * 10 ** 18 - 1) { if (x >= type(uint256).max / 10 ** 36) { x *= 10 ** 18; z = 10 ** 6; } else { x *= 10 ** 36; z = 1; } } z *= cbrt(x); } } /// @dev Returns the factorial of `x`. function factorial(uint256 x) internal pure returns (uint256 result) { /// @solidity memory-safe-assembly assembly { if iszero(lt(x, 58)) { mstore(0x00, 0xaba0f2a2) // `FactorialOverflow()`. revert(0x1c, 0x04) } for { result := 1 } x { x := sub(x, 1) } { result := mul(result, x) } } } /// @dev Returns the log2 of `x`. /// Equivalent to computing the index of the most significant bit (MSB) of `x`. /// Returns 0 if `x` is zero. function log2(uint256 x) internal pure returns (uint256 r) { /// @solidity memory-safe-assembly assembly { r := shl(7, lt(0xffffffffffffffffffffffffffffffff, x)) r := or(r, shl(6, lt(0xffffffffffffffff, 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 r := or(r, byte(and(0x1f, shr(shr(r, x), 0x8421084210842108cc6318c6db6d54be)), 0x0706060506020504060203020504030106050205030304010505030400000000)) } } /// @dev Returns the log2 of `x`, rounded up. /// Returns 0 if `x` is zero. function log2Up(uint256 x) internal pure returns (uint256 r) { r = log2(x); /// @solidity memory-safe-assembly assembly { r := add(r, lt(shl(r, 1), x)) } } /// @dev Returns the log10 of `x`. /// Returns 0 if `x` is zero. function log10(uint256 x) internal pure returns (uint256 r) { /// @solidity memory-safe-assembly assembly { if iszero(lt(x, 100000000000000000000000000000000000000)) { x := div(x, 100000000000000000000000000000000000000) r := 38 } if iszero(lt(x, 100000000000000000000)) { x := div(x, 100000000000000000000) r := add(r, 20) } if iszero(lt(x, 10000000000)) { x := div(x, 10000000000) r := add(r, 10) } if iszero(lt(x, 100000)) { x := div(x, 100000) r := add(r, 5) } r := add(r, add(gt(x, 9), add(gt(x, 99), add(gt(x, 999), gt(x, 9999))))) } } /// @dev Returns the log10 of `x`, rounded up. /// Returns 0 if `x` is zero. function log10Up(uint256 x) internal pure returns (uint256 r) { r = log10(x); /// @solidity memory-safe-assembly assembly { r := add(r, lt(exp(10, r), x)) } } /// @dev Returns the log256 of `x`. /// Returns 0 if `x` is zero. function log256(uint256 x) internal pure returns (uint256 r) { /// @solidity memory-safe-assembly assembly { r := shl(7, lt(0xffffffffffffffffffffffffffffffff, x)) r := or(r, shl(6, lt(0xffffffffffffffff, 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(shr(3, r), lt(0xff, shr(r, x))) } } /// @dev Returns the log256 of `x`, rounded up. /// Returns 0 if `x` is zero. function log256Up(uint256 x) internal pure returns (uint256 r) { r = log256(x); /// @solidity memory-safe-assembly assembly { r := add(r, lt(shl(shl(3, r), 1), x)) } } /// @dev Returns the scientific notation format `mantissa * 10 ** exponent` of `x`. /// Useful for compressing prices (e.g. using 25 bit mantissa and 7 bit exponent). function sci(uint256 x) internal pure returns (uint256 mantissa, uint256 exponent) { /// @solidity memory-safe-assembly assembly { mantissa := x if mantissa { if iszero(mod(mantissa, 1000000000000000000000000000000000)) { mantissa := div(mantissa, 1000000000000000000000000000000000) exponent := 33 } if iszero(mod(mantissa, 10000000000000000000)) { mantissa := div(mantissa, 10000000000000000000) exponent := add(exponent, 19) } if iszero(mod(mantissa, 1000000000000)) { mantissa := div(mantissa, 1000000000000) exponent := add(exponent, 12) } if iszero(mod(mantissa, 1000000)) { mantissa := div(mantissa, 1000000) exponent := add(exponent, 6) } if iszero(mod(mantissa, 10000)) { mantissa := div(mantissa, 10000) exponent := add(exponent, 4) } if iszero(mod(mantissa, 100)) { mantissa := div(mantissa, 100) exponent := add(exponent, 2) } if iszero(mod(mantissa, 10)) { mantissa := div(mantissa, 10) exponent := add(exponent, 1) } } } } /// @dev Convenience function for packing `x` into a smaller number using `sci`. /// The `mantissa` will be in bits [7..255] (the upper 249 bits). /// The `exponent` will be in bits [0..6] (the lower 7 bits). /// Use `SafeCastLib` to safely ensure that the `packed` number is small /// enough to fit in the desired unsigned integer type: /// ``` /// uint32 packed = SafeCastLib.toUint32(FixedPointMathLib.packSci(777 ether)); /// ``` function packSci(uint256 x) internal pure returns (uint256 packed) { (x, packed) = sci(x); // Reuse for `mantissa` and `exponent`. /// @solidity memory-safe-assembly assembly { if shr(249, x) { mstore(0x00, 0xce30380c) // `MantissaOverflow()`. revert(0x1c, 0x04) } packed := or(shl(7, x), packed) } } /// @dev Convenience function for unpacking a packed number from `packSci`. function unpackSci(uint256 packed) internal pure returns (uint256 unpacked) { unchecked { unpacked = (packed >> 7) * 10 ** (packed & 0x7f); } } /// @dev Returns the average of `x` and `y`. function avg(uint256 x, uint256 y) internal pure returns (uint256 z) { unchecked { z = (x & y) + ((x ^ y) >> 1); } } /// @dev Returns the average of `x` and `y`. function avg(int256 x, int256 y) internal pure returns (int256 z) { unchecked { z = (x >> 1) + (y >> 1) + (((x & 1) + (y & 1)) >> 1); } } /// @dev Returns the absolute value of `x`. function abs(int256 x) internal pure returns (uint256 z) { /// @solidity memory-safe-assembly assembly { z := xor(sub(0, shr(255, x)), add(sub(0, shr(255, x)), x)) } } /// @dev Returns the absolute distance between `x` and `y`. function dist(int256 x, int256 y) internal pure returns (uint256 z) { /// @solidity memory-safe-assembly assembly { z := xor(mul(xor(sub(y, x), sub(x, y)), sgt(x, y)), sub(y, x)) } } /// @dev Returns the minimum of `x` and `y`. function min(uint256 x, uint256 y) internal pure returns (uint256 z) { /// @solidity memory-safe-assembly assembly { z := xor(x, mul(xor(x, y), lt(y, x))) } } /// @dev Returns the minimum of `x` and `y`. function min(int256 x, int256 y) internal pure returns (int256 z) { /// @solidity memory-safe-assembly assembly { z := xor(x, mul(xor(x, y), slt(y, x))) } } /// @dev Returns the maximum of `x` and `y`. function max(uint256 x, uint256 y) internal pure returns (uint256 z) { /// @solidity memory-safe-assembly assembly { z := xor(x, mul(xor(x, y), gt(y, x))) } } /// @dev Returns the maximum of `x` and `y`. function max(int256 x, int256 y) internal pure returns (int256 z) { /// @solidity memory-safe-assembly assembly { z := xor(x, mul(xor(x, y), sgt(y, x))) } } /// @dev Returns `x`, bounded to `minValue` and `maxValue`. function clamp(uint256 x, uint256 minValue, uint256 maxValue) internal pure returns (uint256 z) { /// @solidity memory-safe-assembly assembly { z := xor(x, mul(xor(x, minValue), gt(minValue, x))) z := xor(z, mul(xor(z, maxValue), lt(maxValue, z))) } } /// @dev Returns `x`, bounded to `minValue` and `maxValue`. function clamp(int256 x, int256 minValue, int256 maxValue) internal pure returns (int256 z) { /// @solidity memory-safe-assembly assembly { z := xor(x, mul(xor(x, minValue), sgt(minValue, x))) z := xor(z, mul(xor(z, maxValue), slt(maxValue, z))) } } /// @dev Returns greatest common divisor of `x` and `y`. function gcd(uint256 x, uint256 y) internal pure returns (uint256 z) { /// @solidity memory-safe-assembly assembly { for { z := x } y {} { let t := y y := mod(z, y) z := t } } } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* RAW NUMBER OPERATIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Returns `x + y`, without checking for overflow. function rawAdd(uint256 x, uint256 y) internal pure returns (uint256 z) { unchecked { z = x + y; } } /// @dev Returns `x + y`, without checking for overflow. function rawAdd(int256 x, int256 y) internal pure returns (int256 z) { unchecked { z = x + y; } } /// @dev Returns `x - y`, without checking for underflow. function rawSub(uint256 x, uint256 y) internal pure returns (uint256 z) { unchecked { z = x - y; } } /// @dev Returns `x - y`, without checking for underflow. function rawSub(int256 x, int256 y) internal pure returns (int256 z) { unchecked { z = x - y; } } /// @dev Returns `x * y`, without checking for overflow. function rawMul(uint256 x, uint256 y) internal pure returns (uint256 z) { unchecked { z = x * y; } } /// @dev Returns `x * y`, without checking for overflow. function rawMul(int256 x, int256 y) internal pure returns (int256 z) { unchecked { z = x * y; } } /// @dev Returns `x / y`, returning 0 if `y` is zero. function rawDiv(uint256 x, uint256 y) internal pure returns (uint256 z) { /// @solidity memory-safe-assembly assembly { z := div(x, y) } } /// @dev Returns `x / y`, returning 0 if `y` is zero. function rawSDiv(int256 x, int256 y) internal pure returns (int256 z) { /// @solidity memory-safe-assembly assembly { z := sdiv(x, y) } } /// @dev Returns `x % y`, returning 0 if `y` is zero. function rawMod(uint256 x, uint256 y) internal pure returns (uint256 z) { /// @solidity memory-safe-assembly assembly { z := mod(x, y) } } /// @dev Returns `x % y`, returning 0 if `y` is zero. function rawSMod(int256 x, int256 y) internal pure returns (int256 z) { /// @solidity memory-safe-assembly assembly { z := smod(x, y) } } /// @dev Returns `(x + y) % d`, return 0 if `d` if zero. function rawAddMod(uint256 x, uint256 y, uint256 d) internal pure returns (uint256 z) { /// @solidity memory-safe-assembly assembly { z := addmod(x, y, d) } } /// @dev Returns `(x * y) % d`, return 0 if `d` if zero. function rawMulMod(uint256 x, uint256 y, uint256 d) internal pure returns (uint256 z) { /// @solidity memory-safe-assembly assembly { z := mulmod(x, y, d) } } } /// @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) ) ) } } } pragma abicoder v2; /// @title Callback for IUniswapV3PoolActions#swap /// @notice Any contract that calls IUniswapV3PoolActions#swap must implement this interface interface IUniswapV3SwapCallback { /// @notice Called to `msg.sender` after executing a swap via IUniswapV3Pool#swap. /// @dev In the implementation you must pay the pool tokens owed for the swap. /// The caller of this method must be checked to be a UniswapV3Pool deployed by the canonical UniswapV3Factory. /// amount0Delta and amount1Delta can both be 0 if no tokens were swapped. /// @param amount0Delta The amount of token0 that was sent (negative) or must be received (positive) by the pool by /// the end of the swap. If positive, the callback must send that amount of token0 to the pool. /// @param amount1Delta The amount of token1 that was sent (negative) or must be received (positive) by the pool by /// the end of the swap. If positive, the callback must send that amount of token1 to the pool. /// @param data Any data passed through by the caller via the IUniswapV3PoolActions#swap call function uniswapV3SwapCallback( int256 amount0Delta, int256 amount1Delta, bytes calldata data ) external; } /// @title Router token swapping functionality /// @notice Functions for swapping tokens via Uniswap V3 interface ISwapRouter is IUniswapV3SwapCallback { struct ExactInputSingleParams { address tokenIn; address tokenOut; uint24 fee; address recipient; uint256 deadline; uint256 amountIn; uint256 amountOutMinimum; uint160 sqrtPriceLimitX96; } /// @notice Swaps `amountIn` of one token for as much as possible of another token /// @param params The parameters necessary for the swap, encoded as `ExactInputSingleParams` in calldata /// @return amountOut The amount of the received token function exactInputSingle(ExactInputSingleParams calldata params) external payable returns (uint256 amountOut); struct ExactInputParams { bytes path; address recipient; uint256 deadline; uint256 amountIn; uint256 amountOutMinimum; } /// @notice Swaps `amountIn` of one token for as much as possible of another along the specified path /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata /// @return amountOut The amount of the received token function exactInput(ExactInputParams calldata params) external payable returns (uint256 amountOut); struct ExactOutputSingleParams { address tokenIn; address tokenOut; uint24 fee; address recipient; uint256 deadline; uint256 amountOut; uint256 amountInMaximum; uint160 sqrtPriceLimitX96; } /// @notice Swaps as little as possible of one token for `amountOut` of another token /// @param params The parameters necessary for the swap, encoded as `ExactOutputSingleParams` in calldata /// @return amountIn The amount of the input token function exactOutputSingle(ExactOutputSingleParams calldata params) external payable returns (uint256 amountIn); struct ExactOutputParams { bytes path; address recipient; uint256 deadline; uint256 amountOut; uint256 amountInMaximum; } /// @notice Swaps as little as possible of one token for `amountOut` of another along the specified path (reversed) /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactOutputParams` in calldata /// @return amountIn The amount of the input token function exactOutput(ExactOutputParams calldata params) external payable returns (uint256 amountIn); } contract GENAI404 is DN404MS2, Ownable { // // CONSTANTS // address internal constant SWAP_ROUTER = 0xE592427A0AEce92De3Edee1F18E0157C05861564; address internal constant WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; uint256 internal constant WHITELISTED_BITPOS = 1; uint256 internal constant BLACKLISTED_BITPOS = 87; uint256 internal immutable tax; // // ERRORS // error Locked(); error MaxBalanceLimitReached(); error NotLive(); error TradingLocked(); error MaxBalanceLocked(); error Blacklisted(); // // STORAGE // string private _name; string private _symbol; string private _baseURI; string private _dataURI; string private _preURI; string private _desc; string private _website = "https://genai.build/"; bool public maxBalanceLocked; bool public tradingLocked; bool public revealed; bool public live; bool public buyTax = true; bool public restricted; uint8 public maxBalanceLimit; address public pool; // // CONSTRUCTOR // constructor( string memory name_, string memory symbol_, uint96 initialTokenSupply, address initialSupplyOwner, uint16 tax_ // out of 1000; 5 = 5% ) { _initializeOwner(msg.sender); _setWhitelisted(msg.sender,true); _setWhitelisted(address(this),true); _name = name_; _symbol = symbol_; maxBalanceLimit = 10; tax = tax_; address mirror = address(new DN404Mirror(msg.sender)); _initializeDN404(initialTokenSupply, initialSupplyOwner, mirror); } // // TRANSFERS // function _applyMaxBalanceLimit(address from, uint256 toBalance, uint88 toAux) internal view { unchecked { uint256 limit = maxBalanceLimit; if (limit == 0) return; if (toBalance <= _WAD * limit) return; if (isWhitelisted_(toAux)) return; if (from == owner()) return; revert MaxBalanceLimitReached(); } } function _transfer(address from, address to, uint256 amount) internal override { if (to == address(0)) revert TransferToZeroAddress(); if(!live && from != owner()) revert NotLive(); 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; bool taxedBuy = (buyTax && from == pool && to != address(this)); if (amount > t.fromBalance) revert InsufficientBalance(); unchecked { if(restricted && (isBlacklisted_(toAddressData.aux) || isBlacklisted_(fromAddressData.aux))) revert Blacklisted(); t.fromBalance -= amount; fromAddressData.balance = uint96(t.fromBalance); if(taxedBuy){ $.addressData[address(this)].balance = uint96(_addressData(address(this)).balance + FixedPointMathLib.fullMulDiv(amount, (tax), 1000)); toAddressData.balance = uint96(t.toBalance = toAddressData.balance + FixedPointMathLib.fullMulDiv(amount, (1000 - tax), 1000)); } else { toAddressData.balance = uint96(t.toBalance = toAddressData.balance + amount); } t.nftAmountToBurn = _zeroFloorSub(t.fromOwnedLength, t.fromBalance / _WAD); if (toAddressData.flags & _ADDRESS_DATA_GET_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); } } _applyMaxBalanceLimit(from, toAddressData.balance, toAddressData.aux); if(!taxedBuy){ emit Transfer(from, to, amount); }else { emit Transfer(from, address(this), FixedPointMathLib.fullMulDiv(amount, (tax), 1000)); emit Transfer(from, to, FixedPointMathLib.fullMulDiv(amount, (1000-tax), 1000)); } } function _transferFromNFT(address from, address to, uint256 id, address msgSender) internal override { AddressData memory toAddressData = _addressData(to); DN404MS2._transferFromNFT(from, to, id, msgSender); _applyMaxBalanceLimit(from, toAddressData.balance, toAddressData.aux); } // // META // 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) { if (bytes(_baseURI).length > 0) { return string.concat(_baseURI, LibString.toString(tokenId)); } else { uint8 seed = uint8(bytes1(keccak256(abi.encodePacked(tokenId+16181)))); string memory image; string memory color; if (seed <= 100) { image = "gold.gif"; color = "Gold"; } else if (seed <= 160) { image = "emerald.gif"; color = "Emerald"; } else if (seed <= 210) { image = "aquamarine.gif"; color = "Aquamarine"; } else if (seed <= 240) { image = "amethyst.gif"; color = "Amythyst"; } else if (seed <= 255) { image = "garnet.gif"; color = "Garnet"; } string memory jsonPreImage = string.concat( string.concat( string.concat( string.concat('{"name": "GENPAL #', LibString.toString(tokenId)),'","description":"'), string.concat( string.concat( _desc, string.concat( '","external_url":"', _website ) ), '","image":"' ) ), string.concat(_dataURI, image) ); string memory jsonPostImage = string.concat( '","attributes":[{"trait_type":"Type","value":"', color ); string memory jsonPostTraits = '"}]}'; if(revealed){ return string.concat( "data:application/json;utf8,", string.concat( string.concat(jsonPreImage, jsonPostImage), jsonPostTraits ) ); } else { return string.concat( "data:application/json;utf8,", string.concat( string.concat( string.concat( string.concat( '{"name": "GENPAL #', LibString.toString(tokenId) ), '","description":"' ), string.concat( _desc, string.concat( '","external_url":"', _website ), '","image":"' ) ), string.concat( _preURI, '"}' ) ) ); } } } // // VIEW // function isWhitelisted(address target) public view returns (bool) { return isWhitelisted_(_getAux(target)); } function isBlacklisted(address target) public view returns (bool) { return isWhitelisted_(_getAux(target)); } // // OPERATIONS // function setWhitelist(address target, bool status) public onlyOwner { _setWhitelisted(target, status); } function setBlacklist(address[] calldata targets, bool status) public onlyOwner { for(uint160 i; i < targets.length;) { _setBlacklisted(targets[i],status); unchecked { ++i; } } } function setRestricted(bool status) public onlyOwner { restricted = status; } function setPool(address _pool, bool status) public onlyOwner { pool = _pool; _setWhitelisted(_pool, status); } function enableTrading( bool status) public onlyOwner { if(tradingLocked) revert TradingLocked(); restricted = true; live = status; } function reveal(bool status) public onlyOwner { revealed = status; } function setWalletHoldingMax(uint8 limit) public onlyOwner { if(maxBalanceLocked) revert MaxBalanceLocked(); maxBalanceLimit = limit; } function setBaseURI(string calldata baseURI_) public onlyOwner { _baseURI = baseURI_; } function setDataURI(string calldata dataURI_) public onlyOwner { _dataURI = dataURI_; } function setPreURI(string calldata preURI_) public onlyOwner { _preURI = preURI_; } function setDesc(string calldata desc_) public onlyOwner { _desc = desc_; } function setWebsite(string calldata website_) public onlyOwner { _website = website_; } function collectTaxes() public onlyOwner { DN404Storage storage $ = _getDN404Storage(); uint256 balance = $.addressData[address(this)].balance; $.allowance[address(this)][SWAP_ROUTER] = balance; emit Approval(address(this), SWAP_ROUTER, balance); taxSwap(balance); } function taxSwitch(bool status) public onlyOwner { buyTax = status; } function lockContract() public onlyOwner { tradingLocked = true; maxBalanceLocked = true; } function withdraw() public onlyOwner { SafeTransferLib.safeTransferAllETH(msg.sender); } function withdrawTaxes(uint256 amount) public onlyOwner { if(amount > balanceOf(address(this))){revert InsufficientBalance();} _transfer(address(this),owner(),amount); } // // INTERNAL // function taxSwap(uint256 contractBalance) internal { if (contractBalance == 0) { return; } uint256 total = totalSupply(); //only allowed to 1% sell MAX if (contractBalance > total / 100) { contractBalance = total / 100; } _swapTokensForEth(contractBalance); } function _swapTokensForEth(uint256 tokenAmount) internal { uint160 dline = uint160(block.timestamp + 10 minutes); ISwapRouter.ExactInputSingleParams memory params = ISwapRouter .ExactInputSingleParams({ tokenIn: address(this), tokenOut: WETH, fee: 10000, recipient: owner(), deadline: dline, amountIn: tokenAmount, amountOutMinimum: 0, sqrtPriceLimitX96: 0 }); ISwapRouter(SWAP_ROUTER).exactInputSingle(params); } function _setWhitelisted(address target, bool status) internal { _setAux(target, setWhitelisted_(_getAux(target),status)); } function _setBlacklisted(address target, bool status) internal { _setAux(target, setBlacklisted_(_getAux(target),status)); } function setWhitelisted_(uint88 packed, bool status) internal pure returns (uint88) { if (isWhitelisted_(packed) != status) { packed ^= uint88(1 << WHITELISTED_BITPOS); } return packed; } function setBlacklisted_(uint88 packed, bool status) internal pure returns (uint88) { if (isBlacklisted_(packed) != status) { packed ^= uint88(1 << BLACKLISTED_BITPOS); } return packed; } function isWhitelisted_(uint88 packed) internal pure returns (bool) { return packed >> WHITELISTED_BITPOS != 0; } function isBlacklisted_(uint88 packed) internal pure returns (bool) { return packed >> BLACKLISTED_BITPOS != 0; } }
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"},{"internalType":"uint16","name":"tax_","type":"uint16"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AlreadyInitialized","type":"error"},{"inputs":[],"name":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"Blacklisted","type":"error"},{"inputs":[],"name":"DNAlreadyInitialized","type":"error"},{"inputs":[],"name":"InsufficientAllowance","type":"error"},{"inputs":[],"name":"InsufficientBalance","type":"error"},{"inputs":[],"name":"LinkMirrorContractFailed","type":"error"},{"inputs":[],"name":"Locked","type":"error"},{"inputs":[],"name":"MaxBalanceLimitReached","type":"error"},{"inputs":[],"name":"MaxBalanceLocked","type":"error"},{"inputs":[],"name":"MirrorAddressIsZero","type":"error"},{"inputs":[],"name":"NewOwnerIsZeroAddress","type":"error"},{"inputs":[],"name":"NoHandoverRequest","type":"error"},{"inputs":[],"name":"NotLive","type":"error"},{"inputs":[],"name":"SenderNotMirror","type":"error"},{"inputs":[],"name":"TokenDoesNotExist","type":"error"},{"inputs":[],"name":"TotalSupplyOverflow","type":"error"},{"inputs":[],"name":"TradingLocked","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":"target","type":"address"},{"indexed":false,"internalType":"bool","name":"status","type":"bool"}],"name":"GetNFTSet","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":"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":"uint256","name":"amount","type":"uint256"}],"name":"balanceMint","outputs":[],"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":"buyTax","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"cancelOwnershipHandover","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"collectTaxes","outputs":[],"stateMutability":"nonpayable","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":"bool","name":"status","type":"bool"}],"name":"enableTrading","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"a","type":"address"}],"name":"getGetNFT","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"isBlacklisted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"isWhitelisted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"live","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lockContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"maxBalanceLimit","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxBalanceLocked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","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":"pool","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"requestOwnershipHandover","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"restricted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"status","type":"bool"}],"name":"reveal","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"revealed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"baseURI_","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"targets","type":"address[]"},{"internalType":"bool","name":"status","type":"bool"}],"name":"setBlacklist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"dataURI_","type":"string"}],"name":"setDataURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"desc_","type":"string"}],"name":"setDesc","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"getNFT","type":"bool"}],"name":"setGetNFT","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_pool","type":"address"},{"internalType":"bool","name":"status","type":"bool"}],"name":"setPool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"preURI_","type":"string"}],"name":"setPreURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"status","type":"bool"}],"name":"setRestricted","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"limit","type":"uint8"}],"name":"setWalletHoldingMax","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"website_","type":"string"}],"name":"setWebsite","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"target","type":"address"},{"internalType":"bool","name":"status","type":"bool"}],"name":"setWhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"status","type":"bool"}],"name":"taxSwitch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tradingLocked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"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"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdrawTaxes","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
60e060405268056bc75e2d631000006080819052600190620000269063ffffffff620004c8565b620000329190620004e2565b60a05260408051808201909152601481527f68747470733a2f2f67656e61692e6275696c642f000000000000000000000000602082015260069062000078908262000599565b506007805460ff60201b19166401000000001790553480156200009a57600080fd5b5060405162005e8338038062005e83833981016040819052620000bd916200072f565b620000c83362000183565b620000d5336001620001c0565b620000e2306001620001c0565b6000620000f0868262000599565b506001620000ff858262000599565b506007805460ff60301b1916660a00000000000017905561ffff811660c05260405160009033906200013190620004a4565b6001600160a01b039091168152602001604051809103906000f0801580156200015e573d6000803e3d6000fd5b509050620001776001600160601b038516848362000246565b505050505050620007ee565b6001600160a01b0316638b78c6d8198190558060007f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08180a35b50565b620002428262000201620001fa826001600160a01b0316600090815268a20d6e21d0e525531060205260409020546001600160581b031690565b84620003d5565b6001600160a01b0391909116600090815268a20d6e21d0e52553106020526040902080546001600160581b0319166001600160581b03909216919091179055565b5050565b68a20d6e21d0e52553088054640100000000900463ffffffff16156200027f57604051633ab534b960e21b815260040160405180910390fd5b6001600160a01b038216620002a7576040516339a84a7b60e01b815260040160405180910390fd5b620002b28262000409565b805463ffffffff60201b19166401000000001781556001810180546001600160a01b0384166001600160a01b03199091161790558315620003cf576001600160a01b0383166200031557604051633a954ecd60e21b815260040160405180910390fd5b60a051841115620003395760405163e5cfe95760e01b815260040160405180910390fd5b8054600160601b600160c01b0319166c010000000000000000000000006001600160601b03861602178155600062000371846200043c565b80546001600160a01b03908116600160a01b6001600160601b038916021782556040518781529192508516906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a3505b50505050565b6000811515620003f08460011c6001600160571b0316151590565b1515146200040057600292909218915b50815b92915050565b630f4599e560005233602052602060006024601c6000855af160016000511416620001bd5763d125259c6000526004601cfd5b6001600160a01b038116600090815268a20d6e21d0e5255310602052604081208054909168a20d6e21d0e5255308916b010000000000000000000000900460011690036200049e57815460ff60581b19166b0100000000000000000000001782555b50919050565b610dca80620050b983390190565b634e487b7160e01b600052601160045260246000fd5b8082028115828204841417620004035762000403620004b2565b81810381811115620004035762000403620004b2565b634e487b7160e01b600052604160045260246000fd5b600181811c908216806200052357607f821691505b6020821081036200049e57634e487b7160e01b600052602260045260246000fd5b601f82111562000594576000816000526020600020601f850160051c810160208610156200056f5750805b601f850160051c820191505b8181101562000590578281556001016200057b565b5050505b505050565b81516001600160401b03811115620005b557620005b5620004f8565b620005cd81620005c684546200050e565b8462000544565b602080601f831160018114620006055760008415620005ec5750858301515b600019600386901b1c1916600185901b17855562000590565b600085815260208120601f198616915b82811015620006365788860151825594840194600190910190840162000615565b5085821015620006555787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b600082601f8301126200067757600080fd5b81516001600160401b0380821115620006945762000694620004f8565b604051601f8301601f19908116603f01168101908282118183101715620006bf57620006bf620004f8565b8160405283815260209250866020858801011115620006dd57600080fd5b600091505b83821015620007015785820183015181830184015290820190620006e2565b6000602085830101528094505050505092915050565b805161ffff811681146200072a57600080fd5b919050565b600080600080600060a086880312156200074857600080fd5b85516001600160401b03808211156200076057600080fd5b6200076e89838a0162000665565b965060208801519150808211156200078557600080fd5b50620007948882890162000665565b604088015190955090506001600160601b0381168114620007b457600080fd5b60608701519093506001600160a01b0381168114620007d257600080fd5b9150620007e26080870162000717565b90509295509295909350565b60805160a05160c05161485162000868600039600081816130c801528181613162015281816138a1015261391e01526000505060008181611fb30152818161207b015281816127060152818161279c01528181612aee01528181612b5001528181613243015281816132df015261357901526148516000f3fe6080604052600436106103175760003560e01c806355f804b31161019a578063a85aba19116100e1578063f275f64b1161008a578063f8e652d111610064578063f8e652d114610ec9578063fe575a8714610adc578063fee81cf414610ee95761031e565b8063f275f64b14610e76578063f2fde38b14610e96578063f87f44b914610ea95761031e565b8063dd321ac4116100bb578063dd321ac414610de8578063dd62ed3e14610e08578063f04e283e14610e635761031e565b8063a85aba1914610d88578063a9059cbb14610da8578063c87b56dd14610dc85761031e565b80638da5cb5b11610143578063957aa58c1161011d578063957aa58c14610d3257806395d89b4114610d535780639614c76914610d685761031e565b80638da5cb5b14610cbe5780638ff3ffa714610cf2578063940cd05b14610d125761031e565b806370a082311161017457806370a0823114610c30578063715018a614610ca1578063753868e314610ca95761031e565b806355f804b314610bce57806367dd7bb414610bee5780637072c6b114610c0d5761031e565b806324daddc51161025e5780633ccfd60b1161020757806351830227116101e15780635183022714610b8657806353d6fd5914610ba657806354d1f13d14610bc65761031e565b80633ccfd60b14610b1c5780634ef41efc14610b315780634f7041a514610b645761031e565b8063313ce56711610238578063313ce56714610ac85780633af32abf14610adc5780633bfaa4ee14610afc5761031e565b806324daddc514610a805780632569296214610aa05780632a4929c214610aa85761031e565b80630e85d1e3116102c057806318d217c31161029a57806318d217c314610a2057806320bec12c14610a4057806323b872dd14610a605761031e565b80630e85d1e31461095e57806316f0115b1461097e57806318160ddd146109db5761031e565b806306fdde03116102f157806306fdde03146108fc578063074e86c01461091e578063095ea7b31461093e5761031e565b806301b613a514610882578063038c90ad1461089757806304dfe79d146108c65761031e565b3661031e57005b68a20d6e21d0e525530860003560e01c63e985e9c58190036103f757600182015473ffffffffffffffffffffffffffffffffffffffff16331461038d576040517fce5a776b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b604436101561039b57600080fd5b60043573ffffffffffffffffffffffffffffffffffffffff8181166000908152600385016020908152604080832060243594851684529091529020546103f49060ff166103e95760006103ec565b60015b60ff16610f1c565b50505b80636352211e0361048f57600182015473ffffffffffffffffffffffffffffffffffffffff163314610455576040517fce5a776b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b602436101561046357600080fd5b60043561048d61047282610f26565b73ffffffffffffffffffffffffffffffffffffffff16610f1c565b505b8063e5eb36c80361052257600182015473ffffffffffffffffffffffffffffffffffffffff1633146104ed576040517fce5a776b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60843610156104fb57600080fd5b60043560243560443560643561051384848484610f76565b61051d6001610f1c565b505050505b8063813500fc0361060d57600182015473ffffffffffffffffffffffffffffffffffffffff163314610580576040517fce5a776b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606436101561058e57600080fd5b73ffffffffffffffffffffffffffffffffffffffff604435818116600090815268a20d6e21d0e525530b602090815260408083206004359586168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166024351515908117909155906106096001610f1c565b5050505b8063d10b6e0c0361069457600182015473ffffffffffffffffffffffffffffffffffffffff16331461066b576040517fce5a776b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606436101561067957600080fd5b600435602435604435610690610472848484611050565b5050505b8063081812fc0361071157600182015473ffffffffffffffffffffffffffffffffffffffff1633146106f2576040517fce5a776b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b602436101561070057600080fd5b60043561070f610472826111a0565b505b8063f5b100ea036107d957600182015473ffffffffffffffffffffffffffffffffffffffff16331461076f576040517fce5a776b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b602436101561077d57600080fd5b6004356107d76107d28273ffffffffffffffffffffffffffffffffffffffff16600090815268a20d6e21d0e5255310602052604090205463ffffffff7001000000000000000000000000000000009091041690565b610f1c565b505b8063e2c792810361086b57600182015473ffffffffffffffffffffffffffffffffffffffff163314610837576040517fce5a776b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600436101561084557600080fd5b68a20d6e21d0e52553085461086b9068010000000000000000900463ffffffff16610f1c565b8063b7a94eb803610880576108806001610f1c565b005b34801561088e57600080fd5b50610880611212565b3480156108a357600080fd5b506007546108b19060ff1681565b60405190151581526020015b60405180910390f35b3480156108d257600080fd5b506007546108ea906601000000000000900460ff1681565b60405160ff90911681526020016108bd565b34801561090857600080fd5b506109116112db565b6040516108bd9190613f12565b34801561092a57600080fd5b50610880610939366004613f45565b61136d565b34801561094a57600080fd5b506108b1610959366004613f8c565b6113f0565b34801561096a57600080fd5b50610880610979366004613fc6565b611473565b34801561098a57600080fd5b506007546109b690670100000000000000900473ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016108bd565b3480156109e757600080fd5b5068a20d6e21d0e5255308546c0100000000000000000000000090046bffffffffffffffffffffffff165b6040519081526020016108bd565b348015610a2c57600080fd5b50610880610a3b36600461404a565b6114f0565b348015610a4c57600080fd5b50610880610a5b3660046140bc565b61150a565b348015610a6c57600080fd5b506108b1610a7b3660046140ef565b611566565b348015610a8c57600080fd5b50610880610a9b36600461412b565b61165a565b61088061169d565b348015610ab457600080fd5b50610880610ac336600461412b565b6116ed565b348015610ad457600080fd5b5060126108ea565b348015610ae857600080fd5b506108b1610af7366004614146565b61172f565b348015610b0857600080fd5b50610880610b17366004614161565b611774565b348015610b2857600080fd5b50610880611828565b348015610b3d57600080fd5b5068a20d6e21d0e52553095473ffffffffffffffffffffffffffffffffffffffff166109b6565b348015610b7057600080fd5b506007546108b190640100000000900460ff1681565b348015610b9257600080fd5b506007546108b19062010000900460ff1681565b348015610bb257600080fd5b50610880610bc13660046140bc565b61183b565b61088061184d565b348015610bda57600080fd5b50610880610be936600461404a565b611889565b348015610bfa57600080fd5b506007546108b190610100900460ff1681565b348015610c1957600080fd5b506007546108b19065010000000000900460ff1681565b348015610c3c57600080fd5b50610a12610c4b366004614146565b73ffffffffffffffffffffffffffffffffffffffff16600090815268a20d6e21d0e525531060205260409020547401000000000000000000000000000000000000000090046bffffffffffffffffffffffff1690565b61088061189e565b348015610cb557600080fd5b506108806118b0565b348015610cca57600080fd5b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffff74873927546109b6565b348015610cfe57600080fd5b50610880610d0d36600461412b565b6118e6565b348015610d1e57600080fd5b50610880610d2d36600461412b565b6118f0565b348015610d3e57600080fd5b506007546108b1906301000000900460ff1681565b348015610d5f57600080fd5b50610911611930565b348015610d7457600080fd5b50610880610d8336600461404a565b61193f565b348015610d9457600080fd5b50610880610da336600461404a565b611954565b348015610db457600080fd5b506108b1610dc3366004613f8c565b611969565b348015610dd457600080fd5b50610911610de3366004614161565b61197f565b348015610df457600080fd5b50610880610e03366004614161565b611f32565b348015610e1457600080fd5b50610a12610e2336600461417a565b73ffffffffffffffffffffffffffffffffffffffff918216600090815268a20d6e21d0e525530d6020908152604080832093909416825291909152205490565b610880610e71366004614146565b6122b3565b348015610e8257600080fd5b50610880610e9136600461412b565b6122f0565b610880610ea4366004614146565b61237b565b348015610eb557600080fd5b50610880610ec436600461404a565b6123a2565b348015610ed557600080fd5b506108b1610ee4366004614146565b6123b7565b348015610ef557600080fd5b50610a12610f04366004614146565b63389a75e1600c908152600091909152602090205490565b8060005260206000f35b6000610f3182612420565b610f67576040517fceea21b600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610f708261244a565b92915050565b6000610f81846124ac565b6040805160a08101825291546affffffffffffffffffffff8116835260ff6b010000000000000000000000820416602084015263ffffffff6c010000000000000000000000008204811692840192909252700100000000000000000000000000000000810490911660608301526bffffffffffffffffffffffff7401000000000000000000000000000000000000000090910416608082015290506110288585858561253b565b6110498582608001516bffffffffffffffffffffffff168360000151612b2e565b5050505050565b600068a20d6e21d0e52553088168a20d6e21d0e525530a8161109e68a20d6e21d0e525530f600189901b5b600381901c600090815260209290925260409091205460059190911b60e0161c90565b63ffffffff16815260208101919091526040016000205473ffffffffffffffffffffffffffffffffffffffff9081169150841681146111455773ffffffffffffffffffffffffffffffffffffffff808216600090815260038401602090815260408083209388168352929052205460ff16611145576040517fcfb3b94200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000858152600492909201602052604090912080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff871617905590505b9392505050565b60006111ab82612420565b6111e1576040517fceea21b600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50600090815268a20d6e21d0e525530c602052604090205473ffffffffffffffffffffffffffffffffffffffff1690565b61121a612c25565b30600081815268a20d6e21d0e5255310602090815260408083205468a20d6e21d0e525530d835281842073e592427a0aece92de3edee1f18e0157c0586156480865290845293829020740100000000000000000000000000000000000000009091046bffffffffffffffffffffffff16908190558151818152915168a20d6e21d0e52553089591949391927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92592908290030190a36112d781612c5b565b5050565b6060600080546112ea906141a4565b80601f0160208091040260200160405190810160405280929190818152602001828054611316906141a4565b80156113635780601f1061133857610100808354040283529160200191611363565b820191906000526020600020905b81548152906001019060200180831161134657829003601f168201915b5050505050905090565b611375612c25565b60075460ff16156113b2576040517fcd9633f600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6007805460ff9092166601000000000000027fffffffffffffffffffffffffffffffffffffffffffffffffff00ffffffffffff909216919091179055565b60008068a20d6e21d0e5255308336000818152600583016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8a16808552908352928190208890555187815293945090927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a35060019392505050565b61147b612c25565b60005b73ffffffffffffffffffffffffffffffffffffffff81168311156114ea576114e284848373ffffffffffffffffffffffffffffffffffffffff168181106114c7576114c76141f1565b90506020020160208101906114dc9190614146565b83612cb8565b60010161147e565b50505050565b6114f8612c25565b600361150582848361429f565b505050565b611512612c25565b600780547fffffffffff0000000000000000000000000000000000000000ffffffffffffff1667010000000000000073ffffffffffffffffffffffffffffffffffffffff8516021790556112d78282612d70565b73ffffffffffffffffffffffffffffffffffffffff8316600090815268a20d6e21d0e525530d6020908152604080832033845290915281205468a20d6e21d0e5255308907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8114611643578084111561160b576040517f13be252b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff861660009081526005830160209081526040808320338452909152902084820390555b61164e868686612dbe565b50600195945050505050565b611662612c25565b6007805491151565010000000000027fffffffffffffffffffffffffffffffffffffffffffffffffffff00ffffffffff909216919091179055565b60006202a30067ffffffffffffffff164201905063389a75e1600c5233600052806020600c2055337fdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d600080a250565b6116f5612c25565b60078054911515640100000000027fffffffffffffffffffffffffffffffffffffffffffffffffffffff00ffffffff909216919091179055565b73ffffffffffffffffffffffffffffffffffffffff8116600090815268a20d6e21d0e5255310602052604081205460011c6a7fffffffffffffffffffff161515610f70565b61177c612c25565b30600090815268a20d6e21d0e525531060205260409020547401000000000000000000000000000000000000000090046bffffffffffffffffffffffff168111156117f3576040517ff4d678b800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6118253061181f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff748739275490565b83612dbe565b50565b611830612c25565b61183933613965565b565b611843612c25565b6112d78282612d70565b63389a75e1600c523360005260006020600c2055337ffa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92600080a2565b611891612c25565b600261150582848361429f565b6118a6612c25565b6118396000613981565b6118b8612c25565b600780547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000016610101179055565b61182533826139e7565b6118f8612c25565b6007805491151562010000027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ffff909216919091179055565b6060600180546112ea906141a4565b611947612c25565b600561150582848361429f565b61195c612c25565b600461150582848361429f565b6000611976338484612dbe565b50600192915050565b6060600060028054611990906141a4565b905011156119ca5760026119a383613aaf565b6040516020016119b492919061442c565b6040516020818303038152906040529050919050565b60006119d883613f35614480565b6040516020016119ea91815260200190565b6040516020818303038152906040528051906020012060f81c905060608060648360ff1611611a88576040518060400160405280600881526020017f676f6c642e67696600000000000000000000000000000000000000000000000081525091506040518060400160405280600481526020017f476f6c64000000000000000000000000000000000000000000000000000000008152509050611c84565b60a08360ff1611611b08576040518060400160405280600b81526020017f656d6572616c642e67696600000000000000000000000000000000000000000081525091506040518060400160405280600781526020017f456d6572616c64000000000000000000000000000000000000000000000000008152509050611c84565b60d28360ff1611611b88576040518060400160405280600e81526020017f617175616d6172696e652e67696600000000000000000000000000000000000081525091506040518060400160405280600a81526020017f417175616d6172696e65000000000000000000000000000000000000000000008152509050611c84565b60f08360ff1611611c08576040518060400160405280600c81526020017f616d6574687973742e676966000000000000000000000000000000000000000081525091506040518060400160405280600881526020017f416d7974687973740000000000000000000000000000000000000000000000008152509050611c84565b60ff8360ff1611611c84576040518060400160405280600a81526020017f6761726e65742e6769660000000000000000000000000000000000000000000081525091506040518060400160405280600681526020017f4761726e6574000000000000000000000000000000000000000000000000000081525090505b6000611c8f86613aaf565b604051602001611c9f9190614493565b60408051601f1981840301815290829052611cbc916020016144d8565b60405160208183030381529060405260056006604051602001611cdf9190614519565b60408051601f1981840301815290829052611cfd929160200161442c565b60408051601f1981840301815290829052611d1a9160200161454b565b60408051601f1981840301815290829052611d38929160200161458c565b604051602081830303815290604052600384604051602001611d5b92919061442c565b60408051601f1981840301815290829052611d79929160200161458c565b6040516020818303038152906040529050600082604051602001611d9d91906145b2565b60408051808303601f19018152828201909152600482527f227d5d7d00000000000000000000000000000000000000000000000000000000602083015260075490925062010000900460ff1615611e59578282604051602001611e0192919061458c565b60408051601f1981840301815290829052611e2091839060200161458c565b60408051601f1981840301815290829052611e3d9160200161461d565b6040516020818303038152906040529650505050505050919050565b611e6288613aaf565b604051602001611e729190614493565b60408051601f1981840301815290829052611e8f916020016144d8565b60405160208183030381529060405260056006604051602001611eb29190614519565b60408051601f1981840301815290829052611ed09291602001614662565b60408051601f1981840301815290829052611eee929160200161458c565b6040516020818303038152906040526004604051602001611f0f91906146af565b60408051601f1981840301815290829052611e20929160200161458c565b919050565b68a20d6e21d0e52553086000611f47336124ac565b8054909150700100000000000000000000000000000000900463ffffffff166000611fa6856040805180820190915260608152600060208201526040805101828152806020018360051b81016040528183528083602001525050919050565b83549091508290611ffe907f0000000000000000000000000000000000000000000000000000000000000000907401000000000000000000000000000000000000000090046bffffffffffffffffffffffff16614717565b6120089190614752565b851115612041576040517ff4d678b800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b336000908152600685016020526040812090839061205f8883614480565b9050600061206d8733613af3565b88549091506000906120be907f0000000000000000000000000000000000000000000000000000000000000000906c0100000000000000000000000090046bffffffffffffffffffffffff16614717565b895490915063ffffffff64010000000082048116918c918c916008916120f39185916801000000000000000090910416614765565b82546101009290920a63ffffffff8181021990931691831602179091558a547fffffffffffffffffffffffff00000000ffffffffffffffffffffffffffffffff1670010000000000000000000000000000000091871691909102178a55505b6121638a60070161107b8360011b90565b63ffffffff161561218a578161217882614782565b9150811115612185575060015b612152565b6020869052600385901c600090815260409020805460e0600588901b1681811c841863ffffffff16901b18905561221260078b018285886121ca81614782565b99508163ffffffff168160201b17846020528360021c60005260406000206003851660061b815467ffffffffffffffff8482841c188116831b82188455505050505050505050565b602080880180513360601b600885901b17815290910190528161223482614782565b9150811115612241575060015b83850361215257895463ffffffff909116640100000000027fffffffffffffffffffffffffffffffffffffffffffffffff00000000ffffffff90911617895550505050508051511561104957600184015461104990829073ffffffffffffffffffffffffffffffffffffffff16613be5565b6122bb612c25565b63389a75e1600c52806000526020600c2080544211156122e357636f5e88186000526004601cfd5b6000905561182581613981565b6122f8612c25565b600754610100900460ff161561233a576040517fd623127200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600780549115156301000000027fffffffffffffffffffffffffffffffffffffffffffffffffffff00ff00ffffff9092169190911765010000000000179055565b612383612c25565b8060601b61239957637448fbae6000526004601cfd5b61182581613981565b6123aa612c25565b600661150582848361429f565b73ffffffffffffffffffffffffffffffffffffffff8116600090815268a20d6e21d0e52553106020526040812080546b0100000000000000000000009004600116820361240557823b611199565b546b0100000000000000000000009004600216151592915050565b60008061242c8361244a565b73ffffffffffffffffffffffffffffffffffffffff16141592915050565b600068a20d6e21d0e525530868a20d6e21d0e525530a8261247868a20d6e21d0e525530f600187901b61107b565b63ffffffff16815260208101919091526040016000205473ffffffffffffffffffffffffffffffffffffffff169392505050565b73ffffffffffffffffffffffffffffffffffffffff8116600090815268a20d6e21d0e5255310602052604081208054909168a20d6e21d0e5255308916b010000000000000000000000900460011690036125355781547fffffffffffffffffffffffffffffffffffffffff00ffffffffffffffffffffff166b0100000000000000000000001782555b50919050565b68a20d6e21d0e525530873ffffffffffffffffffffffffffffffffffffffff8416612592576040517fea553b3400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008160020160006125ab8460070161107b8860011b90565b63ffffffff16815260208101919091526040016000205473ffffffffffffffffffffffffffffffffffffffff908116915086168114612616576040517fa114810000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8573ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16146126e75773ffffffffffffffffffffffffffffffffffffffff808716600090815260038401602090815260408083209387168352929052205460ff166126e757600084815260048301602052604090205473ffffffffffffffffffffffffffffffffffffffff8481169116146126e7576040517f59c896be00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006126f2876124ac565b905060006126ff876124ac565b82549091507f000000000000000000000000000000000000000000000000000000000000000090839060149061275c9084907401000000000000000000000000000000000000000090046bffffffffffffffffffffffff166147ba565b82546101009290920a6bffffffffffffffffffffffff818102199093169183160217909155825473ffffffffffffffffffffffffffffffffffffffff81167f00000000000000000000000000000000000000000000000000000000000000007401000000000000000000000000000000000000000092839004841601909216021782555061282a60078501600188901b6127f6848b613af3565b826020528160031c60005260406000206007831660051b815463ffffffff8482841c188116831b8218845550505050505050565b6000868152600485016020908152604080832080547fffffffffffffffffffffffff000000000000000000000000000000000000000016905573ffffffffffffffffffffffffffffffffffffffff8b16835260068701825280832085547fffffffffffffffffffffffff00000000ffffffffffffffffffffffffffffffff81167001000000000000000000000000000000009182900463ffffffff9081167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01908116909202178755631fffffff600382901c168552925282205460059190911b60e0161c73ffffffffffffffffffffffffffffffffffffffff8a166000908152600687016020526040902063ffffffff919091169150612992906129576007880160018b811b0161107b565b63ffffffff1683826020528160031c60005260406000206007831660051b815463ffffffff8482841c188116831b8218845550505050505050565b8154600163ffffffff7001000000000000000000000000000000008084048216928301909116027fffffffffffffffffffffffff00000000ffffffffffffffffffffffffffffffff909216919091178355612a09600787016129f784600190811b0190565b6127f660078a0160018d811b0161107b565b73ffffffffffffffffffffffffffffffffffffffff891660009081526006870160209081526040808320909152600383901c82529020805460e0600584901b1681811c8b1863ffffffff16901b189055612a9b6007870160018a811b0183826020528160031c60005260406000206007831660051b815463ffffffff8482841c188116831b8218845550505050505050565b50508673ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef7f0000000000000000000000000000000000000000000000000000000000000000604051612b1c91815260200190565b60405180910390a35050505050505050565b6007546601000000000000900460ff166000819003612b4d5750505050565b807f0000000000000000000000000000000000000000000000000000000000000000028311612b7c5750505050565b600182901c6a7fffffffffffffffffffff1615612b995750505050565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff748739275473ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1603612bf35750505050565b6040517f0f2acbfc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff74873927543314611839576382b429006000526004601cfd5b80600003612c665750565b68a20d6e21d0e5255308546c0100000000000000000000000090046bffffffffffffffffffffffff16612c9a606482614717565b821115612caf57612cac606482614717565b91505b6112d782613c1e565b6112d782612d06612d008573ffffffffffffffffffffffffffffffffffffffff16600090815268a20d6e21d0e525531060205260409020546affffffffffffffffffffff1690565b84613ddd565b73ffffffffffffffffffffffffffffffffffffffff91909116600090815268a20d6e21d0e52553106020526040902080547fffffffffffffffffffffffffffffffffffffffffff0000000000000000000000166affffffffffffffffffffff909216919091179055565b6112d782612d06612db88573ffffffffffffffffffffffffffffffffffffffff16600090815268a20d6e21d0e525531060205260409020546affffffffffffffffffffff1690565b84613e0a565b73ffffffffffffffffffffffffffffffffffffffff8216612e0b576040517fea553b3400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6007546301000000900460ff16158015612e7257507fffffffffffffffffffffffffffffffffffffffffffffffffffffffff748739275473ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15612ea9576040517fbaf13b3f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b68a20d6e21d0e52553086000612ebe856124ac565b90506000612ecb856124ac565b9050612f066040518060c001604052806000815260200160008152602001600081526020016000815260200160008152602001600081525090565b825463ffffffff700100000000000000000000000000000000808304821660808501528454041660a08301526bffffffffffffffffffffffff7401000000000000000000000000000000000000000090910416604082015260075460009060ff640100000000909104168015612fa1575060075473ffffffffffffffffffffffffffffffffffffffff89811667010000000000000090920416145b8015612fc3575073ffffffffffffffffffffffffffffffffffffffff87163014155b90508160400151861115613003576040517ff4d678b800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60075465010000000000900460ff1680156130345750825460571c6001161515806130345750835460571c60011615155b1561306b576040517f09550c7700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040820180518790039081905284546bffffffffffffffffffffffff909116740100000000000000000000000000000000000000000273ffffffffffffffffffffffffffffffffffffffff90911617845580156131e6576130ef867f00000000000000000000000000000000000000000000000000000000000000006103e8613e30565b6130f8306124ac565b543060009081526008880160205260409020805473ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000928390046bffffffffffffffffffffffff9081169490940190931690910291909117905561318d867f00000000000000000000000000000000000000000000000000000000000000006103e890810390613e30565b83546bffffffffffffffffffffffff74010000000000000000000000000000000000000000808304821693909301606086018190521690910273ffffffffffffffffffffffffffffffffffffffff909116178355613239565b82546bffffffffffffffffffffffff7401000000000000000000000000000000000000000080830482168901606086018190529091160273ffffffffffffffffffffffffffffffffffffffff9091161783555b61327e82608001517f0000000000000000000000000000000000000000000000000000000000000000846040015181613274576132746146e8565b0480821191030290565b825282546b010000000000000000000000900460021615613325578673ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff16036132da57815160808301510360a08301525b61331f7f0000000000000000000000000000000000000000000000000000000000000000836060015181613310576133106146e8565b048360a0015180821191030290565b60208301525b600061336f83602001518460000151016040805180820190915260608152600060208201526040805101828152806020018360051b81016040528183528083602001525050919050565b8351909150156135235773ffffffffffffffffffffffffffffffffffffffff89166000908152600687016020526040902060808401518451885463ffffffff6801000000000000000080830482168490038216027fffffffffffffffffffffffffffffffffffffffff00000000ffffffffffffffff909216919091178a558854918303908116700100000000000000000000000000000000027fffffffffffffffffffffffff00000000ffffffffffffffffffffffffffffffff9092169190911788555b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff91909101600381901c600090815260208490526040812054919291600584901b60e0161c60078b01602052633fffffff600282901c16600090815260409020805460c0600684901b1681811c67ffffffffffffffff16901b18905563ffffffff169050600081815260048b016020526040902080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055613517858e8360018360200151818360081b8560601b171781526020810185602001525050505050565b50808203613433575050505b6020830151156137815773ffffffffffffffffffffffffffffffffffffffff881660009081526006870160209081526040822060a08601519186015190929082019061356f888d613af3565b8a549091506000907f0000000000000000000000000000000000000000000000000000000000000000906c0100000000000000000000000090046bffffffffffffffffffffffff16816135c4576135c46146e8565b8c5460208b01517fffffffffffffffffffffffffffffffffffffffff00000000ffffffffffffffff821663ffffffff6801000000000000000080850482169093018116909202178f558c547fffffffffffffffffffffffff00000000ffffffffffffffffffffffffffffffff1670010000000000000000000000000000000088831602178d559290910492506401000000009004165b61366b8c60070161107b8360011b90565b63ffffffff161561368a5760010181811115613685575060015b61365a565b6020869052600385901c600090815260409020805460e0600588901b1681811c841863ffffffff16901b18905560078c016020908152600282901c600090815260409020805460c0600685901b1681811c9389901b63ffffffff8816179390931867ffffffffffffffff1690921b909118905560019094019361372d878f8360008360200151818360081b8560601b171781526020810185602001525050505050565b6001018181111561373c575060015b83850361365a578b5463ffffffff909116640100000000027fffffffffffffffffffffffffffffffffffffffffffffffff00000000ffffffff909116178b5550505050505b805151156137af5760018601546137af90829073ffffffffffffffffffffffffffffffffffffffff16613be5565b5082546137f19089906bffffffffffffffffffffffff74010000000000000000000000000000000000000000820416906affffffffffffffffffffff16612b2e565b80613862578673ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8860405161385591815260200190565b60405180910390a361395b565b3073ffffffffffffffffffffffffffffffffffffffff89167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef6138c8897f00000000000000000000000000000000000000000000000000000000000000006103e8613e30565b60405190815260200160405180910390a373ffffffffffffffffffffffffffffffffffffffff8088169089167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef61394d896139457f00000000000000000000000000000000000000000000000000000000000000006103e8614752565b6103e8613e30565b604051908152602001612b1c565b5050505050505050565b60003860003847855af16118255763b12d13eb6000526004601cfd5b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff74873927805473ffffffffffffffffffffffffffffffffffffffff9092169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a355565b60006139f2836124ac565b80549091506b0100000000000000000000009004600216151582151514613a5857805460ff6b0100000000000000000000008083048216600218909116027fffffffffffffffffffffffffffffffffffffffff00ffffffffffffffffffffff9091161781555b8273ffffffffffffffffffffffffffffffffffffffff167f398a02892d45f032449640fbceed4ba77e4409f4af8ffb321df2bf9e6a5d7ed683604051613aa2911515815260200190565b60405180910390a2505050565b60606080604051019050602081016040526000815280600019835b928101926030600a8206018453600a900480613aca575050819003601f19909101908152919050565b81546c01000000000000000000000000900463ffffffff1668a20d6e21d0e52553086000829003613bde5780548190600090613b349063ffffffff166147df565b825463ffffffff8083166101009490940a8481029102199091161790925585546c0100000000000000000000000082027fffffffffffffffffffffffffffffffff00000000ffffffffffffffffffffffff90911617865560009081526002830160205260409020805473ffffffffffffffffffffffffffffffffffffffff86167fffffffffffffffffffffffff000000000000000000000000000000000000000090911617905591505b5092915050565b81516040810363263c69d68152602080820152815160051b604401915060208183601c84016000875af16001825114166114ea57600081fd5b6000613c2c42610258614480565b905060006040518061010001604052803073ffffffffffffffffffffffffffffffffffffffff16815260200173c02aaa39b223fe8d0a0e5c4f27ead9083c756cc273ffffffffffffffffffffffffffffffffffffffff16815260200161271062ffffff168152602001613cbd7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff748739275490565b73ffffffffffffffffffffffffffffffffffffffff908116825284811660208084019190915260408084018890526000606080860182905260809586019190915281517f414bf38900000000000000000000000000000000000000000000000000000000815286518516600482015292860151841660248401529085015162ffffff1660448301528401518216606482015291830151608483015260a083015160a483015260c083015160c483015260e08301511660e482015290915073e592427a0aece92de3edee1f18e0157c058615649063414bf38990610104016020604051808303816000875af1158015613db9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114ea9190614802565b60006001605784901c16151582151514613e03576a800000000000000000000092909218915b5090919050565b60006a7fffffffffffffffffffff600184901c16151582151514613e0357505060021890565b8282027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8385098181108201900380613e7f5782613e765763ae47f7026000526004601cfd5b50819004611199565b808311613e945763ae47f7026000526004601cfd5b82848609600084810385169485900494848311909303908390038390046001010292030417600260038302811880840282030280840282030280840282030280840282030280840282030280840290910302029392505050565b60005b83811015613f09578181015183820152602001613ef1565b50506000910152565b6020815260008251806020840152613f31816040850160208701613eee565b601f01601f19169190910160400192915050565b600060208284031215613f5757600080fd5b813560ff8116811461119957600080fd5b803573ffffffffffffffffffffffffffffffffffffffff81168114611f2d57600080fd5b60008060408385031215613f9f57600080fd5b613fa883613f68565b946020939093013593505050565b80358015158114611f2d57600080fd5b600080600060408486031215613fdb57600080fd5b833567ffffffffffffffff80821115613ff357600080fd5b818601915086601f83011261400757600080fd5b81358181111561401657600080fd5b8760208260051b850101111561402b57600080fd5b6020928301955093506140419186019050613fb6565b90509250925092565b6000806020838503121561405d57600080fd5b823567ffffffffffffffff8082111561407557600080fd5b818501915085601f83011261408957600080fd5b81358181111561409857600080fd5b8660208285010111156140aa57600080fd5b60209290920196919550909350505050565b600080604083850312156140cf57600080fd5b6140d883613f68565b91506140e660208401613fb6565b90509250929050565b60008060006060848603121561410457600080fd5b61410d84613f68565b925061411b60208501613f68565b9150604084013590509250925092565b60006020828403121561413d57600080fd5b61119982613fb6565b60006020828403121561415857600080fd5b61119982613f68565b60006020828403121561417357600080fd5b5035919050565b6000806040838503121561418d57600080fd5b61419683613f68565b91506140e660208401613f68565b600181811c908216806141b857607f821691505b602082108103612535577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b601f821115611505576000816000526020600020601f850160051c810160208610156142785750805b601f850160051c820191505b8181101561429757828155600101614284565b505050505050565b67ffffffffffffffff8311156142b7576142b7614220565b6142cb836142c583546141a4565b8361424f565b6000601f84116001811461431d57600085156142e75750838201355b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600387901b1c1916600186901b178355611049565b600083815260209020601f19861690835b8281101561434e578685013582556020948501946001909201910161432e565b5086821015614389577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60f88860031b161c19848701351681555b505060018560011b0183555050505050565b600081546143a8816141a4565b600182811680156143c057600181146143f357614422565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0084168752821515830287019450614422565b8560005260208060002060005b858110156144195781548a820152908401908201614400565b50505082870194505b5050505092915050565b6000614438828561439b565b8351614448818360208801613eee565b01949350505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b80820180821115610f7057610f70614451565b7f7b226e616d65223a202247454e50414c202300000000000000000000000000008152600082516144cb816012850160208701613eee565b9190910160120192915050565b600082516144ea818460208701613eee565b7f222c226465736372697074696f6e223a22000000000000000000000000000000920191825250601101919050565b7f222c2265787465726e616c5f75726c223a22000000000000000000000000000081526000611199601283018461439b565b6000825161455d818460208701613eee565b7f222c22696d616765223a22000000000000000000000000000000000000000000920191825250600b01919050565b6000835161459e818460208801613eee565b835190830190614448818360208801613eee565b7f222c2261747472696275746573223a5b7b2274726169745f74797065223a225481527f797065222c2276616c7565223a2200000000000000000000000000000000000060208201526000825161461081602e850160208701613eee565b91909101602e0192915050565b7f646174613a6170706c69636174696f6e2f6a736f6e3b757466382c000000000081526000825161465581601b850160208701613eee565b91909101601b0192915050565b600061466e828561439b565b835161467e818360208801613eee565b7f222c22696d616765223a220000000000000000000000000000000000000000009101908152600b01949350505050565b60006146bb828461439b565b7f227d00000000000000000000000000000000000000000000000000000000000081526002019392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60008261474d577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b81810381811115610f7057610f70614451565b63ffffffff818116838216019080821115613bde57613bde614451565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036147b3576147b3614451565b5060010190565b6bffffffffffffffffffffffff828116828216039080821115613bde57613bde614451565b600063ffffffff8083168181036147f8576147f8614451565b6001019392505050565b60006020828403121561481457600080fd5b505191905056fea26469706673582212201abba9c367d7c501475c2e3dad64da0552430a12dfc4b2f4ae7bf4d4788c976f64736f6c63430008180033608060405234801561001057600080fd5b50604051610dca380380610dca83398101604081905261002f9161005c565b683602298b8c10b0123180546001600160a01b0319166001600160a01b039290921691909117905561008c565b60006020828403121561006e57600080fd5b81516001600160a01b038116811461008557600080fd5b9392505050565b610d2f8061009b6000396000f3fe6080604052600436106100ec5760003560e01c80636352211e1161008a578063a22cb46511610059578063a22cb46514610499578063b88d4fde146104b9578063c87b56dd146104d9578063e985e9c5146104f9576100f3565b80636352211e1461042f57806370a082311461044f57806395d89b411461046f57806397e5311c14610484576100f3565b8063095ea7b3116100c6578063095ea7b3146103b957806318160ddd146103d957806323b872dd146103fc57806342842e0e1461041c576100f3565b806301ffc9a71461030057806306fdde0314610352578063081812fc14610374576100f3565b366100f357005b683602298b8c10b0123060003560e01c63263c69d68190036101e557815473ffffffffffffffffffffffffffffffffffffffff16331461015f576040517f363cb31200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b602036103d60003e6004356024018036103d60003e602081033560051b81018036103d60003e5b8082146101d85781358060601c816001168260a01b60a81c811583028284027fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600038a4505050816020019150610186565b5050600160005260206000f35b80630f4599e5036102fe57600182015473ffffffffffffffffffffffffffffffffffffffff161561027b57600182015473ffffffffffffffffffffffffffffffffffffffff1660043573ffffffffffffffffffffffffffffffffffffffff161461027b576040517fc59ec47a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b815473ffffffffffffffffffffffffffffffffffffffff16156102ca576040517fbf656a4600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b81547fffffffffffffffffffffffff0000000000000000000000000000000000000000163317825560016000908152602090f35b005b34801561030c57600080fd5b5061033d61031b366004610a76565b6301ffc9a760e09190911c9081146380ac58cd821417635b5e139f9091141790565b60405190151581526020015b60405180910390f35b34801561035e57600080fd5b50610367610519565b6040516103499190610abf565b34801561038057600080fd5b5061039461038f366004610b2c565b610573565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610349565b3480156103c557600080fd5b506102fe6103d4366004610b6e565b6105ba565b3480156103e557600080fd5b506103ee610640565b604051908152602001610349565b34801561040857600080fd5b506102fe610417366004610b98565b61067e565b6102fe61042a366004610b98565b61070d565b34801561043b57600080fd5b5061039461044a366004610b2c565b61073f565b34801561045b57600080fd5b506103ee61046a366004610bd4565b610779565b34801561047b57600080fd5b506103676107c3565b34801561049057600080fd5b506103946107f5565b3480156104a557600080fd5b506102fe6104b4366004610bef565b610850565b3480156104c557600080fd5b506102fe6104d4366004610c2b565b6108d3565b3480156104e557600080fd5b506103676104f4366004610b2c565b61092e565b34801561050557600080fd5b5061033d610514366004610cc6565b61098e565b606060006105256107f5565b905060405191506306fdde036000526000806004601c845afa61054b573d6000833e3d82fd5b60206000803e6020600051833e8151602060005101602084013e815160208301016040525090565b60008061057e6107f5565b905063081812fc60005282602052602060006024601c845afa601f3d11166105ad573d60006040513e3d604051fd5b5050600c5160601c919050565b60006105c46107f5565b90508260601b60601c925060405163d10b6e0c600052836020528260405233606052602060006064601c34865af1601f3d1116610604573d6000823e3d81fd5b806040525060006060528183600c5160601c7f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600038a4505050565b60008061064b6107f5565b905063e2c79281600052602060006004601c845afa601f3d1116610676573d60006040513e3d604051fd5b505060005190565b60006106886107f5565b90508360601b60601c93508260601b60601c925060405163e5eb36c881528460208201528360408201528260608201523360808201526020816084601c840134865af16001825114166106de573d6000823e3d81fd5b508183857fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600038a450505050565b61071883838361067e565b813b1561073a5761073a838383604051806020016040528060008152506109ea565b505050565b60008061074a6107f5565b9050636352211e60005282602052602060006024601c845afa601f3d11166105ad573d60006040513e3d604051fd5b6000806107846107f5565b90508260601b60601c60205263f5b100ea600052602060006024601c845afa601f3d11166107b9573d60006040513e3d604051fd5b5050600051919050565b606060006107cf6107f5565b905060405191506395d89b416000526000806004601c845afa61054b573d6000833e3d82fd5b683602298b8c10b012305473ffffffffffffffffffffffffffffffffffffffff168061084d576040517f5b2a47ae00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b90565b600061085a6107f5565b90508260601b60601c925060405163813500fc6000528360205282151560405233606052602060006064601c34865af16001600051141661089e573d6000823e3d81fd5b83337f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3160206040a36040525050600060605250565b6108de85858561067e565b833b156109275761092785858585858080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506109ea92505050565b5050505050565b6060600061093a6107f5565b905060405191508260205263c87b56dd6000526000806024601c845afa610964573d6000833e3d82fd5b60206000803e6020600051833e8151602060005101602084013e8151602083010160405250919050565b6000806109996107f5565b9050604051836040528460601b602c526fe985e9c5000000000000000000000000600c52602060006044601c855afa601f3d11166109da573d6000823e3d81fd5b6040525050600051151592915050565b60405163150b7a028082523360208301528560601b60601c604083015283606083015260808083015282518060a08401528015610a31578060c08401826020870160045afa505b60208360a48301601c860160008a5af1610a54573d15610a54573d6000843e3d83fd5b508060e01b825114610a6e5763d1a57ed66000526004601cfd5b505050505050565b600060208284031215610a8857600080fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114610ab857600080fd5b9392505050565b60006020808352835180602085015260005b81811015610aed57858101830151858201604001528201610ad1565b5060006040828601015260407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8301168501019250505092915050565b600060208284031215610b3e57600080fd5b5035919050565b803573ffffffffffffffffffffffffffffffffffffffff81168114610b6957600080fd5b919050565b60008060408385031215610b8157600080fd5b610b8a83610b45565b946020939093013593505050565b600080600060608486031215610bad57600080fd5b610bb684610b45565b9250610bc460208501610b45565b9150604084013590509250925092565b600060208284031215610be657600080fd5b610ab882610b45565b60008060408385031215610c0257600080fd5b610c0b83610b45565b915060208301358015158114610c2057600080fd5b809150509250929050565b600080600080600060808688031215610c4357600080fd5b610c4c86610b45565b9450610c5a60208701610b45565b935060408601359250606086013567ffffffffffffffff80821115610c7e57600080fd5b818801915088601f830112610c9257600080fd5b813581811115610ca157600080fd5b896020828501011115610cb357600080fd5b9699959850939650602001949392505050565b60008060408385031215610cd957600080fd5b610ce283610b45565b9150610cf060208401610b45565b9050925092905056fea2646970667358221220b8bbf3bd95d6cae55066ecf791bf44981f04ca911d11c8d4a4b3afbb38d1e7a964736f6c6343000818003300000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000d3c21bcecceda1000000000000000000000000000000163fb35efe6cd4dfb6a9b399142bfdf138dbd0840000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000547454e4149000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000547454e4149000000000000000000000000000000000000000000000000000000
Deployed Bytecode
0x6080604052600436106103175760003560e01c806355f804b31161019a578063a85aba19116100e1578063f275f64b1161008a578063f8e652d111610064578063f8e652d114610ec9578063fe575a8714610adc578063fee81cf414610ee95761031e565b8063f275f64b14610e76578063f2fde38b14610e96578063f87f44b914610ea95761031e565b8063dd321ac4116100bb578063dd321ac414610de8578063dd62ed3e14610e08578063f04e283e14610e635761031e565b8063a85aba1914610d88578063a9059cbb14610da8578063c87b56dd14610dc85761031e565b80638da5cb5b11610143578063957aa58c1161011d578063957aa58c14610d3257806395d89b4114610d535780639614c76914610d685761031e565b80638da5cb5b14610cbe5780638ff3ffa714610cf2578063940cd05b14610d125761031e565b806370a082311161017457806370a0823114610c30578063715018a614610ca1578063753868e314610ca95761031e565b806355f804b314610bce57806367dd7bb414610bee5780637072c6b114610c0d5761031e565b806324daddc51161025e5780633ccfd60b1161020757806351830227116101e15780635183022714610b8657806353d6fd5914610ba657806354d1f13d14610bc65761031e565b80633ccfd60b14610b1c5780634ef41efc14610b315780634f7041a514610b645761031e565b8063313ce56711610238578063313ce56714610ac85780633af32abf14610adc5780633bfaa4ee14610afc5761031e565b806324daddc514610a805780632569296214610aa05780632a4929c214610aa85761031e565b80630e85d1e3116102c057806318d217c31161029a57806318d217c314610a2057806320bec12c14610a4057806323b872dd14610a605761031e565b80630e85d1e31461095e57806316f0115b1461097e57806318160ddd146109db5761031e565b806306fdde03116102f157806306fdde03146108fc578063074e86c01461091e578063095ea7b31461093e5761031e565b806301b613a514610882578063038c90ad1461089757806304dfe79d146108c65761031e565b3661031e57005b68a20d6e21d0e525530860003560e01c63e985e9c58190036103f757600182015473ffffffffffffffffffffffffffffffffffffffff16331461038d576040517fce5a776b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b604436101561039b57600080fd5b60043573ffffffffffffffffffffffffffffffffffffffff8181166000908152600385016020908152604080832060243594851684529091529020546103f49060ff166103e95760006103ec565b60015b60ff16610f1c565b50505b80636352211e0361048f57600182015473ffffffffffffffffffffffffffffffffffffffff163314610455576040517fce5a776b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b602436101561046357600080fd5b60043561048d61047282610f26565b73ffffffffffffffffffffffffffffffffffffffff16610f1c565b505b8063e5eb36c80361052257600182015473ffffffffffffffffffffffffffffffffffffffff1633146104ed576040517fce5a776b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60843610156104fb57600080fd5b60043560243560443560643561051384848484610f76565b61051d6001610f1c565b505050505b8063813500fc0361060d57600182015473ffffffffffffffffffffffffffffffffffffffff163314610580576040517fce5a776b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606436101561058e57600080fd5b73ffffffffffffffffffffffffffffffffffffffff604435818116600090815268a20d6e21d0e525530b602090815260408083206004359586168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166024351515908117909155906106096001610f1c565b5050505b8063d10b6e0c0361069457600182015473ffffffffffffffffffffffffffffffffffffffff16331461066b576040517fce5a776b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606436101561067957600080fd5b600435602435604435610690610472848484611050565b5050505b8063081812fc0361071157600182015473ffffffffffffffffffffffffffffffffffffffff1633146106f2576040517fce5a776b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b602436101561070057600080fd5b60043561070f610472826111a0565b505b8063f5b100ea036107d957600182015473ffffffffffffffffffffffffffffffffffffffff16331461076f576040517fce5a776b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b602436101561077d57600080fd5b6004356107d76107d28273ffffffffffffffffffffffffffffffffffffffff16600090815268a20d6e21d0e5255310602052604090205463ffffffff7001000000000000000000000000000000009091041690565b610f1c565b505b8063e2c792810361086b57600182015473ffffffffffffffffffffffffffffffffffffffff163314610837576040517fce5a776b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600436101561084557600080fd5b68a20d6e21d0e52553085461086b9068010000000000000000900463ffffffff16610f1c565b8063b7a94eb803610880576108806001610f1c565b005b34801561088e57600080fd5b50610880611212565b3480156108a357600080fd5b506007546108b19060ff1681565b60405190151581526020015b60405180910390f35b3480156108d257600080fd5b506007546108ea906601000000000000900460ff1681565b60405160ff90911681526020016108bd565b34801561090857600080fd5b506109116112db565b6040516108bd9190613f12565b34801561092a57600080fd5b50610880610939366004613f45565b61136d565b34801561094a57600080fd5b506108b1610959366004613f8c565b6113f0565b34801561096a57600080fd5b50610880610979366004613fc6565b611473565b34801561098a57600080fd5b506007546109b690670100000000000000900473ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016108bd565b3480156109e757600080fd5b5068a20d6e21d0e5255308546c0100000000000000000000000090046bffffffffffffffffffffffff165b6040519081526020016108bd565b348015610a2c57600080fd5b50610880610a3b36600461404a565b6114f0565b348015610a4c57600080fd5b50610880610a5b3660046140bc565b61150a565b348015610a6c57600080fd5b506108b1610a7b3660046140ef565b611566565b348015610a8c57600080fd5b50610880610a9b36600461412b565b61165a565b61088061169d565b348015610ab457600080fd5b50610880610ac336600461412b565b6116ed565b348015610ad457600080fd5b5060126108ea565b348015610ae857600080fd5b506108b1610af7366004614146565b61172f565b348015610b0857600080fd5b50610880610b17366004614161565b611774565b348015610b2857600080fd5b50610880611828565b348015610b3d57600080fd5b5068a20d6e21d0e52553095473ffffffffffffffffffffffffffffffffffffffff166109b6565b348015610b7057600080fd5b506007546108b190640100000000900460ff1681565b348015610b9257600080fd5b506007546108b19062010000900460ff1681565b348015610bb257600080fd5b50610880610bc13660046140bc565b61183b565b61088061184d565b348015610bda57600080fd5b50610880610be936600461404a565b611889565b348015610bfa57600080fd5b506007546108b190610100900460ff1681565b348015610c1957600080fd5b506007546108b19065010000000000900460ff1681565b348015610c3c57600080fd5b50610a12610c4b366004614146565b73ffffffffffffffffffffffffffffffffffffffff16600090815268a20d6e21d0e525531060205260409020547401000000000000000000000000000000000000000090046bffffffffffffffffffffffff1690565b61088061189e565b348015610cb557600080fd5b506108806118b0565b348015610cca57600080fd5b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffff74873927546109b6565b348015610cfe57600080fd5b50610880610d0d36600461412b565b6118e6565b348015610d1e57600080fd5b50610880610d2d36600461412b565b6118f0565b348015610d3e57600080fd5b506007546108b1906301000000900460ff1681565b348015610d5f57600080fd5b50610911611930565b348015610d7457600080fd5b50610880610d8336600461404a565b61193f565b348015610d9457600080fd5b50610880610da336600461404a565b611954565b348015610db457600080fd5b506108b1610dc3366004613f8c565b611969565b348015610dd457600080fd5b50610911610de3366004614161565b61197f565b348015610df457600080fd5b50610880610e03366004614161565b611f32565b348015610e1457600080fd5b50610a12610e2336600461417a565b73ffffffffffffffffffffffffffffffffffffffff918216600090815268a20d6e21d0e525530d6020908152604080832093909416825291909152205490565b610880610e71366004614146565b6122b3565b348015610e8257600080fd5b50610880610e9136600461412b565b6122f0565b610880610ea4366004614146565b61237b565b348015610eb557600080fd5b50610880610ec436600461404a565b6123a2565b348015610ed557600080fd5b506108b1610ee4366004614146565b6123b7565b348015610ef557600080fd5b50610a12610f04366004614146565b63389a75e1600c908152600091909152602090205490565b8060005260206000f35b6000610f3182612420565b610f67576040517fceea21b600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610f708261244a565b92915050565b6000610f81846124ac565b6040805160a08101825291546affffffffffffffffffffff8116835260ff6b010000000000000000000000820416602084015263ffffffff6c010000000000000000000000008204811692840192909252700100000000000000000000000000000000810490911660608301526bffffffffffffffffffffffff7401000000000000000000000000000000000000000090910416608082015290506110288585858561253b565b6110498582608001516bffffffffffffffffffffffff168360000151612b2e565b5050505050565b600068a20d6e21d0e52553088168a20d6e21d0e525530a8161109e68a20d6e21d0e525530f600189901b5b600381901c600090815260209290925260409091205460059190911b60e0161c90565b63ffffffff16815260208101919091526040016000205473ffffffffffffffffffffffffffffffffffffffff9081169150841681146111455773ffffffffffffffffffffffffffffffffffffffff808216600090815260038401602090815260408083209388168352929052205460ff16611145576040517fcfb3b94200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000858152600492909201602052604090912080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff871617905590505b9392505050565b60006111ab82612420565b6111e1576040517fceea21b600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50600090815268a20d6e21d0e525530c602052604090205473ffffffffffffffffffffffffffffffffffffffff1690565b61121a612c25565b30600081815268a20d6e21d0e5255310602090815260408083205468a20d6e21d0e525530d835281842073e592427a0aece92de3edee1f18e0157c0586156480865290845293829020740100000000000000000000000000000000000000009091046bffffffffffffffffffffffff16908190558151818152915168a20d6e21d0e52553089591949391927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92592908290030190a36112d781612c5b565b5050565b6060600080546112ea906141a4565b80601f0160208091040260200160405190810160405280929190818152602001828054611316906141a4565b80156113635780601f1061133857610100808354040283529160200191611363565b820191906000526020600020905b81548152906001019060200180831161134657829003601f168201915b5050505050905090565b611375612c25565b60075460ff16156113b2576040517fcd9633f600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6007805460ff9092166601000000000000027fffffffffffffffffffffffffffffffffffffffffffffffffff00ffffffffffff909216919091179055565b60008068a20d6e21d0e5255308336000818152600583016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8a16808552908352928190208890555187815293945090927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a35060019392505050565b61147b612c25565b60005b73ffffffffffffffffffffffffffffffffffffffff81168311156114ea576114e284848373ffffffffffffffffffffffffffffffffffffffff168181106114c7576114c76141f1565b90506020020160208101906114dc9190614146565b83612cb8565b60010161147e565b50505050565b6114f8612c25565b600361150582848361429f565b505050565b611512612c25565b600780547fffffffffff0000000000000000000000000000000000000000ffffffffffffff1667010000000000000073ffffffffffffffffffffffffffffffffffffffff8516021790556112d78282612d70565b73ffffffffffffffffffffffffffffffffffffffff8316600090815268a20d6e21d0e525530d6020908152604080832033845290915281205468a20d6e21d0e5255308907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8114611643578084111561160b576040517f13be252b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff861660009081526005830160209081526040808320338452909152902084820390555b61164e868686612dbe565b50600195945050505050565b611662612c25565b6007805491151565010000000000027fffffffffffffffffffffffffffffffffffffffffffffffffffff00ffffffffff909216919091179055565b60006202a30067ffffffffffffffff164201905063389a75e1600c5233600052806020600c2055337fdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d600080a250565b6116f5612c25565b60078054911515640100000000027fffffffffffffffffffffffffffffffffffffffffffffffffffffff00ffffffff909216919091179055565b73ffffffffffffffffffffffffffffffffffffffff8116600090815268a20d6e21d0e5255310602052604081205460011c6a7fffffffffffffffffffff161515610f70565b61177c612c25565b30600090815268a20d6e21d0e525531060205260409020547401000000000000000000000000000000000000000090046bffffffffffffffffffffffff168111156117f3576040517ff4d678b800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6118253061181f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff748739275490565b83612dbe565b50565b611830612c25565b61183933613965565b565b611843612c25565b6112d78282612d70565b63389a75e1600c523360005260006020600c2055337ffa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92600080a2565b611891612c25565b600261150582848361429f565b6118a6612c25565b6118396000613981565b6118b8612c25565b600780547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000016610101179055565b61182533826139e7565b6118f8612c25565b6007805491151562010000027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ffff909216919091179055565b6060600180546112ea906141a4565b611947612c25565b600561150582848361429f565b61195c612c25565b600461150582848361429f565b6000611976338484612dbe565b50600192915050565b6060600060028054611990906141a4565b905011156119ca5760026119a383613aaf565b6040516020016119b492919061442c565b6040516020818303038152906040529050919050565b60006119d883613f35614480565b6040516020016119ea91815260200190565b6040516020818303038152906040528051906020012060f81c905060608060648360ff1611611a88576040518060400160405280600881526020017f676f6c642e67696600000000000000000000000000000000000000000000000081525091506040518060400160405280600481526020017f476f6c64000000000000000000000000000000000000000000000000000000008152509050611c84565b60a08360ff1611611b08576040518060400160405280600b81526020017f656d6572616c642e67696600000000000000000000000000000000000000000081525091506040518060400160405280600781526020017f456d6572616c64000000000000000000000000000000000000000000000000008152509050611c84565b60d28360ff1611611b88576040518060400160405280600e81526020017f617175616d6172696e652e67696600000000000000000000000000000000000081525091506040518060400160405280600a81526020017f417175616d6172696e65000000000000000000000000000000000000000000008152509050611c84565b60f08360ff1611611c08576040518060400160405280600c81526020017f616d6574687973742e676966000000000000000000000000000000000000000081525091506040518060400160405280600881526020017f416d7974687973740000000000000000000000000000000000000000000000008152509050611c84565b60ff8360ff1611611c84576040518060400160405280600a81526020017f6761726e65742e6769660000000000000000000000000000000000000000000081525091506040518060400160405280600681526020017f4761726e6574000000000000000000000000000000000000000000000000000081525090505b6000611c8f86613aaf565b604051602001611c9f9190614493565b60408051601f1981840301815290829052611cbc916020016144d8565b60405160208183030381529060405260056006604051602001611cdf9190614519565b60408051601f1981840301815290829052611cfd929160200161442c565b60408051601f1981840301815290829052611d1a9160200161454b565b60408051601f1981840301815290829052611d38929160200161458c565b604051602081830303815290604052600384604051602001611d5b92919061442c565b60408051601f1981840301815290829052611d79929160200161458c565b6040516020818303038152906040529050600082604051602001611d9d91906145b2565b60408051808303601f19018152828201909152600482527f227d5d7d00000000000000000000000000000000000000000000000000000000602083015260075490925062010000900460ff1615611e59578282604051602001611e0192919061458c565b60408051601f1981840301815290829052611e2091839060200161458c565b60408051601f1981840301815290829052611e3d9160200161461d565b6040516020818303038152906040529650505050505050919050565b611e6288613aaf565b604051602001611e729190614493565b60408051601f1981840301815290829052611e8f916020016144d8565b60405160208183030381529060405260056006604051602001611eb29190614519565b60408051601f1981840301815290829052611ed09291602001614662565b60408051601f1981840301815290829052611eee929160200161458c565b6040516020818303038152906040526004604051602001611f0f91906146af565b60408051601f1981840301815290829052611e20929160200161458c565b919050565b68a20d6e21d0e52553086000611f47336124ac565b8054909150700100000000000000000000000000000000900463ffffffff166000611fa6856040805180820190915260608152600060208201526040805101828152806020018360051b81016040528183528083602001525050919050565b83549091508290611ffe907f0000000000000000000000000000000000000000000000056bc75e2d63100000907401000000000000000000000000000000000000000090046bffffffffffffffffffffffff16614717565b6120089190614752565b851115612041576040517ff4d678b800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b336000908152600685016020526040812090839061205f8883614480565b9050600061206d8733613af3565b88549091506000906120be907f0000000000000000000000000000000000000000000000056bc75e2d63100000906c0100000000000000000000000090046bffffffffffffffffffffffff16614717565b895490915063ffffffff64010000000082048116918c918c916008916120f39185916801000000000000000090910416614765565b82546101009290920a63ffffffff8181021990931691831602179091558a547fffffffffffffffffffffffff00000000ffffffffffffffffffffffffffffffff1670010000000000000000000000000000000091871691909102178a55505b6121638a60070161107b8360011b90565b63ffffffff161561218a578161217882614782565b9150811115612185575060015b612152565b6020869052600385901c600090815260409020805460e0600588901b1681811c841863ffffffff16901b18905561221260078b018285886121ca81614782565b99508163ffffffff168160201b17846020528360021c60005260406000206003851660061b815467ffffffffffffffff8482841c188116831b82188455505050505050505050565b602080880180513360601b600885901b17815290910190528161223482614782565b9150811115612241575060015b83850361215257895463ffffffff909116640100000000027fffffffffffffffffffffffffffffffffffffffffffffffff00000000ffffffff90911617895550505050508051511561104957600184015461104990829073ffffffffffffffffffffffffffffffffffffffff16613be5565b6122bb612c25565b63389a75e1600c52806000526020600c2080544211156122e357636f5e88186000526004601cfd5b6000905561182581613981565b6122f8612c25565b600754610100900460ff161561233a576040517fd623127200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600780549115156301000000027fffffffffffffffffffffffffffffffffffffffffffffffffffff00ff00ffffff9092169190911765010000000000179055565b612383612c25565b8060601b61239957637448fbae6000526004601cfd5b61182581613981565b6123aa612c25565b600661150582848361429f565b73ffffffffffffffffffffffffffffffffffffffff8116600090815268a20d6e21d0e52553106020526040812080546b0100000000000000000000009004600116820361240557823b611199565b546b0100000000000000000000009004600216151592915050565b60008061242c8361244a565b73ffffffffffffffffffffffffffffffffffffffff16141592915050565b600068a20d6e21d0e525530868a20d6e21d0e525530a8261247868a20d6e21d0e525530f600187901b61107b565b63ffffffff16815260208101919091526040016000205473ffffffffffffffffffffffffffffffffffffffff169392505050565b73ffffffffffffffffffffffffffffffffffffffff8116600090815268a20d6e21d0e5255310602052604081208054909168a20d6e21d0e5255308916b010000000000000000000000900460011690036125355781547fffffffffffffffffffffffffffffffffffffffff00ffffffffffffffffffffff166b0100000000000000000000001782555b50919050565b68a20d6e21d0e525530873ffffffffffffffffffffffffffffffffffffffff8416612592576040517fea553b3400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008160020160006125ab8460070161107b8860011b90565b63ffffffff16815260208101919091526040016000205473ffffffffffffffffffffffffffffffffffffffff908116915086168114612616576040517fa114810000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8573ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16146126e75773ffffffffffffffffffffffffffffffffffffffff808716600090815260038401602090815260408083209387168352929052205460ff166126e757600084815260048301602052604090205473ffffffffffffffffffffffffffffffffffffffff8481169116146126e7576040517f59c896be00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006126f2876124ac565b905060006126ff876124ac565b82549091507f0000000000000000000000000000000000000000000000056bc75e2d6310000090839060149061275c9084907401000000000000000000000000000000000000000090046bffffffffffffffffffffffff166147ba565b82546101009290920a6bffffffffffffffffffffffff818102199093169183160217909155825473ffffffffffffffffffffffffffffffffffffffff81167f0000000000000000000000000000000000000000000000056bc75e2d631000007401000000000000000000000000000000000000000092839004841601909216021782555061282a60078501600188901b6127f6848b613af3565b826020528160031c60005260406000206007831660051b815463ffffffff8482841c188116831b8218845550505050505050565b6000868152600485016020908152604080832080547fffffffffffffffffffffffff000000000000000000000000000000000000000016905573ffffffffffffffffffffffffffffffffffffffff8b16835260068701825280832085547fffffffffffffffffffffffff00000000ffffffffffffffffffffffffffffffff81167001000000000000000000000000000000009182900463ffffffff9081167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01908116909202178755631fffffff600382901c168552925282205460059190911b60e0161c73ffffffffffffffffffffffffffffffffffffffff8a166000908152600687016020526040902063ffffffff919091169150612992906129576007880160018b811b0161107b565b63ffffffff1683826020528160031c60005260406000206007831660051b815463ffffffff8482841c188116831b8218845550505050505050565b8154600163ffffffff7001000000000000000000000000000000008084048216928301909116027fffffffffffffffffffffffff00000000ffffffffffffffffffffffffffffffff909216919091178355612a09600787016129f784600190811b0190565b6127f660078a0160018d811b0161107b565b73ffffffffffffffffffffffffffffffffffffffff891660009081526006870160209081526040808320909152600383901c82529020805460e0600584901b1681811c8b1863ffffffff16901b189055612a9b6007870160018a811b0183826020528160031c60005260406000206007831660051b815463ffffffff8482841c188116831b8218845550505050505050565b50508673ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef7f0000000000000000000000000000000000000000000000056bc75e2d63100000604051612b1c91815260200190565b60405180910390a35050505050505050565b6007546601000000000000900460ff166000819003612b4d5750505050565b807f0000000000000000000000000000000000000000000000056bc75e2d63100000028311612b7c5750505050565b600182901c6a7fffffffffffffffffffff1615612b995750505050565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff748739275473ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1603612bf35750505050565b6040517f0f2acbfc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff74873927543314611839576382b429006000526004601cfd5b80600003612c665750565b68a20d6e21d0e5255308546c0100000000000000000000000090046bffffffffffffffffffffffff16612c9a606482614717565b821115612caf57612cac606482614717565b91505b6112d782613c1e565b6112d782612d06612d008573ffffffffffffffffffffffffffffffffffffffff16600090815268a20d6e21d0e525531060205260409020546affffffffffffffffffffff1690565b84613ddd565b73ffffffffffffffffffffffffffffffffffffffff91909116600090815268a20d6e21d0e52553106020526040902080547fffffffffffffffffffffffffffffffffffffffffff0000000000000000000000166affffffffffffffffffffff909216919091179055565b6112d782612d06612db88573ffffffffffffffffffffffffffffffffffffffff16600090815268a20d6e21d0e525531060205260409020546affffffffffffffffffffff1690565b84613e0a565b73ffffffffffffffffffffffffffffffffffffffff8216612e0b576040517fea553b3400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6007546301000000900460ff16158015612e7257507fffffffffffffffffffffffffffffffffffffffffffffffffffffffff748739275473ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15612ea9576040517fbaf13b3f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b68a20d6e21d0e52553086000612ebe856124ac565b90506000612ecb856124ac565b9050612f066040518060c001604052806000815260200160008152602001600081526020016000815260200160008152602001600081525090565b825463ffffffff700100000000000000000000000000000000808304821660808501528454041660a08301526bffffffffffffffffffffffff7401000000000000000000000000000000000000000090910416604082015260075460009060ff640100000000909104168015612fa1575060075473ffffffffffffffffffffffffffffffffffffffff89811667010000000000000090920416145b8015612fc3575073ffffffffffffffffffffffffffffffffffffffff87163014155b90508160400151861115613003576040517ff4d678b800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60075465010000000000900460ff1680156130345750825460571c6001161515806130345750835460571c60011615155b1561306b576040517f09550c7700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040820180518790039081905284546bffffffffffffffffffffffff909116740100000000000000000000000000000000000000000273ffffffffffffffffffffffffffffffffffffffff90911617845580156131e6576130ef867f00000000000000000000000000000000000000000000000000000000000000026103e8613e30565b6130f8306124ac565b543060009081526008880160205260409020805473ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000928390046bffffffffffffffffffffffff9081169490940190931690910291909117905561318d867f00000000000000000000000000000000000000000000000000000000000000026103e890810390613e30565b83546bffffffffffffffffffffffff74010000000000000000000000000000000000000000808304821693909301606086018190521690910273ffffffffffffffffffffffffffffffffffffffff909116178355613239565b82546bffffffffffffffffffffffff7401000000000000000000000000000000000000000080830482168901606086018190529091160273ffffffffffffffffffffffffffffffffffffffff9091161783555b61327e82608001517f0000000000000000000000000000000000000000000000056bc75e2d63100000846040015181613274576132746146e8565b0480821191030290565b825282546b010000000000000000000000900460021615613325578673ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff16036132da57815160808301510360a08301525b61331f7f0000000000000000000000000000000000000000000000056bc75e2d63100000836060015181613310576133106146e8565b048360a0015180821191030290565b60208301525b600061336f83602001518460000151016040805180820190915260608152600060208201526040805101828152806020018360051b81016040528183528083602001525050919050565b8351909150156135235773ffffffffffffffffffffffffffffffffffffffff89166000908152600687016020526040902060808401518451885463ffffffff6801000000000000000080830482168490038216027fffffffffffffffffffffffffffffffffffffffff00000000ffffffffffffffff909216919091178a558854918303908116700100000000000000000000000000000000027fffffffffffffffffffffffff00000000ffffffffffffffffffffffffffffffff9092169190911788555b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff91909101600381901c600090815260208490526040812054919291600584901b60e0161c60078b01602052633fffffff600282901c16600090815260409020805460c0600684901b1681811c67ffffffffffffffff16901b18905563ffffffff169050600081815260048b016020526040902080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055613517858e8360018360200151818360081b8560601b171781526020810185602001525050505050565b50808203613433575050505b6020830151156137815773ffffffffffffffffffffffffffffffffffffffff881660009081526006870160209081526040822060a08601519186015190929082019061356f888d613af3565b8a549091506000907f0000000000000000000000000000000000000000000000056bc75e2d63100000906c0100000000000000000000000090046bffffffffffffffffffffffff16816135c4576135c46146e8565b8c5460208b01517fffffffffffffffffffffffffffffffffffffffff00000000ffffffffffffffff821663ffffffff6801000000000000000080850482169093018116909202178f558c547fffffffffffffffffffffffff00000000ffffffffffffffffffffffffffffffff1670010000000000000000000000000000000088831602178d559290910492506401000000009004165b61366b8c60070161107b8360011b90565b63ffffffff161561368a5760010181811115613685575060015b61365a565b6020869052600385901c600090815260409020805460e0600588901b1681811c841863ffffffff16901b18905560078c016020908152600282901c600090815260409020805460c0600685901b1681811c9389901b63ffffffff8816179390931867ffffffffffffffff1690921b909118905560019094019361372d878f8360008360200151818360081b8560601b171781526020810185602001525050505050565b6001018181111561373c575060015b83850361365a578b5463ffffffff909116640100000000027fffffffffffffffffffffffffffffffffffffffffffffffff00000000ffffffff909116178b5550505050505b805151156137af5760018601546137af90829073ffffffffffffffffffffffffffffffffffffffff16613be5565b5082546137f19089906bffffffffffffffffffffffff74010000000000000000000000000000000000000000820416906affffffffffffffffffffff16612b2e565b80613862578673ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8860405161385591815260200190565b60405180910390a361395b565b3073ffffffffffffffffffffffffffffffffffffffff89167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef6138c8897f00000000000000000000000000000000000000000000000000000000000000026103e8613e30565b60405190815260200160405180910390a373ffffffffffffffffffffffffffffffffffffffff8088169089167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef61394d896139457f00000000000000000000000000000000000000000000000000000000000000026103e8614752565b6103e8613e30565b604051908152602001612b1c565b5050505050505050565b60003860003847855af16118255763b12d13eb6000526004601cfd5b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff74873927805473ffffffffffffffffffffffffffffffffffffffff9092169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a355565b60006139f2836124ac565b80549091506b0100000000000000000000009004600216151582151514613a5857805460ff6b0100000000000000000000008083048216600218909116027fffffffffffffffffffffffffffffffffffffffff00ffffffffffffffffffffff9091161781555b8273ffffffffffffffffffffffffffffffffffffffff167f398a02892d45f032449640fbceed4ba77e4409f4af8ffb321df2bf9e6a5d7ed683604051613aa2911515815260200190565b60405180910390a2505050565b60606080604051019050602081016040526000815280600019835b928101926030600a8206018453600a900480613aca575050819003601f19909101908152919050565b81546c01000000000000000000000000900463ffffffff1668a20d6e21d0e52553086000829003613bde5780548190600090613b349063ffffffff166147df565b825463ffffffff8083166101009490940a8481029102199091161790925585546c0100000000000000000000000082027fffffffffffffffffffffffffffffffff00000000ffffffffffffffffffffffff90911617865560009081526002830160205260409020805473ffffffffffffffffffffffffffffffffffffffff86167fffffffffffffffffffffffff000000000000000000000000000000000000000090911617905591505b5092915050565b81516040810363263c69d68152602080820152815160051b604401915060208183601c84016000875af16001825114166114ea57600081fd5b6000613c2c42610258614480565b905060006040518061010001604052803073ffffffffffffffffffffffffffffffffffffffff16815260200173c02aaa39b223fe8d0a0e5c4f27ead9083c756cc273ffffffffffffffffffffffffffffffffffffffff16815260200161271062ffffff168152602001613cbd7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff748739275490565b73ffffffffffffffffffffffffffffffffffffffff908116825284811660208084019190915260408084018890526000606080860182905260809586019190915281517f414bf38900000000000000000000000000000000000000000000000000000000815286518516600482015292860151841660248401529085015162ffffff1660448301528401518216606482015291830151608483015260a083015160a483015260c083015160c483015260e08301511660e482015290915073e592427a0aece92de3edee1f18e0157c058615649063414bf38990610104016020604051808303816000875af1158015613db9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114ea9190614802565b60006001605784901c16151582151514613e03576a800000000000000000000092909218915b5090919050565b60006a7fffffffffffffffffffff600184901c16151582151514613e0357505060021890565b8282027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8385098181108201900380613e7f5782613e765763ae47f7026000526004601cfd5b50819004611199565b808311613e945763ae47f7026000526004601cfd5b82848609600084810385169485900494848311909303908390038390046001010292030417600260038302811880840282030280840282030280840282030280840282030280840282030280840290910302029392505050565b60005b83811015613f09578181015183820152602001613ef1565b50506000910152565b6020815260008251806020840152613f31816040850160208701613eee565b601f01601f19169190910160400192915050565b600060208284031215613f5757600080fd5b813560ff8116811461119957600080fd5b803573ffffffffffffffffffffffffffffffffffffffff81168114611f2d57600080fd5b60008060408385031215613f9f57600080fd5b613fa883613f68565b946020939093013593505050565b80358015158114611f2d57600080fd5b600080600060408486031215613fdb57600080fd5b833567ffffffffffffffff80821115613ff357600080fd5b818601915086601f83011261400757600080fd5b81358181111561401657600080fd5b8760208260051b850101111561402b57600080fd5b6020928301955093506140419186019050613fb6565b90509250925092565b6000806020838503121561405d57600080fd5b823567ffffffffffffffff8082111561407557600080fd5b818501915085601f83011261408957600080fd5b81358181111561409857600080fd5b8660208285010111156140aa57600080fd5b60209290920196919550909350505050565b600080604083850312156140cf57600080fd5b6140d883613f68565b91506140e660208401613fb6565b90509250929050565b60008060006060848603121561410457600080fd5b61410d84613f68565b925061411b60208501613f68565b9150604084013590509250925092565b60006020828403121561413d57600080fd5b61119982613fb6565b60006020828403121561415857600080fd5b61119982613f68565b60006020828403121561417357600080fd5b5035919050565b6000806040838503121561418d57600080fd5b61419683613f68565b91506140e660208401613f68565b600181811c908216806141b857607f821691505b602082108103612535577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b601f821115611505576000816000526020600020601f850160051c810160208610156142785750805b601f850160051c820191505b8181101561429757828155600101614284565b505050505050565b67ffffffffffffffff8311156142b7576142b7614220565b6142cb836142c583546141a4565b8361424f565b6000601f84116001811461431d57600085156142e75750838201355b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600387901b1c1916600186901b178355611049565b600083815260209020601f19861690835b8281101561434e578685013582556020948501946001909201910161432e565b5086821015614389577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60f88860031b161c19848701351681555b505060018560011b0183555050505050565b600081546143a8816141a4565b600182811680156143c057600181146143f357614422565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0084168752821515830287019450614422565b8560005260208060002060005b858110156144195781548a820152908401908201614400565b50505082870194505b5050505092915050565b6000614438828561439b565b8351614448818360208801613eee565b01949350505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b80820180821115610f7057610f70614451565b7f7b226e616d65223a202247454e50414c202300000000000000000000000000008152600082516144cb816012850160208701613eee565b9190910160120192915050565b600082516144ea818460208701613eee565b7f222c226465736372697074696f6e223a22000000000000000000000000000000920191825250601101919050565b7f222c2265787465726e616c5f75726c223a22000000000000000000000000000081526000611199601283018461439b565b6000825161455d818460208701613eee565b7f222c22696d616765223a22000000000000000000000000000000000000000000920191825250600b01919050565b6000835161459e818460208801613eee565b835190830190614448818360208801613eee565b7f222c2261747472696275746573223a5b7b2274726169745f74797065223a225481527f797065222c2276616c7565223a2200000000000000000000000000000000000060208201526000825161461081602e850160208701613eee565b91909101602e0192915050565b7f646174613a6170706c69636174696f6e2f6a736f6e3b757466382c000000000081526000825161465581601b850160208701613eee565b91909101601b0192915050565b600061466e828561439b565b835161467e818360208801613eee565b7f222c22696d616765223a220000000000000000000000000000000000000000009101908152600b01949350505050565b60006146bb828461439b565b7f227d00000000000000000000000000000000000000000000000000000000000081526002019392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60008261474d577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b81810381811115610f7057610f70614451565b63ffffffff818116838216019080821115613bde57613bde614451565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036147b3576147b3614451565b5060010190565b6bffffffffffffffffffffffff828116828216039080821115613bde57613bde614451565b600063ffffffff8083168181036147f8576147f8614451565b6001019392505050565b60006020828403121561481457600080fd5b505191905056fea26469706673582212201abba9c367d7c501475c2e3dad64da0552430a12dfc4b2f4ae7bf4d4788c976f64736f6c63430008180033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000d3c21bcecceda1000000000000000000000000000000163fb35efe6cd4dfb6a9b399142bfdf138dbd0840000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000547454e4149000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000547454e4149000000000000000000000000000000000000000000000000000000
-----Decoded View---------------
Arg [0] : name_ (string): GENAI
Arg [1] : symbol_ (string): GENAI
Arg [2] : initialTokenSupply (uint96): 1000000000000000000000000
Arg [3] : initialSupplyOwner (address): 0x163fB35EFE6cD4dfb6A9b399142BfdF138DBD084
Arg [4] : tax_ (uint16): 2
-----Encoded View---------------
9 Constructor Arguments found :
Arg [0] : 00000000000000000000000000000000000000000000000000000000000000a0
Arg [1] : 00000000000000000000000000000000000000000000000000000000000000e0
Arg [2] : 00000000000000000000000000000000000000000000d3c21bcecceda1000000
Arg [3] : 000000000000000000000000163fb35efe6cd4dfb6a9b399142bfdf138dbd084
Arg [4] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [5] : 0000000000000000000000000000000000000000000000000000000000000005
Arg [6] : 47454e4149000000000000000000000000000000000000000000000000000000
Arg [7] : 0000000000000000000000000000000000000000000000000000000000000005
Arg [8] : 47454e4149000000000000000000000000000000000000000000000000000000
Deployed Bytecode Sourcemap
198760:15312:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6801:20;32696:22;39351:20;32796:3;32773:26;32879:10;32865:24;;;32861:377;;32924:14;;;;;;32910:10;:28;32906:58;;32947:17;;;;;;;;;;;;;;32906:58;33001:4;32983:8;:22;32979:36;;;33007:8;;;32979:36;33078:4;39351:20;33181:26;;;;33032:13;33181:26;;;:19;;;:26;;;;;;;;33149:4;39351:20;33181:36;;;;;;;;;;;33173:53;;33181:36;;:44;;33224:1;33181:44;;;33220:1;33181:44;33173:53;;:7;:53::i;:::-;32891:347;;32861:377;33284:10;33298;33284:24;33280:262;;33343:14;;;;;;33329:10;:28;33325:58;;33366:17;;;;;;;;;;;;;;33325:58;33420:4;33402:8;:22;33398:36;;;33426:8;;;33398:36;33478:4;39351:20;33500:30;33516:12;39351:20;33516:8;:12::i;:::-;33500:30;;:7;:30::i;:::-;33310:232;33280:262;33620:10;33634;33620:24;33616:502;;33679:14;;;;;;33665:10;:28;33661:58;;33702:17;;;;;;;;;;;;;;33661:58;33756:4;33738:8;:22;33734:36;;;33762:8;;;33734:36;33832:4;39351:20;33897:4;39351:20;33946:4;39351:20;34016:4;39351:20;34040:41;39351:20;;;;34040:16;:41::i;:::-;34096:10;34104:1;34096:7;:10::i;:::-;33646:472;;;;33616:502;34187:10;34201;34187:24;34183:451;;34246:14;;;;;;34232:10;:28;34228:58;;34269:17;;;;;;;;;;;;;;34228:58;34323:4;34305:8;:22;34301:36;;;34329:8;;;34301:36;31816:47;34527:4;39351:20;31816:47;;;;;;;:36;:47;;;;;;;;34402:4;39351:20;31816:57;;;;;;;;;;:68;;;;34452:4;39351:20;34438:24;;31816:68;;;;;;34438:24;34612:10;34620:1;34612:7;:10::i;:::-;34213:421;;;34183:451;34699:10;34713;34699:24;34695:427;;34758:14;;;;;;34744:10;:28;34740:58;;34781:17;;;;;;;;;;;;;;34740:58;34835:4;34817:8;:22;34813:36;;;34841:8;;;34813:36;34914:4;39351:20;34963:4;39351:20;35033:4;39351:20;35057:53;35073:35;39351:20;;;35073:11;:35::i;35057:53::-;34725:397;;;34695:427;35172:10;35186;35172:24;35168:266;;35231:14;;;;;;35217:10;:28;35213:58;;35254:17;;;;;;;;;;;;;;35213:58;35308:4;35290:8;:22;35286:36;;;35314:8;;;35286:36;35366:4;39351:20;35388:34;35404:16;39351:20;35404:12;:16::i;35388:34::-;35198:236;35168:266;35485:10;35499;35485:24;35481:282;;35544:14;;;;;;35530:10;:28;35526:58;;35567:17;;;;;;;;;;;;;;35526:58;35621:4;35603:8;:22;35599:36;;;35627:8;;;35599:36;35698:4;39351:20;35722:29;35730:20;39351;29632:37;;29605:7;29632:37;;;:30;:37;;;;;:49;;;;;;;;29536:153;35730:20;35722:7;:29::i;:::-;35511:252;35481:282;35809:10;35823;35809:24;35805:209;;35868:14;;;;;;35854:10;:28;35850:58;;35891:17;;;;;;;;;;;;;;35850:58;35945:4;35927:8;:22;35923:36;;;35951:8;;;35923:36;6801:20;29444:33;35976:26;;29444:33;;;;;35722:7;:29::i;35976:26::-;36061:10;36075;36061:24;36057:67;;36102:10;36110:1;36102:7;:10::i;:::-;32685:3458;211150:336;;;;;;;;;;;;;:::i;199638:28::-;;;;;;;;;;-1:-1:-1;199638:28:0;;;;;;;;;;;179:14:1;;172:22;154:41;;142:2;127:18;199638:28:0;;;;;;;;199816;;;;;;;;;;-1:-1:-1;199816:28:0;;;;;;;;;;;;;;378:4:1;366:17;;;348:36;;336:2;321:18;199816:28:0;206:184:1;205616:92:0;;;;;;;;;;;;;:::i;:::-;;;;;;;:::i;210455:158::-;;;;;;;;;;-1:-1:-1;210455:158:0;;;;;:::i;:::-;;:::i;10148:275::-;;;;;;;;;;-1:-1:-1;10148:275:0;;;;;:::i;:::-;;:::i;209686:257::-;;;;;;;;;;-1:-1:-1;209686:257:0;;;;;:::i;:::-;;:::i;199851:19::-;;;;;;;;;;-1:-1:-1;199851:19:0;;;;;;;;;;;;;;2879:42:1;2867:55;;;2849:74;;2837:2;2822:18;199851:19:0;2703:226:1;9425:126:0;;;;;;;;;;-1:-1:-1;6801:20:0;9512:30;;;;;;9425:126;;;3080:25:1;;;3068:2;3053:18;9425:126:0;2934:177:1;210730:101:0;;;;;;;;;;-1:-1:-1;210730:101:0;;;;;:::i;:::-;;:::i;210050:134::-;;;;;;;;;;-1:-1:-1;210050:134:0;;;;;:::i;:::-;;:::i;11779:512::-;;;;;;;;;;-1:-1:-1;11779:512:0;;;;;:::i;:::-;;:::i;209951:91::-;;;;;;;;;;-1:-1:-1;209951:91:0;;;;;:::i;:::-;;:::i;73020:630::-;;;:::i;211494:83::-;;;;;;;;;;-1:-1:-1;211494:83:0;;;;;:::i;:::-;;:::i;9284:76::-;;;;;;;;;;-1:-1:-1;9350:2:0;9284:76;;209261:123;;;;;;;;;;-1:-1:-1;209261:123:0;;;;;:::i;:::-;;:::i;211817:192::-;;;;;;;;;;-1:-1:-1;211817:192:0;;;;;:::i;:::-;;:::i;211707:102::-;;;;;;;;;;;;;:::i;29188:119::-;;;;;;;;;;-1:-1:-1;29268:31:0;;;;29188:119;;199755:25;;;;;;;;;;-1:-1:-1;199755:25:0;;;;;;;;;;;199705:20;;;;;;;;;;-1:-1:-1;199705:20:0;;;;;;;;;;;209560:118;;;;;;;;;;-1:-1:-1;209560:118:0;;;;;:::i;:::-;;:::i;73735:466::-;;;:::i;210621:101::-;;;;;;;;;;-1:-1:-1;210621:101:0;;;;;:::i;:::-;;:::i;199673:25::-;;;;;;;;;;-1:-1:-1;199673:25:0;;;;;;;;;;;199787:22;;;;;;;;;;-1:-1:-1;199787:22:0;;;;;;;;;;;9620:143;;;;;;;;;;-1:-1:-1;9620:143:0;;;;;:::i;:::-;9710:37;;9683:7;9710:37;;;:30;:37;;;;;:45;;;;;;;9620:143;72755:102;;;:::i;211585:114::-;;;;;;;;;;;;;:::i;75460:187::-;;;;;;;;;;-1:-1:-1;75617:11:0;75611:18;75460:187;;27103:96;;;;;;;;;;-1:-1:-1;27103:96:0;;;;;:::i;:::-;;:::i;210365:82::-;;;;;;;;;;-1:-1:-1;210365:82:0;;;;;:::i;:::-;;:::i;199732:16::-;;;;;;;;;;-1:-1:-1;199732:16:0;;;;;;;;;;;205716:96;;;;;;;;;;;;;:::i;210944:89::-;;;;;;;;;;-1:-1:-1;210944:89:0;;;;;:::i;:::-;;:::i;210839:97::-;;;;;;;;;;-1:-1:-1;210839:97:0;;;;;:::i;:::-;;:::i;10934:150::-;;;;;;;;;;-1:-1:-1;10934:150:0;;;;;:::i;:::-;;:::i;205820:3402::-;;;;;;;;;;-1:-1:-1;205820:3402:0;;;;;:::i;:::-;;:::i;24826:1590::-;;;;;;;;;;-1:-1:-1;24826:1590:0;;;;;:::i;:::-;;:::i;9861:151::-;;;;;;;;;;-1:-1:-1;9861:151:0;;;;;:::i;:::-;9960:35;;;;9933:7;9960:35;;;:28;:35;;;;;;;;:44;;;;;;;;;;;;;9861:151;74392:724;;;;;;:::i;:::-;;:::i;210192:165::-;;;;;;;;;;-1:-1:-1;210192:165:0;;;;;:::i;:::-;;:::i;72329:358::-;;;;;;:::i;:::-;;:::i;211041:101::-;;;;;;;;;;-1:-1:-1;211041:101:0;;;;;:::i;:::-;;:::i;26646:280::-;;;;;;;;;;-1:-1:-1;26646:280:0;;;;;:::i;:::-;;:::i;75753:449::-;;;;;;;;;;-1:-1:-1;75753:449:0;;;;;:::i;:::-;76032:19;76026:4;76019:33;;;75876:14;76066:26;;;;76178:4;76162:21;;76156:28;;75753:449;39482:185;39615:1;39609:4;39602:15;39644:4;39638;39631:18;30148:163;30209:7;30234:11;30242:2;30234:7;:11::i;:::-;30229:44;;30254:19;;;;;;;;;;;;;;30229:44;30291:12;30300:2;30291:8;:12::i;:::-;30284:19;30148:163;-1:-1:-1;;30148:163:0:o;205242:335::-;205377:32;205412:16;205425:2;205412:12;:16::i;:::-;205377:51;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;205439:50:0;205465:4;205471:2;205475;205479:9;205439:25;:50::i;:::-;205500:69;205522:4;205528:13;:21;;;205500:69;;205551:13;:17;;;205500:21;:69::i;:::-;205366:211;205242:335;;;;:::o;31032:527::-;31154:7;6801:20;31154:7;31251:16;31154:7;31268:31;31273:4;40050:1;40045:6;;;31279:19;40444:1;40435:10;;;40385:13;40427:19;;;;;;;;;;;;;40466:1;40451:16;;;;;;40427:41;;40310:167;31268:31;31251:49;;;;;;;;;;;;;-1:-1:-1;31251:49:0;;;;;;;-1:-1:-1;31317:18:0;;;;31313:171;;31357:26;;;;;;;;:19;;;:26;;;;;;;;:37;;;;;;;;;;;;31352:121;;31422:35;;;;;;;;;;;;;;31352:121;31496:20;;;;:16;;;;;:20;;;;;;:30;;;;;;;;;;:20;-1:-1:-1;31032:527:0;;;;;;:::o;30620:192::-;30685:7;30710:11;30718:2;30710:7;:11::i;:::-;30705:44;;30730:19;;;;;;;;;;;;;;30705:44;-1:-1:-1;30767:37:0;;;;:33;:37;;;;;;;;;30620:192::o;211150:336::-;76599:13;:11;:13::i;:::-;211308:4:::1;211212:22;211286:28:::0;;;:13;:28:::1;::::0;;;;;;;:36;211335:11;:26;;;;;198884:42:::1;211335:39:::0;;;;;;;;;;211286:36;;;::::1;;;211335:49:::0;;;;211402:45;;3080:25:1;;;211402:45:0;;6801:20;;211286:36;;198884:42;211308:4;;211402:45:::1;::::0;;;;;;;::::1;211460:16;211468:7;211460;:16::i;:::-;211191:295;;211150:336::o:0;205616:92::-;205662:13;205695:5;205688:12;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;205616:92;:::o;210455:158::-;76599:13;:11;:13::i;:::-;210528:16:::1;::::0;::::1;;210525:46;;;210553:18;;;;;;;;;;;;;;210525:46;210582:15;:23:::0;;::::1;::::0;;::::1;::::0;::::1;::::0;;;::::1;::::0;;;::::1;::::0;;210455:158::o;10148:275::-;10222:4;;6801:20;10307:10;10295:23;;;;:11;;;:23;;;;;;;;;:32;;;;;;;;;;;;:41;;;10354:37;3080:25:1;;;10295:11:0;;-1:-1:-1;10295:32:0;;10354:37;;3053:18:1;10354:37:0;;;;;;;-1:-1:-1;10411:4:0;;10148:275;-1:-1:-1;;;10148:275:0:o;209686:257::-;76599:13;:11;:13::i;:::-;209781:9:::1;209777:159;209792:18;::::0;::::1;::::0;-1:-1:-1;209777:159:0::1;;;209828:34;209844:7;;209852:1;209844:10;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;:::i;:::-;209855:6;209828:15;:34::i;:::-;209906:3;;209777:159;;;;209686:257:::0;;;:::o;210730:101::-;76599:13;:11;:13::i;:::-;210804:8:::1;:19;210815:8:::0;;210804;:19:::1;:::i;:::-;;210730:101:::0;;:::o;210050:134::-;76599:13;:11;:13::i;:::-;210123:4:::1;:12:::0;;;::::1;::::0;::::1;::::0;::::1;;;::::0;;210146:30:::1;210123:12:::0;210169:6;210146:15:::1;:30::i;11779:512::-:0;11958:17;;;11867:4;11958:17;;;:11;:17;;;;;;;;11976:10;11958:29;;;;;;;;6801:20;;12015:17;12004:28;;12000:220;;12062:7;12053:6;:16;12049:52;;;12078:23;;;;;;;;;;;;;;12049:52;12145:17;;;;;;;:11;;;:17;;;;;;;;12163:10;12145:29;;;;;;;12177:16;;;12145:48;;12000:220;12232:27;12242:4;12248:2;12252:6;12232:9;:27::i;:::-;-1:-1:-1;12279:4:0;;11779:512;-1:-1:-1;;;;;11779:512:0:o;209951:91::-;76599:13;:11;:13::i;:::-;210015:10:::1;:19:::0;;;::::1;;::::0;::::1;::::0;;;::::1;::::0;;;::::1;::::0;;209951:91::o;73020:630::-;73115:15;71945:9;73133:46;;:15;:46;73115:64;;73351:19;73345:4;73338:33;73402:8;73396:4;73389:22;73459:7;73452:4;73446;73436:21;73429:38;73608:8;73561:45;73558:1;73555;73550:67;73251:381;73020:630::o;211494:83::-;76599:13;:11;:13::i;:::-;211554:6:::1;:15:::0;;;::::1;;::::0;::::1;::::0;;;::::1;::::0;;;::::1;::::0;;211494:83::o;209261:123::-;23707:37;;;209321:4;23707:37;;;:30;:37;;;;;:41;199062:1;213891:28;;;:33;;209345:31;213805:127;211817:192;76599:13;:11;:13::i;:::-;211914:4:::1;9683:7:::0;9710:37;;;:30;:37;;;;;:45;;;;;;211887:6:::1;:33;211884:68;;;211929:21;;;;;;;;;;;;;;211884:68;211962:39;211980:4;211986:7;75617:11:::0;75611:18;;75460:187;211986:7:::1;211994:6;211962:9;:39::i;:::-;211817:192:::0;:::o;211707:102::-;76599:13;:11;:13::i;:::-;211755:46:::1;211790:10;211755:34;:46::i;:::-;211707:102::o:0;209560:118::-;76599:13;:11;:13::i;:::-;209639:31:::1;209655:6;209663;209639:15;:31::i;73735:466::-:0;73941:19;73935:4;73928:33;73988:8;73982:4;73975:22;74041:1;74034:4;74028;74018:21;74011:32;74174:8;74128:44;74125:1;74122;74117:66;73735:466::o;210621:101::-;76599:13;:11;:13::i;:::-;210695:8:::1;:19;210706:8:::0;;210695;:19:::1;:::i;72755:102::-:0;76599:13;:11;:13::i;:::-;72828:21:::1;72846:1;72828:9;:21::i;211585:114::-:0;76599:13;:11;:13::i;:::-;211637::::1;:20:::0;;211668:23;;;;;;211585:114::o;27103:96::-;27161:30;27172:10;27184:6;27161:10;:30::i;210365:82::-;76599:13;:11;:13::i;:::-;210422:8:::1;:17:::0;;;::::1;;::::0;::::1;::::0;;;::::1;::::0;;;::::1;::::0;;210365:82::o;205716:96::-;205764:13;205797:7;205790:14;;;;;:::i;210944:89::-;76599:13;:11;:13::i;:::-;211012:5:::1;:13;211020:5:::0;;211012;:13:::1;:::i;210839:97::-:0;76599:13;:11;:13::i;:::-;210911:7:::1;:17;210921:7:::0;;210911;:17:::1;:::i;10934:150::-:0;11004:4;11021:33;11031:10;11043:2;11047:6;11021:9;:33::i;:::-;-1:-1:-1;11072:4:0;10934:150;;;;:::o;205820:3402::-;205885:13;205940:1;205921:8;205915:22;;;;;:::i;:::-;;;:26;205911:3304;;;205979:8;205989:27;206008:7;205989:18;:27::i;:::-;205965:52;;;;;;;;;:::i;:::-;;;;;;;;;;;;;205958:59;;205820:3402;;;:::o;205911:3304::-;206050:10;206103:13;:7;206111:5;206103:13;:::i;:::-;206086:31;;;;;;9814:19:1;;9858:2;9849:12;;9685:182;206086:31:0;;;;;;;;;;;;;206076:42;;;;;;206063:57;;206050:70;;206135:19;206169;206217:3;206209:4;:11;;;206205:569;;206241:18;;;;;;;;;;;;;;;;;;;206278:14;;;;;;;;;;;;;;;;;;;206205:569;;;206326:3;206318:4;:11;;;206314:460;;206350:21;;;;;;;;;;;;;;;;;;;206390:17;;;;;;;;;;;;;;;;;;;206314:460;;;206441:3;206433:4;:11;;;206429:345;;206465:24;;;;;;;;;;;;;;;;;;;206508:20;;;;;;;;;;;;;;;;;;;206429:345;;;206562:3;206554:4;:11;;;206550:224;;206586:22;;;;;;;;;;;;;;;;;;;206627:18;;;;;;;;;;;;;;;;;;;206550:224;;;206679:3;206671:4;:11;;;206667:107;;206703:20;;;;;;;;;;;;;;;;;;;206742:16;;;;;;;;;;;;;;;;;;;206667:107;206790:26;206963:27;206982:7;206963:18;:27::i;:::-;206927:64;;;;;;;;:::i;:::-;;;;-1:-1:-1;;206927:64:0;;;;;;;;;;206887:125;;206927:64;206887:125;;:::i;:::-;;;;;;;;;;;;;207131:5;207282:8;207171:154;;;;;;;;:::i;:::-;;;;-1:-1:-1;;207171:154:0;;;;;;;;;;207083:273;;;207171:154;207083:273;;:::i;:::-;;;;-1:-1:-1;;207083:273:0;;;;;;;;;;207039:388;;207083:273;207039:388;;:::i;:::-;;;;-1:-1:-1;;207039:388:0;;;;;;;;;;206851:599;;;207039:388;206851:599;;:::i;:::-;;;;;;;;;;;;;207487:8;207497:5;207473:30;;;;;;;;;:::i;:::-;;;;-1:-1:-1;;207473:30:0;;;;;;;;;;206819:703;;;207473:30;206819:703;;:::i;:::-;;;;;;;;;;;;;206790:732;;207537:27;207666:5;207567:119;;;;;;;;:::i;:::-;;;;;;;-1:-1:-1;;207567:119:0;;;207701:37;;;;;;;;;;207567:119;207701:37;;;207756:8;;207567:119;;-1:-1:-1;207756:8:0;;;;;207753:1437;;;207950:12;207964:13;207936:42;;;;;;;;;:::i;:::-;;;;-1:-1:-1;;207936:42:0;;;;;;;;;;207896:146;;208005:14;;207936:42;207896:146;;:::i;:::-;;;;-1:-1:-1;;207896:146:0;;;;;;;;;;207808:253;;207896:146;207808:253;;:::i;:::-;;;;;;;;;;;;;207784:277;;;;;;;;205820:3402;;;:::o;207753:1437::-;208465:27;208484:7;208465:18;:27::i;:::-;208346:181;;;;;;;;:::i;:::-;;;;-1:-1:-1;;208346:181:0;;;;;;;;;;208298:315;;208346:181;208298:315;;:::i;:::-;;;;;;;;;;;;;208692:5;208843:8;208732:154;;;;;;;;:::i;:::-;;;;-1:-1:-1;;208732:154:0;;;;;;;;;;208644:321;;;208732:154;208644:321;;:::i;:::-;;;;-1:-1:-1;;208644:321:0;;;;;;;;;;208254:738;;;208644:321;208254:738;;:::i;:::-;;;;;;;;;;;;;209063:7;209019:113;;;;;;;;:::i;:::-;;;;-1:-1:-1;;209019:113:0;;;;;;;;;;208214:941;;;209019:113;208214:941;;:::i;205911:3304::-;205820:3402;;;:::o;24826:1590::-;6801:20;24881:22;24973:24;24986:10;24973:12;:24::i;:::-;25034:25;;;;-1:-1:-1;25034:25:0;;;;;25010:21;25112:25;25130:6;-1:-1:-1;;;;;;;;;;;;;;;;;37071:4:0;37064;37058:11;37054:22;37147:1;37141:4;37134:15;37187:4;37181;37177:15;37238:1;37235;37231:9;37223:6;37219:22;37213:4;37206:36;37266:4;37263:1;37256:15;37306:6;37302:1;37296:4;37292:12;37285:28;;;36880:451;;;;25112:25;25164:21;;25080:57;;-1:-1:-1;25196:13:0;;25164:28;;25188:4;;25164:21;;;;;:28;:::i;:::-;25163:46;;;;:::i;:::-;25154:6;:55;25150:1144;;;25220:21;;;;;;;;;;;;;;25150:1144;25313:10;25277:25;25305:19;;;:7;;;:19;;;;;;25361:13;;25409:16;25419:6;25361:13;25409:16;:::i;:::-;25393:32;;25444:14;25461:51;25486:13;25501:10;25461:24;:51::i;:::-;25550:13;;25444:68;;-1:-1:-1;25531:16:0;;25550:20;;25566:4;;25550:13;;;;;:20;:::i;:::-;25602:13;;25531:39;;-1:-1:-1;25602:13:0;;;;;;;25661:6;;25602:1;;25634:16;;:34;;25661:6;;25634:34;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;25687:41;;;;;;;;;;;;;;;-1:-1:-1;25778:460:0;25811:31;25816:1;:4;;25822:19;25838:2;40050:1;40045:6;;39959:100;25811:31;:36;;;25804:123;;25887:8;25880:4;;;:::i;:::-;;;;:15;25876:27;;;-1:-1:-1;25902:1:0;25876:27;25804:123;;;40706:4;40699:22;;;40752:1;40748:13;;;40742:4;40735:27;;;40801:4;40785:21;;40921:8;;40846:21;40850:1;40846:21;;;;41049:9;;;41045:21;;40975:10;41038:29;41031:37;;41024:45;41014:56;;26006:65;26034:4;;;26040:2;26044:7;26060:9;;;;:::i;:::-;;;41454;41442:10;41438:26;41425:10;41421:2;41417:19;41414:51;41492:8;41486:4;41479:22;41535:2;41532:1;41528:10;41522:4;41515:24;41578:4;41572;41562:21;41638:1;41634:2;41630:10;41627:1;41623:18;41701:1;41695:8;41749:18;41842:5;41838:1;41835;41831:9;41827:21;41824:1;41820:29;41817:1;41813:37;41810:1;41806:45;41803:1;41796:56;;;;;;41161:709;;;;;26006:65;37666:4;37662:12;;;37656:19;;26124:10;37714:2;37710:10;37726:1;37722:10;;;37707:26;37689:55;;37779:17;;;37758:39;;26176:8;26169:4;;;:::i;:::-;;;;:15;26165:27;;;-1:-1:-1;26191:1:0;26165:27;26231:5;26220:7;:16;25778:460;;26256:26;;;;;;;;;;;;;;;-1:-1:-1;;;;;26310:15:0;;:22;:27;26306:103;;26382:14;;;;26354:43;;26370:10;;26382:14;;26354:15;:43::i;74392:724::-;76599:13;:11;:13::i;:::-;74630:19:::1;74624:4;74617:33;74677:12;74671:4;74664:26;74740:4;74734;74724:21;74848:12;74842:19;74829:11;74826:36;74823:160;;;74895:10;74889:4;74882:24;74963:4;74957;74950:18;74823:160;75062:1;75041:23:::0;;75085::::1;75095:12:::0;75085:9:::1;:23::i;210192:165::-:0;76599:13;:11;:13::i;:::-;210260::::1;::::0;::::1;::::0;::::1;;;210257:40;;;210282:15;;;;;;;;;;;;;;210257:40;210308:10;:17:::0;;210336:13;::::1;;::::0;::::1;::::0;;;;;;;;210308:17;210336:13;;;210192:165::o;72329:358::-;76599:13;:11;:13::i;:::-;72504:8:::1;72500:2;72496:17;72486:153;;72547:10;72541:4;72534:24;72619:4;72613;72606:18;72486:153;72660:19;72670:8;72660:9;:19::i;211041:101::-:0;76599:13;:11;:13::i;:::-;211115:8:::1;:19;211126:8:::0;;211115;:19:::1;:::i;26646:280::-:0;26746:33;;;26705:4;26746:33;;;:30;:33;;;;;26794:7;;;;;4244:6;26794:40;:45;;26790:69;;39061:14;;26848:11;38908:217;26790:69;26877:7;;;;4379:6;26877:36;:41;;;26646:280;-1:-1:-1;;26646:280:0:o;30363:118::-;30423:4;;30447:12;30456:2;30447:8;:12::i;:::-;:26;;;;;30363:118;-1:-1:-1;;30363:118:0:o;29828:199::-;29889:7;6801:20;29970:16;29889:7;29987:31;29992:4;40050:1;40045:6;;;29998:19;39959:100;29987:31;29970:49;;;;;;;;;;;;;-1:-1:-1;29970:49:0;;;;;29828:199;-1:-1:-1;;;29828:199:0:o;27872:339::-;28023:16;;;27931:21;28023:16;;;:13;:16;;;;;28056:7;;28023:16;;6801:20;;28056:7;;;4244:6;28056:40;:45;;28052:152;;28177:15;;;;;;;;28052:152;27954:257;27872:339;;;:::o;21590:1507::-;6801:20;21784:16;;;21780:52;;21809:23;;;;;;;;;;;;;;21780:52;21845:13;21861:1;:16;;:49;21878:31;21883:1;:4;;21889:19;21905:2;40050:1;40045:6;;39959:100;21878:31;21861:49;;;;;;;;;;;;;-1:-1:-1;21861:49:0;;;;;;;-1:-1:-1;21927:13:0;;;;21923:54;;21949:28;;;;;;;;;;;;;;21923:54;22007:4;21994:17;;:9;:17;;;21990:250;;22033:25;;;;;;;;:19;;;:25;;;;;;;;:36;;;;;;;;;;;;22028:201;;22107:20;;;;:16;;;:20;;;;;;;22094:33;;;22107:20;;22094:33;22090:124;;22159:35;;;;;;;;;;;;;;22090:124;22252:35;22290:18;22303:4;22290:12;:18::i;:::-;22252:56;;22319:33;22355:16;22368:2;22355:12;:16::i;:::-;22384:39;;22319:52;;-1:-1:-1;22418:4:0;;22384:39;;:23;;:39;;22418:4;;22384:39;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;22461:37;;;;;22493:4;22461:37;;;;;;;;;;;;;;;-1:-1:-1;22515:76:0;22520:4;;;-1:-1:-1;40045:6:0;;;22547:43;22572:13;22587:2;22547:24;:43::i;:::-;40712:8;40706:4;40699:22;40755:5;40752:1;40748:13;40742:4;40735:27;40801:4;40795;40785:21;40864:1;40857:5;40853:13;40850:1;40846:21;40927:1;40921:8;40975:10;41060:5;41056:1;41053;41049:9;41045:21;41042:1;41038:29;41035:1;41031:37;41028:1;41024:45;41021:1;41014:56;;;;;40545:543;;;;22515:76;22613:20;;;;:16;;;:20;;;;;;;;22606:27;;;;;;;22675:13;;;;:7;;;:13;;;;;22690:29;;;;;;;;;;;;;;;;;;;;;;;;;40435:10;40444:1;40435:10;;;;40427:19;;;;;;;40466:1;40451:16;;;;;;40427:41;22740:13;;;;;;;:7;;;:13;;;;;22650:70;;;;;;-1:-1:-1;22735:67:0;;22755:27;22760:4;;;40217:1;40212:6;;;40211:12;22766:15;40105:137;22755:27;22735:67;;22791:9;40712:8;40706:4;40699:22;40755:5;40752:1;40748:13;40742:4;40735:27;40801:4;40795;40785:21;40864:1;40857:5;40853:13;40850:1;40846:21;40927:1;40921:8;40975:10;41060:5;41056:1;41053;41049:9;41045:21;41042:1;41038:29;41035:1;41031:37;41028:1;41024:45;41021:1;41014:56;;;;;40545:543;;;;22735:67;22831:27;;;;;;;;;;;;;;;;;;;;;;;;;;;22873:63;22878:4;;;22884:22;22896:9;40217:1;40212:6;;;40211:12;;40105:137;22884:22;22908:27;22913:4;;;40217:1;40212:6;;;40211:12;22919:15;40105:137;22873:63;22956:11;;;;;;;:7;;;:11;;;;;;;;40699:22;;;40752:1;40748:13;;;40735:27;;40785:21;;40921:8;;40846:21;40850:1;40846:21;;;;41049:9;;;41045:21;;40975:10;41038:29;41031:37;;41024:45;41014:56;;22998:38;23003:4;;;40217:1;40212:6;;;40211:12;23033:1;40712:8;40706:4;40699:22;40755:5;40752:1;40748:13;40742:4;40735:27;40801:4;40795;40785:21;40864:1;40857:5;40853:13;40850:1;40846:21;40927:1;40921:8;40975:10;41060:5;41056:1;41053;41049:9;41045:21;41042:1;41038:29;41035:1;41031:37;41028:1;41024:45;41021:1;41014:56;;;;;40545:543;;;;22998:38;22436:612;;23080:2;23065:24;;23074:4;23065:24;;;23084:4;23065:24;;;;3080:25:1;;3068:2;3053:18;;2934:177;23065:24:0;;;;;;;;21713:1384;;;;21590:1507;;;;:::o;200547:403::-;200691:15;;;;;;;200675:13;200725:10;;;200721:23;;200737:7;200547:403;;;:::o;200721:23::-;200782:5;200775:4;:12;200762:9;:25;200758:38;;200789:7;200547:403;;;:::o;200758:38::-;199062:1;213891:28;;;;;:33;200810:34;;200837:7;200547:403;;;:::o;200810:34::-;75617:11;75611:18;200862:15;;:4;:15;;;200858:28;;200879:7;200547:403;;;:::o;200858:28::-;200907:24;;;;;;;;;;;;;;71250:364;71466:11;71460:18;71450:8;71447:32;71437:159;;71513:10;71507:4;71500:24;71576:4;71570;71563:18;212052:353;212118:15;212137:1;212118:20;212114:59;;212052:353;:::o;212114:59::-;6801:20;9512:30;;;;;;212284:11;212292:3;9512:30;212284:11;:::i;:::-;212266:15;:29;212262:91;;;212330:11;212338:3;212330:5;:11;:::i;:::-;212312:29;;212262:91;212363:34;212381:15;212363:17;:34::i;213178:138::-;213252:56;213260:6;213268:39;213284:15;213292:6;23707:37;;23681:6;23707:37;;;:30;:37;;;;;:41;;;;23618:138;213284:15;213300:6;213268:15;:39::i;:::-;24086:37;;;;;;;;;:30;:37;;;;;:49;;;;;;;;;;;;;;24012:131;213032:138;213106:56;213114:6;213122:39;213138:15;213146:6;23707:37;;23681:6;23707:37;;;:30;:37;;;;;:41;;;;23618:138;213138:15;213154:6;213122:15;:39::i;200958:4276::-;201058:16;;;201054:52;;201083:23;;;;;;;;;;;;;;201054:52;201121:4;;;;;;;201120:5;:24;;;;-1:-1:-1;75617:11:0;75611:18;201129:15;;:4;:15;;;;201120:24;201117:45;;;201153:9;;;;;;;;;;;;;;201117:45;6801:20;201175:22;201269:18;201282:4;201269:12;:18::i;:::-;201231:56;;201298:33;201334:16;201347:2;201334:12;:16::i;:::-;201298:52;;201363:23;-1:-1:-1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;201363:23:0;201417:27;;;;;;;;;201397:17;;;:47;201473:25;;;;201455:15;;;:43;201525:23;;;;;;201509:13;;;:39;201578:6;;201417:27;;201578:6;;;;;;:22;;;;-1:-1:-1;201596:4:0;;;201588:12;;;201596:4;;;;;201588:12;201578:22;:45;;;;-1:-1:-1;201604:19:0;;;201618:4;201604:19;;201578:45;201561:63;;201650:1;:13;;;201641:6;:22;201637:56;;;201672:21;;;;;;;;;;;;;;201637:56;201734:10;;;;;;;:88;;;;-1:-1:-1;201764:17:0;;199117:2;214026:28;;;:33;;201749:72;;;-1:-1:-1;201801:19:0;;199117:2;214026:28;;;:33;;201786:35;201731:113;;;201831:13;;;;;;;;;;;;;;201731:113;201873:13;;;:23;;;;;;;;;201911:47;;;;;;;;;;;;;;;201987:443;;;;202102:49;202131:6;202140:3;202146:4;202102:28;:49::i;:::-;202064:27;202085:4;202064:12;:27::i;:::-;:35;202040:4;202064:35;202018:28;;;:13;;;:28;;;;;:134;;:28;:134;202064:35;;;;;;;;;:87;;;;202018:134;;;;;;;;;;;;202240:56;202269:6;202285:3;202278:4;:10;;;;202240:28;:56::i;:::-;202216:21;;;;;;;;;:80;;;;202202:11;;;:94;;;202171:126;;;;;;;;;;;201987:443;;;202383:21;;;;;;;;;:30;;202369:11;;;:44;;;202338:76;;;;;;;;;;;201987:443;202478:54;202492:1;:17;;;202527:4;202511:1;:13;;;:20;;;;;:::i;:::-;;39881:8;;;39891:9;;39877:24;;39714:205;202478:54;202458:74;;202553:19;;;;;4379:6;202553:48;:53;202549:254;;202639:2;202631:10;;:4;:10;;;202627:71;;202681:17;;202661;;;;:37;202643:15;;;:55;202627:71;202737:50;202765:4;202751:1;:11;;;:18;;;;;:::i;:::-;;202771:1;:15;;;39881:8;;;39891:9;;39877:24;;39714:205;202737:50;202717:17;;;:70;202549:254;202819:29;202851:56;202889:1;:17;;;202869:1;:17;;;:37;-1:-1:-1;;;;;;;;;;;;;;;;;37071:4:0;37064;37058:11;37054:22;37147:1;37141:4;37134:15;37187:4;37181;37177:15;37238:1;37235;37231:9;37223:6;37219:22;37213:4;37206:36;37266:4;37263:1;37256:15;37306:6;37302:1;37296:4;37292:12;37285:28;;;36880:451;;;;202851:56;202928:17;;202819:88;;-1:-1:-1;202928:22:0;202924:703;;203001:13;;;202971:27;203001:13;;;:7;;;:13;;;;;203053:17;;;;203119;;203155:45;;;;;;;;;;;;;;;;;;;;;;;;;203219;;203107:29;;;203219:45;;;;;;;;;;;;;;;203314:298;203369:11;;;;;40444:1;40435:10;;;203340;40427:19;;;;;;;;;;;203369:11;;;40466:1;40451:16;;;;;40427:41;203432:4;;;41421:2;41479:22;41528:10;41532:1;41528:10;;;;203442:1;41515:24;;;41578:4;41562:21;;41695:8;;41623:18;41627:1;41623:18;;;;41831:9;;;41749:18;41820:29;41813:37;;41806:45;41796:56;;203340:41;;;-1:-1:-1;203477:20:0;;;;:16;;;:20;;;;;203470:27;;;;;;203520:42;203538:10;203550:4;203494:2;203470:27;37672:1;37666:4;37662:12;37656:19;37735:7;37729:2;37726:1;37722:10;37718:1;37714:2;37710:10;37707:26;37704:39;37696:6;37689:55;37791:4;37783:6;37779:17;37775:1;37769:4;37765:12;37758:39;;37437:378;;;;;203520:42;203317:265;203603:7;203590:9;:20;203314:298;;202952:675;;;202924:703;203647:17;;;;:22;203643:1068;;203718:11;;;203690:25;203718:11;;;:7;;;:11;;;;;;;203766:15;;;;203826:17;;;;203718:11;;203816:27;;;;203879:43;203904:13;203726:2;203879:24;:43::i;:::-;203960:13;;203862:60;;-1:-1:-1;203941:16:0;;203976:4;;203960:13;;;;;203976:4;203960:20;;;;:::i;:::-;204012:13;;204071:17;;;;204044:45;;;204012:13;204044:45;;;;;;;;;;;;;;;;;204108:41;;;;;;;;;;;;203960:20;;;;;-1:-1:-1;204012:13:0;;;;204199:452;204232:31;204237:1;:4;;204243:19;204259:2;40050:1;40045:6;;39959:100;204232:31;:36;;;204225:123;;204301:4;;:15;;;204297:27;;;-1:-1:-1;204323:1:0;204297:27;204225:123;;;40706:4;40699:22;;;40752:1;40748:13;;;40742:4;40735:27;;;40801:4;40785:21;;40921:8;;40846:21;40850:1;40846:21;;;;41049:9;;;41045:21;;40975:10;41038:29;41031:37;;41024:45;41014:56;;204455:4;;;41421:2;41479:22;;;41532:1;41528:10;;;41522:4;41515:24;;;41578:4;41562:21;;41695:8;;41623:18;41627:1;41623:18;;;;41831:9;;;41417:19;;;;41442:10;41438:26;;41414:51;41827:21;;;;41749:18;41820:29;41813:37;;;41806:45;;;41796:56;;204481:9;;;;;204515:40;204533:10;204545:2;204549;204553:1;37672;37666:4;37662:12;37656:19;37735:7;37729:2;37726:1;37722:10;37718:1;37714:2;37710:10;37707:26;37704:39;37696:6;37689:55;37791:4;37783:6;37779:17;37775:1;37769:4;37765:12;37758:39;;37437:378;;;;;204515:40;204582:4;;:15;;;204578:27;;;-1:-1:-1;204604:1:0;204578:27;204644:5;204633:7;:16;204199:452;;204669:26;;;;;;;;;;;;;;;-1:-1:-1;;;;;203643:1068:0;204731:15;;:22;:27;204727:111;;204807:14;;;;204779:43;;204795:10;;204807:14;;204779:15;:43::i;:::-;-1:-1:-1;204887:21:0;;204859:69;;204881:4;;204887:21;;;;;;204910:17;;204859:21;:69::i;:::-;204943:8;204939:282;;204987:2;204972:26;;204981:4;204972:26;;;204991:6;204972:26;;;;3080:25:1;;3068:2;3053:18;;2934:177;204972:26:0;;;;;;;;204939:282;;;205058:4;205035:80;;;;205065:49;205094:6;205103:3;205109:4;205065:28;:49::i;:::-;205035:80;;3080:25:1;;;3068:2;3053:18;205035:80:0;;;;;;;205135:74;;;;;;;;205154:54;205183:6;205192:8;205197:3;205192:4;:8;:::i;:::-;205203:4;205154:28;:54::i;:::-;205135:74;;3080:25:1;;;3068:2;3053:18;205135:74:0;2934:177:1;204939:282:0;201037:4197;;;;;200958:4276;;;:::o;180250:415::-;180520:4;180508:10;180502:4;180490:10;180475:13;180471:2;180464:5;180459:66;180449:198;;180559:10;180553:4;180546:24;180627:4;180621;180614:18;70076:1113;70803:11;71043:16;;70889:26;;;;;;;71003:38;71000:1;;70992:78;71129:27;70076:1113::o;27416:285::-;27487:21;27511:15;27524:1;27511:12;:15::i;:::-;27542:7;;27487:39;;-1:-1:-1;27542:7:0;;;4379:6;27542:36;:41;;27541:52;;;;27537:122;;27610:37;;;;;;;;;4379:6;27610:37;;;;;;;;;;;;27537:122;27684:1;27674:19;;;27687:5;27674:19;;;;179:14:1;172:22;154:41;;142:2;127:18;;14:187;27674:19:0;;;;;;;;27476:225;27416:285;;:::o;78560:1676::-;78616:17;79068:4;79061;79055:11;79051:22;79044:29;;79169:4;79164:3;79160:14;79154:4;79147:28;79252:1;79247:3;79240:14;79356:3;79388:1;79384:6;79600:5;79582:410;79639:11;;;;79823:2;79837;79827:13;;79819:22;79639:11;79806:36;79931:2;79921:13;;79952:25;79582:410;79952:25;-1:-1:-1;;80022:13:0;;;-1:-1:-1;;80137:14:0;;;80199:19;;;80137:14;78560:1676;-1:-1:-1;78560:1676:0:o;28377:469::-;28617:26;;;;;;;6801:20;28511:19;28658:17;;;28654:185;;28707:14;;28709:1;;:12;;28707:14;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;28736:41;;;;;;;;;;;;-1:-1:-1;28792:30:0;;;:16;;;:30;;;;;:35;;;;;;;;;;;;28707:14;-1:-1:-1;28654:185:0;28537:309;28377:469;;;;:::o;37914:635::-;38083:1;38077:8;38118:4;38112;38108:15;38177:10;38174:1;38167:21;38252:4;38245;38242:1;38238:12;38231:26;38348:4;38342:11;38339:1;38335:19;38329:4;38325:30;38316:39;;38474:4;38471:1;38468;38461:4;38458:1;38454:12;38451:1;38443:6;38436:5;38431:48;38427:1;38423;38417:8;38414:15;38410:70;38400:131;;38511:4;38508:1;38501:15;212413:611;212483:13;212507:28;:15;212525:10;212507:28;:::i;:::-;212483:53;;212547:48;212598:356;;;;;;;;212683:4;212598:356;;;;;;198966:42;212598:356;;;;;;212745:5;212598:356;;;;;;212780:7;75617:11;75611:18;;75460:187;212780:7;212598:356;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;212598:356:0;;;;;;;;;;;;;;;212965:49;;;;;16044:13:1;;16040:22;;212965:49:0;;;16022:41:1;16111:17;;;16105:24;16101:33;;16079:20;;;16072:63;16183:17;;;16177:24;16203:8;16173:39;16151:20;;;16144:69;16261:17;;16255:24;16251:33;;16229:20;;;16222:63;16329:17;;;16323:24;16301:20;;;16294:54;16404:4;16392:17;;16386:24;16364:20;;;16357:54;16467:4;16455:17;;16449:24;16427:20;;;16420:54;212965:49:0;16522:17:1;;16516:24;16512:33;16490:20;;;16483:63;212547:407:0;;-1:-1:-1;198884:42:0;;212965:41;;15933:19:1;;212965:49:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;213564:232::-;213640:6;214026:28;199117:2;214026:28;;;;:33;;213663:32;;;;213659:106;;213729:23;213712:41;;;;;213659:106;-1:-1:-1;213782:6:0;;213564:232;-1:-1:-1;213564:232:0:o;213324:::-;213400:6;213891:28;199062:1;213891:28;;;;:33;;213423:32;;;;213419:106;;-1:-1:-1;;213489:23:0;213472:41;;213324:232::o;150375:3640::-;150998:9;;;151097:6;151005:1;151002;151084:20;151214:14;;;151202:27;;151194:36;;;151318:285;;151365:1;151355:156;;151408:10;151402:4;151395:24;151483:4;151477;151470:18;151355:156;-1:-1:-1;151543:14:0;;;151579:5;;151318:285;151727:2;151724:1;151721:9;151711:152;;151768:10;151762:4;151755:24;151839:4;151833;151826:18;151711:152;152126:1;152123;152120;152113:15;152277:1;152273:9;;;152266:17;;152370:9;;;;;153711:13;;;153703:22;;;153735:9;;;;153731:17;;;153750:1;153727:25;153699:54;153788:14;;153784:22;153666:167;152751:1;152758;152754:9;;152747:17;;153037:11;;;153030:19;;153021:29;153111:11;;;153104:19;;153095:29;153186:11;;;153179:19;;153170:29;153261:11;;;153254:19;;153245:29;153336:11;;;153329:19;;153320:29;153923:11;;;153916:19;;;153907:29;153420:539;150375:3640;;;;;:::o;395:250:1:-;480:1;490:113;504:6;501:1;498:13;490:113;;;580:11;;;574:18;561:11;;;554:39;526:2;519:10;490:113;;;-1:-1:-1;;637:1:1;619:16;;612:27;395:250::o;650:455::-;799:2;788:9;781:21;762:4;831:6;825:13;874:6;869:2;858:9;854:18;847:34;890:79;962:6;957:2;946:9;942:18;937:2;929:6;925:15;890:79;:::i;:::-;1021:2;1009:15;-1:-1:-1;;1005:88:1;990:104;;;;1096:2;986:113;;650:455;-1:-1:-1;;650:455:1:o;1110:269::-;1167:6;1220:2;1208:9;1199:7;1195:23;1191:32;1188:52;;;1236:1;1233;1226:12;1188:52;1275:9;1262:23;1325:4;1318:5;1314:16;1307:5;1304:27;1294:55;;1345:1;1342;1335:12;1384:196;1452:20;;1512:42;1501:54;;1491:65;;1481:93;;1570:1;1567;1560:12;1585:254;1653:6;1661;1714:2;1702:9;1693:7;1689:23;1685:32;1682:52;;;1730:1;1727;1720:12;1682:52;1753:29;1772:9;1753:29;:::i;:::-;1743:39;1829:2;1814:18;;;;1801:32;;-1:-1:-1;;;1585:254:1:o;1844:160::-;1909:20;;1965:13;;1958:21;1948:32;;1938:60;;1994:1;1991;1984:12;2009:689;2101:6;2109;2117;2170:2;2158:9;2149:7;2145:23;2141:32;2138:52;;;2186:1;2183;2176:12;2138:52;2226:9;2213:23;2255:18;2296:2;2288:6;2285:14;2282:34;;;2312:1;2309;2302:12;2282:34;2350:6;2339:9;2335:22;2325:32;;2395:7;2388:4;2384:2;2380:13;2376:27;2366:55;;2417:1;2414;2407:12;2366:55;2457:2;2444:16;2483:2;2475:6;2472:14;2469:34;;;2499:1;2496;2489:12;2469:34;2554:7;2547:4;2537:6;2534:1;2530:14;2526:2;2522:23;2518:34;2515:47;2512:67;;;2575:1;2572;2565:12;2512:67;2606:4;2598:13;;;;-1:-1:-1;2630:6:1;-1:-1:-1;2655:37:1;;2671:20;;;-1:-1:-1;2655:37:1;:::i;:::-;2645:47;;2009:689;;;;;:::o;3116:592::-;3187:6;3195;3248:2;3236:9;3227:7;3223:23;3219:32;3216:52;;;3264:1;3261;3254:12;3216:52;3304:9;3291:23;3333:18;3374:2;3366:6;3363:14;3360:34;;;3390:1;3387;3380:12;3360:34;3428:6;3417:9;3413:22;3403:32;;3473:7;3466:4;3462:2;3458:13;3454:27;3444:55;;3495:1;3492;3485:12;3444:55;3535:2;3522:16;3561:2;3553:6;3550:14;3547:34;;;3577:1;3574;3567:12;3547:34;3622:7;3617:2;3608:6;3604:2;3600:15;3596:24;3593:37;3590:57;;;3643:1;3640;3633:12;3590:57;3674:2;3666:11;;;;;3696:6;;-1:-1:-1;3116:592:1;;-1:-1:-1;;;;3116:592:1:o;3713:254::-;3778:6;3786;3839:2;3827:9;3818:7;3814:23;3810:32;3807:52;;;3855:1;3852;3845:12;3807:52;3878:29;3897:9;3878:29;:::i;:::-;3868:39;;3926:35;3957:2;3946:9;3942:18;3926:35;:::i;:::-;3916:45;;3713:254;;;;;:::o;3972:328::-;4049:6;4057;4065;4118:2;4106:9;4097:7;4093:23;4089:32;4086:52;;;4134:1;4131;4124:12;4086:52;4157:29;4176:9;4157:29;:::i;:::-;4147:39;;4205:38;4239:2;4228:9;4224:18;4205:38;:::i;:::-;4195:48;;4290:2;4279:9;4275:18;4262:32;4252:42;;3972:328;;;;;:::o;4305:180::-;4361:6;4414:2;4402:9;4393:7;4389:23;4385:32;4382:52;;;4430:1;4427;4420:12;4382:52;4453:26;4469:9;4453:26;:::i;4490:186::-;4549:6;4602:2;4590:9;4581:7;4577:23;4573:32;4570:52;;;4618:1;4615;4608:12;4570:52;4641:29;4660:9;4641:29;:::i;4681:180::-;4740:6;4793:2;4781:9;4772:7;4768:23;4764:32;4761:52;;;4809:1;4806;4799:12;4761:52;-1:-1:-1;4832:23:1;;4681:180;-1:-1:-1;4681:180:1:o;4866:260::-;4934:6;4942;4995:2;4983:9;4974:7;4970:23;4966:32;4963:52;;;5011:1;5008;5001:12;4963:52;5034:29;5053:9;5034:29;:::i;:::-;5024:39;;5082:38;5116:2;5105:9;5101:18;5082:38;:::i;5131:437::-;5210:1;5206:12;;;;5253;;;5274:61;;5328:4;5320:6;5316:17;5306:27;;5274:61;5381:2;5373:6;5370:14;5350:18;5347:38;5344:218;;5418:77;5415:1;5408:88;5519:4;5516:1;5509:15;5547:4;5544:1;5537:15;5573:184;5625:77;5622:1;5615:88;5722:4;5719:1;5712:15;5746:4;5743:1;5736:15;5762:184;5814:77;5811:1;5804:88;5911:4;5908:1;5901:15;5935:4;5932:1;5925:15;6077:543;6179:2;6174:3;6171:11;6168:446;;;6215:1;6239:5;6236:1;6229:16;6283:4;6280:1;6270:18;6353:2;6341:10;6337:19;6334:1;6330:27;6324:4;6320:38;6389:4;6377:10;6374:20;6371:47;;;-1:-1:-1;6412:4:1;6371:47;6467:2;6462:3;6458:12;6455:1;6451:20;6445:4;6441:31;6431:41;;6522:82;6540:2;6533:5;6530:13;6522:82;;;6585:17;;;6566:1;6555:13;6522:82;;;6526:3;;;6077:543;;;:::o;6856:1325::-;6980:18;6975:3;6972:27;6969:53;;;7002:18;;:::i;:::-;7031:94;7121:3;7081:38;7113:4;7107:11;7081:38;:::i;:::-;7075:4;7031:94;:::i;:::-;7151:1;7176:2;7171:3;7168:11;7193:1;7188:735;;;;7967:1;7984:3;7981:93;;;-1:-1:-1;8040:19:1;;;8027:33;7981:93;6762:66;6753:1;6749:11;;;6745:84;6741:89;6731:100;6837:1;6833:11;;;6728:117;8087:78;;7161:1014;;7188:735;6024:1;6017:14;;;6061:4;6048:18;;-1:-1:-1;;7224:76:1;;;7384:9;7406:229;7420:7;7417:1;7414:14;7406:229;;;7509:19;;;7496:33;7481:49;;7616:4;7601:20;;;;7569:1;7557:14;;;;7436:12;7406:229;;;7410:3;7663;7654:7;7651:16;7648:219;;;7783:66;7777:3;7771;7768:1;7764:11;7760:21;7756:94;7752:99;7739:9;7734:3;7730:19;7717:33;7713:139;7705:6;7698:155;7648:219;;;7910:1;7904:3;7901:1;7897:11;7893:19;7887:4;7880:33;7161:1014;;6856:1325;;;:::o;8186:781::-;8236:3;8277:5;8271:12;8306:36;8332:9;8306:36;:::i;:::-;8361:1;8378:17;;;8404:191;;;;8609:1;8604:357;;;;8371:590;;8404:191;8452:66;8441:9;8437:82;8432:3;8425:95;8575:6;8568:14;8561:22;8553:6;8549:35;8544:3;8540:45;8533:52;;8404:191;;8604:357;8635:5;8632:1;8625:16;8664:4;8709;8706:1;8696:18;8736:1;8750:165;8764:6;8761:1;8758:13;8750:165;;;8842:14;;8829:11;;;8822:35;8885:16;;;;8779:10;;8750:165;;;8754:3;;;8944:6;8939:3;8935:16;8928:23;;8371:590;;;;;8186:781;;;;:::o;8972:389::-;9148:3;9176:38;9210:3;9202:6;9176:38;:::i;:::-;9243:6;9237:13;9259:65;9317:6;9313:2;9306:4;9298:6;9294:17;9259:65;:::i;:::-;9340:15;;8972:389;-1:-1:-1;;;;8972:389:1:o;9366:184::-;9418:77;9415:1;9408:88;9515:4;9512:1;9505:15;9539:4;9536:1;9529:15;9555:125;9620:9;;;9641:10;;;9638:36;;;9654:18;;:::i;9872:486::-;10124:66;10119:3;10112:79;10094:3;10220:6;10214:13;10236:75;10304:6;10299:2;10294:3;10290:12;10283:4;10275:6;10271:17;10236:75;:::i;:::-;10331:16;;;;10349:2;10327:25;;9872:486;-1:-1:-1;;9872:486:1:o;10363:506::-;10585:3;10623:6;10617:13;10639:66;10698:6;10693:3;10686:4;10678:6;10674:17;10639:66;:::i;:::-;10766;10727:16;;10752:81;;;-1:-1:-1;10860:2:1;10849:14;;10363:506;-1:-1:-1;10363:506:1:o;10874:385::-;11123:66;11118:3;11111:79;11093:3;11206:47;11249:2;11244:3;11240:12;11232:6;11206:47;:::i;11264:506::-;11486:3;11524:6;11518:13;11540:66;11599:6;11594:3;11587:4;11579:6;11575:17;11540:66;:::i;:::-;11667;11628:16;;11653:81;;;-1:-1:-1;11761:2:1;11750:14;;11264:506;-1:-1:-1;11264:506:1:o;11775:496::-;11954:3;11992:6;11986:13;12008:66;12067:6;12062:3;12055:4;12047:6;12043:17;12008:66;:::i;:::-;12137:13;;12096:16;;;;12159:70;12137:13;12096:16;12206:4;12194:17;;12159:70;:::i;12276:591::-;12538:66;12533:3;12526:79;12635:66;12630:2;12625:3;12621:12;12614:88;12508:3;12731:6;12725:13;12747:73;12813:6;12808:2;12803:3;12799:12;12794:2;12786:6;12782:15;12747:73;:::i;:::-;12840:16;;;;12858:2;12836:25;;12276:591;-1:-1:-1;;12276:591:1:o;12872:449::-;13124:29;13119:3;13112:42;13094:3;13183:6;13177:13;13199:75;13267:6;13262:2;13257:3;13253:12;13246:4;13238:6;13234:17;13199:75;:::i;:::-;13294:16;;;;13312:2;13290:25;;12872:449;-1:-1:-1;;12872:449:1:o;13326:606::-;13593:3;13621:38;13655:3;13647:6;13621:38;:::i;:::-;13688:6;13682:13;13704:65;13762:6;13758:2;13751:4;13743:6;13739:17;13704:65;:::i;:::-;13829:66;13791:15;;13815:81;;;13923:2;13912:14;;13326:606;-1:-1:-1;;;;13326:606:1:o;13937:412::-;14155:3;14186:38;14220:3;14212:6;14186:38;:::i;:::-;14247:66;14233:81;;14341:1;14330:13;;13937:412;-1:-1:-1;;;13937:412:1:o;14354:184::-;14406:77;14403:1;14396:88;14503:4;14500:1;14493:15;14527:4;14524:1;14517:15;14543:274;14583:1;14609;14599:189;;14644:77;14641:1;14634:88;14745:4;14742:1;14735:15;14773:4;14770:1;14763:15;14599:189;-1:-1:-1;14802:9:1;;14543:274::o;14822:128::-;14889:9;;;14910:11;;;14907:37;;;14924:18;;:::i;14955:172::-;15022:10;15052;;;15064;;;15048:27;;15087:11;;;15084:37;;;15101:18;;:::i;15132:195::-;15171:3;15202:66;15195:5;15192:77;15189:103;;15272:18;;:::i;:::-;-1:-1:-1;15319:1:1;15308:13;;15132:195::o;15332:191::-;15400:26;15459:10;;;15447;;;15443:27;;15482:12;;;15479:38;;;15497:18;;:::i;15528:201::-;15566:3;15594:10;15639:2;15632:5;15628:14;15666:2;15657:7;15654:15;15651:41;;15672:18;;:::i;:::-;15721:1;15708:15;;15528:201;-1:-1:-1;;;15528:201:1:o;16557:184::-;16627:6;16680:2;16668:9;16659:7;16655:23;16651:32;16648:52;;;16696:1;16693;16686:12;16648:52;-1:-1:-1;16719:16:1;;16557:184;-1:-1:-1;16557:184:1:o
Swarm Source
ipfs://b8bbf3bd95d6cae55066ecf791bf44981f04ca911d11c8d4a4b3afbb38d1e7a9
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.