Source Code
Overview
ETH Balance
0 ETH
More Info
ContractCreator
Multichain Info
N/A
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
ExecWithSigFacet
Compiler Version
v0.8.23+commit.f704f362
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity 0.8.23; import {BFacetOwner} from "../facets/base/BFacetOwner.sol"; import {LibDiamond} from "../libraries/diamond/standard/LibDiamond.sol"; import {GelatoBytes} from "../libraries/GelatoBytes.sol"; import {ExecWithSigBase} from "./base/ExecWithSigBase.sol"; import {GelatoCallUtils} from "../libraries/GelatoCallUtils.sol"; import { _getBalance, _simulateAndRevert, _revert, _revertWithFee, _revertWithFeeAndIsFeeCollector } from "../functions/Utils.sol"; import { ExecWithSig, ExecWithSigTrackFee, ExecWithSigFeeCollector, ExecWithSigRelayContext, Message, MessageTrackFee, MessageFeeCollector, MessageRelayContext } from "../types/CallTypes.sol"; import {_isCheckerSigner} from "./storage/SignerStorage.sol"; import {ECDSA} from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; import { _encodeRelayContext, _encodeFeeCollector } from "@gelatonetwork/relay-context/contracts/functions/GelatoRelayUtils.sol"; contract ExecWithSigFacet is ExecWithSigBase, BFacetOwner { using GelatoCallUtils for address; using LibDiamond for address; //solhint-disable-next-line const-name-snakecase string public constant name = "ExecWithSigFacet"; //solhint-disable-next-line const-name-snakecase string public constant version = "1"; address public immutable feeCollector; event LogExecWithSig( bytes32 correlationId, address service, address checkerSigner, address sender ); event LogExecWithSigFeeCollector( bytes32 correlationId, address service, address checkerSigner, address feeToken, uint256 observedFee, address sender ); event LogExecWithSigRelayContext( bytes32 correlationId, address service, address checkerSigner, address feeToken, uint256 observedFee, address sender ); event LogExecWithSigTrackFee( bytes32 correlationId, address service, address checkerSigner, address feeToken, uint256 observedFee, address sender ); constructor(address _feeCollector) { feeCollector = _feeCollector; } // solhint-disable function-max-lines /// @param _correlationId Correlation Id for the execution /// @param _service Target contract to be called /// @param _data Calldata to be executed /// @param _salt Random data to gurantee digest is unique to this execution /// @param _deadline Execution deadline /// Signature is split into `r` and `vs` - See https://eips.ethereum.org/EIPS/eip-2098 /// @param _r Checker signature /// @param _vs Checker signature /// @return estimatedGasUsed Estimated gas used using gas metering function execWithSig( bytes32 _correlationId, address _service, bytes calldata _data, uint256 _salt, uint256 _deadline, bytes32 _r, bytes32 _vs ) external returns (uint256 estimatedGasUsed) { uint256 startGas = gasleft(); require( msg.sender == tx.origin, "ExecWithSigFacet.execWithSig: only EOAs" ); _requireSignerDeadline( _deadline, "ExecWithSigFacet.execWithSig._requireSignerDeadline:" ); bytes32 digest = _getDigest( _getDomainSeparator(), _service, _data, _salt, _deadline ); address checkerSigner = _requireCheckerSignerSignature( digest, _r, _vs, "ExecWithSigFacet.execWithSig._requireCheckerSignerSignature:" ); // call forward _service.revertingContractCall(_data, "ExecWithSigFacet.execWithSig:"); estimatedGasUsed = startGas - gasleft(); emit LogExecWithSig( _correlationId, _service, checkerSigner, msg.sender ); } // solhint-disable function-max-lines /// @param _correlationId Correlation Id for the execution /// @param _service Target contract to be called /// @param _data Calldata to be executed /// @param _salt Random data to gurantee digest is unique to this execution /// @param _deadline Execution deadline /// @param _feeToken Token address used to pay the execution fee /// Signature is split into `r` and `vs` - See https://eips.ethereum.org/EIPS/eip-2098 /// @param _r Checker signature /// @param _vs Checker signature /// @return estimatedGasUsed Estimated gas used using gas metering /// @return observedFee The fee transferred to the fee collector function execWithSigFeeCollector( bytes32 _correlationId, address _service, bytes calldata _data, uint256 _salt, uint256 _deadline, address _feeToken, bytes32 _r, bytes32 _vs ) external returns (uint256 estimatedGasUsed, uint256 observedFee) { uint256 startGas = gasleft(); require( msg.sender == tx.origin, "ExecWithSigFacet.execWithSigFeeCollector: only EOAs" ); _requireSignerDeadline( _deadline, "ExecWithSigFacet.execWithSigFeeCollector._requireSignerDeadline:" ); bytes32 digest = _getDigestFeeCollector( _getDomainSeparator(), _service, _data, _salt, _deadline, _feeToken ); address checkerSigner = _requireCheckerSignerSignature( digest, _r, _vs, "ExecWithSigFacet.execWithSigFeeCollector._requireCheckerSignerSignature:" ); { uint256 preFeeTokenBalance = _getBalance(_feeToken, feeCollector); // call forward + append fee collector _service.revertingContractCall( _encodeFeeCollector(_data, feeCollector), "ExecWithSigFacet.execWithSigFeeCollector:" ); uint256 postFeeTokenBalance = _getBalance(_feeToken, feeCollector); observedFee = postFeeTokenBalance - preFeeTokenBalance; } estimatedGasUsed = startGas - gasleft(); emit LogExecWithSigFeeCollector( _correlationId, _service, checkerSigner, _feeToken, observedFee, msg.sender ); } // solhint-disable function-max-lines /// @param _correlationId Correlation Id for the execution /// @param _service Target contract to be called /// @param _data Calldata to be executed /// @param _salt Random data to gurantee digest is unique to this execution /// @param _deadline Execution deadline /// @param _feeToken Token address used to pay the execution fee /// @param _fee Execution fee /// Signature is split into `r` and `vs` - See https://eips.ethereum.org/EIPS/eip-2098 /// @param _r Checker signature /// @param _vs Checker signature /// @return estimatedGasUsed Estimated gas used using gas metering /// @return observedFee The fee transferred to the fee collector function execWithSigRelayContext( bytes32 _correlationId, address _service, bytes calldata _data, uint256 _salt, uint256 _deadline, address _feeToken, uint256 _fee, bytes32 _r, bytes32 _vs ) external returns (uint256 estimatedGasUsed, uint256 observedFee) { uint256 startGas = gasleft(); require( msg.sender == tx.origin, "ExecWithSigFacet.execWithSigRelayContext: only EOAs" ); _requireSignerDeadline( _deadline, "ExecWithSigFacet.execWithSigRelayContext._requireSignerDeadline:" ); bytes32 digest = _getDigestRelayContext( _getDomainSeparator(), _service, _data, _salt, _deadline, _feeToken, _fee ); address checkerSigner = _requireCheckerSignerSignature( digest, _r, _vs, "ExecWithSigFacet.execWithSigRelayContext._requireCheckerSignerSignature:" ); { uint256 preFeeTokenBalance = _getBalance(_feeToken, feeCollector); // call forward + append fee collector, feeToken, fee _service.revertingContractCall( _encodeRelayContext(_data, feeCollector, _feeToken, _fee), "ExecWithSigFacet.execWithSigRelayContext:" ); uint256 postFeeTokenBalance = _getBalance(_feeToken, feeCollector); observedFee = postFeeTokenBalance - preFeeTokenBalance; } estimatedGasUsed = startGas - gasleft(); emit LogExecWithSigRelayContext( _correlationId, _service, checkerSigner, _feeToken, observedFee, msg.sender ); } // solhint-disable function-max-lines /// @param _correlationId Correlation Id for the execution /// @param _service Target contract to be called /// @param _data Calldata to be executed /// @param _salt Random data to gurantee digest is unique to this execution /// @param _deadline Execution deadline /// @param _feeToken Token address used to pay the execution fee /// @param _isFeeCollector Boolean indicating if fee is being paid to fee collector or diamond /// Signature is split into `r` and `vs` - See https://eips.ethereum.org/EIPS/eip-2098 /// @param _r Checker signature /// @param _vs Checker signature /// @return estimatedGasUsed Estimated gas used using gas metering /// @return observedFee The fee transferred to the fee collector or diamond function execWithSigTrackFee( bytes32 _correlationId, address _service, bytes calldata _data, uint256 _salt, uint256 _deadline, address _feeToken, bool _isFeeCollector, bytes32 _r, bytes32 _vs ) external returns (uint256 estimatedGasUsed, uint256 observedFee) { uint256 startGas = gasleft(); require( msg.sender == tx.origin, "ExecWithSigFacet.execWithSigTrackFee: only EOAs" ); _requireSignerDeadline( _deadline, "ExecWithSigFacet.execWithSigTrackFee._requireSignerDeadline:" ); bytes32 digest = _getDigestTrackFee( _getDomainSeparator(), _service, _data, _salt, _deadline, _feeToken, _isFeeCollector ); address checkerSigner = _requireCheckerSignerSignature( digest, _r, _vs, "ExecWithSigFacet.execWithSigTrackFee._requireCheckerSignerSignature:" ); address feeRecipient = _isFeeCollector ? feeCollector : address(this); { uint256 preFeeTokenBalance = _getBalance(_feeToken, feeRecipient); // call forward _service.revertingContractCall( _data, "ExecWithSigFacet.execWithSigTrackFee:" ); uint256 postFeeTokenBalance = _getBalance(_feeToken, feeRecipient); observedFee = postFeeTokenBalance - preFeeTokenBalance; } estimatedGasUsed = startGas - gasleft(); emit LogExecWithSigTrackFee( _correlationId, _service, checkerSigner, _feeToken, observedFee, msg.sender ); } /// @dev Used for off-chain simulation only! function simulateExecWithSig( address _service, bytes memory _data ) external returns (uint256 estimatedGasUsed) { uint256 startGas = gasleft(); (bool success, bytes memory returndata) = _service.call(_data); estimatedGasUsed = startGas - gasleft(); if (tx.origin != address(0) || !success) { _revert(success, returndata, estimatedGasUsed); } } /// @dev Used for off-chain simulation only! function simulateExecWithSigFeeCollector( address _service, bytes calldata _data, address _feeToken ) external returns (uint256 estimatedGasUsed, uint256 observedFee) { uint256 startGas = gasleft(); uint256 preFeeTokenBalance = _getBalance(_feeToken, feeCollector); (bool success, bytes memory returndata) = _service.call( _encodeFeeCollector(_data, feeCollector) ); uint256 postFeeTokenBalance = _getBalance(_feeToken, feeCollector); observedFee = postFeeTokenBalance - preFeeTokenBalance; estimatedGasUsed = startGas - gasleft(); if (tx.origin != address(0) || !success) { _revertWithFee(success, returndata, estimatedGasUsed, observedFee); } } /// @dev Used for off-chain simulation only! function simulateExecWithSigRelayContext( address _service, bytes calldata _data, address _feeToken, uint256 _fee ) external returns (uint256 estimatedGasUsed, uint256 observedFee) { uint256 startGas = gasleft(); uint256 preFeeTokenBalance = _getBalance(_feeToken, feeCollector); (bool success, bytes memory returndata) = _service.call( _encodeRelayContext(_data, feeCollector, _feeToken, _fee) ); uint256 postFeeTokenBalance = _getBalance(_feeToken, feeCollector); observedFee = postFeeTokenBalance - preFeeTokenBalance; estimatedGasUsed = startGas - gasleft(); if (tx.origin != address(0) || !success) { _revertWithFee(success, returndata, estimatedGasUsed, observedFee); } } /// @dev Used for off-chain simulation only! function simulateExecWithSigTrackFee( address _service, bytes calldata _data, address _feeToken ) external returns ( uint256 estimatedGasUsed, uint256 observedFee, bool isFeeCollector ) { uint256 startGas = gasleft(); uint256 preFeeCollectorBalance = _getBalance(_feeToken, feeCollector); uint256 preDiamondBalance = _getBalance(_feeToken, address(this)); (bool success, bytes memory returndata) = _service.call(_data); uint256 observedFeeCollectorFee = _getBalance(_feeToken, feeCollector) - preFeeCollectorBalance; uint256 observedDiamondFee = _getBalance(_feeToken, address(this)) - preDiamondBalance; if (observedDiamondFee > observedFeeCollectorFee) { observedFee = observedDiamondFee; } else { observedFee = observedFeeCollectorFee; isFeeCollector = true; } estimatedGasUsed = startGas - gasleft(); if (tx.origin != address(0) || !success) { _revertWithFeeAndIsFeeCollector( success, isFeeCollector, returndata, estimatedGasUsed, observedFee ); } } //solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32) { return _getDomainSeparator(); } function _getDomainSeparator() internal view returns (bytes32) { return keccak256( abi.encode( keccak256( bytes( //solhint-disable-next-line max-line-length "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)" ) ), keccak256(bytes(name)), keccak256(bytes(version)), block.chainid, address(this) ) ); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.1; // Four different types of calldata packing // 1. encodeFeeCollector: append 20 byte feeCollector address // 2. encodeRelayContext: append 20 byte feeCollector address, 20 byte feeToken address, 32 byte uint256 fee // 3. encodeFeeCollectorERC2771: append 20 byte feeCollector address, 20 byte _msgSender address // 4. encodeRelayContextERC2771: append 20 byte feeCollector address, 20 byte feeToken address, 32 byte uint256 fee, 20 byte _msgSender address function _encodeFeeCollector(bytes calldata _data, address _feeCollector) pure returns (bytes memory) { return abi.encodePacked(_data, _feeCollector); } function _encodeRelayContext( bytes calldata _data, address _feeCollector, address _feeToken, uint256 _fee ) pure returns (bytes memory) { return abi.encodePacked(_data, _feeCollector, _feeToken, _fee); } // ERC2771 Encodings // vanilla ERC2771 context encoding // solhint-disable-next-line private-vars-leading-underscore, func-visibility function _encodeERC2771Context(bytes calldata _data, address _msgSender) pure returns (bytes memory) { return abi.encodePacked(_data, _msgSender); } function _encodeFeeCollectorERC2771( bytes calldata _data, address _feeCollector, address _msgSender ) pure returns (bytes memory) { return abi.encodePacked(_data, _feeCollector, _msgSender); } function _encodeRelayContextERC2771( bytes calldata _data, address _feeCollector, address _feeToken, uint256 _fee, address _msgSender ) pure returns (bytes memory) { return abi.encodePacked(_data, _feeCollector, _feeToken, _fee, _msgSender); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @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 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 `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, 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 `from` to `to` 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 from, address to, uint256 amount ) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol) pragma solidity ^0.8.0; import "./math/Math.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant _SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), _SYMBOLS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, Math.log256(value) + 1); } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.0; import "../Strings.sol"; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSA { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS, InvalidSignatureV // Deprecated in v4.8 } function _throwError(RecoverError error) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert("ECDSA: invalid signature"); } else if (error == RecoverError.InvalidSignatureLength) { revert("ECDSA: invalid signature length"); } else if (error == RecoverError.InvalidSignatureS) { revert("ECDSA: invalid signature 's' value"); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature` or error string. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) { if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. /// @solidity memory-safe-assembly assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return tryRecover(hash, v, r, s); } else { return (address(0), RecoverError.InvalidSignatureLength); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, signature); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately. * * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures] * * _Available since v4.3._ */ function tryRecover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address, RecoverError) { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); uint8 v = uint8((uint256(vs) >> 255) + 27); return tryRecover(hash, v, r, s); } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. * * _Available since v4.2._ */ function recover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, r, vs); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. * * _Available since v4.3._ */ function tryRecover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address, RecoverError) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS); } // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature); } return (signer, RecoverError.NoError); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, v, r, s); _throwError(error); return recovered; } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) { // 32 is the length in bytes of hash, // enforced by the type signature above return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)); } /** * @dev Returns an Ethereum Signed Message, created from `s`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s)); } /** * @dev Returns an Ethereum Signed Typed Data, created from a * `domainSeparator` and a `structHash`. This produces hash corresponding * to the one signed with the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] * JSON-RPC method as part of EIP-712. * * See {recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv( uint256 x, uint256 y, uint256 denominator ) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works // in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv( uint256 x, uint256 y, uint256 denominator, Rounding rounding ) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10**64) { value /= 10**64; result += 64; } if (value >= 10**32) { value /= 10**32; result += 32; } if (value >= 10**16) { value /= 10**16; result += 16; } if (value >= 10**8) { value /= 10**8; result += 8; } if (value >= 10**4) { value /= 10**4; result += 4; } if (value >= 10**2) { value /= 10**2; result += 2; } if (value >= 10**1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/structs/EnumerableSet.sol) // This file was procedurally generated from scripts/generate/templates/EnumerableSet.js. pragma solidity ^0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. * * [WARNING] * ==== * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure * unusable. * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info. * * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an * array of EnumerableSet. * ==== */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping(bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; if (lastIndex != toDeleteIndex) { bytes32 lastValue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastValue; // Update the index for the moved value set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex } // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { return set._values[index]; } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function _values(Set storage set) private view returns (bytes32[] memory) { return set._values; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(Bytes32Set storage set) internal view returns (bytes32[] memory) { bytes32[] memory store = _values(set._inner); bytes32[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(AddressSet storage set) internal view returns (address[] memory) { bytes32[] memory store = _values(set._inner); address[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values in the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(UintSet storage set) internal view returns (uint256[] memory) { bytes32[] memory store = _values(set._inner); uint256[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.23; address constant NATIVE_TOKEN = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
// SPDX-License-Identifier: MIT pragma solidity 0.8.23; import {LibDiamond} from "../../libraries/diamond/standard/LibDiamond.sol"; abstract contract BFacetOwner { modifier onlyOwner() { LibDiamond.enforceIsContractOwner(); _; } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.23; import {GelatoString} from "../../libraries/GelatoString.sol"; import { _wasSignatureUsedAlready, _setWasSignatureUsedAlready } from "../storage/ExecWithSigStorage.sol"; import { _isExecutorSigner, _isCheckerSigner } from "../storage/SignerStorage.sol"; import { ExecWithSig, ExecWithSigFeeCollector, ExecWithSigRelayContext, MessageRelayContext } from "../../types/CallTypes.sol"; import {ECDSA} from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; abstract contract ExecWithSigBase { using GelatoString for string; bytes32 public constant EXEC_WITH_SIG_TYPEHASH = keccak256( bytes( // solhint-disable-next-line max-line-length "ExecWithSig(address service,bytes data,uint256 salt,uint256 deadline)" ) ); bytes32 public constant EXEC_WITH_SIG_FEE_COLLECTOR_TYPEHASH = keccak256( bytes( // solhint-disable-next-line max-line-length "ExecWithSigFeeCollector(address service,bytes data,uint256 salt,uint256 deadline,address feeToken)" ) ); bytes32 public constant EXEC_WITH_SIG_TRACK_FEE_TYPEHASH = keccak256( bytes( // solhint-disable-next-line max-line-length "ExecWithSigTrackFee(address service,bytes data,uint256 salt,uint256 deadline,address feeToken,bool isFeeCollector)" ) ); bytes32 public constant EXEC_WITH_SIG_RELAY_CONTEXT_TYPEHASH = keccak256( bytes( // solhint-disable-next-line max-line-length "ExecWithSigRelayContext(address service,bytes data,uint256 salt,uint256 deadline,address feeToken,uint256 fee)" ) ); function _requireSignerDeadline( uint256 _signerDeadline, string memory _errorTrace ) internal view { require( // solhint-disable-next-line not-rely-on-time _signerDeadline == 0 || _signerDeadline >= block.timestamp, _errorTrace.suffix("deadline") ); } function _requireCheckerSignerSignature( bytes32 _digest, bytes32 _r, bytes32 _vs, string memory _errorTrace ) internal returns (address checkerSigner) { require( !_wasSignatureUsedAlready(_r, _vs), _errorTrace.suffix("replay") ); ECDSA.RecoverError error; (checkerSigner, error) = ECDSA.tryRecover(_digest, _r, _vs); require( error == ECDSA.RecoverError.NoError && _isCheckerSigner(checkerSigner), _errorTrace.suffix("ECDSA.RecoverError.NoError && isCheckerSigner") ); _setWasSignatureUsedAlready(_r, _vs); } function _getDigest( bytes32 _domainSeparator, address _service, bytes calldata _data, uint256 _salt, uint256 _deadline ) internal pure returns (bytes32 digest) { digest = keccak256( abi.encodePacked( "\x19\x01", _domainSeparator, keccak256( abi.encode( EXEC_WITH_SIG_TYPEHASH, _service, keccak256(_data), _salt, _deadline ) ) ) ); } function _getDigestFeeCollector( bytes32 _domainSeparator, address _service, bytes calldata _data, uint256 _salt, uint256 _deadline, address _feeToken ) internal pure returns (bytes32 digest) { digest = keccak256( abi.encodePacked( "\x19\x01", _domainSeparator, keccak256( abi.encode( EXEC_WITH_SIG_FEE_COLLECTOR_TYPEHASH, _service, keccak256(_data), _salt, _deadline, _feeToken ) ) ) ); } function _getDigestTrackFee( bytes32 _domainSeparator, address _service, bytes calldata _data, uint256 _salt, uint256 _deadline, address _feeToken, bool _isFeeCollector ) internal pure returns (bytes32 digest) { digest = keccak256( abi.encodePacked( "\x19\x01", _domainSeparator, keccak256( abi.encode( EXEC_WITH_SIG_TRACK_FEE_TYPEHASH, _service, keccak256(_data), _salt, _deadline, _feeToken, _isFeeCollector ) ) ) ); } function _getDigestRelayContext( bytes32 _domainSeparator, address _service, bytes calldata _data, uint256 _salt, uint256 _deadline, address _feeToken, uint256 _fee ) internal pure returns (bytes32 digest) { digest = keccak256( abi.encodePacked( "\x19\x01", _domainSeparator, keccak256( abi.encode( EXEC_WITH_SIG_RELAY_CONTEXT_TYPEHASH, _service, keccak256(_data), _salt, _deadline, _feeToken, _fee ) ) ) ); } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.23; struct ExecWithSigStorage { mapping(bytes32 => bool) wasSignatureUsedAlready; } bytes32 constant _EXEC_WITH_SIG_STORAGE = keccak256( "gelato.diamond.execWithSig.storage" ); function _wasSignatureUsedAlready(bytes32 _r, bytes32 _vs) view returns (bool) { return _execWithSigStorage().wasSignatureUsedAlready[ keccak256(bytes.concat(_r, _vs)) ]; } function _setWasSignatureUsedAlready(bytes32 _r, bytes32 _vs) { _execWithSigStorage().wasSignatureUsedAlready[ keccak256(bytes.concat(_r, _vs)) ] = true; } //solhint-disable-next-line private-vars-leading-underscore function _execWithSigStorage() pure returns (ExecWithSigStorage storage ewss) { bytes32 position = _EXEC_WITH_SIG_STORAGE; assembly { ewss.slot := position } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.23; import { EnumerableSet } from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; using EnumerableSet for EnumerableSet.AddressSet; struct SignerStorage { EnumerableSet.AddressSet executorSigners; EnumerableSet.AddressSet checkerSigners; } bytes32 constant _SIGNER_STORAGE_POSITION = keccak256( "gelato.diamond.signer.storage" ); function _addExecutorSigner(address _executor) returns (bool) { return _signerStorage().executorSigners.add(_executor); } function _removeExecutorSigner(address _executor) returns (bool) { return _signerStorage().executorSigners.remove(_executor); } function _isExecutorSigner(address _executorSigner) view returns (bool) { return _signerStorage().executorSigners.contains(_executorSigner); } function _executorSignerAt(uint256 _index) view returns (address) { return _signerStorage().executorSigners.at(_index); } function _executorSigners() view returns (address[] memory) { return _signerStorage().executorSigners.values(); } function _numberOfExecutorSigners() view returns (uint256) { return _signerStorage().executorSigners.length(); } function _addCheckerSigner(address _checker) returns (bool) { return _signerStorage().checkerSigners.add(_checker); } function _removeCheckerSigner(address _checker) returns (bool) { return _signerStorage().checkerSigners.remove(_checker); } function _isCheckerSigner(address _checker) view returns (bool) { return _signerStorage().checkerSigners.contains(_checker); } function _checkerSignerAt(uint256 _index) view returns (address) { return _signerStorage().checkerSigners.at(_index); } function _checkerSigners() view returns (address[] memory checkers) { return _signerStorage().checkerSigners.values(); } function _numberOfCheckerSigners() view returns (uint256) { return _signerStorage().checkerSigners.length(); } function _signerStorage() pure returns (SignerStorage storage ess) { bytes32 position = _SIGNER_STORAGE_POSITION; assembly { ess.slot := position } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.23; import {NATIVE_TOKEN} from "../constants/Tokens.sol"; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; function _getBalance(address token, address user) view returns (uint256) { if (token == address(0)) return 0; return token == NATIVE_TOKEN ? user.balance : IERC20(token).balanceOf(user); } function _simulateAndRevert( address _service, uint256 _gasleft, bytes memory _data ) { assembly { let success := call( gas(), _service, 0, add(_data, 0x20), mload(_data), 0, 0 ) mstore(0x00, success) // store success bool in first word mstore(0x20, sub(_gasleft, gas())) // store gas after success mstore(0x40, returndatasize()) // store length of return data size in third word returndatacopy(0x60, 0, returndatasize()) // store actual return data in fourth word and onwards revert(0, add(returndatasize(), 0x60)) } } function _revert( bool _success, bytes memory _returndata, uint256 _estimatedGasUsed ) pure { bytes memory revertData = bytes.concat( abi.encode(_success, _estimatedGasUsed, _returndata.length), _returndata ); assembly { revert(add(32, revertData), mload(revertData)) } } function _revertWithFee( bool _success, bytes memory _returndata, uint256 _estimatedGasUsed, uint256 _observedFee ) pure { bytes memory revertData = bytes.concat( abi.encode( _success, _estimatedGasUsed, _observedFee, _returndata.length ), _returndata ); assembly { revert(add(32, revertData), mload(revertData)) } } function _revertWithFeeAndIsFeeCollector( bool _success, bool _isFeeCollector, bytes memory _returndata, uint256 _estimatedGasUsed, uint256 _observedFee ) pure { bytes memory revertData = bytes.concat( abi.encode( _success, _estimatedGasUsed, _observedFee, _isFeeCollector, _returndata.length ), _returndata ); assembly { revert(add(32, revertData), mload(revertData)) } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.23; /******************************************************************************\ * Author: Nick Mudge <[email protected]> (https://twitter.com/mudgen) * EIP-2535 Diamond Standard: https://eips.ethereum.org/EIPS/eip-2535 /******************************************************************************/ interface IDiamondCut { enum FacetCutAction { Add, Replace, Remove } // Add=0, Replace=1, Remove=2 struct FacetCut { address facetAddress; FacetCutAction action; bytes4[] functionSelectors; } event DiamondCut(FacetCut[] _diamondCut, address _init, bytes _calldata); /// @notice Add/replace/remove any number of functions and optionally execute /// a function with delegatecall /// @param _diamondCut Contains the facet addresses and function selectors /// @param _init The address of the contract or facet to execute _calldata /// @param _calldata A function call, including function selector and arguments /// _calldata is executed with delegatecall on _init function diamondCut( FacetCut[] calldata _diamondCut, address _init, bytes calldata _calldata ) external; }
// SPDX-License-Identifier: MIT pragma solidity 0.8.23; library GelatoBytes { function calldataSliceSelector( bytes calldata _bytes ) internal pure returns (bytes4 selector) { selector = _bytes[0] | (bytes4(_bytes[1]) >> 8) | (bytes4(_bytes[2]) >> 16) | (bytes4(_bytes[3]) >> 24); } function memorySliceSelector( bytes memory _bytes ) internal pure returns (bytes4 selector) { selector = _bytes[0] | (bytes4(_bytes[1]) >> 8) | (bytes4(_bytes[2]) >> 16) | (bytes4(_bytes[3]) >> 24); } function revertWithError( bytes memory _bytes, string memory _tracingInfo ) internal pure { // 68: 32-location, 32-length, 4-ErrorSelector, UTF-8 err if (_bytes.length % 32 == 4) { bytes4 selector; assembly { selector := mload(add(0x20, _bytes)) } if (selector == 0x08c379a0) { // Function selector for Error(string) assembly { _bytes := add(_bytes, 68) } revert(string(abi.encodePacked(_tracingInfo, string(_bytes)))); } else { revert( string(abi.encodePacked(_tracingInfo, "NoErrorSelector")) ); } } else { revert( string(abi.encodePacked(_tracingInfo, "UnexpectedReturndata")) ); } } function returnError( bytes memory _bytes, string memory _tracingInfo ) internal pure returns (string memory) { // 68: 32-location, 32-length, 4-ErrorSelector, UTF-8 err if (_bytes.length % 32 == 4) { bytes4 selector; assembly { selector := mload(add(0x20, _bytes)) } if (selector == 0x08c379a0) { // Function selector for Error(string) assembly { _bytes := add(_bytes, 68) } return string(abi.encodePacked(_tracingInfo, string(_bytes))); } else { return string(abi.encodePacked(_tracingInfo, "NoErrorSelector")); } } else { return string(abi.encodePacked(_tracingInfo, "UnexpectedReturndata")); } } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.23; import {GelatoBytes} from "./GelatoBytes.sol"; library GelatoCallUtils { using GelatoBytes for bytes; function revertingContractCall( address _contract, bytes memory _data, string memory _errorMsg ) internal returns (bytes memory returndata) { bool success; (success, returndata) = _contract.call(_data); // solhint-disable-next-line max-line-length // https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/blob/f9b6fc3fdab7aca33a9cfa8837c5cd7f67e176be/contracts/utils/AddressUpgradeable.sol#L177 if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require( isContract(_contract), string(abi.encodePacked(_errorMsg, "Call to non contract")) ); } } else { returndata.revertWithError(_errorMsg); } } // solhint-disable-next-line max-line-length // https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/blob/f9b6fc3fdab7aca33a9cfa8837c5cd7f67e176be/contracts/utils/AddressUpgradeable.sol#L36 function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.23; library GelatoString { function startsWithOK(string memory _str) internal pure returns (bool) { if ( bytes(_str).length >= 2 && bytes(_str)[0] == "O" && bytes(_str)[1] == "K" ) return true; return false; } function revertWithInfo( string memory _error, string memory _tracingInfo ) internal pure { revert(string(abi.encodePacked(_tracingInfo, _error))); } function prefix( string memory _second, string memory _first ) internal pure returns (string memory) { return string(abi.encodePacked(_first, _second)); } function suffix( string memory _first, string memory _second ) internal pure returns (string memory) { return string(abi.encodePacked(_first, _second)); } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.23; // solhint-disable max-line-length // https://github.com/mudgen/diamond-3/blob/b009cd08b7822bad727bbcc47aa1b50d8b50f7f0/contracts/libraries/LibDiamond.sol#L1 /******************************************************************************\ * Author: Nick Mudge <[email protected]> (https://twitter.com/mudgen) * EIP-2535 Diamond Standard: https://eips.ethereum.org/EIPS/eip-2535 /******************************************************************************/ import "../../../interfaces/diamond/standard/IDiamondCut.sol"; // Custom due to incorrect string casting (non UTF-8 formatted) import {GelatoBytes} from "../../../libraries/GelatoBytes.sol"; library LibDiamond { bytes32 constant DIAMOND_STORAGE_POSITION = keccak256("diamond.standard.diamond.storage"); struct FacetAddressAndPosition { address facetAddress; uint16 functionSelectorPosition; // position in facetFunctionSelectors.functionSelectors array } struct FacetFunctionSelectors { bytes4[] functionSelectors; uint16 facetAddressPosition; // position of facetAddress in facetAddresses array } struct DiamondStorage { // maps function selector to the facet address and // the position of the selector in the facetFunctionSelectors.selectors array mapping(bytes4 => FacetAddressAndPosition) selectorToFacetAndPosition; // maps facet addresses to function selectors mapping(address => FacetFunctionSelectors) facetFunctionSelectors; // facet addresses address[] facetAddresses; // Used to query if a contract implements an interface. // Used to implement ERC-165. mapping(bytes4 => bool) supportedInterfaces; // owner of the contract address contractOwner; } function diamondStorage() internal pure returns (DiamondStorage storage ds) { bytes32 position = DIAMOND_STORAGE_POSITION; assembly { ds.slot := position } } event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); function setContractOwner(address _newOwner) internal { DiamondStorage storage ds = diamondStorage(); address previousOwner = ds.contractOwner; ds.contractOwner = _newOwner; emit OwnershipTransferred(previousOwner, _newOwner); } function contractOwner() internal view returns (address contractOwner_) { contractOwner_ = diamondStorage().contractOwner; } function isContractOwner(address _guy) internal view returns (bool) { return _guy == contractOwner(); } function enforceIsContractOwner() internal view { require( msg.sender == diamondStorage().contractOwner, "LibDiamond: Must be contract owner" ); } event DiamondCut( IDiamondCut.FacetCut[] _diamondCut, address _init, bytes _calldata ); // Internal function version of diamondCut function diamondCut( IDiamondCut.FacetCut[] memory _diamondCut, address _init, bytes memory _calldata ) internal { for ( uint256 facetIndex; facetIndex < _diamondCut.length; facetIndex++ ) { IDiamondCut.FacetCutAction action = _diamondCut[facetIndex].action; if (action == IDiamondCut.FacetCutAction.Add) { addFunctions( _diamondCut[facetIndex].facetAddress, _diamondCut[facetIndex].functionSelectors ); } else if (action == IDiamondCut.FacetCutAction.Replace) { replaceFunctions( _diamondCut[facetIndex].facetAddress, _diamondCut[facetIndex].functionSelectors ); } else if (action == IDiamondCut.FacetCutAction.Remove) { removeFunctions( _diamondCut[facetIndex].facetAddress, _diamondCut[facetIndex].functionSelectors ); } else { revert("LibDiamondCut: Incorrect FacetCutAction"); } } emit DiamondCut(_diamondCut, _init, _calldata); initializeDiamondCut(_init, _calldata); } function addFunctions( address _facetAddress, bytes4[] memory _functionSelectors ) internal { require( _functionSelectors.length > 0, "LibDiamondCut: No selectors in facet to cut" ); DiamondStorage storage ds = diamondStorage(); // uint16 selectorCount = uint16(diamondStorage().selectors.length); require( _facetAddress != address(0), "LibDiamondCut: Add facet can't be address(0)" ); uint16 selectorPosition = uint16( ds.facetFunctionSelectors[_facetAddress].functionSelectors.length ); // add new facet address if it does not exist if (selectorPosition == 0) { enforceHasContractCode( _facetAddress, "LibDiamondCut: New facet has no code" ); ds .facetFunctionSelectors[_facetAddress] .facetAddressPosition = uint16(ds.facetAddresses.length); ds.facetAddresses.push(_facetAddress); } for ( uint256 selectorIndex; selectorIndex < _functionSelectors.length; selectorIndex++ ) { bytes4 selector = _functionSelectors[selectorIndex]; address oldFacetAddress = ds .selectorToFacetAndPosition[selector] .facetAddress; require( oldFacetAddress == address(0), "LibDiamondCut: Can't add function that already exists" ); ds.facetFunctionSelectors[_facetAddress].functionSelectors.push( selector ); ds .selectorToFacetAndPosition[selector] .facetAddress = _facetAddress; ds .selectorToFacetAndPosition[selector] .functionSelectorPosition = selectorPosition; selectorPosition++; } } function replaceFunctions( address _facetAddress, bytes4[] memory _functionSelectors ) internal { require( _functionSelectors.length > 0, "LibDiamondCut: No selectors in facet to cut" ); DiamondStorage storage ds = diamondStorage(); require( _facetAddress != address(0), "LibDiamondCut: Add facet can't be address(0)" ); uint16 selectorPosition = uint16( ds.facetFunctionSelectors[_facetAddress].functionSelectors.length ); // add new facet address if it does not exist if (selectorPosition == 0) { enforceHasContractCode( _facetAddress, "LibDiamondCut: New facet has no code" ); ds .facetFunctionSelectors[_facetAddress] .facetAddressPosition = uint16(ds.facetAddresses.length); ds.facetAddresses.push(_facetAddress); } for ( uint256 selectorIndex; selectorIndex < _functionSelectors.length; selectorIndex++ ) { bytes4 selector = _functionSelectors[selectorIndex]; address oldFacetAddress = ds .selectorToFacetAndPosition[selector] .facetAddress; require( oldFacetAddress != _facetAddress, "LibDiamondCut: Can't replace function with same function" ); removeFunction(oldFacetAddress, selector); // add function ds .selectorToFacetAndPosition[selector] .functionSelectorPosition = selectorPosition; ds.facetFunctionSelectors[_facetAddress].functionSelectors.push( selector ); ds .selectorToFacetAndPosition[selector] .facetAddress = _facetAddress; selectorPosition++; } } function removeFunctions( address _facetAddress, bytes4[] memory _functionSelectors ) internal { require( _functionSelectors.length > 0, "LibDiamondCut: No selectors in facet to cut" ); DiamondStorage storage ds = diamondStorage(); // if function does not exist then do nothing and return require( _facetAddress == address(0), "LibDiamondCut: Remove facet address must be address(0)" ); for ( uint256 selectorIndex; selectorIndex < _functionSelectors.length; selectorIndex++ ) { bytes4 selector = _functionSelectors[selectorIndex]; address oldFacetAddress = ds .selectorToFacetAndPosition[selector] .facetAddress; removeFunction(oldFacetAddress, selector); } } function removeFunction(address _facetAddress, bytes4 _selector) internal { DiamondStorage storage ds = diamondStorage(); require( _facetAddress != address(0), "LibDiamondCut: Can't remove function that doesn't exist" ); // an immutable function is a function defined directly in a diamond require( _facetAddress != address(this), "LibDiamondCut: Can't remove immutable function" ); // replace selector with last selector, then delete last selector uint256 selectorPosition = ds .selectorToFacetAndPosition[_selector] .functionSelectorPosition; uint256 lastSelectorPosition = ds .facetFunctionSelectors[_facetAddress] .functionSelectors .length - 1; // if not the same then replace _selector with lastSelector if (selectorPosition != lastSelectorPosition) { bytes4 lastSelector = ds .facetFunctionSelectors[_facetAddress] .functionSelectors[lastSelectorPosition]; ds.facetFunctionSelectors[_facetAddress].functionSelectors[ selectorPosition ] = lastSelector; ds .selectorToFacetAndPosition[lastSelector] .functionSelectorPosition = uint16(selectorPosition); } // delete the last selector ds.facetFunctionSelectors[_facetAddress].functionSelectors.pop(); delete ds.selectorToFacetAndPosition[_selector]; // if no more selectors for facet address then delete the facet address if (lastSelectorPosition == 0) { // replace facet address with last facet address and delete last facet address uint256 lastFacetAddressPosition = ds.facetAddresses.length - 1; uint256 facetAddressPosition = ds .facetFunctionSelectors[_facetAddress] .facetAddressPosition; if (facetAddressPosition != lastFacetAddressPosition) { address lastFacetAddress = ds.facetAddresses[ lastFacetAddressPosition ]; ds.facetAddresses[facetAddressPosition] = lastFacetAddress; ds .facetFunctionSelectors[lastFacetAddress] .facetAddressPosition = uint16(facetAddressPosition); } ds.facetAddresses.pop(); delete ds .facetFunctionSelectors[_facetAddress] .facetAddressPosition; } } function initializeDiamondCut( address _init, bytes memory _calldata ) internal { if (_init == address(0)) { require( _calldata.length == 0, "LibDiamondCut: _init is address(0) but_calldata is not empty" ); } else { require( _calldata.length > 0, "LibDiamondCut: _calldata is empty but _init is not address(0)" ); if (_init != address(this)) { enforceHasContractCode( _init, "LibDiamondCut: _init address has no code" ); } (bool success, bytes memory error) = _init.delegatecall(_calldata); if (!success) { if (error.length > 0) { // bubble up the error GelatoBytes.revertWithError(error, "LibDiamondCut:_init:"); } else { revert("LibDiamondCut: _init function reverted"); } } } } function enforceHasContractCode( address _contract, string memory _errorMessage ) internal view { uint256 contractSize; assembly { contractSize := extcodesize(_contract) } require(contractSize > 0, _errorMessage); } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.23; struct Message { address service; bytes data; uint256 salt; uint256 deadline; } struct MessageFeeCollector { address service; bytes data; uint256 salt; uint256 deadline; address feeToken; } struct MessageTrackFee { address service; bytes data; uint256 salt; uint256 deadline; address feeToken; bool isFeeCollector; } struct MessageRelayContext { address service; bytes data; uint256 salt; uint256 deadline; address feeToken; uint256 fee; } struct ExecWithSigs { bytes32 correlationId; Message msg; bytes executorSignerSig; bytes checkerSignerSig; } struct ExecWithSigsFeeCollector { bytes32 correlationId; MessageFeeCollector msg; bytes executorSignerSig; bytes checkerSignerSig; } struct ExecWithSigsTrackFee { bytes32 correlationId; MessageTrackFee msg; bytes executorSignerSig; bytes checkerSignerSig; } struct ExecWithSigsRelayContext { bytes32 correlationId; MessageRelayContext msg; bytes executorSignerSig; bytes checkerSignerSig; } struct ExecWithSig { bytes32 correlationId; Message msg; bytes checkerSignerSig; } struct ExecWithSigFeeCollector { bytes32 correlationId; MessageFeeCollector msg; bytes checkerSignerSig; } struct ExecWithSigTrackFee { bytes32 correlationId; MessageTrackFee msg; bytes checkerSignerSig; } struct ExecWithSigRelayContext { bytes32 correlationId; MessageRelayContext msg; bytes checkerSignerSig; }
{ "evmVersion": "paris", "libraries": {}, "metadata": { "bytecodeHash": "ipfs", "useLiteralContent": true }, "optimizer": { "enabled": true, "runs": 200 }, "remappings": [], "viaIR": true, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
[{"inputs":[{"internalType":"address","name":"_feeCollector","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"correlationId","type":"bytes32"},{"indexed":false,"internalType":"address","name":"service","type":"address"},{"indexed":false,"internalType":"address","name":"checkerSigner","type":"address"},{"indexed":false,"internalType":"address","name":"sender","type":"address"}],"name":"LogExecWithSig","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"correlationId","type":"bytes32"},{"indexed":false,"internalType":"address","name":"service","type":"address"},{"indexed":false,"internalType":"address","name":"checkerSigner","type":"address"},{"indexed":false,"internalType":"address","name":"feeToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"observedFee","type":"uint256"},{"indexed":false,"internalType":"address","name":"sender","type":"address"}],"name":"LogExecWithSigFeeCollector","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"correlationId","type":"bytes32"},{"indexed":false,"internalType":"address","name":"service","type":"address"},{"indexed":false,"internalType":"address","name":"checkerSigner","type":"address"},{"indexed":false,"internalType":"address","name":"feeToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"observedFee","type":"uint256"},{"indexed":false,"internalType":"address","name":"sender","type":"address"}],"name":"LogExecWithSigRelayContext","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"correlationId","type":"bytes32"},{"indexed":false,"internalType":"address","name":"service","type":"address"},{"indexed":false,"internalType":"address","name":"checkerSigner","type":"address"},{"indexed":false,"internalType":"address","name":"feeToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"observedFee","type":"uint256"},{"indexed":false,"internalType":"address","name":"sender","type":"address"}],"name":"LogExecWithSigTrackFee","type":"event"},{"inputs":[],"name":"DOMAIN_SEPARATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"EXEC_WITH_SIG_FEE_COLLECTOR_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"EXEC_WITH_SIG_RELAY_CONTEXT_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"EXEC_WITH_SIG_TRACK_FEE_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"EXEC_WITH_SIG_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_correlationId","type":"bytes32"},{"internalType":"address","name":"_service","type":"address"},{"internalType":"bytes","name":"_data","type":"bytes"},{"internalType":"uint256","name":"_salt","type":"uint256"},{"internalType":"uint256","name":"_deadline","type":"uint256"},{"internalType":"bytes32","name":"_r","type":"bytes32"},{"internalType":"bytes32","name":"_vs","type":"bytes32"}],"name":"execWithSig","outputs":[{"internalType":"uint256","name":"estimatedGasUsed","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_correlationId","type":"bytes32"},{"internalType":"address","name":"_service","type":"address"},{"internalType":"bytes","name":"_data","type":"bytes"},{"internalType":"uint256","name":"_salt","type":"uint256"},{"internalType":"uint256","name":"_deadline","type":"uint256"},{"internalType":"address","name":"_feeToken","type":"address"},{"internalType":"bytes32","name":"_r","type":"bytes32"},{"internalType":"bytes32","name":"_vs","type":"bytes32"}],"name":"execWithSigFeeCollector","outputs":[{"internalType":"uint256","name":"estimatedGasUsed","type":"uint256"},{"internalType":"uint256","name":"observedFee","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_correlationId","type":"bytes32"},{"internalType":"address","name":"_service","type":"address"},{"internalType":"bytes","name":"_data","type":"bytes"},{"internalType":"uint256","name":"_salt","type":"uint256"},{"internalType":"uint256","name":"_deadline","type":"uint256"},{"internalType":"address","name":"_feeToken","type":"address"},{"internalType":"uint256","name":"_fee","type":"uint256"},{"internalType":"bytes32","name":"_r","type":"bytes32"},{"internalType":"bytes32","name":"_vs","type":"bytes32"}],"name":"execWithSigRelayContext","outputs":[{"internalType":"uint256","name":"estimatedGasUsed","type":"uint256"},{"internalType":"uint256","name":"observedFee","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_correlationId","type":"bytes32"},{"internalType":"address","name":"_service","type":"address"},{"internalType":"bytes","name":"_data","type":"bytes"},{"internalType":"uint256","name":"_salt","type":"uint256"},{"internalType":"uint256","name":"_deadline","type":"uint256"},{"internalType":"address","name":"_feeToken","type":"address"},{"internalType":"bool","name":"_isFeeCollector","type":"bool"},{"internalType":"bytes32","name":"_r","type":"bytes32"},{"internalType":"bytes32","name":"_vs","type":"bytes32"}],"name":"execWithSigTrackFee","outputs":[{"internalType":"uint256","name":"estimatedGasUsed","type":"uint256"},{"internalType":"uint256","name":"observedFee","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"feeCollector","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_service","type":"address"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"simulateExecWithSig","outputs":[{"internalType":"uint256","name":"estimatedGasUsed","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_service","type":"address"},{"internalType":"bytes","name":"_data","type":"bytes"},{"internalType":"address","name":"_feeToken","type":"address"}],"name":"simulateExecWithSigFeeCollector","outputs":[{"internalType":"uint256","name":"estimatedGasUsed","type":"uint256"},{"internalType":"uint256","name":"observedFee","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_service","type":"address"},{"internalType":"bytes","name":"_data","type":"bytes"},{"internalType":"address","name":"_feeToken","type":"address"},{"internalType":"uint256","name":"_fee","type":"uint256"}],"name":"simulateExecWithSigRelayContext","outputs":[{"internalType":"uint256","name":"estimatedGasUsed","type":"uint256"},{"internalType":"uint256","name":"observedFee","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_service","type":"address"},{"internalType":"bytes","name":"_data","type":"bytes"},{"internalType":"address","name":"_feeToken","type":"address"}],"name":"simulateExecWithSigTrackFee","outputs":[{"internalType":"uint256","name":"estimatedGasUsed","type":"uint256"},{"internalType":"uint256","name":"observedFee","type":"uint256"},{"internalType":"bool","name":"isFeeCollector","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"version","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
60a03461009457601f611eba38819003918201601f19168301916001600160401b038311848410176100995780849260209460405283398101031261009457516001600160a01b038116810361009457608052604051611e0a90816100b0823960805181818161041a015281816106c4015281816107d90152818161088f01528181610c6301528181610e4f01526112a30152f35b600080fd5b634e487b7160e01b600052604160045260246000fdfe6080604052600436101561001257600080fd5b60003560e01c806306fdde03146101175780630904ad751461011257806309c564311461010d57806309dd98e91461010857806316dea2c2146101035780632a11c863146100fe5780633644e515146100f957806340e5357a146100f45780634d4a1730146100ef57806354fd4d50146100ea57806361932052146100e55780639648b40b146100e0578063c3d97cd3146100db578063c415b95c146100d6578063e02651d7146100d15763e0a5e97e146100cc57600080fd5b610d8b565b610cc9565b610c4d565b610c32565b610ba7565b610a94565b610a78565b610a40565b610986565b6108c0565b610870565b610789565b6106a0565b6104e4565b610347565b610291565b634e487b7160e01b600052604160045260246000fd5b604081019081106001600160401b0382111761014d57604052565b61011c565b60a081019081106001600160401b0382111761014d57604052565b608081019081106001600160401b0382111761014d57604052565b606081019081106001600160401b0382111761014d57604052565b61010081019081106001600160401b0382111761014d57604052565b60c081019081106001600160401b0382111761014d57604052565b90601f801991011681019081106001600160401b0382111761014d57604052565b6001600160401b03811161014d57601f01601f191660200190565b6040519061022382610132565b601082526f115e1958d5da5d1a14da59d19858d95d60821b6020830152565b60005b8381106102555750506000910152565b8181015183820152602001610245565b604091602082526102858151809281602086015260208686019101610242565b601f01601f1916010190565b346102bd5760003660031901126102bd576102b96102ad610216565b60405191829182610265565b0390f35b600080fd5b602435906001600160a01b03821682036102bd57565b60a435906001600160a01b03821682036102bd57565b600435906001600160a01b03821682036102bd57565b604435906001600160a01b03821682036102bd57565b9181601f840112156102bd578235916001600160401b0383116102bd57602083818601950101116102bd57565b346102bd576101203660031901126102bd576103616102c2565b6044356001600160401b0381116102bd5761038090369060040161031a565b608435929161038d6102d8565b9060c435905a9532330361049557610466610481926104617f9296d5f25021a1013ea0de6139d6abc09a106cfc0c805441ed00c1e41bff94879761045a61044b6104166103ff8a8c8f9a61046e9b6103ec6103e6610ed7565b83611467565b888b606435926103fa6114b5565b611581565b610407610f24565b90610104359060e4359061166a565b988a7f00000000000000000000000000000000000000000000000000000000000000008095610445828461179c565b98611846565b610453610f82565b908c6118ae565b508761179c565b610fd1565b965a90610fd1565b9486604051948594339360043587610fde565b0390a1604080519182526020820192909252f35b60405162461bcd60e51b81526020600482015260336024820152600080516020611db583398151915260448201527279436f6e746578743a206f6e6c7920454f417360681b6064820152608490fd5b346102bd5760e03660031901126102bd576104fd6102c2565b6044356001600160401b0381116102bd5761051c90369060040161031a565b90608435925a933233036105f8576102b9946105b16105a27fc6cfec28363edf86fe132edcedb30ccc6dbb89a7ec5f428aaeeb8ae5d901537d9561059a6105846105b99661057161056b611017565b82611467565b6064358b858b61057f6114b5565b611a18565b61058c61106d565b9060c4359060a4359061166a565b973691610c92565b6105aa6110cc565b90856118ae565b505a90610fd1565b6040805160043581526001600160a01b039384166020820152949092169184019190915233606084015291608090a16040519081529081906020820190565b60405162461bcd60e51b815260206004820152602760248201527f457865635769746853696746616365742e65786563576974685369673a206f6e6044820152666c7920454f417360c81b6064820152608490fd5b9060606003198301126102bd576001600160a01b0360043581811681036102bd5792602435906001600160401b0382116102bd5761068d9160040161031a565b9290929160443590811681036102bd5790565b346102bd576106ae3661064d565b92909160009361072885926104616107205a98807f0000000000000000000000000000000000000000000000000000000000000000986106ee8a8961179c565b9a826106fa308b61179c565b97826040519384928337810182815203925af197610461610719611105565b988761179c565b93309061179c565b908082111561077a575061073f90945b5a90610fd1565b923215801590610772575b61076d575060408051938452602084019490945215159282019290925260609150f35b611aa9565b50801561074a565b9150509261073f600191610738565b346102bd5760803660031901126102bd576107a26102ee565b6024356001600160401b0381116102bd576107c190369060040161031a565b91906107cb610304565b906108296000805a9561080f7f0000000000000000000000000000000000000000000000000000000000000000958787610805818361179c565b9b60643593611846565b9082602083519301915af191610823611105565b9361179c565b93840393841161086b575a830392831161086b573215801590610863575b61085e575050604080519182526020820192909252f35b611ae1565b508015610847565b610fbb565b346102bd5761087e3661064d565b906108296000809594955a9561080f7f000000000000000000000000000000000000000000000000000000000000000080966108ba828a61179c565b9a611b10565b346102bd5760003660031901126102bd5760206108db6114b5565b604051908152f35b60726040516108f181610152565b818152716f6c206973466565436f6c6c6563746f722960701b608060208301927f4578656357697468536967547261636b4665652861646472657373207365727684527f6963652c627974657320646174612c75696e743235362073616c742c75696e7460408201527f32353620646561646c696e652c6164647265737320666565546f6b656e2c626f606082015201522090565b346102bd5760003660031901126102bd5760206108db6108e3565b606e6040516109af81610152565b8181526d6e2c75696e74323536206665652960901b608060208301927f457865635769746853696752656c6179436f6e7465787428616464726573732084527f736572766963652c627974657320646174612c75696e743235362073616c742c60408201527f75696e7432353620646561646c696e652c6164647265737320666565546f6b65606082015201522090565b346102bd5760003660031901126102bd5760206108db6109a1565b60405190610a6882610132565b60018252603160f81b6020830152565b346102bd5760003660031901126102bd576102b96102ad610a5b565b346102bd576101203660031901126102bd57610aae6102c2565b6044356001600160401b0381116102bd57610acd90369060040161031a565b610ad89291926102d8565b60c4359081151582036102bd57610b0294610104359460e435946084359260643592600435611211565b60408051928352602083019190915290f35b6062604051610b2281610152565b818152616e2960f01b608060208301927f4578656357697468536967466565436f6c6c6563746f7228616464726573732084527f736572766963652c627974657320646174612c75696e743235362073616c742c60408201527f75696e7432353620646561646c696e652c6164647265737320666565546f6b65606082015201522090565b346102bd5760003660031901126102bd5760206108db610b14565b6045604051610bd08161016d565b818152646c696e652960d81b606060208301927f4578656357697468536967286164647265737320736572766963652c6279746584527f7320646174612c75696e743235362073616c742c75696e743235362064656164604082015201522090565b346102bd5760003660031901126102bd5760206108db610bc2565b346102bd5760003660031901126102bd576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b929192610c9e826101fb565b91610cac60405193846101da565b8294818452818301116102bd578281602093846000960137010152565b346102bd5760403660031901126102bd57610ce26102ee565b6024356001600160401b0381116102bd57366023820112156102bd576000610d1581923690602481600401359101610c92565b5a9382602083519301915af1610d29611105565b905a830392831161086b573215801590610d83575b610d4d57604051838152602090f35b610d7b9282519060405192151560208401526040830152606082015260608152610d768161016d565b611a68565b805190602001fd5b508015610d3e565b346102bd576101003660031901126102bd57610da56102c2565b6044356001600160401b0381116102bd57610dc490369060040161031a565b919060843592610dd26102d8565b905a94323303610e885761046e6104667fd53bb6976768dbfb2109156978ebcdd77f7cca588653bd2d9ea2bcdd7a935a1895610461610e46610e308861048197610e1d61056b61135b565b6064358a878f610e2b6114b5565b611bb1565b610e386113a8565b9060e4359060c4359061166a565b9561045a610e807f00000000000000000000000000000000000000000000000000000000000000008093610e7a828d61179c565b96611b10565b610453611406565b60405162461bcd60e51b81526020600482015260336024820152600080516020611d958339815191526044820152726f6c6c6563746f723a206f6e6c7920454f417360681b6064820152608490fd5b60405190610ee482610188565b604082527f79436f6e746578742e5f726571756972655369676e6572446561646c696e653a604083600080516020611db583398151915260208201520152565b60405190610f318261016d565b604882526733b730ba3ab9329d60c11b606083600080516020611db583398151915260208201527f79436f6e746578742e5f72657175697265436865636b65725369676e6572536960408201520152565b60405190610f8f82610188565b60298252683ca1b7b73a32bc3a1d60b91b604083600080516020611db583398151915260208201520152565b634e487b7160e01b600052601160045260246000fd5b9190820391821161086b57565b9081526001600160a01b03918216602082015291811660408301529182166060820152608081019290925290911660a082015260c00190565b6040519061102482610188565b603482527338bab4b932a9b4b3b732b92232b0b23634b7329d60611b6040837f457865635769746853696746616365742e65786563576974685369672e5f726560208201520152565b6040519061107a82610188565b603c82527f7175697265436865636b65725369676e65725369676e61747572653a000000006040837f457865635769746853696746616365742e65786563576974685369672e5f726560208201520152565b604051906110d982610132565b601d82527f457865635769746853696746616365742e65786563576974685369673a0000006020830152565b3d15611130573d90611116826101fb565b9161112460405193846101da565b82523d6000602084013e565b606090565b6040519061114282610188565b603c82527f6b4665652e5f726571756972655369676e6572446561646c696e653a00000000604083600080516020611d7583398151915260208201520152565b6040519061118f8261016d565b60448252633ab9329d60e11b606083600080516020611d7583398151915260208201527f6b4665652e5f72657175697265436865636b65725369676e65725369676e617460408201520152565b604051906111e982610188565b602582526435a332b29d60d91b604083600080516020611d7583398151915260208201520152565b92999798969599949190945a92323303611310578b6112e06112d1856112986112f19f7f252f4f020261e262eab32b345c49fe26a84c903c699a19566dc56f205a7ebc5f9e6112898f8f6113009f9a6104619b8d6112e79f8d9461127c611276611135565b86611467565b6112846114b5565b611b4d565b91611292611182565b9261166a565b9b15611305576112c97f0000000000000000000000000000000000000000000000000000000000000000809561179c565b953691610c92565b6112d96111dc565b908a6118ae565b508c61179c565b9788915a90610fd1565b98604051958695339487610fde565b0390a1565b6112c930809561179c565b60405162461bcd60e51b815260206004820152602f6024820152600080516020611d7583398151915260448201526e6b4665653a206f6e6c7920454f417360881b6064820152608490fd5b6040519061136882610188565b604082527f6f6c6c6563746f722e5f726571756972655369676e6572446561646c696e653a604083600080516020611d9583398151915260208201520152565b604051906113b58261016d565b604882526733b730ba3ab9329d60c11b606083600080516020611d9583398151915260208201527f6f6c6c6563746f722e5f72657175697265436865636b65725369676e6572536960408201520152565b6040519061141382610188565b602982526837b63632b1ba37b91d60b91b604083600080516020611d9583398151915260208201520152565b156114475750565b60405162461bcd60e51b81529081906114639060048301610265565b0390fd5b6114a69181159182156114a8575b506040516114a09161148682610132565b6008825267646561646c696e6560c01b6020830152611c4d565b9061143f565b565b42111591506114a0611475565b60526040516114c38161016d565b81815271766572696679696e67436f6e74726163742960701b606060208301927f454950373132446f6d61696e28737472696e67206e616d652c737472696e672084527f76657273696f6e2c75696e7432353620636861696e49642c61646472657373206040820152015220611537610216565b60208151910120611546610a5b565b602081519101206040519160208301938452604083015260608201524660808201523060a082015260a0815261157b816101bf565b51902090565b96919561157b9561159a61160d9896959661059a6109a1565b6020815191012094604051956020870197885260018060a01b0380951660408801526060870152608086015260a08501521660c083015260e082015260e081526115e3816101a3565b519020604051928391602083019586909160429261190160f01b8352600283015260228201520190565b03601f1981018352826101da565b6040519061162882610188565b602d82526c21b432b1b5b2b929b4b3b732b960991b6040837f45434453412e5265636f7665724572726f722e4e6f4572726f7220262620697360208201520152565b93929190936116798286611c8b565b602081519101206000527fc7abb622d9f922844c294eef990b8f35fc57cd4f9f07cc9751b539a6f170a9876020526116dc60ff60406000205416156114a06040516116c381610132565b60068152657265706c617960d01b602082015286611c4d565b8160ff1c601b810180911161086b57856117029260ff600180821b038616931690611cf2565b81959195600582101561177a576114a69461173292159182611737575b506114a09061172c61161b565b90611c4d565b611ca8565b6001600160a01b031660009081527fdee078fadc21593590e9046d81e4518a7b3feb16bdee74b2d2488cd4455264d36020526040902054151591506114a061171f565b634e487b7160e01b600052602160045260246000fd5b6040513d6000823e3d90fd5b6001600160a01b03908116801561183e5760009173eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee82036117d2575050503190565b6024602092939460405194859384926370a0823160e01b84521660048301525afa91821561183957809261180557505090565b9091506020823d602011611831575b81611821602093836101da565b8101031261182e57505190565b80fd5b3d9150611814565b611790565b505050600090565b909392611894936068938660405197889560208701378401926bffffffffffffffffffffffff19809260601b16602085015260601b16603483015260488201520360488101845201826101da565b90565b906118aa60209282815194859201610242565b0190565b909291600080602095868151910182865af1936118c9611105565b941561192d578451156118db57505050565b6119286114a6933b15159161191a6118fa604051958693840190611897565b7310d85b1b081d1bc81b9bdb8818dbdb9d1c9858dd60621b815260140190565b03601f1981018452836101da565b61143f565b84600461193b8251601f1690565b036119c6578082015162461bcd60e51b92906001600160e01b03191683036119925761191a61197e926044611977604051978895860190611897565b9101611897565b611463604051928392835260048301610265565b61197e915061191a6119ab604051958693840190611897565b6e2737a2b93937b929b2b632b1ba37b960891b8152600f0190565b60405161146390611a008161160d6119e082880189611897565b73556e657870656374656452657475726e6461746160601b815260140190565b60405162461bcd60e51b815291829160048301610265565b9461160d94611a2d61157b95946112c9610bc2565b60208151910120604051936020850195865260018060a01b031660408501526060840152608083015260a082015260a081526115e3816101bf565b60206114a6919392936040519481611a898793518092868087019101610242565b8201611a9d82518093868085019101610242565b010380855201836101da565b919290610d7b948451926040519415156020860152604085015260608401521515608083015260a082015260a08152610d76816101bf565b610d7b9284835191604051931515602085015260408401526060830152608082015260808152610d7681610152565b60349061189492938460405195869360208501378201906bffffffffffffffffffffffff199060601b1660208201520360148101845201826101da565b96919561157b95611b6661160d9896959661059a6108e3565b6020815191012094604051956020870197885260018060a01b0380951660408801526060870152608086015260a08501521660c0830152151560e082015260e081526115e3816101a3565b9591611bc49095919394956112c9610b14565b6020815191012094604051956020870195865260018060a01b0380951660408801526060870152608086015260a08501521660c083015260c0825260e08201918083106001600160401b0384111761014d576040839052805190912061190160f01b6101008301908152610102830194909452610122909101526042815261157b6062826101da565b6020611894916040519381611c6b8693518092868087019101610242565b8201611c7f82518093868085019101610242565b010380845201826101da565b91906040519260208401526040830152604082526114a682610188565b90611cb291611c8b565b602081519101206000527fc7abb622d9f922844c294eef990b8f35fc57cd4f9f07cc9751b539a6f170a9876020526040600020600160ff19825416179055565b9291907f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311611d685791608094939160ff602094604051948552168484015260408301526060820152600093849182805260015afa156118395781516001600160a01b03811615611d62579190565b50600190565b5050505060009060039056fe457865635769746853696746616365742e657865635769746853696754726163457865635769746853696746616365742e657865635769746853696746656543457865635769746853696746616365742e657865635769746853696752656c61a26469706673582212208e4233bc400dc5e206c34f8967f18c419824c89e96f804b7067d674bd756f54264736f6c634300081700330000000000000000000000003ac05161b76a35c1c28dc99aa01bed7b24cea3bf
Deployed Bytecode
0x6080604052600436101561001257600080fd5b60003560e01c806306fdde03146101175780630904ad751461011257806309c564311461010d57806309dd98e91461010857806316dea2c2146101035780632a11c863146100fe5780633644e515146100f957806340e5357a146100f45780634d4a1730146100ef57806354fd4d50146100ea57806361932052146100e55780639648b40b146100e0578063c3d97cd3146100db578063c415b95c146100d6578063e02651d7146100d15763e0a5e97e146100cc57600080fd5b610d8b565b610cc9565b610c4d565b610c32565b610ba7565b610a94565b610a78565b610a40565b610986565b6108c0565b610870565b610789565b6106a0565b6104e4565b610347565b610291565b634e487b7160e01b600052604160045260246000fd5b604081019081106001600160401b0382111761014d57604052565b61011c565b60a081019081106001600160401b0382111761014d57604052565b608081019081106001600160401b0382111761014d57604052565b606081019081106001600160401b0382111761014d57604052565b61010081019081106001600160401b0382111761014d57604052565b60c081019081106001600160401b0382111761014d57604052565b90601f801991011681019081106001600160401b0382111761014d57604052565b6001600160401b03811161014d57601f01601f191660200190565b6040519061022382610132565b601082526f115e1958d5da5d1a14da59d19858d95d60821b6020830152565b60005b8381106102555750506000910152565b8181015183820152602001610245565b604091602082526102858151809281602086015260208686019101610242565b601f01601f1916010190565b346102bd5760003660031901126102bd576102b96102ad610216565b60405191829182610265565b0390f35b600080fd5b602435906001600160a01b03821682036102bd57565b60a435906001600160a01b03821682036102bd57565b600435906001600160a01b03821682036102bd57565b604435906001600160a01b03821682036102bd57565b9181601f840112156102bd578235916001600160401b0383116102bd57602083818601950101116102bd57565b346102bd576101203660031901126102bd576103616102c2565b6044356001600160401b0381116102bd5761038090369060040161031a565b608435929161038d6102d8565b9060c435905a9532330361049557610466610481926104617f9296d5f25021a1013ea0de6139d6abc09a106cfc0c805441ed00c1e41bff94879761045a61044b6104166103ff8a8c8f9a61046e9b6103ec6103e6610ed7565b83611467565b888b606435926103fa6114b5565b611581565b610407610f24565b90610104359060e4359061166a565b988a7f0000000000000000000000003ac05161b76a35c1c28dc99aa01bed7b24cea3bf8095610445828461179c565b98611846565b610453610f82565b908c6118ae565b508761179c565b610fd1565b965a90610fd1565b9486604051948594339360043587610fde565b0390a1604080519182526020820192909252f35b60405162461bcd60e51b81526020600482015260336024820152600080516020611db583398151915260448201527279436f6e746578743a206f6e6c7920454f417360681b6064820152608490fd5b346102bd5760e03660031901126102bd576104fd6102c2565b6044356001600160401b0381116102bd5761051c90369060040161031a565b90608435925a933233036105f8576102b9946105b16105a27fc6cfec28363edf86fe132edcedb30ccc6dbb89a7ec5f428aaeeb8ae5d901537d9561059a6105846105b99661057161056b611017565b82611467565b6064358b858b61057f6114b5565b611a18565b61058c61106d565b9060c4359060a4359061166a565b973691610c92565b6105aa6110cc565b90856118ae565b505a90610fd1565b6040805160043581526001600160a01b039384166020820152949092169184019190915233606084015291608090a16040519081529081906020820190565b60405162461bcd60e51b815260206004820152602760248201527f457865635769746853696746616365742e65786563576974685369673a206f6e6044820152666c7920454f417360c81b6064820152608490fd5b9060606003198301126102bd576001600160a01b0360043581811681036102bd5792602435906001600160401b0382116102bd5761068d9160040161031a565b9290929160443590811681036102bd5790565b346102bd576106ae3661064d565b92909160009361072885926104616107205a98807f0000000000000000000000003ac05161b76a35c1c28dc99aa01bed7b24cea3bf986106ee8a8961179c565b9a826106fa308b61179c565b97826040519384928337810182815203925af197610461610719611105565b988761179c565b93309061179c565b908082111561077a575061073f90945b5a90610fd1565b923215801590610772575b61076d575060408051938452602084019490945215159282019290925260609150f35b611aa9565b50801561074a565b9150509261073f600191610738565b346102bd5760803660031901126102bd576107a26102ee565b6024356001600160401b0381116102bd576107c190369060040161031a565b91906107cb610304565b906108296000805a9561080f7f0000000000000000000000003ac05161b76a35c1c28dc99aa01bed7b24cea3bf958787610805818361179c565b9b60643593611846565b9082602083519301915af191610823611105565b9361179c565b93840393841161086b575a830392831161086b573215801590610863575b61085e575050604080519182526020820192909252f35b611ae1565b508015610847565b610fbb565b346102bd5761087e3661064d565b906108296000809594955a9561080f7f0000000000000000000000003ac05161b76a35c1c28dc99aa01bed7b24cea3bf80966108ba828a61179c565b9a611b10565b346102bd5760003660031901126102bd5760206108db6114b5565b604051908152f35b60726040516108f181610152565b818152716f6c206973466565436f6c6c6563746f722960701b608060208301927f4578656357697468536967547261636b4665652861646472657373207365727684527f6963652c627974657320646174612c75696e743235362073616c742c75696e7460408201527f32353620646561646c696e652c6164647265737320666565546f6b656e2c626f606082015201522090565b346102bd5760003660031901126102bd5760206108db6108e3565b606e6040516109af81610152565b8181526d6e2c75696e74323536206665652960901b608060208301927f457865635769746853696752656c6179436f6e7465787428616464726573732084527f736572766963652c627974657320646174612c75696e743235362073616c742c60408201527f75696e7432353620646561646c696e652c6164647265737320666565546f6b65606082015201522090565b346102bd5760003660031901126102bd5760206108db6109a1565b60405190610a6882610132565b60018252603160f81b6020830152565b346102bd5760003660031901126102bd576102b96102ad610a5b565b346102bd576101203660031901126102bd57610aae6102c2565b6044356001600160401b0381116102bd57610acd90369060040161031a565b610ad89291926102d8565b60c4359081151582036102bd57610b0294610104359460e435946084359260643592600435611211565b60408051928352602083019190915290f35b6062604051610b2281610152565b818152616e2960f01b608060208301927f4578656357697468536967466565436f6c6c6563746f7228616464726573732084527f736572766963652c627974657320646174612c75696e743235362073616c742c60408201527f75696e7432353620646561646c696e652c6164647265737320666565546f6b65606082015201522090565b346102bd5760003660031901126102bd5760206108db610b14565b6045604051610bd08161016d565b818152646c696e652960d81b606060208301927f4578656357697468536967286164647265737320736572766963652c6279746584527f7320646174612c75696e743235362073616c742c75696e743235362064656164604082015201522090565b346102bd5760003660031901126102bd5760206108db610bc2565b346102bd5760003660031901126102bd576040517f0000000000000000000000003ac05161b76a35c1c28dc99aa01bed7b24cea3bf6001600160a01b03168152602090f35b929192610c9e826101fb565b91610cac60405193846101da565b8294818452818301116102bd578281602093846000960137010152565b346102bd5760403660031901126102bd57610ce26102ee565b6024356001600160401b0381116102bd57366023820112156102bd576000610d1581923690602481600401359101610c92565b5a9382602083519301915af1610d29611105565b905a830392831161086b573215801590610d83575b610d4d57604051838152602090f35b610d7b9282519060405192151560208401526040830152606082015260608152610d768161016d565b611a68565b805190602001fd5b508015610d3e565b346102bd576101003660031901126102bd57610da56102c2565b6044356001600160401b0381116102bd57610dc490369060040161031a565b919060843592610dd26102d8565b905a94323303610e885761046e6104667fd53bb6976768dbfb2109156978ebcdd77f7cca588653bd2d9ea2bcdd7a935a1895610461610e46610e308861048197610e1d61056b61135b565b6064358a878f610e2b6114b5565b611bb1565b610e386113a8565b9060e4359060c4359061166a565b9561045a610e807f0000000000000000000000003ac05161b76a35c1c28dc99aa01bed7b24cea3bf8093610e7a828d61179c565b96611b10565b610453611406565b60405162461bcd60e51b81526020600482015260336024820152600080516020611d958339815191526044820152726f6c6c6563746f723a206f6e6c7920454f417360681b6064820152608490fd5b60405190610ee482610188565b604082527f79436f6e746578742e5f726571756972655369676e6572446561646c696e653a604083600080516020611db583398151915260208201520152565b60405190610f318261016d565b604882526733b730ba3ab9329d60c11b606083600080516020611db583398151915260208201527f79436f6e746578742e5f72657175697265436865636b65725369676e6572536960408201520152565b60405190610f8f82610188565b60298252683ca1b7b73a32bc3a1d60b91b604083600080516020611db583398151915260208201520152565b634e487b7160e01b600052601160045260246000fd5b9190820391821161086b57565b9081526001600160a01b03918216602082015291811660408301529182166060820152608081019290925290911660a082015260c00190565b6040519061102482610188565b603482527338bab4b932a9b4b3b732b92232b0b23634b7329d60611b6040837f457865635769746853696746616365742e65786563576974685369672e5f726560208201520152565b6040519061107a82610188565b603c82527f7175697265436865636b65725369676e65725369676e61747572653a000000006040837f457865635769746853696746616365742e65786563576974685369672e5f726560208201520152565b604051906110d982610132565b601d82527f457865635769746853696746616365742e65786563576974685369673a0000006020830152565b3d15611130573d90611116826101fb565b9161112460405193846101da565b82523d6000602084013e565b606090565b6040519061114282610188565b603c82527f6b4665652e5f726571756972655369676e6572446561646c696e653a00000000604083600080516020611d7583398151915260208201520152565b6040519061118f8261016d565b60448252633ab9329d60e11b606083600080516020611d7583398151915260208201527f6b4665652e5f72657175697265436865636b65725369676e65725369676e617460408201520152565b604051906111e982610188565b602582526435a332b29d60d91b604083600080516020611d7583398151915260208201520152565b92999798969599949190945a92323303611310578b6112e06112d1856112986112f19f7f252f4f020261e262eab32b345c49fe26a84c903c699a19566dc56f205a7ebc5f9e6112898f8f6113009f9a6104619b8d6112e79f8d9461127c611276611135565b86611467565b6112846114b5565b611b4d565b91611292611182565b9261166a565b9b15611305576112c97f0000000000000000000000003ac05161b76a35c1c28dc99aa01bed7b24cea3bf809561179c565b953691610c92565b6112d96111dc565b908a6118ae565b508c61179c565b9788915a90610fd1565b98604051958695339487610fde565b0390a1565b6112c930809561179c565b60405162461bcd60e51b815260206004820152602f6024820152600080516020611d7583398151915260448201526e6b4665653a206f6e6c7920454f417360881b6064820152608490fd5b6040519061136882610188565b604082527f6f6c6c6563746f722e5f726571756972655369676e6572446561646c696e653a604083600080516020611d9583398151915260208201520152565b604051906113b58261016d565b604882526733b730ba3ab9329d60c11b606083600080516020611d9583398151915260208201527f6f6c6c6563746f722e5f72657175697265436865636b65725369676e6572536960408201520152565b6040519061141382610188565b602982526837b63632b1ba37b91d60b91b604083600080516020611d9583398151915260208201520152565b156114475750565b60405162461bcd60e51b81529081906114639060048301610265565b0390fd5b6114a69181159182156114a8575b506040516114a09161148682610132565b6008825267646561646c696e6560c01b6020830152611c4d565b9061143f565b565b42111591506114a0611475565b60526040516114c38161016d565b81815271766572696679696e67436f6e74726163742960701b606060208301927f454950373132446f6d61696e28737472696e67206e616d652c737472696e672084527f76657273696f6e2c75696e7432353620636861696e49642c61646472657373206040820152015220611537610216565b60208151910120611546610a5b565b602081519101206040519160208301938452604083015260608201524660808201523060a082015260a0815261157b816101bf565b51902090565b96919561157b9561159a61160d9896959661059a6109a1565b6020815191012094604051956020870197885260018060a01b0380951660408801526060870152608086015260a08501521660c083015260e082015260e081526115e3816101a3565b519020604051928391602083019586909160429261190160f01b8352600283015260228201520190565b03601f1981018352826101da565b6040519061162882610188565b602d82526c21b432b1b5b2b929b4b3b732b960991b6040837f45434453412e5265636f7665724572726f722e4e6f4572726f7220262620697360208201520152565b93929190936116798286611c8b565b602081519101206000527fc7abb622d9f922844c294eef990b8f35fc57cd4f9f07cc9751b539a6f170a9876020526116dc60ff60406000205416156114a06040516116c381610132565b60068152657265706c617960d01b602082015286611c4d565b8160ff1c601b810180911161086b57856117029260ff600180821b038616931690611cf2565b81959195600582101561177a576114a69461173292159182611737575b506114a09061172c61161b565b90611c4d565b611ca8565b6001600160a01b031660009081527fdee078fadc21593590e9046d81e4518a7b3feb16bdee74b2d2488cd4455264d36020526040902054151591506114a061171f565b634e487b7160e01b600052602160045260246000fd5b6040513d6000823e3d90fd5b6001600160a01b03908116801561183e5760009173eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee82036117d2575050503190565b6024602092939460405194859384926370a0823160e01b84521660048301525afa91821561183957809261180557505090565b9091506020823d602011611831575b81611821602093836101da565b8101031261182e57505190565b80fd5b3d9150611814565b611790565b505050600090565b909392611894936068938660405197889560208701378401926bffffffffffffffffffffffff19809260601b16602085015260601b16603483015260488201520360488101845201826101da565b90565b906118aa60209282815194859201610242565b0190565b909291600080602095868151910182865af1936118c9611105565b941561192d578451156118db57505050565b6119286114a6933b15159161191a6118fa604051958693840190611897565b7310d85b1b081d1bc81b9bdb8818dbdb9d1c9858dd60621b815260140190565b03601f1981018452836101da565b61143f565b84600461193b8251601f1690565b036119c6578082015162461bcd60e51b92906001600160e01b03191683036119925761191a61197e926044611977604051978895860190611897565b9101611897565b611463604051928392835260048301610265565b61197e915061191a6119ab604051958693840190611897565b6e2737a2b93937b929b2b632b1ba37b960891b8152600f0190565b60405161146390611a008161160d6119e082880189611897565b73556e657870656374656452657475726e6461746160601b815260140190565b60405162461bcd60e51b815291829160048301610265565b9461160d94611a2d61157b95946112c9610bc2565b60208151910120604051936020850195865260018060a01b031660408501526060840152608083015260a082015260a081526115e3816101bf565b60206114a6919392936040519481611a898793518092868087019101610242565b8201611a9d82518093868085019101610242565b010380855201836101da565b919290610d7b948451926040519415156020860152604085015260608401521515608083015260a082015260a08152610d76816101bf565b610d7b9284835191604051931515602085015260408401526060830152608082015260808152610d7681610152565b60349061189492938460405195869360208501378201906bffffffffffffffffffffffff199060601b1660208201520360148101845201826101da565b96919561157b95611b6661160d9896959661059a6108e3565b6020815191012094604051956020870197885260018060a01b0380951660408801526060870152608086015260a08501521660c0830152151560e082015260e081526115e3816101a3565b9591611bc49095919394956112c9610b14565b6020815191012094604051956020870195865260018060a01b0380951660408801526060870152608086015260a08501521660c083015260c0825260e08201918083106001600160401b0384111761014d576040839052805190912061190160f01b6101008301908152610102830194909452610122909101526042815261157b6062826101da565b6020611894916040519381611c6b8693518092868087019101610242565b8201611c7f82518093868085019101610242565b010380845201826101da565b91906040519260208401526040830152604082526114a682610188565b90611cb291611c8b565b602081519101206000527fc7abb622d9f922844c294eef990b8f35fc57cd4f9f07cc9751b539a6f170a9876020526040600020600160ff19825416179055565b9291907f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311611d685791608094939160ff602094604051948552168484015260408301526060820152600093849182805260015afa156118395781516001600160a01b03811615611d62579190565b50600190565b5050505060009060039056fe457865635769746853696746616365742e657865635769746853696754726163457865635769746853696746616365742e657865635769746853696746656543457865635769746853696746616365742e657865635769746853696752656c61a26469706673582212208e4233bc400dc5e206c34f8967f18c419824c89e96f804b7067d674bd756f54264736f6c63430008170033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000003ac05161b76a35c1c28dc99aa01bed7b24cea3bf
-----Decoded View---------------
Arg [0] : _feeCollector (address): 0x3AC05161b76a35c1c28dC99Aa01BEd7B24cEA3bf
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 0000000000000000000000003ac05161b76a35c1c28dc99aa01bed7b24cea3bf
Loading...
Loading
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.