Overview
ETH Balance
ETH Value
$0.00Multichain Info
Latest 25 from a total of 10,345 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Multicall | 14326639 | 38 mins ago | IN | 2.7740174 ETH | 0.00000159 | ||||
Multicall | 14324825 | 1 hr ago | IN | 0.03419029 ETH | 0.00000159 | ||||
Multicall | 14321634 | 2 hrs ago | IN | 5.56553865 ETH | 0.00000157 | ||||
Multicall | 14319780 | 2 hrs ago | IN | 0.00786006 ETH | 0.00000159 | ||||
Multicall | 14312808 | 4 hrs ago | IN | 2.19291386 ETH | 0.00000149 | ||||
Multicall | 14311929 | 4 hrs ago | IN | 0.00479182 ETH | 0.00000159 | ||||
Multicall | 14306697 | 6 hrs ago | IN | 0.00008316 ETH | 0.00000163 | ||||
Multicall | 14299866 | 8 hrs ago | IN | 19.18250574 ETH | 0.00000156 | ||||
Multicall | 14299127 | 8 hrs ago | IN | 0.00025825 ETH | 0.00000156 | ||||
Multicall | 14293782 | 9 hrs ago | IN | 0.041 ETH | 0.00000154 | ||||
Multicall | 14293063 | 9 hrs ago | IN | 0.04 ETH | 0.00000135 | ||||
Multicall | 14292747 | 10 hrs ago | IN | 0.04 ETH | 0.00000135 | ||||
Multicall | 14292261 | 10 hrs ago | IN | 0.00007465 ETH | 0.00000168 | ||||
Multicall | 14292261 | 10 hrs ago | IN | 0.00007465 ETH | 0.00000174 | ||||
Multicall | 14292260 | 10 hrs ago | IN | 0.00007465 ETH | 0.00000173 | ||||
Multicall | 14292260 | 10 hrs ago | IN | 0.00007465 ETH | 0.00000173 | ||||
Multicall | 14292260 | 10 hrs ago | IN | 0.00007465 ETH | 0.00000173 | ||||
Multicall | 14292260 | 10 hrs ago | IN | 0.00007465 ETH | 0.00000173 | ||||
Multicall | 14292260 | 10 hrs ago | IN | 0.00007465 ETH | 0.00000169 | ||||
Multicall | 14291579 | 10 hrs ago | IN | 0.04 ETH | 0.00000135 | ||||
Multicall | 14291342 | 10 hrs ago | IN | 0.09 ETH | 0.00000135 | ||||
Multicall | 14291113 | 10 hrs ago | IN | 0.08 ETH | 0.00000135 | ||||
Multicall | 14290836 | 10 hrs ago | IN | 0.00007445 ETH | 0.00000162 | ||||
Multicall | 14290836 | 10 hrs ago | IN | 0.00007445 ETH | 0.00000167 | ||||
Multicall | 14290835 | 10 hrs ago | IN | 0.00007445 ETH | 0.00000167 |
Latest 25 internal transactions (View All)
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
14328439 | 8 mins ago | 0.00050005 ETH | ||||
14328439 | 8 mins ago | 0.00050005 ETH | ||||
14326639 | 38 mins ago | 2.7740174 ETH | ||||
14324825 | 1 hr ago | 0.03419029 ETH | ||||
14321634 | 2 hrs ago | 5.56553865 ETH | ||||
14319812 | 2 hrs ago | 0.00122129 ETH | ||||
14319812 | 2 hrs ago | 0.00122129 ETH | ||||
14319780 | 2 hrs ago | 0.00783499 ETH | ||||
14319780 | 2 hrs ago | 0.00002507 ETH | ||||
14315848 | 3 hrs ago | 0.0002669 ETH | ||||
14315848 | 3 hrs ago | 0.0002669 ETH | ||||
14315755 | 3 hrs ago | 0.00010274 ETH | ||||
14315755 | 3 hrs ago | 0.00010274 ETH | ||||
14312808 | 4 hrs ago | 2.19291386 ETH | ||||
14312630 | 4 hrs ago | 0.00099539 ETH | ||||
14312630 | 4 hrs ago | 0.00099539 ETH | ||||
14311929 | 4 hrs ago | 0.00479182 ETH | ||||
14309346 | 5 hrs ago | 0.00107006 ETH | ||||
14309346 | 5 hrs ago | 0.00107006 ETH | ||||
14309241 | 5 hrs ago | 0.00064243 ETH | ||||
14309241 | 5 hrs ago | 0.00064243 ETH | ||||
14309167 | 5 hrs ago | 0.00385208 ETH | ||||
14309167 | 5 hrs ago | 0.00385208 ETH | ||||
14308355 | 5 hrs ago | 0.03743965 ETH | ||||
14308355 | 5 hrs ago | 0.03743965 ETH |
Contract Source Code Verified (Exact Match)
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.25; import {Tstorish} from "tstorish/src/Tstorish.sol"; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {IERC721} from "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import {IERC1155} from "@openzeppelin/contracts/token/ERC1155/IERC1155.sol"; import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import {SafeTransferLib} from "solady/src/utils/SafeTransferLib.sol"; import {ReentrancyGuardMsgSender} from "../v1/ReentrancyGuardMsgSender.sol"; import {Multicall3} from "./utils/Multicall3.sol"; import {Call3Value, Result, RelayerWitness} from "./utils/RelayStructs.sol"; contract RelayRouter is Multicall3, ReentrancyGuardMsgSender, Tstorish { using SafeTransferLib for address; /// @notice Revert if this contract is set as the recipient error InvalidRecipient(address recipient); /// @notice Revert if the target is invalid error InvalidTarget(address target); /// @notice Revert if the native transfer failed error NativeTransferFailed(); /// @notice Revert if no recipient is set error NoRecipientSet(); /// @notice Revert if the array lengths do not match error ArrayLengthsMismatch(); /// @notice Revert if a call fails error CallFailed(); /// @notice Protocol event to be emitted when transferring native tokens event SolverNativeTransfer(address to, uint256 amount); uint256 RECIPIENT_STORAGE_SLOT = uint256(keccak256("RelayRouter.recipient")) - 1; constructor() Tstorish() {} receive() external payable { emit SolverNativeTransfer(address(this), msg.value); } /// @notice Execute a multicall with the RelayRouter as msg.sender. /// @dev If a multicall is expecting to mint ERC721s or ERC1155s, the recipient must be explicitly set /// All calls to ERC721s and ERC1155s in the multicall will have the same recipient set in recipient /// Be sure to transfer ERC20s or ETH out of the router as part of the multicall /// @param calls The calls to perform /// @param refundTo The address to refund any leftover ETH to /// @param nftRecipient The address to set as recipient of ERC721/ERC1155 mints function multicall( Call3Value[] calldata calls, address refundTo, address nftRecipient ) public payable virtual nonReentrant returns (Result[] memory returnData) { // Set the NFT recipient if provided if (nftRecipient != address(0)) { _setRecipient(nftRecipient); } // Perform the multicall returnData = _aggregate3Value(calls); // Clear the recipient in storage _clearRecipient(); // Refund any leftover ETH to the sender if (address(this).balance > 0) { // If refundTo is address(0), refund to msg.sender address refundAddr = refundTo == address(0) ? msg.sender : refundTo; uint256 amount = address(this).balance; refundAddr.safeTransferETH(amount); emit SolverNativeTransfer(refundAddr, amount); } } /// @notice Send leftover ERC20 tokens to recipients /// @dev Should be included in the multicall if the router is expecting to receive tokens /// Set amount to 0 to transfer the full balance /// @param tokens The addresses of the ERC20 tokens /// @param recipients The addresses to refund the tokens to /// @param amounts The amounts to send function cleanupErc20s( address[] calldata tokens, address[] calldata recipients, uint256[] calldata amounts ) public virtual { // Revert if array lengths do not match if ( tokens.length != amounts.length || amounts.length != recipients.length ) { revert ArrayLengthsMismatch(); } for (uint256 i; i < tokens.length; i++) { address token = tokens[i]; address recipient = recipients[i]; // Get the amount to transfer uint256 amount = amounts[i] == 0 ? IERC20(token).balanceOf(address(this)) : amounts[i]; // Transfer the token to the recipient address token.safeTransfer(recipient, amount); } } /// @notice Send leftover ERC20 tokens via explicit method calls /// @dev Should be included in the multicall if the router is expecting to receive tokens /// Set amount to 0 to transfer the full balance /// @param tokens The addresses of the ERC20 tokens /// @param tos The target addresses for the calls /// @param datas The data for the calls /// @param amounts The amounts to send function cleanupErc20sViaCall( address[] calldata tokens, address[] calldata tos, bytes[] calldata datas, uint256[] calldata amounts ) public virtual { // Revert if array lengths do not match if ( tokens.length != amounts.length || amounts.length != tos.length || tos.length != datas.length ) { revert ArrayLengthsMismatch(); } for (uint256 i; i < tokens.length; i++) { address token = tokens[i]; address to = tos[i]; bytes calldata data = datas[i]; // Get the amount to transfer uint256 amount = amounts[i] == 0 ? IERC20(token).balanceOf(address(this)) : amounts[i]; // First approve the target address for the call IERC20(token).approve(to, amount); // Make the call (bool success, ) = to.call(data); if (!success) { revert CallFailed(); } } } /// @notice Send leftover native tokens to the recipient address /// @dev Set amount to 0 to transfer the full balance. Set recipient to address(0) to transfer to msg.sender /// @param amount The amount of native tokens to transfer /// @param recipient The recipient address function cleanupNative(uint256 amount, address recipient) public virtual { // If recipient is address(0), set to msg.sender address recipientAddr = recipient == address(0) ? msg.sender : recipient; uint256 amountToTransfer = amount == 0 ? address(this).balance : amount; recipientAddr.safeTransferETH(amountToTransfer); emit SolverNativeTransfer(recipientAddr, amountToTransfer); } /// @notice Send leftover native tokens via an explicit method call /// @dev Set amount to 0 to transfer the full balance /// @param amount The amount of native tokens to transfer /// @param to The target address of the call /// @param data The data for the call function cleanupNativeViaCall( uint256 amount, address to, bytes calldata data ) public virtual { (bool success, ) = to.call{ value: amount == 0 ? address(this).balance : amount }(data); if (!success) { revert CallFailed(); } } /// @notice Internal function to set the recipient address for ERC721 or ERC1155 mint /// @dev If the chain does not support tstore, recipient will be saved in storage /// @param recipient The address of the recipient function _setRecipient(address recipient) internal { // For safety, revert if the recipient is this contract // Tokens should either be minted directly to recipient, or transferred to recipient through the onReceived hooks if (recipient == address(this)) { revert InvalidRecipient(address(this)); } // Set the recipient in storage _setTstorish(RECIPIENT_STORAGE_SLOT, uint256(uint160(recipient))); } /// @notice Internal function to get the recipient address for ERC721 or ERC1155 mint function _getRecipient() internal view returns (address) { // Get the recipient from storage return address(uint160(_getTstorish(RECIPIENT_STORAGE_SLOT))); } /// @notice Internal function to clear the recipient address for ERC721 or ERC1155 mint function _clearRecipient() internal { // Return if recipient hasn't been set if (_getRecipient() == address(0)) { return; } // Clear the recipient in storage _clearTstorish(RECIPIENT_STORAGE_SLOT); } function onERC721Received( address /*_operator*/, address /*_from*/, uint256 _tokenId, bytes calldata _data ) external returns (bytes4) { // Get the recipient from storage address recipient = _getRecipient(); // Revert if no recipient is set // Note this means transferring NFTs to this contract via `safeTransferFrom` will revert, // unless the transfer is part of a multicall that sets the recipient in storage if (recipient == address(0)) { revert NoRecipientSet(); } // Transfer the NFT to the recipient IERC721(msg.sender).safeTransferFrom( address(this), recipient, _tokenId, _data ); return this.onERC721Received.selector; } function onERC1155Received( address /*_operator*/, address /*_from*/, uint256 _id, uint256 _value, bytes calldata _data ) external returns (bytes4) { // Get the recipient from storage address recipient = _getRecipient(); // Revert if no recipient is set // Note this means transferring NFTs to this contract via `safeTransferFrom` will revert, // unless the transfer is part of a multicall that sets the recipient in storage if (recipient == address(0)) { revert NoRecipientSet(); } // Transfer the tokens to the recipient IERC1155(msg.sender).safeTransferFrom( address(this), recipient, _id, _value, _data ); return this.onERC1155Received.selector; } function onERC1155BatchReceived( address /*_operator*/, address /*_from*/, uint256[] calldata _ids, uint256[] calldata _values, bytes calldata _data ) external returns (bytes4) { // Get the recipient from storage address recipient = _getRecipient(); // Revert if no recipient is set // Note this means transferring NFTs to this contract via `safeTransferFrom` will revert, // unless the transfer is part of a multicall that sets the recipient in storage if (recipient == address(0)) { revert NoRecipientSet(); } // Transfer the tokens to the recipient IERC1155(msg.sender).safeBatchTransferFrom( address(this), recipient, _ids, _values, _data ); return this.onERC1155BatchReceived.selector; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.1) (token/ERC1155/IERC1155.sol) pragma solidity ^0.8.20; import {IERC165} from "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC1155 compliant contract, as defined in the * https://eips.ethereum.org/EIPS/eip-1155[EIP]. */ interface IERC1155 is IERC165 { /** * @dev Emitted when `value` amount of tokens of type `id` are transferred from `from` to `to` by `operator`. */ event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value); /** * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all * transfers. */ event TransferBatch( address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] values ); /** * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to * `approved`. */ event ApprovalForAll(address indexed account, address indexed operator, bool approved); /** * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI. * * If an {URI} event was emitted for `id`, the standard * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value * returned by {IERC1155MetadataURI-uri}. */ event URI(string value, uint256 indexed id); /** * @dev Returns the value of tokens of token type `id` owned by `account`. * * Requirements: * * - `account` cannot be the zero address. */ function balanceOf(address account, uint256 id) external view returns (uint256); /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}. * * Requirements: * * - `accounts` and `ids` must have the same length. */ function balanceOfBatch( address[] calldata accounts, uint256[] calldata ids ) external view returns (uint256[] memory); /** * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`, * * Emits an {ApprovalForAll} event. * * Requirements: * * - `operator` cannot be the caller. */ function setApprovalForAll(address operator, bool approved) external; /** * @dev Returns true if `operator` is approved to transfer ``account``'s tokens. * * See {setApprovalForAll}. */ function isApprovedForAll(address account, address operator) external view returns (bool); /** * @dev Transfers a `value` amount of tokens of type `id` from `from` to `to`. * * WARNING: This function can potentially allow a reentrancy attack when transferring tokens * to an untrusted contract, when invoking {onERC1155Received} on the receiver. * Ensure to follow the checks-effects-interactions pattern and consider employing * reentrancy guards when interacting with untrusted contracts. * * Emits a {TransferSingle} event. * * Requirements: * * - `to` cannot be the zero address. * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}. * - `from` must have a balance of tokens of type `id` of at least `value` amount. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes calldata data) external; /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}. * * WARNING: This function can potentially allow a reentrancy attack when transferring tokens * to an untrusted contract, when invoking {onERC1155BatchReceived} on the receiver. * Ensure to follow the checks-effects-interactions pattern and consider employing * reentrancy guards when interacting with untrusted contracts. * * Emits either a {TransferSingle} or a {TransferBatch} event, depending on the length of the array arguments. * * Requirements: * * - `ids` and `values` must have the same length. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the * acceptance magic value. */ function safeBatchTransferFrom( address from, address to, uint256[] calldata ids, uint256[] calldata values, bytes calldata data ) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the value of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the value of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves a `value` amount of tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 value) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets a `value` amount of tokens as the allowance of `spender` over the * caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 value) external returns (bool); /** * @dev Moves a `value` amount of tokens from `from` to `to` using the * allowance mechanism. `value` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 value) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. * * ==== Security Considerations * * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be * considered as an intention to spend the allowance in any specific way. The second is that because permits have * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be * generally recommended is: * * ```solidity * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public { * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {} * doThing(..., value); * } * * function doThing(..., uint256 value) public { * token.safeTransferFrom(msg.sender, address(this), value); * ... * } * ``` * * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also * {SafeERC20-safeTransferFrom}). * * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so * contracts should have entry points that don't rely on permit. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. * * CAUTION: See Security Considerations above. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.20; import {IERC20} from "../IERC20.sol"; import {IERC20Permit} from "../extensions/IERC20Permit.sol"; import {Address} from "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; /** * @dev An operation with an ERC20 token failed. */ error SafeERC20FailedOperation(address token); /** * @dev Indicates a failed `decreaseAllowance` request. */ error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease); /** * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value))); } /** * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful. */ function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value))); } /** * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 oldAllowance = token.allowance(address(this), spender); forceApprove(token, spender, oldAllowance + value); } /** * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no * value, non-reverting calls are assumed to be successful. */ function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal { unchecked { uint256 currentAllowance = token.allowance(address(this), spender); if (currentAllowance < requestedDecrease) { revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease); } forceApprove(token, spender, currentAllowance - requestedDecrease); } } /** * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval * to be set to zero before setting it to a non-zero value, such as USDT. */ function forceApprove(IERC20 token, address spender, uint256 value) internal { bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value)); if (!_callOptionalReturnBool(token, approvalCall)) { _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0))); _callOptionalReturn(token, approvalCall); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data); if (returndata.length != 0 && !abi.decode(returndata, (bool))) { revert SafeERC20FailedOperation(address(token)); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). * * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead. */ function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false // and not revert is the subcall reverts. (bool success, bytes memory returndata) = address(token).call(data); return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/IERC721.sol) pragma solidity ^0.8.20; import {IERC165} from "../../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 address zero. * * 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 v5.0.0) (utils/Address.sol) pragma solidity ^0.8.20; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev The ETH balance of the account is not enough to perform the operation. */ error AddressInsufficientBalance(address account); /** * @dev There's no code at `target` (it is not a contract). */ error AddressEmptyCode(address target); /** * @dev A call to an address target failed. The target may have reverted. */ error FailedInnerCall(); /** * @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://consensys.net/diligence/blog/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.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { if (address(this).balance < amount) { revert AddressInsufficientBalance(address(this)); } (bool success, ) = recipient.call{value: amount}(""); if (!success) { revert FailedInnerCall(); } } /** * @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 or custom error, it is bubbled * up by this function (like regular Solidity function calls). However, if * the call reverted with no returned reason, this function reverts with a * {FailedInnerCall} error. * * 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. */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0); } /** * @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`. */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { if (address(this).balance < value) { revert AddressInsufficientBalance(address(this)); } (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an * unsuccessful call. */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata ) internal view returns (bytes memory) { if (!success) { _revert(returndata); } else { // only check if target is a contract if the call was successful and the return data is empty // otherwise we already know that it was a contract if (returndata.length == 0 && target.code.length == 0) { revert AddressEmptyCode(target); } return returndata; } } /** * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the * revert reason or with a default {FailedInnerCall} error. */ function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) { if (!success) { _revert(returndata); } else { return returndata; } } /** * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}. */ function _revert(bytes memory returndata) 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 FailedInnerCall(); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol) pragma solidity ^0.8.20; /** * @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 pragma solidity ^0.8.4; /// @notice Safe ETH and ERC20 transfer library that gracefully handles missing return values. /// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/SafeTransferLib.sol) /// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/SafeTransferLib.sol) /// @author Permit2 operations from (https://github.com/Uniswap/permit2/blob/main/src/libraries/Permit2Lib.sol) /// /// @dev Note: /// - For ETH transfers, please use `forceSafeTransferETH` for DoS protection. /// - For ERC20s, this implementation won't check that a token has code, /// responsibility is delegated to the caller. library SafeTransferLib { /*´:°•.°+.*•´.*:°.°*.°•´.°:°•.°•.*•´.*:°.°*.°•´.°:°•.°+.*•´.*:*/ /* CUSTOM ERRORS */ /*.•°:°.´+°.*°.°:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•°°.*°.°:*.´+°.•*/ /// @dev The ETH transfer has failed. error ETHTransferFailed(); /// @dev The ERC20 `transferFrom` has failed. error TransferFromFailed(); /// @dev The ERC20 `transfer` has failed. error TransferFailed(); /// @dev The ERC20 `approve` has failed. error ApproveFailed(); /// @dev The Permit2 operation has failed. error Permit2Failed(); /// @dev The Permit2 amount must be less than `2**160 - 1`. error Permit2AmountOverflow(); /*´:°•.°+.*•´.*:°.°*.°•´.°:°•.°•.*•´.*:°.°*.°•´.°:°•.°+.*•´.*:*/ /* CONSTANTS */ /*.•°:°.´+°.*°.°:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•°°.*°.°:*.´+°.•*/ /// @dev Suggested gas stipend for contract receiving ETH that disallows any storage writes. uint256 internal constant GAS_STIPEND_NO_STORAGE_WRITES = 2300; /// @dev Suggested gas stipend for contract receiving ETH to perform a few /// storage reads and writes, but low enough to prevent griefing. uint256 internal constant GAS_STIPEND_NO_GRIEF = 100000; /// @dev The unique EIP-712 domain domain separator for the DAI token contract. bytes32 internal constant DAI_DOMAIN_SEPARATOR = 0xdbb8cf42e1ecb028be3f3dbc922e1d878b963f411dc388ced501601c60f7c6f7; /// @dev The address for the WETH9 contract on Ethereum mainnet. address internal constant WETH9 = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; /// @dev The canonical Permit2 address. /// [Github](https://github.com/Uniswap/permit2) /// [Etherscan](https://etherscan.io/address/0x000000000022D473030F116dDEE9F6B43aC78BA3) address internal constant PERMIT2 = 0x000000000022D473030F116dDEE9F6B43aC78BA3; /*´:°•.°+.*•´.*:°.°*.°•´.°:°•.°•.*•´.*:°.°*.°•´.°:°•.°+.*•´.*:*/ /* ETH OPERATIONS */ /*.•°:°.´+°.*°.°:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•°°.*°.°:*.´+°.•*/ // If the ETH transfer MUST succeed with a reasonable gas budget, use the force variants. // // The regular variants: // - Forwards all remaining gas to the target. // - Reverts if the target reverts. // - Reverts if the current contract has insufficient balance. // // The force variants: // - Forwards with an optional gas stipend // (defaults to `GAS_STIPEND_NO_GRIEF`, which is sufficient for most cases). // - If the target reverts, or if the gas stipend is exhausted, // creates a temporary contract to force send the ETH via `SELFDESTRUCT`. // Future compatible with `SENDALL`: https://eips.ethereum.org/EIPS/eip-4758. // - Reverts if the current contract has insufficient balance. // // The try variants: // - Forwards with a mandatory gas stipend. // - Instead of reverting, returns whether the transfer succeeded. /// @dev Sends `amount` (in wei) ETH to `to`. function safeTransferETH(address to, uint256 amount) internal { /// @solidity memory-safe-assembly assembly { if iszero(call(gas(), to, amount, codesize(), 0x00, codesize(), 0x00)) { mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`. revert(0x1c, 0x04) } } } /// @dev Sends all the ETH in the current contract to `to`. function safeTransferAllETH(address to) internal { /// @solidity memory-safe-assembly assembly { // Transfer all the ETH and check if it succeeded or not. if iszero(call(gas(), to, selfbalance(), codesize(), 0x00, codesize(), 0x00)) { mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`. revert(0x1c, 0x04) } } } /// @dev Force sends `amount` (in wei) ETH to `to`, with a `gasStipend`. function forceSafeTransferETH(address to, uint256 amount, uint256 gasStipend) internal { /// @solidity memory-safe-assembly assembly { if lt(selfbalance(), amount) { mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`. revert(0x1c, 0x04) } if iszero(call(gasStipend, to, amount, codesize(), 0x00, codesize(), 0x00)) { mstore(0x00, to) // Store the address in scratch space. mstore8(0x0b, 0x73) // Opcode `PUSH20`. mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`. if iszero(create(amount, 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation. } } } /// @dev Force sends all the ETH in the current contract to `to`, with a `gasStipend`. function forceSafeTransferAllETH(address to, uint256 gasStipend) internal { /// @solidity memory-safe-assembly assembly { if iszero(call(gasStipend, to, selfbalance(), codesize(), 0x00, codesize(), 0x00)) { mstore(0x00, to) // Store the address in scratch space. mstore8(0x0b, 0x73) // Opcode `PUSH20`. mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`. if iszero(create(selfbalance(), 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation. } } } /// @dev Force sends `amount` (in wei) ETH to `to`, with `GAS_STIPEND_NO_GRIEF`. function forceSafeTransferETH(address to, uint256 amount) internal { /// @solidity memory-safe-assembly assembly { if lt(selfbalance(), amount) { mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`. revert(0x1c, 0x04) } if iszero(call(GAS_STIPEND_NO_GRIEF, to, amount, codesize(), 0x00, codesize(), 0x00)) { mstore(0x00, to) // Store the address in scratch space. mstore8(0x0b, 0x73) // Opcode `PUSH20`. mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`. if iszero(create(amount, 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation. } } } /// @dev Force sends all the ETH in the current contract to `to`, with `GAS_STIPEND_NO_GRIEF`. function forceSafeTransferAllETH(address to) internal { /// @solidity memory-safe-assembly assembly { // forgefmt: disable-next-item if iszero(call(GAS_STIPEND_NO_GRIEF, to, selfbalance(), codesize(), 0x00, codesize(), 0x00)) { mstore(0x00, to) // Store the address in scratch space. mstore8(0x0b, 0x73) // Opcode `PUSH20`. mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`. if iszero(create(selfbalance(), 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation. } } } /// @dev Sends `amount` (in wei) ETH to `to`, with a `gasStipend`. function trySafeTransferETH(address to, uint256 amount, uint256 gasStipend) internal returns (bool success) { /// @solidity memory-safe-assembly assembly { success := call(gasStipend, to, amount, codesize(), 0x00, codesize(), 0x00) } } /// @dev Sends all the ETH in the current contract to `to`, with a `gasStipend`. function trySafeTransferAllETH(address to, uint256 gasStipend) internal returns (bool success) { /// @solidity memory-safe-assembly assembly { success := call(gasStipend, to, selfbalance(), codesize(), 0x00, codesize(), 0x00) } } /*´:°•.°+.*•´.*:°.°*.°•´.°:°•.°•.*•´.*:°.°*.°•´.°:°•.°+.*•´.*:*/ /* ERC20 OPERATIONS */ /*.•°:°.´+°.*°.°:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•°°.*°.°:*.´+°.•*/ /// @dev Sends `amount` of ERC20 `token` from `from` to `to`. /// Reverts upon failure. /// /// The `from` account must have at least `amount` approved for /// the current contract to manage. function safeTransferFrom(address token, address from, address to, uint256 amount) internal { /// @solidity memory-safe-assembly assembly { let m := mload(0x40) // Cache the free memory pointer. mstore(0x60, amount) // Store the `amount` argument. mstore(0x40, to) // Store the `to` argument. mstore(0x2c, shl(96, from)) // Store the `from` argument. mstore(0x0c, 0x23b872dd000000000000000000000000) // `transferFrom(address,address,uint256)`. // Perform the transfer, reverting upon failure. if iszero( and( // The arguments of `and` are evaluated from right to left. or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing. call(gas(), token, 0, 0x1c, 0x64, 0x00, 0x20) ) ) { mstore(0x00, 0x7939f424) // `TransferFromFailed()`. revert(0x1c, 0x04) } mstore(0x60, 0) // Restore the zero slot to zero. mstore(0x40, m) // Restore the free memory pointer. } } /// @dev Sends `amount` of ERC20 `token` from `from` to `to`. /// /// The `from` account must have at least `amount` approved for the current contract to manage. function trySafeTransferFrom(address token, address from, address to, uint256 amount) internal returns (bool success) { /// @solidity memory-safe-assembly assembly { let m := mload(0x40) // Cache the free memory pointer. mstore(0x60, amount) // Store the `amount` argument. mstore(0x40, to) // Store the `to` argument. mstore(0x2c, shl(96, from)) // Store the `from` argument. mstore(0x0c, 0x23b872dd000000000000000000000000) // `transferFrom(address,address,uint256)`. success := and( // The arguments of `and` are evaluated from right to left. or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing. call(gas(), token, 0, 0x1c, 0x64, 0x00, 0x20) ) mstore(0x60, 0) // Restore the zero slot to zero. mstore(0x40, m) // Restore the free memory pointer. } } /// @dev Sends all of ERC20 `token` from `from` to `to`. /// Reverts upon failure. /// /// The `from` account must have their entire balance approved for the current contract to manage. function safeTransferAllFrom(address token, address from, address to) internal returns (uint256 amount) { /// @solidity memory-safe-assembly assembly { let m := mload(0x40) // Cache the free memory pointer. mstore(0x40, to) // Store the `to` argument. mstore(0x2c, shl(96, from)) // Store the `from` argument. mstore(0x0c, 0x70a08231000000000000000000000000) // `balanceOf(address)`. // Read the balance, reverting upon failure. if iszero( and( // The arguments of `and` are evaluated from right to left. gt(returndatasize(), 0x1f), // At least 32 bytes returned. staticcall(gas(), token, 0x1c, 0x24, 0x60, 0x20) ) ) { mstore(0x00, 0x7939f424) // `TransferFromFailed()`. revert(0x1c, 0x04) } mstore(0x00, 0x23b872dd) // `transferFrom(address,address,uint256)`. amount := mload(0x60) // The `amount` is already at 0x60. We'll need to return it. // Perform the transfer, reverting upon failure. if iszero( and( // The arguments of `and` are evaluated from right to left. or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing. call(gas(), token, 0, 0x1c, 0x64, 0x00, 0x20) ) ) { mstore(0x00, 0x7939f424) // `TransferFromFailed()`. revert(0x1c, 0x04) } mstore(0x60, 0) // Restore the zero slot to zero. mstore(0x40, m) // Restore the free memory pointer. } } /// @dev Sends `amount` of ERC20 `token` from the current contract to `to`. /// Reverts upon failure. function safeTransfer(address token, address to, uint256 amount) internal { /// @solidity memory-safe-assembly assembly { mstore(0x14, to) // Store the `to` argument. mstore(0x34, amount) // Store the `amount` argument. mstore(0x00, 0xa9059cbb000000000000000000000000) // `transfer(address,uint256)`. // Perform the transfer, reverting upon failure. if iszero( and( // The arguments of `and` are evaluated from right to left. or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing. call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20) ) ) { mstore(0x00, 0x90b8ec18) // `TransferFailed()`. revert(0x1c, 0x04) } mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten. } } /// @dev Sends all of ERC20 `token` from the current contract to `to`. /// Reverts upon failure. function safeTransferAll(address token, address to) internal returns (uint256 amount) { /// @solidity memory-safe-assembly assembly { mstore(0x00, 0x70a08231) // Store the function selector of `balanceOf(address)`. mstore(0x20, address()) // Store the address of the current contract. // Read the balance, reverting upon failure. if iszero( and( // The arguments of `and` are evaluated from right to left. gt(returndatasize(), 0x1f), // At least 32 bytes returned. staticcall(gas(), token, 0x1c, 0x24, 0x34, 0x20) ) ) { mstore(0x00, 0x90b8ec18) // `TransferFailed()`. revert(0x1c, 0x04) } mstore(0x14, to) // Store the `to` argument. amount := mload(0x34) // The `amount` is already at 0x34. We'll need to return it. mstore(0x00, 0xa9059cbb000000000000000000000000) // `transfer(address,uint256)`. // Perform the transfer, reverting upon failure. if iszero( and( // The arguments of `and` are evaluated from right to left. or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing. call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20) ) ) { mstore(0x00, 0x90b8ec18) // `TransferFailed()`. revert(0x1c, 0x04) } mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten. } } /// @dev Sets `amount` of ERC20 `token` for `to` to manage on behalf of the current contract. /// Reverts upon failure. function safeApprove(address token, address to, uint256 amount) internal { /// @solidity memory-safe-assembly assembly { mstore(0x14, to) // Store the `to` argument. mstore(0x34, amount) // Store the `amount` argument. mstore(0x00, 0x095ea7b3000000000000000000000000) // `approve(address,uint256)`. // Perform the approval, reverting upon failure. if iszero( and( // The arguments of `and` are evaluated from right to left. or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing. call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20) ) ) { mstore(0x00, 0x3e3f8f73) // `ApproveFailed()`. revert(0x1c, 0x04) } mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten. } } /// @dev Sets `amount` of ERC20 `token` for `to` to manage on behalf of the current contract. /// If the initial attempt to approve fails, attempts to reset the approved amount to zero, /// then retries the approval again (some tokens, e.g. USDT, requires this). /// Reverts upon failure. function safeApproveWithRetry(address token, address to, uint256 amount) internal { /// @solidity memory-safe-assembly assembly { mstore(0x14, to) // Store the `to` argument. mstore(0x34, amount) // Store the `amount` argument. mstore(0x00, 0x095ea7b3000000000000000000000000) // `approve(address,uint256)`. // Perform the approval, retrying upon failure. if iszero( and( // The arguments of `and` are evaluated from right to left. or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing. call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20) ) ) { mstore(0x34, 0) // Store 0 for the `amount`. mstore(0x00, 0x095ea7b3000000000000000000000000) // `approve(address,uint256)`. pop(call(gas(), token, 0, 0x10, 0x44, codesize(), 0x00)) // Reset the approval. mstore(0x34, amount) // Store back the original `amount`. // Retry the approval, reverting upon failure. if iszero( and( or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing. call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20) ) ) { mstore(0x00, 0x3e3f8f73) // `ApproveFailed()`. revert(0x1c, 0x04) } } mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten. } } /// @dev Returns the amount of ERC20 `token` owned by `account`. /// Returns zero if the `token` does not exist. function balanceOf(address token, address account) internal view returns (uint256 amount) { /// @solidity memory-safe-assembly assembly { mstore(0x14, account) // Store the `account` argument. mstore(0x00, 0x70a08231000000000000000000000000) // `balanceOf(address)`. amount := mul( // The arguments of `mul` are evaluated from right to left. mload(0x20), and( // The arguments of `and` are evaluated from right to left. gt(returndatasize(), 0x1f), // At least 32 bytes returned. staticcall(gas(), token, 0x10, 0x24, 0x20, 0x20) ) ) } } /// @dev Sends `amount` of ERC20 `token` from `from` to `to`. /// If the initial attempt fails, try to use Permit2 to transfer the token. /// Reverts upon failure. /// /// The `from` account must have at least `amount` approved for the current contract to manage. function safeTransferFrom2(address token, address from, address to, uint256 amount) internal { if (!trySafeTransferFrom(token, from, to, amount)) { permit2TransferFrom(token, from, to, amount); } } /// @dev Sends `amount` of ERC20 `token` from `from` to `to` via Permit2. /// Reverts upon failure. function permit2TransferFrom(address token, address from, address to, uint256 amount) internal { /// @solidity memory-safe-assembly assembly { let m := mload(0x40) mstore(add(m, 0x74), shr(96, shl(96, token))) mstore(add(m, 0x54), amount) mstore(add(m, 0x34), to) mstore(add(m, 0x20), shl(96, from)) // `transferFrom(address,address,uint160,address)`. mstore(m, 0x36c78516000000000000000000000000) let p := PERMIT2 let exists := eq(chainid(), 1) if iszero(exists) { exists := iszero(iszero(extcodesize(p))) } if iszero(and(call(gas(), p, 0, add(m, 0x10), 0x84, codesize(), 0x00), exists)) { mstore(0x00, 0x7939f4248757f0fd) // `TransferFromFailed()` or `Permit2AmountOverflow()`. revert(add(0x18, shl(2, iszero(iszero(shr(160, amount))))), 0x04) } } } /// @dev Permit a user to spend a given amount of /// another user's tokens via native EIP-2612 permit if possible, falling /// back to Permit2 if native permit fails or is not implemented on the token. function permit2( address token, address owner, address spender, uint256 amount, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { bool success; /// @solidity memory-safe-assembly assembly { for {} shl(96, xor(token, WETH9)) {} { mstore(0x00, 0x3644e515) // `DOMAIN_SEPARATOR()`. if iszero( and( // The arguments of `and` are evaluated from right to left. lt(iszero(mload(0x00)), eq(returndatasize(), 0x20)), // Returns 1 non-zero word. // Gas stipend to limit gas burn for tokens that don't refund gas when // an non-existing function is called. 5K should be enough for a SLOAD. staticcall(5000, token, 0x1c, 0x04, 0x00, 0x20) ) ) { break } // After here, we can be sure that token is a contract. let m := mload(0x40) mstore(add(m, 0x34), spender) mstore(add(m, 0x20), shl(96, owner)) mstore(add(m, 0x74), deadline) if eq(mload(0x00), DAI_DOMAIN_SEPARATOR) { mstore(0x14, owner) mstore(0x00, 0x7ecebe00000000000000000000000000) // `nonces(address)`. mstore(add(m, 0x94), staticcall(gas(), token, 0x10, 0x24, add(m, 0x54), 0x20)) mstore(m, 0x8fcbaf0c000000000000000000000000) // `IDAIPermit.permit`. // `nonces` is already at `add(m, 0x54)`. // `1` is already stored at `add(m, 0x94)`. mstore(add(m, 0xb4), and(0xff, v)) mstore(add(m, 0xd4), r) mstore(add(m, 0xf4), s) success := call(gas(), token, 0, add(m, 0x10), 0x104, codesize(), 0x00) break } mstore(m, 0xd505accf000000000000000000000000) // `IERC20Permit.permit`. mstore(add(m, 0x54), amount) mstore(add(m, 0x94), and(0xff, v)) mstore(add(m, 0xb4), r) mstore(add(m, 0xd4), s) success := call(gas(), token, 0, add(m, 0x10), 0xe4, codesize(), 0x00) break } } if (!success) simplePermit2(token, owner, spender, amount, deadline, v, r, s); } /// @dev Simple permit on the Permit2 contract. function simplePermit2( address token, address owner, address spender, uint256 amount, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { /// @solidity memory-safe-assembly assembly { let m := mload(0x40) mstore(m, 0x927da105) // `allowance(address,address,address)`. { let addressMask := shr(96, not(0)) mstore(add(m, 0x20), and(addressMask, owner)) mstore(add(m, 0x40), and(addressMask, token)) mstore(add(m, 0x60), and(addressMask, spender)) mstore(add(m, 0xc0), and(addressMask, spender)) } let p := mul(PERMIT2, iszero(shr(160, amount))) if iszero( and( // The arguments of `and` are evaluated from right to left. gt(returndatasize(), 0x5f), // Returns 3 words: `amount`, `expiration`, `nonce`. staticcall(gas(), p, add(m, 0x1c), 0x64, add(m, 0x60), 0x60) ) ) { mstore(0x00, 0x6b836e6b8757f0fd) // `Permit2Failed()` or `Permit2AmountOverflow()`. revert(add(0x18, shl(2, iszero(p))), 0x04) } mstore(m, 0x2b67b570) // `Permit2.permit` (PermitSingle variant). // `owner` is already `add(m, 0x20)`. // `token` is already at `add(m, 0x40)`. mstore(add(m, 0x60), amount) mstore(add(m, 0x80), 0xffffffffffff) // `expiration = type(uint48).max`. // `nonce` is already at `add(m, 0xa0)`. // `spender` is already at `add(m, 0xc0)`. mstore(add(m, 0xe0), deadline) mstore(add(m, 0x100), 0x100) // `signature` offset. mstore(add(m, 0x120), 0x41) // `signature` length. mstore(add(m, 0x140), r) mstore(add(m, 0x160), s) mstore(add(m, 0x180), shl(248, v)) if iszero(call(gas(), p, 0, add(m, 0x1c), 0x184, codesize(), 0x00)) { mstore(0x00, 0x6b836e6b) // `Permit2Failed()`. revert(0x1c, 0x04) } } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.24; contract Tstorish { // Declare a storage variable indicating if TSTORE support has been // activated post-deployment. bool private _tstoreSupport; /* * ------------------------------------------------------------------------+ * Opcode | Mnemonic | Stack | Memory | * ------------------------------------------------------------------------| * 60 0x02 | PUSH1 0x02 | 0x02 | | * 60 0x1e | PUSH1 0x1e | 0x1e 0x02 | | * 61 0x3d5c | PUSH2 0x3d5c | 0x3d5c 0x1e 0x02 | | * 3d | RETURNDATASIZE | 0 0x3d5c 0x1e 0x02 | | * | * :: store deployed bytecode in memory: (3d) RETURNDATASIZE (5c) TLOAD :: | * 52 | MSTORE | 0x1e 0x02 | [0..0x20): 0x3d5c | * f3 | RETURN | | [0..0x20): 0x3d5c | * ------------------------------------------------------------------------+ */ uint256 constant _TLOAD_TEST_PAYLOAD = 0x6002_601e_613d5c_3d_52_f3; uint256 constant _TLOAD_TEST_PAYLOAD_LENGTH = 0x0a; uint256 constant _TLOAD_TEST_PAYLOAD_OFFSET = 0x16; // Declare an immutable variable to store the tstore test contract address. address private immutable _tloadTestContract; // Declare an immutable variable to store the initial TSTORE support status. bool private immutable _tstoreInitialSupport; // Declare an immutable function type variable for the _setTstorish function // based on chain support for tstore at time of deployment. function(uint256,uint256) internal immutable _setTstorish; // Declare an immutable function type variable for the _getTstorish function // based on chain support for tstore at time of deployment. function(uint256) view returns (uint256) internal immutable _getTstorish; // Declare an immutable function type variable for the _clearTstorish function // based on chain support for tstore at time of deployment. function(uint256) internal immutable _clearTstorish; // Declare a few custom revert error types. error TStoreAlreadyActivated(); error TStoreNotSupported(); error TloadTestContractDeploymentFailed(); error OnlyDirectCalls(); /** * @dev Determine TSTORE availability during deployment. This involves * attempting to deploy a contract that utilizes TLOAD as part of the * contract construction bytecode, and configuring initial support for * using TSTORE in place of SSTORE based on the result. */ constructor() { // Deploy the contract testing TLOAD support and store the address. address tloadTestContract = _prepareTloadTest(); // Ensure the deployment was successful. if (tloadTestContract == address(0)) { revert TloadTestContractDeploymentFailed(); } // Determine if TSTORE is supported. bool tstoreInitialSupport = _testTload(tloadTestContract); if (tstoreInitialSupport) { // If TSTORE is supported, set functions to their versions that use // tstore/tload directly without support checks. _setTstorish = _setTstore; _getTstorish = _getTstore; _clearTstorish = _clearTstore; } else { // If TSTORE is not supported, set functions to their versions that // fallback to sstore/sload until _tstoreSupport is true. _setTstorish = _setTstorishWithSstoreFallback; _getTstorish = _getTstorishWithSloadFallback; _clearTstorish = _clearTstorishWithSstoreFallback; } _tstoreInitialSupport = tstoreInitialSupport; // Set the address of the deployed TLOAD test contract as an immutable. _tloadTestContract = tloadTestContract; } /** * @dev External function to activate TSTORE usage. Does not need to be * called if TSTORE is supported from deployment, and only needs to be * called once. Reverts if TSTORE has already been activated or if the * opcode is not available. Note that this must be called directly from * an externally-owned account to avoid potential reentrancy issues. */ function __activateTstore() external { // Ensure this function is triggered from an externally-owned account. if (msg.sender != tx.origin) { revert OnlyDirectCalls(); } // Determine if TSTORE can potentially be activated. if (_tstoreInitialSupport || _tstoreSupport) { revert TStoreAlreadyActivated(); } // Determine if TSTORE can be activated and revert if not. if (!_testTload(_tloadTestContract)) { revert TStoreNotSupported(); } // Mark TSTORE as activated. _tstoreSupport = true; } /** * @dev Private function to set a TSTORISH value. Assigned to _setTstorish * internal function variable at construction if chain has tstore support. * * @param storageSlot The slot to write the TSTORISH value to. * @param value The value to write to the given storage slot. */ function _setTstore(uint256 storageSlot, uint256 value) private { assembly { tstore(storageSlot, value) } } /** * @dev Private function to set a TSTORISH value with sstore fallback. * Assigned to _setTstorish internal function variable at construction * if chain does not have tstore support. * * @param storageSlot The slot to write the TSTORISH value to. * @param value The value to write to the given storage slot. */ function _setTstorishWithSstoreFallback(uint256 storageSlot, uint256 value) private { if (_tstoreSupport) { assembly { tstore(storageSlot, value) } } else { assembly { sstore(storageSlot, value) } } } /** * @dev Private function to read a TSTORISH value. Assigned to _getTstorish * internal function variable at construction if chain has tstore support. * * @param storageSlot The slot to read the TSTORISH value from. * * @return value The TSTORISH value at the given storage slot. */ function _getTstore( uint256 storageSlot ) private view returns (uint256 value) { assembly { value := tload(storageSlot) } } /** * @dev Private function to read a TSTORISH value with sload fallback. * Assigned to _getTstorish internal function variable at construction * if chain does not have tstore support. * * @param storageSlot The slot to read the TSTORISH value from. * * @return value The TSTORISH value at the given storage slot. */ function _getTstorishWithSloadFallback( uint256 storageSlot ) private view returns (uint256 value) { if (_tstoreSupport) { assembly { value := tload(storageSlot) } } else { assembly { value := sload(storageSlot) } } } /** * @dev Private function to clear a TSTORISH value. Assigned to _clearTstorish internal * function variable at construction if chain has tstore support. * * @param storageSlot The slot to clear the TSTORISH value for. */ function _clearTstore(uint256 storageSlot) private { assembly { tstore(storageSlot, 0) } } /** * @dev Private function to clear a TSTORISH value with sstore fallback. * Assigned to _clearTstorish internal function variable at construction * if chain does not have tstore support. * * @param storageSlot The slot to clear the TSTORISH value for. */ function _clearTstorishWithSstoreFallback(uint256 storageSlot) private { if (_tstoreSupport) { assembly { tstore(storageSlot, 0) } } else { assembly { sstore(storageSlot, 0) } } } /** * @dev Private function to deploy a test contract that utilizes TLOAD as * part of its fallback logic. */ function _prepareTloadTest() private returns (address contractAddress) { // Utilize assembly to deploy a contract testing TLOAD support. assembly { // Write the contract deployment code payload to scratch space. mstore(0, _TLOAD_TEST_PAYLOAD) // Deploy the contract. contractAddress := create( 0, _TLOAD_TEST_PAYLOAD_OFFSET, _TLOAD_TEST_PAYLOAD_LENGTH ) } } /** * @dev Private view function to determine if TSTORE/TLOAD are supported by * the current EVM implementation by attempting to call the test * contract, which utilizes TLOAD as part of its fallback logic. */ function _testTload( address tloadTestContract ) private view returns (bool ok) { // Call the test contract, which will perform a TLOAD test. If the call // does not revert, then TLOAD/TSTORE is supported. Do not forward all // available gas, as all forwarded gas will be consumed on revert. (ok, ) = tloadTestContract.staticcall{ gas: gasleft() / 10 }(""); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.25; import {TransientSlot} from "./TransientSlot.sol"; /// @title ReentrancyGuardMsgSender /// @notice Modified version of OpenZeppelin's ReentrancyGuardTransient /// https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/ReentrancyGuardTransient.sol /// @dev ReentrancyGuardMsgSender stores the original, nonreentrant msg.sender in transient storage. Allows the original sender /// and the contract itself to reenter the contract, but prevents all other callers from reentering. abstract contract ReentrancyGuardMsgSender { using TransientSlot for *; // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.ReentrancyGuard")) - 1)) & ~bytes32(uint256(0xff)) bytes32 MSG_SENDER_STORAGE_SLOT = 0x9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00; /** * @dev Unauthorized reentrant call. */ error InvalidMsgSender(address storedSender, address actualSender); constructor() {} modifier nonReentrant() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { // Load the stored sender from the transient slot address storedSender = MSG_SENDER_STORAGE_SLOT.asAddress().tload(); // Revert if sender slot has been set and is not the same as the caller // Allow contract to reenter itself if ( storedSender != address(0) && storedSender != msg.sender && msg.sender != address(this) ) { revert InvalidMsgSender(storedSender, msg.sender); } // Any calls to nonReentrant after this point will fail MSG_SENDER_STORAGE_SLOT.asAddress().tstore(msg.sender); } function _nonReentrantAfter() private { // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) MSG_SENDER_STORAGE_SLOT.asAddress().tstore(address(0)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (utils/TransientSlot.sol) // This file was procedurally generated from scripts/generate/templates/TransientSlot.js. pragma solidity ^0.8.24; /** * @dev Library for reading and writing value-types to specific transient storage slots. * * Transient slots are often used to store temporary values that are removed after the current transaction. * This library helps with reading and writing to such slots without the need for inline assembly. * * * Example reading and writing values using transient storage: * ```solidity * contract Lock { * using TransientSlot for *; * * // Define the slot. Alternatively, use the SlotDerivation library to derive the slot. * bytes32 internal constant _LOCK_SLOT = 0xf4678858b2b588224636b8522b729e7722d32fc491da849ed75b3fdf3c84f542; * * modifier locked() { * require(!_LOCK_SLOT.asBoolean().tload()); * * _LOCK_SLOT.asBoolean().tstore(true); * _; * _LOCK_SLOT.asBoolean().tstore(false); * } * } * ``` * * TIP: Consider using this library along with {SlotDerivation}. */ library TransientSlot { /** * @dev UDVT that represent a slot holding a address. */ type AddressSlot is bytes32; /** * @dev Cast an arbitrary slot to a AddressSlot. */ function asAddress(bytes32 slot) internal pure returns (AddressSlot) { return AddressSlot.wrap(slot); } /** * @dev UDVT that represent a slot holding a bool. */ type BooleanSlot is bytes32; /** * @dev Cast an arbitrary slot to a BooleanSlot. */ function asBoolean(bytes32 slot) internal pure returns (BooleanSlot) { return BooleanSlot.wrap(slot); } /** * @dev UDVT that represent a slot holding a bytes32. */ type Bytes32Slot is bytes32; /** * @dev Cast an arbitrary slot to a Bytes32Slot. */ function asBytes32(bytes32 slot) internal pure returns (Bytes32Slot) { return Bytes32Slot.wrap(slot); } /** * @dev UDVT that represent a slot holding a uint256. */ type Uint256Slot is bytes32; /** * @dev Cast an arbitrary slot to a Uint256Slot. */ function asUint256(bytes32 slot) internal pure returns (Uint256Slot) { return Uint256Slot.wrap(slot); } /** * @dev UDVT that represent a slot holding a int256. */ type Int256Slot is bytes32; /** * @dev Cast an arbitrary slot to a Int256Slot. */ function asInt256(bytes32 slot) internal pure returns (Int256Slot) { return Int256Slot.wrap(slot); } /** * @dev Load the value held at location `slot` in transient storage. */ function tload(AddressSlot slot) internal view returns (address value) { assembly ("memory-safe") { value := tload(slot) } } /** * @dev Store `value` at location `slot` in transient storage. */ function tstore(AddressSlot slot, address value) internal { assembly ("memory-safe") { tstore(slot, value) } } /** * @dev Load the value held at location `slot` in transient storage. */ function tload(BooleanSlot slot) internal view returns (bool value) { assembly ("memory-safe") { value := tload(slot) } } /** * @dev Store `value` at location `slot` in transient storage. */ function tstore(BooleanSlot slot, bool value) internal { assembly ("memory-safe") { tstore(slot, value) } } /** * @dev Load the value held at location `slot` in transient storage. */ function tload(Bytes32Slot slot) internal view returns (bytes32 value) { assembly ("memory-safe") { value := tload(slot) } } /** * @dev Store `value` at location `slot` in transient storage. */ function tstore(Bytes32Slot slot, bytes32 value) internal { assembly ("memory-safe") { tstore(slot, value) } } /** * @dev Load the value held at location `slot` in transient storage. */ function tload(Uint256Slot slot) internal view returns (uint256 value) { assembly ("memory-safe") { value := tload(slot) } } /** * @dev Store `value` at location `slot` in transient storage. */ function tstore(Uint256Slot slot, uint256 value) internal { assembly ("memory-safe") { tstore(slot, value) } } /** * @dev Load the value held at location `slot` in transient storage. */ function tload(Int256Slot slot) internal view returns (int256 value) { assembly ("memory-safe") { value := tload(slot) } } /** * @dev Store `value` at location `slot` in transient storage. */ function tstore(Int256Slot slot, int256 value) internal { assembly ("memory-safe") { tstore(slot, value) } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.12; import {Call3Value, Result} from "./RelayStructs.sol"; /// @title Multicall3 /// @notice Aggregate results from multiple function calls /// @dev Multicall & Multicall2 backwards-compatible /// @dev Aggregate methods are marked `payable` to save 24 gas per call /// @dev This is a fork of the original Multicall3 contract with multicalls /// @dev only executable by address(this). This contract is meant to be inherited /// @dev by other contracts that need to perform multicalls. /// @author Michael Elliot <[email protected]> /// @author Joshua Levine <[email protected]> /// @author Nick Johnson <[email protected]> /// @author Andreas Bigger <[email protected]> /// @author Matt Solomon <[email protected]> contract Multicall3 { event SolverCallExecuted(address to, bytes data, uint256 amount); /// @notice Aggregate calls /// @param calls An array of Call3Value structs /// @return returnData An array of Result structs function _aggregate3Value( Call3Value[] calldata calls ) internal returns (Result[] memory returnData) { uint256 length = calls.length; returnData = new Result[](length); Call3Value calldata calli; for (uint256 i = 0; i < length; ) { Result memory result = returnData[i]; calli = calls[i]; uint256 val = calli.value; (result.success, result.returnData) = calli.target.call{value: val}( calli.callData ); assembly { // Revert if the call fails and failure is not allowed // `allowFailure := calldataload(add(calli, 0x20))` and `success := mload(result)` if iszero(or(calldataload(add(calli, 0x20)), mload(result))) { // Set "Error(string)" signature: bytes32(bytes4(keccak256("Error(string)"))) mstore( 0x00, 0x08c379a000000000000000000000000000000000000000000000000000000000 ) // set data offset mstore( 0x04, 0x0000000000000000000000000000000000000000000000000000000000000020 ) // Set length of revert string mstore( 0x24, 0x0000000000000000000000000000000000000000000000000000000000000017 ) // Set revert string: bytes32(abi.encodePacked("Multicall3: call failed")) mstore( 0x44, 0x4d756c746963616c6c333a2063616c6c206661696c6564000000000000000000 ) revert(0x00, 0x84) } } if (result.success) { emit SolverCallExecuted( calli.target, calli.callData, calli.value ); } unchecked { ++i; } } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.23; struct Call3Value { address target; bool allowFailure; uint256 value; bytes callData; } struct Permit { address token; address owner; uint256 value; uint256 nonce; uint256 deadline; uint8 v; bytes32 r; bytes32 s; } struct Result { bool success; bytes returnData; } struct RelayerWitness { address relayer; Call3Value[] call3Values; }
{ "evmVersion": "cancun", "libraries": {}, "metadata": { "appendCBOR": true, "bytecodeHash": "ipfs", "useLiteralContent": false }, "optimizer": { "enabled": false, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "remappings": [ "@openzeppelin/=lib/openzeppelin-contracts/", "@openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/", "solady/=lib/solady/", "multicaller/=lib/Multicaller/", "v2-core/=lib/v2-core/", "v2-periphery/=lib/v2-periphery/", "tstorish/=lib/tstorish/", "permit2-relay/=lib/permit2-relay/", "solmate/=lib/solmate/", "@matterlabs/zksync-contracts/=/lib/v2-testnet-contracts/", "@uniswap/v3-core/=lib/v3-core/", "@uniswap/v2-core/=lib/v2-core/", "0x-settler/=lib/0x-settler/", "seaport-1.5/=lib/seaport-1.5/", "trustlessPermit/=lib/trustlessPermit/", "@rari-capital/solmate/=lib/seaport-1.5/lib/solmate/", "Multicaller/=lib/Multicaller/src/", "ds-test/=lib/seaport-1.5/lib/ds-test/src/", "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/", "forge-gas-snapshot/=lib/0x-settler/lib/forge-gas-snapshot/src/", "forge-std/=lib/forge-std/src/", "halmos-cheatcodes/=lib/openzeppelin-contracts-upgradeable/lib/halmos-cheatcodes/src/", "murky/=lib/seaport-1.5/lib/murky/src/", "openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/", "openzeppelin-contracts/=lib/openzeppelin-contracts/", "permit2/=lib/0x-settler/lib/permit2/", "seaport-core/=lib/seaport-core/src/", "seaport-sol/=lib/seaport-sol/src/", "seaport-types/=lib/seaport-1.5/lib/seaport-types/", "seaport/=lib/seaport-1.5/contracts/", "solarray/=lib/seaport-1.5/lib/solarray/src/", "v3-core/=lib/v3-core/" ], "viaIR": true }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ArrayLengthsMismatch","type":"error"},{"inputs":[],"name":"CallFailed","type":"error"},{"inputs":[{"internalType":"address","name":"storedSender","type":"address"},{"internalType":"address","name":"actualSender","type":"address"}],"name":"InvalidMsgSender","type":"error"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"}],"name":"InvalidRecipient","type":"error"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"InvalidTarget","type":"error"},{"inputs":[],"name":"NativeTransferFailed","type":"error"},{"inputs":[],"name":"NoRecipientSet","type":"error"},{"inputs":[],"name":"OnlyDirectCalls","type":"error"},{"inputs":[],"name":"TStoreAlreadyActivated","type":"error"},{"inputs":[],"name":"TStoreNotSupported","type":"error"},{"inputs":[],"name":"TloadTestContractDeploymentFailed","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"bytes","name":"data","type":"bytes"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"SolverCallExecuted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"SolverNativeTransfer","type":"event"},{"inputs":[],"name":"__activateTstore","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"tokens","type":"address[]"},{"internalType":"address[]","name":"recipients","type":"address[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"name":"cleanupErc20s","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"tokens","type":"address[]"},{"internalType":"address[]","name":"tos","type":"address[]"},{"internalType":"bytes[]","name":"datas","type":"bytes[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"name":"cleanupErc20sViaCall","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"}],"name":"cleanupNative","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"cleanupNativeViaCall","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"bool","name":"allowFailure","type":"bool"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"callData","type":"bytes"}],"internalType":"struct Call3Value[]","name":"calls","type":"tuple[]"},{"internalType":"address","name":"refundTo","type":"address"},{"internalType":"address","name":"nftRecipient","type":"address"}],"name":"multicall","outputs":[{"components":[{"internalType":"bool","name":"success","type":"bool"},{"internalType":"bytes","name":"returnData","type":"bytes"}],"internalType":"struct Result[]","name":"returnData","type":"tuple[]"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256[]","name":"_ids","type":"uint256[]"},{"internalType":"uint256[]","name":"_values","type":"uint256[]"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"onERC1155BatchReceived","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"_id","type":"uint256"},{"internalType":"uint256","name":"_value","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"onERC1155Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
6101206040523461005657610012610136565b61001a61005b565b6122dd6104718239608051816116d0015260a0518161169e015260c05181611cea015260e05181611b260152610100518161209201526122dd90f35b610061565b60405190565b5f80fd5b5f1c90565b90565b90565b61008461007f6100899261006a565b61006d565b61006a565b90565b61009861009d91610065565b610070565b90565b90565b6100b76100b26100bc926100a0565b61006d565b61006a565b90565b634e487b7160e01b5f52601160045260245ffd5b6100e26100e89193929361006a565b9261006a565b82039182116100f357565b6100bf565b5f1b90565b906101095f19916100f8565b9181191691161790565b90565b9061012b61012661013292610070565b610113565b82546100fd565b9055565b61013e6101cd565b61018461017d61016d7f72dc4effd7d159affb1f4d451190a65a842cb9499f45eb1ae60b404ca68ad9d961008c565b61017760016100a3565b906100d3565b6002610116565b565b90565b60018060a01b031690565b6101a86101a36101ad92610186565b61006d565b610189565b90565b6101b990610194565b90565b6101c590610189565b90565b5f0190565b6101d56102a5565b6101dd6102d5565b806101f86101f26101ed5f6101b0565b6101bc565b916101bc565b1461023b576102068161042d565b805f1461022657600160c052600360e0526005610100525b60a052608052565b600260c052600460e05260066101005261021e565b5f632aea588760e01b815280610253600482016101c8565b0390fd5b90565b90565b61027161026c61027692610257565b6100f8565b61025a565b90565b61028290610065565b90565b9061029a6102956102a19261025d565b610279565b82546100fd565b9055565b6102cf7f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f005f610285565b565b5f90565b6102dd6102d1565b50696002601e613d5c3d52f35f52600a60165ff090565b5f90565b90565b61030f61030a610314926102f8565b61006d565b61006a565b90565b634e487b7160e01b5f52601260045260245ffd5b61033761033d9161006a565b9161006a565b908115610348570490565b610317565b905090565b61035d5f809261034d565b0190565b61036a90610352565b90565b601f801991011690565b634e487b7160e01b5f52604160045260245ffd5b906103959061036d565b810190811060018060401b038211176103ad57604052565b610377565b906103c56103be61005b565b928361038b565b565b60018060401b0381116103e3576103df60209161036d565b0190565b610377565b906103fa6103f5836103c7565b6103b2565b918252565b606090565b3d5f1461041f576104143d6103e8565b903d5f602084013e5b565b6104276103ff565b9061041d565b5f80916104386102f4565b5061044d5a610447600a6102fb565b9061032b565b9061045661005b565b908161046181610361565b0392fa61046c610404565b509056fe6080604052600436101561001d575b366109635761001b611a89565b005b6100275f356100b6565b8063150b7a02146100b157806330be5567146100ac5780633b2253c8146100a75780635d1fe6a2146100a25780635de81e3f1461009d57806373b7bb2f146100985780637423eb3c14610093578063bc197c811461008e5763f23a6e610361000e57610927565b610878565b6107a3565b610757565b610635565b6105d1565b610545565b61040d565b610207565b60e01c90565b60405190565b5f80fd5b5f80fd5b5f80fd5b60018060a01b031690565b6100e2906100ce565b90565b6100ee816100d9565b036100f557565b5f80fd5b90503590610106826100e5565b565b90565b61011481610108565b0361011b57565b5f80fd5b9050359061012c8261010b565b565b5f80fd5b5f80fd5b5f80fd5b909182601f830112156101745781359167ffffffffffffffff831161016f57602001926001830284011161016a57565b610136565b610132565b61012e565b906080828203126101d457610190815f84016100f9565b9261019e82602085016100f9565b926101ac836040830161011f565b92606082013567ffffffffffffffff81116101cf576101cb920161013a565b9091565b6100ca565b6100c6565b63ffffffff60e01b1690565b6101ee906101d9565b9052565b9190610205905f602085019401906101e5565b565b3461023b5761023761022661021d366004610179565b93929092610bb1565b61022e6100bc565b918291826101f2565b0390f35b6100c2565b909182601f8301121561027a5781359167ffffffffffffffff831161027557602001926020830284011161027057565b610136565b610132565b61012e565b9190916060818403126102d0575f8101359167ffffffffffffffff83116102cb576102af846102c8948401610240565b9390946102bf81602086016100f9565b936040016100f9565b90565b6100ca565b6100c6565b5190565b60209181520190565b60200190565b151590565b6102f6906102e8565b9052565b5190565b60209181520190565b90825f9392825e0152565b601f801991011690565b61033b61034460209361034993610332816102fa565b938480936102fe565b95869101610307565b610312565b0190565b61037891602060408201926103685f8201515f8501906102ed565b015190602081840391015261031c565b90565b906103859161034d565b90565b60200190565b906103a261039b836102d5565b80926102d9565b90816103b3602083028401946102e2565b925f915b8383106103c657505050505090565b909192939460206103e86103e28385600195038752895161037b565b97610388565b93019301919392906103b7565b61040a9160208201915f81840391015261038e565b90565b61043861042761041e36600461027f565b92919091610e00565b61042f6100bc565b918291826103f5565b0390f35b909182601f830112156104765781359167ffffffffffffffff831161047157602001926020830284011161046c57565b610136565b610132565b61012e565b909182601f830112156104b55781359167ffffffffffffffff83116104b05760200192602083028401116104ab57565b610136565b610132565b61012e565b9060608282031261053b575f82013567ffffffffffffffff811161053657816104e491840161043c565b929093602082013567ffffffffffffffff8111610531578361050791840161043c565b929093604082013567ffffffffffffffff811161052c57610528920161047b565b9091565b6100ca565b6100ca565b6100ca565b6100c6565b5f0190565b3461057a576105646105583660046104ba565b94939093929192610eec565b61056c6100bc565b8061057681610540565b0390f35b6100c2565b916060838303126105cc57610596825f850161011f565b926105a483602083016100f9565b92604082013567ffffffffffffffff81116105c7576105c3920161013a565b9091565b6100ca565b6100c6565b34610603576105ed6105e436600461057f565b92919091611173565b6105f56100bc565b806105ff81610540565b0390f35b6100c2565b9190604083820312610630578061062461062d925f860161011f565b936020016100f9565b90565b6100c6565b346106645761064e610648366004610608565b906111f4565b6106566100bc565b8061066081610540565b0390f35b6100c2565b909182601f830112156106a35781359167ffffffffffffffff831161069e57602001926020830284011161069957565b610136565b610132565b61012e565b9091608082840312610752575f82013567ffffffffffffffff811161074d57836106d391840161043c565b929093602082013567ffffffffffffffff811161074857816106f691840161043c565b929093604082013567ffffffffffffffff81116107435783610719918401610669565b929093606082013567ffffffffffffffff811161073e5761073a920161047b565b9091565b6100ca565b6100ca565b6100ca565b6100ca565b6100c6565b3461078f5761077961076a3660046106a8565b9695909594919493929361134b565b6107816100bc565b8061078b81610540565b0390f35b6100c2565b5f91031261079e57565b6100c6565b346107d1576107b3366004610794565b6107bb611684565b6107c36100bc565b806107cd81610540565b0390f35b6100c2565b9160a083830312610873576107ed825f85016100f9565b926107fb83602083016100f9565b92604082013567ffffffffffffffff811161086e578161081c91840161047b565b929093606082013567ffffffffffffffff8111610869578361083f91840161047b565b929093608082013567ffffffffffffffff811161086457610860920161013a565b9091565b6100ca565b6100ca565b6100ca565b6100c6565b346108b2576108ae61089d61088e3660046107d6565b96959095949194939293611833565b6108a56100bc565b918291826101f2565b0390f35b6100c2565b91909160a081840312610922576108d0835f83016100f9565b926108de81602084016100f9565b926108ec826040850161011f565b926108fa836060830161011f565b92608082013567ffffffffffffffff811161091d57610919920161013a565b9091565b6100ca565b6100c6565b3461095e5761095a61094961093d3660046108b7565b94939093929192611988565b6109516100bc565b918291826101f2565b0390f35b6100c2565b5f80fd5b5f1c90565b60ff1690565b61097e61098391610967565b61096c565b90565b6109909054610972565b90565b5f9061099f6001610986565b82146109a9575d5b565b556109a7565b5f905d565b5f90565b6109c06109b4565b506109cb6001610986565b5f146109d6575c905b565b54906109d4565b6109e56109b4565b505c90565b6109f46001610986565b5f146109fe575d5b565b556109fc565b5d565b5f90565b90565b90565b610a25610a20610a2a92610a0b565b610a0e565b6100ce565b90565b610a3690610a11565b90565b610a4d610a48610a52926100ce565b610a0e565b6100ce565b90565b610a5e90610a39565b90565b610a6a90610a55565b90565b610a7690610a39565b90565b610a8290610a6d565b90565b610a8e90610a6d565b90565b5f80fd5b634e487b7160e01b5f52604160045260245ffd5b90610ab390610312565b810190811067ffffffffffffffff821117610acd57604052565b610a95565b60e01b90565b5f910312610ae257565b6100c6565b610af0906100d9565b9052565b610afd90610108565b9052565b60209181520190565b90825f939282370152565b9190610b2f81610b2881610b3495610b01565b8095610b0a565b610312565b0190565b909391610b799593610b62610b6c92610b5860808601985f870190610ae7565b6020850190610ae7565b6040830190610af4565b6060818503910152610b15565b90565b610b846100bc565b3d5f823e3d90fd5b63ffffffff1690565b610ba9610ba4610bae92610b8c565b610ad2565b6101d9565b90565b505091610bbc610a07565b50610bc5611b12565b9081610be1610bdb610bd65f610a2d565b6100d9565b916100d9565b14610c9457610bf7610bf233610a61565b610a79565b9063b88d4fde90610c0730610a85565b9395949091833b15610c8f57610c3e610c33935f97938894610c276100bc565b9a8b998a988997610ad2565b875260048701610b38565b03925af18015610c8a57610c5e575b50610c5b63150b7a02610b95565b90565b610c7d905f3d8111610c83575b610c758183610aa9565b810190610ad8565b5f610c4d565b503d610c6b565b610b7c565b610a91565b5f63f36675c360e01b815280610cac60048201610540565b0390fd5b606090565b90610cca94939291610cc5611bb5565b610d14565b90610cd3611c77565b565b610ce9610ce4610cee92610a0b565b610a0e565b610108565b90565b916020610d12929493610d0b60408201965f830190610ae7565b0190610af4565b565b93610d439395945080610d37610d31610d2c5f610a2d565b6100d9565b916100d9565b03610df1575b50611ecd565b91610d4c612066565b610d5530610a85565b31610d68610d625f610cd5565b91610108565b11610d71575b50565b80610d8c610d86610d815f610a2d565b6100d9565b916100d9565b145f14610dec5750335b610d9f30610a85565b3190610dac8183906120c5565b907fd35467972d1fda5b63c735f59d3974fa51785a41a92aa3ed1b70832836f8dba691610de3610dda6100bc565b92839283610cf1565b0390a15f610d6e565b610d96565b610dfa90611cc4565b5f610d3d565b90610e14939291610e0f610cb0565b610cb5565b90565b5090565b5090565b6001610e2b9101610108565b90565b634e487b7160e01b5f52603260045260245ffd5b9190811015610e52576020020190565b610e2e565b35610e61816100e5565b90565b9190811015610e74576020020190565b610e2e565b35610e838161010b565b90565b610e8f90610a39565b90565b610e9b90610e86565b90565b610ea790610a6d565b90565b90505190610eb78261010b565b565b90602082820312610ed257610ecf915f01610eaa565b90565b6100c6565b9190610eea905f60208501940190610ae7565b565b9594929195610efc818390610e17565b610f18610f12610f0d888890610e1b565b610108565b91610108565b14158015611099575b61107d57610f2d6109b4565b5b80610f4b610f45610f40858790610e17565b610108565b91610108565b101561107357610f65610f6083858491610e42565b610e57565b90610f7a610f758a878491610e42565b610e57565b610f8e610f8989898591610e64565b610e79565b610fa0610f9a5f610cd5565b91610108565b145f1461105257610ff0906020610fbe610fb986610e92565b610e9e565b6370a0823190610fe5610fd030610a85565b92610fd96100bc565b96879485938493610ad2565b835260048301610ed7565b03915afa93841561104d5761101a94611015935f9161101f575b505b909190916120e3565b610e1f565b610f2e565b611040915060203d8111611046575b6110388183610aa9565b810190610eb9565b5f61100a565b503d61102e565b610b7c565b6110159061101a9361106e6110698b8b8791610e64565b610e79565b61100c565b5050505050509050565b5f631dc0052360e11b81528061109560048201610540565b0390fd5b506110a5858590610e1b565b6110c16110bb6110b68a8790610e17565b610108565b91610108565b1415610f21565b905090565b9091826110dd816110e4936110c8565b8093610b0a565b0190565b90916110f3926110cd565b90565b906111096111026100bc565b9283610aa9565b565b67ffffffffffffffff811161112957611125602091610312565b0190565b610a95565b9061114061113b8361110b565b6110f6565b918252565b606090565b3d5f146111655761115a3d61112e565b903d5f602084013e5b565b61116d611145565b90611163565b6111cc935f938493928061118f61118987610cd5565b91610108565b1485146111ee57506111a030610a85565b31925b92906111b96111b06100bc565b938492836110e8565b03925af16111c561114a565b50156102e8565b6111d257565b5f633204506f60e01b8152806111ea60048201610540565b0390fd5b926111a3565b908061121061120a6112055f610a2d565b6100d9565b916100d9565b145f1461128e5750335b908061122e6112285f610cd5565b91610108565b145f14611289575061123f30610a85565b315b9061124d8183906120c5565b907fd35467972d1fda5b63c735f59d3974fa51785a41a92aa3ed1b70832836f8dba69161128461127b6100bc565b92839283610cf1565b0390a1565b611241565b61121a565b5090565b5f80fd5b5f80fd5b5f80fd5b9035906001602003813603038212156112e5570180359067ffffffffffffffff82116112e0576020019160018202360383136112db57565b61129f565b61129b565b611297565b9082101561130557602061130192028101906112a3565b9091565b610e2e565b611313816102e8565b0361131a57565b5f80fd5b9050519061132b8261130a565b565b9060208282031261134657611343915f0161131e565b90565b6100c6565b9593959492919461135d818390610e17565b61137961137361136e888c90610e1b565b610108565b91610108565b1415801561160b575b80156115dc575b6115c0576113956109b4565b5b806113b36113ad6113a8858790610e17565b610108565b91610108565b10156115b5576113cd6113c883858491610e42565b610e57565b6113e16113dc89878591610e42565b610e57565b6113ed8a8885916112ea565b9290898d61140561140083838a91610e64565b610e79565b6114176114115f610cd5565b91610108565b145f14611593575050611468602061143661143185610e92565b610e9e565b6370a082319061145d61144830610a85565b926114516100bc565b95869485938493610ad2565b835260048301610ed7565b03915afa801561158e5761148b611490916020935f91611561575b505b94610e92565b610e9e565b9263095ea7b3936114b55f8793966114c06114a96100bc565b98899687958694610ad2565b845260048401610cf1565b03925af193841561155c575f8094819461150297611530575b50926114ef6114e66100bc565b938492836110e8565b03925af16114fb61114a565b50156102e8565b6115145761150f90610e1f565b611396565b5f633204506f60e01b81528061152c60048201610540565b0390fd5b6115509060203d8111611555575b6115488183610aa9565b81019061132d565b6114d9565b503d61153e565b610b7c565b6115819150843d8111611587575b6115798183610aa9565b810190610eb9565b5f611483565b503d61156f565b610b7c565b61148b6115b06115ab61149093602095908b91610e64565b610e79565b611485565b505050505050505050565b5f631dc0052360e11b8152806115d860048201610540565b0390fd5b506115e8868490610e17565b6116046115fe6115f98a8890611293565b610108565b91610108565b1415611389565b50611617858990610e1b565b61163361162d611628898790610e17565b610108565b91610108565b1415611382565b5f1b90565b9061164b60ff9161163a565b9181191691161790565b61165e906102e8565b90565b90565b9061167961167461168092611655565b611661565b825461163f565b9055565b33611697611691326100d9565b916100d9565b03611753577f00000000000000000000000000000000000000000000000000000000000000008015611743575b611727576116fa6116f47f0000000000000000000000000000000000000000000000000000000000000000612195565b156102e8565b61170b57611709600180611664565b565b5f6370a4078f60e01b81528061172360048201610540565b0390fd5b5f630f45b98b60e41b81528061173f60048201610540565b0390fd5b5061174e6001610986565b6116c4565b5f63096650c560e21b81528061176b60048201610540565b0390fd5b61177890610a39565b90565b6117849061176f565b90565b61179090610a6d565b90565b60209181520190565b5f80fd5b9037565b9091826117b091611793565b9160018060fb1b0381116117d357829160206117cf92029384916117a0565b0190565b61179c565b61182294819896946118076118309b99956117fd611814965f60a08801970190610ae7565b60208c0190610ae7565b89830360408b01526117a4565b9186830360608801526117a4565b926080818503910152610b15565b90565b505094929091611841610a07565b5061184a611b12565b938461186661186061185b5f610a2d565b6100d9565b916100d9565b1461191a5761187c6118773361177b565b611787565b93632eb2c2d69161188c30610a85565b969891939497863b15611915575f986118b9968a966118c4956118ad6100bc565b9d8e9c8d9b8c9a610ad2565b8a5260048a016117d8565b03925af18015611910576118e4575b506118e163bc197c81610b95565b90565b611903905f3d8111611909575b6118fb8183610aa9565b810190610ad8565b5f6118d3565b503d6118f1565b610b7c565b610a91565b5f63f36675c360e01b81528061193260048201610540565b0390fd5b919361196e611978929694611964611985999761195a60a088019a5f890190610ae7565b6020870190610ae7565b6040850190610af4565b6060830190610af4565b6080818503910152610b15565b90565b5050929091611995610a07565b5061199e611b12565b91826119ba6119b46119af5f610a2d565b6100d9565b916100d9565b14611a6d576119d06119cb3361177b565b611787565b9163f242432a6119df30610a85565b949695919295843b15611a68575f96611a0c948894611a1793611a006100bc565b9b8c9a8b998a98610ad2565b885260048801611936565b03925af18015611a6357611a37575b50611a3463f23a6e61610b95565b90565b611a56905f3d8111611a5c575b611a4e8183610aa9565b810190610ad8565b5f611a26565b503d611a44565b610b7c565b610a91565b5f63f36675c360e01b815280611a8560048201610540565b0390fd5b611a9230610a85565b347fd35467972d1fda5b63c735f59d3974fa51785a41a92aa3ed1b70832836f8dba691611ac9611ac06100bc565b92839283610cf1565b0390a1565b5f90565b90565b611ae1611ae691610967565b611ad2565b90565b611af39054611ad5565b90565b611b0a611b05611b0f92610108565b610a0e565b6100ce565b90565b611b1a611ace565b50611b5f611b5a611b557f0000000000000000000000000000000000000000000000000000000000000000611b4f6002611ae9565b9061224e565b611af6565b610a6d565b90565b90565b611b71611b7691610967565b611b62565b90565b611b839054611b65565b90565b611b8f90610a6d565b90565b916020611bb3929493611bac60408201965f830190610ae7565b0190610ae7565b565b611bce611bc9611bc45f611b79565b6121eb565b612200565b80611be9611be3611bde5f610a2d565b6100d9565b916100d9565b141580611c5c575b80611c39575b611c195750611c17611c10611c0b5f611b79565b6121eb565b339061220d565b565b3390611c355f92839263200991eb60e21b845260048401611b92565b0390fd5b5033611c55611c4f611c4a30611b86565b6100d9565b916100d9565b1415611bf7565b5080611c70611c6a336100d9565b916100d9565b1415611bf1565b611c9a611c8b611c865f611b79565b6121eb565b611c945f610a2d565b9061220d565b565b611ca590610a39565b90565b611cbc611cb7611cc1926100ce565b610a0e565b610108565b90565b80611cdf611cd9611cd430610a85565b6100d9565b916100d9565b14611d2d57611d2b907f000000000000000000000000000000000000000000000000000000000000000090611d25611d20611d1a6002611ae9565b92611c9c565b611ca8565b9161227a565b565b611d50611d3930610a85565b5f918291630bc2c5df60e11b835260048301610ed7565b0390fd5b5090565b67ffffffffffffffff8111611d705760208091020190565b610a95565b90611d87611d8283611d58565b6110f6565b918252565b611d9660406110f6565b90565b5f90565b606090565b611daa611d8c565b9060208083611db7611d99565b815201611dc2611d9d565b81525050565b611dd0611da2565b90565b5f5b828110611de157505050565b602090611dec611dc8565b8184015201611dd5565b90611e1b611e0383611d75565b92602080611e118693611d58565b9201910390611dd3565b565b3690565b90611e2b826102d5565b811015611e3c576020809102010190565b610e2e565b903590600160800381360303821215611e58570190565b611297565b90821015611e77576020611e749202810190611e41565b90565b610e2e565b90611e86906102e8565b9052565b611e9490516102e8565b90565b949391604091611ecb94611ec392611eb660608a01935f8b0190610ae7565b88830360208a0152610b15565b940190610af4565b565b9190611ed7610cb0565b50611ee3838290611d54565b91611eed83611df6565b90611ef6611e1d565b50611f005f610cd5565b5b80611f14611f0e87610108565b91610108565b101561205e57611f25838290611e21565b5190611f3387868391611e5d565b611f905f80611f4460408501610e79565b611f4f828601610e57565b90611f5e8660608101906112a3565b9190611f74611f6b6100bc565b938492836110e8565b03925af1611f8061114a565b905f860191602087015290611e7c565b82516020820135171561202257611fab5f611fb69401611e8a565b611fbb575b50610e1f565b611f01565b80611fc95f60409301610e57565b612019611fe6611fdd8460608101906112a3565b95909401610e79565b7f93485dcd31a905e3ffd7b012abe3438fa8fa77f98ddc9f50e879d3fa7ccdc324946120106100bc565b94859485611e97565b0390a15f611fb0565b62461bcd60e51b5f52602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260845ffd5b509250925050565b61206e611b12565b61208861208261207d5f610a2d565b6100d9565b916100d9565b146120c3576120c17f00000000000000000000000000000000000000000000000000000000000000006120bb6002611ae9565b90612224565b565b565b905f8092389238915af1156120d657565b63b12d13eb5f526004601cfd5b60105f604492602095829560145260345263a9059cbb60601b82525af13d1560015f5114171615612114575f603452565b6390b8ec185f526004601cfd5b5f90565b90565b61213c61213761214192612125565b610a0e565b610108565b90565b634e487b7160e01b5f52601260045260245ffd5b61216461216a91610108565b91610108565b908115612175570490565b612144565b6121855f80926110c8565b0190565b6121929061217a565b90565b5f80916121a0612121565b506121b55a6121af600a612128565b90612158565b906121be6100bc565b90816121c981612189565b0392fa6121d461114a565b5090565b5f90565b90565b6121e8906121dc565b90565b6121fd906121f76121d8565b506121df565b90565b612208611ace565b505c90565b5d565b634e487b7160e01b5f52605160045260245ffd5b8060061461223f576005036122105761223c906109af565b5b565b5061224990610993565b61223d565b8060041461226a5760030361221057612266906109dd565b905b565b50612274906109b8565b90612268565b91909180600214612298576001036122105761229591610a04565b5b565b506122a2916109ea565b61229656fea2646970667358221220f5321f815837e49693a50f86aafaccf3a993dc7eae58572adb515efb7d24f76f64736f6c634300081c0033
Deployed Bytecode
0x6080604052600436101561001d575b366109635761001b611a89565b005b6100275f356100b6565b8063150b7a02146100b157806330be5567146100ac5780633b2253c8146100a75780635d1fe6a2146100a25780635de81e3f1461009d57806373b7bb2f146100985780637423eb3c14610093578063bc197c811461008e5763f23a6e610361000e57610927565b610878565b6107a3565b610757565b610635565b6105d1565b610545565b61040d565b610207565b60e01c90565b60405190565b5f80fd5b5f80fd5b5f80fd5b60018060a01b031690565b6100e2906100ce565b90565b6100ee816100d9565b036100f557565b5f80fd5b90503590610106826100e5565b565b90565b61011481610108565b0361011b57565b5f80fd5b9050359061012c8261010b565b565b5f80fd5b5f80fd5b5f80fd5b909182601f830112156101745781359167ffffffffffffffff831161016f57602001926001830284011161016a57565b610136565b610132565b61012e565b906080828203126101d457610190815f84016100f9565b9261019e82602085016100f9565b926101ac836040830161011f565b92606082013567ffffffffffffffff81116101cf576101cb920161013a565b9091565b6100ca565b6100c6565b63ffffffff60e01b1690565b6101ee906101d9565b9052565b9190610205905f602085019401906101e5565b565b3461023b5761023761022661021d366004610179565b93929092610bb1565b61022e6100bc565b918291826101f2565b0390f35b6100c2565b909182601f8301121561027a5781359167ffffffffffffffff831161027557602001926020830284011161027057565b610136565b610132565b61012e565b9190916060818403126102d0575f8101359167ffffffffffffffff83116102cb576102af846102c8948401610240565b9390946102bf81602086016100f9565b936040016100f9565b90565b6100ca565b6100c6565b5190565b60209181520190565b60200190565b151590565b6102f6906102e8565b9052565b5190565b60209181520190565b90825f9392825e0152565b601f801991011690565b61033b61034460209361034993610332816102fa565b938480936102fe565b95869101610307565b610312565b0190565b61037891602060408201926103685f8201515f8501906102ed565b015190602081840391015261031c565b90565b906103859161034d565b90565b60200190565b906103a261039b836102d5565b80926102d9565b90816103b3602083028401946102e2565b925f915b8383106103c657505050505090565b909192939460206103e86103e28385600195038752895161037b565b97610388565b93019301919392906103b7565b61040a9160208201915f81840391015261038e565b90565b61043861042761041e36600461027f565b92919091610e00565b61042f6100bc565b918291826103f5565b0390f35b909182601f830112156104765781359167ffffffffffffffff831161047157602001926020830284011161046c57565b610136565b610132565b61012e565b909182601f830112156104b55781359167ffffffffffffffff83116104b05760200192602083028401116104ab57565b610136565b610132565b61012e565b9060608282031261053b575f82013567ffffffffffffffff811161053657816104e491840161043c565b929093602082013567ffffffffffffffff8111610531578361050791840161043c565b929093604082013567ffffffffffffffff811161052c57610528920161047b565b9091565b6100ca565b6100ca565b6100ca565b6100c6565b5f0190565b3461057a576105646105583660046104ba565b94939093929192610eec565b61056c6100bc565b8061057681610540565b0390f35b6100c2565b916060838303126105cc57610596825f850161011f565b926105a483602083016100f9565b92604082013567ffffffffffffffff81116105c7576105c3920161013a565b9091565b6100ca565b6100c6565b34610603576105ed6105e436600461057f565b92919091611173565b6105f56100bc565b806105ff81610540565b0390f35b6100c2565b9190604083820312610630578061062461062d925f860161011f565b936020016100f9565b90565b6100c6565b346106645761064e610648366004610608565b906111f4565b6106566100bc565b8061066081610540565b0390f35b6100c2565b909182601f830112156106a35781359167ffffffffffffffff831161069e57602001926020830284011161069957565b610136565b610132565b61012e565b9091608082840312610752575f82013567ffffffffffffffff811161074d57836106d391840161043c565b929093602082013567ffffffffffffffff811161074857816106f691840161043c565b929093604082013567ffffffffffffffff81116107435783610719918401610669565b929093606082013567ffffffffffffffff811161073e5761073a920161047b565b9091565b6100ca565b6100ca565b6100ca565b6100ca565b6100c6565b3461078f5761077961076a3660046106a8565b9695909594919493929361134b565b6107816100bc565b8061078b81610540565b0390f35b6100c2565b5f91031261079e57565b6100c6565b346107d1576107b3366004610794565b6107bb611684565b6107c36100bc565b806107cd81610540565b0390f35b6100c2565b9160a083830312610873576107ed825f85016100f9565b926107fb83602083016100f9565b92604082013567ffffffffffffffff811161086e578161081c91840161047b565b929093606082013567ffffffffffffffff8111610869578361083f91840161047b565b929093608082013567ffffffffffffffff811161086457610860920161013a565b9091565b6100ca565b6100ca565b6100ca565b6100c6565b346108b2576108ae61089d61088e3660046107d6565b96959095949194939293611833565b6108a56100bc565b918291826101f2565b0390f35b6100c2565b91909160a081840312610922576108d0835f83016100f9565b926108de81602084016100f9565b926108ec826040850161011f565b926108fa836060830161011f565b92608082013567ffffffffffffffff811161091d57610919920161013a565b9091565b6100ca565b6100c6565b3461095e5761095a61094961093d3660046108b7565b94939093929192611988565b6109516100bc565b918291826101f2565b0390f35b6100c2565b5f80fd5b5f1c90565b60ff1690565b61097e61098391610967565b61096c565b90565b6109909054610972565b90565b5f9061099f6001610986565b82146109a9575d5b565b556109a7565b5f905d565b5f90565b6109c06109b4565b506109cb6001610986565b5f146109d6575c905b565b54906109d4565b6109e56109b4565b505c90565b6109f46001610986565b5f146109fe575d5b565b556109fc565b5d565b5f90565b90565b90565b610a25610a20610a2a92610a0b565b610a0e565b6100ce565b90565b610a3690610a11565b90565b610a4d610a48610a52926100ce565b610a0e565b6100ce565b90565b610a5e90610a39565b90565b610a6a90610a55565b90565b610a7690610a39565b90565b610a8290610a6d565b90565b610a8e90610a6d565b90565b5f80fd5b634e487b7160e01b5f52604160045260245ffd5b90610ab390610312565b810190811067ffffffffffffffff821117610acd57604052565b610a95565b60e01b90565b5f910312610ae257565b6100c6565b610af0906100d9565b9052565b610afd90610108565b9052565b60209181520190565b90825f939282370152565b9190610b2f81610b2881610b3495610b01565b8095610b0a565b610312565b0190565b909391610b799593610b62610b6c92610b5860808601985f870190610ae7565b6020850190610ae7565b6040830190610af4565b6060818503910152610b15565b90565b610b846100bc565b3d5f823e3d90fd5b63ffffffff1690565b610ba9610ba4610bae92610b8c565b610ad2565b6101d9565b90565b505091610bbc610a07565b50610bc5611b12565b9081610be1610bdb610bd65f610a2d565b6100d9565b916100d9565b14610c9457610bf7610bf233610a61565b610a79565b9063b88d4fde90610c0730610a85565b9395949091833b15610c8f57610c3e610c33935f97938894610c276100bc565b9a8b998a988997610ad2565b875260048701610b38565b03925af18015610c8a57610c5e575b50610c5b63150b7a02610b95565b90565b610c7d905f3d8111610c83575b610c758183610aa9565b810190610ad8565b5f610c4d565b503d610c6b565b610b7c565b610a91565b5f63f36675c360e01b815280610cac60048201610540565b0390fd5b606090565b90610cca94939291610cc5611bb5565b610d14565b90610cd3611c77565b565b610ce9610ce4610cee92610a0b565b610a0e565b610108565b90565b916020610d12929493610d0b60408201965f830190610ae7565b0190610af4565b565b93610d439395945080610d37610d31610d2c5f610a2d565b6100d9565b916100d9565b03610df1575b50611ecd565b91610d4c612066565b610d5530610a85565b31610d68610d625f610cd5565b91610108565b11610d71575b50565b80610d8c610d86610d815f610a2d565b6100d9565b916100d9565b145f14610dec5750335b610d9f30610a85565b3190610dac8183906120c5565b907fd35467972d1fda5b63c735f59d3974fa51785a41a92aa3ed1b70832836f8dba691610de3610dda6100bc565b92839283610cf1565b0390a15f610d6e565b610d96565b610dfa90611cc4565b5f610d3d565b90610e14939291610e0f610cb0565b610cb5565b90565b5090565b5090565b6001610e2b9101610108565b90565b634e487b7160e01b5f52603260045260245ffd5b9190811015610e52576020020190565b610e2e565b35610e61816100e5565b90565b9190811015610e74576020020190565b610e2e565b35610e838161010b565b90565b610e8f90610a39565b90565b610e9b90610e86565b90565b610ea790610a6d565b90565b90505190610eb78261010b565b565b90602082820312610ed257610ecf915f01610eaa565b90565b6100c6565b9190610eea905f60208501940190610ae7565b565b9594929195610efc818390610e17565b610f18610f12610f0d888890610e1b565b610108565b91610108565b14158015611099575b61107d57610f2d6109b4565b5b80610f4b610f45610f40858790610e17565b610108565b91610108565b101561107357610f65610f6083858491610e42565b610e57565b90610f7a610f758a878491610e42565b610e57565b610f8e610f8989898591610e64565b610e79565b610fa0610f9a5f610cd5565b91610108565b145f1461105257610ff0906020610fbe610fb986610e92565b610e9e565b6370a0823190610fe5610fd030610a85565b92610fd96100bc565b96879485938493610ad2565b835260048301610ed7565b03915afa93841561104d5761101a94611015935f9161101f575b505b909190916120e3565b610e1f565b610f2e565b611040915060203d8111611046575b6110388183610aa9565b810190610eb9565b5f61100a565b503d61102e565b610b7c565b6110159061101a9361106e6110698b8b8791610e64565b610e79565b61100c565b5050505050509050565b5f631dc0052360e11b81528061109560048201610540565b0390fd5b506110a5858590610e1b565b6110c16110bb6110b68a8790610e17565b610108565b91610108565b1415610f21565b905090565b9091826110dd816110e4936110c8565b8093610b0a565b0190565b90916110f3926110cd565b90565b906111096111026100bc565b9283610aa9565b565b67ffffffffffffffff811161112957611125602091610312565b0190565b610a95565b9061114061113b8361110b565b6110f6565b918252565b606090565b3d5f146111655761115a3d61112e565b903d5f602084013e5b565b61116d611145565b90611163565b6111cc935f938493928061118f61118987610cd5565b91610108565b1485146111ee57506111a030610a85565b31925b92906111b96111b06100bc565b938492836110e8565b03925af16111c561114a565b50156102e8565b6111d257565b5f633204506f60e01b8152806111ea60048201610540565b0390fd5b926111a3565b908061121061120a6112055f610a2d565b6100d9565b916100d9565b145f1461128e5750335b908061122e6112285f610cd5565b91610108565b145f14611289575061123f30610a85565b315b9061124d8183906120c5565b907fd35467972d1fda5b63c735f59d3974fa51785a41a92aa3ed1b70832836f8dba69161128461127b6100bc565b92839283610cf1565b0390a1565b611241565b61121a565b5090565b5f80fd5b5f80fd5b5f80fd5b9035906001602003813603038212156112e5570180359067ffffffffffffffff82116112e0576020019160018202360383136112db57565b61129f565b61129b565b611297565b9082101561130557602061130192028101906112a3565b9091565b610e2e565b611313816102e8565b0361131a57565b5f80fd5b9050519061132b8261130a565b565b9060208282031261134657611343915f0161131e565b90565b6100c6565b9593959492919461135d818390610e17565b61137961137361136e888c90610e1b565b610108565b91610108565b1415801561160b575b80156115dc575b6115c0576113956109b4565b5b806113b36113ad6113a8858790610e17565b610108565b91610108565b10156115b5576113cd6113c883858491610e42565b610e57565b6113e16113dc89878591610e42565b610e57565b6113ed8a8885916112ea565b9290898d61140561140083838a91610e64565b610e79565b6114176114115f610cd5565b91610108565b145f14611593575050611468602061143661143185610e92565b610e9e565b6370a082319061145d61144830610a85565b926114516100bc565b95869485938493610ad2565b835260048301610ed7565b03915afa801561158e5761148b611490916020935f91611561575b505b94610e92565b610e9e565b9263095ea7b3936114b55f8793966114c06114a96100bc565b98899687958694610ad2565b845260048401610cf1565b03925af193841561155c575f8094819461150297611530575b50926114ef6114e66100bc565b938492836110e8565b03925af16114fb61114a565b50156102e8565b6115145761150f90610e1f565b611396565b5f633204506f60e01b81528061152c60048201610540565b0390fd5b6115509060203d8111611555575b6115488183610aa9565b81019061132d565b6114d9565b503d61153e565b610b7c565b6115819150843d8111611587575b6115798183610aa9565b810190610eb9565b5f611483565b503d61156f565b610b7c565b61148b6115b06115ab61149093602095908b91610e64565b610e79565b611485565b505050505050505050565b5f631dc0052360e11b8152806115d860048201610540565b0390fd5b506115e8868490610e17565b6116046115fe6115f98a8890611293565b610108565b91610108565b1415611389565b50611617858990610e1b565b61163361162d611628898790610e17565b610108565b91610108565b1415611382565b5f1b90565b9061164b60ff9161163a565b9181191691161790565b61165e906102e8565b90565b90565b9061167961167461168092611655565b611661565b825461163f565b9055565b33611697611691326100d9565b916100d9565b03611753577f00000000000000000000000000000000000000000000000000000000000000018015611743575b611727576116fa6116f47f0000000000000000000000002ae45edba52b8ba67a473da132bc2c36e95f0677612195565b156102e8565b61170b57611709600180611664565b565b5f6370a4078f60e01b81528061172360048201610540565b0390fd5b5f630f45b98b60e41b81528061173f60048201610540565b0390fd5b5061174e6001610986565b6116c4565b5f63096650c560e21b81528061176b60048201610540565b0390fd5b61177890610a39565b90565b6117849061176f565b90565b61179090610a6d565b90565b60209181520190565b5f80fd5b9037565b9091826117b091611793565b9160018060fb1b0381116117d357829160206117cf92029384916117a0565b0190565b61179c565b61182294819896946118076118309b99956117fd611814965f60a08801970190610ae7565b60208c0190610ae7565b89830360408b01526117a4565b9186830360608801526117a4565b926080818503910152610b15565b90565b505094929091611841610a07565b5061184a611b12565b938461186661186061185b5f610a2d565b6100d9565b916100d9565b1461191a5761187c6118773361177b565b611787565b93632eb2c2d69161188c30610a85565b969891939497863b15611915575f986118b9968a966118c4956118ad6100bc565b9d8e9c8d9b8c9a610ad2565b8a5260048a016117d8565b03925af18015611910576118e4575b506118e163bc197c81610b95565b90565b611903905f3d8111611909575b6118fb8183610aa9565b810190610ad8565b5f6118d3565b503d6118f1565b610b7c565b610a91565b5f63f36675c360e01b81528061193260048201610540565b0390fd5b919361196e611978929694611964611985999761195a60a088019a5f890190610ae7565b6020870190610ae7565b6040850190610af4565b6060830190610af4565b6080818503910152610b15565b90565b5050929091611995610a07565b5061199e611b12565b91826119ba6119b46119af5f610a2d565b6100d9565b916100d9565b14611a6d576119d06119cb3361177b565b611787565b9163f242432a6119df30610a85565b949695919295843b15611a68575f96611a0c948894611a1793611a006100bc565b9b8c9a8b998a98610ad2565b885260048801611936565b03925af18015611a6357611a37575b50611a3463f23a6e61610b95565b90565b611a56905f3d8111611a5c575b611a4e8183610aa9565b810190610ad8565b5f611a26565b503d611a44565b610b7c565b610a91565b5f63f36675c360e01b815280611a8560048201610540565b0390fd5b611a9230610a85565b347fd35467972d1fda5b63c735f59d3974fa51785a41a92aa3ed1b70832836f8dba691611ac9611ac06100bc565b92839283610cf1565b0390a1565b5f90565b90565b611ae1611ae691610967565b611ad2565b90565b611af39054611ad5565b90565b611b0a611b05611b0f92610108565b610a0e565b6100ce565b90565b611b1a611ace565b50611b5f611b5a611b557f0000000000000000000000000000000000000000000000000000000000000003611b4f6002611ae9565b9061224e565b611af6565b610a6d565b90565b90565b611b71611b7691610967565b611b62565b90565b611b839054611b65565b90565b611b8f90610a6d565b90565b916020611bb3929493611bac60408201965f830190610ae7565b0190610ae7565b565b611bce611bc9611bc45f611b79565b6121eb565b612200565b80611be9611be3611bde5f610a2d565b6100d9565b916100d9565b141580611c5c575b80611c39575b611c195750611c17611c10611c0b5f611b79565b6121eb565b339061220d565b565b3390611c355f92839263200991eb60e21b845260048401611b92565b0390fd5b5033611c55611c4f611c4a30611b86565b6100d9565b916100d9565b1415611bf7565b5080611c70611c6a336100d9565b916100d9565b1415611bf1565b611c9a611c8b611c865f611b79565b6121eb565b611c945f610a2d565b9061220d565b565b611ca590610a39565b90565b611cbc611cb7611cc1926100ce565b610a0e565b610108565b90565b80611cdf611cd9611cd430610a85565b6100d9565b916100d9565b14611d2d57611d2b907f000000000000000000000000000000000000000000000000000000000000000190611d25611d20611d1a6002611ae9565b92611c9c565b611ca8565b9161227a565b565b611d50611d3930610a85565b5f918291630bc2c5df60e11b835260048301610ed7565b0390fd5b5090565b67ffffffffffffffff8111611d705760208091020190565b610a95565b90611d87611d8283611d58565b6110f6565b918252565b611d9660406110f6565b90565b5f90565b606090565b611daa611d8c565b9060208083611db7611d99565b815201611dc2611d9d565b81525050565b611dd0611da2565b90565b5f5b828110611de157505050565b602090611dec611dc8565b8184015201611dd5565b90611e1b611e0383611d75565b92602080611e118693611d58565b9201910390611dd3565b565b3690565b90611e2b826102d5565b811015611e3c576020809102010190565b610e2e565b903590600160800381360303821215611e58570190565b611297565b90821015611e77576020611e749202810190611e41565b90565b610e2e565b90611e86906102e8565b9052565b611e9490516102e8565b90565b949391604091611ecb94611ec392611eb660608a01935f8b0190610ae7565b88830360208a0152610b15565b940190610af4565b565b9190611ed7610cb0565b50611ee3838290611d54565b91611eed83611df6565b90611ef6611e1d565b50611f005f610cd5565b5b80611f14611f0e87610108565b91610108565b101561205e57611f25838290611e21565b5190611f3387868391611e5d565b611f905f80611f4460408501610e79565b611f4f828601610e57565b90611f5e8660608101906112a3565b9190611f74611f6b6100bc565b938492836110e8565b03925af1611f8061114a565b905f860191602087015290611e7c565b82516020820135171561202257611fab5f611fb69401611e8a565b611fbb575b50610e1f565b611f01565b80611fc95f60409301610e57565b612019611fe6611fdd8460608101906112a3565b95909401610e79565b7f93485dcd31a905e3ffd7b012abe3438fa8fa77f98ddc9f50e879d3fa7ccdc324946120106100bc565b94859485611e97565b0390a15f611fb0565b62461bcd60e51b5f52602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260845ffd5b509250925050565b61206e611b12565b61208861208261207d5f610a2d565b6100d9565b916100d9565b146120c3576120c17f00000000000000000000000000000000000000000000000000000000000000056120bb6002611ae9565b90612224565b565b565b905f8092389238915af1156120d657565b63b12d13eb5f526004601cfd5b60105f604492602095829560145260345263a9059cbb60601b82525af13d1560015f5114171615612114575f603452565b6390b8ec185f526004601cfd5b5f90565b90565b61213c61213761214192612125565b610a0e565b610108565b90565b634e487b7160e01b5f52601260045260245ffd5b61216461216a91610108565b91610108565b908115612175570490565b612144565b6121855f80926110c8565b0190565b6121929061217a565b90565b5f80916121a0612121565b506121b55a6121af600a612128565b90612158565b906121be6100bc565b90816121c981612189565b0392fa6121d461114a565b5090565b5f90565b90565b6121e8906121dc565b90565b6121fd906121f76121d8565b506121df565b90565b612208611ace565b505c90565b5d565b634e487b7160e01b5f52605160045260245ffd5b8060061461223f576005036122105761223c906109af565b5b565b5061224990610993565b61223d565b8060041461226a5760030361221057612266906109dd565b905b565b50612274906109b8565b90612268565b91909180600214612298576001036122105761229591610a04565b5b565b506122a2916109ea565b61229656fea2646970667358221220f5321f815837e49693a50f86aafaccf3a993dc7eae58572adb515efb7d24f76f64736f6c634300081c0033

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.