Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
- Contract name:
- Forwarder
- Optimization enabled
- true
- Compiler version
- v0.8.24+commit.e11b9ed9
- Optimization runs
- 100
- EVM Version
- paris
- Verified at
- 2024-06-06T03:46:27.864535Z
contracts/xai-subsidy/Forwarder.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.22;
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import {ECDSA} from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
contract Forwarder is Initializable {
using ECDSA for bytes32;
bytes32 public DOMAIN_SEPARATOR;
bytes32 public constant FORWARD_REQUEST_TYPEHASH =
keccak256(
"ForwardRequest(address from,address to,uint256 value,uint256 gas,uint256 nonce,bytes data)"
);
// Mapping to store nonces for each sender
mapping(address => uint256) public nonces;
struct ForwardRequest {
address from; // an externally owned account making the request
address to; // destination address, in this case the Receiver Contract
uint256 value; // ETH Amount to transfer to destination
uint256 gas; // gas limit for execution
uint256 nonce; // the users nonce for this request
bytes data; // the data to be sent to the destination
}
function initialize() public initializer {
uint256 chainId;
assembly {
chainId := chainid()
}
DOMAIN_SEPARATOR = keccak256(
abi.encode(
keccak256(
"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"
),
keccak256(bytes("Forwarder")), // Name of the contract
keccak256(bytes("1")), // Version
chainId, // Chain ID
address(this) // Address of the contract
)
);
}
function verify(
ForwardRequest calldata request,
bytes calldata signature
) public view returns (bool) {
bytes32 messageHash = keccak256(
abi.encodePacked(
"\x19\x01",
DOMAIN_SEPARATOR,
keccak256(
abi.encode(
FORWARD_REQUEST_TYPEHASH,
request.from,
request.to,
request.value,
request.gas,
nonces[request.from],
keccak256(request.data)
)
)
)
);
(address recovered, ECDSA.RecoverError err) = messageHash.tryRecover(
signature
);
if (err == ECDSA.RecoverError.NoError) {
return recovered == request.from;
}
return false;
}
function execute(
ForwardRequest calldata request,
bytes calldata signature
) public payable returns (bool, bytes memory) {
require(msg.value == request.value, "Invalid msg.value");
require(
verify(request, signature),
"Forwarder: signature does not match request"
);
nonces[request.from]++;
(bool success, bytes memory returndata) = request.to.call{
gas: request.gas,
value: request.value
}(abi.encodePacked(request.data, request.from));
if (gasleft() <= request.gas / 63) {
// We explicitly trigger invalid opcode to consume all gas and bubble-up the effects, since
// neither revert or assert consume all gas since Solidity 0.8.0
// https://docs.soliditylang.org/en/v0.8.0/control-structures.html#panic-via-assert-and-error-via-require
assembly {
invalid()
}
}
require(success, "Invalid forward request");
return (success, returndata);
}
}
@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)
pragma solidity ^0.8.2;
import "../../utils/AddressUpgradeable.sol";
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
* behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
* external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
* function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
*
* The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
* reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
* case an upgrade adds a module that needs to be initialized.
*
* For example:
*
* [.hljs-theme-light.nopadding]
* ```solidity
* contract MyToken is ERC20Upgradeable {
* function initialize() initializer public {
* __ERC20_init("MyToken", "MTK");
* }
* }
*
* contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
* function initializeV2() reinitializer(2) public {
* __ERC20Permit_init("MyToken");
* }
* }
* ```
*
* TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
* possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
*
* CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
* that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
*
* [CAUTION]
* ====
* Avoid leaving a contract uninitialized.
*
* An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
* contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
* the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
*
* [.hljs-theme-light.nopadding]
* ```
* /// @custom:oz-upgrades-unsafe-allow constructor
* constructor() {
* _disableInitializers();
* }
* ```
* ====
*/
abstract contract Initializable {
/**
* @dev Indicates that the contract has been initialized.
* @custom:oz-retyped-from bool
*/
uint8 private _initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool private _initializing;
/**
* @dev Triggered when the contract has been initialized or reinitialized.
*/
event Initialized(uint8 version);
/**
* @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
* `onlyInitializing` functions can be used to initialize parent contracts.
*
* Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a
* constructor.
*
* Emits an {Initialized} event.
*/
modifier initializer() {
bool isTopLevelCall = !_initializing;
require(
(isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
"Initializable: contract is already initialized"
);
_initialized = 1;
if (isTopLevelCall) {
_initializing = true;
}
_;
if (isTopLevelCall) {
_initializing = false;
emit Initialized(1);
}
}
/**
* @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
* contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
* used to initialize parent contracts.
*
* A reinitializer may be used after the original initialization step. This is essential to configure modules that
* are added through upgrades and that require initialization.
*
* When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
* cannot be nested. If one is invoked in the context of another, execution will revert.
*
* Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
* a contract, executing them in the right order is up to the developer or operator.
*
* WARNING: setting the version to 255 will prevent any future reinitialization.
*
* Emits an {Initialized} event.
*/
modifier reinitializer(uint8 version) {
require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
_initialized = version;
_initializing = true;
_;
_initializing = false;
emit Initialized(version);
}
/**
* @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
* {initializer} and {reinitializer} modifiers, directly or indirectly.
*/
modifier onlyInitializing() {
require(_initializing, "Initializable: contract is not initializing");
_;
}
/**
* @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
* Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
* to any version. It is recommended to use this to lock implementation contracts that are designed to be called
* through proxies.
*
* Emits an {Initialized} event the first time it is successfully executed.
*/
function _disableInitializers() internal virtual {
require(!_initializing, "Initializable: contract is initializing");
if (_initialized != type(uint8).max) {
_initialized = type(uint8).max;
emit Initialized(type(uint8).max);
}
}
/**
* @dev Returns the highest version that has been initialized. See {reinitializer}.
*/
function _getInitializedVersion() internal view returns (uint8) {
return _initialized;
}
/**
* @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
*/
function _isInitializing() internal view returns (bool) {
return _initializing;
}
}
@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library AddressUpgradeable {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
*
* Furthermore, `isContract` will also return true if the target contract within
* the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
* which only has an effect at the end of a transaction.
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
@openzeppelin/contracts/utils/Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)
pragma solidity ^0.8.0;
import "./math/Math.sol";
import "./math/SignedMath.sol";
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _SYMBOLS = "0123456789abcdef";
uint8 private constant _ADDRESS_LENGTH = 20;
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
unchecked {
uint256 length = Math.log10(value) + 1;
string memory buffer = new string(length);
uint256 ptr;
/// @solidity memory-safe-assembly
assembly {
ptr := add(buffer, add(32, length))
}
while (true) {
ptr--;
/// @solidity memory-safe-assembly
assembly {
mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
}
value /= 10;
if (value == 0) break;
}
return buffer;
}
}
/**
* @dev Converts a `int256` to its ASCII `string` decimal representation.
*/
function toString(int256 value) internal pure returns (string memory) {
return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMath.abs(value))));
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
unchecked {
return toHexString(value, Math.log256(value) + 1);
}
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
/**
* @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
*/
function toHexString(address addr) internal pure returns (string memory) {
return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
}
/**
* @dev Returns true if the two strings are equal.
*/
function equal(string memory a, string memory b) internal pure returns (bool) {
return keccak256(bytes(a)) == keccak256(bytes(b));
}
}
@openzeppelin/contracts/utils/cryptography/ECDSA.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/ECDSA.sol)
pragma solidity ^0.8.0;
import "../Strings.sol";
/**
* @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
*
* These functions can be used to verify that a message was signed by the holder
* of the private keys of a given address.
*/
library ECDSA {
enum RecoverError {
NoError,
InvalidSignature,
InvalidSignatureLength,
InvalidSignatureS,
InvalidSignatureV // Deprecated in v4.8
}
function _throwError(RecoverError error) private pure {
if (error == RecoverError.NoError) {
return; // no error: do nothing
} else if (error == RecoverError.InvalidSignature) {
revert("ECDSA: invalid signature");
} else if (error == RecoverError.InvalidSignatureLength) {
revert("ECDSA: invalid signature length");
} else if (error == RecoverError.InvalidSignatureS) {
revert("ECDSA: invalid signature 's' value");
}
}
/**
* @dev Returns the address that signed a hashed message (`hash`) with
* `signature` or error string. This address can then be used for verification purposes.
*
* The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {toEthSignedMessageHash} on it.
*
* Documentation for signature generation:
* - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
* - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
*
* _Available since v4.3._
*/
function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {
if (signature.length == 65) {
bytes32 r;
bytes32 s;
uint8 v;
// ecrecover takes the signature parameters, and the only way to get them
// currently is to use assembly.
/// @solidity memory-safe-assembly
assembly {
r := mload(add(signature, 0x20))
s := mload(add(signature, 0x40))
v := byte(0, mload(add(signature, 0x60)))
}
return tryRecover(hash, v, r, s);
} else {
return (address(0), RecoverError.InvalidSignatureLength);
}
}
/**
* @dev Returns the address that signed a hashed message (`hash`) with
* `signature`. This address can then be used for verification purposes.
*
* The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {toEthSignedMessageHash} on it.
*/
function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, signature);
_throwError(error);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
*
* See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
*
* _Available since v4.3._
*/
function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError) {
bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
uint8 v = uint8((uint256(vs) >> 255) + 27);
return tryRecover(hash, v, r, s);
}
/**
* @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
*
* _Available since v4.2._
*/
function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, r, vs);
_throwError(error);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `v`,
* `r` and `s` signature fields separately.
*
* _Available since v4.3._
*/
function tryRecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address, RecoverError) {
// EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
// unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
// the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
// signatures from current libraries generate a unique signature with an s-value in the lower half order.
//
// If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
// with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
// vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
// these malleable signatures as well.
if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
return (address(0), RecoverError.InvalidSignatureS);
}
// If the signature is valid (and not malleable), return the signer address
address signer = ecrecover(hash, v, r, s);
if (signer == address(0)) {
return (address(0), RecoverError.InvalidSignature);
}
return (signer, RecoverError.NoError);
}
/**
* @dev Overload of {ECDSA-recover} that receives the `v`,
* `r` and `s` signature fields separately.
*/
function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, v, r, s);
_throwError(error);
return recovered;
}
/**
* @dev Returns an Ethereum Signed Message, created from a `hash`. This
* produces hash corresponding to the one signed with the
* https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
* JSON-RPC method as part of EIP-191.
*
* See {recover}.
*/
function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 message) {
// 32 is the length in bytes of hash,
// enforced by the type signature above
/// @solidity memory-safe-assembly
assembly {
mstore(0x00, "\x19Ethereum Signed Message:\n32")
mstore(0x1c, hash)
message := keccak256(0x00, 0x3c)
}
}
/**
* @dev Returns an Ethereum Signed Message, created from `s`. This
* produces hash corresponding to the one signed with the
* https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
* JSON-RPC method as part of EIP-191.
*
* See {recover}.
*/
function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s));
}
/**
* @dev Returns an Ethereum Signed Typed Data, created from a
* `domainSeparator` and a `structHash`. This produces hash corresponding
* to the one signed with the
* https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]
* JSON-RPC method as part of EIP-712.
*
* See {recover}.
*/
function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 data) {
/// @solidity memory-safe-assembly
assembly {
let ptr := mload(0x40)
mstore(ptr, "\x19\x01")
mstore(add(ptr, 0x02), domainSeparator)
mstore(add(ptr, 0x22), structHash)
data := keccak256(ptr, 0x42)
}
}
/**
* @dev Returns an Ethereum Signed Data with intended validator, created from a
* `validator` and `data` according to the version 0 of EIP-191.
*
* See {recover}.
*/
function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19\x00", validator, data));
}
}
@openzeppelin/contracts/utils/math/Math.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
enum Rounding {
Down, // Toward negative infinity
Up, // Toward infinity
Zero // Toward zero
}
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two numbers. The result is rounded towards
* zero.
*/
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow.
return (a & b) + (a ^ b) / 2;
}
/**
* @dev Returns the ceiling of the division of two numbers.
*
* This differs from standard division with `/` in that it rounds up instead
* of rounding down.
*/
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b - 1) / b can overflow on addition, so we distribute.
return a == 0 ? 0 : (a - 1) / b + 1;
}
/**
* @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
* @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
* with further edits by Uniswap Labs also under MIT license.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
unchecked {
// 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
// use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
// variables such that product = prod1 * 2^256 + prod0.
uint256 prod0; // Least significant 256 bits of the product
uint256 prod1; // Most significant 256 bits of the product
assembly {
let mm := mulmod(x, y, not(0))
prod0 := mul(x, y)
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
// Handle non-overflow cases, 256 by 256 division.
if (prod1 == 0) {
// Solidity will revert if denominator == 0, unlike the div opcode on its own.
// The surrounding unchecked block does not change this fact.
// See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
return prod0 / denominator;
}
// Make sure the result is less than 2^256. Also prevents denominator == 0.
require(denominator > prod1, "Math: mulDiv overflow");
///////////////////////////////////////////////
// 512 by 256 division.
///////////////////////////////////////////////
// Make division exact by subtracting the remainder from [prod1 prod0].
uint256 remainder;
assembly {
// Compute remainder using mulmod.
remainder := mulmod(x, y, denominator)
// Subtract 256 bit number from 512 bit number.
prod1 := sub(prod1, gt(remainder, prod0))
prod0 := sub(prod0, remainder)
}
// Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
// See https://cs.stackexchange.com/q/138556/92363.
// Does not overflow because the denominator cannot be zero at this stage in the function.
uint256 twos = denominator & (~denominator + 1);
assembly {
// Divide denominator by twos.
denominator := div(denominator, twos)
// Divide [prod1 prod0] by twos.
prod0 := div(prod0, twos)
// Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
twos := add(div(sub(0, twos), twos), 1)
}
// Shift in bits from prod1 into prod0.
prod0 |= prod1 * twos;
// Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
// that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
// four bits. That is, denominator * inv = 1 mod 2^4.
uint256 inverse = (3 * denominator) ^ 2;
// Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
// in modular arithmetic, doubling the correct bits in each step.
inverse *= 2 - denominator * inverse; // inverse mod 2^8
inverse *= 2 - denominator * inverse; // inverse mod 2^16
inverse *= 2 - denominator * inverse; // inverse mod 2^32
inverse *= 2 - denominator * inverse; // inverse mod 2^64
inverse *= 2 - denominator * inverse; // inverse mod 2^128
inverse *= 2 - denominator * inverse; // inverse mod 2^256
// Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
// This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
// less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
// is no longer required.
result = prod0 * inverse;
return result;
}
}
/**
* @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
uint256 result = mulDiv(x, y, denominator);
if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
result += 1;
}
return result;
}
/**
* @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
*
* Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
*/
function sqrt(uint256 a) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
// For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
//
// We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
// `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
//
// This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
// → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
// → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
//
// Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
uint256 result = 1 << (log2(a) >> 1);
// At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
// since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
// every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
// into the expected uint128 result.
unchecked {
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
return min(result, a / result);
}
}
/**
* @notice Calculates sqrt(a), following the selected rounding direction.
*/
function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = sqrt(a);
return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
}
}
/**
* @dev Return the log in base 2, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 128;
}
if (value >> 64 > 0) {
value >>= 64;
result += 64;
}
if (value >> 32 > 0) {
value >>= 32;
result += 32;
}
if (value >> 16 > 0) {
value >>= 16;
result += 16;
}
if (value >> 8 > 0) {
value >>= 8;
result += 8;
}
if (value >> 4 > 0) {
value >>= 4;
result += 4;
}
if (value >> 2 > 0) {
value >>= 2;
result += 2;
}
if (value >> 1 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 2, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log2(value);
return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 10, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >= 10 ** 64) {
value /= 10 ** 64;
result += 64;
}
if (value >= 10 ** 32) {
value /= 10 ** 32;
result += 32;
}
if (value >= 10 ** 16) {
value /= 10 ** 16;
result += 16;
}
if (value >= 10 ** 8) {
value /= 10 ** 8;
result += 8;
}
if (value >= 10 ** 4) {
value /= 10 ** 4;
result += 4;
}
if (value >= 10 ** 2) {
value /= 10 ** 2;
result += 2;
}
if (value >= 10 ** 1) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 10, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log10(value);
return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 256, rounded down, of a positive value.
* Returns 0 if given 0.
*
* Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
*/
function log256(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 16;
}
if (value >> 64 > 0) {
value >>= 64;
result += 8;
}
if (value >> 32 > 0) {
value >>= 32;
result += 4;
}
if (value >> 16 > 0) {
value >>= 16;
result += 2;
}
if (value >> 8 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 256, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log256(value);
return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);
}
}
}
@openzeppelin/contracts/utils/math/SignedMath.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard signed math utilities missing in the Solidity language.
*/
library SignedMath {
/**
* @dev Returns the largest of two signed numbers.
*/
function max(int256 a, int256 b) internal pure returns (int256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two signed numbers.
*/
function min(int256 a, int256 b) internal pure returns (int256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two signed numbers without overflow.
* The result is rounded towards zero.
*/
function average(int256 a, int256 b) internal pure returns (int256) {
// Formula from the book "Hacker's Delight"
int256 x = (a & b) + ((a ^ b) >> 1);
return x + (int256(uint256(x) >> 255) & (a ^ b));
}
/**
* @dev Returns the absolute unsigned value of a signed value.
*/
function abs(int256 n) internal pure returns (uint256) {
unchecked {
// must be unchecked in order to support `n = type(int256).min`
return uint256(n >= 0 ? n : -n);
}
}
}
Compiler Settings
{"viaIR":true,"outputSelection":{"*":{"*":["abi","evm.bytecode","evm.deployedBytecode","evm.methodIdentifiers"]}},"optimizer":{"runs":100,"enabled":true,"details":{"yulDetails":{"optimizerSteps":"u"}}},"libraries":{},"evmVersion":"paris"}
Contract ABI
[{"type":"event","name":"Initialized","inputs":[{"type":"uint8","name":"version","internalType":"uint8","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"DOMAIN_SEPARATOR","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"FORWARD_REQUEST_TYPEHASH","inputs":[]},{"type":"function","stateMutability":"payable","outputs":[{"type":"bool","name":"","internalType":"bool"},{"type":"bytes","name":"","internalType":"bytes"}],"name":"execute","inputs":[{"type":"tuple","name":"request","internalType":"struct Forwarder.ForwardRequest","components":[{"type":"address","name":"from","internalType":"address"},{"type":"address","name":"to","internalType":"address"},{"type":"uint256","name":"value","internalType":"uint256"},{"type":"uint256","name":"gas","internalType":"uint256"},{"type":"uint256","name":"nonce","internalType":"uint256"},{"type":"bytes","name":"data","internalType":"bytes"}]},{"type":"bytes","name":"signature","internalType":"bytes"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"initialize","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"nonces","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"verify","inputs":[{"type":"tuple","name":"request","internalType":"struct Forwarder.ForwardRequest","components":[{"type":"address","name":"from","internalType":"address"},{"type":"address","name":"to","internalType":"address"},{"type":"uint256","name":"value","internalType":"uint256"},{"type":"uint256","name":"gas","internalType":"uint256"},{"type":"uint256","name":"nonce","internalType":"uint256"},{"type":"bytes","name":"data","internalType":"bytes"}]},{"type":"bytes","name":"signature","internalType":"bytes"}]}]
Contract Creation Code
0x60806040523461001a57604051610e546100208239610e5490f35b600080fdfe6080604052600436101561001257600080fd5b60003560e01c80633644e5151461007257806347153f821461006d5780637ecebe00146100685780638129fc1c14610063578063956309681461005e5763bf5d3bdb0361008257610312565b6102f7565b6102b6565b61029b565b6101e1565b6100b2565b600091031261008257565b600080fd5b610092916008021c81565b90565b906100929154610087565b61009260006001610095565b9052565b565b34610082576100c2366004610077565b6100dd6100cd6100a0565b6040519182918290815260200190565b0390f35b908160c09103126100825790565b909182601f830112156100825781359167ffffffffffffffff831161008257602001926001830284011161008257565b91909160408184031261008257803567ffffffffffffffff811161008257836101499183016100e1565b92602082013567ffffffffffffffff81116100825761016892016100ef565b9091565b60005b83811061017f5750506000910152565b818101518382015260200161016f565b6101b06101b96020936101c3936101a4815190565b80835293849260200190565b9586910161016c565b601f01601f191690565b0190565b90151581526040602082018190526100929291019061018f565b6101f56101ef36600461011f565b91610634565b906100dd61020260405190565b928392836101c7565b6001600160a01b031690565b6102208161020b565b0361008257565b905035906100b082610217565b906020828203126100825761009291610227565b6100929061020b906001600160a01b031682565b61009290610248565b6100929061025c565b9061027890610265565b600052602052604060002090565b600061029661009292600261026e565b610095565b34610082576100dd6100cd6102b1366004610234565b610286565b34610082576102c6366004610077565b6102ce610aa9565b604051005b7fdd8f4b70b0f4393e889bd39128a30628a78b61816a9eb8199759e7a349657e4890565b3461008257610307366004610077565b6100dd6100cd6102d3565b34610082576100dd61032e61032836600461011f565b91610b79565b60405191829182901515815260200190565b80610220565b3561009281610340565b602080825260119082015270496e76616c6964206d73672e76616c756560781b604082015260600190565b1561038257565b60405162461bcd60e51b81528061039b60048201610350565b0390fd5b6020808252602b908201527f466f727761726465723a207369676e617475726520646f6573206e6f74206d6160408201526a1d18da081c995c5d595cdd60aa1b606082015260800190565b156103f157565b60405162461bcd60e51b81528061039b6004820161039f565b3561009281610217565b6100929081565b6100929054610414565b634e487b7160e01b600052601160045260246000fd5b600019811461044a5760010190565b610425565b90600019905b9181191691161790565b6100926100926100929290565b9061047c6100926104839261045f565b825461044f565b9055565b903590601e193682900301821215610082570180359067ffffffffffffffff8211610082576020019136829003831361008257565b90826000939282370152565b90916101c390839080936104bc565b60601b90565b610092906104d7565b6104f26100ac9161020b565b6104dd565b61050890601494936101c3936104c8565b80926104e6565b634e487b7160e01b600052604160045260246000fd5b90601f01601f1916810190811067ffffffffffffffff82111761054757604052565b61050f565b906100b061055960405190565b9283610525565b67ffffffffffffffff811161054757602090601f01601f19160190565b9061058f61058a83610560565b61054c565b918252565b3d156105ae576105a33d61057d565b903d6000602084013e565b606090565b634e487b7160e01b600052601260045260246000fd5b906105d3565b9190565b9081156105de570490565b6105b3565b602080825260179082015276125b9d985b1a5908199bdc9dd85c99081c995c5d595cdd604a1b604082015260600190565b1561061b57565b60405162461bcd60e51b81528061039b600482016105e3565b929160009161067061066b8493610649600090565b50604088019361066561065e61009287610346565b341461037b565b88610b79565b6103ea565b8185016106a06106896106828361040a565b600261026e565b61069a6106958261041b565b61043b565b9061046c565b6106ac6020870161040a565b9560608101966106e06107076106d86106cd6106c78c610346565b97610346565b9460a0810190610487565b92909561040a565b916106fb6106ed60405190565b9384926020840198896104f7565b86810382520382610525565b5193f1610712610594565b926107366105cf6100926107265a94610346565b610730603f61045f565b906105c9565b1115610745576105cf81610614565bfe5b6100929060081c5b60ff1690565b6100929054610747565b6100929061074f565b610092905461075f565b61074f6100926100929290565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b156107d457565b60405162461bcd60e51b81528061039b6004820161077f565b9060ff90610455565b61074f6100926100929260ff1690565b90610816610092610483926107f6565b82546107ed565b9061ff009060081b610455565b151590565b9061083f6100926104839261082a565b825461081d565b6100ac90610772565b6020810192916100b09190610846565b61087061086c6000610755565b1590565b808061094b575b8015610906575b610887906107cd565b8061089c6108956001610772565b6000610806565b6108f5575b6108a9610a0d565b6108af57565b6108ba60008061082f565b7f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024986108e460405190565b806108f060018261084f565b0390a1565b6109016001600061082f565b6108a1565b5061091b61086c61091630610265565b610cc2565b801561087e575061088761092f6000610768565b61094361093c6001610772565b9160ff1690565b14905061087e565b506109566000610768565b61096361093c6001610772565b10610877565b610973600961057d565b682337b93bb0b93232b960b91b602082015290565b610092610969565b61099a600161057d565b603160f81b602082015290565b610092610990565b6100ac9061020b565b909594926100b0946109ea6109f1926109e36080966109dc60a088019c6000890152565b6020870152565b6040850152565b6060830152565b01906109af565b9061047c610a0861048392610092565b610092565b6100b0610a18610988565b610a2a610a23825190565b9160200190565b20610a96610a366109a7565b610a41610a23825190565b2091610a4c30610265565b92610a8a610a5960405190565b948593602085019346917f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f866109b8565b90810382520382610525565b610aa1610a23825190565b2060016109f8565b6100b061085f565b90929192610ac161058a82610560565b9381855281830111610082576100b09160208501906104bc565b610092913691610ab1565b90815260e08101979695909490939092909160208601610b05916109af565b60408501610b12916109af565b6060840152608083015260a082015260c00152565b6020809392610b4461058f6101c39461190160f01b815260020190565b01918252565b634e487b7160e01b600052602160045260246000fd5b60051115610b6a57565b610b4a565b906100b082610b60565b9190610c79610c7f92610b8a600090565b50610a8a610c67610b9b600161041b565b87610c43817fdd8f4b70b0f4393e889bd39128a30628a78b61816a9eb8199759e7a349657e48610a8a610bd96020610bd28561040a565b940161040a565b948d610be760408201610346565b91610c1f610c19610c0e610c09610682610c0360608801610346565b9561040a565b61041b565b9360a0810190610487565b90610adb565b610c2a610a23825190565b2092610c3560405190565b988997602089019788610ae6565b610c4e610a23825190565b2090610c5960405190565b938492602084019283610b27565b610c72610a23825190565b2092610adb565b90610cea565b610c95610c8f6000949394610b6f565b91610b6f565b14610ca1575050600090565b610cb8610cb36000610cbe930161040a565b61020b565b9161020b565b1490565b3b610cd06105cf600061045f565b1190565b61020b6100926100929290565b61009290610cd4565b908051610cfa6105cf604161045f565b03610d1c57610168916020820151906060604084015193015160001a90610d77565b5050610d286000610ce1565b90600290565b6100929061045f565b610d676100b094610d60606094989795610d56608086019a6000870152565b60ff166020850152565b6040830152565b0152565b6040513d6000823e3d90fd5b919291610d8383610d2e565b610da56105cf6fa2a8918ca85bafe22016d0b997e4df60600160ff1b0361045f565b11610e0a57610dc5600093602095610dbc60405190565b94859485610d37565b838052039060015afa15610e0557600051610de06000610ce1565b610de98161020b565b610df28361020b565b14610dfe575090600090565b9160019150565b610d6b565b50505050610e186000610ce1565b9060039056fea264697066735822122063a81f7b3cd5039bbd84ef3e128a1cfea2bdb870167a7f77a562ab967eda468e64736f6c63430008180033
Deployed ByteCode
0x6080604052600436101561001257600080fd5b60003560e01c80633644e5151461007257806347153f821461006d5780637ecebe00146100685780638129fc1c14610063578063956309681461005e5763bf5d3bdb0361008257610312565b6102f7565b6102b6565b61029b565b6101e1565b6100b2565b600091031261008257565b600080fd5b610092916008021c81565b90565b906100929154610087565b61009260006001610095565b9052565b565b34610082576100c2366004610077565b6100dd6100cd6100a0565b6040519182918290815260200190565b0390f35b908160c09103126100825790565b909182601f830112156100825781359167ffffffffffffffff831161008257602001926001830284011161008257565b91909160408184031261008257803567ffffffffffffffff811161008257836101499183016100e1565b92602082013567ffffffffffffffff81116100825761016892016100ef565b9091565b60005b83811061017f5750506000910152565b818101518382015260200161016f565b6101b06101b96020936101c3936101a4815190565b80835293849260200190565b9586910161016c565b601f01601f191690565b0190565b90151581526040602082018190526100929291019061018f565b6101f56101ef36600461011f565b91610634565b906100dd61020260405190565b928392836101c7565b6001600160a01b031690565b6102208161020b565b0361008257565b905035906100b082610217565b906020828203126100825761009291610227565b6100929061020b906001600160a01b031682565b61009290610248565b6100929061025c565b9061027890610265565b600052602052604060002090565b600061029661009292600261026e565b610095565b34610082576100dd6100cd6102b1366004610234565b610286565b34610082576102c6366004610077565b6102ce610aa9565b604051005b7fdd8f4b70b0f4393e889bd39128a30628a78b61816a9eb8199759e7a349657e4890565b3461008257610307366004610077565b6100dd6100cd6102d3565b34610082576100dd61032e61032836600461011f565b91610b79565b60405191829182901515815260200190565b80610220565b3561009281610340565b602080825260119082015270496e76616c6964206d73672e76616c756560781b604082015260600190565b1561038257565b60405162461bcd60e51b81528061039b60048201610350565b0390fd5b6020808252602b908201527f466f727761726465723a207369676e617475726520646f6573206e6f74206d6160408201526a1d18da081c995c5d595cdd60aa1b606082015260800190565b156103f157565b60405162461bcd60e51b81528061039b6004820161039f565b3561009281610217565b6100929081565b6100929054610414565b634e487b7160e01b600052601160045260246000fd5b600019811461044a5760010190565b610425565b90600019905b9181191691161790565b6100926100926100929290565b9061047c6100926104839261045f565b825461044f565b9055565b903590601e193682900301821215610082570180359067ffffffffffffffff8211610082576020019136829003831361008257565b90826000939282370152565b90916101c390839080936104bc565b60601b90565b610092906104d7565b6104f26100ac9161020b565b6104dd565b61050890601494936101c3936104c8565b80926104e6565b634e487b7160e01b600052604160045260246000fd5b90601f01601f1916810190811067ffffffffffffffff82111761054757604052565b61050f565b906100b061055960405190565b9283610525565b67ffffffffffffffff811161054757602090601f01601f19160190565b9061058f61058a83610560565b61054c565b918252565b3d156105ae576105a33d61057d565b903d6000602084013e565b606090565b634e487b7160e01b600052601260045260246000fd5b906105d3565b9190565b9081156105de570490565b6105b3565b602080825260179082015276125b9d985b1a5908199bdc9dd85c99081c995c5d595cdd604a1b604082015260600190565b1561061b57565b60405162461bcd60e51b81528061039b600482016105e3565b929160009161067061066b8493610649600090565b50604088019361066561065e61009287610346565b341461037b565b88610b79565b6103ea565b8185016106a06106896106828361040a565b600261026e565b61069a6106958261041b565b61043b565b9061046c565b6106ac6020870161040a565b9560608101966106e06107076106d86106cd6106c78c610346565b97610346565b9460a0810190610487565b92909561040a565b916106fb6106ed60405190565b9384926020840198896104f7565b86810382520382610525565b5193f1610712610594565b926107366105cf6100926107265a94610346565b610730603f61045f565b906105c9565b1115610745576105cf81610614565bfe5b6100929060081c5b60ff1690565b6100929054610747565b6100929061074f565b610092905461075f565b61074f6100926100929290565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b156107d457565b60405162461bcd60e51b81528061039b6004820161077f565b9060ff90610455565b61074f6100926100929260ff1690565b90610816610092610483926107f6565b82546107ed565b9061ff009060081b610455565b151590565b9061083f6100926104839261082a565b825461081d565b6100ac90610772565b6020810192916100b09190610846565b61087061086c6000610755565b1590565b808061094b575b8015610906575b610887906107cd565b8061089c6108956001610772565b6000610806565b6108f5575b6108a9610a0d565b6108af57565b6108ba60008061082f565b7f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024986108e460405190565b806108f060018261084f565b0390a1565b6109016001600061082f565b6108a1565b5061091b61086c61091630610265565b610cc2565b801561087e575061088761092f6000610768565b61094361093c6001610772565b9160ff1690565b14905061087e565b506109566000610768565b61096361093c6001610772565b10610877565b610973600961057d565b682337b93bb0b93232b960b91b602082015290565b610092610969565b61099a600161057d565b603160f81b602082015290565b610092610990565b6100ac9061020b565b909594926100b0946109ea6109f1926109e36080966109dc60a088019c6000890152565b6020870152565b6040850152565b6060830152565b01906109af565b9061047c610a0861048392610092565b610092565b6100b0610a18610988565b610a2a610a23825190565b9160200190565b20610a96610a366109a7565b610a41610a23825190565b2091610a4c30610265565b92610a8a610a5960405190565b948593602085019346917f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f866109b8565b90810382520382610525565b610aa1610a23825190565b2060016109f8565b6100b061085f565b90929192610ac161058a82610560565b9381855281830111610082576100b09160208501906104bc565b610092913691610ab1565b90815260e08101979695909490939092909160208601610b05916109af565b60408501610b12916109af565b6060840152608083015260a082015260c00152565b6020809392610b4461058f6101c39461190160f01b815260020190565b01918252565b634e487b7160e01b600052602160045260246000fd5b60051115610b6a57565b610b4a565b906100b082610b60565b9190610c79610c7f92610b8a600090565b50610a8a610c67610b9b600161041b565b87610c43817fdd8f4b70b0f4393e889bd39128a30628a78b61816a9eb8199759e7a349657e48610a8a610bd96020610bd28561040a565b940161040a565b948d610be760408201610346565b91610c1f610c19610c0e610c09610682610c0360608801610346565b9561040a565b61041b565b9360a0810190610487565b90610adb565b610c2a610a23825190565b2092610c3560405190565b988997602089019788610ae6565b610c4e610a23825190565b2090610c5960405190565b938492602084019283610b27565b610c72610a23825190565b2092610adb565b90610cea565b610c95610c8f6000949394610b6f565b91610b6f565b14610ca1575050600090565b610cb8610cb36000610cbe930161040a565b61020b565b9161020b565b1490565b3b610cd06105cf600061045f565b1190565b61020b6100926100929290565b61009290610cd4565b908051610cfa6105cf604161045f565b03610d1c57610168916020820151906060604084015193015160001a90610d77565b5050610d286000610ce1565b90600290565b6100929061045f565b610d676100b094610d60606094989795610d56608086019a6000870152565b60ff166020850152565b6040830152565b0152565b6040513d6000823e3d90fd5b919291610d8383610d2e565b610da56105cf6fa2a8918ca85bafe22016d0b997e4df60600160ff1b0361045f565b11610e0a57610dc5600093602095610dbc60405190565b94859485610d37565b838052039060015afa15610e0557600051610de06000610ce1565b610de98161020b565b610df28361020b565b14610dfe575090600090565b9160019150565b610d6b565b50505050610e186000610ce1565b9060039056fea264697066735822122063a81f7b3cd5039bbd84ef3e128a1cfea2bdb870167a7f77a562ab967eda468e64736f6c63430008180033