Feature Tip: Add private address tag to any address under My Name Tag !
Source Code
Overview
ETH Balance
0 ETH
Eth Value
$0.00| Transaction Hash |
Method
|
Block
|
From
|
|
To
|
||||
|---|---|---|---|---|---|---|---|---|---|
Latest 25 internal transactions (View All)
Advanced mode:
| Parent Transaction Hash | Method | Block |
From
|
|
To
|
||
|---|---|---|---|---|---|---|---|
| Transfer | 23979816 | 44 hrs ago | 0.00025287 ETH | ||||
| Transfer | 23979816 | 44 hrs ago | 0.00012918 ETH | ||||
| Transfer | 23979816 | 44 hrs ago | 0.12679183 ETH | ||||
| Transfer | 23979816 | 44 hrs ago | 0.00012918 ETH | ||||
| Transfer | 23979816 | 44 hrs ago | 0.12730308 ETH | ||||
| Transfer | 23969914 | 3 days ago | 0.00001281 ETH | ||||
| Transfer | 23969914 | 3 days ago | 0.00009308 ETH | ||||
| Transfer | 23969914 | 3 days ago | 0.00140741 ETH | ||||
| Transfer | 23969914 | 3 days ago | 0.00009308 ETH | ||||
| Transfer | 23969914 | 3 days ago | 0.00160639 ETH | ||||
| Transfer | 23936230 | 8 days ago | 0.00000502 ETH | ||||
| Transfer | 23936230 | 8 days ago | 0.00001465 ETH | ||||
| Transfer | 23936230 | 8 days ago | 0.00624091 ETH | ||||
| Transfer | 23936230 | 8 days ago | 0.00001465 ETH | ||||
| Transfer | 23936230 | 8 days ago | 0.00627525 ETH | ||||
| Transfer | 23932775 | 8 days ago | 0.00000005 ETH | ||||
| Transfer | 23932775 | 8 days ago | 0.0000225 ETH | ||||
| Transfer | 23932775 | 8 days ago | 0.00526373 ETH | ||||
| Transfer | 23932775 | 8 days ago | 0.0000225 ETH | ||||
| Transfer | 23932775 | 8 days ago | 0.0053088 ETH | ||||
| Transfer | 23798878 | 27 days ago | 0.00001935 ETH | ||||
| Transfer | 23798878 | 27 days ago | 0.0003949 ETH | ||||
| Transfer | 23798878 | 27 days ago | 0.03019115 ETH | ||||
| Transfer | 23798878 | 27 days ago | 0.0003949 ETH | ||||
| Transfer | 23798878 | 27 days ago | 0.03100031 ETH |
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
RelayRouter
Compiler Version
v0.8.28+commit.7893614a
Optimization Enabled:
Yes with 600 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.25;
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 {SafeTransferLib} from "./SafeTransferLib.sol"; // NOT the solmate version.
import {ReentrancyGuardMsgSender} from "@lib/ReentrancyGuardMsgSender.sol";
import {Multicall3} from "./Multicall3.sol";
import {Call3Value, Result, RelayerWitness} from "./RelayStructs.sol";
contract RelayRouter is Multicall3, ReentrancyGuardMsgSender {
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);
// Simple storage-backed recipient holder (replaces Tstorish/tstore usage)
address private _nftRecipientStorage;
constructor() {}
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 Stores the recipient in contract storage to forward received NFTs during multicall
/// @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
_nftRecipientStorage = 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 _nftRecipientStorage;
}
/// @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
_nftRecipientStorage = address(0);
}
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
pragma solidity ^0.8.25;
// Transient storage is not available on Paris EVM. Use standard storage.
/// @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 storage.
/// Allows the original sender and the contract itself to reenter the contract,
/// but prevents all other callers from reentering.
/// Update: We added a _nonReentrantKey() function to make this contractt compatible with
/// ERC-4337 and ERC-2771.
/// the “lock key” is the logical user for i.e. the trusted Forwarder for ERC-2771
/// and the EntryPoint for ERC-4337
abstract contract ReentrancyGuardMsgSender {
address private _nonReentrantSender;
error InvalidMsgSender(address storedSender, address actualSender);
// Override point for children (defaults to msg.sender)
function _nonReentrantKey() internal view virtual returns (address) {
return msg.sender;
}
modifier nonReentrant() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
function _nonReentrantBefore() private {
address storedSender = _nonReentrantSender;
address key = _nonReentrantKey(); // use the logical key
if (
storedSender != address(0) &&
storedSender != key &&
msg.sender != address(this)
) {
revert InvalidMsgSender(storedSender, msg.sender);
}
_nonReentrantSender = key;
}
function _nonReentrantAfter() private {
_nonReentrantSender = address(0);
}
}// 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
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) 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 `amount` 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 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @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);
}// 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/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.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;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
/// @notice Safe ETH and ERC20 transfer library that gracefully handles missing return values.
/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/SafeTransferLib.sol)
/// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/SafeTransferLib.sol)
/// @author Permit2 operations from (https://github.com/Uniswap/permit2/blob/main/src/libraries/Permit2Lib.sol)
///
/// @dev Note:
/// - For ETH transfers, please use `forceSafeTransferETH` for DoS protection.
/// - For ERC20s, this implementation won't check that a token has code,
/// responsibility is delegated to the caller.
library SafeTransferLib {
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* CUSTOM ERRORS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev The ETH transfer has failed.
error ETHTransferFailed();
/// @dev The ERC20 `transferFrom` has failed.
error TransferFromFailed();
/// @dev The ERC20 `transfer` has failed.
error TransferFailed();
/// @dev The ERC20 `approve` has failed.
error ApproveFailed();
/// @dev The Permit2 operation has failed.
error Permit2Failed();
/// @dev The Permit2 amount must be less than `2**160 - 1`.
error Permit2AmountOverflow();
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* CONSTANTS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev Suggested gas stipend for contract receiving ETH that disallows any storage writes.
uint256 internal constant GAS_STIPEND_NO_STORAGE_WRITES = 2300;
/// @dev Suggested gas stipend for contract receiving ETH to perform a few
/// storage reads and writes, but low enough to prevent griefing.
uint256 internal constant GAS_STIPEND_NO_GRIEF = 100000;
/// @dev The unique EIP-712 domain domain separator for the DAI token contract.
bytes32 internal constant DAI_DOMAIN_SEPARATOR =
0xdbb8cf42e1ecb028be3f3dbc922e1d878b963f411dc388ced501601c60f7c6f7;
/// @dev The address for the WETH9 contract on Ethereum mainnet.
address internal constant WETH9 = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;
/// @dev The canonical Permit2 address.
/// [Github](https://github.com/Uniswap/permit2)
/// [Etherscan](https://etherscan.io/address/0x000000000022D473030F116dDEE9F6B43aC78BA3)
address internal constant PERMIT2 = 0x000000000022D473030F116dDEE9F6B43aC78BA3;
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* ETH OPERATIONS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
// If the ETH transfer MUST succeed with a reasonable gas budget, use the force variants.
//
// The regular variants:
// - Forwards all remaining gas to the target.
// - Reverts if the target reverts.
// - Reverts if the current contract has insufficient balance.
//
// The force variants:
// - Forwards with an optional gas stipend
// (defaults to `GAS_STIPEND_NO_GRIEF`, which is sufficient for most cases).
// - If the target reverts, or if the gas stipend is exhausted,
// creates a temporary contract to force send the ETH via `SELFDESTRUCT`.
// Future compatible with `SENDALL`: https://eips.ethereum.org/EIPS/eip-4758.
// - Reverts if the current contract has insufficient balance.
//
// The try variants:
// - Forwards with a mandatory gas stipend.
// - Instead of reverting, returns whether the transfer succeeded.
/// @dev Sends `amount` (in wei) ETH to `to`.
function safeTransferETH(address to, uint256 amount) internal {
/// @solidity memory-safe-assembly
assembly {
if iszero(call(gas(), to, amount, codesize(), 0x00, codesize(), 0x00)) {
mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`.
revert(0x1c, 0x04)
}
}
}
/// @dev Sends all the ETH in the current contract to `to`.
function safeTransferAllETH(address to) internal {
/// @solidity memory-safe-assembly
assembly {
// Transfer all the ETH and check if it succeeded or not.
if iszero(call(gas(), to, selfbalance(), codesize(), 0x00, codesize(), 0x00)) {
mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`.
revert(0x1c, 0x04)
}
}
}
/// @dev Force sends `amount` (in wei) ETH to `to`, with a `gasStipend`.
function forceSafeTransferETH(address to, uint256 amount, uint256 gasStipend) internal {
/// @solidity memory-safe-assembly
assembly {
if lt(selfbalance(), amount) {
mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`.
revert(0x1c, 0x04)
}
if iszero(call(gasStipend, to, amount, codesize(), 0x00, codesize(), 0x00)) {
mstore(0x00, to) // Store the address in scratch space.
mstore8(0x0b, 0x73) // Opcode `PUSH20`.
mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`.
if iszero(create(amount, 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation.
}
}
}
/// @dev Force sends all the ETH in the current contract to `to`, with a `gasStipend`.
function forceSafeTransferAllETH(address to, uint256 gasStipend) internal {
/// @solidity memory-safe-assembly
assembly {
if iszero(call(gasStipend, to, selfbalance(), codesize(), 0x00, codesize(), 0x00)) {
mstore(0x00, to) // Store the address in scratch space.
mstore8(0x0b, 0x73) // Opcode `PUSH20`.
mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`.
if iszero(create(selfbalance(), 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation.
}
}
}
/// @dev Force sends `amount` (in wei) ETH to `to`, with `GAS_STIPEND_NO_GRIEF`.
function forceSafeTransferETH(address to, uint256 amount) internal {
/// @solidity memory-safe-assembly
assembly {
if lt(selfbalance(), amount) {
mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`.
revert(0x1c, 0x04)
}
if iszero(call(GAS_STIPEND_NO_GRIEF, to, amount, codesize(), 0x00, codesize(), 0x00)) {
mstore(0x00, to) // Store the address in scratch space.
mstore8(0x0b, 0x73) // Opcode `PUSH20`.
mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`.
if iszero(create(amount, 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation.
}
}
}
/// @dev Force sends all the ETH in the current contract to `to`, with `GAS_STIPEND_NO_GRIEF`.
function forceSafeTransferAllETH(address to) internal {
/// @solidity memory-safe-assembly
assembly {
// forgefmt: disable-next-item
if iszero(call(GAS_STIPEND_NO_GRIEF, to, selfbalance(), codesize(), 0x00, codesize(), 0x00)) {
mstore(0x00, to) // Store the address in scratch space.
mstore8(0x0b, 0x73) // Opcode `PUSH20`.
mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`.
if iszero(create(selfbalance(), 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation.
}
}
}
/// @dev Sends `amount` (in wei) ETH to `to`, with a `gasStipend`.
function trySafeTransferETH(address to, uint256 amount, uint256 gasStipend)
internal
returns (bool success)
{
/// @solidity memory-safe-assembly
assembly {
success := call(gasStipend, to, amount, codesize(), 0x00, codesize(), 0x00)
}
}
/// @dev Sends all the ETH in the current contract to `to`, with a `gasStipend`.
function trySafeTransferAllETH(address to, uint256 gasStipend)
internal
returns (bool success)
{
/// @solidity memory-safe-assembly
assembly {
success := call(gasStipend, to, selfbalance(), codesize(), 0x00, codesize(), 0x00)
}
}
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* ERC20 OPERATIONS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev Sends `amount` of ERC20 `token` from `from` to `to`.
/// Reverts upon failure.
///
/// The `from` account must have at least `amount` approved for
/// the current contract to manage.
function safeTransferFrom(address token, address from, address to, uint256 amount) internal {
/// @solidity memory-safe-assembly
assembly {
let m := mload(0x40) // Cache the free memory pointer.
mstore(0x60, amount) // Store the `amount` argument.
mstore(0x40, to) // Store the `to` argument.
mstore(0x2c, shl(96, from)) // Store the `from` argument.
mstore(0x0c, 0x23b872dd000000000000000000000000) // `transferFrom(address,address,uint256)`.
// Perform the transfer, reverting upon failure.
if iszero(
and( // The arguments of `and` are evaluated from right to left.
or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing.
call(gas(), token, 0, 0x1c, 0x64, 0x00, 0x20)
)
) {
mstore(0x00, 0x7939f424) // `TransferFromFailed()`.
revert(0x1c, 0x04)
}
mstore(0x60, 0) // Restore the zero slot to zero.
mstore(0x40, m) // Restore the free memory pointer.
}
}
/// @dev Sends `amount` of ERC20 `token` from `from` to `to`.
///
/// The `from` account must have at least `amount` approved for the current contract to manage.
function trySafeTransferFrom(address token, address from, address to, uint256 amount)
internal
returns (bool success)
{
/// @solidity memory-safe-assembly
assembly {
let m := mload(0x40) // Cache the free memory pointer.
mstore(0x60, amount) // Store the `amount` argument.
mstore(0x40, to) // Store the `to` argument.
mstore(0x2c, shl(96, from)) // Store the `from` argument.
mstore(0x0c, 0x23b872dd000000000000000000000000) // `transferFrom(address,address,uint256)`.
success :=
and( // The arguments of `and` are evaluated from right to left.
or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing.
call(gas(), token, 0, 0x1c, 0x64, 0x00, 0x20)
)
mstore(0x60, 0) // Restore the zero slot to zero.
mstore(0x40, m) // Restore the free memory pointer.
}
}
/// @dev Sends all of ERC20 `token` from `from` to `to`.
/// Reverts upon failure.
///
/// The `from` account must have their entire balance approved for the current contract to manage.
function safeTransferAllFrom(address token, address from, address to)
internal
returns (uint256 amount)
{
/// @solidity memory-safe-assembly
assembly {
let m := mload(0x40) // Cache the free memory pointer.
mstore(0x40, to) // Store the `to` argument.
mstore(0x2c, shl(96, from)) // Store the `from` argument.
mstore(0x0c, 0x70a08231000000000000000000000000) // `balanceOf(address)`.
// Read the balance, reverting upon failure.
if iszero(
and( // The arguments of `and` are evaluated from right to left.
gt(returndatasize(), 0x1f), // At least 32 bytes returned.
staticcall(gas(), token, 0x1c, 0x24, 0x60, 0x20)
)
) {
mstore(0x00, 0x7939f424) // `TransferFromFailed()`.
revert(0x1c, 0x04)
}
mstore(0x00, 0x23b872dd) // `transferFrom(address,address,uint256)`.
amount := mload(0x60) // The `amount` is already at 0x60. We'll need to return it.
// Perform the transfer, reverting upon failure.
if iszero(
and( // The arguments of `and` are evaluated from right to left.
or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing.
call(gas(), token, 0, 0x1c, 0x64, 0x00, 0x20)
)
) {
mstore(0x00, 0x7939f424) // `TransferFromFailed()`.
revert(0x1c, 0x04)
}
mstore(0x60, 0) // Restore the zero slot to zero.
mstore(0x40, m) // Restore the free memory pointer.
}
}
/// @dev Sends `amount` of ERC20 `token` from the current contract to `to`.
/// Reverts upon failure.
function safeTransfer(address token, address to, uint256 amount) internal {
/// @solidity memory-safe-assembly
assembly {
mstore(0x14, to) // Store the `to` argument.
mstore(0x34, amount) // Store the `amount` argument.
mstore(0x00, 0xa9059cbb000000000000000000000000) // `transfer(address,uint256)`.
// Perform the transfer, reverting upon failure.
if iszero(
and( // The arguments of `and` are evaluated from right to left.
or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing.
call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20)
)
) {
mstore(0x00, 0x90b8ec18) // `TransferFailed()`.
revert(0x1c, 0x04)
}
mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten.
}
}
/// @dev Sends all of ERC20 `token` from the current contract to `to`.
/// Reverts upon failure.
function safeTransferAll(address token, address to) internal returns (uint256 amount) {
/// @solidity memory-safe-assembly
assembly {
mstore(0x00, 0x70a08231) // Store the function selector of `balanceOf(address)`.
mstore(0x20, address()) // Store the address of the current contract.
// Read the balance, reverting upon failure.
if iszero(
and( // The arguments of `and` are evaluated from right to left.
gt(returndatasize(), 0x1f), // At least 32 bytes returned.
staticcall(gas(), token, 0x1c, 0x24, 0x34, 0x20)
)
) {
mstore(0x00, 0x90b8ec18) // `TransferFailed()`.
revert(0x1c, 0x04)
}
mstore(0x14, to) // Store the `to` argument.
amount := mload(0x34) // The `amount` is already at 0x34. We'll need to return it.
mstore(0x00, 0xa9059cbb000000000000000000000000) // `transfer(address,uint256)`.
// Perform the transfer, reverting upon failure.
if iszero(
and( // The arguments of `and` are evaluated from right to left.
or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing.
call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20)
)
) {
mstore(0x00, 0x90b8ec18) // `TransferFailed()`.
revert(0x1c, 0x04)
}
mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten.
}
}
/// @dev Sets `amount` of ERC20 `token` for `to` to manage on behalf of the current contract.
/// Reverts upon failure.
function safeApprove(address token, address to, uint256 amount) internal {
/// @solidity memory-safe-assembly
assembly {
mstore(0x14, to) // Store the `to` argument.
mstore(0x34, amount) // Store the `amount` argument.
mstore(0x00, 0x095ea7b3000000000000000000000000) // `approve(address,uint256)`.
// Perform the approval, reverting upon failure.
if iszero(
and( // The arguments of `and` are evaluated from right to left.
or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing.
call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20)
)
) {
mstore(0x00, 0x3e3f8f73) // `ApproveFailed()`.
revert(0x1c, 0x04)
}
mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten.
}
}
/// @dev Sets `amount` of ERC20 `token` for `to` to manage on behalf of the current contract.
/// If the initial attempt to approve fails, attempts to reset the approved amount to zero,
/// then retries the approval again (some tokens, e.g. USDT, requires this).
/// Reverts upon failure.
function safeApproveWithRetry(address token, address to, uint256 amount) internal {
/// @solidity memory-safe-assembly
assembly {
mstore(0x14, to) // Store the `to` argument.
mstore(0x34, amount) // Store the `amount` argument.
mstore(0x00, 0x095ea7b3000000000000000000000000) // `approve(address,uint256)`.
// Perform the approval, retrying upon failure.
if iszero(
and( // The arguments of `and` are evaluated from right to left.
or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing.
call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20)
)
) {
mstore(0x34, 0) // Store 0 for the `amount`.
mstore(0x00, 0x095ea7b3000000000000000000000000) // `approve(address,uint256)`.
pop(call(gas(), token, 0, 0x10, 0x44, codesize(), 0x00)) // Reset the approval.
mstore(0x34, amount) // Store back the original `amount`.
// Retry the approval, reverting upon failure.
if iszero(
and(
or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing.
call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20)
)
) {
mstore(0x00, 0x3e3f8f73) // `ApproveFailed()`.
revert(0x1c, 0x04)
}
}
mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten.
}
}
/// @dev Returns the amount of ERC20 `token` owned by `account`.
/// Returns zero if the `token` does not exist.
function balanceOf(address token, address account) internal view returns (uint256 amount) {
/// @solidity memory-safe-assembly
assembly {
mstore(0x14, account) // Store the `account` argument.
mstore(0x00, 0x70a08231000000000000000000000000) // `balanceOf(address)`.
amount :=
mul( // The arguments of `mul` are evaluated from right to left.
mload(0x20),
and( // The arguments of `and` are evaluated from right to left.
gt(returndatasize(), 0x1f), // At least 32 bytes returned.
staticcall(gas(), token, 0x10, 0x24, 0x20, 0x20)
)
)
}
}
/// @dev Sends `amount` of ERC20 `token` from `from` to `to`.
/// If the initial attempt fails, try to use Permit2 to transfer the token.
/// Reverts upon failure.
///
/// The `from` account must have at least `amount` approved for the current contract to manage.
function safeTransferFrom2(address token, address from, address to, uint256 amount) internal {
if (!trySafeTransferFrom(token, from, to, amount)) {
permit2TransferFrom(token, from, to, amount);
}
}
/// @dev Sends `amount` of ERC20 `token` from `from` to `to` via Permit2.
/// Reverts upon failure.
function permit2TransferFrom(address token, address from, address to, uint256 amount)
internal
{
/// @solidity memory-safe-assembly
assembly {
let m := mload(0x40)
mstore(add(m, 0x74), shr(96, shl(96, token)))
mstore(add(m, 0x54), amount)
mstore(add(m, 0x34), to)
mstore(add(m, 0x20), shl(96, from))
// `transferFrom(address,address,uint160,address)`.
mstore(m, 0x36c78516000000000000000000000000)
let p := PERMIT2
let exists := eq(chainid(), 1)
if iszero(exists) { exists := iszero(iszero(extcodesize(p))) }
if iszero(and(call(gas(), p, 0, add(m, 0x10), 0x84, codesize(), 0x00), exists)) {
mstore(0x00, 0x7939f4248757f0fd) // `TransferFromFailed()` or `Permit2AmountOverflow()`.
revert(add(0x18, shl(2, iszero(iszero(shr(160, amount))))), 0x04)
}
}
}
/// @dev Permit a user to spend a given amount of
/// another user's tokens via native EIP-2612 permit if possible, falling
/// back to Permit2 if native permit fails or is not implemented on the token.
function permit2(
address token,
address owner,
address spender,
uint256 amount,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) internal {
bool success;
/// @solidity memory-safe-assembly
assembly {
for {} shl(96, xor(token, WETH9)) {} {
mstore(0x00, 0x3644e515) // `DOMAIN_SEPARATOR()`.
if iszero(
and( // The arguments of `and` are evaluated from right to left.
lt(iszero(mload(0x00)), eq(returndatasize(), 0x20)), // Returns 1 non-zero word.
// Gas stipend to limit gas burn for tokens that don't refund gas when
// an non-existing function is called. 5K should be enough for a SLOAD.
staticcall(5000, token, 0x1c, 0x04, 0x00, 0x20)
)
) { break }
// After here, we can be sure that token is a contract.
let m := mload(0x40)
mstore(add(m, 0x34), spender)
mstore(add(m, 0x20), shl(96, owner))
mstore(add(m, 0x74), deadline)
if eq(mload(0x00), DAI_DOMAIN_SEPARATOR) {
mstore(0x14, owner)
mstore(0x00, 0x7ecebe00000000000000000000000000) // `nonces(address)`.
mstore(add(m, 0x94), staticcall(gas(), token, 0x10, 0x24, add(m, 0x54), 0x20))
mstore(m, 0x8fcbaf0c000000000000000000000000) // `IDAIPermit.permit`.
// `nonces` is already at `add(m, 0x54)`.
// `1` is already stored at `add(m, 0x94)`.
mstore(add(m, 0xb4), and(0xff, v))
mstore(add(m, 0xd4), r)
mstore(add(m, 0xf4), s)
success := call(gas(), token, 0, add(m, 0x10), 0x104, codesize(), 0x00)
break
}
mstore(m, 0xd505accf000000000000000000000000) // `IERC20Permit.permit`.
mstore(add(m, 0x54), amount)
mstore(add(m, 0x94), and(0xff, v))
mstore(add(m, 0xb4), r)
mstore(add(m, 0xd4), s)
success := call(gas(), token, 0, add(m, 0x10), 0xe4, codesize(), 0x00)
break
}
}
if (!success) simplePermit2(token, owner, spender, amount, deadline, v, r, s);
}
/// @dev Simple permit on the Permit2 contract.
function simplePermit2(
address token,
address owner,
address spender,
uint256 amount,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) internal {
/// @solidity memory-safe-assembly
assembly {
let m := mload(0x40)
mstore(m, 0x927da105) // `allowance(address,address,address)`.
{
let addressMask := shr(96, not(0))
mstore(add(m, 0x20), and(addressMask, owner))
mstore(add(m, 0x40), and(addressMask, token))
mstore(add(m, 0x60), and(addressMask, spender))
mstore(add(m, 0xc0), and(addressMask, spender))
}
let p := mul(PERMIT2, iszero(shr(160, amount)))
if iszero(
and( // The arguments of `and` are evaluated from right to left.
gt(returndatasize(), 0x5f), // Returns 3 words: `amount`, `expiration`, `nonce`.
staticcall(gas(), p, add(m, 0x1c), 0x64, add(m, 0x60), 0x60)
)
) {
mstore(0x00, 0x6b836e6b8757f0fd) // `Permit2Failed()` or `Permit2AmountOverflow()`.
revert(add(0x18, shl(2, iszero(p))), 0x04)
}
mstore(m, 0x2b67b570) // `Permit2.permit` (PermitSingle variant).
// `owner` is already `add(m, 0x20)`.
// `token` is already at `add(m, 0x40)`.
mstore(add(m, 0x60), amount)
mstore(add(m, 0x80), 0xffffffffffff) // `expiration = type(uint48).max`.
// `nonce` is already at `add(m, 0xa0)`.
// `spender` is already at `add(m, 0xc0)`.
mstore(add(m, 0xe0), deadline)
mstore(add(m, 0x100), 0x100) // `signature` offset.
mstore(add(m, 0x120), 0x41) // `signature` length.
mstore(add(m, 0x140), r)
mstore(add(m, 0x160), s)
mstore(add(m, 0x180), shl(248, v))
if iszero(call(gas(), p, 0, add(m, 0x1c), 0x184, codesize(), 0x00)) {
mstore(0x00, 0x6b836e6b) // `Permit2Failed()`.
revert(0x1c, 0x04)
}
}
}
}{
"optimizer": {
"enabled": true,
"runs": 600
},
"evmVersion": "paris",
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"metadata": {
"useLiteralContent": 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"},{"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":[{"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
6080604052348015600f57600080fd5b5061157a8061001f6000396000f3fe60806040526004361061007f5760003560e01c80635de81e3f1161004e5780635de81e3f1461017b57806373b7bb2f1461019b578063bc197c81146101bb578063f23a6e61146101db57600080fd5b8063150b7a02146100c357806330be5567146101195780633b2253c8146101395780635d1fe6a21461015b57600080fd5b366100be57604080513081523460208201527fd35467972d1fda5b63c735f59d3974fa51785a41a92aa3ed1b70832836f8dba6910160405180910390a1005b600080fd5b3480156100cf57600080fd5b506100e36100de366004610dbc565b6101fb565b6040517fffffffff0000000000000000000000000000000000000000000000000000000090911681526020015b60405180910390f35b61012c610127366004610e70565b6102a9565b6040516101109190610ed5565b34801561014557600080fd5b50610159610154366004610f8a565b610376565b005b34801561016757600080fd5b50610159610176366004611030565b6104d6565b34801561018757600080fd5b5061015961019636600461108a565b61056b565b3480156101a757600080fd5b506101596101b63660046110b6565b6105f3565b3480156101c757600080fd5b506100e36101d636600461118d565b610874565b3480156101e757600080fd5b506100e36101f6366004611240565b61092b565b6000806102106001546001600160a01b031690565b90506001600160a01b0381166102395760405163f36675c360e01b815260040160405180910390fd5b604051635c46a7ef60e11b8152339063b88d4fde9061026490309085908a908a908a906004016112cf565b600060405180830381600087803b15801561027e57600080fd5b505af1158015610292573d6000803e3d6000fd5b50630a85bd0160e11b9a9950505050505050505050565b60606102b36109dc565b6001600160a01b038216156102cb576102cb82610a6d565b6102d58585610aba565b90506102df610cb2565b47156103595760006001600160a01b038416156102fc57836102fe565b335b9050476103146001600160a01b03831682610ce8565b604080516001600160a01b0384168152602081018390527fd35467972d1fda5b63c735f59d3974fa51785a41a92aa3ed1b70832836f8dba6910160405180910390a150505b61036e600080546001600160a01b0319169055565b949350505050565b84811415806103855750808314155b156103a357604051631dc0052360e11b815260040160405180910390fd5b60005b858110156104cd5760008787838181106103c2576103c2611312565b90506020020160208101906103d79190611328565b905060008686848181106103ed576103ed611312565b90506020020160208101906104029190611328565b9050600085858581811061041857610418611312565b905060200201356000146104445785858581811061043857610438611312565b905060200201356104ac565b6040516370a0823160e01b81523060048201526001600160a01b038416906370a0823190602401602060405180830381865afa158015610488573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104ac919061134a565b90506104c26001600160a01b0384168383610d08565b5050506001016103a6565b50505050505050565b60006001600160a01b03841685156104ee57856104f0565b475b8484604051610500929190611363565b60006040518083038185875af1925050503d806000811461053d576040519150601f19603f3d011682016040523d82523d6000602084013e610542565b606091505b505090508061056457604051633204506f60e01b815260040160405180910390fd5b5050505050565b60006001600160a01b038216156105825781610584565b335b9050600083156105945783610596565b475b90506105ab6001600160a01b03831682610ce8565b604080516001600160a01b0384168152602081018390527fd35467972d1fda5b63c735f59d3974fa51785a41a92aa3ed1b70832836f8dba6910160405180910390a150505050565b86811415806106025750808514155b8061060d5750848314155b1561062b57604051631dc0052360e11b815260040160405180910390fd5b60005b8781101561086957600089898381811061064a5761064a611312565b905060200201602081019061065f9190611328565b9050600088888481811061067557610675611312565b905060200201602081019061068a9190611328565b90503660008888868181106106a1576106a1611312565b90506020028101906106b39190611373565b9150915060008787878181106106cb576106cb611312565b905060200201356000146106f7578787878181106106eb576106eb611312565b9050602002013561075f565b6040516370a0823160e01b81523060048201526001600160a01b038616906370a0823190602401602060405180830381865afa15801561073b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061075f919061134a565b60405163095ea7b360e01b81526001600160a01b038681166004830152602482018390529192509086169063095ea7b3906044016020604051808303816000875af11580156107b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107d691906113ba565b506000846001600160a01b031684846040516107f3929190611363565b6000604051808303816000865af19150503d8060008114610830576040519150601f19603f3d011682016040523d82523d6000602084013e610835565b606091505b505090508061085757604051633204506f60e01b815260040160405180910390fd5b50506001909401935061062e92505050565b505050505050505050565b6000806108896001546001600160a01b031690565b90506001600160a01b0381166108b25760405163f36675c360e01b815260040160405180910390fd5b604051631759616b60e11b81523390632eb2c2d6906108e390309085908d908d908d908d908d908d90600401611427565b600060405180830381600087803b1580156108fd57600080fd5b505af1158015610911573d6000803e3d6000fd5b5063bc197c8160e01b9d9c50505050505050505050505050565b6000806109406001546001600160a01b031690565b90506001600160a01b0381166109695760405163f36675c360e01b815260040160405180910390fd5b604051637921219560e11b8152339063f242432a9061099690309085908b908b908b908b90600401611490565b600060405180830381600087803b1580156109b057600080fd5b505af11580156109c4573d6000803e3d6000fd5b5063f23a6e6160e01b9b9a5050505050505050505050565b6000546001600160a01b0316338115801590610a0a5750806001600160a01b0316826001600160a01b031614155b8015610a165750333014155b15610a4a5760405163200991eb60e21b81526001600160a01b03831660048201523360248201526044015b60405180910390fd5b600080546001600160a01b0319166001600160a01b039290921691909117905550565b306001600160a01b03821603610a9857604051630bc2c5df60e11b8152306004820152602401610a41565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6060818067ffffffffffffffff811115610ad657610ad66114da565b604051908082528060200260200182016040528015610b1c57816020015b604080518082019091526000815260606020820152815260200190600190039081610af45790505b5091503660005b82811015610ca9576000848281518110610b3f57610b3f611312565b60200260200101519050868683818110610b5b57610b5b611312565b9050602002810190610b6d91906114f0565b92506040830135610b816020850185611328565b6001600160a01b031681610b986060870187611373565b604051610ba6929190611363565b60006040518083038185875af1925050503d8060008114610be3576040519150601f19603f3d011682016040523d82523d6000602084013e610be8565b606091505b506020808501919091529015158084529085013517610c3f5762461bcd60e51b600052602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260846000fd5b815115610c9f577f93485dcd31a905e3ffd7b012abe3438fa8fa77f98ddc9f50e879d3fa7ccdc324610c746020860186611328565b610c816060870187611373565b8760400135604051610c969493929190611510565b60405180910390a15b5050600101610b23565b50505092915050565b6000610cc66001546001600160a01b031690565b6001600160a01b031603610cd657565b600180546001600160a01b0319169055565b60003860003884865af1610d045763b12d13eb6000526004601cfd5b5050565b81601452806034526fa9059cbb00000000000000000000000060005260206000604460106000875af13d156001600051141716610d4d576390b8ec186000526004601cfd5b6000603452505050565b80356001600160a01b0381168114610d6e57600080fd5b919050565b60008083601f840112610d8557600080fd5b50813567ffffffffffffffff811115610d9d57600080fd5b602083019150836020828501011115610db557600080fd5b9250929050565b600080600080600060808688031215610dd457600080fd5b610ddd86610d57565b9450610deb60208701610d57565b935060408601359250606086013567ffffffffffffffff811115610e0e57600080fd5b610e1a88828901610d73565b969995985093965092949392505050565b60008083601f840112610e3d57600080fd5b50813567ffffffffffffffff811115610e5557600080fd5b6020830191508360208260051b8501011115610db557600080fd5b60008060008060608587031215610e8657600080fd5b843567ffffffffffffffff811115610e9d57600080fd5b610ea987828801610e2b565b9095509350610ebc905060208601610d57565b9150610eca60408601610d57565b905092959194509250565b6000602082016020835280845180835260408501915060408160051b86010192506020860160005b82811015610f7e57603f1987860301845281518051151586526020810151905060406020870152805180604088015260005b81811015610f4c57602081840181015160608a8401015201610f2f565b506000606082890101526060601f19601f83011688010196505050602082019150602084019350600181019050610efd565b50929695505050505050565b60008060008060008060608789031215610fa357600080fd5b863567ffffffffffffffff811115610fba57600080fd5b610fc689828a01610e2b565b909750955050602087013567ffffffffffffffff811115610fe657600080fd5b610ff289828a01610e2b565b909550935050604087013567ffffffffffffffff81111561101257600080fd5b61101e89828a01610e2b565b979a9699509497509295939492505050565b6000806000806060858703121561104657600080fd5b8435935061105660208601610d57565b9250604085013567ffffffffffffffff81111561107257600080fd5b61107e87828801610d73565b95989497509550505050565b6000806040838503121561109d57600080fd5b823591506110ad60208401610d57565b90509250929050565b6000806000806000806000806080898b0312156110d257600080fd5b883567ffffffffffffffff8111156110e957600080fd5b6110f58b828c01610e2b565b909950975050602089013567ffffffffffffffff81111561111557600080fd5b6111218b828c01610e2b565b909750955050604089013567ffffffffffffffff81111561114157600080fd5b61114d8b828c01610e2b565b909550935050606089013567ffffffffffffffff81111561116d57600080fd5b6111798b828c01610e2b565b999c989b5096995094979396929594505050565b60008060008060008060008060a0898b0312156111a957600080fd5b6111b289610d57565b97506111c060208a01610d57565b9650604089013567ffffffffffffffff8111156111dc57600080fd5b6111e88b828c01610e2b565b909750955050606089013567ffffffffffffffff81111561120857600080fd5b6112148b828c01610e2b565b909550935050608089013567ffffffffffffffff81111561123457600080fd5b6111798b828c01610d73565b60008060008060008060a0878903121561125957600080fd5b61126287610d57565b955061127060208801610d57565b94506040870135935060608701359250608087013567ffffffffffffffff81111561129a57600080fd5b61101e89828a01610d73565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b03861681526001600160a01b03851660208201528360408201526080606082015260006113076080830184866112a6565b979650505050505050565b634e487b7160e01b600052603260045260246000fd5b60006020828403121561133a57600080fd5b61134382610d57565b9392505050565b60006020828403121561135c57600080fd5b5051919050565b8183823760009101908152919050565b6000808335601e1984360301811261138a57600080fd5b83018035915067ffffffffffffffff8211156113a557600080fd5b602001915036819003821315610db557600080fd5b6000602082840312156113cc57600080fd5b8151801515811461134357600080fd5b81835260007f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83111561140e57600080fd5b8260051b80836020870137939093016020019392505050565b6001600160a01b03891681526001600160a01b038816602082015260a06040820152600061145960a08301888a6113dc565b828103606084015261146c8187896113dc565b905082810360808401526114818185876112a6565b9b9a5050505050505050505050565b6001600160a01b03871681526001600160a01b038616602082015284604082015283606082015260a0608082015260006114ce60a0830184866112a6565b98975050505050505050565b634e487b7160e01b600052604160045260246000fd5b60008235607e1983360301811261150657600080fd5b9190910192915050565b6001600160a01b03851681526060602082015260006115336060830185876112a6565b90508260408301529594505050505056fea264697066735822122017e46de45349726566f8db652f291bc27ed3e878bdc9a913649736ed7661fe5164736f6c634300081c0033
Deployed Bytecode
0x60806040526004361061007f5760003560e01c80635de81e3f1161004e5780635de81e3f1461017b57806373b7bb2f1461019b578063bc197c81146101bb578063f23a6e61146101db57600080fd5b8063150b7a02146100c357806330be5567146101195780633b2253c8146101395780635d1fe6a21461015b57600080fd5b366100be57604080513081523460208201527fd35467972d1fda5b63c735f59d3974fa51785a41a92aa3ed1b70832836f8dba6910160405180910390a1005b600080fd5b3480156100cf57600080fd5b506100e36100de366004610dbc565b6101fb565b6040517fffffffff0000000000000000000000000000000000000000000000000000000090911681526020015b60405180910390f35b61012c610127366004610e70565b6102a9565b6040516101109190610ed5565b34801561014557600080fd5b50610159610154366004610f8a565b610376565b005b34801561016757600080fd5b50610159610176366004611030565b6104d6565b34801561018757600080fd5b5061015961019636600461108a565b61056b565b3480156101a757600080fd5b506101596101b63660046110b6565b6105f3565b3480156101c757600080fd5b506100e36101d636600461118d565b610874565b3480156101e757600080fd5b506100e36101f6366004611240565b61092b565b6000806102106001546001600160a01b031690565b90506001600160a01b0381166102395760405163f36675c360e01b815260040160405180910390fd5b604051635c46a7ef60e11b8152339063b88d4fde9061026490309085908a908a908a906004016112cf565b600060405180830381600087803b15801561027e57600080fd5b505af1158015610292573d6000803e3d6000fd5b50630a85bd0160e11b9a9950505050505050505050565b60606102b36109dc565b6001600160a01b038216156102cb576102cb82610a6d565b6102d58585610aba565b90506102df610cb2565b47156103595760006001600160a01b038416156102fc57836102fe565b335b9050476103146001600160a01b03831682610ce8565b604080516001600160a01b0384168152602081018390527fd35467972d1fda5b63c735f59d3974fa51785a41a92aa3ed1b70832836f8dba6910160405180910390a150505b61036e600080546001600160a01b0319169055565b949350505050565b84811415806103855750808314155b156103a357604051631dc0052360e11b815260040160405180910390fd5b60005b858110156104cd5760008787838181106103c2576103c2611312565b90506020020160208101906103d79190611328565b905060008686848181106103ed576103ed611312565b90506020020160208101906104029190611328565b9050600085858581811061041857610418611312565b905060200201356000146104445785858581811061043857610438611312565b905060200201356104ac565b6040516370a0823160e01b81523060048201526001600160a01b038416906370a0823190602401602060405180830381865afa158015610488573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104ac919061134a565b90506104c26001600160a01b0384168383610d08565b5050506001016103a6565b50505050505050565b60006001600160a01b03841685156104ee57856104f0565b475b8484604051610500929190611363565b60006040518083038185875af1925050503d806000811461053d576040519150601f19603f3d011682016040523d82523d6000602084013e610542565b606091505b505090508061056457604051633204506f60e01b815260040160405180910390fd5b5050505050565b60006001600160a01b038216156105825781610584565b335b9050600083156105945783610596565b475b90506105ab6001600160a01b03831682610ce8565b604080516001600160a01b0384168152602081018390527fd35467972d1fda5b63c735f59d3974fa51785a41a92aa3ed1b70832836f8dba6910160405180910390a150505050565b86811415806106025750808514155b8061060d5750848314155b1561062b57604051631dc0052360e11b815260040160405180910390fd5b60005b8781101561086957600089898381811061064a5761064a611312565b905060200201602081019061065f9190611328565b9050600088888481811061067557610675611312565b905060200201602081019061068a9190611328565b90503660008888868181106106a1576106a1611312565b90506020028101906106b39190611373565b9150915060008787878181106106cb576106cb611312565b905060200201356000146106f7578787878181106106eb576106eb611312565b9050602002013561075f565b6040516370a0823160e01b81523060048201526001600160a01b038616906370a0823190602401602060405180830381865afa15801561073b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061075f919061134a565b60405163095ea7b360e01b81526001600160a01b038681166004830152602482018390529192509086169063095ea7b3906044016020604051808303816000875af11580156107b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107d691906113ba565b506000846001600160a01b031684846040516107f3929190611363565b6000604051808303816000865af19150503d8060008114610830576040519150601f19603f3d011682016040523d82523d6000602084013e610835565b606091505b505090508061085757604051633204506f60e01b815260040160405180910390fd5b50506001909401935061062e92505050565b505050505050505050565b6000806108896001546001600160a01b031690565b90506001600160a01b0381166108b25760405163f36675c360e01b815260040160405180910390fd5b604051631759616b60e11b81523390632eb2c2d6906108e390309085908d908d908d908d908d908d90600401611427565b600060405180830381600087803b1580156108fd57600080fd5b505af1158015610911573d6000803e3d6000fd5b5063bc197c8160e01b9d9c50505050505050505050505050565b6000806109406001546001600160a01b031690565b90506001600160a01b0381166109695760405163f36675c360e01b815260040160405180910390fd5b604051637921219560e11b8152339063f242432a9061099690309085908b908b908b908b90600401611490565b600060405180830381600087803b1580156109b057600080fd5b505af11580156109c4573d6000803e3d6000fd5b5063f23a6e6160e01b9b9a5050505050505050505050565b6000546001600160a01b0316338115801590610a0a5750806001600160a01b0316826001600160a01b031614155b8015610a165750333014155b15610a4a5760405163200991eb60e21b81526001600160a01b03831660048201523360248201526044015b60405180910390fd5b600080546001600160a01b0319166001600160a01b039290921691909117905550565b306001600160a01b03821603610a9857604051630bc2c5df60e11b8152306004820152602401610a41565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6060818067ffffffffffffffff811115610ad657610ad66114da565b604051908082528060200260200182016040528015610b1c57816020015b604080518082019091526000815260606020820152815260200190600190039081610af45790505b5091503660005b82811015610ca9576000848281518110610b3f57610b3f611312565b60200260200101519050868683818110610b5b57610b5b611312565b9050602002810190610b6d91906114f0565b92506040830135610b816020850185611328565b6001600160a01b031681610b986060870187611373565b604051610ba6929190611363565b60006040518083038185875af1925050503d8060008114610be3576040519150601f19603f3d011682016040523d82523d6000602084013e610be8565b606091505b506020808501919091529015158084529085013517610c3f5762461bcd60e51b600052602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260846000fd5b815115610c9f577f93485dcd31a905e3ffd7b012abe3438fa8fa77f98ddc9f50e879d3fa7ccdc324610c746020860186611328565b610c816060870187611373565b8760400135604051610c969493929190611510565b60405180910390a15b5050600101610b23565b50505092915050565b6000610cc66001546001600160a01b031690565b6001600160a01b031603610cd657565b600180546001600160a01b0319169055565b60003860003884865af1610d045763b12d13eb6000526004601cfd5b5050565b81601452806034526fa9059cbb00000000000000000000000060005260206000604460106000875af13d156001600051141716610d4d576390b8ec186000526004601cfd5b6000603452505050565b80356001600160a01b0381168114610d6e57600080fd5b919050565b60008083601f840112610d8557600080fd5b50813567ffffffffffffffff811115610d9d57600080fd5b602083019150836020828501011115610db557600080fd5b9250929050565b600080600080600060808688031215610dd457600080fd5b610ddd86610d57565b9450610deb60208701610d57565b935060408601359250606086013567ffffffffffffffff811115610e0e57600080fd5b610e1a88828901610d73565b969995985093965092949392505050565b60008083601f840112610e3d57600080fd5b50813567ffffffffffffffff811115610e5557600080fd5b6020830191508360208260051b8501011115610db557600080fd5b60008060008060608587031215610e8657600080fd5b843567ffffffffffffffff811115610e9d57600080fd5b610ea987828801610e2b565b9095509350610ebc905060208601610d57565b9150610eca60408601610d57565b905092959194509250565b6000602082016020835280845180835260408501915060408160051b86010192506020860160005b82811015610f7e57603f1987860301845281518051151586526020810151905060406020870152805180604088015260005b81811015610f4c57602081840181015160608a8401015201610f2f565b506000606082890101526060601f19601f83011688010196505050602082019150602084019350600181019050610efd565b50929695505050505050565b60008060008060008060608789031215610fa357600080fd5b863567ffffffffffffffff811115610fba57600080fd5b610fc689828a01610e2b565b909750955050602087013567ffffffffffffffff811115610fe657600080fd5b610ff289828a01610e2b565b909550935050604087013567ffffffffffffffff81111561101257600080fd5b61101e89828a01610e2b565b979a9699509497509295939492505050565b6000806000806060858703121561104657600080fd5b8435935061105660208601610d57565b9250604085013567ffffffffffffffff81111561107257600080fd5b61107e87828801610d73565b95989497509550505050565b6000806040838503121561109d57600080fd5b823591506110ad60208401610d57565b90509250929050565b6000806000806000806000806080898b0312156110d257600080fd5b883567ffffffffffffffff8111156110e957600080fd5b6110f58b828c01610e2b565b909950975050602089013567ffffffffffffffff81111561111557600080fd5b6111218b828c01610e2b565b909750955050604089013567ffffffffffffffff81111561114157600080fd5b61114d8b828c01610e2b565b909550935050606089013567ffffffffffffffff81111561116d57600080fd5b6111798b828c01610e2b565b999c989b5096995094979396929594505050565b60008060008060008060008060a0898b0312156111a957600080fd5b6111b289610d57565b97506111c060208a01610d57565b9650604089013567ffffffffffffffff8111156111dc57600080fd5b6111e88b828c01610e2b565b909750955050606089013567ffffffffffffffff81111561120857600080fd5b6112148b828c01610e2b565b909550935050608089013567ffffffffffffffff81111561123457600080fd5b6111798b828c01610d73565b60008060008060008060a0878903121561125957600080fd5b61126287610d57565b955061127060208801610d57565b94506040870135935060608701359250608087013567ffffffffffffffff81111561129a57600080fd5b61101e89828a01610d73565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b03861681526001600160a01b03851660208201528360408201526080606082015260006113076080830184866112a6565b979650505050505050565b634e487b7160e01b600052603260045260246000fd5b60006020828403121561133a57600080fd5b61134382610d57565b9392505050565b60006020828403121561135c57600080fd5b5051919050565b8183823760009101908152919050565b6000808335601e1984360301811261138a57600080fd5b83018035915067ffffffffffffffff8211156113a557600080fd5b602001915036819003821315610db557600080fd5b6000602082840312156113cc57600080fd5b8151801515811461134357600080fd5b81835260007f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83111561140e57600080fd5b8260051b80836020870137939093016020019392505050565b6001600160a01b03891681526001600160a01b038816602082015260a06040820152600061145960a08301888a6113dc565b828103606084015261146c8187896113dc565b905082810360808401526114818185876112a6565b9b9a5050505050505050505050565b6001600160a01b03871681526001600160a01b038616602082015284604082015283606082015260a0608082015260006114ce60a0830184866112a6565b98975050505050505050565b634e487b7160e01b600052604160045260246000fd5b60008235607e1983360301811261150657600080fd5b9190910192915050565b6001600160a01b03851681526060602082015260006115336060830185876112a6565b90508260408301529594505050505056fea264697066735822122017e46de45349726566f8db652f291bc27ed3e878bdc9a913649736ed7661fe5164736f6c634300081c0033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 34 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.