Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
TokenTracker
Latest 25 from a total of 251 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
Value | ||||
---|---|---|---|---|---|---|---|---|---|
Approve | 19974117 | 33 days ago | IN | 0 ETH | 0.00035446 | ||||
Approve | 19899538 | 43 days ago | IN | 0 ETH | 0.0001352 | ||||
Approve | 19328609 | 123 days ago | IN | 0 ETH | 0.00211491 | ||||
Approve | 19320737 | 124 days ago | IN | 0 ETH | 0.00121325 | ||||
Approve | 19315563 | 125 days ago | IN | 0 ETH | 0.00233619 | ||||
Approve | 19315025 | 125 days ago | IN | 0 ETH | 0.0017596 | ||||
Approve | 19314745 | 125 days ago | IN | 0 ETH | 0.00167005 | ||||
Approve | 19314736 | 125 days ago | IN | 0 ETH | 0.00173922 | ||||
Approve | 19314726 | 125 days ago | IN | 0 ETH | 0.00194344 | ||||
Approve | 19314705 | 125 days ago | IN | 0 ETH | 0.00188003 | ||||
Approve | 19314622 | 125 days ago | IN | 0 ETH | 0.00215693 | ||||
Approve | 19314585 | 125 days ago | IN | 0 ETH | 0.00258048 | ||||
Approve | 19314581 | 125 days ago | IN | 0 ETH | 0.00260321 | ||||
Approve | 19314574 | 125 days ago | IN | 0 ETH | 0.00225485 | ||||
Approve | 19314571 | 125 days ago | IN | 0 ETH | 0.00677553 | ||||
Approve | 19314506 | 125 days ago | IN | 0 ETH | 0.00192944 | ||||
Approve | 19314449 | 125 days ago | IN | 0 ETH | 0.00249768 | ||||
Approve | 19314442 | 125 days ago | IN | 0 ETH | 0.00223956 | ||||
Approve | 19314434 | 125 days ago | IN | 0 ETH | 0.00190958 | ||||
Approve | 19314402 | 125 days ago | IN | 0 ETH | 0.00231683 | ||||
Approve | 19314359 | 125 days ago | IN | 0 ETH | 0.00275336 | ||||
Approve | 19314359 | 125 days ago | IN | 0 ETH | 0.00275336 | ||||
Approve | 19314358 | 125 days ago | IN | 0 ETH | 0.00272347 | ||||
Approve | 19314357 | 125 days ago | IN | 0 ETH | 0.00593637 | ||||
Approve | 19314355 | 125 days ago | IN | 0 ETH | 0.00288654 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
Pepemon
Compiler Version
v0.8.24+commit.e11b9ed9
Contract Source Code (Solidity Multiple files format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "./DN404.sol"; import {DailyOutflowCounterLib} from "./DailyOutflowCounterLib.sol"; import {OwnableRoles} from "./OwnableRoles.sol"; import {LibString} from "./LibString.sol"; import {SafeTransferLib} from "./SafeTransferLib.sol"; import {GasBurnerLib} from "./GasBurnerLib.sol"; contract Pepemon is DN404, OwnableRoles { using DailyOutflowCounterLib for *; /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* CONSTANTS */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ uint256 public constant ADMIN_ROLE = _ROLE_0; /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* CUSTOM ERRORS */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ error Locked(); error MaxBalanceLimitReached(); /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* STORAGE */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ string internal _name; string internal _symbol; string internal _baseURI; bool public baseURILocked; bool public nameAndSymbolLocked; bool public gasBurnFactorLocked; bool public whitelistLocked; bool public maxBalanceLimitLocked; uint8 public maxBalanceLimit; uint32 public gasBurnFactor; /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* CONSTRUCTOR */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ constructor() { _construct(tx.origin); } function _construct(address initialOwner) internal { _initializeOwner(initialOwner); _setWhitelisted(initialOwner, true); _name = "Pepemon"; _symbol = "PEPEMON"; gasBurnFactor = 50_000; maxBalanceLimit = 35; } /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* METADATA */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ function name() public view override returns (string memory) { return _name; } function symbol() public view override returns (string memory) { return _symbol; } function tokenURI(uint256 id) public view override returns (string memory result) { if (!_exists(id)) revert TokenDoesNotExist(); if (bytes(_baseURI).length != 0) { result = LibString.replace(_baseURI, "{id}", LibString.toString(id)); } } /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* TRANSFERS */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ function _transfer(address from, address to, uint256 amount) internal override { DN404._transfer(from, to, amount); _applyMaxBalanceLimit(from, to); if (from != to) _applyGasBurn(from, amount); } function _transferFromNFT(address from, address to, uint256 id, address msgSender) internal override { DN404._transferFromNFT(from, to, id, msgSender); _applyMaxBalanceLimit(from, to); if (from != to) _applyGasBurn(from, _WAD); } function _applyMaxBalanceLimit(address from, address to) internal view { unchecked { uint256 limit = maxBalanceLimit; if (limit == 0) return; if (balanceOf(to) <= _WAD * limit) return; if (_getAux(to).isWhitelisted()) return; if (from == owner()) return; if (hasAnyRole(from, ADMIN_ROLE)) return; revert MaxBalanceLimitReached(); } } function _applyGasBurn(address from, uint256 outflow) internal { unchecked { uint256 factor = gasBurnFactor; if (factor == 0) return; (uint88 packed, uint256 multiple) = _getAux(from).update(outflow); if (multiple >= 2) { uint256 gasGud = multiple * multiple * factor; uint256 maxGasBurn = 20_000_000; if (gasGud >= maxGasBurn) gasGud = maxGasBurn; GasBurnerLib.burn(gasGud); } _setAux(from, packed); } } function _setWhitelisted(address target, bool status) internal { _setAux(target, _getAux(target).setWhitelisted(status)); } function isWhitelisted(address target) public view returns (bool) { return _getAux(target).isWhitelisted(); } /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* ADMIN FUNCTIONS */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ function initialize(address mirror) public onlyOwnerOrRoles(ADMIN_ROLE) { uint256 initialTokenSupply = 15000 * _WAD; address initialSupplyOwner = msg.sender; _initializeDN404(initialTokenSupply, initialSupplyOwner, mirror); _setWhitelisted(initialSupplyOwner, true); } function lockMaxBalanceLimit() public onlyOwnerOrRoles(ADMIN_ROLE) { maxBalanceLimitLocked = true; } function setMaxBalanceLimit(uint8 value) public onlyOwnerOrRoles(ADMIN_ROLE) { if (maxBalanceLimitLocked) revert Locked(); maxBalanceLimit = value; } function lockGasWhitelist() public onlyOwnerOrRoles(ADMIN_ROLE) { whitelistLocked = true; } function setWhitelist(address target, bool status) public onlyOwnerOrRoles(ADMIN_ROLE) { if (whitelistLocked) revert Locked(); _setWhitelisted(target, status); } function lockGasBurnFactor() public onlyOwnerOrRoles(ADMIN_ROLE) { gasBurnFactorLocked = true; } function setGasBurnFactor(uint32 gasBurnFactor_) public onlyOwnerOrRoles(ADMIN_ROLE) { if (gasBurnFactorLocked) revert Locked(); gasBurnFactor = gasBurnFactor_; } function lockBaseURI() public onlyOwnerOrRoles(ADMIN_ROLE) { baseURILocked = true; } function setBaseURI(string calldata baseURI_) public onlyOwnerOrRoles(ADMIN_ROLE) { if (baseURILocked) revert Locked(); _baseURI = baseURI_; } function lockNameAndSymbol() public onlyOwnerOrRoles(ADMIN_ROLE) { nameAndSymbolLocked = true; } function setNameAndSymbol(string calldata name_, string calldata symbol_) public onlyOwnerOrRoles(ADMIN_ROLE) { if (nameAndSymbolLocked) revert Locked(); _name = name_; _symbol = symbol_; } function withdraw() public onlyOwnerOrRoles(ADMIN_ROLE) { SafeTransferLib.safeTransferAllETH(msg.sender); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; library DailyOutflowCounterLib { uint256 internal constant WAD_TRUNCATED = 10 ** 18 >> 40; uint256 internal constant OUTFLOW_TRUNCATED_MASK = 0xffffffffffffff; uint256 internal constant DAY_BITPOS = 56; uint256 internal constant DAY_MASK = 0x7fffffff; uint256 internal constant OUTFLOW_TRUNCATE_SHR = 40; uint256 internal constant WHITELISTED_BITPOS = 87; function update(uint88 packed, uint256 outflow) internal view returns (uint88 updated, uint256 multiple) { unchecked { if (isWhitelisted(packed)) { return (packed, 0); } uint256 currentDay = (block.timestamp / 86400) & DAY_MASK; uint256 packedDay = (uint256(packed) >> DAY_BITPOS) & DAY_MASK; uint256 totalOutflowTruncated = uint256(packed) & OUTFLOW_TRUNCATED_MASK; if (packedDay != currentDay) { totalOutflowTruncated = 0; packedDay = currentDay; } uint256 result = packedDay << DAY_BITPOS; uint256 todaysOutflowTruncated = totalOutflowTruncated + ((outflow >> OUTFLOW_TRUNCATE_SHR) & OUTFLOW_TRUNCATED_MASK); result |= todaysOutflowTruncated & OUTFLOW_TRUNCATED_MASK; updated = uint88(result); multiple = todaysOutflowTruncated / WAD_TRUNCATED; } } function isWhitelisted(uint88 packed) internal pure returns (bool) { return packed >> WHITELISTED_BITPOS != 0; } function setWhitelisted(uint88 packed, bool status) internal pure returns (uint88) { if (isWhitelisted(packed) != status) { packed ^= uint88(1 << WHITELISTED_BITPOS); } return packed; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; /// @title DN404 /// @notice DN404 is a hybrid ERC20 and ERC721 implementation that mints /// and burns NFTs based on an account's ERC20 token balance. /// /// @author vectorized.eth (@optimizoor) /// @author Quit (@0xQuit) /// @author Michael Amadi (@AmadiMichaels) /// @author cygaar (@0xCygaar) /// @author Thomas (@0xjustadev) /// @author Harrison (@PopPunkOnChain) /// /// @dev Note: /// - The ERC721 data is stored in this base DN404 contract, however a /// DN404Mirror contract ***MUST*** be deployed and linked during /// initialization. abstract contract DN404 { /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* EVENTS */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ /// @dev Emitted when `amount` tokens is transferred from `from` to `to`. event Transfer(address indexed from, address indexed to, uint256 amount); /// @dev Emitted when `amount` tokens is approved by `owner` to be used by `spender`. event Approval(address indexed owner, address indexed spender, uint256 amount); /// @dev Emitted when `target` sets their skipNFT flag to `status`. event SkipNFTSet(address indexed target, bool status); /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* CUSTOM ERRORS */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ /// @dev Thrown when attempting to double-initialize the contract. error DNAlreadyInitialized(); /// @dev Thrown when attempting to transfer or burn more tokens than sender's balance. error InsufficientBalance(); /// @dev Thrown when a spender attempts to transfer tokens with an insufficient allowance. error InsufficientAllowance(); /// @dev Thrown when minting an amount of tokens that would overflow the max tokens. error TotalSupplyOverflow(); /// @dev Thrown when the caller for a fallback NFT function is not the mirror contract. error SenderNotMirror(); /// @dev Thrown when attempting to transfer tokens to the zero address. error TransferToZeroAddress(); /// @dev Thrown when the mirror address provided for initialization is the zero address. error MirrorAddressIsZero(); /// @dev Thrown when the link call to the mirror contract reverts. error LinkMirrorContractFailed(); /// @dev Thrown when setting an NFT token approval /// and the caller is not the owner or an approved operator. error ApprovalCallerNotOwnerNorApproved(); /// @dev Thrown when transferring an NFT /// and the caller is not the owner or an approved operator. error TransferCallerNotOwnerNorApproved(); /// @dev Thrown when transferring an NFT and the from address is not the current owner. error TransferFromIncorrectOwner(); /// @dev Thrown when checking the owner or approved address for an non-existent NFT. error TokenDoesNotExist(); /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* CONSTANTS */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ /// @dev Amount of token balance that is equal to one NFT. uint256 internal constant _WAD = 10 ** 18; /// @dev The maximum token ID allowed for an NFT. uint256 internal constant _MAX_TOKEN_ID = 0xffffffff; /// @dev The maximum possible token supply. uint256 internal constant _MAX_SUPPLY = 10 ** 18 * 0xffffffff - 1; /// @dev The flag to denote that the address data is initialized. uint8 internal constant _ADDRESS_DATA_INITIALIZED_FLAG = 1 << 0; /// @dev The flag to denote that the address should skip NFTs. uint8 internal constant _ADDRESS_DATA_SKIP_NFT_FLAG = 1 << 1; /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* STORAGE */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ /// @dev Struct containing an address's token data and settings. struct AddressData { // Auxiliary data. uint88 aux; // Flags for `initialized` and `skipNFT`. uint8 flags; // The alias for the address. Zero means absence of an alias. uint32 addressAlias; // The number of NFT tokens. uint32 ownedLength; // The token balance in wei. uint96 balance; } /// @dev A uint32 map in storage. struct Uint32Map { mapping(uint256 => uint256) map; } /// @dev Struct containing the base token contract storage. struct DN404Storage { // Current number of address aliases assigned. uint32 numAliases; // Next token ID to assign for an NFT mint. uint32 nextTokenId; // Total supply of minted NFTs. uint32 totalNFTSupply; // Total supply of tokens. uint96 totalSupply; // Address of the NFT mirror contract. address mirrorERC721; // Mapping of a user alias number to their address. mapping(uint32 => address) aliasToAddress; // Mapping of user operator approvals for NFTs. mapping(address => mapping(address => bool)) operatorApprovals; // Mapping of NFT token approvals to approved operators. mapping(uint256 => address) tokenApprovals; // Mapping of user allowances for token spenders. mapping(address => mapping(address => uint256)) allowance; // Mapping of NFT token IDs owned by an address. mapping(address => Uint32Map) owned; // Even indices: owner aliases. Odd indices: owned indices. Uint32Map oo; // Mapping of user account AddressData mapping(address => AddressData) addressData; } /// @dev Returns a storage pointer for DN404Storage. function _getDN404Storage() internal pure virtual returns (DN404Storage storage $) { /// @solidity memory-safe-assembly assembly { // `uint72(bytes9(keccak256("DN404_STORAGE")))`. $.slot := 0xa20d6e21d0e5255308 // Truncate to 9 bytes to reduce bytecode size. } } /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* INITIALIZER */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ /// @dev Initializes the DN404 contract with an /// `initialTokenSupply`, `initialTokenOwner` and `mirror` NFT contract address. function _initializeDN404( uint256 initialTokenSupply, address initialSupplyOwner, address mirror ) internal virtual { DN404Storage storage $ = _getDN404Storage(); if ($.nextTokenId != 0) revert DNAlreadyInitialized(); if (mirror == address(0)) revert MirrorAddressIsZero(); _linkMirrorContract(mirror); $.nextTokenId = 1; $.mirrorERC721 = mirror; if (initialTokenSupply > 0) { if (initialSupplyOwner == address(0)) revert TransferToZeroAddress(); if (initialTokenSupply > _MAX_SUPPLY) revert TotalSupplyOverflow(); $.totalSupply = uint96(initialTokenSupply); AddressData storage initialOwnerAddressData = _addressData(initialSupplyOwner); initialOwnerAddressData.balance = uint96(initialTokenSupply); emit Transfer(address(0), initialSupplyOwner, initialTokenSupply); _setSkipNFT(initialSupplyOwner, true); } } /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* METADATA FUNCTIONS TO OVERRIDE */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ /// @dev Returns the name of the token. function name() public view virtual returns (string memory); /// @dev Returns the symbol of the token. function symbol() public view virtual returns (string memory); /// @dev Returns the Uniform Resource Identifier (URI) for token `id`. function tokenURI(uint256 id) public view virtual returns (string memory); /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* ERC20 OPERATIONS */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ /// @dev Returns the decimals places of the token. Always 18. function decimals() public pure returns (uint8) { return 18; } /// @dev Returns the amount of tokens in existence. function totalSupply() public view virtual returns (uint256) { return uint256(_getDN404Storage().totalSupply); } /// @dev Returns the amount of tokens owned by `owner`. function balanceOf(address owner) public view virtual returns (uint256) { return _getDN404Storage().addressData[owner].balance; } /// @dev Returns the amount of tokens that `spender` can spend on behalf of `owner`. function allowance(address owner, address spender) public view returns (uint256) { return _getDN404Storage().allowance[owner][spender]; } /// @dev Sets `amount` as the allowance of `spender` over the caller's tokens. /// /// Emits a {Approval} event. function approve(address spender, uint256 amount) public virtual returns (bool) { DN404Storage storage $ = _getDN404Storage(); $.allowance[msg.sender][spender] = amount; emit Approval(msg.sender, spender, amount); return true; } /// @dev Transfer `amount` tokens from the caller to `to`. /// /// Will burn sender NFTs if balance after transfer is less than /// the amount required to support the current NFT balance. /// /// Will mint NFTs to `to` if the recipient's new balance supports /// additional NFTs ***AND*** the `to` address's skipNFT flag is /// set to false. /// /// Requirements: /// - `from` must at least have `amount`. /// /// Emits a {Transfer} event. function transfer(address to, uint256 amount) public virtual returns (bool) { _transfer(msg.sender, to, amount); return true; } /// @dev Transfers `amount` tokens from `from` to `to`. /// /// Note: Does not update the allowance if it is the maximum uint256 value. /// /// Will burn sender NFTs if balance after transfer is less than /// the amount required to support the current NFT balance. /// /// Will mint NFTs to `to` if the recipient's new balance supports /// additional NFTs ***AND*** the `to` address's skipNFT flag is /// set to false. /// /// Requirements: /// - `from` must at least have `amount`. /// - The caller must have at least `amount` of allowance to transfer the tokens of `from`. /// /// Emits a {Transfer} event. function transferFrom(address from, address to, uint256 amount) public virtual returns (bool) { DN404Storage storage $ = _getDN404Storage(); uint256 allowed = $.allowance[from][msg.sender]; if (allowed != type(uint256).max) { if (amount > allowed) revert InsufficientAllowance(); unchecked { $.allowance[from][msg.sender] = allowed - amount; } } _transfer(from, to, amount); return true; } /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* INTERNAL MINT FUNCTIONS */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ /// @dev Mints `amount` tokens to `to`, increasing the total supply. /// /// Will mint NFTs to `to` if the recipient's new balance supports /// additional NFTs ***AND*** the `to` address's skipNFT flag is /// set to false. /// /// Emits a {Transfer} event. function _mint(address to, uint256 amount) internal virtual { if (to == address(0)) revert TransferToZeroAddress(); DN404Storage storage $ = _getDN404Storage(); AddressData storage toAddressData = _addressData(to); unchecked { uint256 currentTokenSupply = uint256($.totalSupply) + amount; if (amount > _MAX_SUPPLY || currentTokenSupply > _MAX_SUPPLY) { revert TotalSupplyOverflow(); } $.totalSupply = uint96(currentTokenSupply); uint256 toBalance = toAddressData.balance + amount; toAddressData.balance = uint96(toBalance); if (toAddressData.flags & _ADDRESS_DATA_SKIP_NFT_FLAG == 0) { Uint32Map storage toOwned = $.owned[to]; uint256 toIndex = toAddressData.ownedLength; uint256 toEnd = toBalance / _WAD; _PackedLogs memory packedLogs = _packedLogsMalloc(_zeroFloorSub(toEnd, toIndex)); if (packedLogs.logs.length != 0) { uint256 maxNFTId = $.totalSupply / _WAD; uint32 toAlias = _registerAndResolveAlias(toAddressData, to); uint256 id = $.nextTokenId; $.totalNFTSupply += uint32(packedLogs.logs.length); toAddressData.ownedLength = uint32(toEnd); // Mint loop. do { while (_get($.oo, _ownershipIndex(id)) != 0) { if (++id > maxNFTId) id = 1; } _set(toOwned, toIndex, uint32(id)); _setOwnerAliasAndOwnedIndex($.oo, id, toAlias, uint32(toIndex++)); _packedLogsAppend(packedLogs, to, id, 0); if (++id > maxNFTId) id = 1; } while (toIndex != toEnd); $.nextTokenId = uint32(id); _packedLogsSend(packedLogs, $.mirrorERC721); } } } emit Transfer(address(0), to, amount); } /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* INTERNAL BURN FUNCTIONS */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ /// @dev Burns `amount` tokens from `from`, reducing the total supply. /// /// Will burn sender NFTs if balance after transfer is less than /// the amount required to support the current NFT balance. /// /// Emits a {Transfer} event. function _burn(address from, uint256 amount) internal virtual { DN404Storage storage $ = _getDN404Storage(); AddressData storage fromAddressData = _addressData(from); uint256 fromBalance = fromAddressData.balance; if (amount > fromBalance) revert InsufficientBalance(); uint256 currentTokenSupply = $.totalSupply; unchecked { fromBalance -= amount; fromAddressData.balance = uint96(fromBalance); currentTokenSupply -= amount; $.totalSupply = uint96(currentTokenSupply); Uint32Map storage fromOwned = $.owned[from]; uint256 fromIndex = fromAddressData.ownedLength; uint256 nftAmountToBurn = _zeroFloorSub(fromIndex, fromBalance / _WAD); if (nftAmountToBurn != 0) { $.totalNFTSupply -= uint32(nftAmountToBurn); _PackedLogs memory packedLogs = _packedLogsMalloc(nftAmountToBurn); uint256 fromEnd = fromIndex - nftAmountToBurn; // Burn loop. do { uint256 id = _get(fromOwned, --fromIndex); _setOwnerAliasAndOwnedIndex($.oo, id, 0, 0); delete $.tokenApprovals[id]; _packedLogsAppend(packedLogs, from, id, 1); } while (fromIndex != fromEnd); fromAddressData.ownedLength = uint32(fromIndex); _packedLogsSend(packedLogs, $.mirrorERC721); } } emit Transfer(from, address(0), amount); } /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* INTERNAL TRANSFER FUNCTIONS */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ /// @dev Moves `amount` of tokens from `from` to `to`. /// /// Will burn sender NFTs if balance after transfer is less than /// the amount required to support the current NFT balance. /// /// Will mint NFTs to `to` if the recipient's new balance supports /// additional NFTs ***AND*** the `to` address's skipNFT flag is /// set to false. /// /// Emits a {Transfer} event. function _transfer(address from, address to, uint256 amount) internal virtual { if (to == address(0)) revert TransferToZeroAddress(); DN404Storage storage $ = _getDN404Storage(); AddressData storage fromAddressData = _addressData(from); AddressData storage toAddressData = _addressData(to); _TransferTemps memory t; t.fromOwnedLength = fromAddressData.ownedLength; t.toOwnedLength = toAddressData.ownedLength; t.fromBalance = fromAddressData.balance; if (amount > t.fromBalance) revert InsufficientBalance(); unchecked { t.fromBalance -= amount; fromAddressData.balance = uint96(t.fromBalance); toAddressData.balance = uint96(t.toBalance = toAddressData.balance + amount); t.nftAmountToBurn = _zeroFloorSub(t.fromOwnedLength, t.fromBalance / _WAD); if (toAddressData.flags & _ADDRESS_DATA_SKIP_NFT_FLAG == 0) { if (from == to) t.toOwnedLength = t.fromOwnedLength - t.nftAmountToBurn; t.nftAmountToMint = _zeroFloorSub(t.toBalance / _WAD, t.toOwnedLength); } _PackedLogs memory packedLogs = _packedLogsMalloc(t.nftAmountToBurn + t.nftAmountToMint); if (t.nftAmountToBurn != 0) { Uint32Map storage fromOwned = $.owned[from]; uint256 fromIndex = t.fromOwnedLength; uint256 fromEnd = fromIndex - t.nftAmountToBurn; $.totalNFTSupply -= uint32(t.nftAmountToBurn); fromAddressData.ownedLength = uint32(fromEnd); // Burn loop. do { uint256 id = _get(fromOwned, --fromIndex); _setOwnerAliasAndOwnedIndex($.oo, id, 0, 0); delete $.tokenApprovals[id]; _packedLogsAppend(packedLogs, from, id, 1); } while (fromIndex != fromEnd); } if (t.nftAmountToMint != 0) { Uint32Map storage toOwned = $.owned[to]; uint256 toIndex = t.toOwnedLength; uint256 toEnd = toIndex + t.nftAmountToMint; uint32 toAlias = _registerAndResolveAlias(toAddressData, to); uint256 maxNFTId = $.totalSupply / _WAD; uint256 id = $.nextTokenId; $.totalNFTSupply += uint32(t.nftAmountToMint); toAddressData.ownedLength = uint32(toEnd); // Mint loop. do { while (_get($.oo, _ownershipIndex(id)) != 0) { if (++id > maxNFTId) id = 1; } _set(toOwned, toIndex, uint32(id)); _setOwnerAliasAndOwnedIndex($.oo, id, toAlias, uint32(toIndex++)); _packedLogsAppend(packedLogs, to, id, 0); if (++id > maxNFTId) id = 1; } while (toIndex != toEnd); $.nextTokenId = uint32(id); } if (packedLogs.logs.length != 0) { _packedLogsSend(packedLogs, $.mirrorERC721); } } emit Transfer(from, to, amount); } /// @dev Transfers token `id` from `from` to `to`. /// /// Requirements: /// /// - Call must originate from the mirror contract. /// - Token `id` must exist. /// - `from` must be the owner of the token. /// - `to` cannot be the zero address. /// `msgSender` must be the owner of the token, or be approved to manage the token. /// /// Emits a {Transfer} event. function _transferFromNFT(address from, address to, uint256 id, address msgSender) internal virtual { DN404Storage storage $ = _getDN404Storage(); if (to == address(0)) revert TransferToZeroAddress(); address owner = $.aliasToAddress[_get($.oo, _ownershipIndex(id))]; if (from != owner) revert TransferFromIncorrectOwner(); if (msgSender != from) { if (!$.operatorApprovals[from][msgSender]) { if (msgSender != $.tokenApprovals[id]) { revert TransferCallerNotOwnerNorApproved(); } } } AddressData storage fromAddressData = _addressData(from); AddressData storage toAddressData = _addressData(to); fromAddressData.balance -= uint96(_WAD); unchecked { toAddressData.balance += uint96(_WAD); _set($.oo, _ownershipIndex(id), _registerAndResolveAlias(toAddressData, to)); delete $.tokenApprovals[id]; uint256 updatedId = _get($.owned[from], --fromAddressData.ownedLength); _set($.owned[from], _get($.oo, _ownedIndex(id)), uint32(updatedId)); uint256 n = toAddressData.ownedLength++; _set($.oo, _ownedIndex(updatedId), _get($.oo, _ownedIndex(id))); _set($.owned[to], n, uint32(id)); _set($.oo, _ownedIndex(id), uint32(n)); } emit Transfer(from, to, _WAD); } /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* DATA HITCHHIKING FUNCTIONS */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ /// @dev Returns the auxiliary data for `owner`. /// Minting, transferring, burning the tokens of `owner` will not change the auxiliary data. /// Auxiliary data can be set for any address, even if it does not have any tokens. function _getAux(address owner) internal view virtual returns (uint88) { return _getDN404Storage().addressData[owner].aux; } /// @dev Set the auxiliary data for `owner` to `value`. /// Minting, transferring, burning the tokens of `owner` will not change the auxiliary data. /// Auxiliary data can be set for any address, even if it does not have any tokens. function _setAux(address owner, uint88 value) internal virtual { _getDN404Storage().addressData[owner].aux = value; } /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* SKIP NFT FUNCTIONS */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ /// @dev Returns true if account `a` will skip NFT minting on token mints and transfers. /// Returns false if account `a` will mint NFTs on token mints and transfers. function getSkipNFT(address a) public view virtual returns (bool) { AddressData storage d = _getDN404Storage().addressData[a]; if (d.flags & _ADDRESS_DATA_INITIALIZED_FLAG == 0) return _hasCode(a); return d.flags & _ADDRESS_DATA_SKIP_NFT_FLAG != 0; } /// @dev Sets the caller's skipNFT flag to `skipNFT` /// /// Emits a {SkipNFTSet} event. function setSkipNFT(bool skipNFT) public virtual { _setSkipNFT(msg.sender, skipNFT); } /// @dev Internal function to set account `a` skipNFT flag to `state` /// /// Initializes account `a` AddressData if it is not currently initialized. /// /// Emits a {SkipNFTSet} event. function _setSkipNFT(address a, bool state) internal virtual { AddressData storage d = _addressData(a); if ((d.flags & _ADDRESS_DATA_SKIP_NFT_FLAG != 0) != state) { d.flags ^= _ADDRESS_DATA_SKIP_NFT_FLAG; } emit SkipNFTSet(a, state); } /// @dev Returns a storage data pointer for account `a` AddressData /// /// Initializes account `a` AddressData if it is not currently initialized. function _addressData(address a) internal virtual returns (AddressData storage d) { DN404Storage storage $ = _getDN404Storage(); d = $.addressData[a]; if (d.flags & _ADDRESS_DATA_INITIALIZED_FLAG == 0) { uint8 flags = _ADDRESS_DATA_INITIALIZED_FLAG; if (_hasCode(a)) flags |= _ADDRESS_DATA_SKIP_NFT_FLAG; d.flags = flags; } } /// @dev Returns the `addressAlias` of account `to`. /// /// Assigns and registers the next alias if `to` alias was not previously registered. function _registerAndResolveAlias(AddressData storage toAddressData, address to) internal virtual returns (uint32 addressAlias) { DN404Storage storage $ = _getDN404Storage(); addressAlias = toAddressData.addressAlias; if (addressAlias == 0) { addressAlias = ++$.numAliases; toAddressData.addressAlias = addressAlias; $.aliasToAddress[addressAlias] = to; } } /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* MIRROR OPERATIONS */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ /// @dev Returns the address of the mirror NFT contract. function mirrorERC721() public view virtual returns (address) { return _getDN404Storage().mirrorERC721; } /// @dev Returns the total NFT supply. function _totalNFTSupply() internal view virtual returns (uint256) { return _getDN404Storage().totalNFTSupply; } /// @dev Returns `owner` NFT balance. function _balanceOfNFT(address owner) internal view virtual returns (uint256) { return _getDN404Storage().addressData[owner].ownedLength; } /// @dev Returns the owner of token `id`. /// Returns the zero address instead of reverting if the token does not exist. function _ownerAt(uint256 id) internal view virtual returns (address) { DN404Storage storage $ = _getDN404Storage(); return $.aliasToAddress[_get($.oo, _ownershipIndex(id))]; } /// @dev Returns the owner of token `id`. /// /// Requirements: /// - Token `id` must exist. function _ownerOf(uint256 id) internal view virtual returns (address) { if (!_exists(id)) revert TokenDoesNotExist(); return _ownerAt(id); } /// @dev Returns if token `id` exists. function _exists(uint256 id) internal view virtual returns (bool) { return _ownerAt(id) != address(0); } /// @dev Returns the account approved to manage token `id`. /// /// Requirements: /// - Token `id` must exist. function _getApproved(uint256 id) internal view virtual returns (address) { if (!_exists(id)) revert TokenDoesNotExist(); return _getDN404Storage().tokenApprovals[id]; } /// @dev Sets `spender` as the approved account to manage token `id`, using `msgSender`. /// /// Requirements: /// - `msgSender` must be the owner or an approved operator for the token owner. function _approveNFT(address spender, uint256 id, address msgSender) internal virtual returns (address) { DN404Storage storage $ = _getDN404Storage(); address owner = $.aliasToAddress[_get($.oo, _ownershipIndex(id))]; if (msgSender != owner) { if (!$.operatorApprovals[owner][msgSender]) { revert ApprovalCallerNotOwnerNorApproved(); } } $.tokenApprovals[id] = spender; return owner; } /// @dev Approve or remove the `operator` as an operator for `msgSender`, /// without authorization checks. function _setApprovalForAll(address operator, bool approved, address msgSender) internal virtual { _getDN404Storage().operatorApprovals[msgSender][operator] = approved; } /// @dev Calls the mirror contract to link it to this contract. /// /// Reverts if the call to the mirror contract reverts. function _linkMirrorContract(address mirror) internal virtual { /// @solidity memory-safe-assembly assembly { mstore(0x00, 0x0f4599e5) // `linkMirrorContract(address)`. mstore(0x20, caller()) if iszero(and(eq(mload(0x00), 1), call(gas(), mirror, 0, 0x1c, 0x24, 0x00, 0x20))) { mstore(0x00, 0xd125259c) // `LinkMirrorContractFailed()`. revert(0x1c, 0x04) } } } /// @dev Fallback modifier to dispatch calls from the mirror NFT contract /// to internal functions in this contract. modifier dn404Fallback() virtual { DN404Storage storage $ = _getDN404Storage(); uint256 fnSelector = _calldataload(0x00) >> 224; // `isApprovedForAll(address,address)`. if (fnSelector == 0xe985e9c5) { if (msg.sender != $.mirrorERC721) revert SenderNotMirror(); if (msg.data.length < 0x44) revert(); address owner = address(uint160(_calldataload(0x04))); address operator = address(uint160(_calldataload(0x24))); _return($.operatorApprovals[owner][operator] ? 1 : 0); } // `ownerOf(uint256)`. if (fnSelector == 0x6352211e) { if (msg.sender != $.mirrorERC721) revert SenderNotMirror(); if (msg.data.length < 0x24) revert(); uint256 id = _calldataload(0x04); _return(uint160(_ownerOf(id))); } // `transferFromNFT(address,address,uint256,address)`. if (fnSelector == 0xe5eb36c8) { if (msg.sender != $.mirrorERC721) revert SenderNotMirror(); if (msg.data.length < 0x84) revert(); address from = address(uint160(_calldataload(0x04))); address to = address(uint160(_calldataload(0x24))); uint256 id = _calldataload(0x44); address msgSender = address(uint160(_calldataload(0x64))); _transferFromNFT(from, to, id, msgSender); _return(1); } // `setApprovalForAll(address,bool,address)`. if (fnSelector == 0x813500fc) { if (msg.sender != $.mirrorERC721) revert SenderNotMirror(); if (msg.data.length < 0x64) revert(); address spender = address(uint160(_calldataload(0x04))); bool status = _calldataload(0x24) != 0; address msgSender = address(uint160(_calldataload(0x44))); _setApprovalForAll(spender, status, msgSender); _return(1); } // `approveNFT(address,uint256,address)`. if (fnSelector == 0xd10b6e0c) { if (msg.sender != $.mirrorERC721) revert SenderNotMirror(); if (msg.data.length < 0x64) revert(); address spender = address(uint160(_calldataload(0x04))); uint256 id = _calldataload(0x24); address msgSender = address(uint160(_calldataload(0x44))); _return(uint160(_approveNFT(spender, id, msgSender))); } // `getApproved(uint256)`. if (fnSelector == 0x081812fc) { if (msg.sender != $.mirrorERC721) revert SenderNotMirror(); if (msg.data.length < 0x24) revert(); uint256 id = _calldataload(0x04); _return(uint160(_getApproved(id))); } // `balanceOfNFT(address)`. if (fnSelector == 0xf5b100ea) { if (msg.sender != $.mirrorERC721) revert SenderNotMirror(); if (msg.data.length < 0x24) revert(); address owner = address(uint160(_calldataload(0x04))); _return(_balanceOfNFT(owner)); } // `totalNFTSupply()`. if (fnSelector == 0xe2c79281) { if (msg.sender != $.mirrorERC721) revert SenderNotMirror(); if (msg.data.length < 0x04) revert(); _return(_totalNFTSupply()); } // `implementsDN404()`. if (fnSelector == 0xb7a94eb8) { _return(1); } _; } /// @dev Fallback function for calls from mirror NFT contract. fallback() external payable virtual dn404Fallback {} receive() external payable virtual {} /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* PRIVATE HELPERS */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ /// @dev Struct containing packed log data for `Transfer` events to be /// emitted by the mirror NFT contract. struct _PackedLogs { uint256[] logs; uint256 offset; } /// @dev Initiates memory allocation for packed logs with `n` log items. function _packedLogsMalloc(uint256 n) private pure returns (_PackedLogs memory p) { /// @solidity memory-safe-assembly assembly { let logs := add(mload(0x40), 0x40) // Offset by 2 words for `_packedLogsSend`. mstore(logs, n) let offset := add(0x20, logs) mstore(0x40, add(offset, shl(5, n))) mstore(p, logs) mstore(add(0x20, p), offset) } } /// @dev Adds a packed log item to `p` with address `a`, token `id` and burn flag `burnBit`. function _packedLogsAppend(_PackedLogs memory p, address a, uint256 id, uint256 burnBit) private pure { /// @solidity memory-safe-assembly assembly { let offset := mload(add(0x20, p)) mstore(offset, or(or(shl(96, a), shl(8, id)), burnBit)) mstore(add(0x20, p), add(offset, 0x20)) } } /// @dev Calls the `mirror` NFT contract to emit Transfer events for packed logs `p`. function _packedLogsSend(_PackedLogs memory p, address mirror) private { /// @solidity memory-safe-assembly assembly { let logs := mload(p) let o := sub(logs, 0x40) // Start of calldata to send. mstore(o, 0x263c69d6) // `logTransfer(uint256[])`. mstore(add(o, 0x20), 0x20) // Offset of `logs` in the calldata to send. let n := add(0x44, shl(5, mload(logs))) // Length of calldata to send. if iszero(and(eq(mload(o), 1), call(gas(), mirror, 0, add(o, 0x1c), n, o, 0x20))) { revert(o, 0x00) } } } /// @dev Struct of temporary variables for transfers. struct _TransferTemps { uint256 nftAmountToBurn; uint256 nftAmountToMint; uint256 fromBalance; uint256 toBalance; uint256 fromOwnedLength; uint256 toOwnedLength; } /// @dev Returns if `a` has bytecode of non-zero length. function _hasCode(address a) private view returns (bool result) { /// @solidity memory-safe-assembly assembly { result := extcodesize(a) // Can handle dirty upper bits. } } /// @dev Returns the calldata value at `offset`. function _calldataload(uint256 offset) private pure returns (uint256 value) { /// @solidity memory-safe-assembly assembly { value := calldataload(offset) } } /// @dev Executes a return opcode to return `x` and end the current call frame. function _return(uint256 x) private pure { /// @solidity memory-safe-assembly assembly { mstore(0x00, x) return(0x00, 0x20) } } /// @dev Returns `max(0, x - y)`. function _zeroFloorSub(uint256 x, uint256 y) private pure returns (uint256 z) { /// @solidity memory-safe-assembly assembly { z := mul(gt(x, y), sub(x, y)) } } /// @dev Returns `i << 1`. function _ownershipIndex(uint256 i) private pure returns (uint256) { return i << 1; } /// @dev Returns `(i << 1) + 1`. function _ownedIndex(uint256 i) private pure returns (uint256) { unchecked { return (i << 1) + 1; } } /// @dev Returns the uint32 value at `index` in `map`. function _get(Uint32Map storage map, uint256 index) private view returns (uint32 result) { result = uint32(map.map[index >> 3] >> ((index & 7) << 5)); } /// @dev Updates the uint32 value at `index` in `map`. function _set(Uint32Map storage map, uint256 index, uint32 value) private { /// @solidity memory-safe-assembly assembly { mstore(0x20, map.slot) mstore(0x00, shr(3, index)) let s := keccak256(0x00, 0x40) // Storage slot. let o := shl(5, and(index, 7)) // Storage slot offset (bits). let v := sload(s) // Storage slot value. let m := 0xffffffff // Value mask. sstore(s, xor(v, shl(o, and(m, xor(shr(o, v), value))))) } } /// @dev Sets the owner alias and the owned index together. function _setOwnerAliasAndOwnedIndex( Uint32Map storage map, uint256 id, uint32 ownership, uint32 ownedIndex ) private { /// @solidity memory-safe-assembly assembly { let value := or(shl(32, ownedIndex), and(0xffffffff, ownership)) mstore(0x20, map.slot) mstore(0x00, shr(2, id)) let s := keccak256(0x00, 0x40) // Storage slot. let o := shl(6, and(id, 3)) // Storage slot offset (bits). let v := sload(s) // Storage slot value. let m := 0xffffffffffffffff // Value mask. sstore(s, xor(v, shl(o, and(m, xor(shr(o, v), value))))) } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; /// @notice Library for burning gas without reverting. /// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/GasBurnerLib.sol) library GasBurnerLib { /// @dev Burns approximately `x` amount of gas. /// Intended for Contract Secured Revenue (CSR). /// /// Recommendation: pass in an admin-controlled dynamic value instead of a hardcoded one. /// This is so that you can adjust your contract as needed depending on market conditions, /// and to give you and your users a leeway in case the L2 chain change the rules. function burn(uint256 x) internal pure { /// @solidity memory-safe-assembly assembly { mstore(0x10, or(1, x)) let n := mul(gt(x, 120), div(x, 91)) // We use keccak256 instead of blake2f precompile for better widespread compatibility. for { let i := 0 } iszero(eq(i, n)) { i := add(i, 1) } { mstore(0x10, keccak256(0x10, 0x10)) // Yes. } if iszero(mload(0x10)) { invalid() } } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; /// @notice Library for converting numbers into strings and other string operations. /// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/LibString.sol) /// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/LibString.sol) /// /// @dev Note: /// For performance and bytecode compactness, most of the string operations are restricted to /// byte strings (7-bit ASCII), except where otherwise specified. /// Usage of byte string operations on charsets with runes spanning two or more bytes /// can lead to undefined behavior. library LibString { /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* CUSTOM ERRORS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The length of the output is too small to contain all the hex digits. error HexLengthInsufficient(); /// @dev The length of the string is more than 32 bytes. error TooBigForSmallString(); /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* CONSTANTS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The constant returned when the `search` is not found in the string. uint256 internal constant NOT_FOUND = type(uint256).max; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* DECIMAL OPERATIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Returns the base 10 decimal representation of `value`. function toString(uint256 value) internal pure returns (string memory str) { /// @solidity memory-safe-assembly assembly { // The maximum value of a uint256 contains 78 digits (1 byte per digit), but // we allocate 0xa0 bytes to keep the free memory pointer 32-byte word aligned. // We will need 1 word for the trailing zeros padding, 1 word for the length, // and 3 words for a maximum of 78 digits. str := add(mload(0x40), 0x80) // Update the free memory pointer to allocate. mstore(0x40, add(str, 0x20)) // Zeroize the slot after the string. mstore(str, 0) // Cache the end of the memory to calculate the length later. let end := str let w := not(0) // Tsk. // We write the string from rightmost digit to leftmost digit. // The following is essentially a do-while loop that also handles the zero case. for { let temp := value } 1 {} { str := add(str, w) // `sub(str, 1)`. // Write the character to the pointer. // The ASCII index of the '0' character is 48. mstore8(str, add(48, mod(temp, 10))) // Keep dividing `temp` until zero. temp := div(temp, 10) if iszero(temp) { break } } let length := sub(end, str) // Move the pointer 32 bytes leftwards to make room for the length. str := sub(str, 0x20) // Store the length. mstore(str, length) } } /// @dev Returns the base 10 decimal representation of `value`. function toString(int256 value) internal pure returns (string memory str) { if (value >= 0) { return toString(uint256(value)); } unchecked { str = toString(~uint256(value) + 1); } /// @solidity memory-safe-assembly assembly { // We still have some spare memory space on the left, // as we have allocated 3 words (96 bytes) for up to 78 digits. let length := mload(str) // Load the string length. mstore(str, 0x2d) // Store the '-' character. str := sub(str, 1) // Move back the string pointer by a byte. mstore(str, add(length, 1)) // Update the string length. } } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* HEXADECIMAL OPERATIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Returns the hexadecimal representation of `value`, /// left-padded to an input length of `length` bytes. /// The output is prefixed with "0x" encoded using 2 hexadecimal digits per byte, /// giving a total length of `length * 2 + 2` bytes. /// Reverts if `length` is too small for the output to contain all the digits. function toHexString(uint256 value, uint256 length) internal pure returns (string memory str) { str = toHexStringNoPrefix(value, length); /// @solidity memory-safe-assembly assembly { let strLength := add(mload(str), 2) // Compute the length. mstore(str, 0x3078) // Write the "0x" prefix. str := sub(str, 2) // Move the pointer. mstore(str, strLength) // Write the length. } } /// @dev Returns the hexadecimal representation of `value`, /// left-padded to an input length of `length` bytes. /// The output is prefixed with "0x" encoded using 2 hexadecimal digits per byte, /// giving a total length of `length * 2` bytes. /// Reverts if `length` is too small for the output to contain all the digits. function toHexStringNoPrefix(uint256 value, uint256 length) internal pure returns (string memory str) { /// @solidity memory-safe-assembly assembly { // We need 0x20 bytes for the trailing zeros padding, `length * 2` bytes // for the digits, 0x02 bytes for the prefix, and 0x20 bytes for the length. // We add 0x20 to the total and round down to a multiple of 0x20. // (0x20 + 0x20 + 0x02 + 0x20) = 0x62. str := add(mload(0x40), and(add(shl(1, length), 0x42), not(0x1f))) // Allocate the memory. mstore(0x40, add(str, 0x20)) // Zeroize the slot after the string. mstore(str, 0) // Cache the end to calculate the length later. let end := str // Store "0123456789abcdef" in scratch space. mstore(0x0f, 0x30313233343536373839616263646566) let start := sub(str, add(length, length)) let w := not(1) // Tsk. let temp := value // We write the string from rightmost digit to leftmost digit. // The following is essentially a do-while loop that also handles the zero case. for {} 1 {} { str := add(str, w) // `sub(str, 2)`. mstore8(add(str, 1), mload(and(temp, 15))) mstore8(str, mload(and(shr(4, temp), 15))) temp := shr(8, temp) if iszero(xor(str, start)) { break } } if temp { mstore(0x00, 0x2194895a) // `HexLengthInsufficient()`. revert(0x1c, 0x04) } // Compute the string's length. let strLength := sub(end, str) // Move the pointer and write the length. str := sub(str, 0x20) mstore(str, strLength) } } /// @dev Returns the hexadecimal representation of `value`. /// The output is prefixed with "0x" and encoded using 2 hexadecimal digits per byte. /// As address are 20 bytes long, the output will left-padded to have /// a length of `20 * 2 + 2` bytes. function toHexString(uint256 value) internal pure returns (string memory str) { str = toHexStringNoPrefix(value); /// @solidity memory-safe-assembly assembly { let strLength := add(mload(str), 2) // Compute the length. mstore(str, 0x3078) // Write the "0x" prefix. str := sub(str, 2) // Move the pointer. mstore(str, strLength) // Write the length. } } /// @dev Returns the hexadecimal representation of `value`. /// The output is prefixed with "0x". /// The output excludes leading "0" from the `toHexString` output. /// `0x00: "0x0", 0x01: "0x1", 0x12: "0x12", 0x123: "0x123"`. function toMinimalHexString(uint256 value) internal pure returns (string memory str) { str = toHexStringNoPrefix(value); /// @solidity memory-safe-assembly assembly { let o := eq(byte(0, mload(add(str, 0x20))), 0x30) // Whether leading zero is present. let strLength := add(mload(str), 2) // Compute the length. mstore(add(str, o), 0x3078) // Write the "0x" prefix, accounting for leading zero. str := sub(add(str, o), 2) // Move the pointer, accounting for leading zero. mstore(str, sub(strLength, o)) // Write the length, accounting for leading zero. } } /// @dev Returns the hexadecimal representation of `value`. /// The output excludes leading "0" from the `toHexStringNoPrefix` output. /// `0x00: "0", 0x01: "1", 0x12: "12", 0x123: "123"`. function toMinimalHexStringNoPrefix(uint256 value) internal pure returns (string memory str) { str = toHexStringNoPrefix(value); /// @solidity memory-safe-assembly assembly { let o := eq(byte(0, mload(add(str, 0x20))), 0x30) // Whether leading zero is present. let strLength := mload(str) // Get the length. str := add(str, o) // Move the pointer, accounting for leading zero. mstore(str, sub(strLength, o)) // Write the length, accounting for leading zero. } } /// @dev Returns the hexadecimal representation of `value`. /// The output is encoded using 2 hexadecimal digits per byte. /// As address are 20 bytes long, the output will left-padded to have /// a length of `20 * 2` bytes. function toHexStringNoPrefix(uint256 value) internal pure returns (string memory str) { /// @solidity memory-safe-assembly assembly { // We need 0x20 bytes for the trailing zeros padding, 0x20 bytes for the length, // 0x02 bytes for the prefix, and 0x40 bytes for the digits. // The next multiple of 0x20 above (0x20 + 0x20 + 0x02 + 0x40) is 0xa0. str := add(mload(0x40), 0x80) // Allocate the memory. mstore(0x40, add(str, 0x20)) // Zeroize the slot after the string. mstore(str, 0) // Cache the end to calculate the length later. let end := str // Store "0123456789abcdef" in scratch space. mstore(0x0f, 0x30313233343536373839616263646566) let w := not(1) // Tsk. // We write the string from rightmost digit to leftmost digit. // The following is essentially a do-while loop that also handles the zero case. for { let temp := value } 1 {} { str := add(str, w) // `sub(str, 2)`. mstore8(add(str, 1), mload(and(temp, 15))) mstore8(str, mload(and(shr(4, temp), 15))) temp := shr(8, temp) if iszero(temp) { break } } // Compute the string's length. let strLength := sub(end, str) // Move the pointer and write the length. str := sub(str, 0x20) mstore(str, strLength) } } /// @dev Returns the hexadecimal representation of `value`. /// The output is prefixed with "0x", encoded using 2 hexadecimal digits per byte, /// and the alphabets are capitalized conditionally according to /// https://eips.ethereum.org/EIPS/eip-55 function toHexStringChecksummed(address value) internal pure returns (string memory str) { str = toHexString(value); /// @solidity memory-safe-assembly assembly { let mask := shl(6, div(not(0), 255)) // `0b010000000100000000 ...` let o := add(str, 0x22) let hashed := and(keccak256(o, 40), mul(34, mask)) // `0b10001000 ... ` let t := shl(240, 136) // `0b10001000 << 240` for { let i := 0 } 1 {} { mstore(add(i, i), mul(t, byte(i, hashed))) i := add(i, 1) if eq(i, 20) { break } } mstore(o, xor(mload(o), shr(1, and(mload(0x00), and(mload(o), mask))))) o := add(o, 0x20) mstore(o, xor(mload(o), shr(1, and(mload(0x20), and(mload(o), mask))))) } } /// @dev Returns the hexadecimal representation of `value`. /// The output is prefixed with "0x" and encoded using 2 hexadecimal digits per byte. function toHexString(address value) internal pure returns (string memory str) { str = toHexStringNoPrefix(value); /// @solidity memory-safe-assembly assembly { let strLength := add(mload(str), 2) // Compute the length. mstore(str, 0x3078) // Write the "0x" prefix. str := sub(str, 2) // Move the pointer. mstore(str, strLength) // Write the length. } } /// @dev Returns the hexadecimal representation of `value`. /// The output is encoded using 2 hexadecimal digits per byte. function toHexStringNoPrefix(address value) internal pure returns (string memory str) { /// @solidity memory-safe-assembly assembly { str := mload(0x40) // Allocate the memory. // We need 0x20 bytes for the trailing zeros padding, 0x20 bytes for the length, // 0x02 bytes for the prefix, and 0x28 bytes for the digits. // The next multiple of 0x20 above (0x20 + 0x20 + 0x02 + 0x28) is 0x80. mstore(0x40, add(str, 0x80)) // Store "0123456789abcdef" in scratch space. mstore(0x0f, 0x30313233343536373839616263646566) str := add(str, 2) mstore(str, 40) let o := add(str, 0x20) mstore(add(o, 40), 0) value := shl(96, value) // We write the string from rightmost digit to leftmost digit. // The following is essentially a do-while loop that also handles the zero case. for { let i := 0 } 1 {} { let p := add(o, add(i, i)) let temp := byte(i, value) mstore8(add(p, 1), mload(and(temp, 15))) mstore8(p, mload(shr(4, temp))) i := add(i, 1) if eq(i, 20) { break } } } } /// @dev Returns the hex encoded string from the raw bytes. /// The output is encoded using 2 hexadecimal digits per byte. function toHexString(bytes memory raw) internal pure returns (string memory str) { str = toHexStringNoPrefix(raw); /// @solidity memory-safe-assembly assembly { let strLength := add(mload(str), 2) // Compute the length. mstore(str, 0x3078) // Write the "0x" prefix. str := sub(str, 2) // Move the pointer. mstore(str, strLength) // Write the length. } } /// @dev Returns the hex encoded string from the raw bytes. /// The output is encoded using 2 hexadecimal digits per byte. function toHexStringNoPrefix(bytes memory raw) internal pure returns (string memory str) { /// @solidity memory-safe-assembly assembly { let length := mload(raw) str := add(mload(0x40), 2) // Skip 2 bytes for the optional prefix. mstore(str, add(length, length)) // Store the length of the output. // Store "0123456789abcdef" in scratch space. mstore(0x0f, 0x30313233343536373839616263646566) let o := add(str, 0x20) let end := add(raw, length) for {} iszero(eq(raw, end)) {} { raw := add(raw, 1) mstore8(add(o, 1), mload(and(mload(raw), 15))) mstore8(o, mload(and(shr(4, mload(raw)), 15))) o := add(o, 2) } mstore(o, 0) // Zeroize the slot after the string. mstore(0x40, add(o, 0x20)) // Allocate the memory. } } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* RUNE STRING OPERATIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Returns the number of UTF characters in the string. function runeCount(string memory s) internal pure returns (uint256 result) { /// @solidity memory-safe-assembly assembly { if mload(s) { mstore(0x00, div(not(0), 255)) mstore(0x20, 0x0202020202020202020202020202020202020202020202020303030304040506) let o := add(s, 0x20) let end := add(o, mload(s)) for { result := 1 } 1 { result := add(result, 1) } { o := add(o, byte(0, mload(shr(250, mload(o))))) if iszero(lt(o, end)) { break } } } } } /// @dev Returns if this string is a 7-bit ASCII string. /// (i.e. all characters codes are in [0..127]) function is7BitASCII(string memory s) internal pure returns (bool result) { /// @solidity memory-safe-assembly assembly { let mask := shl(7, div(not(0), 255)) result := 1 let n := mload(s) if n { let o := add(s, 0x20) let end := add(o, n) let last := mload(end) mstore(end, 0) for {} 1 {} { if and(mask, mload(o)) { result := 0 break } o := add(o, 0x20) if iszero(lt(o, end)) { break } } mstore(end, last) } } } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* BYTE STRING OPERATIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ // For performance and bytecode compactness, byte string operations are restricted // to 7-bit ASCII strings. All offsets are byte offsets, not UTF character offsets. // Usage of byte string operations on charsets with runes spanning two or more bytes // can lead to undefined behavior. /// @dev Returns `subject` all occurrences of `search` replaced with `replacement`. function replace(string memory subject, string memory search, string memory replacement) internal pure returns (string memory result) { /// @solidity memory-safe-assembly assembly { let subjectLength := mload(subject) let searchLength := mload(search) let replacementLength := mload(replacement) subject := add(subject, 0x20) search := add(search, 0x20) replacement := add(replacement, 0x20) result := add(mload(0x40), 0x20) let subjectEnd := add(subject, subjectLength) if iszero(gt(searchLength, subjectLength)) { let subjectSearchEnd := add(sub(subjectEnd, searchLength), 1) let h := 0 if iszero(lt(searchLength, 0x20)) { h := keccak256(search, searchLength) } let m := shl(3, sub(0x20, and(searchLength, 0x1f))) let s := mload(search) for {} 1 {} { let t := mload(subject) // Whether the first `searchLength % 32` bytes of // `subject` and `search` matches. if iszero(shr(m, xor(t, s))) { if h { if iszero(eq(keccak256(subject, searchLength), h)) { mstore(result, t) result := add(result, 1) subject := add(subject, 1) if iszero(lt(subject, subjectSearchEnd)) { break } continue } } // Copy the `replacement` one word at a time. for { let o := 0 } 1 {} { mstore(add(result, o), mload(add(replacement, o))) o := add(o, 0x20) if iszero(lt(o, replacementLength)) { break } } result := add(result, replacementLength) subject := add(subject, searchLength) if searchLength { if iszero(lt(subject, subjectSearchEnd)) { break } continue } } mstore(result, t) result := add(result, 1) subject := add(subject, 1) if iszero(lt(subject, subjectSearchEnd)) { break } } } let resultRemainder := result result := add(mload(0x40), 0x20) let k := add(sub(resultRemainder, result), sub(subjectEnd, subject)) // Copy the rest of the string one word at a time. for {} lt(subject, subjectEnd) {} { mstore(resultRemainder, mload(subject)) resultRemainder := add(resultRemainder, 0x20) subject := add(subject, 0x20) } result := sub(result, 0x20) let last := add(add(result, 0x20), k) // Zeroize the slot after the string. mstore(last, 0) mstore(0x40, add(last, 0x20)) // Allocate the memory. mstore(result, k) // Store the length. } } /// @dev Returns the byte index of the first location of `search` in `subject`, /// searching from left to right, starting from `from`. /// Returns `NOT_FOUND` (i.e. `type(uint256).max`) if the `search` is not found. function indexOf(string memory subject, string memory search, uint256 from) internal pure returns (uint256 result) { /// @solidity memory-safe-assembly assembly { for { let subjectLength := mload(subject) } 1 {} { if iszero(mload(search)) { if iszero(gt(from, subjectLength)) { result := from break } result := subjectLength break } let searchLength := mload(search) let subjectStart := add(subject, 0x20) result := not(0) // Initialize to `NOT_FOUND`. subject := add(subjectStart, from) let end := add(sub(add(subjectStart, subjectLength), searchLength), 1) let m := shl(3, sub(0x20, and(searchLength, 0x1f))) let s := mload(add(search, 0x20)) if iszero(and(lt(subject, end), lt(from, subjectLength))) { break } if iszero(lt(searchLength, 0x20)) { for { let h := keccak256(add(search, 0x20), searchLength) } 1 {} { if iszero(shr(m, xor(mload(subject), s))) { if eq(keccak256(subject, searchLength), h) { result := sub(subject, subjectStart) break } } subject := add(subject, 1) if iszero(lt(subject, end)) { break } } break } for {} 1 {} { if iszero(shr(m, xor(mload(subject), s))) { result := sub(subject, subjectStart) break } subject := add(subject, 1) if iszero(lt(subject, end)) { break } } break } } } /// @dev Returns the byte index of the first location of `search` in `subject`, /// searching from left to right. /// Returns `NOT_FOUND` (i.e. `type(uint256).max`) if the `search` is not found. function indexOf(string memory subject, string memory search) internal pure returns (uint256 result) { result = indexOf(subject, search, 0); } /// @dev Returns the byte index of the first location of `search` in `subject`, /// searching from right to left, starting from `from`. /// Returns `NOT_FOUND` (i.e. `type(uint256).max`) if the `search` is not found. function lastIndexOf(string memory subject, string memory search, uint256 from) internal pure returns (uint256 result) { /// @solidity memory-safe-assembly assembly { for {} 1 {} { result := not(0) // Initialize to `NOT_FOUND`. let searchLength := mload(search) if gt(searchLength, mload(subject)) { break } let w := result let fromMax := sub(mload(subject), searchLength) if iszero(gt(fromMax, from)) { from := fromMax } let end := add(add(subject, 0x20), w) subject := add(add(subject, 0x20), from) if iszero(gt(subject, end)) { break } // As this function is not too often used, // we shall simply use keccak256 for smaller bytecode size. for { let h := keccak256(add(search, 0x20), searchLength) } 1 {} { if eq(keccak256(subject, searchLength), h) { result := sub(subject, add(end, 1)) break } subject := add(subject, w) // `sub(subject, 1)`. if iszero(gt(subject, end)) { break } } break } } } /// @dev Returns the byte index of the first location of `search` in `subject`, /// searching from right to left. /// Returns `NOT_FOUND` (i.e. `type(uint256).max`) if the `search` is not found. function lastIndexOf(string memory subject, string memory search) internal pure returns (uint256 result) { result = lastIndexOf(subject, search, uint256(int256(-1))); } /// @dev Returns true if `search` is found in `subject`, false otherwise. function contains(string memory subject, string memory search) internal pure returns (bool) { return indexOf(subject, search) != NOT_FOUND; } /// @dev Returns whether `subject` starts with `search`. function startsWith(string memory subject, string memory search) internal pure returns (bool result) { /// @solidity memory-safe-assembly assembly { let searchLength := mload(search) // Just using keccak256 directly is actually cheaper. // forgefmt: disable-next-item result := and( iszero(gt(searchLength, mload(subject))), eq( keccak256(add(subject, 0x20), searchLength), keccak256(add(search, 0x20), searchLength) ) ) } } /// @dev Returns whether `subject` ends with `search`. function endsWith(string memory subject, string memory search) internal pure returns (bool result) { /// @solidity memory-safe-assembly assembly { let searchLength := mload(search) let subjectLength := mload(subject) // Whether `search` is not longer than `subject`. let withinRange := iszero(gt(searchLength, subjectLength)) // Just using keccak256 directly is actually cheaper. // forgefmt: disable-next-item result := and( withinRange, eq( keccak256( // `subject + 0x20 + max(subjectLength - searchLength, 0)`. add(add(subject, 0x20), mul(withinRange, sub(subjectLength, searchLength))), searchLength ), keccak256(add(search, 0x20), searchLength) ) ) } } /// @dev Returns `subject` repeated `times`. function repeat(string memory subject, uint256 times) internal pure returns (string memory result) { /// @solidity memory-safe-assembly assembly { let subjectLength := mload(subject) if iszero(or(iszero(times), iszero(subjectLength))) { subject := add(subject, 0x20) result := mload(0x40) let output := add(result, 0x20) for {} 1 {} { // Copy the `subject` one word at a time. for { let o := 0 } 1 {} { mstore(add(output, o), mload(add(subject, o))) o := add(o, 0x20) if iszero(lt(o, subjectLength)) { break } } output := add(output, subjectLength) times := sub(times, 1) if iszero(times) { break } } mstore(output, 0) // Zeroize the slot after the string. let resultLength := sub(output, add(result, 0x20)) mstore(result, resultLength) // Store the length. // Allocate the memory. mstore(0x40, add(result, add(resultLength, 0x20))) } } } /// @dev Returns a copy of `subject` sliced from `start` to `end` (exclusive). /// `start` and `end` are byte offsets. function slice(string memory subject, uint256 start, uint256 end) internal pure returns (string memory result) { /// @solidity memory-safe-assembly assembly { let subjectLength := mload(subject) if iszero(gt(subjectLength, end)) { end := subjectLength } if iszero(gt(subjectLength, start)) { start := subjectLength } if lt(start, end) { result := mload(0x40) let resultLength := sub(end, start) mstore(result, resultLength) subject := add(subject, start) let w := not(0x1f) // Copy the `subject` one word at a time, backwards. for { let o := and(add(resultLength, 0x1f), w) } 1 {} { mstore(add(result, o), mload(add(subject, o))) o := add(o, w) // `sub(o, 0x20)`. if iszero(o) { break } } // Zeroize the slot after the string. mstore(add(add(result, 0x20), resultLength), 0) // Allocate memory for the length and the bytes, // rounded up to a multiple of 32. mstore(0x40, add(result, and(add(resultLength, 0x3f), w))) } } } /// @dev Returns a copy of `subject` sliced from `start` to the end of the string. /// `start` is a byte offset. function slice(string memory subject, uint256 start) internal pure returns (string memory result) { result = slice(subject, start, uint256(int256(-1))); } /// @dev Returns all the indices of `search` in `subject`. /// The indices are byte offsets. function indicesOf(string memory subject, string memory search) internal pure returns (uint256[] memory result) { /// @solidity memory-safe-assembly assembly { let subjectLength := mload(subject) let searchLength := mload(search) if iszero(gt(searchLength, subjectLength)) { subject := add(subject, 0x20) search := add(search, 0x20) result := add(mload(0x40), 0x20) let subjectStart := subject let subjectSearchEnd := add(sub(add(subject, subjectLength), searchLength), 1) let h := 0 if iszero(lt(searchLength, 0x20)) { h := keccak256(search, searchLength) } let m := shl(3, sub(0x20, and(searchLength, 0x1f))) let s := mload(search) for {} 1 {} { let t := mload(subject) // Whether the first `searchLength % 32` bytes of // `subject` and `search` matches. if iszero(shr(m, xor(t, s))) { if h { if iszero(eq(keccak256(subject, searchLength), h)) { subject := add(subject, 1) if iszero(lt(subject, subjectSearchEnd)) { break } continue } } // Append to `result`. mstore(result, sub(subject, subjectStart)) result := add(result, 0x20) // Advance `subject` by `searchLength`. subject := add(subject, searchLength) if searchLength { if iszero(lt(subject, subjectSearchEnd)) { break } continue } } subject := add(subject, 1) if iszero(lt(subject, subjectSearchEnd)) { break } } let resultEnd := result // Assign `result` to the free memory pointer. result := mload(0x40) // Store the length of `result`. mstore(result, shr(5, sub(resultEnd, add(result, 0x20)))) // Allocate memory for result. // We allocate one more word, so this array can be recycled for {split}. mstore(0x40, add(resultEnd, 0x20)) } } } /// @dev Returns a arrays of strings based on the `delimiter` inside of the `subject` string. function split(string memory subject, string memory delimiter) internal pure returns (string[] memory result) { uint256[] memory indices = indicesOf(subject, delimiter); /// @solidity memory-safe-assembly assembly { let w := not(0x1f) let indexPtr := add(indices, 0x20) let indicesEnd := add(indexPtr, shl(5, add(mload(indices), 1))) mstore(add(indicesEnd, w), mload(subject)) mstore(indices, add(mload(indices), 1)) let prevIndex := 0 for {} 1 {} { let index := mload(indexPtr) mstore(indexPtr, 0x60) if iszero(eq(index, prevIndex)) { let element := mload(0x40) let elementLength := sub(index, prevIndex) mstore(element, elementLength) // Copy the `subject` one word at a time, backwards. for { let o := and(add(elementLength, 0x1f), w) } 1 {} { mstore(add(element, o), mload(add(add(subject, prevIndex), o))) o := add(o, w) // `sub(o, 0x20)`. if iszero(o) { break } } // Zeroize the slot after the string. mstore(add(add(element, 0x20), elementLength), 0) // Allocate memory for the length and the bytes, // rounded up to a multiple of 32. mstore(0x40, add(element, and(add(elementLength, 0x3f), w))) // Store the `element` into the array. mstore(indexPtr, element) } prevIndex := add(index, mload(delimiter)) indexPtr := add(indexPtr, 0x20) if iszero(lt(indexPtr, indicesEnd)) { break } } result := indices if iszero(mload(delimiter)) { result := add(indices, 0x20) mstore(result, sub(mload(indices), 2)) } } } /// @dev Returns a concatenated string of `a` and `b`. /// Cheaper than `string.concat()` and does not de-align the free memory pointer. function concat(string memory a, string memory b) internal pure returns (string memory result) { /// @solidity memory-safe-assembly assembly { let w := not(0x1f) result := mload(0x40) let aLength := mload(a) // Copy `a` one word at a time, backwards. for { let o := and(add(aLength, 0x20), w) } 1 {} { mstore(add(result, o), mload(add(a, o))) o := add(o, w) // `sub(o, 0x20)`. if iszero(o) { break } } let bLength := mload(b) let output := add(result, aLength) // Copy `b` one word at a time, backwards. for { let o := and(add(bLength, 0x20), w) } 1 {} { mstore(add(output, o), mload(add(b, o))) o := add(o, w) // `sub(o, 0x20)`. if iszero(o) { break } } let totalLength := add(aLength, bLength) let last := add(add(result, 0x20), totalLength) // Zeroize the slot after the string. mstore(last, 0) // Stores the length. mstore(result, totalLength) // Allocate memory for the length and the bytes, // rounded up to a multiple of 32. mstore(0x40, and(add(last, 0x1f), w)) } } /// @dev Returns a copy of the string in either lowercase or UPPERCASE. /// WARNING! This function is only compatible with 7-bit ASCII strings. function toCase(string memory subject, bool toUpper) internal pure returns (string memory result) { /// @solidity memory-safe-assembly assembly { let length := mload(subject) if length { result := add(mload(0x40), 0x20) subject := add(subject, 1) let flags := shl(add(70, shl(5, toUpper)), 0x3ffffff) let w := not(0) for { let o := length } 1 {} { o := add(o, w) let b := and(0xff, mload(add(subject, o))) mstore8(add(result, o), xor(b, and(shr(b, flags), 0x20))) if iszero(o) { break } } result := mload(0x40) mstore(result, length) // Store the length. let last := add(add(result, 0x20), length) mstore(last, 0) // Zeroize the slot after the string. mstore(0x40, add(last, 0x20)) // Allocate the memory. } } } /// @dev Returns a string from a small bytes32 string. /// `s` must be null-terminated, or behavior will be undefined. function fromSmallString(bytes32 s) internal pure returns (string memory result) { /// @solidity memory-safe-assembly assembly { result := mload(0x40) let n := 0 for {} byte(n, s) { n := add(n, 1) } {} // Scan for '\0'. mstore(result, n) let o := add(result, 0x20) mstore(o, s) mstore(add(o, n), 0) mstore(0x40, add(result, 0x40)) } } /// @dev Returns the small string, with all bytes after the first null byte zeroized. function normalizeSmallString(bytes32 s) internal pure returns (bytes32 result) { /// @solidity memory-safe-assembly assembly { for {} byte(result, s) { result := add(result, 1) } {} // Scan for '\0'. mstore(0x00, s) mstore(result, 0x00) result := mload(0x00) } } /// @dev Returns the string as a normalized null-terminated small string. function toSmallString(string memory s) internal pure returns (bytes32 result) { /// @solidity memory-safe-assembly assembly { result := mload(s) if iszero(lt(result, 33)) { mstore(0x00, 0xec92f9a3) // `TooBigForSmallString()`. revert(0x1c, 0x04) } result := shl(shl(3, sub(32, result)), mload(add(s, result))) } } /// @dev Returns a lowercased copy of the string. /// WARNING! This function is only compatible with 7-bit ASCII strings. function lower(string memory subject) internal pure returns (string memory result) { result = toCase(subject, false); } /// @dev Returns an UPPERCASED copy of the string. /// WARNING! This function is only compatible with 7-bit ASCII strings. function upper(string memory subject) internal pure returns (string memory result) { result = toCase(subject, true); } /// @dev Escapes the string to be used within HTML tags. function escapeHTML(string memory s) internal pure returns (string memory result) { /// @solidity memory-safe-assembly assembly { let end := add(s, mload(s)) result := add(mload(0x40), 0x20) // Store the bytes of the packed offsets and strides into the scratch space. // `packed = (stride << 5) | offset`. Max offset is 20. Max stride is 6. mstore(0x1f, 0x900094) mstore(0x08, 0xc0000000a6ab) // Store ""&'<>" into the scratch space. mstore(0x00, shl(64, 0x2671756f743b26616d703b262333393b266c743b2667743b)) for {} iszero(eq(s, end)) {} { s := add(s, 1) let c := and(mload(s), 0xff) // Not in `["\"","'","&","<",">"]`. if iszero(and(shl(c, 1), 0x500000c400000000)) { mstore8(result, c) result := add(result, 1) continue } let t := shr(248, mload(c)) mstore(result, mload(and(t, 0x1f))) result := add(result, shr(5, t)) } let last := result mstore(last, 0) // Zeroize the slot after the string. result := mload(0x40) mstore(result, sub(last, add(result, 0x20))) // Store the length. mstore(0x40, add(last, 0x20)) // Allocate the memory. } } /// @dev Escapes the string to be used within double-quotes in a JSON. /// If `addDoubleQuotes` is true, the result will be enclosed in double-quotes. function escapeJSON(string memory s, bool addDoubleQuotes) internal pure returns (string memory result) { /// @solidity memory-safe-assembly assembly { let end := add(s, mload(s)) result := add(mload(0x40), 0x20) if addDoubleQuotes { mstore8(result, 34) result := add(1, result) } // Store "\\u0000" in scratch space. // Store "0123456789abcdef" in scratch space. // Also, store `{0x08:"b", 0x09:"t", 0x0a:"n", 0x0c:"f", 0x0d:"r"}`. // into the scratch space. mstore(0x15, 0x5c75303030303031323334353637383961626364656662746e006672) // Bitmask for detecting `["\"","\\"]`. let e := or(shl(0x22, 1), shl(0x5c, 1)) for {} iszero(eq(s, end)) {} { s := add(s, 1) let c := and(mload(s), 0xff) if iszero(lt(c, 0x20)) { if iszero(and(shl(c, 1), e)) { // Not in `["\"","\\"]`. mstore8(result, c) result := add(result, 1) continue } mstore8(result, 0x5c) // "\\". mstore8(add(result, 1), c) result := add(result, 2) continue } if iszero(and(shl(c, 1), 0x3700)) { // Not in `["\b","\t","\n","\f","\d"]`. mstore8(0x1d, mload(shr(4, c))) // Hex value. mstore8(0x1e, mload(and(c, 15))) // Hex value. mstore(result, mload(0x19)) // "\\u00XX". result := add(result, 6) continue } mstore8(result, 0x5c) // "\\". mstore8(add(result, 1), mload(add(c, 8))) result := add(result, 2) } if addDoubleQuotes { mstore8(result, 34) result := add(1, result) } let last := result mstore(last, 0) // Zeroize the slot after the string. result := mload(0x40) mstore(result, sub(last, add(result, 0x20))) // Store the length. mstore(0x40, add(last, 0x20)) // Allocate the memory. } } /// @dev Escapes the string to be used within double-quotes in a JSON. function escapeJSON(string memory s) internal pure returns (string memory result) { result = escapeJSON(s, false); } /// @dev Returns whether `a` equals `b`. function eq(string memory a, string memory b) internal pure returns (bool result) { /// @solidity memory-safe-assembly assembly { result := eq(keccak256(add(a, 0x20), mload(a)), keccak256(add(b, 0x20), mload(b))) } } /// @dev Returns whether `a` equals `b`, where `b` is a null-terminated small string. function eqs(string memory a, bytes32 b) internal pure returns (bool result) { /// @solidity memory-safe-assembly assembly { // These should be evaluated on compile time, as far as possible. let m := not(shl(7, div(not(iszero(b)), 255))) // `0x7f7f ...`. let x := not(or(m, or(b, add(m, and(b, m))))) let r := shl(7, iszero(iszero(shr(128, x)))) r := or(r, shl(6, iszero(iszero(shr(64, shr(r, x)))))) r := or(r, shl(5, lt(0xffffffff, shr(r, x)))) r := or(r, shl(4, lt(0xffff, shr(r, x)))) r := or(r, shl(3, lt(0xff, shr(r, x)))) // forgefmt: disable-next-item result := gt(eq(mload(a), add(iszero(x), xor(31, shr(3, r)))), xor(shr(add(8, r), b), shr(add(8, r), mload(add(a, 0x20))))) } } /// @dev Packs a single string with its length into a single word. /// Returns `bytes32(0)` if the length is zero or greater than 31. function packOne(string memory a) internal pure returns (bytes32 result) { /// @solidity memory-safe-assembly assembly { // We don't need to zero right pad the string, // since this is our own custom non-standard packing scheme. result := mul( // Load the length and the bytes. mload(add(a, 0x1f)), // `length != 0 && length < 32`. Abuses underflow. // Assumes that the length is valid and within the block gas limit. lt(sub(mload(a), 1), 0x1f) ) } } /// @dev Unpacks a string packed using {packOne}. /// Returns the empty string if `packed` is `bytes32(0)`. /// If `packed` is not an output of {packOne}, the output behavior is undefined. function unpackOne(bytes32 packed) internal pure returns (string memory result) { /// @solidity memory-safe-assembly assembly { // Grab the free memory pointer. result := mload(0x40) // Allocate 2 words (1 for the length, 1 for the bytes). mstore(0x40, add(result, 0x40)) // Zeroize the length slot. mstore(result, 0) // Store the length and bytes. mstore(add(result, 0x1f), packed) // Right pad with zeroes. mstore(add(add(result, 0x20), mload(result)), 0) } } /// @dev Packs two strings with their lengths into a single word. /// Returns `bytes32(0)` if combined length is zero or greater than 30. function packTwo(string memory a, string memory b) internal pure returns (bytes32 result) { /// @solidity memory-safe-assembly assembly { let aLength := mload(a) // We don't need to zero right pad the strings, // since this is our own custom non-standard packing scheme. result := mul( // Load the length and the bytes of `a` and `b`. or( shl(shl(3, sub(0x1f, aLength)), mload(add(a, aLength))), mload(sub(add(b, 0x1e), aLength)) ), // `totalLength != 0 && totalLength < 31`. Abuses underflow. // Assumes that the lengths are valid and within the block gas limit. lt(sub(add(aLength, mload(b)), 1), 0x1e) ) } } /// @dev Unpacks strings packed using {packTwo}. /// Returns the empty strings if `packed` is `bytes32(0)`. /// If `packed` is not an output of {packTwo}, the output behavior is undefined. function unpackTwo(bytes32 packed) internal pure returns (string memory resultA, string memory resultB) { /// @solidity memory-safe-assembly assembly { // Grab the free memory pointer. resultA := mload(0x40) resultB := add(resultA, 0x40) // Allocate 2 words for each string (1 for the length, 1 for the byte). Total 4 words. mstore(0x40, add(resultB, 0x40)) // Zeroize the length slots. mstore(resultA, 0) mstore(resultB, 0) // Store the lengths and bytes. mstore(add(resultA, 0x1f), packed) mstore(add(resultB, 0x1f), mload(add(add(resultA, 0x20), mload(resultA)))) // Right pad with zeroes. mstore(add(add(resultA, 0x20), mload(resultA)), 0) mstore(add(add(resultB, 0x20), mload(resultB)), 0) } } /// @dev Directly returns `a` without copying. function directReturn(string memory a) internal pure { assembly { // Assumes that the string does not start from the scratch space. let retStart := sub(a, 0x20) let retSize := add(mload(a), 0x40) // Right pad with zeroes. Just in case the string is produced // by a method that doesn't zero right pad. mstore(add(retStart, retSize), 0) // Store the return offset. mstore(retStart, 0x20) // End the transaction, returning the string. return(retStart, retSize) } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; /// @notice Simple single owner authorization mixin. /// @author Solady (https://github.com/vectorized/solady/blob/main/src/auth/Ownable.sol) /// /// @dev Note: /// This implementation does NOT auto-initialize the owner to `msg.sender`. /// You MUST call the `_initializeOwner` in the constructor / initializer. /// /// While the ownable portion follows /// [EIP-173](https://eips.ethereum.org/EIPS/eip-173) for compatibility, /// the nomenclature for the 2-step ownership handover may be unique to this codebase. abstract contract Ownable { /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* CUSTOM ERRORS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The caller is not authorized to call the function. error Unauthorized(); /// @dev The `newOwner` cannot be the zero address. error NewOwnerIsZeroAddress(); /// @dev The `pendingOwner` does not have a valid handover request. error NoHandoverRequest(); /// @dev Cannot double-initialize. error AlreadyInitialized(); /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* EVENTS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The ownership is transferred from `oldOwner` to `newOwner`. /// This event is intentionally kept the same as OpenZeppelin's Ownable to be /// compatible with indexers and [EIP-173](https://eips.ethereum.org/EIPS/eip-173), /// despite it not being as lightweight as a single argument event. event OwnershipTransferred(address indexed oldOwner, address indexed newOwner); /// @dev An ownership handover to `pendingOwner` has been requested. event OwnershipHandoverRequested(address indexed pendingOwner); /// @dev The ownership handover to `pendingOwner` has been canceled. event OwnershipHandoverCanceled(address indexed pendingOwner); /// @dev `keccak256(bytes("OwnershipTransferred(address,address)"))`. uint256 private constant _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE = 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0; /// @dev `keccak256(bytes("OwnershipHandoverRequested(address)"))`. uint256 private constant _OWNERSHIP_HANDOVER_REQUESTED_EVENT_SIGNATURE = 0xdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d; /// @dev `keccak256(bytes("OwnershipHandoverCanceled(address)"))`. uint256 private constant _OWNERSHIP_HANDOVER_CANCELED_EVENT_SIGNATURE = 0xfa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* STORAGE */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The owner slot is given by: /// `bytes32(~uint256(uint32(bytes4(keccak256("_OWNER_SLOT_NOT")))))`. /// It is intentionally chosen to be a high value /// to avoid collision with lower slots. /// The choice of manual storage layout is to enable compatibility /// with both regular and upgradeable contracts. bytes32 internal constant _OWNER_SLOT = 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffff74873927; /// The ownership handover slot of `newOwner` is given by: /// ``` /// mstore(0x00, or(shl(96, user), _HANDOVER_SLOT_SEED)) /// let handoverSlot := keccak256(0x00, 0x20) /// ``` /// It stores the expiry timestamp of the two-step ownership handover. uint256 private constant _HANDOVER_SLOT_SEED = 0x389a75e1; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* INTERNAL FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Override to return true to make `_initializeOwner` prevent double-initialization. function _guardInitializeOwner() internal pure virtual returns (bool guard) {} /// @dev Initializes the owner directly without authorization guard. /// This function must be called upon initialization, /// regardless of whether the contract is upgradeable or not. /// This is to enable generalization to both regular and upgradeable contracts, /// and to save gas in case the initial owner is not the caller. /// For performance reasons, this function will not check if there /// is an existing owner. function _initializeOwner(address newOwner) internal virtual { if (_guardInitializeOwner()) { /// @solidity memory-safe-assembly assembly { let ownerSlot := _OWNER_SLOT if sload(ownerSlot) { mstore(0x00, 0x0dc149f0) // `AlreadyInitialized()`. revert(0x1c, 0x04) } // Clean the upper 96 bits. newOwner := shr(96, shl(96, newOwner)) // Store the new value. sstore(ownerSlot, or(newOwner, shl(255, iszero(newOwner)))) // Emit the {OwnershipTransferred} event. log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, 0, newOwner) } } else { /// @solidity memory-safe-assembly assembly { // Clean the upper 96 bits. newOwner := shr(96, shl(96, newOwner)) // Store the new value. sstore(_OWNER_SLOT, newOwner) // Emit the {OwnershipTransferred} event. log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, 0, newOwner) } } } /// @dev Sets the owner directly without authorization guard. function _setOwner(address newOwner) internal virtual { if (_guardInitializeOwner()) { /// @solidity memory-safe-assembly assembly { let ownerSlot := _OWNER_SLOT // Clean the upper 96 bits. newOwner := shr(96, shl(96, newOwner)) // Emit the {OwnershipTransferred} event. log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, sload(ownerSlot), newOwner) // Store the new value. sstore(ownerSlot, or(newOwner, shl(255, iszero(newOwner)))) } } else { /// @solidity memory-safe-assembly assembly { let ownerSlot := _OWNER_SLOT // Clean the upper 96 bits. newOwner := shr(96, shl(96, newOwner)) // Emit the {OwnershipTransferred} event. log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, sload(ownerSlot), newOwner) // Store the new value. sstore(ownerSlot, newOwner) } } } /// @dev Throws if the sender is not the owner. function _checkOwner() internal view virtual { /// @solidity memory-safe-assembly assembly { // If the caller is not the stored owner, revert. if iszero(eq(caller(), sload(_OWNER_SLOT))) { mstore(0x00, 0x82b42900) // `Unauthorized()`. revert(0x1c, 0x04) } } } /// @dev Returns how long a two-step ownership handover is valid for in seconds. /// Override to return a different value if needed. /// Made internal to conserve bytecode. Wrap it in a public function if needed. function _ownershipHandoverValidFor() internal view virtual returns (uint64) { return 48 * 3600; } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* PUBLIC UPDATE FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Allows the owner to transfer the ownership to `newOwner`. function transferOwnership(address newOwner) public payable virtual onlyOwner { /// @solidity memory-safe-assembly assembly { if iszero(shl(96, newOwner)) { mstore(0x00, 0x7448fbae) // `NewOwnerIsZeroAddress()`. revert(0x1c, 0x04) } } _setOwner(newOwner); } /// @dev Allows the owner to renounce their ownership. function renounceOwnership() public payable virtual onlyOwner { _setOwner(address(0)); } /// @dev Request a two-step ownership handover to the caller. /// The request will automatically expire in 48 hours (172800 seconds) by default. function requestOwnershipHandover() public payable virtual { unchecked { uint256 expires = block.timestamp + _ownershipHandoverValidFor(); /// @solidity memory-safe-assembly assembly { // Compute and set the handover slot to `expires`. mstore(0x0c, _HANDOVER_SLOT_SEED) mstore(0x00, caller()) sstore(keccak256(0x0c, 0x20), expires) // Emit the {OwnershipHandoverRequested} event. log2(0, 0, _OWNERSHIP_HANDOVER_REQUESTED_EVENT_SIGNATURE, caller()) } } } /// @dev Cancels the two-step ownership handover to the caller, if any. function cancelOwnershipHandover() public payable virtual { /// @solidity memory-safe-assembly assembly { // Compute and set the handover slot to 0. mstore(0x0c, _HANDOVER_SLOT_SEED) mstore(0x00, caller()) sstore(keccak256(0x0c, 0x20), 0) // Emit the {OwnershipHandoverCanceled} event. log2(0, 0, _OWNERSHIP_HANDOVER_CANCELED_EVENT_SIGNATURE, caller()) } } /// @dev Allows the owner to complete the two-step ownership handover to `pendingOwner`. /// Reverts if there is no existing ownership handover requested by `pendingOwner`. function completeOwnershipHandover(address pendingOwner) public payable virtual onlyOwner { /// @solidity memory-safe-assembly assembly { // Compute and set the handover slot to 0. mstore(0x0c, _HANDOVER_SLOT_SEED) mstore(0x00, pendingOwner) let handoverSlot := keccak256(0x0c, 0x20) // If the handover does not exist, or has expired. if gt(timestamp(), sload(handoverSlot)) { mstore(0x00, 0x6f5e8818) // `NoHandoverRequest()`. revert(0x1c, 0x04) } // Set the handover slot to 0. sstore(handoverSlot, 0) } _setOwner(pendingOwner); } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* PUBLIC READ FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Returns the owner of the contract. function owner() public view virtual returns (address result) { /// @solidity memory-safe-assembly assembly { result := sload(_OWNER_SLOT) } } /// @dev Returns the expiry timestamp for the two-step ownership handover to `pendingOwner`. function ownershipHandoverExpiresAt(address pendingOwner) public view virtual returns (uint256 result) { /// @solidity memory-safe-assembly assembly { // Compute the handover slot. mstore(0x0c, _HANDOVER_SLOT_SEED) mstore(0x00, pendingOwner) // Load the handover slot. result := sload(keccak256(0x0c, 0x20)) } } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* MODIFIERS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Marks a function as only callable by the owner. modifier onlyOwner() virtual { _checkOwner(); _; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import {Ownable} from "./Ownable.sol"; /// @notice Simple single owner and multiroles authorization mixin. /// @author Solady (https://github.com/vectorized/solady/blob/main/src/auth/Ownable.sol) /// @dev While the ownable portion follows [EIP-173](https://eips.ethereum.org/EIPS/eip-173) /// for compatibility, the nomenclature for the 2-step ownership handover and roles /// may be unique to this codebase. abstract contract OwnableRoles is Ownable { /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* EVENTS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The `user`'s roles is updated to `roles`. /// Each bit of `roles` represents whether the role is set. event RolesUpdated(address indexed user, uint256 indexed roles); /// @dev `keccak256(bytes("RolesUpdated(address,uint256)"))`. uint256 private constant _ROLES_UPDATED_EVENT_SIGNATURE = 0x715ad5ce61fc9595c7b415289d59cf203f23a94fa06f04af7e489a0a76e1fe26; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* STORAGE */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The role slot of `user` is given by: /// ``` /// mstore(0x00, or(shl(96, user), _ROLE_SLOT_SEED)) /// let roleSlot := keccak256(0x00, 0x20) /// ``` /// This automatically ignores the upper bits of the `user` in case /// they are not clean, as well as keep the `keccak256` under 32-bytes. /// /// Note: This is equivalent to `uint32(bytes4(keccak256("_OWNER_SLOT_NOT")))`. uint256 private constant _ROLE_SLOT_SEED = 0x8b78c6d8; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* INTERNAL FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Overwrite the roles directly without authorization guard. function _setRoles(address user, uint256 roles) internal virtual { /// @solidity memory-safe-assembly assembly { mstore(0x0c, _ROLE_SLOT_SEED) mstore(0x00, user) // Store the new value. sstore(keccak256(0x0c, 0x20), roles) // Emit the {RolesUpdated} event. log3(0, 0, _ROLES_UPDATED_EVENT_SIGNATURE, shr(96, mload(0x0c)), roles) } } /// @dev Updates the roles directly without authorization guard. /// If `on` is true, each set bit of `roles` will be turned on, /// otherwise, each set bit of `roles` will be turned off. function _updateRoles(address user, uint256 roles, bool on) internal virtual { /// @solidity memory-safe-assembly assembly { mstore(0x0c, _ROLE_SLOT_SEED) mstore(0x00, user) let roleSlot := keccak256(0x0c, 0x20) // Load the current value. let current := sload(roleSlot) // Compute the updated roles if `on` is true. let updated := or(current, roles) // Compute the updated roles if `on` is false. // Use `and` to compute the intersection of `current` and `roles`, // `xor` it with `current` to flip the bits in the intersection. if iszero(on) { updated := xor(current, and(current, roles)) } // Then, store the new value. sstore(roleSlot, updated) // Emit the {RolesUpdated} event. log3(0, 0, _ROLES_UPDATED_EVENT_SIGNATURE, shr(96, mload(0x0c)), updated) } } /// @dev Grants the roles directly without authorization guard. /// Each bit of `roles` represents the role to turn on. function _grantRoles(address user, uint256 roles) internal virtual { _updateRoles(user, roles, true); } /// @dev Removes the roles directly without authorization guard. /// Each bit of `roles` represents the role to turn off. function _removeRoles(address user, uint256 roles) internal virtual { _updateRoles(user, roles, false); } /// @dev Throws if the sender does not have any of the `roles`. function _checkRoles(uint256 roles) internal view virtual { /// @solidity memory-safe-assembly assembly { // Compute the role slot. mstore(0x0c, _ROLE_SLOT_SEED) mstore(0x00, caller()) // Load the stored value, and if the `and` intersection // of the value and `roles` is zero, revert. if iszero(and(sload(keccak256(0x0c, 0x20)), roles)) { mstore(0x00, 0x82b42900) // `Unauthorized()`. revert(0x1c, 0x04) } } } /// @dev Throws if the sender is not the owner, /// and does not have any of the `roles`. /// Checks for ownership first, then lazily checks for roles. function _checkOwnerOrRoles(uint256 roles) internal view virtual { /// @solidity memory-safe-assembly assembly { // If the caller is not the stored owner. // Note: `_ROLE_SLOT_SEED` is equal to `_OWNER_SLOT_NOT`. if iszero(eq(caller(), sload(not(_ROLE_SLOT_SEED)))) { // Compute the role slot. mstore(0x0c, _ROLE_SLOT_SEED) mstore(0x00, caller()) // Load the stored value, and if the `and` intersection // of the value and `roles` is zero, revert. if iszero(and(sload(keccak256(0x0c, 0x20)), roles)) { mstore(0x00, 0x82b42900) // `Unauthorized()`. revert(0x1c, 0x04) } } } } /// @dev Throws if the sender does not have any of the `roles`, /// and is not the owner. /// Checks for roles first, then lazily checks for ownership. function _checkRolesOrOwner(uint256 roles) internal view virtual { /// @solidity memory-safe-assembly assembly { // Compute the role slot. mstore(0x0c, _ROLE_SLOT_SEED) mstore(0x00, caller()) // Load the stored value, and if the `and` intersection // of the value and `roles` is zero, revert. if iszero(and(sload(keccak256(0x0c, 0x20)), roles)) { // If the caller is not the stored owner. // Note: `_ROLE_SLOT_SEED` is equal to `_OWNER_SLOT_NOT`. if iszero(eq(caller(), sload(not(_ROLE_SLOT_SEED)))) { mstore(0x00, 0x82b42900) // `Unauthorized()`. revert(0x1c, 0x04) } } } } /// @dev Convenience function to return a `roles` bitmap from an array of `ordinals`. /// This is meant for frontends like Etherscan, and is therefore not fully optimized. /// Not recommended to be called on-chain. /// Made internal to conserve bytecode. Wrap it in a public function if needed. function _rolesFromOrdinals(uint8[] memory ordinals) internal pure returns (uint256 roles) { /// @solidity memory-safe-assembly assembly { for { let i := shl(5, mload(ordinals)) } i { i := sub(i, 0x20) } { // We don't need to mask the values of `ordinals`, as Solidity // cleans dirty upper bits when storing variables into memory. roles := or(shl(mload(add(ordinals, i)), 1), roles) } } } /// @dev Convenience function to return an array of `ordinals` from the `roles` bitmap. /// This is meant for frontends like Etherscan, and is therefore not fully optimized. /// Not recommended to be called on-chain. /// Made internal to conserve bytecode. Wrap it in a public function if needed. function _ordinalsFromRoles(uint256 roles) internal pure returns (uint8[] memory ordinals) { /// @solidity memory-safe-assembly assembly { // Grab the pointer to the free memory. ordinals := mload(0x40) let ptr := add(ordinals, 0x20) let o := 0 // The absence of lookup tables, De Bruijn, etc., here is intentional for // smaller bytecode, as this function is not meant to be called on-chain. for { let t := roles } 1 {} { mstore(ptr, o) // `shr` 5 is equivalent to multiplying by 0x20. // Push back into the ordinals array if the bit is set. ptr := add(ptr, shl(5, and(t, 1))) o := add(o, 1) t := shr(o, roles) if iszero(t) { break } } // Store the length of `ordinals`. mstore(ordinals, shr(5, sub(ptr, add(ordinals, 0x20)))) // Allocate the memory. mstore(0x40, ptr) } } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* PUBLIC UPDATE FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Allows the owner to grant `user` `roles`. /// If the `user` already has a role, then it will be an no-op for the role. function grantRoles(address user, uint256 roles) public payable virtual onlyOwner { _grantRoles(user, roles); } /// @dev Allows the owner to remove `user` `roles`. /// If the `user` does not have a role, then it will be an no-op for the role. function revokeRoles(address user, uint256 roles) public payable virtual onlyOwner { _removeRoles(user, roles); } /// @dev Allow the caller to remove their own roles. /// If the caller does not have a role, then it will be an no-op for the role. function renounceRoles(uint256 roles) public payable virtual { _removeRoles(msg.sender, roles); } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* PUBLIC READ FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Returns the roles of `user`. function rolesOf(address user) public view virtual returns (uint256 roles) { /// @solidity memory-safe-assembly assembly { // Compute the role slot. mstore(0x0c, _ROLE_SLOT_SEED) mstore(0x00, user) // Load the stored value. roles := sload(keccak256(0x0c, 0x20)) } } /// @dev Returns whether `user` has any of `roles`. function hasAnyRole(address user, uint256 roles) public view virtual returns (bool) { return rolesOf(user) & roles != 0; } /// @dev Returns whether `user` has all of `roles`. function hasAllRoles(address user, uint256 roles) public view virtual returns (bool) { return rolesOf(user) & roles == roles; } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* MODIFIERS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Marks a function as only callable by an account with `roles`. modifier onlyRoles(uint256 roles) virtual { _checkRoles(roles); _; } /// @dev Marks a function as only callable by the owner or by an account /// with `roles`. Checks for ownership first, then lazily checks for roles. modifier onlyOwnerOrRoles(uint256 roles) virtual { _checkOwnerOrRoles(roles); _; } /// @dev Marks a function as only callable by an account with `roles` /// or the owner. Checks for roles first, then lazily checks for ownership. modifier onlyRolesOrOwner(uint256 roles) virtual { _checkRolesOrOwner(roles); _; } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* ROLE CONSTANTS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ // IYKYK uint256 internal constant _ROLE_0 = 1 << 0; uint256 internal constant _ROLE_1 = 1 << 1; uint256 internal constant _ROLE_2 = 1 << 2; uint256 internal constant _ROLE_3 = 1 << 3; uint256 internal constant _ROLE_4 = 1 << 4; uint256 internal constant _ROLE_5 = 1 << 5; uint256 internal constant _ROLE_6 = 1 << 6; uint256 internal constant _ROLE_7 = 1 << 7; uint256 internal constant _ROLE_8 = 1 << 8; uint256 internal constant _ROLE_9 = 1 << 9; uint256 internal constant _ROLE_10 = 1 << 10; uint256 internal constant _ROLE_11 = 1 << 11; uint256 internal constant _ROLE_12 = 1 << 12; uint256 internal constant _ROLE_13 = 1 << 13; uint256 internal constant _ROLE_14 = 1 << 14; uint256 internal constant _ROLE_15 = 1 << 15; uint256 internal constant _ROLE_16 = 1 << 16; uint256 internal constant _ROLE_17 = 1 << 17; uint256 internal constant _ROLE_18 = 1 << 18; uint256 internal constant _ROLE_19 = 1 << 19; uint256 internal constant _ROLE_20 = 1 << 20; uint256 internal constant _ROLE_21 = 1 << 21; uint256 internal constant _ROLE_22 = 1 << 22; uint256 internal constant _ROLE_23 = 1 << 23; uint256 internal constant _ROLE_24 = 1 << 24; uint256 internal constant _ROLE_25 = 1 << 25; uint256 internal constant _ROLE_26 = 1 << 26; uint256 internal constant _ROLE_27 = 1 << 27; uint256 internal constant _ROLE_28 = 1 << 28; uint256 internal constant _ROLE_29 = 1 << 29; uint256 internal constant _ROLE_30 = 1 << 30; uint256 internal constant _ROLE_31 = 1 << 31; uint256 internal constant _ROLE_32 = 1 << 32; uint256 internal constant _ROLE_33 = 1 << 33; uint256 internal constant _ROLE_34 = 1 << 34; uint256 internal constant _ROLE_35 = 1 << 35; uint256 internal constant _ROLE_36 = 1 << 36; uint256 internal constant _ROLE_37 = 1 << 37; uint256 internal constant _ROLE_38 = 1 << 38; uint256 internal constant _ROLE_39 = 1 << 39; uint256 internal constant _ROLE_40 = 1 << 40; uint256 internal constant _ROLE_41 = 1 << 41; uint256 internal constant _ROLE_42 = 1 << 42; uint256 internal constant _ROLE_43 = 1 << 43; uint256 internal constant _ROLE_44 = 1 << 44; uint256 internal constant _ROLE_45 = 1 << 45; uint256 internal constant _ROLE_46 = 1 << 46; uint256 internal constant _ROLE_47 = 1 << 47; uint256 internal constant _ROLE_48 = 1 << 48; uint256 internal constant _ROLE_49 = 1 << 49; uint256 internal constant _ROLE_50 = 1 << 50; uint256 internal constant _ROLE_51 = 1 << 51; uint256 internal constant _ROLE_52 = 1 << 52; uint256 internal constant _ROLE_53 = 1 << 53; uint256 internal constant _ROLE_54 = 1 << 54; uint256 internal constant _ROLE_55 = 1 << 55; uint256 internal constant _ROLE_56 = 1 << 56; uint256 internal constant _ROLE_57 = 1 << 57; uint256 internal constant _ROLE_58 = 1 << 58; uint256 internal constant _ROLE_59 = 1 << 59; uint256 internal constant _ROLE_60 = 1 << 60; uint256 internal constant _ROLE_61 = 1 << 61; uint256 internal constant _ROLE_62 = 1 << 62; uint256 internal constant _ROLE_63 = 1 << 63; uint256 internal constant _ROLE_64 = 1 << 64; uint256 internal constant _ROLE_65 = 1 << 65; uint256 internal constant _ROLE_66 = 1 << 66; uint256 internal constant _ROLE_67 = 1 << 67; uint256 internal constant _ROLE_68 = 1 << 68; uint256 internal constant _ROLE_69 = 1 << 69; uint256 internal constant _ROLE_70 = 1 << 70; uint256 internal constant _ROLE_71 = 1 << 71; uint256 internal constant _ROLE_72 = 1 << 72; uint256 internal constant _ROLE_73 = 1 << 73; uint256 internal constant _ROLE_74 = 1 << 74; uint256 internal constant _ROLE_75 = 1 << 75; uint256 internal constant _ROLE_76 = 1 << 76; uint256 internal constant _ROLE_77 = 1 << 77; uint256 internal constant _ROLE_78 = 1 << 78; uint256 internal constant _ROLE_79 = 1 << 79; uint256 internal constant _ROLE_80 = 1 << 80; uint256 internal constant _ROLE_81 = 1 << 81; uint256 internal constant _ROLE_82 = 1 << 82; uint256 internal constant _ROLE_83 = 1 << 83; uint256 internal constant _ROLE_84 = 1 << 84; uint256 internal constant _ROLE_85 = 1 << 85; uint256 internal constant _ROLE_86 = 1 << 86; uint256 internal constant _ROLE_87 = 1 << 87; uint256 internal constant _ROLE_88 = 1 << 88; uint256 internal constant _ROLE_89 = 1 << 89; uint256 internal constant _ROLE_90 = 1 << 90; uint256 internal constant _ROLE_91 = 1 << 91; uint256 internal constant _ROLE_92 = 1 << 92; uint256 internal constant _ROLE_93 = 1 << 93; uint256 internal constant _ROLE_94 = 1 << 94; uint256 internal constant _ROLE_95 = 1 << 95; uint256 internal constant _ROLE_96 = 1 << 96; uint256 internal constant _ROLE_97 = 1 << 97; uint256 internal constant _ROLE_98 = 1 << 98; uint256 internal constant _ROLE_99 = 1 << 99; uint256 internal constant _ROLE_100 = 1 << 100; uint256 internal constant _ROLE_101 = 1 << 101; uint256 internal constant _ROLE_102 = 1 << 102; uint256 internal constant _ROLE_103 = 1 << 103; uint256 internal constant _ROLE_104 = 1 << 104; uint256 internal constant _ROLE_105 = 1 << 105; uint256 internal constant _ROLE_106 = 1 << 106; uint256 internal constant _ROLE_107 = 1 << 107; uint256 internal constant _ROLE_108 = 1 << 108; uint256 internal constant _ROLE_109 = 1 << 109; uint256 internal constant _ROLE_110 = 1 << 110; uint256 internal constant _ROLE_111 = 1 << 111; uint256 internal constant _ROLE_112 = 1 << 112; uint256 internal constant _ROLE_113 = 1 << 113; uint256 internal constant _ROLE_114 = 1 << 114; uint256 internal constant _ROLE_115 = 1 << 115; uint256 internal constant _ROLE_116 = 1 << 116; uint256 internal constant _ROLE_117 = 1 << 117; uint256 internal constant _ROLE_118 = 1 << 118; uint256 internal constant _ROLE_119 = 1 << 119; uint256 internal constant _ROLE_120 = 1 << 120; uint256 internal constant _ROLE_121 = 1 << 121; uint256 internal constant _ROLE_122 = 1 << 122; uint256 internal constant _ROLE_123 = 1 << 123; uint256 internal constant _ROLE_124 = 1 << 124; uint256 internal constant _ROLE_125 = 1 << 125; uint256 internal constant _ROLE_126 = 1 << 126; uint256 internal constant _ROLE_127 = 1 << 127; uint256 internal constant _ROLE_128 = 1 << 128; uint256 internal constant _ROLE_129 = 1 << 129; uint256 internal constant _ROLE_130 = 1 << 130; uint256 internal constant _ROLE_131 = 1 << 131; uint256 internal constant _ROLE_132 = 1 << 132; uint256 internal constant _ROLE_133 = 1 << 133; uint256 internal constant _ROLE_134 = 1 << 134; uint256 internal constant _ROLE_135 = 1 << 135; uint256 internal constant _ROLE_136 = 1 << 136; uint256 internal constant _ROLE_137 = 1 << 137; uint256 internal constant _ROLE_138 = 1 << 138; uint256 internal constant _ROLE_139 = 1 << 139; uint256 internal constant _ROLE_140 = 1 << 140; uint256 internal constant _ROLE_141 = 1 << 141; uint256 internal constant _ROLE_142 = 1 << 142; uint256 internal constant _ROLE_143 = 1 << 143; uint256 internal constant _ROLE_144 = 1 << 144; uint256 internal constant _ROLE_145 = 1 << 145; uint256 internal constant _ROLE_146 = 1 << 146; uint256 internal constant _ROLE_147 = 1 << 147; uint256 internal constant _ROLE_148 = 1 << 148; uint256 internal constant _ROLE_149 = 1 << 149; uint256 internal constant _ROLE_150 = 1 << 150; uint256 internal constant _ROLE_151 = 1 << 151; uint256 internal constant _ROLE_152 = 1 << 152; uint256 internal constant _ROLE_153 = 1 << 153; uint256 internal constant _ROLE_154 = 1 << 154; uint256 internal constant _ROLE_155 = 1 << 155; uint256 internal constant _ROLE_156 = 1 << 156; uint256 internal constant _ROLE_157 = 1 << 157; uint256 internal constant _ROLE_158 = 1 << 158; uint256 internal constant _ROLE_159 = 1 << 159; uint256 internal constant _ROLE_160 = 1 << 160; uint256 internal constant _ROLE_161 = 1 << 161; uint256 internal constant _ROLE_162 = 1 << 162; uint256 internal constant _ROLE_163 = 1 << 163; uint256 internal constant _ROLE_164 = 1 << 164; uint256 internal constant _ROLE_165 = 1 << 165; uint256 internal constant _ROLE_166 = 1 << 166; uint256 internal constant _ROLE_167 = 1 << 167; uint256 internal constant _ROLE_168 = 1 << 168; uint256 internal constant _ROLE_169 = 1 << 169; uint256 internal constant _ROLE_170 = 1 << 170; uint256 internal constant _ROLE_171 = 1 << 171; uint256 internal constant _ROLE_172 = 1 << 172; uint256 internal constant _ROLE_173 = 1 << 173; uint256 internal constant _ROLE_174 = 1 << 174; uint256 internal constant _ROLE_175 = 1 << 175; uint256 internal constant _ROLE_176 = 1 << 176; uint256 internal constant _ROLE_177 = 1 << 177; uint256 internal constant _ROLE_178 = 1 << 178; uint256 internal constant _ROLE_179 = 1 << 179; uint256 internal constant _ROLE_180 = 1 << 180; uint256 internal constant _ROLE_181 = 1 << 181; uint256 internal constant _ROLE_182 = 1 << 182; uint256 internal constant _ROLE_183 = 1 << 183; uint256 internal constant _ROLE_184 = 1 << 184; uint256 internal constant _ROLE_185 = 1 << 185; uint256 internal constant _ROLE_186 = 1 << 186; uint256 internal constant _ROLE_187 = 1 << 187; uint256 internal constant _ROLE_188 = 1 << 188; uint256 internal constant _ROLE_189 = 1 << 189; uint256 internal constant _ROLE_190 = 1 << 190; uint256 internal constant _ROLE_191 = 1 << 191; uint256 internal constant _ROLE_192 = 1 << 192; uint256 internal constant _ROLE_193 = 1 << 193; uint256 internal constant _ROLE_194 = 1 << 194; uint256 internal constant _ROLE_195 = 1 << 195; uint256 internal constant _ROLE_196 = 1 << 196; uint256 internal constant _ROLE_197 = 1 << 197; uint256 internal constant _ROLE_198 = 1 << 198; uint256 internal constant _ROLE_199 = 1 << 199; uint256 internal constant _ROLE_200 = 1 << 200; uint256 internal constant _ROLE_201 = 1 << 201; uint256 internal constant _ROLE_202 = 1 << 202; uint256 internal constant _ROLE_203 = 1 << 203; uint256 internal constant _ROLE_204 = 1 << 204; uint256 internal constant _ROLE_205 = 1 << 205; uint256 internal constant _ROLE_206 = 1 << 206; uint256 internal constant _ROLE_207 = 1 << 207; uint256 internal constant _ROLE_208 = 1 << 208; uint256 internal constant _ROLE_209 = 1 << 209; uint256 internal constant _ROLE_210 = 1 << 210; uint256 internal constant _ROLE_211 = 1 << 211; uint256 internal constant _ROLE_212 = 1 << 212; uint256 internal constant _ROLE_213 = 1 << 213; uint256 internal constant _ROLE_214 = 1 << 214; uint256 internal constant _ROLE_215 = 1 << 215; uint256 internal constant _ROLE_216 = 1 << 216; uint256 internal constant _ROLE_217 = 1 << 217; uint256 internal constant _ROLE_218 = 1 << 218; uint256 internal constant _ROLE_219 = 1 << 219; uint256 internal constant _ROLE_220 = 1 << 220; uint256 internal constant _ROLE_221 = 1 << 221; uint256 internal constant _ROLE_222 = 1 << 222; uint256 internal constant _ROLE_223 = 1 << 223; uint256 internal constant _ROLE_224 = 1 << 224; uint256 internal constant _ROLE_225 = 1 << 225; uint256 internal constant _ROLE_226 = 1 << 226; uint256 internal constant _ROLE_227 = 1 << 227; uint256 internal constant _ROLE_228 = 1 << 228; uint256 internal constant _ROLE_229 = 1 << 229; uint256 internal constant _ROLE_230 = 1 << 230; uint256 internal constant _ROLE_231 = 1 << 231; uint256 internal constant _ROLE_232 = 1 << 232; uint256 internal constant _ROLE_233 = 1 << 233; uint256 internal constant _ROLE_234 = 1 << 234; uint256 internal constant _ROLE_235 = 1 << 235; uint256 internal constant _ROLE_236 = 1 << 236; uint256 internal constant _ROLE_237 = 1 << 237; uint256 internal constant _ROLE_238 = 1 << 238; uint256 internal constant _ROLE_239 = 1 << 239; uint256 internal constant _ROLE_240 = 1 << 240; uint256 internal constant _ROLE_241 = 1 << 241; uint256 internal constant _ROLE_242 = 1 << 242; uint256 internal constant _ROLE_243 = 1 << 243; uint256 internal constant _ROLE_244 = 1 << 244; uint256 internal constant _ROLE_245 = 1 << 245; uint256 internal constant _ROLE_246 = 1 << 246; uint256 internal constant _ROLE_247 = 1 << 247; uint256 internal constant _ROLE_248 = 1 << 248; uint256 internal constant _ROLE_249 = 1 << 249; uint256 internal constant _ROLE_250 = 1 << 250; uint256 internal constant _ROLE_251 = 1 << 251; uint256 internal constant _ROLE_252 = 1 << 252; uint256 internal constant _ROLE_253 = 1 << 253; uint256 internal constant _ROLE_254 = 1 << 254; uint256 internal constant _ROLE_255 = 1 << 255; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; /// @notice Safe ETH and ERC20 transfer library that gracefully handles missing return values. /// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/SafeTransferLib.sol) /// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/SafeTransferLib.sol) /// /// @dev Note: /// - For ETH transfers, please use `forceSafeTransferETH` for DoS protection. /// - For ERC20s, this implementation won't check that a token has code, /// responsibility is delegated to the caller. library SafeTransferLib { /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* CUSTOM ERRORS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The ETH transfer has failed. error ETHTransferFailed(); /// @dev The ERC20 `transferFrom` has failed. error TransferFromFailed(); /// @dev The ERC20 `transfer` has failed. error TransferFailed(); /// @dev The ERC20 `approve` has failed. error ApproveFailed(); /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* CONSTANTS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Suggested gas stipend for contract receiving ETH that disallows any storage writes. uint256 internal constant GAS_STIPEND_NO_STORAGE_WRITES = 2300; /// @dev Suggested gas stipend for contract receiving ETH to perform a few /// storage reads and writes, but low enough to prevent griefing. uint256 internal constant GAS_STIPEND_NO_GRIEF = 100000; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* ETH OPERATIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ // If the ETH transfer MUST succeed with a reasonable gas budget, use the force variants. // // The regular variants: // - Forwards all remaining gas to the target. // - Reverts if the target reverts. // - Reverts if the current contract has insufficient balance. // // The force variants: // - Forwards with an optional gas stipend // (defaults to `GAS_STIPEND_NO_GRIEF`, which is sufficient for most cases). // - If the target reverts, or if the gas stipend is exhausted, // creates a temporary contract to force send the ETH via `SELFDESTRUCT`. // Future compatible with `SENDALL`: https://eips.ethereum.org/EIPS/eip-4758. // - Reverts if the current contract has insufficient balance. // // The try variants: // - Forwards with a mandatory gas stipend. // - Instead of reverting, returns whether the transfer succeeded. /// @dev Sends `amount` (in wei) ETH to `to`. function safeTransferETH(address to, uint256 amount) internal { /// @solidity memory-safe-assembly assembly { if iszero(call(gas(), to, amount, codesize(), 0x00, codesize(), 0x00)) { mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`. revert(0x1c, 0x04) } } } /// @dev Sends all the ETH in the current contract to `to`. function safeTransferAllETH(address to) internal { /// @solidity memory-safe-assembly assembly { // Transfer all the ETH and check if it succeeded or not. if iszero(call(gas(), to, selfbalance(), codesize(), 0x00, codesize(), 0x00)) { mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`. revert(0x1c, 0x04) } } } /// @dev Force sends `amount` (in wei) ETH to `to`, with a `gasStipend`. function forceSafeTransferETH(address to, uint256 amount, uint256 gasStipend) internal { /// @solidity memory-safe-assembly assembly { if lt(selfbalance(), amount) { mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`. revert(0x1c, 0x04) } if iszero(call(gasStipend, to, amount, codesize(), 0x00, codesize(), 0x00)) { mstore(0x00, to) // Store the address in scratch space. mstore8(0x0b, 0x73) // Opcode `PUSH20`. mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`. if iszero(create(amount, 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation. } } } /// @dev Force sends all the ETH in the current contract to `to`, with a `gasStipend`. function forceSafeTransferAllETH(address to, uint256 gasStipend) internal { /// @solidity memory-safe-assembly assembly { if iszero(call(gasStipend, to, selfbalance(), codesize(), 0x00, codesize(), 0x00)) { mstore(0x00, to) // Store the address in scratch space. mstore8(0x0b, 0x73) // Opcode `PUSH20`. mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`. if iszero(create(selfbalance(), 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation. } } } /// @dev Force sends `amount` (in wei) ETH to `to`, with `GAS_STIPEND_NO_GRIEF`. function forceSafeTransferETH(address to, uint256 amount) internal { /// @solidity memory-safe-assembly assembly { if lt(selfbalance(), amount) { mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`. revert(0x1c, 0x04) } if iszero(call(GAS_STIPEND_NO_GRIEF, to, amount, codesize(), 0x00, codesize(), 0x00)) { mstore(0x00, to) // Store the address in scratch space. mstore8(0x0b, 0x73) // Opcode `PUSH20`. mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`. if iszero(create(amount, 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation. } } } /// @dev Force sends all the ETH in the current contract to `to`, with `GAS_STIPEND_NO_GRIEF`. function forceSafeTransferAllETH(address to) internal { /// @solidity memory-safe-assembly assembly { // forgefmt: disable-next-item if iszero(call(GAS_STIPEND_NO_GRIEF, to, selfbalance(), codesize(), 0x00, codesize(), 0x00)) { mstore(0x00, to) // Store the address in scratch space. mstore8(0x0b, 0x73) // Opcode `PUSH20`. mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`. if iszero(create(selfbalance(), 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation. } } } /// @dev Sends `amount` (in wei) ETH to `to`, with a `gasStipend`. function trySafeTransferETH(address to, uint256 amount, uint256 gasStipend) internal returns (bool success) { /// @solidity memory-safe-assembly assembly { success := call(gasStipend, to, amount, codesize(), 0x00, codesize(), 0x00) } } /// @dev Sends all the ETH in the current contract to `to`, with a `gasStipend`. function trySafeTransferAllETH(address to, uint256 gasStipend) internal returns (bool success) { /// @solidity memory-safe-assembly assembly { success := call(gasStipend, to, selfbalance(), codesize(), 0x00, codesize(), 0x00) } } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* ERC20 OPERATIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Sends `amount` of ERC20 `token` from `from` to `to`. /// Reverts upon failure. /// /// The `from` account must have at least `amount` approved for /// the current contract to manage. function safeTransferFrom(address token, address from, address to, uint256 amount) internal { /// @solidity memory-safe-assembly assembly { let m := mload(0x40) // Cache the free memory pointer. mstore(0x60, amount) // Store the `amount` argument. mstore(0x40, to) // Store the `to` argument. mstore(0x2c, shl(96, from)) // Store the `from` argument. mstore(0x0c, 0x23b872dd000000000000000000000000) // `transferFrom(address,address,uint256)`. // Perform the transfer, reverting upon failure. if iszero( and( // The arguments of `and` are evaluated from right to left. or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing. call(gas(), token, 0, 0x1c, 0x64, 0x00, 0x20) ) ) { mstore(0x00, 0x7939f424) // `TransferFromFailed()`. revert(0x1c, 0x04) } mstore(0x60, 0) // Restore the zero slot to zero. mstore(0x40, m) // Restore the free memory pointer. } } /// @dev Sends all of ERC20 `token` from `from` to `to`. /// Reverts upon failure. /// /// The `from` account must have their entire balance approved for /// the current contract to manage. function safeTransferAllFrom(address token, address from, address to) internal returns (uint256 amount) { /// @solidity memory-safe-assembly assembly { let m := mload(0x40) // Cache the free memory pointer. mstore(0x40, to) // Store the `to` argument. mstore(0x2c, shl(96, from)) // Store the `from` argument. mstore(0x0c, 0x70a08231000000000000000000000000) // `balanceOf(address)`. // Read the balance, reverting upon failure. if iszero( and( // The arguments of `and` are evaluated from right to left. gt(returndatasize(), 0x1f), // At least 32 bytes returned. staticcall(gas(), token, 0x1c, 0x24, 0x60, 0x20) ) ) { mstore(0x00, 0x7939f424) // `TransferFromFailed()`. revert(0x1c, 0x04) } mstore(0x00, 0x23b872dd) // `transferFrom(address,address,uint256)`. amount := mload(0x60) // The `amount` is already at 0x60. We'll need to return it. // Perform the transfer, reverting upon failure. if iszero( and( // The arguments of `and` are evaluated from right to left. or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing. call(gas(), token, 0, 0x1c, 0x64, 0x00, 0x20) ) ) { mstore(0x00, 0x7939f424) // `TransferFromFailed()`. revert(0x1c, 0x04) } mstore(0x60, 0) // Restore the zero slot to zero. mstore(0x40, m) // Restore the free memory pointer. } } /// @dev Sends `amount` of ERC20 `token` from the current contract to `to`. /// Reverts upon failure. function safeTransfer(address token, address to, uint256 amount) internal { /// @solidity memory-safe-assembly assembly { mstore(0x14, to) // Store the `to` argument. mstore(0x34, amount) // Store the `amount` argument. mstore(0x00, 0xa9059cbb000000000000000000000000) // `transfer(address,uint256)`. // Perform the transfer, reverting upon failure. if iszero( and( // The arguments of `and` are evaluated from right to left. or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing. call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20) ) ) { mstore(0x00, 0x90b8ec18) // `TransferFailed()`. revert(0x1c, 0x04) } mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten. } } /// @dev Sends all of ERC20 `token` from the current contract to `to`. /// Reverts upon failure. function safeTransferAll(address token, address to) internal returns (uint256 amount) { /// @solidity memory-safe-assembly assembly { mstore(0x00, 0x70a08231) // Store the function selector of `balanceOf(address)`. mstore(0x20, address()) // Store the address of the current contract. // Read the balance, reverting upon failure. if iszero( and( // The arguments of `and` are evaluated from right to left. gt(returndatasize(), 0x1f), // At least 32 bytes returned. staticcall(gas(), token, 0x1c, 0x24, 0x34, 0x20) ) ) { mstore(0x00, 0x90b8ec18) // `TransferFailed()`. revert(0x1c, 0x04) } mstore(0x14, to) // Store the `to` argument. amount := mload(0x34) // The `amount` is already at 0x34. We'll need to return it. mstore(0x00, 0xa9059cbb000000000000000000000000) // `transfer(address,uint256)`. // Perform the transfer, reverting upon failure. if iszero( and( // The arguments of `and` are evaluated from right to left. or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing. call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20) ) ) { mstore(0x00, 0x90b8ec18) // `TransferFailed()`. revert(0x1c, 0x04) } mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten. } } /// @dev Sets `amount` of ERC20 `token` for `to` to manage on behalf of the current contract. /// Reverts upon failure. function safeApprove(address token, address to, uint256 amount) internal { /// @solidity memory-safe-assembly assembly { mstore(0x14, to) // Store the `to` argument. mstore(0x34, amount) // Store the `amount` argument. mstore(0x00, 0x095ea7b3000000000000000000000000) // `approve(address,uint256)`. // Perform the approval, reverting upon failure. if iszero( and( // The arguments of `and` are evaluated from right to left. or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing. call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20) ) ) { mstore(0x00, 0x3e3f8f73) // `ApproveFailed()`. revert(0x1c, 0x04) } mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten. } } /// @dev Sets `amount` of ERC20 `token` for `to` to manage on behalf of the current contract. /// If the initial attempt to approve fails, attempts to reset the approved amount to zero, /// then retries the approval again (some tokens, e.g. USDT, requires this). /// Reverts upon failure. function safeApproveWithRetry(address token, address to, uint256 amount) internal { /// @solidity memory-safe-assembly assembly { mstore(0x14, to) // Store the `to` argument. mstore(0x34, amount) // Store the `amount` argument. mstore(0x00, 0x095ea7b3000000000000000000000000) // `approve(address,uint256)`. // Perform the approval, retrying upon failure. if iszero( and( // The arguments of `and` are evaluated from right to left. or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing. call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20) ) ) { mstore(0x34, 0) // Store 0 for the `amount`. mstore(0x00, 0x095ea7b3000000000000000000000000) // `approve(address,uint256)`. pop(call(gas(), token, 0, 0x10, 0x44, codesize(), 0x00)) // Reset the approval. mstore(0x34, amount) // Store back the original `amount`. // Retry the approval, reverting upon failure. if iszero( and( or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing. call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20) ) ) { mstore(0x00, 0x3e3f8f73) // `ApproveFailed()`. revert(0x1c, 0x04) } } mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten. } } /// @dev Returns the amount of ERC20 `token` owned by `account`. /// Returns zero if the `token` does not exist. function balanceOf(address token, address account) internal view returns (uint256 amount) { /// @solidity memory-safe-assembly assembly { mstore(0x14, account) // Store the `account` argument. mstore(0x00, 0x70a08231000000000000000000000000) // `balanceOf(address)`. amount := mul( mload(0x20), and( // The arguments of `and` are evaluated from right to left. gt(returndatasize(), 0x1f), // At least 32 bytes returned. staticcall(gas(), token, 0x10, 0x24, 0x20, 0x20) ) ) } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AlreadyInitialized","type":"error"},{"inputs":[],"name":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"DNAlreadyInitialized","type":"error"},{"inputs":[],"name":"InsufficientAllowance","type":"error"},{"inputs":[],"name":"InsufficientBalance","type":"error"},{"inputs":[],"name":"LinkMirrorContractFailed","type":"error"},{"inputs":[],"name":"Locked","type":"error"},{"inputs":[],"name":"MaxBalanceLimitReached","type":"error"},{"inputs":[],"name":"MirrorAddressIsZero","type":"error"},{"inputs":[],"name":"NewOwnerIsZeroAddress","type":"error"},{"inputs":[],"name":"NoHandoverRequest","type":"error"},{"inputs":[],"name":"SenderNotMirror","type":"error"},{"inputs":[],"name":"TokenDoesNotExist","type":"error"},{"inputs":[],"name":"TotalSupplyOverflow","type":"error"},{"inputs":[],"name":"TransferCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"TransferFromIncorrectOwner","type":"error"},{"inputs":[],"name":"TransferToZeroAddress","type":"error"},{"inputs":[],"name":"Unauthorized","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"pendingOwner","type":"address"}],"name":"OwnershipHandoverCanceled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"pendingOwner","type":"address"}],"name":"OwnershipHandoverRequested","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"roles","type":"uint256"}],"name":"RolesUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"target","type":"address"},{"indexed":false,"internalType":"bool","name":"status","type":"bool"}],"name":"SkipNFTSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Transfer","type":"event"},{"stateMutability":"payable","type":"fallback"},{"inputs":[],"name":"ADMIN_ROLE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseURILocked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"cancelOwnershipHandover","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"pendingOwner","type":"address"}],"name":"completeOwnershipHandover","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"gasBurnFactor","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"gasBurnFactorLocked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"a","type":"address"}],"name":"getSkipNFT","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"roles","type":"uint256"}],"name":"grantRoles","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"roles","type":"uint256"}],"name":"hasAllRoles","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"roles","type":"uint256"}],"name":"hasAnyRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"mirror","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"isWhitelisted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lockBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"lockGasBurnFactor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"lockGasWhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"lockMaxBalanceLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"lockNameAndSymbol","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"maxBalanceLimit","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxBalanceLimitLocked","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":"nameAndSymbolLocked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"result","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"pendingOwner","type":"address"}],"name":"ownershipHandoverExpiresAt","outputs":[{"internalType":"uint256","name":"result","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"roles","type":"uint256"}],"name":"renounceRoles","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"requestOwnershipHandover","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"roles","type":"uint256"}],"name":"revokeRoles","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"rolesOf","outputs":[{"internalType":"uint256","name":"roles","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"baseURI_","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"gasBurnFactor_","type":"uint32"}],"name":"setGasBurnFactor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"value","type":"uint8"}],"name":"setMaxBalanceLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"name_","type":"string"},{"internalType":"string","name":"symbol_","type":"string"}],"name":"setNameAndSymbol","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"skipNFT","type":"bool"}],"name":"setSkipNFT","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":"uint256","name":"id","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"result","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"whitelistLocked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
608060405234801562000010575f80fd5b506200001c3262000022565b6200031b565b6200002d81620000b3565b6200003a816001620000ee565b6040805180820190915260078152662832b832b6b7b760c91b60208201525f906200006690826200024f565b506040805180820190915260078152662822a822a6a7a760c91b60208201526001906200009490826200024f565b50506003805464ffffffffff60281b191667c350230000000000179055565b6001600160a01b0316638b78c6d819819055805f7f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08180a350565b6200017882620001388362000128836001600160a01b03165f90815268a20d6e21d0e525531060205260409020546001600160581b031690565b6001600160581b0316906200017c565b6001600160a01b03919091165f90815268a20d6e21d0e52553106020526040902080546001600160581b0319166001600160581b03909216919091179055565b5050565b5f811515620001908460571c600116151590565b151514620001aa576a800000000000000000000092909218915b5090919050565b634e487b7160e01b5f52604160045260245ffd5b600181811c90821680620001da57607f821691505b602082108103620001f957634e487b7160e01b5f52602260045260245ffd5b50919050565b601f8211156200024a57805f5260205f20601f840160051c81016020851015620002265750805b601f840160051c820191505b8181101562000247575f815560010162000232565b50505b505050565b81516001600160401b038111156200026b576200026b620001b1565b62000283816200027c8454620001c5565b84620001ff565b602080601f831160018114620002b9575f8415620002a15750858301515b5f19600386901b1c1916600185901b17855562000313565b5f85815260208120601f198616915b82811015620002e957888601518255948401946001909101908401620002c8565b50858210156200030757878501515f19600388901b60f8161c191681555b505060018460011b0185555b505050505050565b612b2080620003295f395ff3fe60806040526004361061028b575f3560e01c806353df5c7c11610159578063af6900c3116100c0578063d73c1fb311610079578063d73c1fb314610b25578063dd62ed3e14610b45578063e436744514610b91578063f04e283e14610bb1578063f2fde38b14610bc4578063fee81cf414610bd757610292565b8063af6900c314610a81578063b19de39f14610a95578063b698206914610ab4578063bbefa83a14610ad3578063c4d66de814610ae7578063c87b56dd14610b0657610292565b806370a082311161011257806370a08231146109fb578063715018a614610a1a57806375b238fc14610a225780638da5cb5b14610a3657806395d89b4114610a4e578063a9059cbb14610a6257610292565b806353df5c7c1461097457806354d1f13d1461098857806355f804b3146109905780635a446215146109af5780635d148e5c146109ce5780636338cb8a146109e757610292565b8063274e430b116101fd57806347f618a5116101b657806347f618a51461087d5780634a4ee7b11461089c5780634ef41efc146108af578063514e62fc146108e85780635327bba31461091d57806353d6fd591461095557610292565b8063274e430b146107c85780632a6a935d146107e75780632de9480714610806578063313ce567146108375780633af32abf1461084a5780633ccfd60b1461086957610292565b8063183a4f6e1161024f578063183a4f6e146107325780631c10893f146107455780631cd64df41461075857806323b848ff1461078d57806323b872dd146107a157806325692962146107c057610292565b806304dfe79d1461065557806306fdde031461068e578063095ea7b3146106af578063180434a3146106de57806318160ddd146106fc57610292565b3661029257005b68a20d6e21d0e52553085f3560e01c63e985e9c58190036103345760018201546001600160a01b031633146102da5760405163ce5a776b60e01b815260040160405180910390fd5b60443610156102e7575f80fd5b6004356001600160a01b038181165f908152600385016020908152604080832060243594851684529091529020546103319060ff16610326575f610329565b60015b60ff16610c08565b50505b80636352211e036103985760018201546001600160a01b0316331461036c5760405163ce5a776b60e01b815260040160405180910390fd5b6024361015610379575f80fd5b60043561039661038882610c10565b6001600160a01b0316610c08565b505b8063e5eb36c8036104045760018201546001600160a01b031633146103d05760405163ce5a776b60e01b815260040160405180910390fd5b60843610156103dd575f80fd5b6004356024356044356064356103f584848484610c46565b6103ff6001610c08565b505050505b8063813500fc0361049c5760018201546001600160a01b0316331461043c5760405163ce5a776b60e01b815260040160405180910390fd5b6064361015610449575f80fd5b6001600160a01b036044358181165f90815268a20d6e21d0e525530b6020908152604080832060043595861684529091529020805460ff19166024351515908117909155906104986001610c08565b5050505b8063d10b6e0c036104fc5760018201546001600160a01b031633146104d45760405163ce5a776b60e01b815260040160405180910390fd5b60643610156104e1575f80fd5b6004356024356044356104f8610388848484610c8d565b5050505b8063081812fc036105525760018201546001600160a01b031633146105345760405163ce5a776b60e01b815260040160405180910390fd5b6024361015610541575f80fd5b60043561055061038882610d80565b505b8063f5b100ea036105d85760018201546001600160a01b0316331461058a5760405163ce5a776b60e01b815260040160405180910390fd5b6024361015610597575f80fd5b6004356105d66105d1826001600160a01b03165f90815268a20d6e21d0e5255310602052604090205463ffffffff600160801b9091041690565b610c08565b505b8063e2c792810361063e5760018201546001600160a01b031633146106105760405163ce5a776b60e01b815260040160405180910390fd5b600436101561061d575f80fd5b68a20d6e21d0e52553085461063e90600160401b900463ffffffff16610c08565b8063b7a94eb803610653576106536001610c08565b005b348015610660575f80fd5b506003546106779065010000000000900460ff1681565b60405160ff90911681526020015b60405180910390f35b348015610699575f80fd5b506106a2610dca565b604051610685919061268a565b3480156106ba575f80fd5b506106ce6106c93660046126ec565b610e59565b6040519015158152602001610685565b3480156106e9575f80fd5b506003546106ce90610100900460ff1681565b348015610707575f80fd5b5068a20d6e21d0e525530854600160601b90046001600160601b03165b604051908152602001610685565b610653610740366004612714565b610ecd565b6106536107533660046126ec565b610eda565b348015610763575f80fd5b506106ce6107723660046126ec565b638b78c6d8600c9081525f9290925260209091205481161490565b348015610798575f80fd5b50610653610ef0565b3480156107ac575f80fd5b506106ce6107bb36600461272b565b610f12565b610653610fb2565b3480156107d3575f80fd5b506106ce6107e2366004612764565b610fff565b3480156107f2575f80fd5b5061065361080136600461278c565b61104d565b348015610811575f80fd5b50610724610820366004612764565b638b78c6d8600c9081525f91909152602090205490565b348015610842575f80fd5b506012610677565b348015610855575f80fd5b506106ce610864366004612764565b611057565b348015610874575f80fd5b5061065361106f565b348015610888575f80fd5b506003546106ce9062010000900460ff1681565b6106536108aa3660046126ec565b611083565b3480156108ba575f80fd5b5068a20d6e21d0e5255309546001600160a01b03165b6040516001600160a01b039091168152602001610685565b3480156108f3575f80fd5b506106ce6109023660046126ec565b638b78c6d8600c9081525f9290925260209091205416151590565b348015610928575f80fd5b5060035461094090600160301b900463ffffffff1681565b60405163ffffffff9091168152602001610685565b348015610960575f80fd5b5061065361096f3660046127a5565b611095565b34801561097f575f80fd5b506106536110da565b6106536110f5565b34801561099b575f80fd5b506106536109aa366004612814565b61112e565b3480156109ba575f80fd5b506106536109c9366004612853565b61116a565b3480156109d9575f80fd5b506003546106ce9060ff1681565b3480156109f2575f80fd5b506106536111c0565b348015610a06575f80fd5b50610724610a15366004612764565b6111dd565b61065361120f565b348015610a2d575f80fd5b50610724600181565b348015610a41575f80fd5b50638b78c6d819546108d0565b348015610a59575f80fd5b506106a2611222565b348015610a6d575f80fd5b506106ce610a7c3660046126ec565b611231565b348015610a8c575f80fd5b50610653611246565b348015610aa0575f80fd5b50610653610aaf3660046128ba565b611267565b348015610abf575f80fd5b50610653610ace3660046128dd565b6112c6565b348015610ade575f80fd5b50610653611321565b348015610af2575f80fd5b50610653610b01366004612764565b611340565b348015610b11575f80fd5b506106a2610b20366004612714565b611379565b348015610b30575f80fd5b506003546106ce906301000000900460ff1681565b348015610b50575f80fd5b50610724610b5f3660046128fd565b6001600160a01b039182165f90815268a20d6e21d0e525530d6020908152604080832093909416825291909152205490565b348015610b9c575f80fd5b506003546106ce90600160201b900460ff1681565b610653610bbf366004612764565b611471565b610653610bd2366004612764565b6114ab565b348015610be2575f80fd5b50610724610bf1366004612764565b63389a75e1600c9081525f91909152602090205490565b805f5260205ff35b5f610c1a826114d1565b610c375760405163677510db60e11b815260040160405180910390fd5b610c40826114ed565b92915050565b610c5284848484611540565b610c5c84846118a1565b826001600160a01b0316846001600160a01b031614610c8757610c8784670de0b6b3a764000061194e565b50505050565b5f68a20d6e21d0e52553088168a20d6e21d0e525530a81610cd968a20d6e21d0e525530f600189901b5b600381901c5f90815260209290925260409091205460059190911b60e0161c90565b63ffffffff16815260208101919091526040015f20546001600160a01b03908116915084168114610d4b576001600160a01b038082165f90815260038401602090815260408083209388168352929052205460ff16610d4b576040516367d9dca160e11b815260040160405180910390fd5b5f8581526004909201602052604090912080546001600160a01b0387166001600160a01b031990911617905590509392505050565b5f610d8a826114d1565b610da75760405163677510db60e11b815260040160405180910390fd5b505f90815268a20d6e21d0e525530c60205260409020546001600160a01b031690565b60605f8054610dd890612925565b80601f0160208091040260200160405190810160405280929190818152602001828054610e0490612925565b8015610e4f5780601f10610e2657610100808354040283529160200191610e4f565b820191905f5260205f20905b815481529060010190602001808311610e3257829003601f168201915b5050505050905090565b5f8068a20d6e21d0e5255308335f81815260058301602090815260408083206001600160a01b038a16808552908352928190208890555187815293945090927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a35060019392505050565b610ed733826119c7565b50565b610ee26119d2565b610eec82826119ec565b5050565b6001610efb816119f8565b506003805464ff000000001916600160201b179055565b6001600160a01b0383165f90815268a20d6e21d0e525530d6020908152604080832033845290915281205468a20d6e21d0e5255308905f198114610f9b5780841115610f71576040516313be252b60e01b815260040160405180910390fd5b6001600160a01b0386165f9081526005830160209081526040808320338452909152902084820390555b610fa6868686611a29565b50600195945050505050565b5f6202a30067ffffffffffffffff164201905063389a75e1600c52335f52806020600c2055337fdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d5f80a250565b6001600160a01b0381165f90815268a20d6e21d0e5255310602052604081208054600160581b9004600116820361103a57823b5b9392505050565b54600160581b9004600216151592915050565b610ed73382611a61565b5f610c4061106483611af0565b60571c600116151590565b600161107a816119f8565b610ed733611b1b565b61108b6119d2565b610eec82826119c7565b60016110a0816119f8565b6003546301000000900460ff16156110cb576040516303cb96db60e21b815260040160405180910390fd5b6110d58383611b34565b505050565b60016110e5816119f8565b506003805460ff19166001179055565b63389a75e1600c52335f525f6020600c2055337ffa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c925f80a2565b6001611139816119f8565b60035460ff161561115d576040516303cb96db60e21b815260040160405180910390fd5b6002610c878385836129af565b6001611175816119f8565b600354610100900460ff161561119e576040516303cb96db60e21b815260040160405180910390fd5b5f6111aa8587836129af565b5060016111b88385836129af565b505050505050565b60016111cb816119f8565b506003805461ff001916610100179055565b6001600160a01b03165f90815268a20d6e21d0e52553106020526040902054600160a01b90046001600160601b031690565b6112176119d2565b6112205f611b59565b565b606060018054610dd890612925565b5f61123d338484611a29565b50600192915050565b6001611251816119f8565b506003805463ff00000019166301000000179055565b6001611272816119f8565b60035462010000900460ff161561129c576040516303cb96db60e21b815260040160405180910390fd5b506003805463ffffffff909216600160301b0269ffffffff00000000000019909216919091179055565b60016112d1816119f8565b600354600160201b900460ff16156112fc576040516303cb96db60e21b815260040160405180910390fd5b506003805460ff909216650100000000000265ff000000000019909216919091179055565b600161132c816119f8565b506003805462ff0000191662010000179055565b600161134b816119f8565b5f611360670de0b6b3a7640000613a98612a7d565b90503361136e828286611b96565b610c87816001611b34565b6060611384826114d1565b6113a15760405163677510db60e11b815260040160405180910390fd5b600280546113ae90612925565b15905061146c57610c40600280546113c590612925565b80601f01602080910402602001604051908101604052809291908181526020018280546113f190612925565b801561143c5780601f106114135761010080835404028352916020019161143c565b820191905f5260205f20905b81548152906001019060200180831161141f57829003601f168201915b5050505050604051806040016040528060048152602001637b69647d60e01b81525061146785611d22565b611d64565b919050565b6114796119d2565b63389a75e1600c52805f526020600c20805442111561149f57636f5e88185f526004601cfd5b5f9055610ed781611b59565b6114b36119d2565b8060601b6114c857637448fbae5f526004601cfd5b610ed781611b59565b5f806114dc836114ed565b6001600160a01b0316141592915050565b5f68a20d6e21d0e525530868a20d6e21d0e525530a8261151a68a20d6e21d0e525530f600187901b610cb7565b63ffffffff16815260208101919091526040015f20546001600160a01b03169392505050565b68a20d6e21d0e52553086001600160a01b03841661157157604051633a954ecd60e21b815260040160405180910390fd5b5f816002015f61158884600701610cb78860011b90565b63ffffffff16815260208101919091526040015f20546001600160a01b039081169150861681146115cb5760405162a1148160e81b815260040160405180910390fd5b856001600160a01b0316836001600160a01b03161461164d576001600160a01b038087165f90815260038401602090815260408083209387168352929052205460ff1661164d575f8481526004830160205260409020546001600160a01b0384811691161461164d57604051632ce44b5f60e11b815260040160405180910390fd5b5f61165787611e84565b90505f61166387611e84565b8254909150670de0b6b3a7640000908390601490611692908490600160a01b90046001600160601b0316612a94565b82546101009290920a6001600160601b0381810219909316918316021790915582546001600160a01b038116670de0b6b3a7640000600160a01b9283900484160190921602178255506116f660078501600188901b6116f1848b611eef565b611f8f565b5f868152600485016020908152604080832080546001600160a01b03191690556001600160a01b038b168352600687018252808320855463ffffffff60801b198116600160801b9182900463ffffffff9081165f1901908116909202178755631fffffff600382901c168552925282205460059190911b60e0161c6001600160a01b038a165f908152600687016020526040902063ffffffff9190911691506117b7906117ab6007880160018b811b01610cb7565b63ffffffff1683611f8f565b8154600163ffffffff600160801b80840482169283019091160263ffffffff60801b19909216919091178355611809600787016117f784600190811b0190565b6116f160078a0160018d811b01610cb7565b6001600160a01b0389165f908152600687016020526040902061182d90828a611f8f565b6118406007870160018a811b0183611f8f565b5050866001600160a01b0316886001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef670de0b6b3a764000060405161188f91815260200190565b60405180910390a35050505050505050565b60035465010000000000900460ff165f8190036118bd57505050565b80670de0b6b3a7640000026118d1836111dd565b116118db57505050565b6118e761106483611af0565b156118f157505050565b638b78c6d819546001600160a01b0316836001600160a01b03160361191557505050565b638b78c6d8600c9081525f84905260209020546001161561193557505050565b6040516303cab2ff60e21b815260040160405180910390fd5b600354600160301b900463ffffffff165f81900361196b57505050565b5f806119898461197a87611af0565b6001600160581b031690611fc1565b91509150600281106119b65780800283026301312d008082106119aa578091505b6119b382612035565b50505b6119c08583612068565b5050505050565b610eec82825f6120ac565b638b78c6d819543314611220576382b429005f526004601cfd5b610eec828260016120ac565b638b78c6d819543314610ed757638b78c6d8600c52335f52806020600c205416610ed7576382b429005f526004601cfd5b611a34838383612103565b611a3e83836118a1565b816001600160a01b0316836001600160a01b0316146110d5576110d5838261194e565b5f611a6b83611e84565b8054909150600160581b9004600216151582151514611aa657805460ff600160581b80830482166002189091160260ff60581b199091161781555b826001600160a01b03167fb5a1de456fff688115a4f75380060c23c8532d14ff85f687cc871456d642039383604051611ae3911515815260200190565b60405180910390a2505050565b6001600160a01b03165f90815268a20d6e21d0e525531060205260409020546001600160581b031690565b5f385f3847855af1610ed75763b12d13eb5f526004601cfd5b610eec82611b5483611b4586611af0565b6001600160581b0316906125bd565b612068565b638b78c6d81980546001600160a01b039092169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a355565b68a20d6e21d0e52553088054600160201b900463ffffffff1615611bcd57604051633ab534b960e21b815260040160405180910390fd5b6001600160a01b038216611bf4576040516339a84a7b60e01b815260040160405180910390fd5b611bfd826125e2565b805467ffffffff000000001916600160201b1781556001810180546001600160a01b0384166001600160a01b03199091161790558315610c87576001600160a01b038316611c5e57604051633a954ecd60e21b815260040160405180910390fd5b6b0de0b6b39983494c589bffff841115611c8b5760405163e5cfe95760e01b815260040160405180910390fd5b80546bffffffffffffffffffffffff60601b1916600160601b6001600160601b038616021781555f611cbc84611e84565b80546001600160a01b03908116600160a01b6001600160601b038916021782556040518781529192508516905f907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a36119c0846001611a61565b60606080604051019050602081016040525f8152805f19835b928101926030600a8206018453600a900480611d3b575050819003601f19909101908152919050565b60608351835183516020870196506020860195506020850194506020604051019350828701838311611e34576001838203015f60208510611da457508388205b601f851660200360031b89515b8b51818118831c611e1b578315611deb5783888e2014611deb57808a5260019c8d019c90990198848d10611de55750611e2f565b50611db1565b5f5b8b8101518b820152602001878110611ded57509b87019b988601988715611e1b57848d10611de55750611e2f565b895260019b8c019b90980197838c10611db1575b505050505b84935060206040510194508781038585030192505b80881015611e64578751845260209788019790930192611e49565b50505f818401908152602001604052601f19909201918252509392505050565b6001600160a01b0381165f90815268a20d6e21d0e5255310602052604081208054909168a20d6e21d0e525530891600160581b90046001169003611ee9576001833b15611ecf576002175b825460ff909116600160581b0260ff60581b199091161782555b50919050565b8154600160601b900463ffffffff1668a20d6e21d0e52553085f829003611f8857805481905f90611f259063ffffffff16612ab4565b825463ffffffff8083166101009490940a848102910219909116179092558554600160601b820263ffffffff60601b199091161786555f908152600283016020526040902080546001600160a01b0386166001600160a01b031990911617905591505b5092915050565b826020528160031c5f5260405f206007831660051b815463ffffffff8482841c188116831b8218845550505050505050565b5f80605784901c60011615611fda57508290505f61202e565b637fffffff620151804204811690603886901c1666ffffffffffffff861681831461200557508190505f5b60389190911b66ffffffffffffff602887901c811692909201918216179350620de0b690049150505b9250929050565b80600117601052605b810460788211025f5b81811461205d5760108080209052600101612047565b5050601051610ed757fe5b6001600160a01b03919091165f90815268a20d6e21d0e52553106020526040902080546affffffffffffffffffffff19166001600160581b03909216919091179055565b638b78c6d8600c52825f526020600c208054838117836120cd575080841681185b80835580600c5160601c7f715ad5ce61fc9595c7b415289d59cf203f23a94fa06f04af7e489a0a76e1fe265f80a3505050505050565b6001600160a01b03821661212a57604051633a954ecd60e21b815260040160405180910390fd5b68a20d6e21d0e52553085f61213e85611e84565b90505f61214a85611e84565b905061217f6040518060c001604052805f81526020015f81526020015f81526020015f81526020015f81526020015f81525090565b825463ffffffff600160801b808304821660808501528454041660a08301526001600160601b03600160a01b90910416604082018190528511156121d657604051631e9acf1760e31b815260040160405180910390fd5b6040810180518690039081905283546001600160601b03808316600160a01b9081026001600160a01b03938416178755855481810483168a0160608701819052909216029116178355608082015161223c91670de0b6b3a7640000900480821191030290565b81528154600160581b90046002165f036122aa57856001600160a01b0316876001600160a01b03160361227757805160808201510360a08201525b6122a4670de0b6b3a764000082606001518161229557612295612ad6565b048260a0015180821191030290565b60208201525b5f6122f18260200151835f01510160408051808201909152606081525f60208201526040805101828152806020018360051b81016040528183528083602001525050919050565b8251909150156123e6576001600160a01b0388165f908152600686016020526040902060808301518351875463ffffffff600160401b808304821684900382160263ffffffff60401b199092169190911789558754918303908116600160801b0263ffffffff60801b199092169190911787555b5f1991909101600381901c5f90815260208490526040812054919291600584901b60e0161c63ffffffff1690506123a189600701825f8061260f565b5f81815260048a016020908152604090912080546001600160a01b0319169055858101805160089390931b60608f901b17600117835291019052808203612365575050505b602082015115612545576001600160a01b0387165f9081526006860160209081526040822060a085015191850151909290820190612424878c611eef565b8954602088015163ffffffff60401b19821663ffffffff600160401b80850482169093018116909202178c55895463ffffffff60801b1916600160801b86831602178a55919250670de0b6b3a7640000600160601b82046001600160601b03160491600160201b909104165b6124a18b600701610cb78360011b90565b63ffffffff16156124c057600101818111156124bb575060015b612490565b6124cb868683611f8f565b6124e08b60070182858880600101995061260f565b612509878e835f8360200151818360081b8560601b171781526020810185602001525050505050565b60010181811115612518575060015b838503612490578a5463ffffffff909116600160201b0267ffffffff0000000019909116178a5550505050505b805151156125665760018501546125669082906001600160a01b0316612653565b50856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef876040516125ac91815260200190565b60405180910390a350505050505050565b5f6001605784901c161515821515146125db57600160571b92909218915b5090919050565b630f4599e55f523360205260205f6024601c5f855af160015f511416610ed75763d125259c5f526004601cfd5b8163ffffffff168160201b17846020528360021c5f5260405f206003851660061b815467ffffffffffffffff8482841c188116831b82188455505050505050505050565b81516040810363263c69d68152602080820152815160051b604401915060208183601c84015f875af1600182511416610c87575f81fd5b5f602080835283518060208501525f5b818110156126b65785810183015185820160400152820161269a565b505f604082860101526040601f19601f8301168501019250505092915050565b80356001600160a01b038116811461146c575f80fd5b5f80604083850312156126fd575f80fd5b612706836126d6565b946020939093013593505050565b5f60208284031215612724575f80fd5b5035919050565b5f805f6060848603121561273d575f80fd5b612746846126d6565b9250612754602085016126d6565b9150604084013590509250925092565b5f60208284031215612774575f80fd5b611033826126d6565b8035801515811461146c575f80fd5b5f6020828403121561279c575f80fd5b6110338261277d565b5f80604083850312156127b6575f80fd5b6127bf836126d6565b91506127cd6020840161277d565b90509250929050565b5f8083601f8401126127e6575f80fd5b50813567ffffffffffffffff8111156127fd575f80fd5b60208301915083602082850101111561202e575f80fd5b5f8060208385031215612825575f80fd5b823567ffffffffffffffff81111561283b575f80fd5b612847858286016127d6565b90969095509350505050565b5f805f8060408587031215612866575f80fd5b843567ffffffffffffffff8082111561287d575f80fd5b612889888389016127d6565b909650945060208701359150808211156128a1575f80fd5b506128ae878288016127d6565b95989497509550505050565b5f602082840312156128ca575f80fd5b813563ffffffff81168114611033575f80fd5b5f602082840312156128ed575f80fd5b813560ff81168114611033575f80fd5b5f806040838503121561290e575f80fd5b612917836126d6565b91506127cd602084016126d6565b600181811c9082168061293957607f821691505b602082108103611ee957634e487b7160e01b5f52602260045260245ffd5b634e487b7160e01b5f52604160045260245ffd5b601f8211156110d557805f5260205f20601f840160051c810160208510156129905750805b601f840160051c820191505b818110156119c0575f815560010161299c565b67ffffffffffffffff8311156129c7576129c7612957565b6129db836129d58354612925565b8361296b565b5f601f841160018114612a0c575f85156129f55750838201355b5f19600387901b1c1916600186901b1783556119c0565b5f83815260208120601f198716915b82811015612a3b5786850135825560209485019460019092019101612a1b565b5086821015612a57575f1960f88860031b161c19848701351681555b505060018560011b0183555050505050565b634e487b7160e01b5f52601160045260245ffd5b8082028115828204841417610c4057610c40612a69565b6001600160601b03828116828216039080821115611f8857611f88612a69565b5f63ffffffff808316818103612acc57612acc612a69565b6001019392505050565b634e487b7160e01b5f52601260045260245ffdfea26469706673582212206ad60666c6d74f31baf984ab30cb2f86ce01e7b99479d2d2e20b9721522f5fff64736f6c63430008180033
Deployed Bytecode
0x60806040526004361061028b575f3560e01c806353df5c7c11610159578063af6900c3116100c0578063d73c1fb311610079578063d73c1fb314610b25578063dd62ed3e14610b45578063e436744514610b91578063f04e283e14610bb1578063f2fde38b14610bc4578063fee81cf414610bd757610292565b8063af6900c314610a81578063b19de39f14610a95578063b698206914610ab4578063bbefa83a14610ad3578063c4d66de814610ae7578063c87b56dd14610b0657610292565b806370a082311161011257806370a08231146109fb578063715018a614610a1a57806375b238fc14610a225780638da5cb5b14610a3657806395d89b4114610a4e578063a9059cbb14610a6257610292565b806353df5c7c1461097457806354d1f13d1461098857806355f804b3146109905780635a446215146109af5780635d148e5c146109ce5780636338cb8a146109e757610292565b8063274e430b116101fd57806347f618a5116101b657806347f618a51461087d5780634a4ee7b11461089c5780634ef41efc146108af578063514e62fc146108e85780635327bba31461091d57806353d6fd591461095557610292565b8063274e430b146107c85780632a6a935d146107e75780632de9480714610806578063313ce567146108375780633af32abf1461084a5780633ccfd60b1461086957610292565b8063183a4f6e1161024f578063183a4f6e146107325780631c10893f146107455780631cd64df41461075857806323b848ff1461078d57806323b872dd146107a157806325692962146107c057610292565b806304dfe79d1461065557806306fdde031461068e578063095ea7b3146106af578063180434a3146106de57806318160ddd146106fc57610292565b3661029257005b68a20d6e21d0e52553085f3560e01c63e985e9c58190036103345760018201546001600160a01b031633146102da5760405163ce5a776b60e01b815260040160405180910390fd5b60443610156102e7575f80fd5b6004356001600160a01b038181165f908152600385016020908152604080832060243594851684529091529020546103319060ff16610326575f610329565b60015b60ff16610c08565b50505b80636352211e036103985760018201546001600160a01b0316331461036c5760405163ce5a776b60e01b815260040160405180910390fd5b6024361015610379575f80fd5b60043561039661038882610c10565b6001600160a01b0316610c08565b505b8063e5eb36c8036104045760018201546001600160a01b031633146103d05760405163ce5a776b60e01b815260040160405180910390fd5b60843610156103dd575f80fd5b6004356024356044356064356103f584848484610c46565b6103ff6001610c08565b505050505b8063813500fc0361049c5760018201546001600160a01b0316331461043c5760405163ce5a776b60e01b815260040160405180910390fd5b6064361015610449575f80fd5b6001600160a01b036044358181165f90815268a20d6e21d0e525530b6020908152604080832060043595861684529091529020805460ff19166024351515908117909155906104986001610c08565b5050505b8063d10b6e0c036104fc5760018201546001600160a01b031633146104d45760405163ce5a776b60e01b815260040160405180910390fd5b60643610156104e1575f80fd5b6004356024356044356104f8610388848484610c8d565b5050505b8063081812fc036105525760018201546001600160a01b031633146105345760405163ce5a776b60e01b815260040160405180910390fd5b6024361015610541575f80fd5b60043561055061038882610d80565b505b8063f5b100ea036105d85760018201546001600160a01b0316331461058a5760405163ce5a776b60e01b815260040160405180910390fd5b6024361015610597575f80fd5b6004356105d66105d1826001600160a01b03165f90815268a20d6e21d0e5255310602052604090205463ffffffff600160801b9091041690565b610c08565b505b8063e2c792810361063e5760018201546001600160a01b031633146106105760405163ce5a776b60e01b815260040160405180910390fd5b600436101561061d575f80fd5b68a20d6e21d0e52553085461063e90600160401b900463ffffffff16610c08565b8063b7a94eb803610653576106536001610c08565b005b348015610660575f80fd5b506003546106779065010000000000900460ff1681565b60405160ff90911681526020015b60405180910390f35b348015610699575f80fd5b506106a2610dca565b604051610685919061268a565b3480156106ba575f80fd5b506106ce6106c93660046126ec565b610e59565b6040519015158152602001610685565b3480156106e9575f80fd5b506003546106ce90610100900460ff1681565b348015610707575f80fd5b5068a20d6e21d0e525530854600160601b90046001600160601b03165b604051908152602001610685565b610653610740366004612714565b610ecd565b6106536107533660046126ec565b610eda565b348015610763575f80fd5b506106ce6107723660046126ec565b638b78c6d8600c9081525f9290925260209091205481161490565b348015610798575f80fd5b50610653610ef0565b3480156107ac575f80fd5b506106ce6107bb36600461272b565b610f12565b610653610fb2565b3480156107d3575f80fd5b506106ce6107e2366004612764565b610fff565b3480156107f2575f80fd5b5061065361080136600461278c565b61104d565b348015610811575f80fd5b50610724610820366004612764565b638b78c6d8600c9081525f91909152602090205490565b348015610842575f80fd5b506012610677565b348015610855575f80fd5b506106ce610864366004612764565b611057565b348015610874575f80fd5b5061065361106f565b348015610888575f80fd5b506003546106ce9062010000900460ff1681565b6106536108aa3660046126ec565b611083565b3480156108ba575f80fd5b5068a20d6e21d0e5255309546001600160a01b03165b6040516001600160a01b039091168152602001610685565b3480156108f3575f80fd5b506106ce6109023660046126ec565b638b78c6d8600c9081525f9290925260209091205416151590565b348015610928575f80fd5b5060035461094090600160301b900463ffffffff1681565b60405163ffffffff9091168152602001610685565b348015610960575f80fd5b5061065361096f3660046127a5565b611095565b34801561097f575f80fd5b506106536110da565b6106536110f5565b34801561099b575f80fd5b506106536109aa366004612814565b61112e565b3480156109ba575f80fd5b506106536109c9366004612853565b61116a565b3480156109d9575f80fd5b506003546106ce9060ff1681565b3480156109f2575f80fd5b506106536111c0565b348015610a06575f80fd5b50610724610a15366004612764565b6111dd565b61065361120f565b348015610a2d575f80fd5b50610724600181565b348015610a41575f80fd5b50638b78c6d819546108d0565b348015610a59575f80fd5b506106a2611222565b348015610a6d575f80fd5b506106ce610a7c3660046126ec565b611231565b348015610a8c575f80fd5b50610653611246565b348015610aa0575f80fd5b50610653610aaf3660046128ba565b611267565b348015610abf575f80fd5b50610653610ace3660046128dd565b6112c6565b348015610ade575f80fd5b50610653611321565b348015610af2575f80fd5b50610653610b01366004612764565b611340565b348015610b11575f80fd5b506106a2610b20366004612714565b611379565b348015610b30575f80fd5b506003546106ce906301000000900460ff1681565b348015610b50575f80fd5b50610724610b5f3660046128fd565b6001600160a01b039182165f90815268a20d6e21d0e525530d6020908152604080832093909416825291909152205490565b348015610b9c575f80fd5b506003546106ce90600160201b900460ff1681565b610653610bbf366004612764565b611471565b610653610bd2366004612764565b6114ab565b348015610be2575f80fd5b50610724610bf1366004612764565b63389a75e1600c9081525f91909152602090205490565b805f5260205ff35b5f610c1a826114d1565b610c375760405163677510db60e11b815260040160405180910390fd5b610c40826114ed565b92915050565b610c5284848484611540565b610c5c84846118a1565b826001600160a01b0316846001600160a01b031614610c8757610c8784670de0b6b3a764000061194e565b50505050565b5f68a20d6e21d0e52553088168a20d6e21d0e525530a81610cd968a20d6e21d0e525530f600189901b5b600381901c5f90815260209290925260409091205460059190911b60e0161c90565b63ffffffff16815260208101919091526040015f20546001600160a01b03908116915084168114610d4b576001600160a01b038082165f90815260038401602090815260408083209388168352929052205460ff16610d4b576040516367d9dca160e11b815260040160405180910390fd5b5f8581526004909201602052604090912080546001600160a01b0387166001600160a01b031990911617905590509392505050565b5f610d8a826114d1565b610da75760405163677510db60e11b815260040160405180910390fd5b505f90815268a20d6e21d0e525530c60205260409020546001600160a01b031690565b60605f8054610dd890612925565b80601f0160208091040260200160405190810160405280929190818152602001828054610e0490612925565b8015610e4f5780601f10610e2657610100808354040283529160200191610e4f565b820191905f5260205f20905b815481529060010190602001808311610e3257829003601f168201915b5050505050905090565b5f8068a20d6e21d0e5255308335f81815260058301602090815260408083206001600160a01b038a16808552908352928190208890555187815293945090927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a35060019392505050565b610ed733826119c7565b50565b610ee26119d2565b610eec82826119ec565b5050565b6001610efb816119f8565b506003805464ff000000001916600160201b179055565b6001600160a01b0383165f90815268a20d6e21d0e525530d6020908152604080832033845290915281205468a20d6e21d0e5255308905f198114610f9b5780841115610f71576040516313be252b60e01b815260040160405180910390fd5b6001600160a01b0386165f9081526005830160209081526040808320338452909152902084820390555b610fa6868686611a29565b50600195945050505050565b5f6202a30067ffffffffffffffff164201905063389a75e1600c52335f52806020600c2055337fdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d5f80a250565b6001600160a01b0381165f90815268a20d6e21d0e5255310602052604081208054600160581b9004600116820361103a57823b5b9392505050565b54600160581b9004600216151592915050565b610ed73382611a61565b5f610c4061106483611af0565b60571c600116151590565b600161107a816119f8565b610ed733611b1b565b61108b6119d2565b610eec82826119c7565b60016110a0816119f8565b6003546301000000900460ff16156110cb576040516303cb96db60e21b815260040160405180910390fd5b6110d58383611b34565b505050565b60016110e5816119f8565b506003805460ff19166001179055565b63389a75e1600c52335f525f6020600c2055337ffa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c925f80a2565b6001611139816119f8565b60035460ff161561115d576040516303cb96db60e21b815260040160405180910390fd5b6002610c878385836129af565b6001611175816119f8565b600354610100900460ff161561119e576040516303cb96db60e21b815260040160405180910390fd5b5f6111aa8587836129af565b5060016111b88385836129af565b505050505050565b60016111cb816119f8565b506003805461ff001916610100179055565b6001600160a01b03165f90815268a20d6e21d0e52553106020526040902054600160a01b90046001600160601b031690565b6112176119d2565b6112205f611b59565b565b606060018054610dd890612925565b5f61123d338484611a29565b50600192915050565b6001611251816119f8565b506003805463ff00000019166301000000179055565b6001611272816119f8565b60035462010000900460ff161561129c576040516303cb96db60e21b815260040160405180910390fd5b506003805463ffffffff909216600160301b0269ffffffff00000000000019909216919091179055565b60016112d1816119f8565b600354600160201b900460ff16156112fc576040516303cb96db60e21b815260040160405180910390fd5b506003805460ff909216650100000000000265ff000000000019909216919091179055565b600161132c816119f8565b506003805462ff0000191662010000179055565b600161134b816119f8565b5f611360670de0b6b3a7640000613a98612a7d565b90503361136e828286611b96565b610c87816001611b34565b6060611384826114d1565b6113a15760405163677510db60e11b815260040160405180910390fd5b600280546113ae90612925565b15905061146c57610c40600280546113c590612925565b80601f01602080910402602001604051908101604052809291908181526020018280546113f190612925565b801561143c5780601f106114135761010080835404028352916020019161143c565b820191905f5260205f20905b81548152906001019060200180831161141f57829003601f168201915b5050505050604051806040016040528060048152602001637b69647d60e01b81525061146785611d22565b611d64565b919050565b6114796119d2565b63389a75e1600c52805f526020600c20805442111561149f57636f5e88185f526004601cfd5b5f9055610ed781611b59565b6114b36119d2565b8060601b6114c857637448fbae5f526004601cfd5b610ed781611b59565b5f806114dc836114ed565b6001600160a01b0316141592915050565b5f68a20d6e21d0e525530868a20d6e21d0e525530a8261151a68a20d6e21d0e525530f600187901b610cb7565b63ffffffff16815260208101919091526040015f20546001600160a01b03169392505050565b68a20d6e21d0e52553086001600160a01b03841661157157604051633a954ecd60e21b815260040160405180910390fd5b5f816002015f61158884600701610cb78860011b90565b63ffffffff16815260208101919091526040015f20546001600160a01b039081169150861681146115cb5760405162a1148160e81b815260040160405180910390fd5b856001600160a01b0316836001600160a01b03161461164d576001600160a01b038087165f90815260038401602090815260408083209387168352929052205460ff1661164d575f8481526004830160205260409020546001600160a01b0384811691161461164d57604051632ce44b5f60e11b815260040160405180910390fd5b5f61165787611e84565b90505f61166387611e84565b8254909150670de0b6b3a7640000908390601490611692908490600160a01b90046001600160601b0316612a94565b82546101009290920a6001600160601b0381810219909316918316021790915582546001600160a01b038116670de0b6b3a7640000600160a01b9283900484160190921602178255506116f660078501600188901b6116f1848b611eef565b611f8f565b5f868152600485016020908152604080832080546001600160a01b03191690556001600160a01b038b168352600687018252808320855463ffffffff60801b198116600160801b9182900463ffffffff9081165f1901908116909202178755631fffffff600382901c168552925282205460059190911b60e0161c6001600160a01b038a165f908152600687016020526040902063ffffffff9190911691506117b7906117ab6007880160018b811b01610cb7565b63ffffffff1683611f8f565b8154600163ffffffff600160801b80840482169283019091160263ffffffff60801b19909216919091178355611809600787016117f784600190811b0190565b6116f160078a0160018d811b01610cb7565b6001600160a01b0389165f908152600687016020526040902061182d90828a611f8f565b6118406007870160018a811b0183611f8f565b5050866001600160a01b0316886001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef670de0b6b3a764000060405161188f91815260200190565b60405180910390a35050505050505050565b60035465010000000000900460ff165f8190036118bd57505050565b80670de0b6b3a7640000026118d1836111dd565b116118db57505050565b6118e761106483611af0565b156118f157505050565b638b78c6d819546001600160a01b0316836001600160a01b03160361191557505050565b638b78c6d8600c9081525f84905260209020546001161561193557505050565b6040516303cab2ff60e21b815260040160405180910390fd5b600354600160301b900463ffffffff165f81900361196b57505050565b5f806119898461197a87611af0565b6001600160581b031690611fc1565b91509150600281106119b65780800283026301312d008082106119aa578091505b6119b382612035565b50505b6119c08583612068565b5050505050565b610eec82825f6120ac565b638b78c6d819543314611220576382b429005f526004601cfd5b610eec828260016120ac565b638b78c6d819543314610ed757638b78c6d8600c52335f52806020600c205416610ed7576382b429005f526004601cfd5b611a34838383612103565b611a3e83836118a1565b816001600160a01b0316836001600160a01b0316146110d5576110d5838261194e565b5f611a6b83611e84565b8054909150600160581b9004600216151582151514611aa657805460ff600160581b80830482166002189091160260ff60581b199091161781555b826001600160a01b03167fb5a1de456fff688115a4f75380060c23c8532d14ff85f687cc871456d642039383604051611ae3911515815260200190565b60405180910390a2505050565b6001600160a01b03165f90815268a20d6e21d0e525531060205260409020546001600160581b031690565b5f385f3847855af1610ed75763b12d13eb5f526004601cfd5b610eec82611b5483611b4586611af0565b6001600160581b0316906125bd565b612068565b638b78c6d81980546001600160a01b039092169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a355565b68a20d6e21d0e52553088054600160201b900463ffffffff1615611bcd57604051633ab534b960e21b815260040160405180910390fd5b6001600160a01b038216611bf4576040516339a84a7b60e01b815260040160405180910390fd5b611bfd826125e2565b805467ffffffff000000001916600160201b1781556001810180546001600160a01b0384166001600160a01b03199091161790558315610c87576001600160a01b038316611c5e57604051633a954ecd60e21b815260040160405180910390fd5b6b0de0b6b39983494c589bffff841115611c8b5760405163e5cfe95760e01b815260040160405180910390fd5b80546bffffffffffffffffffffffff60601b1916600160601b6001600160601b038616021781555f611cbc84611e84565b80546001600160a01b03908116600160a01b6001600160601b038916021782556040518781529192508516905f907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a36119c0846001611a61565b60606080604051019050602081016040525f8152805f19835b928101926030600a8206018453600a900480611d3b575050819003601f19909101908152919050565b60608351835183516020870196506020860195506020850194506020604051019350828701838311611e34576001838203015f60208510611da457508388205b601f851660200360031b89515b8b51818118831c611e1b578315611deb5783888e2014611deb57808a5260019c8d019c90990198848d10611de55750611e2f565b50611db1565b5f5b8b8101518b820152602001878110611ded57509b87019b988601988715611e1b57848d10611de55750611e2f565b895260019b8c019b90980197838c10611db1575b505050505b84935060206040510194508781038585030192505b80881015611e64578751845260209788019790930192611e49565b50505f818401908152602001604052601f19909201918252509392505050565b6001600160a01b0381165f90815268a20d6e21d0e5255310602052604081208054909168a20d6e21d0e525530891600160581b90046001169003611ee9576001833b15611ecf576002175b825460ff909116600160581b0260ff60581b199091161782555b50919050565b8154600160601b900463ffffffff1668a20d6e21d0e52553085f829003611f8857805481905f90611f259063ffffffff16612ab4565b825463ffffffff8083166101009490940a848102910219909116179092558554600160601b820263ffffffff60601b199091161786555f908152600283016020526040902080546001600160a01b0386166001600160a01b031990911617905591505b5092915050565b826020528160031c5f5260405f206007831660051b815463ffffffff8482841c188116831b8218845550505050505050565b5f80605784901c60011615611fda57508290505f61202e565b637fffffff620151804204811690603886901c1666ffffffffffffff861681831461200557508190505f5b60389190911b66ffffffffffffff602887901c811692909201918216179350620de0b690049150505b9250929050565b80600117601052605b810460788211025f5b81811461205d5760108080209052600101612047565b5050601051610ed757fe5b6001600160a01b03919091165f90815268a20d6e21d0e52553106020526040902080546affffffffffffffffffffff19166001600160581b03909216919091179055565b638b78c6d8600c52825f526020600c208054838117836120cd575080841681185b80835580600c5160601c7f715ad5ce61fc9595c7b415289d59cf203f23a94fa06f04af7e489a0a76e1fe265f80a3505050505050565b6001600160a01b03821661212a57604051633a954ecd60e21b815260040160405180910390fd5b68a20d6e21d0e52553085f61213e85611e84565b90505f61214a85611e84565b905061217f6040518060c001604052805f81526020015f81526020015f81526020015f81526020015f81526020015f81525090565b825463ffffffff600160801b808304821660808501528454041660a08301526001600160601b03600160a01b90910416604082018190528511156121d657604051631e9acf1760e31b815260040160405180910390fd5b6040810180518690039081905283546001600160601b03808316600160a01b9081026001600160a01b03938416178755855481810483168a0160608701819052909216029116178355608082015161223c91670de0b6b3a7640000900480821191030290565b81528154600160581b90046002165f036122aa57856001600160a01b0316876001600160a01b03160361227757805160808201510360a08201525b6122a4670de0b6b3a764000082606001518161229557612295612ad6565b048260a0015180821191030290565b60208201525b5f6122f18260200151835f01510160408051808201909152606081525f60208201526040805101828152806020018360051b81016040528183528083602001525050919050565b8251909150156123e6576001600160a01b0388165f908152600686016020526040902060808301518351875463ffffffff600160401b808304821684900382160263ffffffff60401b199092169190911789558754918303908116600160801b0263ffffffff60801b199092169190911787555b5f1991909101600381901c5f90815260208490526040812054919291600584901b60e0161c63ffffffff1690506123a189600701825f8061260f565b5f81815260048a016020908152604090912080546001600160a01b0319169055858101805160089390931b60608f901b17600117835291019052808203612365575050505b602082015115612545576001600160a01b0387165f9081526006860160209081526040822060a085015191850151909290820190612424878c611eef565b8954602088015163ffffffff60401b19821663ffffffff600160401b80850482169093018116909202178c55895463ffffffff60801b1916600160801b86831602178a55919250670de0b6b3a7640000600160601b82046001600160601b03160491600160201b909104165b6124a18b600701610cb78360011b90565b63ffffffff16156124c057600101818111156124bb575060015b612490565b6124cb868683611f8f565b6124e08b60070182858880600101995061260f565b612509878e835f8360200151818360081b8560601b171781526020810185602001525050505050565b60010181811115612518575060015b838503612490578a5463ffffffff909116600160201b0267ffffffff0000000019909116178a5550505050505b805151156125665760018501546125669082906001600160a01b0316612653565b50856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef876040516125ac91815260200190565b60405180910390a350505050505050565b5f6001605784901c161515821515146125db57600160571b92909218915b5090919050565b630f4599e55f523360205260205f6024601c5f855af160015f511416610ed75763d125259c5f526004601cfd5b8163ffffffff168160201b17846020528360021c5f5260405f206003851660061b815467ffffffffffffffff8482841c188116831b82188455505050505050505050565b81516040810363263c69d68152602080820152815160051b604401915060208183601c84015f875af1600182511416610c87575f81fd5b5f602080835283518060208501525f5b818110156126b65785810183015185820160400152820161269a565b505f604082860101526040601f19601f8301168501019250505092915050565b80356001600160a01b038116811461146c575f80fd5b5f80604083850312156126fd575f80fd5b612706836126d6565b946020939093013593505050565b5f60208284031215612724575f80fd5b5035919050565b5f805f6060848603121561273d575f80fd5b612746846126d6565b9250612754602085016126d6565b9150604084013590509250925092565b5f60208284031215612774575f80fd5b611033826126d6565b8035801515811461146c575f80fd5b5f6020828403121561279c575f80fd5b6110338261277d565b5f80604083850312156127b6575f80fd5b6127bf836126d6565b91506127cd6020840161277d565b90509250929050565b5f8083601f8401126127e6575f80fd5b50813567ffffffffffffffff8111156127fd575f80fd5b60208301915083602082850101111561202e575f80fd5b5f8060208385031215612825575f80fd5b823567ffffffffffffffff81111561283b575f80fd5b612847858286016127d6565b90969095509350505050565b5f805f8060408587031215612866575f80fd5b843567ffffffffffffffff8082111561287d575f80fd5b612889888389016127d6565b909650945060208701359150808211156128a1575f80fd5b506128ae878288016127d6565b95989497509550505050565b5f602082840312156128ca575f80fd5b813563ffffffff81168114611033575f80fd5b5f602082840312156128ed575f80fd5b813560ff81168114611033575f80fd5b5f806040838503121561290e575f80fd5b612917836126d6565b91506127cd602084016126d6565b600181811c9082168061293957607f821691505b602082108103611ee957634e487b7160e01b5f52602260045260245ffd5b634e487b7160e01b5f52604160045260245ffd5b601f8211156110d557805f5260205f20601f840160051c810160208510156129905750805b601f840160051c820191505b818110156119c0575f815560010161299c565b67ffffffffffffffff8311156129c7576129c7612957565b6129db836129d58354612925565b8361296b565b5f601f841160018114612a0c575f85156129f55750838201355b5f19600387901b1c1916600186901b1783556119c0565b5f83815260208120601f198716915b82811015612a3b5786850135825560209485019460019092019101612a1b565b5086821015612a57575f1960f88860031b161c19848701351681555b505060018560011b0183555050505050565b634e487b7160e01b5f52601160045260245ffd5b8082028115828204841417610c4057610c40612a69565b6001600160601b03828116828216039080821115611f8857611f88612a69565b5f63ffffffff808316818103612acc57612acc612a69565b6001019392505050565b634e487b7160e01b5f52601260045260245ffdfea26469706673582212206ad60666c6d74f31baf984ab30cb2f86ce01e7b99479d2d2e20b9721522f5fff64736f6c63430008180033
Deployed Bytecode Sourcemap
355:7149:6:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6559:20:0;30451:22;37103:20;30551:3;30528:26;30634:10;30620:24;;;30616:377;;30679:14;;;;-1:-1:-1;;;;;30679:14:0;30665:10;:28;30661:58;;30702:17;;-1:-1:-1;;;30702:17:0;;;;;;;;;;;30661:58;30756:4;30738:8;:22;30734:36;;;30762:8;;;30734:36;30833:4;37103:20;-1:-1:-1;;;;;30936:26:0;;;30787:13;30936:26;;;:19;;;:26;;;;;;;;30904:4;37103:20;30936:36;;;;;;;;;;;30928:53;;30936:36;;:44;;30979:1;30936:44;;;30975:1;30936:44;30928:53;;:7;:53::i;:::-;30646:347;;30616:377;31039:10;31053;31039:24;31035:262;;31098:14;;;;-1:-1:-1;;;;;31098:14:0;31084:10;:28;31080:58;;31121:17;;-1:-1:-1;;;31121:17:0;;;;;;;;;;;31080:58;31175:4;31157:8;:22;31153:36;;;31181:8;;;31153:36;31233:4;37103:20;31255:30;31271:12;37103:20;31271:8;:12::i;:::-;-1:-1:-1;;;;;31255:30:0;:7;:30::i;:::-;31065:232;31035:262;31375:10;31389;31375:24;31371:502;;31434:14;;;;-1:-1:-1;;;;;31434:14:0;31420:10;:28;31416:58;;31457:17;;-1:-1:-1;;;31457:17:0;;;;;;;;;;;31416:58;31511:4;31493:8;:22;31489:36;;;31517:8;;;31489:36;31587:4;37103:20;31652:4;37103:20;31701:4;37103:20;31771:4;37103:20;31795:41;37103:20;;;;31795:16;:41::i;:::-;31851:10;31859:1;31851:7;:10::i;:::-;31401:472;;;;31371:502;31942:10;31956;31942:24;31938:451;;32001:14;;;;-1:-1:-1;;;;;32001:14:0;31987:10;:28;31983:58;;32024:17;;-1:-1:-1;;;32024:17:0;;;;;;;;;;;31983:58;32078:4;32060:8;:22;32056:36;;;32084:8;;;32056:36;-1:-1:-1;;;;;32282:4:0;37103:20;29571:47;;;;;;;:36;:47;;;;;;;;32157:4;37103:20;29571:57;;;;;;;;;;:68;;-1:-1:-1;;29571:68:0;32207:4;37103:20;32193:24;;29571:68;;;;;;32193:24;32367:10;32375:1;32367:7;:10::i;:::-;31968:421;;;31938:451;32454:10;32468;32454:24;32450:427;;32513:14;;;;-1:-1:-1;;;;;32513:14:0;32499:10;:28;32495:58;;32536:17;;-1:-1:-1;;;32536:17:0;;;;;;;;;;;32495:58;32590:4;32572:8;:22;32568:36;;;32596:8;;;32568:36;32669:4;37103:20;32718:4;37103:20;32788:4;37103:20;32812:53;32828:35;37103:20;;;32828:11;:35::i;32812:53::-;32480:397;;;32450:427;32927:10;32941;32927:24;32923:266;;32986:14;;;;-1:-1:-1;;;;;32986:14:0;32972:10;:28;32968:58;;33009:17;;-1:-1:-1;;;33009:17:0;;;;;;;;;;;32968:58;33063:4;33045:8;:22;33041:36;;;33069:8;;;33041:36;33121:4;37103:20;33143:34;33159:16;37103:20;33159:12;:16::i;33143:34::-;32953:236;32923:266;33240:10;33254;33240:24;33236:282;;33299:14;;;;-1:-1:-1;;;;;33299:14:0;33285:10;:28;33281:58;;33322:17;;-1:-1:-1;;;33322:17:0;;;;;;;;;;;33281:58;33376:4;33358:8;:22;33354:36;;;33382:8;;;33354:36;33453:4;37103:20;33477:29;33485:20;37103;-1:-1:-1;;;;;27387:37:0;27360:7;27387:37;;;:30;:37;;;;;:49;;-1:-1:-1;;;27387:49:0;;;;;27291:153;33485:20;33477:7;:29::i;:::-;33266:252;33236:282;33564:10;33578;33564:24;33560:209;;33623:14;;;;-1:-1:-1;;;;;33623:14:0;33609:10;:28;33605:58;;33646:17;;-1:-1:-1;;;33646:17:0;;;;;;;;;;;33605:58;33700:4;33682:8;:22;33678:36;;;33706:8;;;33678:36;6559:20;27199:33;33731:26;;-1:-1:-1;;;27199:33:0;;;;33477:7;:29::i;33731:26::-;33816:10;33830;33816:24;33812:67;;33857:10;33865:1;33857:7;:10::i;:::-;30440:3458;1663:28:6;;;;;;;;;;-1:-1:-1;1663:28:6;;;;;;;;;;;;;;186:4:8;174:17;;;156:36;;144:2;129:18;1663:28:6;;;;;;;;2618:92;;;;;;;;;;;;;:::i;:::-;;;;;;;:::i;9960:275:0:-;;;;;;;;;;-1:-1:-1;9960:275:0;;;;;:::i;:::-;;:::i;:::-;;;1358:14:8;;1351:22;1333:41;;1321:2;1306:18;9960:275:0;1193:187:8;1505:31:6;;;;;;;;;;-1:-1:-1;1505:31:6;;;;;;;;;;;9237:126:0;;;;;;;;;;-1:-1:-1;6559:20:0;9324:30;-1:-1:-1;;;9324:30:0;;-1:-1:-1;;;;;9324:30:0;9237:126;;;1531:25:8;;;1519:2;1504:18;9237:126:0;1385:177:8;10340:111:5;;;;;;:::i;:::-;;:::i;9789:125::-;;;;;;:::i;:::-;;:::i;11417:141::-;;;;;;;;;;-1:-1:-1;11417:141:5;;;;;:::i;:::-;10995:15;10989:4;10982:29;;;11496:4;11025:18;;;;11127:4;11111:21;;;11105:28;11520:21;;:30;;11417:141;5813:114:6;;;;;;;;;;;;;:::i;11595:512:0:-;;;;;;;;;;-1:-1:-1;11595:512:0;;;;;:::i;:::-;;:::i;9212:630:4:-;;;:::i;24386:282:0:-;;;;;;;;;;-1:-1:-1;24386:282:0;;;;;:::i;:::-;;:::i;24780:100::-;;;;;;;;;;-1:-1:-1;24780:100:0;;;;;:::i;:::-;;:::i;10789:362:5:-;;;;;;;;;;-1:-1:-1;10789:362:5;;;;;:::i;:::-;10995:15;10989:4;10982:29;;;10849:13;11025:18;;;;11127:4;11111:21;;11105:28;;10789:362;9096:76:0;;;;;;;;;;-1:-1:-1;9162:2:0;9096:76;;5093:123:6;;;;;;;;;;-1:-1:-1;5093:123:6;;;;;:::i;:::-;;:::i;7380:121::-;;;;;;;;;;;;;:::i;1545:31::-;;;;;;;;;;-1:-1:-1;1545:31:6;;;;;;;;;;;10063:127:5;;;;;;:::i;:::-;;:::i;26943:119:0:-;;;;;;;;;;-1:-1:-1;27023:31:0;;-1:-1:-1;;;;;27023:31:0;26943:119;;;-1:-1:-1;;;;;2790:32:8;;;2772:51;;2760:2;2745:18;26943:119:0;2626:203:8;11216:136:5;;;;;;;;;;-1:-1:-1;11216:136:5;;;;;:::i;:::-;10995:15;10989:4;10982:29;;;11294:4;11025:18;;;;11127:4;11111:21;;;11105:28;11318:21;:26;;;11216:136;1700:27:6;;;;;;;;;;-1:-1:-1;1700:27:6;;;;-1:-1:-1;;;1700:27:6;;;;;;;;;3008:10:8;2996:23;;;2978:42;;2966:2;2951:18;1700:27:6;2834:192:8;6228:184:6;;;;;;;;;;-1:-1:-1;6228:184:6;;;;;:::i;:::-;;:::i;6731:98::-;;;;;;;;;;;;;:::i;9927:466:4:-;;;:::i;6837:165:6:-;;;;;;;;;;-1:-1:-1;6837:165:6;;;;;:::i;:::-;;:::i;7128:244::-;;;;;;;;;;-1:-1:-1;7128:244:6;;;;;:::i;:::-;;:::i;1471:25::-;;;;;;;;;;-1:-1:-1;1471:25:6;;;;;;;;7010:110;;;;;;;;;;;;;:::i;9432:143:0:-;;;;;;;;;;-1:-1:-1;9432:143:0;;;;;:::i;:::-;;:::i;8947:102:4:-;;;:::i;717:44:6:-;;;;;;;;;;;;12908:6:5;717:44:6;;11652:187:4;;;;;;;;;;-1:-1:-1;;;11803:18:4;11652:187;;2718:96:6;;;;;;;;;;;;;:::i;10748:150:0:-;;;;;;;;;;-1:-1:-1;10748:150:0;;;;;:::i;:::-;;:::i;6115:105:6:-;;;;;;;;;;;;;:::i;6538:185::-;;;;;;;;;;-1:-1:-1;6538:185:6;;;;;:::i;:::-;;:::i;5935:172::-;;;;;;;;;;-1:-1:-1;5935:172:6;;;;;:::i;:::-;;:::i;6420:110::-;;;;;;;;;;;;;:::i;5496:309::-;;;;;;;;;;-1:-1:-1;5496:309:6;;;;;:::i;:::-;;:::i;2822:283::-;;;;;;;;;;-1:-1:-1;2822:283:6;;;;;:::i;:::-;;:::i;1585:27::-;;;;;;;;;;-1:-1:-1;1585:27:6;;;;;;;;;;;9673:151:0;;;;;;;;;;-1:-1:-1;9673:151:0;;;;;:::i;:::-;-1:-1:-1;;;;;9772:35:0;;;9745:7;9772:35;;;:28;:35;;;;;;;;:44;;;;;;;;;;;;;9673:151;1621:33:6;;;;;;;;;;-1:-1:-1;1621:33:6;;;;-1:-1:-1;;;1621:33:6;;;;;;10584:724:4;;;;;;:::i;:::-;;:::i;8521:358::-;;;;;;:::i;:::-;;:::i;11945:449::-;;;;;;;;;;-1:-1:-1;11945:449:4;;;;;:::i;:::-;12224:19;12218:4;12211:33;;;12068:14;12258:26;;;;12370:4;12354:21;;12348:28;;11945:449;37234:185:0;37367:1;37361:4;37354:15;37396:4;37390;37383:18;27903:163;27964:7;27989:11;27997:2;27989:7;:11::i;:::-;27984:44;;28009:19;;-1:-1:-1;;;28009:19:0;;;;;;;;;;;27984:44;28046:12;28055:2;28046:8;:12::i;:::-;28039:19;27903:163;-1:-1:-1;;27903:163:0:o;3620:284:6:-;3755:47;3778:4;3784:2;3788;3792:9;3755:22;:47::i;:::-;3813:31;3835:4;3841:2;3813:21;:31::i;:::-;3867:2;-1:-1:-1;;;;;3859:10:6;:4;-1:-1:-1;;;;;3859:10:6;;3855:41;;3871:25;3885:4;3616:8:0;3871:13:6;:25::i;:::-;3620:284;;;;:::o;28787:527:0:-;28909:7;6559:20;28909:7;29006:16;28909:7;29023:31;29028:4;37800:1;37795:6;;;29034:19;38193:1;38184:10;;;38134:13;38176:19;;;;;;;;;;;;;38215:1;38200:16;;;;;;38176:41;;38060:166;29023:31;29006:49;;;;;;;;;;;;;-1:-1:-1;29006:49:0;;-1:-1:-1;;;;;29006:49:0;;;;-1:-1:-1;29072:18:0;;;;29068:171;;-1:-1:-1;;;;;29112:26:0;;;;;;;:19;;;:26;;;;;;;;:37;;;;;;;;;;;;29107:121;;29177:35;;-1:-1:-1;;;29177:35:0;;;;;;;;;;;29107:121;29251:20;;;;:16;;;;:20;;;;;;:30;;-1:-1:-1;;;;;29251:30:0;;-1:-1:-1;;;;;;29251:30:0;;;;;;29301:5;-1:-1:-1;28787:527:0;;;;;:::o;28375:192::-;28440:7;28465:11;28473:2;28465:7;:11::i;:::-;28460:44;;28485:19;;-1:-1:-1;;;28485:19:0;;;;;;;;;;;28460:44;-1:-1:-1;28522:37:0;;;;:33;:37;;;;;;-1:-1:-1;;;;;28522:37:0;;28375:192::o;2618:92:6:-;2664:13;2697:5;2690:12;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2618:92;:::o;9960:275:0:-;10034:4;;6559:20;10119:10;10107:23;;;;:11;;;:23;;;;;;;;-1:-1:-1;;;;;10107:32:0;;;;;;;;;;;;:41;;;10166:37;1531:25:8;;;10107:11:0;;-1:-1:-1;10107:32:0;;10166:37;;1504:18:8;10166:37:0;;;;;;;-1:-1:-1;10223:4:0;;9960:275;-1:-1:-1;;;9960:275:0:o;10340:111:5:-;10412:31;10425:10;10437:5;10412:12;:31::i;:::-;10340:111;:::o;9789:125::-;12791:13:4;:11;:13::i;:::-;9882:24:5::1;9894:4;9900:5;9882:11;:24::i;:::-;9789:125:::0;;:::o;5813:114:6:-;12908:6:5;12247:25;12266:5;12247:18;:25::i;:::-;-1:-1:-1;5891:21:6::1;:28:::0;;-1:-1:-1;;5891:28:6::1;-1:-1:-1::0;;;5891:28:6::1;::::0;;5813:114::o;11595:512:0:-;-1:-1:-1;;;;;11774:17:0;;11683:4;11774:17;;;:11;:17;;;;;;;;11792:10;11774:29;;;;;;;;6559:20;;-1:-1:-1;;11820:28:0;;11816:220;;11878:7;11869:6;:16;11865:52;;;11894:23;;-1:-1:-1;;;11894:23:0;;;;;;;;;;;11865:52;-1:-1:-1;;;;;11961:17:0;;;;;;:11;;;:17;;;;;;;;11979:10;11961:29;;;;;;;11993:16;;;11961:48;;11816:220;12048:27;12058:4;12064:2;12068:6;12048:9;:27::i;:::-;-1:-1:-1;12095:4:0;;11595:512;-1:-1:-1;;;;;11595:512:0:o;9212:630:4:-;9307:15;8137:9;9325:46;;:15;:46;9307:64;;9543:19;9537:4;9530:33;9594:8;9588:4;9581:22;9651:7;9644:4;9638;9628:21;9621:38;9800:8;9753:45;9750:1;9747;9742:67;9443:381;9212:630::o;24386:282:0:-;-1:-1:-1;;;;;24487:33:0;;24446:4;24487:33;;;:30;:33;;;;;24535:7;;-1:-1:-1;;;24535:7:0;;4000:6;24535:40;:45;;24531:69;;36813:14;;24589:11;24582:18;24386:282;-1:-1:-1;;;24386:282:0:o;24531:69::-;24618:7;-1:-1:-1;;;24618:7:0;;4137:6;24618:37;:42;;;24386:282;-1:-1:-1;;24386:282:0:o;24780:100::-;24840:32;24852:10;24864:7;24840:11;:32::i;5093:123:6:-;5153:4;5177:31;:15;5185:6;5177:7;:15::i;:::-;452:2:1;1592:28;;;:33;;;1507:126;7380:121:6;12908:6:5;12247:25;12266:5;12247:18;:25::i;:::-;7447:46:6::1;7482:10;7447:34;:46::i;10063:127:5:-:0;12791:13:4;:11;:13::i;:::-;10157:25:5::1;10170:4;10176:5;10157:12;:25::i;6228:184:6:-:0;12908:6:5;12247:25;12266:5;12247:18;:25::i;:::-;6330:15:6::1;::::0;;;::::1;;;6326:36;;;6354:8;;-1:-1:-1::0;;;6354:8:6::1;;;;;;;;;;;6326:36;6373:31;6389:6;6397;6373:15;:31::i;:::-;6228:184:::0;;;:::o;6731:98::-;12908:6:5;12247:25;12266:5;12247:18;:25::i;:::-;-1:-1:-1;6801:13:6::1;:20:::0;;-1:-1:-1;;6801:20:6::1;6817:4;6801:20;::::0;;6731:98::o;9927:466:4:-;10133:19;10127:4;10120:33;10180:8;10174:4;10167:22;10233:1;10226:4;10220;10210:21;10203:32;10366:8;10320:44;10317:1;10314;10309:66;9927:466::o;6837:165:6:-;12908:6:5;12247:25;12266:5;12247:18;:25::i;:::-;6934:13:6::1;::::0;::::1;;6930:34;;;6956:8;;-1:-1:-1::0;;;6956:8:6::1;;;;;;;;;;;6930:34;6975:8;:19;6986:8:::0;;6975;:19:::1;:::i;7128:244::-:0;12908:6:5;12247:25;12266:5;12247:18;:25::i;:::-;7276:19:6::1;::::0;::::1;::::0;::::1;;;7272:40;;;7304:8;;-1:-1:-1::0;;;7304:8:6::1;;;;;;;;;;;7272:40;7323:5;:13;7331:5:::0;;7323;:13:::1;:::i;:::-;-1:-1:-1::0;7347:7:6::1;:17;7357:7:::0;;7347;:17:::1;:::i;:::-;;7128:244:::0;;;;;:::o;7010:110::-;12908:6:5;12247:25;12266:5;12247:18;:25::i;:::-;-1:-1:-1;7086:19:6::1;:26:::0;;-1:-1:-1;;7086:26:6::1;;;::::0;;7010:110::o;9432:143:0:-;-1:-1:-1;;;;;9522:37:0;9495:7;9522:37;;;:30;:37;;;;;:45;-1:-1:-1;;;9522:45:0;;-1:-1:-1;;;;;9522:45:0;;9432:143::o;8947:102:4:-;12791:13;:11;:13::i;:::-;9020:21:::1;9038:1;9020:9;:21::i;:::-;8947:102::o:0;2718:96:6:-;2766:13;2799:7;2792:14;;;;;:::i;10748:150:0:-;10818:4;10835:33;10845:10;10857:2;10861:6;10835:9;:33::i;:::-;-1:-1:-1;10886:4:0;10748:150;;;;:::o;6115:105:6:-;12908:6:5;12247:25;12266:5;12247:18;:25::i;:::-;-1:-1:-1;6190:15:6::1;:22:::0;;-1:-1:-1;;6190:22:6::1;::::0;::::1;::::0;;6115:105::o;6538:185::-;12908:6:5;12247:25;12266:5;12247:18;:25::i;:::-;6638:19:6::1;::::0;;;::::1;;;6634:40;;;6666:8;;-1:-1:-1::0;;;6666:8:6::1;;;;;;;;;;;6634:40;-1:-1:-1::0;6685:13:6::1;:30:::0;;::::1;::::0;;::::1;-1:-1:-1::0;;;6685:30:6::1;-1:-1:-1::0;;6685:30:6;;::::1;::::0;;;::::1;::::0;;6538:185::o;5935:172::-;12908:6:5;12247:25;12266:5;12247:18;:25::i;:::-;6027:21:6::1;::::0;-1:-1:-1;;;6027:21:6;::::1;;;6023:42;;;6057:8;;-1:-1:-1::0;;;6057:8:6::1;;;;;;;;;;;6023:42;-1:-1:-1::0;6076:15:6::1;:23:::0;;::::1;::::0;;::::1;::::0;::::1;-1:-1:-1::0;;6076:23:6;;::::1;::::0;;;::::1;::::0;;5935:172::o;6420:110::-;12908:6:5;12247:25;12266:5;12247:18;:25::i;:::-;-1:-1:-1;6496:19:6::1;:26:::0;;-1:-1:-1;;6496:26:6::1;::::0;::::1;::::0;;6420:110::o;5496:309::-;12908:6:5;12247:25;12266:5;12247:18;:25::i;:::-;5579:26:6::1;5608:12;3616:8:0;5608:5:6;:12;:::i;:::-;5579:41:::0;-1:-1:-1;5660:10:6::1;5681:64;5579:41:::0;5660:10;5738:6;5681:16:::1;:64::i;:::-;5756:41;5772:18;5792:4;5756:15;:41::i;2822:283::-:0;2882:20;2920:11;2928:2;2920:7;:11::i;:::-;2915:44;;2940:19;;-1:-1:-1;;;2940:19:6;;;;;;;;;;;2915:44;2980:8;2974:22;;;;;:::i;:::-;:27;;-1:-1:-1;2970:128:6;;3027:59;3045:8;3027:59;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;3027:59:6;;;3063:22;3082:2;3063:18;:22::i;:::-;3027:17;:59::i;2970:128::-;2822:283;;;:::o;10584:724:4:-;12791:13;:11;:13::i;:::-;10822:19:::1;10816:4;10809:33;10869:12;10863:4;10856:26;10932:4;10926;10916:21;11040:12;11034:19;11021:11;11018:36;11015:160;;;11087:10;11081:4;11074:24;11155:4;11149;11142:18;11015:160;11254:1;11233:23:::0;;11277::::1;11287:12:::0;11277:9:::1;:23::i;8521:358::-:0;12791:13;:11;:13::i;:::-;8696:8:::1;8692:2;8688:17;8678:153;;8739:10;8733:4;8726:24;8811:4;8805;8798:18;8678:153;8852:19;8862:8;8852:9;:19::i;28118:118:0:-:0;28178:4;;28202:12;28211:2;28202:8;:12::i;:::-;-1:-1:-1;;;;;28202:26:0;;;;28118:118;-1:-1:-1;;28118:118:0:o;27583:199::-;27644:7;6559:20;27725:16;27644:7;27742:31;27747:4;37800:1;37795:6;;;27753:19;37710:99;27742:31;27725:49;;;;;;;;;;;;;-1:-1:-1;27725:49:0;;-1:-1:-1;;;;;27725:49:0;;27583:199;-1:-1:-1;;;27583:199:0:o;21376:1507::-;6559:20;-1:-1:-1;;;;;21570:16:0;;21566:52;;21595:23;;-1:-1:-1;;;21595:23:0;;;;;;;;;;;21566:52;21631:13;21647:1;:16;;:49;21664:31;21669:1;:4;;21675:19;21691:2;37800:1;37795:6;;37710:99;21664:31;21647:49;;;;;;;;;;;;;-1:-1:-1;21647:49:0;;-1:-1:-1;;;;;21647:49:0;;;;-1:-1:-1;21713:13:0;;;;21709:54;;21735:28;;-1:-1:-1;;;21735:28:0;;;;;;;;;;;21709:54;21793:4;-1:-1:-1;;;;;21780:17:0;:9;-1:-1:-1;;;;;21780:17:0;;21776:250;;-1:-1:-1;;;;;21819:25:0;;;;;;;:19;;;:25;;;;;;;;:36;;;;;;;;;;;;21814:201;;21893:20;;;;:16;;;:20;;;;;;-1:-1:-1;;;;;21880:33:0;;;21893:20;;21880:33;21876:124;;21945:35;;-1:-1:-1;;;21945:35:0;;;;;;;;;;;21876:124;22038:35;22076:18;22089:4;22076:12;:18::i;:::-;22038:56;;22105:33;22141:16;22154:2;22141:12;:16::i;:::-;22170:39;;22105:52;;-1:-1:-1;3616:8:0;;22170:39;;:23;;:39;;3616:8;;-1:-1:-1;;;22170:39:0;;-1:-1:-1;;;;;22170:39:0;;:::i;:::-;;;;;;;;-1:-1:-1;;;;;22170:39:0;;;;;;;;;;;;;;;22247:37;;-1:-1:-1;;;;;22247:37:0;;3616:8;-1:-1:-1;;;22247:37:0;;;;;;;;;;;;;;-1:-1:-1;22301:76:0;22306:4;;;-1:-1:-1;37795:6:0;;;22333:43;22358:13;22373:2;22333:24;:43::i;:::-;22301:4;:76::i;:::-;22399:20;;;;:16;;;:20;;;;;;;;22392:27;;-1:-1:-1;;;;;;22392:27:0;;;-1:-1:-1;;;;;22461:13:0;;;;:7;;;:13;;;;;22476:29;;-1:-1:-1;;;;22476:29:0;;-1:-1:-1;;;22476:29:0;;;;;;;;-1:-1:-1;;22476:29:0;;;;;;;;;;38184:10;38193:1;38184:10;;;;38176:19;;;;;;;38215:1;38200:16;;;;;;38176:41;-1:-1:-1;;;;;22526:13:0;;;;;;:7;;;:13;;;;;22436:70;;;;;;-1:-1:-1;22521:67:0;;22541:27;22546:4;;;37967:1;37962:6;;;37961:12;22552:15;37855:137;22541:27;22521:67;;22577:9;22521:4;:67::i;:::-;22617:27;;;;-1:-1:-1;;;22617:27:0;;;;;;;;;;;;-1:-1:-1;;;;22617:27:0;;;;;;;;;22659:63;22664:4;;;22670:22;22682:9;37967:1;37962:6;;;37961:12;;37855:137;22670:22;22694:27;22699:4;;;37967:1;37962:6;;;37961:12;22705:15;37855:137;22659:63;-1:-1:-1;;;;;22742:11:0;;;;;;:7;;;:11;;;;;22737:32;;22755:1;22765:2;22737:4;:32::i;:::-;22784:38;22789:4;;;37967:1;37962:6;;;37961:12;22819:1;22784:4;:38::i;:::-;22222:612;;22866:2;-1:-1:-1;;;;;22851:24:0;22860:4;-1:-1:-1;;;;;22851:24:0;;3616:8;22851:24;;;;1531:25:8;;1519:2;1504:18;;1385:177;22851:24:0;;;;;;;;21499:1384;;;;21376:1507;;;;:::o;3912:447:6:-;4035:15;;;;;;;4019:13;4069:10;;;4065:23;;4081:7;3912:447;;:::o;4065:23::-;4130:5;3616:8:0;4123:12:6;4106:13;4116:2;4106:9;:13::i;:::-;:29;4102:42;;4137:7;3912:447;;:::o;4102:42::-;4162:27;:11;4170:2;4162:7;:11::i;:27::-;4158:40;;;4191:7;3912:447;;:::o;4158:40::-;-1:-1:-1;;11803:18:4;-1:-1:-1;;;;;4216:15:6;:4;-1:-1:-1;;;;;4216:15:6;;4212:28;;4233:7;3912:447;;:::o;4212:28::-;10995:15:5;10989:4;10982:29;;;11294:4;11025:18;;;11127:4;11111:21;;11105:28;12908:6;11318:21;:26;4254:41:6;;4288:7;3912:447;;:::o;4254:41::-;4316:24;;-1:-1:-1;;;4316:24:6;;;;;;;;;;;4367:573;4483:13;;-1:-1:-1;;;4483:13:6;;;;4466:14;4515:11;;;4511:24;;4528:7;4367:573;;:::o;4511:24::-;4550:13;4565:16;4585:29;4606:7;4585:13;4593:4;4585:7;:13::i;:::-;-1:-1:-1;;;;;4585:20:6;;;:29::i;:::-;4549:65;;;;4645:1;4633:8;:13;4629:257;;4684:19;;;:28;;4752:10;4785:20;;;4781:45;;4816:10;4807:19;;4781:45;4845:25;4863:6;4845:17;:25::i;:::-;4648:238;;4629:257;4900:21;4908:4;4914:6;4900:7;:21::i;:::-;4441:492;;;4367:573;;:::o;4391:119:5:-;4470:32;4483:4;4489:5;4496;4470:12;:32::i;7442:364:4:-;-1:-1:-1;;7652:18:4;7642:8;7639:32;7629:159;;7705:10;7699:4;7692:24;7768:4;7762;7755:18;4134:117:5;4212:31;4225:4;4231:5;4238:4;4212:12;:31::i;5329:819::-;-1:-1:-1;;5622:27:5;5612:8;5609:41;5599:531;;5727:15;5721:4;5714:29;5774:8;5768:4;5761:22;5980:5;5972:4;5966;5956:21;5950:28;5946:40;5936:179;;6024:10;6018:4;6011:24;6091:4;6085;6078:18;3385:227:6;3475:33;3491:4;3497:2;3501:6;3475:15;:33::i;:::-;3519:31;3541:4;3547:2;3519:21;:31::i;:::-;3573:2;-1:-1:-1;;;;;3565:10:6;:4;-1:-1:-1;;;;;3565:10:6;;3561:43;;3577:27;3591:4;3597:6;3577:13;:27::i;25099:289:0:-;25171:21;25195:15;25208:1;25195:12;:15::i;:::-;25226:7;;25171:39;;-1:-1:-1;;;;25226:7:0;;4137:6;25226:37;:42;;25225:53;;;;25221:124;;25295:38;;;-1:-1:-1;;;25295:38:0;;;;;4137:6;25295:38;;;;;-1:-1:-1;;;;25295:38:0;;;;;;25221:124;25371:1;-1:-1:-1;;;;;25360:20:0;;25374:5;25360:20;;;;1358:14:8;1351:22;1333:41;;1321:2;1306:18;;1193:187;25360:20:0;;;;;;;;25160:228;25099:289;;:::o;23404:138::-;-1:-1:-1;;;;;23493:37:0;23467:6;23493:37;;;:30;:37;;;;;:41;-1:-1:-1;;;;;23493:41:0;;23404:138::o;3589:415:7:-;3859:4;3847:10;3841:4;3829:10;3814:13;3810:2;3803:5;3798:66;3788:198;;3898:10;3892:4;3885:24;3966:4;3960;3953:18;4948:137:6;5022:55;5030:6;5038:38;5069:6;5038:15;5046:6;5038:7;:15::i;:::-;-1:-1:-1;;;;;5038:30:6;;;:38::i;:::-;5022:7;:55::i;6268:1113:4:-;-1:-1:-1;;7235:16:4;;-1:-1:-1;;;;;7081:26:4;;;;;;7195:38;7192:1;;7184:78;7321:27;6268:1113::o;7064:1025:0:-;6559:20;7284:13;;-1:-1:-1;;;7284:13:0;;;;:18;7280:53;;7311:22;;-1:-1:-1;;;7311:22:0;;;;;;;;;;;7280:53;-1:-1:-1;;;;;7350:20:0;;7346:54;;7379:21;;-1:-1:-1;;;7379:21:0;;;;;;;;;;;7346:54;7411:27;7431:6;7411:19;:27::i;:::-;7451:17;;-1:-1:-1;;7451:17:0;-1:-1:-1;;;7451:17:0;;;7467:1;7479:14;;:23;;-1:-1:-1;;;;;7479:23:0;;-1:-1:-1;;;;;;7479:23:0;;;;;;7519:22;;7515:567;;-1:-1:-1;;;;;7562:32:0;;7558:68;;7603:23;;-1:-1:-1;;;7603:23:0;;;;;;;;;;;7558:68;3838:25;7645:18;:32;7641:66;;;7686:21;;-1:-1:-1;;;7686:21:0;;;;;;;;;;;7641:66;7724:42;;-1:-1:-1;;;;7724:42:0;-1:-1:-1;;;;;;;;7724:42:0;;;;;;-1:-1:-1;7827:32:0;7840:18;7827:12;:32::i;:::-;7874:60;;-1:-1:-1;;;;;7874:60:0;;;-1:-1:-1;;;;;;;;7874:60:0;;;;;;7956;;1531:25:8;;;7874:60:0;;-1:-1:-1;7956:60:0;;;-1:-1:-1;;7956:60:0;;1519:2:8;1504:18;7956:60:0;;;;;;;8033:37;8045:18;8065:4;8033:11;:37::i;1981:1676:3:-;2037:17;2489:4;2482;2476:11;2472:22;2465:29;;2590:4;2585:3;2581:14;2575:4;2568:28;2673:1;2668:3;2661:14;2777:3;2809:1;2805:6;3021:5;3003:410;3060:11;;;;3244:2;3258;3248:13;;3240:22;3060:11;3227:36;3352:2;3342:13;;3373:25;3003:410;3373:25;-1:-1:-1;;3443:13:3;;;-1:-1:-1;;3558:14:3;;;3620:19;;;3558:14;1981:1676;-1:-1:-1;1981:1676:3:o;19604:3410::-;19743:20;19876:7;19870:14;19924:6;19918:13;19976:11;19970:18;20028:4;20019:7;20015:18;20004:29;;20069:4;20061:6;20057:17;20047:27;;20120:4;20107:11;20103:22;20088:37;;20166:4;20159;20153:11;20149:22;20139:32;;20218:13;20209:7;20205:27;20273:13;20259:12;20256:31;20246:2004;;20367:1;20352:12;20340:10;20336:29;20332:37;20396:1;20442:4;20428:12;20425:22;20415:74;;-1:-1:-1;20456:31:3;;;20415:74;20551:4;20537:12;20533:23;20527:4;20523:34;20520:1;20516:42;20591:6;20585:13;20616:1619;20666:7;20660:14;20847:1;20844;20840:9;20837:1;20833:17;20823:1188;;20882:1;20879:441;;;20962:1;20947:12;20938:7;20928:32;20925:39;20915:378;;21001:17;;;21074:1;21121:15;;;;21062:14;;;;21180:29;;;21170:50;;21213:5;;;21170:50;21254:8;20616:1619;;20915:378;21432:1;21417:254;21501:19;;;21495:26;21479:14;;;21472:50;21564:4;21557:12;21609:24;;;21417:254;21599:45;-1:-1:-1;21774:26:3;;;;21707:30;;;;21826:162;;;;21895:16;21886:7;21883:29;21873:50;;21916:5;;;21826:162;22033:17;;22094:1;22129:15;;;;22082:14;;;;22176:29;;;20616:1619;22166:50;20616:1619;20620:2;;;;20246:2004;22289:6;22266:29;;22336:4;22329;22323:11;22319:22;22309:32;;22414:7;22402:10;22398:24;22389:6;22372:15;22368:28;22364:59;22355:68;;22501:217;22520:10;22511:7;22508:23;22501:217;;;22578:14;;22554:39;;22651:4;22685:18;;;;22630:26;;;;22501:217;;;-1:-1:-1;;22789:17:3;22785:25;;;22862:15;;;22754:4;22904:15;22898:4;22891:29;-1:-1:-1;;22742:17:3;;;22958;;;-1:-1:-1;22742:17:3;19604:3410;-1:-1:-1;;;19604:3410:3:o;25559:407:0:-;-1:-1:-1;;;;;25710:16:0;;25618:21;25710:16;;;:13;:16;;;;;25743:7;;25710:16;;6559:20;;-1:-1:-1;;;25743:7:0;;4000:6;25743:40;:45;;25739:220;;4000:6;36813:14;;25864:53;;;4137:6;25881:36;25864:53;25932:15;;;;;;-1:-1:-1;;;25932:15:0;-1:-1:-1;;;;25932:15:0;;;;;;25739:220;25641:325;25559:407;;;:::o;26132:469::-;26372:26;;-1:-1:-1;;;26372:26:0;;;;6559:20;26266:19;26413:17;;;26409:185;;26462:14;;26464:1;;:12;;26462:14;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;26491:41;;-1:-1:-1;;;26491:41:0;;-1:-1:-1;;;;26491:41:0;;;;;;-1:-1:-1;26547:30:0;;;:16;;;:30;;;;;:35;;-1:-1:-1;;;;;26547:35:0;;-1:-1:-1;;;;;;26547:35:0;;;;;;26462:14;-1:-1:-1;26409:185:0;26292:309;26132:469;;;;:::o;38294:542::-;38460:8;38454:4;38447:22;38503:5;38500:1;38496:13;38490:4;38483:27;38549:4;38543;38533:21;38612:1;38605:5;38601:13;38598:1;38594:21;38675:1;38669:8;38723:10;38808:5;38804:1;38801;38797:9;38793:21;38790:1;38786:29;38783:1;38779:37;38776:1;38772:45;38769:1;38762:56;;;;;38294:542;;;:::o;463:1036:1:-;561:14;;452:2;1592:28;;;;;:33;636:80;;-1:-1:-1;690:6:1;;-1:-1:-1;698:1:1;682:18;;636:80;326:10;772:5;754:15;:23;753:36;;;278:2;825:29;;;824:42;214:16;913:40;;974:23;;;970:130;;-1:-1:-1;1074:10:1;;-1:-1:-1;1042:1:1;970:130;278:2;1133:23;;;;214:16;394:2;1247:31;;;1246:58;;1221:84;;;;1330:47;;;1320:57;;-1:-1:-1;140:14:1;1442:38;;;-1:-1:-1;;463:1036:1;;;;;;:::o;635:504:2:-;772:1;769;766:8;760:4;753:22;821:2;818:1;814:10;808:3;805:1;802:10;798:27;954:1;939:132;971:1;968;965:8;939:132;;1042:4;1026:21;;;1013:35;;989:1;982:9;939:132;;;943:14;;1101:4;1095:11;1085:36;;1110:9;23798:131:0;-1:-1:-1;;;;;23872:37:0;;;;;;;;:30;:37;;;;;:49;;-1:-1:-1;;23872:49:0;-1:-1:-1;;;;;23872:49:0;;;;;;;;;23798:131::o;3010:986:5:-;3179:15;3173:4;3166:29;3222:4;3216;3209:18;3273:4;3267;3257:21;3353:8;3347:15;3462:5;3453:7;3450:18;3710:2;3700:62;;-1:-1:-1;3740:19:5;;;3727:33;;3700:62;3836:7;3826:8;3819:25;3970:7;3962:4;3956:11;3952:2;3948:20;3916:30;3913:1;3910;3905:73;;;;3010:986;;;:::o;17683:3268:0:-;-1:-1:-1;;;;;17776:16:0;;17772:52;;17801:23;;-1:-1:-1;;;17801:23:0;;;;;;;;;;;17772:52;6559:20;17837:22;17931:18;17944:4;17931:12;:18::i;:::-;17893:56;;17960:33;17996:16;18009:2;17996:12;:16::i;:::-;17960:52;;18025:23;-1:-1:-1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;18025:23:0;18079:27;;;-1:-1:-1;;;18079:27:0;;;;;18059:17;;;:47;18135:25;;;;18117:15;;;:43;-1:-1:-1;;;;;;;;18187:23:0;;;;18171:13;;;:39;;;18227:22;;18223:56;;;18258:21;;-1:-1:-1;;;18258:21:0;;;;;;;;;;;18223:56;18317:13;;;:23;;;;;;;;;18355:47;;-1:-1:-1;;;;;18355:47:0;;;-1:-1:-1;;;18355:47:0;;;-1:-1:-1;;;;;18355:47:0;;;;;;18462:21;;;;;;;:30;;18448:11;;;:44;;;18417:76;;;;;;;;;18544:17;;;;18530:54;;3616:8;;18563:20;37632:8;;;37642:9;;37628:24;;37466:204;18530:54;18510:74;;18605:19;;-1:-1:-1;;;18605:19:0;;4137:6;18605:49;18510:17;18605:54;18601:255;;18692:2;-1:-1:-1;;;;;18684:10:0;:4;-1:-1:-1;;;;;18684:10:0;;18680:71;;18734:17;;18714;;;;:37;18696:15;;;:55;18680:71;18790:50;3616:8;18804:1;:11;;;:18;;;;;:::i;:::-;;18824:1;:15;;;37632:8;;;37642:9;;37628:24;;37466:204;18790:50;18770:17;;;:70;18601:255;18872:29;18904:56;18942:1;:17;;;18922:1;:17;;;:37;-1:-1:-1;;;;;;;;;;;;;;;;;34825:4:0;34818;34812:11;34808:22;34901:1;34895:4;34888:15;34941:4;34935;34931:15;34992:1;34989;34985:9;34977:6;34973:22;34967:4;34960:36;35020:4;35017:1;35010:15;35060:6;35056:1;35050:4;35046:12;35039:28;;;34635:450;;;;18904:56;18981:17;;18872:88;;-1:-1:-1;18981:22:0;18977:703;;-1:-1:-1;;;;;19054:13:0;;19024:27;19054:13;;;:7;;;:13;;;;;19106:17;;;;19172;;19208:45;;;-1:-1:-1;;;19208:45:0;;;;;;;;;;;-1:-1:-1;;;;19208:45:0;;;;;;;;;19272;;19160:29;;;19272:45;;;-1:-1:-1;;;19272:45:0;-1:-1:-1;;;;19272:45:0;;;;;;;;;19367:298;-1:-1:-1;;19422:11:0;;;;38193:1;38184:10;;;19393;38176:19;;;;;;;;;;;19422:11;;;38215:1;38200:16;;;;;38176:41;19393;;;;19457:43;19485:1;:4;;19491:2;19495:1;19498;19457:27;:43::i;:::-;19530:20;;;;:16;;;:20;;;;;;;;19523:27;;-1:-1:-1;;;;;;19523:27:0;;;35415:12;;;35409:19;;35479:1;35475:10;;;;35467:2;35463:10;;;35460:26;-1:-1:-1;35457:39:0;35442:55;;35532:17;;35511:39;;19643:20;;;19367:298;;19005:675;;;18977:703;19700:17;;;;:22;19696:1068;;-1:-1:-1;;;;;19771:11:0;;19743:25;19771:11;;;:7;;;:11;;;;;;;19819:15;;;;19879:17;;;;19771:11;;19869:27;;;;19932:43;19957:13;19779:2;19932:24;:43::i;:::-;20013:13;;20124:17;;;;-1:-1:-1;;;;20097:45:0;;20065:13;-1:-1:-1;;;20097:45:0;;;;;;;;;;;;;;;;20161:41;;-1:-1:-1;;;;20161:41:0;-1:-1:-1;;;20161:41:0;;;;;;;19915:60;;-1:-1:-1;3616:8:0;-1:-1:-1;;;20013:13:0;;-1:-1:-1;;;;;20013:13:0;:20;;-1:-1:-1;;;20065:13:0;;;;20252:452;20285:31;20290:1;:4;;20296:19;20312:2;37800:1;37795:6;;37710:99;20285:31;:36;;;20278:123;;20354:4;;:15;;;20350:27;;;-1:-1:-1;20376:1:0;20350:27;20278:123;;;20423:34;20428:7;20437;20453:2;20423:4;:34::i;:::-;20480:65;20508:1;:4;;20514:2;20518:7;20534:9;;;;;;20480:27;:65::i;:::-;20568:40;20586:10;20598:2;20602;20606:1;35425;35419:4;35415:12;35409:19;35488:7;35482:2;35479:1;35475:10;35471:1;35467:2;35463:10;35460:26;35457:39;35449:6;35442:55;35544:4;35536:6;35532:17;35528:1;35522:4;35518:12;35511:39;;35191:377;;;;;20568:40;20635:4;;:15;;;20631:27;;;-1:-1:-1;20657:1:0;20631:27;20697:5;20686:7;:16;20252:452;;20722:26;;;;;;-1:-1:-1;;;20722:26:0;-1:-1:-1;;20722:26:0;;;;;;-1:-1:-1;;;;;19696:1068:0;20784:15;;:22;:27;20780:111;;20860:14;;;;20832:43;;20848:10;;-1:-1:-1;;;;;20860:14:0;20832:15;:43::i;:::-;18292:2610;20932:2;-1:-1:-1;;;;;20917:26:0;20926:4;-1:-1:-1;;;;;20917:26:0;;20936:6;20917:26;;;;1531:25:8;;1519:2;1504:18;;1385:177;20917:26:0;;;;;;;;17761:3190;;;;17683:3268;;;:::o;1641:230:1:-;1716:6;1592:28;452:2;1592:28;;;;:33;;1739:31;;;;1735:105;;-1:-1:-1;;;1787:41:1;;;;;1735:105;-1:-1:-1;1857:6:1;;1641:230;-1:-1:-1;1641:230:1:o;29794:477:0:-;29948:10;29942:4;29935:24;30020:8;30014:4;30007:22;30118:4;30112;30106;30100;30097:1;30089:6;30082:5;30077:46;30073:1;30066:4;30060:11;30057:18;30053:71;30043:210;;30158:10;30152:4;30145:24;30233:4;30227;30220:18;38909:708;39201:9;39189:10;39185:26;39172:10;39168:2;39164:19;39161:51;39239:8;39233:4;39226:22;39282:2;39279:1;39275:10;39269:4;39262:24;39325:4;39319;39309:21;39385:1;39381:2;39377:10;39374:1;39370:18;39448:1;39442:8;39496:18;39589:5;39585:1;39582;39578:9;39574:21;39571:1;39567:29;39564:1;39560:37;39557:1;39553:45;39550:1;39543:56;;;;;;38909:708;;;;:::o;35667:634::-;35835:1;35829:8;35870:4;35864;35860:15;35929:10;35926:1;35919:21;36004:4;35997;35994:1;35990:12;35983:26;36100:4;36094:11;36091:1;36087:19;36081:4;36077:30;36068:39;;36226:4;36223:1;36220;36213:4;36210:1;36206:12;36203:1;36195:6;36188:5;36183:48;36179:1;36175;36169:8;36166:15;36162:70;36152:131;;36263:4;36260:1;36253:15;203:548:8;315:4;344:2;373;362:9;355:21;405:6;399:13;448:6;443:2;432:9;428:18;421:34;473:1;483:140;497:6;494:1;491:13;483:140;;;592:14;;;588:23;;582:30;558:17;;;577:2;554:26;547:66;512:10;;483:140;;;487:3;672:1;667:2;658:6;647:9;643:22;639:31;632:42;742:2;735;731:7;726:2;718:6;714:15;710:29;699:9;695:45;691:54;683:62;;;;203:548;;;;:::o;756:173::-;824:20;;-1:-1:-1;;;;;873:31:8;;863:42;;853:70;;919:1;916;909:12;934:254;1002:6;1010;1063:2;1051:9;1042:7;1038:23;1034:32;1031:52;;;1079:1;1076;1069:12;1031:52;1102:29;1121:9;1102:29;:::i;:::-;1092:39;1178:2;1163:18;;;;1150:32;;-1:-1:-1;;;934:254:8:o;1567:180::-;1626:6;1679:2;1667:9;1658:7;1654:23;1650:32;1647:52;;;1695:1;1692;1685:12;1647:52;-1:-1:-1;1718:23:8;;1567:180;-1:-1:-1;1567:180:8:o;1752:328::-;1829:6;1837;1845;1898:2;1886:9;1877:7;1873:23;1869:32;1866:52;;;1914:1;1911;1904:12;1866:52;1937:29;1956:9;1937:29;:::i;:::-;1927:39;;1985:38;2019:2;2008:9;2004:18;1985:38;:::i;:::-;1975:48;;2070:2;2059:9;2055:18;2042:32;2032:42;;1752:328;;;;;:::o;2085:186::-;2144:6;2197:2;2185:9;2176:7;2172:23;2168:32;2165:52;;;2213:1;2210;2203:12;2165:52;2236:29;2255:9;2236:29;:::i;2276:160::-;2341:20;;2397:13;;2390:21;2380:32;;2370:60;;2426:1;2423;2416:12;2441:180;2497:6;2550:2;2538:9;2529:7;2525:23;2521:32;2518:52;;;2566:1;2563;2556:12;2518:52;2589:26;2605:9;2589:26;:::i;3031:254::-;3096:6;3104;3157:2;3145:9;3136:7;3132:23;3128:32;3125:52;;;3173:1;3170;3163:12;3125:52;3196:29;3215:9;3196:29;:::i;:::-;3186:39;;3244:35;3275:2;3264:9;3260:18;3244:35;:::i;:::-;3234:45;;3031:254;;;;;:::o;3290:348::-;3342:8;3352:6;3406:3;3399:4;3391:6;3387:17;3383:27;3373:55;;3424:1;3421;3414:12;3373:55;-1:-1:-1;3447:20:8;;3490:18;3479:30;;3476:50;;;3522:1;3519;3512:12;3476:50;3559:4;3551:6;3547:17;3535:29;;3611:3;3604:4;3595:6;3587;3583:19;3579:30;3576:39;3573:59;;;3628:1;3625;3618:12;3643:411;3714:6;3722;3775:2;3763:9;3754:7;3750:23;3746:32;3743:52;;;3791:1;3788;3781:12;3743:52;3831:9;3818:23;3864:18;3856:6;3853:30;3850:50;;;3896:1;3893;3886:12;3850:50;3935:59;3986:7;3977:6;3966:9;3962:22;3935:59;:::i;:::-;4013:8;;3909:85;;-1:-1:-1;3643:411:8;-1:-1:-1;;;;3643:411:8:o;4059:721::-;4151:6;4159;4167;4175;4228:2;4216:9;4207:7;4203:23;4199:32;4196:52;;;4244:1;4241;4234:12;4196:52;4284:9;4271:23;4313:18;4354:2;4346:6;4343:14;4340:34;;;4370:1;4367;4360:12;4340:34;4409:59;4460:7;4451:6;4440:9;4436:22;4409:59;:::i;:::-;4487:8;;-1:-1:-1;4383:85:8;-1:-1:-1;4575:2:8;4560:18;;4547:32;;-1:-1:-1;4591:16:8;;;4588:36;;;4620:1;4617;4610:12;4588:36;;4659:61;4712:7;4701:8;4690:9;4686:24;4659:61;:::i;:::-;4059:721;;;;-1:-1:-1;4739:8:8;-1:-1:-1;;;;4059:721:8:o;4785:276::-;4843:6;4896:2;4884:9;4875:7;4871:23;4867:32;4864:52;;;4912:1;4909;4902:12;4864:52;4951:9;4938:23;5001:10;4994:5;4990:22;4983:5;4980:33;4970:61;;5027:1;5024;5017:12;5066:269;5123:6;5176:2;5164:9;5155:7;5151:23;5147:32;5144:52;;;5192:1;5189;5182:12;5144:52;5231:9;5218:23;5281:4;5274:5;5270:16;5263:5;5260:27;5250:55;;5301:1;5298;5291:12;5340:260;5408:6;5416;5469:2;5457:9;5448:7;5444:23;5440:32;5437:52;;;5485:1;5482;5475:12;5437:52;5508:29;5527:9;5508:29;:::i;:::-;5498:39;;5556:38;5590:2;5579:9;5575:18;5556:38;:::i;5605:380::-;5684:1;5680:12;;;;5727;;;5748:61;;5802:4;5794:6;5790:17;5780:27;;5748:61;5855:2;5847:6;5844:14;5824:18;5821:38;5818:161;;5901:10;5896:3;5892:20;5889:1;5882:31;5936:4;5933:1;5926:15;5964:4;5961:1;5954:15;5990:127;6051:10;6046:3;6042:20;6039:1;6032:31;6082:4;6079:1;6072:15;6106:4;6103:1;6096:15;6248:518;6350:2;6345:3;6342:11;6339:421;;;6386:5;6383:1;6376:16;6430:4;6427:1;6417:18;6500:2;6488:10;6484:19;6481:1;6477:27;6471:4;6467:38;6536:4;6524:10;6521:20;6518:47;;;-1:-1:-1;6559:4:8;6518:47;6614:2;6609:3;6605:12;6602:1;6598:20;6592:4;6588:31;6578:41;;6669:81;6687:2;6680:5;6677:13;6669:81;;;6746:1;6732:16;;6713:1;6702:13;6669:81;;6942:1198;7066:18;7061:3;7058:27;7055:53;;;7088:18;;:::i;:::-;7117:94;7207:3;7167:38;7199:4;7193:11;7167:38;:::i;:::-;7161:4;7117:94;:::i;:::-;7237:1;7262:2;7257:3;7254:11;7279:1;7274:608;;;;7926:1;7943:3;7940:93;;;-1:-1:-1;7999:19:8;;;7986:33;7940:93;-1:-1:-1;;6899:1:8;6895:11;;;6891:24;6887:29;6877:40;6923:1;6919:11;;;6874:57;8046:78;;7247:887;;7274:608;6195:1;6188:14;;;6232:4;6219:18;;-1:-1:-1;;7310:17:8;;;7425:229;7439:7;7436:1;7433:14;7425:229;;;7528:19;;;7515:33;7500:49;;7635:4;7620:20;;;;7588:1;7576:14;;;;7455:12;7425:229;;;7429:3;7682;7673:7;7670:16;7667:159;;;7806:1;7802:6;7796:3;7790;7787:1;7783:11;7779:21;7775:34;7771:39;7758:9;7753:3;7749:19;7736:33;7732:79;7724:6;7717:95;7667:159;;;7869:1;7863:3;7860:1;7856:11;7852:19;7846:4;7839:33;7247:887;;6942:1198;;;:::o;8145:127::-;8206:10;8201:3;8197:20;8194:1;8187:31;8237:4;8234:1;8227:15;8261:4;8258:1;8251:15;8277:168;8350:9;;;8381;;8398:15;;;8392:22;;8378:37;8368:71;;8419:18;;:::i;8450:191::-;-1:-1:-1;;;;;8577:10:8;;;8565;;;8561:27;;8600:12;;;8597:38;;;8615:18;;:::i;8646:201::-;8684:3;8712:10;8757:2;8750:5;8746:14;8784:2;8775:7;8772:15;8769:41;;8790:18;;:::i;:::-;8839:1;8826:15;;8646:201;-1:-1:-1;;;8646:201:8:o;8852:127::-;8913:10;8908:3;8904:20;8901:1;8894:31;8944:4;8941:1;8934:15;8968:4;8965:1;8958:15
Swarm Source
ipfs://6ad60666c6d74f31baf984ab30cb2f86ce01e7b99479d2d2e20b9721522f5fff
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 26 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.