ERC-20
Overview
Max Total Supply
10,000 ASTX
Holders
3,245 ( 0.092%)
Market
Price
$522.34 @ 0.151093 ETH (-0.19%)
Onchain Market Cap
$5,223,423.77
Circulating Supply Market Cap
$5,223,423.77
Other Info
Token Contract (WITH 18 Decimals)
Balance
0 ASTXValue
$0.00Loading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|---|---|---|---|---|
1 | Uniswap V3 (Ethereum) | 0X0000000000CA73A6DF4C58B84C5B4B847FE8FF39-0XC02AAA39B223FE8D0A0E5C4F27EAD9083C756CC2 | $527.71 0.1519747 Eth | $9,510.25 18.289 0X0000000000CA73A6DF4C58B84C5B4B847FE8FF39 | 99.6647% |
2 | Uniswap V2 (Ethereum) | 0X0000000000CA73A6DF4C58B84C5B4B847FE8FF39-0XC02AAA39B223FE8D0A0E5C4F27EAD9083C756CC2 | $504.71 0.1461565 Eth | $31.06 0.062 0X0000000000CA73A6DF4C58B84C5B4B847FE8FF39 | 0.3353% |
Contract Source Code Verified (Exact Match)
Contract Name:
Asterix
Compiler Version
v0.8.24+commit.e11b9ed9
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "./DN404.sol"; import {DailyOutflowCounterLib} from "./DailyOutflowCounterLib.sol"; import {OwnableRoles} from "solady/auth/OwnableRoles.sol"; import {LibString} from "solady/utils/LibString.sol"; import {SafeTransferLib} from "solady/utils/SafeTransferLib.sol"; import {GasBurnerLib} from "solady/utils/GasBurnerLib.sol"; contract Asterix 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 = "Asterix"; _symbol = "ASTX"; 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 = 10000 * _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; /// @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; 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; 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 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 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) ) ) } } }
// 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 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(); _; } }
{ "remappings": [ "forge-std/=test/utils/forge-std/", "ds-test/=lib/forge-std/lib/ds-test/src/", "forge-std/=lib/forge-std/src/", "solady/=lib/solady/src/" ], "optimizer": { "enabled": true, "runs": 1000 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "ipfs", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "abi" ] } }, "evmVersion": "paris", "libraries": {} }
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
60806040523480156200001157600080fd5b506200001d3262000023565b62000327565b6200002e81620000b2565b6200003b816001620000ee565b604080518082019091526007815266082e6e8cae4d2f60cb1b60208201526000906200006890826200025b565b50604080518082019091526004815263082a6a8b60e31b60208201526001906200009390826200025b565b50506003805464ffffffffff60281b191667c350230000000000179055565b6001600160a01b0316638b78c6d8198190558060007f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08180a350565b6200017a82620001398362000129836001600160a01b0316600090815268a20d6e21d0e525531060205260409020546001600160581b031690565b6001600160581b0316906200017e565b6001600160a01b0391909116600090815268a20d6e21d0e52553106020526040902080546001600160581b0319166001600160581b03909216919091179055565b5050565b6000811515620001938460571c600116151590565b151514620001ad576a800000000000000000000092909218915b5090919050565b634e487b7160e01b600052604160045260246000fd5b600181811c90821680620001df57607f821691505b6020821081036200020057634e487b7160e01b600052602260045260246000fd5b50919050565b601f82111562000256576000816000526020600020601f850160051c81016020861015620002315750805b601f850160051c820191505b8181101562000252578281556001016200023d565b5050505b505050565b81516001600160401b03811115620002775762000277620001b4565b6200028f81620002888454620001ca565b8462000206565b602080601f831160018114620002c75760008415620002ae5750858301515b600019600386901b1c1916600185901b17855562000252565b600085815260208120601f198616915b82811015620002f857888601518255948401946001909101908401620002d7565b5085821015620003175787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b612fae80620003376000396000f3fe60806040526004361061030c5760003560e01c806353df5c7c1161019a578063af6900c3116100e1578063d73c1fb31161008a578063f04e283e11610064578063f04e283e14610caa578063f2fde38b14610cbd578063fee81cf414610cd057610313565b8063d73c1fb314610c19578063dd62ed3e14610c3a578063e436744514610c8857610313565b8063bbefa83a116100bb578063bbefa83a14610bc4578063c4d66de814610bd9578063c87b56dd14610bf957610313565b8063af6900c314610b6f578063b19de39f14610b84578063b698206914610ba457610313565b806370a08231116101435780638da5cb5b1161011d5780638da5cb5b14610b2157806395d89b4114610b3a578063a9059cbb14610b4f57610313565b806370a0823114610ab1578063715018a614610b0457806375b238fc14610b0c57610313565b80635a446215116101745780635a44621514610a625780635d148e5c14610a825780636338cb8a14610a9c57610313565b806353df5c7c14610a2557806354d1f13d14610a3a57806355f804b314610a4257610313565b8063274e430b1161025e57806347f618a511610207578063514e62fc116101e1578063514e62fc146109925780635327bba3146109c957806353d6fd5914610a0557610313565b806347f618a5146109255780634a4ee7b1146109455780634ef41efc1461095857610313565b8063313ce56711610238578063313ce567146108dc5780633af32abf146108f05780633ccfd60b1461091057610313565b8063274e430b146108695780632a6a935d146108895780632de94807146108a957610313565b8063183a4f6e116102c057806323b848ff1161029a57806323b848ff1461082c57806323b872dd14610841578063256929621461086157610313565b8063183a4f6e146107cf5780631c10893f146107e25780631cd64df4146107f557610313565b8063095ea7b3116102f1578063095ea7b314610744578063180434a31461077457806318160ddd1461079357610313565b806304dfe79d146106e857806306fdde031461072257610313565b3661031357005b68a20d6e21d0e525530860003560e01c63e985e9c58190036103b95760018201546001600160a01b0316331461035c5760405163ce5a776b60e01b815260040160405180910390fd5b604436101561036a57600080fd5b6004356001600160a01b038181166000908152600385016020908152604080832060243594851684529091529020546103b69060ff166103ab5760006103ae565b60015b60ff16610d03565b50505b80636352211e0361041e5760018201546001600160a01b031633146103f15760405163ce5a776b60e01b815260040160405180910390fd5b60243610156103ff57600080fd5b60043561041c61040e82610d0d565b6001600160a01b0316610d03565b505b8063e5eb36c80361048b5760018201546001600160a01b031633146104565760405163ce5a776b60e01b815260040160405180910390fd5b608436101561046457600080fd5b60043560243560443560643561047c84848484610d44565b6104866001610d03565b505050505b8063813500fc036105255760018201546001600160a01b031633146104c35760405163ce5a776b60e01b815260040160405180910390fd5b60643610156104d157600080fd5b6001600160a01b03604435818116600090815268a20d6e21d0e525530b6020908152604080832060043595861684529091529020805460ff19166024351515908117909155906105216001610d03565b5050505b8063d10b6e0c036105865760018201546001600160a01b0316331461055d5760405163ce5a776b60e01b815260040160405180910390fd5b606436101561056b57600080fd5b60043560243560443561058261040e848484610d8b565b5050505b8063081812fc036105dd5760018201546001600160a01b031633146105be5760405163ce5a776b60e01b815260040160405180910390fd5b60243610156105cc57600080fd5b6004356105db61040e82610e9c565b505b8063f5b100ea036106655760018201546001600160a01b031633146106155760405163ce5a776b60e01b815260040160405180910390fd5b602436101561062357600080fd5b60043561066361065e826001600160a01b0316600090815268a20d6e21d0e5255310602052604090205463ffffffff600160801b9091041690565b610d03565b505b8063e2c79281036106d15760018201546001600160a01b0316331461069d5760405163ce5a776b60e01b815260040160405180910390fd5b60043610156106ab57600080fd5b68a20d6e21d0e5255308546106d19068010000000000000000900463ffffffff16610d03565b8063b7a94eb8036106e6576106e66001610d03565b005b3480156106f457600080fd5b5060035461070b9065010000000000900460ff1681565b60405160ff90911681526020015b60405180910390f35b34801561072e57600080fd5b50610737610ee8565b6040516107199190612ada565b34801561075057600080fd5b5061076461075f366004612b40565b610f7a565b6040519015158152602001610719565b34801561078057600080fd5b5060035461076490610100900460ff1681565b34801561079f57600080fd5b5068a20d6e21d0e525530854600160601b90046bffffffffffffffffffffffff165b604051908152602001610719565b6106e66107dd366004612b6a565b610ff0565b6106e66107f0366004612b40565b610ffd565b34801561080157600080fd5b50610764610810366004612b40565b638b78c6d8600c90815260009290925260209091205481161490565b34801561083857600080fd5b506106e6611013565b34801561084d57600080fd5b5061076461085c366004612b83565b611036565b6106e66110f2565b34801561087557600080fd5b50610764610884366004612bbf565b611142565b34801561089557600080fd5b506106e66108a4366004612bea565b611191565b3480156108b557600080fd5b506107c16108c4366004612bbf565b638b78c6d8600c908152600091909152602090205490565b3480156108e857600080fd5b50601261070b565b3480156108fc57600080fd5b5061076461090b366004612bbf565b61119b565b34801561091c57600080fd5b506106e66111d9565b34801561093157600080fd5b506003546107649062010000900460ff1681565b6106e6610953366004612b40565b6111ed565b34801561096457600080fd5b5068a20d6e21d0e5255309546001600160a01b03165b6040516001600160a01b039091168152602001610719565b34801561099e57600080fd5b506107646109ad366004612b40565b638b78c6d8600c90815260009290925260209091205416151590565b3480156109d557600080fd5b506003546109f0906601000000000000900463ffffffff1681565b60405163ffffffff9091168152602001610719565b348015610a1157600080fd5b506106e6610a20366004612c05565b6111ff565b348015610a3157600080fd5b506106e6611244565b6106e661125f565b348015610a4e57600080fd5b506106e6610a5d366004612c7a565b61129b565b348015610a6e57600080fd5b506106e6610a7d366004612cbc565b6112d7565b348015610a8e57600080fd5b506003546107649060ff1681565b348015610aa857600080fd5b506106e661132e565b348015610abd57600080fd5b506107c1610acc366004612bbf565b6001600160a01b0316600090815268a20d6e21d0e52553106020526040902054600160a01b90046bffffffffffffffffffffffff1690565b6106e661134b565b348015610b1857600080fd5b506107c1600181565b348015610b2d57600080fd5b50638b78c6d8195461097a565b348015610b4657600080fd5b5061073761135f565b348015610b5b57600080fd5b50610764610b6a366004612b40565b61136e565b348015610b7b57600080fd5b506106e6611384565b348015610b9057600080fd5b506106e6610b9f366004612d28565b6113a5565b348015610bb057600080fd5b506106e6610bbf366004612d4e565b611407565b348015610bd057600080fd5b506106e6611463565b348015610be557600080fd5b506106e6610bf4366004612bbf565b611482565b348015610c0557600080fd5b50610737610c14366004612b6a565b6114bc565b348015610c2557600080fd5b50600354610764906301000000900460ff1681565b348015610c4657600080fd5b506107c1610c55366004612d71565b6001600160a01b03918216600090815268a20d6e21d0e525530d6020908152604080832093909416825291909152205490565b348015610c9457600080fd5b5060035461076490640100000000900460ff1681565b6106e6610cb8366004612bbf565b6115cf565b6106e6610ccb366004612bbf565b61160c565b348015610cdc57600080fd5b506107c1610ceb366004612bbf565b63389a75e1600c908152600091909152602090205490565b8060005260206000f35b6000610d1882611633565b610d355760405163677510db60e11b815260040160405180910390fd5b610d3e82611650565b92915050565b610d50848484846116a5565b610d5a8484611af9565b826001600160a01b0316846001600160a01b031614610d8557610d8584670de0b6b3a7640000611c1a565b50505050565b600068a20d6e21d0e52553088168a20d6e21d0e525530a81610dd968a20d6e21d0e525530f600189901b5b600381901c600090815260209290925260409091205460059190911b60e0161c90565b63ffffffff1681526020810191909152604001600020546001600160a01b03908116915084168114610e66576001600160a01b03808216600090815260038401602090815260408083209388168352929052205460ff16610e66576040517fcfb3b94200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008581526004909201602052604090912080546001600160a01b0387166001600160a01b031990911617905590509392505050565b6000610ea782611633565b610ec45760405163677510db60e11b815260040160405180910390fd5b50600090815268a20d6e21d0e525530c60205260409020546001600160a01b031690565b606060008054610ef790612d9b565b80601f0160208091040260200160405190810160405280929190818152602001828054610f2390612d9b565b8015610f705780601f10610f4557610100808354040283529160200191610f70565b820191906000526020600020905b815481529060010190602001808311610f5357829003601f168201915b5050505050905090565b60008068a20d6e21d0e525530833600081815260058301602090815260408083206001600160a01b038a16808552908352928190208890555187815293945090927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a35060019392505050565b610ffa3382611cff565b50565b611005611d0b565b61100f8282611d26565b5050565b600161101e81611d32565b506003805464ff000000001916640100000000179055565b6001600160a01b038316600090815268a20d6e21d0e525530d6020908152604080832033845290915281205468a20d6e21d0e52553089060001981146110db57808411156110b0576040517f13be252b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b03861660009081526005830160209081526040808320338452909152902084820390555b6110e6868686611d65565b50600195945050505050565b60006202a30067ffffffffffffffff164201905063389a75e1600c5233600052806020600c2055337fdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d600080a250565b6001600160a01b038116600090815268a20d6e21d0e5255310602052604081208054600160581b9004600116820361117e57823b5b9392505050565b54600160581b9004600216151592915050565b610ffa3382611d9d565b6001600160a01b038116600090815268a20d6e21d0e52553106020526040812054610d3e906affffffffffffffffffffff165b60571c600116151590565b60016111e481611d32565b610ffa33611e35565b6111f5611d0b565b61100f8282611cff565b600161120a81611d32565b6003546301000000900460ff1615611235576040516303cb96db60e21b815260040160405180910390fd5b61123f8383611e51565b505050565b600161124f81611d32565b506003805460ff19166001179055565b63389a75e1600c523360005260006020600c2055337ffa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92600080a2565b60016112a681611d32565b60035460ff16156112ca576040516303cb96db60e21b815260040160405180910390fd5b6002610d85838583612e2d565b60016112e281611d32565b600354610100900460ff161561130b576040516303cb96db60e21b815260040160405180910390fd5b6000611318858783612e2d565b506001611326838583612e2d565b505050505050565b600161133981611d32565b506003805461ff001916610100179055565b611353611d0b565b61135d6000611ee9565b565b606060018054610ef790612d9b565b600061137b338484611d65565b50600192915050565b600161138f81611d32565b506003805463ff00000019166301000000179055565b60016113b081611d32565b60035462010000900460ff16156113da576040516303cb96db60e21b815260040160405180910390fd5b506003805463ffffffff90921666010000000000000269ffffffff00000000000019909216919091179055565b600161141281611d32565b600354640100000000900460ff161561143e576040516303cb96db60e21b815260040160405180910390fd5b506003805460ff909216650100000000000265ff000000000019909216919091179055565b600161146e81611d32565b506003805462ff0000191662010000179055565b600161148d81611d32565b60006114a3670de0b6b3a7640000612710612f03565b9050336114b1828286611f27565b610d85816001611e51565b60606114c782611633565b6114e45760405163677510db60e11b815260040160405180910390fd5b600280546114f190612d9b565b1590506115ca57610d3e6002805461150890612d9b565b80601f016020809104026020016040519081016040528092919081815260200182805461153490612d9b565b80156115815780601f1061155657610100808354040283529160200191611581565b820191906000526020600020905b81548152906001019060200180831161156457829003601f168201915b50505050506040518060400160405280600481526020017f7b69647d000000000000000000000000000000000000000000000000000000008152506115c58561211c565b612160565b919050565b6115d7611d0b565b63389a75e1600c52806000526020600c2080544211156115ff57636f5e88186000526004601cfd5b60009055610ffa81611ee9565b611614611d0b565b8060601b61162a57637448fbae6000526004601cfd5b610ffa81611ee9565b60008061163f83611650565b6001600160a01b0316141592915050565b600068a20d6e21d0e525530868a20d6e21d0e525530a8261167e68a20d6e21d0e525530f600187901b610db6565b63ffffffff1681526020810191909152604001600020546001600160a01b03169392505050565b68a20d6e21d0e52553086001600160a01b0384166116d657604051633a954ecd60e21b815260040160405180910390fd5b60008160020160006116ef84600701610db68860011b90565b63ffffffff1681526020810191909152604001600020546001600160a01b0390811691508616811461174d576040517fa114810000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b856001600160a01b0316836001600160a01b0316146117ea576001600160a01b03808716600090815260038401602090815260408083209387168352929052205460ff166117ea5760008481526004830160205260409020546001600160a01b038481169116146117ea576040517f59c896be00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006117f587612283565b9050600061180287612283565b8254909150670de0b6b3a7640000908390601490611836908490600160a01b90046bffffffffffffffffffffffff16612f1a565b82546101009290920a6bffffffffffffffffffffffff81810219909316918316021790915582546001600160a01b038116670de0b6b3a7640000600160a01b9283900484160190921602178255506118ce60078501600188901b61189a848b6122f7565b826020528160031c60005260406000206007831660051b815463ffffffff8482841c188116831b8218845550505050505050565b6000868152600485016020908152604080832080546001600160a01b03191690556001600160a01b038b168352600687018252808320855463ffffffff60801b198116600160801b9182900463ffffffff90811660001901908116909202178755631fffffff600382901c168552925282205460059190911b60e0161c6001600160a01b038a166000908152600687016020526040902063ffffffff9190911691506119c1906119866007880160018b811b01610db6565b63ffffffff1683826020528160031c60005260406000206007831660051b815463ffffffff8482841c188116831b8218845550505050505050565b8154600163ffffffff600160801b80840482169283019091160263ffffffff60801b19909216919091178355611a1360078701611a0184600190811b0190565b61189a60078a0160018d811b01610db6565b6001600160a01b03891660009081526006870160209081526040808320909152600383901c82529020805460e0600584901b1681811c8b1863ffffffff16901b189055611a986007870160018a811b0183826020528160031c60005260406000206007831660051b815463ffffffff8482841c188116831b8218845550505050505050565b5050866001600160a01b0316886001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef670de0b6b3a7640000604051611ae791815260200190565b60405180910390a35050505050505050565b60035465010000000000900460ff166000819003611b1657505050565b6001600160a01b038216600090815268a20d6e21d0e52553106020526040902054670de0b6b3a7640000820290600160a01b90046bffffffffffffffffffffffff1611611b6257505050565b611b996111ce836001600160a01b0316600090815268a20d6e21d0e525531060205260409020546affffffffffffffffffffff1690565b15611ba357505050565b638b78c6d819546001600160a01b0316836001600160a01b031603611bc757505050565b638b78c6d8600c9081526000849052602090205460011615611be857505050565b6040517f0f2acbfc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6003546601000000000000900463ffffffff166000819003611c3b57505050565b600080611c8984611c76876001600160a01b0316600090815268a20d6e21d0e525531060205260409020546affffffffffffffffffffff1690565b6affffffffffffffffffffff16906123b2565b9150915060028110611cb65780800283026301312d00808210611caa578091505b611cb382612429565b50505b6001600160a01b038516600090815268a20d6e21d0e52553106020526040902080546affffffffffffffffffffff19166affffffffffffffffffffff84161790555b5050505050565b61100f8282600061245d565b638b78c6d81954331461135d576382b429006000526004601cfd5b61100f8282600161245d565b638b78c6d819543314610ffa57638b78c6d8600c5233600052806020600c205416610ffa576382b429006000526004601cfd5b611d708383836124b6565b611d7a8383611af9565b816001600160a01b0316836001600160a01b03161461123f5761123f8382611c1a565b6000611da883612283565b8054909150600160581b9004600216151582151514611deb57805460ff600160581b8083048216600218909116026bff0000000000000000000000199091161781555b826001600160a01b03167fb5a1de456fff688115a4f75380060c23c8532d14ff85f687cc871456d642039383604051611e28911515815260200190565b60405180910390a2505050565b60003860003847855af1610ffa5763b12d13eb6000526004601cfd5b61100f82611ea083611e8d866001600160a01b0316600090815268a20d6e21d0e525531060205260409020546affffffffffffffffffffff1690565b6affffffffffffffffffffff1690612a42565b6001600160a01b0391909116600090815268a20d6e21d0e52553106020526040902080546affffffffffffffffffffff19166affffffffffffffffffffff909216919091179055565b638b78c6d81980546001600160a01b039092169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a355565b68a20d6e21d0e52553088054640100000000900463ffffffff1615611f78576040517fead4d2e400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b038216611fb8576040517f39a84a7b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611fc182612a6f565b805467ffffffff0000000019166401000000001781556001810180546001600160a01b0384166001600160a01b03199091161790558315610d85576001600160a01b03831661202357604051633a954ecd60e21b815260040160405180910390fd5b6b0de0b6b39983494c589bffff841115612069576040517fe5cfe95700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80547fffffffffffffffff000000000000000000000000ffffffffffffffffffffffff16600160601b6bffffffffffffffffffffffff86160217815560006120b084612283565b80546001600160a01b03908116600160a01b6bffffffffffffffffffffffff8916021782556040518781529192508516906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a3611cf8846001611d9d565b60606080604051019050602081016040526000815280600019835b928101926030600a8206018453600a900480612137575050819003601f19909101908152919050565b60608351835183516020870196506020860195506020850194506020604051019350828701838311612232576001838203016000602085106121a157508388205b601f851660200360031b89515b8b51818118831c6122195783156121e85783888e20146121e857808a5260019c8d019c90990198848d106121e2575061222d565b506121ae565b60005b8b8101518b8201526020018781106121eb57509b87019b98860198871561221957848d106121e2575061222d565b895260019b8c019b90980197838c106121ae575b505050505b84935060206040510194508781038585030192505b80881015612262578751845260209788019790930192612247565b50506000818401908152602001604052601f19909201918252509392505050565b6001600160a01b038116600090815268a20d6e21d0e5255310602052604081208054909168a20d6e21d0e525530891600160581b900460011690036122f1576001833b156122cf576002175b825460ff909116600160581b026bff0000000000000000000000199091161782555b50919050565b8154600160601b900463ffffffff1668a20d6e21d0e525530860008290036123ab578054819060009061232f9063ffffffff16612f3f565b825463ffffffff8083166101009490940a848102910219909116179092558554600160601b82027fffffffffffffffffffffffffffffffff00000000ffffffffffffffffffffffff9091161786556000908152600283016020526040902080546001600160a01b0386166001600160a01b031990911617905591505b5092915050565b600080605784901c600116156123cd57508290506000612422565b637fffffff620151804204811690603886901c1666ffffffffffffff86168183146123f9575081905060005b60389190911b66ffffffffffffff602887901c811692909201918216179350620de0b690049150505b9250929050565b80600117601052605b8104607882110260005b818114612452576010808020905260010161243c565b5050601051610ffa57fe5b638b78c6d8600c52826000526020600c2080548381178361247f575080841681185b80835580600c5160601c7f715ad5ce61fc9595c7b415289d59cf203f23a94fa06f04af7e489a0a76e1fe26600080a3505050505050565b6001600160a01b0382166124dd57604051633a954ecd60e21b815260040160405180910390fd5b68a20d6e21d0e525530860006124f285612283565b905060006124ff85612283565b905061253a6040518060c001604052806000815260200160008152602001600081526020016000815260200160008152602001600081525090565b825463ffffffff600160801b808304821660808501528454041660a08301526bffffffffffffffffffffffff600160a01b90910416604082018190528511156125af576040517ff4d678b800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040810180518690039081905283546bffffffffffffffffffffffff808316600160a01b9081026001600160a01b03938416178755855481810483168a0160608701819052909216029116178355608082015161261a91670de0b6b3a7640000900480821191030290565b81528154600160581b900460021660000361268957856001600160a01b0316876001600160a01b03160361265657805160808201510360a08201525b612683670de0b6b3a764000082606001518161267457612674612f62565b048260a0015180821191030290565b60208201525b60006126d382602001518360000151016040805180820190915260608152600060208201526040805101828152806020018360051b81016040528183528083602001525050919050565b8251909150156127ff576001600160a01b0388166000908152600686016020526040902060808301518351875463ffffffff6801000000000000000080830482168490038216026bffffffff0000000000000000199092169190911789558754918303908116600160801b0263ffffffff60801b199092169190911787555b60001991909101600381901c600090815260208490526040812054919291600584901b60e0161c60078a01602052633fffffff600282901c16600090815260409020805460c0600684901b1681811c67ffffffffffffffff16901b18905563ffffffff169050600081815260048a016020908152604090912080546001600160a01b0319169055858101805160608f901b600885901b176001178152909101905250808203612752575050505b6020820151156129ca576001600160a01b03871660009081526006860160209081526040822060a08501519185015190929082019061283e878c6122f7565b895460208801516bffffffff000000000000000019821663ffffffff6801000000000000000080850482169093018116909202178c55895463ffffffff60801b1916600160801b86831602178a55919250670de0b6b3a7640000600160601b82046bffffffffffffffffffffffff160491640100000000909104165b6128cb8b600701610db68360011b90565b63ffffffff16156128ea57600101818111156128e5575060015b6128ba565b6020869052600385901c600090815260409020805460e0600588901b1681811c841863ffffffff16901b18905560078b016020908152600282901c600090815260409020805460c0600685901b1681811c9389901b63ffffffff8816179390931867ffffffffffffffff1690921b909118905560019094019361298d878e8360008360200151818360081b8560601b171781526020810185602001525050505050565b6001018181111561299c575060015b8385036128ba578a5463ffffffff9091166401000000000267ffffffff0000000019909116178a5550505050505b805151156129eb5760018501546129eb9082906001600160a01b0316612aa1565b50856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef87604051612a3191815260200190565b60405180910390a350505050505050565b60006001605784901c16151582151514612a68576a800000000000000000000092909218915b5090919050565b630f4599e560005233602052602060006024601c6000855af160016000511416610ffa5763d125259c6000526004601cfd5b81516040810363263c69d68152602080820152815160051b604401915060208183601c84016000875af1600182511416610d8557600081fd5b60006020808352835180602085015260005b81811015612b0857858101830151858201604001528201612aec565b506000604082860101526040601f19601f8301168501019250505092915050565b80356001600160a01b03811681146115ca57600080fd5b60008060408385031215612b5357600080fd5b612b5c83612b29565b946020939093013593505050565b600060208284031215612b7c57600080fd5b5035919050565b600080600060608486031215612b9857600080fd5b612ba184612b29565b9250612baf60208501612b29565b9150604084013590509250925092565b600060208284031215612bd157600080fd5b61117782612b29565b803580151581146115ca57600080fd5b600060208284031215612bfc57600080fd5b61117782612bda565b60008060408385031215612c1857600080fd5b612c2183612b29565b9150612c2f60208401612bda565b90509250929050565b60008083601f840112612c4a57600080fd5b50813567ffffffffffffffff811115612c6257600080fd5b60208301915083602082850101111561242257600080fd5b60008060208385031215612c8d57600080fd5b823567ffffffffffffffff811115612ca457600080fd5b612cb085828601612c38565b90969095509350505050565b60008060008060408587031215612cd257600080fd5b843567ffffffffffffffff80821115612cea57600080fd5b612cf688838901612c38565b90965094506020870135915080821115612d0f57600080fd5b50612d1c87828801612c38565b95989497509550505050565b600060208284031215612d3a57600080fd5b813563ffffffff8116811461117757600080fd5b600060208284031215612d6057600080fd5b813560ff8116811461117757600080fd5b60008060408385031215612d8457600080fd5b612d8d83612b29565b9150612c2f60208401612b29565b600181811c90821680612daf57607f821691505b6020821081036122f157634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b601f82111561123f576000816000526020600020601f850160051c81016020861015612e0e5750805b601f850160051c820191505b8181101561132657828155600101612e1a565b67ffffffffffffffff831115612e4557612e45612dcf565b612e5983612e538354612d9b565b83612de5565b6000601f841160018114612e8d5760008515612e755750838201355b600019600387901b1c1916600186901b178355611cf8565b600083815260209020601f19861690835b82811015612ebe5786850135825560209485019460019092019101612e9e565b5086821015612edb5760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b634e487b7160e01b600052601160045260246000fd5b8082028115828204841417610d3e57610d3e612eed565b6bffffffffffffffffffffffff8281168282160390808211156123ab576123ab612eed565b600063ffffffff808316818103612f5857612f58612eed565b6001019392505050565b634e487b7160e01b600052601260045260246000fdfea2646970667358221220a355f6339ac2b63f9cfd678e5ae6c747b67293b0045023593cc9950e11b0621d64736f6c63430008180033
Deployed Bytecode
0x60806040526004361061030c5760003560e01c806353df5c7c1161019a578063af6900c3116100e1578063d73c1fb31161008a578063f04e283e11610064578063f04e283e14610caa578063f2fde38b14610cbd578063fee81cf414610cd057610313565b8063d73c1fb314610c19578063dd62ed3e14610c3a578063e436744514610c8857610313565b8063bbefa83a116100bb578063bbefa83a14610bc4578063c4d66de814610bd9578063c87b56dd14610bf957610313565b8063af6900c314610b6f578063b19de39f14610b84578063b698206914610ba457610313565b806370a08231116101435780638da5cb5b1161011d5780638da5cb5b14610b2157806395d89b4114610b3a578063a9059cbb14610b4f57610313565b806370a0823114610ab1578063715018a614610b0457806375b238fc14610b0c57610313565b80635a446215116101745780635a44621514610a625780635d148e5c14610a825780636338cb8a14610a9c57610313565b806353df5c7c14610a2557806354d1f13d14610a3a57806355f804b314610a4257610313565b8063274e430b1161025e57806347f618a511610207578063514e62fc116101e1578063514e62fc146109925780635327bba3146109c957806353d6fd5914610a0557610313565b806347f618a5146109255780634a4ee7b1146109455780634ef41efc1461095857610313565b8063313ce56711610238578063313ce567146108dc5780633af32abf146108f05780633ccfd60b1461091057610313565b8063274e430b146108695780632a6a935d146108895780632de94807146108a957610313565b8063183a4f6e116102c057806323b848ff1161029a57806323b848ff1461082c57806323b872dd14610841578063256929621461086157610313565b8063183a4f6e146107cf5780631c10893f146107e25780631cd64df4146107f557610313565b8063095ea7b3116102f1578063095ea7b314610744578063180434a31461077457806318160ddd1461079357610313565b806304dfe79d146106e857806306fdde031461072257610313565b3661031357005b68a20d6e21d0e525530860003560e01c63e985e9c58190036103b95760018201546001600160a01b0316331461035c5760405163ce5a776b60e01b815260040160405180910390fd5b604436101561036a57600080fd5b6004356001600160a01b038181166000908152600385016020908152604080832060243594851684529091529020546103b69060ff166103ab5760006103ae565b60015b60ff16610d03565b50505b80636352211e0361041e5760018201546001600160a01b031633146103f15760405163ce5a776b60e01b815260040160405180910390fd5b60243610156103ff57600080fd5b60043561041c61040e82610d0d565b6001600160a01b0316610d03565b505b8063e5eb36c80361048b5760018201546001600160a01b031633146104565760405163ce5a776b60e01b815260040160405180910390fd5b608436101561046457600080fd5b60043560243560443560643561047c84848484610d44565b6104866001610d03565b505050505b8063813500fc036105255760018201546001600160a01b031633146104c35760405163ce5a776b60e01b815260040160405180910390fd5b60643610156104d157600080fd5b6001600160a01b03604435818116600090815268a20d6e21d0e525530b6020908152604080832060043595861684529091529020805460ff19166024351515908117909155906105216001610d03565b5050505b8063d10b6e0c036105865760018201546001600160a01b0316331461055d5760405163ce5a776b60e01b815260040160405180910390fd5b606436101561056b57600080fd5b60043560243560443561058261040e848484610d8b565b5050505b8063081812fc036105dd5760018201546001600160a01b031633146105be5760405163ce5a776b60e01b815260040160405180910390fd5b60243610156105cc57600080fd5b6004356105db61040e82610e9c565b505b8063f5b100ea036106655760018201546001600160a01b031633146106155760405163ce5a776b60e01b815260040160405180910390fd5b602436101561062357600080fd5b60043561066361065e826001600160a01b0316600090815268a20d6e21d0e5255310602052604090205463ffffffff600160801b9091041690565b610d03565b505b8063e2c79281036106d15760018201546001600160a01b0316331461069d5760405163ce5a776b60e01b815260040160405180910390fd5b60043610156106ab57600080fd5b68a20d6e21d0e5255308546106d19068010000000000000000900463ffffffff16610d03565b8063b7a94eb8036106e6576106e66001610d03565b005b3480156106f457600080fd5b5060035461070b9065010000000000900460ff1681565b60405160ff90911681526020015b60405180910390f35b34801561072e57600080fd5b50610737610ee8565b6040516107199190612ada565b34801561075057600080fd5b5061076461075f366004612b40565b610f7a565b6040519015158152602001610719565b34801561078057600080fd5b5060035461076490610100900460ff1681565b34801561079f57600080fd5b5068a20d6e21d0e525530854600160601b90046bffffffffffffffffffffffff165b604051908152602001610719565b6106e66107dd366004612b6a565b610ff0565b6106e66107f0366004612b40565b610ffd565b34801561080157600080fd5b50610764610810366004612b40565b638b78c6d8600c90815260009290925260209091205481161490565b34801561083857600080fd5b506106e6611013565b34801561084d57600080fd5b5061076461085c366004612b83565b611036565b6106e66110f2565b34801561087557600080fd5b50610764610884366004612bbf565b611142565b34801561089557600080fd5b506106e66108a4366004612bea565b611191565b3480156108b557600080fd5b506107c16108c4366004612bbf565b638b78c6d8600c908152600091909152602090205490565b3480156108e857600080fd5b50601261070b565b3480156108fc57600080fd5b5061076461090b366004612bbf565b61119b565b34801561091c57600080fd5b506106e66111d9565b34801561093157600080fd5b506003546107649062010000900460ff1681565b6106e6610953366004612b40565b6111ed565b34801561096457600080fd5b5068a20d6e21d0e5255309546001600160a01b03165b6040516001600160a01b039091168152602001610719565b34801561099e57600080fd5b506107646109ad366004612b40565b638b78c6d8600c90815260009290925260209091205416151590565b3480156109d557600080fd5b506003546109f0906601000000000000900463ffffffff1681565b60405163ffffffff9091168152602001610719565b348015610a1157600080fd5b506106e6610a20366004612c05565b6111ff565b348015610a3157600080fd5b506106e6611244565b6106e661125f565b348015610a4e57600080fd5b506106e6610a5d366004612c7a565b61129b565b348015610a6e57600080fd5b506106e6610a7d366004612cbc565b6112d7565b348015610a8e57600080fd5b506003546107649060ff1681565b348015610aa857600080fd5b506106e661132e565b348015610abd57600080fd5b506107c1610acc366004612bbf565b6001600160a01b0316600090815268a20d6e21d0e52553106020526040902054600160a01b90046bffffffffffffffffffffffff1690565b6106e661134b565b348015610b1857600080fd5b506107c1600181565b348015610b2d57600080fd5b50638b78c6d8195461097a565b348015610b4657600080fd5b5061073761135f565b348015610b5b57600080fd5b50610764610b6a366004612b40565b61136e565b348015610b7b57600080fd5b506106e6611384565b348015610b9057600080fd5b506106e6610b9f366004612d28565b6113a5565b348015610bb057600080fd5b506106e6610bbf366004612d4e565b611407565b348015610bd057600080fd5b506106e6611463565b348015610be557600080fd5b506106e6610bf4366004612bbf565b611482565b348015610c0557600080fd5b50610737610c14366004612b6a565b6114bc565b348015610c2557600080fd5b50600354610764906301000000900460ff1681565b348015610c4657600080fd5b506107c1610c55366004612d71565b6001600160a01b03918216600090815268a20d6e21d0e525530d6020908152604080832093909416825291909152205490565b348015610c9457600080fd5b5060035461076490640100000000900460ff1681565b6106e6610cb8366004612bbf565b6115cf565b6106e6610ccb366004612bbf565b61160c565b348015610cdc57600080fd5b506107c1610ceb366004612bbf565b63389a75e1600c908152600091909152602090205490565b8060005260206000f35b6000610d1882611633565b610d355760405163677510db60e11b815260040160405180910390fd5b610d3e82611650565b92915050565b610d50848484846116a5565b610d5a8484611af9565b826001600160a01b0316846001600160a01b031614610d8557610d8584670de0b6b3a7640000611c1a565b50505050565b600068a20d6e21d0e52553088168a20d6e21d0e525530a81610dd968a20d6e21d0e525530f600189901b5b600381901c600090815260209290925260409091205460059190911b60e0161c90565b63ffffffff1681526020810191909152604001600020546001600160a01b03908116915084168114610e66576001600160a01b03808216600090815260038401602090815260408083209388168352929052205460ff16610e66576040517fcfb3b94200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008581526004909201602052604090912080546001600160a01b0387166001600160a01b031990911617905590509392505050565b6000610ea782611633565b610ec45760405163677510db60e11b815260040160405180910390fd5b50600090815268a20d6e21d0e525530c60205260409020546001600160a01b031690565b606060008054610ef790612d9b565b80601f0160208091040260200160405190810160405280929190818152602001828054610f2390612d9b565b8015610f705780601f10610f4557610100808354040283529160200191610f70565b820191906000526020600020905b815481529060010190602001808311610f5357829003601f168201915b5050505050905090565b60008068a20d6e21d0e525530833600081815260058301602090815260408083206001600160a01b038a16808552908352928190208890555187815293945090927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a35060019392505050565b610ffa3382611cff565b50565b611005611d0b565b61100f8282611d26565b5050565b600161101e81611d32565b506003805464ff000000001916640100000000179055565b6001600160a01b038316600090815268a20d6e21d0e525530d6020908152604080832033845290915281205468a20d6e21d0e52553089060001981146110db57808411156110b0576040517f13be252b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b03861660009081526005830160209081526040808320338452909152902084820390555b6110e6868686611d65565b50600195945050505050565b60006202a30067ffffffffffffffff164201905063389a75e1600c5233600052806020600c2055337fdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d600080a250565b6001600160a01b038116600090815268a20d6e21d0e5255310602052604081208054600160581b9004600116820361117e57823b5b9392505050565b54600160581b9004600216151592915050565b610ffa3382611d9d565b6001600160a01b038116600090815268a20d6e21d0e52553106020526040812054610d3e906affffffffffffffffffffff165b60571c600116151590565b60016111e481611d32565b610ffa33611e35565b6111f5611d0b565b61100f8282611cff565b600161120a81611d32565b6003546301000000900460ff1615611235576040516303cb96db60e21b815260040160405180910390fd5b61123f8383611e51565b505050565b600161124f81611d32565b506003805460ff19166001179055565b63389a75e1600c523360005260006020600c2055337ffa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92600080a2565b60016112a681611d32565b60035460ff16156112ca576040516303cb96db60e21b815260040160405180910390fd5b6002610d85838583612e2d565b60016112e281611d32565b600354610100900460ff161561130b576040516303cb96db60e21b815260040160405180910390fd5b6000611318858783612e2d565b506001611326838583612e2d565b505050505050565b600161133981611d32565b506003805461ff001916610100179055565b611353611d0b565b61135d6000611ee9565b565b606060018054610ef790612d9b565b600061137b338484611d65565b50600192915050565b600161138f81611d32565b506003805463ff00000019166301000000179055565b60016113b081611d32565b60035462010000900460ff16156113da576040516303cb96db60e21b815260040160405180910390fd5b506003805463ffffffff90921666010000000000000269ffffffff00000000000019909216919091179055565b600161141281611d32565b600354640100000000900460ff161561143e576040516303cb96db60e21b815260040160405180910390fd5b506003805460ff909216650100000000000265ff000000000019909216919091179055565b600161146e81611d32565b506003805462ff0000191662010000179055565b600161148d81611d32565b60006114a3670de0b6b3a7640000612710612f03565b9050336114b1828286611f27565b610d85816001611e51565b60606114c782611633565b6114e45760405163677510db60e11b815260040160405180910390fd5b600280546114f190612d9b565b1590506115ca57610d3e6002805461150890612d9b565b80601f016020809104026020016040519081016040528092919081815260200182805461153490612d9b565b80156115815780601f1061155657610100808354040283529160200191611581565b820191906000526020600020905b81548152906001019060200180831161156457829003601f168201915b50505050506040518060400160405280600481526020017f7b69647d000000000000000000000000000000000000000000000000000000008152506115c58561211c565b612160565b919050565b6115d7611d0b565b63389a75e1600c52806000526020600c2080544211156115ff57636f5e88186000526004601cfd5b60009055610ffa81611ee9565b611614611d0b565b8060601b61162a57637448fbae6000526004601cfd5b610ffa81611ee9565b60008061163f83611650565b6001600160a01b0316141592915050565b600068a20d6e21d0e525530868a20d6e21d0e525530a8261167e68a20d6e21d0e525530f600187901b610db6565b63ffffffff1681526020810191909152604001600020546001600160a01b03169392505050565b68a20d6e21d0e52553086001600160a01b0384166116d657604051633a954ecd60e21b815260040160405180910390fd5b60008160020160006116ef84600701610db68860011b90565b63ffffffff1681526020810191909152604001600020546001600160a01b0390811691508616811461174d576040517fa114810000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b856001600160a01b0316836001600160a01b0316146117ea576001600160a01b03808716600090815260038401602090815260408083209387168352929052205460ff166117ea5760008481526004830160205260409020546001600160a01b038481169116146117ea576040517f59c896be00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006117f587612283565b9050600061180287612283565b8254909150670de0b6b3a7640000908390601490611836908490600160a01b90046bffffffffffffffffffffffff16612f1a565b82546101009290920a6bffffffffffffffffffffffff81810219909316918316021790915582546001600160a01b038116670de0b6b3a7640000600160a01b9283900484160190921602178255506118ce60078501600188901b61189a848b6122f7565b826020528160031c60005260406000206007831660051b815463ffffffff8482841c188116831b8218845550505050505050565b6000868152600485016020908152604080832080546001600160a01b03191690556001600160a01b038b168352600687018252808320855463ffffffff60801b198116600160801b9182900463ffffffff90811660001901908116909202178755631fffffff600382901c168552925282205460059190911b60e0161c6001600160a01b038a166000908152600687016020526040902063ffffffff9190911691506119c1906119866007880160018b811b01610db6565b63ffffffff1683826020528160031c60005260406000206007831660051b815463ffffffff8482841c188116831b8218845550505050505050565b8154600163ffffffff600160801b80840482169283019091160263ffffffff60801b19909216919091178355611a1360078701611a0184600190811b0190565b61189a60078a0160018d811b01610db6565b6001600160a01b03891660009081526006870160209081526040808320909152600383901c82529020805460e0600584901b1681811c8b1863ffffffff16901b189055611a986007870160018a811b0183826020528160031c60005260406000206007831660051b815463ffffffff8482841c188116831b8218845550505050505050565b5050866001600160a01b0316886001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef670de0b6b3a7640000604051611ae791815260200190565b60405180910390a35050505050505050565b60035465010000000000900460ff166000819003611b1657505050565b6001600160a01b038216600090815268a20d6e21d0e52553106020526040902054670de0b6b3a7640000820290600160a01b90046bffffffffffffffffffffffff1611611b6257505050565b611b996111ce836001600160a01b0316600090815268a20d6e21d0e525531060205260409020546affffffffffffffffffffff1690565b15611ba357505050565b638b78c6d819546001600160a01b0316836001600160a01b031603611bc757505050565b638b78c6d8600c9081526000849052602090205460011615611be857505050565b6040517f0f2acbfc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6003546601000000000000900463ffffffff166000819003611c3b57505050565b600080611c8984611c76876001600160a01b0316600090815268a20d6e21d0e525531060205260409020546affffffffffffffffffffff1690565b6affffffffffffffffffffff16906123b2565b9150915060028110611cb65780800283026301312d00808210611caa578091505b611cb382612429565b50505b6001600160a01b038516600090815268a20d6e21d0e52553106020526040902080546affffffffffffffffffffff19166affffffffffffffffffffff84161790555b5050505050565b61100f8282600061245d565b638b78c6d81954331461135d576382b429006000526004601cfd5b61100f8282600161245d565b638b78c6d819543314610ffa57638b78c6d8600c5233600052806020600c205416610ffa576382b429006000526004601cfd5b611d708383836124b6565b611d7a8383611af9565b816001600160a01b0316836001600160a01b03161461123f5761123f8382611c1a565b6000611da883612283565b8054909150600160581b9004600216151582151514611deb57805460ff600160581b8083048216600218909116026bff0000000000000000000000199091161781555b826001600160a01b03167fb5a1de456fff688115a4f75380060c23c8532d14ff85f687cc871456d642039383604051611e28911515815260200190565b60405180910390a2505050565b60003860003847855af1610ffa5763b12d13eb6000526004601cfd5b61100f82611ea083611e8d866001600160a01b0316600090815268a20d6e21d0e525531060205260409020546affffffffffffffffffffff1690565b6affffffffffffffffffffff1690612a42565b6001600160a01b0391909116600090815268a20d6e21d0e52553106020526040902080546affffffffffffffffffffff19166affffffffffffffffffffff909216919091179055565b638b78c6d81980546001600160a01b039092169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a355565b68a20d6e21d0e52553088054640100000000900463ffffffff1615611f78576040517fead4d2e400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b038216611fb8576040517f39a84a7b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611fc182612a6f565b805467ffffffff0000000019166401000000001781556001810180546001600160a01b0384166001600160a01b03199091161790558315610d85576001600160a01b03831661202357604051633a954ecd60e21b815260040160405180910390fd5b6b0de0b6b39983494c589bffff841115612069576040517fe5cfe95700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80547fffffffffffffffff000000000000000000000000ffffffffffffffffffffffff16600160601b6bffffffffffffffffffffffff86160217815560006120b084612283565b80546001600160a01b03908116600160a01b6bffffffffffffffffffffffff8916021782556040518781529192508516906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a3611cf8846001611d9d565b60606080604051019050602081016040526000815280600019835b928101926030600a8206018453600a900480612137575050819003601f19909101908152919050565b60608351835183516020870196506020860195506020850194506020604051019350828701838311612232576001838203016000602085106121a157508388205b601f851660200360031b89515b8b51818118831c6122195783156121e85783888e20146121e857808a5260019c8d019c90990198848d106121e2575061222d565b506121ae565b60005b8b8101518b8201526020018781106121eb57509b87019b98860198871561221957848d106121e2575061222d565b895260019b8c019b90980197838c106121ae575b505050505b84935060206040510194508781038585030192505b80881015612262578751845260209788019790930192612247565b50506000818401908152602001604052601f19909201918252509392505050565b6001600160a01b038116600090815268a20d6e21d0e5255310602052604081208054909168a20d6e21d0e525530891600160581b900460011690036122f1576001833b156122cf576002175b825460ff909116600160581b026bff0000000000000000000000199091161782555b50919050565b8154600160601b900463ffffffff1668a20d6e21d0e525530860008290036123ab578054819060009061232f9063ffffffff16612f3f565b825463ffffffff8083166101009490940a848102910219909116179092558554600160601b82027fffffffffffffffffffffffffffffffff00000000ffffffffffffffffffffffff9091161786556000908152600283016020526040902080546001600160a01b0386166001600160a01b031990911617905591505b5092915050565b600080605784901c600116156123cd57508290506000612422565b637fffffff620151804204811690603886901c1666ffffffffffffff86168183146123f9575081905060005b60389190911b66ffffffffffffff602887901c811692909201918216179350620de0b690049150505b9250929050565b80600117601052605b8104607882110260005b818114612452576010808020905260010161243c565b5050601051610ffa57fe5b638b78c6d8600c52826000526020600c2080548381178361247f575080841681185b80835580600c5160601c7f715ad5ce61fc9595c7b415289d59cf203f23a94fa06f04af7e489a0a76e1fe26600080a3505050505050565b6001600160a01b0382166124dd57604051633a954ecd60e21b815260040160405180910390fd5b68a20d6e21d0e525530860006124f285612283565b905060006124ff85612283565b905061253a6040518060c001604052806000815260200160008152602001600081526020016000815260200160008152602001600081525090565b825463ffffffff600160801b808304821660808501528454041660a08301526bffffffffffffffffffffffff600160a01b90910416604082018190528511156125af576040517ff4d678b800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040810180518690039081905283546bffffffffffffffffffffffff808316600160a01b9081026001600160a01b03938416178755855481810483168a0160608701819052909216029116178355608082015161261a91670de0b6b3a7640000900480821191030290565b81528154600160581b900460021660000361268957856001600160a01b0316876001600160a01b03160361265657805160808201510360a08201525b612683670de0b6b3a764000082606001518161267457612674612f62565b048260a0015180821191030290565b60208201525b60006126d382602001518360000151016040805180820190915260608152600060208201526040805101828152806020018360051b81016040528183528083602001525050919050565b8251909150156127ff576001600160a01b0388166000908152600686016020526040902060808301518351875463ffffffff6801000000000000000080830482168490038216026bffffffff0000000000000000199092169190911789558754918303908116600160801b0263ffffffff60801b199092169190911787555b60001991909101600381901c600090815260208490526040812054919291600584901b60e0161c60078a01602052633fffffff600282901c16600090815260409020805460c0600684901b1681811c67ffffffffffffffff16901b18905563ffffffff169050600081815260048a016020908152604090912080546001600160a01b0319169055858101805160608f901b600885901b176001178152909101905250808203612752575050505b6020820151156129ca576001600160a01b03871660009081526006860160209081526040822060a08501519185015190929082019061283e878c6122f7565b895460208801516bffffffff000000000000000019821663ffffffff6801000000000000000080850482169093018116909202178c55895463ffffffff60801b1916600160801b86831602178a55919250670de0b6b3a7640000600160601b82046bffffffffffffffffffffffff160491640100000000909104165b6128cb8b600701610db68360011b90565b63ffffffff16156128ea57600101818111156128e5575060015b6128ba565b6020869052600385901c600090815260409020805460e0600588901b1681811c841863ffffffff16901b18905560078b016020908152600282901c600090815260409020805460c0600685901b1681811c9389901b63ffffffff8816179390931867ffffffffffffffff1690921b909118905560019094019361298d878e8360008360200151818360081b8560601b171781526020810185602001525050505050565b6001018181111561299c575060015b8385036128ba578a5463ffffffff9091166401000000000267ffffffff0000000019909116178a5550505050505b805151156129eb5760018501546129eb9082906001600160a01b0316612aa1565b50856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef87604051612a3191815260200190565b60405180910390a350505050505050565b60006001605784901c16151582151514612a68576a800000000000000000000092909218915b5090919050565b630f4599e560005233602052602060006024601c6000855af160016000511416610ffa5763d125259c6000526004601cfd5b81516040810363263c69d68152602080820152815160051b604401915060208183601c84016000875af1600182511416610d8557600081fd5b60006020808352835180602085015260005b81811015612b0857858101830151858201604001528201612aec565b506000604082860101526040601f19601f8301168501019250505092915050565b80356001600160a01b03811681146115ca57600080fd5b60008060408385031215612b5357600080fd5b612b5c83612b29565b946020939093013593505050565b600060208284031215612b7c57600080fd5b5035919050565b600080600060608486031215612b9857600080fd5b612ba184612b29565b9250612baf60208501612b29565b9150604084013590509250925092565b600060208284031215612bd157600080fd5b61117782612b29565b803580151581146115ca57600080fd5b600060208284031215612bfc57600080fd5b61117782612bda565b60008060408385031215612c1857600080fd5b612c2183612b29565b9150612c2f60208401612bda565b90509250929050565b60008083601f840112612c4a57600080fd5b50813567ffffffffffffffff811115612c6257600080fd5b60208301915083602082850101111561242257600080fd5b60008060208385031215612c8d57600080fd5b823567ffffffffffffffff811115612ca457600080fd5b612cb085828601612c38565b90969095509350505050565b60008060008060408587031215612cd257600080fd5b843567ffffffffffffffff80821115612cea57600080fd5b612cf688838901612c38565b90965094506020870135915080821115612d0f57600080fd5b50612d1c87828801612c38565b95989497509550505050565b600060208284031215612d3a57600080fd5b813563ffffffff8116811461117757600080fd5b600060208284031215612d6057600080fd5b813560ff8116811461117757600080fd5b60008060408385031215612d8457600080fd5b612d8d83612b29565b9150612c2f60208401612b29565b600181811c90821680612daf57607f821691505b6020821081036122f157634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b601f82111561123f576000816000526020600020601f850160051c81016020861015612e0e5750805b601f850160051c820191505b8181101561132657828155600101612e1a565b67ffffffffffffffff831115612e4557612e45612dcf565b612e5983612e538354612d9b565b83612de5565b6000601f841160018114612e8d5760008515612e755750838201355b600019600387901b1c1916600186901b178355611cf8565b600083815260209020601f19861690835b82811015612ebe5786850135825560209485019460019092019101612e9e565b5086821015612edb5760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b634e487b7160e01b600052601160045260246000fd5b8082028115828204841417610d3e57610d3e612eed565b6bffffffffffffffffffffffff8281168282160390808211156123ab576123ab612eed565b600063ffffffff808316818103612f5857612f58612eed565b6001019392505050565b634e487b7160e01b600052601260045260246000fdfea2646970667358221220a355f6339ac2b63f9cfd678e5ae6c747b67293b0045023593cc9950e11b0621d64736f6c63430008180033
Deployed Bytecode Sourcemap
388:6952:5:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6410:20:6;29731:22;36213:20;29829:3;29806:26;29909:10;29895:24;;;29891:369;;29953:14;;;;-1:-1:-1;;;;;29953:14:6;29939:10;:28;29935:58;;29976:17;;-1:-1:-1;;;29976:17:6;;;;;;;;;;;29935:58;30029:4;30011:8;:22;30007:36;;;30035:8;;;30007:36;30104:4;36213:20;-1:-1:-1;;;;;30204:26:6;;;30058:13;30204:26;;;:19;;;:26;;;;;;;;30174:4;36213:20;30204:36;;;;;;;;;;;30196:53;;30204:36;;:44;;30247:1;30204:44;;;30243:1;30204:44;30196:53;;:7;:53::i;:::-;29921:339;;29891:369;30304:10;30318;30304:24;30300:255;;30362:14;;;;-1:-1:-1;;;;;30362:14:6;30348:10;:28;30344:58;;30385:17;;-1:-1:-1;;;30385:17:6;;;;;;;;;;;30344:58;30438:4;30420:8;:22;30416:36;;;30444:8;;;30416:36;30494:4;36213:20;30514:30;30530:12;36213:20;30530:8;:12::i;:::-;-1:-1:-1;;;;;30514:30:6;:7;:30::i;:::-;30330:225;30300:255;30631:10;30645;30631:24;30627:491;;30689:14;;;;-1:-1:-1;;;;;30689:14:6;30675:10;:28;30671:58;;30712:17;;-1:-1:-1;;;30712:17:6;;;;;;;;;;;30671:58;30765:4;30747:8;:22;30743:36;;;30771:8;;;30743:36;30839:4;36213:20;30903:4;36213:20;30951:4;36213:20;31020:4;36213:20;31042:41;36213:20;;;;31042:16;:41::i;:::-;31097:10;31105:1;31097:7;:10::i;:::-;30657:461;;;;30627:491;31185:10;31199;31185:24;31181:441;;31243:14;;;;-1:-1:-1;;;;;31243:14:6;31229:10;:28;31225:58;;31266:17;;-1:-1:-1;;;31266:17:6;;;;;;;;;;;31225:58;31319:4;31301:8;:22;31297:36;;;31325:8;;;31297:36;-1:-1:-1;;;;;31519:4:6;36213:20;28872:47;;;;;;;:36;:47;;;;;;;;31396:4;36213:20;28872:57;;;;;;;;;;:68;;-1:-1:-1;;28872:68:6;31445:4;36213:20;31431:24;;28872:68;;;;;;31431:24;31601:10;31609:1;31601:7;:10::i;:::-;31211:411;;;31181:441;31685:10;31699;31685:24;31681:418;;31743:14;;;;-1:-1:-1;;;;;31743:14:6;31729:10;:28;31725:58;;31766:17;;-1:-1:-1;;;31766:17:6;;;;;;;;;;;31725:58;31819:4;31801:8;:22;31797:36;;;31825:8;;;31797:36;31896:4;36213:20;31944:4;36213:20;32013:4;36213:20;32035:53;32051:35;36213:20;;;32051:11;:35::i;32035:53::-;31711:388;;;31681:418;32147:10;32161;32147:24;32143:259;;32205:14;;;;-1:-1:-1;;;;;32205:14:6;32191:10;:28;32187:58;;32228:17;;-1:-1:-1;;;32228:17:6;;;;;;;;;;;32187:58;32281:4;32263:8;:22;32259:36;;;32287:8;;;32259:36;32337:4;36213:20;32357:34;32373:16;36213:20;32373:12;:16::i;32357:34::-;32173:229;32143:259;32451:10;32465;32451:24;32447:275;;32509:14;;;;-1:-1:-1;;;;;32509:14:6;32495:10;:28;32491:58;;32532:17;;-1:-1:-1;;;32532:17:6;;;;;;;;;;;32491:58;32585:4;32567:8;:22;32563:36;;;32591:8;;;32563:36;32660:4;36213:20;32682:29;32690:20;36213;-1:-1:-1;;;;;26751:37:6;26725:7;26751:37;;;:30;:37;;;;;:49;;-1:-1:-1;;;26751:49:6;;;;;26656:151;32690:20;32682:7;:29::i;:::-;32477:245;32447:275;32766:10;32780;32766:24;32762:204;;32824:14;;;;-1:-1:-1;;;;;32824:14:6;32810:10;:28;32806:58;;32847:17;;-1:-1:-1;;;32847:17:6;;;;;;;;;;;32806:58;32900:4;32882:8;:22;32878:36;;;32906:8;;;32878:36;6410:20;26568:33;32929:26;;26568:33;;;;;32682:7;:29::i;32929:26::-;33011:10;33025;33011:24;33007:65;;33051:10;33059:1;33051:7;:10::i;:::-;29721:3368;1659:28:5;;;;;;;;;;-1:-1:-1;1659:28:5;;;;;;;;;;;;;;186:4:8;174:17;;;156:36;;144:2;129:18;1659:28:5;;;;;;;;2586:90;;;;;;;;;;;;;:::i;:::-;;;;;;;:::i;9732:267:6:-;;;;;;;;;;-1:-1:-1;9732:267:6;;;;;:::i;:::-;;:::i;:::-;;;1381:14:8;;1374:22;1356:41;;1344:2;1329:18;9732:267:6;1216:187:8;1509:31:5;;;;;;;;;;-1:-1:-1;1509:31:5;;;;;;;;;;;9026:124:6;;;;;;;;;;-1:-1:-1;6410:20:6;9112:30;-1:-1:-1;;;9112:30:6;;;;9026:124;;;1554:25:8;;;1542:2;1527:18;9026:124:6;1408:177:8;10127:109:1;;;;;;:::i;:::-;;:::i;9588:123::-;;;;;;:::i;:::-;;:::i;11178:139::-;;;;;;;;;;-1:-1:-1;11178:139:1;;;;;:::i;:::-;10769:15;10763:4;10756:29;;;11257:4;10798:18;;;;10898:4;10882:21;;;10876:28;11280:21;;:30;;11178:139;5701:112:5;;;;;;;;;;;;;:::i;11323:497:6:-;;;;;;;;;;-1:-1:-1;11323:497:6;;;;;:::i;:::-;;:::i;9021:617:0:-;;;:::i;23823:278:6:-;;;;;;;;;;-1:-1:-1;23823:278:6;;;;;:::i;:::-;;:::i;24208:98::-;;;;;;;;;;-1:-1:-1;24208:98:6;;;;;:::i;:::-;;:::i;10567:353:1:-;;;;;;;;;;-1:-1:-1;10567:353:1;;;;;:::i;:::-;10769:15;10763:4;10756:29;;;10627:13;10798:18;;;;10898:4;10882:21;;10876:28;;10567:353;8890:74:6;;;;;;;;;;-1:-1:-1;8955:2:6;8890:74;;4996:121:5;;;;;;;;;;-1:-1:-1;4996:121:5;;;;;:::i;:::-;;:::i;7219:119::-;;;;;;;;;;;;;:::i;1547:31::-;;;;;;;;;;-1:-1:-1;1547:31:5;;;;;;;;;;;9856:125:1;;;;;;:::i;:::-;;:::i;26318:117:6:-;;;;;;;;;;-1:-1:-1;26397:31:6;;-1:-1:-1;;;;;26397:31:6;26318:117;;;-1:-1:-1;;;;;2813:55:8;;;2795:74;;2783:2;2768:18;26318:117:6;2649:226:8;10982:134:1;;;;;;;;;;-1:-1:-1;10982:134:1;;;;;:::i;:::-;10769:15;10763:4;10756:29;;;11060:4;10798:18;;;;10898:4;10882:21;;;10876:28;11083:21;:26;;;10982:134;1694:27:5;;;;;;;;;;-1:-1:-1;1694:27:5;;;;;;;;;;;;;;3054:10:8;3042:23;;;3024:42;;3012:2;2997:18;1694:27:5;2880:192:8;6103:181:5;;;;;;;;;;-1:-1:-1;6103:181:5;;;;;:::i;:::-;;:::i;6592:96::-;;;;;;;;;;;;;:::i;9720:456:0:-;;;:::i;6694:162:5:-;;;;;;;;;;-1:-1:-1;6694:162:5;;;;;:::i;:::-;;:::i;6976:237::-;;;;;;;;;;-1:-1:-1;6976:237:5;;;;;:::i;:::-;;:::i;1477:25::-;;;;;;;;;;-1:-1:-1;1477:25:5;;;;;;;;6862:108;;;;;;;;;;;;;:::i;9216:141:6:-;;;;;;;;;;-1:-1:-1;9216:141:6;;;;;:::i;:::-;-1:-1:-1;;;;;9305:37:6;9279:7;9305:37;;;:30;:37;;;;;:45;-1:-1:-1;;;9305:45:6;;;;;9216:141;8762:100:0;;;:::i;743:44:5:-;;;;;;;;;;;;12635:6:1;743:44:5;;11408:182:0;;;;;;;;;;-1:-1:-1;;;11556:18:0;11408:182;;2682:94:5;;;;;;;;;;;;;:::i;10497:147:6:-;;;;;;;;;;-1:-1:-1;10497:147:6;;;;;:::i;:::-;;:::i;5994:103:5:-;;;;;;;;;;;;;:::i;6404:182::-;;;;;;;;;;-1:-1:-1;6404:182:5;;;;;:::i;:::-;;:::i;5819:169::-;;;;;;;;;;-1:-1:-1;5819:169:5;;;;;:::i;:::-;;:::i;6290:108::-;;;;;;;;;;;;;:::i;5391:304::-;;;;;;;;;;-1:-1:-1;5391:304:5;;;;;:::i;:::-;;:::i;2782:278::-;;;;;;;;;;-1:-1:-1;2782:278:5;;;;;:::i;:::-;;:::i;1585:27::-;;;;;;;;;;-1:-1:-1;1585:27:5;;;;;;;;;;;9452:149:6;;;;;;;;;;-1:-1:-1;9452:149:6;;;;;:::i;:::-;-1:-1:-1;;;;;9550:35:6;;;9524:7;9550:35;;;:28;:35;;;;;;;;:44;;;;;;;;;;;;;9452:149;1619:33:5;;;;;;;;;;-1:-1:-1;1619:33:5;;;;;;;;;;;10363:708:0;;;;;;:::i;:::-;;:::i;8348:349::-;;;;;;:::i;:::-;;:::i;11693:435::-;;;;;;;;;;-1:-1:-1;11693:435:0;;;;;:::i;:::-;11963:19;11957:4;11950:33;;;11812:14;11996:26;;;;12106:4;12090:21;;12084:28;;11693:435;36339:179:6;36469:1;36463:4;36456:15;36497:4;36491;36484:18;27253:160;27314:7;27338:11;27346:2;27338:7;:11::i;:::-;27333:44;;27358:19;;-1:-1:-1;;;27358:19:6;;;;;;;;;;;27333:44;27394:12;27403:2;27394:8;:12::i;:::-;27387:19;27253:160;-1:-1:-1;;27253:160:6:o;3563:277:5:-;3694:47;3717:4;3723:2;3727;3731:9;3694:22;:47::i;:::-;3751:31;3773:4;3779:2;3751:21;:31::i;:::-;3804:2;-1:-1:-1;;;;;3796:10:5;:4;-1:-1:-1;;;;;3796:10:5;;3792:41;;3808:25;3822:4;3537:8:6;3808:13:5;:25::i;:::-;3563:277;;;;:::o;28114:509:6:-;28233:7;6410:20;28233:7;28326:16;28233:7;28343:31;28348:4;36887:1;36882:6;;;28354:19;37268:1;37259:10;;;37210:13;37251:19;;;;;;;;;;;;;37290:1;37275:16;;;;;;37251:41;;37136:164;28343:31;28326:49;;;;;;;;;;;;;-1:-1:-1;28326:49:6;;-1:-1:-1;;;;;28326:49:6;;;;-1:-1:-1;28390:18:6;;;;28386:167;;-1:-1:-1;;;;;28429:26:6;;;;;;;:19;;;:26;;;;;;;;:37;;;;;;;;;;;;28424:119;;28493:35;;;;;;;;;;;;;;28424:119;28563:20;;;;:16;;;;:20;;;;;;:30;;-1:-1:-1;;;;;28563:30:6;;-1:-1:-1;;;;;;28563:30:6;;;;;;28611:5;-1:-1:-1;28114:509:6;;;;;:::o;27711:189::-;27776:7;27800:11;27808:2;27800:7;:11::i;:::-;27795:44;;27820:19;;-1:-1:-1;;;27820:19:6;;;;;;;;;;;27795:44;-1:-1:-1;27856:37:6;;;;:33;:37;;;;;;-1:-1:-1;;;;;27856:37:6;;27711:189::o;2586:90:5:-;2632:13;2664:5;2657:12;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2586:90;:::o;9732:267:6:-;9806:4;;6410:20;9888:10;9876:23;;;;:11;;;:23;;;;;;;;-1:-1:-1;;;;;9876:32:6;;;;;;;;;;;;:41;;;9933:37;1554:25:8;;;9876:11:6;;-1:-1:-1;9876:32:6;;9933:37;;1527:18:8;9933:37:6;;;;;;;-1:-1:-1;9988:4:6;;9732:267;-1:-1:-1;;;9732:267:6:o;10127:109:1:-;10198:31;10211:10;10223:5;10198:12;:31::i;:::-;10127:109;:::o;9588:123::-;12517:13:0;:11;:13::i;:::-;9680:24:1::1;9692:4;9698:5;9680:11;:24::i;:::-;9588:123:::0;;:::o;5701:112:5:-;12635:6:1;11991:25;12010:5;11991:18;:25::i;:::-;-1:-1:-1;5778:21:5::1;:28:::0;;-1:-1:-1;;5778:28:5::1;::::0;::::1;::::0;;5701:112::o;11323:497:6:-;-1:-1:-1;;;;;11499:17:6;;11411:4;11499:17;;;:11;:17;;;;;;;;11517:10;11499:29;;;;;;;;6410:20;;-1:-1:-1;;11543:28:6;;11539:215;;11600:7;11591:6;:16;11587:52;;;11616:23;;;;;;;;;;;;;;11587:52;-1:-1:-1;;;;;11681:17:6;;;;;;:11;;;:17;;;;;;;;11699:10;11681:29;;;;;;;11713:16;;;11681:48;;11539:215;11764:27;11774:4;11780:2;11784:6;11764:9;:27::i;:::-;-1:-1:-1;11809:4:6;;11323:497;-1:-1:-1;;;;;11323:497:6:o;9021:617:0:-;9114:15;7972:9;9132:46;;:15;:46;9114:64;;9346:19;9340:4;9333:33;9396:8;9390:4;9383:22;9452:7;9445:4;9439;9429:21;9422:38;9599:8;9552:45;9549:1;9546;9541:67;9248:374;9021:617::o;23823:278:6:-;-1:-1:-1;;;;;23923:33:6;;23883:4;23923:33;;;:30;:33;;;;;23970:7;;-1:-1:-1;;;23970:7:6;;3912:6;23970:40;:45;;23966:69;;35931:14;;24024:11;24017:18;23823:278;-1:-1:-1;;;23823:278:6:o;23966:69::-;24052:7;-1:-1:-1;;;24052:7:6;;4046:6;24052:37;:42;;;23823:278;-1:-1:-1;;23823:278:6:o;24208:98::-;24267:32;24279:10;24291:7;24267:11;:32::i;4996:121:5:-;-1:-1:-1;;;;;22946:37:6;;5056:4:5;22946:37:6;;;:30;:37;;;;;:41;5079:31:5;;22946:41:6;;5079:15:5;438:2:7;1547:28;;;:33;;;1463:124;7219:119:5;12635:6:1;11991:25;12010:5;11991:18;:25::i;:::-;7285:46:5::1;7320:10;7285:34;:46::i;9856:125:1:-:0;12517:13:0;:11;:13::i;:::-;9949:25:1::1;9962:4;9968:5;9949:12;:25::i;6103:181:5:-:0;12635:6:1;11991:25;12010:5;11991:18;:25::i;:::-;6204:15:5::1;::::0;;;::::1;;;6200:36;;;6228:8;;-1:-1:-1::0;;;6228:8:5::1;;;;;;;;;;;6200:36;6246:31;6262:6;6270;6246:15;:31::i;:::-;6103:181:::0;;;:::o;6592:96::-;12635:6:1;11991:25;12010:5;11991:18;:25::i;:::-;-1:-1:-1;6661:13:5::1;:20:::0;;-1:-1:-1;;6661:20:5::1;6677:4;6661:20;::::0;;6592:96::o;9720:456:0:-;9922:19;9916:4;9909:33;9968:8;9962:4;9955:22;10020:1;10013:4;10007;9997:21;9990:32;10151:8;10105:44;10102:1;10099;10094:66;9720:456::o;6694:162:5:-;12635:6:1;11991:25;12010:5;11991:18;:25::i;:::-;6790:13:5::1;::::0;::::1;;6786:34;;;6812:8;;-1:-1:-1::0;;;6812:8:5::1;;;;;;;;;;;6786:34;6830:8;:19;6841:8:::0;;6830;:19:::1;:::i;6976:237::-:0;12635:6:1;11991:25;12010:5;11991:18;:25::i;:::-;7120:19:5::1;::::0;::::1;::::0;::::1;;;7116:40;;;7148:8;;-1:-1:-1::0;;;7148:8:5::1;;;;;;;;;;;7116:40;7166:5;:13;7174:5:::0;;7166;:13:::1;:::i;:::-;-1:-1:-1::0;7189:7:5::1;:17;7199:7:::0;;7189;:17:::1;:::i;:::-;;6976:237:::0;;;;;:::o;6862:108::-;12635:6:1;11991:25;12010:5;11991:18;:25::i;:::-;-1:-1:-1;6937:19:5::1;:26:::0;;-1:-1:-1;;6937:26:5::1;;;::::0;;6862:108::o;8762:100:0:-;12517:13;:11;:13::i;:::-;8834:21:::1;8852:1;8834:9;:21::i;:::-;8762:100::o:0;2682:94:5:-;2730:13;2762:7;2755:14;;;;;:::i;10497:147:6:-;10567:4;10583:33;10593:10;10605:2;10609:6;10583:9;:33::i;:::-;-1:-1:-1;10633:4:6;10497:147;;;;:::o;5994:103:5:-;12635:6:1;11991:25;12010:5;11991:18;:25::i;:::-;-1:-1:-1;6068:15:5::1;:22:::0;;-1:-1:-1;;6068:22:5::1;::::0;::::1;::::0;;5994:103::o;6404:182::-;12635:6:1;11991:25;12010:5;11991:18;:25::i;:::-;6503:19:5::1;::::0;;;::::1;;;6499:40;;;6531:8;;-1:-1:-1::0;;;6531:8:5::1;;;;;;;;;;;6499:40;-1:-1:-1::0;6549:13:5::1;:30:::0;;::::1;::::0;;::::1;::::0;::::1;-1:-1:-1::0;;6549:30:5;;::::1;::::0;;;::::1;::::0;;6404:182::o;5819:169::-;12635:6:1;11991:25;12010:5;11991:18;:25::i;:::-;5910:21:5::1;::::0;;;::::1;;;5906:42;;;5940:8;;-1:-1:-1::0;;;5940:8:5::1;;;;;;;;;;;5906:42;-1:-1:-1::0;5958:15:5::1;:23:::0;;::::1;::::0;;::::1;::::0;::::1;-1:-1:-1::0;;5958:23:5;;::::1;::::0;;;::::1;::::0;;5819:169::o;6290:108::-;12635:6:1;11991:25;12010:5;11991:18;:25::i;:::-;-1:-1:-1;6365:19:5::1;:26:::0;;-1:-1:-1;;6365:26:5::1;::::0;::::1;::::0;;6290:108::o;5391:304::-;12635:6:1;11991:25;12010:5;11991:18;:25::i;:::-;5473:26:5::1;5502:12;3537:8:6;5502:5:5;:12;:::i;:::-;5473:41:::0;-1:-1:-1;5553:10:5::1;5573:64;5473:41:::0;5553:10;5630:6;5573:16:::1;:64::i;:::-;5647:41;5663:18;5683:4;5647:15;:41::i;2782:278::-:0;2842:20;2879:11;2887:2;2879:7;:11::i;:::-;2874:44;;2899:19;;-1:-1:-1;;;2899:19:5;;;;;;;;;;;2874:44;2938:8;2932:22;;;;;:::i;:::-;:27;;-1:-1:-1;2928:126:5;;2984:59;3002:8;2984:59;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3020:22;3039:2;3020:18;:22::i;:::-;2984:17;:59::i;2928:126::-;2782:278;;;:::o;10363:708:0:-;12517:13;:11;:13::i;:::-;10597:19:::1;10591:4;10584:33;10643:12;10637:4;10630:26;10705:4;10699;10689:21;10811:12;10805:19;10792:11;10789:36;10786:157;;;10857:10;10851:4;10844:24;10924:4;10918;10911:18;10786:157;11020:1;10999:23:::0;;11041::::1;11051:12:::0;11041:9:::1;:23::i;8348:349::-:0;12517:13;:11;:13::i;:::-;8520:8:::1;8516:2;8512:17;8502:150;;8562:10;8556:4;8549:24;8633:4;8627;8620:18;8502:150;8671:19;8681:8;8671:9;:19::i;27462:116:6:-:0;27522:4;;27545:12;27554:2;27545:8;:12::i;:::-;-1:-1:-1;;;;;27545:26:6;;;;27462:116;-1:-1:-1;;27462:116:6:o;26942:196::-;27003:7;6410:20;27082:16;27003:7;27099:31;27104:4;36887:1;36882:6;;;27110:19;36798:97;27099:31;27082:49;;;;;;;;;;;;;-1:-1:-1;27082:49:6;;-1:-1:-1;;;;;27082:49:6;;26942:196;-1:-1:-1;;;26942:196:6:o;20880:1466::-;6410:20;-1:-1:-1;;;;;21068:16:6;;21064:52;;21093:23;;-1:-1:-1;;;21093:23:6;;;;;;;;;;;21064:52;21127:13;21143:1;:16;;:49;21160:31;21165:1;:4;;21171:19;21187:2;36887:1;36882:6;;36798:97;21160:31;21143:49;;;;;;;;;;;;;-1:-1:-1;21143:49:6;;-1:-1:-1;;;;;21143:49:6;;;;-1:-1:-1;21207:13:6;;;;21203:54;;21229:28;;;;;;;;;;;;;;21203:54;21285:4;-1:-1:-1;;;;;21272:17:6;:9;-1:-1:-1;;;;;21272:17:6;;21268:244;;-1:-1:-1;;;;;21310:25:6;;;;;;;:19;;;:25;;;;;;;;:36;;;;;;;;;;;;21305:197;;21383:20;;;;:16;;;:20;;;;;;-1:-1:-1;;;;;21370:33:6;;;21383:20;;21370:33;21366:122;;21434:35;;;;;;;;;;;;;;21366:122;21522:35;21560:18;21573:4;21560:12;:18::i;:::-;21522:56;;21588:33;21624:16;21637:2;21624:12;:16::i;:::-;21651:39;;21588:52;;-1:-1:-1;3537:8:6;;21651:39;;:23;;:39;;3537:8;;-1:-1:-1;;;21651:39:6;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;21725:37;;-1:-1:-1;;;;;21725:37:6;;3537:8;-1:-1:-1;;;21725:37:6;;;;;;;;;;;;;;-1:-1:-1;21777:76:6;21782:4;;;-1:-1:-1;36882:6:6;;;21809:43;21834:13;21849:2;21809:24;:43::i;:::-;37528:8;37522:4;37515:22;37570:5;37567:1;37563:13;37557:4;37550:27;37615:4;37609;37599:21;37677:1;37670:5;37666:13;37663:1;37659:21;37739:1;37733:8;37786:10;37870:5;37866:1;37863;37859:9;37855:21;37852:1;37848:29;37845:1;37841:37;37838:1;37834:45;37831:1;37824:56;;;;;37365:531;;;;21777:76;21874:20;;;;:16;;;:20;;;;;;;;21867:27;;-1:-1:-1;;;;;;21867:27:6;;;-1:-1:-1;;;;;21934:13:6;;;;:7;;;:13;;;;;21949:29;;-1:-1:-1;;;;21949:29:6;;-1:-1:-1;;;21949:29:6;;;;;;;;-1:-1:-1;;21949:29:6;;;;;;;;;;37259:10;37268:1;37259:10;;;;37251:19;;;;;;;37290:1;37275:16;;;;;;37251:41;-1:-1:-1;;;;;21998:13:6;;;;;;:7;;;:13;;;;;21909:70;;;;;;-1:-1:-1;21993:67:6;;22013:27;22018:4;;;37048:1;37043:6;;;37042:12;22024:15;36938:133;22013:27;21993:67;;22049:9;37528:8;37522:4;37515:22;37570:5;37567:1;37563:13;37557:4;37550:27;37615:4;37609;37599:21;37677:1;37670:5;37666:13;37663:1;37659:21;37739:1;37733:8;37786:10;37870:5;37866:1;37863;37859:9;37855:21;37852:1;37848:29;37845:1;37841:37;37838:1;37834:45;37831:1;37824:56;;;;;37365:531;;;;21993:67;22087:27;;;;-1:-1:-1;;;22087:27:6;;;;;;;;;;;;-1:-1:-1;;;;22087:27:6;;;;;;;;;22128:63;22133:4;;;22139:22;22151:9;37048:1;37043:6;;;37042:12;;36938:133;22139:22;22163:27;22168:4;;;37048:1;37043:6;;;37042:12;22174:15;36938:133;22128:63;-1:-1:-1;;;;;22210:11:6;;;;;;:7;;;:11;;;;;;;;37515:22;;;37567:1;37563:13;;;37550:27;;37599:21;;37733:8;;37659:21;37663:1;37659:21;;;;37859:9;;;37855:21;;37786:10;37848:29;37841:37;;37834:45;37824:56;;22251:38;22256:4;;;37048:1;37043:6;;;37042:12;22286:1;37528:8;37522:4;37515:22;37570:5;37567:1;37563:13;37557:4;37550:27;37615:4;37609;37599:21;37677:1;37670:5;37666:13;37663:1;37659:21;37739:1;37733:8;37786:10;37870:5;37866:1;37863;37859:9;37855:21;37852:1;37848:29;37845:1;37841:37;37838:1;37834:45;37831:1;37824:56;;;;;37365:531;;;;22251:38;21701:599;;22330:2;-1:-1:-1;;;;;22315:24:6;22324:4;-1:-1:-1;;;;;22315:24:6;;3537:8;22315:24;;;;1554:25:8;;1542:2;1527:18;;1408:177;22315:24:6;;;;;;;;21000:1346;;;;20880:1466;;;;:::o;3846:437:5:-;3967:15;;;;;;;3951:13;4000:10;;;3996:23;;4012:7;3846:437;;:::o;3996:23::-;-1:-1:-1;;;;;9305:37:6;;9279:7;9305:37;;;:30;:37;;;;;:45;3537:8;4053:12:5;;;-1:-1:-1;;;9305:45:6;;;;4036:29:5;4032:42;;4067:7;3846:437;;:::o;4032:42::-;4091:27;:11;4099:2;-1:-1:-1;;;;;22946:37:6;22921:6;22946:37;;;:30;:37;;;;;:41;;;;22858:136;4091:27:5;4087:40;;;4120:7;3846:437;;:::o;4087:40::-;-1:-1:-1;;11556:18:0;-1:-1:-1;;;;;4144:15:5;:4;-1:-1:-1;;;;;4144:15:5;;4140:28;;4161:7;3846:437;;:::o;4140:28::-;10769:15:1;10763:4;10756:29;;;11060:4;10798:18;;;10898:4;10882:21;;10876:28;12635:6;11083:21;:26;4181:41:5;;4215:7;3846:437;;:::o;4181:41::-;4242:24;;;;;;;;;;;;;;4289:560;4403:13;;;;;;;4386:14;4434:11;;;4430:24;;4447:7;4289:560;;:::o;4430:24::-;4468:13;4483:16;4503:29;4524:7;4503:13;4511:4;-1:-1:-1;;;;;22946:37:6;22921:6;22946:37;;;:30;:37;;;;;:41;;;;22858:136;4503:13:5;:20;;;;:29::i;:::-;4467:65;;;;4562:1;4550:8;:13;4546:252;;4600:19;;;:28;;4667:10;4699:20;;;4695:45;;4730:10;4721:19;;4695:45;4758:25;4776:6;4758:17;:25::i;:::-;4565:233;;4546:252;-1:-1:-1;;;;;23318:37:6;;;;;;:30;:37;;;;;:49;;-1:-1:-1;;23318:49:6;;;;;;;4811:21:5;4362:481;;;4289:560;;:::o;4304:117:1:-;4382:32;4395:4;4401:5;4408;4382:12;:32::i;7292:355:0:-;-1:-1:-1;;7498:18:0;7488:8;7485:32;7475:156;;7550:10;7544:4;7537:24;7612:4;7606;7599:18;4053:115:1;4130:31;4143:4;4149:5;4156:4;4130:12;:31::i;5219:802::-;-1:-1:-1;;5507:27:1;5497:8;5494:41;5484:521;;5610:15;5604:4;5597:29;5656:8;5650:4;5643:22;5859:5;5851:4;5845;5835:21;5829:28;5825:40;5815:176;;5902:10;5896:4;5889:24;5968:4;5962;5955:18;3334:223:5;3423:33;3439:4;3445:2;3449:6;3423:15;:33::i;:::-;3466:31;3488:4;3494:2;3466:21;:31::i;:::-;3519:2;-1:-1:-1;;;;;3511:10:5;:4;-1:-1:-1;;;;;3511:10:5;;3507:43;;3523:27;3537:4;3543:6;3523:13;:27::i;24518:283:6:-;24589:21;24613:15;24626:1;24613:12;:15::i;:::-;24643:7;;24589:39;;-1:-1:-1;;;;24643:7:6;;4046:6;24643:37;:42;;24642:53;;;;24638:122;;24711:38;;;-1:-1:-1;;;24711:38:6;;;;;4046:6;24711:38;;;;;-1:-1:-1;;24711:38:6;;;;;;24638:122;24785:1;-1:-1:-1;;;;;24774:20:6;;24788:5;24774:20;;;;1381:14:8;1374:22;1356:41;;1344:2;1329:18;;1216:187;24774:20:6;;;;;;;;24579:222;24518:283;;:::o;3515:406:4:-;3781:4;3769:10;3763:4;3751:10;3736:13;3732:2;3725:5;3720:66;3710:195;;3819:10;3813:4;3806:24;3886:4;3880;3873:18;4855:135:5;4928:55;4936:6;4944:38;4975:6;4944:15;4952:6;-1:-1:-1;;;;;22946:37:6;22921:6;22946:37;;;:30;:37;;;;;:41;;;;22858:136;4944:15:5;:30;;;;:38::i;:::-;-1:-1:-1;;;;;23318:37:6;;;;;;;;:30;:37;;;;;:49;;-1:-1:-1;;23318:49:6;;;;;;;;;;;23245:129;6145:1089:0;-1:-1:-1;;7093:16:0;;-1:-1:-1;;;;;6941:26:0;;;;;;7053:38;7050:1;;7042:78;7177:27;6145:1089::o;6905:998:6:-;6410:20;7118:13;;;;;;;:18;7114:53;;7145:22;;;;;;;;;;;;;;7114:53;-1:-1:-1;;;;;7182:20:6;;7178:54;;7211:21;;;;;;;;;;;;;;7178:54;7242:27;7262:6;7242:19;:27::i;:::-;7280:17;;-1:-1:-1;;7280:17:6;;;;;7296:1;7307:14;;:23;;-1:-1:-1;;;;;7307:23:6;;-1:-1:-1;;;;;;7307:23:6;;;;;;7345:22;;7341:556;;-1:-1:-1;;;;;7387:32:6;;7383:68;;7428:23;;-1:-1:-1;;;7428:23:6;;;;;;;;;;;7383:68;3753:25;7469:18;:32;7465:66;;;7510:21;;;;;;;;;;;;;;7465:66;7546:42;;;;-1:-1:-1;;;7546:42:6;;;;;;;-1:-1:-1;7648:32:6;7661:18;7648:12;:32::i;:::-;7694:60;;-1:-1:-1;;;;;7694:60:6;;;-1:-1:-1;;;7694:60:6;;;;;;;7774;;1554:25:8;;;7694:60:6;;-1:-1:-1;7774:60:6;;;-1:-1:-1;;7774:60:6;;1542:2:8;1527:18;7774:60:6;;;;;;;7849:37;7861:18;7881:4;7849:11;:37::i;1946:1641:3:-;2002:17;2447:4;2440;2434:11;2430:22;2423:29;;2546:4;2541:3;2537:14;2531:4;2524:28;2627:1;2622:3;2615:14;2728:3;2758:1;2754:6;2967:5;2949:402;3005:11;;;;3186:2;3200;3190:13;;3182:22;3005:11;3169:36;3292:2;3282:13;;3312:25;2949:402;3312:25;-1:-1:-1;;3379:13:3;;;-1:-1:-1;;3492:14:3;;;3552:19;;;3492:14;1946:1641;-1:-1:-1;1946:1641:3:o;19186:3338::-;19322:20;19451:7;19445:14;19498:6;19492:13;19549:11;19543:18;19599:4;19590:7;19586:18;19575:29;;19639:4;19631:6;19627:17;19617:27;;19689:4;19676:11;19672:22;19657:37;;19734:4;19727;19721:11;19717:22;19707:32;;19784:13;19775:7;19771:27;19838:13;19824:12;19821:31;19811:1966;;19931:1;19916:12;19904:10;19900:29;19896:37;19959:1;20004:4;19990:12;19987:22;19977:74;;-1:-1:-1;20018:31:3;;;19977:74;20112:4;20098:12;20094:23;20088:4;20084:34;20081:1;20077:42;20151:6;20145:13;20175:1588;20224:7;20218:14;20402:1;20399;20395:9;20392:1;20388:17;20378:1166;;20436:1;20433:433;;;20515:1;20500:12;20491:7;20481:32;20478:39;20468:372;;20553:17;;;20625:1;20671:15;;;;20613:14;;;;20729:29;;;20719:50;;20762:5;;;20719:50;20802:8;20175:1588;;20468:372;20976:1;20961:250;21044:19;;;21038:26;21022:14;;;21015:50;21106:4;21099:12;21150:24;;;20961:250;21140:45;-1:-1:-1;21312:26:3;;;;21246:30;;;;21363:159;;;;21431:16;21422:7;21419:29;21409:50;;21452:5;;;21363:159;21565:17;;21625:1;21659:15;;;;21613:14;;;;21705:29;;;20175:1588;21695:50;20175:1588;20179:2;;;;19811:1966;21814:6;21791:29;;21860:4;21853;21847:11;21843:22;21833:32;;21937:7;21925:10;21921:24;21912:6;21895:15;21891:28;21887:59;21878:68;;22022:213;22041:10;22032:7;22029:23;22022:213;;;22098:14;;22074:39;;22170:4;22203:18;;;;22149:26;;;;22022:213;;;-1:-1:-1;;22304:17:3;22300:25;;;22376:15;;;22270:4;22417:15;22411:4;22404:29;-1:-1:-1;;22258:17:3;;;22470;;;-1:-1:-1;22258:17:3;19186:3338;-1:-1:-1;;;19186:3338:3:o;24967:398:6:-;-1:-1:-1;;;;;25116:16:6;;25026:21;25116:16;;;:13;:16;;;;;25147:7;;25116:16;;6410:20;;-1:-1:-1;;;25147:7:6;;3912:6;25147:40;:45;;25143:216;;3912:6;35931:14;;25266:53;;;4046:6;25283:36;25266:53;25333:15;;;;;;-1:-1:-1;;;25333:15:6;-1:-1:-1;;25333:15:6;;;;;;25143:216;25049:316;24967:398;;;:::o;25526:457::-;25760:26;;-1:-1:-1;;;25760:26:6;;;;6410:20;25657:19;25800:17;;;25796:181;;25848:14;;25850:1;;:12;;25848:14;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;25876:41;;-1:-1:-1;;;25876:41:6;;;;;;;;;-1:-1:-1;25931:30:6;;;:16;;;:30;;;;;:35;;-1:-1:-1;;;;;25931:35:6;;-1:-1:-1;;;;;;25931:35:6;;;;;;25848:14;-1:-1:-1;25796:181:6;25682:301;25526:457;;;;:::o;447:1010:7:-;542:14;;438:2;1547:28;;;;;:33;614:78;;-1:-1:-1;667:6:7;;-1:-1:-1;675:1:7;659:18;;614:78;316:10;746:5;728:15;:23;727:36;;;270:2;798:29;;;797:42;208:16;885:40;;944:23;;;940:127;;-1:-1:-1;1042:10:7;;-1:-1:-1;1011:1:7;940:127;270:2;1098:23;;;;208:16;382:2;1210:31;;;1209:58;;1184:84;;;;1292:47;;;1282:57;;-1:-1:-1;136:14:7;1402:38;;;-1:-1:-1;;447:1010:7;;;;;;:::o;623:493:2:-;757:1;754;751:8;745:4;738:22;805:2;802:1;798:10;792:3;789:1;786:10;782:27;936:1;921:130;953:1;950;947:8;921:130;;1023:4;1007:21;;;994:35;;971:1;964:9;921:130;;;925:14;;1080:4;1074:11;1064:36;;1089:9;2952:967:1;3118:15;3112:4;3105:29;3160:4;3154;3147:18;3210:4;3204;3194:21;3288:8;3282:15;3395:5;3386:7;3383:18;3639:2;3629:62;;-1:-1:-1;3669:19:1;;;3656:33;;3629:62;3763:7;3753:8;3746:25;3895:7;3887:4;3881:11;3877:2;3873:20;3841:30;3838:1;3835;3830:73;;;;2952:967;;;:::o;17271:3197:6:-;-1:-1:-1;;;;;17363:16:6;;17359:52;;17388:23;;-1:-1:-1;;;17388:23:6;;;;;;;;;;;17359:52;6410:20;17422:22;17514:18;17527:4;17514:12;:18::i;:::-;17476:56;;17542:33;17578:16;17591:2;17578:12;:16::i;:::-;17542:52;;17605:23;-1:-1:-1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;17605:23:6;17658:27;;;-1:-1:-1;;;17658:27:6;;;;;17638:17;;;:47;17713:25;;;;17695:15;;;:43;17764:23;-1:-1:-1;;;17764:23:6;;;;17748:13;;;:39;;;17802:22;;17798:56;;;17833:21;;;;;;;;;;;;;;17798:56;17889:13;;;:23;;;;;;;;;17926:47;;;;;;-1:-1:-1;;;17926:47:6;;;-1:-1:-1;;;;;17926:47:6;;;;;;18032:21;;;;;;;:30;;18018:11;;;:44;;;17987:76;;;;;;;;;18112:17;;;;18098:54;;3537:8;;18131:20;36725:8;;;36735:9;;36721:24;;36562:199;18098:54;18078:74;;18171:19;;-1:-1:-1;;;18171:19:6;;4046:6;18171:49;18078:17;18171:54;18167:252;;18257:2;-1:-1:-1;;;;;18249:10:6;:4;-1:-1:-1;;;;;18249:10:6;;18245:71;;18299:17;;18279;;;;:37;18261:15;;;:55;18245:71;18354:50;3537:8;18368:1;:11;;;:18;;;;;:::i;:::-;;18388:1;:15;;;36725:8;;;36735:9;;36721:24;;36562:199;18354:50;18334:17;;;:70;18167:252;18433:29;18465:56;18503:1;:17;;;18483:1;:17;;;:37;-1:-1:-1;;;;;;;;;;;;;;;;;33994:4:6;33987;33981:11;33977:22;34069:1;34063:4;34056:15;34108:4;34102;34098:15;34158:1;34155;34151:9;34143:6;34139:22;34133:4;34126:36;34185:4;34182:1;34175:15;34224:6;34220:1;34214:4;34210:12;34203:28;;;33807:440;;;;18465:56;18540:17;;18433:88;;-1:-1:-1;18540:22:6;18536:690;;-1:-1:-1;;;;;18612:13:6;;18582:27;18612:13;;;:7;;;:13;;;;;18663:17;;;;18728;;18763:45;;;;;;;;;;;;;;;-1:-1:-1;;18763:45:6;;;;;;;;;18826;;18716:29;;;18826:45;;;-1:-1:-1;;;18826:45:6;-1:-1:-1;;;;18826:45:6;;;;;;;;;18919:293;-1:-1:-1;;18973:11:6;;;;37268:1;37259:10;;;18944;37251:19;;;;;;;;;;;18973:11;;;37290:1;37275:16;;;;;37251:41;19035:4;;;38217:2;38274:22;38322:10;38326:1;38322:10;;;;19045:1;38309:24;;;38371:4;38355:21;;38486:8;;38415:18;38419:1;38415:18;;;;38620:9;;;38539:18;38609:29;38602:37;;38595:45;38585:56;;18944:41;;;-1:-1:-1;19079:20:6;;;;:16;;;:20;;;;;;;;19072:27;;-1:-1:-1;;;;;;19072:27:6;;;34568:12;;;34562:19;;34619:2;34615:10;;;34631:1;34627:10;;;34612:26;-1:-1:-1;34609:39:6;34594:55;;34683:17;;;34662:39;;18922:260;19203:7;19190:9;:20;18919:293;;18564:662;;;18536:690;19244:17;;;;:22;19240:1048;;-1:-1:-1;;;;;19314:11:6;;19286:25;19314:11;;;:7;;;:11;;;;;;;19361:15;;;;19420:17;;;;19314:11;;19410:27;;;;19472:43;19497:13;19322:2;19472:24;:43::i;:::-;19552:13;;19661:17;;;;-1:-1:-1;;19634:45:6;;19603:13;19634:45;;;;;;;;;;;;;;;;;19697:41;;-1:-1:-1;;;;19697:41:6;-1:-1:-1;;;19697:41:6;;;;;;;19455:60;;-1:-1:-1;3537:8:6;-1:-1:-1;;;19552:13:6;;;;:20;;19603:13;;;;;19786:444;19818:31;19823:1;:4;;19829:19;19845:2;36887:1;36882:6;;36798:97;19818:31;:36;;;19811:121;;19886:4;;:15;;;19882:27;;;-1:-1:-1;19908:1:6;19882:27;19811:121;;;37522:4;37515:22;;;37567:1;37563:13;;;37557:4;37550:27;;;37615:4;37599:21;;37733:8;;37659:21;37663:1;37659:21;;;;37859:9;;;37855:21;;37786:10;37848:29;37841:37;;37834:45;37824:56;;20037:4;;;38217:2;38274:22;;;38326:1;38322:10;;;38316:4;38309:24;;;38371:4;38355:21;;38486:8;;38415:18;38419:1;38415:18;;;;38620:9;;;38213:19;;;;38238:10;38234:26;;38210:51;38616:21;;;;38539:18;38609:29;38602:37;;;38595:45;;;38585:56;;20063:9;;;;;20096:40;20114:10;20126:2;20130;20134:1;34578;34572:4;34568:12;34562:19;34640:7;34634:2;34631:1;34627:10;34623:1;34619:2;34615:10;34612:26;34609:39;34601:6;34594:55;34695:4;34687:6;34683:17;34679:1;34673:4;34669:12;34662:39;;34350:367;;;;;20096:40;20162:4;;:15;;;20158:27;;;-1:-1:-1;20184:1:6;20158:27;20223:5;20212:7;:16;19786:444;;20247:26;;;;;;;;-1:-1:-1;;20247:26:6;;;;;;-1:-1:-1;;;;;19240:1048:6;20306:15;;:22;:27;20302:109;;20381:14;;;;20353:43;;20369:10;;-1:-1:-1;;;;;20381:14:6;20353:15;:43::i;:::-;17865:2556;20450:2;-1:-1:-1;;;;;20435:26:6;20444:4;-1:-1:-1;;;;;20435:26:6;;20454:6;20435:26;;;;1554:25:8;;1542:2;1527:18;;1408:177;20435:26:6;;;;;;;;17349:3119;;;;17271:3197;;;:::o;1593:225:7:-;1668:6;1547:28;438:2;1547:28;;;;:33;;1690:31;;;;1686:103;;1754:23;1737:41;;;;;1686:103;-1:-1:-1;1805:6:7;;1593:225;-1:-1:-1;1593:225:7:o;29089:467:6:-;29240:10;29234:4;29227:24;29311:8;29305:4;29298:22;29408:4;29402;29396;29390;29387:1;29379:6;29372:5;29367:46;29363:1;29356:4;29350:11;29347:18;29343:71;29333:207;;29447:10;29441:4;29434:24;29521:4;29515;29508:18;34813:622;34978:1;34972:8;35012:4;35006;35002:15;35070:10;35067:1;35060:21;35144:4;35137;35134:1;35130:12;35123:26;35239:4;35233:11;35230:1;35226:19;35220:4;35216:30;35207:39;;35364:4;35361:1;35358;35351:4;35348:1;35344:12;35341:1;35333:6;35326:5;35321:48;35317:1;35313;35307:8;35304:15;35300:70;35290:129;;35400:4;35397:1;35390: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:196::-;824:20;;-1:-1:-1;;;;;873:54:8;;863:65;;853:93;;942:1;939;932:12;957:254;1025:6;1033;1086:2;1074:9;1065:7;1061:23;1057:32;1054:52;;;1102:1;1099;1092:12;1054:52;1125:29;1144:9;1125:29;:::i;:::-;1115:39;1201:2;1186:18;;;;1173:32;;-1:-1:-1;;;957:254:8:o;1590:180::-;1649:6;1702:2;1690:9;1681:7;1677:23;1673:32;1670:52;;;1718:1;1715;1708:12;1670:52;-1:-1:-1;1741:23:8;;1590:180;-1:-1:-1;1590:180:8:o;1775:328::-;1852:6;1860;1868;1921:2;1909:9;1900:7;1896:23;1892:32;1889:52;;;1937:1;1934;1927:12;1889:52;1960:29;1979:9;1960:29;:::i;:::-;1950:39;;2008:38;2042:2;2031:9;2027:18;2008:38;:::i;:::-;1998:48;;2093:2;2082:9;2078:18;2065:32;2055:42;;1775:328;;;;;:::o;2108:186::-;2167:6;2220:2;2208:9;2199:7;2195:23;2191:32;2188:52;;;2236:1;2233;2226:12;2188:52;2259:29;2278:9;2259:29;:::i;2299:160::-;2364:20;;2420:13;;2413:21;2403:32;;2393:60;;2449:1;2446;2439:12;2464:180;2520:6;2573:2;2561:9;2552:7;2548:23;2544:32;2541:52;;;2589:1;2586;2579:12;2541:52;2612:26;2628:9;2612:26;:::i;3077:254::-;3142:6;3150;3203:2;3191:9;3182:7;3178:23;3174:32;3171:52;;;3219:1;3216;3209:12;3171:52;3242:29;3261:9;3242:29;:::i;:::-;3232:39;;3290:35;3321:2;3310:9;3306:18;3290:35;:::i;:::-;3280:45;;3077:254;;;;;:::o;3336:348::-;3388:8;3398:6;3452:3;3445:4;3437:6;3433:17;3429:27;3419:55;;3470:1;3467;3460:12;3419:55;-1:-1:-1;3493:20:8;;3536:18;3525:30;;3522:50;;;3568:1;3565;3558:12;3522:50;3605:4;3597:6;3593:17;3581:29;;3657:3;3650:4;3641:6;3633;3629:19;3625:30;3622:39;3619:59;;;3674:1;3671;3664:12;3689:411;3760:6;3768;3821:2;3809:9;3800:7;3796:23;3792:32;3789:52;;;3837:1;3834;3827:12;3789:52;3877:9;3864:23;3910:18;3902:6;3899:30;3896:50;;;3942:1;3939;3932:12;3896:50;3981:59;4032:7;4023:6;4012:9;4008:22;3981:59;:::i;:::-;4059:8;;3955:85;;-1:-1:-1;3689:411:8;-1:-1:-1;;;;3689:411:8:o;4105:721::-;4197:6;4205;4213;4221;4274:2;4262:9;4253:7;4249:23;4245:32;4242:52;;;4290:1;4287;4280:12;4242:52;4330:9;4317:23;4359:18;4400:2;4392:6;4389:14;4386:34;;;4416:1;4413;4406:12;4386:34;4455:59;4506:7;4497:6;4486:9;4482:22;4455:59;:::i;:::-;4533:8;;-1:-1:-1;4429:85:8;-1:-1:-1;4621:2:8;4606:18;;4593:32;;-1:-1:-1;4637:16:8;;;4634:36;;;4666:1;4663;4656:12;4634:36;;4705:61;4758:7;4747:8;4736:9;4732:24;4705:61;:::i;:::-;4105:721;;;;-1:-1:-1;4785:8:8;-1:-1:-1;;;;4105:721:8:o;4831:276::-;4889:6;4942:2;4930:9;4921:7;4917:23;4913:32;4910:52;;;4958:1;4955;4948:12;4910:52;4997:9;4984:23;5047:10;5040:5;5036:22;5029:5;5026:33;5016:61;;5073:1;5070;5063:12;5112:269;5169:6;5222:2;5210:9;5201:7;5197:23;5193:32;5190:52;;;5238:1;5235;5228:12;5190:52;5277:9;5264:23;5327:4;5320:5;5316:16;5309:5;5306:27;5296:55;;5347:1;5344;5337:12;5386:260;5454:6;5462;5515:2;5503:9;5494:7;5490:23;5486:32;5483:52;;;5531:1;5528;5521:12;5483:52;5554:29;5573:9;5554:29;:::i;:::-;5544:39;;5602:38;5636:2;5625:9;5621:18;5602:38;:::i;5651:437::-;5730:1;5726:12;;;;5773;;;5794:61;;5848:4;5840:6;5836:17;5826:27;;5794:61;5901:2;5893:6;5890:14;5870:18;5867:38;5864:218;;-1:-1:-1;;;5935:1:8;5928:88;6039:4;6036:1;6029:15;6067:4;6064:1;6057:15;6093:184;-1:-1:-1;;;6142:1:8;6135:88;6242:4;6239:1;6232:15;6266:4;6263:1;6256:15;6408:543;6510:2;6505:3;6502:11;6499:446;;;6546:1;6570:5;6567:1;6560:16;6614:4;6611:1;6601:18;6684:2;6672:10;6668:19;6665:1;6661:27;6655:4;6651:38;6720:4;6708:10;6705:20;6702:47;;;-1:-1:-1;6743:4:8;6702:47;6798:2;6793:3;6789:12;6786:1;6782:20;6776:4;6772:31;6762:41;;6853:82;6871:2;6864:5;6861:13;6853:82;;;6916:17;;;6897:1;6886:13;6853:82;;7127:1206;7251:18;7246:3;7243:27;7240:53;;;7273:18;;:::i;:::-;7302:94;7392:3;7352:38;7384:4;7378:11;7352:38;:::i;:::-;7346:4;7302:94;:::i;:::-;7422:1;7447:2;7442:3;7439:11;7464:1;7459:616;;;;8119:1;8136:3;8133:93;;;-1:-1:-1;8192:19:8;;;8179:33;8133:93;-1:-1:-1;;7084:1:8;7080:11;;;7076:24;7072:29;7062:40;7108:1;7104:11;;;7059:57;8239:78;;7432:895;;7459:616;6355:1;6348:14;;;6392:4;6379:18;;-1:-1:-1;;7495:17:8;;;7596:9;7618:229;7632:7;7629:1;7626:14;7618:229;;;7721:19;;;7708:33;7693:49;;7828:4;7813:20;;;;7781:1;7769:14;;;;7648:12;7618:229;;;7622:3;7875;7866:7;7863:16;7860:159;;;7999:1;7995:6;7989:3;7983;7980:1;7976:11;7972:21;7968:34;7964:39;7951:9;7946:3;7942:19;7929:33;7925:79;7917:6;7910:95;7860:159;;;8062:1;8056:3;8053:1;8049:11;8045:19;8039:4;8032:33;7432:895;;7127:1206;;;:::o;8338:184::-;-1:-1:-1;;;8387:1:8;8380:88;8487:4;8484:1;8477:15;8511:4;8508:1;8501:15;8527:168;8600:9;;;8631;;8648:15;;;8642:22;;8628:37;8618:71;;8669:18;;:::i;8700:191::-;8768:26;8827:10;;;8815;;;8811:27;;8850:12;;;8847:38;;;8865:18;;:::i;8896:201::-;8934:3;8962:10;9007:2;9000:5;8996:14;9034:2;9025:7;9022:15;9019:41;;9040:18;;:::i;:::-;9089:1;9076:15;;8896:201;-1:-1:-1;;;8896:201:8:o;9102:184::-;-1:-1:-1;;;9151:1:8;9144:88;9251:4;9248:1;9241:15;9275:4;9272:1;9265:15
Swarm Source
ipfs://a355f6339ac2b63f9cfd678e5ae6c747b67293b0045023593cc9950e11b0621d
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.