Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 5,448 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Purchase | 18920195 | 356 days ago | IN | 0 ETH | 0.00073889 | ||||
Purchase | 18907000 | 358 days ago | IN | 0 ETH | 0.0025067 | ||||
Purchase | 18906982 | 358 days ago | IN | 0 ETH | 0.00309896 | ||||
Purchase | 18906817 | 358 days ago | IN | 0 ETH | 0.00430455 | ||||
Purchase | 18905887 | 358 days ago | IN | 0 ETH | 0.00249009 | ||||
Purchase | 18905846 | 358 days ago | IN | 0 ETH | 0.00238084 | ||||
Purchase | 18905486 | 358 days ago | IN | 0 ETH | 0.00226273 | ||||
Purchase | 18904365 | 358 days ago | IN | 0 ETH | 0.00258764 | ||||
Purchase | 18904328 | 358 days ago | IN | 0 ETH | 0.00212189 | ||||
Purchase | 18904298 | 358 days ago | IN | 0 ETH | 0.00210379 | ||||
Purchase | 18904266 | 358 days ago | IN | 0 ETH | 0.00228959 | ||||
Purchase | 18902865 | 358 days ago | IN | 0 ETH | 0.00253603 | ||||
Purchase | 18902424 | 359 days ago | IN | 0 ETH | 0.00217561 | ||||
Purchase | 18901878 | 359 days ago | IN | 0 ETH | 0.00235507 | ||||
Purchase | 18901230 | 359 days ago | IN | 0 ETH | 0.00218695 | ||||
Purchase | 18901183 | 359 days ago | IN | 0 ETH | 0.00232135 | ||||
Purchase | 18900536 | 359 days ago | IN | 0 ETH | 0.00315517 | ||||
Purchase | 18899933 | 359 days ago | IN | 0 ETH | 0.00530998 | ||||
Purchase | 18899876 | 359 days ago | IN | 0 ETH | 0.0048625 | ||||
Purchase | 18899768 | 359 days ago | IN | 0 ETH | 0.00499628 | ||||
Purchase | 18899767 | 359 days ago | IN | 0 ETH | 0.00561258 | ||||
Purchase | 18899766 | 359 days ago | IN | 0 ETH | 0.00561258 | ||||
Purchase | 18899765 | 359 days ago | IN | 0 ETH | 0.00572859 | ||||
Purchase | 18899717 | 359 days ago | IN | 0 ETH | 0.00657267 | ||||
Purchase | 18899564 | 359 days ago | IN | 0 ETH | 0.0109334 |
Latest 1 internal transaction
Advanced mode:
Parent Transaction Hash | Block |
From
|
To
|
|||
---|---|---|---|---|---|---|
17083451 | 614 days ago | 0.2 ETH |
Loading...
Loading
Contract Name:
DelegatedMoonbirdNestingLevelGatedSettablePrice
Compiler Version
v0.8.19+commit.7dd6d404
Optimization Enabled:
Yes with 9999 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT // Copyright 2023 PROOF Holdings Inc pragma solidity ^0.8.16; import {IERC721} from "openzeppelin-contracts/token/ERC721/ERC721.sol"; import {ProofTest} from "proof/constants/Testing.sol"; import {IDelegationRegistry} from "delegation-registry/DelegationRegistry.sol"; import {ISellable, CallbackerWithAccessControl} from "./CallbackerWithAccessControl.sol"; import {ExactSettableFixedPrice} from "./ExactSettableFixedPrice.sol"; import {InternallyPriced, ExactInternallyPriced} from "../base/InternallyPriced.sol"; import {NestingLevelLib} from "../mechanics/NestingLevelLib.sol"; import {MoonbirdNestingLevelGated} from "../../src/mechanics/MoonbirdNestingLevelGated.sol"; import {DelegatedTokenApprovalChecker} from "../base/TokenApprovalChecker.sol"; /** * @notice Public seller with a fixed price. */ contract DelegatedMoonbirdNestingLevelGatedSettablePrice is MoonbirdNestingLevelGated, DelegatedTokenApprovalChecker, ExactSettableFixedPrice { constructor( address admin, address steerer, ISellable sellable_, uint256 price, IERC721 gatingToken, NestingLevelLib.NestingLevel requiredLevel, IDelegationRegistry registry ) CallbackerWithAccessControl(admin, steerer, sellable_) MoonbirdNestingLevelGated(gatingToken, requiredLevel) DelegatedTokenApprovalChecker(registry) ExactSettableFixedPrice(price) {} function _checkAndModifyPurchase(address to, uint64 num, uint256 cost_, bytes memory data) internal view virtual override(InternallyPriced, ExactInternallyPriced) returns (address, uint64, uint256) { return ExactInternallyPriced._checkAndModifyPurchase(to, num, cost_, data); } /** * @notice Changes set of signers authorised to sign allowances. */ function changeAllowlistSigners(address[] calldata rm, address[] calldata add) public onlyRole(DEFAULT_STEERING_ROLE) { _changeAllowlistSigners(rm, add); } }
// SPDX-License-Identifier: CC0-1.0 pragma solidity ^0.8.17; import {IDelegationRegistry} from "./IDelegationRegistry.sol"; import {EnumerableSet} from "openzeppelin-contracts/contracts/utils/structs/EnumerableSet.sol"; import {ERC165} from "openzeppelin-contracts/contracts/utils/introspection/ERC165.sol"; /** * @title DelegationRegistry * @custom:version 1.0 * @notice An immutable registry contract to be deployed as a standalone primitive. * @dev See EIP-5639, new project launches can read previous cold wallet -> hot wallet delegations * from here and integrate those permissions into their flow. * @custom:coauthor foobar (0xfoobar) * @custom:coauthor wwchung (manifoldxyz) * @custom:coauthor purplehat (artblocks) * @custom:coauthor ryley-o (artblocks) * @custom:coauthor andy8052 (tessera) * @custom:coauthor punk6529 (open metaverse) * @custom:coauthor loopify (loopiverse) * @custom:coauthor emiliano (nftrentals) * @custom:coauthor arran (proof) * @custom:coauthor james (collabland) * @custom:coauthor john (gnosis safe) * @custom:coauthor 0xrusowsky */ contract DelegationRegistry is IDelegationRegistry, ERC165 { using EnumerableSet for EnumerableSet.AddressSet; using EnumerableSet for EnumerableSet.Bytes32Set; /// @notice The global mapping and single source of truth for delegations /// @dev vault -> vaultVersion -> delegationHash mapping(address => mapping(uint256 => EnumerableSet.Bytes32Set)) internal delegations; /// @notice A mapping of wallets to versions (for cheap revocation) mapping(address => uint256) internal vaultVersion; /// @notice A mapping of wallets to delegates to versions (for cheap revocation) mapping(address => mapping(address => uint256)) internal delegateVersion; /// @notice A secondary mapping to return onchain enumerability of delegations that a given address can perform /// @dev delegate -> delegationHashes mapping(address => EnumerableSet.Bytes32Set) internal delegationHashes; /// @notice A secondary mapping used to return delegation information about a delegation /// @dev delegationHash -> DelegateInfo mapping(bytes32 => IDelegationRegistry.DelegationInfo) internal delegationInfo; /** * @inheritdoc ERC165 */ function supportsInterface(bytes4 interfaceId) public view virtual override (ERC165) returns (bool) { return interfaceId == type(IDelegationRegistry).interfaceId || super.supportsInterface(interfaceId); } /** * ----------- WRITE ----------- */ /** * @inheritdoc IDelegationRegistry */ function delegateForAll(address delegate, bool value) external override { bytes32 delegationHash = _computeAllDelegationHash(msg.sender, delegate); _setDelegationValues( delegate, delegationHash, value, IDelegationRegistry.DelegationType.ALL, msg.sender, address(0), 0 ); emit IDelegationRegistry.DelegateForAll(msg.sender, delegate, value); } /** * @inheritdoc IDelegationRegistry */ function delegateForContract(address delegate, address contract_, bool value) external override { bytes32 delegationHash = _computeContractDelegationHash(msg.sender, delegate, contract_); _setDelegationValues( delegate, delegationHash, value, IDelegationRegistry.DelegationType.CONTRACT, msg.sender, contract_, 0 ); emit IDelegationRegistry.DelegateForContract(msg.sender, delegate, contract_, value); } /** * @inheritdoc IDelegationRegistry */ function delegateForToken(address delegate, address contract_, uint256 tokenId, bool value) external override { bytes32 delegationHash = _computeTokenDelegationHash(msg.sender, delegate, contract_, tokenId); _setDelegationValues( delegate, delegationHash, value, IDelegationRegistry.DelegationType.TOKEN, msg.sender, contract_, tokenId ); emit IDelegationRegistry.DelegateForToken(msg.sender, delegate, contract_, tokenId, value); } /** * @dev Helper function to set all delegation values and enumeration sets */ function _setDelegationValues( address delegate, bytes32 delegateHash, bool value, IDelegationRegistry.DelegationType type_, address vault, address contract_, uint256 tokenId ) internal { if (value) { delegations[vault][vaultVersion[vault]].add(delegateHash); delegationHashes[delegate].add(delegateHash); delegationInfo[delegateHash] = DelegationInfo({vault: vault, delegate: delegate, type_: type_, contract_: contract_, tokenId: tokenId}); } else { delegations[vault][vaultVersion[vault]].remove(delegateHash); delegationHashes[delegate].remove(delegateHash); delete delegationInfo[delegateHash]; } } /** * @dev Helper function to compute delegation hash for wallet delegation */ function _computeAllDelegationHash(address vault, address delegate) internal view returns (bytes32) { uint256 vaultVersion_ = vaultVersion[vault]; uint256 delegateVersion_ = delegateVersion[vault][delegate]; return keccak256(abi.encode(delegate, vault, vaultVersion_, delegateVersion_)); } /** * @dev Helper function to compute delegation hash for contract delegation */ function _computeContractDelegationHash(address vault, address delegate, address contract_) internal view returns (bytes32) { uint256 vaultVersion_ = vaultVersion[vault]; uint256 delegateVersion_ = delegateVersion[vault][delegate]; return keccak256(abi.encode(delegate, vault, contract_, vaultVersion_, delegateVersion_)); } /** * @dev Helper function to compute delegation hash for token delegation */ function _computeTokenDelegationHash(address vault, address delegate, address contract_, uint256 tokenId) internal view returns (bytes32) { uint256 vaultVersion_ = vaultVersion[vault]; uint256 delegateVersion_ = delegateVersion[vault][delegate]; return keccak256(abi.encode(delegate, vault, contract_, tokenId, vaultVersion_, delegateVersion_)); } /** * @inheritdoc IDelegationRegistry */ function revokeAllDelegates() external override { ++vaultVersion[msg.sender]; emit IDelegationRegistry.RevokeAllDelegates(msg.sender); } /** * @inheritdoc IDelegationRegistry */ function revokeDelegate(address delegate) external override { _revokeDelegate(delegate, msg.sender); } /** * @inheritdoc IDelegationRegistry */ function revokeSelf(address vault) external override { _revokeDelegate(msg.sender, vault); } /** * @dev Revoke the `delegate` hotwallet from the `vault` coldwallet. */ function _revokeDelegate(address delegate, address vault) internal { ++delegateVersion[vault][delegate]; // For enumerations, filter in the view functions emit IDelegationRegistry.RevokeDelegate(vault, msg.sender); } /** * ----------- READ ----------- */ /** * @inheritdoc IDelegationRegistry */ function getDelegationsByDelegate(address delegate) external view returns (IDelegationRegistry.DelegationInfo[] memory info) { EnumerableSet.Bytes32Set storage potentialDelegationHashes = delegationHashes[delegate]; uint256 potentialDelegationHashesLength = potentialDelegationHashes.length(); uint256 delegationCount = 0; info = new IDelegationRegistry.DelegationInfo[](potentialDelegationHashesLength); for (uint256 i = 0; i < potentialDelegationHashesLength;) { bytes32 delegateHash = potentialDelegationHashes.at(i); IDelegationRegistry.DelegationInfo memory delegationInfo_ = delegationInfo[delegateHash]; address vault = delegationInfo_.vault; IDelegationRegistry.DelegationType type_ = delegationInfo_.type_; bool valid = false; if (type_ == IDelegationRegistry.DelegationType.ALL) { if (delegateHash == _computeAllDelegationHash(vault, delegate)) { valid = true; } } else if (type_ == IDelegationRegistry.DelegationType.CONTRACT) { if (delegateHash == _computeContractDelegationHash(vault, delegate, delegationInfo_.contract_)) { valid = true; } } else if (type_ == IDelegationRegistry.DelegationType.TOKEN) { if ( delegateHash == _computeTokenDelegationHash(vault, delegate, delegationInfo_.contract_, delegationInfo_.tokenId) ) { valid = true; } } if (valid) { info[delegationCount++] = delegationInfo_; } unchecked { ++i; } } if (potentialDelegationHashesLength > delegationCount) { assembly { let decrease := sub(potentialDelegationHashesLength, delegationCount) mstore(info, sub(mload(info), decrease)) } } } /** * @inheritdoc IDelegationRegistry */ function getDelegatesForAll(address vault) external view returns (address[] memory delegates) { return _getDelegatesForLevel(vault, IDelegationRegistry.DelegationType.ALL, address(0), 0); } /** * @inheritdoc IDelegationRegistry */ function getDelegatesForContract(address vault, address contract_) external view override returns (address[] memory delegates) { return _getDelegatesForLevel(vault, IDelegationRegistry.DelegationType.CONTRACT, contract_, 0); } /** * @inheritdoc IDelegationRegistry */ function getDelegatesForToken(address vault, address contract_, uint256 tokenId) external view override returns (address[] memory delegates) { return _getDelegatesForLevel(vault, IDelegationRegistry.DelegationType.TOKEN, contract_, tokenId); } function _getDelegatesForLevel( address vault, IDelegationRegistry.DelegationType delegationType, address contract_, uint256 tokenId ) internal view returns (address[] memory delegates) { EnumerableSet.Bytes32Set storage delegationHashes_ = delegations[vault][vaultVersion[vault]]; uint256 potentialDelegatesLength = delegationHashes_.length(); uint256 delegatesCount = 0; delegates = new address[](potentialDelegatesLength); for (uint256 i = 0; i < potentialDelegatesLength;) { bytes32 delegationHash = delegationHashes_.at(i); DelegationInfo storage delegationInfo_ = delegationInfo[delegationHash]; if (delegationInfo_.type_ == delegationType) { if (delegationType == IDelegationRegistry.DelegationType.ALL) { // check delegate version by validating the hash if (delegationHash == _computeAllDelegationHash(vault, delegationInfo_.delegate)) { delegates[delegatesCount++] = delegationInfo_.delegate; } } else if (delegationType == IDelegationRegistry.DelegationType.CONTRACT) { if (delegationInfo_.contract_ == contract_) { // check delegate version by validating the hash if ( delegationHash == _computeContractDelegationHash(vault, delegationInfo_.delegate, contract_) ) { delegates[delegatesCount++] = delegationInfo_.delegate; } } } else if (delegationType == IDelegationRegistry.DelegationType.TOKEN) { if (delegationInfo_.contract_ == contract_ && delegationInfo_.tokenId == tokenId) { // check delegate version by validating the hash if ( delegationHash == _computeTokenDelegationHash(vault, delegationInfo_.delegate, contract_, tokenId) ) { delegates[delegatesCount++] = delegationInfo_.delegate; } } } } unchecked { ++i; } } if (potentialDelegatesLength > delegatesCount) { assembly { let decrease := sub(potentialDelegatesLength, delegatesCount) mstore(delegates, sub(mload(delegates), decrease)) } } } /** * @inheritdoc IDelegationRegistry */ function getContractLevelDelegations(address vault) external view returns (IDelegationRegistry.ContractDelegation[] memory contractDelegations) { EnumerableSet.Bytes32Set storage delegationHashes_ = delegations[vault][vaultVersion[vault]]; uint256 potentialLength = delegationHashes_.length(); uint256 delegationCount = 0; contractDelegations = new IDelegationRegistry.ContractDelegation[](potentialLength); for (uint256 i = 0; i < potentialLength;) { bytes32 delegationHash = delegationHashes_.at(i); DelegationInfo storage delegationInfo_ = delegationInfo[delegationHash]; if (delegationInfo_.type_ == IDelegationRegistry.DelegationType.CONTRACT) { // check delegate version by validating the hash if ( delegationHash == _computeContractDelegationHash(vault, delegationInfo_.delegate, delegationInfo_.contract_) ) { contractDelegations[delegationCount++] = IDelegationRegistry.ContractDelegation({ contract_: delegationInfo_.contract_, delegate: delegationInfo_.delegate }); } } unchecked { ++i; } } if (potentialLength > delegationCount) { assembly { let decrease := sub(potentialLength, delegationCount) mstore(contractDelegations, sub(mload(contractDelegations), decrease)) } } } /** * @inheritdoc IDelegationRegistry */ function getTokenLevelDelegations(address vault) external view returns (IDelegationRegistry.TokenDelegation[] memory tokenDelegations) { EnumerableSet.Bytes32Set storage delegationHashes_ = delegations[vault][vaultVersion[vault]]; uint256 potentialLength = delegationHashes_.length(); uint256 delegationCount = 0; tokenDelegations = new IDelegationRegistry.TokenDelegation[](potentialLength); for (uint256 i = 0; i < potentialLength;) { bytes32 delegationHash = delegationHashes_.at(i); DelegationInfo storage delegationInfo_ = delegationInfo[delegationHash]; if (delegationInfo_.type_ == IDelegationRegistry.DelegationType.TOKEN) { // check delegate version by validating the hash if ( delegationHash == _computeTokenDelegationHash( vault, delegationInfo_.delegate, delegationInfo_.contract_, delegationInfo_.tokenId ) ) { tokenDelegations[delegationCount++] = IDelegationRegistry.TokenDelegation({ contract_: delegationInfo_.contract_, tokenId: delegationInfo_.tokenId, delegate: delegationInfo_.delegate }); } } unchecked { ++i; } } if (potentialLength > delegationCount) { assembly { let decrease := sub(potentialLength, delegationCount) mstore(tokenDelegations, sub(mload(tokenDelegations), decrease)) } } } /** * @inheritdoc IDelegationRegistry */ function checkDelegateForAll(address delegate, address vault) public view override returns (bool) { bytes32 delegateHash = keccak256(abi.encode(delegate, vault, vaultVersion[vault], delegateVersion[vault][delegate])); return delegations[vault][vaultVersion[vault]].contains(delegateHash); } /** * @inheritdoc IDelegationRegistry */ function checkDelegateForContract(address delegate, address vault, address contract_) public view override returns (bool) { bytes32 delegateHash = keccak256(abi.encode(delegate, vault, contract_, vaultVersion[vault], delegateVersion[vault][delegate])); return delegations[vault][vaultVersion[vault]].contains(delegateHash) ? true : checkDelegateForAll(delegate, vault); } /** * @inheritdoc IDelegationRegistry */ function checkDelegateForToken(address delegate, address vault, address contract_, uint256 tokenId) public view override returns (bool) { bytes32 delegateHash = keccak256( abi.encode(delegate, vault, contract_, tokenId, vaultVersion[vault], delegateVersion[vault][delegate]) ); return delegations[vault][vaultVersion[vault]].contains(delegateHash) ? true : checkDelegateForContract(delegate, vault, contract_); } }
// SPDX-License-Identifier: CC0-1.0 pragma solidity ^0.8.17; /** * @title An immutable registry contract to be deployed as a standalone primitive * @dev See EIP-5639, new project launches can read previous cold wallet -> hot wallet delegations * from here and integrate those permissions into their flow */ interface IDelegationRegistry { /// @notice Delegation type enum DelegationType { NONE, ALL, CONTRACT, TOKEN } /// @notice Info about a single delegation, used for onchain enumeration struct DelegationInfo { DelegationType type_; address vault; address delegate; address contract_; uint256 tokenId; } /// @notice Info about a single contract-level delegation struct ContractDelegation { address contract_; address delegate; } /// @notice Info about a single token-level delegation struct TokenDelegation { address contract_; uint256 tokenId; address delegate; } /// @notice Emitted when a user delegates their entire wallet event DelegateForAll(address vault, address delegate, bool value); /// @notice Emitted when a user delegates a specific contract event DelegateForContract(address vault, address delegate, address contract_, bool value); /// @notice Emitted when a user delegates a specific token event DelegateForToken(address vault, address delegate, address contract_, uint256 tokenId, bool value); /// @notice Emitted when a user revokes all delegations event RevokeAllDelegates(address vault); /// @notice Emitted when a user revoes all delegations for a given delegate event RevokeDelegate(address vault, address delegate); /** * ----------- WRITE ----------- */ /** * @notice Allow the delegate to act on your behalf for all contracts * @param delegate The hotwallet to act on your behalf * @param value Whether to enable or disable delegation for this address, true for setting and false for revoking */ function delegateForAll(address delegate, bool value) external; /** * @notice Allow the delegate to act on your behalf for a specific contract * @param delegate The hotwallet to act on your behalf * @param contract_ The address for the contract you're delegating * @param value Whether to enable or disable delegation for this address, true for setting and false for revoking */ function delegateForContract(address delegate, address contract_, bool value) external; /** * @notice Allow the delegate to act on your behalf for a specific token * @param delegate The hotwallet to act on your behalf * @param contract_ The address for the contract you're delegating * @param tokenId The token id for the token you're delegating * @param value Whether to enable or disable delegation for this address, true for setting and false for revoking */ function delegateForToken(address delegate, address contract_, uint256 tokenId, bool value) external; /** * @notice Revoke all delegates */ function revokeAllDelegates() external; /** * @notice Revoke a specific delegate for all their permissions * @param delegate The hotwallet to revoke */ function revokeDelegate(address delegate) external; /** * @notice Remove yourself as a delegate for a specific vault * @param vault The vault which delegated to the msg.sender, and should be removed */ function revokeSelf(address vault) external; /** * ----------- READ ----------- */ /** * @notice Returns all active delegations a given delegate is able to claim on behalf of * @param delegate The delegate that you would like to retrieve delegations for * @return info Array of DelegationInfo structs */ function getDelegationsByDelegate(address delegate) external view returns (DelegationInfo[] memory); /** * @notice Returns an array of wallet-level delegates for a given vault * @param vault The cold wallet who issued the delegation * @return addresses Array of wallet-level delegates for a given vault */ function getDelegatesForAll(address vault) external view returns (address[] memory); /** * @notice Returns an array of contract-level delegates for a given vault and contract * @param vault The cold wallet who issued the delegation * @param contract_ The address for the contract you're delegating * @return addresses Array of contract-level delegates for a given vault and contract */ function getDelegatesForContract(address vault, address contract_) external view returns (address[] memory); /** * @notice Returns an array of contract-level delegates for a given vault's token * @param vault The cold wallet who issued the delegation * @param contract_ The address for the contract holding the token * @param tokenId The token id for the token you're delegating * @return addresses Array of contract-level delegates for a given vault's token */ function getDelegatesForToken(address vault, address contract_, uint256 tokenId) external view returns (address[] memory); /** * @notice Returns all contract-level delegations for a given vault * @param vault The cold wallet who issued the delegations * @return delegations Array of ContractDelegation structs */ function getContractLevelDelegations(address vault) external view returns (ContractDelegation[] memory delegations); /** * @notice Returns all token-level delegations for a given vault * @param vault The cold wallet who issued the delegations * @return delegations Array of TokenDelegation structs */ function getTokenLevelDelegations(address vault) external view returns (TokenDelegation[] memory delegations); /** * @notice Returns true if the address is delegated to act on the entire vault * @param delegate The hotwallet to act on your behalf * @param vault The cold wallet who issued the delegation */ function checkDelegateForAll(address delegate, address vault) external view returns (bool); /** * @notice Returns true if the address is delegated to act on your behalf for a token contract or an entire vault * @param delegate The hotwallet to act on your behalf * @param contract_ The address for the contract you're delegating * @param vault The cold wallet who issued the delegation */ function checkDelegateForContract(address delegate, address vault, address contract_) external view returns (bool); /** * @notice Returns true if the address is delegated to act on your behalf for a specific token, the token's contract or an entire vault * @param delegate The hotwallet to act on your behalf * @param contract_ The address for the contract you're delegating * @param tokenId The token id for the token you're delegating * @param vault The cold wallet who issued the delegation */ function checkDelegateForToken(address delegate, address vault, address contract_, uint256 tokenId) external view returns (bool); }
// SPDX-License-Identifier: GPL-3.0-or-later // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. pragma solidity >=0.5.0; contract DSTest { event log (string); event logs (bytes); event log_address (address); event log_bytes32 (bytes32); event log_int (int); event log_uint (uint); event log_bytes (bytes); event log_string (string); event log_named_address (string key, address val); event log_named_bytes32 (string key, bytes32 val); event log_named_decimal_int (string key, int val, uint decimals); event log_named_decimal_uint (string key, uint val, uint decimals); event log_named_int (string key, int val); event log_named_uint (string key, uint val); event log_named_bytes (string key, bytes val); event log_named_string (string key, string val); bool public IS_TEST = true; bool private _failed; address constant HEVM_ADDRESS = address(bytes20(uint160(uint256(keccak256('hevm cheat code'))))); modifier mayRevert() { _; } modifier testopts(string memory) { _; } function failed() public returns (bool) { if (_failed) { return _failed; } else { bool globalFailed = false; if (hasHEVMContext()) { (, bytes memory retdata) = HEVM_ADDRESS.call( abi.encodePacked( bytes4(keccak256("load(address,bytes32)")), abi.encode(HEVM_ADDRESS, bytes32("failed")) ) ); globalFailed = abi.decode(retdata, (bool)); } return globalFailed; } } function fail() internal { if (hasHEVMContext()) { (bool status, ) = HEVM_ADDRESS.call( abi.encodePacked( bytes4(keccak256("store(address,bytes32,bytes32)")), abi.encode(HEVM_ADDRESS, bytes32("failed"), bytes32(uint256(0x01))) ) ); status; // Silence compiler warnings } _failed = true; } function hasHEVMContext() internal view returns (bool) { uint256 hevmCodeSize = 0; assembly { hevmCodeSize := extcodesize(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D) } return hevmCodeSize > 0; } modifier logs_gas() { uint startGas = gasleft(); _; uint endGas = gasleft(); emit log_named_uint("gas", startGas - endGas); } function assertTrue(bool condition) internal { if (!condition) { emit log("Error: Assertion Failed"); fail(); } } function assertTrue(bool condition, string memory err) internal { if (!condition) { emit log_named_string("Error", err); assertTrue(condition); } } function assertEq(address a, address b) internal { if (a != b) { emit log("Error: a == b not satisfied [address]"); emit log_named_address(" Left", a); emit log_named_address(" Right", b); fail(); } } function assertEq(address a, address b, string memory err) internal { if (a != b) { emit log_named_string ("Error", err); assertEq(a, b); } } function assertEq(bytes32 a, bytes32 b) internal { if (a != b) { emit log("Error: a == b not satisfied [bytes32]"); emit log_named_bytes32(" Left", a); emit log_named_bytes32(" Right", b); fail(); } } function assertEq(bytes32 a, bytes32 b, string memory err) internal { if (a != b) { emit log_named_string ("Error", err); assertEq(a, b); } } function assertEq32(bytes32 a, bytes32 b) internal { assertEq(a, b); } function assertEq32(bytes32 a, bytes32 b, string memory err) internal { assertEq(a, b, err); } function assertEq(int a, int b) internal { if (a != b) { emit log("Error: a == b not satisfied [int]"); emit log_named_int(" Left", a); emit log_named_int(" Right", b); fail(); } } function assertEq(int a, int b, string memory err) internal { if (a != b) { emit log_named_string("Error", err); assertEq(a, b); } } function assertEq(uint a, uint b) internal { if (a != b) { emit log("Error: a == b not satisfied [uint]"); emit log_named_uint(" Left", a); emit log_named_uint(" Right", b); fail(); } } function assertEq(uint a, uint b, string memory err) internal { if (a != b) { emit log_named_string("Error", err); assertEq(a, b); } } function assertEqDecimal(int a, int b, uint decimals) internal { if (a != b) { emit log("Error: a == b not satisfied [decimal int]"); emit log_named_decimal_int(" Left", a, decimals); emit log_named_decimal_int(" Right", b, decimals); fail(); } } function assertEqDecimal(int a, int b, uint decimals, string memory err) internal { if (a != b) { emit log_named_string("Error", err); assertEqDecimal(a, b, decimals); } } function assertEqDecimal(uint a, uint b, uint decimals) internal { if (a != b) { emit log("Error: a == b not satisfied [decimal uint]"); emit log_named_decimal_uint(" Left", a, decimals); emit log_named_decimal_uint(" Right", b, decimals); fail(); } } function assertEqDecimal(uint a, uint b, uint decimals, string memory err) internal { if (a != b) { emit log_named_string("Error", err); assertEqDecimal(a, b, decimals); } } function assertGt(uint a, uint b) internal { if (a <= b) { emit log("Error: a > b not satisfied [uint]"); emit log_named_uint(" Value a", a); emit log_named_uint(" Value b", b); fail(); } } function assertGt(uint a, uint b, string memory err) internal { if (a <= b) { emit log_named_string("Error", err); assertGt(a, b); } } function assertGt(int a, int b) internal { if (a <= b) { emit log("Error: a > b not satisfied [int]"); emit log_named_int(" Value a", a); emit log_named_int(" Value b", b); fail(); } } function assertGt(int a, int b, string memory err) internal { if (a <= b) { emit log_named_string("Error", err); assertGt(a, b); } } function assertGtDecimal(int a, int b, uint decimals) internal { if (a <= b) { emit log("Error: a > b not satisfied [decimal int]"); emit log_named_decimal_int(" Value a", a, decimals); emit log_named_decimal_int(" Value b", b, decimals); fail(); } } function assertGtDecimal(int a, int b, uint decimals, string memory err) internal { if (a <= b) { emit log_named_string("Error", err); assertGtDecimal(a, b, decimals); } } function assertGtDecimal(uint a, uint b, uint decimals) internal { if (a <= b) { emit log("Error: a > b not satisfied [decimal uint]"); emit log_named_decimal_uint(" Value a", a, decimals); emit log_named_decimal_uint(" Value b", b, decimals); fail(); } } function assertGtDecimal(uint a, uint b, uint decimals, string memory err) internal { if (a <= b) { emit log_named_string("Error", err); assertGtDecimal(a, b, decimals); } } function assertGe(uint a, uint b) internal { if (a < b) { emit log("Error: a >= b not satisfied [uint]"); emit log_named_uint(" Value a", a); emit log_named_uint(" Value b", b); fail(); } } function assertGe(uint a, uint b, string memory err) internal { if (a < b) { emit log_named_string("Error", err); assertGe(a, b); } } function assertGe(int a, int b) internal { if (a < b) { emit log("Error: a >= b not satisfied [int]"); emit log_named_int(" Value a", a); emit log_named_int(" Value b", b); fail(); } } function assertGe(int a, int b, string memory err) internal { if (a < b) { emit log_named_string("Error", err); assertGe(a, b); } } function assertGeDecimal(int a, int b, uint decimals) internal { if (a < b) { emit log("Error: a >= b not satisfied [decimal int]"); emit log_named_decimal_int(" Value a", a, decimals); emit log_named_decimal_int(" Value b", b, decimals); fail(); } } function assertGeDecimal(int a, int b, uint decimals, string memory err) internal { if (a < b) { emit log_named_string("Error", err); assertGeDecimal(a, b, decimals); } } function assertGeDecimal(uint a, uint b, uint decimals) internal { if (a < b) { emit log("Error: a >= b not satisfied [decimal uint]"); emit log_named_decimal_uint(" Value a", a, decimals); emit log_named_decimal_uint(" Value b", b, decimals); fail(); } } function assertGeDecimal(uint a, uint b, uint decimals, string memory err) internal { if (a < b) { emit log_named_string("Error", err); assertGeDecimal(a, b, decimals); } } function assertLt(uint a, uint b) internal { if (a >= b) { emit log("Error: a < b not satisfied [uint]"); emit log_named_uint(" Value a", a); emit log_named_uint(" Value b", b); fail(); } } function assertLt(uint a, uint b, string memory err) internal { if (a >= b) { emit log_named_string("Error", err); assertLt(a, b); } } function assertLt(int a, int b) internal { if (a >= b) { emit log("Error: a < b not satisfied [int]"); emit log_named_int(" Value a", a); emit log_named_int(" Value b", b); fail(); } } function assertLt(int a, int b, string memory err) internal { if (a >= b) { emit log_named_string("Error", err); assertLt(a, b); } } function assertLtDecimal(int a, int b, uint decimals) internal { if (a >= b) { emit log("Error: a < b not satisfied [decimal int]"); emit log_named_decimal_int(" Value a", a, decimals); emit log_named_decimal_int(" Value b", b, decimals); fail(); } } function assertLtDecimal(int a, int b, uint decimals, string memory err) internal { if (a >= b) { emit log_named_string("Error", err); assertLtDecimal(a, b, decimals); } } function assertLtDecimal(uint a, uint b, uint decimals) internal { if (a >= b) { emit log("Error: a < b not satisfied [decimal uint]"); emit log_named_decimal_uint(" Value a", a, decimals); emit log_named_decimal_uint(" Value b", b, decimals); fail(); } } function assertLtDecimal(uint a, uint b, uint decimals, string memory err) internal { if (a >= b) { emit log_named_string("Error", err); assertLtDecimal(a, b, decimals); } } function assertLe(uint a, uint b) internal { if (a > b) { emit log("Error: a <= b not satisfied [uint]"); emit log_named_uint(" Value a", a); emit log_named_uint(" Value b", b); fail(); } } function assertLe(uint a, uint b, string memory err) internal { if (a > b) { emit log_named_string("Error", err); assertLe(a, b); } } function assertLe(int a, int b) internal { if (a > b) { emit log("Error: a <= b not satisfied [int]"); emit log_named_int(" Value a", a); emit log_named_int(" Value b", b); fail(); } } function assertLe(int a, int b, string memory err) internal { if (a > b) { emit log_named_string("Error", err); assertLe(a, b); } } function assertLeDecimal(int a, int b, uint decimals) internal { if (a > b) { emit log("Error: a <= b not satisfied [decimal int]"); emit log_named_decimal_int(" Value a", a, decimals); emit log_named_decimal_int(" Value b", b, decimals); fail(); } } function assertLeDecimal(int a, int b, uint decimals, string memory err) internal { if (a > b) { emit log_named_string("Error", err); assertLeDecimal(a, b, decimals); } } function assertLeDecimal(uint a, uint b, uint decimals) internal { if (a > b) { emit log("Error: a <= b not satisfied [decimal uint]"); emit log_named_decimal_uint(" Value a", a, decimals); emit log_named_decimal_uint(" Value b", b, decimals); fail(); } } function assertLeDecimal(uint a, uint b, uint decimals, string memory err) internal { if (a > b) { emit log_named_string("Error", err); assertGeDecimal(a, b, decimals); } } function assertEq(string memory a, string memory b) internal { if (keccak256(abi.encodePacked(a)) != keccak256(abi.encodePacked(b))) { emit log("Error: a == b not satisfied [string]"); emit log_named_string(" Left", a); emit log_named_string(" Right", b); fail(); } } function assertEq(string memory a, string memory b, string memory err) internal { if (keccak256(abi.encodePacked(a)) != keccak256(abi.encodePacked(b))) { emit log_named_string("Error", err); assertEq(a, b); } } function checkEq0(bytes memory a, bytes memory b) internal pure returns (bool ok) { ok = true; if (a.length == b.length) { for (uint i = 0; i < a.length; i++) { if (a[i] != b[i]) { ok = false; } } } else { ok = false; } } function assertEq0(bytes memory a, bytes memory b) internal { if (!checkEq0(a, b)) { emit log("Error: a == b not satisfied [bytes]"); emit log_named_bytes(" Left", a); emit log_named_bytes(" Right", b); fail(); } } function assertEq0(bytes memory a, bytes memory b, string memory err) internal { if (!checkEq0(a, b)) { emit log_named_string("Error", err); assertEq0(a, b); } } }
// SPDX-License-Identifier: MIT // Copyright (c) 2023 the ethier authors (github.com/divergencetech/ethier) pragma solidity >=0.8.0 <0.9.0; import {AccessControlEnumerable as ACE} from "@openzeppelin/contracts/access/AccessControlEnumerable.sol"; contract AccessControlEnumerable is ACE { /// @notice The default role intended to perform access-restricted actions. /// @dev We are using this instead of DEFAULT_ADMIN_ROLE because the latter /// is intended to grant/revoke roles and will be secured differently. bytes32 public constant DEFAULT_STEERING_ROLE = keccak256("DEFAULT_STEERING_ROLE"); /// @dev Overrides supportsInterface so that inheriting contracts can /// reference this contract instead of OZ's version for further overrides. function supportsInterface(bytes4 interfaceId) public view virtual override(ACE) returns (bool) { return ACE.supportsInterface(interfaceId); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.2 <0.9.0; import {StdStorage} from "./StdStorage.sol"; import {Vm, VmSafe} from "./Vm.sol"; abstract contract CommonBase { // Cheat code address, 0x7109709ECfa91a80626fF3989D68f67F5b1DD12D. address internal constant VM_ADDRESS = address(uint160(uint256(keccak256("hevm cheat code")))); // console.sol and console2.sol work by executing a staticcall to this address. address internal constant CONSOLE = 0x000000000000000000636F6e736F6c652e6c6f67; // Default address for tx.origin and msg.sender, 0x1804c8AB1F12E6bbf3894d4083f33e07309d1f38. address internal constant DEFAULT_SENDER = address(uint160(uint256(keccak256("foundry default caller")))); // Address of the test contract, deployed by the DEFAULT_SENDER. address internal constant DEFAULT_TEST_CONTRACT = 0x5615dEB798BB3E4dFa0139dFa1b3D433Cc23b72f; // Deterministic deployment address of the Multicall3 contract. address internal constant MULTICALL3_ADDRESS = 0xcA11bde05977b3631167028862bE2a173976CA11; uint256 internal constant UINT256_MAX = 115792089237316195423570985008687907853269984665640564039457584007913129639935; Vm internal constant vm = Vm(VM_ADDRESS); StdStorage internal stdstore; } abstract contract TestBase is CommonBase {} abstract contract ScriptBase is CommonBase { // Used when deploying with create2, https://github.com/Arachnid/deterministic-deployment-proxy. address internal constant CREATE2_FACTORY = 0x4e59b44847b379578588920cA78FbF26c0B4956C; VmSafe internal constant vmSafe = VmSafe(VM_ADDRESS); }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.2 <0.9.0; import {DSTest} from "ds-test/test.sol"; import {stdMath} from "./StdMath.sol"; abstract contract StdAssertions is DSTest { event log_array(uint256[] val); event log_array(int256[] val); event log_array(address[] val); event log_named_array(string key, uint256[] val); event log_named_array(string key, int256[] val); event log_named_array(string key, address[] val); function fail(string memory err) internal virtual { emit log_named_string("Error", err); fail(); } function assertFalse(bool data) internal virtual { assertTrue(!data); } function assertFalse(bool data, string memory err) internal virtual { assertTrue(!data, err); } function assertEq(bool a, bool b) internal virtual { if (a != b) { emit log("Error: a == b not satisfied [bool]"); emit log_named_string(" Expected", b ? "true" : "false"); emit log_named_string(" Actual", a ? "true" : "false"); fail(); } } function assertEq(bool a, bool b, string memory err) internal virtual { if (a != b) { emit log_named_string("Error", err); assertEq(a, b); } } function assertEq(bytes memory a, bytes memory b) internal virtual { assertEq0(a, b); } function assertEq(bytes memory a, bytes memory b, string memory err) internal virtual { assertEq0(a, b, err); } function assertEq(uint256[] memory a, uint256[] memory b) internal virtual { if (keccak256(abi.encode(a)) != keccak256(abi.encode(b))) { emit log("Error: a == b not satisfied [uint[]]"); emit log_named_array(" Expected", b); emit log_named_array(" Actual", a); fail(); } } function assertEq(int256[] memory a, int256[] memory b) internal virtual { if (keccak256(abi.encode(a)) != keccak256(abi.encode(b))) { emit log("Error: a == b not satisfied [int[]]"); emit log_named_array(" Expected", b); emit log_named_array(" Actual", a); fail(); } } function assertEq(address[] memory a, address[] memory b) internal virtual { if (keccak256(abi.encode(a)) != keccak256(abi.encode(b))) { emit log("Error: a == b not satisfied [address[]]"); emit log_named_array(" Expected", b); emit log_named_array(" Actual", a); fail(); } } function assertEq(uint256[] memory a, uint256[] memory b, string memory err) internal virtual { if (keccak256(abi.encode(a)) != keccak256(abi.encode(b))) { emit log_named_string("Error", err); assertEq(a, b); } } function assertEq(int256[] memory a, int256[] memory b, string memory err) internal virtual { if (keccak256(abi.encode(a)) != keccak256(abi.encode(b))) { emit log_named_string("Error", err); assertEq(a, b); } } function assertEq(address[] memory a, address[] memory b, string memory err) internal virtual { if (keccak256(abi.encode(a)) != keccak256(abi.encode(b))) { emit log_named_string("Error", err); assertEq(a, b); } } // Legacy helper function assertEqUint(uint256 a, uint256 b) internal virtual { assertEq(uint256(a), uint256(b)); } function assertApproxEqAbs(uint256 a, uint256 b, uint256 maxDelta) internal virtual { uint256 delta = stdMath.delta(a, b); if (delta > maxDelta) { emit log("Error: a ~= b not satisfied [uint]"); emit log_named_uint(" Expected", b); emit log_named_uint(" Actual", a); emit log_named_uint(" Max Delta", maxDelta); emit log_named_uint(" Delta", delta); fail(); } } function assertApproxEqAbs(uint256 a, uint256 b, uint256 maxDelta, string memory err) internal virtual { uint256 delta = stdMath.delta(a, b); if (delta > maxDelta) { emit log_named_string("Error", err); assertApproxEqAbs(a, b, maxDelta); } } function assertApproxEqAbsDecimal(uint256 a, uint256 b, uint256 maxDelta, uint256 decimals) internal virtual { uint256 delta = stdMath.delta(a, b); if (delta > maxDelta) { emit log("Error: a ~= b not satisfied [uint]"); emit log_named_decimal_uint(" Expected", b, decimals); emit log_named_decimal_uint(" Actual", a, decimals); emit log_named_decimal_uint(" Max Delta", maxDelta, decimals); emit log_named_decimal_uint(" Delta", delta, decimals); fail(); } } function assertApproxEqAbsDecimal(uint256 a, uint256 b, uint256 maxDelta, uint256 decimals, string memory err) internal virtual { uint256 delta = stdMath.delta(a, b); if (delta > maxDelta) { emit log_named_string("Error", err); assertApproxEqAbsDecimal(a, b, maxDelta, decimals); } } function assertApproxEqAbs(int256 a, int256 b, uint256 maxDelta) internal virtual { uint256 delta = stdMath.delta(a, b); if (delta > maxDelta) { emit log("Error: a ~= b not satisfied [int]"); emit log_named_int(" Expected", b); emit log_named_int(" Actual", a); emit log_named_uint(" Max Delta", maxDelta); emit log_named_uint(" Delta", delta); fail(); } } function assertApproxEqAbs(int256 a, int256 b, uint256 maxDelta, string memory err) internal virtual { uint256 delta = stdMath.delta(a, b); if (delta > maxDelta) { emit log_named_string("Error", err); assertApproxEqAbs(a, b, maxDelta); } } function assertApproxEqAbsDecimal(int256 a, int256 b, uint256 maxDelta, uint256 decimals) internal virtual { uint256 delta = stdMath.delta(a, b); if (delta > maxDelta) { emit log("Error: a ~= b not satisfied [int]"); emit log_named_decimal_int(" Expected", b, decimals); emit log_named_decimal_int(" Actual", a, decimals); emit log_named_decimal_uint(" Max Delta", maxDelta, decimals); emit log_named_decimal_uint(" Delta", delta, decimals); fail(); } } function assertApproxEqAbsDecimal(int256 a, int256 b, uint256 maxDelta, uint256 decimals, string memory err) internal virtual { uint256 delta = stdMath.delta(a, b); if (delta > maxDelta) { emit log_named_string("Error", err); assertApproxEqAbsDecimal(a, b, maxDelta, decimals); } } function assertApproxEqRel( uint256 a, uint256 b, uint256 maxPercentDelta // An 18 decimal fixed point number, where 1e18 == 100% ) internal virtual { if (b == 0) return assertEq(a, b); // If the expected is 0, actual must be too. uint256 percentDelta = stdMath.percentDelta(a, b); if (percentDelta > maxPercentDelta) { emit log("Error: a ~= b not satisfied [uint]"); emit log_named_uint(" Expected", b); emit log_named_uint(" Actual", a); emit log_named_decimal_uint(" Max % Delta", maxPercentDelta, 18); emit log_named_decimal_uint(" % Delta", percentDelta, 18); fail(); } } function assertApproxEqRel( uint256 a, uint256 b, uint256 maxPercentDelta, // An 18 decimal fixed point number, where 1e18 == 100% string memory err ) internal virtual { if (b == 0) return assertEq(a, b, err); // If the expected is 0, actual must be too. uint256 percentDelta = stdMath.percentDelta(a, b); if (percentDelta > maxPercentDelta) { emit log_named_string("Error", err); assertApproxEqRel(a, b, maxPercentDelta); } } function assertApproxEqRelDecimal( uint256 a, uint256 b, uint256 maxPercentDelta, // An 18 decimal fixed point number, where 1e18 == 100% uint256 decimals ) internal virtual { if (b == 0) return assertEq(a, b); // If the expected is 0, actual must be too. uint256 percentDelta = stdMath.percentDelta(a, b); if (percentDelta > maxPercentDelta) { emit log("Error: a ~= b not satisfied [uint]"); emit log_named_decimal_uint(" Expected", b, decimals); emit log_named_decimal_uint(" Actual", a, decimals); emit log_named_decimal_uint(" Max % Delta", maxPercentDelta, 18); emit log_named_decimal_uint(" % Delta", percentDelta, 18); fail(); } } function assertApproxEqRelDecimal( uint256 a, uint256 b, uint256 maxPercentDelta, // An 18 decimal fixed point number, where 1e18 == 100% uint256 decimals, string memory err ) internal virtual { if (b == 0) return assertEq(a, b, err); // If the expected is 0, actual must be too. uint256 percentDelta = stdMath.percentDelta(a, b); if (percentDelta > maxPercentDelta) { emit log_named_string("Error", err); assertApproxEqRelDecimal(a, b, maxPercentDelta, decimals); } } function assertApproxEqRel(int256 a, int256 b, uint256 maxPercentDelta) internal virtual { if (b == 0) return assertEq(a, b); // If the expected is 0, actual must be too. uint256 percentDelta = stdMath.percentDelta(a, b); if (percentDelta > maxPercentDelta) { emit log("Error: a ~= b not satisfied [int]"); emit log_named_int(" Expected", b); emit log_named_int(" Actual", a); emit log_named_decimal_uint(" Max % Delta", maxPercentDelta, 18); emit log_named_decimal_uint(" % Delta", percentDelta, 18); fail(); } } function assertApproxEqRel(int256 a, int256 b, uint256 maxPercentDelta, string memory err) internal virtual { if (b == 0) return assertEq(a, b, err); // If the expected is 0, actual must be too. uint256 percentDelta = stdMath.percentDelta(a, b); if (percentDelta > maxPercentDelta) { emit log_named_string("Error", err); assertApproxEqRel(a, b, maxPercentDelta); } } function assertApproxEqRelDecimal(int256 a, int256 b, uint256 maxPercentDelta, uint256 decimals) internal virtual { if (b == 0) return assertEq(a, b); // If the expected is 0, actual must be too. uint256 percentDelta = stdMath.percentDelta(a, b); if (percentDelta > maxPercentDelta) { emit log("Error: a ~= b not satisfied [int]"); emit log_named_decimal_int(" Expected", b, decimals); emit log_named_decimal_int(" Actual", a, decimals); emit log_named_decimal_uint(" Max % Delta", maxPercentDelta, 18); emit log_named_decimal_uint(" % Delta", percentDelta, 18); fail(); } } function assertApproxEqRelDecimal(int256 a, int256 b, uint256 maxPercentDelta, uint256 decimals, string memory err) internal virtual { if (b == 0) return assertEq(a, b, err); // If the expected is 0, actual must be too. uint256 percentDelta = stdMath.percentDelta(a, b); if (percentDelta > maxPercentDelta) { emit log_named_string("Error", err); assertApproxEqRelDecimal(a, b, maxPercentDelta, decimals); } } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.2 <0.9.0; pragma experimental ABIEncoderV2; import {VmSafe} from "./Vm.sol"; /** * StdChains provides information about EVM compatible chains that can be used in scripts/tests. * For each chain, the chain's name, chain ID, and a default RPC URL are provided. Chains are * identified by their alias, which is the same as the alias in the `[rpc_endpoints]` section of * the `foundry.toml` file. For best UX, ensure the alias in the `foundry.toml` file match the * alias used in this contract, which can be found as the first argument to the * `setChainWithDefaultRpcUrl` call in the `initialize` function. * * There are two main ways to use this contract: * 1. Set a chain with `setChain(string memory chainAlias, ChainData memory chain)` or * `setChain(string memory chainAlias, Chain memory chain)` * 2. Get a chain with `getChain(string memory chainAlias)` or `getChain(uint256 chainId)`. * * The first time either of those are used, chains are initialized with the default set of RPC URLs. * This is done in `initialize`, which uses `setChainWithDefaultRpcUrl`. Defaults are recorded in * `defaultRpcUrls`. * * The `setChain` function is straightforward, and it simply saves off the given chain data. * * The `getChain` methods use `getChainWithUpdatedRpcUrl` to return a chain. For example, let's say * we want to retrieve `mainnet`'s RPC URL: * - If you haven't set any mainnet chain info with `setChain`, you haven't specified that * chain in `foundry.toml` and no env var is set, the default data and RPC URL will be returned. * - If you have set a mainnet RPC URL in `foundry.toml` it will return that, if valid (e.g. if * a URL is given or if an environment variable is given and that environment variable exists). * Otherwise, the default data is returned. * - If you specified data with `setChain` it will return that. * * Summarizing the above, the prioritization hierarchy is `setChain` -> `foundry.toml` -> environment variable -> defaults. */ abstract contract StdChains { VmSafe private constant vm = VmSafe(address(uint160(uint256(keccak256("hevm cheat code"))))); bool private initialized; struct ChainData { string name; uint256 chainId; string rpcUrl; } struct Chain { // The chain name. string name; // The chain's Chain ID. uint256 chainId; // The chain's alias. (i.e. what gets specified in `foundry.toml`). string chainAlias; // A default RPC endpoint for this chain. // NOTE: This default RPC URL is included for convenience to facilitate quick tests and // experimentation. Do not use this RPC URL for production test suites, CI, or other heavy // usage as you will be throttled and this is a disservice to others who need this endpoint. string rpcUrl; } // Maps from the chain's alias (matching the alias in the `foundry.toml` file) to chain data. mapping(string => Chain) private chains; // Maps from the chain's alias to it's default RPC URL. mapping(string => string) private defaultRpcUrls; // Maps from a chain ID to it's alias. mapping(uint256 => string) private idToAlias; bool private fallbackToDefaultRpcUrls = true; // The RPC URL will be fetched from config or defaultRpcUrls if possible. function getChain(string memory chainAlias) internal virtual returns (Chain memory chain) { require(bytes(chainAlias).length != 0, "StdChains getChain(string): Chain alias cannot be the empty string."); initialize(); chain = chains[chainAlias]; require( chain.chainId != 0, string(abi.encodePacked("StdChains getChain(string): Chain with alias \"", chainAlias, "\" not found.")) ); chain = getChainWithUpdatedRpcUrl(chainAlias, chain); } function getChain(uint256 chainId) internal virtual returns (Chain memory chain) { require(chainId != 0, "StdChains getChain(uint256): Chain ID cannot be 0."); initialize(); string memory chainAlias = idToAlias[chainId]; chain = chains[chainAlias]; require( chain.chainId != 0, string(abi.encodePacked("StdChains getChain(uint256): Chain with ID ", vm.toString(chainId), " not found.")) ); chain = getChainWithUpdatedRpcUrl(chainAlias, chain); } // set chain info, with priority to argument's rpcUrl field. function setChain(string memory chainAlias, ChainData memory chain) internal virtual { require( bytes(chainAlias).length != 0, "StdChains setChain(string,ChainData): Chain alias cannot be the empty string." ); require(chain.chainId != 0, "StdChains setChain(string,ChainData): Chain ID cannot be 0."); initialize(); string memory foundAlias = idToAlias[chain.chainId]; require( bytes(foundAlias).length == 0 || keccak256(bytes(foundAlias)) == keccak256(bytes(chainAlias)), string( abi.encodePacked( "StdChains setChain(string,ChainData): Chain ID ", vm.toString(chain.chainId), " already used by \"", foundAlias, "\"." ) ) ); uint256 oldChainId = chains[chainAlias].chainId; delete idToAlias[oldChainId]; chains[chainAlias] = Chain({name: chain.name, chainId: chain.chainId, chainAlias: chainAlias, rpcUrl: chain.rpcUrl}); idToAlias[chain.chainId] = chainAlias; } // set chain info, with priority to argument's rpcUrl field. function setChain(string memory chainAlias, Chain memory chain) internal virtual { setChain(chainAlias, ChainData({name: chain.name, chainId: chain.chainId, rpcUrl: chain.rpcUrl})); } function _toUpper(string memory str) private pure returns (string memory) { bytes memory strb = bytes(str); bytes memory copy = new bytes(strb.length); for (uint256 i = 0; i < strb.length; i++) { bytes1 b = strb[i]; if (b >= 0x61 && b <= 0x7A) { copy[i] = bytes1(uint8(b) - 32); } else { copy[i] = b; } } return string(copy); } // lookup rpcUrl, in descending order of priority: // current -> config (foundry.toml) -> environment variable -> default function getChainWithUpdatedRpcUrl(string memory chainAlias, Chain memory chain) private returns (Chain memory) { if (bytes(chain.rpcUrl).length == 0) { try vm.rpcUrl(chainAlias) returns (string memory configRpcUrl) { chain.rpcUrl = configRpcUrl; } catch (bytes memory err) { string memory envName = string(abi.encodePacked(_toUpper(chainAlias), "_RPC_URL")); if (fallbackToDefaultRpcUrls) { chain.rpcUrl = vm.envOr(envName, defaultRpcUrls[chainAlias]); } else { chain.rpcUrl = vm.envString(envName); } // distinguish 'not found' from 'cannot read' bytes memory notFoundError = abi.encodeWithSignature("CheatCodeError", string(abi.encodePacked("invalid rpc url ", chainAlias))); if (keccak256(notFoundError) != keccak256(err) || bytes(chain.rpcUrl).length == 0) { /// @solidity memory-safe-assembly assembly { revert(add(32, err), mload(err)) } } } } return chain; } function setFallbackToDefaultRpcUrls(bool useDefault) internal { fallbackToDefaultRpcUrls = useDefault; } function initialize() private { if (initialized) return; initialized = true; // If adding an RPC here, make sure to test the default RPC URL in `testRpcs` setChainWithDefaultRpcUrl("anvil", ChainData("Anvil", 31337, "http://127.0.0.1:8545")); setChainWithDefaultRpcUrl( "mainnet", ChainData("Mainnet", 1, "https://mainnet.infura.io/v3/f4a0bdad42674adab5fc0ac077ffab2b") ); setChainWithDefaultRpcUrl( "goerli", ChainData("Goerli", 5, "https://goerli.infura.io/v3/f4a0bdad42674adab5fc0ac077ffab2b") ); setChainWithDefaultRpcUrl( "sepolia", ChainData("Sepolia", 11155111, "https://sepolia.infura.io/v3/f4a0bdad42674adab5fc0ac077ffab2b") ); setChainWithDefaultRpcUrl("optimism", ChainData("Optimism", 10, "https://mainnet.optimism.io")); setChainWithDefaultRpcUrl("optimism_goerli", ChainData("Optimism Goerli", 420, "https://goerli.optimism.io")); setChainWithDefaultRpcUrl("arbitrum_one", ChainData("Arbitrum One", 42161, "https://arb1.arbitrum.io/rpc")); setChainWithDefaultRpcUrl( "arbitrum_one_goerli", ChainData("Arbitrum One Goerli", 421613, "https://goerli-rollup.arbitrum.io/rpc") ); setChainWithDefaultRpcUrl("arbitrum_nova", ChainData("Arbitrum Nova", 42170, "https://nova.arbitrum.io/rpc")); setChainWithDefaultRpcUrl("polygon", ChainData("Polygon", 137, "https://polygon-rpc.com")); setChainWithDefaultRpcUrl( "polygon_mumbai", ChainData("Polygon Mumbai", 80001, "https://rpc-mumbai.maticvigil.com") ); setChainWithDefaultRpcUrl("avalanche", ChainData("Avalanche", 43114, "https://api.avax.network/ext/bc/C/rpc")); setChainWithDefaultRpcUrl( "avalanche_fuji", ChainData("Avalanche Fuji", 43113, "https://api.avax-test.network/ext/bc/C/rpc") ); setChainWithDefaultRpcUrl( "bnb_smart_chain", ChainData("BNB Smart Chain", 56, "https://bsc-dataseed1.binance.org") ); setChainWithDefaultRpcUrl( "bnb_smart_chain_testnet", ChainData("BNB Smart Chain Testnet", 97, "https://rpc.ankr.com/bsc_testnet_chapel") ); setChainWithDefaultRpcUrl("gnosis_chain", ChainData("Gnosis Chain", 100, "https://rpc.gnosischain.com")); } // set chain info, with priority to chainAlias' rpc url in foundry.toml function setChainWithDefaultRpcUrl(string memory chainAlias, ChainData memory chain) private { string memory rpcUrl = chain.rpcUrl; defaultRpcUrls[chainAlias] = rpcUrl; chain.rpcUrl = ""; setChain(chainAlias, chain); chain.rpcUrl = rpcUrl; // restore argument } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.2 <0.9.0; pragma experimental ABIEncoderV2; import {StdStorage, stdStorage} from "./StdStorage.sol"; import {Vm} from "./Vm.sol"; abstract contract StdCheatsSafe { Vm private constant vm = Vm(address(uint160(uint256(keccak256("hevm cheat code"))))); bool private gasMeteringOff; // Data structures to parse Transaction objects from the broadcast artifact // that conform to EIP1559. The Raw structs is what is parsed from the JSON // and then converted to the one that is used by the user for better UX. struct RawTx1559 { string[] arguments; address contractAddress; string contractName; // json value name = function string functionSig; bytes32 hash; // json value name = tx RawTx1559Detail txDetail; // json value name = type string opcode; } struct RawTx1559Detail { AccessList[] accessList; bytes data; address from; bytes gas; bytes nonce; address to; bytes txType; bytes value; } struct Tx1559 { string[] arguments; address contractAddress; string contractName; string functionSig; bytes32 hash; Tx1559Detail txDetail; string opcode; } struct Tx1559Detail { AccessList[] accessList; bytes data; address from; uint256 gas; uint256 nonce; address to; uint256 txType; uint256 value; } // Data structures to parse Transaction objects from the broadcast artifact // that DO NOT conform to EIP1559. The Raw structs is what is parsed from the JSON // and then converted to the one that is used by the user for better UX. struct TxLegacy { string[] arguments; address contractAddress; string contractName; string functionSig; string hash; string opcode; TxDetailLegacy transaction; } struct TxDetailLegacy { AccessList[] accessList; uint256 chainId; bytes data; address from; uint256 gas; uint256 gasPrice; bytes32 hash; uint256 nonce; bytes1 opcode; bytes32 r; bytes32 s; uint256 txType; address to; uint8 v; uint256 value; } struct AccessList { address accessAddress; bytes32[] storageKeys; } // Data structures to parse Receipt objects from the broadcast artifact. // The Raw structs is what is parsed from the JSON // and then converted to the one that is used by the user for better UX. struct RawReceipt { bytes32 blockHash; bytes blockNumber; address contractAddress; bytes cumulativeGasUsed; bytes effectiveGasPrice; address from; bytes gasUsed; RawReceiptLog[] logs; bytes logsBloom; bytes status; address to; bytes32 transactionHash; bytes transactionIndex; } struct Receipt { bytes32 blockHash; uint256 blockNumber; address contractAddress; uint256 cumulativeGasUsed; uint256 effectiveGasPrice; address from; uint256 gasUsed; ReceiptLog[] logs; bytes logsBloom; uint256 status; address to; bytes32 transactionHash; uint256 transactionIndex; } // Data structures to parse the entire broadcast artifact, assuming the // transactions conform to EIP1559. struct EIP1559ScriptArtifact { string[] libraries; string path; string[] pending; Receipt[] receipts; uint256 timestamp; Tx1559[] transactions; TxReturn[] txReturns; } struct RawEIP1559ScriptArtifact { string[] libraries; string path; string[] pending; RawReceipt[] receipts; TxReturn[] txReturns; uint256 timestamp; RawTx1559[] transactions; } struct RawReceiptLog { // json value = address address logAddress; bytes32 blockHash; bytes blockNumber; bytes data; bytes logIndex; bool removed; bytes32[] topics; bytes32 transactionHash; bytes transactionIndex; bytes transactionLogIndex; } struct ReceiptLog { // json value = address address logAddress; bytes32 blockHash; uint256 blockNumber; bytes data; uint256 logIndex; bytes32[] topics; uint256 transactionIndex; uint256 transactionLogIndex; bool removed; } struct TxReturn { string internalType; string value; } function assumeNoPrecompiles(address addr) internal virtual { // Assembly required since `block.chainid` was introduced in 0.8.0. uint256 chainId; assembly { chainId := chainid() } assumeNoPrecompiles(addr, chainId); } function assumeNoPrecompiles(address addr, uint256 chainId) internal pure virtual { // Note: For some chains like Optimism these are technically predeploys (i.e. bytecode placed at a specific // address), but the same rationale for excluding them applies so we include those too. // These should be present on all EVM-compatible chains. vm.assume(addr < address(0x1) || addr > address(0x9)); // forgefmt: disable-start if (chainId == 10 || chainId == 420) { // https://github.com/ethereum-optimism/optimism/blob/eaa371a0184b56b7ca6d9eb9cb0a2b78b2ccd864/op-bindings/predeploys/addresses.go#L6-L21 vm.assume(addr < address(0x4200000000000000000000000000000000000000) || addr > address(0x4200000000000000000000000000000000000800)); } else if (chainId == 42161 || chainId == 421613) { // https://developer.arbitrum.io/useful-addresses#arbitrum-precompiles-l2-same-on-all-arb-chains vm.assume(addr < address(0x0000000000000000000000000000000000000064) || addr > address(0x0000000000000000000000000000000000000068)); } else if (chainId == 43114 || chainId == 43113) { // https://github.com/ava-labs/subnet-evm/blob/47c03fd007ecaa6de2c52ea081596e0a88401f58/precompile/params.go#L18-L59 vm.assume(addr < address(0x0100000000000000000000000000000000000000) || addr > address(0x01000000000000000000000000000000000000ff)); vm.assume(addr < address(0x0200000000000000000000000000000000000000) || addr > address(0x02000000000000000000000000000000000000FF)); vm.assume(addr < address(0x0300000000000000000000000000000000000000) || addr > address(0x03000000000000000000000000000000000000Ff)); } // forgefmt: disable-end } function readEIP1559ScriptArtifact(string memory path) internal view virtual returns (EIP1559ScriptArtifact memory) { string memory data = vm.readFile(path); bytes memory parsedData = vm.parseJson(data); RawEIP1559ScriptArtifact memory rawArtifact = abi.decode(parsedData, (RawEIP1559ScriptArtifact)); EIP1559ScriptArtifact memory artifact; artifact.libraries = rawArtifact.libraries; artifact.path = rawArtifact.path; artifact.timestamp = rawArtifact.timestamp; artifact.pending = rawArtifact.pending; artifact.txReturns = rawArtifact.txReturns; artifact.receipts = rawToConvertedReceipts(rawArtifact.receipts); artifact.transactions = rawToConvertedEIPTx1559s(rawArtifact.transactions); return artifact; } function rawToConvertedEIPTx1559s(RawTx1559[] memory rawTxs) internal pure virtual returns (Tx1559[] memory) { Tx1559[] memory txs = new Tx1559[](rawTxs.length); for (uint256 i; i < rawTxs.length; i++) { txs[i] = rawToConvertedEIPTx1559(rawTxs[i]); } return txs; } function rawToConvertedEIPTx1559(RawTx1559 memory rawTx) internal pure virtual returns (Tx1559 memory) { Tx1559 memory transaction; transaction.arguments = rawTx.arguments; transaction.contractName = rawTx.contractName; transaction.functionSig = rawTx.functionSig; transaction.hash = rawTx.hash; transaction.txDetail = rawToConvertedEIP1559Detail(rawTx.txDetail); transaction.opcode = rawTx.opcode; return transaction; } function rawToConvertedEIP1559Detail(RawTx1559Detail memory rawDetail) internal pure virtual returns (Tx1559Detail memory) { Tx1559Detail memory txDetail; txDetail.data = rawDetail.data; txDetail.from = rawDetail.from; txDetail.to = rawDetail.to; txDetail.nonce = _bytesToUint(rawDetail.nonce); txDetail.txType = _bytesToUint(rawDetail.txType); txDetail.value = _bytesToUint(rawDetail.value); txDetail.gas = _bytesToUint(rawDetail.gas); txDetail.accessList = rawDetail.accessList; return txDetail; } function readTx1559s(string memory path) internal view virtual returns (Tx1559[] memory) { string memory deployData = vm.readFile(path); bytes memory parsedDeployData = vm.parseJson(deployData, ".transactions"); RawTx1559[] memory rawTxs = abi.decode(parsedDeployData, (RawTx1559[])); return rawToConvertedEIPTx1559s(rawTxs); } function readTx1559(string memory path, uint256 index) internal view virtual returns (Tx1559 memory) { string memory deployData = vm.readFile(path); string memory key = string(abi.encodePacked(".transactions[", vm.toString(index), "]")); bytes memory parsedDeployData = vm.parseJson(deployData, key); RawTx1559 memory rawTx = abi.decode(parsedDeployData, (RawTx1559)); return rawToConvertedEIPTx1559(rawTx); } // Analogous to readTransactions, but for receipts. function readReceipts(string memory path) internal view virtual returns (Receipt[] memory) { string memory deployData = vm.readFile(path); bytes memory parsedDeployData = vm.parseJson(deployData, ".receipts"); RawReceipt[] memory rawReceipts = abi.decode(parsedDeployData, (RawReceipt[])); return rawToConvertedReceipts(rawReceipts); } function readReceipt(string memory path, uint256 index) internal view virtual returns (Receipt memory) { string memory deployData = vm.readFile(path); string memory key = string(abi.encodePacked(".receipts[", vm.toString(index), "]")); bytes memory parsedDeployData = vm.parseJson(deployData, key); RawReceipt memory rawReceipt = abi.decode(parsedDeployData, (RawReceipt)); return rawToConvertedReceipt(rawReceipt); } function rawToConvertedReceipts(RawReceipt[] memory rawReceipts) internal pure virtual returns (Receipt[] memory) { Receipt[] memory receipts = new Receipt[](rawReceipts.length); for (uint256 i; i < rawReceipts.length; i++) { receipts[i] = rawToConvertedReceipt(rawReceipts[i]); } return receipts; } function rawToConvertedReceipt(RawReceipt memory rawReceipt) internal pure virtual returns (Receipt memory) { Receipt memory receipt; receipt.blockHash = rawReceipt.blockHash; receipt.to = rawReceipt.to; receipt.from = rawReceipt.from; receipt.contractAddress = rawReceipt.contractAddress; receipt.effectiveGasPrice = _bytesToUint(rawReceipt.effectiveGasPrice); receipt.cumulativeGasUsed = _bytesToUint(rawReceipt.cumulativeGasUsed); receipt.gasUsed = _bytesToUint(rawReceipt.gasUsed); receipt.status = _bytesToUint(rawReceipt.status); receipt.transactionIndex = _bytesToUint(rawReceipt.transactionIndex); receipt.blockNumber = _bytesToUint(rawReceipt.blockNumber); receipt.logs = rawToConvertedReceiptLogs(rawReceipt.logs); receipt.logsBloom = rawReceipt.logsBloom; receipt.transactionHash = rawReceipt.transactionHash; return receipt; } function rawToConvertedReceiptLogs(RawReceiptLog[] memory rawLogs) internal pure virtual returns (ReceiptLog[] memory) { ReceiptLog[] memory logs = new ReceiptLog[](rawLogs.length); for (uint256 i; i < rawLogs.length; i++) { logs[i].logAddress = rawLogs[i].logAddress; logs[i].blockHash = rawLogs[i].blockHash; logs[i].blockNumber = _bytesToUint(rawLogs[i].blockNumber); logs[i].data = rawLogs[i].data; logs[i].logIndex = _bytesToUint(rawLogs[i].logIndex); logs[i].topics = rawLogs[i].topics; logs[i].transactionIndex = _bytesToUint(rawLogs[i].transactionIndex); logs[i].transactionLogIndex = _bytesToUint(rawLogs[i].transactionLogIndex); logs[i].removed = rawLogs[i].removed; } return logs; } // Deploy a contract by fetching the contract bytecode from // the artifacts directory // e.g. `deployCode(code, abi.encode(arg1,arg2,arg3))` function deployCode(string memory what, bytes memory args) internal virtual returns (address addr) { bytes memory bytecode = abi.encodePacked(vm.getCode(what), args); /// @solidity memory-safe-assembly assembly { addr := create(0, add(bytecode, 0x20), mload(bytecode)) } require(addr != address(0), "StdCheats deployCode(string,bytes): Deployment failed."); } function deployCode(string memory what) internal virtual returns (address addr) { bytes memory bytecode = vm.getCode(what); /// @solidity memory-safe-assembly assembly { addr := create(0, add(bytecode, 0x20), mload(bytecode)) } require(addr != address(0), "StdCheats deployCode(string): Deployment failed."); } /// @dev deploy contract with value on construction function deployCode(string memory what, bytes memory args, uint256 val) internal virtual returns (address addr) { bytes memory bytecode = abi.encodePacked(vm.getCode(what), args); /// @solidity memory-safe-assembly assembly { addr := create(val, add(bytecode, 0x20), mload(bytecode)) } require(addr != address(0), "StdCheats deployCode(string,bytes,uint256): Deployment failed."); } function deployCode(string memory what, uint256 val) internal virtual returns (address addr) { bytes memory bytecode = vm.getCode(what); /// @solidity memory-safe-assembly assembly { addr := create(val, add(bytecode, 0x20), mload(bytecode)) } require(addr != address(0), "StdCheats deployCode(string,uint256): Deployment failed."); } // creates a labeled address and the corresponding private key function makeAddrAndKey(string memory name) internal virtual returns (address addr, uint256 privateKey) { privateKey = uint256(keccak256(abi.encodePacked(name))); addr = vm.addr(privateKey); vm.label(addr, name); } // creates a labeled address function makeAddr(string memory name) internal virtual returns (address addr) { (addr,) = makeAddrAndKey(name); } function deriveRememberKey(string memory mnemonic, uint32 index) internal virtual returns (address who, uint256 privateKey) { privateKey = vm.deriveKey(mnemonic, index); who = vm.rememberKey(privateKey); } function _bytesToUint(bytes memory b) private pure returns (uint256) { require(b.length <= 32, "StdCheats _bytesToUint(bytes): Bytes length exceeds 32."); return abi.decode(abi.encodePacked(new bytes(32 - b.length), b), (uint256)); } function isFork() internal view virtual returns (bool status) { try vm.activeFork() { status = true; } catch (bytes memory) {} } modifier skipWhenForking() { if (!isFork()) { _; } } modifier skipWhenNotForking() { if (isFork()) { _; } } modifier noGasMetering() { vm.pauseGasMetering(); // To prevent turning gas monitoring back on with nested functions that use this modifier, // we check if gasMetering started in the off position. If it did, we don't want to turn // it back on until we exit the top level function that used the modifier // // i.e. funcA() noGasMetering { funcB() }, where funcB has noGasMetering as well. // funcA will have `gasStartedOff` as false, funcB will have it as true, // so we only turn metering back on at the end of the funcA bool gasStartedOff = gasMeteringOff; gasMeteringOff = true; _; // if gas metering was on when this modifier was called, turn it back on at the end if (!gasStartedOff) { gasMeteringOff = false; vm.resumeGasMetering(); } } // a cheat for fuzzing addresses that are payable only // see https://github.com/foundry-rs/foundry/issues/3631 function assumePayable(address addr) internal virtual { (bool success,) = payable(addr).call{value: 0}(""); vm.assume(success); } } // Wrappers around cheatcodes to avoid footguns abstract contract StdCheats is StdCheatsSafe { using stdStorage for StdStorage; StdStorage private stdstore; Vm private constant vm = Vm(address(uint160(uint256(keccak256("hevm cheat code"))))); // Skip forward or rewind time by the specified number of seconds function skip(uint256 time) internal virtual { vm.warp(block.timestamp + time); } function rewind(uint256 time) internal virtual { vm.warp(block.timestamp - time); } // Setup a prank from an address that has some ether function hoax(address msgSender) internal virtual { vm.deal(msgSender, 1 << 128); vm.prank(msgSender); } function hoax(address msgSender, uint256 give) internal virtual { vm.deal(msgSender, give); vm.prank(msgSender); } function hoax(address msgSender, address origin) internal virtual { vm.deal(msgSender, 1 << 128); vm.prank(msgSender, origin); } function hoax(address msgSender, address origin, uint256 give) internal virtual { vm.deal(msgSender, give); vm.prank(msgSender, origin); } // Start perpetual prank from an address that has some ether function startHoax(address msgSender) internal virtual { vm.deal(msgSender, 1 << 128); vm.startPrank(msgSender); } function startHoax(address msgSender, uint256 give) internal virtual { vm.deal(msgSender, give); vm.startPrank(msgSender); } // Start perpetual prank from an address that has some ether // tx.origin is set to the origin parameter function startHoax(address msgSender, address origin) internal virtual { vm.deal(msgSender, 1 << 128); vm.startPrank(msgSender, origin); } function startHoax(address msgSender, address origin, uint256 give) internal virtual { vm.deal(msgSender, give); vm.startPrank(msgSender, origin); } function changePrank(address msgSender) internal virtual { vm.stopPrank(); vm.startPrank(msgSender); } // The same as Vm's `deal` // Use the alternative signature for ERC20 tokens function deal(address to, uint256 give) internal virtual { vm.deal(to, give); } // Set the balance of an account for any ERC20 token // Use the alternative signature to update `totalSupply` function deal(address token, address to, uint256 give) internal virtual { deal(token, to, give, false); } function deal(address token, address to, uint256 give, bool adjust) internal virtual { // get current balance (, bytes memory balData) = token.call(abi.encodeWithSelector(0x70a08231, to)); uint256 prevBal = abi.decode(balData, (uint256)); // update balance stdstore.target(token).sig(0x70a08231).with_key(to).checked_write(give); // update total supply if (adjust) { (, bytes memory totSupData) = token.call(abi.encodeWithSelector(0x18160ddd)); uint256 totSup = abi.decode(totSupData, (uint256)); if (give < prevBal) { totSup -= (prevBal - give); } else { totSup += (give - prevBal); } stdstore.target(token).sig(0x18160ddd).checked_write(totSup); } } }
// SPDX-License-Identifier: MIT // Panics work for versions >=0.8.0, but we lowered the pragma to make this compatible with Test pragma solidity >=0.6.2 <0.9.0; library stdError { bytes public constant assertionError = abi.encodeWithSignature("Panic(uint256)", 0x01); bytes public constant arithmeticError = abi.encodeWithSignature("Panic(uint256)", 0x11); bytes public constant divisionError = abi.encodeWithSignature("Panic(uint256)", 0x12); bytes public constant enumConversionError = abi.encodeWithSignature("Panic(uint256)", 0x21); bytes public constant encodeStorageError = abi.encodeWithSignature("Panic(uint256)", 0x22); bytes public constant popError = abi.encodeWithSignature("Panic(uint256)", 0x31); bytes public constant indexOOBError = abi.encodeWithSignature("Panic(uint256)", 0x32); bytes public constant memOverflowError = abi.encodeWithSignature("Panic(uint256)", 0x41); bytes public constant zeroVarError = abi.encodeWithSignature("Panic(uint256)", 0x51); }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.2 <0.9.0; pragma experimental ABIEncoderV2; contract StdInvariant { struct FuzzSelector { address addr; bytes4[] selectors; } address[] private _excludedContracts; address[] private _excludedSenders; address[] private _targetedContracts; address[] private _targetedSenders; string[] private _excludedArtifacts; string[] private _targetedArtifacts; FuzzSelector[] private _targetedArtifactSelectors; FuzzSelector[] private _targetedSelectors; // Functions for users: // These are intended to be called in tests. function excludeContract(address newExcludedContract_) internal { _excludedContracts.push(newExcludedContract_); } function excludeSender(address newExcludedSender_) internal { _excludedSenders.push(newExcludedSender_); } function excludeArtifact(string memory newExcludedArtifact_) internal { _excludedArtifacts.push(newExcludedArtifact_); } function targetArtifact(string memory newTargetedArtifact_) internal { _targetedArtifacts.push(newTargetedArtifact_); } function targetArtifactSelector(FuzzSelector memory newTargetedArtifactSelector_) internal { _targetedArtifactSelectors.push(newTargetedArtifactSelector_); } function targetContract(address newTargetedContract_) internal { _targetedContracts.push(newTargetedContract_); } function targetSelector(FuzzSelector memory newTargetedSelector_) internal { _targetedSelectors.push(newTargetedSelector_); } function targetSender(address newTargetedSender_) internal { _targetedSenders.push(newTargetedSender_); } // Functions for forge: // These are called by forge to run invariant tests and don't need to be called in tests. function excludeArtifacts() public view returns (string[] memory excludedArtifacts_) { excludedArtifacts_ = _excludedArtifacts; } function excludeContracts() public view returns (address[] memory excludedContracts_) { excludedContracts_ = _excludedContracts; } function excludeSenders() public view returns (address[] memory excludedSenders_) { excludedSenders_ = _excludedSenders; } function targetArtifacts() public view returns (string[] memory targetedArtifacts_) { targetedArtifacts_ = _targetedArtifacts; } function targetArtifactSelectors() public view returns (FuzzSelector[] memory targetedArtifactSelectors_) { targetedArtifactSelectors_ = _targetedArtifactSelectors; } function targetContracts() public view returns (address[] memory targetedContracts_) { targetedContracts_ = _targetedContracts; } function targetSelectors() public view returns (FuzzSelector[] memory targetedSelectors_) { targetedSelectors_ = _targetedSelectors; } function targetSenders() public view returns (address[] memory targetedSenders_) { targetedSenders_ = _targetedSenders; } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.9.0; pragma experimental ABIEncoderV2; import {VmSafe} from "./Vm.sol"; // Helpers for parsing and writing JSON files // To parse: // ``` // using stdJson for string; // string memory json = vm.readFile("some_peth"); // json.parseUint("<json_path>"); // ``` // To write: // ``` // using stdJson for string; // string memory json = "deploymentArtifact"; // Contract contract = new Contract(); // json.serialize("contractAddress", address(contract)); // json = json.serialize("deploymentTimes", uint(1)); // // store the stringified JSON to the 'json' variable we have been using as a key // // as we won't need it any longer // string memory json2 = "finalArtifact"; // string memory final = json2.serialize("depArtifact", json); // final.write("<some_path>"); // ``` library stdJson { VmSafe private constant vm = VmSafe(address(uint160(uint256(keccak256("hevm cheat code"))))); function parseRaw(string memory json, string memory key) internal pure returns (bytes memory) { return vm.parseJson(json, key); } function readUint(string memory json, string memory key) internal returns (uint256) { return vm.parseJsonUint(json, key); } function readUintArray(string memory json, string memory key) internal returns (uint256[] memory) { return vm.parseJsonUintArray(json, key); } function readInt(string memory json, string memory key) internal returns (int256) { return vm.parseJsonInt(json, key); } function readIntArray(string memory json, string memory key) internal returns (int256[] memory) { return vm.parseJsonIntArray(json, key); } function readBytes32(string memory json, string memory key) internal returns (bytes32) { return vm.parseJsonBytes32(json, key); } function readBytes32Array(string memory json, string memory key) internal returns (bytes32[] memory) { return vm.parseJsonBytes32Array(json, key); } function readString(string memory json, string memory key) internal returns (string memory) { return vm.parseJsonString(json, key); } function readStringArray(string memory json, string memory key) internal returns (string[] memory) { return vm.parseJsonStringArray(json, key); } function readAddress(string memory json, string memory key) internal returns (address) { return vm.parseJsonAddress(json, key); } function readAddressArray(string memory json, string memory key) internal returns (address[] memory) { return vm.parseJsonAddressArray(json, key); } function readBool(string memory json, string memory key) internal returns (bool) { return vm.parseJsonBool(json, key); } function readBoolArray(string memory json, string memory key) internal returns (bool[] memory) { return vm.parseJsonBoolArray(json, key); } function readBytes(string memory json, string memory key) internal returns (bytes memory) { return vm.parseJsonBytes(json, key); } function readBytesArray(string memory json, string memory key) internal returns (bytes[] memory) { return vm.parseJsonBytesArray(json, key); } function serialize(string memory jsonKey, string memory key, bool value) internal returns (string memory) { return vm.serializeBool(jsonKey, key, value); } function serialize(string memory jsonKey, string memory key, bool[] memory value) internal returns (string memory) { return vm.serializeBool(jsonKey, key, value); } function serialize(string memory jsonKey, string memory key, uint256 value) internal returns (string memory) { return vm.serializeUint(jsonKey, key, value); } function serialize(string memory jsonKey, string memory key, uint256[] memory value) internal returns (string memory) { return vm.serializeUint(jsonKey, key, value); } function serialize(string memory jsonKey, string memory key, int256 value) internal returns (string memory) { return vm.serializeInt(jsonKey, key, value); } function serialize(string memory jsonKey, string memory key, int256[] memory value) internal returns (string memory) { return vm.serializeInt(jsonKey, key, value); } function serialize(string memory jsonKey, string memory key, address value) internal returns (string memory) { return vm.serializeAddress(jsonKey, key, value); } function serialize(string memory jsonKey, string memory key, address[] memory value) internal returns (string memory) { return vm.serializeAddress(jsonKey, key, value); } function serialize(string memory jsonKey, string memory key, bytes32 value) internal returns (string memory) { return vm.serializeBytes32(jsonKey, key, value); } function serialize(string memory jsonKey, string memory key, bytes32[] memory value) internal returns (string memory) { return vm.serializeBytes32(jsonKey, key, value); } function serialize(string memory jsonKey, string memory key, bytes memory value) internal returns (string memory) { return vm.serializeBytes(jsonKey, key, value); } function serialize(string memory jsonKey, string memory key, bytes[] memory value) internal returns (string memory) { return vm.serializeBytes(jsonKey, key, value); } function serialize(string memory jsonKey, string memory key, string memory value) internal returns (string memory) { return vm.serializeString(jsonKey, key, value); } function serialize(string memory jsonKey, string memory key, string[] memory value) internal returns (string memory) { return vm.serializeString(jsonKey, key, value); } function write(string memory jsonKey, string memory path) internal { vm.writeJson(jsonKey, path); } function write(string memory jsonKey, string memory path, string memory valueKey) internal { vm.writeJson(jsonKey, path, valueKey); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.2 <0.9.0; library stdMath { int256 private constant INT256_MIN = -57896044618658097711785492504343953926634992332820282019728792003956564819968; function abs(int256 a) internal pure returns (uint256) { // Required or it will fail when `a = type(int256).min` if (a == INT256_MIN) { return 57896044618658097711785492504343953926634992332820282019728792003956564819968; } return uint256(a > 0 ? a : -a); } function delta(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a - b : b - a; } function delta(int256 a, int256 b) internal pure returns (uint256) { // a and b are of the same sign // this works thanks to two's complement, the left-most bit is the sign bit if ((a ^ b) > -1) { return delta(abs(a), abs(b)); } // a and b are of opposite signs return abs(a) + abs(b); } function percentDelta(uint256 a, uint256 b) internal pure returns (uint256) { uint256 absDelta = delta(a, b); return absDelta * 1e18 / b; } function percentDelta(int256 a, int256 b) internal pure returns (uint256) { uint256 absDelta = delta(a, b); uint256 absB = abs(b); return absDelta * 1e18 / absB; } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.2 <0.9.0; import {Vm} from "./Vm.sol"; struct StdStorage { mapping(address => mapping(bytes4 => mapping(bytes32 => uint256))) slots; mapping(address => mapping(bytes4 => mapping(bytes32 => bool))) finds; bytes32[] _keys; bytes4 _sig; uint256 _depth; address _target; bytes32 _set; } library stdStorageSafe { event SlotFound(address who, bytes4 fsig, bytes32 keysHash, uint256 slot); event WARNING_UninitedSlot(address who, uint256 slot); Vm private constant vm = Vm(address(uint160(uint256(keccak256("hevm cheat code"))))); function sigs(string memory sigStr) internal pure returns (bytes4) { return bytes4(keccak256(bytes(sigStr))); } /// @notice find an arbitrary storage slot given a function sig, input data, address of the contract and a value to check against // slot complexity: // if flat, will be bytes32(uint256(uint)); // if map, will be keccak256(abi.encode(key, uint(slot))); // if deep map, will be keccak256(abi.encode(key1, keccak256(abi.encode(key0, uint(slot))))); // if map struct, will be bytes32(uint256(keccak256(abi.encode(key1, keccak256(abi.encode(key0, uint(slot)))))) + structFieldDepth); function find(StdStorage storage self) internal returns (uint256) { address who = self._target; bytes4 fsig = self._sig; uint256 field_depth = self._depth; bytes32[] memory ins = self._keys; // calldata to test against if (self.finds[who][fsig][keccak256(abi.encodePacked(ins, field_depth))]) { return self.slots[who][fsig][keccak256(abi.encodePacked(ins, field_depth))]; } bytes memory cald = abi.encodePacked(fsig, flatten(ins)); vm.record(); bytes32 fdat; { (, bytes memory rdat) = who.staticcall(cald); fdat = bytesToBytes32(rdat, 32 * field_depth); } (bytes32[] memory reads,) = vm.accesses(address(who)); if (reads.length == 1) { bytes32 curr = vm.load(who, reads[0]); if (curr == bytes32(0)) { emit WARNING_UninitedSlot(who, uint256(reads[0])); } if (fdat != curr) { require( false, "stdStorage find(StdStorage): Packed slot. This would cause dangerous overwriting and currently isn't supported." ); } emit SlotFound(who, fsig, keccak256(abi.encodePacked(ins, field_depth)), uint256(reads[0])); self.slots[who][fsig][keccak256(abi.encodePacked(ins, field_depth))] = uint256(reads[0]); self.finds[who][fsig][keccak256(abi.encodePacked(ins, field_depth))] = true; } else if (reads.length > 1) { for (uint256 i = 0; i < reads.length; i++) { bytes32 prev = vm.load(who, reads[i]); if (prev == bytes32(0)) { emit WARNING_UninitedSlot(who, uint256(reads[i])); } // store vm.store(who, reads[i], bytes32(hex"1337")); bool success; bytes memory rdat; { (success, rdat) = who.staticcall(cald); fdat = bytesToBytes32(rdat, 32 * field_depth); } if (success && fdat == bytes32(hex"1337")) { // we found which of the slots is the actual one emit SlotFound(who, fsig, keccak256(abi.encodePacked(ins, field_depth)), uint256(reads[i])); self.slots[who][fsig][keccak256(abi.encodePacked(ins, field_depth))] = uint256(reads[i]); self.finds[who][fsig][keccak256(abi.encodePacked(ins, field_depth))] = true; vm.store(who, reads[i], prev); break; } vm.store(who, reads[i], prev); } } else { revert("stdStorage find(StdStorage): No storage use detected for target."); } require( self.finds[who][fsig][keccak256(abi.encodePacked(ins, field_depth))], "stdStorage find(StdStorage): Slot(s) not found." ); delete self._target; delete self._sig; delete self._keys; delete self._depth; return self.slots[who][fsig][keccak256(abi.encodePacked(ins, field_depth))]; } function target(StdStorage storage self, address _target) internal returns (StdStorage storage) { self._target = _target; return self; } function sig(StdStorage storage self, bytes4 _sig) internal returns (StdStorage storage) { self._sig = _sig; return self; } function sig(StdStorage storage self, string memory _sig) internal returns (StdStorage storage) { self._sig = sigs(_sig); return self; } function with_key(StdStorage storage self, address who) internal returns (StdStorage storage) { self._keys.push(bytes32(uint256(uint160(who)))); return self; } function with_key(StdStorage storage self, uint256 amt) internal returns (StdStorage storage) { self._keys.push(bytes32(amt)); return self; } function with_key(StdStorage storage self, bytes32 key) internal returns (StdStorage storage) { self._keys.push(key); return self; } function depth(StdStorage storage self, uint256 _depth) internal returns (StdStorage storage) { self._depth = _depth; return self; } function read(StdStorage storage self) private returns (bytes memory) { address t = self._target; uint256 s = find(self); return abi.encode(vm.load(t, bytes32(s))); } function read_bytes32(StdStorage storage self) internal returns (bytes32) { return abi.decode(read(self), (bytes32)); } function read_bool(StdStorage storage self) internal returns (bool) { int256 v = read_int(self); if (v == 0) return false; if (v == 1) return true; revert("stdStorage read_bool(StdStorage): Cannot decode. Make sure you are reading a bool."); } function read_address(StdStorage storage self) internal returns (address) { return abi.decode(read(self), (address)); } function read_uint(StdStorage storage self) internal returns (uint256) { return abi.decode(read(self), (uint256)); } function read_int(StdStorage storage self) internal returns (int256) { return abi.decode(read(self), (int256)); } function bytesToBytes32(bytes memory b, uint256 offset) private pure returns (bytes32) { bytes32 out; uint256 max = b.length > 32 ? 32 : b.length; for (uint256 i = 0; i < max; i++) { out |= bytes32(b[offset + i] & 0xFF) >> (i * 8); } return out; } function flatten(bytes32[] memory b) private pure returns (bytes memory) { bytes memory result = new bytes(b.length * 32); for (uint256 i = 0; i < b.length; i++) { bytes32 k = b[i]; /// @solidity memory-safe-assembly assembly { mstore(add(result, add(32, mul(32, i))), k) } } return result; } } library stdStorage { Vm private constant vm = Vm(address(uint160(uint256(keccak256("hevm cheat code"))))); function sigs(string memory sigStr) internal pure returns (bytes4) { return stdStorageSafe.sigs(sigStr); } function find(StdStorage storage self) internal returns (uint256) { return stdStorageSafe.find(self); } function target(StdStorage storage self, address _target) internal returns (StdStorage storage) { return stdStorageSafe.target(self, _target); } function sig(StdStorage storage self, bytes4 _sig) internal returns (StdStorage storage) { return stdStorageSafe.sig(self, _sig); } function sig(StdStorage storage self, string memory _sig) internal returns (StdStorage storage) { return stdStorageSafe.sig(self, _sig); } function with_key(StdStorage storage self, address who) internal returns (StdStorage storage) { return stdStorageSafe.with_key(self, who); } function with_key(StdStorage storage self, uint256 amt) internal returns (StdStorage storage) { return stdStorageSafe.with_key(self, amt); } function with_key(StdStorage storage self, bytes32 key) internal returns (StdStorage storage) { return stdStorageSafe.with_key(self, key); } function depth(StdStorage storage self, uint256 _depth) internal returns (StdStorage storage) { return stdStorageSafe.depth(self, _depth); } function checked_write(StdStorage storage self, address who) internal { checked_write(self, bytes32(uint256(uint160(who)))); } function checked_write(StdStorage storage self, uint256 amt) internal { checked_write(self, bytes32(amt)); } function checked_write(StdStorage storage self, bool write) internal { bytes32 t; /// @solidity memory-safe-assembly assembly { t := write } checked_write(self, t); } function checked_write(StdStorage storage self, bytes32 set) internal { address who = self._target; bytes4 fsig = self._sig; uint256 field_depth = self._depth; bytes32[] memory ins = self._keys; bytes memory cald = abi.encodePacked(fsig, flatten(ins)); if (!self.finds[who][fsig][keccak256(abi.encodePacked(ins, field_depth))]) { find(self); } bytes32 slot = bytes32(self.slots[who][fsig][keccak256(abi.encodePacked(ins, field_depth))]); bytes32 fdat; { (, bytes memory rdat) = who.staticcall(cald); fdat = bytesToBytes32(rdat, 32 * field_depth); } bytes32 curr = vm.load(who, slot); if (fdat != curr) { require( false, "stdStorage find(StdStorage): Packed slot. This would cause dangerous overwriting and currently isn't supported." ); } vm.store(who, slot, set); delete self._target; delete self._sig; delete self._keys; delete self._depth; } function read_bytes32(StdStorage storage self) internal returns (bytes32) { return stdStorageSafe.read_bytes32(self); } function read_bool(StdStorage storage self) internal returns (bool) { return stdStorageSafe.read_bool(self); } function read_address(StdStorage storage self) internal returns (address) { return stdStorageSafe.read_address(self); } function read_uint(StdStorage storage self) internal returns (uint256) { return stdStorageSafe.read_uint(self); } function read_int(StdStorage storage self) internal returns (int256) { return stdStorageSafe.read_int(self); } // Private function so needs to be copied over function bytesToBytes32(bytes memory b, uint256 offset) private pure returns (bytes32) { bytes32 out; uint256 max = b.length > 32 ? 32 : b.length; for (uint256 i = 0; i < max; i++) { out |= bytes32(b[offset + i] & 0xFF) >> (i * 8); } return out; } // Private function so needs to be copied over function flatten(bytes32[] memory b) private pure returns (bytes memory) { bytes memory result = new bytes(b.length * 32); for (uint256 i = 0; i < b.length; i++) { bytes32 k = b[i]; /// @solidity memory-safe-assembly assembly { mstore(add(result, add(32, mul(32, i))), k) } } return result; } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.2 <0.9.0; pragma experimental ABIEncoderV2; import {IMulticall3} from "./interfaces/IMulticall3.sol"; // TODO Remove import. import {VmSafe} from "./Vm.sol"; abstract contract StdUtils { /*////////////////////////////////////////////////////////////////////////// CONSTANTS //////////////////////////////////////////////////////////////////////////*/ IMulticall3 private constant multicall = IMulticall3(0xcA11bde05977b3631167028862bE2a173976CA11); VmSafe private constant vm = VmSafe(address(uint160(uint256(keccak256("hevm cheat code"))))); address private constant CONSOLE2_ADDRESS = 0x000000000000000000636F6e736F6c652e6c6f67; uint256 private constant INT256_MIN_ABS = 57896044618658097711785492504343953926634992332820282019728792003956564819968; uint256 private constant UINT256_MAX = 115792089237316195423570985008687907853269984665640564039457584007913129639935; // Used by default when deploying with create2, https://github.com/Arachnid/deterministic-deployment-proxy. address private constant CREATE2_FACTORY = 0x4e59b44847b379578588920cA78FbF26c0B4956C; /*////////////////////////////////////////////////////////////////////////// INTERNAL FUNCTIONS //////////////////////////////////////////////////////////////////////////*/ function _bound(uint256 x, uint256 min, uint256 max) internal pure virtual returns (uint256 result) { require(min <= max, "StdUtils bound(uint256,uint256,uint256): Max is less than min."); // If x is between min and max, return x directly. This is to ensure that dictionary values // do not get shifted if the min is nonzero. More info: https://github.com/foundry-rs/forge-std/issues/188 if (x >= min && x <= max) return x; uint256 size = max - min + 1; // If the value is 0, 1, 2, 3, warp that to min, min+1, min+2, min+3. Similarly for the UINT256_MAX side. // This helps ensure coverage of the min/max values. if (x <= 3 && size > x) return min + x; if (x >= UINT256_MAX - 3 && size > UINT256_MAX - x) return max - (UINT256_MAX - x); // Otherwise, wrap x into the range [min, max], i.e. the range is inclusive. if (x > max) { uint256 diff = x - max; uint256 rem = diff % size; if (rem == 0) return max; result = min + rem - 1; } else if (x < min) { uint256 diff = min - x; uint256 rem = diff % size; if (rem == 0) return min; result = max - rem + 1; } } function bound(uint256 x, uint256 min, uint256 max) internal view virtual returns (uint256 result) { result = _bound(x, min, max); console2_log("Bound Result", result); } function bound(int256 x, int256 min, int256 max) internal view virtual returns (int256 result) { require(min <= max, "StdUtils bound(int256,int256,int256): Max is less than min."); // Shifting all int256 values to uint256 to use _bound function. The range of two types are: // int256 : -(2**255) ~ (2**255 - 1) // uint256: 0 ~ (2**256 - 1) // So, add 2**255, INT256_MIN_ABS to the integer values. // // If the given integer value is -2**255, we cannot use `-uint256(-x)` because of the overflow. // So, use `~uint256(x) + 1` instead. uint256 _x = x < 0 ? (INT256_MIN_ABS - ~uint256(x) - 1) : (uint256(x) + INT256_MIN_ABS); uint256 _min = min < 0 ? (INT256_MIN_ABS - ~uint256(min) - 1) : (uint256(min) + INT256_MIN_ABS); uint256 _max = max < 0 ? (INT256_MIN_ABS - ~uint256(max) - 1) : (uint256(max) + INT256_MIN_ABS); uint256 y = _bound(_x, _min, _max); // To move it back to int256 value, subtract INT256_MIN_ABS at here. result = y < INT256_MIN_ABS ? int256(~(INT256_MIN_ABS - y) + 1) : int256(y - INT256_MIN_ABS); console2_log("Bound result", vm.toString(result)); } function bytesToUint(bytes memory b) internal pure virtual returns (uint256) { require(b.length <= 32, "StdUtils bytesToUint(bytes): Bytes length exceeds 32."); return abi.decode(abi.encodePacked(new bytes(32 - b.length), b), (uint256)); } /// @dev Compute the address a contract will be deployed at for a given deployer address and nonce /// @notice adapted from Solmate implementation (https://github.com/Rari-Capital/solmate/blob/main/src/utils/LibRLP.sol) function computeCreateAddress(address deployer, uint256 nonce) internal pure virtual returns (address) { // forgefmt: disable-start // The integer zero is treated as an empty byte string, and as a result it only has a length prefix, 0x80, computed via 0x80 + 0. // A one byte integer uses its own value as its length prefix, there is no additional "0x80 + length" prefix that comes before it. if (nonce == 0x00) return addressFromLast20Bytes(keccak256(abi.encodePacked(bytes1(0xd6), bytes1(0x94), deployer, bytes1(0x80)))); if (nonce <= 0x7f) return addressFromLast20Bytes(keccak256(abi.encodePacked(bytes1(0xd6), bytes1(0x94), deployer, uint8(nonce)))); // Nonces greater than 1 byte all follow a consistent encoding scheme, where each value is preceded by a prefix of 0x80 + length. if (nonce <= 2**8 - 1) return addressFromLast20Bytes(keccak256(abi.encodePacked(bytes1(0xd7), bytes1(0x94), deployer, bytes1(0x81), uint8(nonce)))); if (nonce <= 2**16 - 1) return addressFromLast20Bytes(keccak256(abi.encodePacked(bytes1(0xd8), bytes1(0x94), deployer, bytes1(0x82), uint16(nonce)))); if (nonce <= 2**24 - 1) return addressFromLast20Bytes(keccak256(abi.encodePacked(bytes1(0xd9), bytes1(0x94), deployer, bytes1(0x83), uint24(nonce)))); // forgefmt: disable-end // More details about RLP encoding can be found here: https://eth.wiki/fundamentals/rlp // 0xda = 0xc0 (short RLP prefix) + 0x16 (length of: 0x94 ++ proxy ++ 0x84 ++ nonce) // 0x94 = 0x80 + 0x14 (0x14 = the length of an address, 20 bytes, in hex) // 0x84 = 0x80 + 0x04 (0x04 = the bytes length of the nonce, 4 bytes, in hex) // We assume nobody can have a nonce large enough to require more than 32 bytes. return addressFromLast20Bytes( keccak256(abi.encodePacked(bytes1(0xda), bytes1(0x94), deployer, bytes1(0x84), uint32(nonce))) ); } function computeCreate2Address(bytes32 salt, bytes32 initcodeHash, address deployer) internal pure virtual returns (address) { return addressFromLast20Bytes(keccak256(abi.encodePacked(bytes1(0xff), deployer, salt, initcodeHash))); } /// @dev returns the address of a contract created with CREATE2 using the default CREATE2 deployer function computeCreate2Address(bytes32 salt, bytes32 initCodeHash) internal pure returns (address) { return computeCreate2Address(salt, initCodeHash, CREATE2_FACTORY); } /// @dev returns the hash of the init code (creation code + no args) used in CREATE2 with no constructor arguments /// @param creationCode the creation code of a contract C, as returned by type(C).creationCode function hashInitCode(bytes memory creationCode) internal pure returns (bytes32) { return hashInitCode(creationCode, ""); } /// @dev returns the hash of the init code (creation code + ABI-encoded args) used in CREATE2 /// @param creationCode the creation code of a contract C, as returned by type(C).creationCode /// @param args the ABI-encoded arguments to the constructor of C function hashInitCode(bytes memory creationCode, bytes memory args) internal pure returns (bytes32) { return keccak256(abi.encodePacked(creationCode, args)); } // Performs a single call with Multicall3 to query the ERC-20 token balances of the given addresses. function getTokenBalances(address token, address[] memory addresses) internal virtual returns (uint256[] memory balances) { uint256 tokenCodeSize; assembly { tokenCodeSize := extcodesize(token) } require(tokenCodeSize > 0, "StdUtils getTokenBalances(address,address[]): Token address is not a contract."); // ABI encode the aggregate call to Multicall3. uint256 length = addresses.length; IMulticall3.Call[] memory calls = new IMulticall3.Call[](length); for (uint256 i = 0; i < length; ++i) { // 0x70a08231 = bytes4("balanceOf(address)")) calls[i] = IMulticall3.Call({target: token, callData: abi.encodeWithSelector(0x70a08231, (addresses[i]))}); } // Make the aggregate call. (, bytes[] memory returnData) = multicall.aggregate(calls); // ABI decode the return data and return the balances. balances = new uint256[](length); for (uint256 i = 0; i < length; ++i) { balances[i] = abi.decode(returnData[i], (uint256)); } } /*////////////////////////////////////////////////////////////////////////// PRIVATE FUNCTIONS //////////////////////////////////////////////////////////////////////////*/ function addressFromLast20Bytes(bytes32 bytesValue) private pure returns (address) { return address(uint160(uint256(bytesValue))); } // Used to prevent the compilation of console, which shortens the compilation time when console is not used elsewhere. function console2_log(string memory p0, uint256 p1) private view { (bool status,) = address(CONSOLE2_ADDRESS).staticcall(abi.encodeWithSignature("log(string,uint256)", p0, p1)); status; } function console2_log(string memory p0, string memory p1) private view { (bool status,) = address(CONSOLE2_ADDRESS).staticcall(abi.encodeWithSignature("log(string,string)", p0, p1)); status; } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.2 <0.9.0; pragma experimental ABIEncoderV2; // 💬 ABOUT // Standard Library's default Test // 🧩 MODULES import {console} from "./console.sol"; import {console2} from "./console2.sol"; import {StdAssertions} from "./StdAssertions.sol"; import {StdChains} from "./StdChains.sol"; import {StdCheats} from "./StdCheats.sol"; import {stdError} from "./StdError.sol"; import {StdInvariant} from "./StdInvariant.sol"; import {stdJson} from "./StdJson.sol"; import {stdMath} from "./StdMath.sol"; import {StdStorage, stdStorage} from "./StdStorage.sol"; import {StdUtils} from "./StdUtils.sol"; import {Vm} from "./Vm.sol"; // 📦 BOILERPLATE import {TestBase} from "./Base.sol"; import {DSTest} from "ds-test/test.sol"; // ⭐️ TEST abstract contract Test is DSTest, StdAssertions, StdChains, StdCheats, StdInvariant, StdUtils, TestBase { // Note: IS_TEST() must return true. // Note: Must have failure system, https://github.com/dapphub/ds-test/blob/cd98eff28324bfac652e63a239a60632a761790b/src/test.sol#L39-L76. }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.2 <0.9.0; pragma experimental ABIEncoderV2; // Cheatcodes are marked as view/pure/none using the following rules: // 0. A call's observable behaviour includes its return value, logs, reverts and state writes, // 1. If you can influence a later call's observable behaviour, you're neither `view` nor `pure (you are modifying some state be it the EVM, interpreter, filesystem, etc), // 2. Otherwise if you can be influenced by an earlier call, or if reading some state, you're `view`, // 3. Otherwise you're `pure`. interface VmSafe { struct Log { bytes32[] topics; bytes data; address emitter; } struct Rpc { string key; string url; } struct FsMetadata { bool isDir; bool isSymlink; uint256 length; bool readOnly; uint256 modified; uint256 accessed; uint256 created; } // Loads a storage slot from an address function load(address target, bytes32 slot) external view returns (bytes32 data); // Signs data function sign(uint256 privateKey, bytes32 digest) external pure returns (uint8 v, bytes32 r, bytes32 s); // Gets the address for a given private key function addr(uint256 privateKey) external pure returns (address keyAddr); // Gets the nonce of an account function getNonce(address account) external view returns (uint64 nonce); // Performs a foreign function call via the terminal function ffi(string[] calldata commandInput) external returns (bytes memory result); // Sets environment variables function setEnv(string calldata name, string calldata value) external; // Reads environment variables, (name) => (value) function envBool(string calldata name) external view returns (bool value); function envUint(string calldata name) external view returns (uint256 value); function envInt(string calldata name) external view returns (int256 value); function envAddress(string calldata name) external view returns (address value); function envBytes32(string calldata name) external view returns (bytes32 value); function envString(string calldata name) external view returns (string memory value); function envBytes(string calldata name) external view returns (bytes memory value); // Reads environment variables as arrays function envBool(string calldata name, string calldata delim) external view returns (bool[] memory value); function envUint(string calldata name, string calldata delim) external view returns (uint256[] memory value); function envInt(string calldata name, string calldata delim) external view returns (int256[] memory value); function envAddress(string calldata name, string calldata delim) external view returns (address[] memory value); function envBytes32(string calldata name, string calldata delim) external view returns (bytes32[] memory value); function envString(string calldata name, string calldata delim) external view returns (string[] memory value); function envBytes(string calldata name, string calldata delim) external view returns (bytes[] memory value); // Read environment variables with default value function envOr(string calldata name, bool defaultValue) external returns (bool value); function envOr(string calldata name, uint256 defaultValue) external returns (uint256 value); function envOr(string calldata name, int256 defaultValue) external returns (int256 value); function envOr(string calldata name, address defaultValue) external returns (address value); function envOr(string calldata name, bytes32 defaultValue) external returns (bytes32 value); function envOr(string calldata name, string calldata defaultValue) external returns (string memory value); function envOr(string calldata name, bytes calldata defaultValue) external returns (bytes memory value); // Read environment variables as arrays with default value function envOr(string calldata name, string calldata delim, bool[] calldata defaultValue) external returns (bool[] memory value); function envOr(string calldata name, string calldata delim, uint256[] calldata defaultValue) external returns (uint256[] memory value); function envOr(string calldata name, string calldata delim, int256[] calldata defaultValue) external returns (int256[] memory value); function envOr(string calldata name, string calldata delim, address[] calldata defaultValue) external returns (address[] memory value); function envOr(string calldata name, string calldata delim, bytes32[] calldata defaultValue) external returns (bytes32[] memory value); function envOr(string calldata name, string calldata delim, string[] calldata defaultValue) external returns (string[] memory value); function envOr(string calldata name, string calldata delim, bytes[] calldata defaultValue) external returns (bytes[] memory value); // Records all storage reads and writes function record() external; // Gets all accessed reads and write slot from a recording session, for a given address function accesses(address target) external returns (bytes32[] memory readSlots, bytes32[] memory writeSlots); // Gets the _creation_ bytecode from an artifact file. Takes in the relative path to the json file function getCode(string calldata artifactPath) external view returns (bytes memory creationBytecode); // Gets the _deployed_ bytecode from an artifact file. Takes in the relative path to the json file function getDeployedCode(string calldata artifactPath) external view returns (bytes memory runtimeBytecode); // Labels an address in call traces function label(address account, string calldata newLabel) external; // Using the address that calls the test contract, has the next call (at this call depth only) create a transaction that can later be signed and sent onchain function broadcast() external; // Has the next call (at this call depth only) create a transaction with the address provided as the sender that can later be signed and sent onchain function broadcast(address signer) external; // Has the next call (at this call depth only) create a transaction with the private key provided as the sender that can later be signed and sent onchain function broadcast(uint256 privateKey) external; // Using the address that calls the test contract, has all subsequent calls (at this call depth only) create transactions that can later be signed and sent onchain function startBroadcast() external; // Has all subsequent calls (at this call depth only) create transactions with the address provided that can later be signed and sent onchain function startBroadcast(address signer) external; // Has all subsequent calls (at this call depth only) create transactions with the private key provided that can later be signed and sent onchain function startBroadcast(uint256 privateKey) external; // Stops collecting onchain transactions function stopBroadcast() external; // Reads the entire content of file to string function readFile(string calldata path) external view returns (string memory data); // Reads the entire content of file as binary. Path is relative to the project root. function readFileBinary(string calldata path) external view returns (bytes memory data); // Get the path of the current project root function projectRoot() external view returns (string memory path); // Get the metadata for a file/directory function fsMetadata(string calldata fileOrDir) external returns (FsMetadata memory metadata); // Reads next line of file to string function readLine(string calldata path) external view returns (string memory line); // Writes data to file, creating a file if it does not exist, and entirely replacing its contents if it does. function writeFile(string calldata path, string calldata data) external; // Writes binary data to a file, creating a file if it does not exist, and entirely replacing its contents if it does. // Path is relative to the project root. function writeFileBinary(string calldata path, bytes calldata data) external; // Writes line to file, creating a file if it does not exist. function writeLine(string calldata path, string calldata data) external; // Closes file for reading, resetting the offset and allowing to read it from beginning with readLine. function closeFile(string calldata path) external; // Removes file. This cheatcode will revert in the following situations, but is not limited to just these cases: // - Path points to a directory. // - The file doesn't exist. // - The user lacks permissions to remove the file. function removeFile(string calldata path) external; // Convert values to a string function toString(address value) external pure returns (string memory stringifiedValue); function toString(bytes calldata value) external pure returns (string memory stringifiedValue); function toString(bytes32 value) external pure returns (string memory stringifiedValue); function toString(bool value) external pure returns (string memory stringifiedValue); function toString(uint256 value) external pure returns (string memory stringifiedValue); function toString(int256 value) external pure returns (string memory stringifiedValue); // Convert values from a string function parseBytes(string calldata stringifiedValue) external pure returns (bytes memory parsedValue); function parseAddress(string calldata stringifiedValue) external pure returns (address parsedValue); function parseUint(string calldata stringifiedValue) external pure returns (uint256 parsedValue); function parseInt(string calldata stringifiedValue) external pure returns (int256 parsedValue); function parseBytes32(string calldata stringifiedValue) external pure returns (bytes32 parsedValue); function parseBool(string calldata stringifiedValue) external pure returns (bool parsedValue); // Record all the transaction logs function recordLogs() external; // Gets all the recorded logs function getRecordedLogs() external returns (Log[] memory logs); // Derive a private key from a provided mnenomic string (or mnenomic file path) at the derivation path m/44'/60'/0'/0/{index} function deriveKey(string calldata mnemonic, uint32 index) external pure returns (uint256 privateKey); // Derive a private key from a provided mnenomic string (or mnenomic file path) at {derivationPath}{index} function deriveKey(string calldata mnemonic, string calldata derivationPath, uint32 index) external pure returns (uint256 privateKey); // Adds a private key to the local forge wallet and returns the address function rememberKey(uint256 privateKey) external returns (address keyAddr); // // parseJson // // ---- // In case the returned value is a JSON object, it's encoded as a ABI-encoded tuple. As JSON objects // don't have the notion of ordered, but tuples do, they JSON object is encoded with it's fields ordered in // ALPHABETICAL order. That means that in order to successfully decode the tuple, we need to define a tuple that // encodes the fields in the same order, which is alphabetical. In the case of Solidity structs, they are encoded // as tuples, with the attributes in the order in which they are defined. // For example: json = { 'a': 1, 'b': 0xa4tb......3xs} // a: uint256 // b: address // To decode that json, we need to define a struct or a tuple as follows: // struct json = { uint256 a; address b; } // If we defined a json struct with the opposite order, meaning placing the address b first, it would try to // decode the tuple in that order, and thus fail. // ---- // Given a string of JSON, return it as ABI-encoded function parseJson(string calldata json, string calldata key) external pure returns (bytes memory abiEncodedData); function parseJson(string calldata json) external pure returns (bytes memory abiEncodedData); // The following parseJson cheatcodes will do type coercion, for the type that they indicate. // For example, parseJsonUint will coerce all values to a uint256. That includes stringified numbers '12' // and hex numbers '0xEF'. // Type coercion works ONLY for discrete values or arrays. That means that the key must return a value or array, not // a JSON object. function parseJsonUint(string calldata, string calldata) external returns (uint256); function parseJsonUintArray(string calldata, string calldata) external returns (uint256[] memory); function parseJsonInt(string calldata, string calldata) external returns (int256); function parseJsonIntArray(string calldata, string calldata) external returns (int256[] memory); function parseJsonBool(string calldata, string calldata) external returns (bool); function parseJsonBoolArray(string calldata, string calldata) external returns (bool[] memory); function parseJsonAddress(string calldata, string calldata) external returns (address); function parseJsonAddressArray(string calldata, string calldata) external returns (address[] memory); function parseJsonString(string calldata, string calldata) external returns (string memory); function parseJsonStringArray(string calldata, string calldata) external returns (string[] memory); function parseJsonBytes(string calldata, string calldata) external returns (bytes memory); function parseJsonBytesArray(string calldata, string calldata) external returns (bytes[] memory); function parseJsonBytes32(string calldata, string calldata) external returns (bytes32); function parseJsonBytes32Array(string calldata, string calldata) external returns (bytes32[] memory); // Serialize a key and value to a JSON object stored in-memory that can be later written to a file // It returns the stringified version of the specific JSON file up to that moment. function serializeBool(string calldata objectKey, string calldata valueKey, bool value) external returns (string memory json); function serializeUint(string calldata objectKey, string calldata valueKey, uint256 value) external returns (string memory json); function serializeInt(string calldata objectKey, string calldata valueKey, int256 value) external returns (string memory json); function serializeAddress(string calldata objectKey, string calldata valueKey, address value) external returns (string memory json); function serializeBytes32(string calldata objectKey, string calldata valueKey, bytes32 value) external returns (string memory json); function serializeString(string calldata objectKey, string calldata valueKey, string calldata value) external returns (string memory json); function serializeBytes(string calldata objectKey, string calldata valueKey, bytes calldata value) external returns (string memory json); function serializeBool(string calldata objectKey, string calldata valueKey, bool[] calldata values) external returns (string memory json); function serializeUint(string calldata objectKey, string calldata valueKey, uint256[] calldata values) external returns (string memory json); function serializeInt(string calldata objectKey, string calldata valueKey, int256[] calldata values) external returns (string memory json); function serializeAddress(string calldata objectKey, string calldata valueKey, address[] calldata values) external returns (string memory json); function serializeBytes32(string calldata objectKey, string calldata valueKey, bytes32[] calldata values) external returns (string memory json); function serializeString(string calldata objectKey, string calldata valueKey, string[] calldata values) external returns (string memory json); function serializeBytes(string calldata objectKey, string calldata valueKey, bytes[] calldata values) external returns (string memory json); // // writeJson // // ---- // Write a serialized JSON object to a file. If the file exists, it will be overwritten. // Let's assume we want to write the following JSON to a file: // // { "boolean": true, "number": 342, "object": { "title": "finally json serialization" } } // // ``` // string memory json1 = "some key"; // vm.serializeBool(json1, "boolean", true); // vm.serializeBool(json1, "number", uint256(342)); // json2 = "some other key"; // string memory output = vm.serializeString(json2, "title", "finally json serialization"); // string memory finalJson = vm.serialize(json1, "object", output); // vm.writeJson(finalJson, "./output/example.json"); // ``` // The critical insight is that every invocation of serialization will return the stringified version of the JSON // up to that point. That means we can construct arbitrary JSON objects and then use the return stringified version // to serialize them as values to another JSON object. // // json1 and json2 are simply keys used by the backend to keep track of the objects. So vm.serializeJson(json1,..) // will find the object in-memory that is keyed by "some key". function writeJson(string calldata json, string calldata path) external; // Write a serialized JSON object to an **existing** JSON file, replacing a value with key = <value_key> // This is useful to replace a specific value of a JSON file, without having to parse the entire thing function writeJson(string calldata json, string calldata path, string calldata valueKey) external; // Returns the RPC url for the given alias function rpcUrl(string calldata rpcAlias) external view returns (string memory json); // Returns all rpc urls and their aliases `[alias, url][]` function rpcUrls() external view returns (string[2][] memory urls); // Returns all rpc urls and their aliases as structs. function rpcUrlStructs() external view returns (Rpc[] memory urls); // If the condition is false, discard this run's fuzz inputs and generate new ones. function assume(bool condition) external pure; // Pauses gas metering (i.e. gas usage is not counted). Noop if already paused. function pauseGasMetering() external; // Resumes gas metering (i.e. gas usage is counted again). Noop if already on. function resumeGasMetering() external; } interface Vm is VmSafe { // Sets block.timestamp function warp(uint256 newTimestamp) external; // Sets block.height function roll(uint256 newHeight) external; // Sets block.basefee function fee(uint256 newBasefee) external; // Sets block.difficulty function difficulty(uint256 newDifficulty) external; // Sets block.chainid function chainId(uint256 newChainId) external; // Stores a value to an address' storage slot. function store(address target, bytes32 slot, bytes32 value) external; // Sets the nonce of an account; must be higher than the current nonce of the account function setNonce(address account, uint64 newNonce) external; // Sets the *next* call's msg.sender to be the input address function prank(address msgSender) external; // Sets all subsequent calls' msg.sender to be the input address until `stopPrank` is called function startPrank(address msgSender) external; // Sets the *next* call's msg.sender to be the input address, and the tx.origin to be the second input function prank(address msgSender, address txOrigin) external; // Sets all subsequent calls' msg.sender to be the input address until `stopPrank` is called, and the tx.origin to be the second input function startPrank(address msgSender, address txOrigin) external; // Resets subsequent calls' msg.sender to be `address(this)` function stopPrank() external; // Sets an address' balance function deal(address account, uint256 newBalance) external; // Sets an address' code function etch(address target, bytes calldata newRuntimeBytecode) external; // Expects an error on next call function expectRevert(bytes calldata revertData) external; function expectRevert(bytes4 revertData) external; function expectRevert() external; // Prepare an expected log with (bool checkTopic1, bool checkTopic2, bool checkTopic3, bool checkData). // Call this function, then emit an event, then call a function. Internally after the call, we check if // logs were emitted in the expected order with the expected topics and data (as specified by the booleans) function expectEmit(bool checkTopic1, bool checkTopic2, bool checkTopic3, bool checkData) external; function expectEmit(bool checkTopic1, bool checkTopic2, bool checkTopic3, bool checkData, address emitter) external; // Mocks a call to an address, returning specified data. // Calldata can either be strict or a partial match, e.g. if you only // pass a Solidity selector to the expected calldata, then the entire Solidity // function will be mocked. function mockCall(address callee, bytes calldata data, bytes calldata returnData) external; // Mocks a call to an address with a specific msg.value, returning specified data. // Calldata match takes precedence over msg.value in case of ambiguity. function mockCall(address callee, uint256 msgValue, bytes calldata data, bytes calldata returnData) external; // Clears all mocked calls function clearMockedCalls() external; // Expects a call to an address with the specified calldata. // Calldata can either be a strict or a partial match function expectCall(address callee, bytes calldata data) external; // Expects a call to an address with the specified msg.value and calldata function expectCall(address callee, uint256 msgValue, bytes calldata data) external; // Sets block.coinbase function coinbase(address newCoinbase) external; // Snapshot the current state of the evm. // Returns the id of the snapshot that was created. // To revert a snapshot use `revertTo` function snapshot() external returns (uint256 snapshotId); // Revert the state of the EVM to a previous snapshot // Takes the snapshot id to revert to. // This deletes the snapshot and all snapshots taken after the given snapshot id. function revertTo(uint256 snapshotId) external returns (bool success); // Creates a new fork with the given endpoint and block and returns the identifier of the fork function createFork(string calldata urlOrAlias, uint256 blockNumber) external returns (uint256 forkId); // Creates a new fork with the given endpoint and the _latest_ block and returns the identifier of the fork function createFork(string calldata urlOrAlias) external returns (uint256 forkId); // Creates a new fork with the given endpoint and at the block the given transaction was mined in, replays all transaction mined in the block before the transaction, // and returns the identifier of the fork function createFork(string calldata urlOrAlias, bytes32 txHash) external returns (uint256 forkId); // Creates _and_ also selects a new fork with the given endpoint and block and returns the identifier of the fork function createSelectFork(string calldata urlOrAlias, uint256 blockNumber) external returns (uint256 forkId); // Creates _and_ also selects new fork with the given endpoint and at the block the given transaction was mined in, replays all transaction mined in the block before // the transaction, returns the identifier of the fork function createSelectFork(string calldata urlOrAlias, bytes32 txHash) external returns (uint256 forkId); // Creates _and_ also selects a new fork with the given endpoint and the latest block and returns the identifier of the fork function createSelectFork(string calldata urlOrAlias) external returns (uint256 forkId); // Takes a fork identifier created by `createFork` and sets the corresponding forked state as active. function selectFork(uint256 forkId) external; /// Returns the identifier of the currently active fork. Reverts if no fork is currently active. function activeFork() external view returns (uint256 forkId); // Updates the currently active fork to given block number // This is similar to `roll` but for the currently active fork function rollFork(uint256 blockNumber) external; // Updates the currently active fork to given transaction // this will `rollFork` with the number of the block the transaction was mined in and replays all transaction mined before it in the block function rollFork(bytes32 txHash) external; // Updates the given fork to given block number function rollFork(uint256 forkId, uint256 blockNumber) external; // Updates the given fork to block number of the given transaction and replays all transaction mined before it in the block function rollFork(uint256 forkId, bytes32 txHash) external; // Marks that the account(s) should use persistent storage across fork swaps in a multifork setup // Meaning, changes made to the state of this account will be kept when switching forks function makePersistent(address account) external; function makePersistent(address account0, address account1) external; function makePersistent(address account0, address account1, address account2) external; function makePersistent(address[] calldata accounts) external; // Revokes persistent status from the address, previously added via `makePersistent` function revokePersistent(address account) external; function revokePersistent(address[] calldata accounts) external; // Returns true if the account is marked as persistent function isPersistent(address account) external view returns (bool persistent); // In forking mode, explicitly grant the given address cheatcode access function allowCheatcodes(address account) external; // Fetches the given transaction from the active fork and executes it on the current state function transact(bytes32 txHash) external; // Fetches the given transaction from the given fork and executes it on the current state function transact(uint256 forkId, bytes32 txHash) external; }
// SPDX-License-Identifier: MIT pragma solidity >=0.4.22 <0.9.0; library console { address constant CONSOLE_ADDRESS = address(0x000000000000000000636F6e736F6c652e6c6f67); function _sendLogPayload(bytes memory payload) private view { uint256 payloadLength = payload.length; address consoleAddress = CONSOLE_ADDRESS; /// @solidity memory-safe-assembly assembly { let payloadStart := add(payload, 32) let r := staticcall(gas(), consoleAddress, payloadStart, payloadLength, 0, 0) } } function log() internal view { _sendLogPayload(abi.encodeWithSignature("log()")); } function logInt(int p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(int)", p0)); } function logUint(uint p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint)", p0)); } function logString(string memory p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(string)", p0)); } function logBool(bool p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool)", p0)); } function logAddress(address p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(address)", p0)); } function logBytes(bytes memory p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes)", p0)); } function logBytes1(bytes1 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes1)", p0)); } function logBytes2(bytes2 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes2)", p0)); } function logBytes3(bytes3 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes3)", p0)); } function logBytes4(bytes4 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes4)", p0)); } function logBytes5(bytes5 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes5)", p0)); } function logBytes6(bytes6 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes6)", p0)); } function logBytes7(bytes7 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes7)", p0)); } function logBytes8(bytes8 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes8)", p0)); } function logBytes9(bytes9 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes9)", p0)); } function logBytes10(bytes10 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes10)", p0)); } function logBytes11(bytes11 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes11)", p0)); } function logBytes12(bytes12 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes12)", p0)); } function logBytes13(bytes13 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes13)", p0)); } function logBytes14(bytes14 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes14)", p0)); } function logBytes15(bytes15 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes15)", p0)); } function logBytes16(bytes16 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes16)", p0)); } function logBytes17(bytes17 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes17)", p0)); } function logBytes18(bytes18 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes18)", p0)); } function logBytes19(bytes19 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes19)", p0)); } function logBytes20(bytes20 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes20)", p0)); } function logBytes21(bytes21 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes21)", p0)); } function logBytes22(bytes22 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes22)", p0)); } function logBytes23(bytes23 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes23)", p0)); } function logBytes24(bytes24 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes24)", p0)); } function logBytes25(bytes25 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes25)", p0)); } function logBytes26(bytes26 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes26)", p0)); } function logBytes27(bytes27 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes27)", p0)); } function logBytes28(bytes28 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes28)", p0)); } function logBytes29(bytes29 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes29)", p0)); } function logBytes30(bytes30 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes30)", p0)); } function logBytes31(bytes31 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes31)", p0)); } function logBytes32(bytes32 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes32)", p0)); } function log(uint p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint)", p0)); } function log(string memory p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(string)", p0)); } function log(bool p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool)", p0)); } function log(address p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(address)", p0)); } function log(uint p0, uint p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint)", p0, p1)); } function log(uint p0, string memory p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string)", p0, p1)); } function log(uint p0, bool p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool)", p0, p1)); } function log(uint p0, address p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address)", p0, p1)); } function log(string memory p0, uint p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint)", p0, p1)); } function log(string memory p0, string memory p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string)", p0, p1)); } function log(string memory p0, bool p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool)", p0, p1)); } function log(string memory p0, address p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address)", p0, p1)); } function log(bool p0, uint p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint)", p0, p1)); } function log(bool p0, string memory p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string)", p0, p1)); } function log(bool p0, bool p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool)", p0, p1)); } function log(bool p0, address p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address)", p0, p1)); } function log(address p0, uint p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint)", p0, p1)); } function log(address p0, string memory p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string)", p0, p1)); } function log(address p0, bool p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool)", p0, p1)); } function log(address p0, address p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address)", p0, p1)); } function log(uint p0, uint p1, uint p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,uint)", p0, p1, p2)); } function log(uint p0, uint p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,string)", p0, p1, p2)); } function log(uint p0, uint p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,bool)", p0, p1, p2)); } function log(uint p0, uint p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,address)", p0, p1, p2)); } function log(uint p0, string memory p1, uint p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,uint)", p0, p1, p2)); } function log(uint p0, string memory p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,string)", p0, p1, p2)); } function log(uint p0, string memory p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,bool)", p0, p1, p2)); } function log(uint p0, string memory p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,address)", p0, p1, p2)); } function log(uint p0, bool p1, uint p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,uint)", p0, p1, p2)); } function log(uint p0, bool p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,string)", p0, p1, p2)); } function log(uint p0, bool p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,bool)", p0, p1, p2)); } function log(uint p0, bool p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,address)", p0, p1, p2)); } function log(uint p0, address p1, uint p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,uint)", p0, p1, p2)); } function log(uint p0, address p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,string)", p0, p1, p2)); } function log(uint p0, address p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,bool)", p0, p1, p2)); } function log(uint p0, address p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,address)", p0, p1, p2)); } function log(string memory p0, uint p1, uint p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,uint)", p0, p1, p2)); } function log(string memory p0, uint p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,string)", p0, p1, p2)); } function log(string memory p0, uint p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,bool)", p0, p1, p2)); } function log(string memory p0, uint p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,address)", p0, p1, p2)); } function log(string memory p0, string memory p1, uint p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string,uint)", p0, p1, p2)); } function log(string memory p0, string memory p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string,string)", p0, p1, p2)); } function log(string memory p0, string memory p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string,bool)", p0, p1, p2)); } function log(string memory p0, string memory p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string,address)", p0, p1, p2)); } function log(string memory p0, bool p1, uint p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,uint)", p0, p1, p2)); } function log(string memory p0, bool p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,string)", p0, p1, p2)); } function log(string memory p0, bool p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,bool)", p0, p1, p2)); } function log(string memory p0, bool p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,address)", p0, p1, p2)); } function log(string memory p0, address p1, uint p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,uint)", p0, p1, p2)); } function log(string memory p0, address p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,string)", p0, p1, p2)); } function log(string memory p0, address p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,bool)", p0, p1, p2)); } function log(string memory p0, address p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,address)", p0, p1, p2)); } function log(bool p0, uint p1, uint p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,uint)", p0, p1, p2)); } function log(bool p0, uint p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,string)", p0, p1, p2)); } function log(bool p0, uint p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,bool)", p0, p1, p2)); } function log(bool p0, uint p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,address)", p0, p1, p2)); } function log(bool p0, string memory p1, uint p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,uint)", p0, p1, p2)); } function log(bool p0, string memory p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,string)", p0, p1, p2)); } function log(bool p0, string memory p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,bool)", p0, p1, p2)); } function log(bool p0, string memory p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,address)", p0, p1, p2)); } function log(bool p0, bool p1, uint p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint)", p0, p1, p2)); } function log(bool p0, bool p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,string)", p0, p1, p2)); } function log(bool p0, bool p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool)", p0, p1, p2)); } function log(bool p0, bool p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,address)", p0, p1, p2)); } function log(bool p0, address p1, uint p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,uint)", p0, p1, p2)); } function log(bool p0, address p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,string)", p0, p1, p2)); } function log(bool p0, address p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,bool)", p0, p1, p2)); } function log(bool p0, address p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,address)", p0, p1, p2)); } function log(address p0, uint p1, uint p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,uint)", p0, p1, p2)); } function log(address p0, uint p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,string)", p0, p1, p2)); } function log(address p0, uint p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,bool)", p0, p1, p2)); } function log(address p0, uint p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,address)", p0, p1, p2)); } function log(address p0, string memory p1, uint p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,uint)", p0, p1, p2)); } function log(address p0, string memory p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,string)", p0, p1, p2)); } function log(address p0, string memory p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,bool)", p0, p1, p2)); } function log(address p0, string memory p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,address)", p0, p1, p2)); } function log(address p0, bool p1, uint p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,uint)", p0, p1, p2)); } function log(address p0, bool p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,string)", p0, p1, p2)); } function log(address p0, bool p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,bool)", p0, p1, p2)); } function log(address p0, bool p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,address)", p0, p1, p2)); } function log(address p0, address p1, uint p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,uint)", p0, p1, p2)); } function log(address p0, address p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,string)", p0, p1, p2)); } function log(address p0, address p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,bool)", p0, p1, p2)); } function log(address p0, address p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,address)", p0, p1, p2)); } function log(uint p0, uint p1, uint p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,uint,uint)", p0, p1, p2, p3)); } function log(uint p0, uint p1, uint p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,uint,string)", p0, p1, p2, p3)); } function log(uint p0, uint p1, uint p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,uint,bool)", p0, p1, p2, p3)); } function log(uint p0, uint p1, uint p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,uint,address)", p0, p1, p2, p3)); } function log(uint p0, uint p1, string memory p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,string,uint)", p0, p1, p2, p3)); } function log(uint p0, uint p1, string memory p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,string,string)", p0, p1, p2, p3)); } function log(uint p0, uint p1, string memory p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,string,bool)", p0, p1, p2, p3)); } function log(uint p0, uint p1, string memory p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,string,address)", p0, p1, p2, p3)); } function log(uint p0, uint p1, bool p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,bool,uint)", p0, p1, p2, p3)); } function log(uint p0, uint p1, bool p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,bool,string)", p0, p1, p2, p3)); } function log(uint p0, uint p1, bool p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,bool,bool)", p0, p1, p2, p3)); } function log(uint p0, uint p1, bool p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,bool,address)", p0, p1, p2, p3)); } function log(uint p0, uint p1, address p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,address,uint)", p0, p1, p2, p3)); } function log(uint p0, uint p1, address p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,address,string)", p0, p1, p2, p3)); } function log(uint p0, uint p1, address p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,address,bool)", p0, p1, p2, p3)); } function log(uint p0, uint p1, address p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,address,address)", p0, p1, p2, p3)); } function log(uint p0, string memory p1, uint p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,uint,uint)", p0, p1, p2, p3)); } function log(uint p0, string memory p1, uint p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,uint,string)", p0, p1, p2, p3)); } function log(uint p0, string memory p1, uint p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,uint,bool)", p0, p1, p2, p3)); } function log(uint p0, string memory p1, uint p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,uint,address)", p0, p1, p2, p3)); } function log(uint p0, string memory p1, string memory p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,string,uint)", p0, p1, p2, p3)); } function log(uint p0, string memory p1, string memory p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,string,string)", p0, p1, p2, p3)); } function log(uint p0, string memory p1, string memory p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,string,bool)", p0, p1, p2, p3)); } function log(uint p0, string memory p1, string memory p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,string,address)", p0, p1, p2, p3)); } function log(uint p0, string memory p1, bool p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,bool,uint)", p0, p1, p2, p3)); } function log(uint p0, string memory p1, bool p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,bool,string)", p0, p1, p2, p3)); } function log(uint p0, string memory p1, bool p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,bool,bool)", p0, p1, p2, p3)); } function log(uint p0, string memory p1, bool p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,bool,address)", p0, p1, p2, p3)); } function log(uint p0, string memory p1, address p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,address,uint)", p0, p1, p2, p3)); } function log(uint p0, string memory p1, address p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,address,string)", p0, p1, p2, p3)); } function log(uint p0, string memory p1, address p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,address,bool)", p0, p1, p2, p3)); } function log(uint p0, string memory p1, address p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,address,address)", p0, p1, p2, p3)); } function log(uint p0, bool p1, uint p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,uint,uint)", p0, p1, p2, p3)); } function log(uint p0, bool p1, uint p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,uint,string)", p0, p1, p2, p3)); } function log(uint p0, bool p1, uint p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,uint,bool)", p0, p1, p2, p3)); } function log(uint p0, bool p1, uint p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,uint,address)", p0, p1, p2, p3)); } function log(uint p0, bool p1, string memory p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,string,uint)", p0, p1, p2, p3)); } function log(uint p0, bool p1, string memory p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,string,string)", p0, p1, p2, p3)); } function log(uint p0, bool p1, string memory p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,string,bool)", p0, p1, p2, p3)); } function log(uint p0, bool p1, string memory p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,string,address)", p0, p1, p2, p3)); } function log(uint p0, bool p1, bool p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,bool,uint)", p0, p1, p2, p3)); } function log(uint p0, bool p1, bool p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,bool,string)", p0, p1, p2, p3)); } function log(uint p0, bool p1, bool p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,bool,bool)", p0, p1, p2, p3)); } function log(uint p0, bool p1, bool p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,bool,address)", p0, p1, p2, p3)); } function log(uint p0, bool p1, address p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,address,uint)", p0, p1, p2, p3)); } function log(uint p0, bool p1, address p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,address,string)", p0, p1, p2, p3)); } function log(uint p0, bool p1, address p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,address,bool)", p0, p1, p2, p3)); } function log(uint p0, bool p1, address p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,address,address)", p0, p1, p2, p3)); } function log(uint p0, address p1, uint p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,uint,uint)", p0, p1, p2, p3)); } function log(uint p0, address p1, uint p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,uint,string)", p0, p1, p2, p3)); } function log(uint p0, address p1, uint p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,uint,bool)", p0, p1, p2, p3)); } function log(uint p0, address p1, uint p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,uint,address)", p0, p1, p2, p3)); } function log(uint p0, address p1, string memory p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,string,uint)", p0, p1, p2, p3)); } function log(uint p0, address p1, string memory p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,string,string)", p0, p1, p2, p3)); } function log(uint p0, address p1, string memory p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,string,bool)", p0, p1, p2, p3)); } function log(uint p0, address p1, string memory p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,string,address)", p0, p1, p2, p3)); } function log(uint p0, address p1, bool p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,bool,uint)", p0, p1, p2, p3)); } function log(uint p0, address p1, bool p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,bool,string)", p0, p1, p2, p3)); } function log(uint p0, address p1, bool p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,bool,bool)", p0, p1, p2, p3)); } function log(uint p0, address p1, bool p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,bool,address)", p0, p1, p2, p3)); } function log(uint p0, address p1, address p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,address,uint)", p0, p1, p2, p3)); } function log(uint p0, address p1, address p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,address,string)", p0, p1, p2, p3)); } function log(uint p0, address p1, address p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,address,bool)", p0, p1, p2, p3)); } function log(uint p0, address p1, address p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,address,address)", p0, p1, p2, p3)); } function log(string memory p0, uint p1, uint p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,uint,uint)", p0, p1, p2, p3)); } function log(string memory p0, uint p1, uint p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,uint,string)", p0, p1, p2, p3)); } function log(string memory p0, uint p1, uint p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,uint,bool)", p0, p1, p2, p3)); } function log(string memory p0, uint p1, uint p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,uint,address)", p0, p1, p2, p3)); } function log(string memory p0, uint p1, string memory p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,string,uint)", p0, p1, p2, p3)); } function log(string memory p0, uint p1, string memory p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,string,string)", p0, p1, p2, p3)); } function log(string memory p0, uint p1, string memory p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,string,bool)", p0, p1, p2, p3)); } function log(string memory p0, uint p1, string memory p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,string,address)", p0, p1, p2, p3)); } function log(string memory p0, uint p1, bool p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,bool,uint)", p0, p1, p2, p3)); } function log(string memory p0, uint p1, bool p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,bool,string)", p0, p1, p2, p3)); } function log(string memory p0, uint p1, bool p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,bool,bool)", p0, p1, p2, p3)); } function log(string memory p0, uint p1, bool p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,bool,address)", p0, p1, p2, p3)); } function log(string memory p0, uint p1, address p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,address,uint)", p0, p1, p2, p3)); } function log(string memory p0, uint p1, address p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,address,string)", p0, p1, p2, p3)); } function log(string memory p0, uint p1, address p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,address,bool)", p0, p1, p2, p3)); } function log(string memory p0, uint p1, address p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,address,address)", p0, p1, p2, p3)); } function log(string memory p0, string memory p1, uint p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string,uint,uint)", p0, p1, p2, p3)); } function log(string memory p0, string memory p1, uint p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string,uint,string)", p0, p1, p2, p3)); } function log(string memory p0, string memory p1, uint p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string,uint,bool)", p0, p1, p2, p3)); } function log(string memory p0, string memory p1, uint p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string,uint,address)", p0, p1, p2, p3)); } function log(string memory p0, string memory p1, string memory p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string,string,uint)", p0, p1, p2, p3)); } function log(string memory p0, string memory p1, string memory p2, string memory p3) internal view { _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 view { _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 view { _sendLogPayload(abi.encodeWithSignature("log(string,string,string,address)", p0, p1, p2, p3)); } function log(string memory p0, string memory p1, bool p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string,bool,uint)", p0, p1, p2, p3)); } function log(string memory p0, string memory p1, bool p2, string memory p3) internal view { _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 view { _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 view { _sendLogPayload(abi.encodeWithSignature("log(string,string,bool,address)", p0, p1, p2, p3)); } function log(string memory p0, string memory p1, address p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string,address,uint)", p0, p1, p2, p3)); } function log(string memory p0, string memory p1, address p2, string memory p3) internal view { _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 view { _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 view { _sendLogPayload(abi.encodeWithSignature("log(string,string,address,address)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, uint p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,uint,uint)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, uint p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,uint,string)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, uint p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,uint,bool)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, uint p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,uint,address)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, string memory p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,string,uint)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, string memory p2, string memory p3) internal view { _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 view { _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 view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,string,address)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, bool p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,bool,uint)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, bool p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,bool,string)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, bool p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,bool,bool)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, bool p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,bool,address)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, address p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,address,uint)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, address p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,address,string)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, address p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,address,bool)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, address p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,address,address)", p0, p1, p2, p3)); } function log(string memory p0, address p1, uint p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,uint,uint)", p0, p1, p2, p3)); } function log(string memory p0, address p1, uint p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,uint,string)", p0, p1, p2, p3)); } function log(string memory p0, address p1, uint p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,uint,bool)", p0, p1, p2, p3)); } function log(string memory p0, address p1, uint p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,uint,address)", p0, p1, p2, p3)); } function log(string memory p0, address p1, string memory p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,string,uint)", p0, p1, p2, p3)); } function log(string memory p0, address p1, string memory p2, string memory p3) internal view { _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 view { _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 view { _sendLogPayload(abi.encodeWithSignature("log(string,address,string,address)", p0, p1, p2, p3)); } function log(string memory p0, address p1, bool p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,bool,uint)", p0, p1, p2, p3)); } function log(string memory p0, address p1, bool p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,bool,string)", p0, p1, p2, p3)); } function log(string memory p0, address p1, bool p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,bool,bool)", p0, p1, p2, p3)); } function log(string memory p0, address p1, bool p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,bool,address)", p0, p1, p2, p3)); } function log(string memory p0, address p1, address p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,address,uint)", p0, p1, p2, p3)); } function log(string memory p0, address p1, address p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,address,string)", p0, p1, p2, p3)); } function log(string memory p0, address p1, address p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,address,bool)", p0, p1, p2, p3)); } function log(string memory p0, address p1, address p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,address,address)", p0, p1, p2, p3)); } function log(bool p0, uint p1, uint p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,uint,uint)", p0, p1, p2, p3)); } function log(bool p0, uint p1, uint p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,uint,string)", p0, p1, p2, p3)); } function log(bool p0, uint p1, uint p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,uint,bool)", p0, p1, p2, p3)); } function log(bool p0, uint p1, uint p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,uint,address)", p0, p1, p2, p3)); } function log(bool p0, uint p1, string memory p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,string,uint)", p0, p1, p2, p3)); } function log(bool p0, uint p1, string memory p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,string,string)", p0, p1, p2, p3)); } function log(bool p0, uint p1, string memory p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,string,bool)", p0, p1, p2, p3)); } function log(bool p0, uint p1, string memory p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,string,address)", p0, p1, p2, p3)); } function log(bool p0, uint p1, bool p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,bool,uint)", p0, p1, p2, p3)); } function log(bool p0, uint p1, bool p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,bool,string)", p0, p1, p2, p3)); } function log(bool p0, uint p1, bool p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,bool,bool)", p0, p1, p2, p3)); } function log(bool p0, uint p1, bool p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,bool,address)", p0, p1, p2, p3)); } function log(bool p0, uint p1, address p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,address,uint)", p0, p1, p2, p3)); } function log(bool p0, uint p1, address p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,address,string)", p0, p1, p2, p3)); } function log(bool p0, uint p1, address p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,address,bool)", p0, p1, p2, p3)); } function log(bool p0, uint p1, address p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,address,address)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, uint p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,uint,uint)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, uint p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,uint,string)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, uint p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,uint,bool)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, uint p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,uint,address)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, string memory p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,string,uint)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, string memory p2, string memory p3) internal view { _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 view { _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 view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,string,address)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, bool p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,bool,uint)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, bool p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,bool,string)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, bool p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,bool,bool)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, bool p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,bool,address)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, address p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,address,uint)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, address p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,address,string)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, address p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,address,bool)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, address p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,address,address)", p0, p1, p2, p3)); } function log(bool p0, bool p1, uint p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint,uint)", p0, p1, p2, p3)); } function log(bool p0, bool p1, uint p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint,string)", p0, p1, p2, p3)); } function log(bool p0, bool p1, uint p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint,bool)", p0, p1, p2, p3)); } function log(bool p0, bool p1, uint p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint,address)", p0, p1, p2, p3)); } function log(bool p0, bool p1, string memory p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,string,uint)", p0, p1, p2, p3)); } function log(bool p0, bool p1, string memory p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,string,string)", p0, p1, p2, p3)); } function log(bool p0, bool p1, string memory p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,string,bool)", p0, p1, p2, p3)); } function log(bool p0, bool p1, string memory p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,string,address)", p0, p1, p2, p3)); } function log(bool p0, bool p1, bool p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool,uint)", p0, p1, p2, p3)); } function log(bool p0, bool p1, bool p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool,string)", p0, p1, p2, p3)); } function log(bool p0, bool p1, bool p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool,bool)", p0, p1, p2, p3)); } function log(bool p0, bool p1, bool p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool,address)", p0, p1, p2, p3)); } function log(bool p0, bool p1, address p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,address,uint)", p0, p1, p2, p3)); } function log(bool p0, bool p1, address p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,address,string)", p0, p1, p2, p3)); } function log(bool p0, bool p1, address p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,address,bool)", p0, p1, p2, p3)); } function log(bool p0, bool p1, address p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,address,address)", p0, p1, p2, p3)); } function log(bool p0, address p1, uint p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,uint,uint)", p0, p1, p2, p3)); } function log(bool p0, address p1, uint p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,uint,string)", p0, p1, p2, p3)); } function log(bool p0, address p1, uint p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,uint,bool)", p0, p1, p2, p3)); } function log(bool p0, address p1, uint p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,uint,address)", p0, p1, p2, p3)); } function log(bool p0, address p1, string memory p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,string,uint)", p0, p1, p2, p3)); } function log(bool p0, address p1, string memory p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,string,string)", p0, p1, p2, p3)); } function log(bool p0, address p1, string memory p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,string,bool)", p0, p1, p2, p3)); } function log(bool p0, address p1, string memory p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,string,address)", p0, p1, p2, p3)); } function log(bool p0, address p1, bool p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,bool,uint)", p0, p1, p2, p3)); } function log(bool p0, address p1, bool p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,bool,string)", p0, p1, p2, p3)); } function log(bool p0, address p1, bool p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,bool,bool)", p0, p1, p2, p3)); } function log(bool p0, address p1, bool p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,bool,address)", p0, p1, p2, p3)); } function log(bool p0, address p1, address p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,address,uint)", p0, p1, p2, p3)); } function log(bool p0, address p1, address p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,address,string)", p0, p1, p2, p3)); } function log(bool p0, address p1, address p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,address,bool)", p0, p1, p2, p3)); } function log(bool p0, address p1, address p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,address,address)", p0, p1, p2, p3)); } function log(address p0, uint p1, uint p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,uint,uint)", p0, p1, p2, p3)); } function log(address p0, uint p1, uint p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,uint,string)", p0, p1, p2, p3)); } function log(address p0, uint p1, uint p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,uint,bool)", p0, p1, p2, p3)); } function log(address p0, uint p1, uint p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,uint,address)", p0, p1, p2, p3)); } function log(address p0, uint p1, string memory p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,string,uint)", p0, p1, p2, p3)); } function log(address p0, uint p1, string memory p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,string,string)", p0, p1, p2, p3)); } function log(address p0, uint p1, string memory p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,string,bool)", p0, p1, p2, p3)); } function log(address p0, uint p1, string memory p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,string,address)", p0, p1, p2, p3)); } function log(address p0, uint p1, bool p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,bool,uint)", p0, p1, p2, p3)); } function log(address p0, uint p1, bool p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,bool,string)", p0, p1, p2, p3)); } function log(address p0, uint p1, bool p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,bool,bool)", p0, p1, p2, p3)); } function log(address p0, uint p1, bool p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,bool,address)", p0, p1, p2, p3)); } function log(address p0, uint p1, address p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,address,uint)", p0, p1, p2, p3)); } function log(address p0, uint p1, address p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,address,string)", p0, p1, p2, p3)); } function log(address p0, uint p1, address p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,address,bool)", p0, p1, p2, p3)); } function log(address p0, uint p1, address p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,address,address)", p0, p1, p2, p3)); } function log(address p0, string memory p1, uint p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,uint,uint)", p0, p1, p2, p3)); } function log(address p0, string memory p1, uint p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,uint,string)", p0, p1, p2, p3)); } function log(address p0, string memory p1, uint p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,uint,bool)", p0, p1, p2, p3)); } function log(address p0, string memory p1, uint p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,uint,address)", p0, p1, p2, p3)); } function log(address p0, string memory p1, string memory p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,string,uint)", p0, p1, p2, p3)); } function log(address p0, string memory p1, string memory p2, string memory p3) internal view { _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 view { _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 view { _sendLogPayload(abi.encodeWithSignature("log(address,string,string,address)", p0, p1, p2, p3)); } function log(address p0, string memory p1, bool p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,bool,uint)", p0, p1, p2, p3)); } function log(address p0, string memory p1, bool p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,bool,string)", p0, p1, p2, p3)); } function log(address p0, string memory p1, bool p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,bool,bool)", p0, p1, p2, p3)); } function log(address p0, string memory p1, bool p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,bool,address)", p0, p1, p2, p3)); } function log(address p0, string memory p1, address p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,address,uint)", p0, p1, p2, p3)); } function log(address p0, string memory p1, address p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,address,string)", p0, p1, p2, p3)); } function log(address p0, string memory p1, address p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,address,bool)", p0, p1, p2, p3)); } function log(address p0, string memory p1, address p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,address,address)", p0, p1, p2, p3)); } function log(address p0, bool p1, uint p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,uint,uint)", p0, p1, p2, p3)); } function log(address p0, bool p1, uint p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,uint,string)", p0, p1, p2, p3)); } function log(address p0, bool p1, uint p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,uint,bool)", p0, p1, p2, p3)); } function log(address p0, bool p1, uint p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,uint,address)", p0, p1, p2, p3)); } function log(address p0, bool p1, string memory p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,string,uint)", p0, p1, p2, p3)); } function log(address p0, bool p1, string memory p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,string,string)", p0, p1, p2, p3)); } function log(address p0, bool p1, string memory p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,string,bool)", p0, p1, p2, p3)); } function log(address p0, bool p1, string memory p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,string,address)", p0, p1, p2, p3)); } function log(address p0, bool p1, bool p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,bool,uint)", p0, p1, p2, p3)); } function log(address p0, bool p1, bool p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,bool,string)", p0, p1, p2, p3)); } function log(address p0, bool p1, bool p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,bool,bool)", p0, p1, p2, p3)); } function log(address p0, bool p1, bool p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,bool,address)", p0, p1, p2, p3)); } function log(address p0, bool p1, address p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,address,uint)", p0, p1, p2, p3)); } function log(address p0, bool p1, address p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,address,string)", p0, p1, p2, p3)); } function log(address p0, bool p1, address p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,address,bool)", p0, p1, p2, p3)); } function log(address p0, bool p1, address p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,address,address)", p0, p1, p2, p3)); } function log(address p0, address p1, uint p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,uint,uint)", p0, p1, p2, p3)); } function log(address p0, address p1, uint p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,uint,string)", p0, p1, p2, p3)); } function log(address p0, address p1, uint p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,uint,bool)", p0, p1, p2, p3)); } function log(address p0, address p1, uint p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,uint,address)", p0, p1, p2, p3)); } function log(address p0, address p1, string memory p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,string,uint)", p0, p1, p2, p3)); } function log(address p0, address p1, string memory p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,string,string)", p0, p1, p2, p3)); } function log(address p0, address p1, string memory p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,string,bool)", p0, p1, p2, p3)); } function log(address p0, address p1, string memory p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,string,address)", p0, p1, p2, p3)); } function log(address p0, address p1, bool p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,bool,uint)", p0, p1, p2, p3)); } function log(address p0, address p1, bool p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,bool,string)", p0, p1, p2, p3)); } function log(address p0, address p1, bool p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,bool,bool)", p0, p1, p2, p3)); } function log(address p0, address p1, bool p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,bool,address)", p0, p1, p2, p3)); } function log(address p0, address p1, address p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,address,uint)", p0, p1, p2, p3)); } function log(address p0, address p1, address p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,address,string)", p0, p1, p2, p3)); } function log(address p0, address p1, address p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,address,bool)", p0, p1, p2, p3)); } function log(address p0, address p1, address p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,address,address)", p0, p1, p2, p3)); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.4.22 <0.9.0; /// @dev The original console.sol uses `int` and `uint` for computing function selectors, but it should /// use `int256` and `uint256`. This modified version fixes that. This version is recommended /// over `console.sol` if you don't need compatibility with Hardhat as the logs will show up in /// forge stack traces. If you do need compatibility with Hardhat, you must use `console.sol`. /// Reference: https://github.com/NomicFoundation/hardhat/issues/2178 library console2 { address constant CONSOLE_ADDRESS = address(0x000000000000000000636F6e736F6c652e6c6f67); function _sendLogPayload(bytes memory payload) private view { uint256 payloadLength = payload.length; address consoleAddress = CONSOLE_ADDRESS; /// @solidity memory-safe-assembly assembly { let payloadStart := add(payload, 32) let r := staticcall(gas(), consoleAddress, payloadStart, payloadLength, 0, 0) } } function log() internal view { _sendLogPayload(abi.encodeWithSignature("log()")); } function logInt(int256 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(int256)", p0)); } function logUint(uint256 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint256)", p0)); } function logString(string memory p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(string)", p0)); } function logBool(bool p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool)", p0)); } function logAddress(address p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(address)", p0)); } function logBytes(bytes memory p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes)", p0)); } function logBytes1(bytes1 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes1)", p0)); } function logBytes2(bytes2 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes2)", p0)); } function logBytes3(bytes3 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes3)", p0)); } function logBytes4(bytes4 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes4)", p0)); } function logBytes5(bytes5 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes5)", p0)); } function logBytes6(bytes6 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes6)", p0)); } function logBytes7(bytes7 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes7)", p0)); } function logBytes8(bytes8 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes8)", p0)); } function logBytes9(bytes9 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes9)", p0)); } function logBytes10(bytes10 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes10)", p0)); } function logBytes11(bytes11 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes11)", p0)); } function logBytes12(bytes12 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes12)", p0)); } function logBytes13(bytes13 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes13)", p0)); } function logBytes14(bytes14 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes14)", p0)); } function logBytes15(bytes15 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes15)", p0)); } function logBytes16(bytes16 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes16)", p0)); } function logBytes17(bytes17 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes17)", p0)); } function logBytes18(bytes18 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes18)", p0)); } function logBytes19(bytes19 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes19)", p0)); } function logBytes20(bytes20 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes20)", p0)); } function logBytes21(bytes21 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes21)", p0)); } function logBytes22(bytes22 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes22)", p0)); } function logBytes23(bytes23 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes23)", p0)); } function logBytes24(bytes24 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes24)", p0)); } function logBytes25(bytes25 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes25)", p0)); } function logBytes26(bytes26 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes26)", p0)); } function logBytes27(bytes27 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes27)", p0)); } function logBytes28(bytes28 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes28)", p0)); } function logBytes29(bytes29 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes29)", p0)); } function logBytes30(bytes30 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes30)", p0)); } function logBytes31(bytes31 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes31)", p0)); } function logBytes32(bytes32 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes32)", p0)); } function log(uint256 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint256)", p0)); } function log(int256 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(int256)", p0)); } function log(string memory p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(string)", p0)); } function log(bool p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool)", p0)); } function log(address p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(address)", p0)); } function log(uint256 p0, uint256 p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256)", p0, p1)); } function log(uint256 p0, string memory p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint256,string)", p0, p1)); } function log(uint256 p0, bool p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint256,bool)", p0, p1)); } function log(uint256 p0, address p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint256,address)", p0, p1)); } function log(string memory p0, uint256 p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint256)", p0, p1)); } function log(string memory p0, int256 p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,int256)", p0, p1)); } function log(string memory p0, string memory p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string)", p0, p1)); } function log(string memory p0, bool p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool)", p0, p1)); } function log(string memory p0, address p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address)", p0, p1)); } function log(bool p0, uint256 p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint256)", p0, p1)); } function log(bool p0, string memory p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string)", p0, p1)); } function log(bool p0, bool p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool)", p0, p1)); } function log(bool p0, address p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address)", p0, p1)); } function log(address p0, uint256 p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint256)", p0, p1)); } function log(address p0, string memory p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string)", p0, p1)); } function log(address p0, bool p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool)", p0, p1)); } function log(address p0, address p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address)", p0, p1)); } function log(uint256 p0, uint256 p1, uint256 p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,uint256)", p0, p1, p2)); } function log(uint256 p0, uint256 p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,string)", p0, p1, p2)); } function log(uint256 p0, uint256 p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,bool)", p0, p1, p2)); } function log(uint256 p0, uint256 p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,address)", p0, p1, p2)); } function log(uint256 p0, string memory p1, uint256 p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint256,string,uint256)", p0, p1, p2)); } function log(uint256 p0, string memory p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint256,string,string)", p0, p1, p2)); } function log(uint256 p0, string memory p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint256,string,bool)", p0, p1, p2)); } function log(uint256 p0, string memory p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint256,string,address)", p0, p1, p2)); } function log(uint256 p0, bool p1, uint256 p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint256,bool,uint256)", p0, p1, p2)); } function log(uint256 p0, bool p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint256,bool,string)", p0, p1, p2)); } function log(uint256 p0, bool p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint256,bool,bool)", p0, p1, p2)); } function log(uint256 p0, bool p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint256,bool,address)", p0, p1, p2)); } function log(uint256 p0, address p1, uint256 p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint256,address,uint256)", p0, p1, p2)); } function log(uint256 p0, address p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint256,address,string)", p0, p1, p2)); } function log(uint256 p0, address p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint256,address,bool)", p0, p1, p2)); } function log(uint256 p0, address p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint256,address,address)", p0, p1, p2)); } function log(string memory p0, uint256 p1, uint256 p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint256,uint256)", p0, p1, p2)); } function log(string memory p0, uint256 p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint256,string)", p0, p1, p2)); } function log(string memory p0, uint256 p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint256,bool)", p0, p1, p2)); } function log(string memory p0, uint256 p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint256,address)", p0, p1, p2)); } function log(string memory p0, string memory p1, uint256 p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string,uint256)", p0, p1, p2)); } function log(string memory p0, string memory p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string,string)", p0, p1, p2)); } function log(string memory p0, string memory p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string,bool)", p0, p1, p2)); } function log(string memory p0, string memory p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string,address)", p0, p1, p2)); } function log(string memory p0, bool p1, uint256 p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,uint256)", p0, p1, p2)); } function log(string memory p0, bool p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,string)", p0, p1, p2)); } function log(string memory p0, bool p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,bool)", p0, p1, p2)); } function log(string memory p0, bool p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,address)", p0, p1, p2)); } function log(string memory p0, address p1, uint256 p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,uint256)", p0, p1, p2)); } function log(string memory p0, address p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,string)", p0, p1, p2)); } function log(string memory p0, address p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,bool)", p0, p1, p2)); } function log(string memory p0, address p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,address)", p0, p1, p2)); } function log(bool p0, uint256 p1, uint256 p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint256,uint256)", p0, p1, p2)); } function log(bool p0, uint256 p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint256,string)", p0, p1, p2)); } function log(bool p0, uint256 p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint256,bool)", p0, p1, p2)); } function log(bool p0, uint256 p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint256,address)", p0, p1, p2)); } function log(bool p0, string memory p1, uint256 p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,uint256)", p0, p1, p2)); } function log(bool p0, string memory p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,string)", p0, p1, p2)); } function log(bool p0, string memory p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,bool)", p0, p1, p2)); } function log(bool p0, string memory p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,address)", p0, p1, p2)); } function log(bool p0, bool p1, uint256 p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint256)", p0, p1, p2)); } function log(bool p0, bool p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,string)", p0, p1, p2)); } function log(bool p0, bool p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool)", p0, p1, p2)); } function log(bool p0, bool p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,address)", p0, p1, p2)); } function log(bool p0, address p1, uint256 p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,uint256)", p0, p1, p2)); } function log(bool p0, address p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,string)", p0, p1, p2)); } function log(bool p0, address p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,bool)", p0, p1, p2)); } function log(bool p0, address p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,address)", p0, p1, p2)); } function log(address p0, uint256 p1, uint256 p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint256,uint256)", p0, p1, p2)); } function log(address p0, uint256 p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint256,string)", p0, p1, p2)); } function log(address p0, uint256 p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint256,bool)", p0, p1, p2)); } function log(address p0, uint256 p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint256,address)", p0, p1, p2)); } function log(address p0, string memory p1, uint256 p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,uint256)", p0, p1, p2)); } function log(address p0, string memory p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,string)", p0, p1, p2)); } function log(address p0, string memory p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,bool)", p0, p1, p2)); } function log(address p0, string memory p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,address)", p0, p1, p2)); } function log(address p0, bool p1, uint256 p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,uint256)", p0, p1, p2)); } function log(address p0, bool p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,string)", p0, p1, p2)); } function log(address p0, bool p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,bool)", p0, p1, p2)); } function log(address p0, bool p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,address)", p0, p1, p2)); } function log(address p0, address p1, uint256 p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,uint256)", p0, p1, p2)); } function log(address p0, address p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,string)", p0, p1, p2)); } function log(address p0, address p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,bool)", p0, p1, p2)); } function log(address p0, address p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,address)", p0, p1, p2)); } function log(uint256 p0, uint256 p1, uint256 p2, uint256 p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,uint256,uint256)", p0, p1, p2, p3)); } function log(uint256 p0, uint256 p1, uint256 p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,uint256,string)", p0, p1, p2, p3)); } function log(uint256 p0, uint256 p1, uint256 p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,uint256,bool)", p0, p1, p2, p3)); } function log(uint256 p0, uint256 p1, uint256 p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,uint256,address)", p0, p1, p2, p3)); } function log(uint256 p0, uint256 p1, string memory p2, uint256 p3) internal view { _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 view { _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,string,string)", p0, p1, p2, p3)); } function log(uint256 p0, uint256 p1, string memory p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,string,bool)", p0, p1, p2, p3)); } function log(uint256 p0, uint256 p1, string memory p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,string,address)", p0, p1, p2, p3)); } function log(uint256 p0, uint256 p1, bool p2, uint256 p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,bool,uint256)", p0, p1, p2, p3)); } function log(uint256 p0, uint256 p1, bool p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,bool,string)", p0, p1, p2, p3)); } function log(uint256 p0, uint256 p1, bool p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,bool,bool)", p0, p1, p2, p3)); } function log(uint256 p0, uint256 p1, bool p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,bool,address)", p0, p1, p2, p3)); } function log(uint256 p0, uint256 p1, address p2, uint256 p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,address,uint256)", p0, p1, p2, p3)); } function log(uint256 p0, uint256 p1, address p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,address,string)", p0, p1, p2, p3)); } function log(uint256 p0, uint256 p1, address p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,address,bool)", p0, p1, p2, p3)); } function log(uint256 p0, uint256 p1, address p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,address,address)", p0, p1, p2, p3)); } function log(uint256 p0, string memory p1, uint256 p2, uint256 p3) internal view { _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 view { _sendLogPayload(abi.encodeWithSignature("log(uint256,string,uint256,string)", p0, p1, p2, p3)); } function log(uint256 p0, string memory p1, uint256 p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint256,string,uint256,bool)", p0, p1, p2, p3)); } function log(uint256 p0, string memory p1, uint256 p2, address p3) internal view { _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 view { _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 view { _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 view { _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 view { _sendLogPayload(abi.encodeWithSignature("log(uint256,string,string,address)", p0, p1, p2, p3)); } function log(uint256 p0, string memory p1, bool p2, uint256 p3) internal view { _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 view { _sendLogPayload(abi.encodeWithSignature("log(uint256,string,bool,string)", p0, p1, p2, p3)); } function log(uint256 p0, string memory p1, bool p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint256,string,bool,bool)", p0, p1, p2, p3)); } function log(uint256 p0, string memory p1, bool p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint256,string,bool,address)", p0, p1, p2, p3)); } function log(uint256 p0, string memory p1, address p2, uint256 p3) internal view { _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 view { _sendLogPayload(abi.encodeWithSignature("log(uint256,string,address,string)", p0, p1, p2, p3)); } function log(uint256 p0, string memory p1, address p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint256,string,address,bool)", p0, p1, p2, p3)); } function log(uint256 p0, string memory p1, address p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint256,string,address,address)", p0, p1, p2, p3)); } function log(uint256 p0, bool p1, uint256 p2, uint256 p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint256,bool,uint256,uint256)", p0, p1, p2, p3)); } function log(uint256 p0, bool p1, uint256 p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint256,bool,uint256,string)", p0, p1, p2, p3)); } function log(uint256 p0, bool p1, uint256 p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint256,bool,uint256,bool)", p0, p1, p2, p3)); } function log(uint256 p0, bool p1, uint256 p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint256,bool,uint256,address)", p0, p1, p2, p3)); } function log(uint256 p0, bool p1, string memory p2, uint256 p3) internal view { _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 view { _sendLogPayload(abi.encodeWithSignature("log(uint256,bool,string,string)", p0, p1, p2, p3)); } function log(uint256 p0, bool p1, string memory p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint256,bool,string,bool)", p0, p1, p2, p3)); } function log(uint256 p0, bool p1, string memory p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint256,bool,string,address)", p0, p1, p2, p3)); } function log(uint256 p0, bool p1, bool p2, uint256 p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint256,bool,bool,uint256)", p0, p1, p2, p3)); } function log(uint256 p0, bool p1, bool p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint256,bool,bool,string)", p0, p1, p2, p3)); } function log(uint256 p0, bool p1, bool p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint256,bool,bool,bool)", p0, p1, p2, p3)); } function log(uint256 p0, bool p1, bool p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint256,bool,bool,address)", p0, p1, p2, p3)); } function log(uint256 p0, bool p1, address p2, uint256 p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint256,bool,address,uint256)", p0, p1, p2, p3)); } function log(uint256 p0, bool p1, address p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint256,bool,address,string)", p0, p1, p2, p3)); } function log(uint256 p0, bool p1, address p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint256,bool,address,bool)", p0, p1, p2, p3)); } function log(uint256 p0, bool p1, address p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint256,bool,address,address)", p0, p1, p2, p3)); } function log(uint256 p0, address p1, uint256 p2, uint256 p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint256,address,uint256,uint256)", p0, p1, p2, p3)); } function log(uint256 p0, address p1, uint256 p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint256,address,uint256,string)", p0, p1, p2, p3)); } function log(uint256 p0, address p1, uint256 p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint256,address,uint256,bool)", p0, p1, p2, p3)); } function log(uint256 p0, address p1, uint256 p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint256,address,uint256,address)", p0, p1, p2, p3)); } function log(uint256 p0, address p1, string memory p2, uint256 p3) internal view { _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 view { _sendLogPayload(abi.encodeWithSignature("log(uint256,address,string,string)", p0, p1, p2, p3)); } function log(uint256 p0, address p1, string memory p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint256,address,string,bool)", p0, p1, p2, p3)); } function log(uint256 p0, address p1, string memory p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint256,address,string,address)", p0, p1, p2, p3)); } function log(uint256 p0, address p1, bool p2, uint256 p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint256,address,bool,uint256)", p0, p1, p2, p3)); } function log(uint256 p0, address p1, bool p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint256,address,bool,string)", p0, p1, p2, p3)); } function log(uint256 p0, address p1, bool p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint256,address,bool,bool)", p0, p1, p2, p3)); } function log(uint256 p0, address p1, bool p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint256,address,bool,address)", p0, p1, p2, p3)); } function log(uint256 p0, address p1, address p2, uint256 p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint256,address,address,uint256)", p0, p1, p2, p3)); } function log(uint256 p0, address p1, address p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint256,address,address,string)", p0, p1, p2, p3)); } function log(uint256 p0, address p1, address p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint256,address,address,bool)", p0, p1, p2, p3)); } function log(uint256 p0, address p1, address p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint256,address,address,address)", p0, p1, p2, p3)); } function log(string memory p0, uint256 p1, uint256 p2, uint256 p3) internal view { _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 view { _sendLogPayload(abi.encodeWithSignature("log(string,uint256,uint256,string)", p0, p1, p2, p3)); } function log(string memory p0, uint256 p1, uint256 p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint256,uint256,bool)", p0, p1, p2, p3)); } function log(string memory p0, uint256 p1, uint256 p2, address p3) internal view { _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 view { _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 view { _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 view { _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 view { _sendLogPayload(abi.encodeWithSignature("log(string,uint256,string,address)", p0, p1, p2, p3)); } function log(string memory p0, uint256 p1, bool p2, uint256 p3) internal view { _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 view { _sendLogPayload(abi.encodeWithSignature("log(string,uint256,bool,string)", p0, p1, p2, p3)); } function log(string memory p0, uint256 p1, bool p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint256,bool,bool)", p0, p1, p2, p3)); } function log(string memory p0, uint256 p1, bool p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint256,bool,address)", p0, p1, p2, p3)); } function log(string memory p0, uint256 p1, address p2, uint256 p3) internal view { _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 view { _sendLogPayload(abi.encodeWithSignature("log(string,uint256,address,string)", p0, p1, p2, p3)); } function log(string memory p0, uint256 p1, address p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint256,address,bool)", p0, p1, p2, p3)); } function log(string memory p0, uint256 p1, address p2, address p3) internal view { _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 view { _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 view { _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 view { _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 view { _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 view { _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 view { _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 view { _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 view { _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 view { _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 view { _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 view { _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 view { _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 view { _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 view { _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 view { _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 view { _sendLogPayload(abi.encodeWithSignature("log(string,string,address,address)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, uint256 p2, uint256 p3) internal view { _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 view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,uint256,string)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, uint256 p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,uint256,bool)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, uint256 p2, address p3) internal view { _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 view { _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 view { _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 view { _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 view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,string,address)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, bool p2, uint256 p3) internal view { _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 view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,bool,string)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, bool p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,bool,bool)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, bool p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,bool,address)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, address p2, uint256 p3) internal view { _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 view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,address,string)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, address p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,address,bool)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, address p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,address,address)", p0, p1, p2, p3)); } function log(string memory p0, address p1, uint256 p2, uint256 p3) internal view { _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 view { _sendLogPayload(abi.encodeWithSignature("log(string,address,uint256,string)", p0, p1, p2, p3)); } function log(string memory p0, address p1, uint256 p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,uint256,bool)", p0, p1, p2, p3)); } function log(string memory p0, address p1, uint256 p2, address p3) internal view { _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 view { _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 view { _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 view { _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 view { _sendLogPayload(abi.encodeWithSignature("log(string,address,string,address)", p0, p1, p2, p3)); } function log(string memory p0, address p1, bool p2, uint256 p3) internal view { _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 view { _sendLogPayload(abi.encodeWithSignature("log(string,address,bool,string)", p0, p1, p2, p3)); } function log(string memory p0, address p1, bool p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,bool,bool)", p0, p1, p2, p3)); } function log(string memory p0, address p1, bool p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,bool,address)", p0, p1, p2, p3)); } function log(string memory p0, address p1, address p2, uint256 p3) internal view { _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 view { _sendLogPayload(abi.encodeWithSignature("log(string,address,address,string)", p0, p1, p2, p3)); } function log(string memory p0, address p1, address p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,address,bool)", p0, p1, p2, p3)); } function log(string memory p0, address p1, address p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,address,address)", p0, p1, p2, p3)); } function log(bool p0, uint256 p1, uint256 p2, uint256 p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint256,uint256,uint256)", p0, p1, p2, p3)); } function log(bool p0, uint256 p1, uint256 p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint256,uint256,string)", p0, p1, p2, p3)); } function log(bool p0, uint256 p1, uint256 p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint256,uint256,bool)", p0, p1, p2, p3)); } function log(bool p0, uint256 p1, uint256 p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint256,uint256,address)", p0, p1, p2, p3)); } function log(bool p0, uint256 p1, string memory p2, uint256 p3) internal view { _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 view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint256,string,string)", p0, p1, p2, p3)); } function log(bool p0, uint256 p1, string memory p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint256,string,bool)", p0, p1, p2, p3)); } function log(bool p0, uint256 p1, string memory p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint256,string,address)", p0, p1, p2, p3)); } function log(bool p0, uint256 p1, bool p2, uint256 p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint256,bool,uint256)", p0, p1, p2, p3)); } function log(bool p0, uint256 p1, bool p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint256,bool,string)", p0, p1, p2, p3)); } function log(bool p0, uint256 p1, bool p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint256,bool,bool)", p0, p1, p2, p3)); } function log(bool p0, uint256 p1, bool p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint256,bool,address)", p0, p1, p2, p3)); } function log(bool p0, uint256 p1, address p2, uint256 p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint256,address,uint256)", p0, p1, p2, p3)); } function log(bool p0, uint256 p1, address p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint256,address,string)", p0, p1, p2, p3)); } function log(bool p0, uint256 p1, address p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint256,address,bool)", p0, p1, p2, p3)); } function log(bool p0, uint256 p1, address p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint256,address,address)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, uint256 p2, uint256 p3) internal view { _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 view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,uint256,string)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, uint256 p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,uint256,bool)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, uint256 p2, address p3) internal view { _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 view { _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 view { _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 view { _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 view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,string,address)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, bool p2, uint256 p3) internal view { _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 view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,bool,string)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, bool p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,bool,bool)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, bool p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,bool,address)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, address p2, uint256 p3) internal view { _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 view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,address,string)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, address p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,address,bool)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, address p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,address,address)", p0, p1, p2, p3)); } function log(bool p0, bool p1, uint256 p2, uint256 p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint256,uint256)", p0, p1, p2, p3)); } function log(bool p0, bool p1, uint256 p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint256,string)", p0, p1, p2, p3)); } function log(bool p0, bool p1, uint256 p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint256,bool)", p0, p1, p2, p3)); } function log(bool p0, bool p1, uint256 p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint256,address)", p0, p1, p2, p3)); } function log(bool p0, bool p1, string memory p2, uint256 p3) internal view { _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 view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,string,string)", p0, p1, p2, p3)); } function log(bool p0, bool p1, string memory p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,string,bool)", p0, p1, p2, p3)); } function log(bool p0, bool p1, string memory p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,string,address)", p0, p1, p2, p3)); } function log(bool p0, bool p1, bool p2, uint256 p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool,uint256)", p0, p1, p2, p3)); } function log(bool p0, bool p1, bool p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool,string)", p0, p1, p2, p3)); } function log(bool p0, bool p1, bool p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool,bool)", p0, p1, p2, p3)); } function log(bool p0, bool p1, bool p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool,address)", p0, p1, p2, p3)); } function log(bool p0, bool p1, address p2, uint256 p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,address,uint256)", p0, p1, p2, p3)); } function log(bool p0, bool p1, address p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,address,string)", p0, p1, p2, p3)); } function log(bool p0, bool p1, address p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,address,bool)", p0, p1, p2, p3)); } function log(bool p0, bool p1, address p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,address,address)", p0, p1, p2, p3)); } function log(bool p0, address p1, uint256 p2, uint256 p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,uint256,uint256)", p0, p1, p2, p3)); } function log(bool p0, address p1, uint256 p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,uint256,string)", p0, p1, p2, p3)); } function log(bool p0, address p1, uint256 p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,uint256,bool)", p0, p1, p2, p3)); } function log(bool p0, address p1, uint256 p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,uint256,address)", p0, p1, p2, p3)); } function log(bool p0, address p1, string memory p2, uint256 p3) internal view { _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 view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,string,string)", p0, p1, p2, p3)); } function log(bool p0, address p1, string memory p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,string,bool)", p0, p1, p2, p3)); } function log(bool p0, address p1, string memory p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,string,address)", p0, p1, p2, p3)); } function log(bool p0, address p1, bool p2, uint256 p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,bool,uint256)", p0, p1, p2, p3)); } function log(bool p0, address p1, bool p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,bool,string)", p0, p1, p2, p3)); } function log(bool p0, address p1, bool p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,bool,bool)", p0, p1, p2, p3)); } function log(bool p0, address p1, bool p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,bool,address)", p0, p1, p2, p3)); } function log(bool p0, address p1, address p2, uint256 p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,address,uint256)", p0, p1, p2, p3)); } function log(bool p0, address p1, address p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,address,string)", p0, p1, p2, p3)); } function log(bool p0, address p1, address p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,address,bool)", p0, p1, p2, p3)); } function log(bool p0, address p1, address p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,address,address)", p0, p1, p2, p3)); } function log(address p0, uint256 p1, uint256 p2, uint256 p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint256,uint256,uint256)", p0, p1, p2, p3)); } function log(address p0, uint256 p1, uint256 p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint256,uint256,string)", p0, p1, p2, p3)); } function log(address p0, uint256 p1, uint256 p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint256,uint256,bool)", p0, p1, p2, p3)); } function log(address p0, uint256 p1, uint256 p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint256,uint256,address)", p0, p1, p2, p3)); } function log(address p0, uint256 p1, string memory p2, uint256 p3) internal view { _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 view { _sendLogPayload(abi.encodeWithSignature("log(address,uint256,string,string)", p0, p1, p2, p3)); } function log(address p0, uint256 p1, string memory p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint256,string,bool)", p0, p1, p2, p3)); } function log(address p0, uint256 p1, string memory p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint256,string,address)", p0, p1, p2, p3)); } function log(address p0, uint256 p1, bool p2, uint256 p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint256,bool,uint256)", p0, p1, p2, p3)); } function log(address p0, uint256 p1, bool p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint256,bool,string)", p0, p1, p2, p3)); } function log(address p0, uint256 p1, bool p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint256,bool,bool)", p0, p1, p2, p3)); } function log(address p0, uint256 p1, bool p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint256,bool,address)", p0, p1, p2, p3)); } function log(address p0, uint256 p1, address p2, uint256 p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint256,address,uint256)", p0, p1, p2, p3)); } function log(address p0, uint256 p1, address p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint256,address,string)", p0, p1, p2, p3)); } function log(address p0, uint256 p1, address p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint256,address,bool)", p0, p1, p2, p3)); } function log(address p0, uint256 p1, address p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint256,address,address)", p0, p1, p2, p3)); } function log(address p0, string memory p1, uint256 p2, uint256 p3) internal view { _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 view { _sendLogPayload(abi.encodeWithSignature("log(address,string,uint256,string)", p0, p1, p2, p3)); } function log(address p0, string memory p1, uint256 p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,uint256,bool)", p0, p1, p2, p3)); } function log(address p0, string memory p1, uint256 p2, address p3) internal view { _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 view { _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 view { _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 view { _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 view { _sendLogPayload(abi.encodeWithSignature("log(address,string,string,address)", p0, p1, p2, p3)); } function log(address p0, string memory p1, bool p2, uint256 p3) internal view { _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 view { _sendLogPayload(abi.encodeWithSignature("log(address,string,bool,string)", p0, p1, p2, p3)); } function log(address p0, string memory p1, bool p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,bool,bool)", p0, p1, p2, p3)); } function log(address p0, string memory p1, bool p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,bool,address)", p0, p1, p2, p3)); } function log(address p0, string memory p1, address p2, uint256 p3) internal view { _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 view { _sendLogPayload(abi.encodeWithSignature("log(address,string,address,string)", p0, p1, p2, p3)); } function log(address p0, string memory p1, address p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,address,bool)", p0, p1, p2, p3)); } function log(address p0, string memory p1, address p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,address,address)", p0, p1, p2, p3)); } function log(address p0, bool p1, uint256 p2, uint256 p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,uint256,uint256)", p0, p1, p2, p3)); } function log(address p0, bool p1, uint256 p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,uint256,string)", p0, p1, p2, p3)); } function log(address p0, bool p1, uint256 p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,uint256,bool)", p0, p1, p2, p3)); } function log(address p0, bool p1, uint256 p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,uint256,address)", p0, p1, p2, p3)); } function log(address p0, bool p1, string memory p2, uint256 p3) internal view { _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 view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,string,string)", p0, p1, p2, p3)); } function log(address p0, bool p1, string memory p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,string,bool)", p0, p1, p2, p3)); } function log(address p0, bool p1, string memory p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,string,address)", p0, p1, p2, p3)); } function log(address p0, bool p1, bool p2, uint256 p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,bool,uint256)", p0, p1, p2, p3)); } function log(address p0, bool p1, bool p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,bool,string)", p0, p1, p2, p3)); } function log(address p0, bool p1, bool p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,bool,bool)", p0, p1, p2, p3)); } function log(address p0, bool p1, bool p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,bool,address)", p0, p1, p2, p3)); } function log(address p0, bool p1, address p2, uint256 p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,address,uint256)", p0, p1, p2, p3)); } function log(address p0, bool p1, address p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,address,string)", p0, p1, p2, p3)); } function log(address p0, bool p1, address p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,address,bool)", p0, p1, p2, p3)); } function log(address p0, bool p1, address p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,address,address)", p0, p1, p2, p3)); } function log(address p0, address p1, uint256 p2, uint256 p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,uint256,uint256)", p0, p1, p2, p3)); } function log(address p0, address p1, uint256 p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,uint256,string)", p0, p1, p2, p3)); } function log(address p0, address p1, uint256 p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,uint256,bool)", p0, p1, p2, p3)); } function log(address p0, address p1, uint256 p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,uint256,address)", p0, p1, p2, p3)); } function log(address p0, address p1, string memory p2, uint256 p3) internal view { _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 view { _sendLogPayload(abi.encodeWithSignature("log(address,address,string,string)", p0, p1, p2, p3)); } function log(address p0, address p1, string memory p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,string,bool)", p0, p1, p2, p3)); } function log(address p0, address p1, string memory p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,string,address)", p0, p1, p2, p3)); } function log(address p0, address p1, bool p2, uint256 p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,bool,uint256)", p0, p1, p2, p3)); } function log(address p0, address p1, bool p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,bool,string)", p0, p1, p2, p3)); } function log(address p0, address p1, bool p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,bool,bool)", p0, p1, p2, p3)); } function log(address p0, address p1, bool p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,bool,address)", p0, p1, p2, p3)); } function log(address p0, address p1, address p2, uint256 p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,address,uint256)", p0, p1, p2, p3)); } function log(address p0, address p1, address p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,address,string)", p0, p1, p2, p3)); } function log(address p0, address p1, address p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,address,bool)", p0, p1, p2, p3)); } function log(address p0, address p1, address p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,address,address)", p0, p1, p2, p3)); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.2 <0.9.0; pragma experimental ABIEncoderV2; interface IMulticall3 { struct Call { address target; bytes callData; } struct Call3 { address target; bool allowFailure; bytes callData; } struct Call3Value { address target; bool allowFailure; uint256 value; bytes callData; } struct Result { bool success; bytes returnData; } function aggregate(Call[] calldata calls) external payable returns (uint256 blockNumber, bytes[] memory returnData); function aggregate3(Call3[] calldata calls) external payable returns (Result[] memory returnData); function aggregate3Value(Call3Value[] calldata calls) external payable returns (Result[] memory returnData); function blockAndAggregate(Call[] calldata calls) external payable returns (uint256 blockNumber, bytes32 blockHash, Result[] memory returnData); function getBasefee() external view returns (uint256 basefee); function getBlockHash(uint256 blockNumber) external view returns (bytes32 blockHash); function getBlockNumber() external view returns (uint256 blockNumber); function getChainId() external view returns (uint256 chainid); function getCurrentBlockCoinbase() external view returns (address coinbase); function getCurrentBlockDifficulty() external view returns (uint256 difficulty); function getCurrentBlockGasLimit() external view returns (uint256 gaslimit); function getCurrentBlockTimestamp() external view returns (uint256 timestamp); function getEthBalance(address addr) external view returns (uint256 balance); function getLastBlockHash() external view returns (bytes32 blockHash); function tryAggregate(bool requireSuccess, Call[] calldata calls) external payable returns (Result[] memory returnData); function tryBlockAndAggregate(bool requireSuccess, Call[] calldata calls) external payable returns (uint256 blockNumber, bytes32 blockHash, Result[] memory returnData); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.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: * * ``` * 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}: * * ``` * 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. */ 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 (last updated v4.5.0) (access/AccessControlEnumerable.sol) pragma solidity ^0.8.0; import "./IAccessControlEnumerable.sol"; import "./AccessControl.sol"; import "../utils/structs/EnumerableSet.sol"; /** * @dev Extension of {AccessControl} that allows enumerating the members of each role. */ abstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl { using EnumerableSet for EnumerableSet.AddressSet; mapping(bytes32 => EnumerableSet.AddressSet) private _roleMembers; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) public view virtual override returns (address) { return _roleMembers[role].at(index); } /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) public view virtual override returns (uint256) { return _roleMembers[role].length(); } /** * @dev Overload {_grantRole} to track enumerable memberships */ function _grantRole(bytes32 role, address account) internal virtual override { super._grantRole(role, account); _roleMembers[role].add(account); } /** * @dev Overload {_revokeRole} to track enumerable memberships */ function _revokeRole(bytes32 role, address account) internal virtual override { super._revokeRole(role, account); _roleMembers[role].remove(account); } }
// 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 v4.4.1 (access/IAccessControlEnumerable.sol) pragma solidity ^0.8.0; import "./IAccessControl.sol"; /** * @dev External interface of AccessControlEnumerable declared to support ERC165 detection. */ interface IAccessControlEnumerable is IAccessControl { /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) external view returns (address); /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) external view returns (uint256); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.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; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/ERC721.sol) pragma solidity ^0.8.0; import "./IERC721.sol"; import "./IERC721Receiver.sol"; import "./extensions/IERC721Metadata.sol"; import "../../utils/Address.sol"; import "../../utils/Context.sol"; import "../../utils/Strings.sol"; import "../../utils/introspection/ERC165.sol"; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: address zero is not a valid owner"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _ownerOf(tokenId); require(owner != address(0), "ERC721: invalid token ID"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { _requireMinted(tokenId); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overridden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not token owner or approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { _requireMinted(tokenId); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { _setApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner or approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner or approved"); _safeTransfer(from, to, tokenId, data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist */ function _ownerOf(uint256 tokenId) internal view virtual returns (address) { return _owners[tokenId]; } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _ownerOf(tokenId) != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { address owner = ERC721.ownerOf(tokenId); return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint( address to, uint256 tokenId, bytes memory data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId, 1); // Check that tokenId was not minted by `_beforeTokenTransfer` hook require(!_exists(tokenId), "ERC721: token already minted"); unchecked { // Will not overflow unless all 2**256 token ids are minted to the same owner. // Given that tokens are minted one by one, it is impossible in practice that // this ever happens. Might change if we allow batch minting. // The ERC fails to describe this case. _balances[to] += 1; } _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); _afterTokenTransfer(address(0), to, tokenId, 1); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * This is an internal function that does not check if the sender is authorized to operate on the token. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId, 1); // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook owner = ERC721.ownerOf(tokenId); // Clear approvals delete _tokenApprovals[tokenId]; unchecked { // Cannot overflow, as that would require more tokens to be burned/transferred // out than the owner initially received through minting and transferring in. _balances[owner] -= 1; } delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); _afterTokenTransfer(owner, address(0), tokenId, 1); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId, 1); // Check that tokenId was not transferred by `_beforeTokenTransfer` hook require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner"); // Clear approvals from the previous owner delete _tokenApprovals[tokenId]; unchecked { // `_balances[from]` cannot overflow for the same reason as described in `_burn`: // `from`'s balance is the number of token held, which is at least one before the current // transfer. // `_balances[to]` could overflow in the conditions described in `_mint`. That would require // all 2**256 token ids to be minted, which in practice is impossible. _balances[from] -= 1; _balances[to] += 1; } _owners[tokenId] = to; emit Transfer(from, to, tokenId); _afterTokenTransfer(from, to, tokenId, 1); } /** * @dev Approve `to` to operate on `tokenId` * * Emits an {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Approve `operator` to operate on all of `owner` tokens * * Emits an {ApprovalForAll} event. */ function _setApprovalForAll( address owner, address operator, bool approved ) internal virtual { require(owner != operator, "ERC721: approve to caller"); _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } /** * @dev Reverts if the `tokenId` has not been minted yet. */ function _requireMinted(uint256 tokenId) internal view virtual { require(_exists(tokenId), "ERC721: invalid token ID"); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { /// @solidity memory-safe-assembly assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`. * - When `from` is zero, the tokens will be minted for `to`. * - When `to` is zero, ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * - `batchSize` is non-zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256, /* firstTokenId */ uint256 batchSize ) internal virtual { if (batchSize > 1) { if (from != address(0)) { _balances[from] -= batchSize; } if (to != address(0)) { _balances[to] += batchSize; } } } /** * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`. * - When `from` is zero, the tokens were minted for `to`. * - When `to` is zero, ``from``'s tokens were burned. * - `from` and `to` are never both zero. * - `batchSize` is non-zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 firstTokenId, uint256 batchSize ) internal virtual {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - 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 tokenId, bytes calldata data ) external; /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}. * - 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 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721 * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must * understand this adds an external call which potentially creates a reentrancy vulnerability. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol) pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol) pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (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; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol) pragma solidity ^0.8.0; import "./math/Math.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 `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); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.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) { // 32 is the length in bytes of hash, // enforced by the type signature above return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)); } /** * @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) { return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash)); } }
// 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.8.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) { return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1); /////////////////////////////////////////////// // 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 10, 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 * 8) < value ? 1 : 0); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SafeCast.sol) // This file was procedurally generated from scripts/generate/templates/SafeCast.js. pragma solidity ^0.8.0; /** * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow * checks. * * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can * easily result in undesired exploitation or bugs, since developers usually * assume that overflows raise errors. `SafeCast` restores this intuition by * reverting the transaction when such an operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. * * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing * all math on `uint256` and `int256` and then downcasting. */ library SafeCast { /** * @dev Returns the downcasted uint248 from uint256, reverting on * overflow (when the input is greater than largest uint248). * * Counterpart to Solidity's `uint248` operator. * * Requirements: * * - input must fit into 248 bits * * _Available since v4.7._ */ function toUint248(uint256 value) internal pure returns (uint248) { require(value <= type(uint248).max, "SafeCast: value doesn't fit in 248 bits"); return uint248(value); } /** * @dev Returns the downcasted uint240 from uint256, reverting on * overflow (when the input is greater than largest uint240). * * Counterpart to Solidity's `uint240` operator. * * Requirements: * * - input must fit into 240 bits * * _Available since v4.7._ */ function toUint240(uint256 value) internal pure returns (uint240) { require(value <= type(uint240).max, "SafeCast: value doesn't fit in 240 bits"); return uint240(value); } /** * @dev Returns the downcasted uint232 from uint256, reverting on * overflow (when the input is greater than largest uint232). * * Counterpart to Solidity's `uint232` operator. * * Requirements: * * - input must fit into 232 bits * * _Available since v4.7._ */ function toUint232(uint256 value) internal pure returns (uint232) { require(value <= type(uint232).max, "SafeCast: value doesn't fit in 232 bits"); return uint232(value); } /** * @dev Returns the downcasted uint224 from uint256, reverting on * overflow (when the input is greater than largest uint224). * * Counterpart to Solidity's `uint224` operator. * * Requirements: * * - input must fit into 224 bits * * _Available since v4.2._ */ function toUint224(uint256 value) internal pure returns (uint224) { require(value <= type(uint224).max, "SafeCast: value doesn't fit in 224 bits"); return uint224(value); } /** * @dev Returns the downcasted uint216 from uint256, reverting on * overflow (when the input is greater than largest uint216). * * Counterpart to Solidity's `uint216` operator. * * Requirements: * * - input must fit into 216 bits * * _Available since v4.7._ */ function toUint216(uint256 value) internal pure returns (uint216) { require(value <= type(uint216).max, "SafeCast: value doesn't fit in 216 bits"); return uint216(value); } /** * @dev Returns the downcasted uint208 from uint256, reverting on * overflow (when the input is greater than largest uint208). * * Counterpart to Solidity's `uint208` operator. * * Requirements: * * - input must fit into 208 bits * * _Available since v4.7._ */ function toUint208(uint256 value) internal pure returns (uint208) { require(value <= type(uint208).max, "SafeCast: value doesn't fit in 208 bits"); return uint208(value); } /** * @dev Returns the downcasted uint200 from uint256, reverting on * overflow (when the input is greater than largest uint200). * * Counterpart to Solidity's `uint200` operator. * * Requirements: * * - input must fit into 200 bits * * _Available since v4.7._ */ function toUint200(uint256 value) internal pure returns (uint200) { require(value <= type(uint200).max, "SafeCast: value doesn't fit in 200 bits"); return uint200(value); } /** * @dev Returns the downcasted uint192 from uint256, reverting on * overflow (when the input is greater than largest uint192). * * Counterpart to Solidity's `uint192` operator. * * Requirements: * * - input must fit into 192 bits * * _Available since v4.7._ */ function toUint192(uint256 value) internal pure returns (uint192) { require(value <= type(uint192).max, "SafeCast: value doesn't fit in 192 bits"); return uint192(value); } /** * @dev Returns the downcasted uint184 from uint256, reverting on * overflow (when the input is greater than largest uint184). * * Counterpart to Solidity's `uint184` operator. * * Requirements: * * - input must fit into 184 bits * * _Available since v4.7._ */ function toUint184(uint256 value) internal pure returns (uint184) { require(value <= type(uint184).max, "SafeCast: value doesn't fit in 184 bits"); return uint184(value); } /** * @dev Returns the downcasted uint176 from uint256, reverting on * overflow (when the input is greater than largest uint176). * * Counterpart to Solidity's `uint176` operator. * * Requirements: * * - input must fit into 176 bits * * _Available since v4.7._ */ function toUint176(uint256 value) internal pure returns (uint176) { require(value <= type(uint176).max, "SafeCast: value doesn't fit in 176 bits"); return uint176(value); } /** * @dev Returns the downcasted uint168 from uint256, reverting on * overflow (when the input is greater than largest uint168). * * Counterpart to Solidity's `uint168` operator. * * Requirements: * * - input must fit into 168 bits * * _Available since v4.7._ */ function toUint168(uint256 value) internal pure returns (uint168) { require(value <= type(uint168).max, "SafeCast: value doesn't fit in 168 bits"); return uint168(value); } /** * @dev Returns the downcasted uint160 from uint256, reverting on * overflow (when the input is greater than largest uint160). * * Counterpart to Solidity's `uint160` operator. * * Requirements: * * - input must fit into 160 bits * * _Available since v4.7._ */ function toUint160(uint256 value) internal pure returns (uint160) { require(value <= type(uint160).max, "SafeCast: value doesn't fit in 160 bits"); return uint160(value); } /** * @dev Returns the downcasted uint152 from uint256, reverting on * overflow (when the input is greater than largest uint152). * * Counterpart to Solidity's `uint152` operator. * * Requirements: * * - input must fit into 152 bits * * _Available since v4.7._ */ function toUint152(uint256 value) internal pure returns (uint152) { require(value <= type(uint152).max, "SafeCast: value doesn't fit in 152 bits"); return uint152(value); } /** * @dev Returns the downcasted uint144 from uint256, reverting on * overflow (when the input is greater than largest uint144). * * Counterpart to Solidity's `uint144` operator. * * Requirements: * * - input must fit into 144 bits * * _Available since v4.7._ */ function toUint144(uint256 value) internal pure returns (uint144) { require(value <= type(uint144).max, "SafeCast: value doesn't fit in 144 bits"); return uint144(value); } /** * @dev Returns the downcasted uint136 from uint256, reverting on * overflow (when the input is greater than largest uint136). * * Counterpart to Solidity's `uint136` operator. * * Requirements: * * - input must fit into 136 bits * * _Available since v4.7._ */ function toUint136(uint256 value) internal pure returns (uint136) { require(value <= type(uint136).max, "SafeCast: value doesn't fit in 136 bits"); return uint136(value); } /** * @dev Returns the downcasted uint128 from uint256, reverting on * overflow (when the input is greater than largest uint128). * * Counterpart to Solidity's `uint128` operator. * * Requirements: * * - input must fit into 128 bits * * _Available since v2.5._ */ function toUint128(uint256 value) internal pure returns (uint128) { require(value <= type(uint128).max, "SafeCast: value doesn't fit in 128 bits"); return uint128(value); } /** * @dev Returns the downcasted uint120 from uint256, reverting on * overflow (when the input is greater than largest uint120). * * Counterpart to Solidity's `uint120` operator. * * Requirements: * * - input must fit into 120 bits * * _Available since v4.7._ */ function toUint120(uint256 value) internal pure returns (uint120) { require(value <= type(uint120).max, "SafeCast: value doesn't fit in 120 bits"); return uint120(value); } /** * @dev Returns the downcasted uint112 from uint256, reverting on * overflow (when the input is greater than largest uint112). * * Counterpart to Solidity's `uint112` operator. * * Requirements: * * - input must fit into 112 bits * * _Available since v4.7._ */ function toUint112(uint256 value) internal pure returns (uint112) { require(value <= type(uint112).max, "SafeCast: value doesn't fit in 112 bits"); return uint112(value); } /** * @dev Returns the downcasted uint104 from uint256, reverting on * overflow (when the input is greater than largest uint104). * * Counterpart to Solidity's `uint104` operator. * * Requirements: * * - input must fit into 104 bits * * _Available since v4.7._ */ function toUint104(uint256 value) internal pure returns (uint104) { require(value <= type(uint104).max, "SafeCast: value doesn't fit in 104 bits"); return uint104(value); } /** * @dev Returns the downcasted uint96 from uint256, reverting on * overflow (when the input is greater than largest uint96). * * Counterpart to Solidity's `uint96` operator. * * Requirements: * * - input must fit into 96 bits * * _Available since v4.2._ */ function toUint96(uint256 value) internal pure returns (uint96) { require(value <= type(uint96).max, "SafeCast: value doesn't fit in 96 bits"); return uint96(value); } /** * @dev Returns the downcasted uint88 from uint256, reverting on * overflow (when the input is greater than largest uint88). * * Counterpart to Solidity's `uint88` operator. * * Requirements: * * - input must fit into 88 bits * * _Available since v4.7._ */ function toUint88(uint256 value) internal pure returns (uint88) { require(value <= type(uint88).max, "SafeCast: value doesn't fit in 88 bits"); return uint88(value); } /** * @dev Returns the downcasted uint80 from uint256, reverting on * overflow (when the input is greater than largest uint80). * * Counterpart to Solidity's `uint80` operator. * * Requirements: * * - input must fit into 80 bits * * _Available since v4.7._ */ function toUint80(uint256 value) internal pure returns (uint80) { require(value <= type(uint80).max, "SafeCast: value doesn't fit in 80 bits"); return uint80(value); } /** * @dev Returns the downcasted uint72 from uint256, reverting on * overflow (when the input is greater than largest uint72). * * Counterpart to Solidity's `uint72` operator. * * Requirements: * * - input must fit into 72 bits * * _Available since v4.7._ */ function toUint72(uint256 value) internal pure returns (uint72) { require(value <= type(uint72).max, "SafeCast: value doesn't fit in 72 bits"); return uint72(value); } /** * @dev Returns the downcasted uint64 from uint256, reverting on * overflow (when the input is greater than largest uint64). * * Counterpart to Solidity's `uint64` operator. * * Requirements: * * - input must fit into 64 bits * * _Available since v2.5._ */ function toUint64(uint256 value) internal pure returns (uint64) { require(value <= type(uint64).max, "SafeCast: value doesn't fit in 64 bits"); return uint64(value); } /** * @dev Returns the downcasted uint56 from uint256, reverting on * overflow (when the input is greater than largest uint56). * * Counterpart to Solidity's `uint56` operator. * * Requirements: * * - input must fit into 56 bits * * _Available since v4.7._ */ function toUint56(uint256 value) internal pure returns (uint56) { require(value <= type(uint56).max, "SafeCast: value doesn't fit in 56 bits"); return uint56(value); } /** * @dev Returns the downcasted uint48 from uint256, reverting on * overflow (when the input is greater than largest uint48). * * Counterpart to Solidity's `uint48` operator. * * Requirements: * * - input must fit into 48 bits * * _Available since v4.7._ */ function toUint48(uint256 value) internal pure returns (uint48) { require(value <= type(uint48).max, "SafeCast: value doesn't fit in 48 bits"); return uint48(value); } /** * @dev Returns the downcasted uint40 from uint256, reverting on * overflow (when the input is greater than largest uint40). * * Counterpart to Solidity's `uint40` operator. * * Requirements: * * - input must fit into 40 bits * * _Available since v4.7._ */ function toUint40(uint256 value) internal pure returns (uint40) { require(value <= type(uint40).max, "SafeCast: value doesn't fit in 40 bits"); return uint40(value); } /** * @dev Returns the downcasted uint32 from uint256, reverting on * overflow (when the input is greater than largest uint32). * * Counterpart to Solidity's `uint32` operator. * * Requirements: * * - input must fit into 32 bits * * _Available since v2.5._ */ function toUint32(uint256 value) internal pure returns (uint32) { require(value <= type(uint32).max, "SafeCast: value doesn't fit in 32 bits"); return uint32(value); } /** * @dev Returns the downcasted uint24 from uint256, reverting on * overflow (when the input is greater than largest uint24). * * Counterpart to Solidity's `uint24` operator. * * Requirements: * * - input must fit into 24 bits * * _Available since v4.7._ */ function toUint24(uint256 value) internal pure returns (uint24) { require(value <= type(uint24).max, "SafeCast: value doesn't fit in 24 bits"); return uint24(value); } /** * @dev Returns the downcasted uint16 from uint256, reverting on * overflow (when the input is greater than largest uint16). * * Counterpart to Solidity's `uint16` operator. * * Requirements: * * - input must fit into 16 bits * * _Available since v2.5._ */ function toUint16(uint256 value) internal pure returns (uint16) { require(value <= type(uint16).max, "SafeCast: value doesn't fit in 16 bits"); return uint16(value); } /** * @dev Returns the downcasted uint8 from uint256, reverting on * overflow (when the input is greater than largest uint8). * * Counterpart to Solidity's `uint8` operator. * * Requirements: * * - input must fit into 8 bits * * _Available since v2.5._ */ function toUint8(uint256 value) internal pure returns (uint8) { require(value <= type(uint8).max, "SafeCast: value doesn't fit in 8 bits"); return uint8(value); } /** * @dev Converts a signed int256 into an unsigned uint256. * * Requirements: * * - input must be greater than or equal to 0. * * _Available since v3.0._ */ function toUint256(int256 value) internal pure returns (uint256) { require(value >= 0, "SafeCast: value must be positive"); return uint256(value); } /** * @dev Returns the downcasted int248 from int256, reverting on * overflow (when the input is less than smallest int248 or * greater than largest int248). * * Counterpart to Solidity's `int248` operator. * * Requirements: * * - input must fit into 248 bits * * _Available since v4.7._ */ function toInt248(int256 value) internal pure returns (int248 downcasted) { downcasted = int248(value); require(downcasted == value, "SafeCast: value doesn't fit in 248 bits"); } /** * @dev Returns the downcasted int240 from int256, reverting on * overflow (when the input is less than smallest int240 or * greater than largest int240). * * Counterpart to Solidity's `int240` operator. * * Requirements: * * - input must fit into 240 bits * * _Available since v4.7._ */ function toInt240(int256 value) internal pure returns (int240 downcasted) { downcasted = int240(value); require(downcasted == value, "SafeCast: value doesn't fit in 240 bits"); } /** * @dev Returns the downcasted int232 from int256, reverting on * overflow (when the input is less than smallest int232 or * greater than largest int232). * * Counterpart to Solidity's `int232` operator. * * Requirements: * * - input must fit into 232 bits * * _Available since v4.7._ */ function toInt232(int256 value) internal pure returns (int232 downcasted) { downcasted = int232(value); require(downcasted == value, "SafeCast: value doesn't fit in 232 bits"); } /** * @dev Returns the downcasted int224 from int256, reverting on * overflow (when the input is less than smallest int224 or * greater than largest int224). * * Counterpart to Solidity's `int224` operator. * * Requirements: * * - input must fit into 224 bits * * _Available since v4.7._ */ function toInt224(int256 value) internal pure returns (int224 downcasted) { downcasted = int224(value); require(downcasted == value, "SafeCast: value doesn't fit in 224 bits"); } /** * @dev Returns the downcasted int216 from int256, reverting on * overflow (when the input is less than smallest int216 or * greater than largest int216). * * Counterpart to Solidity's `int216` operator. * * Requirements: * * - input must fit into 216 bits * * _Available since v4.7._ */ function toInt216(int256 value) internal pure returns (int216 downcasted) { downcasted = int216(value); require(downcasted == value, "SafeCast: value doesn't fit in 216 bits"); } /** * @dev Returns the downcasted int208 from int256, reverting on * overflow (when the input is less than smallest int208 or * greater than largest int208). * * Counterpart to Solidity's `int208` operator. * * Requirements: * * - input must fit into 208 bits * * _Available since v4.7._ */ function toInt208(int256 value) internal pure returns (int208 downcasted) { downcasted = int208(value); require(downcasted == value, "SafeCast: value doesn't fit in 208 bits"); } /** * @dev Returns the downcasted int200 from int256, reverting on * overflow (when the input is less than smallest int200 or * greater than largest int200). * * Counterpart to Solidity's `int200` operator. * * Requirements: * * - input must fit into 200 bits * * _Available since v4.7._ */ function toInt200(int256 value) internal pure returns (int200 downcasted) { downcasted = int200(value); require(downcasted == value, "SafeCast: value doesn't fit in 200 bits"); } /** * @dev Returns the downcasted int192 from int256, reverting on * overflow (when the input is less than smallest int192 or * greater than largest int192). * * Counterpart to Solidity's `int192` operator. * * Requirements: * * - input must fit into 192 bits * * _Available since v4.7._ */ function toInt192(int256 value) internal pure returns (int192 downcasted) { downcasted = int192(value); require(downcasted == value, "SafeCast: value doesn't fit in 192 bits"); } /** * @dev Returns the downcasted int184 from int256, reverting on * overflow (when the input is less than smallest int184 or * greater than largest int184). * * Counterpart to Solidity's `int184` operator. * * Requirements: * * - input must fit into 184 bits * * _Available since v4.7._ */ function toInt184(int256 value) internal pure returns (int184 downcasted) { downcasted = int184(value); require(downcasted == value, "SafeCast: value doesn't fit in 184 bits"); } /** * @dev Returns the downcasted int176 from int256, reverting on * overflow (when the input is less than smallest int176 or * greater than largest int176). * * Counterpart to Solidity's `int176` operator. * * Requirements: * * - input must fit into 176 bits * * _Available since v4.7._ */ function toInt176(int256 value) internal pure returns (int176 downcasted) { downcasted = int176(value); require(downcasted == value, "SafeCast: value doesn't fit in 176 bits"); } /** * @dev Returns the downcasted int168 from int256, reverting on * overflow (when the input is less than smallest int168 or * greater than largest int168). * * Counterpart to Solidity's `int168` operator. * * Requirements: * * - input must fit into 168 bits * * _Available since v4.7._ */ function toInt168(int256 value) internal pure returns (int168 downcasted) { downcasted = int168(value); require(downcasted == value, "SafeCast: value doesn't fit in 168 bits"); } /** * @dev Returns the downcasted int160 from int256, reverting on * overflow (when the input is less than smallest int160 or * greater than largest int160). * * Counterpart to Solidity's `int160` operator. * * Requirements: * * - input must fit into 160 bits * * _Available since v4.7._ */ function toInt160(int256 value) internal pure returns (int160 downcasted) { downcasted = int160(value); require(downcasted == value, "SafeCast: value doesn't fit in 160 bits"); } /** * @dev Returns the downcasted int152 from int256, reverting on * overflow (when the input is less than smallest int152 or * greater than largest int152). * * Counterpart to Solidity's `int152` operator. * * Requirements: * * - input must fit into 152 bits * * _Available since v4.7._ */ function toInt152(int256 value) internal pure returns (int152 downcasted) { downcasted = int152(value); require(downcasted == value, "SafeCast: value doesn't fit in 152 bits"); } /** * @dev Returns the downcasted int144 from int256, reverting on * overflow (when the input is less than smallest int144 or * greater than largest int144). * * Counterpart to Solidity's `int144` operator. * * Requirements: * * - input must fit into 144 bits * * _Available since v4.7._ */ function toInt144(int256 value) internal pure returns (int144 downcasted) { downcasted = int144(value); require(downcasted == value, "SafeCast: value doesn't fit in 144 bits"); } /** * @dev Returns the downcasted int136 from int256, reverting on * overflow (when the input is less than smallest int136 or * greater than largest int136). * * Counterpart to Solidity's `int136` operator. * * Requirements: * * - input must fit into 136 bits * * _Available since v4.7._ */ function toInt136(int256 value) internal pure returns (int136 downcasted) { downcasted = int136(value); require(downcasted == value, "SafeCast: value doesn't fit in 136 bits"); } /** * @dev Returns the downcasted int128 from int256, reverting on * overflow (when the input is less than smallest int128 or * greater than largest int128). * * Counterpart to Solidity's `int128` operator. * * Requirements: * * - input must fit into 128 bits * * _Available since v3.1._ */ function toInt128(int256 value) internal pure returns (int128 downcasted) { downcasted = int128(value); require(downcasted == value, "SafeCast: value doesn't fit in 128 bits"); } /** * @dev Returns the downcasted int120 from int256, reverting on * overflow (when the input is less than smallest int120 or * greater than largest int120). * * Counterpart to Solidity's `int120` operator. * * Requirements: * * - input must fit into 120 bits * * _Available since v4.7._ */ function toInt120(int256 value) internal pure returns (int120 downcasted) { downcasted = int120(value); require(downcasted == value, "SafeCast: value doesn't fit in 120 bits"); } /** * @dev Returns the downcasted int112 from int256, reverting on * overflow (when the input is less than smallest int112 or * greater than largest int112). * * Counterpart to Solidity's `int112` operator. * * Requirements: * * - input must fit into 112 bits * * _Available since v4.7._ */ function toInt112(int256 value) internal pure returns (int112 downcasted) { downcasted = int112(value); require(downcasted == value, "SafeCast: value doesn't fit in 112 bits"); } /** * @dev Returns the downcasted int104 from int256, reverting on * overflow (when the input is less than smallest int104 or * greater than largest int104). * * Counterpart to Solidity's `int104` operator. * * Requirements: * * - input must fit into 104 bits * * _Available since v4.7._ */ function toInt104(int256 value) internal pure returns (int104 downcasted) { downcasted = int104(value); require(downcasted == value, "SafeCast: value doesn't fit in 104 bits"); } /** * @dev Returns the downcasted int96 from int256, reverting on * overflow (when the input is less than smallest int96 or * greater than largest int96). * * Counterpart to Solidity's `int96` operator. * * Requirements: * * - input must fit into 96 bits * * _Available since v4.7._ */ function toInt96(int256 value) internal pure returns (int96 downcasted) { downcasted = int96(value); require(downcasted == value, "SafeCast: value doesn't fit in 96 bits"); } /** * @dev Returns the downcasted int88 from int256, reverting on * overflow (when the input is less than smallest int88 or * greater than largest int88). * * Counterpart to Solidity's `int88` operator. * * Requirements: * * - input must fit into 88 bits * * _Available since v4.7._ */ function toInt88(int256 value) internal pure returns (int88 downcasted) { downcasted = int88(value); require(downcasted == value, "SafeCast: value doesn't fit in 88 bits"); } /** * @dev Returns the downcasted int80 from int256, reverting on * overflow (when the input is less than smallest int80 or * greater than largest int80). * * Counterpart to Solidity's `int80` operator. * * Requirements: * * - input must fit into 80 bits * * _Available since v4.7._ */ function toInt80(int256 value) internal pure returns (int80 downcasted) { downcasted = int80(value); require(downcasted == value, "SafeCast: value doesn't fit in 80 bits"); } /** * @dev Returns the downcasted int72 from int256, reverting on * overflow (when the input is less than smallest int72 or * greater than largest int72). * * Counterpart to Solidity's `int72` operator. * * Requirements: * * - input must fit into 72 bits * * _Available since v4.7._ */ function toInt72(int256 value) internal pure returns (int72 downcasted) { downcasted = int72(value); require(downcasted == value, "SafeCast: value doesn't fit in 72 bits"); } /** * @dev Returns the downcasted int64 from int256, reverting on * overflow (when the input is less than smallest int64 or * greater than largest int64). * * Counterpart to Solidity's `int64` operator. * * Requirements: * * - input must fit into 64 bits * * _Available since v3.1._ */ function toInt64(int256 value) internal pure returns (int64 downcasted) { downcasted = int64(value); require(downcasted == value, "SafeCast: value doesn't fit in 64 bits"); } /** * @dev Returns the downcasted int56 from int256, reverting on * overflow (when the input is less than smallest int56 or * greater than largest int56). * * Counterpart to Solidity's `int56` operator. * * Requirements: * * - input must fit into 56 bits * * _Available since v4.7._ */ function toInt56(int256 value) internal pure returns (int56 downcasted) { downcasted = int56(value); require(downcasted == value, "SafeCast: value doesn't fit in 56 bits"); } /** * @dev Returns the downcasted int48 from int256, reverting on * overflow (when the input is less than smallest int48 or * greater than largest int48). * * Counterpart to Solidity's `int48` operator. * * Requirements: * * - input must fit into 48 bits * * _Available since v4.7._ */ function toInt48(int256 value) internal pure returns (int48 downcasted) { downcasted = int48(value); require(downcasted == value, "SafeCast: value doesn't fit in 48 bits"); } /** * @dev Returns the downcasted int40 from int256, reverting on * overflow (when the input is less than smallest int40 or * greater than largest int40). * * Counterpart to Solidity's `int40` operator. * * Requirements: * * - input must fit into 40 bits * * _Available since v4.7._ */ function toInt40(int256 value) internal pure returns (int40 downcasted) { downcasted = int40(value); require(downcasted == value, "SafeCast: value doesn't fit in 40 bits"); } /** * @dev Returns the downcasted int32 from int256, reverting on * overflow (when the input is less than smallest int32 or * greater than largest int32). * * Counterpart to Solidity's `int32` operator. * * Requirements: * * - input must fit into 32 bits * * _Available since v3.1._ */ function toInt32(int256 value) internal pure returns (int32 downcasted) { downcasted = int32(value); require(downcasted == value, "SafeCast: value doesn't fit in 32 bits"); } /** * @dev Returns the downcasted int24 from int256, reverting on * overflow (when the input is less than smallest int24 or * greater than largest int24). * * Counterpart to Solidity's `int24` operator. * * Requirements: * * - input must fit into 24 bits * * _Available since v4.7._ */ function toInt24(int256 value) internal pure returns (int24 downcasted) { downcasted = int24(value); require(downcasted == value, "SafeCast: value doesn't fit in 24 bits"); } /** * @dev Returns the downcasted int16 from int256, reverting on * overflow (when the input is less than smallest int16 or * greater than largest int16). * * Counterpart to Solidity's `int16` operator. * * Requirements: * * - input must fit into 16 bits * * _Available since v3.1._ */ function toInt16(int256 value) internal pure returns (int16 downcasted) { downcasted = int16(value); require(downcasted == value, "SafeCast: value doesn't fit in 16 bits"); } /** * @dev Returns the downcasted int8 from int256, reverting on * overflow (when the input is less than smallest int8 or * greater than largest int8). * * Counterpart to Solidity's `int8` operator. * * Requirements: * * - input must fit into 8 bits * * _Available since v3.1._ */ function toInt8(int256 value) internal pure returns (int8 downcasted) { downcasted = int8(value); require(downcasted == value, "SafeCast: value doesn't fit in 8 bits"); } /** * @dev Converts an unsigned uint256 into a signed int256. * * Requirements: * * - input must be less than or equal to maxInt256. * * _Available since v3.0._ */ function toInt256(uint256 value) internal pure returns (int256) { // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive require(value <= uint256(type(int256).max), "SafeCast: value doesn't fit in an int256"); return int256(value); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/structs/BitMaps.sol) pragma solidity ^0.8.0; /** * @dev Library for managing uint256 to bool mapping in a compact and efficient way, providing the keys are sequential. * Largely inspired by Uniswap's https://github.com/Uniswap/merkle-distributor/blob/master/contracts/MerkleDistributor.sol[merkle-distributor]. */ library BitMaps { struct BitMap { mapping(uint256 => uint256) _data; } /** * @dev Returns whether the bit at `index` is set. */ function get(BitMap storage bitmap, uint256 index) internal view returns (bool) { uint256 bucket = index >> 8; uint256 mask = 1 << (index & 0xff); return bitmap._data[bucket] & mask != 0; } /** * @dev Sets the bit at `index` to the boolean `value`. */ function setTo( BitMap storage bitmap, uint256 index, bool value ) internal { if (value) { set(bitmap, index); } else { unset(bitmap, index); } } /** * @dev Sets the bit at `index`. */ function set(BitMap storage bitmap, uint256 index) internal { uint256 bucket = index >> 8; uint256 mask = 1 << (index & 0xff); bitmap._data[bucket] |= mask; } /** * @dev Unsets the bit at `index`. */ function unset(BitMap storage bitmap, uint256 index) internal { uint256 bucket = index >> 8; uint256 mask = 1 << (index & 0xff); bitmap._data[bucket] &= ~mask; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.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. * * ``` * 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 // Copyright 2023 PROOF Holdings Inc pragma solidity ^0.8.15; library Math { /** * @notice Returns the largest integer less than or equal to the square root of a given integer. * @dev Uses the Babylonian method. * @dev Not optimised and should therefore only be used for testing. * TODO(arran): control this through Bazel visibility */ function intSqrt(uint256 x) internal pure returns (uint256) { if (x == 0) { return 0; } if (x < 4) { return 1; } uint256 z = x; uint256 y = x / 2 + 1; while (y < z) { z = y; y = (x / y + y) / 2; } return z; } }
// SPDX-License-Identifier: MIT // Copyright (c) 2022 the ethier authors (github.com/divergencetech/ethier) pragma solidity ^0.8.15; import {Test} from "forge-std/Test.sol"; import {Address} from "openzeppelin-contracts/utils/Address.sol"; import {Strings} from "openzeppelin-contracts/utils/Strings.sol"; import {IERC721, ERC721} from "openzeppelin-contracts/token/ERC721/ERC721.sol"; import {AccessControlEnumerable} from "ethier/utils/AccessControlEnumerable.sol"; import {Math} from "./Math.sol"; contract ProofTest is Test { using Address for address; bytes32 public immutable DEFAULT_ADMIN_ROLE; bytes32 public immutable DEFAULT_STEERING_ROLE; constructor() { AccessControlEnumerable ace = new AccessControlEnumerable(); DEFAULT_ADMIN_ROLE = ace.DEFAULT_ADMIN_ROLE(); DEFAULT_STEERING_ROLE = ace.DEFAULT_STEERING_ROLE(); } address public immutable admin = makeAddr("admin"); address public immutable steerer = makeAddr("steerer"); function missingRoleError(address account, bytes32 role) public pure returns (bytes memory) { return bytes( string.concat( "AccessControl: account ", Strings.toHexString(account), " is missing role ", vm.toString(role) ) ); } function _assumeNotContract(address account) public view { vm.assume(uint160(account) > 10); vm.assume(!account.isContract()); } modifier assertBalanceChangedBy(address account, int256 delta) { uint256 balance = account.balance; _; assertEq(account.balance, uint256(int256(balance) + delta)); } modifier assertERC721BalanceChangedBy(IERC721 token, address account, int256 delta) { // Excluding this since balance checks of most ERC721 implementations will fail if the account is the zero address. vm.assume(account != address(0)); uint256 balance = token.balanceOf(account); _; assertEq(token.balanceOf(account), uint256(int256(balance) + delta)); } modifier assertERC721TokenBurned(IERC721 token, uint256 tokenId) { // Checking that it did not revert before. token.ownerOf(tokenId); _; // Not checking a specific revert here since the ERC721 standard does not mandate a specific error and it will differ across implementations. // TODO (dave): explore EIP165 checks to determine the implementation vm.expectRevert(); token.ownerOf(tokenId); } function sequence(uint256 from, uint256 to) public pure returns (uint256[] memory) { uint256 num = to - from; uint256[] memory seq = new uint[](num); for (uint256 i = 0; i < num; i++) { seq[i] = from + i; } return seq; } function slice(uint256[] memory x, uint256 from, uint256 to) public pure returns (uint256[] memory) { uint256 num = to - from; uint256[] memory s = new uint256[](num); for (uint256 i = 0; i < num; i++) { s[i] = x[from + i]; } return s; } function _deltasToAbsolute(uint256[] memory deltas, uint256 offset) private pure returns (uint256[] memory) { uint256[] memory tokenIds = new uint[](deltas.length); uint256 tokenId = 0; for (uint256 i = 0; i < deltas.length; i++) { tokenId += uint256(deltas[i]) + offset; tokenIds[i] = tokenId; } return tokenIds; } function deltasToAbsolute(uint256[] memory deltas) public pure returns (uint256[] memory) { return _deltasToAbsolute(deltas, 0); } function deltasToUniqueAbsolute(uint256[] memory deltas) public pure returns (uint256[] memory) { return _deltasToAbsolute(deltas, 1); } function assertBoundedIncl(uint256 x, uint256 lower, uint256 upper, string memory reason) public { string memory err = string.concat(reason, " ", vm.toString(x), " not in [", vm.toString(lower), ",", vm.toString(upper), "]"); assertLe(x, upper, err); assertGe(x, lower, err); } function assertBoundedIncl(uint256 x, uint256 lower, uint256 upper) public { assertBoundedIncl(x, lower, upper, ""); } function assertBinomialBoundedIncl(uint256 x, uint256 mean, uint256 numSigma) public { assertBinomialBoundedIncl(x, mean, numSigma, ""); } function assertBinomialBoundedIncl(uint256 x, uint256 mean, uint256 numSigma, string memory reason) public { // crude approximation of the confidence interval via the central limit theorem // the approximation is only good if mean is sufficiently large // https://en.wikipedia.org/wiki/Binomial_proportion_confidence_interval#Normal_approximation_interval uint256 tolerance = numSigma * Math.intSqrt(mean); assertBoundedIncl(x, mean > tolerance ? mean - tolerance : 0, mean + tolerance, reason); } function expectRevertNotSteererThenPrank(address vandal) public { vm.assume(vandal != steerer); vm.expectRevert(missingRoleError(vandal, DEFAULT_STEERING_ROLE)); vm.prank(vandal, steerer); } // TODO(dave): generated these programmatically via a go template and add more. function toUint64s(uint8[1] memory input) public pure returns (uint64[] memory output) { output = new uint64[](input.length); for (uint256 i; i < input.length; ++i) { output[i] = input[i]; } } function toUint64s(uint8[2] memory input) public pure returns (uint64[] memory output) { output = new uint64[](input.length); for (uint256 i; i < input.length; ++i) { output[i] = input[i]; } } function toUint64s(uint8[3] memory input) public pure returns (uint64[] memory output) { output = new uint64[](input.length); for (uint256 i; i < input.length; ++i) { output[i] = input[i]; } } function toUint64s(uint8[4] memory input) public pure returns (uint64[] memory output) { output = new uint64[](input.length); for (uint256 i; i < input.length; ++i) { output[i] = input[i]; } } function toUint64s(uint8[5] memory input) public pure returns (uint64[] memory output) { output = new uint64[](input.length); for (uint256 i; i < input.length; ++i) { output[i] = input[i]; } } function toUint64s(uint32[1] memory input) public pure returns (uint64[] memory output) { output = new uint64[](input.length); for (uint256 i; i < input.length; ++i) { output[i] = input[i]; } } function toUint64s(uint32[2] memory input) public pure returns (uint64[] memory output) { output = new uint64[](input.length); for (uint256 i; i < input.length; ++i) { output[i] = input[i]; } } function toUint64s(uint32[3] memory input) public pure returns (uint64[] memory output) { output = new uint64[](input.length); for (uint256 i; i < input.length; ++i) { output[i] = input[i]; } } function toUint64s(uint32[4] memory input) public pure returns (uint64[] memory output) { output = new uint64[](input.length); for (uint256 i; i < input.length; ++i) { output[i] = input[i]; } } function toUint64s(uint64[1] memory input) public pure returns (uint64[] memory output) { output = new uint64[](input.length); for (uint256 i; i < input.length; ++i) { output[i] = input[i]; } } function toUint64s(uint64[2] memory input) public pure returns (uint64[] memory output) { output = new uint64[](input.length); for (uint256 i; i < input.length; ++i) { output[i] = input[i]; } } function toUint64s(uint64[3] memory input) public pure returns (uint64[] memory output) { output = new uint64[](input.length); for (uint256 i; i < input.length; ++i) { output[i] = input[i]; } } function toUint64s(uint64[4] memory input) public pure returns (uint64[] memory output) { output = new uint64[](input.length); for (uint256 i; i < input.length; ++i) { output[i] = input[i]; } } function toUint128s(uint8[1] memory input) public pure returns (uint128[] memory output) { output = new uint128[](input.length); for (uint256 i; i < input.length; ++i) { output[i] = input[i]; } } function toUint128s(uint8[2] memory input) public pure returns (uint128[] memory output) { output = new uint128[](input.length); for (uint256 i; i < input.length; ++i) { output[i] = input[i]; } } function toUint128s(uint8[3] memory input) public pure returns (uint128[] memory output) { output = new uint128[](input.length); for (uint256 i; i < input.length; ++i) { output[i] = input[i]; } } function toUint128s(uint8[4] memory input) public pure returns (uint128[] memory output) { output = new uint128[](input.length); for (uint256 i; i < input.length; ++i) { output[i] = input[i]; } } function toUint128s(uint128[1] memory input) public pure returns (uint128[] memory output) { output = new uint128[](input.length); for (uint256 i; i < input.length; ++i) { output[i] = input[i]; } } function toUint128s(uint128[2] memory input) public pure returns (uint128[] memory output) { output = new uint128[](input.length); for (uint256 i; i < input.length; ++i) { output[i] = input[i]; } } function toUint128s(uint128[3] memory input) public pure returns (uint128[] memory output) { output = new uint128[](input.length); for (uint256 i; i < input.length; ++i) { output[i] = input[i]; } } function toUint128s(uint128[4] memory input) public pure returns (uint128[] memory output) { output = new uint128[](input.length); for (uint256 i; i < input.length; ++i) { output[i] = input[i]; } } function toUint256s(uint8[1] memory input) public pure returns (uint256[] memory output) { output = new uint256[](input.length); for (uint256 i; i < input.length; ++i) { output[i] = input[i]; } } function toUint256s(uint8[2] memory input) public pure returns (uint256[] memory output) { output = new uint256[](input.length); for (uint256 i; i < input.length; ++i) { output[i] = input[i]; } } function toUint256s(uint8[3] memory input) public pure returns (uint256[] memory output) { output = new uint256[](input.length); for (uint256 i; i < input.length; ++i) { output[i] = input[i]; } } function toUint256s(uint8[4] memory input) public pure returns (uint256[] memory output) { output = new uint256[](input.length); for (uint256 i; i < input.length; ++i) { output[i] = input[i]; } } function toUint256s(uint8[5] memory input) public pure returns (uint256[] memory output) { output = new uint256[](input.length); for (uint256 i; i < input.length; ++i) { output[i] = input[i]; } } function toUint256s(uint8[6] memory input) public pure returns (uint256[] memory output) { output = new uint256[](input.length); for (uint256 i; i < input.length; ++i) { output[i] = input[i]; } } function toUint256s(uint16[1] memory input) public pure returns (uint256[] memory output) { output = new uint256[](input.length); for (uint256 i; i < input.length; ++i) { output[i] = input[i]; } } function toUint256s(uint16[2] memory input) public pure returns (uint256[] memory output) { output = new uint256[](input.length); for (uint256 i; i < input.length; ++i) { output[i] = input[i]; } } function toUint256s(uint16[3] memory input) public pure returns (uint256[] memory output) { output = new uint256[](input.length); for (uint256 i; i < input.length; ++i) { output[i] = input[i]; } } function toUint256s(uint16[4] memory input) public pure returns (uint256[] memory output) { output = new uint256[](input.length); for (uint256 i; i < input.length; ++i) { output[i] = input[i]; } } function toUint256s(uint16[5] memory input) public pure returns (uint256[] memory output) { output = new uint256[](input.length); for (uint256 i; i < input.length; ++i) { output[i] = input[i]; } } function toUint256s(uint16[6] memory input) public pure returns (uint256[] memory output) { output = new uint256[](input.length); for (uint256 i; i < input.length; ++i) { output[i] = input[i]; } } function toUint256s(uint32[20] memory input) public pure returns (uint256[] memory output) { output = new uint256[](input.length); for (uint256 i; i < input.length; ++i) { output[i] = input[i]; } } function toUint256s(uint32[50] memory input) public pure returns (uint256[] memory output) { output = new uint256[](input.length); for (uint256 i; i < input.length; ++i) { output[i] = input[i]; } } function toUint256s(uint32[100] memory input) public pure returns (uint256[] memory output) { output = new uint256[](input.length); for (uint256 i; i < input.length; ++i) { output[i] = input[i]; } } function toUint256s(uint128[1] memory input) public pure returns (uint256[] memory output) { output = new uint256[](input.length); for (uint256 i; i < input.length; ++i) { output[i] = input[i]; } } function toUint256s(uint128[2] memory input) public pure returns (uint256[] memory output) { output = new uint256[](input.length); for (uint256 i; i < input.length; ++i) { output[i] = input[i]; } } function toUint256s(uint128[3] memory input) public pure returns (uint256[] memory output) { output = new uint256[](input.length); for (uint256 i; i < input.length; ++i) { output[i] = input[i]; } } function toUint256s(uint128[4] memory input) public pure returns (uint256[] memory output) { output = new uint256[](input.length); for (uint256 i; i < input.length; ++i) { output[i] = input[i]; } } function toUint256s(uint256[4] memory input) public pure returns (uint256[] memory output) { output = new uint256[](input.length); for (uint256 i; i < input.length; ++i) { output[i] = input[i]; } } function toAddresses(address[1] memory input) public pure returns (address[] memory output) { output = new address[](input.length); for (uint256 i; i < input.length; ++i) { output[i] = input[i]; } } } contract SignerTest is Test { address public immutable signer; uint256 public immutable signerKey; constructor() { (signer, signerKey) = makeAddrAndKey("signer"); } function _sign(uint256 key, bytes32 digest) internal pure returns (bytes memory) { (uint8 v, bytes32 r, bytes32 s) = vm.sign(key, digest); return abi.encodePacked(r, s, v); } } contract ERC721Fake is ERC721("Fake", "FAKE") { function mint(address to, uint256 tokenId) public { _mint(to, tokenId); } function mint(address to, uint256[] memory tokenIds) public { for (uint256 i; i < tokenIds.length; ++i) { mint(to, tokenIds[i]); } } }
// SPDX-License-Identifier: MIT // Copyright 2023 PROOF Holdings Inc pragma solidity >=0.8.0 <0.9.0; import {Seller} from "./Seller.sol"; /** * @notice Extends the basic seller by assuming that the total cost of the purchase can be computed by an internal * function and is not supplied externally. */ abstract contract InternallyPriced is Seller { /** * @notice Computes the total cost of purchasing `num` tokens. * @dev This is intended to be overridden by derived contracts. */ function _cost(uint64 num) internal view virtual returns (uint256); /** * @notice Returns the total cost of purchasing `num` tokens. * @dev Intended for third-party integrations. */ function cost(uint64 num) external view returns (uint256) { return _cost(num); } /** * @dev Replaces the cost of the purchase with the computed value. */ function _checkAndModifyPurchase(address to, uint64 num, uint256 cost_, bytes memory data) internal view virtual override returns (address, uint64, uint256) { (to, num, cost_) = super._checkAndModifyPurchase(to, num, cost_, data); return (to, num, _cost(num)); } /** * @dev Convenience function without cost that is now computed internally instead. */ function _purchase(address to, uint64 num, bytes memory data) internal { _purchase(to, num, _UNDEFINED_COST, data); } } /** * @notice Extends internally priced sellers by ensuring that the sent value matches the computed cost exactly. */ abstract contract ExactInternallyPriced is InternallyPriced { // ========================================================================= // Errors // ========================================================================= /** * @notice Thrown if the payment does not match the computed cost. */ error WrongPayment(uint256 actual, uint256 expected); /** * @inheritdoc Seller */ function _checkAndModifyPurchase(address to, uint64 num, uint256 cost_, bytes memory data) internal view virtual override returns (address, uint64, uint256) { (to, num, cost_) = InternallyPriced._checkAndModifyPurchase(to, num, cost_, data); if (msg.value != cost_) { revert WrongPayment(msg.value, cost_); } return (to, num, cost_); } } /** * @notice Public seller with a fixed price. */ abstract contract ExactFixedPrice is ExactInternallyPriced { constructor(uint256 price) { _setPrice(price); } /** * @notice The price of a single purchase. */ uint256 private _price; /** * @notice Computes the cost of a purchase. */ function _cost(uint64 num) internal view virtual override returns (uint256) { return num * _price; } /** * @notice Sets the price of a single purchase. */ function _setPrice(uint256 price) internal { _price = price; } }
// SPDX-License-Identifier: MIT // Copyright 2023 PROOF Holdings Inc pragma solidity ^0.8.16; import {IERC721} from "openzeppelin-contracts/token/ERC721/IERC721.sol"; import {SafeCast} from "openzeppelin-contracts/utils/math/SafeCast.sol"; import {InternallyPriced} from "../base/InternallyPriced.sol"; import {TokenUsageTracker} from "../base/TokenUsageTracker.sol"; /** * @notice Introduces claimability based on ERC721 token ownership. */ abstract contract InternallyPricedTokenGated is InternallyPriced, TokenUsageTracker { constructor(IERC721 token) TokenUsageTracker(token) {} /** * @notice Redeems claims with a list of given token ids. * @dev Reverts if the sender is not allowed to spend one or more of the * listed tokens or if a token has already been used. */ function _purchase(uint256[] memory tokenIds) internal virtual { TokenUsageTracker._checkAndTrackPurchasesWithTokens(msg.sender, tokenIds); InternallyPriced._purchase(msg.sender, SafeCast.toUint64(tokenIds.length), ""); } }
// SPDX-License-Identifier: MIT // Copyright 2023 PROOF Holdings Inc pragma solidity >=0.8.0 <0.9.0; import {ISellable} from "../interfaces/ISellable.sol"; import {PurchaseExecuter} from "../interfaces/PurchaseExecuter.sol"; /** * @notice Executes a purchase by calling the purchase interface of a `ISellable` contract. */ abstract contract SellableCallbacker is PurchaseExecuter { /** * @notice Emitted when the callback to the `ISellable` contract fails. */ error CallbackFailed(bytes reason); /** * @notice The `ISellable` contract that will be called to execute the purchase. */ ISellable public immutable sellable; constructor(ISellable sellable_) { sellable = ISellable(sellable_); } /** * @notice Executes a purchase by calling the sale interface of a `ISellable` contract. */ function _executePurchase(address to, uint64 num, uint256 cost, bytes memory data) internal virtual override { try sellable.handleSale{value: cost}(to, num, data) {} catch (bytes memory reason) { // TODO(dave): the reason is empty if the above call runs OutOfFund. Explore ways to bubble this up more cleanly. revert CallbackFailed(reason); } } }
// SPDX-License-Identifier: MIT // Copyright 2023 PROOF Holdings Inc pragma solidity >=0.8.0 <0.9.0; import {ReentrancyGuard} from "openzeppelin-contracts/security/ReentrancyGuard.sol"; import {PurchaseExecuter} from "../interfaces/PurchaseExecuter.sol"; /** * @notice Abstract base contract for all `Seller`s. * @dev The intention of this contract is to provide an extensible base for various kinds of Seller modules that can be * flexibly composed to build more complex sellers - allowing effective code reuse. * Derived contracts are intended to implement their logic by overriding and extending the `_checkAndModifyPurchase` and * `_beforePurchase` hooks (calling the parent implementation(s) to compose logic). The former is intended to perform * manipulations and checks of the input data; the latter to update the internal state of the module. * Final sellers will compose these modules and expose an addition external purchase function for buyers. */ abstract contract Seller is PurchaseExecuter, ReentrancyGuard { uint256 internal constant _UNDEFINED_COST = type(uint256).max; /** * @notice Internal function handling a given purchase, performing checks and input manipulations depending on the * logic in the hooks. * @param to The receiver of the purchase * @param num Number of requested purchases * @param externalTotalCost Total cost of the purchase * @dev This function is intended to be wrapped in an external method for final sellers. Since we cannot foresee * what logic will be implemented in the hooks, we added a reentrancy guard for safety. */ function _purchase(address to, uint64 num, uint256 externalTotalCost, bytes memory data) internal virtual nonReentrant { uint256 totalCost; (to, num, totalCost) = _checkAndModifyPurchase(to, num, externalTotalCost, data); _beforePurchase(to, num, totalCost, data); _executePurchase(to, num, totalCost, data); } // ================================================================================================================= // Hooks // ================================================================================================================= /** * @notice Hook that is called before handling a purchase (even before `_beforePurchase`) * @dev The intent of this hook is to manipulate the input data and perform checks before actually handling the * purchase. * @param to The receiver of the purchase * @param num Number of requested purchases * @param totalCost Total cost of the purchase * @dev This function MUST return sensible values, since these will be used to perfom the purchase. */ function _checkAndModifyPurchase(address to, uint64 num, uint256 totalCost, bytes memory) internal view virtual returns (address, uint64, uint256) { return (to, num, totalCost); } /** * @notice Hook that is called before handling a purchase. * @dev The intent of this hook is to update the internal state of the seller (module) if necessary. * It is critical that the updates happen here and not in `_checkAndModifyPurchase` because only after calling that * function the purchase parameters can be considered fixed. */ function _beforePurchase(address to, uint64 num, uint256 totalCost, bytes memory data) internal virtual { // solhint-disable-line no-empty-blocks } }
// SPDX-License-Identifier: MIT // Copyright 2023 PROOF Holdings Inc pragma solidity ^0.8.16; import {IERC721} from "openzeppelin-contracts/token/ERC721/IERC721.sol"; import {IDelegationRegistry} from "delegation-registry/IDelegationRegistry.sol"; /** * @notice Checks if an operator is allowed to purchase with given ERC721 tokens. */ abstract contract TokenApprovalChecker { /** * @notice Determines if a given operator is allowed to purchase with a given token. */ function _isAllowedToPurchaseWithToken(address operator, IERC721 token, uint256 tokenId) internal view virtual returns (bool); } /** * @notice Allows the token owner and any ERC721-approved operator to purchase. */ contract DefaultTokenApprovalChecker is TokenApprovalChecker { /** * @inheritdoc TokenApprovalChecker */ function _isAllowedToPurchaseWithToken(address operator, IERC721 token, uint256 tokenId) internal view virtual override returns (bool) { address tokenOwner = token.ownerOf(tokenId); return (operator == tokenOwner) || token.isApprovedForAll(tokenOwner, operator) || (operator == token.getApproved(tokenId)); } } /** * @notice Extension to `DefaultTokenApprovalChecker` that additionally allows delegated operators via delegate.cash. */ contract DelegatedTokenApprovalChecker is TokenApprovalChecker { /** * @notice The delegate.cash delegation registry. */ IDelegationRegistry internal immutable _delegationRegistry; constructor(IDelegationRegistry delegationRegistry) { _delegationRegistry = delegationRegistry; } /** * @inheritdoc TokenApprovalChecker */ function _isAllowedToPurchaseWithToken(address operator, IERC721 token, uint256 tokenId) internal view virtual override returns (bool) { // Reimplemententing the standard checks instead of calling // `super._isAllowedToClaim` here to have a specific ordering for gas // efficiency: 1. owner, 2. delegation, 3. ERC721 approvals. address tokenOwner = token.ownerOf(tokenId); return (operator == tokenOwner) || _delegationRegistry.checkDelegateForToken(operator, tokenOwner, address(token), tokenId) || token.isApprovedForAll(tokenOwner, operator) || (operator == token.getApproved(tokenId)); } }
// SPDX-License-Identifier: MIT // Copyright 2023 PROOF Holdings Inc pragma solidity ^0.8.16; import {IERC721} from "openzeppelin-contracts/token/ERC721/IERC721.sol"; import {BitMaps} from "openzeppelin-contracts/utils/structs/BitMaps.sol"; import {TokenApprovalChecker} from "./TokenApprovalChecker.sol"; /** * @notice Checks if an operator is allowed to purchase with given ERC721 tokens and keeps track of already used tokens. */ abstract contract TokenUsageTracker is TokenApprovalChecker { using BitMaps for BitMaps.BitMap; // ========================================================================= // Errors // ========================================================================= /** * @notice Thrown if the operator is not allowed to act with a given token. */ error OperatorNotAllowedToPurchaseWithToken(address operator, uint256 tokenId); /** * @notice Thrown if a token was already used to claim. */ error TokenAlreadyUsedForPurchase(uint256 tokenId); // ========================================================================= // Constants // ========================================================================= /** * @notice The ERC721 contract for token-gating. */ IERC721 internal immutable _token; // ========================================================================= // Storage // ========================================================================= /** * @notice Keeps track of tokens that have already been used for redemptions. */ BitMaps.BitMap private _usedTokens; constructor(IERC721 token) { _token = token; } // ========================================================================= // Accounting // ========================================================================= /** * @notice Checks if a token has already been used to purchase. */ function alreadyPurchasedWithTokens(uint256[] calldata tokenIds) external view returns (bool[] memory) { bool[] memory used = new bool[](tokenIds.length); for (uint256 i; i < tokenIds.length; ++i) { used[i] = _usedTokens.get(tokenIds[i]); } return used; } /** * @notice Checks if the operator is allowed to purchase with the given tokens and marks them as used. * @dev Reverts if the operator is not allowed to spend one or more of the listed tokens or if a token has already * been used. */ function _checkAndTrackPurchasesWithTokens(address operator, uint256[] memory tokenIds) internal virtual { for (uint256 i; i < tokenIds.length; ++i) { if (!_isAllowedToPurchaseWithToken(operator, _token, tokenIds[i])) { revert OperatorNotAllowedToPurchaseWithToken(operator, tokenIds[i]); } if (_usedTokens.get(tokenIds[i])) { revert TokenAlreadyUsedForPurchase(tokenIds[i]); } _usedTokens.set(tokenIds[i]); } } }
// SPDX-License-Identifier: MIT // Copyright 2023 PROOF Holdings Inc pragma solidity >=0.8.0 <0.9.0; /** * @notice Basic interface for a contract providing sellable content. */ interface ISellable { /** * @notice Handles the sale of sellable content. * @dev This is usually only callable by Sellers. */ function handleSale(address to, uint64 num, bytes calldata data) external payable; }
// SPDX-License-Identifier: MIT // Copyright 2023 PROOF Holdings Inc pragma solidity >=0.8.0 <0.9.0; /** * @notice Interface to execute purchases in `Seller`s. * @dev This executes the final purchase. This can be anything from minting ERC721 tokens to transfering funds, etc. */ abstract contract PurchaseExecuter { function _executePurchase(address to, uint64 num, uint256 cost, bytes memory data) internal virtual; }
// SPDX-License-Identifier: MIT // Copyright 2023 PROOF Holdings Inc pragma solidity ^0.8.16; import {EnumerableSet} from "openzeppelin-contracts/utils/structs/EnumerableSet.sol"; import {NestingLevelLib} from "./NestingLevelLib.sol"; import {IERC721, InternallyPricedTokenGated} from "./TokenGated.sol"; import {Seller} from "../base/Seller.sol"; /** * @notice Introduces claimability based on signed MoonbirdNestingLevels. */ abstract contract MoonbirdNestingLevelGated is InternallyPricedTokenGated { using EnumerableSet for EnumerableSet.AddressSet; using NestingLevelLib for NestingLevelLib.MoonbirdNestingLevel; using NestingLevelLib for NestingLevelLib.SignedMoonbirdNestingLevel; // ================================================================================================================= // Errors // ================================================================================================================= /** * @notice Thrown if a the signer of a MoonbirdNestingLevels is not authorised. */ error UnauthorisedSigner(NestingLevelLib.SignedMoonbirdNestingLevel, address recovered); /** * @notice Thrown if the nesting level of a given Moonbird is insufficient, i.e. lower than `requiredNestingLevel`. */ error InsufficientNestingLevel( NestingLevelLib.MoonbirdNestingLevel moonbirdNestingLevel, NestingLevelLib.NestingLevel requiredNestingLevel ); // ================================================================================================================= // Storage // ================================================================================================================= /** * @notice The minimum nesting level required to purchase. */ NestingLevelLib.NestingLevel public immutable requiredNestingLevel; /** * @notice The set of autorised moonbirdNestingLevel signers. */ EnumerableSet.AddressSet private _signers; constructor(IERC721 token, NestingLevelLib.NestingLevel requiredNestingLevel_) InternallyPricedTokenGated(token) { requiredNestingLevel = requiredNestingLevel_; } // ================================================================================================================= // Purchasing // ================================================================================================================= /** * @notice Computes the hash of a given MoonbirdNestingLevel. * @dev This is the raw bytes32 message that will finally be signed by one of the authorised `_signers`. */ function digest(NestingLevelLib.MoonbirdNestingLevel memory moonbirdNestingLevel) public view returns (bytes32) { return moonbirdNestingLevel.digest(); } /** * @notice Interface to perform purchases with signed MoonbirdNestingLevels. */ function purchase(NestingLevelLib.SignedMoonbirdNestingLevel[] calldata sigs) public payable virtual { uint256[] memory tokenIds = new uint[](sigs.length); for (uint256 i; i < sigs.length; ++i) { address signer = sigs[i].recoverSigner(); if (!_signers.contains(signer)) { revert UnauthorisedSigner(sigs[i], signer); } if (sigs[i].payload.nestingLevel < requiredNestingLevel) { revert InsufficientNestingLevel(sigs[i].payload, requiredNestingLevel); } tokenIds[i] = sigs[i].payload.tokenId; } InternallyPricedTokenGated._purchase(tokenIds); } // ================================================================================================================= // Steering // ================================================================================================================= /** * @notice Changes set of signers authorised to sign MoonbirdNestingLevels. */ function _changeAllowlistSigners(address[] calldata rm, address[] calldata add) internal { for (uint256 i; i < rm.length; ++i) { _signers.remove(rm[i]); } for (uint256 i; i < add.length; ++i) { _signers.add(add[i]); } } }
// SPDX-License-Identifier: MIT // Copyright 2023 PROOF Holdings Inc pragma solidity ^0.8.16; import {ECDSA} from "openzeppelin-contracts/utils/cryptography/ECDSA.sol"; library NestingLevelLib { using NestingLevelLib for MoonbirdNestingLevel; using NestingLevelLib for SignedMoonbirdNestingLevel; /** * @notice The nesting levels of a Moonbird. */ enum NestingLevel { Unnested, Straw, Bronze, Silver, Gold, Diamond } /** * @notice Associates a moonbird with its nesting level. * @dev Encodes the payload to be signed by a trusted signer. */ struct MoonbirdNestingLevel { uint256 tokenId; NestingLevel nestingLevel; } /** * @notice A MoonbirdNestingLevel with signature proving that the given nesting level is correct. * @dev The signature will be issued by a trusted signer. */ struct SignedMoonbirdNestingLevel { MoonbirdNestingLevel payload; bytes signature; } /** * @notice Computes the hash of a given MoonbirdNestingLevel depending on chainId. */ function digest(MoonbirdNestingLevel memory payload, uint256 chainId) internal pure returns (bytes32) { // We do not use EIP712 signatures here for the time being for simplicity (and since we will be the only ones // signing). return ECDSA.toEthSignedMessageHash( abi.encode( payload, // Adding chain id to prevent replay attacks using testnet signatures. chainId ) ); } /** * @notice Convenience wrapper around `digest(MoonbirdNestingLevel, uint256)` that uses the current chainId. */ function digest(MoonbirdNestingLevel memory payload) internal view returns (bytes32) { return digest(payload, block.chainid); } /** * @notice Performs ECDSA.recover()y on the digest of the signed payload. */ function recoverSigner(SignedMoonbirdNestingLevel memory signed, uint256 chainId) internal pure returns (address) { return ECDSA.recover(signed.payload.digest(chainId), signed.signature); } /** * @notice Convenience wrapper for `recoverSigner(SignedMoonbirdNestingLevel, block.chainid)`. */ function recoverSigner(SignedMoonbirdNestingLevel memory signed) internal view returns (address) { return signed.recoverSigner(block.chainid); } }
// SPDX-License-Identifier: MIT // Copyright 2023 PROOF Holdings Inc pragma solidity ^0.8.16; import {IERC721} from "openzeppelin-contracts/token/ERC721/IERC721.sol"; import {BitMaps} from "openzeppelin-contracts/utils/structs/BitMaps.sol"; import {SafeCast} from "openzeppelin-contracts/utils/math/SafeCast.sol"; import {IDelegationRegistry} from "delegation-registry/IDelegationRegistry.sol"; import {InternallyPricedTokenGated} from "../base/InternallyPricedTokenGated.sol"; import { TokenApprovalChecker, DefaultTokenApprovalChecker, DelegatedTokenApprovalChecker } from "../base/TokenApprovalChecker.sol"; /** * @notice Introduces claimability based on ERC721 token ownership. */ abstract contract TokenGated is InternallyPricedTokenGated { constructor(IERC721 token) InternallyPricedTokenGated(token) {} /** * @notice Redeems claims with a list of given token ids. * @dev Reverts if the sender is not allowed to spend one or more of the listed tokens or if a token has already * been used. */ function purchase(uint256[] calldata tokenIds) external payable virtual { InternallyPricedTokenGated._purchase(tokenIds); } } /** * @notice Introduces claimability based on ERC721 token ownership. */ abstract contract DefaultTokenGated is TokenGated, DefaultTokenApprovalChecker { constructor(IERC721 token) TokenGated(token) {} /** * @inheritdoc TokenApprovalChecker */ function _isAllowedToPurchaseWithToken(address operator, IERC721 token, uint256 tokenId) internal view virtual override(TokenApprovalChecker, DefaultTokenApprovalChecker) returns (bool) { return DefaultTokenApprovalChecker._isAllowedToPurchaseWithToken(operator, token, tokenId); } } /** * @notice Extension to `TokenGated` adding delegation via delegate.cash. */ abstract contract DelegatedTokenGated is TokenGated, DelegatedTokenApprovalChecker { constructor(IERC721 token, IDelegationRegistry delegationRegistry) TokenGated(token) DelegatedTokenApprovalChecker(delegationRegistry) {} /** * @inheritdoc TokenApprovalChecker */ function _isAllowedToPurchaseWithToken(address operator, IERC721 token, uint256 tokenId) internal view virtual override(TokenApprovalChecker, DelegatedTokenApprovalChecker) returns (bool) { return DelegatedTokenApprovalChecker._isAllowedToPurchaseWithToken(operator, token, tokenId); } }
// SPDX-License-Identifier: MIT // Copyright 2023 PROOF Holdings Inc pragma solidity ^0.8.16; import {AccessControlEnumerable} from "ethier/utils/AccessControlEnumerable.sol"; import {ISellable, SellableCallbacker} from "../base/SellableCallbacker.sol"; /** * @notice Base contract for seller presets that call back to a sellable contract. */ contract CallbackerWithAccessControl is SellableCallbacker, AccessControlEnumerable { constructor(address admin, address steerer, ISellable sellable_) SellableCallbacker(sellable_) { _grantRole(DEFAULT_ADMIN_ROLE, admin); _grantRole(DEFAULT_STEERING_ROLE, steerer); } }
// SPDX-License-Identifier: MIT // Copyright 2023 PROOF Holdings Inc pragma solidity ^0.8.16; import {CallbackerWithAccessControl} from "./CallbackerWithAccessControl.sol"; import {ExactFixedPrice} from "../base/InternallyPriced.sol"; /** * @notice Seller with a steerer-settable price. */ abstract contract ExactSettableFixedPrice is ExactFixedPrice, CallbackerWithAccessControl { constructor(uint256 price) ExactFixedPrice(price) {} /** * @notice Sets the price of a single purchase. */ function setPrice(uint256 price) external onlyRole(DEFAULT_STEERING_ROLE) { _setPrice(price); } }
{ "remappings": [ "@divergencetech/ethier/=/home/dave/.cache/bazel/_bazel_dave/b9a57168317213f9241a484d2ee2d038/external/ethier_0-55-0/", "@openzeppelin/=/home/dave/.cache/bazel/_bazel_dave/b9a57168317213f9241a484d2ee2d038/external/openzeppelin-contracts_4-8-1/", "ERC721A/=/home/dave/.cache/bazel/_bazel_dave/b9a57168317213f9241a484d2ee2d038/external/ERC721A_4-2-3/contracts/", "ERC721A_root/=/home/dave/.cache/bazel/_bazel_dave/b9a57168317213f9241a484d2ee2d038/external/ERC721A_4-2-3/", "delegation-registry/=/home/dave/.cache/bazel/_bazel_dave/b9a57168317213f9241a484d2ee2d038/external/delegation-registry_2d1a158b/src/", "delegation-registry_root/=/home/dave/.cache/bazel/_bazel_dave/b9a57168317213f9241a484d2ee2d038/external/delegation-registry_2d1a158b/", "ds-test/=/home/dave/.cache/bazel/_bazel_dave/b9a57168317213f9241a484d2ee2d038/external/ds-test_013e6c64/src/", "ds-test_root/=/home/dave/.cache/bazel/_bazel_dave/b9a57168317213f9241a484d2ee2d038/external/ds-test_013e6c64/", "erc721a/=/home/dave/.cache/bazel/_bazel_dave/b9a57168317213f9241a484d2ee2d038/external/ERC721A_4-2-3/", "ethier/=/home/dave/.cache/bazel/_bazel_dave/b9a57168317213f9241a484d2ee2d038/external/ethier_0-55-0/contracts/", "ethier_root/=/home/dave/.cache/bazel/_bazel_dave/b9a57168317213f9241a484d2ee2d038/external/ethier_0-55-0/", "forge-std/=/home/dave/.cache/bazel/_bazel_dave/b9a57168317213f9241a484d2ee2d038/external/forge-std_1-4-0/src/", "openzeppelin-contracts/=/home/dave/.cache/bazel/_bazel_dave/b9a57168317213f9241a484d2ee2d038/external/openzeppelin-contracts_4-8-1/contracts/", "openzeppelin-contracts/contracts/=/home/dave/.cache/bazel/_bazel_dave/b9a57168317213f9241a484d2ee2d038/external/openzeppelin-contracts_4-8-1/contracts/", "openzeppelin-contracts_root/=/home/dave/.cache/bazel/_bazel_dave/b9a57168317213f9241a484d2ee2d038/external/openzeppelin-contracts_4-8-1/", "operator-filter-registry/src/=/home/dave/.cache/bazel/_bazel_dave/b9a57168317213f9241a484d2ee2d038/external/operator-filter-registry_1-4-1/src/", "operator-filter-registry_root/=/home/dave/.cache/bazel/_bazel_dave/b9a57168317213f9241a484d2ee2d038/external/operator-filter-registry_1-4-1/", "proof/constants/=/home/dave/proof/proof-seller/contracts/constants/src/", "proof/entropy/=/home/dave/proof/proof-seller/contracts/entropy/", "proof/redemption/=/home/dave/proof/proof-seller/contracts/redemption/src/", "proof/sellers/=/home/dave/proof/proof-seller/contracts/sellers/src/" ], "optimizer": { "enabled": true, "runs": 9999 }, "metadata": { "bytecodeHash": "ipfs", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "london", "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"admin","type":"address"},{"internalType":"address","name":"steerer","type":"address"},{"internalType":"contract ISellable","name":"sellable_","type":"address"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"contract IERC721","name":"gatingToken","type":"address"},{"internalType":"enum NestingLevelLib.NestingLevel","name":"requiredLevel","type":"uint8"},{"internalType":"contract IDelegationRegistry","name":"registry","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"bytes","name":"reason","type":"bytes"}],"name":"CallbackFailed","type":"error"},{"inputs":[{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"enum NestingLevelLib.NestingLevel","name":"nestingLevel","type":"uint8"}],"internalType":"struct NestingLevelLib.MoonbirdNestingLevel","name":"moonbirdNestingLevel","type":"tuple"},{"internalType":"enum NestingLevelLib.NestingLevel","name":"requiredNestingLevel","type":"uint8"}],"name":"InsufficientNestingLevel","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"OperatorNotAllowedToPurchaseWithToken","type":"error"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"TokenAlreadyUsedForPurchase","type":"error"},{"inputs":[{"components":[{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"enum NestingLevelLib.NestingLevel","name":"nestingLevel","type":"uint8"}],"internalType":"struct NestingLevelLib.MoonbirdNestingLevel","name":"payload","type":"tuple"},{"internalType":"bytes","name":"signature","type":"bytes"}],"internalType":"struct NestingLevelLib.SignedMoonbirdNestingLevel","name":"","type":"tuple"},{"internalType":"address","name":"recovered","type":"address"}],"name":"UnauthorisedSigner","type":"error"},{"inputs":[{"internalType":"uint256","name":"actual","type":"uint256"},{"internalType":"uint256","name":"expected","type":"uint256"}],"name":"WrongPayment","type":"error"},{"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"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_STEERING_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"alreadyPurchasedWithTokens","outputs":[{"internalType":"bool[]","name":"","type":"bool[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"rm","type":"address[]"},{"internalType":"address[]","name":"add","type":"address[]"}],"name":"changeAllowlistSigners","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint64","name":"num","type":"uint64"}],"name":"cost","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"enum NestingLevelLib.NestingLevel","name":"nestingLevel","type":"uint8"}],"internalType":"struct NestingLevelLib.MoonbirdNestingLevel","name":"moonbirdNestingLevel","type":"tuple"}],"name":"digest","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"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":"bytes32","name":"role","type":"bytes32"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getRoleMember","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMemberCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":[{"components":[{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"enum NestingLevelLib.NestingLevel","name":"nestingLevel","type":"uint8"}],"internalType":"struct NestingLevelLib.MoonbirdNestingLevel","name":"payload","type":"tuple"},{"internalType":"bytes","name":"signature","type":"bytes"}],"internalType":"struct NestingLevelLib.SignedMoonbirdNestingLevel[]","name":"sigs","type":"tuple[]"}],"name":"purchase","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":"requiredNestingLevel","outputs":[{"internalType":"enum NestingLevelLib.NestingLevel","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"sellable","outputs":[{"internalType":"contract ISellable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"price","type":"uint256"}],"name":"setPrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
6101006040523480156200001257600080fd5b5060405162002b3c38038062002b3c833981016040819052620000359162000249565b60016000556001600160a01b038316608052838787878084868989806005811115620000655762000065620002eb565b60a08160058111156200007c576200007c620002eb565b90525050506001600160a01b031660c0526200009781600455565b506001600160a01b031660e052620000b1600084620000ee565b620000dd7f1e4c11efbd6a865b1cba79eea33d1b33c1394d834190605ed6a14c71c480bf7683620000ee565b505050505050505050505062000301565b620000fa828262000119565b6000828152600660205260409020620001149082620001be565b505050565b60008281526005602090815260408083206001600160a01b038516845290915290205460ff16620001ba5760008281526005602090815260408083206001600160a01b03851684529091529020805460ff19166001179055620001793390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b6000620001d5836001600160a01b038416620001de565b90505b92915050565b60008181526001830160205260408120546200022757508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155620001d8565b506000620001d8565b6001600160a01b03811681146200024657600080fd5b50565b600080600080600080600060e0888a0312156200026557600080fd5b8751620002728162000230565b6020890151909750620002858162000230565b6040890151909650620002988162000230565b606089015160808a01519196509450620002b28162000230565b60a089015190935060068110620002c857600080fd5b60c0890151909250620002db8162000230565b8091505092959891949750929550565b634e487b7160e01b600052602160045260246000fd5b60805160a05160c05160e0516127ec62000350600039600081816102bd0152611b2b0152600061124a0152600081816101b801528181610553015261062001526000610bea01526127ec6000f3fe6080604052600436106101295760003560e01c80636deefc7a116100a557806391d1485411610074578063ca15c87311610059578063ca15c873146103cc578063d547741f146103ec578063edbc99031461040c57600080fd5b806391d1485414610364578063a217fddf146103b757600080fd5b80636deefc7a146102ab578063824fad99146103045780639010d07c1461032457806391b7f5ed1461034457600080fd5b8063248a9ca3116100fc57806331c23d20116100e157806331c23d201461023757806336568abe1461026b5780633aedca7c1461028b57600080fd5b8063248a9ca3146101e75780632f2ff15d1461021757600080fd5b806301ffc9a71461012e5780630250339b146101635780630be5923a1461019157806320e2570d146101a6575b600080fd5b34801561013a57600080fd5b5061014e610149366004611ee0565b610439565b60405190151581526020015b60405180910390f35b34801561016f57600080fd5b5061018361017e366004611f22565b61044a565b60405190815260200161015a565b6101a461019f366004611f91565b610455565b005b3480156101b257600080fd5b506101da7f000000000000000000000000000000000000000000000000000000000000000081565b60405161015a919061203d565b3480156101f357600080fd5b5061018361020236600461204b565b60009081526005602052604090206001015490565b34801561022357600080fd5b506101a4610232366004612086565b6106b0565b34801561024357600080fd5b506101837f1e4c11efbd6a865b1cba79eea33d1b33c1394d834190605ed6a14c71c480bf7681565b34801561027757600080fd5b506101a4610286366004612086565b6106d5565b34801561029757600080fd5b506101a46102a63660046120b6565b610788565b3480156102b757600080fd5b506102df7f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161015a565b34801561031057600080fd5b5061018361031f3660046121f6565b6107c5565b34801561033057600080fd5b506102df61033f366004612212565b6107d0565b34801561035057600080fd5b506101a461035f36600461204b565b6107ef565b34801561037057600080fd5b5061014e61037f366004612086565b600091825260056020908152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b3480156103c357600080fd5b50610183600081565b3480156103d857600080fd5b506101836103e736600461204b565b610822565b3480156103f857600080fd5b506101a4610407366004612086565b610839565b34801561041857600080fd5b5061042c610427366004611f91565b61085e565b60405161015a9190612234565b600061044482610918565b92915050565b60006104448261096e565b60008167ffffffffffffffff81111561047057610470612122565b604051908082528060200260200182016040528015610499578160200160208202803683370190505b50905060005b828110156106a15760006104de8585848181106104be576104be61227a565b90506020028101906104d091906122a9565b6104d9906122e7565b610988565b90506104eb600282610994565b610551578484838181106105015761050161227a565b905060200281019061051391906122a9565b816040517f0dc5f61a0000000000000000000000000000000000000000000000000000000081526004016105489291906123b1565b60405180910390fd5b7f0000000000000000000000000000000000000000000000000000000000000000600581111561058357610583611fd3565b8585848181106105955761059561227a565b90506020028101906105a791906122a9565b6105b8906040810190602001612475565b60058111156105c9576105c9611fd3565b1015610648578484838181106105e1576105e161227a565b90506020028101906105f391906122a9565b6040517fffb4def400000000000000000000000000000000000000000000000000000000815261054891907f000000000000000000000000000000000000000000000000000000000000000090600401612490565b84848381811061065a5761065a61227a565b905060200281019061066c91906122a9565b600001600001358383815181106106855761068561227a565b60209081029190910101525061069a816124da565b905061049f565b506106ab816109c3565b505050565b6000828152600560205260409020600101546106cb816109f3565b6106ab83836109fd565b73ffffffffffffffffffffffffffffffffffffffff8116331461077a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c6600000000000000000000000000000000006064820152608401610548565b6107848282610a1f565b5050565b7f1e4c11efbd6a865b1cba79eea33d1b33c1394d834190605ed6a14c71c480bf766107b2816109f3565b6107be85858585610a41565b5050505050565b600061044482610ade565b60008281526006602052604081206107e89083610aea565b9392505050565b7f1e4c11efbd6a865b1cba79eea33d1b33c1394d834190605ed6a14c71c480bf76610819816109f3565b61078482600455565b600081815260066020526040812061044490610af6565b600082815260056020526040902060010154610854816109f3565b6106ab8383610a1f565b606060008267ffffffffffffffff81111561087b5761087b612122565b6040519080825280602002602001820160405280156108a4578160200160208202803683370190505b50905060005b83811015610910576108de8585838181106108c7576108c761227a565b905060200201356001610b0090919063ffffffff16565b8282815181106108f0576108f061227a565b91151560209283029190910190910152610909816124da565b90506108aa565b509392505050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f5a05180f000000000000000000000000000000000000000000000000000000001480610444575061044482610b24565b60006004548267ffffffffffffffff166104449190612512565b60006104448246610bbb565b73ffffffffffffffffffffffffffffffffffffffff8116600090815260018301602052604081205415156107e8565b6109cd3382610bd8565b6109f0336109db8351610d58565b60405180602001604052806000815250610df6565b50565b6109f08133610e22565b610a078282610ebe565b60008281526006602052604090206106ab9082610fb2565b610a298282610fd4565b60008281526006602052604090206106ab908261108f565b60005b83811015610a8f57610a7e858583818110610a6157610a6161227a565b9050602002016020810190610a769190612529565b60029061108f565b50610a88816124da565b9050610a44565b5060005b818110156107be57610acd838383818110610ab057610ab061227a565b9050602002016020810190610ac59190612529565b600290610fb2565b50610ad7816124da565b9050610a93565b600061044482466110b1565b60006107e883836110dd565b6000610444825490565b600881901c600090815260208390526040902054600160ff83161b16151592915050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b00000000000000000000000000000000000000000000000000000000148061044457507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000831614610444565b81516000906107e890610bce90846110b1565b8460200151611107565b60005b81518110156106ab57610c28837f0000000000000000000000000000000000000000000000000000000000000000848481518110610c1b57610c1b61227a565b6020026020010151611123565b610c9a5782828281518110610c3f57610c3f61227a565b60209081029190910101516040517f580402d800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff90921660048301526024820152604401610548565b610cc7828281518110610caf57610caf61227a565b60200260200101516001610b0090919063ffffffff16565b15610d1b57818181518110610cde57610cde61227a565b60200260200101516040517f2f61d7fb00000000000000000000000000000000000000000000000000000000815260040161054891815260200190565b610d48828281518110610d3057610d3061227a565b6020026020010151600161142090919063ffffffff16565b610d51816124da565b9050610bdb565b600067ffffffffffffffff821115610df2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203660448201527f34206269747300000000000000000000000000000000000000000000000000006064820152608401610548565b5090565b6106ab83837fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff84611449565b600082815260056020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff1661078457610e6281611483565b610e6d8360206114a2565b604051602001610e7e92919061256a565b60408051601f19818403018152908290527f08c379a000000000000000000000000000000000000000000000000000000000825261054891600401612617565b600082815260056020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff1661078457600082815260056020908152604080832073ffffffffffffffffffffffffffffffffffffffff85168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055610f543390565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60006107e88373ffffffffffffffffffffffffffffffffffffffff84166116e5565b600082815260056020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff161561078457600082815260056020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60006107e88373ffffffffffffffffffffffffffffffffffffffff8416611734565b60006107e883836040516020016110c992919061262a565b604051602081830303815290604052611827565b60008260000182815481106110f4576110f461227a565b9060005260206000200154905092915050565b60008060006111168585611862565b91509150610910816118a7565b6040517f6352211e00000000000000000000000000000000000000000000000000000000815260048101829052600090819073ffffffffffffffffffffffffffffffffffffffff851690636352211e90602401602060405180830381865afa158015611193573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111b79190612653565b90508073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614806112b557506040517faba69cf800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff868116600483015282811660248301528581166044830152606482018590527f0000000000000000000000000000000000000000000000000000000000000000169063aba69cf890608401602060405180830381865afa158015611291573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112b59190612670565b8061135357506040517fe985e9c500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8281166004830152868116602483015285169063e985e9c590604401602060405180830381865afa15801561132f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113539190612670565b8061141757506040517f081812fc0000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff85169063081812fc90602401602060405180830381865afa1580156113c4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113e89190612653565b73ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16145b95945050505050565b600881901c600090815260209290925260409091208054600160ff9093169290921b9091179055565b611451611a5a565b600061145f85858585611acd565b9196509450905061147285858385611aee565b5061147d6001600055565b50505050565b606061044473ffffffffffffffffffffffffffffffffffffffff831660145b606060006114b1836002612512565b6114bc906002612692565b67ffffffffffffffff8111156114d4576114d4612122565b6040519080825280601f01601f1916602001820160405280156114fe576020820181803683370190505b5090507f3000000000000000000000000000000000000000000000000000000000000000816000815181106115355761153561227a565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f7800000000000000000000000000000000000000000000000000000000000000816001815181106115985761159861227a565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060006115d4846002612512565b6115df906001612692565b90505b600181111561167c577f303132333435363738396162636465660000000000000000000000000000000085600f16601081106116205761162061227a565b1a60f81b8282815181106116365761163661227a565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060049490941c93611675816126a5565b90506115e2565b5083156107e8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610548565b600081815260018301602052604081205461172c57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610444565b506000610444565b6000818152600183016020526040812054801561181d5760006117586001836126da565b855490915060009061176c906001906126da565b90508181146117d157600086600001828154811061178c5761178c61227a565b90600052602060002001549050808760000184815481106117af576117af61227a565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806117e2576117e26126ed565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610444565b6000915050610444565b60006118338251611bf9565b8260405160200161184592919061271c565b604051602081830303815290604052805190602001209050919050565b60008082516041036118985760208301516040840151606085015160001a61188c87828585611cb7565b945094505050506118a0565b506000905060025b9250929050565b60008160048111156118bb576118bb611fd3565b036118c35750565b60018160048111156118d7576118d7611fd3565b0361193e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610548565b600281600481111561195257611952611fd3565b036119b9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610548565b60038160048111156119cd576119cd611fd3565b036109f0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c60448201527f75650000000000000000000000000000000000000000000000000000000000006064820152608401610548565b600260005403611ac6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610548565b6002600055565b6000806000611ade87878787611d88565b9250925092509450945094915050565b6040517f5ada5c5500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001690635ada5c55908490611b6690889088908790600401612777565b6000604051808303818588803b158015611b7f57600080fd5b505af193505050508015611b91575060015b61147d573d808015611bbf576040519150601f19603f3d011682016040523d82523d6000602084013e611bc4565b606091505b50806040517f30b9b6dd0000000000000000000000000000000000000000000000000000000081526004016105489190612617565b60606000611c0683611def565b600101905060008167ffffffffffffffff811115611c2657611c26612122565b6040519080825280601f01601f191660200182016040528015611c50576020820181803683370190505b5090508181016020015b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff017f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a8504945084611c5a57509392505050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115611cee5750600090506003611d7f565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015611d42573d6000803e3d6000fd5b5050604051601f19015191505073ffffffffffffffffffffffffffffffffffffffff8116611d7857600060019250925050611d7f565b9150600090505b94509492505050565b6000806000611d9987878787611ed1565b91985096509450348514611de2576040517f0dd32d1c00000000000000000000000000000000000000000000000000000000815234600482015260248101869052604401610548565b5094959394509192915050565b6000807a184f03e93ff9f4daa797ed6e38ed64bf6a1f0100000000000000008310611e38577a184f03e93ff9f4daa797ed6e38ed64bf6a1f010000000000000000830492506040015b6d04ee2d6d415b85acef81000000008310611e64576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc100008310611e8257662386f26fc10000830492506010015b6305f5e1008310611e9a576305f5e100830492506008015b6127108310611eae57612710830492506004015b60648310611ec0576064830492506002015b600a83106104445760010192915050565b600080808686611ade8161096e565b600060208284031215611ef257600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146107e857600080fd5b600060208284031215611f3457600080fd5b813567ffffffffffffffff811681146107e857600080fd5b60008083601f840112611f5e57600080fd5b50813567ffffffffffffffff811115611f7657600080fd5b6020830191508360208260051b85010111156118a057600080fd5b60008060208385031215611fa457600080fd5b823567ffffffffffffffff811115611fbb57600080fd5b611fc785828601611f4c565b90969095509350505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b60068110612039577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b9052565b602081016104448284612002565b60006020828403121561205d57600080fd5b5035919050565b73ffffffffffffffffffffffffffffffffffffffff811681146109f057600080fd5b6000806040838503121561209957600080fd5b8235915060208301356120ab81612064565b809150509250929050565b600080600080604085870312156120cc57600080fd5b843567ffffffffffffffff808211156120e457600080fd5b6120f088838901611f4c565b9096509450602087013591508082111561210957600080fd5b5061211687828801611f4c565b95989497509550505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040805190810167ffffffffffffffff8111828210171561217457612174612122565b60405290565b604051601f8201601f1916810167ffffffffffffffff811182821017156121a3576121a3612122565b604052919050565b8035600681106121ba57600080fd5b919050565b6000604082840312156121d157600080fd5b6121d9612151565b9050813581526121eb602083016121ab565b602082015292915050565b60006040828403121561220857600080fd5b6107e883836121bf565b6000806040838503121561222557600080fd5b50508035926020909101359150565b6020808252825182820181905260009190848201906040850190845b8181101561226e578351151583529284019291840191600101612250565b50909695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600082357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa18336030181126122dd57600080fd5b9190910192915050565b6000606082360312156122f957600080fd5b612301612151565b61230b36846121bf565b8152604083013567ffffffffffffffff8082111561232857600080fd5b9084019036601f83011261233b57600080fd5b813560208282111561234f5761234f612122565b61236181601f19601f8501160161217a565b9250818352368183860101111561237757600080fd5b818185018285013760009183018101919091528301525092915050565b803582526123a4602082016121ab565b6106ab6020840182612002565b604081526123c26040820184612394565b600060408401357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18536030181126123f957600080fd5b840160208101903567ffffffffffffffff81111561241657600080fd5b80360382131561242557600080fd5b606060808501528060a0850152808260c0860137600060c0828601015260c0601f19601f830116850101925050506107e8602083018473ffffffffffffffffffffffffffffffffffffffff169052565b60006020828403121561248757600080fd5b6107e8826121ab565b6060810161249e8285612394565b6107e86040830184612002565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361250b5761250b6124ab565b5060010190565b8082028115828204841417610444576104446124ab565b60006020828403121561253b57600080fd5b81356107e881612064565b60005b83811015612561578181015183820152602001612549565b50506000910152565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516125a2816017850160208801612546565b7f206973206d697373696e6720726f6c652000000000000000000000000000000060179184019182015283516125df816028840160208801612546565b01602801949350505050565b60008151808452612603816020860160208601612546565b601f01601f19169290920160200192915050565b6020815260006107e860208301846125eb565b82518152602080840151606083019161264590840182612002565b508260408301529392505050565b60006020828403121561266557600080fd5b81516107e881612064565b60006020828403121561268257600080fd5b815180151581146107e857600080fd5b80820180821115610444576104446124ab565b6000816126b4576126b46124ab565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190565b81810381811115610444576104446124ab565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b7f19457468657265756d205369676e6564204d6573736167653a0a00000000000081526000835161275481601a850160208801612546565b83519083019061276b81601a840160208801612546565b01601a01949350505050565b73ffffffffffffffffffffffffffffffffffffffff8416815267ffffffffffffffff8316602082015260606040820152600061141760608301846125eb56fea2646970667358221220ab79920e0835e14cb57b9fa4133fa1ca6519c1e47078cb15dd13d0e3bce9fa3964736f6c6343000813003300000000000000000000000070c71b539bdcb5b59edd42a500fd95bdec96265000000000000000000000000032220f07dbcd18149f619f28cd09fd911cc0372d00000000000000000000000013303b4ee819fac204be5ef77523cfcd558c082f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000023581767a106ae21c074b2276d25e5c3e136a68b000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000076a84fef008cdabe6409d2fe638b
Deployed Bytecode
0x6080604052600436106101295760003560e01c80636deefc7a116100a557806391d1485411610074578063ca15c87311610059578063ca15c873146103cc578063d547741f146103ec578063edbc99031461040c57600080fd5b806391d1485414610364578063a217fddf146103b757600080fd5b80636deefc7a146102ab578063824fad99146103045780639010d07c1461032457806391b7f5ed1461034457600080fd5b8063248a9ca3116100fc57806331c23d20116100e157806331c23d201461023757806336568abe1461026b5780633aedca7c1461028b57600080fd5b8063248a9ca3146101e75780632f2ff15d1461021757600080fd5b806301ffc9a71461012e5780630250339b146101635780630be5923a1461019157806320e2570d146101a6575b600080fd5b34801561013a57600080fd5b5061014e610149366004611ee0565b610439565b60405190151581526020015b60405180910390f35b34801561016f57600080fd5b5061018361017e366004611f22565b61044a565b60405190815260200161015a565b6101a461019f366004611f91565b610455565b005b3480156101b257600080fd5b506101da7f000000000000000000000000000000000000000000000000000000000000000581565b60405161015a919061203d565b3480156101f357600080fd5b5061018361020236600461204b565b60009081526005602052604090206001015490565b34801561022357600080fd5b506101a4610232366004612086565b6106b0565b34801561024357600080fd5b506101837f1e4c11efbd6a865b1cba79eea33d1b33c1394d834190605ed6a14c71c480bf7681565b34801561027757600080fd5b506101a4610286366004612086565b6106d5565b34801561029757600080fd5b506101a46102a63660046120b6565b610788565b3480156102b757600080fd5b506102df7f00000000000000000000000013303b4ee819fac204be5ef77523cfcd558c082f81565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161015a565b34801561031057600080fd5b5061018361031f3660046121f6565b6107c5565b34801561033057600080fd5b506102df61033f366004612212565b6107d0565b34801561035057600080fd5b506101a461035f36600461204b565b6107ef565b34801561037057600080fd5b5061014e61037f366004612086565b600091825260056020908152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b3480156103c357600080fd5b50610183600081565b3480156103d857600080fd5b506101836103e736600461204b565b610822565b3480156103f857600080fd5b506101a4610407366004612086565b610839565b34801561041857600080fd5b5061042c610427366004611f91565b61085e565b60405161015a9190612234565b600061044482610918565b92915050565b60006104448261096e565b60008167ffffffffffffffff81111561047057610470612122565b604051908082528060200260200182016040528015610499578160200160208202803683370190505b50905060005b828110156106a15760006104de8585848181106104be576104be61227a565b90506020028101906104d091906122a9565b6104d9906122e7565b610988565b90506104eb600282610994565b610551578484838181106105015761050161227a565b905060200281019061051391906122a9565b816040517f0dc5f61a0000000000000000000000000000000000000000000000000000000081526004016105489291906123b1565b60405180910390fd5b7f0000000000000000000000000000000000000000000000000000000000000005600581111561058357610583611fd3565b8585848181106105955761059561227a565b90506020028101906105a791906122a9565b6105b8906040810190602001612475565b60058111156105c9576105c9611fd3565b1015610648578484838181106105e1576105e161227a565b90506020028101906105f391906122a9565b6040517fffb4def400000000000000000000000000000000000000000000000000000000815261054891907f000000000000000000000000000000000000000000000000000000000000000590600401612490565b84848381811061065a5761065a61227a565b905060200281019061066c91906122a9565b600001600001358383815181106106855761068561227a565b60209081029190910101525061069a816124da565b905061049f565b506106ab816109c3565b505050565b6000828152600560205260409020600101546106cb816109f3565b6106ab83836109fd565b73ffffffffffffffffffffffffffffffffffffffff8116331461077a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c6600000000000000000000000000000000006064820152608401610548565b6107848282610a1f565b5050565b7f1e4c11efbd6a865b1cba79eea33d1b33c1394d834190605ed6a14c71c480bf766107b2816109f3565b6107be85858585610a41565b5050505050565b600061044482610ade565b60008281526006602052604081206107e89083610aea565b9392505050565b7f1e4c11efbd6a865b1cba79eea33d1b33c1394d834190605ed6a14c71c480bf76610819816109f3565b61078482600455565b600081815260066020526040812061044490610af6565b600082815260056020526040902060010154610854816109f3565b6106ab8383610a1f565b606060008267ffffffffffffffff81111561087b5761087b612122565b6040519080825280602002602001820160405280156108a4578160200160208202803683370190505b50905060005b83811015610910576108de8585838181106108c7576108c761227a565b905060200201356001610b0090919063ffffffff16565b8282815181106108f0576108f061227a565b91151560209283029190910190910152610909816124da565b90506108aa565b509392505050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f5a05180f000000000000000000000000000000000000000000000000000000001480610444575061044482610b24565b60006004548267ffffffffffffffff166104449190612512565b60006104448246610bbb565b73ffffffffffffffffffffffffffffffffffffffff8116600090815260018301602052604081205415156107e8565b6109cd3382610bd8565b6109f0336109db8351610d58565b60405180602001604052806000815250610df6565b50565b6109f08133610e22565b610a078282610ebe565b60008281526006602052604090206106ab9082610fb2565b610a298282610fd4565b60008281526006602052604090206106ab908261108f565b60005b83811015610a8f57610a7e858583818110610a6157610a6161227a565b9050602002016020810190610a769190612529565b60029061108f565b50610a88816124da565b9050610a44565b5060005b818110156107be57610acd838383818110610ab057610ab061227a565b9050602002016020810190610ac59190612529565b600290610fb2565b50610ad7816124da565b9050610a93565b600061044482466110b1565b60006107e883836110dd565b6000610444825490565b600881901c600090815260208390526040902054600160ff83161b16151592915050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b00000000000000000000000000000000000000000000000000000000148061044457507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000831614610444565b81516000906107e890610bce90846110b1565b8460200151611107565b60005b81518110156106ab57610c28837f00000000000000000000000023581767a106ae21c074b2276d25e5c3e136a68b848481518110610c1b57610c1b61227a565b6020026020010151611123565b610c9a5782828281518110610c3f57610c3f61227a565b60209081029190910101516040517f580402d800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff90921660048301526024820152604401610548565b610cc7828281518110610caf57610caf61227a565b60200260200101516001610b0090919063ffffffff16565b15610d1b57818181518110610cde57610cde61227a565b60200260200101516040517f2f61d7fb00000000000000000000000000000000000000000000000000000000815260040161054891815260200190565b610d48828281518110610d3057610d3061227a565b6020026020010151600161142090919063ffffffff16565b610d51816124da565b9050610bdb565b600067ffffffffffffffff821115610df2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203660448201527f34206269747300000000000000000000000000000000000000000000000000006064820152608401610548565b5090565b6106ab83837fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff84611449565b600082815260056020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff1661078457610e6281611483565b610e6d8360206114a2565b604051602001610e7e92919061256a565b60408051601f19818403018152908290527f08c379a000000000000000000000000000000000000000000000000000000000825261054891600401612617565b600082815260056020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff1661078457600082815260056020908152604080832073ffffffffffffffffffffffffffffffffffffffff85168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055610f543390565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60006107e88373ffffffffffffffffffffffffffffffffffffffff84166116e5565b600082815260056020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff161561078457600082815260056020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60006107e88373ffffffffffffffffffffffffffffffffffffffff8416611734565b60006107e883836040516020016110c992919061262a565b604051602081830303815290604052611827565b60008260000182815481106110f4576110f461227a565b9060005260206000200154905092915050565b60008060006111168585611862565b91509150610910816118a7565b6040517f6352211e00000000000000000000000000000000000000000000000000000000815260048101829052600090819073ffffffffffffffffffffffffffffffffffffffff851690636352211e90602401602060405180830381865afa158015611193573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111b79190612653565b90508073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614806112b557506040517faba69cf800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff868116600483015282811660248301528581166044830152606482018590527f00000000000000000000000000000000000076a84fef008cdabe6409d2fe638b169063aba69cf890608401602060405180830381865afa158015611291573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112b59190612670565b8061135357506040517fe985e9c500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8281166004830152868116602483015285169063e985e9c590604401602060405180830381865afa15801561132f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113539190612670565b8061141757506040517f081812fc0000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff85169063081812fc90602401602060405180830381865afa1580156113c4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113e89190612653565b73ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16145b95945050505050565b600881901c600090815260209290925260409091208054600160ff9093169290921b9091179055565b611451611a5a565b600061145f85858585611acd565b9196509450905061147285858385611aee565b5061147d6001600055565b50505050565b606061044473ffffffffffffffffffffffffffffffffffffffff831660145b606060006114b1836002612512565b6114bc906002612692565b67ffffffffffffffff8111156114d4576114d4612122565b6040519080825280601f01601f1916602001820160405280156114fe576020820181803683370190505b5090507f3000000000000000000000000000000000000000000000000000000000000000816000815181106115355761153561227a565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f7800000000000000000000000000000000000000000000000000000000000000816001815181106115985761159861227a565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060006115d4846002612512565b6115df906001612692565b90505b600181111561167c577f303132333435363738396162636465660000000000000000000000000000000085600f16601081106116205761162061227a565b1a60f81b8282815181106116365761163661227a565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060049490941c93611675816126a5565b90506115e2565b5083156107e8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610548565b600081815260018301602052604081205461172c57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610444565b506000610444565b6000818152600183016020526040812054801561181d5760006117586001836126da565b855490915060009061176c906001906126da565b90508181146117d157600086600001828154811061178c5761178c61227a565b90600052602060002001549050808760000184815481106117af576117af61227a565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806117e2576117e26126ed565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610444565b6000915050610444565b60006118338251611bf9565b8260405160200161184592919061271c565b604051602081830303815290604052805190602001209050919050565b60008082516041036118985760208301516040840151606085015160001a61188c87828585611cb7565b945094505050506118a0565b506000905060025b9250929050565b60008160048111156118bb576118bb611fd3565b036118c35750565b60018160048111156118d7576118d7611fd3565b0361193e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610548565b600281600481111561195257611952611fd3565b036119b9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610548565b60038160048111156119cd576119cd611fd3565b036109f0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c60448201527f75650000000000000000000000000000000000000000000000000000000000006064820152608401610548565b600260005403611ac6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610548565b6002600055565b6000806000611ade87878787611d88565b9250925092509450945094915050565b6040517f5ada5c5500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000013303b4ee819fac204be5ef77523cfcd558c082f1690635ada5c55908490611b6690889088908790600401612777565b6000604051808303818588803b158015611b7f57600080fd5b505af193505050508015611b91575060015b61147d573d808015611bbf576040519150601f19603f3d011682016040523d82523d6000602084013e611bc4565b606091505b50806040517f30b9b6dd0000000000000000000000000000000000000000000000000000000081526004016105489190612617565b60606000611c0683611def565b600101905060008167ffffffffffffffff811115611c2657611c26612122565b6040519080825280601f01601f191660200182016040528015611c50576020820181803683370190505b5090508181016020015b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff017f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a8504945084611c5a57509392505050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115611cee5750600090506003611d7f565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015611d42573d6000803e3d6000fd5b5050604051601f19015191505073ffffffffffffffffffffffffffffffffffffffff8116611d7857600060019250925050611d7f565b9150600090505b94509492505050565b6000806000611d9987878787611ed1565b91985096509450348514611de2576040517f0dd32d1c00000000000000000000000000000000000000000000000000000000815234600482015260248101869052604401610548565b5094959394509192915050565b6000807a184f03e93ff9f4daa797ed6e38ed64bf6a1f0100000000000000008310611e38577a184f03e93ff9f4daa797ed6e38ed64bf6a1f010000000000000000830492506040015b6d04ee2d6d415b85acef81000000008310611e64576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc100008310611e8257662386f26fc10000830492506010015b6305f5e1008310611e9a576305f5e100830492506008015b6127108310611eae57612710830492506004015b60648310611ec0576064830492506002015b600a83106104445760010192915050565b600080808686611ade8161096e565b600060208284031215611ef257600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146107e857600080fd5b600060208284031215611f3457600080fd5b813567ffffffffffffffff811681146107e857600080fd5b60008083601f840112611f5e57600080fd5b50813567ffffffffffffffff811115611f7657600080fd5b6020830191508360208260051b85010111156118a057600080fd5b60008060208385031215611fa457600080fd5b823567ffffffffffffffff811115611fbb57600080fd5b611fc785828601611f4c565b90969095509350505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b60068110612039577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b9052565b602081016104448284612002565b60006020828403121561205d57600080fd5b5035919050565b73ffffffffffffffffffffffffffffffffffffffff811681146109f057600080fd5b6000806040838503121561209957600080fd5b8235915060208301356120ab81612064565b809150509250929050565b600080600080604085870312156120cc57600080fd5b843567ffffffffffffffff808211156120e457600080fd5b6120f088838901611f4c565b9096509450602087013591508082111561210957600080fd5b5061211687828801611f4c565b95989497509550505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040805190810167ffffffffffffffff8111828210171561217457612174612122565b60405290565b604051601f8201601f1916810167ffffffffffffffff811182821017156121a3576121a3612122565b604052919050565b8035600681106121ba57600080fd5b919050565b6000604082840312156121d157600080fd5b6121d9612151565b9050813581526121eb602083016121ab565b602082015292915050565b60006040828403121561220857600080fd5b6107e883836121bf565b6000806040838503121561222557600080fd5b50508035926020909101359150565b6020808252825182820181905260009190848201906040850190845b8181101561226e578351151583529284019291840191600101612250565b50909695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600082357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa18336030181126122dd57600080fd5b9190910192915050565b6000606082360312156122f957600080fd5b612301612151565b61230b36846121bf565b8152604083013567ffffffffffffffff8082111561232857600080fd5b9084019036601f83011261233b57600080fd5b813560208282111561234f5761234f612122565b61236181601f19601f8501160161217a565b9250818352368183860101111561237757600080fd5b818185018285013760009183018101919091528301525092915050565b803582526123a4602082016121ab565b6106ab6020840182612002565b604081526123c26040820184612394565b600060408401357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18536030181126123f957600080fd5b840160208101903567ffffffffffffffff81111561241657600080fd5b80360382131561242557600080fd5b606060808501528060a0850152808260c0860137600060c0828601015260c0601f19601f830116850101925050506107e8602083018473ffffffffffffffffffffffffffffffffffffffff169052565b60006020828403121561248757600080fd5b6107e8826121ab565b6060810161249e8285612394565b6107e86040830184612002565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361250b5761250b6124ab565b5060010190565b8082028115828204841417610444576104446124ab565b60006020828403121561253b57600080fd5b81356107e881612064565b60005b83811015612561578181015183820152602001612549565b50506000910152565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516125a2816017850160208801612546565b7f206973206d697373696e6720726f6c652000000000000000000000000000000060179184019182015283516125df816028840160208801612546565b01602801949350505050565b60008151808452612603816020860160208601612546565b601f01601f19169290920160200192915050565b6020815260006107e860208301846125eb565b82518152602080840151606083019161264590840182612002565b508260408301529392505050565b60006020828403121561266557600080fd5b81516107e881612064565b60006020828403121561268257600080fd5b815180151581146107e857600080fd5b80820180821115610444576104446124ab565b6000816126b4576126b46124ab565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190565b81810381811115610444576104446124ab565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b7f19457468657265756d205369676e6564204d6573736167653a0a00000000000081526000835161275481601a850160208801612546565b83519083019061276b81601a840160208801612546565b01601a01949350505050565b73ffffffffffffffffffffffffffffffffffffffff8416815267ffffffffffffffff8316602082015260606040820152600061141760608301846125eb56fea2646970667358221220ab79920e0835e14cb57b9fa4133fa1ca6519c1e47078cb15dd13d0e3bce9fa3964736f6c63430008130033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000070c71b539bdcb5b59edd42a500fd95bdec96265000000000000000000000000032220f07dbcd18149f619f28cd09fd911cc0372d00000000000000000000000013303b4ee819fac204be5ef77523cfcd558c082f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000023581767a106ae21c074b2276d25e5c3e136a68b000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000076a84fef008cdabe6409d2fe638b
-----Decoded View---------------
Arg [0] : admin (address): 0x70c71b539BDcB5b59Edd42a500Fd95bdeC962650
Arg [1] : steerer (address): 0x32220f07DBcd18149f619F28cD09FD911cc0372D
Arg [2] : sellable_ (address): 0x13303b4EE819FAc204be5eF77523cfCd558c082f
Arg [3] : price (uint256): 0
Arg [4] : gatingToken (address): 0x23581767a106ae21c074b2276D25e5C3e136a68b
Arg [5] : requiredLevel (uint8): 5
Arg [6] : registry (address): 0x00000000000076A84feF008CDAbe6409d2FE638B
-----Encoded View---------------
7 Constructor Arguments found :
Arg [0] : 00000000000000000000000070c71b539bdcb5b59edd42a500fd95bdec962650
Arg [1] : 00000000000000000000000032220f07dbcd18149f619f28cd09fd911cc0372d
Arg [2] : 00000000000000000000000013303b4ee819fac204be5ef77523cfcd558c082f
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [4] : 00000000000000000000000023581767a106ae21c074b2276d25e5c3e136a68b
Arg [5] : 0000000000000000000000000000000000000000000000000000000000000005
Arg [6] : 00000000000000000000000000000000000076a84fef008cdabe6409d2fe638b
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.