ERC-20
Overview
Max Total Supply
18,861,500 $VLN
Holders
465
Market
Onchain Market Cap
$0.00
Circulating Supply Market Cap
-
Other Info
Token Contract (WITH 18 Decimals)
Loading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
Contract Source Code Verified (Exact Match)
Contract Name:
MAVILLAIN
Compiler Version
v0.8.24+commit.e11b9ed9
Optimization Enabled:
Yes with 200 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "./DN404.sol"; import "./ExtendedDN404Mirror.sol"; import {Ownable} from "solady/src/auth/Ownable.sol"; import {LibString} from "solady/src/utils/LibString.sol"; import {SafeTransferLib} from "solady/src/utils/SafeTransferLib.sol"; import {MerkleProofLib} from "solady/src/utils/MerkleProofLib.sol"; import "@openzeppelin/contracts/access/AccessControl.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; contract MAVILLAIN is DN404, AccessControl, Ownable, ReentrancyGuard { // Constants at the top bytes32 public constant ADMIN_ROLE = keccak256("ADMIN_ROLE"); bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); bytes32 public constant AIRDROP_ROLE = keccak256("AIRDROP_ROLE"); bytes4 private constant ERC20_INTERFACE_ID = 0x36372b07; bytes4 private constant ERC165_INTERFACE_ID = 0x01ffc9a7; bytes4 private constant ERC721_INTERFACE_ID = 0x80ac58cd; string private constant TOKEN_NAME = "MUTANT ALIENS VILLAIN"; string private constant TOKEN_SYMBOL = "$VLN"; string private constant NFT_NAME = "MUTANT ALIENS VILLAIN"; string private constant NFT_SYMBOL = "MAV"; // Error definitions error InvalidAirdropParameters(); error BatchAirdropFailed(); error FractionalTransferNotAllowed(); error InvalidPhaseTransition(uint256 current, uint256 requested); error InsufficientPayment(uint256 required, uint256 provided); error MaxSupplyExceeded(uint256 requested, uint256 remaining); error PhaseNotConfigured(uint256 phase); error InvalidTimePeriod(uint256 startTime, uint256 endTime); error InvalidProof(address user, bytes32 merkleRoot); error PhaseNotActive(uint256 phase); error PhasePaused(uint256 phase); error ExceedsPhaseLimit(uint256 requested, uint256 allowed); error InvalidMintRatio(uint256 oldRatio, uint256 newRatio); error InvalidOperation(string reason); error InvalidPrice(); error NotLive(); error PhaseAlreadyExists(uint256 phase); error NotAllowlisted(address user); error AllowlistAmountExceeded(uint256 requested, uint256 allowed); error AllowlistValidationFailed(address user, uint256 phase, string reason); error MintValidationFailed(string reason); error ExceedsTransactionLimit(uint256 requested, uint256 maximum); error InvalidMintAmount(uint256 provided, uint256 maximum, string reason); error InvalidPhaseState(uint256 phase, bool isPaused, bool isConfigured); struct PhaseConfig { uint96 price; uint32 maxPerWallet; uint32 maxSupplyForPhase; bool isConfigured; bool isPaused; bool requiresAllowlist; uint256 totalMinted; bytes32 merkleRoot; mapping(address => uint256) mintedAmount; } struct PhaseStatus { bool isActive; bool isPaused; uint256 totalMinted; uint96 price; uint32 maxPerWallet; uint32 maxSupplyForPhase; bool requiresAllowlist; bytes32 merkleRoot; } // Events event PhaseConfigured( uint256 indexed phase, uint96 price, uint32 maxPerWallet, uint32 maxSupplyForPhase, bytes32 merkleRoot, bool requiresAllowlist ); struct AllowlistValidationParams { address user; uint256 phase; uint256 amount; uint256 maxAllowedAmount; bytes32[] proof; } struct MintParams { address receiver; uint256 amount; bool isNFT; uint256 maxAllowedAmount; bytes32[] proof; uint256 phase; } event MintCompleted( address indexed user, address indexed receiver, uint256 amount, uint256 price, uint256 indexed phase, bool isNFT, bool isAllowlist ); event EmergencyRecovery( address indexed token, address indexed to, uint256 amount ); uint256 public maxPerTransaction; event PhaseUpdated(uint256 indexed oldPhase, uint256 indexed newPhase); event ConfigurationUpdated(string indexed parameter, uint256 newValue); event EmergencyAction(string indexed action, uint256 timestamp); event WithdrawTest(address indexed to, uint256 amount, uint256 timestamp); event PhaseStatusChanged(uint256 indexed phase, bool isPaused); event PhaseRemoved(uint256 indexed phase); event AirdropCompleted( address indexed recipient, uint256 amount, bool isNFT ); event BatchAirdropCompleted( address[] recipients, uint256[] amounts, bool isNFT ); event ExternalMintCompleted( address indexed recipient, uint256 amount, bool isNFT ); // Immutable state variables address public immutable CAL; MUTANT_ALIENS_VILLAIN public immutable mirror; // Storage variables address public withdrawAddress; string private _name; string private _symbol; string private _baseURI; address public forwarder; uint256 public currentPhase; mapping(uint256 => PhaseConfig) public phaseConfigs; mapping(uint256 => mapping(address => uint32)) public mintCounts; mapping(uint256 => uint256) public phaseTotalMints; uint32 public totalMinted; uint32 public maxPerWallet = 20000; uint32 public maxSupply = 20000; uint256 private _mintRatio = 1000; bool public live; constructor( address initialSupplyOwner, address contractAllowListProxy, address initialWithdrawAddress, address initialForwarder ) { _initializeOwner(msg.sender); _setupRole(DEFAULT_ADMIN_ROLE, msg.sender); _setupRole(ADMIN_ROLE, msg.sender); _setupRole(MINTER_ROLE, msg.sender); _setupRole(AIRDROP_ROLE, msg.sender); withdrawAddress = initialWithdrawAddress; forwarder = initialForwarder; CAL = contractAllowListProxy; mirror = new MUTANT_ALIENS_VILLAIN(msg.sender, CAL, withdrawAddress); _setSkipNFT(initialSupplyOwner, false); _initializeDN404( 16000 * _unit(), initialSupplyOwner, address(mirror) ); } // ERC20 Core Functions function name() public view override returns (string memory) { return msg.sender == address(mirror) ? NFT_NAME : TOKEN_NAME; } function symbol() public view override returns (string memory) { return msg.sender == address(mirror) ? NFT_SYMBOL : TOKEN_SYMBOL; } // Interface support function supportsInterface( bytes4 interfaceId ) public view virtual override(AccessControl) returns (bool) { if (interfaceId == ERC20_INTERFACE_ID) return true; if (interfaceId == ERC165_INTERFACE_ID) return true; if (interfaceId == ERC721_INTERFACE_ID) return false; return AccessControl.supportsInterface(interfaceId); } // Internal functions function _unit() internal view override returns (uint256) { return _mintRatio * 10 ** decimals(); } // Modifiers modifier onlyAdmin() { require(hasRole(ADMIN_ROLE, msg.sender), "Caller is not an admin"); _; } modifier onlyLive() { if (!live) revert NotLive(); _; } modifier callerIsUser() { require( tx.origin == msg.sender || msg.sender == forwarder, "The caller is another contract and not an authorized forwarder." ); _; } modifier validatePhase(uint256 phase) { PhaseConfig storage config = phaseConfigs[phase]; if (!config.isConfigured) revert PhaseNotConfigured(phase); if (config.isPaused) revert PhasePaused(phase); _; } modifier validateMintRequest( uint256 phase, uint256 price, uint256 amount ) { if (msg.value != price * amount) revert InvalidPrice(); uint256 newTotalMinted; unchecked { newTotalMinted = totalMinted + amount; } if (newTotalMinted > maxSupply) revert MaxSupplyExceeded(amount, maxSupply - totalMinted); PhaseConfig storage config = phaseConfigs[phase]; if (config.maxSupplyForPhase > 0) { uint256 newPhaseMinted; unchecked { newPhaseMinted = phaseTotalMints[phase] + amount; } if (newPhaseMinted > config.maxSupplyForPhase) revert ExceedsPhaseLimit( amount, config.maxSupplyForPhase - phaseTotalMints[phase] ); } _; unchecked { totalMinted = uint32(newTotalMinted); phaseTotalMints[phase] += amount; } } modifier validateReceiverMintLimit( uint256 phase, address minter, address receiver, uint256 amount ) { PhaseConfig storage config = phaseConfigs[phase]; uint256 receiverPhaseMints = mintCounts[phase][receiver]; uint256 maxPerWalletInPhase = config.maxPerWallet; if (receiverPhaseMints + amount > maxPerWalletInPhase) { revert ExceedsPhaseLimit( amount, maxPerWalletInPhase - receiverPhaseMints ); } _; unchecked { mintCounts[phase][receiver] = uint32(receiverPhaseMints + amount); } } function _validateAllowlist( AllowlistValidationParams memory params ) internal view { PhaseConfig storage config = phaseConfigs[params.phase]; if (!config.requiresAllowlist) { return; } bytes32 leaf = keccak256( abi.encodePacked(params.user, params.maxAllowedAmount) ); if (!MerkleProofLib.verify(params.proof, config.merkleRoot, leaf)) { revert InvalidProof(params.user, config.merkleRoot); } uint256 totalMintedInPhase = config.mintedAmount[params.user]; if (totalMintedInPhase + params.amount > params.maxAllowedAmount) { revert AllowlistAmountExceeded( params.amount, params.maxAllowedAmount - totalMintedInPhase ); } } function _processMint(MintParams memory params) internal { if (params.amount > maxPerTransaction) { revert ExceedsTransactionLimit({ requested: params.amount, maximum: maxPerTransaction }); } PhaseConfig storage config = phaseConfigs[params.phase]; _validateAllowlist( AllowlistValidationParams({ user: params.receiver, phase: params.phase, amount: params.amount, maxAllowedAmount: params.maxAllowedAmount, proof: params.proof }) ); uint256 mintAmount = params.isNFT ? params.amount * _unit() : params.amount * 10 ** decimals(); _mint(params.receiver, mintAmount); unchecked { uint256 newTotalMinted = config.totalMinted + params.amount; config.totalMinted = newTotalMinted; config.mintedAmount[params.receiver] += params.amount; totalMinted += uint32(params.amount); } emit MintCompleted( msg.sender, params.receiver, params.amount, config.price, params.phase, params.isNFT, config.requiresAllowlist ); } // Public minting functions function mint( uint256 amount, bool isNFT, uint256 maxAllowedAmount, bytes32[] calldata proof ) external payable onlyLive validatePhase(currentPhase) validateMintRequest( currentPhase, phaseConfigs[currentPhase].price, amount ) validateReceiverMintLimit(currentPhase, msg.sender, msg.sender, amount) nonReentrant { PhaseConfig storage config = phaseConfigs[currentPhase]; if (config.requiresAllowlist) { require(proof.length > 0, "Allowlist proof required"); } else { maxAllowedAmount = config.maxPerWallet; } _processMint( MintParams({ receiver: msg.sender, amount: amount, isNFT: isNFT, maxAllowedAmount: maxAllowedAmount, proof: proof, phase: currentPhase }) ); } function mintWithReceiver( address receiver, uint256 amount, bool isNFT, uint256 maxAllowedAmount, bytes32[] calldata proof ) external payable callerIsUser onlyLive validatePhase(currentPhase) validateMintRequest( currentPhase, phaseConfigs[currentPhase].price, amount ) validateReceiverMintLimit(currentPhase, msg.sender, receiver, amount) nonReentrant { PhaseConfig storage config = phaseConfigs[currentPhase]; if (config.requiresAllowlist) { require(proof.length > 0, "Allowlist proof required"); } else { maxAllowedAmount = config.maxPerWallet; } _processMint( MintParams({ receiver: receiver, amount: amount, isNFT: isNFT, maxAllowedAmount: maxAllowedAmount, proof: proof, phase: currentPhase }) ); } // Airdrop functions function airdrop( address recipient, uint256 amount, bool isNFT ) external onlyRole(AIRDROP_ROLE) { if (recipient == address(0) || amount == 0) revert InvalidAirdropParameters(); uint256 mintAmount = isNFT ? amount * _unit() : amount * 10 ** decimals(); _mint(recipient, mintAmount); emit AirdropCompleted(recipient, amount, isNFT); } function batchAirdrop( address[] calldata recipients, uint256[] calldata amounts, bool isNFT ) external onlyRole(AIRDROP_ROLE) { if (recipients.length != amounts.length || recipients.length == 0) revert InvalidAirdropParameters(); for (uint256 i = 0; i < recipients.length; i++) { if (recipients[i] == address(0)) revert InvalidAirdropParameters(); uint256 mintAmount = isNFT ? amounts[i] * _unit() : amounts[i] * 10 ** decimals(); _mint(recipients[i], mintAmount); } emit BatchAirdropCompleted(recipients, amounts, isNFT); } function externalMint( address recipient, uint256 amount, bool isNFT ) external onlyRole(MINTER_ROLE) { if (recipient == address(0) || amount == 0) revert InvalidAirdropParameters(); uint256 mintAmount = isNFT ? amount * _unit() : amount * 10 ** decimals(); _mint(recipient, mintAmount); emit ExternalMintCompleted(recipient, amount, isNFT); } // Admin functions function setPhase(uint256 newPhase) external onlyRole(ADMIN_ROLE) { if (!phaseConfigs[newPhase].isConfigured) revert PhaseNotConfigured(newPhase); uint256 oldPhase = currentPhase; currentPhase = newPhase; emit PhaseUpdated(oldPhase, newPhase); } function configurePhase( uint256 phase, uint96 price, uint32 phaseMaxPerWallet, uint32 maxSupplyForPhase, bytes32 merkleRoot, bool requiresAllowlist ) external onlyRole(ADMIN_ROLE) { PhaseConfig storage config = phaseConfigs[phase]; if (config.isConfigured) revert PhaseAlreadyExists(phase); config.price = price; config.maxPerWallet = phaseMaxPerWallet; config.maxSupplyForPhase = maxSupplyForPhase; config.merkleRoot = merkleRoot; config.requiresAllowlist = requiresAllowlist; config.isConfigured = true; emit PhaseConfigured( phase, price, phaseMaxPerWallet, maxSupplyForPhase, merkleRoot, requiresAllowlist ); } function resetPhaseConfig(uint256 phase) external onlyRole(ADMIN_ROLE) { delete phaseConfigs[phase]; emit PhaseRemoved(phase); } function togglePhase(uint256 phase) external onlyRole(ADMIN_ROLE) { PhaseConfig storage config = phaseConfigs[phase]; if (!config.isConfigured) revert PhaseNotConfigured(phase); config.isPaused = !config.isPaused; emit PhaseStatusChanged(phase, config.isPaused); } function setBaseURI( string calldata baseURI_ ) external onlyRole(ADMIN_ROLE) nonReentrant { _baseURI = baseURI_; } function setPhasePrice( uint256 phase, uint96 newPrice ) external onlyRole(ADMIN_ROLE) { if (!phaseConfigs[phase].isConfigured) revert PhaseNotConfigured(phase); phaseConfigs[phase].price = newPrice; emit ConfigurationUpdated( string(abi.encodePacked("price_phase_", LibString.toString(phase))), newPrice ); } function setMintRatio(uint256 newRatio) external onlyRole(ADMIN_ROLE) { if (newRatio == 0) revert InvalidMintRatio(_mintRatio, newRatio); _mintRatio = newRatio; emit ConfigurationUpdated("mintRatio", newRatio); } function setMaxPerWallet( uint32 _maxPerWallet ) external onlyRole(ADMIN_ROLE) { maxPerWallet = _maxPerWallet; emit ConfigurationUpdated("maxPerWallet", _maxPerWallet); } function setPhaseMaxPerWallet( uint256 phase, uint32 newMaxPerWallet ) external onlyRole(ADMIN_ROLE) { if (!phaseConfigs[phase].isConfigured) revert PhaseNotConfigured(phase); phaseConfigs[phase].maxPerWallet = newMaxPerWallet; emit ConfigurationUpdated( string( abi.encodePacked( "maxPerWallet_phase_", LibString.toString(phase) ) ), newMaxPerWallet ); } function setMaxSupply(uint32 _maxSupply) external onlyRole(ADMIN_ROLE) { if (_maxSupply < totalMinted) revert InvalidOperation("New max supply below total minted"); maxSupply = _maxSupply; emit ConfigurationUpdated("maxSupply", _maxSupply); } function setPhaseMaxSupply( uint256 phase, uint32 newMaxSupply ) external onlyRole(ADMIN_ROLE) { if (!phaseConfigs[phase].isConfigured) revert PhaseNotConfigured(phase); if (newMaxSupply < phaseTotalMints[phase]) revert InvalidOperation( "New phase max supply below phase total minted" ); phaseConfigs[phase].maxSupplyForPhase = newMaxSupply; emit ConfigurationUpdated( string( abi.encodePacked("maxSupply_phase_", LibString.toString(phase)) ), newMaxSupply ); } function toggleLive() external onlyRole(ADMIN_ROLE) { live = !live; } function setMerkleRoot( uint256 phase, bytes32 newRoot ) external onlyRole(ADMIN_ROLE) { if (!phaseConfigs[phase].isConfigured) revert PhaseNotConfigured(phase); if (!phaseConfigs[phase].requiresAllowlist) revert InvalidOperation("Phase does not require allowlist"); phaseConfigs[phase].merkleRoot = newRoot; emit ConfigurationUpdated( string( abi.encodePacked("merkleRoot_phase_", LibString.toString(phase)) ), uint256(newRoot) ); } function setMaxPerTransaction( uint256 _maxPerTransaction ) external onlyRole(ADMIN_ROLE) { maxPerTransaction = _maxPerTransaction; emit ConfigurationUpdated("maxPerTransaction", _maxPerTransaction); } // View functions function getMerkleRoot(uint256 phase) external view returns (bytes32) { if (!phaseConfigs[phase].isConfigured) revert PhaseNotConfigured(phase); if (!phaseConfigs[phase].requiresAllowlist) revert InvalidOperation("Phase does not require allowlist"); return phaseConfigs[phase].merkleRoot; } function tokenURI( uint256 tokenId ) public view override returns (string memory result) { if (bytes(_baseURI).length != 0) { result = string( abi.encodePacked(_baseURI, LibString.toString(tokenId), ".json") ); } } function getNextTokenId() public view returns (uint32) { DN404Storage storage $ = _getDN404Storage(); return $.nextTokenId; } function getAllowlistMintedAmount( uint256 phase, address user ) external view returns (uint256) { return phaseConfigs[phase].mintedAmount[user]; } function getPhaseStatus( uint256 phase ) external view returns (PhaseStatus memory) { PhaseConfig storage config = phaseConfigs[phase]; return PhaseStatus({ isActive: config.isConfigured, isPaused: config.isPaused, totalMinted: getTotalMintedInPhase(phase), price: config.price, maxPerWallet: config.maxPerWallet, maxSupplyForPhase: config.maxSupplyForPhase, requiresAllowlist: config.requiresAllowlist, merkleRoot: config.merkleRoot }); } // Internal functions function getTotalMintedInPhase( uint256 phase ) internal view returns (uint256) { PhaseConfig storage config = phaseConfigs[phase]; return config.totalMinted; } // Withdrawal functions function withdraw() external nonReentrant onlyOwner { require(withdrawAddress != address(0), "Withdraw address not set"); SafeTransferLib.safeTransferAllETH(withdrawAddress); emit EmergencyAction("withdraw", block.timestamp); } function withdrawAmount(uint256 amount) external nonReentrant onlyOwner { require(withdrawAddress != address(0), "Withdraw address not set"); require(amount > 0, "Amount must be greater than 0"); require(address(this).balance >= amount, "Insufficient balance"); SafeTransferLib.safeTransferETH(withdrawAddress, amount); emit WithdrawTest(withdrawAddress, amount, block.timestamp); } function setWithdrawAddress(address _withdrawAddress) public onlyOwner { require(_withdrawAddress != address(0), "Invalid address"); withdrawAddress = _withdrawAddress; } function getWithdrawAddress() public view returns (address) { return withdrawAddress; } // Emergency functions function emergencyPause() external onlyRole(ADMIN_ROLE) { live = false; emit EmergencyAction("pause", block.timestamp); } function emergencyTokenRecovery( address token, address to, uint256 amount ) external onlyOwner nonReentrant { if (token == address(this)) revert InvalidOperation("Cannot recover self"); SafeTransferLib.safeTransfer(token, to, amount); emit EmergencyRecovery(token, to, amount); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol) pragma solidity ^0.8.0; import "./IAccessControl.sol"; import "../utils/Context.sol"; import "../utils/Strings.sol"; import "../utils/introspection/ERC165.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight version that doesn't allow enumerating role * members except through off-chain means by accessing the contract event logs. Some * applications may benefit from on-chain enumerability, for those cases see * {AccessControlEnumerable}. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ```solidity * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ```solidity * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules} * to enforce additional security measures for this role. */ abstract contract AccessControl is Context, IAccessControl, ERC165 { struct RoleData { mapping(address => bool) members; bytes32 adminRole; } mapping(bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with a standardized message including the required role. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ * * _Available since v4.1._ */ modifier onlyRole(bytes32 role) { _checkRole(role); _; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view virtual override returns (bool) { return _roles[role].members[account]; } /** * @dev Revert with a standard message if `_msgSender()` is missing `role`. * Overriding this function changes the behavior of the {onlyRole} modifier. * * Format of the revert message is described in {_checkRole}. * * _Available since v4.6._ */ function _checkRole(bytes32 role) internal view virtual { _checkRole(role, _msgSender()); } /** * @dev Revert with a standard message if `account` is missing `role`. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ */ function _checkRole(bytes32 role, address account) internal view virtual { if (!hasRole(role, account)) { revert( string( abi.encodePacked( "AccessControl: account ", Strings.toHexString(account), " is missing role ", Strings.toHexString(uint256(role), 32) ) ) ); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleGranted} event. */ function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleRevoked} event. */ function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been revoked `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. * * May emit a {RoleRevoked} event. */ function renounceRole(bytes32 role, address account) public virtual override { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * May emit a {RoleGranted} event. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== * * NOTE: This function is deprecated in favor of {_grantRole}. */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { bytes32 previousAdminRole = getRoleAdmin(role); _roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Grants `role` to `account`. * * Internal function without access restriction. * * May emit a {RoleGranted} event. */ function _grantRole(bytes32 role, address account) internal virtual { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); } } /** * @dev Revokes `role` from `account`. * * Internal function without access restriction. * * May emit a {RoleRevoked} event. */ function _revokeRole(bytes32 role, address account) internal virtual { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol) pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControl { /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC2981.sol) pragma solidity ^0.8.0; import "../utils/introspection/IERC165.sol"; /** * @dev Interface for the NFT Royalty Standard. * * A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal * support for royalty payments across all NFT marketplaces and ecosystem participants. * * _Available since v4.5._ */ interface IERC2981 is IERC165 { /** * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of * exchange. The royalty amount is denominated and should be paid in that same unit of exchange. */ function royaltyInfo( uint256 tokenId, uint256 salePrice ) external view returns (address receiver, uint256 royaltyAmount); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { // On the first call to nonReentrant, _status will be _NOT_ENTERED require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; } function _nonReentrantAfter() private { // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } /** * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a * `nonReentrant` function in the call stack. */ function _reentrancyGuardEntered() internal view returns (bool) { return _status == _ENTERED; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/common/ERC2981.sol) pragma solidity ^0.8.0; import "../../interfaces/IERC2981.sol"; import "../../utils/introspection/ERC165.sol"; /** * @dev Implementation of the NFT Royalty Standard, a standardized way to retrieve royalty payment information. * * Royalty information can be specified globally for all token ids via {_setDefaultRoyalty}, and/or individually for * specific token ids via {_setTokenRoyalty}. The latter takes precedence over the first. * * Royalty is specified as a fraction of sale price. {_feeDenominator} is overridable but defaults to 10000, meaning the * fee is specified in basis points by default. * * IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See * https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the EIP. Marketplaces are expected to * voluntarily pay royalties together with sales, but note that this standard is not yet widely supported. * * _Available since v4.5._ */ abstract contract ERC2981 is IERC2981, ERC165 { struct RoyaltyInfo { address receiver; uint96 royaltyFraction; } RoyaltyInfo private _defaultRoyaltyInfo; mapping(uint256 => RoyaltyInfo) private _tokenRoyaltyInfo; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC165) returns (bool) { return interfaceId == type(IERC2981).interfaceId || super.supportsInterface(interfaceId); } /** * @inheritdoc IERC2981 */ function royaltyInfo(uint256 tokenId, uint256 salePrice) public view virtual override returns (address, uint256) { RoyaltyInfo memory royalty = _tokenRoyaltyInfo[tokenId]; if (royalty.receiver == address(0)) { royalty = _defaultRoyaltyInfo; } uint256 royaltyAmount = (salePrice * royalty.royaltyFraction) / _feeDenominator(); return (royalty.receiver, royaltyAmount); } /** * @dev The denominator with which to interpret the fee set in {_setTokenRoyalty} and {_setDefaultRoyalty} as a * fraction of the sale price. Defaults to 10000 so fees are expressed in basis points, but may be customized by an * override. */ function _feeDenominator() internal pure virtual returns (uint96) { return 10000; } /** * @dev Sets the royalty information that all ids in this contract will default to. * * Requirements: * * - `receiver` cannot be the zero address. * - `feeNumerator` cannot be greater than the fee denominator. */ function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual { require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice"); require(receiver != address(0), "ERC2981: invalid receiver"); _defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator); } /** * @dev Removes default royalty information. */ function _deleteDefaultRoyalty() internal virtual { delete _defaultRoyaltyInfo; } /** * @dev Sets the royalty information for a specific token id, overriding the global default. * * Requirements: * * - `receiver` cannot be the zero address. * - `feeNumerator` cannot be greater than the fee denominator. */ function _setTokenRoyalty(uint256 tokenId, address receiver, uint96 feeNumerator) internal virtual { require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice"); require(receiver != address(0), "ERC2981: Invalid parameters"); _tokenRoyaltyInfo[tokenId] = RoyaltyInfo(receiver, feeNumerator); } /** * @dev Resets royalty information for the token id back to the global default. */ function _resetTokenRoyalty(uint256 tokenId) internal virtual { delete _tokenRoyaltyInfo[tokenId]; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } function _contextSuffixLength() internal view virtual returns (uint256) { return 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.0; import "../Strings.sol"; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSA { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS, InvalidSignatureV // Deprecated in v4.8 } function _throwError(RecoverError error) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert("ECDSA: invalid signature"); } else if (error == RecoverError.InvalidSignatureLength) { revert("ECDSA: invalid signature length"); } else if (error == RecoverError.InvalidSignatureS) { revert("ECDSA: invalid signature 's' value"); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature` or error string. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) { if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. /// @solidity memory-safe-assembly assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return tryRecover(hash, v, r, s); } else { return (address(0), RecoverError.InvalidSignatureLength); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, signature); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately. * * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError) { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); uint8 v = uint8((uint256(vs) >> 255) + 27); return tryRecover(hash, v, r, s); } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. * * _Available since v4.2._ */ function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, r, vs); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. * * _Available since v4.3._ */ function tryRecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address, RecoverError) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS); } // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature); } return (signer, RecoverError.NoError); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, v, r, s); _throwError(error); return recovered; } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 message) { // 32 is the length in bytes of hash, // enforced by the type signature above /// @solidity memory-safe-assembly assembly { mstore(0x00, "\x19Ethereum Signed Message:\n32") mstore(0x1c, hash) message := keccak256(0x00, 0x3c) } } /** * @dev Returns an Ethereum Signed Message, created from `s`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s)); } /** * @dev Returns an Ethereum Signed Typed Data, created from a * `domainSeparator` and a `structHash`. This produces hash corresponding * to the one signed with the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] * JSON-RPC method as part of EIP-712. * * See {recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 data) { /// @solidity memory-safe-assembly assembly { let ptr := mload(0x40) mstore(ptr, "\x19\x01") mstore(add(ptr, 0x02), domainSeparator) mstore(add(ptr, 0x22), structHash) data := keccak256(ptr, 0x42) } } /** * @dev Returns an Ethereum Signed Data with intended validator, created from a * `validator` and `data` according to the version 0 of EIP-191. * * See {recover}. */ function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19\x00", validator, data)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { // Solidity will revert if denominator == 0, unlike the div opcode on its own. // The surrounding unchecked block does not change this fact. // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic. return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1, "Math: mulDiv overflow"); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works // in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10 ** 64) { value /= 10 ** 64; result += 64; } if (value >= 10 ** 32) { value /= 10 ** 32; result += 32; } if (value >= 10 ** 16) { value /= 10 ** 16; result += 16; } if (value >= 10 ** 8) { value /= 10 ** 8; result += 8; } if (value >= 10 ** 4) { value /= 10 ** 4; result += 4; } if (value >= 10 ** 2) { value /= 10 ** 2; result += 2; } if (value >= 10 ** 1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 256, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol) pragma solidity ^0.8.0; /** * @dev Standard signed math utilities missing in the Solidity language. */ library SignedMath { /** * @dev Returns the largest of two signed numbers. */ function max(int256 a, int256 b) internal pure returns (int256) { return a > b ? a : b; } /** * @dev Returns the smallest of two signed numbers. */ function min(int256 a, int256 b) internal pure returns (int256) { return a < b ? a : b; } /** * @dev Returns the average of two signed numbers without overflow. * The result is rounded towards zero. */ function average(int256 a, int256 b) internal pure returns (int256) { // Formula from the book "Hacker's Delight" int256 x = (a & b) + ((a ^ b) >> 1); return x + (int256(uint256(x) >> 255) & (a ^ b)); } /** * @dev Returns the absolute unsigned value of a signed value. */ function abs(int256 n) internal pure returns (uint256) { unchecked { // must be unchecked in order to support `n = type(int256).min` return uint256(n >= 0 ? n : -n); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol) pragma solidity ^0.8.0; import "./math/Math.sol"; import "./math/SignedMath.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant _SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), _SYMBOLS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `int256` to its ASCII `string` decimal representation. */ function toString(int256 value) internal pure returns (string memory) { return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMath.abs(value)))); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, Math.log256(value) + 1); } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } /** * @dev Returns true if the two strings are equal. */ function equal(string memory a, string memory b) internal pure returns (bool) { return keccak256(bytes(a)) == keccak256(bytes(b)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/structs/EnumerableSet.sol) // This file was procedurally generated from scripts/generate/templates/EnumerableSet.js. pragma solidity ^0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ```solidity * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. * * [WARNING] * ==== * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure * unusable. * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info. * * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an * array of EnumerableSet. * ==== */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping(bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; if (lastIndex != toDeleteIndex) { bytes32 lastValue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastValue; // Update the index for the moved value set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex } // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { return set._values[index]; } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function _values(Set storage set) private view returns (bytes32[] memory) { return set._values; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(Bytes32Set storage set) internal view returns (bytes32[] memory) { bytes32[] memory store = _values(set._inner); bytes32[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(AddressSet storage set) internal view returns (address[] memory) { bytes32[] memory store = _values(set._inner); address[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values in the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(UintSet storage set) internal view returns (uint256[] memory) { bytes32[] memory store = _values(set._inner); uint256[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } }
// SPDX-License-Identifier: MIT pragma solidity >=0.7.0 <0.9.0; interface IContractAllowListProxy { function isAllowed(address _transferer, uint256 _level) external view returns (bool); }
// 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); /// @dev `keccak256(bytes("Transfer(address,address,uint256)"))`. uint256 private constant _TRANSFER_EVENT_SIGNATURE = 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef; /// @dev `keccak256(bytes("Approval(address,address,uint256)"))`. uint256 private constant _APPROVAL_EVENT_SIGNATURE = 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925; /// @dev `keccak256(bytes("SkipNFTSet(address,bool)"))`. uint256 private constant _SKIP_NFT_SET_EVENT_SIGNATURE = 0xb5a1de456fff688115a4f75380060c23c8532d14ff85f687cc871456d6420393; /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* 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 The unit cannot be zero. error UnitIsZero(); /// @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 a non-existent NFT. error TokenDoesNotExist(); /// @dev The function selector is not recognized. error FnSelectorNotRecognized(); /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* CONSTANTS */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ /// @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; /// @dev The flag to denote that the address has overridden the default Permit2 allowance. uint8 internal constant _ADDRESS_DATA_OVERRIDE_PERMIT2_FLAG = 1 << 2; /// @dev The canonical Permit2 address. /// For signature-based allowance granting for single transaction ERC20 `transferFrom`. /// To enable, override `_givePermit2DefaultInfiniteAllowance()`. /// [Github](https://github.com/Uniswap/permit2) /// [Etherscan](https://etherscan.io/address/0x000000000022D473030F116dDEE9F6B43aC78BA3) address internal constant _PERMIT2 = 0x000000000022D473030F116dDEE9F6B43aC78BA3; /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* 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 { uint256 spacer; } /// @dev A bitmap in storage. struct Bitmap { uint256 spacer; } /// @dev A struct to wrap a uint256 in storage. struct Uint256Ref { uint256 value; } /// @dev A mapping of an address pair to a Uint256Ref. struct AddressPairToUint256RefMap { uint256 spacer; } /// @dev Struct containing the base token contract storage. struct DN404Storage { // Current number of address aliases assigned. uint32 numAliases; // Next NFT ID to assign for a mint. uint32 nextTokenId; // The head of the burned pool. uint32 burnedPoolHead; // The tail of the burned pool. uint32 burnedPoolTail; // Total number of NFTs in existence. 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. AddressPairToUint256RefMap operatorApprovals; // Mapping of NFT approvals to approved operators. mapping(uint256 => address) nftApprovals; // Bitmap of whether an non-zero NFT approval may exist. Bitmap mayHaveNFTApproval; // Bitmap of whether a NFT ID exists. Ignored if `_useExistsLookup()` returns false. Bitmap exists; // Mapping of user allowances for ERC20 spenders. AddressPairToUint256RefMap allowance; // Mapping of NFT IDs owned by an address. mapping(address => Uint32Map) owned; // The pool of burned NFT IDs. Uint32Map burnedPool; // 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 (_unit() == 0) revert UnitIsZero(); if ($.mirrorERC721 != address(0)) revert DNAlreadyInitialized(); if (mirror == address(0)) revert MirrorAddressIsZero(); /// @solidity memory-safe-assembly assembly { // Make the call to link the mirror contract. 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) } } $.nextTokenId = 1; $.mirrorERC721 = mirror; if (initialTokenSupply != 0) { if (initialSupplyOwner == address(0)) revert TransferToZeroAddress(); if (_totalSupplyOverflows(initialTokenSupply)) revert TotalSupplyOverflow(); $.totalSupply = uint96(initialTokenSupply); AddressData storage initialOwnerAddressData = _addressData(initialSupplyOwner); initialOwnerAddressData.balance = uint96(initialTokenSupply); /// @solidity memory-safe-assembly assembly { // Emit the {Transfer} event. mstore(0x00, initialTokenSupply) log3(0x00, 0x20, _TRANSFER_EVENT_SIGNATURE, 0, shr(96, shl(96, initialSupplyOwner))) } _setSkipNFT(initialSupplyOwner, true); } } /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* BASE UNIT FUNCTION TO OVERRIDE */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ /// @dev Amount of token balance that is equal to one NFT. function _unit() internal view virtual returns (uint256) { return 10 ** 18; } /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* 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); /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* CONFIGURABLES */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ /// @dev Returns if direct NFT transfers should be used during ERC20 transfers /// whenever possible, instead of burning and re-minting. function _useDirectTransfersIfPossible() internal view virtual returns (bool) { return true; } /// @dev Returns if burns should be added to the burn pool. /// This returns false by default, which means the NFT IDs are re-minted in a cycle. function _addToBurnedPool(uint256 totalNFTSupplyAfterBurn, uint256 totalSupplyAfterBurn) internal view virtual returns (bool) { // Silence unused variable compiler warning. totalSupplyAfterBurn = totalNFTSupplyAfterBurn; return false; } /// @dev Returns whether to use the exists bitmap for more efficient /// scanning of an empty token ID slot. /// Recommended for collections that do not use the burn pool, /// and are expected to have nearly all possible NFTs materialized. /// /// Note: The returned value must be constant after initialization. function _useExistsLookup() internal view virtual returns (bool) { return true; } /// @dev Hook that is called after any NFT token transfers, including minting and burning. function _afterNFTTransfer(address from, address to, uint256 id) internal virtual {} /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* 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) { if (_givePermit2DefaultInfiniteAllowance() && spender == _PERMIT2) { uint8 flags = _getDN404Storage().addressData[owner].flags; if (flags & _ADDRESS_DATA_OVERRIDE_PERMIT2_FLAG == 0) return type(uint256).max; } return _ref(_getDN404Storage().allowance, owner, spender).value; } /// @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) { _approve(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) { Uint256Ref storage a = _ref(_getDN404Storage().allowance, from, msg.sender); uint256 allowed = _givePermit2DefaultInfiniteAllowance() && msg.sender == _PERMIT2 && (_getDN404Storage().addressData[from].flags & _ADDRESS_DATA_OVERRIDE_PERMIT2_FLAG) == 0 ? type(uint256).max : a.value; if (allowed != type(uint256).max) { if (amount > allowed) revert InsufficientAllowance(); unchecked { a.value = allowed - amount; } } _transfer(from, to, amount); return true; } /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* PERMIT2 */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ /// @dev Whether Permit2 has infinite allowances by default for all owners. /// For signature-based allowance granting for single transaction ERC20 `transferFrom`. /// To enable, override this function to return true. function _givePermit2DefaultInfiniteAllowance() internal view virtual returns (bool) { return false; } /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* 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(); AddressData storage toAddressData = _addressData(to); DN404Storage storage $ = _getDN404Storage(); if ($.mirrorERC721 == address(0)) revert(); _DNMintTemps memory t; unchecked { uint256 toBalance = uint256(toAddressData.balance) + amount; toAddressData.balance = uint96(toBalance); t.toEnd = toBalance / _unit(); } uint256 maxId; unchecked { uint256 totalSupply_ = uint256($.totalSupply) + amount; $.totalSupply = uint96(totalSupply_); uint256 overflows = _toUint(_totalSupplyOverflows(totalSupply_)); if (overflows | _toUint(totalSupply_ < amount) != 0) revert TotalSupplyOverflow(); maxId = totalSupply_ / _unit(); } unchecked { if (toAddressData.flags & _ADDRESS_DATA_SKIP_NFT_FLAG == 0) { Uint32Map storage toOwned = $.owned[to]; Uint32Map storage oo = $.oo; uint256 toIndex = toAddressData.ownedLength; _DNPackedLogs memory packedLogs = _packedLogsMalloc(_zeroFloorSub(t.toEnd, toIndex)); if (packedLogs.logs.length != 0) { _packedLogsSet(packedLogs, to, 0); $.totalNFTSupply += uint32(packedLogs.logs.length); toAddressData.ownedLength = uint32(t.toEnd); t.toAlias = _registerAndResolveAlias(toAddressData, to); uint32 burnedPoolHead = $.burnedPoolHead; t.burnedPoolTail = $.burnedPoolTail; t.nextTokenId = _wrapNFTId($.nextTokenId, maxId); // Mint loop. do { uint256 id; if (burnedPoolHead != t.burnedPoolTail) { id = _get($.burnedPool, burnedPoolHead++); } else { id = t.nextTokenId; while (_get(oo, _ownershipIndex(id)) != 0) { id = _useExistsLookup() ? _wrapNFTId(_findFirstUnset($.exists, id + 1, maxId + 1), maxId) : _wrapNFTId(id + 1, maxId); } t.nextTokenId = _wrapNFTId(id + 1, maxId); } if (_useExistsLookup()) _set($.exists, id, true); _set(toOwned, toIndex, uint32(id)); _setOwnerAliasAndOwnedIndex(oo, id, t.toAlias, uint32(toIndex++)); _packedLogsAppend(packedLogs, id); _afterNFTTransfer(address(0), to, id); } while (toIndex != t.toEnd); $.nextTokenId = uint32(t.nextTokenId); $.burnedPoolHead = burnedPoolHead; _packedLogsSend(packedLogs, $.mirrorERC721); } } } /// @solidity memory-safe-assembly assembly { // Emit the {Transfer} event. mstore(0x00, amount) log3(0x00, 0x20, _TRANSFER_EVENT_SIGNATURE, 0, shr(96, shl(96, to))) } } /// @dev Mints `amount` tokens to `to`, increasing the total supply. /// This variant mints NFT tokens starting from ID `preTotalSupply / _unit() + 1`. /// This variant will not touch the `burnedPool` and `nextTokenId`. /// /// 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 _mintNext(address to, uint256 amount) internal virtual { if (to == address(0)) revert TransferToZeroAddress(); AddressData storage toAddressData = _addressData(to); DN404Storage storage $ = _getDN404Storage(); if ($.mirrorERC721 == address(0)) revert(); _DNMintTemps memory t; unchecked { uint256 toBalance = uint256(toAddressData.balance) + amount; toAddressData.balance = uint96(toBalance); t.toEnd = toBalance / _unit(); } uint256 startId; uint256 maxId; unchecked { uint256 preTotalSupply = uint256($.totalSupply); startId = preTotalSupply / _unit() + 1; uint256 totalSupply_ = uint256(preTotalSupply) + amount; $.totalSupply = uint96(totalSupply_); uint256 overflows = _toUint(_totalSupplyOverflows(totalSupply_)); if (overflows | _toUint(totalSupply_ < amount) != 0) revert TotalSupplyOverflow(); maxId = totalSupply_ / _unit(); } unchecked { if (toAddressData.flags & _ADDRESS_DATA_SKIP_NFT_FLAG == 0) { Uint32Map storage toOwned = $.owned[to]; Uint32Map storage oo = $.oo; uint256 toIndex = toAddressData.ownedLength; _DNPackedLogs memory packedLogs = _packedLogsMalloc(_zeroFloorSub(t.toEnd, toIndex)); if (packedLogs.logs.length != 0) { _packedLogsSet(packedLogs, to, 0); $.totalNFTSupply += uint32(packedLogs.logs.length); toAddressData.ownedLength = uint32(t.toEnd); t.toAlias = _registerAndResolveAlias(toAddressData, to); // Mint loop. do { uint256 id = startId; while (_get(oo, _ownershipIndex(id)) != 0) { id = _useExistsLookup() ? _wrapNFTId(_findFirstUnset($.exists, id + 1, maxId + 1), maxId) : _wrapNFTId(id + 1, maxId); } startId = _wrapNFTId(id + 1, maxId); if (_useExistsLookup()) _set($.exists, id, true); _set(toOwned, toIndex, uint32(id)); _setOwnerAliasAndOwnedIndex(oo, id, t.toAlias, uint32(toIndex++)); _packedLogsAppend(packedLogs, id); _afterNFTTransfer(address(0), to, id); } while (toIndex != t.toEnd); _packedLogsSend(packedLogs, $.mirrorERC721); } } } /// @solidity memory-safe-assembly assembly { // Emit the {Transfer} event. mstore(0x00, amount) log3(0x00, 0x20, _TRANSFER_EVENT_SIGNATURE, 0, shr(96, shl(96, to))) } } /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* 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 { AddressData storage fromAddressData = _addressData(from); DN404Storage storage $ = _getDN404Storage(); if ($.mirrorERC721 == address(0)) revert(); uint256 fromBalance = fromAddressData.balance; if (amount > fromBalance) revert InsufficientBalance(); unchecked { fromAddressData.balance = uint96(fromBalance -= amount); uint256 totalSupply_ = uint256($.totalSupply) - amount; $.totalSupply = uint96(totalSupply_); Uint32Map storage fromOwned = $.owned[from]; uint256 fromIndex = fromAddressData.ownedLength; uint256 numNFTBurns = _zeroFloorSub(fromIndex, fromBalance / _unit()); if (numNFTBurns != 0) { _DNPackedLogs memory packedLogs = _packedLogsMalloc(numNFTBurns); _packedLogsSet(packedLogs, from, 1); bool addToBurnedPool; { uint256 totalNFTSupply = uint256($.totalNFTSupply) - numNFTBurns; $.totalNFTSupply = uint32(totalNFTSupply); addToBurnedPool = _addToBurnedPool(totalNFTSupply, totalSupply_); } Uint32Map storage oo = $.oo; uint256 fromEnd = fromIndex - numNFTBurns; fromAddressData.ownedLength = uint32(fromEnd); uint32 burnedPoolTail = $.burnedPoolTail; // Burn loop. do { uint256 id = _get(fromOwned, --fromIndex); _setOwnerAliasAndOwnedIndex(oo, id, 0, 0); _packedLogsAppend(packedLogs, id); if (_useExistsLookup()) _set($.exists, id, false); if (addToBurnedPool) _set($.burnedPool, burnedPoolTail++, uint32(id)); if (_get($.mayHaveNFTApproval, id)) { _set($.mayHaveNFTApproval, id, false); delete $.nftApprovals[id]; } _afterNFTTransfer(from, address(0), id); } while (fromIndex != fromEnd); if (addToBurnedPool) $.burnedPoolTail = burnedPoolTail; _packedLogsSend(packedLogs, $.mirrorERC721); } } /// @solidity memory-safe-assembly assembly { // Emit the {Transfer} event. mstore(0x00, amount) log3(0x00, 0x20, _TRANSFER_EVENT_SIGNATURE, shr(96, shl(96, from)), 0) } } /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* 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(); AddressData storage fromAddressData = _addressData(from); AddressData storage toAddressData = _addressData(to); DN404Storage storage $ = _getDN404Storage(); if ($.mirrorERC721 == address(0)) revert(); _DNTransferTemps memory t; t.fromOwnedLength = fromAddressData.ownedLength; t.toOwnedLength = toAddressData.ownedLength; t.totalSupply = $.totalSupply; if (amount > (t.fromBalance = fromAddressData.balance)) revert InsufficientBalance(); unchecked { fromAddressData.balance = uint96(t.fromBalance -= amount); toAddressData.balance = uint96(t.toBalance = uint256(toAddressData.balance) + amount); t.numNFTBurns = _zeroFloorSub(t.fromOwnedLength, t.fromBalance / _unit()); if (toAddressData.flags & _ADDRESS_DATA_SKIP_NFT_FLAG == 0) { if (from == to) t.toOwnedLength = t.fromOwnedLength - t.numNFTBurns; t.numNFTMints = _zeroFloorSub(t.toBalance / _unit(), t.toOwnedLength); } while (_useDirectTransfersIfPossible()) { uint256 n = _min(t.fromOwnedLength, _min(t.numNFTBurns, t.numNFTMints)); if (n == 0) break; t.numNFTBurns -= n; t.numNFTMints -= n; if (from == to) { t.toOwnedLength += n; break; } _DNDirectLogs memory directLogs = _directLogsMalloc(n, from, to); Uint32Map storage fromOwned = $.owned[from]; Uint32Map storage toOwned = $.owned[to]; t.toAlias = _registerAndResolveAlias(toAddressData, to); uint256 toIndex = t.toOwnedLength; // Direct transfer loop. do { uint256 id = _get(fromOwned, --t.fromOwnedLength); _set(toOwned, toIndex, uint32(id)); _setOwnerAliasAndOwnedIndex($.oo, id, t.toAlias, uint32(toIndex++)); _directLogsAppend(directLogs, id); if (_get($.mayHaveNFTApproval, id)) { _set($.mayHaveNFTApproval, id, false); delete $.nftApprovals[id]; } _afterNFTTransfer(from, to, id); } while (--n != 0); toAddressData.ownedLength = uint32(t.toOwnedLength = toIndex); fromAddressData.ownedLength = uint32(t.fromOwnedLength); _directLogsSend(directLogs, $.mirrorERC721); break; } t.totalNFTSupply = uint256($.totalNFTSupply) + t.numNFTMints - t.numNFTBurns; $.totalNFTSupply = uint32(t.totalNFTSupply); Uint32Map storage oo = $.oo; _DNPackedLogs memory packedLogs = _packedLogsMalloc(t.numNFTBurns + t.numNFTMints); t.burnedPoolTail = $.burnedPoolTail; if (t.numNFTBurns != 0) { _packedLogsSet(packedLogs, from, 1); bool addToBurnedPool = _addToBurnedPool(t.totalNFTSupply, t.totalSupply); Uint32Map storage fromOwned = $.owned[from]; uint256 fromIndex = t.fromOwnedLength; fromAddressData.ownedLength = uint32(t.fromEnd = fromIndex - t.numNFTBurns); uint32 burnedPoolTail = t.burnedPoolTail; // Burn loop. do { uint256 id = _get(fromOwned, --fromIndex); _setOwnerAliasAndOwnedIndex(oo, id, 0, 0); _packedLogsAppend(packedLogs, id); if (_useExistsLookup()) _set($.exists, id, false); if (addToBurnedPool) _set($.burnedPool, burnedPoolTail++, uint32(id)); if (_get($.mayHaveNFTApproval, id)) { _set($.mayHaveNFTApproval, id, false); delete $.nftApprovals[id]; } _afterNFTTransfer(from, address(0), id); } while (fromIndex != t.fromEnd); if (addToBurnedPool) $.burnedPoolTail = (t.burnedPoolTail = burnedPoolTail); } if (t.numNFTMints != 0) { _packedLogsSet(packedLogs, to, 0); Uint32Map storage toOwned = $.owned[to]; t.toAlias = _registerAndResolveAlias(toAddressData, to); uint256 maxId = t.totalSupply / _unit(); t.nextTokenId = _wrapNFTId($.nextTokenId, maxId); uint256 toIndex = t.toOwnedLength; toAddressData.ownedLength = uint32(t.toEnd = toIndex + t.numNFTMints); uint32 burnedPoolHead = $.burnedPoolHead; // Mint loop. do { uint256 id; if (burnedPoolHead != t.burnedPoolTail) { id = _get($.burnedPool, burnedPoolHead++); } else { id = t.nextTokenId; while (_get(oo, _ownershipIndex(id)) != 0) { id = _useExistsLookup() ? _wrapNFTId(_findFirstUnset($.exists, id + 1, maxId + 1), maxId) : _wrapNFTId(id + 1, maxId); } t.nextTokenId = _wrapNFTId(id + 1, maxId); } if (_useExistsLookup()) _set($.exists, id, true); _set(toOwned, toIndex, uint32(id)); _setOwnerAliasAndOwnedIndex(oo, id, t.toAlias, uint32(toIndex++)); _packedLogsAppend(packedLogs, id); _afterNFTTransfer(address(0), to, id); } while (toIndex != t.toEnd); $.burnedPoolHead = burnedPoolHead; $.nextTokenId = uint32(t.nextTokenId); } if (packedLogs.logs.length != 0) _packedLogsSend(packedLogs, $.mirrorERC721); } /// @solidity memory-safe-assembly assembly { // Emit the {Transfer} event. mstore(0x00, amount) // forgefmt: disable-next-item log3(0x00, 0x20, _TRANSFER_EVENT_SIGNATURE, shr(96, shl(96, from)), shr(96, shl(96, to))) } } /// @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 { if (to == address(0)) revert TransferToZeroAddress(); DN404Storage storage $ = _getDN404Storage(); if ($.mirrorERC721 == address(0)) revert(); Uint32Map storage oo = $.oo; if (from != $.aliasToAddress[_get(oo, _ownershipIndex(_restrictNFTId(id)))]) { revert TransferFromIncorrectOwner(); } if (msgSender != from) { if (_ref($.operatorApprovals, from, msgSender).value == 0) { if (msgSender != $.nftApprovals[id]) { revert TransferCallerNotOwnerNorApproved(); } } } AddressData storage fromAddressData = _addressData(from); AddressData storage toAddressData = _addressData(to); uint256 unit = _unit(); mapping(address => Uint32Map) storage owned = $.owned; Uint32Map storage fromOwned = owned[from]; unchecked { uint256 fromBalance = fromAddressData.balance; if (unit > fromBalance) revert InsufficientBalance(); fromAddressData.balance = uint96(fromBalance - unit); toAddressData.balance += uint96(unit); } if (_get($.mayHaveNFTApproval, id)) { _set($.mayHaveNFTApproval, id, false); delete $.nftApprovals[id]; } unchecked { uint32 updatedId = _get(fromOwned, --fromAddressData.ownedLength); uint32 i = _get(oo, _ownedIndex(id)); _set(fromOwned, i, updatedId); _set(oo, _ownedIndex(updatedId), i); } unchecked { uint32 n = toAddressData.ownedLength++; _set(owned[to], n, uint32(id)); _setOwnerAliasAndOwnedIndex(oo, id, _registerAndResolveAlias(toAddressData, to), n); } _afterNFTTransfer(from, to, id); /// @solidity memory-safe-assembly assembly { // Emit the {Transfer} event. mstore(0x00, unit) // forgefmt: disable-next-item log3(0x00, 0x20, _TRANSFER_EVENT_SIGNATURE, shr(96, shl(96, from)), shr(96, shl(96, to))) } } /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* INTERNAL APPROVE FUNCTIONS */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ /// @dev Sets `amount` as the allowance of `spender` over the tokens of `owner`. /// /// Emits a {Approval} event. function _approve(address owner, address spender, uint256 amount) internal virtual { if (_givePermit2DefaultInfiniteAllowance() && spender == _PERMIT2) { _getDN404Storage().addressData[owner].flags |= _ADDRESS_DATA_OVERRIDE_PERMIT2_FLAG; } _ref(_getDN404Storage().allowance, owner, spender).value = amount; /// @solidity memory-safe-assembly assembly { // Emit the {Approval} event. mstore(0x00, amount) // forgefmt: disable-next-item log3(0x00, 0x20, _APPROVAL_EVENT_SIGNATURE, shr(96, shl(96, owner)), shr(96, shl(96, spender))) } } /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* 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 minting and transferring ERC20s to `owner` will skip minting NFTs. /// Returns false otherwise. function getSkipNFT(address owner) public view virtual returns (bool) { AddressData storage d = _getDN404Storage().addressData[owner]; if (d.flags & _ADDRESS_DATA_INITIALIZED_FLAG == 0) return _hasCode(owner); return d.flags & _ADDRESS_DATA_SKIP_NFT_FLAG != 0; } /// @dev Sets the caller's skipNFT flag to `skipNFT`. Returns true. /// /// Emits a {SkipNFTSet} event. function setSkipNFT(bool skipNFT) public virtual returns (bool) { _setSkipNFT(msg.sender, skipNFT); return true; } /// @dev Internal function to set account `owner` skipNFT flag to `state` /// /// Initializes account `owner` AddressData if it is not currently initialized. /// /// Emits a {SkipNFTSet} event. function _setSkipNFT(address owner, bool state) internal virtual { AddressData storage d = _addressData(owner); if ((d.flags & _ADDRESS_DATA_SKIP_NFT_FLAG != 0) != state) { d.flags ^= _ADDRESS_DATA_SKIP_NFT_FLAG; } /// @solidity memory-safe-assembly assembly { mstore(0x00, iszero(iszero(state))) log2(0x00, 0x20, _SKIP_NFT_SET_EVENT_SIGNATURE, shr(96, shl(96, owner))) } } /// @dev Returns a storage data pointer for account `owner` AddressData /// /// Initializes account `owner` AddressData if it is not currently initialized. function _addressData(address owner) internal virtual returns (AddressData storage d) { d = _getDN404Storage().addressData[owner]; unchecked { if (d.flags & _ADDRESS_DATA_INITIALIZED_FLAG == 0) { uint256 skipNFT = _toUint(_hasCode(owner)) * _ADDRESS_DATA_SKIP_NFT_FLAG; d.flags = uint8(skipNFT | _ADDRESS_DATA_INITIALIZED_FLAG); } } } /// @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) { unchecked { addressAlias = ++$.numAliases; } toAddressData.addressAlias = addressAlias; $.aliasToAddress[addressAlias] = to; if (addressAlias == 0) revert(); // Overflow. } } /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* 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(_restrictNFTId(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().nftApprovals[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 owner) { DN404Storage storage $ = _getDN404Storage(); owner = $.aliasToAddress[_get($.oo, _ownershipIndex(_restrictNFTId(id)))]; if (msgSender != owner) { if (_ref($.operatorApprovals, owner, msgSender).value == 0) { revert ApprovalCallerNotOwnerNorApproved(); } } $.nftApprovals[id] = spender; _set($.mayHaveNFTApproval, id, spender != address(0)); } /// @dev Approve or remove the `operator` as an operator for `msgSender`, /// without authorization checks. function _setApprovalForAll(address operator, bool approved, address msgSender) internal virtual { _ref(_getDN404Storage().operatorApprovals, msgSender, operator).value = _toUint(approved); } /// @dev Returns the NFT IDs of `owner` in range `[begin, end)`. /// Optimized for smaller bytecode size, as this function is intended for off-chain calling. function _ownedIds(address owner, uint256 begin, uint256 end) internal view virtual returns (uint256[] memory ids) { DN404Storage storage $ = _getDN404Storage(); Uint32Map storage owned = $.owned[owner]; uint256 n = _min($.addressData[owner].ownedLength, end); /// @solidity memory-safe-assembly assembly { ids := mload(0x40) let i := begin for {} lt(i, n) { i := add(i, 1) } { let s := add(shl(96, owned.slot), shr(3, i)) // Storage slot. let id := and(0xffffffff, shr(shl(5, and(i, 7)), sload(s))) mstore(add(add(ids, 0x20), shl(5, sub(i, begin))), id) // Append to. } mstore(ids, sub(i, begin)) // Store the length. mstore(0x40, add(add(ids, 0x20), shl(5, sub(i, begin)))) // Allocate memory. } } /// @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; address mirror = $.mirrorERC721; // `transferFromNFT(address,address,uint256,address)`. if (fnSelector == 0xe5eb36c8) { if (msg.sender != mirror) revert SenderNotMirror(); _transferFromNFT( address(uint160(_calldataload(0x04))), // `from`. address(uint160(_calldataload(0x24))), // `to`. _calldataload(0x44), // `id`. address(uint160(_calldataload(0x64))) // `msgSender`. ); _return(1); } // `setApprovalForAll(address,bool,address)`. if (fnSelector == 0x813500fc) { if (msg.sender != mirror) revert SenderNotMirror(); _setApprovalForAll( address(uint160(_calldataload(0x04))), // `spender`. _calldataload(0x24) != 0, // `status`. address(uint160(_calldataload(0x44))) // `msgSender`. ); _return(1); } // `isApprovedForAll(address,address)`. if (fnSelector == 0xe985e9c5) { if (msg.sender != mirror) revert SenderNotMirror(); Uint256Ref storage ref = _ref( $.operatorApprovals, address(uint160(_calldataload(0x04))), // `owner`. address(uint160(_calldataload(0x24))) // `operator`. ); _return(ref.value); } // `ownerOf(uint256)`. if (fnSelector == 0x6352211e) { if (msg.sender != mirror) revert SenderNotMirror(); _return(uint160(_ownerOf(_calldataload(0x04)))); } // `ownerAt(uint256)`. if (fnSelector == 0x24359879) { if (msg.sender != mirror) revert SenderNotMirror(); _return(uint160(_ownerAt(_calldataload(0x04)))); } // `approveNFT(address,uint256,address)`. if (fnSelector == 0xd10b6e0c) { if (msg.sender != mirror) revert SenderNotMirror(); address owner = _approveNFT( address(uint160(_calldataload(0x04))), // `spender`. _calldataload(0x24), // `id`. address(uint160(_calldataload(0x44))) // `msgSender`. ); _return(uint160(owner)); } // `getApproved(uint256)`. if (fnSelector == 0x081812fc) { if (msg.sender != mirror) revert SenderNotMirror(); _return(uint160(_getApproved(_calldataload(0x04)))); } // `balanceOfNFT(address)`. if (fnSelector == 0xf5b100ea) { if (msg.sender != mirror) revert SenderNotMirror(); _return(_balanceOfNFT(address(uint160(_calldataload(0x04))))); } // `totalNFTSupply()`. if (fnSelector == 0xe2c79281) { if (msg.sender != mirror) revert SenderNotMirror(); _return(_totalNFTSupply()); } // `implementsDN404()`. if (fnSelector == 0xb7a94eb8) { _return(1); } _; } /// @dev Fallback function for calls from mirror NFT contract. /// Override this if you need to implement your custom /// fallback with utilities like Solady's `LibZip.cdFallback()`. /// And always remember to always wrap the fallback with `dn404Fallback`. fallback() external payable virtual dn404Fallback { revert FnSelectorNotRecognized(); // Not mandatory. Just for quality of life. } /// @dev This is to silence the compiler warning. /// Override and remove the revert if you want your contract to receive ETH via receive. receive() external payable virtual { if (msg.value != 0) revert(); } /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* INTERNAL / PRIVATE HELPERS */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ /// @dev Returns `(i - 1) << 1`. function _ownershipIndex(uint256 i) internal pure returns (uint256) { unchecked { return (i - 1) << 1; // Minus 1 as token IDs start from 1. } } /// @dev Returns `((i - 1) << 1) + 1`. function _ownedIndex(uint256 i) internal pure returns (uint256) { unchecked { return ((i - 1) << 1) + 1; // Minus 1 as token IDs start from 1. } } /// @dev Returns the uint32 value at `index` in `map`. function _get(Uint32Map storage map, uint256 index) internal view returns (uint32 result) { /// @solidity memory-safe-assembly assembly { let s := add(shl(96, map.slot), shr(3, index)) // Storage slot. result := and(0xffffffff, shr(shl(5, and(index, 7)), sload(s))) } } /// @dev Updates the uint32 value at `index` in `map`. function _set(Uint32Map storage map, uint256 index, uint32 value) internal { /// @solidity memory-safe-assembly assembly { let s := add(shl(96, map.slot), shr(3, index)) // Storage slot. let o := shl(5, and(index, 7)) // Storage slot offset (bits). let v := sload(s) // Storage slot value. sstore(s, xor(v, shl(o, and(0xffffffff, xor(value, shr(o, v)))))) } } /// @dev Sets the owner alias and the owned index together. function _setOwnerAliasAndOwnedIndex( Uint32Map storage map, uint256 id, uint32 ownership, uint32 ownedIndex ) internal { /// @solidity memory-safe-assembly assembly { let i := sub(id, 1) // Index of the uint64 combined value. let s := add(shl(96, map.slot), shr(2, i)) // Storage slot. let v := sload(s) // Storage slot value. let o := shl(6, and(i, 3)) // Storage slot offset (bits). let combined := or(shl(32, ownedIndex), and(0xffffffff, ownership)) sstore(s, xor(v, shl(o, and(0xffffffffffffffff, xor(shr(o, v), combined))))) } } /// @dev Returns the boolean value of the bit at `index` in `bitmap`. function _get(Bitmap storage bitmap, uint256 index) internal view returns (bool result) { /// @solidity memory-safe-assembly assembly { let s := add(shl(96, bitmap.slot), shr(8, index)) // Storage slot. result := and(1, shr(and(0xff, index), sload(s))) } } /// @dev Updates the bit at `index` in `bitmap` to `value`. function _set(Bitmap storage bitmap, uint256 index, bool value) internal { /// @solidity memory-safe-assembly assembly { let s := add(shl(96, bitmap.slot), shr(8, index)) // Storage slot. let o := and(0xff, index) // Storage slot offset (bits). sstore(s, or(and(sload(s), not(shl(o, 1))), shl(o, iszero(iszero(value))))) } } /// @dev Returns the index of the least significant unset bit in `[begin, end)`. /// If no unset bit is found, returns `type(uint256).max`. function _findFirstUnset(Bitmap storage bitmap, uint256 begin, uint256 end) internal view returns (uint256 unsetBitIndex) { /// @solidity memory-safe-assembly assembly { unsetBitIndex := not(0) // Initialize to `type(uint256).max`. let s := shl(96, bitmap.slot) // Storage offset of the bitmap. let bucket := add(s, shr(8, begin)) let negBits := shl(and(0xff, begin), shr(and(0xff, begin), not(sload(bucket)))) if iszero(negBits) { let lastBucket := add(s, shr(8, end)) for {} 1 {} { bucket := add(bucket, 1) negBits := not(sload(bucket)) if or(negBits, gt(bucket, lastBucket)) { break } } if gt(bucket, lastBucket) { negBits := shr(and(0xff, not(end)), shl(and(0xff, not(end)), negBits)) } } if negBits { // Find-first-set routine. let b := and(negBits, add(not(negBits), 1)) // Isolate the least significant bit. let r := shl(7, lt(0xffffffffffffffffffffffffffffffff, b)) r := or(r, shl(6, lt(0xffffffffffffffff, shr(r, b)))) r := or(r, shl(5, lt(0xffffffff, shr(r, b)))) // For the remaining 32 bits, use a De Bruijn lookup. // forgefmt: disable-next-item r := or(r, byte(and(div(0xd76453e0, shr(r, b)), 0x1f), 0x001f0d1e100c1d070f090b19131c1706010e11080a1a141802121b1503160405)) r := or(shl(8, sub(bucket, s)), r) unsetBitIndex := or(r, sub(0, or(iszero(lt(r, end)), lt(r, begin)))) } } } /// @dev Returns a storage reference to the value at (`a0`, `a1`) in `map`. function _ref(AddressPairToUint256RefMap storage map, address a0, address a1) internal pure returns (Uint256Ref storage ref) { /// @solidity memory-safe-assembly assembly { mstore(0x28, a1) mstore(0x14, a0) mstore(0x00, map.slot) ref.slot := keccak256(0x00, 0x48) // Clear the part of the free memory pointer that was overwritten. mstore(0x28, 0x00) } } /// @dev Wraps the NFT ID. function _wrapNFTId(uint256 id, uint256 maxId) internal pure returns (uint256 result) { /// @solidity memory-safe-assembly assembly { result := or(mul(iszero(gt(id, maxId)), id), gt(id, maxId)) } } /// @dev Returns `id > type(uint32).max ? 0 : id`. function _restrictNFTId(uint256 id) internal pure returns (uint256 result) { /// @solidity memory-safe-assembly assembly { result := mul(id, lt(id, 0x100000000)) } } /// @dev Returns whether `amount` is a valid `totalSupply`. function _totalSupplyOverflows(uint256 amount) internal view returns (bool result) { uint256 unit = _unit(); /// @solidity memory-safe-assembly assembly { result := iszero(iszero(or(shr(96, amount), lt(0xfffffffe, div(amount, unit))))) } } /// @dev Returns `max(0, x - y)`. function _zeroFloorSub(uint256 x, uint256 y) internal pure returns (uint256 z) { /// @solidity memory-safe-assembly assembly { z := mul(gt(x, y), sub(x, y)) } } /// @dev Returns `x < y ? x : y`. function _min(uint256 x, uint256 y) internal pure returns (uint256 z) { /// @solidity memory-safe-assembly assembly { z := xor(x, mul(xor(x, y), lt(y, x))) } } /// @dev Returns `b ? 1 : 0`. function _toUint(bool b) internal pure returns (uint256 result) { /// @solidity memory-safe-assembly assembly { result := iszero(iszero(b)) } } /// @dev Struct containing direct transfer log data for {Transfer} events to be /// emitted by the mirror NFT contract. struct _DNDirectLogs { uint256 offset; address from; address to; uint256[] logs; } /// @dev Initiates memory allocation for direct logs with `n` log items. function _directLogsMalloc(uint256 n, address from, address to) private pure returns (_DNDirectLogs memory p) { /// @solidity memory-safe-assembly assembly { // Note that `p` implicitly allocates and advances the free memory pointer by // 4 words, which we can safely mutate in `_directLogsSend`. let logs := mload(0x40) mstore(logs, n) // Store the length. let offset := add(0x20, logs) // Skip the word for `p.logs.length`. mstore(0x40, add(offset, shl(5, n))) // Allocate memory. mstore(add(0x60, p), logs) // Set `p.logs`. mstore(add(0x40, p), to) // Set `p.to`. mstore(add(0x20, p), from) // Set `p.from`. mstore(p, offset) // Set `p.offset`. } } /// @dev Adds a direct log item to `p` with token `id`. function _directLogsAppend(_DNDirectLogs memory p, uint256 id) private pure { /// @solidity memory-safe-assembly assembly { let offset := mload(p) mstore(offset, id) mstore(p, add(offset, 0x20)) } } /// @dev Calls the `mirror` NFT contract to emit {Transfer} events for packed logs `p`. function _directLogsSend(_DNDirectLogs memory p, address mirror) private { /// @solidity memory-safe-assembly assembly { let logs := mload(add(p, 0x60)) let n := add(0x84, shl(5, mload(logs))) // Length of calldata to send. let o := sub(logs, 0x80) // Start of calldata to send. mstore(o, 0x144027d3) // `logDirectTransfer(address,address,uint256[])`. let from := mload(add(0x20, p)) let to := mload(add(0x40, p)) mstore(add(o, 0x20), from) mstore(add(o, 0x40), to) mstore(add(o, 0x60), 0x60) // Offset of `logs` in the 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 containing packed log data for {Transfer} events to be /// emitted by the mirror NFT contract. struct _DNPackedLogs { uint256 offset; uint256 addressAndBit; uint256[] logs; } /// @dev Initiates memory allocation for packed logs with `n` log items. function _packedLogsMalloc(uint256 n) private pure returns (_DNPackedLogs memory p) { /// @solidity memory-safe-assembly assembly { // Note that `p` implicitly allocates and advances the free memory pointer by // 3 words, which we can safely mutate in `_packedLogsSend`. let logs := mload(0x40) mstore(logs, n) // Store the length. let offset := add(0x20, logs) // Skip the word for `p.logs.length`. mstore(0x40, add(offset, shl(5, n))) // Allocate memory. mstore(add(0x40, p), logs) // Set `p.logs`. mstore(p, offset) // Set `p.offset`. } } /// @dev Set the current address and the burn bit. function _packedLogsSet(_DNPackedLogs memory p, address a, uint256 burnBit) private pure { /// @solidity memory-safe-assembly assembly { mstore(add(p, 0x20), or(shl(96, a), burnBit)) // Set `p.addressAndBit`. } } /// @dev Adds a packed log item to `p` with token `id`. function _packedLogsAppend(_DNPackedLogs memory p, uint256 id) private pure { /// @solidity memory-safe-assembly assembly { let offset := mload(p) mstore(offset, or(mload(add(p, 0x20)), shl(8, id))) // `p.addressAndBit | (id << 8)`. mstore(p, add(offset, 0x20)) } } /// @dev Calls the `mirror` NFT contract to emit {Transfer} events for packed logs `p`. function _packedLogsSend(_DNPackedLogs memory p, address mirror) private { /// @solidity memory-safe-assembly assembly { let logs := mload(add(p, 0x40)) 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 _DNTransferTemps { uint256 numNFTBurns; uint256 numNFTMints; uint256 fromBalance; uint256 toBalance; uint256 fromOwnedLength; uint256 toOwnedLength; uint256 totalSupply; uint256 totalNFTSupply; uint256 fromEnd; uint256 toEnd; uint32 toAlias; uint256 nextTokenId; uint32 burnedPoolTail; } /// @dev Struct of temporary variables for mints. struct _DNMintTemps { uint256 nextTokenId; uint32 burnedPoolTail; uint256 toEnd; uint32 toAlias; } /// @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) } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; /// @title DN404Mirror /// @notice DN404Mirror provides an interface for interacting with the /// NFT tokens in a DN404 implementation. /// /// @author vectorized.eth (@optimizoor) /// @author Quit (@0xQuit) /// @author Michael Amadi (@AmadiMichaels) /// @author cygaar (@0xCygaar) /// @author Thomas (@0xjustadev) /// @author Harrison (@PopPunkOnChain) /// /// @dev Note: /// - The ERC721 data is stored in the base DN404 contract. contract DN404Mirror { /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* EVENTS */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ /// @dev Emitted when token `id` is transferred from `from` to `to`. event Transfer(address indexed from, address indexed to, uint256 indexed id); /// @dev Emitted when `owner` enables `account` to manage the `id` token. event Approval(address indexed owner, address indexed account, uint256 indexed id); /// @dev Emitted when `owner` enables or disables `operator` to manage all of their tokens. event ApprovalForAll(address indexed owner, address indexed operator, bool isApproved); /// @dev The ownership is transferred from `oldOwner` to `newOwner`. /// This is for marketplace signaling purposes. This contract has a `pullOwner()` /// function that will sync the owner from the base contract. event OwnershipTransferred(address indexed oldOwner, address indexed newOwner); /// @dev `keccak256(bytes("Transfer(address,address,uint256)"))`. uint256 private constant _TRANSFER_EVENT_SIGNATURE = 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef; /// @dev `keccak256(bytes("Approval(address,address,uint256)"))`. uint256 private constant _APPROVAL_EVENT_SIGNATURE = 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925; /// @dev `keccak256(bytes("ApprovalForAll(address,address,bool)"))`. uint256 private constant _APPROVAL_FOR_ALL_EVENT_SIGNATURE = 0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31; /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* CUSTOM ERRORS */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ /// @dev Thrown when a call for an NFT function did not originate /// from the base DN404 contract. error SenderNotBase(); /// @dev Thrown when a call for an NFT function did not originate from the deployer. error SenderNotDeployer(); /// @dev Thrown when transferring an NFT to a contract address that /// does not implement ERC721Receiver. error TransferToNonERC721ReceiverImplementer(); /// @dev Thrown when linking to the DN404 base contract and the /// DN404 supportsInterface check fails or the call reverts. error CannotLink(); /// @dev Thrown when a linkMirrorContract call is received and the /// NFT mirror contract has already been linked to a DN404 base contract. error AlreadyLinked(); /// @dev Thrown when retrieving the base DN404 address when a link has not /// been established. error NotLinked(); /// @dev The function selector is not recognized. error FnSelectorNotRecognized(); /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* STORAGE */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ /// @dev Struct contain the NFT mirror contract storage. struct DN404NFTStorage { // Address of the ERC20 base contract. address baseERC20; // The deployer, if provided. If non-zero, the initialization of the // ERC20 <-> ERC721 link can only be done be the deployer via the ERC20 base contract. address deployer; // The owner of the ERC20 base contract. For marketplace signaling. address owner; } /// @dev Returns a storage pointer for DN404NFTStorage. function _getDN404NFTStorage() internal pure virtual returns (DN404NFTStorage storage $) { /// @solidity memory-safe-assembly assembly { // `uint72(bytes9(keccak256("DN404_MIRROR_STORAGE")))`. $.slot := 0x3602298b8c10b01230 // Truncate to 9 bytes to reduce bytecode size. } } /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* CONSTRUCTOR */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ constructor(address deployer) { // For non-proxies, we will store the deployer so that only the deployer can // link the base contract. _getDN404NFTStorage().deployer = deployer; } /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* ERC721 OPERATIONS */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ /// @dev Returns the token collection name from the base DN404 contract. function name() public view virtual returns (string memory) { return _readString(0x06fdde03, 0); // `name()`. } /// @dev Returns the token collection symbol from the base DN404 contract. function symbol() public view virtual returns (string memory) { return _readString(0x95d89b41, 0); // `symbol()`. } /// @dev Returns the Uniform Resource Identifier (URI) for token `id` from /// the base DN404 contract. function tokenURI(uint256 id) public view virtual returns (string memory) { return _readString(0xc87b56dd, id); // `tokenURI()`. } /// @dev Returns the total NFT supply from the base DN404 contract. function totalSupply() public view virtual returns (uint256) { return _readWord(0xe2c79281, 0, 0); // `totalNFTSupply()`. } /// @dev Returns the number of NFT tokens owned by `nftOwner` from the base DN404 contract. /// /// Requirements: /// - `nftOwner` must not be the zero address. function balanceOf(address nftOwner) public view virtual returns (uint256) { return _readWord(0xf5b100ea, uint160(nftOwner), 0); // `balanceOfNFT(address)`. } /// @dev Returns the owner of token `id` from the base DN404 contract. /// /// Requirements: /// - Token `id` must exist. function ownerOf(uint256 id) public view virtual returns (address) { return address(uint160(_readWord(0x6352211e, id, 0))); // `ownerOf(uint256)`. } /// @dev Returns the owner of token `id` from the base DN404 contract. /// Returns `address(0)` instead of reverting if the token does not exist. function ownerAt(uint256 id) public view virtual returns (address) { return address(uint160(_readWord(0x24359879, id, 0))); // `ownerAt(uint256)`. } /// @dev Sets `spender` as the approved account to manage token `id` in /// the base DN404 contract. /// /// Requirements: /// - Token `id` must exist. /// - The caller must be the owner of the token, /// or an approved operator for the token owner. /// /// Emits an {Approval} event. function approve(address spender, uint256 id) public payable virtual { address base = baseERC20(); /// @solidity memory-safe-assembly assembly { spender := shr(96, shl(96, spender)) let m := mload(0x40) mstore(0x00, 0xd10b6e0c) // `approveNFT(address,uint256,address)`. mstore(0x20, spender) mstore(0x40, id) mstore(0x60, caller()) if iszero( and( // Arguments of `and` are evaluated last to first. gt(returndatasize(), 0x1f), // The call must return at least 32 bytes. call(gas(), base, callvalue(), 0x1c, 0x64, 0x00, 0x20) ) ) { returndatacopy(m, 0x00, returndatasize()) revert(m, returndatasize()) } mstore(0x40, m) // Restore the free memory pointer. mstore(0x60, 0) // Restore the zero pointer. // Emit the {Approval} event. log4(codesize(), 0x00, _APPROVAL_EVENT_SIGNATURE, shr(96, mload(0x0c)), spender, id) } } /// @dev Returns the account approved to manage token `id` from /// the base DN404 contract. /// /// Requirements: /// - Token `id` must exist. function getApproved(uint256 id) public view virtual returns (address) { return address(uint160(_readWord(0x081812fc, id, 0))); // `getApproved(uint256)`. } /// @dev Sets whether `operator` is approved to manage the tokens of the caller in /// the base DN404 contract. /// /// Emits an {ApprovalForAll} event. function setApprovalForAll(address operator, bool approved) public virtual { address base = baseERC20(); /// @solidity memory-safe-assembly assembly { operator := shr(96, shl(96, operator)) let m := mload(0x40) mstore(0x00, 0x813500fc) // `setApprovalForAll(address,bool,address)`. mstore(0x20, operator) mstore(0x40, iszero(iszero(approved))) mstore(0x60, caller()) if iszero( and( // Arguments of `and` are evaluated last to first. eq(mload(0x00), 1), // The call must return 1. call(gas(), base, callvalue(), 0x1c, 0x64, 0x00, 0x20) ) ) { returndatacopy(m, 0x00, returndatasize()) revert(m, returndatasize()) } // Emit the {ApprovalForAll} event. // The `approved` value is already at 0x40. log3(0x40, 0x20, _APPROVAL_FOR_ALL_EVENT_SIGNATURE, caller(), operator) mstore(0x40, m) // Restore the free memory pointer. mstore(0x60, 0) // Restore the zero pointer. } } /// @dev Returns whether `operator` is approved to manage the tokens of `nftOwner` from /// the base DN404 contract. function isApprovedForAll(address nftOwner, address operator) public view virtual returns (bool) { // `isApprovedForAll(address,address)`. return _readWord(0xe985e9c5, uint160(nftOwner), uint160(operator)) != 0; } /// @dev Transfers token `id` from `from` to `to`. /// /// Requirements: /// /// - Token `id` must exist. /// - `from` must be the owner of the token. /// - `to` cannot be the zero address. /// - The caller must be the owner of the token, or be approved to manage the token. /// /// Emits a {Transfer} event. function transferFrom(address from, address to, uint256 id) public payable virtual { address base = baseERC20(); /// @solidity memory-safe-assembly assembly { from := shr(96, shl(96, from)) to := shr(96, shl(96, to)) let m := mload(0x40) mstore(m, 0xe5eb36c8) // `transferFromNFT(address,address,uint256,address)`. mstore(add(m, 0x20), from) mstore(add(m, 0x40), to) mstore(add(m, 0x60), id) mstore(add(m, 0x80), caller()) if iszero( and( // Arguments of `and` are evaluated last to first. eq(mload(m), 1), // The call must return 1. call(gas(), base, callvalue(), add(m, 0x1c), 0x84, m, 0x20) ) ) { returndatacopy(m, 0x00, returndatasize()) revert(m, returndatasize()) } // Emit the {Transfer} event. log4(codesize(), 0x00, _TRANSFER_EVENT_SIGNATURE, from, to, id) } } /// @dev Equivalent to `safeTransferFrom(from, to, id, "")`. function safeTransferFrom(address from, address to, uint256 id) public payable virtual { transferFrom(from, to, id); if (_hasCode(to)) _checkOnERC721Received(from, to, id, ""); } /// @dev Transfers token `id` from `from` to `to`. /// /// Requirements: /// /// - Token `id` must exist. /// - `from` must be the owner of the token. /// - `to` cannot be the zero address. /// - The caller must be the owner of the token, or be approved to manage the token. /// - If `to` refers to a smart contract, it must implement /// {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. /// /// Emits a {Transfer} event. function safeTransferFrom(address from, address to, uint256 id, bytes calldata data) public payable virtual { transferFrom(from, to, id); if (_hasCode(to)) _checkOnERC721Received(from, to, id, data); } /// @dev Returns true if this contract implements the interface defined by `interfaceId`. /// See: https://eips.ethereum.org/EIPS/eip-165 /// This function call must use less than 30000 gas. function supportsInterface(bytes4 interfaceId) public view virtual returns (bool result) { /// @solidity memory-safe-assembly assembly { let s := shr(224, interfaceId) // ERC165: 0x01ffc9a7, ERC721: 0x80ac58cd, ERC721Metadata: 0x5b5e139f. result := or(or(eq(s, 0x01ffc9a7), eq(s, 0x80ac58cd)), eq(s, 0x5b5e139f)) } } /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* OWNER SYNCING OPERATIONS */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ /// @dev Returns the `owner` of the contract, for marketplace signaling purposes. function owner() public view virtual returns (address) { return _getDN404NFTStorage().owner; } /// @dev Permissionless function to pull the owner from the base DN404 contract /// if it implements ownable, for marketplace signaling purposes. function pullOwner() public virtual returns (bool) { address newOwner; address base = baseERC20(); /// @solidity memory-safe-assembly assembly { mstore(0x00, 0x8da5cb5b) // `owner()`. let success := staticcall(gas(), base, 0x1c, 0x04, 0x00, 0x20) newOwner := mul(shr(96, mload(0x0c)), and(gt(returndatasize(), 0x1f), success)) } DN404NFTStorage storage $ = _getDN404NFTStorage(); address oldOwner = $.owner; if (oldOwner != newOwner) { $.owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } return true; } /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* MIRROR OPERATIONS */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ /// @dev Returns the address of the base DN404 contract. function baseERC20() public view virtual returns (address base) { base = _getDN404NFTStorage().baseERC20; if (base == address(0)) revert NotLinked(); } /// @dev Fallback modifier to execute calls from the base DN404 contract. modifier dn404NFTFallback() virtual { DN404NFTStorage storage $ = _getDN404NFTStorage(); uint256 fnSelector = _calldataload(0x00) >> 224; // `logTransfer(uint256[])`. if (fnSelector == 0x263c69d6) { if (msg.sender != $.baseERC20) revert SenderNotBase(); /// @solidity memory-safe-assembly assembly { let o := add(0x24, calldataload(0x04)) // Packed logs offset. let end := add(o, shl(5, calldataload(sub(o, 0x20)))) for {} iszero(eq(o, end)) { o := add(0x20, o) } { let d := calldataload(o) // Entry in the packed logs. let a := shr(96, d) // The address. let b := and(1, d) // Whether it is a burn. log4( codesize(), 0x00, _TRANSFER_EVENT_SIGNATURE, mul(a, b), // `from`. mul(a, iszero(b)), // `to`. shr(168, shl(160, d)) // `id`. ) } mstore(0x00, 0x01) return(0x00, 0x20) } } // `logDirectTransfer(address,address,uint256[])`. if (fnSelector == 0x144027d3) { if (msg.sender != $.baseERC20) revert SenderNotBase(); /// @solidity memory-safe-assembly assembly { let from := calldataload(0x04) let to := calldataload(0x24) let o := add(0x24, calldataload(0x44)) // Direct logs offset. let end := add(o, shl(5, calldataload(sub(o, 0x20)))) for {} iszero(eq(o, end)) { o := add(0x20, o) } { log4(codesize(), 0x00, _TRANSFER_EVENT_SIGNATURE, from, to, calldataload(o)) } mstore(0x00, 0x01) return(0x00, 0x20) } } // `linkMirrorContract(address)`. if (fnSelector == 0x0f4599e5) { if ($.deployer != address(0)) { if (address(uint160(_calldataload(0x04))) != $.deployer) { revert SenderNotDeployer(); } } if ($.baseERC20 != address(0)) revert AlreadyLinked(); $.baseERC20 = msg.sender; /// @solidity memory-safe-assembly assembly { mstore(0x00, 0x01) return(0x00, 0x20) } } _; } /// @dev Fallback function for calls from base DN404 contract. /// Override this if you need to implement your custom /// fallback with utilities like Solady's `LibZip.cdFallback()`. /// And always remember to always wrap the fallback with `dn404NFTFallback`. fallback() external payable virtual dn404NFTFallback { revert FnSelectorNotRecognized(); // Not mandatory. Just for quality of life. } /// @dev This is to silence the compiler warning. /// Override and remove the revert if you want your contract to receive ETH via receive. receive() external payable virtual { if (msg.value != 0) revert(); } /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* PRIVATE HELPERS */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ /// @dev Helper to read a string from the base DN404 contract. function _readString(uint256 fnSelector, uint256 arg0) private view returns (string memory result) { address base = baseERC20(); /// @solidity memory-safe-assembly assembly { result := mload(0x40) mstore(0x00, fnSelector) mstore(0x20, arg0) if iszero(staticcall(gas(), base, 0x1c, 0x24, 0x00, 0x00)) { returndatacopy(result, 0x00, returndatasize()) revert(result, returndatasize()) } returndatacopy(0x00, 0x00, 0x20) // Copy the offset of the string in returndata. returndatacopy(result, mload(0x00), 0x20) // Copy the length of the string. returndatacopy(add(result, 0x20), add(mload(0x00), 0x20), mload(result)) // Copy the string. let end := add(add(result, 0x20), mload(result)) mstore(end, 0) // Zeroize the word after the string. mstore(0x40, add(end, 0x20)) // Allocate memory. } } /// @dev Helper to read a word from the base DN404 contract. function _readWord(uint256 fnSelector, uint256 arg0, uint256 arg1) private view returns (uint256 result) { address base = baseERC20(); /// @solidity memory-safe-assembly assembly { let m := mload(0x40) mstore(0x00, fnSelector) mstore(0x20, arg0) mstore(0x40, arg1) if iszero( and( // Arguments of `and` are evaluated last to first. gt(returndatasize(), 0x1f), // The call must return at least 32 bytes. staticcall(gas(), base, 0x1c, 0x44, 0x00, 0x20) ) ) { returndatacopy(m, 0x00, returndatasize()) revert(m, returndatasize()) } mstore(0x40, m) // Restore the free memory pointer. result := mload(0x00) } } /// @dev Returns the calldata value at `offset`. function _calldataload(uint256 offset) private pure returns (uint256 value) { /// @solidity memory-safe-assembly assembly { value := calldataload(offset) } } /// @dev Returns if `a` has bytecode of non-zero length. function _hasCode(address a) private view returns (bool result) { /// @solidity memory-safe-assembly assembly { result := extcodesize(a) // Can handle dirty upper bits. } } /// @dev Perform a call to invoke {IERC721Receiver-onERC721Received} on `to`. /// Reverts if the target does not support the function correctly. function _checkOnERC721Received(address from, address to, uint256 id, bytes memory data) private { /// @solidity memory-safe-assembly assembly { // Prepare the calldata. let m := mload(0x40) let onERC721ReceivedSelector := 0x150b7a02 mstore(m, onERC721ReceivedSelector) mstore(add(m, 0x20), caller()) // The `operator`, which is always `msg.sender`. mstore(add(m, 0x40), shr(96, shl(96, from))) mstore(add(m, 0x60), id) mstore(add(m, 0x80), 0x80) let n := mload(data) mstore(add(m, 0xa0), n) if n { pop(staticcall(gas(), 4, add(data, 0x20), n, add(m, 0xc0), n)) } // Revert if the call reverts. if iszero(call(gas(), to, 0, add(m, 0x1c), add(n, 0xa4), m, 0x20)) { if returndatasize() { // Bubble up the revert if the call reverts. returndatacopy(m, 0x00, returndatasize()) revert(m, returndatasize()) } } // Load the returndata and compare it. if iszero(eq(mload(m), shl(224, onERC721ReceivedSelector))) { mstore(0x00, 0xd1a57ed6) // `TransferToNonERC721ReceiverImplementer()`. revert(0x1c, 0x04) } } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "hardhat/console.sol"; import "./DN404Mirror.sol"; import "@openzeppelin/contracts/access/AccessControl.sol"; import "@openzeppelin/contracts/token/common/ERC2981.sol"; import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "contract-allow-list/contracts/proxy/interface/IContractAllowListProxy.sol"; /** * @title ExtendedDN404Mirror * @dev Extends DN404Mirror with ERC721C capabilities and maintains CAL functionality */ contract MUTANT_ALIENS_VILLAIN is DN404Mirror, AccessControl, ERC2981, ReentrancyGuard { using EnumerableSet for EnumerableSet.AddressSet; using ECDSA for bytes32; // === Constants and Interfaces === bytes32 public constant NFT_SECURITY_NAMESPACE = keccak256("NFT_SECURITY"); bytes32 public constant ADMIN_ROLE = keccak256("ADMIN_ROLE"); bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); bytes4 private constant _SEAPORT_HOOK_INTERFACE = 0x9059e6c3; bytes4 private constant INTERFACE_ID_ERC721C = 0x3f4ce757; bytes4 private constant INTERFACE_ID_CONTRACT_LEVEL = 0xa40eb359; uint96 private defaultRoyaltyRate; uint96 private constant MAX_ROYALTY_RATE = 1000; // 10% // === State Variables === IContractAllowListProxy public CAL; EnumerableSet.AddressSet private localAllowedAddresses; // New NFT Security Enum enum NFTSecurityLevel { NONE, // No restrictions CAL_ONLY, // Only CAL restrictions FULL // Full restrictions (CAL + Additional) } // State Variables NFTSecurityLevel public defaultNFTSecurityLevel = NFTSecurityLevel.FULL; bool public enableRestrict = true; uint256 public CALLevel = 2; bool public contractLocked = false; // Mappings mapping(uint256 => bool) public tokenLocked; mapping(address => bool) public walletLocked; mapping(uint256 => NFTSecurityLevel) public tokenSecurityLevels; mapping(uint256 => uint256) public tokenCALLevel; mapping(address => uint256) public walletCALLevel; // Events event SecurityLevelUpdated(NFTSecurityLevel level); event TokenSecurityLevelChanged( uint256 indexed tokenId, NFTSecurityLevel level ); event RoyaltyPaid( address indexed tokenContract, uint256 indexed tokenId, address indexed royaltyReceiver, address seller, address buyer, uint256 amount ); event MarketplaceApproved( address indexed marketplace, bool approved, uint256 fee ); event TokenMarketplaceSet( uint256 indexed tokenId, address indexed marketplace ); event OwnershipSynced(address indexed oldOwner, address indexed newOwner); event RoyaltyEnforced( uint256 tokenId, address receiver, uint96 feeNumerator ); event CreatorEarningsConfigured(address receiver, uint96 feeNumerator); event ApprovalAttempt( address indexed owner, address indexed spender, uint256 indexed tokenId, bool success, string reason ); event SetApprovalForAllAttempt( address indexed owner, address indexed operator, bool approved, bool success, string reason ); event TransferAttempt( address indexed from, address indexed to, uint256 indexed tokenId, bool success, string reason ); event SafeTransferAttempt( address indexed from, address indexed to, uint256 indexed tokenId, bytes data, bool success, string reason ); event LocalCalAdded(address indexed operator, address indexed transferer); event LocalCalRemoved(address indexed operator, address indexed transferer); event ContractLevelUpdated(uint256 newLevel); event TokenLevelUpdated(uint256 indexed tokenId, uint256 newLevel); // === Constructor === constructor( address deployer, address _cal, address defaultRoyaltyReceiver ) DN404Mirror(deployer) { console.log("Deploying ExtendedDN404Mirror with deployer:", deployer); _grantRole(DEFAULT_ADMIN_ROLE, deployer); _grantRole(ADMIN_ROLE, deployer); _grantRole(MINTER_ROLE, deployer); defaultNFTSecurityLevel = NFTSecurityLevel.FULL; defaultRoyaltyRate = 1000; // 10% _setDefaultRoyalty(defaultRoyaltyReceiver, defaultRoyaltyRate); CAL = IContractAllowListProxy(_cal); enableRestrict = true; } // === Lock Management === function lockContract() external onlyRole(ADMIN_ROLE) { contractLocked = true; } function unlockContract() external onlyRole(ADMIN_ROLE) { contractLocked = false; } function lockWallet(address wallet) external onlyRole(ADMIN_ROLE) { walletLocked[wallet] = true; } function unlockWallet(address wallet) external onlyRole(ADMIN_ROLE) { walletLocked[wallet] = false; } function lockToken(uint256 tokenId) external onlyRole(ADMIN_ROLE) { tokenLocked[tokenId] = true; } function unlockToken(uint256 tokenId) external onlyRole(ADMIN_ROLE) { tokenLocked[tokenId] = false; } function isLocked( address wallet, uint256 tokenId ) public view returns (bool) { return contractLocked || walletLocked[wallet] || tokenLocked[tokenId]; } // === CAL Management === function setCAL(address _cal) external onlyRole(ADMIN_ROLE) { CAL = IContractAllowListProxy(_cal); } function setCALLevel(uint256 level) external onlyRole(ADMIN_ROLE) { require(level <= 2, "Invalid level"); CALLevel = level; } function addLocalContractAllowList( address transferer ) external onlyRole(ADMIN_ROLE) { localAllowedAddresses.add(transferer); emit LocalCalAdded(msg.sender, transferer); } function removeLocalContractAllowList( address transferer ) external onlyRole(ADMIN_ROLE) { localAllowedAddresses.remove(transferer); emit LocalCalRemoved(msg.sender, transferer); } function getLocalContractAllowList() external view returns (address[] memory) { return localAllowedAddresses.values(); } function setTokenCALLevel( uint256 tokenId, uint256 level ) external onlyRole(ADMIN_ROLE) { require(level <= 2, "Invalid level"); tokenCALLevel[tokenId] = level; emit TokenSecurityLevelChanged( tokenId, level == 0 ? NFTSecurityLevel.NONE : NFTSecurityLevel.CAL_ONLY ); } function setWalletCALLevel(uint256 level) external onlyRole(ADMIN_ROLE) { walletCALLevel[msg.sender] = level; } function _getCALLevel( address holder, uint256 tokenId ) internal view returns (uint256) { if (tokenCALLevel[tokenId] > 0) { return tokenCALLevel[tokenId]; } if (walletCALLevel[holder] > 0) { return walletCALLevel[holder]; } return CALLevel; } function setDefaultSecurityLevel( NFTSecurityLevel newLevel ) external onlyRole(ADMIN_ROLE) { require( newLevel == NFTSecurityLevel.FULL || newLevel == NFTSecurityLevel.NONE || newLevel == NFTSecurityLevel.CAL_ONLY, "Invalid security level" ); defaultNFTSecurityLevel = newLevel; emit SecurityLevelUpdated(newLevel); } function setTokenSecurityLevel( uint256 tokenId, NFTSecurityLevel level ) external onlyRole(ADMIN_ROLE) { require( ownerOf(tokenId) == msg.sender || hasRole(ADMIN_ROLE, msg.sender), "Not authorized" ); tokenSecurityLevels[tokenId] = level; emit TokenSecurityLevelChanged(tokenId, level); } function setDefaultRoyalty( address receiver, uint96 feeNumerator ) public onlyRole(ADMIN_ROLE) { require(receiver != address(0), "Invalid royalty receiver"); require( feeNumerator <= MAX_ROYALTY_RATE, "Royalty rate exceeds maximum" ); defaultRoyaltyRate = feeNumerator; _setDefaultRoyalty(receiver, feeNumerator); emit CreatorEarningsConfigured(receiver, feeNumerator); } function setTokenRoyalty( uint256 tokenId, address receiver, uint96 feeNumerator ) public onlyRole(ADMIN_ROLE) { require(receiver != address(0), "Invalid royalty receiver"); require( feeNumerator <= MAX_ROYALTY_RATE, "Royalty rate exceeds maximum" ); defaultRoyaltyRate = feeNumerator; _setTokenRoyalty(tokenId, receiver, feeNumerator); emit RoyaltyEnforced(tokenId, receiver, feeNumerator); } function getDefaultRoyaltyRate() external view returns (uint96) { return defaultRoyaltyRate; } function getTokenRoyaltyInfo( uint256 tokenId, uint256 salePrice ) external view returns (address receiver, uint256 royaltyAmount) { return royaltyInfo(tokenId, salePrice); } // === Allow List Checks === function _isAllowed( address operator, address tokenOwner ) internal view returns (bool) { if (!enableRestrict) return true; if (operator == tokenOwner) return true; uint256 level = _getCALLevel(tokenOwner, 0); return localAllowedAddresses.contains(operator) || CAL.isAllowed(operator, level); } function checkIsAllowed( address operator, address tokenOwner ) public view returns (bool) { return _isAllowed(operator, tokenOwner); } // === Transfer Management === function setApprovalForAll( address operator, bool approved ) public virtual override { require(_isAllowed(operator, msg.sender), "Operator not allowed"); super.setApprovalForAll(operator, approved); emit SetApprovalForAllAttempt(msg.sender, operator, approved, true, ""); } function approve( address spender, uint256 id ) public payable virtual override { address owner = ownerOf(id); NFTSecurityLevel level = tokenSecurityLevels[id] != NFTSecurityLevel.NONE ? tokenSecurityLevels[id] : defaultNFTSecurityLevel; if ( level == NFTSecurityLevel.CAL_ONLY || level == NFTSecurityLevel.FULL ) { require(_isAllowed(spender, owner), "Spender not allowed by CAL"); } super.approve(spender, id); emit ApprovalAttempt(owner, spender, id, true, ""); } // === Transfer Functions === function transferFrom( address from, address to, uint256 tokenId ) public payable virtual override nonReentrant { if (msg.value > 0) { _processRoyalty(from, to, tokenId, msg.value); } super.transferFrom(from, to, tokenId); } function _processRoyalty( address from, address to, uint256 tokenId, uint256 paymentAmount ) internal { (address receiver, uint256 royaltyAmount) = royaltyInfo(tokenId, paymentAmount); if (royaltyAmount > 0) { (bool success, ) = receiver.call{value: royaltyAmount}(""); require(success, "Royalty transfer failed"); uint256 excess = paymentAmount - royaltyAmount; if (excess > 0) { (bool refundSuccess, ) = payable(msg.sender).call{value: excess}(""); require(refundSuccess, "Refund failed"); } emit RoyaltyPaid( address(this), tokenId, receiver, from, to, royaltyAmount ); } } function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) public payable virtual override nonReentrant { if (msg.value > 0) { _processRoyalty(from, to, tokenId, msg.value); } super.safeTransferFrom(from, to, tokenId, data); } function safeTransferFrom( address from, address to, uint256 tokenId ) public payable virtual override nonReentrant { if (msg.value > 0) { _processRoyalty(from, to, tokenId, msg.value); } super.safeTransferFrom(from, to, tokenId); } /** * @dev Returns allowed contract level for a given token * @param tokenId Token ID to check */ function contractLevel(uint256 tokenId) external view returns (uint256) { return _getCALLevel(ownerOf(tokenId), tokenId); } /** * @dev Returns the base contract level */ function defaultContractLevel() external view returns (uint256) { return CALLevel; } // === Interface Support === function supportsInterface( bytes4 interfaceId ) public view virtual override(DN404Mirror, AccessControl, ERC2981) returns (bool) { return interfaceId == INTERFACE_ID_ERC721C || interfaceId == INTERFACE_ID_CONTRACT_LEVEL || interfaceId == _SEAPORT_HOOK_INTERFACE || DN404Mirror.supportsInterface(interfaceId) || AccessControl.supportsInterface(interfaceId) || ERC2981.supportsInterface(interfaceId); } // === Utility Functions === receive() external payable virtual override {} function withdrawETH() external onlyRole(ADMIN_ROLE) { (bool success, ) = msg.sender.call{value: address(this).balance}(""); require(success, "ETH withdrawal failed"); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.4.22 <0.9.0; library console { address constant CONSOLE_ADDRESS = 0x000000000000000000636F6e736F6c652e6c6f67; function _sendLogPayloadImplementation(bytes memory payload) internal view { address consoleAddress = CONSOLE_ADDRESS; /// @solidity memory-safe-assembly assembly { pop( staticcall( gas(), consoleAddress, add(payload, 32), mload(payload), 0, 0 ) ) } } function _castToPure( function(bytes memory) internal view fnIn ) internal pure returns (function(bytes memory) pure fnOut) { assembly { fnOut := fnIn } } function _sendLogPayload(bytes memory payload) internal pure { _castToPure(_sendLogPayloadImplementation)(payload); } function log() internal pure { _sendLogPayload(abi.encodeWithSignature("log()")); } function logInt(int256 p0) internal pure { _sendLogPayload(abi.encodeWithSignature("log(int256)", p0)); } function logUint(uint256 p0) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256)", p0)); } function logString(string memory p0) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string)", p0)); } function logBool(bool p0) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool)", p0)); } function logAddress(address p0) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address)", p0)); } function logBytes(bytes memory p0) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bytes)", p0)); } function logBytes1(bytes1 p0) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bytes1)", p0)); } function logBytes2(bytes2 p0) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bytes2)", p0)); } function logBytes3(bytes3 p0) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bytes3)", p0)); } function logBytes4(bytes4 p0) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bytes4)", p0)); } function logBytes5(bytes5 p0) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bytes5)", p0)); } function logBytes6(bytes6 p0) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bytes6)", p0)); } function logBytes7(bytes7 p0) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bytes7)", p0)); } function logBytes8(bytes8 p0) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bytes8)", p0)); } function logBytes9(bytes9 p0) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bytes9)", p0)); } function logBytes10(bytes10 p0) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bytes10)", p0)); } function logBytes11(bytes11 p0) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bytes11)", p0)); } function logBytes12(bytes12 p0) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bytes12)", p0)); } function logBytes13(bytes13 p0) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bytes13)", p0)); } function logBytes14(bytes14 p0) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bytes14)", p0)); } function logBytes15(bytes15 p0) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bytes15)", p0)); } function logBytes16(bytes16 p0) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bytes16)", p0)); } function logBytes17(bytes17 p0) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bytes17)", p0)); } function logBytes18(bytes18 p0) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bytes18)", p0)); } function logBytes19(bytes19 p0) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bytes19)", p0)); } function logBytes20(bytes20 p0) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bytes20)", p0)); } function logBytes21(bytes21 p0) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bytes21)", p0)); } function logBytes22(bytes22 p0) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bytes22)", p0)); } function logBytes23(bytes23 p0) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bytes23)", p0)); } function logBytes24(bytes24 p0) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bytes24)", p0)); } function logBytes25(bytes25 p0) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bytes25)", p0)); } function logBytes26(bytes26 p0) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bytes26)", p0)); } function logBytes27(bytes27 p0) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bytes27)", p0)); } function logBytes28(bytes28 p0) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bytes28)", p0)); } function logBytes29(bytes29 p0) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bytes29)", p0)); } function logBytes30(bytes30 p0) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bytes30)", p0)); } function logBytes31(bytes31 p0) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bytes31)", p0)); } function logBytes32(bytes32 p0) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bytes32)", p0)); } function log(uint256 p0) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256)", p0)); } function log(string memory p0) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string)", p0)); } function log(bool p0) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool)", p0)); } function log(address p0) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address)", p0)); } function log(uint256 p0, uint256 p1) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256)", p0, p1)); } function log(uint256 p0, string memory p1) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,string)", p0, p1)); } function log(uint256 p0, bool p1) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,bool)", p0, p1)); } function log(uint256 p0, address p1) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,address)", p0, p1)); } function log(string memory p0, uint256 p1) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,uint256)", p0, p1)); } function log(string memory p0, string memory p1) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,string)", p0, p1)); } function log(string memory p0, bool p1) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,bool)", p0, p1)); } function log(string memory p0, address p1) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,address)", p0, p1)); } function log(bool p0, uint256 p1) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,uint256)", p0, p1)); } function log(bool p0, string memory p1) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,string)", p0, p1)); } function log(bool p0, bool p1) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,bool)", p0, p1)); } function log(bool p0, address p1) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,address)", p0, p1)); } function log(address p0, uint256 p1) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,uint256)", p0, p1)); } function log(address p0, string memory p1) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,string)", p0, p1)); } function log(address p0, bool p1) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,bool)", p0, p1)); } function log(address p0, address p1) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,address)", p0, p1)); } function log(uint256 p0, uint256 p1, uint256 p2) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,uint256)", p0, p1, p2)); } function log(uint256 p0, uint256 p1, string memory p2) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,string)", p0, p1, p2)); } function log(uint256 p0, uint256 p1, bool p2) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,bool)", p0, p1, p2)); } function log(uint256 p0, uint256 p1, address p2) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,address)", p0, p1, p2)); } function log(uint256 p0, string memory p1, uint256 p2) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,string,uint256)", p0, p1, p2)); } function log(uint256 p0, string memory p1, string memory p2) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,string,string)", p0, p1, p2)); } function log(uint256 p0, string memory p1, bool p2) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,string,bool)", p0, p1, p2)); } function log(uint256 p0, string memory p1, address p2) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,string,address)", p0, p1, p2)); } function log(uint256 p0, bool p1, uint256 p2) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,bool,uint256)", p0, p1, p2)); } function log(uint256 p0, bool p1, string memory p2) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,bool,string)", p0, p1, p2)); } function log(uint256 p0, bool p1, bool p2) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,bool,bool)", p0, p1, p2)); } function log(uint256 p0, bool p1, address p2) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,bool,address)", p0, p1, p2)); } function log(uint256 p0, address p1, uint256 p2) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,address,uint256)", p0, p1, p2)); } function log(uint256 p0, address p1, string memory p2) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,address,string)", p0, p1, p2)); } function log(uint256 p0, address p1, bool p2) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,address,bool)", p0, p1, p2)); } function log(uint256 p0, address p1, address p2) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,address,address)", p0, p1, p2)); } function log(string memory p0, uint256 p1, uint256 p2) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,uint256,uint256)", p0, p1, p2)); } function log(string memory p0, uint256 p1, string memory p2) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,uint256,string)", p0, p1, p2)); } function log(string memory p0, uint256 p1, bool p2) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,uint256,bool)", p0, p1, p2)); } function log(string memory p0, uint256 p1, address p2) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,uint256,address)", p0, p1, p2)); } function log(string memory p0, string memory p1, uint256 p2) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,string,uint256)", p0, p1, p2)); } function log(string memory p0, string memory p1, string memory p2) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,string,string)", p0, p1, p2)); } function log(string memory p0, string memory p1, bool p2) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,string,bool)", p0, p1, p2)); } function log(string memory p0, string memory p1, address p2) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,string,address)", p0, p1, p2)); } function log(string memory p0, bool p1, uint256 p2) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,bool,uint256)", p0, p1, p2)); } function log(string memory p0, bool p1, string memory p2) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,bool,string)", p0, p1, p2)); } function log(string memory p0, bool p1, bool p2) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,bool,bool)", p0, p1, p2)); } function log(string memory p0, bool p1, address p2) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,bool,address)", p0, p1, p2)); } function log(string memory p0, address p1, uint256 p2) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,address,uint256)", p0, p1, p2)); } function log(string memory p0, address p1, string memory p2) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,address,string)", p0, p1, p2)); } function log(string memory p0, address p1, bool p2) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,address,bool)", p0, p1, p2)); } function log(string memory p0, address p1, address p2) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,address,address)", p0, p1, p2)); } function log(bool p0, uint256 p1, uint256 p2) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,uint256,uint256)", p0, p1, p2)); } function log(bool p0, uint256 p1, string memory p2) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,uint256,string)", p0, p1, p2)); } function log(bool p0, uint256 p1, bool p2) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,uint256,bool)", p0, p1, p2)); } function log(bool p0, uint256 p1, address p2) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,uint256,address)", p0, p1, p2)); } function log(bool p0, string memory p1, uint256 p2) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,string,uint256)", p0, p1, p2)); } function log(bool p0, string memory p1, string memory p2) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,string,string)", p0, p1, p2)); } function log(bool p0, string memory p1, bool p2) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,string,bool)", p0, p1, p2)); } function log(bool p0, string memory p1, address p2) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,string,address)", p0, p1, p2)); } function log(bool p0, bool p1, uint256 p2) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint256)", p0, p1, p2)); } function log(bool p0, bool p1, string memory p2) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,string)", p0, p1, p2)); } function log(bool p0, bool p1, bool p2) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool)", p0, p1, p2)); } function log(bool p0, bool p1, address p2) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,address)", p0, p1, p2)); } function log(bool p0, address p1, uint256 p2) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,address,uint256)", p0, p1, p2)); } function log(bool p0, address p1, string memory p2) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,address,string)", p0, p1, p2)); } function log(bool p0, address p1, bool p2) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,address,bool)", p0, p1, p2)); } function log(bool p0, address p1, address p2) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,address,address)", p0, p1, p2)); } function log(address p0, uint256 p1, uint256 p2) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,uint256,uint256)", p0, p1, p2)); } function log(address p0, uint256 p1, string memory p2) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,uint256,string)", p0, p1, p2)); } function log(address p0, uint256 p1, bool p2) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,uint256,bool)", p0, p1, p2)); } function log(address p0, uint256 p1, address p2) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,uint256,address)", p0, p1, p2)); } function log(address p0, string memory p1, uint256 p2) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,string,uint256)", p0, p1, p2)); } function log(address p0, string memory p1, string memory p2) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,string,string)", p0, p1, p2)); } function log(address p0, string memory p1, bool p2) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,string,bool)", p0, p1, p2)); } function log(address p0, string memory p1, address p2) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,string,address)", p0, p1, p2)); } function log(address p0, bool p1, uint256 p2) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,bool,uint256)", p0, p1, p2)); } function log(address p0, bool p1, string memory p2) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,bool,string)", p0, p1, p2)); } function log(address p0, bool p1, bool p2) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,bool,bool)", p0, p1, p2)); } function log(address p0, bool p1, address p2) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,bool,address)", p0, p1, p2)); } function log(address p0, address p1, uint256 p2) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,address,uint256)", p0, p1, p2)); } function log(address p0, address p1, string memory p2) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,address,string)", p0, p1, p2)); } function log(address p0, address p1, bool p2) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,address,bool)", p0, p1, p2)); } function log(address p0, address p1, address p2) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,address,address)", p0, p1, p2)); } function log(uint256 p0, uint256 p1, uint256 p2, uint256 p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,uint256,uint256)", p0, p1, p2, p3)); } function log(uint256 p0, uint256 p1, uint256 p2, string memory p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,uint256,string)", p0, p1, p2, p3)); } function log(uint256 p0, uint256 p1, uint256 p2, bool p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,uint256,bool)", p0, p1, p2, p3)); } function log(uint256 p0, uint256 p1, uint256 p2, address p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,uint256,address)", p0, p1, p2, p3)); } function log(uint256 p0, uint256 p1, string memory p2, uint256 p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,string,uint256)", p0, p1, p2, p3)); } function log(uint256 p0, uint256 p1, string memory p2, string memory p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,string,string)", p0, p1, p2, p3)); } function log(uint256 p0, uint256 p1, string memory p2, bool p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,string,bool)", p0, p1, p2, p3)); } function log(uint256 p0, uint256 p1, string memory p2, address p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,string,address)", p0, p1, p2, p3)); } function log(uint256 p0, uint256 p1, bool p2, uint256 p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,bool,uint256)", p0, p1, p2, p3)); } function log(uint256 p0, uint256 p1, bool p2, string memory p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,bool,string)", p0, p1, p2, p3)); } function log(uint256 p0, uint256 p1, bool p2, bool p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,bool,bool)", p0, p1, p2, p3)); } function log(uint256 p0, uint256 p1, bool p2, address p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,bool,address)", p0, p1, p2, p3)); } function log(uint256 p0, uint256 p1, address p2, uint256 p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,address,uint256)", p0, p1, p2, p3)); } function log(uint256 p0, uint256 p1, address p2, string memory p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,address,string)", p0, p1, p2, p3)); } function log(uint256 p0, uint256 p1, address p2, bool p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,address,bool)", p0, p1, p2, p3)); } function log(uint256 p0, uint256 p1, address p2, address p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,address,address)", p0, p1, p2, p3)); } function log(uint256 p0, string memory p1, uint256 p2, uint256 p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,string,uint256,uint256)", p0, p1, p2, p3)); } function log(uint256 p0, string memory p1, uint256 p2, string memory p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,string,uint256,string)", p0, p1, p2, p3)); } function log(uint256 p0, string memory p1, uint256 p2, bool p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,string,uint256,bool)", p0, p1, p2, p3)); } function log(uint256 p0, string memory p1, uint256 p2, address p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,string,uint256,address)", p0, p1, p2, p3)); } function log(uint256 p0, string memory p1, string memory p2, uint256 p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,string,string,uint256)", p0, p1, p2, p3)); } function log(uint256 p0, string memory p1, string memory p2, string memory p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,string,string,string)", p0, p1, p2, p3)); } function log(uint256 p0, string memory p1, string memory p2, bool p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,string,string,bool)", p0, p1, p2, p3)); } function log(uint256 p0, string memory p1, string memory p2, address p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,string,string,address)", p0, p1, p2, p3)); } function log(uint256 p0, string memory p1, bool p2, uint256 p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,string,bool,uint256)", p0, p1, p2, p3)); } function log(uint256 p0, string memory p1, bool p2, string memory p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,string,bool,string)", p0, p1, p2, p3)); } function log(uint256 p0, string memory p1, bool p2, bool p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,string,bool,bool)", p0, p1, p2, p3)); } function log(uint256 p0, string memory p1, bool p2, address p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,string,bool,address)", p0, p1, p2, p3)); } function log(uint256 p0, string memory p1, address p2, uint256 p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,string,address,uint256)", p0, p1, p2, p3)); } function log(uint256 p0, string memory p1, address p2, string memory p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,string,address,string)", p0, p1, p2, p3)); } function log(uint256 p0, string memory p1, address p2, bool p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,string,address,bool)", p0, p1, p2, p3)); } function log(uint256 p0, string memory p1, address p2, address p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,string,address,address)", p0, p1, p2, p3)); } function log(uint256 p0, bool p1, uint256 p2, uint256 p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,bool,uint256,uint256)", p0, p1, p2, p3)); } function log(uint256 p0, bool p1, uint256 p2, string memory p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,bool,uint256,string)", p0, p1, p2, p3)); } function log(uint256 p0, bool p1, uint256 p2, bool p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,bool,uint256,bool)", p0, p1, p2, p3)); } function log(uint256 p0, bool p1, uint256 p2, address p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,bool,uint256,address)", p0, p1, p2, p3)); } function log(uint256 p0, bool p1, string memory p2, uint256 p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,bool,string,uint256)", p0, p1, p2, p3)); } function log(uint256 p0, bool p1, string memory p2, string memory p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,bool,string,string)", p0, p1, p2, p3)); } function log(uint256 p0, bool p1, string memory p2, bool p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,bool,string,bool)", p0, p1, p2, p3)); } function log(uint256 p0, bool p1, string memory p2, address p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,bool,string,address)", p0, p1, p2, p3)); } function log(uint256 p0, bool p1, bool p2, uint256 p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,bool,bool,uint256)", p0, p1, p2, p3)); } function log(uint256 p0, bool p1, bool p2, string memory p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,bool,bool,string)", p0, p1, p2, p3)); } function log(uint256 p0, bool p1, bool p2, bool p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,bool,bool,bool)", p0, p1, p2, p3)); } function log(uint256 p0, bool p1, bool p2, address p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,bool,bool,address)", p0, p1, p2, p3)); } function log(uint256 p0, bool p1, address p2, uint256 p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,bool,address,uint256)", p0, p1, p2, p3)); } function log(uint256 p0, bool p1, address p2, string memory p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,bool,address,string)", p0, p1, p2, p3)); } function log(uint256 p0, bool p1, address p2, bool p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,bool,address,bool)", p0, p1, p2, p3)); } function log(uint256 p0, bool p1, address p2, address p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,bool,address,address)", p0, p1, p2, p3)); } function log(uint256 p0, address p1, uint256 p2, uint256 p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,address,uint256,uint256)", p0, p1, p2, p3)); } function log(uint256 p0, address p1, uint256 p2, string memory p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,address,uint256,string)", p0, p1, p2, p3)); } function log(uint256 p0, address p1, uint256 p2, bool p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,address,uint256,bool)", p0, p1, p2, p3)); } function log(uint256 p0, address p1, uint256 p2, address p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,address,uint256,address)", p0, p1, p2, p3)); } function log(uint256 p0, address p1, string memory p2, uint256 p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,address,string,uint256)", p0, p1, p2, p3)); } function log(uint256 p0, address p1, string memory p2, string memory p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,address,string,string)", p0, p1, p2, p3)); } function log(uint256 p0, address p1, string memory p2, bool p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,address,string,bool)", p0, p1, p2, p3)); } function log(uint256 p0, address p1, string memory p2, address p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,address,string,address)", p0, p1, p2, p3)); } function log(uint256 p0, address p1, bool p2, uint256 p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,address,bool,uint256)", p0, p1, p2, p3)); } function log(uint256 p0, address p1, bool p2, string memory p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,address,bool,string)", p0, p1, p2, p3)); } function log(uint256 p0, address p1, bool p2, bool p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,address,bool,bool)", p0, p1, p2, p3)); } function log(uint256 p0, address p1, bool p2, address p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,address,bool,address)", p0, p1, p2, p3)); } function log(uint256 p0, address p1, address p2, uint256 p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,address,address,uint256)", p0, p1, p2, p3)); } function log(uint256 p0, address p1, address p2, string memory p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,address,address,string)", p0, p1, p2, p3)); } function log(uint256 p0, address p1, address p2, bool p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,address,address,bool)", p0, p1, p2, p3)); } function log(uint256 p0, address p1, address p2, address p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(uint256,address,address,address)", p0, p1, p2, p3)); } function log(string memory p0, uint256 p1, uint256 p2, uint256 p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,uint256,uint256,uint256)", p0, p1, p2, p3)); } function log(string memory p0, uint256 p1, uint256 p2, string memory p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,uint256,uint256,string)", p0, p1, p2, p3)); } function log(string memory p0, uint256 p1, uint256 p2, bool p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,uint256,uint256,bool)", p0, p1, p2, p3)); } function log(string memory p0, uint256 p1, uint256 p2, address p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,uint256,uint256,address)", p0, p1, p2, p3)); } function log(string memory p0, uint256 p1, string memory p2, uint256 p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,uint256,string,uint256)", p0, p1, p2, p3)); } function log(string memory p0, uint256 p1, string memory p2, string memory p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,uint256,string,string)", p0, p1, p2, p3)); } function log(string memory p0, uint256 p1, string memory p2, bool p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,uint256,string,bool)", p0, p1, p2, p3)); } function log(string memory p0, uint256 p1, string memory p2, address p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,uint256,string,address)", p0, p1, p2, p3)); } function log(string memory p0, uint256 p1, bool p2, uint256 p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,uint256,bool,uint256)", p0, p1, p2, p3)); } function log(string memory p0, uint256 p1, bool p2, string memory p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,uint256,bool,string)", p0, p1, p2, p3)); } function log(string memory p0, uint256 p1, bool p2, bool p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,uint256,bool,bool)", p0, p1, p2, p3)); } function log(string memory p0, uint256 p1, bool p2, address p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,uint256,bool,address)", p0, p1, p2, p3)); } function log(string memory p0, uint256 p1, address p2, uint256 p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,uint256,address,uint256)", p0, p1, p2, p3)); } function log(string memory p0, uint256 p1, address p2, string memory p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,uint256,address,string)", p0, p1, p2, p3)); } function log(string memory p0, uint256 p1, address p2, bool p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,uint256,address,bool)", p0, p1, p2, p3)); } function log(string memory p0, uint256 p1, address p2, address p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,uint256,address,address)", p0, p1, p2, p3)); } function log(string memory p0, string memory p1, uint256 p2, uint256 p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,string,uint256,uint256)", p0, p1, p2, p3)); } function log(string memory p0, string memory p1, uint256 p2, string memory p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,string,uint256,string)", p0, p1, p2, p3)); } function log(string memory p0, string memory p1, uint256 p2, bool p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,string,uint256,bool)", p0, p1, p2, p3)); } function log(string memory p0, string memory p1, uint256 p2, address p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,string,uint256,address)", p0, p1, p2, p3)); } function log(string memory p0, string memory p1, string memory p2, uint256 p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,string,string,uint256)", p0, p1, p2, p3)); } function log(string memory p0, string memory p1, string memory p2, string memory p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,string,string,string)", p0, p1, p2, p3)); } function log(string memory p0, string memory p1, string memory p2, bool p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,string,string,bool)", p0, p1, p2, p3)); } function log(string memory p0, string memory p1, string memory p2, address p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,string,string,address)", p0, p1, p2, p3)); } function log(string memory p0, string memory p1, bool p2, uint256 p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,string,bool,uint256)", p0, p1, p2, p3)); } function log(string memory p0, string memory p1, bool p2, string memory p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,string,bool,string)", p0, p1, p2, p3)); } function log(string memory p0, string memory p1, bool p2, bool p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,string,bool,bool)", p0, p1, p2, p3)); } function log(string memory p0, string memory p1, bool p2, address p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,string,bool,address)", p0, p1, p2, p3)); } function log(string memory p0, string memory p1, address p2, uint256 p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,string,address,uint256)", p0, p1, p2, p3)); } function log(string memory p0, string memory p1, address p2, string memory p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,string,address,string)", p0, p1, p2, p3)); } function log(string memory p0, string memory p1, address p2, bool p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,string,address,bool)", p0, p1, p2, p3)); } function log(string memory p0, string memory p1, address p2, address p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,string,address,address)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, uint256 p2, uint256 p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,bool,uint256,uint256)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, uint256 p2, string memory p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,bool,uint256,string)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, uint256 p2, bool p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,bool,uint256,bool)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, uint256 p2, address p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,bool,uint256,address)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, string memory p2, uint256 p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,bool,string,uint256)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, string memory p2, string memory p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,bool,string,string)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, string memory p2, bool p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,bool,string,bool)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, string memory p2, address p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,bool,string,address)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, bool p2, uint256 p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,bool,bool,uint256)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, bool p2, string memory p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,bool,bool,string)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, bool p2, bool p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,bool,bool,bool)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, bool p2, address p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,bool,bool,address)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, address p2, uint256 p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,bool,address,uint256)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, address p2, string memory p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,bool,address,string)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, address p2, bool p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,bool,address,bool)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, address p2, address p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,bool,address,address)", p0, p1, p2, p3)); } function log(string memory p0, address p1, uint256 p2, uint256 p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,address,uint256,uint256)", p0, p1, p2, p3)); } function log(string memory p0, address p1, uint256 p2, string memory p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,address,uint256,string)", p0, p1, p2, p3)); } function log(string memory p0, address p1, uint256 p2, bool p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,address,uint256,bool)", p0, p1, p2, p3)); } function log(string memory p0, address p1, uint256 p2, address p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,address,uint256,address)", p0, p1, p2, p3)); } function log(string memory p0, address p1, string memory p2, uint256 p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,address,string,uint256)", p0, p1, p2, p3)); } function log(string memory p0, address p1, string memory p2, string memory p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,address,string,string)", p0, p1, p2, p3)); } function log(string memory p0, address p1, string memory p2, bool p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,address,string,bool)", p0, p1, p2, p3)); } function log(string memory p0, address p1, string memory p2, address p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,address,string,address)", p0, p1, p2, p3)); } function log(string memory p0, address p1, bool p2, uint256 p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,address,bool,uint256)", p0, p1, p2, p3)); } function log(string memory p0, address p1, bool p2, string memory p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,address,bool,string)", p0, p1, p2, p3)); } function log(string memory p0, address p1, bool p2, bool p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,address,bool,bool)", p0, p1, p2, p3)); } function log(string memory p0, address p1, bool p2, address p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,address,bool,address)", p0, p1, p2, p3)); } function log(string memory p0, address p1, address p2, uint256 p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,address,address,uint256)", p0, p1, p2, p3)); } function log(string memory p0, address p1, address p2, string memory p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,address,address,string)", p0, p1, p2, p3)); } function log(string memory p0, address p1, address p2, bool p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,address,address,bool)", p0, p1, p2, p3)); } function log(string memory p0, address p1, address p2, address p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(string,address,address,address)", p0, p1, p2, p3)); } function log(bool p0, uint256 p1, uint256 p2, uint256 p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,uint256,uint256,uint256)", p0, p1, p2, p3)); } function log(bool p0, uint256 p1, uint256 p2, string memory p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,uint256,uint256,string)", p0, p1, p2, p3)); } function log(bool p0, uint256 p1, uint256 p2, bool p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,uint256,uint256,bool)", p0, p1, p2, p3)); } function log(bool p0, uint256 p1, uint256 p2, address p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,uint256,uint256,address)", p0, p1, p2, p3)); } function log(bool p0, uint256 p1, string memory p2, uint256 p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,uint256,string,uint256)", p0, p1, p2, p3)); } function log(bool p0, uint256 p1, string memory p2, string memory p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,uint256,string,string)", p0, p1, p2, p3)); } function log(bool p0, uint256 p1, string memory p2, bool p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,uint256,string,bool)", p0, p1, p2, p3)); } function log(bool p0, uint256 p1, string memory p2, address p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,uint256,string,address)", p0, p1, p2, p3)); } function log(bool p0, uint256 p1, bool p2, uint256 p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,uint256,bool,uint256)", p0, p1, p2, p3)); } function log(bool p0, uint256 p1, bool p2, string memory p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,uint256,bool,string)", p0, p1, p2, p3)); } function log(bool p0, uint256 p1, bool p2, bool p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,uint256,bool,bool)", p0, p1, p2, p3)); } function log(bool p0, uint256 p1, bool p2, address p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,uint256,bool,address)", p0, p1, p2, p3)); } function log(bool p0, uint256 p1, address p2, uint256 p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,uint256,address,uint256)", p0, p1, p2, p3)); } function log(bool p0, uint256 p1, address p2, string memory p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,uint256,address,string)", p0, p1, p2, p3)); } function log(bool p0, uint256 p1, address p2, bool p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,uint256,address,bool)", p0, p1, p2, p3)); } function log(bool p0, uint256 p1, address p2, address p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,uint256,address,address)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, uint256 p2, uint256 p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,string,uint256,uint256)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, uint256 p2, string memory p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,string,uint256,string)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, uint256 p2, bool p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,string,uint256,bool)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, uint256 p2, address p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,string,uint256,address)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, string memory p2, uint256 p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,string,string,uint256)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, string memory p2, string memory p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,string,string,string)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, string memory p2, bool p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,string,string,bool)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, string memory p2, address p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,string,string,address)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, bool p2, uint256 p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,string,bool,uint256)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, bool p2, string memory p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,string,bool,string)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, bool p2, bool p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,string,bool,bool)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, bool p2, address p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,string,bool,address)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, address p2, uint256 p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,string,address,uint256)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, address p2, string memory p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,string,address,string)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, address p2, bool p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,string,address,bool)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, address p2, address p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,string,address,address)", p0, p1, p2, p3)); } function log(bool p0, bool p1, uint256 p2, uint256 p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint256,uint256)", p0, p1, p2, p3)); } function log(bool p0, bool p1, uint256 p2, string memory p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint256,string)", p0, p1, p2, p3)); } function log(bool p0, bool p1, uint256 p2, bool p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint256,bool)", p0, p1, p2, p3)); } function log(bool p0, bool p1, uint256 p2, address p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint256,address)", p0, p1, p2, p3)); } function log(bool p0, bool p1, string memory p2, uint256 p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,string,uint256)", p0, p1, p2, p3)); } function log(bool p0, bool p1, string memory p2, string memory p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,string,string)", p0, p1, p2, p3)); } function log(bool p0, bool p1, string memory p2, bool p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,string,bool)", p0, p1, p2, p3)); } function log(bool p0, bool p1, string memory p2, address p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,string,address)", p0, p1, p2, p3)); } function log(bool p0, bool p1, bool p2, uint256 p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool,uint256)", p0, p1, p2, p3)); } function log(bool p0, bool p1, bool p2, string memory p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool,string)", p0, p1, p2, p3)); } function log(bool p0, bool p1, bool p2, bool p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool,bool)", p0, p1, p2, p3)); } function log(bool p0, bool p1, bool p2, address p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool,address)", p0, p1, p2, p3)); } function log(bool p0, bool p1, address p2, uint256 p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,address,uint256)", p0, p1, p2, p3)); } function log(bool p0, bool p1, address p2, string memory p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,address,string)", p0, p1, p2, p3)); } function log(bool p0, bool p1, address p2, bool p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,address,bool)", p0, p1, p2, p3)); } function log(bool p0, bool p1, address p2, address p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,address,address)", p0, p1, p2, p3)); } function log(bool p0, address p1, uint256 p2, uint256 p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,address,uint256,uint256)", p0, p1, p2, p3)); } function log(bool p0, address p1, uint256 p2, string memory p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,address,uint256,string)", p0, p1, p2, p3)); } function log(bool p0, address p1, uint256 p2, bool p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,address,uint256,bool)", p0, p1, p2, p3)); } function log(bool p0, address p1, uint256 p2, address p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,address,uint256,address)", p0, p1, p2, p3)); } function log(bool p0, address p1, string memory p2, uint256 p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,address,string,uint256)", p0, p1, p2, p3)); } function log(bool p0, address p1, string memory p2, string memory p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,address,string,string)", p0, p1, p2, p3)); } function log(bool p0, address p1, string memory p2, bool p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,address,string,bool)", p0, p1, p2, p3)); } function log(bool p0, address p1, string memory p2, address p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,address,string,address)", p0, p1, p2, p3)); } function log(bool p0, address p1, bool p2, uint256 p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,address,bool,uint256)", p0, p1, p2, p3)); } function log(bool p0, address p1, bool p2, string memory p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,address,bool,string)", p0, p1, p2, p3)); } function log(bool p0, address p1, bool p2, bool p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,address,bool,bool)", p0, p1, p2, p3)); } function log(bool p0, address p1, bool p2, address p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,address,bool,address)", p0, p1, p2, p3)); } function log(bool p0, address p1, address p2, uint256 p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,address,address,uint256)", p0, p1, p2, p3)); } function log(bool p0, address p1, address p2, string memory p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,address,address,string)", p0, p1, p2, p3)); } function log(bool p0, address p1, address p2, bool p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,address,address,bool)", p0, p1, p2, p3)); } function log(bool p0, address p1, address p2, address p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(bool,address,address,address)", p0, p1, p2, p3)); } function log(address p0, uint256 p1, uint256 p2, uint256 p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,uint256,uint256,uint256)", p0, p1, p2, p3)); } function log(address p0, uint256 p1, uint256 p2, string memory p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,uint256,uint256,string)", p0, p1, p2, p3)); } function log(address p0, uint256 p1, uint256 p2, bool p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,uint256,uint256,bool)", p0, p1, p2, p3)); } function log(address p0, uint256 p1, uint256 p2, address p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,uint256,uint256,address)", p0, p1, p2, p3)); } function log(address p0, uint256 p1, string memory p2, uint256 p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,uint256,string,uint256)", p0, p1, p2, p3)); } function log(address p0, uint256 p1, string memory p2, string memory p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,uint256,string,string)", p0, p1, p2, p3)); } function log(address p0, uint256 p1, string memory p2, bool p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,uint256,string,bool)", p0, p1, p2, p3)); } function log(address p0, uint256 p1, string memory p2, address p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,uint256,string,address)", p0, p1, p2, p3)); } function log(address p0, uint256 p1, bool p2, uint256 p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,uint256,bool,uint256)", p0, p1, p2, p3)); } function log(address p0, uint256 p1, bool p2, string memory p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,uint256,bool,string)", p0, p1, p2, p3)); } function log(address p0, uint256 p1, bool p2, bool p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,uint256,bool,bool)", p0, p1, p2, p3)); } function log(address p0, uint256 p1, bool p2, address p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,uint256,bool,address)", p0, p1, p2, p3)); } function log(address p0, uint256 p1, address p2, uint256 p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,uint256,address,uint256)", p0, p1, p2, p3)); } function log(address p0, uint256 p1, address p2, string memory p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,uint256,address,string)", p0, p1, p2, p3)); } function log(address p0, uint256 p1, address p2, bool p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,uint256,address,bool)", p0, p1, p2, p3)); } function log(address p0, uint256 p1, address p2, address p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,uint256,address,address)", p0, p1, p2, p3)); } function log(address p0, string memory p1, uint256 p2, uint256 p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,string,uint256,uint256)", p0, p1, p2, p3)); } function log(address p0, string memory p1, uint256 p2, string memory p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,string,uint256,string)", p0, p1, p2, p3)); } function log(address p0, string memory p1, uint256 p2, bool p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,string,uint256,bool)", p0, p1, p2, p3)); } function log(address p0, string memory p1, uint256 p2, address p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,string,uint256,address)", p0, p1, p2, p3)); } function log(address p0, string memory p1, string memory p2, uint256 p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,string,string,uint256)", p0, p1, p2, p3)); } function log(address p0, string memory p1, string memory p2, string memory p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,string,string,string)", p0, p1, p2, p3)); } function log(address p0, string memory p1, string memory p2, bool p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,string,string,bool)", p0, p1, p2, p3)); } function log(address p0, string memory p1, string memory p2, address p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,string,string,address)", p0, p1, p2, p3)); } function log(address p0, string memory p1, bool p2, uint256 p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,string,bool,uint256)", p0, p1, p2, p3)); } function log(address p0, string memory p1, bool p2, string memory p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,string,bool,string)", p0, p1, p2, p3)); } function log(address p0, string memory p1, bool p2, bool p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,string,bool,bool)", p0, p1, p2, p3)); } function log(address p0, string memory p1, bool p2, address p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,string,bool,address)", p0, p1, p2, p3)); } function log(address p0, string memory p1, address p2, uint256 p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,string,address,uint256)", p0, p1, p2, p3)); } function log(address p0, string memory p1, address p2, string memory p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,string,address,string)", p0, p1, p2, p3)); } function log(address p0, string memory p1, address p2, bool p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,string,address,bool)", p0, p1, p2, p3)); } function log(address p0, string memory p1, address p2, address p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,string,address,address)", p0, p1, p2, p3)); } function log(address p0, bool p1, uint256 p2, uint256 p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,bool,uint256,uint256)", p0, p1, p2, p3)); } function log(address p0, bool p1, uint256 p2, string memory p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,bool,uint256,string)", p0, p1, p2, p3)); } function log(address p0, bool p1, uint256 p2, bool p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,bool,uint256,bool)", p0, p1, p2, p3)); } function log(address p0, bool p1, uint256 p2, address p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,bool,uint256,address)", p0, p1, p2, p3)); } function log(address p0, bool p1, string memory p2, uint256 p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,bool,string,uint256)", p0, p1, p2, p3)); } function log(address p0, bool p1, string memory p2, string memory p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,bool,string,string)", p0, p1, p2, p3)); } function log(address p0, bool p1, string memory p2, bool p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,bool,string,bool)", p0, p1, p2, p3)); } function log(address p0, bool p1, string memory p2, address p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,bool,string,address)", p0, p1, p2, p3)); } function log(address p0, bool p1, bool p2, uint256 p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,bool,bool,uint256)", p0, p1, p2, p3)); } function log(address p0, bool p1, bool p2, string memory p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,bool,bool,string)", p0, p1, p2, p3)); } function log(address p0, bool p1, bool p2, bool p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,bool,bool,bool)", p0, p1, p2, p3)); } function log(address p0, bool p1, bool p2, address p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,bool,bool,address)", p0, p1, p2, p3)); } function log(address p0, bool p1, address p2, uint256 p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,bool,address,uint256)", p0, p1, p2, p3)); } function log(address p0, bool p1, address p2, string memory p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,bool,address,string)", p0, p1, p2, p3)); } function log(address p0, bool p1, address p2, bool p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,bool,address,bool)", p0, p1, p2, p3)); } function log(address p0, bool p1, address p2, address p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,bool,address,address)", p0, p1, p2, p3)); } function log(address p0, address p1, uint256 p2, uint256 p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,address,uint256,uint256)", p0, p1, p2, p3)); } function log(address p0, address p1, uint256 p2, string memory p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,address,uint256,string)", p0, p1, p2, p3)); } function log(address p0, address p1, uint256 p2, bool p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,address,uint256,bool)", p0, p1, p2, p3)); } function log(address p0, address p1, uint256 p2, address p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,address,uint256,address)", p0, p1, p2, p3)); } function log(address p0, address p1, string memory p2, uint256 p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,address,string,uint256)", p0, p1, p2, p3)); } function log(address p0, address p1, string memory p2, string memory p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,address,string,string)", p0, p1, p2, p3)); } function log(address p0, address p1, string memory p2, bool p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,address,string,bool)", p0, p1, p2, p3)); } function log(address p0, address p1, string memory p2, address p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,address,string,address)", p0, p1, p2, p3)); } function log(address p0, address p1, bool p2, uint256 p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,address,bool,uint256)", p0, p1, p2, p3)); } function log(address p0, address p1, bool p2, string memory p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,address,bool,string)", p0, p1, p2, p3)); } function log(address p0, address p1, bool p2, bool p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,address,bool,bool)", p0, p1, p2, p3)); } function log(address p0, address p1, bool p2, address p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,address,bool,address)", p0, p1, p2, p3)); } function log(address p0, address p1, address p2, uint256 p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,address,address,uint256)", p0, p1, p2, p3)); } function log(address p0, address p1, address p2, string memory p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,address,address,string)", p0, p1, p2, p3)); } function log(address p0, address p1, address p2, bool p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,address,address,bool)", p0, p1, p2, p3)); } function log(address p0, address p1, address p2, address p3) internal pure { _sendLogPayload(abi.encodeWithSignature("log(address,address,address,address)", p0, p1, p2, p3)); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; /// @notice Simple single owner authorization mixin. /// @author Solady (https://github.com/vectorized/solady/blob/main/src/auth/Ownable.sol) /// /// @dev Note: /// This implementation does NOT auto-initialize the owner to `msg.sender`. /// You MUST call the `_initializeOwner` in the constructor / initializer. /// /// While the ownable portion follows /// [EIP-173](https://eips.ethereum.org/EIPS/eip-173) for compatibility, /// the nomenclature for the 2-step ownership handover may be unique to this codebase. abstract contract Ownable { /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* CUSTOM ERRORS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The caller is not authorized to call the function. error Unauthorized(); /// @dev The `newOwner` cannot be the zero address. error NewOwnerIsZeroAddress(); /// @dev The `pendingOwner` does not have a valid handover request. error NoHandoverRequest(); /// @dev Cannot double-initialize. error AlreadyInitialized(); /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* EVENTS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The ownership is transferred from `oldOwner` to `newOwner`. /// This event is intentionally kept the same as OpenZeppelin's Ownable to be /// compatible with indexers and [EIP-173](https://eips.ethereum.org/EIPS/eip-173), /// despite it not being as lightweight as a single argument event. event OwnershipTransferred(address indexed oldOwner, address indexed newOwner); /// @dev An ownership handover to `pendingOwner` has been requested. event OwnershipHandoverRequested(address indexed pendingOwner); /// @dev The ownership handover to `pendingOwner` has been canceled. event OwnershipHandoverCanceled(address indexed pendingOwner); /// @dev `keccak256(bytes("OwnershipTransferred(address,address)"))`. uint256 private constant _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE = 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0; /// @dev `keccak256(bytes("OwnershipHandoverRequested(address)"))`. uint256 private constant _OWNERSHIP_HANDOVER_REQUESTED_EVENT_SIGNATURE = 0xdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d; /// @dev `keccak256(bytes("OwnershipHandoverCanceled(address)"))`. uint256 private constant _OWNERSHIP_HANDOVER_CANCELED_EVENT_SIGNATURE = 0xfa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* STORAGE */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The owner slot is given by: /// `bytes32(~uint256(uint32(bytes4(keccak256("_OWNER_SLOT_NOT")))))`. /// It is intentionally chosen to be a high value /// to avoid collision with lower slots. /// The choice of manual storage layout is to enable compatibility /// with both regular and upgradeable contracts. bytes32 internal constant _OWNER_SLOT = 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffff74873927; /// The ownership handover slot of `newOwner` is given by: /// ``` /// mstore(0x00, or(shl(96, user), _HANDOVER_SLOT_SEED)) /// let handoverSlot := keccak256(0x00, 0x20) /// ``` /// It stores the expiry timestamp of the two-step ownership handover. uint256 private constant _HANDOVER_SLOT_SEED = 0x389a75e1; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* INTERNAL FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Override to return true to make `_initializeOwner` prevent double-initialization. function _guardInitializeOwner() internal pure virtual returns (bool guard) {} /// @dev Initializes the owner directly without authorization guard. /// This function must be called upon initialization, /// regardless of whether the contract is upgradeable or not. /// This is to enable generalization to both regular and upgradeable contracts, /// and to save gas in case the initial owner is not the caller. /// For performance reasons, this function will not check if there /// is an existing owner. function _initializeOwner(address newOwner) internal virtual { if (_guardInitializeOwner()) { /// @solidity memory-safe-assembly assembly { let ownerSlot := _OWNER_SLOT if sload(ownerSlot) { mstore(0x00, 0x0dc149f0) // `AlreadyInitialized()`. revert(0x1c, 0x04) } // Clean the upper 96 bits. newOwner := shr(96, shl(96, newOwner)) // Store the new value. sstore(ownerSlot, or(newOwner, shl(255, iszero(newOwner)))) // Emit the {OwnershipTransferred} event. log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, 0, newOwner) } } else { /// @solidity memory-safe-assembly assembly { // Clean the upper 96 bits. newOwner := shr(96, shl(96, newOwner)) // Store the new value. sstore(_OWNER_SLOT, newOwner) // Emit the {OwnershipTransferred} event. log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, 0, newOwner) } } } /// @dev Sets the owner directly without authorization guard. function _setOwner(address newOwner) internal virtual { if (_guardInitializeOwner()) { /// @solidity memory-safe-assembly assembly { let ownerSlot := _OWNER_SLOT // Clean the upper 96 bits. newOwner := shr(96, shl(96, newOwner)) // Emit the {OwnershipTransferred} event. log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, sload(ownerSlot), newOwner) // Store the new value. sstore(ownerSlot, or(newOwner, shl(255, iszero(newOwner)))) } } else { /// @solidity memory-safe-assembly assembly { let ownerSlot := _OWNER_SLOT // Clean the upper 96 bits. newOwner := shr(96, shl(96, newOwner)) // Emit the {OwnershipTransferred} event. log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, sload(ownerSlot), newOwner) // Store the new value. sstore(ownerSlot, newOwner) } } } /// @dev Throws if the sender is not the owner. function _checkOwner() internal view virtual { /// @solidity memory-safe-assembly assembly { // If the caller is not the stored owner, revert. if iszero(eq(caller(), sload(_OWNER_SLOT))) { mstore(0x00, 0x82b42900) // `Unauthorized()`. revert(0x1c, 0x04) } } } /// @dev Returns how long a two-step ownership handover is valid for in seconds. /// Override to return a different value if needed. /// Made internal to conserve bytecode. Wrap it in a public function if needed. function _ownershipHandoverValidFor() internal view virtual returns (uint64) { return 48 * 3600; } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* PUBLIC UPDATE FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Allows the owner to transfer the ownership to `newOwner`. function transferOwnership(address newOwner) public payable virtual onlyOwner { /// @solidity memory-safe-assembly assembly { if iszero(shl(96, newOwner)) { mstore(0x00, 0x7448fbae) // `NewOwnerIsZeroAddress()`. revert(0x1c, 0x04) } } _setOwner(newOwner); } /// @dev Allows the owner to renounce their ownership. function renounceOwnership() public payable virtual onlyOwner { _setOwner(address(0)); } /// @dev Request a two-step ownership handover to the caller. /// The request will automatically expire in 48 hours (172800 seconds) by default. function requestOwnershipHandover() public payable virtual { unchecked { uint256 expires = block.timestamp + _ownershipHandoverValidFor(); /// @solidity memory-safe-assembly assembly { // Compute and set the handover slot to `expires`. mstore(0x0c, _HANDOVER_SLOT_SEED) mstore(0x00, caller()) sstore(keccak256(0x0c, 0x20), expires) // Emit the {OwnershipHandoverRequested} event. log2(0, 0, _OWNERSHIP_HANDOVER_REQUESTED_EVENT_SIGNATURE, caller()) } } } /// @dev Cancels the two-step ownership handover to the caller, if any. function cancelOwnershipHandover() public payable virtual { /// @solidity memory-safe-assembly assembly { // Compute and set the handover slot to 0. mstore(0x0c, _HANDOVER_SLOT_SEED) mstore(0x00, caller()) sstore(keccak256(0x0c, 0x20), 0) // Emit the {OwnershipHandoverCanceled} event. log2(0, 0, _OWNERSHIP_HANDOVER_CANCELED_EVENT_SIGNATURE, caller()) } } /// @dev Allows the owner to complete the two-step ownership handover to `pendingOwner`. /// Reverts if there is no existing ownership handover requested by `pendingOwner`. function completeOwnershipHandover(address pendingOwner) public payable virtual onlyOwner { /// @solidity memory-safe-assembly assembly { // Compute and set the handover slot to 0. mstore(0x0c, _HANDOVER_SLOT_SEED) mstore(0x00, pendingOwner) let handoverSlot := keccak256(0x0c, 0x20) // If the handover does not exist, or has expired. if gt(timestamp(), sload(handoverSlot)) { mstore(0x00, 0x6f5e8818) // `NoHandoverRequest()`. revert(0x1c, 0x04) } // Set the handover slot to 0. sstore(handoverSlot, 0) } _setOwner(pendingOwner); } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* PUBLIC READ FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Returns the owner of the contract. function owner() public view virtual returns (address result) { /// @solidity memory-safe-assembly assembly { result := sload(_OWNER_SLOT) } } /// @dev Returns the expiry timestamp for the two-step ownership handover to `pendingOwner`. function ownershipHandoverExpiresAt(address pendingOwner) public view virtual returns (uint256 result) { /// @solidity memory-safe-assembly assembly { // Compute the handover slot. mstore(0x0c, _HANDOVER_SLOT_SEED) mstore(0x00, pendingOwner) // Load the handover slot. result := sload(keccak256(0x0c, 0x20)) } } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* MODIFIERS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Marks a function as only callable by the owner. modifier onlyOwner() virtual { _checkOwner(); _; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; /// @notice 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(); /// @dev The input string must be a 7-bit ASCII. error StringNot7BitASCII(); /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* CONSTANTS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The constant returned when the `search` is not found in the string. uint256 internal constant NOT_FOUND = type(uint256).max; /// @dev Lookup for '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'. uint128 internal constant ALPHANUMERIC_7_BIT_ASCII = 0x7fffffe07fffffe03ff000000000000; /// @dev Lookup for 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'. uint128 internal constant LETTERS_7_BIT_ASCII = 0x7fffffe07fffffe0000000000000000; /// @dev Lookup for 'abcdefghijklmnopqrstuvwxyz'. uint128 internal constant LOWERCASE_7_BIT_ASCII = 0x7fffffe000000000000000000000000; /// @dev Lookup for 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'. uint128 internal constant UPPERCASE_7_BIT_ASCII = 0x7fffffe0000000000000000; /// @dev Lookup for '0123456789'. uint128 internal constant DIGITS_7_BIT_ASCII = 0x3ff000000000000; /// @dev Lookup for '0123456789abcdefABCDEF'. uint128 internal constant HEXDIGITS_7_BIT_ASCII = 0x7e0000007e03ff000000000000; /// @dev Lookup for '01234567'. uint128 internal constant OCTDIGITS_7_BIT_ASCII = 0xff000000000000; /// @dev Lookup for '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~ \t\n\r\x0b\x0c'. uint128 internal constant PRINTABLE_7_BIT_ASCII = 0x7fffffffffffffffffffffff00003e00; /// @dev Lookup for '!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~'. uint128 internal constant PUNCTUATION_7_BIT_ASCII = 0x78000001f8000001fc00fffe00000000; /// @dev Lookup for ' \t\n\r\x0b\x0c'. uint128 internal constant WHITESPACE_7_BIT_ASCII = 0x100003e00; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* 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) mstore(0x40, add(str, 0x20)) // Allocate the memory. mstore(str, 0) // Zeroize the slot after the string. let end := str // Cache the end of the memory to calculate the length later. 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)`. // Store the character to the pointer. // The ASCII index of the '0' character is 48. mstore8(str, add(48, mod(temp, 10))) temp := div(temp, 10) // Keep dividing `temp` until zero. if iszero(temp) { break } } let length := sub(end, str) str := sub(str, 0x20) // Move the pointer 32 bytes back to make room for the length. mstore(str, length) // Store the 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) // Store the "0x" prefix. str := sub(str, 2) // Move the pointer. mstore(str, strLength) // Store the length. } } /// @dev Returns the hexadecimal representation of `value`, /// left-padded to an input length of `length` bytes. /// The output is not prefixed with "0x" and is 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))) mstore(0x40, add(str, 0x20)) // Allocate the memory. mstore(str, 0) // Zeroize the slot after the string. let end := str // Cache the end to calculate the length later. // 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) } let strLength := sub(end, str) str := sub(str, 0x20) mstore(str, strLength) // Store the length. } } /// @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) // Store the "0x" prefix. str := sub(str, 2) // Move the pointer. mstore(str, strLength) // Store 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) // Store 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)) // Store 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)) // Store 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) mstore(0x40, add(str, 0x20)) // Allocate the memory. mstore(str, 0) // Zeroize the slot after the string. let end := str // Cache the end to calculate the length later. mstore(0x0f, 0x30313233343536373839616263646566) // Store the "0123456789abcdef" lookup. 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 } } let strLength := sub(end, str) str := sub(str, 0x20) mstore(str, strLength) // Store the length. } } /// @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) // Store the "0x" prefix. str := sub(str, 2) // Move the pointer. mstore(str, strLength) // Store 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)) mstore(0x0f, 0x30313233343536373839616263646566) // Store the "0123456789abcdef" lookup. str := add(str, 2) mstore(str, 40) // Store the length. let o := add(str, 0x20) mstore(add(o, 40), 0) // Zeroize the slot after the string. 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) // Store the "0x" prefix. str := sub(str, 2) // Move the pointer. mstore(str, strLength) // Store 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. mstore(0x0f, 0x30313233343536373839616263646566) // Store the "0123456789abcdef" lookup. 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) } } } /// @dev Returns if this string is a 7-bit ASCII string, /// AND all characters are in the `allowed` lookup. /// Note: If `s` is empty, returns true regardless of `allowed`. function is7BitASCII(string memory s, uint128 allowed) internal pure returns (bool result) { /// @solidity memory-safe-assembly assembly { result := 1 if mload(s) { let allowed_ := shr(128, shl(128, allowed)) let o := add(s, 0x20) let end := add(o, mload(s)) for {} 1 {} { result := and(result, shr(byte(0, mload(o)), allowed_)) o := add(o, 1) if iszero(and(result, lt(o, end))) { break } } } } } /// @dev Converts the bytes in the 7-bit ASCII string `s` to /// an allowed lookup for use in `is7BitASCII(s, allowed)`. /// To save runtime gas, you can cache the result in an immutable variable. function to7BitASCIIAllowedLookup(string memory s) internal pure returns (uint128 result) { /// @solidity memory-safe-assembly assembly { if mload(s) { let o := add(s, 0x20) let end := add(o, mload(s)) for {} 1 {} { result := or(result, shl(byte(0, mload(o)), 1)) o := add(o, 1) if iszero(lt(o, end)) { break } } if shr(128, result) { mstore(0x00, 0xc9807e0d) // `StringNot7BitASCII()`. revert(0x1c, 0x04) } } } } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* 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. mstore(0x40, add(result, add(resultLength, 0x40))) // Allocate the memory. } } } /// @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) mstore(0x40, add(result, add(resultLength, 0x40))) // Allocate the memory. } } } /// @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) mstore(last, 0) // Zeroize the slot after the string. mstore(result, totalLength) // Store the length. mstore(0x40, add(last, 0x20)) // Allocate the memory. } } /// @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) // Store the length. let o := add(result, 0x20) mstore(o, s) // Store the bytes of the string. mstore(add(o, n), 0) // Zeroize the slot after the string. mstore(0x40, add(result, 0x40)) // Allocate the memory. } } /// @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 { result := mload(0x40) // Grab the free memory pointer. mstore(0x40, add(result, 0x40)) // Allocate 2 words (1 for the length, 1 for the bytes). mstore(result, 0) // Zeroize the length slot. mstore(add(result, 0x1f), packed) // Store the length and bytes. mstore(add(add(result, 0x20), mload(result)), 0) // Right pad with zeroes. } } /// @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( or( // Load the length and the bytes of `a` and `b`. 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 { resultA := mload(0x40) // Grab the free memory pointer. 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 retUnpaddedSize := 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, retUnpaddedSize), 0) mstore(retStart, 0x20) // Store the return offset. // End the transaction, returning the string. return(retStart, and(not(0x1f), add(0x1f, retUnpaddedSize))) } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; /// @notice Gas optimized verification of proof of inclusion for a leaf in a Merkle tree. /// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/MerkleProofLib.sol) /// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/MerkleProofLib.sol) /// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/cryptography/MerkleProof.sol) library MerkleProofLib { /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* MERKLE PROOF VERIFICATION OPERATIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Returns whether `leaf` exists in the Merkle tree with `root`, given `proof`. function verify(bytes32[] memory proof, bytes32 root, bytes32 leaf) internal pure returns (bool isValid) { /// @solidity memory-safe-assembly assembly { if mload(proof) { // Initialize `offset` to the offset of `proof` elements in memory. let offset := add(proof, 0x20) // Left shift by 5 is equivalent to multiplying by 0x20. let end := add(offset, shl(5, mload(proof))) // Iterate over proof elements to compute root hash. for {} 1 {} { // Slot of `leaf` in scratch space. // If the condition is true: 0x20, otherwise: 0x00. let scratch := shl(5, gt(leaf, mload(offset))) // Store elements to hash contiguously in scratch space. // Scratch space is 64 bytes (0x00 - 0x3f) and both elements are 32 bytes. mstore(scratch, leaf) mstore(xor(scratch, 0x20), mload(offset)) // Reuse `leaf` to store the hash to reduce stack operations. leaf := keccak256(0x00, 0x40) offset := add(offset, 0x20) if iszero(lt(offset, end)) { break } } } isValid := eq(leaf, root) } } /// @dev Returns whether `leaf` exists in the Merkle tree with `root`, given `proof`. function verifyCalldata(bytes32[] calldata proof, bytes32 root, bytes32 leaf) internal pure returns (bool isValid) { /// @solidity memory-safe-assembly assembly { if proof.length { // Left shift by 5 is equivalent to multiplying by 0x20. let end := add(proof.offset, shl(5, proof.length)) // Initialize `offset` to the offset of `proof` in the calldata. let offset := proof.offset // Iterate over proof elements to compute root hash. for {} 1 {} { // Slot of `leaf` in scratch space. // If the condition is true: 0x20, otherwise: 0x00. let scratch := shl(5, gt(leaf, calldataload(offset))) // Store elements to hash contiguously in scratch space. // Scratch space is 64 bytes (0x00 - 0x3f) and both elements are 32 bytes. mstore(scratch, leaf) mstore(xor(scratch, 0x20), calldataload(offset)) // Reuse `leaf` to store the hash to reduce stack operations. leaf := keccak256(0x00, 0x40) offset := add(offset, 0x20) if iszero(lt(offset, end)) { break } } } isValid := eq(leaf, root) } } /// @dev Returns whether all `leaves` exist in the Merkle tree with `root`, /// given `proof` and `flags`. /// /// Note: /// - Breaking the invariant `flags.length == (leaves.length - 1) + proof.length` /// will always return false. /// - The sum of the lengths of `proof` and `leaves` must never overflow. /// - Any non-zero word in the `flags` array is treated as true. /// - The memory offset of `proof` must be non-zero /// (i.e. `proof` is not pointing to the scratch space). function verifyMultiProof( bytes32[] memory proof, bytes32 root, bytes32[] memory leaves, bool[] memory flags ) internal pure returns (bool isValid) { // Rebuilds the root by consuming and producing values on a queue. // The queue starts with the `leaves` array, and goes into a `hashes` array. // After the process, the last element on the queue is verified // to be equal to the `root`. // // The `flags` array denotes whether the sibling // should be popped from the queue (`flag == true`), or // should be popped from the `proof` (`flag == false`). /// @solidity memory-safe-assembly assembly { // Cache the lengths of the arrays. let leavesLength := mload(leaves) let proofLength := mload(proof) let flagsLength := mload(flags) // Advance the pointers of the arrays to point to the data. leaves := add(0x20, leaves) proof := add(0x20, proof) flags := add(0x20, flags) // If the number of flags is correct. for {} eq(add(leavesLength, proofLength), add(flagsLength, 1)) {} { // For the case where `proof.length + leaves.length == 1`. if iszero(flagsLength) { // `isValid = (proof.length == 1 ? proof[0] : leaves[0]) == root`. isValid := eq(mload(xor(leaves, mul(xor(proof, leaves), proofLength))), root) break } // The required final proof offset if `flagsLength` is not zero, otherwise zero. let proofEnd := add(proof, shl(5, proofLength)) // We can use the free memory space for the queue. // We don't need to allocate, since the queue is temporary. let hashesFront := mload(0x40) // Copy the leaves into the hashes. // Sometimes, a little memory expansion costs less than branching. // Should cost less, even with a high free memory offset of 0x7d00. leavesLength := shl(5, leavesLength) for { let i := 0 } iszero(eq(i, leavesLength)) { i := add(i, 0x20) } { mstore(add(hashesFront, i), mload(add(leaves, i))) } // Compute the back of the hashes. let hashesBack := add(hashesFront, leavesLength) // This is the end of the memory for the queue. // We recycle `flagsLength` to save on stack variables (sometimes save gas). flagsLength := add(hashesBack, shl(5, flagsLength)) for {} 1 {} { // Pop from `hashes`. let a := mload(hashesFront) // Pop from `hashes`. let b := mload(add(hashesFront, 0x20)) hashesFront := add(hashesFront, 0x40) // If the flag is false, load the next proof, // else, pops from the queue. if iszero(mload(flags)) { // Loads the next proof. b := mload(proof) proof := add(proof, 0x20) // Unpop from `hashes`. hashesFront := sub(hashesFront, 0x20) } // Advance to the next flag. flags := add(flags, 0x20) // Slot of `a` in scratch space. // If the condition is true: 0x20, otherwise: 0x00. let scratch := shl(5, gt(a, b)) // Hash the scratch space and push the result onto the queue. mstore(scratch, a) mstore(xor(scratch, 0x20), b) mstore(hashesBack, keccak256(0x00, 0x40)) hashesBack := add(hashesBack, 0x20) if iszero(lt(hashesBack, flagsLength)) { break } } isValid := and( // Checks if the last value in the queue is same as the root. eq(mload(sub(hashesBack, 0x20)), root), // And whether all the proofs are used, if required. eq(proofEnd, proof) ) break } } } /// @dev Returns whether all `leaves` exist in the Merkle tree with `root`, /// given `proof` and `flags`. /// /// Note: /// - Breaking the invariant `flags.length == (leaves.length - 1) + proof.length` /// will always return false. /// - Any non-zero word in the `flags` array is treated as true. /// - The calldata offset of `proof` must be non-zero /// (i.e. `proof` is from a regular Solidity function with a 4-byte selector). function verifyMultiProofCalldata( bytes32[] calldata proof, bytes32 root, bytes32[] calldata leaves, bool[] calldata flags ) internal pure returns (bool isValid) { // Rebuilds the root by consuming and producing values on a queue. // The queue starts with the `leaves` array, and goes into a `hashes` array. // After the process, the last element on the queue is verified // to be equal to the `root`. // // The `flags` array denotes whether the sibling // should be popped from the queue (`flag == true`), or // should be popped from the `proof` (`flag == false`). /// @solidity memory-safe-assembly assembly { // If the number of flags is correct. for {} eq(add(leaves.length, proof.length), add(flags.length, 1)) {} { // For the case where `proof.length + leaves.length == 1`. if iszero(flags.length) { // `isValid = (proof.length == 1 ? proof[0] : leaves[0]) == root`. // forgefmt: disable-next-item isValid := eq( calldataload( xor(leaves.offset, mul(xor(proof.offset, leaves.offset), proof.length)) ), root ) break } // The required final proof offset if `flagsLength` is not zero, otherwise zero. let proofEnd := add(proof.offset, shl(5, proof.length)) // We can use the free memory space for the queue. // We don't need to allocate, since the queue is temporary. let hashesFront := mload(0x40) // Copy the leaves into the hashes. // Sometimes, a little memory expansion costs less than branching. // Should cost less, even with a high free memory offset of 0x7d00. calldatacopy(hashesFront, leaves.offset, shl(5, leaves.length)) // Compute the back of the hashes. let hashesBack := add(hashesFront, shl(5, leaves.length)) // This is the end of the memory for the queue. // We recycle `flagsLength` to save on stack variables (sometimes save gas). flags.length := add(hashesBack, shl(5, flags.length)) // We don't need to make a copy of `proof.offset` or `flags.offset`, // as they are pass-by-value (this trick may not always save gas). for {} 1 {} { // Pop from `hashes`. let a := mload(hashesFront) // Pop from `hashes`. let b := mload(add(hashesFront, 0x20)) hashesFront := add(hashesFront, 0x40) // If the flag is false, load the next proof, // else, pops from the queue. if iszero(calldataload(flags.offset)) { // Loads the next proof. b := calldataload(proof.offset) proof.offset := add(proof.offset, 0x20) // Unpop from `hashes`. hashesFront := sub(hashesFront, 0x20) } // Advance to the next flag offset. flags.offset := add(flags.offset, 0x20) // Slot of `a` in scratch space. // If the condition is true: 0x20, otherwise: 0x00. let scratch := shl(5, gt(a, b)) // Hash the scratch space and push the result onto the queue. mstore(scratch, a) mstore(xor(scratch, 0x20), b) mstore(hashesBack, keccak256(0x00, 0x40)) hashesBack := add(hashesBack, 0x20) if iszero(lt(hashesBack, flags.length)) { break } } isValid := and( // Checks if the last value in the queue is same as the root. eq(mload(sub(hashesBack, 0x20)), root), // And whether all the proofs are used, if required. eq(proofEnd, proof.offset) ) break } } } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* EMPTY CALLDATA HELPERS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Returns an empty calldata bytes32 array. function emptyProof() internal pure returns (bytes32[] calldata proof) { /// @solidity memory-safe-assembly assembly { proof.length := 0 } } /// @dev Returns an empty calldata bytes32 array. function emptyLeaves() internal pure returns (bytes32[] calldata leaves) { /// @solidity memory-safe-assembly assembly { leaves.length := 0 } } /// @dev Returns an empty calldata bool array. function emptyFlags() internal pure returns (bool[] calldata flags) { /// @solidity memory-safe-assembly assembly { flags.length := 0 } } }
// 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) /// @author Permit2 operations from (https://github.com/Uniswap/permit2/blob/main/src/libraries/Permit2Lib.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(); /// @dev The Permit2 operation has failed. error Permit2Failed(); /// @dev The Permit2 amount must be less than `2**160 - 1`. error Permit2AmountOverflow(); /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* 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; /// @dev The unique EIP-712 domain domain separator for the DAI token contract. bytes32 internal constant DAI_DOMAIN_SEPARATOR = 0xdbb8cf42e1ecb028be3f3dbc922e1d878b963f411dc388ced501601c60f7c6f7; /// @dev The address for the WETH9 contract on Ethereum mainnet. address internal constant WETH9 = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; /// @dev The canonical Permit2 address. /// [Github](https://github.com/Uniswap/permit2) /// [Etherscan](https://etherscan.io/address/0x000000000022D473030F116dDEE9F6B43aC78BA3) address internal constant PERMIT2 = 0x000000000022D473030F116dDEE9F6B43aC78BA3; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* 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 `amount` of ERC20 `token` from `from` to `to`. /// /// The `from` account must have at least `amount` approved for the current contract to manage. function trySafeTransferFrom(address token, address from, address to, uint256 amount) internal returns (bool success) { /// @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)`. success := 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(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( // The arguments of `mul` are evaluated from right to left. 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) ) ) } } /// @dev Sends `amount` of ERC20 `token` from `from` to `to`. /// If the initial attempt fails, try to use Permit2 to transfer the token. /// Reverts upon failure. /// /// The `from` account must have at least `amount` approved for the current contract to manage. function safeTransferFrom2(address token, address from, address to, uint256 amount) internal { if (!trySafeTransferFrom(token, from, to, amount)) { permit2TransferFrom(token, from, to, amount); } } /// @dev Sends `amount` of ERC20 `token` from `from` to `to` via Permit2. /// Reverts upon failure. function permit2TransferFrom(address token, address from, address to, uint256 amount) internal { /// @solidity memory-safe-assembly assembly { let m := mload(0x40) mstore(add(m, 0x74), shr(96, shl(96, token))) mstore(add(m, 0x54), amount) mstore(add(m, 0x34), to) mstore(add(m, 0x20), shl(96, from)) // `transferFrom(address,address,uint160,address)`. mstore(m, 0x36c78516000000000000000000000000) let p := PERMIT2 let exists := eq(chainid(), 1) if iszero(exists) { exists := iszero(iszero(extcodesize(p))) } if iszero(and(call(gas(), p, 0, add(m, 0x10), 0x84, codesize(), 0x00), exists)) { mstore(0x00, 0x7939f4248757f0fd) // `TransferFromFailed()` or `Permit2AmountOverflow()`. revert(add(0x18, shl(2, iszero(iszero(shr(160, amount))))), 0x04) } } } /// @dev Permit a user to spend a given amount of /// another user's tokens via native EIP-2612 permit if possible, falling /// back to Permit2 if native permit fails or is not implemented on the token. function permit2( address token, address owner, address spender, uint256 amount, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { bool success; /// @solidity memory-safe-assembly assembly { for {} shl(96, xor(token, WETH9)) {} { mstore(0x00, 0x3644e515) // `DOMAIN_SEPARATOR()`. if iszero( and( // The arguments of `and` are evaluated from right to left. lt(iszero(mload(0x00)), eq(returndatasize(), 0x20)), // Returns 1 non-zero word. // Gas stipend to limit gas burn for tokens that don't refund gas when // an non-existing function is called. 5K should be enough for a SLOAD. staticcall(5000, token, 0x1c, 0x04, 0x00, 0x20) ) ) { break } // After here, we can be sure that token is a contract. let m := mload(0x40) mstore(add(m, 0x34), spender) mstore(add(m, 0x20), shl(96, owner)) mstore(add(m, 0x74), deadline) if eq(mload(0x00), DAI_DOMAIN_SEPARATOR) { mstore(0x14, owner) mstore(0x00, 0x7ecebe00000000000000000000000000) // `nonces(address)`. mstore(add(m, 0x94), staticcall(gas(), token, 0x10, 0x24, add(m, 0x54), 0x20)) mstore(m, 0x8fcbaf0c000000000000000000000000) // `IDAIPermit.permit`. // `nonces` is already at `add(m, 0x54)`. // `1` is already stored at `add(m, 0x94)`. mstore(add(m, 0xb4), and(0xff, v)) mstore(add(m, 0xd4), r) mstore(add(m, 0xf4), s) success := call(gas(), token, 0, add(m, 0x10), 0x104, codesize(), 0x00) break } mstore(m, 0xd505accf000000000000000000000000) // `IERC20Permit.permit`. mstore(add(m, 0x54), amount) mstore(add(m, 0x94), and(0xff, v)) mstore(add(m, 0xb4), r) mstore(add(m, 0xd4), s) success := call(gas(), token, 0, add(m, 0x10), 0xe4, codesize(), 0x00) break } } if (!success) simplePermit2(token, owner, spender, amount, deadline, v, r, s); } /// @dev Simple permit on the Permit2 contract. function simplePermit2( address token, address owner, address spender, uint256 amount, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { /// @solidity memory-safe-assembly assembly { let m := mload(0x40) mstore(m, 0x927da105) // `allowance(address,address,address)`. { let addressMask := shr(96, not(0)) mstore(add(m, 0x20), and(addressMask, owner)) mstore(add(m, 0x40), and(addressMask, token)) mstore(add(m, 0x60), and(addressMask, spender)) mstore(add(m, 0xc0), and(addressMask, spender)) } let p := mul(PERMIT2, iszero(shr(160, amount))) if iszero( and( // The arguments of `and` are evaluated from right to left. gt(returndatasize(), 0x5f), // Returns 3 words: `amount`, `expiration`, `nonce`. staticcall(gas(), p, add(m, 0x1c), 0x64, add(m, 0x60), 0x60) ) ) { mstore(0x00, 0x6b836e6b8757f0fd) // `Permit2Failed()` or `Permit2AmountOverflow()`. revert(add(0x18, shl(2, iszero(p))), 0x04) } mstore(m, 0x2b67b570) // `Permit2.permit` (PermitSingle variant). // `owner` is already `add(m, 0x20)`. // `token` is already at `add(m, 0x40)`. mstore(add(m, 0x60), amount) mstore(add(m, 0x80), 0xffffffffffff) // `expiration = type(uint48).max`. // `nonce` is already at `add(m, 0xa0)`. // `spender` is already at `add(m, 0xc0)`. mstore(add(m, 0xe0), deadline) mstore(add(m, 0x100), 0x100) // `signature` offset. mstore(add(m, 0x120), 0x41) // `signature` length. mstore(add(m, 0x140), r) mstore(add(m, 0x160), s) mstore(add(m, 0x180), shl(248, v)) if iszero(call(gas(), p, 0, add(m, 0x1c), 0x184, codesize(), 0x00)) { mstore(0x00, 0x6b836e6b) // `Permit2Failed()`. revert(0x1c, 0x04) } } } }
{ "optimizer": { "enabled": true, "runs": 200 }, "viaIR": true, "evmVersion": "paris", "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "metadata": { "useLiteralContent": true }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"initialSupplyOwner","type":"address"},{"internalType":"address","name":"contractAllowListProxy","type":"address"},{"internalType":"address","name":"initialWithdrawAddress","type":"address"},{"internalType":"address","name":"initialForwarder","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"uint256","name":"requested","type":"uint256"},{"internalType":"uint256","name":"allowed","type":"uint256"}],"name":"AllowlistAmountExceeded","type":"error"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"phase","type":"uint256"},{"internalType":"string","name":"reason","type":"string"}],"name":"AllowlistValidationFailed","type":"error"},{"inputs":[],"name":"AlreadyInitialized","type":"error"},{"inputs":[],"name":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"BatchAirdropFailed","type":"error"},{"inputs":[],"name":"DNAlreadyInitialized","type":"error"},{"inputs":[{"internalType":"uint256","name":"requested","type":"uint256"},{"internalType":"uint256","name":"allowed","type":"uint256"}],"name":"ExceedsPhaseLimit","type":"error"},{"inputs":[{"internalType":"uint256","name":"requested","type":"uint256"},{"internalType":"uint256","name":"maximum","type":"uint256"}],"name":"ExceedsTransactionLimit","type":"error"},{"inputs":[],"name":"FnSelectorNotRecognized","type":"error"},{"inputs":[],"name":"FractionalTransferNotAllowed","type":"error"},{"inputs":[],"name":"InsufficientAllowance","type":"error"},{"inputs":[],"name":"InsufficientBalance","type":"error"},{"inputs":[{"internalType":"uint256","name":"required","type":"uint256"},{"internalType":"uint256","name":"provided","type":"uint256"}],"name":"InsufficientPayment","type":"error"},{"inputs":[],"name":"InvalidAirdropParameters","type":"error"},{"inputs":[{"internalType":"uint256","name":"provided","type":"uint256"},{"internalType":"uint256","name":"maximum","type":"uint256"},{"internalType":"string","name":"reason","type":"string"}],"name":"InvalidMintAmount","type":"error"},{"inputs":[{"internalType":"uint256","name":"oldRatio","type":"uint256"},{"internalType":"uint256","name":"newRatio","type":"uint256"}],"name":"InvalidMintRatio","type":"error"},{"inputs":[{"internalType":"string","name":"reason","type":"string"}],"name":"InvalidOperation","type":"error"},{"inputs":[{"internalType":"uint256","name":"phase","type":"uint256"},{"internalType":"bool","name":"isPaused","type":"bool"},{"internalType":"bool","name":"isConfigured","type":"bool"}],"name":"InvalidPhaseState","type":"error"},{"inputs":[{"internalType":"uint256","name":"current","type":"uint256"},{"internalType":"uint256","name":"requested","type":"uint256"}],"name":"InvalidPhaseTransition","type":"error"},{"inputs":[],"name":"InvalidPrice","type":"error"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"bytes32","name":"merkleRoot","type":"bytes32"}],"name":"InvalidProof","type":"error"},{"inputs":[{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"endTime","type":"uint256"}],"name":"InvalidTimePeriod","type":"error"},{"inputs":[],"name":"LinkMirrorContractFailed","type":"error"},{"inputs":[{"internalType":"uint256","name":"requested","type":"uint256"},{"internalType":"uint256","name":"remaining","type":"uint256"}],"name":"MaxSupplyExceeded","type":"error"},{"inputs":[{"internalType":"string","name":"reason","type":"string"}],"name":"MintValidationFailed","type":"error"},{"inputs":[],"name":"MirrorAddressIsZero","type":"error"},{"inputs":[],"name":"NewOwnerIsZeroAddress","type":"error"},{"inputs":[],"name":"NoHandoverRequest","type":"error"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"NotAllowlisted","type":"error"},{"inputs":[],"name":"NotLive","type":"error"},{"inputs":[{"internalType":"uint256","name":"phase","type":"uint256"}],"name":"PhaseAlreadyExists","type":"error"},{"inputs":[{"internalType":"uint256","name":"phase","type":"uint256"}],"name":"PhaseNotActive","type":"error"},{"inputs":[{"internalType":"uint256","name":"phase","type":"uint256"}],"name":"PhaseNotConfigured","type":"error"},{"inputs":[{"internalType":"uint256","name":"phase","type":"uint256"}],"name":"PhasePaused","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"},{"inputs":[],"name":"UnitIsZero","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"bool","name":"isNFT","type":"bool"}],"name":"AirdropCompleted","type":"event"},{"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":false,"internalType":"address[]","name":"recipients","type":"address[]"},{"indexed":false,"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"indexed":false,"internalType":"bool","name":"isNFT","type":"bool"}],"name":"BatchAirdropCompleted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"string","name":"parameter","type":"string"},{"indexed":false,"internalType":"uint256","name":"newValue","type":"uint256"}],"name":"ConfigurationUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"string","name":"action","type":"string"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"EmergencyAction","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"EmergencyRecovery","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"bool","name":"isNFT","type":"bool"}],"name":"ExternalMintCompleted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"price","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"phase","type":"uint256"},{"indexed":false,"internalType":"bool","name":"isNFT","type":"bool"},{"indexed":false,"internalType":"bool","name":"isAllowlist","type":"bool"}],"name":"MintCompleted","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":"uint256","name":"phase","type":"uint256"},{"indexed":false,"internalType":"uint96","name":"price","type":"uint96"},{"indexed":false,"internalType":"uint32","name":"maxPerWallet","type":"uint32"},{"indexed":false,"internalType":"uint32","name":"maxSupplyForPhase","type":"uint32"},{"indexed":false,"internalType":"bytes32","name":"merkleRoot","type":"bytes32"},{"indexed":false,"internalType":"bool","name":"requiresAllowlist","type":"bool"}],"name":"PhaseConfigured","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"phase","type":"uint256"}],"name":"PhaseRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"phase","type":"uint256"},{"indexed":false,"internalType":"bool","name":"isPaused","type":"bool"}],"name":"PhaseStatusChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"oldPhase","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"newPhase","type":"uint256"}],"name":"PhaseUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","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"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"WithdrawTest","type":"event"},{"stateMutability":"payable","type":"fallback"},{"inputs":[],"name":"ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"AIRDROP_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"CAL","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINTER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bool","name":"isNFT","type":"bool"}],"name":"airdrop","outputs":[],"stateMutability":"nonpayable","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":[{"internalType":"address[]","name":"recipients","type":"address[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"bool","name":"isNFT","type":"bool"}],"name":"batchAirdrop","outputs":[],"stateMutability":"nonpayable","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":[{"internalType":"uint256","name":"phase","type":"uint256"},{"internalType":"uint96","name":"price","type":"uint96"},{"internalType":"uint32","name":"phaseMaxPerWallet","type":"uint32"},{"internalType":"uint32","name":"maxSupplyForPhase","type":"uint32"},{"internalType":"bytes32","name":"merkleRoot","type":"bytes32"},{"internalType":"bool","name":"requiresAllowlist","type":"bool"}],"name":"configurePhase","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"currentPhase","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"emergencyPause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"emergencyTokenRecovery","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bool","name":"isNFT","type":"bool"}],"name":"externalMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"forwarder","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"phase","type":"uint256"},{"internalType":"address","name":"user","type":"address"}],"name":"getAllowlistMintedAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"phase","type":"uint256"}],"name":"getMerkleRoot","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getNextTokenId","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"phase","type":"uint256"}],"name":"getPhaseStatus","outputs":[{"components":[{"internalType":"bool","name":"isActive","type":"bool"},{"internalType":"bool","name":"isPaused","type":"bool"},{"internalType":"uint256","name":"totalMinted","type":"uint256"},{"internalType":"uint96","name":"price","type":"uint96"},{"internalType":"uint32","name":"maxPerWallet","type":"uint32"},{"internalType":"uint32","name":"maxSupplyForPhase","type":"uint32"},{"internalType":"bool","name":"requiresAllowlist","type":"bool"},{"internalType":"bytes32","name":"merkleRoot","type":"bytes32"}],"internalType":"struct MAVILLAIN.PhaseStatus","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"getSkipNFT","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getWithdrawAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"live","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxPerTransaction","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxPerWallet","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxSupply","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bool","name":"isNFT","type":"bool"},{"internalType":"uint256","name":"maxAllowedAmount","type":"uint256"},{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"}],"name":"mint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"mintCounts","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bool","name":"isNFT","type":"bool"},{"internalType":"uint256","name":"maxAllowedAmount","type":"uint256"},{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"}],"name":"mintWithReceiver","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"mirror","outputs":[{"internalType":"contract MUTANT_ALIENS_VILLAIN","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mirrorERC721","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"result","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"pendingOwner","type":"address"}],"name":"ownershipHandoverExpiresAt","outputs":[{"internalType":"uint256","name":"result","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"phaseConfigs","outputs":[{"internalType":"uint96","name":"price","type":"uint96"},{"internalType":"uint32","name":"maxPerWallet","type":"uint32"},{"internalType":"uint32","name":"maxSupplyForPhase","type":"uint32"},{"internalType":"bool","name":"isConfigured","type":"bool"},{"internalType":"bool","name":"isPaused","type":"bool"},{"internalType":"bool","name":"requiresAllowlist","type":"bool"},{"internalType":"uint256","name":"totalMinted","type":"uint256"},{"internalType":"bytes32","name":"merkleRoot","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"phaseTotalMints","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"requestOwnershipHandover","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"phase","type":"uint256"}],"name":"resetPhaseConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"baseURI_","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_maxPerTransaction","type":"uint256"}],"name":"setMaxPerTransaction","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"_maxPerWallet","type":"uint32"}],"name":"setMaxPerWallet","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"_maxSupply","type":"uint32"}],"name":"setMaxSupply","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"phase","type":"uint256"},{"internalType":"bytes32","name":"newRoot","type":"bytes32"}],"name":"setMerkleRoot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newRatio","type":"uint256"}],"name":"setMintRatio","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newPhase","type":"uint256"}],"name":"setPhase","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"phase","type":"uint256"},{"internalType":"uint32","name":"newMaxPerWallet","type":"uint32"}],"name":"setPhaseMaxPerWallet","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"phase","type":"uint256"},{"internalType":"uint32","name":"newMaxSupply","type":"uint32"}],"name":"setPhaseMaxSupply","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"phase","type":"uint256"},{"internalType":"uint96","name":"newPrice","type":"uint96"}],"name":"setPhasePrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"skipNFT","type":"bool"}],"name":"setSkipNFT","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_withdrawAddress","type":"address"}],"name":"setWithdrawAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"toggleLive","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"phase","type":"uint256"}],"name":"togglePhase","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"result","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalMinted","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdrawAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
60c034620005c457601f62008c4738819003918201601f19168301926001600160401b0392909183851183861017620005c9578160809284926040978852833981010312620005c4576200005381620005df565b60209062000063828401620005df565b906200007f606062000077888701620005df565b9501620005df565b94600191828055694e2000004e2000000000640100000000600160601b0319600c541617600c556103e8600d5533638b78c6d8195560009333857f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08180a3848052848652888520338652865260ff92838a87205416156200058d575b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c217758087528688528a87203388528852848b882054161562000554575b507f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a68087528688528a87203388528852848b88205416156200051b575b507f3a2f235c9daaf33349d300aadff2f15078a89df81bcfdd45ba11c8f816bddc6f8087528688528a87203388528852848b8820541615620004e2575b5060018060a01b038098168860018060a01b03199a828c6003541617600355168a6007541617600755826080528a51926130278085019385851090851117620004ce57918a60609492869462005c008639338452168a8301528c82015203019085f08015620004c45760a05281620002298262000628565b805460581c6002811662000496575b505050838052858116967fb5a1de456fff688115a4f75380060c23c8532d14ff85f687cc871456d64203939688888888a2600d546200027781620005f4565b92613e8093808502948504036200048257620002988360a0511692620005f4565b15620004715768a20d6e21d0e52553099183835416620004605780156200044f57630f4599e58952338a5289896024601c82855af1888a51141615620004425768a20d6e21d0e525530891825493640100000000928367ffffffff0000000019871617855582825416179055856200033a575b8d5161557d908162000683823960805181612b21015260a051818181611967015281816129a901526133460152f35b8c1562000431576200034e600d54620005f4565b860463fffffffe108660601c17620004205760a086901b1667ffffffff00000001600160a01b03939093168317179055620003c693929190620003918462000628565b91825416179055855287857fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8882a362000628565b805460581c8360028216151503620003f2575b5050508152a2388080808080808080808080806200030b565b815460ff60581b1916921660021860581b6bff000000000000000000000016919091179055388080620003d9565b8d5163e5cfe95760e01b8152600490fd5b8d51633a954ecd60e21b8152600490fd5b63d125259c89526004601cfd5b8c516339a84a7b60e01b8152600490fd5b8c51633ab534b960e21b8152600490fd5b8b51630af2b2b160e01b8152600490fd5b634e487b7160e01b88526011600452602488fd5b815460ff60581b1916921660021860581b6bff00000000000000000000001691909117905581388062000238565b88513d86823e3d90fd5b634e487b7160e01b89526041600452602489fd5b8087528688528a872033885288528a87208660ff198254161790553390339060008051602062008c278339815191528980a438620001b1565b8087528688528a872033885288528a87208660ff198254161790553390339060008051602062008c278339815191528980a43862000174565b8087528688528a872033885288528a87208660ff198254161790553390339060008051602062008c278339815191528980a43862000137565b85805285875289862033875287528986208560ff1982541617905533338760008051602062008c278339815191528180a4620000fb565b600080fd5b634e487b7160e01b600052604160045260246000fd5b51906001600160a01b0382168203620005c457565b90670de0b6b3a7640000918281029281840414901517156200061257565b634e487b7160e01b600052601160045260246000fd5b9060018060a01b03821660005268a20d6e21d0e52553136020526040600020916001835460581c1615620006595750565b825460ff60581b1916903b1515600190811b1760581b6bff00000000000000000000001617825556fe6080604081815260049182361015610839575b50361561082d5768a20d6e21d0e5255309546001600160a01b039081169190600090813560e01c9063e5eb36c8821461045b5763813500fc82146104125763e985e9c582146103d157636352211e821461032257632435987982146102d15763d10b6e0c82146101df5763081812fc82146101475763f5b100ea82146100f5575063e2c7928181146100c35763b7a94eb891929350146100ba575051631e085ca760e11b8152fd5b80600160209252f35b509133036100e65760208263ffffffff68a20d6e21d0e52553085460801c168152f35b5163ce5a776b60e01b81529050fd5b92919390503303610138575061012f63ffffffff91602094351660018060a01b031660005268a20d6e21d0e5255313602052604060002090565b5460801c168152f35b5163ce5a776b60e01b81528390fd5b92919390503303610138578335826101ae610190600019640100000000851085020160011b60e08160031c685106b710e87292a98960611b01549160051b161c63ffffffff1690565b63ffffffff1660005268a20d6e21d0e525530a602052604060002090565b5416156101cf5760209450835268a20d6e21d0e525530c8452822054168152f35b815163677510db60e11b81528590fd5b92919390503303610138578184351660243591836044351693610233610190600019640100000000871087020160011b60e08160031c685106b710e87292a98960611b01549160051b161c63ffffffff1690565b541693848103610290575b506020955082855268a20d6e21d0e525530c86528420816001600160601b0360a01b82541617905560018260081c68a20d6e21d0e525530d60601b019260ff16911515821b911b198254161790558152f35b6102b690859060285260145268a20d6e21d0e525530b6000526048600020906000602852565b54156102c2578561023e565b516367d9dca160e11b81528590fd5b92919390503303610138575061031c61019060209435600019906401000000008110020160011b60e08160031c685106b710e87292a98960611b01549160051b161c63ffffffff1690565b54168152f35b9050848433036103c3578035600019906401000000008110020160e060018060fd1b038260021c16685106b710e87292a98960611b01549160061b161c63ffffffff1693826103898663ffffffff1660005268a20d6e21d0e525530a602052604060002090565b5416156103b657505061031c60209363ffffffff1660005268a20d6e21d0e525530a602052604060002090565b5163677510db60e11b8152fd5b835163ce5a776b60e01b8152fd5b9291939050330361013857506020928161040d92602435169135169060285260145268a20d6e21d0e525530b6000526048600020906000602852565b548152f35b9291939050330361013857509161045483602094602435151593351690604435169060285260145268a20d6e21d0e525530b6000526048600020906000602852565b5560018152f35b9192859150843303610820578282351690836024351692604435968560643516908515610810571561080c5760001990600196806104c7610190858d640100000000811002018b1b60e08160031c685106b710e87292a98960611b01549160051b161c63ffffffff1690565b541686036107fd578582036107a2575b50506104e284614fc2565b916104ec86614fc2565b91600d5494670de0b6b3a76400009586810296818804149015171561078f576001600160a01b038716600090815268a20d6e21d0e52553106020526040902092855460a01c90818811610781575085546001600160a01b03199188900360a090811b83166001600160a01b0392831617885586546001600160601b038a1681831c0190911b909216911617845560209a6107119594909361070b938a938c91908e68a20d6e21d0e525530d60601b60088a901c015460ff8a161c841661073b575b5050875463ffffffff60801b198116608091821c63ffffffff90811684019283901b63ffffffff60801b169190911790995560e0631fffffff8260031c168560601b01549160051b161c88166106588161062b85858c01811b0160e08160031c685106b710e87292a98960611b01549160051b161c63ffffffff1690565b958b87169060e0909291928360031c9060601b019260051b1682549182821c1863ffffffff16901b189055565b01811b019060e08260031c685106b710e87292a98960611b019260051b1682549182821c188816901b18905561070685825460801c16956106b9818d890116849081549063ffffffff60801b9060801b169063ffffffff60801b1916179055565b6001600160a01b038416600090815268a20d6e21d0e52553106020526040902060601b600388901c01805463ffffffff60058a901b60e01682811c948a16949094181690921b9091189055565b615017565b906150bb565b84527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8585a38152f35b68a20d6e21d0e525530d60601b60088a901c018054600160ff8c161b1916905588815268a20d6e21d0e525530c6020522080546001600160a01b03191690558f8e6105ad565b8251631e9acf1760e31b8152fd5b634e487b7160e01b8a526011835260248afd5b6107c882879060285260145268a20d6e21d0e525530b6000526048600020906000602852565b546104d75789895268a20d6e21d0e525530c6020528489205416036107ee5788806104d7565b509051632ce44b5f60e11b8152fd5b845162a1148160e81b81528490fd5b8680fd5b8351633a954ecd60e21b81528390fd5b5163ce5a776b60e01b8152fd5b3461083457005b600080fd5b600090813560e01c90816301ffc9a7146134d157508063055ad42e146134b25780630562b9f71461339457806306fdde031461332c5780630700efce146132cf578063095ea7b31461324d5780630aab8ba5146131f15780631581b60014610e6f57806318160ddd146131c757806318712c21146130a55780631e0fbfa21461306a5780631ec145dd14613042578063238fb4ef14612fb557806323b872dd14612f3a578063248a9ca314612f105780632569296214612ec5578063272f5be814612e7d578063274e430b14612e4e5780632a6a935d14612db85780632cc8265514612d3e5780632f2ff15d14612c955780633006b54314612bfd578063313ce56714612be157806336568abe14612b50578063396e8f5314612b0c5780633ab1a49414612a8c5780633ccfd60b146129d8578063444d917214612994578063453c23101461296e5780634b980d671461294f5780634ef41efc1461291e57806351858e27146128a157806354c3a192146127be57806354d1f13d1461277857806355f804b3146125da57806356a3d732146124f95780635a6e7d411461243a5780636296d2b4146122d9578063639984c514611fbb5780636609b18e14611c9e5780636ddcb44214611b8857806370a0823114611b3a578063715018a614611af4578063758cbc3a14611aaf57806375b238fc14611a745780638da5cb5b14611a4757806391d1485414611a01578063957aa58c146119dd57806395d89b411461194d5780639a7620a814611819578063a217fddf146117fe578063a2309ff8146117d9578063a9059cbb146117a8578063bd93641b14611593578063c418f8bb1461149d578063c87b56dd1461137a578063caa0f92a1461134c578063ccfdd2f8146112d6578063d3668ebe14611242578063d539139314611207578063d547741f146111c9578063d5abeb01146111a3578063dd62ed3e14611153578063de2ad38a14610e98578063e8e7f80014610e6f578063ec0d755714610e3d578063f04e283e14610dbd578063f2fde38b14610d50578063f645d4f914610d27578063f9da322414610c36578063fe1e302314610b915763fee81cf403610012579034610b8d576020366003190112610b8d57602091610b77613559565b9063389a75e1600c525281600c20549051908152f35b5080fd5b509134610c32576020366003190112610c3257803591610baf613a19565b82845260096020528084209182549060ff8260a01c1615610c1b57509160ff6020927fcaa587774a739716975845b28aca3a12b09f0b2fd6c92d932399daa4ad6f0b5f948260a81b838260a81c161560a81b16908360a81b191617809355519160a81c1615158152a280f35b8251630641efb760e51b8152908101859052602490fd5b8280fd5b50919034610c32576020366003190112610c3257610c526135c9565b610c5a613a19565b600c549063ffffffff938482169483168510610cd95750928260209263ffffffff60401b7fef996b8a1b7c31d0243ffa1e0e12f6fcb5a5208385d9d8e87ee0534b6e69a25596600080516020615528833981519152961b169063ffffffff60401b191617600c55686d6178537570706c7960b81b81515251908152a280f35b608490602085519163e066a8d760e01b8352820152602160248201527f4e6577206d617820737570706c792062656c6f7720746f74616c206d696e74656044820152601960fa1b6064820152fd5b509034610b8d5781600319360112610b8d5760075490516001600160a01b039091168152602090f35b50826020366003190112610b8d57610d66613559565b90610d6f6139fc565b8160601b15610db2575060018060a01b0316638b78c6d8198181547f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08580a35580f35b637448fbae8352601cfd5b50826020366003190112610b8d57610dd3613559565b90610ddc6139fc565b63389a75e1600c528183526020600c209081544211610e32575082905560018060a01b0316638b78c6d8198181547f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08580a35580f35b636f5e88188452601cfd5b5034610e6c5780600319360112610e6c57610e56613a19565b600e5460ff80821615169060ff191617600e5580f35b80fd5b509034610b8d5781600319360112610b8d5760035490516001600160a01b039091168152602090f35b50906080366003190112610b8d5782359060243580151580910361114f576064356001600160401b03811161114b57610ed49036908701613638565b909160ff600e54161561113b5760085491828752602093600985528588205460ff8160a01c16156111245760a81c60ff1661110d5783885260098552610f26876001600160601b03888b205416613871565b34036110fe57600c549163ffffffff938484169a858a8d01958a1c169b8c86116110c05750908a959493929187875260098952858a88205460801c1680611089575b508787526009895285808b808a2099600a8d528181203382528d52205416975460601c1680610f978d8a6138bd565b11611063575050968a611009829897969594611018948d600b9c8e610fba6139a6565b604435928b82600854998a815260098c52205460ff8160b01c16600014611058575050610fe88515156138ca565b815198610ff48a613706565b338a5289015287015260608601523691613916565b608083015260a0820152614ddb565b60018055838952600a8552868920338a528552868920828963ffffffff19950116848254161790551690600c541617600c55855252822090815401905580f35b60601c169350610fe8565b908a8c6110728a6044956138b0565b915163219dd1b760e01b8152928301526024820152fd5b9091929394959650600b8952898c205490808c8301116110b1578c9796959493929150610f68565b8b611072604494938d936138b0565b8a9250896110d16110fa928f61389a565b9051637502c12360e11b815292830193845263ffffffff16602084015290918291604090910190565b0390fd5b855162bfc92160e01b81528990fd5b8551632fe3470360e11b8152808a01859052602490fd5b8651630641efb760e51b8152808b01869052602490fd5b835163baf13b3f60e01b81528790fd5b8480fd5b8380fd5b509034610b8d5780600319360112610b8d5760209061119b611173613559565b61117b61356f565b60285260145268a20d6e21d0e525530f6000526048600020906000602852565b549051908152f35b509034610b8d5781600319360112610b8d57600c548151911c63ffffffff168152602090f35b50919034610c325780600319360112610c325761120491356111ff60016111ee61356f565b938387528660205286200154613d4a565b6148ff565b80f35b509034610b8d5781600319360112610b8d57602090517f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a68152f35b50919034610c32576020366003190112610c3257813591611261613a19565b82156112b85750602082600080516020615528833981519152927f341240f02d2fb9af45ea944a93599eb4428bb2c222a699f51dfc890760f1394594600d55686d696e74526174696f60b81b81515251908152a280f35b82604492600d5490519263350c7cdb60e01b84528301526024820152fd5b50919034610c32576020366003190112610c32576020600080516020615528833981519152917f3f84be5711ce273bd979b147a668e592577d8822754db7e25bf3a27a1c017579933590611328613a19565b816002557036b0bc2832b92a3930b739b0b1ba34b7b760791b81515251908152a280f35b509034610b8d5781600319360112610b8d5768a20d6e21d0e5255308549051602091821c63ffffffff168152f35b509034610b8d5760209283600319360112610c32576060926006549161139f83613837565b6113b5575b8351806113b1878261352d565b0390f35b6113c3919293945035613e54565b835192826113d082613837565b9160019081811690811561147f5750600114611429575b505050826113b195836114058461142096600596519485920161350a565b0164173539b7b760d91b815203601a19810184520182613789565b903880806113a4565b9091929350600682527ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f5b83831061146c575050508201840190828560056113e7565b8054868401890152918701918101611454565b60ff1916878a015250505080151502830185019150828560056113e7565b509134610c325781600319360112610c325780356114b96135dc565b916114c2613a19565b818552600960205260ff8486205460a01c161561157e575080845260096020908152838520805463ffffffff60601b1916606085901b63ffffffff60601b1617905560008051602061552883398151915292909163ffffffff906115749061152990613e54565b61156f603388518093726d617850657257616c6c65745f70686173655f60681b8983015261155f815180928b868601910161350a565b8101036013810184520182613789565b6137db565b945191168152a280f35b602491845191630641efb760e51b8352820152fd5b509134610c32576060366003190112610c32576001600160401b0390803582811161114b576115c59036908301613638565b9260249060243590811161080c576115e09036908501613638565b9290916115eb6135ba565b946115f4613c03565b8487148015906117a0575b61179257885b8781106116b35750505085519480606087016060885252608086019190885b8181106116855750505084810360208601528281526001600160fb1b03831161080c577f27a890c7250443bf27fd15f7a3efe30003fd0bc2da75d7ebb8d795fc83fd618895602094869460051b80948785013715159084015201030190a180f35b90919283359060018060a01b0382168092036116af57908152602090810193019190600101611624565b8a80fd5b6001600160a01b036116ce6116c9838b8861396c565b613992565b161561178357861561173f576116e581878761396c565b35600d5490670de0b6b3a76400009182810292818404149015171561172d576117146001939261172792613871565b6117226116c9848d8a61396c565b614973565b01611605565b634e487b7160e01b8c5260118452848cfd5b61174a81878761396c565b35670de0b6b3a7640000908181029181830414901517156117715790611727600192611714565b634e487b7160e01b8b5260118352838bfd5b5087516376f54d1560e01b8152fd5b87516376f54d1560e01b8152fd5b5086156115ff565b509034610b8d5780600319360112610b8d576020906117d26117c8613559565b6024359033613eb3565b5160018152f35b509034610b8d5781600319360112610b8d5760209063ffffffff600c54169051908152f35b509034610b8d5781600319360112610b8d5751908152602090f35b509134610c325760c0366003190112610c3257803591611837613622565b906044359163ffffffff918284168085036119495760643593841692838503611945576084359460a435968715158098036116af57611874613a19565b898b526009602052848b209283549960ff8b60a01c1661192e575060028401889055608092831b63ffffffff60801b16606092831b63ffffffff60601b166001600160601b0392909216600161ff0160a81b03199b909b168b17919091171760b089901b60ff60b01b1617600160a01b1790925583519788526020880192909252918601929092528401919091528201527fefc86cdb7fbdb2c9eb4f56ac330863ccbaa9a16a700b884f9375e4b82e4363299060a090a280f35b8651630964557760e41b81529081018c9052602490fd5b8880fd5b8780fd5b509134610c325782600319360112610c32576113b19250337f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316036119bc575080516119a08161376e565b600381526226a0ab60e91b6020820152905b519182918261352d565b8151906119c88261376e565b815263122b262760e11b6020820152906119b2565b509034610b8d5781600319360112610b8d5760209060ff600e541690519015158152f35b509134610c325781600319360112610c32578160209360ff92611a2261356f565b903582528186528282206001600160a01b039091168252855220549151911615158152f35b509034610b8d5781600319360112610b8d57638b78c6d8195490516001600160a01b039091168152602090f35b509034610b8d5781600319360112610b8d57602090517fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c217758152f35b509134610c325781600319360112610c32576020928291611ace61356f565b90358252600985528282206001600160a01b039091168252600301845220549051908152f35b5080600319360112610e6c57611b086139fc565b80638b78c6d8198181547f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a35580f35b509034610b8d576020366003190112610b8d57602090611b7d611b5b613559565b6001600160a01b0316600090815268a20d6e21d0e52553136020526040902090565b5460a01c9051908152f35b509134610c32576020366003190112610c32578282916101009460e08451611baf81613737565b82815282602082015282868201528260608201528260808201528260a08201528260c0820152015235815260096020522090815460026001840154936001600160601b039063ffffffff928391015494805192611c0b84613737565b60ff8660a01c16151597888552602085019260ff8860a81c1615158452808601918252606086019183891683526080870194868a60601c16865260e060a0890198888c60801c168a5260ff60c082019c60b01c1615158c52019a8b5282519b8c5251151560208c015251908a01525116606088015251166080860152511660a084015251151560c08301525160e0820152f35b509034610b8d57611cae366135ef565b91927f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a6808652602090868252828720338852825260ff838820541615611dfc5750506001600160a01b0384169384158015611df4575b611de4578315611d9757600d54670de0b6b3a764000090818102918183041490151715611d84577f0610a4434b6dd70cb607c534c0839e0d53c57bea1e48a8a945e348a0a3f1f44d95969750611d7e9291611d62611d689286613871565b90614973565b5191825291151560208201529081906040820190565b0390a280f35b634e487b7160e01b875260118852602487fd5b670de0b6b3a7640000808402908482041484151715611d84577f0610a4434b6dd70cb607c534c0839e0d53c57bea1e48a8a945e348a0a3f1f44d95969750611d7e9291611d689190614973565b81516376f54d1560e01b81528790fd5b508215611d04565b90868892611e0933615418565b855191611e1583613753565b60428352848301936060368637835115611fa8576030855383519060019160011015611f955790607860218601536041915b818311611f2a57505050611ee8576110fa938693611ed493611ec5604894611e9c9a519a8576020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b8d97880152825192839160378901910161350a565b8401917001034b99036b4b9b9b4b733903937b6329607d1b60378401525180938684019061350a565b01036028810187520185613789565b5162461bcd60e51b8152928392830161352d565b50505080606493519262461bcd60e51b845283015260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152fd5b909192600f81166010811015611f82576f181899199a1a9b1b9c1cb0b131b232b360811b901a611f5a8588615407565b53881c928015611f6f57600019019190611e47565b634e487b7160e01b825260118952602482fd5b634e487b7160e01b835260328a52602483fd5b634e487b7160e01b815260328852602490fd5b634e487b7160e01b815260328752602490fd5b509060a0366003190112610b8d57611fd1613559565b90602491823592611fe06135ba565b916084356001600160401b03811161080c57611fff9036908901613638565b92909733321480156122c5575b1561225e5760ff600e541615612250576008549384895260209560098752878a205460ff8160a01c16156122395760a81c60ff1661222357858a5260098752612061896001600160601b038a8d205416613871565b340361221457600c549263ffffffff94858516868c8201968c1c1680871161220457505090889392918b878c8f8c8152600989528c838383205460801c16806121c6575b50815260098952818120600a8a528282206001600160a01b03909d168083529c90995220549654968116999660601c169081906120e2908b6138bd565b116121a1575050508a6110098b9c9d612156948c9d600b9d8d966121046139a6565b606435928c83600854998a815260098c52205460ff8160b01c166000146121965750506121328515156138ca565b82519861213e8a613706565b8b8a5289015215159087015260608601523691613916565b60018055848a52600a8652878a20908a528552868920828963ffffffff19950116848254161790551690600c541617600c55855252822090815401905580f35b60601c169350612132565b604492918d6121b18b8f946138b0565b925163219dd1b760e01b815293840152820152fd5b95969798999350505050600b9150528a8d205490808d8301116121f45750908b878c8f8c8e999897966120a5565b918c6121b18d93604496956138b0565b6110fa8c6110d18f94879461389a565b875162bfc92160e01b81528390fd5b50508551632fe3470360e11b8152908101849052fd5b50508651630641efb760e51b815291820185905250fd5b855163baf13b3f60e01b8152fd5b603f608492602088519362461bcd60e51b85528401528201527f5468652063616c6c657220697320616e6f7468657220636f6e7472616374206160448201527f6e64206e6f7420616e20617574686f72697a656420666f727761726465722e006064820152fd5b506007546001600160a01b0316331461200c565b509134610c325781600319360112610c32578035906122f66135dc565b916122ff613a19565b8085526020926009845260ff8587205460a01c161561242357818652600b8452848620549263ffffffff82169384106123c9575081865260098452848620805463ffffffff60801b191660809290921b63ffffffff60801b169190911790556000805160206155288339815191529291906123c09061237d90613e54565b61156f6030875180936f6d6178537570706c795f70686173655f60801b888301526123b0815180928a868601910161350a565b8101036010810184520182613789565b9351908152a280f35b855163e066a8d760e01b8152908101859052602d60248201527f4e6577207068617365206d617820737570706c792062656c6f7720706861736560448201526c081d1bdd185b081b5a5b9d1959609a1b6064820152608490fd5b8451630641efb760e51b8152808401839052602490fd5b509134610c325781600319360112610c32578035612456613622565b9161245f613a19565b818552600960205260ff8486205460a01c161561157e5750600080516020615528833981519152916123c06124ba836020948852600985526001600160601b03878920941693846001600160601b0319825416179055613e54565b61156f602c875180936b70726963655f70686173655f60a01b888301526124e9815180928a868601910161350a565b810103600c810184520182613789565b509034610b8d57612509366135ef565b9192612513613c03565b6001600160a01b03841693841580156125d2575b611de457831561258557600d54670de0b6b3a764000090818102918183041490151715611d84577f7d6c77b6b3211c768de8bb693397ebb3ecdc9bf2cf62817255c91a403d56808d95969750611d7e9291611d62611d689286613871565b670de0b6b3a7640000808402908482041484151715611d84577f7d6c77b6b3211c768de8bb693397ebb3ecdc9bf2cf62817255c91a403d56808d95969750611d7e9291611d689190614973565b508215612527565b838234610e6c576020916020600319360112610b8d5780356001600160401b039182821161114f573660238301121561114f57810135918211610c3257602490366024848301011161114f5761262e613a19565b6126366139a6565b612641600654613837565b601f8111612719575b508391601f841160011461268f5750838394955092612681575b50508160011b916000199060031b1c1916176006555b6001805580f35b602492500101358380612664565b91947ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f92601f1985169186915b8383106126fd57505050948360019596106126e0575b505050811b0160065561267a565b0160240135600019600384901b60f8161c191690558380806126d2565b908060018a978483969c890101358155019601980191906126bc565b7ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f601f850160051c8101916020861061276e575b601f0160051c01905b818110612763575061264a565b858155600101612756565b909150819061274d565b5080600319360112610e6c5763389a75e1600c52338152806020600c2055337ffa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c928280a280f35b50919034610c32576127cf36613585565b9391926127da6139fc565b6127e26139a6565b6001600160a01b038481169490939030861461286757876044601082602094886014528b60345263a9059cbb60601b82525af13d15600189511417161561285c5750916020917f1ac506e936e7f02f4036dbe44708f5e8d72af9ace8745a29fd391481a8fbcb879387603452519586521693a36001805580f35b6390b8ec188752601cfd5b506020606492519163e066a8d760e01b8352820152601360248201527221b0b73737ba103932b1b7bb32b91039b2b63360691b6044820152fd5b509034610b8d5781600319360112610b8d577f88313a379cb5333a1379fba0719d9d3a734fe6625681e0651edf4c8c105b517860207faff618718f1cde37d9c527a9237b04e6ac0489a8647d0517bb15827758ece72092612900613a19565b60ff19600e5416600e5564706175736560d81b81515251428152a280f35b509034610b8d5781600319360112610b8d5768a20d6e21d0e52553095490516001600160a01b039091168152602090f35b509034610b8d5781600319360112610b8d576020906002549051908152f35b509034610b8d5781600319360112610b8d57600c549051602091821c63ffffffff168152f35b509034610b8d5781600319360112610b8d57517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b509134610c325782600319360112610c32576129f26139a6565b6129fa6139fc565b60035483906001600160a01b0316612a138115156136ba565b8180389247905af115612a8157507f88313a379cb5333a1379fba0719d9d3a734fe6625681e0651edf4c8c105b517860208267776974686472617760c01b7f855511cc3694f64379908437d6d64458dc76d02482052bfb8a5b33a72c054c7794515251428152a26001805580f35b63b12d13eb8352601cfd5b509134610c32576020366003190112610c3257612aa7613559565b612aaf6139fc565b6001600160a01b0316918215612ad75750506001600160601b0360a01b600354161760035580f35b906020606492519162461bcd60e51b8352820152600f60248201526e496e76616c6964206164647265737360881b6044820152fd5b509034610b8d5781600319360112610b8d57517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b508234610b8d5782600319360112610b8d57612b6a61356f565b90336001600160a01b03831603612b86579061120491356148ff565b608490602085519162461bcd60e51b8352820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152fd5b509034610b8d5781600319360112610b8d576020905160128152f35b509034610b8d576020366003190112610b8d5760008051602061552883398151915260207fc6754f10631b5a99eaa243abe7df60798bee230d34474d8d8e161c7fa79edc629263ffffffff612c506135c9565b91612c59613a19565b600c5467ffffffff0000000084861b169067ffffffff00000000191617600c556b1b585e14195c95d85b1b195d60a21b8151525191168152a280f35b509134610c325781600319360112610c32573590612cb161356f565b9082845283602052612cc860018286200154613d4a565b82845260208481528185206001600160a01b039093168086529290528084205460ff1615612cf4578380f35b828452836020528084208285526020528320600160ff1982541617905533917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d8480a43880808380f35b509134610c32576020366003190112610c3257803591612d5c613a19565b828452600960205260ff8185205460a01c1615612da3575050600854816008557fa89951a03e2758c1bc16583a91fbb676c836dcda755bf7d40c05625b2bfdccec8380a380f35b916024925191630641efb760e51b8352820152fd5b509134610c32576020366003190112610c325735801515809103610c325791602092612de333614fc2565b805460581c908260028316151503612e26575b505081527fb5a1de456fff688115a4f75380060c23c8532d14ff85f687cc871456d6420393833392a25160018152f35b805460ff60581b191660ff9290921660021860581b60ff60581b169190911790553880612df6565b509034610b8d576020366003190112610b8d57602090612e74612e6f613559565b6137fb565b90519015158152f35b509134610c325781600319360112610c32578160209363ffffffff92612ea161356f565b90358252600a86528282206001600160a01b03909116825285522054915191168152f35b5080600319360112610e6c5763389a75e1600c523381526202a30042016020600c2055337fdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d8280a280f35b509134610c32576020366003190112610c3257816020936001923581528085522001549051908152f35b5034610e6c5750612f4a36613585565b93612f7492919233839060285260145268a20d6e21d0e525530f6000526048600020906000602852565b8054909160018201612f8f575b6020866117d2898888613eb3565b818711612fa7575085900390558160206117d2612f81565b85516313be252b60e01b8152fd5b509134610c32576020366003190112610c32576101009282913581526009602052209081549160ff63ffffffff9360026001840154930154938051956001600160601b0383168752808360601c1660208801528260801c1690860152818160a01c1615156060860152818160a81c161515608086015260b01c16151560a084015260c083015260e0820152f35b509134610c32576020366003190112610c32576020928291358152600b845220549051908152f35b509034610b8d5781600319360112610b8d57602090517f3a2f235c9daaf33349d300aadff2f15078a89df81bcfdd45ba11c8f816bddc6f8152f35b509034610b8d5780600319360112610b8d578235926024356130c5613a19565b8484526020916009835260ff8486205460a01c16156131b0578585526009835260ff8486205460b01c161561316557506123c061312186869760008051602061552883398151915296975260098552836002888a200155613e54565b61156f603187518093706d65726b6c65526f6f745f70686173655f60781b88830152613155815180928a868601910161350a565b8101036011810184520182613789565b835163e066a8d760e01b81526020918101828152828101929092527f506861736520646f6573206e6f74207265717569726520616c6c6f776c69737460408301529081906060010390fd5b8351630641efb760e51b8152908101869052602490fd5b509034610b8d5781600319360112610b8d5760209068a20d6e21d0e52553085460a01c9051908152f35b508234610b8d576020366003190112610b8d57803590818352600960205260ff8484205460a01c161561157e57818352600960205260ff8484205460b01c16156131655760208460028186868152600985522001549051908152f35b509034610b8d5780600319360112610b8d5760209161326a613559565b6024358061329483339060285260145268a20d6e21d0e525530f6000526048600020906000602852565b5582526001600160a01b03169033907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925908590a35160018152f35b50809234610b8d576020366003190112610b8d5760029035926132f0613a19565b8383526009602052822082815582600182015501557f3ae6bd42f8622e3894ef16a2193a204de29ee6392703e402f31749d92b1735e88280a280f35b509034610b8d5781600319360112610b8d576113b19150337f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316036133865761337b6137aa565b90519182918261352d565b61338e6137aa565b906119b2565b509034610b8d576020366003190112610b8d578235906133b26139a6565b6133ba6139fc565b6003546001600160a01b039081166133d38115156136ba565b831561346f5783471061343557849081808638935af11561342957907f5e737119861ebb8ae4f22253f041cd898cf3e5d13c721dfa00bec4b7b43fc8979160035416928151908152426020820152a26001805580f35b8463b12d13eb8552601cfd5b825162461bcd60e51b81526020818801526014602482015273496e73756666696369656e742062616c616e636560601b6044820152606490fd5b825162461bcd60e51b8152602081880152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e20300000006044820152606490fd5b509034610b8d5781600319360112610b8d576020906008549051908152f35b90508334610c32576020366003190112610c325735916001600160e01b031983168303610e6c5750613504602092613668565b15158152f35b60005b83811061351d5750506000910152565b818101518382015260200161350d565b6040916020825261354d815180928160208601526020868601910161350a565b601f01601f1916010190565b600435906001600160a01b038216820361083457565b602435906001600160a01b038216820361083457565b6060906003190112610834576001600160a01b0390600435828116810361083457916024359081168103610834579060443590565b60443590811515820361083457565b6004359063ffffffff8216820361083457565b6024359063ffffffff8216820361083457565b6060906003190112610834576004356001600160a01b038116810361083457906024359060443580151581036108345790565b602435906001600160601b038216820361083457565b9181601f84011215610834578235916001600160401b038311610834576020808501948460051b01011161083457565b6001600160e01b0319166336372b0760e01b81146136b4576301ffc9a760e01b81146136b4576380ac58cd60e01b81146136ae57637965db0b60e01b1480156136ae5790565b50600090565b50600190565b156136c157565b60405162461bcd60e51b815260206004820152601860248201527f57697468647261772061646472657373206e6f742073657400000000000000006044820152606490fd5b60c081019081106001600160401b0382111761372157604052565b634e487b7160e01b600052604160045260246000fd5b61010081019081106001600160401b0382111761372157604052565b608081019081106001600160401b0382111761372157604052565b604081019081106001600160401b0382111761372157604052565b90601f801991011681019081106001600160401b0382111761372157604052565b604051906137b78261376e565b601582527426aaaa20a72a1020a624a2a729902b24a62620a4a760591b6020830152565b6137f39060206040519282848094519384920161350a565b810103902090565b6001600160a01b038116600090815268a20d6e21d0e5255313602052604090205460581c6001811615613832576002915016151590565b503b90565b90600182811c92168015613867575b602083101461385157565b634e487b7160e01b600052602260045260246000fd5b91607f1691613846565b8181029291811591840414171561388457565b634e487b7160e01b600052601160045260246000fd5b63ffffffff918216908216039190821161388457565b9190820391821161388457565b9190820180921161388457565b156138d157565b60405162461bcd60e51b815260206004820152601860248201527f416c6c6f776c6973742070726f6f6620726571756972656400000000000000006044820152606490fd5b9092916001600160401b038411613721578360051b602092602060405161393f82850182613789565b809781520191810192831161083457905b82821061395d5750505050565b81358152908301908301613950565b919081101561397c5760051b0190565b634e487b7160e01b600052603260045260246000fd5b356001600160a01b03811681036108345790565b6002600154146139b7576002600155565b60405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606490fd5b638b78c6d819543303613a0b57565b6382b429006000526004601cfd5b3360009081527f7d7ffb7a348e1c6a02869081a26547b49160dd3df72d1d75a570eb9b698292ec60209081526040808320549092907fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c217759060ff1615613a7e5750505050565b613a8733615418565b845191613a9383613753565b60428352848301936060368637835115613bef576030855383519060019160011015613bef5790607860218601536041915b818311613b8157505050613b3f57611e9c938593613b2993613b1a6048946110fa9951988576020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b8b97880152825192839160378901910161350a565b01036028810185520183613789565b5162461bcd60e51b81529182916004830161352d565b60648486519062461bcd60e51b825280600483015260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152fd5b909192600f81166010811015613bdb576f181899199a1a9b1b9c1cb0b131b232b360811b901a613bb18588615407565b5360041c928015613bc757600019019190613ac5565b634e487b7160e01b82526011600452602482fd5b634e487b7160e01b83526032600452602483fd5b634e487b7160e01b81526032600452602490fd5b3360009081527fc36282328fcdfb3ab7b55ebd970e39b3777a8c58b872e64ea8cf6803645f57b060209081526040808320549092907f3a2f235c9daaf33349d300aadff2f15078a89df81bcfdd45ba11c8f816bddc6f9060ff1615613c685750505050565b613c7133615418565b845191613c7d83613753565b60428352848301936060368637835115613bef576030855383519060019160011015613bef5790607860218601536041915b818311613d0457505050613b3f57611e9c938593613b2993613b1a6048946110fa9951988576020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b8b97880152825192839160378901910161350a565b909192600f81166010811015613bdb576f181899199a1a9b1b9c1cb0b131b232b360811b901a613d348588615407565b5360041c928015613bc757600019019190613caf565b6000818152602090808252604092838220338352835260ff848320541615613d725750505050565b613d7b33615418565b845191613d8783613753565b60428352848301936060368637835115613bef576030855383519060019160011015613bef5790607860218601536041915b818311613e0e57505050613b3f57611e9c938593613b2993613b1a6048946110fa9951988576020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b8b97880152825192839160378901910161350a565b909192600f81166010811015613bdb576f181899199a1a9b1b9c1cb0b131b232b360811b901a613e3e8588615407565b5360041c928015613bc757600019019190613db9565b90604051608081019260a0820160405260008452925b6000190192600a906030828206018553049283613e6a57809350608091030191601f1901918252565b8115613e9d570490565b634e487b7160e01b600052601260045260246000fd5b6001600160a01b038216156148ed57613ecb81614fc2565b613ed483614fc2565b68a20d6e21d0e5255309549095906001600160a01b03161561083457604051926101a084018481106001600160401b0382111761372157604052600084526000602085015260006060850152600060e085015260006101008501526000610120850152600061014085015260006101608501526000610180850152825463ffffffff8160801c16608086015263ffffffff885460801c1660a086015268a20d6e21d0e52553085460a01c60c086015260a01c80604086015286116148db576040840180518790039081905283546001600160a01b031960a083811b82166001600160a01b039384161787558a5480821c8b0160608a0181905290911b90911691161788556080850151600d549182670de0b6b3a7640000810204670de0b6b3a764000014831517156138845761401590670de0b6b3a7640000840290613e93565b8082039111028086526002895460581c1615614885575b50506080840151845160208601518082188282100282188084189084110280841898939192911461487757879003865286900360208601526001600160a01b0382811690821614614860576040519661408488613753565b60008852600060208901526000604089015260608089015260405187815260208860051b82010160405280896060015282896040015283896020015260200188526140e98360018060a01b031660005268a20d6e21d0e5255310602052604060002090565b6001600160a01b038316600090815268a20d6e21d0e5255310602052604090209095909963ffffffff61411c8583615017565b1661014089015260a088015198878c8a8c60015b15614246575b63ffffffff6001816101406141b09561419b60009960e0600019608085015101918260808601528260031c9060601b01549160051b161c98878a86169160e0909291928360031c9060601b019260051b1682549182821c1863ffffffff16901b189055565b015116929f019e16908363ffffffff166150bb565b60208d518263ffffffff168152018d5262ffffff8160081c1668a20d6e21d0e525530d60601b015460ff82161c6001166141f0575b508c8a8c8b93614130565b68a20d6e21d0e525530d60601b62ffffff600883901c16018054600160ff84161b1916905563ffffffff1660005268a20d6e21d0e525530c60205260406000206001600160601b0360a01b8154169055386141e5565b5050505060001901801561425d57878c8a8c614136565b5060a08801899052805463ffffffff60801b191660809990991b63ffffffff60801b16989098178855939850919690959194929350909190608082810151855463ffffffff60801b1916911b63ffffffff60801b1617845560016020818060a01b0368a20d6e21d0e5255309541692606081015193845160051b608401906000607f19870196879463144027d3865280870151906040015190605f19830152603f198201526060601f1982015260631901915af19151141615610834575b68a20d6e21d0e5255308549263ffffffff60208301519461436b8451968781858560801c160103978860e08801528460801b8960801b168560801b1985161768a20d6e21d0e525530855016150fc565b958260801b9060801b16908260801b19161760601c1661018083015281516146d3575b50602081015161440a575b50506040810151516143e4575b5060009081526001600160a01b0391821692909116907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90602090a3565b68a20d6e21d0e525530954614404916001600160a01b039091169061525a565b386143a6565b91939092958160601b602086015261443c8260018060a01b031660005268a20d6e21d0e5255310602052604060002090565b9563ffffffff61444c8487615017565b1661014085015260c0840151600d549081670de0b6b3a7640000810204670de0b6b3a7640000148215171561388457670de0b6b3a764000061448f920290613e93565b68a20d6e21d0e525530854602090811c63ffffffff1682811180159091021761016087015260a08601519086015181016101208701819052875463ffffffff60801b191660809190911b63ffffffff60801b16179096559263ffffffff68a20d6e21d0e52553085460401c169860015b1561466e575b61018086015160009063ffffffff8c81169116146145e75768a20d6e21d0e525531160601b631fffffff60038d901c16015463ffffffff60018d0181169c60051b60e0169190911c1663ffffffff166145e2905b6145808160018160081c685106b710e87292a98760611b019160ff161b8019825416179055565b60608c901b60038b901c01805460058c901b60e01681811c63ffffffff8581169190911816901b1890556145cb63ffffffff6101408b01511663ffffffff60018d019c1690836150bb565b8a9060209082519060081b82840151178152019052565b6144ff565b9499939291906101608701515b63ffffffff614628600019830160011b60e08160031c685106b710e87292a98960611b01549160051b161c63ffffffff1690565b161561464b5761463e906001808e01910161514b565b8b811190811502176145f4565b6145e2909b9691929394959b6001810188811190811502176101608a0152614559565b6101208601518703614505579550959391979250955063ffffffff60401b67ffffffff0000000061016068a20d6e21d0e52553085493015160201b169260401b16906bffffffffffffffff000000001916171768a20d6e21d0e5255308553880614399565b949160018760609996939895991b17602089015261470b8460018060a01b031660005268a20d6e21d0e5255310602052604060002090565b608080890151895181036101008b01819052895463ffffffff60801b1916921b63ffffffff60801b16919091179097559660015b15614845575b60009660001901968760031c8960601b015460e08960051b161c8063ffffffff169060001982018060021c685106b710e87292a98960611b019060c082549160061b1681811c6001600160401b0316901b1890556147b4828d9060209082519060081b82840151178152019052565b62ffffff8160081c1660ff81685106b710e87292a98760611b019216916001831b19815416905568a20d6e21d0e525530d60601b0154901c6001166147fa575b5061473f565b68a20d6e21d0e525530d60601b600882901c018054600160ff84161b1916905560005268a20d6e21d0e525530c60205260406000206001600160601b0360a01b8154169055386147f4565b6101008101518703614745579194979396509194503861438e565b9460a08592979598939801510160a082015261431b565b50509450949295909561431b565b6148b391670de0b6b3a7640000916001600160a01b03858116908a16146148ca575b50026060860151613e93565b60a08501518082039111026020850152388061402c565b60808801510360a0880152386148a7565b604051631e9acf1760e31b8152600490fd5b604051633a954ecd60e21b8152600490fd5b9060009180835282602052604083209160018060a01b03169182845260205260ff60408420541661492f57505050565b80835282602052604083208284526020526040832060ff1981541690557ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b339380a4565b906001600160a01b038216156148ed5761498c82614fc2565b68a20d6e21d0e5255309546001600160a01b031615610834576040516149b181613753565b60008082526020820181905260408201819052606082015281546001600160a01b03811660a091821c85019182901b6001600160a01b031916178355600d5490670de0b6b3a7640000918281029281840414901517156138845781614a1591613e93565b604083015268a20d6e21d0e52553085491848360a01c01916001600160601b0360a01b8360a01b1660018060a01b0385161768a20d6e21d0e52553085585831081840463fffffffe108460601c17151517614dc957614a749083613e93565b84549460028660581c1615614abe575b50505050505060005260018060a01b031660007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef602082a3565b6001600160a01b038816600090815268a20d6e21d0e52553106020526040902063ffffffff909660801c1693614afe6040850151868082039111026150fc565b9560408701518051614b13575b505050614a84565b60608b901b6020890152516001600160801b03821660a09390931b6001600160a01b0319169283176001600160a01b03909216909217608090811c63ffffffff90811693811693909301811b63ffffffff60801b9081169290921768a20d6e21d0e5255308556040860151845463ffffffff60801b1916911b90911617825596989597949693959294919390614baa908390615017565b16606085015268a20d6e21d0e5255308549763ffffffff808a60401c1699818160601c16602088015260201c168481119081150217855260015b15614d45575b602085015160009063ffffffff8b8116911614614cc857614cc363ffffffff614c39818060018f01169d1660e08160031c68a20d6e21d0e525531160601b01549160051b161c63ffffffff1690565b165b614c628160018160081c685106b710e87292a98760611b019160ff161b8019825416179055565b60608b901b60038a901c01805460058b901b60e01681811c63ffffffff8581169190911816901b189055614cac63ffffffff60608a01511663ffffffff60018c019b1690836150bb565b899060209082519060081b82840151178152019052565b614be4565b939892919085515b63ffffffff614d04600019830160011b60e08160031c685106b710e87292a98960611b01549160051b161c63ffffffff1690565b1615614d2757614d1a906001808d01910161514b565b8a81119081150217614cd0565b614cc3909a95919293949a6001810187811190811502178852614c3b565b60408501518603614bea579593919792509550614dbb9350519067ffffffff0000000063ffffffff60401b68a20d6e21d0e5255308549260401b169260201b16906bffffffffffffffff000000001916171768a20d6e21d0e52553085560018060a01b0368a20d6e21d0e525530954169061525a565b388080808080808080614b0b565b60405163e5cfe95760e01b8152600490fd5b90602082018051600254808211614fa457505060a08301805193600094855260096020526040918286209260018060a01b03808451168351875160608701519060808801519286519460a086018681106001600160401b03821117614f90578852855260208501528584015260608301526080820152614e5a90615297565b838201805190969015614f50578051600d5490670de0b6b3a764000091828102928184041490151715614f3c57614e9b60ff9798999a9b92614ea492613871565b84895116614973565b8360018901918254928451809401905584895116815260038a0160205220908154019055519463ffffffff600c549080881681831601169063ffffffff191617600c55511694549151955115159080519485526001600160601b038316602086015284015260b01c16151560608201527f432265d7d7c9794c8c17745e14b88a816bd36a0a46e680dde95e885bbc92415460803392a4565b634e487b7160e01b8b52601160045260248bfd5b8051670de0b6b3a764000090818102918183041490151715614f7c5798614ea460ff969798999a614e9b565b634e487b7160e01b8a52601160045260248afd5b634e487b7160e01b8f52604160045260248ffd5b6044925060405191636ff82ea360e01b835260048301526024820152fd5b6001600160a01b038116600090815268a20d6e21d0e525531360205260409020909190916001835460581c1615614ff65750565b825460ff60581b1916903b1515600190811b1760581b60ff60581b16178255565b805460601c63ffffffff9081169392841561503157505050565b68a20d6e21d0e5255308805463ffffffff1981169084166001019093169283179055825463ffffffff60601b1916606083901b63ffffffff60601b1617909255925082906150978263ffffffff1660005268a20d6e21d0e525530a602052604060002090565b80546001600160a01b0319166001600160a01b039092169190911790551561083457565b60001901908160021c685106b710e87292a98960611b019260c084549360061b169163ffffffff169060201b1782821c186001600160401b0316901b189055565b9060409182519060608201908282106001600160401b0383111761372157602091855260008352600082840152606085840152828095805193838594855260051b840101815201526020019052565b685106b710e87292a98760611b600882901c81018054600019959492901960ff851690811c901b90811561521e575b5080615187575b50505050565b9091929394506001811901167e1f0d1e100c1d070f090b19131c1706010e11080a1a141802121b1503160405601f826001600160801b031060071b83811c6001600160401b031060061b1783811c63ffffffff1060051b1792831c63d76453e004161a179074a20d6e21d0e525530dffffffffffffffffffffffff190160081b179182109082101517600003179038808080615181565b600191508360081c01915b01805419828211811761523f5750600190615229565b80919283111561517a5750821960ff1690811b901c8061517a565b60206040600192015192603f19840193849163263c69d6835283601f198301526000825160051b6044019260231901915af1915114161561083457565b60209081810151906000918252600983526040918281209360ff855460b01c16156154005782519460608401958651865190848201926001600160601b03199060601b168352603482015260348152606081018181106001600160401b038211176153ec5787525190206080850151906002830154918291908051806153a8575b50500361537d575083516001600160a01b03168352600301905282902054908201805161534590836138bd565b93518094116153545750505050565b60449450906153649151936138b0565b90519163218a779d60e21b835260048301526024820152fd5b84518651637df9108360e01b81526001600160a01b0390911660048201526024810191909152604490fd5b9250858082019160059460051b0101915b81518111841b9081528682519118528589882091019284838510156153e0575092906153b9565b93505090503880615318565b634e487b7160e01b86526041600452602486fd5b5050505050565b90815181101561397c570160200190565b60405190606082018281106001600160401b0382111761372157604052602a825260208201604036823782511561397c576030905381516001906001101561397c57607860218401536029905b8082116154b95750506154755790565b606460405162461bcd60e51b815260206004820152602060248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152fd5b9091600f81166010811015615512576f181899199a1a9b1b9c1cb0b131b232b360811b901a6154e88486615407565b5360041c9180156154fd576000190190615465565b60246000634e487b7160e01b81526011600452fd5b60246000634e487b7160e01b81526032600452fdfe319a4565da908d26083a1132a8a05b7630d680ea0b63943a59e84146cb97464ea26469706673582212209d777bfabce8a7fd991137b2b3c39d1486a4027fb56b90475f78795ad322972164736f6c63430008180033608060409080825234620003a757606081620030278038038091620000258285620003ac565b833981010312620003a7576200003b81620003d0565b602062000057846200004f838601620003d0565b9401620003d0565b683602298b8c10b0123180546001600160a01b0319166001600160a01b0394851690811790915560016003556007805461ffff1990811661010290811790925560026008556009805460ff1990811690915588519297919694959491936001600160401b0393606081018581118282101762000280578b52602c81527f4465706c6f79696e6720457874656e646564444e3430344d6972726f72207769878201526b3a34103232b83637bcb2b91d60a11b8b8201528a518781019163319af33360e01b83528c60248301528051908160648401528960005b838110620003915750505091816200016c6084828660008381998299010152886044830152601f80199101168101036064810184520182620003ac565b51906a636f6e736f6c652e6c6f675afa5060008052600086528960002081600052865260ff8a60002054161562000355575b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c2177580600052600087528a60002082600052875260ff8b60002054161562000318575b507f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a69182600052600087528a60002082600052875260ff8b600020541615620002da575b5050506007549416908115620002965787519081890190811182821017620002805788528181526103e89301839052607d60a31b1760015560601b6001600160601b03191617600455161760075551612c219081620003e68239f35b634e487b7160e01b600052604160045260246000fd5b875162461bcd60e51b815260048101859052601960248201527f455243323938313a20696e76616c6964207265636569766572000000000000006044820152606490fd5b82600052600087528a60002082600052875260018b60002091825416179055339160008051602062003007833981519152600080a438808062000224565b80600052600087528a6000208260005287528a60002060018482541617905581339160008051602062003007833981519152600080a438620001e0565b6000805260008652896000208160005286528960002060018382541617905533816000600080516020620030078339815191528180a46200019e565b81818401015160848287010152018a906200012f565b600080fd5b601f909101601f19168101906001600160401b038211908210176200028057604052565b51906001600160a01b0382168203620003a75756fe60806040818152600491823610156101bd575b5036156101bb576000803560e01c63263c69d6811461013e5763144027d381146100c957630f4599e51461004e575051631e085ca760e11b8152fd5b683602298b8c10b01231549091906001600160a01b03908116806100aa575b50683602298b8c10b0123091825491821661009b57506001600160a01b031916331790556001815260209150f35b51635fb2b52360e11b81528490fd5b81853516036100b9573861006d565b81516362cf623d60e11b81528490fd5b50683602298b8c10b01230549091906001600160a01b0316330361012f575081356024359060246044358082019581013560051b0101935b8481036101115760208460018152f35b80358383600080516020612bcc8339815191528780a4602001610101565b51631b1e598960e11b81529050fd5b50683602298b8c10b01230549091906001600160a01b0316330361012f5750602482358082019381013560051b0101915b82810361017f5760208260018152f35b80358060601c6affffffffffffffffffffff826001169260081c1691801582029102600080516020612bcc8339815191528580a460200161016f565b005b600090813560e01c9081623f332f14611ccb5750806301ffc9a714611be2578063025e332e14611b9e57806304634d8d14611a8557806306fdde0314611a2157806307265389146119fa578063081812fc146119a8578063095ea7b3146118125780630f4345e2146117e357806318160ddd1461179b57806322f0f2f9146117755780632398f8431461173d57806323b872dd1461169d578063243598791461164b578063248a9ca3146116215780632a55205a14610c985780632f2ff15d14611578578063324cb3cb1461155457806336568abe146114c3578063396e8f53146114a25780633e0f974c1461146257806342842e0e1461134c57806346694b7d1461131f5780634f3db346146113005780635759e231146113005780635944c753146111c15780636352211e1461118f5780636cef16e6146110ee57806370a082311461109557806372b44d7114611038578063753868e31461100f57806375b238fc14610fd45780637c3dc17314610f5e5780637c85a06614610f2357806380f2036314610ef05780638da5cb5b14610ebf5780638fe1061514610e815780639065f62314610e5b5780639131161214610e2257806391d1485414610ddc57806395d89b4114610d7857806397e5311c14610d4a57806399cca36c14610cd65780639c9cfc9714610c98578063a217fddf14610c7d578063a22cb46514610b5a578063a35c23ad14610b2f578063ae17d5d014610b08578063b31391cb14610ae0578063b88d4fde1461097f578063c87b56dd1461090b578063c8ac8b8314610818578063cd808d94146107d5578063d53913931461079a578063d547741f1461075c578063dd2e0ac01461072c578063e086e5ec146106bc578063e985e9c51461064f578063f39e78f214610614578063f4431e49146105df578063fd0536cf146104ce5763ff7682120361001257346104cb5760203660031901126104cb57610488611d84565b610490612105565b6001600160a01b03166104a281612a44565b50337fbd0af1fe0a2c1c7bb340c17a284a291138979c8eeb797e176dbd1c415199af3c8380a380f35b80fd5b5091346105db57816003193601126105db578035916024359160038310156105d7576104f8612105565b6001600160a01b0361050985612485565b163314801561059a575b1561056757507fe2b551c00d162749f98447327d18714eaa6453c11fe903d51d4cc61e2762fb2d9161056191848652600c60205280862060ff1981541660ff84161790555191829182611e4f565b0390a280f35b6020606492519162461bcd60e51b8352820152600e60248201526d139bdd08185d5d1a1bdc9a5e995960921b6044820152fd5b507fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c2177585528460205281852033865260205260ff8286205416610513565b8480fd5b8280fd5b5091346105db5760203660031901126105db57816106109360ff92358152600c602052205416905191829182611e4f565b0390f35b50903461064b578060031936011261064b57602090610642610634611d84565b61063c611d9f565b906124c4565b90519015158152f35b5080fd5b50346104cb57816003193601126104cb57610668611d84565b916020826044601c610678611d9f565b6001600160a01b0361068861205e565b918188519a63e985e9c588521687521686525afa601f3d1116156106b3578290525115158152602090f35b503d90823e3d90fd5b509190346105db57826003193601126105db576106d7612105565b8280808047335af16106e76120a9565b50156106f1578280f35b906020606492519162461bcd60e51b83528201526015602482015274115512081dda5d1a191c985dd85b0819985a5b1959605a1b6044820152fd5b5091346105db5760203660031901126105db57610747612105565b358252600a6020528120805460ff1916905580f35b509190346105db57806003193601126105db5761079791356107926001610781611d9f565b93838752866020528620015461231c565b612757565b80f35b50903461064b578160031936011261064b57602090517f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a68152f35b50903461064b57602036600319011261064b576107f0611d84565b6107f8612105565b6001600160a01b03168252600b6020528120805460ff1916600117905580f35b509190346105db5760203660031901126105db57813591600383101561090757610840612105565b600283148481156108fd575b81156108da575b501561089f57507f59b018d05cdb2dcaea67d62d5a2c647dab51d8d9e2b8b8126f626699e30a38c5916108999160ff196007541660ff8316176007555191829182611e4f565b0390a180f35b6020606492519162461bcd60e51b83528201526016602482015275125b9d985b1a59081cd958dd5c9a5d1e481b195d995b60521b6044820152fd5b90506108ea576001831438610853565b634e487b7160e01b845260219052602483fd5b505082158461084c565b8380fd5b508290346104cb57602090816003193601126104cb5780806024601c61092f61205e565b88519763c87b56dd85523587525afa15610976578181803e818151843e8251828251018385013e8251830191820152828101809352610971603f199284611dd8565b030190f35b3d9150823e3d90fd5b50919060803660031901126105db57610996611d84565b61099e611d9f565b6044359160643567ffffffffffffffff95868211610adc5736602383011215610adc57810135958611610ad8573660248783010111610ad8576109df6125c0565b34151580610ac7575b6109f06125c0565b610ab6575b6109fd61205e565b60018060a01b036084602082861692871693895192839163e5eb36c883528584840152868c8401528a6060840152336080840152601c83019034905af160018251141615610aae57508892918691600080516020612bcc8339815191528580a46001600355833b610a72575b50600160035580f35b86806024602093610a91610a88610aa29c61208d565b9a519a8b611f9a565b828a52018389013786010152612861565b38808080808581610a69565b3d8a823e3d90fd5b610ac234858585612616565b6109f5565b610ad334868686612616565b6109e8565b8680fd5b8780fd5b5091346105db5760203660031901126105db576020928291358152600d845220549051908152f35b50903461064b578160031936011261064b576106109060ff60075416905191829182611e4f565b5091346105db5760203660031901126105db57610b4a612105565b338352600e602052359082205580f35b509190346105db57806003193601126105db57610b75611d84565b90602435928315158094036105d757610b8e33846124c4565b15610c445750610b9c61205e565b9160018060a01b0316926020856064601c8286519763813500fc8252898652868852336060525af160018651141615610c3b579060609184337f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31602085a38382528583528352600160208401528201528260608201527f4cdaf6538eaf7d8b2bcf9a426c5b82c581dd443c8f400b33b5f9c3797dbe7e2460803392a380f35b823d86823e3d90fd5b6020606492519162461bcd60e51b8352820152601460248201527313dc195c985d1bdc881b9bdd08185b1b1bddd95960621b6044820152fd5b50903461064b578160031936011261064b5751908152602090f35b50903461064b5761061090610cb5610caf36611e39565b90611fbc565b91516001600160a01b03909116815260208101919091529081906040820190565b50903461064b578060031936011261064b5790602091610cf4611d84565b9160ff60095416928315610d2c575b508215610d14575b50519015158152f35b6024358152600a84528190205460ff16915083610d0b565b6001600160a01b03168152600b84528181205460ff16925084610d03565b50903461064b578160031936011261064b57602090610d6761205e565b90516001600160a01b039091168152f35b50346104cb57806003193601126104cb57610d9161205e565b8251916395d89b41815280806024601c6020958387525afa15610976578181803e818151843e8251828251018385013e8251830191820152828101809352610971603f199284611dd8565b5091346105db57816003193601126105db578160209360ff92610dfd611d9f565b903582528186528282206001600160a01b039091168252855220549151911615158152f35b50346104cb5760203660031901126104cb5750602091610e5490356001600160a01b03610e4e82612485565b16612828565b9051908152f35b50346104cb57806003193601126104cb57506001600160601b0360209254169051908152f35b50903461064b57602036600319011261064b5760209160ff9082906001600160a01b03610eac611d84565b168152600b855220541690519015158152f35b50903461064b578160031936011261064b57683602298b8c10b012325490516001600160a01b039091168152602090f35b5091346105db5760203660031901126105db57610f0b612105565b358252600a6020528120805460ff1916600117905580f35b50903461064b578160031936011261064b57602090517ffb8d9d99baef2df7e4bcb7b023fa0da4fc7a62d2d7f0d5b816cbcc1d594273a58152f35b50903461064b577fe2b551c00d162749f98447327d18714eaa6453c11fe903d51d4cc61e2762fb2d610561610f9236611e39565b610f9d949194612105565b610faa6002821115611f10565b848652600d602052808287205515600014610fcc5784905b5191829182611e4f565b600190610fc2565b50903461064b578160031936011261064b57602090517fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c217758152f35b50346104cb57806003193601126104cb57611028612105565b600160ff19600954161760095580f35b50346104cb5760203660031901126104cb57611052611d84565b61105a612105565b6001600160a01b031661106c81612943565b50337f3b01c97343869ca2757fcc37cdb8f71683b0a7aed858e3755f4529a1db8572928380a380f35b50346104cb5760203660031901126104cb576001600160a01b036110b7611d84565b16916020826044601c6110c861205e565b85519763f5b100ea855285528386525afa601f3d1116156106b357829052518152602090f35b5091346105db57826003193601126105db57916020818194601c61111061205e565b638da5cb5b84525afa601f3d1116600c5160601c02683602298b8c10b012329182549060018060a01b03808316931693848403611151575b86865160018152f35b847f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0936001600160601b0360a01b1617905580a33880808080611148565b5091346105db5760203660031901126105db57602092506001600160a01b03906111b99035612485565b169051908152f35b5091346105db5760603660031901126105db578035916111df611d9f565b91604435926001600160601b0384168094036112fc576111fd612105565b6001600160a01b039081169182156112158115611e78565b6112236103e8871115611ec4565b81546001600160601b03191686178255611241612710871115612426565b6112b9575091606093917f349fe6ff324f404bca2151c3543cead52f483617c182089b86bcd1362e9e6ad9959382519061127a82611f4c565b8282526020820190858252868a526002602052848a20925116906001600160601b0360a01b905160a01b1617905581519384526020840152820152a180f35b606490602085519162461bcd60e51b8352820152601b60248201527f455243323938313a20496e76616c696420706172616d657465727300000000006044820152fd5b8580fd5b50903461064b578160031936011261064b576020906008549051908152f35b5091346105db5760203660031901126105db578160209360ff92358152600a855220541690519015158152f35b509061135736611e04565b916113606125c0565b34151580611451575b6113716125c0565b611440575b61137e61205e565b60018060a01b036084602082851692861693885192839163e5eb36c883528584840152868b840152896060840152336080840152601c83019034905af1600182511416156114385750908491600080516020612bcc8339815191528880a46001600355813b6113f1575b84600160035580f35b835193602085019085821067ffffffffffffffff8311176114255761141b96975052858452612861565b80388080806113e8565b634e487b7160e01b875260418852602487fd5b3d88823e3d90fd5b61144c34848484612616565b611376565b61145d34858585612616565b611369565b50903461064b57602036600319011261064b5761147d611d84565b611485612105565b6001600160a01b03168252600b6020528120805460ff1916905580f35b5091346105db57826003193601126105db57602092505460601c9051908152f35b50823461064b578260031936011261064b576114dd611d9f565b90336001600160a01b038316036114f957906107979135612757565b608490602085519162461bcd60e51b8352820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152fd5b50903461064b578160031936011261064b5760209060ff6009541690519015158152f35b5091346105db57816003193601126105db573590611594611d9f565b90828452836020526115ab6001828620015461231c565b82845260208481528185206001600160a01b039093168086529290528084205460ff16156115d7578380f35b828452836020528084208285526020528320600160ff1982541617905533917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d8480a43880808380f35b5091346105db5760203660031901126105db57816020936001923581528085522001549051908152f35b50903461064b57602036600319011261064b576020826044601c61166d61205e565b855197632435987985523585528386525afa601f3d1116156106b357829052516001600160a01b03168152602090f35b5060206084836116ac36611e04565b9490926116b76125c0565b3461172c575b6116c561205e565b9260018060a01b038091169416948593825194859363e5eb36c885528786860152840152876060840152336080840152601c83019034905af1600182511416156117245750600080516020612bcc8339815191528480a4600160035580f35b3d85823e3d90fd5b61173834878686612616565b6116bd565b50903461064b57602036600319011261064b5760209181906001600160a01b03611765611d84565b168152600e845220549051908152f35b50346104cb57806003193601126104cb5761178e612105565b60ff196009541660095580f35b50346104cb57806003193601126104cb576117b461205e565b916020826044601c84519663e2c7928184528385528386525afa601f3d1116156106b357829052518152602090f35b50823461064b57602036600319011261064b57356117ff612105565b61180c6002821115611f10565b60085580f35b5091816003193601126105db57611827611d84565b602435926001600160a01b0391908261183f86612485565b1692858752602094600c865260ff8389205416600381101561198a571561199d57868852600c865260ff83892054165b600381101561198a576001811490811561197f575b5061192e575b5061189361205e565b92169380876064601c85519663d10b6e0c84528985528a87523360605234905af1601f3d11161561192557918682807fee03c3b1892e0d39907da6105800ae6e1b4d70fd3db4b52f81b6beca10b4b3729584606096528386528989600c51881c7f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258780a460018552840152820152a480f35b823d88823e3d90fd5b61193885856124c4565b61188a57825162461bcd60e51b8152908101869052601a60248201527f5370656e646572206e6f7420616c6c6f7765642062792043414c0000000000006044820152606490fd5b600291501438611884565b634e487b7160e01b895260218252602489fd5b60ff6007541661186f565b50903461064b57602036600319011261064b576020826044601c6119ca61205e565b85519763081812fc85523585528386525afa601f3d1116156106b357829052516001600160a01b03168152602090f35b50903461064b578160031936011261064b5760209060ff60075460081c1690519015158152f35b50346104cb57806003193601126104cb57611a3a61205e565b8251916306fdde03815280806024601c6020958387525afa15610976578181803e818151843e8251828251018385013e8251830191820152828101809352610971603f199284611dd8565b50903461064b578060031936011261064b57611a9f611d84565b92602435936001600160601b038516908186036105d757611abe612105565b6001600160a01b0316918215611ad48115611e78565b611ae26103e8841115611ec4565b81546001600160601b03191683178255611b00612710841115612426565b611b5b57507fddba1cc96f152f9f0127a4f966e45605ea6461d1dcb2a88eaffbe783ff66aad393948160208551611b3681611f4c565b858152015260a01b6001600160a01b031916821760015582519182526020820152a180f35b606490602085519162461bcd60e51b8352820152601960248201527f455243323938313a20696e76616c6964207265636569766572000000000000006044820152fd5b50823461064b57602036600319011261064b57611bb9611d84565b611bc1612105565b81546001600160601b031660609190911b6001600160601b03191617905580f35b5091346105db5760203660031901126105db57359063ffffffff60e01b8216918281036109075760209350633f4ce75760e01b8314928315611cba575b8315611ca9575b8315611c85575b8315611c74575b8315611c45575b5050519015158152f35b91925063152a902d60e11b909114908115611c64575b50903880611c3b565b611c6e91506120d9565b38611c5b565b9250611c7f816120d9565b92611c34565b92508060e01c635b5e139f8114906301ffc9a76380ac58cd82149114171792611c2d565b639059e6c360e01b81149350611c26565b63a40eb35960e01b81149350611c1f565b90503461064b578160031936011261064b579190600554908184526020938481018093600584527f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db090845b818110611d705750505081611d2c910382611f9a565b83519485948186019282875251809352850193925b828110611d5057505050500390f35b83516001600160a01b031685528695509381019392810192600101611d41565b825484529288019260019283019201611d16565b600435906001600160a01b0382168203611d9a57565b600080fd5b602435906001600160a01b0382168203611d9a57565b60005b838110611dc85750506000910152565b8181015183820152602001611db8565b60409160208252611df88151809281602086015260208686019101611db5565b601f01601f1916010190565b6060906003190112611d9a576001600160a01b03906004358281168103611d9a57916024359081168103611d9a579060443590565b6040906003190112611d9a576004359060243590565b919060208301926003821015611e625752565b634e487b7160e01b600052602160045260246000fd5b15611e7f57565b60405162461bcd60e51b815260206004820152601860248201527f496e76616c696420726f79616c747920726563656976657200000000000000006044820152606490fd5b15611ecb57565b60405162461bcd60e51b815260206004820152601c60248201527f526f79616c747920726174652065786365656473206d6178696d756d000000006044820152606490fd5b15611f1757565b60405162461bcd60e51b815260206004820152600d60248201526c125b9d985b1a59081b195d995b609a1b6044820152606490fd5b6040810190811067ffffffffffffffff821117611f6857604052565b634e487b7160e01b600052604160045260246000fd5b6080810190811067ffffffffffffffff821117611f6857604052565b90601f8019910116810190811067ffffffffffffffff821117611f6857604052565b9190916000526002602052604060002060405190611fd982611f4c565b546001600160a01b0380821680845260a09290921c6020840152901561203a575b6001600160601b036020830151169384810294818604149015171561202457612710915116920490565b634e487b7160e01b600052601160045260246000fd5b905060405161204881611f4c565b600154828116825260a01c602082015290611ffa565b683602298b8c10b01230546001600160a01b031690811561207b57565b604051632d9523d760e11b8152600490fd5b67ffffffffffffffff8111611f6857601f01601f191660200190565b3d156120d4573d906120ba8261208d565b916120c86040519384611f9a565b82523d6000602084013e565b606090565b63ffffffff60e01b16637965db0b60e01b81149081156120f7575090565b6301ffc9a760e01b14919050565b3360009081527f7d7ffb7a348e1c6a02869081a26547b49160dd3df72d1d75a570eb9b698292ec60209081526040808320549092907fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c217759060ff161561216a5750505050565b61217333612abb565b84519161217f83611f7e565b604283528483019360603686378351156123085760308553835190600191600110156123085790607860218601536041915b81831161229a575050506122585761220693859361223e9361222f6048946122549951988576020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b8b978801528251928391603789019101611db5565b8401917001034b99036b4b9b9b4b733903937b6329607d1b603784015251809386840190611db5565b01036028810185520183611f9a565b5162461bcd60e51b815291829160048301611dd8565b0390fd5b60648486519062461bcd60e51b825280600483015260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152fd5b909192600f811660108110156122f4576f181899199a1a9b1b9c1cb0b131b232b360811b901a6122ca8588612aaa565b5360041c9280156122e0576000190191906121b1565b634e487b7160e01b82526011600452602482fd5b634e487b7160e01b83526032600452602483fd5b634e487b7160e01b81526032600452602490fd5b6000818152602090808252604092838220338352835260ff8483205416156123445750505050565b61234d33612abb565b84519161235983611f7e565b604283528483019360603686378351156123085760308553835190600191600110156123085790607860218601536041915b8183116123e0575050506122585761220693859361223e9361222f6048946122549951988576020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b8b978801528251928391603789019101611db5565b909192600f811660108110156122f4576f181899199a1a9b1b9c1cb0b131b232b360811b901a6124108588612aaa565b5360041c9280156122e05760001901919061238b565b1561242d57565b60405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b6064820152608490fd5b602060006044601c61249561205e565b60405195636352211e85528552836040525afa601f3d1116156124bb5760405260005190565b3d6000823e3d90fd5b9060ff60075460081c16156125b9576001600160a01b038281169190811682146125b1576124f1906127cb565b6000918252600660205260408220541592831593612510575b50505090565b60048054604051630f8350ed60e41b81526001600160a01b039390931691830191909152602482019290925292506020908390604490829060601c5afa9182156125a4578192612565575b505038808061250a565b9091506020813d60201161259c575b8161258160209383611f9a565b8101031261064b57519081151582036104cb5750388061255b565b3d9150612574565b50604051903d90823e3d90fd5b505050600190565b5050600190565b6002600354146125d1576002600355565b60405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606490fd5b926126218184611fbc565b909181612631575b505050505050565b6000908180808086885af16126446120a9565b501561271257828103908082116126fe5783036126ad575b505060018060a01b0380938160405197168752166020860152604085015216917f2e3eed7c018e465c6beedb3fe36f1d691e3cbd010433b2dff7e3a3a11e5ee86660603092a4388080808080612629565b81808092335af16126bc6120a9565b50156126c957388061265c565b60405162461bcd60e51b815260206004820152600d60248201526c1499599d5b990819985a5b1959609a1b6044820152606490fd5b634e487b7160e01b83526011600452602483fd5b60405162461bcd60e51b815260206004820152601760248201527f526f79616c7479207472616e73666572206661696c65640000000000000000006044820152606490fd5b9060009180835282602052604083209160018060a01b03169182845260205260ff60408420541661278757505050565b80835282602052604083208284526020526040832060ff1981541690557ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b339380a4565b60008052600d6020527f81955a0a11e65eac625c29e8882660bae4e165a75d72780094acae8ece9a29ee548061282357506001600160a01b03166000908152600e602052604090205480612820575060085490565b90565b905090565b90600052600d6020526040600020548061282357506001600160a01b03166000908152600e602052604090205480612820575060085490565b9060a46020939460405195869463150b7a028652338787015260018060a01b03166040860152606085015260808085015280518091818060a08801526128e2575b505001906000601c8401915af1156128d3575b5163757a42ff60e11b016128c557565b63d1a57ed66000526004601cfd5b3d156128b5573d6000823e3d90fd5b818760c08801920160045afa5080386128a2565b60055481101561292d5760056000527f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db00190600090565b634e487b7160e01b600052603260045260246000fd5b6000818152600660205260408120549091908015612a3f5760001990808201818111612a2b5760055490838201918211612a17578082036129cc575b50505060055480156129b857810190612997826128f6565b909182549160031b1b19169055600555815260066020526040812055600190565b634e487b7160e01b84526031600452602484fd5b612a016129db6129ea936128f6565b90549060031b1c9283926128f6565b819391549060031b91821b91600019901b19161790565b905584526006602052604084205538808061297f565b634e487b7160e01b86526011600452602486fd5b634e487b7160e01b85526011600452602485fd5b505090565b6000818152600660205260408120546128235760055468010000000000000000811015612a96579082612a826129ea846001604096016005556128f6565b905560055492815260066020522055600190565b634e487b7160e01b82526041600452602482fd5b90815181101561292d570160200190565b604051906060820182811067ffffffffffffffff821117611f6857604052602a825260208201604036823782511561292d576030905381516001906001101561292d57607860218401536029905b808211612b5d575050612b195790565b606460405162461bcd60e51b815260206004820152602060248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152fd5b9091600f81166010811015612bb6576f181899199a1a9b1b9c1cb0b131b232b360811b901a612b8c8486612aaa565b5360041c918015612ba1576000190190612b09565b60246000634e487b7160e01b81526011600452fd5b60246000634e487b7160e01b81526032600452fdfeddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa264697066735822122041a94aa685b9570d205ff09bd19a5059415b6134b8d70ba26a3cec2a4621e17164736f6c634300081800332f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d0000000000000000000000001ef7c1596d893eb46826557841c5c7579efe0fbb000000000000000000000000dbaa28cbe70af04ebfb166b1a3e8f8034e5b9fc70000000000000000000000005836f538374aee94e15c3a849a50d263a5d859d10000000000000000000000001234567890abcdef1234567890abcdef12345678
Deployed Bytecode
0x6080604081815260049182361015610839575b50361561082d5768a20d6e21d0e5255309546001600160a01b039081169190600090813560e01c9063e5eb36c8821461045b5763813500fc82146104125763e985e9c582146103d157636352211e821461032257632435987982146102d15763d10b6e0c82146101df5763081812fc82146101475763f5b100ea82146100f5575063e2c7928181146100c35763b7a94eb891929350146100ba575051631e085ca760e11b8152fd5b80600160209252f35b509133036100e65760208263ffffffff68a20d6e21d0e52553085460801c168152f35b5163ce5a776b60e01b81529050fd5b92919390503303610138575061012f63ffffffff91602094351660018060a01b031660005268a20d6e21d0e5255313602052604060002090565b5460801c168152f35b5163ce5a776b60e01b81528390fd5b92919390503303610138578335826101ae610190600019640100000000851085020160011b60e08160031c685106b710e87292a98960611b01549160051b161c63ffffffff1690565b63ffffffff1660005268a20d6e21d0e525530a602052604060002090565b5416156101cf5760209450835268a20d6e21d0e525530c8452822054168152f35b815163677510db60e11b81528590fd5b92919390503303610138578184351660243591836044351693610233610190600019640100000000871087020160011b60e08160031c685106b710e87292a98960611b01549160051b161c63ffffffff1690565b541693848103610290575b506020955082855268a20d6e21d0e525530c86528420816001600160601b0360a01b82541617905560018260081c68a20d6e21d0e525530d60601b019260ff16911515821b911b198254161790558152f35b6102b690859060285260145268a20d6e21d0e525530b6000526048600020906000602852565b54156102c2578561023e565b516367d9dca160e11b81528590fd5b92919390503303610138575061031c61019060209435600019906401000000008110020160011b60e08160031c685106b710e87292a98960611b01549160051b161c63ffffffff1690565b54168152f35b9050848433036103c3578035600019906401000000008110020160e060018060fd1b038260021c16685106b710e87292a98960611b01549160061b161c63ffffffff1693826103898663ffffffff1660005268a20d6e21d0e525530a602052604060002090565b5416156103b657505061031c60209363ffffffff1660005268a20d6e21d0e525530a602052604060002090565b5163677510db60e11b8152fd5b835163ce5a776b60e01b8152fd5b9291939050330361013857506020928161040d92602435169135169060285260145268a20d6e21d0e525530b6000526048600020906000602852565b548152f35b9291939050330361013857509161045483602094602435151593351690604435169060285260145268a20d6e21d0e525530b6000526048600020906000602852565b5560018152f35b9192859150843303610820578282351690836024351692604435968560643516908515610810571561080c5760001990600196806104c7610190858d640100000000811002018b1b60e08160031c685106b710e87292a98960611b01549160051b161c63ffffffff1690565b541686036107fd578582036107a2575b50506104e284614fc2565b916104ec86614fc2565b91600d5494670de0b6b3a76400009586810296818804149015171561078f576001600160a01b038716600090815268a20d6e21d0e52553106020526040902092855460a01c90818811610781575085546001600160a01b03199188900360a090811b83166001600160a01b0392831617885586546001600160601b038a1681831c0190911b909216911617845560209a6107119594909361070b938a938c91908e68a20d6e21d0e525530d60601b60088a901c015460ff8a161c841661073b575b5050875463ffffffff60801b198116608091821c63ffffffff90811684019283901b63ffffffff60801b169190911790995560e0631fffffff8260031c168560601b01549160051b161c88166106588161062b85858c01811b0160e08160031c685106b710e87292a98960611b01549160051b161c63ffffffff1690565b958b87169060e0909291928360031c9060601b019260051b1682549182821c1863ffffffff16901b189055565b01811b019060e08260031c685106b710e87292a98960611b019260051b1682549182821c188816901b18905561070685825460801c16956106b9818d890116849081549063ffffffff60801b9060801b169063ffffffff60801b1916179055565b6001600160a01b038416600090815268a20d6e21d0e52553106020526040902060601b600388901c01805463ffffffff60058a901b60e01682811c948a16949094181690921b9091189055565b615017565b906150bb565b84527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8585a38152f35b68a20d6e21d0e525530d60601b60088a901c018054600160ff8c161b1916905588815268a20d6e21d0e525530c6020522080546001600160a01b03191690558f8e6105ad565b8251631e9acf1760e31b8152fd5b634e487b7160e01b8a526011835260248afd5b6107c882879060285260145268a20d6e21d0e525530b6000526048600020906000602852565b546104d75789895268a20d6e21d0e525530c6020528489205416036107ee5788806104d7565b509051632ce44b5f60e11b8152fd5b845162a1148160e81b81528490fd5b8680fd5b8351633a954ecd60e21b81528390fd5b5163ce5a776b60e01b8152fd5b3461083457005b600080fd5b600090813560e01c90816301ffc9a7146134d157508063055ad42e146134b25780630562b9f71461339457806306fdde031461332c5780630700efce146132cf578063095ea7b31461324d5780630aab8ba5146131f15780631581b60014610e6f57806318160ddd146131c757806318712c21146130a55780631e0fbfa21461306a5780631ec145dd14613042578063238fb4ef14612fb557806323b872dd14612f3a578063248a9ca314612f105780632569296214612ec5578063272f5be814612e7d578063274e430b14612e4e5780632a6a935d14612db85780632cc8265514612d3e5780632f2ff15d14612c955780633006b54314612bfd578063313ce56714612be157806336568abe14612b50578063396e8f5314612b0c5780633ab1a49414612a8c5780633ccfd60b146129d8578063444d917214612994578063453c23101461296e5780634b980d671461294f5780634ef41efc1461291e57806351858e27146128a157806354c3a192146127be57806354d1f13d1461277857806355f804b3146125da57806356a3d732146124f95780635a6e7d411461243a5780636296d2b4146122d9578063639984c514611fbb5780636609b18e14611c9e5780636ddcb44214611b8857806370a0823114611b3a578063715018a614611af4578063758cbc3a14611aaf57806375b238fc14611a745780638da5cb5b14611a4757806391d1485414611a01578063957aa58c146119dd57806395d89b411461194d5780639a7620a814611819578063a217fddf146117fe578063a2309ff8146117d9578063a9059cbb146117a8578063bd93641b14611593578063c418f8bb1461149d578063c87b56dd1461137a578063caa0f92a1461134c578063ccfdd2f8146112d6578063d3668ebe14611242578063d539139314611207578063d547741f146111c9578063d5abeb01146111a3578063dd62ed3e14611153578063de2ad38a14610e98578063e8e7f80014610e6f578063ec0d755714610e3d578063f04e283e14610dbd578063f2fde38b14610d50578063f645d4f914610d27578063f9da322414610c36578063fe1e302314610b915763fee81cf403610012579034610b8d576020366003190112610b8d57602091610b77613559565b9063389a75e1600c525281600c20549051908152f35b5080fd5b509134610c32576020366003190112610c3257803591610baf613a19565b82845260096020528084209182549060ff8260a01c1615610c1b57509160ff6020927fcaa587774a739716975845b28aca3a12b09f0b2fd6c92d932399daa4ad6f0b5f948260a81b838260a81c161560a81b16908360a81b191617809355519160a81c1615158152a280f35b8251630641efb760e51b8152908101859052602490fd5b8280fd5b50919034610c32576020366003190112610c3257610c526135c9565b610c5a613a19565b600c549063ffffffff938482169483168510610cd95750928260209263ffffffff60401b7fef996b8a1b7c31d0243ffa1e0e12f6fcb5a5208385d9d8e87ee0534b6e69a25596600080516020615528833981519152961b169063ffffffff60401b191617600c55686d6178537570706c7960b81b81515251908152a280f35b608490602085519163e066a8d760e01b8352820152602160248201527f4e6577206d617820737570706c792062656c6f7720746f74616c206d696e74656044820152601960fa1b6064820152fd5b509034610b8d5781600319360112610b8d5760075490516001600160a01b039091168152602090f35b50826020366003190112610b8d57610d66613559565b90610d6f6139fc565b8160601b15610db2575060018060a01b0316638b78c6d8198181547f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08580a35580f35b637448fbae8352601cfd5b50826020366003190112610b8d57610dd3613559565b90610ddc6139fc565b63389a75e1600c528183526020600c209081544211610e32575082905560018060a01b0316638b78c6d8198181547f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08580a35580f35b636f5e88188452601cfd5b5034610e6c5780600319360112610e6c57610e56613a19565b600e5460ff80821615169060ff191617600e5580f35b80fd5b509034610b8d5781600319360112610b8d5760035490516001600160a01b039091168152602090f35b50906080366003190112610b8d5782359060243580151580910361114f576064356001600160401b03811161114b57610ed49036908701613638565b909160ff600e54161561113b5760085491828752602093600985528588205460ff8160a01c16156111245760a81c60ff1661110d5783885260098552610f26876001600160601b03888b205416613871565b34036110fe57600c549163ffffffff938484169a858a8d01958a1c169b8c86116110c05750908a959493929187875260098952858a88205460801c1680611089575b508787526009895285808b808a2099600a8d528181203382528d52205416975460601c1680610f978d8a6138bd565b11611063575050968a611009829897969594611018948d600b9c8e610fba6139a6565b604435928b82600854998a815260098c52205460ff8160b01c16600014611058575050610fe88515156138ca565b815198610ff48a613706565b338a5289015287015260608601523691613916565b608083015260a0820152614ddb565b60018055838952600a8552868920338a528552868920828963ffffffff19950116848254161790551690600c541617600c55855252822090815401905580f35b60601c169350610fe8565b908a8c6110728a6044956138b0565b915163219dd1b760e01b8152928301526024820152fd5b9091929394959650600b8952898c205490808c8301116110b1578c9796959493929150610f68565b8b611072604494938d936138b0565b8a9250896110d16110fa928f61389a565b9051637502c12360e11b815292830193845263ffffffff16602084015290918291604090910190565b0390fd5b855162bfc92160e01b81528990fd5b8551632fe3470360e11b8152808a01859052602490fd5b8651630641efb760e51b8152808b01869052602490fd5b835163baf13b3f60e01b81528790fd5b8480fd5b8380fd5b509034610b8d5780600319360112610b8d5760209061119b611173613559565b61117b61356f565b60285260145268a20d6e21d0e525530f6000526048600020906000602852565b549051908152f35b509034610b8d5781600319360112610b8d57600c548151911c63ffffffff168152602090f35b50919034610c325780600319360112610c325761120491356111ff60016111ee61356f565b938387528660205286200154613d4a565b6148ff565b80f35b509034610b8d5781600319360112610b8d57602090517f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a68152f35b50919034610c32576020366003190112610c3257813591611261613a19565b82156112b85750602082600080516020615528833981519152927f341240f02d2fb9af45ea944a93599eb4428bb2c222a699f51dfc890760f1394594600d55686d696e74526174696f60b81b81515251908152a280f35b82604492600d5490519263350c7cdb60e01b84528301526024820152fd5b50919034610c32576020366003190112610c32576020600080516020615528833981519152917f3f84be5711ce273bd979b147a668e592577d8822754db7e25bf3a27a1c017579933590611328613a19565b816002557036b0bc2832b92a3930b739b0b1ba34b7b760791b81515251908152a280f35b509034610b8d5781600319360112610b8d5768a20d6e21d0e5255308549051602091821c63ffffffff168152f35b509034610b8d5760209283600319360112610c32576060926006549161139f83613837565b6113b5575b8351806113b1878261352d565b0390f35b6113c3919293945035613e54565b835192826113d082613837565b9160019081811690811561147f5750600114611429575b505050826113b195836114058461142096600596519485920161350a565b0164173539b7b760d91b815203601a19810184520182613789565b903880806113a4565b9091929350600682527ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f5b83831061146c575050508201840190828560056113e7565b8054868401890152918701918101611454565b60ff1916878a015250505080151502830185019150828560056113e7565b509134610c325781600319360112610c325780356114b96135dc565b916114c2613a19565b818552600960205260ff8486205460a01c161561157e575080845260096020908152838520805463ffffffff60601b1916606085901b63ffffffff60601b1617905560008051602061552883398151915292909163ffffffff906115749061152990613e54565b61156f603388518093726d617850657257616c6c65745f70686173655f60681b8983015261155f815180928b868601910161350a565b8101036013810184520182613789565b6137db565b945191168152a280f35b602491845191630641efb760e51b8352820152fd5b509134610c32576060366003190112610c32576001600160401b0390803582811161114b576115c59036908301613638565b9260249060243590811161080c576115e09036908501613638565b9290916115eb6135ba565b946115f4613c03565b8487148015906117a0575b61179257885b8781106116b35750505085519480606087016060885252608086019190885b8181106116855750505084810360208601528281526001600160fb1b03831161080c577f27a890c7250443bf27fd15f7a3efe30003fd0bc2da75d7ebb8d795fc83fd618895602094869460051b80948785013715159084015201030190a180f35b90919283359060018060a01b0382168092036116af57908152602090810193019190600101611624565b8a80fd5b6001600160a01b036116ce6116c9838b8861396c565b613992565b161561178357861561173f576116e581878761396c565b35600d5490670de0b6b3a76400009182810292818404149015171561172d576117146001939261172792613871565b6117226116c9848d8a61396c565b614973565b01611605565b634e487b7160e01b8c5260118452848cfd5b61174a81878761396c565b35670de0b6b3a7640000908181029181830414901517156117715790611727600192611714565b634e487b7160e01b8b5260118352838bfd5b5087516376f54d1560e01b8152fd5b87516376f54d1560e01b8152fd5b5086156115ff565b509034610b8d5780600319360112610b8d576020906117d26117c8613559565b6024359033613eb3565b5160018152f35b509034610b8d5781600319360112610b8d5760209063ffffffff600c54169051908152f35b509034610b8d5781600319360112610b8d5751908152602090f35b509134610c325760c0366003190112610c3257803591611837613622565b906044359163ffffffff918284168085036119495760643593841692838503611945576084359460a435968715158098036116af57611874613a19565b898b526009602052848b209283549960ff8b60a01c1661192e575060028401889055608092831b63ffffffff60801b16606092831b63ffffffff60601b166001600160601b0392909216600161ff0160a81b03199b909b168b17919091171760b089901b60ff60b01b1617600160a01b1790925583519788526020880192909252918601929092528401919091528201527fefc86cdb7fbdb2c9eb4f56ac330863ccbaa9a16a700b884f9375e4b82e4363299060a090a280f35b8651630964557760e41b81529081018c9052602490fd5b8880fd5b8780fd5b509134610c325782600319360112610c32576113b19250337f000000000000000000000000b62e49ad5ed5317be30568bff343dd5dd1bfc3796001600160a01b0316036119bc575080516119a08161376e565b600381526226a0ab60e91b6020820152905b519182918261352d565b8151906119c88261376e565b815263122b262760e11b6020820152906119b2565b509034610b8d5781600319360112610b8d5760209060ff600e541690519015158152f35b509134610c325781600319360112610c32578160209360ff92611a2261356f565b903582528186528282206001600160a01b039091168252855220549151911615158152f35b509034610b8d5781600319360112610b8d57638b78c6d8195490516001600160a01b039091168152602090f35b509034610b8d5781600319360112610b8d57602090517fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c217758152f35b509134610c325781600319360112610c32576020928291611ace61356f565b90358252600985528282206001600160a01b039091168252600301845220549051908152f35b5080600319360112610e6c57611b086139fc565b80638b78c6d8198181547f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a35580f35b509034610b8d576020366003190112610b8d57602090611b7d611b5b613559565b6001600160a01b0316600090815268a20d6e21d0e52553136020526040902090565b5460a01c9051908152f35b509134610c32576020366003190112610c32578282916101009460e08451611baf81613737565b82815282602082015282868201528260608201528260808201528260a08201528260c0820152015235815260096020522090815460026001840154936001600160601b039063ffffffff928391015494805192611c0b84613737565b60ff8660a01c16151597888552602085019260ff8860a81c1615158452808601918252606086019183891683526080870194868a60601c16865260e060a0890198888c60801c168a5260ff60c082019c60b01c1615158c52019a8b5282519b8c5251151560208c015251908a01525116606088015251166080860152511660a084015251151560c08301525160e0820152f35b509034610b8d57611cae366135ef565b91927f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a6808652602090868252828720338852825260ff838820541615611dfc5750506001600160a01b0384169384158015611df4575b611de4578315611d9757600d54670de0b6b3a764000090818102918183041490151715611d84577f0610a4434b6dd70cb607c534c0839e0d53c57bea1e48a8a945e348a0a3f1f44d95969750611d7e9291611d62611d689286613871565b90614973565b5191825291151560208201529081906040820190565b0390a280f35b634e487b7160e01b875260118852602487fd5b670de0b6b3a7640000808402908482041484151715611d84577f0610a4434b6dd70cb607c534c0839e0d53c57bea1e48a8a945e348a0a3f1f44d95969750611d7e9291611d689190614973565b81516376f54d1560e01b81528790fd5b508215611d04565b90868892611e0933615418565b855191611e1583613753565b60428352848301936060368637835115611fa8576030855383519060019160011015611f955790607860218601536041915b818311611f2a57505050611ee8576110fa938693611ed493611ec5604894611e9c9a519a8576020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b8d97880152825192839160378901910161350a565b8401917001034b99036b4b9b9b4b733903937b6329607d1b60378401525180938684019061350a565b01036028810187520185613789565b5162461bcd60e51b8152928392830161352d565b50505080606493519262461bcd60e51b845283015260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152fd5b909192600f81166010811015611f82576f181899199a1a9b1b9c1cb0b131b232b360811b901a611f5a8588615407565b53881c928015611f6f57600019019190611e47565b634e487b7160e01b825260118952602482fd5b634e487b7160e01b835260328a52602483fd5b634e487b7160e01b815260328852602490fd5b634e487b7160e01b815260328752602490fd5b509060a0366003190112610b8d57611fd1613559565b90602491823592611fe06135ba565b916084356001600160401b03811161080c57611fff9036908901613638565b92909733321480156122c5575b1561225e5760ff600e541615612250576008549384895260209560098752878a205460ff8160a01c16156122395760a81c60ff1661222357858a5260098752612061896001600160601b038a8d205416613871565b340361221457600c549263ffffffff94858516868c8201968c1c1680871161220457505090889392918b878c8f8c8152600989528c838383205460801c16806121c6575b50815260098952818120600a8a528282206001600160a01b03909d168083529c90995220549654968116999660601c169081906120e2908b6138bd565b116121a1575050508a6110098b9c9d612156948c9d600b9d8d966121046139a6565b606435928c83600854998a815260098c52205460ff8160b01c166000146121965750506121328515156138ca565b82519861213e8a613706565b8b8a5289015215159087015260608601523691613916565b60018055848a52600a8652878a20908a528552868920828963ffffffff19950116848254161790551690600c541617600c55855252822090815401905580f35b60601c169350612132565b604492918d6121b18b8f946138b0565b925163219dd1b760e01b815293840152820152fd5b95969798999350505050600b9150528a8d205490808d8301116121f45750908b878c8f8c8e999897966120a5565b918c6121b18d93604496956138b0565b6110fa8c6110d18f94879461389a565b875162bfc92160e01b81528390fd5b50508551632fe3470360e11b8152908101849052fd5b50508651630641efb760e51b815291820185905250fd5b855163baf13b3f60e01b8152fd5b603f608492602088519362461bcd60e51b85528401528201527f5468652063616c6c657220697320616e6f7468657220636f6e7472616374206160448201527f6e64206e6f7420616e20617574686f72697a656420666f727761726465722e006064820152fd5b506007546001600160a01b0316331461200c565b509134610c325781600319360112610c32578035906122f66135dc565b916122ff613a19565b8085526020926009845260ff8587205460a01c161561242357818652600b8452848620549263ffffffff82169384106123c9575081865260098452848620805463ffffffff60801b191660809290921b63ffffffff60801b169190911790556000805160206155288339815191529291906123c09061237d90613e54565b61156f6030875180936f6d6178537570706c795f70686173655f60801b888301526123b0815180928a868601910161350a565b8101036010810184520182613789565b9351908152a280f35b855163e066a8d760e01b8152908101859052602d60248201527f4e6577207068617365206d617820737570706c792062656c6f7720706861736560448201526c081d1bdd185b081b5a5b9d1959609a1b6064820152608490fd5b8451630641efb760e51b8152808401839052602490fd5b509134610c325781600319360112610c32578035612456613622565b9161245f613a19565b818552600960205260ff8486205460a01c161561157e5750600080516020615528833981519152916123c06124ba836020948852600985526001600160601b03878920941693846001600160601b0319825416179055613e54565b61156f602c875180936b70726963655f70686173655f60a01b888301526124e9815180928a868601910161350a565b810103600c810184520182613789565b509034610b8d57612509366135ef565b9192612513613c03565b6001600160a01b03841693841580156125d2575b611de457831561258557600d54670de0b6b3a764000090818102918183041490151715611d84577f7d6c77b6b3211c768de8bb693397ebb3ecdc9bf2cf62817255c91a403d56808d95969750611d7e9291611d62611d689286613871565b670de0b6b3a7640000808402908482041484151715611d84577f7d6c77b6b3211c768de8bb693397ebb3ecdc9bf2cf62817255c91a403d56808d95969750611d7e9291611d689190614973565b508215612527565b838234610e6c576020916020600319360112610b8d5780356001600160401b039182821161114f573660238301121561114f57810135918211610c3257602490366024848301011161114f5761262e613a19565b6126366139a6565b612641600654613837565b601f8111612719575b508391601f841160011461268f5750838394955092612681575b50508160011b916000199060031b1c1916176006555b6001805580f35b602492500101358380612664565b91947ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f92601f1985169186915b8383106126fd57505050948360019596106126e0575b505050811b0160065561267a565b0160240135600019600384901b60f8161c191690558380806126d2565b908060018a978483969c890101358155019601980191906126bc565b7ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f601f850160051c8101916020861061276e575b601f0160051c01905b818110612763575061264a565b858155600101612756565b909150819061274d565b5080600319360112610e6c5763389a75e1600c52338152806020600c2055337ffa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c928280a280f35b50919034610c32576127cf36613585565b9391926127da6139fc565b6127e26139a6565b6001600160a01b038481169490939030861461286757876044601082602094886014528b60345263a9059cbb60601b82525af13d15600189511417161561285c5750916020917f1ac506e936e7f02f4036dbe44708f5e8d72af9ace8745a29fd391481a8fbcb879387603452519586521693a36001805580f35b6390b8ec188752601cfd5b506020606492519163e066a8d760e01b8352820152601360248201527221b0b73737ba103932b1b7bb32b91039b2b63360691b6044820152fd5b509034610b8d5781600319360112610b8d577f88313a379cb5333a1379fba0719d9d3a734fe6625681e0651edf4c8c105b517860207faff618718f1cde37d9c527a9237b04e6ac0489a8647d0517bb15827758ece72092612900613a19565b60ff19600e5416600e5564706175736560d81b81515251428152a280f35b509034610b8d5781600319360112610b8d5768a20d6e21d0e52553095490516001600160a01b039091168152602090f35b509034610b8d5781600319360112610b8d576020906002549051908152f35b509034610b8d5781600319360112610b8d57600c549051602091821c63ffffffff168152f35b509034610b8d5781600319360112610b8d57517f000000000000000000000000b62e49ad5ed5317be30568bff343dd5dd1bfc3796001600160a01b03168152602090f35b509134610c325782600319360112610c32576129f26139a6565b6129fa6139fc565b60035483906001600160a01b0316612a138115156136ba565b8180389247905af115612a8157507f88313a379cb5333a1379fba0719d9d3a734fe6625681e0651edf4c8c105b517860208267776974686472617760c01b7f855511cc3694f64379908437d6d64458dc76d02482052bfb8a5b33a72c054c7794515251428152a26001805580f35b63b12d13eb8352601cfd5b509134610c32576020366003190112610c3257612aa7613559565b612aaf6139fc565b6001600160a01b0316918215612ad75750506001600160601b0360a01b600354161760035580f35b906020606492519162461bcd60e51b8352820152600f60248201526e496e76616c6964206164647265737360881b6044820152fd5b509034610b8d5781600319360112610b8d57517f000000000000000000000000dbaa28cbe70af04ebfb166b1a3e8f8034e5b9fc76001600160a01b03168152602090f35b508234610b8d5782600319360112610b8d57612b6a61356f565b90336001600160a01b03831603612b86579061120491356148ff565b608490602085519162461bcd60e51b8352820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152fd5b509034610b8d5781600319360112610b8d576020905160128152f35b509034610b8d576020366003190112610b8d5760008051602061552883398151915260207fc6754f10631b5a99eaa243abe7df60798bee230d34474d8d8e161c7fa79edc629263ffffffff612c506135c9565b91612c59613a19565b600c5467ffffffff0000000084861b169067ffffffff00000000191617600c556b1b585e14195c95d85b1b195d60a21b8151525191168152a280f35b509134610c325781600319360112610c32573590612cb161356f565b9082845283602052612cc860018286200154613d4a565b82845260208481528185206001600160a01b039093168086529290528084205460ff1615612cf4578380f35b828452836020528084208285526020528320600160ff1982541617905533917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d8480a43880808380f35b509134610c32576020366003190112610c3257803591612d5c613a19565b828452600960205260ff8185205460a01c1615612da3575050600854816008557fa89951a03e2758c1bc16583a91fbb676c836dcda755bf7d40c05625b2bfdccec8380a380f35b916024925191630641efb760e51b8352820152fd5b509134610c32576020366003190112610c325735801515809103610c325791602092612de333614fc2565b805460581c908260028316151503612e26575b505081527fb5a1de456fff688115a4f75380060c23c8532d14ff85f687cc871456d6420393833392a25160018152f35b805460ff60581b191660ff9290921660021860581b60ff60581b169190911790553880612df6565b509034610b8d576020366003190112610b8d57602090612e74612e6f613559565b6137fb565b90519015158152f35b509134610c325781600319360112610c32578160209363ffffffff92612ea161356f565b90358252600a86528282206001600160a01b03909116825285522054915191168152f35b5080600319360112610e6c5763389a75e1600c523381526202a30042016020600c2055337fdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d8280a280f35b509134610c32576020366003190112610c3257816020936001923581528085522001549051908152f35b5034610e6c5750612f4a36613585565b93612f7492919233839060285260145268a20d6e21d0e525530f6000526048600020906000602852565b8054909160018201612f8f575b6020866117d2898888613eb3565b818711612fa7575085900390558160206117d2612f81565b85516313be252b60e01b8152fd5b509134610c32576020366003190112610c32576101009282913581526009602052209081549160ff63ffffffff9360026001840154930154938051956001600160601b0383168752808360601c1660208801528260801c1690860152818160a01c1615156060860152818160a81c161515608086015260b01c16151560a084015260c083015260e0820152f35b509134610c32576020366003190112610c32576020928291358152600b845220549051908152f35b509034610b8d5781600319360112610b8d57602090517f3a2f235c9daaf33349d300aadff2f15078a89df81bcfdd45ba11c8f816bddc6f8152f35b509034610b8d5780600319360112610b8d578235926024356130c5613a19565b8484526020916009835260ff8486205460a01c16156131b0578585526009835260ff8486205460b01c161561316557506123c061312186869760008051602061552883398151915296975260098552836002888a200155613e54565b61156f603187518093706d65726b6c65526f6f745f70686173655f60781b88830152613155815180928a868601910161350a565b8101036011810184520182613789565b835163e066a8d760e01b81526020918101828152828101929092527f506861736520646f6573206e6f74207265717569726520616c6c6f776c69737460408301529081906060010390fd5b8351630641efb760e51b8152908101869052602490fd5b509034610b8d5781600319360112610b8d5760209068a20d6e21d0e52553085460a01c9051908152f35b508234610b8d576020366003190112610b8d57803590818352600960205260ff8484205460a01c161561157e57818352600960205260ff8484205460b01c16156131655760208460028186868152600985522001549051908152f35b509034610b8d5780600319360112610b8d5760209161326a613559565b6024358061329483339060285260145268a20d6e21d0e525530f6000526048600020906000602852565b5582526001600160a01b03169033907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925908590a35160018152f35b50809234610b8d576020366003190112610b8d5760029035926132f0613a19565b8383526009602052822082815582600182015501557f3ae6bd42f8622e3894ef16a2193a204de29ee6392703e402f31749d92b1735e88280a280f35b509034610b8d5781600319360112610b8d576113b19150337f000000000000000000000000b62e49ad5ed5317be30568bff343dd5dd1bfc3796001600160a01b0316036133865761337b6137aa565b90519182918261352d565b61338e6137aa565b906119b2565b509034610b8d576020366003190112610b8d578235906133b26139a6565b6133ba6139fc565b6003546001600160a01b039081166133d38115156136ba565b831561346f5783471061343557849081808638935af11561342957907f5e737119861ebb8ae4f22253f041cd898cf3e5d13c721dfa00bec4b7b43fc8979160035416928151908152426020820152a26001805580f35b8463b12d13eb8552601cfd5b825162461bcd60e51b81526020818801526014602482015273496e73756666696369656e742062616c616e636560601b6044820152606490fd5b825162461bcd60e51b8152602081880152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e20300000006044820152606490fd5b509034610b8d5781600319360112610b8d576020906008549051908152f35b90508334610c32576020366003190112610c325735916001600160e01b031983168303610e6c5750613504602092613668565b15158152f35b60005b83811061351d5750506000910152565b818101518382015260200161350d565b6040916020825261354d815180928160208601526020868601910161350a565b601f01601f1916010190565b600435906001600160a01b038216820361083457565b602435906001600160a01b038216820361083457565b6060906003190112610834576001600160a01b0390600435828116810361083457916024359081168103610834579060443590565b60443590811515820361083457565b6004359063ffffffff8216820361083457565b6024359063ffffffff8216820361083457565b6060906003190112610834576004356001600160a01b038116810361083457906024359060443580151581036108345790565b602435906001600160601b038216820361083457565b9181601f84011215610834578235916001600160401b038311610834576020808501948460051b01011161083457565b6001600160e01b0319166336372b0760e01b81146136b4576301ffc9a760e01b81146136b4576380ac58cd60e01b81146136ae57637965db0b60e01b1480156136ae5790565b50600090565b50600190565b156136c157565b60405162461bcd60e51b815260206004820152601860248201527f57697468647261772061646472657373206e6f742073657400000000000000006044820152606490fd5b60c081019081106001600160401b0382111761372157604052565b634e487b7160e01b600052604160045260246000fd5b61010081019081106001600160401b0382111761372157604052565b608081019081106001600160401b0382111761372157604052565b604081019081106001600160401b0382111761372157604052565b90601f801991011681019081106001600160401b0382111761372157604052565b604051906137b78261376e565b601582527426aaaa20a72a1020a624a2a729902b24a62620a4a760591b6020830152565b6137f39060206040519282848094519384920161350a565b810103902090565b6001600160a01b038116600090815268a20d6e21d0e5255313602052604090205460581c6001811615613832576002915016151590565b503b90565b90600182811c92168015613867575b602083101461385157565b634e487b7160e01b600052602260045260246000fd5b91607f1691613846565b8181029291811591840414171561388457565b634e487b7160e01b600052601160045260246000fd5b63ffffffff918216908216039190821161388457565b9190820391821161388457565b9190820180921161388457565b156138d157565b60405162461bcd60e51b815260206004820152601860248201527f416c6c6f776c6973742070726f6f6620726571756972656400000000000000006044820152606490fd5b9092916001600160401b038411613721578360051b602092602060405161393f82850182613789565b809781520191810192831161083457905b82821061395d5750505050565b81358152908301908301613950565b919081101561397c5760051b0190565b634e487b7160e01b600052603260045260246000fd5b356001600160a01b03811681036108345790565b6002600154146139b7576002600155565b60405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606490fd5b638b78c6d819543303613a0b57565b6382b429006000526004601cfd5b3360009081527f7d7ffb7a348e1c6a02869081a26547b49160dd3df72d1d75a570eb9b698292ec60209081526040808320549092907fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c217759060ff1615613a7e5750505050565b613a8733615418565b845191613a9383613753565b60428352848301936060368637835115613bef576030855383519060019160011015613bef5790607860218601536041915b818311613b8157505050613b3f57611e9c938593613b2993613b1a6048946110fa9951988576020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b8b97880152825192839160378901910161350a565b01036028810185520183613789565b5162461bcd60e51b81529182916004830161352d565b60648486519062461bcd60e51b825280600483015260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152fd5b909192600f81166010811015613bdb576f181899199a1a9b1b9c1cb0b131b232b360811b901a613bb18588615407565b5360041c928015613bc757600019019190613ac5565b634e487b7160e01b82526011600452602482fd5b634e487b7160e01b83526032600452602483fd5b634e487b7160e01b81526032600452602490fd5b3360009081527fc36282328fcdfb3ab7b55ebd970e39b3777a8c58b872e64ea8cf6803645f57b060209081526040808320549092907f3a2f235c9daaf33349d300aadff2f15078a89df81bcfdd45ba11c8f816bddc6f9060ff1615613c685750505050565b613c7133615418565b845191613c7d83613753565b60428352848301936060368637835115613bef576030855383519060019160011015613bef5790607860218601536041915b818311613d0457505050613b3f57611e9c938593613b2993613b1a6048946110fa9951988576020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b8b97880152825192839160378901910161350a565b909192600f81166010811015613bdb576f181899199a1a9b1b9c1cb0b131b232b360811b901a613d348588615407565b5360041c928015613bc757600019019190613caf565b6000818152602090808252604092838220338352835260ff848320541615613d725750505050565b613d7b33615418565b845191613d8783613753565b60428352848301936060368637835115613bef576030855383519060019160011015613bef5790607860218601536041915b818311613e0e57505050613b3f57611e9c938593613b2993613b1a6048946110fa9951988576020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b8b97880152825192839160378901910161350a565b909192600f81166010811015613bdb576f181899199a1a9b1b9c1cb0b131b232b360811b901a613e3e8588615407565b5360041c928015613bc757600019019190613db9565b90604051608081019260a0820160405260008452925b6000190192600a906030828206018553049283613e6a57809350608091030191601f1901918252565b8115613e9d570490565b634e487b7160e01b600052601260045260246000fd5b6001600160a01b038216156148ed57613ecb81614fc2565b613ed483614fc2565b68a20d6e21d0e5255309549095906001600160a01b03161561083457604051926101a084018481106001600160401b0382111761372157604052600084526000602085015260006060850152600060e085015260006101008501526000610120850152600061014085015260006101608501526000610180850152825463ffffffff8160801c16608086015263ffffffff885460801c1660a086015268a20d6e21d0e52553085460a01c60c086015260a01c80604086015286116148db576040840180518790039081905283546001600160a01b031960a083811b82166001600160a01b039384161787558a5480821c8b0160608a0181905290911b90911691161788556080850151600d549182670de0b6b3a7640000810204670de0b6b3a764000014831517156138845761401590670de0b6b3a7640000840290613e93565b8082039111028086526002895460581c1615614885575b50506080840151845160208601518082188282100282188084189084110280841898939192911461487757879003865286900360208601526001600160a01b0382811690821614614860576040519661408488613753565b60008852600060208901526000604089015260608089015260405187815260208860051b82010160405280896060015282896040015283896020015260200188526140e98360018060a01b031660005268a20d6e21d0e5255310602052604060002090565b6001600160a01b038316600090815268a20d6e21d0e5255310602052604090209095909963ffffffff61411c8583615017565b1661014089015260a088015198878c8a8c60015b15614246575b63ffffffff6001816101406141b09561419b60009960e0600019608085015101918260808601528260031c9060601b01549160051b161c98878a86169160e0909291928360031c9060601b019260051b1682549182821c1863ffffffff16901b189055565b015116929f019e16908363ffffffff166150bb565b60208d518263ffffffff168152018d5262ffffff8160081c1668a20d6e21d0e525530d60601b015460ff82161c6001166141f0575b508c8a8c8b93614130565b68a20d6e21d0e525530d60601b62ffffff600883901c16018054600160ff84161b1916905563ffffffff1660005268a20d6e21d0e525530c60205260406000206001600160601b0360a01b8154169055386141e5565b5050505060001901801561425d57878c8a8c614136565b5060a08801899052805463ffffffff60801b191660809990991b63ffffffff60801b16989098178855939850919690959194929350909190608082810151855463ffffffff60801b1916911b63ffffffff60801b1617845560016020818060a01b0368a20d6e21d0e5255309541692606081015193845160051b608401906000607f19870196879463144027d3865280870151906040015190605f19830152603f198201526060601f1982015260631901915af19151141615610834575b68a20d6e21d0e5255308549263ffffffff60208301519461436b8451968781858560801c160103978860e08801528460801b8960801b168560801b1985161768a20d6e21d0e525530855016150fc565b958260801b9060801b16908260801b19161760601c1661018083015281516146d3575b50602081015161440a575b50506040810151516143e4575b5060009081526001600160a01b0391821692909116907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90602090a3565b68a20d6e21d0e525530954614404916001600160a01b039091169061525a565b386143a6565b91939092958160601b602086015261443c8260018060a01b031660005268a20d6e21d0e5255310602052604060002090565b9563ffffffff61444c8487615017565b1661014085015260c0840151600d549081670de0b6b3a7640000810204670de0b6b3a7640000148215171561388457670de0b6b3a764000061448f920290613e93565b68a20d6e21d0e525530854602090811c63ffffffff1682811180159091021761016087015260a08601519086015181016101208701819052875463ffffffff60801b191660809190911b63ffffffff60801b16179096559263ffffffff68a20d6e21d0e52553085460401c169860015b1561466e575b61018086015160009063ffffffff8c81169116146145e75768a20d6e21d0e525531160601b631fffffff60038d901c16015463ffffffff60018d0181169c60051b60e0169190911c1663ffffffff166145e2905b6145808160018160081c685106b710e87292a98760611b019160ff161b8019825416179055565b60608c901b60038b901c01805460058c901b60e01681811c63ffffffff8581169190911816901b1890556145cb63ffffffff6101408b01511663ffffffff60018d019c1690836150bb565b8a9060209082519060081b82840151178152019052565b6144ff565b9499939291906101608701515b63ffffffff614628600019830160011b60e08160031c685106b710e87292a98960611b01549160051b161c63ffffffff1690565b161561464b5761463e906001808e01910161514b565b8b811190811502176145f4565b6145e2909b9691929394959b6001810188811190811502176101608a0152614559565b6101208601518703614505579550959391979250955063ffffffff60401b67ffffffff0000000061016068a20d6e21d0e52553085493015160201b169260401b16906bffffffffffffffff000000001916171768a20d6e21d0e5255308553880614399565b949160018760609996939895991b17602089015261470b8460018060a01b031660005268a20d6e21d0e5255310602052604060002090565b608080890151895181036101008b01819052895463ffffffff60801b1916921b63ffffffff60801b16919091179097559660015b15614845575b60009660001901968760031c8960601b015460e08960051b161c8063ffffffff169060001982018060021c685106b710e87292a98960611b019060c082549160061b1681811c6001600160401b0316901b1890556147b4828d9060209082519060081b82840151178152019052565b62ffffff8160081c1660ff81685106b710e87292a98760611b019216916001831b19815416905568a20d6e21d0e525530d60601b0154901c6001166147fa575b5061473f565b68a20d6e21d0e525530d60601b600882901c018054600160ff84161b1916905560005268a20d6e21d0e525530c60205260406000206001600160601b0360a01b8154169055386147f4565b6101008101518703614745579194979396509194503861438e565b9460a08592979598939801510160a082015261431b565b50509450949295909561431b565b6148b391670de0b6b3a7640000916001600160a01b03858116908a16146148ca575b50026060860151613e93565b60a08501518082039111026020850152388061402c565b60808801510360a0880152386148a7565b604051631e9acf1760e31b8152600490fd5b604051633a954ecd60e21b8152600490fd5b9060009180835282602052604083209160018060a01b03169182845260205260ff60408420541661492f57505050565b80835282602052604083208284526020526040832060ff1981541690557ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b339380a4565b906001600160a01b038216156148ed5761498c82614fc2565b68a20d6e21d0e5255309546001600160a01b031615610834576040516149b181613753565b60008082526020820181905260408201819052606082015281546001600160a01b03811660a091821c85019182901b6001600160a01b031916178355600d5490670de0b6b3a7640000918281029281840414901517156138845781614a1591613e93565b604083015268a20d6e21d0e52553085491848360a01c01916001600160601b0360a01b8360a01b1660018060a01b0385161768a20d6e21d0e52553085585831081840463fffffffe108460601c17151517614dc957614a749083613e93565b84549460028660581c1615614abe575b50505050505060005260018060a01b031660007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef602082a3565b6001600160a01b038816600090815268a20d6e21d0e52553106020526040902063ffffffff909660801c1693614afe6040850151868082039111026150fc565b9560408701518051614b13575b505050614a84565b60608b901b6020890152516001600160801b03821660a09390931b6001600160a01b0319169283176001600160a01b03909216909217608090811c63ffffffff90811693811693909301811b63ffffffff60801b9081169290921768a20d6e21d0e5255308556040860151845463ffffffff60801b1916911b90911617825596989597949693959294919390614baa908390615017565b16606085015268a20d6e21d0e5255308549763ffffffff808a60401c1699818160601c16602088015260201c168481119081150217855260015b15614d45575b602085015160009063ffffffff8b8116911614614cc857614cc363ffffffff614c39818060018f01169d1660e08160031c68a20d6e21d0e525531160601b01549160051b161c63ffffffff1690565b165b614c628160018160081c685106b710e87292a98760611b019160ff161b8019825416179055565b60608b901b60038a901c01805460058b901b60e01681811c63ffffffff8581169190911816901b189055614cac63ffffffff60608a01511663ffffffff60018c019b1690836150bb565b899060209082519060081b82840151178152019052565b614be4565b939892919085515b63ffffffff614d04600019830160011b60e08160031c685106b710e87292a98960611b01549160051b161c63ffffffff1690565b1615614d2757614d1a906001808d01910161514b565b8a81119081150217614cd0565b614cc3909a95919293949a6001810187811190811502178852614c3b565b60408501518603614bea579593919792509550614dbb9350519067ffffffff0000000063ffffffff60401b68a20d6e21d0e5255308549260401b169260201b16906bffffffffffffffff000000001916171768a20d6e21d0e52553085560018060a01b0368a20d6e21d0e525530954169061525a565b388080808080808080614b0b565b60405163e5cfe95760e01b8152600490fd5b90602082018051600254808211614fa457505060a08301805193600094855260096020526040918286209260018060a01b03808451168351875160608701519060808801519286519460a086018681106001600160401b03821117614f90578852855260208501528584015260608301526080820152614e5a90615297565b838201805190969015614f50578051600d5490670de0b6b3a764000091828102928184041490151715614f3c57614e9b60ff9798999a9b92614ea492613871565b84895116614973565b8360018901918254928451809401905584895116815260038a0160205220908154019055519463ffffffff600c549080881681831601169063ffffffff191617600c55511694549151955115159080519485526001600160601b038316602086015284015260b01c16151560608201527f432265d7d7c9794c8c17745e14b88a816bd36a0a46e680dde95e885bbc92415460803392a4565b634e487b7160e01b8b52601160045260248bfd5b8051670de0b6b3a764000090818102918183041490151715614f7c5798614ea460ff969798999a614e9b565b634e487b7160e01b8a52601160045260248afd5b634e487b7160e01b8f52604160045260248ffd5b6044925060405191636ff82ea360e01b835260048301526024820152fd5b6001600160a01b038116600090815268a20d6e21d0e525531360205260409020909190916001835460581c1615614ff65750565b825460ff60581b1916903b1515600190811b1760581b60ff60581b16178255565b805460601c63ffffffff9081169392841561503157505050565b68a20d6e21d0e5255308805463ffffffff1981169084166001019093169283179055825463ffffffff60601b1916606083901b63ffffffff60601b1617909255925082906150978263ffffffff1660005268a20d6e21d0e525530a602052604060002090565b80546001600160a01b0319166001600160a01b039092169190911790551561083457565b60001901908160021c685106b710e87292a98960611b019260c084549360061b169163ffffffff169060201b1782821c186001600160401b0316901b189055565b9060409182519060608201908282106001600160401b0383111761372157602091855260008352600082840152606085840152828095805193838594855260051b840101815201526020019052565b685106b710e87292a98760611b600882901c81018054600019959492901960ff851690811c901b90811561521e575b5080615187575b50505050565b9091929394506001811901167e1f0d1e100c1d070f090b19131c1706010e11080a1a141802121b1503160405601f826001600160801b031060071b83811c6001600160401b031060061b1783811c63ffffffff1060051b1792831c63d76453e004161a179074a20d6e21d0e525530dffffffffffffffffffffffff190160081b179182109082101517600003179038808080615181565b600191508360081c01915b01805419828211811761523f5750600190615229565b80919283111561517a5750821960ff1690811b901c8061517a565b60206040600192015192603f19840193849163263c69d6835283601f198301526000825160051b6044019260231901915af1915114161561083457565b60209081810151906000918252600983526040918281209360ff855460b01c16156154005782519460608401958651865190848201926001600160601b03199060601b168352603482015260348152606081018181106001600160401b038211176153ec5787525190206080850151906002830154918291908051806153a8575b50500361537d575083516001600160a01b03168352600301905282902054908201805161534590836138bd565b93518094116153545750505050565b60449450906153649151936138b0565b90519163218a779d60e21b835260048301526024820152fd5b84518651637df9108360e01b81526001600160a01b0390911660048201526024810191909152604490fd5b9250858082019160059460051b0101915b81518111841b9081528682519118528589882091019284838510156153e0575092906153b9565b93505090503880615318565b634e487b7160e01b86526041600452602486fd5b5050505050565b90815181101561397c570160200190565b60405190606082018281106001600160401b0382111761372157604052602a825260208201604036823782511561397c576030905381516001906001101561397c57607860218401536029905b8082116154b95750506154755790565b606460405162461bcd60e51b815260206004820152602060248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152fd5b9091600f81166010811015615512576f181899199a1a9b1b9c1cb0b131b232b360811b901a6154e88486615407565b5360041c9180156154fd576000190190615465565b60246000634e487b7160e01b81526011600452fd5b60246000634e487b7160e01b81526032600452fdfe319a4565da908d26083a1132a8a05b7630d680ea0b63943a59e84146cb97464ea26469706673582212209d777bfabce8a7fd991137b2b3c39d1486a4027fb56b90475f78795ad322972164736f6c63430008180033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000001ef7c1596d893eb46826557841c5c7579efe0fbb000000000000000000000000dbaa28cbe70af04ebfb166b1a3e8f8034e5b9fc70000000000000000000000005836f538374aee94e15c3a849a50d263a5d859d10000000000000000000000001234567890abcdef1234567890abcdef12345678
-----Decoded View---------------
Arg [0] : initialSupplyOwner (address): 0x1eF7c1596d893eb46826557841c5c7579eFE0fbb
Arg [1] : contractAllowListProxy (address): 0xdbaa28cBe70aF04EbFB166b1A3E8F8034e5B9FC7
Arg [2] : initialWithdrawAddress (address): 0x5836F538374aee94E15C3A849A50D263A5D859d1
Arg [3] : initialForwarder (address): 0x1234567890AbcdEF1234567890aBcdef12345678
-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 0000000000000000000000001ef7c1596d893eb46826557841c5c7579efe0fbb
Arg [1] : 000000000000000000000000dbaa28cbe70af04ebfb166b1a3e8f8034e5b9fc7
Arg [2] : 0000000000000000000000005836f538374aee94e15c3a849a50d263a5d859d1
Arg [3] : 0000000000000000000000001234567890abcdef1234567890abcdef12345678
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.