Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 14,045 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Swap And Transfe... | 20403028 | 117 days ago | IN | 0.00000487 ETH | 0.00003933 | ||||
Swap And Transfe... | 19849870 | 195 days ago | IN | 0.00216225 ETH | 0.00011776 | ||||
Swap And Transfe... | 19800198 | 202 days ago | IN | 0.00315794 ETH | 0.00014281 | ||||
Swap And Transfe... | 19743593 | 210 days ago | IN | 0.10221761 ETH | 0.00021998 | ||||
Transfer Token | 19678861 | 219 days ago | IN | 0 ETH | 0.0019915 | ||||
Swap And Transfe... | 19672421 | 220 days ago | IN | 0.03267906 ETH | 0.0016258 | ||||
Swap And Transfe... | 19672240 | 220 days ago | IN | 0.00820867 ETH | 0.00176605 | ||||
Transfer Token | 19669998 | 220 days ago | IN | 0 ETH | 0.00175016 | ||||
Transfer Token | 19669989 | 220 days ago | IN | 0 ETH | 0.00167896 | ||||
Swap And Transfe... | 19669974 | 220 days ago | IN | 0.01644855 ETH | 0.00277567 | ||||
Swap And Transfe... | 19669973 | 220 days ago | IN | 0.01184296 ETH | 0.00281972 | ||||
Transfer Token | 19669972 | 220 days ago | IN | 0 ETH | 0.0017406 | ||||
Swap And Transfe... | 19669963 | 220 days ago | IN | 0.05923321 ETH | 0.00259326 | ||||
Transfer Token | 19669958 | 220 days ago | IN | 0 ETH | 0.00163286 | ||||
Transfer Token | 19669946 | 220 days ago | IN | 0 ETH | 0.0017518 | ||||
Swap And Transfe... | 19669946 | 220 days ago | IN | 0.05919817 ETH | 0.00252177 | ||||
Transfer Token | 19669935 | 220 days ago | IN | 0 ETH | 0.00045675 | ||||
Transfer Token | 19669935 | 220 days ago | IN | 0 ETH | 0.00045675 | ||||
Transfer Token | 19669935 | 220 days ago | IN | 0 ETH | 0.00045675 | ||||
Transfer Token | 19669935 | 220 days ago | IN | 0 ETH | 0.00045675 | ||||
Transfer Token | 19669933 | 220 days ago | IN | 0 ETH | 0.0014851 | ||||
Transfer Token | 19669933 | 220 days ago | IN | 0 ETH | 0.00174999 | ||||
Swap And Transfe... | 19669932 | 220 days ago | IN | 0.06172752 ETH | 0.00188786 | ||||
Swap And Transfe... | 19669866 | 220 days ago | IN | 0.32948594 ETH | 0.00320239 | ||||
Transfer Token | 19669848 | 220 days ago | IN | 0 ETH | 0.00048888 |
Latest 25 internal transactions (View All)
Advanced mode:
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
19672421 | 220 days ago | 0.03267906 ETH | ||||
19672240 | 220 days ago | 0.00820867 ETH | ||||
19669974 | 220 days ago | 0.01644855 ETH | ||||
19669973 | 220 days ago | 0.01184296 ETH | ||||
19669963 | 220 days ago | 0.05923321 ETH | ||||
19669946 | 220 days ago | 0.05919817 ETH | ||||
19669932 | 220 days ago | 0.06172752 ETH | ||||
19669866 | 220 days ago | 0.32948594 ETH | ||||
19669822 | 220 days ago | 0.55594784 ETH | ||||
19669821 | 220 days ago | 0.11881785 ETH | ||||
19669818 | 220 days ago | 0.07624037 ETH | ||||
19669783 | 220 days ago | 0.00336905 ETH | ||||
19669770 | 220 days ago | 0.15031776 ETH | ||||
19669767 | 220 days ago | 0.00099214 ETH | ||||
19669745 | 220 days ago | 0.09869675 ETH | ||||
19669741 | 220 days ago | 0.03303753 ETH | ||||
19669728 | 220 days ago | 0.00597347 ETH | ||||
19669703 | 220 days ago | 0.00352645 ETH | ||||
19669697 | 220 days ago | 0.01494559 ETH | ||||
19669695 | 220 days ago | 0.05035021 ETH | ||||
19669651 | 220 days ago | 0.01945013 ETH | ||||
19669591 | 220 days ago | 0.00330222 ETH | ||||
19669486 | 220 days ago | 0.21401206 ETH | ||||
19669465 | 220 days ago | 0.06297179 ETH | ||||
19669454 | 220 days ago | 0.09060651 ETH |
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Name:
Transfers
Compiler Version
v0.8.17+commit.8df45f5f
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.17; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/Context.sol"; import "@uniswap/universal-router/contracts/interfaces/IUniversalRouter.sol"; import {Commands as UniswapCommands} from "@uniswap/universal-router/contracts/libraries/Commands.sol"; import {Constants as UniswapConstants} from "@uniswap/universal-router/contracts/libraries/Constants.sol"; import "../interfaces/IWrappedNativeCurrency.sol"; import "../interfaces/ITransfers.sol"; import "../utils/Sweepable.sol"; import "../permit2/src/Permit2.sol"; // Uniswap error selectors, used to surface information when swaps fail // Pulled from @uniswap/universal-router/out/V3SwapRouter.sol/V3SwapRouter.json after compiling with forge bytes32 constant V3_INVALID_SWAP = keccak256(hex"316cf0eb"); bytes32 constant V3_TOO_LITTLE_RECEIVED = keccak256(hex"39d35496"); bytes32 constant V3_TOO_MUCH_REQUESTED = keccak256(hex"739dbe52"); bytes32 constant V3_INVALID_AMOUNT_OUT = keccak256(hex"d4e0248e"); bytes32 constant V3_INVALID_CALLER = keccak256(hex"32b13d91"); // @inheritdoc ITransfers contract Transfers is Context, Ownable, Pausable, ReentrancyGuard, Sweepable, ITransfers { using SafeERC20 for IERC20; using SafeERC20 for IWrappedNativeCurrency; // @dev Map of operator addresses and fee destinations. mapping(address => address) private feeDestinations; // @dev Map of operator addresses to a map of transfer intent ids that have been processed mapping(address => mapping(bytes16 => bool)) private processedTransferIntents; // @dev Represents native token of a chain (e.g. ETH or MATIC) address private immutable NATIVE_CURRENCY = address(0); // @dev Uniswap on-chain contract IUniversalRouter private immutable uniswap; // @dev permit2 SignatureTransfer contract address. Used for tranferring tokens with a signature instead of a full transaction. // See: https://github.com/Uniswap/permit2 Permit2 public immutable permit2; // @dev Canonical wrapped token for this chain. e.g. (wETH or wMATIC). IWrappedNativeCurrency private immutable wrappedNativeCurrency; // @param _uniswap The address of the Uniswap V3 swap router // @param _wrappedNativeCurrency The address of the wrapped token for this chain constructor( IUniversalRouter _uniswap, Permit2 _permit2, address _initialOperator, address _initialFeeDestination, IWrappedNativeCurrency _wrappedNativeCurrency ) { require( address(_uniswap) != address(0) && address(_permit2) != address(0) && address(_wrappedNativeCurrency) != address(0) && _initialOperator != address(0) && _initialFeeDestination != address(0), "invalid constructor parameters" ); uniswap = _uniswap; permit2 = _permit2; wrappedNativeCurrency = _wrappedNativeCurrency; // Sets an initial operator to enable immediate payment processing feeDestinations[_initialOperator] = _initialFeeDestination; } // @dev Raises errors if the intent is invalid // @param _intent The intent to validate modifier validIntent(TransferIntent calldata _intent) { bytes32 hash = keccak256( abi.encodePacked( _intent.recipientAmount, _intent.deadline, _intent.recipient, _intent.recipientCurrency, _intent.refundDestination, _intent.feeAmount, _intent.id, _intent.operator, block.chainid, _msgSender(), address(this) ) ); bytes32 signedMessageHash; if (_intent.prefix.length == 0) { // Use 'default' message prefix. signedMessageHash = ECDSA.toEthSignedMessageHash(hash); } else { // Use custom message prefix. signedMessageHash = keccak256(abi.encodePacked(_intent.prefix, hash)); } address signer = ECDSA.recover(signedMessageHash, _intent.signature); if (signer != _intent.operator) { revert InvalidSignature(); } if (_intent.deadline < block.timestamp) { revert ExpiredIntent(); } if (_intent.recipient == address(0)) { revert NullRecipient(); } if (processedTransferIntents[_intent.operator][_intent.id]) { revert AlreadyProcessed(); } _; } // @dev Raises an error if the operator in the transfer intent is not registered. // @param _intent The intent to validate modifier operatorIsRegistered(TransferIntent calldata _intent) { if (feeDestinations[_intent.operator] == address(0)) revert OperatorNotRegistered(); _; } modifier exactValueSent(TransferIntent calldata _intent) { // Make sure the correct value was sent uint256 neededAmount = _intent.recipientAmount + _intent.feeAmount; if (msg.value > neededAmount) { revert InvalidNativeAmount(int256(msg.value - neededAmount)); } else if (msg.value < neededAmount) { revert InvalidNativeAmount(-int256(neededAmount - msg.value)); } _; } // @inheritdoc ITransfers function transferNative(TransferIntent calldata _intent) external payable override nonReentrant whenNotPaused validIntent(_intent) operatorIsRegistered(_intent) exactValueSent(_intent) { // Make sure the recipient wants the native currency if (_intent.recipientCurrency != NATIVE_CURRENCY) revert IncorrectCurrency(NATIVE_CURRENCY); if (msg.value > 0) { // Complete the payment transferFundsToDestinations(_intent); } succeedPayment(_intent, msg.value, NATIVE_CURRENCY); } // @inheritdoc ITransfers function transferToken( TransferIntent calldata _intent, Permit2SignatureTransferData calldata _signatureTransferData ) external override nonReentrant whenNotPaused validIntent(_intent) operatorIsRegistered(_intent) { // Make sure the recipient wants a token and the payer is sending it if ( _intent.recipientCurrency == NATIVE_CURRENCY || _signatureTransferData.permit.permitted.token != _intent.recipientCurrency ) { revert IncorrectCurrency(_signatureTransferData.permit.permitted.token); } // Make sure the payer has enough of the payment token IERC20 erc20 = IERC20(_intent.recipientCurrency); uint256 neededAmount = _intent.recipientAmount + _intent.feeAmount; uint256 payerBalance = erc20.balanceOf(_msgSender()); if (payerBalance < neededAmount) { revert InsufficientBalance(neededAmount - payerBalance); } if (neededAmount > 0) { // Make sure the payer is transferring the right amount to this contract if ( _signatureTransferData.transferDetails.to != address(this) || _signatureTransferData.transferDetails.requestedAmount != neededAmount ) { revert InvalidTransferDetails(); } // Record our balance before (most likely zero) to detect fee-on-transfer tokens uint256 balanceBefore = erc20.balanceOf(address(this)); // Transfer the payment token to this contract permit2.permitTransferFrom( _signatureTransferData.permit, _signatureTransferData.transferDetails, _msgSender(), _signatureTransferData.signature ); // Make sure this is not a fee-on-transfer token revertIfInexactTransfer(neededAmount, balanceBefore, erc20, address(this)); // Complete the payment transferFundsToDestinations(_intent); } succeedPayment(_intent, neededAmount, _intent.recipientCurrency); } // @inheritdoc ITransfers function transferTokenPreApproved(TransferIntent calldata _intent) external override nonReentrant whenNotPaused validIntent(_intent) operatorIsRegistered(_intent) { // Make sure the recipient wants a token if (_intent.recipientCurrency == NATIVE_CURRENCY) { revert IncorrectCurrency(_intent.recipientCurrency); } // Make sure the payer has enough of the payment token IERC20 erc20 = IERC20(_intent.recipientCurrency); uint256 neededAmount = _intent.recipientAmount + _intent.feeAmount; uint256 payerBalance = erc20.balanceOf(_msgSender()); if (payerBalance < neededAmount) { revert InsufficientBalance(neededAmount - payerBalance); } // Make sure the payer has approved this contract for a sufficient transfer uint256 allowance = erc20.allowance(_msgSender(), address(this)); if (allowance < neededAmount) { revert InsufficientAllowance(neededAmount - allowance); } if (neededAmount > 0) { // Record our balance before (most likely zero) to detect fee-on-transfer tokens uint256 balanceBefore = erc20.balanceOf(address(this)); // Transfer the payment token to this contract erc20.safeTransferFrom(_msgSender(), address(this), neededAmount); // Make sure this is not a fee-on-transfer token revertIfInexactTransfer(neededAmount, balanceBefore, erc20, address(this)); // Complete the payment transferFundsToDestinations(_intent); } succeedPayment(_intent, neededAmount, _intent.recipientCurrency); } // @inheritdoc ITransfers // @dev Wraps msg.value into wrapped token and transfers to recipient. function wrapAndTransfer(TransferIntent calldata _intent) external payable override nonReentrant whenNotPaused validIntent(_intent) operatorIsRegistered(_intent) exactValueSent(_intent) { // Make sure the recipient wants to receive the wrapped native currency if (_intent.recipientCurrency != address(wrappedNativeCurrency)) { revert IncorrectCurrency(NATIVE_CURRENCY); } if (msg.value > 0) { // Wrap the sent native currency wrappedNativeCurrency.deposit{value: msg.value}(); // Complete the payment transferFundsToDestinations(_intent); } succeedPayment(_intent, msg.value, NATIVE_CURRENCY); } // @inheritdoc ITransfers // @dev Requires _msgSender() to have approved this contract to use the wrapped token. // @dev Unwraps into native token and transfers native token (e.g. ETH) to _intent.recipient. function unwrapAndTransfer( TransferIntent calldata _intent, Permit2SignatureTransferData calldata _signatureTransferData ) external override nonReentrant whenNotPaused validIntent(_intent) operatorIsRegistered(_intent) { // Make sure the recipient wants the native currency and that the payer is // sending the wrapped native currency if ( _intent.recipientCurrency != NATIVE_CURRENCY || _signatureTransferData.permit.permitted.token != address(wrappedNativeCurrency) ) { revert IncorrectCurrency(_signatureTransferData.permit.permitted.token); } // Make sure the payer has enough of the wrapped native currency uint256 neededAmount = _intent.recipientAmount + _intent.feeAmount; uint256 payerBalance = wrappedNativeCurrency.balanceOf(_msgSender()); if (payerBalance < neededAmount) { revert InsufficientBalance(neededAmount - payerBalance); } if (neededAmount > 0) { // Make sure the payer is transferring the right amount of the wrapped native currency to the contract if ( _signatureTransferData.transferDetails.to != address(this) || _signatureTransferData.transferDetails.requestedAmount != neededAmount ) { revert InvalidTransferDetails(); } // Transfer the payer's wrapped native currency to the contract permit2.permitTransferFrom( _signatureTransferData.permit, _signatureTransferData.transferDetails, _msgSender(), _signatureTransferData.signature ); // Complete the payment unwrapAndTransferFundsToDestinations(_intent); } succeedPayment(_intent, neededAmount, address(wrappedNativeCurrency)); } // @inheritdoc ITransfers // @dev Requires _msgSender() to have approved this contract to use the wrapped token. // @dev Unwraps into native token and transfers native token (e.g. ETH) to _intent.recipient. function unwrapAndTransferPreApproved(TransferIntent calldata _intent) external override nonReentrant whenNotPaused validIntent(_intent) operatorIsRegistered(_intent) { // Make sure the recipient wants the native currency if (_intent.recipientCurrency != NATIVE_CURRENCY) { revert IncorrectCurrency(address(wrappedNativeCurrency)); } // Make sure the payer has enough of the wrapped native currency uint256 neededAmount = _intent.recipientAmount + _intent.feeAmount; uint256 payerBalance = wrappedNativeCurrency.balanceOf(_msgSender()); if (payerBalance < neededAmount) { revert InsufficientBalance(neededAmount - payerBalance); } // Make sure the payer has approved this contract for a sufficient transfer uint256 allowance = wrappedNativeCurrency.allowance(_msgSender(), address(this)); if (allowance < neededAmount) { revert InsufficientAllowance(neededAmount - allowance); } if (neededAmount > 0) { // Transfer the payer's wrapped native currency to the contract wrappedNativeCurrency.safeTransferFrom(_msgSender(), address(this), neededAmount); // Complete the payment unwrapAndTransferFundsToDestinations(_intent); } succeedPayment(_intent, neededAmount, address(wrappedNativeCurrency)); } /*------------------------------------------------------------------*\ | Swap and Transfer \*------------------------------------------------------------------*/ // @inheritdoc ITransfers function swapAndTransferUniswapV3Native(TransferIntent calldata _intent, uint24 poolFeesTier) external payable override nonReentrant whenNotPaused validIntent(_intent) operatorIsRegistered(_intent) { // Make sure a swap is actually required, otherwise the payer should use `wrapAndTransfer` or `transferNative` if ( _intent.recipientCurrency == NATIVE_CURRENCY || _intent.recipientCurrency == address(wrappedNativeCurrency) ) { revert IncorrectCurrency(NATIVE_CURRENCY); } uint256 amountSwapped = 0; if (msg.value > 0) { // Perform the swap amountSwapped = swapTokens(_intent, address(wrappedNativeCurrency), msg.value, poolFeesTier); } // Complete the payment succeedPayment(_intent, amountSwapped, NATIVE_CURRENCY); } // @inheritdoc ITransfers function swapAndTransferUniswapV3Token( TransferIntent calldata _intent, Permit2SignatureTransferData calldata _signatureTransferData, uint24 poolFeesTier ) external override nonReentrant whenNotPaused validIntent(_intent) operatorIsRegistered(_intent) { IERC20 tokenIn = IERC20(_signatureTransferData.permit.permitted.token); // Make sure a swap is actually required if (address(tokenIn) == _intent.recipientCurrency) { revert IncorrectCurrency(address(tokenIn)); } // Make sure the transfer is to this contract if (_signatureTransferData.transferDetails.to != address(this)) { revert InvalidTransferDetails(); } uint256 maxWillingToPay = _signatureTransferData.transferDetails.requestedAmount; uint256 amountSwapped = 0; if (maxWillingToPay > 0) { // Record our balance before (most likely zero) to detect fee-on-transfer tokens uint256 balanceBefore = tokenIn.balanceOf(address(this)); // Transfer the payer's tokens to this contract permit2.permitTransferFrom( _signatureTransferData.permit, _signatureTransferData.transferDetails, _msgSender(), _signatureTransferData.signature ); // Make sure this is not a fee-on-transfer token revertIfInexactTransfer(maxWillingToPay, balanceBefore, tokenIn, address(this)); // Perform the swap amountSwapped = swapTokens(_intent, address(tokenIn), maxWillingToPay, poolFeesTier); } // Complete the payment succeedPayment(_intent, amountSwapped, address(tokenIn)); } // @inheritdoc ITransfers function swapAndTransferUniswapV3TokenPreApproved( TransferIntent calldata _intent, address _tokenIn, uint256 maxWillingToPay, uint24 poolFeesTier ) external override nonReentrant whenNotPaused validIntent(_intent) operatorIsRegistered(_intent) { IERC20 tokenIn = IERC20(_tokenIn); // Make sure a swap is actually required if (address(tokenIn) == _intent.recipientCurrency) { revert IncorrectCurrency(address(tokenIn)); } // Make sure the payer has enough of the payment token uint256 payerBalance = tokenIn.balanceOf(_msgSender()); if (payerBalance < maxWillingToPay) { revert InsufficientBalance(maxWillingToPay - payerBalance); } // Make sure the payer has approved this contract for a sufficient transfer uint256 allowance = tokenIn.allowance(_msgSender(), address(this)); if (allowance < maxWillingToPay) { revert InsufficientAllowance(maxWillingToPay - allowance); } uint256 amountSwapped = 0; if (maxWillingToPay > 0) { // Record our balance before (most likely zero) to detect fee-on-transfer tokens uint256 balanceBefore = tokenIn.balanceOf(address(this)); // Transfer the payment token to this contract tokenIn.safeTransferFrom(_msgSender(), address(this), maxWillingToPay); // Make sure this is not a fee-on-transfer token revertIfInexactTransfer(maxWillingToPay, balanceBefore, tokenIn, address(this)); // Perform the swap amountSwapped = swapTokens(_intent, address(tokenIn), maxWillingToPay, poolFeesTier); } // Complete the payment succeedPayment(_intent, amountSwapped, address(tokenIn)); } function swapTokens( TransferIntent calldata _intent, address tokenIn, uint256 maxAmountWillingToPay, uint24 poolFeesTier ) internal returns (uint256) { // If the seller is requesting native currency, we need to swap for the wrapped // version of that currency first, then unwrap it and send it to the seller. address tokenOut = _intent.recipientCurrency == NATIVE_CURRENCY ? address(wrappedNativeCurrency) : _intent.recipientCurrency; // Figure out the total output needed from the swap uint256 neededAmount = _intent.recipientAmount + _intent.feeAmount; // Parameters and shared inputs for the universal router bytes memory uniswap_commands; bytes[] memory uniswap_inputs; bytes memory swapPath = abi.encodePacked(tokenOut, poolFeesTier, tokenIn); bytes memory swapParams = abi.encode(address(uniswap), neededAmount, maxAmountWillingToPay, swapPath, false); bytes memory transferToRecipient = abi.encode( _intent.recipientCurrency, _intent.recipient, _intent.recipientAmount ); bytes memory collectFees = abi.encode( _intent.recipientCurrency, feeDestinations[_intent.operator], _intent.feeAmount ); // The payer's and router's balances before this transaction, used to calculate the amount consumed by the swap uint256 payerBalanceBefore; uint256 routerBalanceBefore; // The fee and recipient balances of the output token, to detect fee-on-transfer tokens uint256 feeBalanceBefore; uint256 recipientBalanceBefore; // Populate the commands and inputs for the universal router if (msg.value > 0) { payerBalanceBefore = _msgSender().balance + msg.value; routerBalanceBefore = address(uniswap).balance + IERC20(wrappedNativeCurrency).balanceOf(address(uniswap)); feeBalanceBefore = IERC20(tokenOut).balanceOf(feeDestinations[_intent.operator]); recipientBalanceBefore = IERC20(tokenOut).balanceOf(_intent.recipient); // Paying with ETH, merchant wants tokenOut uniswap_commands = abi.encodePacked( bytes1(uint8(UniswapCommands.WRAP_ETH)), bytes1(uint8(UniswapCommands.V3_SWAP_EXACT_OUT)), bytes1(uint8(UniswapCommands.TRANSFER)), bytes1(uint8(UniswapCommands.TRANSFER)), bytes1(uint8(UniswapCommands.UNWRAP_WETH)), // for the payer refund bytes1(uint8(UniswapCommands.SWEEP)) ); uniswap_inputs = new bytes[](6); uniswap_inputs[0] = abi.encode(address(uniswap), msg.value); uniswap_inputs[1] = swapParams; uniswap_inputs[2] = collectFees; uniswap_inputs[3] = transferToRecipient; uniswap_inputs[4] = abi.encode(address(uniswap), 0); uniswap_inputs[5] = abi.encode(UniswapConstants.ETH, _msgSender(), 0); } else { // No need to check fee/recipient balance of the output token before, // since we know WETH and ETH are not fee-on-transfer payerBalanceBefore = IERC20(tokenIn).balanceOf(_msgSender()) + maxAmountWillingToPay; routerBalanceBefore = IERC20(tokenIn).balanceOf(address(uniswap)); if (_intent.recipientCurrency == NATIVE_CURRENCY) { // Paying with token, merchant wants ETH uniswap_commands = abi.encodePacked( bytes1(uint8(UniswapCommands.V3_SWAP_EXACT_OUT)), bytes1(uint8(UniswapCommands.UNWRAP_WETH)), // for the recipient bytes1(uint8(UniswapCommands.TRANSFER)), bytes1(uint8(UniswapCommands.TRANSFER)), bytes1(uint8(UniswapCommands.SWEEP)) ); uniswap_inputs = new bytes[](5); uniswap_inputs[0] = swapParams; uniswap_inputs[1] = abi.encode(address(uniswap), neededAmount); uniswap_inputs[2] = collectFees; uniswap_inputs[3] = transferToRecipient; uniswap_inputs[4] = abi.encode(tokenIn, _msgSender(), 0); } else { feeBalanceBefore = IERC20(tokenOut).balanceOf(feeDestinations[_intent.operator]); recipientBalanceBefore = IERC20(tokenOut).balanceOf(_intent.recipient); // Paying with token, merchant wants tokenOut uniswap_commands = abi.encodePacked( bytes1(uint8(UniswapCommands.V3_SWAP_EXACT_OUT)), bytes1(uint8(UniswapCommands.TRANSFER)), bytes1(uint8(UniswapCommands.TRANSFER)), bytes1(uint8(UniswapCommands.SWEEP)) ); uniswap_inputs = new bytes[](4); uniswap_inputs[0] = swapParams; uniswap_inputs[1] = collectFees; uniswap_inputs[2] = transferToRecipient; uniswap_inputs[3] = abi.encode(tokenIn, _msgSender(), 0); } // Send the input tokens to Uniswap for the swap IERC20(tokenIn).safeTransfer(address(uniswap), maxAmountWillingToPay); } // Perform the swap try uniswap.execute{value: msg.value}(uniswap_commands, uniswap_inputs, _intent.deadline) { // Disallow fee-on-transfer tokens as the output token, since we want to guarantee exact settlement if (_intent.recipientCurrency != NATIVE_CURRENCY) { revertIfInexactTransfer( _intent.feeAmount, feeBalanceBefore, IERC20(tokenOut), feeDestinations[_intent.operator] ); revertIfInexactTransfer( _intent.recipientAmount, recipientBalanceBefore, IERC20(tokenOut), _intent.recipient ); } // Calculate and return how much of the input token was consumed by the swap. The router // could have had a balance of the input token prior to this transaction, which would have // been swept to the payer. This amount, if any, must be accounted for so we don't underflow // and assume that negative amount of the input token was consumed by the swap. uint256 payerBalanceAfter; uint256 routerBalanceAfter; if (msg.value > 0) { payerBalanceAfter = _msgSender().balance; routerBalanceAfter = address(uniswap).balance + IERC20(wrappedNativeCurrency).balanceOf(address(uniswap)); } else { payerBalanceAfter = IERC20(tokenIn).balanceOf(_msgSender()); routerBalanceAfter = IERC20(tokenIn).balanceOf(address(uniswap)); } return (payerBalanceBefore + routerBalanceBefore) - (payerBalanceAfter + routerBalanceAfter); } catch Error(string memory reason) { revert SwapFailedString(reason); } catch (bytes memory reason) { bytes32 reasonHash = keccak256(reason); if (reasonHash == V3_INVALID_SWAP) { revert SwapFailedString("V3InvalidSwap"); } else if (reasonHash == V3_TOO_LITTLE_RECEIVED) { revert SwapFailedString("V3TooLittleReceived"); } else if (reasonHash == V3_TOO_MUCH_REQUESTED) { revert SwapFailedString("V3TooMuchRequested"); } else if (reasonHash == V3_INVALID_AMOUNT_OUT) { revert SwapFailedString("V3InvalidAmountOut"); } else if (reasonHash == V3_INVALID_CALLER) { revert SwapFailedString("V3InvalidCaller"); } else { revert SwapFailedBytes(reason); } } } function transferFundsToDestinations(TransferIntent calldata _intent) internal { if (_intent.recipientCurrency == NATIVE_CURRENCY) { if (_intent.recipientAmount > 0) { sendNative(_intent.recipient, _intent.recipientAmount, false); } if (_intent.feeAmount > 0) { sendNative(feeDestinations[_intent.operator], _intent.feeAmount, false); } } else { IERC20 requestedCurrency = IERC20(_intent.recipientCurrency); if (_intent.recipientAmount > 0) { requestedCurrency.safeTransfer(_intent.recipient, _intent.recipientAmount); } if (_intent.feeAmount > 0) { requestedCurrency.safeTransfer(feeDestinations[_intent.operator], _intent.feeAmount); } } } function unwrapAndTransferFundsToDestinations(TransferIntent calldata _intent) internal { uint256 amountToWithdraw = _intent.recipientAmount + _intent.feeAmount; if (_intent.recipientCurrency == NATIVE_CURRENCY && amountToWithdraw > 0) { wrappedNativeCurrency.withdraw(amountToWithdraw); } transferFundsToDestinations(_intent); } function succeedPayment( TransferIntent calldata _intent, uint256 spentAmount, address spentCurrency ) internal { processedTransferIntents[_intent.operator][_intent.id] = true; emit Transferred(_intent.operator, _intent.id, _intent.recipient, _msgSender(), spentAmount, spentCurrency); } function sendNative( address destination, uint256 amount, bool isRefund ) internal { (bool success, bytes memory data) = payable(destination).call{value: amount}(""); if (!success) { revert NativeTransferFailed(destination, amount, isRefund, data); } } function revertIfInexactTransfer( uint256 expectedDiff, uint256 balanceBefore, IERC20 token, address target ) internal view { uint256 balanceAfter = token.balanceOf(target); if (balanceAfter - balanceBefore != expectedDiff) { revert InexactTransfer(); } } // @notice Registers an operator with a custom fee destination. function registerOperatorWithFeeDestination(address _feeDestination) external { feeDestinations[_msgSender()] = _feeDestination; emit OperatorRegistered(_msgSender(), _feeDestination); } // @notice Registers an operator, using the operator's address as the fee destination. function registerOperator() external { feeDestinations[_msgSender()] = _msgSender(); emit OperatorRegistered(_msgSender(), _msgSender()); } function unregisterOperator() external { delete feeDestinations[_msgSender()]; emit OperatorUnregistered(_msgSender()); } // @notice Allows the owner to pause the contract. function pause() external onlyOwner { _pause(); } // @notice Allows the owner to un-pause the contract. function unpause() external onlyOwner { _unpause(); } // @dev Required to be able to unwrap WETH receive() external payable { require(msg.sender == address(wrappedNativeCurrency), "only payable for unwrapping"); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract Pausable is Context { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ constructor() { _paused = false; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { _requireNotPaused(); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { _requirePaused(); _; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Throws if the contract is paused. */ function _requireNotPaused() internal view virtual { require(!paused(), "Pausable: paused"); } /** * @dev Throws if the contract is not paused. */ function _requirePaused() internal view virtual { require(paused(), "Pausable: not paused"); } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev _Available since v3.1._ */ interface IERC1155Receiver is IERC165 { /** * @dev Handles the receipt of a single ERC1155 token type. This function is * called at the end of a `safeTransferFrom` after the balance has been updated. * * NOTE: To accept the transfer, this must return * `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` * (i.e. 0xf23a6e61, or its own function selector). * * @param operator The address which initiated the transfer (i.e. msg.sender) * @param from The address which previously owned the token * @param id The ID of the token being transferred * @param value The amount of tokens being transferred * @param data Additional data with no specified format * @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed */ function onERC1155Received( address operator, address from, uint256 id, uint256 value, bytes calldata data ) external returns (bytes4); /** * @dev Handles the receipt of a multiple ERC1155 token types. This function * is called at the end of a `safeBatchTransferFrom` after the balances have * been updated. * * NOTE: To accept the transfer(s), this must return * `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` * (i.e. 0xbc197c81, or its own function selector). * * @param operator The address which initiated the batch transfer (i.e. msg.sender) * @param from The address which previously owned the token * @param ids An array containing ids of each token being transferred (order and length must match values array) * @param values An array containing amounts of each token being transferred (order and length must match ids array) * @param data Additional data with no specified format * @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed */ function onERC1155BatchReceived( address operator, address from, uint256[] calldata ids, uint256[] calldata values, bytes calldata data ) external returns (bytes4); }
// 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 v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/draft-IERC20Permit.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20 token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol) pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "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"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(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) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(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) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason 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 { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_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) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @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] = _HEX_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.7.3) (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 } 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"); } else if (error == RecoverError.InvalidSignatureV) { revert("ECDSA: invalid signature 'v' 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 (v != 27 && v != 28) { return (address(0), RecoverError.InvalidSignatureV); } // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature); } return (signer, RecoverError.NoError); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, v, r, s); _throwError(error); return recovered; } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) { // 32 is the length in bytes of hash, // enforced by the type signature above return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)); } /** * @dev Returns an Ethereum Signed Message, created from `s`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s)); } /** * @dev Returns an Ethereum Signed Typed Data, created from a * `domainSeparator` and a `structHash`. This produces hash corresponding * to the one signed with the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] * JSON-RPC method as part of EIP-712. * * See {recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.15; import {ERC20} from 'solmate/src/tokens/ERC20.sol'; /// @title LooksRare Rewards Collector /// @notice Implements a permissionless call to fetch LooksRare rewards earned by Universal Router users /// and transfers them to an external rewards distributor contract interface IRewardsCollector { /// @notice Fetches users' LooksRare rewards and sends them to the distributor contract /// @param looksRareClaim The data required by LooksRare to claim reward tokens function collectRewards(bytes calldata looksRareClaim) external; }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.17; import {IERC721Receiver} from '@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol'; import {IERC1155Receiver} from '@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol'; import {IRewardsCollector} from './IRewardsCollector.sol'; interface IUniversalRouter is IRewardsCollector, IERC721Receiver, IERC1155Receiver { /// @notice Thrown when a required command has failed error ExecutionFailed(uint256 commandIndex, bytes message); /// @notice Thrown when attempting to send ETH directly to the contract error ETHNotAccepted(); /// @notice Thrown when executing commands with an expired deadline error TransactionDeadlinePassed(); /// @notice Thrown when attempting to execute commands and an incorrect number of inputs are provided error LengthMismatch(); /// @notice Executes encoded commands along with provided inputs. Reverts if deadline has expired. /// @param commands A set of concatenated commands, each 1 byte in length /// @param inputs An array of byte strings containing abi encoded inputs for each command /// @param deadline The deadline by which the transaction must be executed function execute(bytes calldata commands, bytes[] calldata inputs, uint256 deadline) external payable; }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.4; import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol'; /// @title Interface for WETH9 interface IWETH9 is IERC20 { /// @notice Deposit ether to get wrapped ether function deposit() external payable; /// @notice Withdraw wrapped ether to get ether function withdraw(uint256) external; }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.17; /// @title Commands /// @notice Command Flags used to decode commands library Commands { // Masks to extract certain bits of commands bytes1 internal constant FLAG_ALLOW_REVERT = 0x80; bytes1 internal constant COMMAND_TYPE_MASK = 0x3f; // Command Types. Maximum supported command at this moment is 0x3f. // Command Types where value<0x08, executed in the first nested-if block uint256 constant V3_SWAP_EXACT_IN = 0x00; uint256 constant V3_SWAP_EXACT_OUT = 0x01; uint256 constant PERMIT2_TRANSFER_FROM = 0x02; uint256 constant PERMIT2_PERMIT_BATCH = 0x03; uint256 constant SWEEP = 0x04; uint256 constant TRANSFER = 0x05; uint256 constant PAY_PORTION = 0x06; // COMMAND_PLACEHOLDER = 0x07; // The commands are executed in nested if blocks to minimise gas consumption // The following constant defines one of the boundaries where the if blocks split commands uint256 constant FIRST_IF_BOUNDARY = 0x08; // Command Types where 0x08<=value<=0x0f, executed in the second nested-if block uint256 constant V2_SWAP_EXACT_IN = 0x08; uint256 constant V2_SWAP_EXACT_OUT = 0x09; uint256 constant PERMIT2_PERMIT = 0x0a; uint256 constant WRAP_ETH = 0x0b; uint256 constant UNWRAP_WETH = 0x0c; uint256 constant PERMIT2_TRANSFER_FROM_BATCH = 0x0d; uint256 constant BALANCE_CHECK_ERC20 = 0x0e; // COMMAND_PLACEHOLDER = 0x0f; // The commands are executed in nested if blocks to minimise gas consumption // The following constant defines one of the boundaries where the if blocks split commands uint256 constant SECOND_IF_BOUNDARY = 0x10; // Command Types where 0x10<=value<0x18, executed in the third nested-if block uint256 constant SEAPORT_V1_5 = 0x10; uint256 constant LOOKS_RARE_V2 = 0x11; uint256 constant NFTX = 0x12; uint256 constant CRYPTOPUNKS = 0x13; // 0x14; uint256 constant OWNER_CHECK_721 = 0x15; uint256 constant OWNER_CHECK_1155 = 0x16; uint256 constant SWEEP_ERC721 = 0x17; // The commands are executed in nested if blocks to minimise gas consumption // The following constant defines one of the boundaries where the if blocks split commands uint256 constant THIRD_IF_BOUNDARY = 0x18; // Command Types where 0x18<=value<=0x1f, executed in the final nested-if block uint256 constant X2Y2_721 = 0x18; uint256 constant SUDOSWAP = 0x19; uint256 constant NFT20 = 0x1a; uint256 constant X2Y2_1155 = 0x1b; uint256 constant FOUNDATION = 0x1c; uint256 constant SWEEP_ERC1155 = 0x1d; uint256 constant ELEMENT_MARKET = 0x1e; // COMMAND_PLACEHOLDER = 0x1f; // The commands are executed in nested if blocks to minimise gas consumption // The following constant defines one of the boundaries where the if blocks split commands uint256 constant FOURTH_IF_BOUNDARY = 0x20; // Command Types where 0x20<=value uint256 constant SEAPORT_V1_4 = 0x20; uint256 constant EXECUTE_SUB_PLAN = 0x21; uint256 constant APPROVE_ERC20 = 0x22; uint256 constant WRAP_STETH = 0x23; uint256 constant UNWRAP_STETH = 0x24; // COMMAND_PLACEHOLDER for 0x25 to 0x3f (all unused) }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.17; import {IWETH9} from '../interfaces/external/IWETH9.sol'; /// @title Constant state /// @notice Constant state used by the Universal Router library Constants { /// @dev Used for identifying cases when this contract's balance of a token is to be used as an input /// This value is equivalent to 1<<255, i.e. a singular 1 in the most significant bit. uint256 internal constant CONTRACT_BALANCE = 0x8000000000000000000000000000000000000000000000000000000000000000; /// @dev Used for identifying cases when a v2 pair has already received input tokens uint256 internal constant ALREADY_PAID = 0; /// @dev Used as a flag for identifying the transfer of ETH instead of a token address internal constant ETH = address(0); /// @dev Used as a flag for identifying that msg.sender should be used, saves gas by sending more 0 bytes address internal constant MSG_SENDER = address(1); /// @dev Used as a flag for identifying address(this) should be used, saves gas by sending more 0 bytes address internal constant ADDRESS_THIS = address(2); /// @dev The length of the bytes encoded address uint256 internal constant ADDR_SIZE = 20; /// @dev The length of the bytes encoded fee uint256 internal constant V3_FEE_SIZE = 3; /// @dev The offset of a single token address (20) and pool fee (3) uint256 internal constant NEXT_V3_POOL_OFFSET = ADDR_SIZE + V3_FEE_SIZE; /// @dev The offset of an encoded pool key /// Token (20) + Fee (3) + Token (20) = 43 uint256 internal constant V3_POP_OFFSET = NEXT_V3_POOL_OFFSET + ADDR_SIZE; /// @dev The minimum length of an encoding that contains 2 or more pools uint256 internal constant MULTIPLE_V3_POOLS_MIN_LENGTH = V3_POP_OFFSET + NEXT_V3_POOL_OFFSET; }
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.17; import "../permit2/src/interfaces/ISignatureTransfer.sol"; // @notice Description of the transfer // @member recipientAmount Amount of currency to transfer // @member deadline The timestamp by when the transfer must be in a block. // @member chainId The chain which the transfer must occur on. // @member recipient The address which will receive the funds. // @member recipientCurrency The currency address that amount is priced in. // @member refundDestination The address which will receive any refunds. If blank, this will be msg.sender. // @member feeAmount The fee value (in currency) to send to the operator. // @member id An ID which can be used to track payments. // @member operator The address of the operator (who created and signed the intent). // @member signature A hash of all the other struct properties signed by the operator. // @member prefix An alternate signature prefix to use instead of the standard EIP-191 "\x19Ethereum Signed Message:\n" // @dev signature=keccak256(encodePacked(...allPropsInOrderExceptSignatureAndPrefix, chainId, _msgSender(), address(transfersContract)) struct TransferIntent { uint256 recipientAmount; uint256 deadline; address payable recipient; address recipientCurrency; address refundDestination; uint256 feeAmount; bytes16 id; address operator; bytes signature; bytes prefix; } struct Permit2SignatureTransferData { ISignatureTransfer.PermitTransferFrom permit; ISignatureTransfer.SignatureTransferDetails transferDetails; bytes signature; } // @title Transfers Contract // @notice Functions for making checked transfers between accounts interface ITransfers { // @notice Emitted when a transfer is completed // @param operator The operator for the transfer intent // @param id The ID of the transfer intent // @param recipient Who recieved the funds. // @param sender Who sent the funds. // @param spentAmount How much the payer sent // @param spentCurrency What currency the payer sent event Transferred( address indexed operator, bytes16 id, address recipient, address sender, uint256 spentAmount, address spentCurrency ); // @notice Raised when a native currency transfer fails // @param recipient Who the transfer was intended for // @param amount The amount of the transfer // @param isRefund Whether the transfer was part of a refund // @param data The data returned from the failed call error NativeTransferFailed(address recipient, uint256 amount, bool isRefund, bytes data); // @notice Emitted when an operator is registered // @param operator The operator that was registered // @param feeDestination The new fee destination for the operator event OperatorRegistered(address operator, address feeDestination); // @notice Emitted when an operator is unregistered // @param operator The operator that was registered event OperatorUnregistered(address operator); // @notice Raised when the operator in the intent is not registered error OperatorNotRegistered(); // @notice Raised when the intent signature is invalid error InvalidSignature(); // @notice Raised when the invalid amount of native currency is provided // @param difference The surplus (or deficit) amount sent error InvalidNativeAmount(int256 difference); // @notice Raised when the payer does not have enough of the payment token // @param difference The balance deficit error InsufficientBalance(uint256 difference); // @notice Raised when the payer has not approved enough of the payment token // @param difference The allowance deficit error InsufficientAllowance(uint256 difference); // @notice Raised when providing an intent with the incorrect currency. e.g. a USDC intent to `wrapAndTransfer` // @param attemptedCurrency The currency the payer attempted to pay with error IncorrectCurrency(address attemptedCurrency); // @notice Raised when the permit2 transfer details are incorrect error InvalidTransferDetails(); // @notice Raised when an intent is paid past its deadline error ExpiredIntent(); // @notice Raised when an intent's recipient is the null address error NullRecipient(); // @notice Raised when an intent has already been processed error AlreadyProcessed(); // @notice Raised when a transfer does not result in the correct balance increase, // such as with fee-on-transfer tokens error InexactTransfer(); // @notice Raised when a swap fails and returns a reason string // @param reason The error reason returned from the swap error SwapFailedString(string reason); // @notice Raised when a swap fails and returns another error // @param reason The error reason returned from the swap error SwapFailedBytes(bytes reason); // @notice Send the exact amount of the native currency from the sender to the recipient. // @dev The intent's recipient currency must be the native currency. // @param _intent The intent which describes the transfer function transferNative(TransferIntent calldata _intent) external payable; // @notice Transfer the exact amount of any ERC-20 token from the sender to the recipient. // @dev The intent's recipient currency must be an ERC-20 token matching the one in `_signatureTransferData`. // @dev The user must have approved the Permit2 contract for at least `_intent.recipientAmount + _intent.feeAmount` // with the `_intent.recipientCurrency` ERC-20 contract prior to invoking. // @param _intent The intent which describes the transfer function transferToken( TransferIntent calldata _intent, Permit2SignatureTransferData calldata _signatureTransferData ) external; // @notice Transfer the exact amount of any ERC-20 token from the sender to the recipient. // @dev The intent's recipient currency must be an ERC-20 token. // @dev The user must have approved this contract for at least `_intent.recipientAmount + _intent.feeAmount` // with the `_intent.recipientCurrency` ERC-20 contract prior to invoking. // @param _intent The intent which describes the transfer function transferTokenPreApproved(TransferIntent calldata _intent) external; // @notice Takes native currency (e.g. ETH) from the sender and sends wrapped currency (e.g. wETH) to the recipient. // @dev The intent's recipient currency must be the wrapped native currency. // @param _intent The intent which describes the transfer function wrapAndTransfer(TransferIntent calldata _intent) external payable; // @notice Takes wrapped currency (e.g. wETH) from the sender and sends native currency (e.g. ETH) to the recipient. // @dev The intent's recipient currency must be the native currency. // @dev The user must have approved the Permit2 contract for at least `_intent.recipientAmount + _intent.feeAmount` // with the wETH contract prior to invoking. // @param _intent The intent which describes the transfer // @param _signatureTransferData The signed Permit2 transfer data for the payment function unwrapAndTransfer( TransferIntent calldata _intent, Permit2SignatureTransferData calldata _signatureTransferData ) external; // @notice Takes wrapped currency (e.g. wETH) from the sender and sends native currency (e.g. ETH) to the recipient. // @dev The intent's recipient currency must be the native currency. // @dev The user must have approved this contract for at least `_intent.recipientAmount + _intent.feeAmount` with the wETH contract prior to invoking. // @param _intent The intent which describes the transfer function unwrapAndTransferPreApproved(TransferIntent calldata _intent) external; // @notice Allows the sender to pay for an intent with a swap from the native currency using Uniswap. // @param _intent The intent which describes the transfer // @param poolFeesTier The Uniswap pool fee the user wishes to pay. See: https://docs.uniswap.org/protocol/concepts/V3-overview/fees#pool-fees-tiers function swapAndTransferUniswapV3Native(TransferIntent calldata _intent, uint24 poolFeesTier) external payable; // @notice Allows the sender to pay for an intent with a swap from any ERC-20 token using Uniswap. // @dev The user must have approved the Permit2 contract for at least `_signatureTransferData.transferDetails.requestedAmount` // with the `_signatureTransferData.permit.permitted.token` ERC-20 contract prior to invoking. // @param _intent The intent which describes the transfer // @param _signatureTransferData The signed Permit2 transfer data for the payment // @param poolFeesTier The Uniswap pool fee the user wishes to pay. See: https://docs.uniswap.org/protocol/concepts/V3-overview/fees#pool-fees-tiers function swapAndTransferUniswapV3Token( TransferIntent calldata _intent, Permit2SignatureTransferData calldata _signatureTransferData, uint24 poolFeesTier ) external; // @notice Allows the sender to pay for an intent with a swap from any ERC-20 token using Uniswap. // @dev The user must have approved this contract for at least `maxWillingToPay` with the `_tokenIn` ERC-20 contract prior to invoking. // @param _intent The intent which describes the transfer // @param _tokenIn The currency address which the sender wishes to pay for the intent. // @param maxWillingToPay The maximum amount of _tokenIn the sender is willing to pay. // @param poolFeesTier The Uniswap pool fee the user wishes to pay. See: https://docs.uniswap.org/protocol/concepts/V3-overview/fees#pool-fees-tiers function swapAndTransferUniswapV3TokenPreApproved( TransferIntent calldata _intent, address _tokenIn, uint256 maxWillingToPay, uint24 poolFeesTier ) external; }
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.17; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; // @title Represented wrapped (e.g. wETH) currencies interface IWrappedNativeCurrency is IERC20 { function deposit() external payable; function withdraw(uint256) external; }
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity >=0.8.0; /// @notice Modern and gas efficient ERC20 + EIP-2612 implementation. /// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC20.sol) /// @author Modified from Uniswap (https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol) /// @dev Do not manually set balances without updating totalSupply, as the sum of all user balances must not exceed it. abstract contract ERC20 { /*////////////////////////////////////////////////////////////// EVENTS //////////////////////////////////////////////////////////////*/ event Transfer(address indexed from, address indexed to, uint256 amount); event Approval(address indexed owner, address indexed spender, uint256 amount); /*////////////////////////////////////////////////////////////// METADATA STORAGE //////////////////////////////////////////////////////////////*/ string public name; string public symbol; uint8 public immutable decimals; /*////////////////////////////////////////////////////////////// ERC20 STORAGE //////////////////////////////////////////////////////////////*/ uint256 public totalSupply; mapping(address => uint256) public balanceOf; mapping(address => mapping(address => uint256)) public allowance; /*////////////////////////////////////////////////////////////// EIP-2612 STORAGE //////////////////////////////////////////////////////////////*/ uint256 internal immutable INITIAL_CHAIN_ID; bytes32 internal immutable INITIAL_DOMAIN_SEPARATOR; mapping(address => uint256) public nonces; /*////////////////////////////////////////////////////////////// CONSTRUCTOR //////////////////////////////////////////////////////////////*/ constructor( string memory _name, string memory _symbol, uint8 _decimals ) { name = _name; symbol = _symbol; decimals = _decimals; INITIAL_CHAIN_ID = block.chainid; INITIAL_DOMAIN_SEPARATOR = computeDomainSeparator(); } /*////////////////////////////////////////////////////////////// ERC20 LOGIC //////////////////////////////////////////////////////////////*/ function approve(address spender, uint256 amount) public virtual returns (bool) { allowance[msg.sender][spender] = amount; emit Approval(msg.sender, spender, amount); return true; } function transfer(address to, uint256 amount) public virtual returns (bool) { balanceOf[msg.sender] -= amount; // Cannot overflow because the sum of all user // balances can't exceed the max uint256 value. unchecked { balanceOf[to] += amount; } emit Transfer(msg.sender, to, amount); return true; } function transferFrom( address from, address to, uint256 amount ) public virtual returns (bool) { uint256 allowed = allowance[from][msg.sender]; // Saves gas for limited approvals. if (allowed != type(uint256).max) allowance[from][msg.sender] = allowed - amount; balanceOf[from] -= amount; // Cannot overflow because the sum of all user // balances can't exceed the max uint256 value. unchecked { balanceOf[to] += amount; } emit Transfer(from, to, amount); return true; } /*////////////////////////////////////////////////////////////// EIP-2612 LOGIC //////////////////////////////////////////////////////////////*/ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) public virtual { require(deadline >= block.timestamp, "PERMIT_DEADLINE_EXPIRED"); // Unchecked because the only math done is incrementing // the owner's nonce which cannot realistically overflow. unchecked { address recoveredAddress = ecrecover( keccak256( abi.encodePacked( "\x19\x01", DOMAIN_SEPARATOR(), keccak256( abi.encode( keccak256( "Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)" ), owner, spender, value, nonces[owner]++, deadline ) ) ) ), v, r, s ); require(recoveredAddress != address(0) && recoveredAddress == owner, "INVALID_SIGNER"); allowance[recoveredAddress][spender] = value; } emit Approval(owner, spender, value); } function DOMAIN_SEPARATOR() public view virtual returns (bytes32) { return block.chainid == INITIAL_CHAIN_ID ? INITIAL_DOMAIN_SEPARATOR : computeDomainSeparator(); } function computeDomainSeparator() internal view virtual returns (bytes32) { return keccak256( abi.encode( keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"), keccak256(bytes(name)), keccak256("1"), block.chainid, address(this) ) ); } /*////////////////////////////////////////////////////////////// INTERNAL MINT/BURN LOGIC //////////////////////////////////////////////////////////////*/ function _mint(address to, uint256 amount) internal virtual { totalSupply += amount; // Cannot overflow because the sum of all user // balances can't exceed the max uint256 value. unchecked { balanceOf[to] += amount; } emit Transfer(address(0), to, amount); } function _burn(address from, uint256 amount) internal virtual { balanceOf[from] -= amount; // Cannot underflow because a user's balance // will never be larger than the total supply. unchecked { totalSupply -= amount; } emit Transfer(from, address(0), amount); } }
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity >=0.8.0; import {ERC20} from "../tokens/ERC20.sol"; /// @notice Safe ETH and ERC20 transfer library that gracefully handles missing return values. /// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/SafeTransferLib.sol) /// @dev Use with caution! Some functions in this library knowingly create dirty bits at the destination of the free memory pointer. /// @dev Note that none of the functions in this library check that a token has code at all! That responsibility is delegated to the caller. library SafeTransferLib { /*////////////////////////////////////////////////////////////// ETH OPERATIONS //////////////////////////////////////////////////////////////*/ function safeTransferETH(address to, uint256 amount) internal { bool success; /// @solidity memory-safe-assembly assembly { // Transfer the ETH and store if it succeeded or not. success := call(gas(), to, amount, 0, 0, 0, 0) } require(success, "ETH_TRANSFER_FAILED"); } /*////////////////////////////////////////////////////////////// ERC20 OPERATIONS //////////////////////////////////////////////////////////////*/ function safeTransferFrom( ERC20 token, address from, address to, uint256 amount ) internal { bool success; /// @solidity memory-safe-assembly assembly { // Get a pointer to some free memory. let freeMemoryPointer := mload(0x40) // Write the abi-encoded calldata into memory, beginning with the function selector. mstore(freeMemoryPointer, 0x23b872dd00000000000000000000000000000000000000000000000000000000) mstore(add(freeMemoryPointer, 4), from) // Append the "from" argument. mstore(add(freeMemoryPointer, 36), to) // Append the "to" argument. mstore(add(freeMemoryPointer, 68), amount) // Append the "amount" argument. success := and( // Set success to whether the call reverted, if not we check it either // returned exactly 1 (can't just be non-zero data), or had no return data. or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())), // We use 100 because the length of our calldata totals up like so: 4 + 32 * 3. // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space. // Counterintuitively, this call must be positioned second to the or() call in the // surrounding and() call or else returndatasize() will be zero during the computation. call(gas(), token, 0, freeMemoryPointer, 100, 0, 32) ) } require(success, "TRANSFER_FROM_FAILED"); } function safeTransfer( ERC20 token, address to, uint256 amount ) internal { bool success; /// @solidity memory-safe-assembly assembly { // Get a pointer to some free memory. let freeMemoryPointer := mload(0x40) // Write the abi-encoded calldata into memory, beginning with the function selector. mstore(freeMemoryPointer, 0xa9059cbb00000000000000000000000000000000000000000000000000000000) mstore(add(freeMemoryPointer, 4), to) // Append the "to" argument. mstore(add(freeMemoryPointer, 36), amount) // Append the "amount" argument. success := and( // Set success to whether the call reverted, if not we check it either // returned exactly 1 (can't just be non-zero data), or had no return data. or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())), // We use 68 because the length of our calldata totals up like so: 4 + 32 * 2. // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space. // Counterintuitively, this call must be positioned second to the or() call in the // surrounding and() call or else returndatasize() will be zero during the computation. call(gas(), token, 0, freeMemoryPointer, 68, 0, 32) ) } require(success, "TRANSFER_FAILED"); } function safeApprove( ERC20 token, address to, uint256 amount ) internal { bool success; /// @solidity memory-safe-assembly assembly { // Get a pointer to some free memory. let freeMemoryPointer := mload(0x40) // Write the abi-encoded calldata into memory, beginning with the function selector. mstore(freeMemoryPointer, 0x095ea7b300000000000000000000000000000000000000000000000000000000) mstore(add(freeMemoryPointer, 4), to) // Append the "to" argument. mstore(add(freeMemoryPointer, 36), amount) // Append the "amount" argument. success := and( // Set success to whether the call reverted, if not we check it either // returned exactly 1 (can't just be non-zero data), or had no return data. or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())), // We use 68 because the length of our calldata totals up like so: 4 + 32 * 2. // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space. // Counterintuitively, this call must be positioned second to the or() call in the // surrounding and() call or else returndatasize() will be zero during the computation. call(gas(), token, 0, freeMemoryPointer, 68, 0, 32) ) } require(success, "APPROVE_FAILED"); } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.17; import {ERC20} from "../solmate/tokens/ERC20.sol"; import {SafeTransferLib} from "../solmate/utils/SafeTransferLib.sol"; import {PermitHash} from "./libraries/PermitHash.sol"; import {SignatureVerification} from "./libraries/SignatureVerification.sol"; import {EIP712} from "./EIP712.sol"; import {IAllowanceTransfer} from "../src/interfaces/IAllowanceTransfer.sol"; import {SignatureExpired, InvalidNonce} from "./PermitErrors.sol"; import {Allowance} from "./libraries/Allowance.sol"; contract AllowanceTransfer is IAllowanceTransfer, EIP712 { using SignatureVerification for bytes; using SafeTransferLib for ERC20; using PermitHash for PermitSingle; using PermitHash for PermitBatch; using Allowance for PackedAllowance; /// @notice Maps users to tokens to spender addresses and information about the approval on the token /// @dev Indexed in the order of token owner address, token address, spender address /// @dev The stored word saves the allowed amount, expiration on the allowance, and nonce mapping(address => mapping(address => mapping(address => PackedAllowance))) public allowance; /// @inheritdoc IAllowanceTransfer function approve(address token, address spender, uint160 amount, uint48 expiration) external { PackedAllowance storage allowed = allowance[msg.sender][token][spender]; allowed.updateAmountAndExpiration(amount, expiration); emit Approval(msg.sender, token, spender, amount, expiration); } /// @inheritdoc IAllowanceTransfer function permit(address owner, PermitSingle memory permitSingle, bytes calldata signature) external { if (block.timestamp > permitSingle.sigDeadline) revert SignatureExpired(permitSingle.sigDeadline); // Verify the signer address from the signature. signature.verify(_hashTypedData(permitSingle.hash()), owner); _updateApproval(permitSingle.details, owner, permitSingle.spender); } /// @inheritdoc IAllowanceTransfer function permit(address owner, PermitBatch memory permitBatch, bytes calldata signature) external { if (block.timestamp > permitBatch.sigDeadline) revert SignatureExpired(permitBatch.sigDeadline); // Verify the signer address from the signature. signature.verify(_hashTypedData(permitBatch.hash()), owner); address spender = permitBatch.spender; unchecked { uint256 length = permitBatch.details.length; for (uint256 i = 0; i < length; ++i) { _updateApproval(permitBatch.details[i], owner, spender); } } } /// @inheritdoc IAllowanceTransfer function transferFrom(address from, address to, uint160 amount, address token) external { _transfer(from, to, amount, token); } /// @inheritdoc IAllowanceTransfer function transferFrom(AllowanceTransferDetails[] calldata transferDetails) external { unchecked { uint256 length = transferDetails.length; for (uint256 i = 0; i < length; ++i) { AllowanceTransferDetails memory transferDetail = transferDetails[i]; _transfer(transferDetail.from, transferDetail.to, transferDetail.amount, transferDetail.token); } } } /// @notice Internal function for transferring tokens using stored allowances /// @dev Will fail if the allowed timeframe has passed function _transfer(address from, address to, uint160 amount, address token) private { PackedAllowance storage allowed = allowance[from][token][msg.sender]; if (block.timestamp > allowed.expiration) revert AllowanceExpired(allowed.expiration); uint256 maxAmount = allowed.amount; if (maxAmount != type(uint160).max) { if (amount > maxAmount) { revert InsufficientAllowance(maxAmount); } else { unchecked { allowed.amount = uint160(maxAmount) - amount; } } } // Transfer the tokens from the from address to the recipient. ERC20(token).safeTransferFrom(from, to, amount); } /// @inheritdoc IAllowanceTransfer function lockdown(TokenSpenderPair[] calldata approvals) external { address owner = msg.sender; // Revoke allowances for each pair of spenders and tokens. unchecked { uint256 length = approvals.length; for (uint256 i = 0; i < length; ++i) { address token = approvals[i].token; address spender = approvals[i].spender; allowance[owner][token][spender].amount = 0; emit Lockdown(owner, token, spender); } } } /// @inheritdoc IAllowanceTransfer function invalidateNonces(address token, address spender, uint48 newNonce) external { uint48 oldNonce = allowance[msg.sender][token][spender].nonce; if (newNonce <= oldNonce) revert InvalidNonce(); // Limit the amount of nonces that can be invalidated in one transaction. unchecked { uint48 delta = newNonce - oldNonce; if (delta > type(uint16).max) revert ExcessiveInvalidation(); } allowance[msg.sender][token][spender].nonce = newNonce; emit NonceInvalidation(msg.sender, token, spender, newNonce, oldNonce); } /// @notice Sets the new values for amount, expiration, and nonce. /// @dev Will check that the signed nonce is equal to the current nonce and then incrememnt the nonce value by 1. /// @dev Emits a Permit event. function _updateApproval(PermitDetails memory details, address owner, address spender) private { uint48 nonce = details.nonce; address token = details.token; uint160 amount = details.amount; uint48 expiration = details.expiration; PackedAllowance storage allowed = allowance[owner][token][spender]; if (allowed.nonce != nonce) revert InvalidNonce(); allowed.updateAll(amount, expiration, nonce); emit Permit(owner, token, spender, amount, expiration, nonce); } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.17; /// @notice EIP712 helpers for permit2 /// @dev Maintains cross-chain replay protection in the event of a fork /// @dev Reference: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/cryptography/EIP712.sol contract EIP712 { // Cache the domain separator as an immutable value, but also store the chain id that it // corresponds to, in order to invalidate the cached domain separator if the chain id changes. bytes32 private immutable _CACHED_DOMAIN_SEPARATOR; uint256 private immutable _CACHED_CHAIN_ID; bytes32 private constant _HASHED_NAME = keccak256("Permit2"); bytes32 private constant _TYPE_HASH = keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)"); constructor() { _CACHED_CHAIN_ID = block.chainid; _CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME); } /// @notice Returns the domain separator for the current chain. /// @dev Uses cached version if chainid and address are unchanged from construction. function DOMAIN_SEPARATOR() public view returns (bytes32) { return block.chainid == _CACHED_CHAIN_ID ? _CACHED_DOMAIN_SEPARATOR : _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME); } /// @notice Builds a domain separator using the current chainId and contract address. function _buildDomainSeparator(bytes32 typeHash, bytes32 nameHash) private view returns (bytes32) { return keccak256(abi.encode(typeHash, nameHash, block.chainid, address(this))); } /// @notice Creates an EIP-712 typed data hash function _hashTypedData(bytes32 dataHash) internal view returns (bytes32) { return keccak256(abi.encodePacked("\x19\x01", DOMAIN_SEPARATOR(), dataHash)); } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.17; import {SignatureTransfer} from "./SignatureTransfer.sol"; import {AllowanceTransfer} from "./AllowanceTransfer.sol"; /// @notice Permit2 handles signature-based transfers in SignatureTransfer and allowance-based transfers in AllowanceTransfer. /// @dev Users must approve Permit2 before calling any of the transfer functions. contract Permit2 is SignatureTransfer, AllowanceTransfer { // Permit2 unifies the two contracts so users have maximal flexibility with their approval. }
// SPDX-License-Identifier: MIT pragma solidity 0.8.17; /// @notice Shared errors between signature based transfers and allowance based transfers. /// @notice Thrown when validating an inputted signature that is stale /// @param signatureDeadline The timestamp at which a signature is no longer valid error SignatureExpired(uint256 signatureDeadline); /// @notice Thrown when validating that the inputted nonce has not been used error InvalidNonce();
// SPDX-License-Identifier: MIT pragma solidity 0.8.17; import {ISignatureTransfer} from "./interfaces/ISignatureTransfer.sol"; import {SignatureExpired, InvalidNonce} from "./PermitErrors.sol"; import {ERC20} from "../solmate/tokens/ERC20.sol"; import {SafeTransferLib} from "../solmate/utils/SafeTransferLib.sol"; import {SignatureVerification} from "./libraries/SignatureVerification.sol"; import {PermitHash} from "./libraries/PermitHash.sol"; import {EIP712} from "./EIP712.sol"; contract SignatureTransfer is ISignatureTransfer, EIP712 { using SignatureVerification for bytes; using SafeTransferLib for ERC20; using PermitHash for PermitTransferFrom; using PermitHash for PermitBatchTransferFrom; /// @inheritdoc ISignatureTransfer mapping(address => mapping(uint256 => uint256)) public nonceBitmap; /// @inheritdoc ISignatureTransfer function permitTransferFrom( PermitTransferFrom memory permit, SignatureTransferDetails calldata transferDetails, address owner, bytes calldata signature ) external { _permitTransferFrom(permit, transferDetails, owner, permit.hash(), signature); } /// @inheritdoc ISignatureTransfer function permitWitnessTransferFrom( PermitTransferFrom memory permit, SignatureTransferDetails calldata transferDetails, address owner, bytes32 witness, string calldata witnessTypeString, bytes calldata signature ) external { _permitTransferFrom( permit, transferDetails, owner, permit.hashWithWitness(witness, witnessTypeString), signature ); } /// @notice Transfers a token using a signed permit message. /// @dev If to is the zero address, the tokens are sent to the spender. /// @param permit The permit data signed over by the owner /// @param dataHash The EIP-712 hash of permit data to include when checking signature /// @param owner The owner of the tokens to transfer /// @param transferDetails The spender's requested transfer details for the permitted token /// @param signature The signature to verify function _permitTransferFrom( PermitTransferFrom memory permit, SignatureTransferDetails calldata transferDetails, address owner, bytes32 dataHash, bytes calldata signature ) private { uint256 requestedAmount = transferDetails.requestedAmount; if (block.timestamp > permit.deadline) revert SignatureExpired(permit.deadline); if (requestedAmount > permit.permitted.amount) revert InvalidAmount(permit.permitted.amount); _useUnorderedNonce(owner, permit.nonce); signature.verify(_hashTypedData(dataHash), owner); ERC20(permit.permitted.token).safeTransferFrom(owner, transferDetails.to, requestedAmount); } /// @inheritdoc ISignatureTransfer function permitTransferFrom( PermitBatchTransferFrom memory permit, SignatureTransferDetails[] calldata transferDetails, address owner, bytes calldata signature ) external { _permitTransferFrom(permit, transferDetails, owner, permit.hash(), signature); } /// @inheritdoc ISignatureTransfer function permitWitnessTransferFrom( PermitBatchTransferFrom memory permit, SignatureTransferDetails[] calldata transferDetails, address owner, bytes32 witness, string calldata witnessTypeString, bytes calldata signature ) external { _permitTransferFrom( permit, transferDetails, owner, permit.hashWithWitness(witness, witnessTypeString), signature ); } /// @notice Transfers tokens using a signed permit messages /// @dev If to is the zero address, the tokens are sent to the spender /// @param permit The permit data signed over by the owner /// @param dataHash The EIP-712 hash of permit data to include when checking signature /// @param owner The owner of the tokens to transfer /// @param signature The signature to verify function _permitTransferFrom( PermitBatchTransferFrom memory permit, SignatureTransferDetails[] calldata transferDetails, address owner, bytes32 dataHash, bytes calldata signature ) private { uint256 numPermitted = permit.permitted.length; if (block.timestamp > permit.deadline) revert SignatureExpired(permit.deadline); if (numPermitted != transferDetails.length) revert LengthMismatch(); _useUnorderedNonce(owner, permit.nonce); signature.verify(_hashTypedData(dataHash), owner); unchecked { for (uint256 i = 0; i < numPermitted; ++i) { TokenPermissions memory permitted = permit.permitted[i]; uint256 requestedAmount = transferDetails[i].requestedAmount; if (requestedAmount > permitted.amount) revert InvalidAmount(permitted.amount); if (requestedAmount != 0) { // allow spender to specify which of the permitted tokens should be transferred ERC20(permitted.token).safeTransferFrom(owner, transferDetails[i].to, requestedAmount); } } } } /// @inheritdoc ISignatureTransfer function invalidateUnorderedNonces(uint256 wordPos, uint256 mask) external { nonceBitmap[msg.sender][wordPos] |= mask; emit UnorderedNonceInvalidation(msg.sender, wordPos, mask); } /// @notice Returns the index of the bitmap and the bit position within the bitmap. Used for unordered nonces /// @param nonce The nonce to get the associated word and bit positions /// @return wordPos The word position or index into the nonceBitmap /// @return bitPos The bit position /// @dev The first 248 bits of the nonce value is the index of the desired bitmap /// @dev The last 8 bits of the nonce value is the position of the bit in the bitmap function bitmapPositions(uint256 nonce) private pure returns (uint256 wordPos, uint256 bitPos) { wordPos = uint248(nonce >> 8); bitPos = uint8(nonce); } /// @notice Checks whether a nonce is taken and sets the bit at the bit position in the bitmap at the word position /// @param from The address to use the nonce at /// @param nonce The nonce to spend function _useUnorderedNonce(address from, uint256 nonce) internal { (uint256 wordPos, uint256 bitPos) = bitmapPositions(nonce); uint256 bit = 1 << bitPos; uint256 flipped = nonceBitmap[from][wordPos] ^= bit; if (flipped & bit == 0) revert InvalidNonce(); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.17; /// @title AllowanceTransfer /// @notice Handles ERC20 token permissions through signature based allowance setting and ERC20 token transfers by checking allowed amounts /// @dev Requires user's token approval on the Permit2 contract interface IAllowanceTransfer { /// @notice Thrown when an allowance on a token has expired. /// @param deadline The timestamp at which the allowed amount is no longer valid error AllowanceExpired(uint256 deadline); /// @notice Thrown when an allowance on a token has been depleted. /// @param amount The maximum amount allowed error InsufficientAllowance(uint256 amount); /// @notice Thrown when too many nonces are invalidated. error ExcessiveInvalidation(); /// @notice Emits an event when the owner successfully invalidates an ordered nonce. event NonceInvalidation( address indexed owner, address indexed token, address indexed spender, uint48 newNonce, uint48 oldNonce ); /// @notice Emits an event when the owner successfully sets permissions on a token for the spender. event Approval( address indexed owner, address indexed token, address indexed spender, uint160 amount, uint48 expiration ); /// @notice Emits an event when the owner successfully sets permissions using a permit signature on a token for the spender. event Permit( address indexed owner, address indexed token, address indexed spender, uint160 amount, uint48 expiration, uint48 nonce ); /// @notice Emits an event when the owner sets the allowance back to 0 with the lockdown function. event Lockdown(address indexed owner, address token, address spender); /// @notice The permit data for a token struct PermitDetails { // ERC20 token address address token; // the maximum amount allowed to spend uint160 amount; // timestamp at which a spender's token allowances become invalid uint48 expiration; // an incrementing value indexed per owner,token,and spender for each signature uint48 nonce; } /// @notice The permit message signed for a single token allownce struct PermitSingle { // the permit data for a single token alownce PermitDetails details; // address permissioned on the allowed tokens address spender; // deadline on the permit signature uint256 sigDeadline; } /// @notice The permit message signed for multiple token allowances struct PermitBatch { // the permit data for multiple token allowances PermitDetails[] details; // address permissioned on the allowed tokens address spender; // deadline on the permit signature uint256 sigDeadline; } /// @notice The saved permissions /// @dev This info is saved per owner, per token, per spender and all signed over in the permit message /// @dev Setting amount to type(uint160).max sets an unlimited approval struct PackedAllowance { // amount allowed uint160 amount; // permission expiry uint48 expiration; // an incrementing value indexed per owner,token,and spender for each signature uint48 nonce; } /// @notice A token spender pair. struct TokenSpenderPair { // the token the spender is approved address token; // the spender address address spender; } /// @notice Details for a token transfer. struct AllowanceTransferDetails { // the owner of the token address from; // the recipient of the token address to; // the amount of the token uint160 amount; // the token to be transferred address token; } /// @notice A mapping from owner address to token address to spender address to PackedAllowance struct, which contains details and conditions of the approval. /// @notice The mapping is indexed in the above order see: allowance[ownerAddress][tokenAddress][spenderAddress] /// @dev The packed slot holds the allowed amount, expiration at which the allowed amount is no longer valid, and current nonce thats updated on any signature based approvals. function allowance(address, address, address) external view returns (uint160, uint48, uint48); /// @notice Approves the spender to use up to amount of the specified token up until the expiration /// @param token The token to approve /// @param spender The spender address to approve /// @param amount The approved amount of the token /// @param expiration The timestamp at which the approval is no longer valid /// @dev The packed allowance also holds a nonce, which will stay unchanged in approve /// @dev Setting amount to type(uint160).max sets an unlimited approval function approve(address token, address spender, uint160 amount, uint48 expiration) external; /// @notice Permit a spender to a given amount of the owners token via the owner's EIP-712 signature /// @dev May fail if the owner's nonce was invalidated in-flight by invalidateNonce /// @param owner The owner of the tokens being approved /// @param permitSingle Data signed over by the owner specifying the terms of approval /// @param signature The owner's signature over the permit data function permit(address owner, PermitSingle memory permitSingle, bytes calldata signature) external; /// @notice Permit a spender to the signed amounts of the owners tokens via the owner's EIP-712 signature /// @dev May fail if the owner's nonce was invalidated in-flight by invalidateNonce /// @param owner The owner of the tokens being approved /// @param permitBatch Data signed over by the owner specifying the terms of approval /// @param signature The owner's signature over the permit data function permit(address owner, PermitBatch memory permitBatch, bytes calldata signature) external; /// @notice Transfer approved tokens from one address to another /// @param from The address to transfer from /// @param to The address of the recipient /// @param amount The amount of the token to transfer /// @param token The token address to transfer /// @dev Requires the from address to have approved at least the desired amount /// of tokens to msg.sender. function transferFrom(address from, address to, uint160 amount, address token) external; /// @notice Transfer approved tokens in a batch /// @param transferDetails Array of owners, recipients, amounts, and tokens for the transfers /// @dev Requires the from addresses to have approved at least the desired amount /// of tokens to msg.sender. function transferFrom(AllowanceTransferDetails[] calldata transferDetails) external; /// @notice Enables performing a "lockdown" of the sender's Permit2 identity /// by batch revoking approvals /// @param approvals Array of approvals to revoke. function lockdown(TokenSpenderPair[] calldata approvals) external; /// @notice Invalidate nonces for a given (token, spender) pair /// @param token The token to invalidate nonces for /// @param spender The spender to invalidate nonces for /// @param newNonce The new nonce to set. Invalidates all nonces less than it. /// @dev Can't invalidate more than 2**16 nonces per transaction. function invalidateNonces(address token, address spender, uint48 newNonce) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.17; interface IERC1271 { /// @dev Should return whether the signature provided is valid for the provided data /// @param hash Hash of the data to be signed /// @param signature Signature byte array associated with _data /// @return magicValue The bytes4 magic value 0x1626ba7e function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4 magicValue); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.17; /// @title SignatureTransfer /// @notice Handles ERC20 token transfers through signature based actions /// @dev Requires user's token approval on the Permit2 contract interface ISignatureTransfer { /// @notice Thrown when the requested amount for a transfer is larger than the permissioned amount /// @param maxAmount The maximum amount a spender can request to transfer error InvalidAmount(uint256 maxAmount); /// @notice Thrown when the number of tokens permissioned to a spender does not match the number of tokens being transferred /// @dev If the spender does not need to transfer the number of tokens permitted, the spender can request amount 0 to be transferred error LengthMismatch(); /// @notice Emits an event when the owner successfully invalidates an unordered nonce. event UnorderedNonceInvalidation(address indexed owner, uint256 word, uint256 mask); /// @notice The token and amount details for a transfer signed in the permit transfer signature struct TokenPermissions { // ERC20 token address address token; // the maximum amount that can be spent uint256 amount; } /// @notice The signed permit message for a single token transfer struct PermitTransferFrom { TokenPermissions permitted; // a unique value for every token owner's signature to prevent signature replays uint256 nonce; // deadline on the permit signature uint256 deadline; } /// @notice Specifies the recipient address and amount for batched transfers. /// @dev Recipients and amounts correspond to the index of the signed token permissions array. /// @dev Reverts if the requested amount is greater than the permitted signed amount. struct SignatureTransferDetails { // recipient address address to; // spender requested amount uint256 requestedAmount; } /// @notice Used to reconstruct the signed permit message for multiple token transfers /// @dev Do not need to pass in spender address as it is required that it is msg.sender /// @dev Note that a user still signs over a spender address struct PermitBatchTransferFrom { // the tokens and corresponding amounts permitted for a transfer TokenPermissions[] permitted; // a unique value for every token owner's signature to prevent signature replays uint256 nonce; // deadline on the permit signature uint256 deadline; } /// @notice A map from token owner address and a caller specified word index to a bitmap. Used to set bits in the bitmap to prevent against signature replay protection /// @dev Uses unordered nonces so that permit messages do not need to be spent in a certain order /// @dev The mapping is indexed first by the token owner, then by an index specified in the nonce /// @dev It returns a uint256 bitmap /// @dev The index, or wordPosition is capped at type(uint248).max function nonceBitmap(address, uint256) external view returns (uint256); /// @notice Transfers a token using a signed permit message /// @dev Reverts if the requested amount is greater than the permitted signed amount /// @param permit The permit data signed over by the owner /// @param owner The owner of the tokens to transfer /// @param transferDetails The spender's requested transfer details for the permitted token /// @param signature The signature to verify function permitTransferFrom( PermitTransferFrom memory permit, SignatureTransferDetails calldata transferDetails, address owner, bytes calldata signature ) external; /// @notice Transfers a token using a signed permit message /// @notice Includes extra data provided by the caller to verify signature over /// @dev The witness type string must follow EIP712 ordering of nested structs and must include the TokenPermissions type definition /// @dev Reverts if the requested amount is greater than the permitted signed amount /// @param permit The permit data signed over by the owner /// @param owner The owner of the tokens to transfer /// @param transferDetails The spender's requested transfer details for the permitted token /// @param witness Extra data to include when checking the user signature /// @param witnessTypeString The EIP-712 type definition for remaining string stub of the typehash /// @param signature The signature to verify function permitWitnessTransferFrom( PermitTransferFrom memory permit, SignatureTransferDetails calldata transferDetails, address owner, bytes32 witness, string calldata witnessTypeString, bytes calldata signature ) external; /// @notice Transfers multiple tokens using a signed permit message /// @param permit The permit data signed over by the owner /// @param owner The owner of the tokens to transfer /// @param transferDetails Specifies the recipient and requested amount for the token transfer /// @param signature The signature to verify function permitTransferFrom( PermitBatchTransferFrom memory permit, SignatureTransferDetails[] calldata transferDetails, address owner, bytes calldata signature ) external; /// @notice Transfers multiple tokens using a signed permit message /// @dev The witness type string must follow EIP712 ordering of nested structs and must include the TokenPermissions type definition /// @notice Includes extra data provided by the caller to verify signature over /// @param permit The permit data signed over by the owner /// @param owner The owner of the tokens to transfer /// @param transferDetails Specifies the recipient and requested amount for the token transfer /// @param witness Extra data to include when checking the user signature /// @param witnessTypeString The EIP-712 type definition for remaining string stub of the typehash /// @param signature The signature to verify function permitWitnessTransferFrom( PermitBatchTransferFrom memory permit, SignatureTransferDetails[] calldata transferDetails, address owner, bytes32 witness, string calldata witnessTypeString, bytes calldata signature ) external; /// @notice Invalidates the bits specified in mask for the bitmap at the word position /// @dev The wordPos is maxed at type(uint248).max /// @param wordPos A number to index the nonceBitmap at /// @param mask A bitmap masked against msg.sender's current bitmap at the word position function invalidateUnorderedNonces(uint256 wordPos, uint256 mask) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.17; import {IAllowanceTransfer} from "../interfaces/IAllowanceTransfer.sol"; library Allowance { // note if the expiration passed is 0, then it the approval set to the block.timestamp uint256 private constant BLOCK_TIMESTAMP_EXPIRATION = 0; /// @notice Sets the allowed amount, expiry, and nonce of the spender's permissions on owner's token. /// @dev Nonce is incremented. /// @dev If the inputted expiration is 0, the stored expiration is set to block.timestamp function updateAll( IAllowanceTransfer.PackedAllowance storage allowed, uint160 amount, uint48 expiration, uint48 nonce ) internal { uint48 storedNonce; unchecked { storedNonce = nonce + 1; } uint48 storedExpiration = expiration == BLOCK_TIMESTAMP_EXPIRATION ? uint48(block.timestamp) : expiration; uint256 word = pack(amount, storedExpiration, storedNonce); assembly { sstore(allowed.slot, word) } } /// @notice Sets the allowed amount and expiry of the spender's permissions on owner's token. /// @dev Nonce does not need to be incremented. function updateAmountAndExpiration( IAllowanceTransfer.PackedAllowance storage allowed, uint160 amount, uint48 expiration ) internal { // If the inputted expiration is 0, the allowance only lasts the duration of the block. allowed.expiration = expiration == 0 ? uint48(block.timestamp) : expiration; allowed.amount = amount; } /// @notice Computes the packed slot of the amount, expiration, and nonce that make up PackedAllowance function pack(uint160 amount, uint48 expiration, uint48 nonce) internal pure returns (uint256 word) { word = (uint256(nonce) << 208) | uint256(expiration) << 160 | amount; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.17; import {IAllowanceTransfer} from "../interfaces/IAllowanceTransfer.sol"; import {ISignatureTransfer} from "../interfaces/ISignatureTransfer.sol"; library PermitHash { bytes32 public constant _PERMIT_DETAILS_TYPEHASH = keccak256("PermitDetails(address token,uint160 amount,uint48 expiration,uint48 nonce)"); bytes32 public constant _PERMIT_SINGLE_TYPEHASH = keccak256( "PermitSingle(PermitDetails details,address spender,uint256 sigDeadline)PermitDetails(address token,uint160 amount,uint48 expiration,uint48 nonce)" ); bytes32 public constant _PERMIT_BATCH_TYPEHASH = keccak256( "PermitBatch(PermitDetails[] details,address spender,uint256 sigDeadline)PermitDetails(address token,uint160 amount,uint48 expiration,uint48 nonce)" ); bytes32 public constant _TOKEN_PERMISSIONS_TYPEHASH = keccak256("TokenPermissions(address token,uint256 amount)"); bytes32 public constant _PERMIT_TRANSFER_FROM_TYPEHASH = keccak256( "PermitTransferFrom(TokenPermissions permitted,address spender,uint256 nonce,uint256 deadline)TokenPermissions(address token,uint256 amount)" ); bytes32 public constant _PERMIT_BATCH_TRANSFER_FROM_TYPEHASH = keccak256( "PermitBatchTransferFrom(TokenPermissions[] permitted,address spender,uint256 nonce,uint256 deadline)TokenPermissions(address token,uint256 amount)" ); string public constant _TOKEN_PERMISSIONS_TYPESTRING = "TokenPermissions(address token,uint256 amount)"; string public constant _PERMIT_TRANSFER_FROM_WITNESS_TYPEHASH_STUB = "PermitWitnessTransferFrom(TokenPermissions permitted,address spender,uint256 nonce,uint256 deadline,"; string public constant _PERMIT_BATCH_WITNESS_TRANSFER_FROM_TYPEHASH_STUB = "PermitBatchWitnessTransferFrom(TokenPermissions[] permitted,address spender,uint256 nonce,uint256 deadline,"; function hash(IAllowanceTransfer.PermitSingle memory permitSingle) internal pure returns (bytes32) { bytes32 permitHash = _hashPermitDetails(permitSingle.details); return keccak256(abi.encode(_PERMIT_SINGLE_TYPEHASH, permitHash, permitSingle.spender, permitSingle.sigDeadline)); } function hash(IAllowanceTransfer.PermitBatch memory permitBatch) internal pure returns (bytes32) { uint256 numPermits = permitBatch.details.length; bytes32[] memory permitHashes = new bytes32[](numPermits); for (uint256 i = 0; i < numPermits; ++i) { permitHashes[i] = _hashPermitDetails(permitBatch.details[i]); } return keccak256( abi.encode( _PERMIT_BATCH_TYPEHASH, keccak256(abi.encodePacked(permitHashes)), permitBatch.spender, permitBatch.sigDeadline ) ); } function hash(ISignatureTransfer.PermitTransferFrom memory permit) internal view returns (bytes32) { bytes32 tokenPermissionsHash = _hashTokenPermissions(permit.permitted); return keccak256( abi.encode(_PERMIT_TRANSFER_FROM_TYPEHASH, tokenPermissionsHash, msg.sender, permit.nonce, permit.deadline) ); } function hash(ISignatureTransfer.PermitBatchTransferFrom memory permit) internal view returns (bytes32) { uint256 numPermitted = permit.permitted.length; bytes32[] memory tokenPermissionHashes = new bytes32[](numPermitted); for (uint256 i = 0; i < numPermitted; ++i) { tokenPermissionHashes[i] = _hashTokenPermissions(permit.permitted[i]); } return keccak256( abi.encode( _PERMIT_BATCH_TRANSFER_FROM_TYPEHASH, keccak256(abi.encodePacked(tokenPermissionHashes)), msg.sender, permit.nonce, permit.deadline ) ); } function hashWithWitness( ISignatureTransfer.PermitTransferFrom memory permit, bytes32 witness, string calldata witnessTypeString ) internal view returns (bytes32) { bytes32 typeHash = keccak256(abi.encodePacked(_PERMIT_TRANSFER_FROM_WITNESS_TYPEHASH_STUB, witnessTypeString)); bytes32 tokenPermissionsHash = _hashTokenPermissions(permit.permitted); return keccak256(abi.encode(typeHash, tokenPermissionsHash, msg.sender, permit.nonce, permit.deadline, witness)); } function hashWithWitness( ISignatureTransfer.PermitBatchTransferFrom memory permit, bytes32 witness, string calldata witnessTypeString ) internal view returns (bytes32) { bytes32 typeHash = keccak256(abi.encodePacked(_PERMIT_BATCH_WITNESS_TRANSFER_FROM_TYPEHASH_STUB, witnessTypeString)); uint256 numPermitted = permit.permitted.length; bytes32[] memory tokenPermissionHashes = new bytes32[](numPermitted); for (uint256 i = 0; i < numPermitted; ++i) { tokenPermissionHashes[i] = _hashTokenPermissions(permit.permitted[i]); } return keccak256( abi.encode( typeHash, keccak256(abi.encodePacked(tokenPermissionHashes)), msg.sender, permit.nonce, permit.deadline, witness ) ); } function _hashPermitDetails(IAllowanceTransfer.PermitDetails memory details) private pure returns (bytes32) { return keccak256(abi.encode(_PERMIT_DETAILS_TYPEHASH, details)); } function _hashTokenPermissions(ISignatureTransfer.TokenPermissions memory permitted) private pure returns (bytes32) { return keccak256(abi.encode(_TOKEN_PERMISSIONS_TYPEHASH, permitted)); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.17; import {IERC1271} from "../interfaces/IERC1271.sol"; library SignatureVerification { /// @notice Thrown when the passed in signature is not a valid length error InvalidSignatureLength(); /// @notice Thrown when the recovered signer is equal to the zero address error InvalidSignature(); /// @notice Thrown when the recovered signer does not equal the claimedSigner error InvalidSigner(); /// @notice Thrown when the recovered contract signature is incorrect error InvalidContractSignature(); bytes32 constant UPPER_BIT_MASK = (0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); function verify(bytes calldata signature, bytes32 hash, address claimedSigner) internal view { bytes32 r; bytes32 s; uint8 v; if (claimedSigner.code.length == 0) { if (signature.length == 65) { (r, s) = abi.decode(signature, (bytes32, bytes32)); v = uint8(signature[64]); } else if (signature.length == 64) { // EIP-2098 bytes32 vs; (r, vs) = abi.decode(signature, (bytes32, bytes32)); s = vs & UPPER_BIT_MASK; v = uint8(uint256(vs >> 255)) + 27; } else { revert InvalidSignatureLength(); } address signer = ecrecover(hash, v, r, s); if (signer == address(0)) revert InvalidSignature(); if (signer != claimedSigner) revert InvalidSigner(); } else { bytes4 magicValue = IERC1271(claimedSigner).isValidSignature(hash, signature); if (magicValue != IERC1271.isValidSignature.selector) revert InvalidContractSignature(); } } }
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.17; import "@openzeppelin/contracts/utils/Context.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; // @title Sweepable contract // @notice Implements a role that can sweep stuck funds to an address provided // at the time of the call abstract contract Sweepable is Context, Ownable { using SafeERC20 for IERC20; // @dev The address of the current sweeper address private _sweeper; // @dev Restricts the caller to the current sweeper modifier onlySweeper() { require(sweeper() == _msgSender(), "Sweepable: not the sweeper"); _; } modifier notZero(address a) { require(a != address(0), "Sweepable: cannot be zero address"); _; } // @dev Returns the current sweeper function sweeper() public view virtual returns (address) { return _sweeper; } // @dev Sets the sweeper // @notice To remove the sweeper role entirely, set this to the zero address. function setSweeper(address newSweeper) public virtual onlyOwner notZero(newSweeper) { _sweeper = newSweeper; } // @dev Sweeps the entire ETH balance to `destination` function sweepETH(address payable destination) public virtual onlySweeper notZero(destination) { uint256 balance = address(this).balance; require(balance > 0, "Sweepable: zero balance"); (bool success, ) = destination.call{value: balance}(""); require(success, "Sweepable: transfer error"); } // @dev Sweeps a specific ETH `amount` to `destination` function sweepETHAmount(address payable destination, uint256 amount) public virtual onlySweeper notZero(destination) { uint256 balance = address(this).balance; require(balance >= amount, "Sweepable: insufficient balance"); (bool success, ) = destination.call{value: amount}(""); require(success, "Sweepable: transfer error"); } // @dev Sweeps the entire token balance to `destination` function sweepToken(address _token, address destination) public virtual onlySweeper notZero(destination) { IERC20 token = IERC20(_token); uint256 balance = token.balanceOf(address(this)); require(balance > 0, "Sweepable: zero balance"); token.safeTransfer(destination, balance); } // @dev Sweeps a specific token `amount` to `destination` function sweepTokenAmount( address _token, address destination, uint256 amount ) public virtual onlySweeper notZero(destination) { IERC20 token = IERC20(_token); uint256 balance = token.balanceOf(address(this)); require(balance >= amount, "Sweepable: insufficient balance"); token.safeTransfer(destination, amount); } }
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity >=0.8.0; /// @notice Modern and gas efficient ERC20 + EIP-2612 implementation. /// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC20.sol) /// @author Modified from Uniswap (https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol) /// @dev Do not manually set balances without updating totalSupply, as the sum of all user balances must not exceed it. abstract contract ERC20 { /*////////////////////////////////////////////////////////////// EVENTS //////////////////////////////////////////////////////////////*/ event Transfer(address indexed from, address indexed to, uint256 amount); event Approval(address indexed owner, address indexed spender, uint256 amount); /*////////////////////////////////////////////////////////////// METADATA STORAGE //////////////////////////////////////////////////////////////*/ string public name; string public symbol; uint8 public immutable decimals; /*////////////////////////////////////////////////////////////// ERC20 STORAGE //////////////////////////////////////////////////////////////*/ uint256 public totalSupply; mapping(address => uint256) public balanceOf; mapping(address => mapping(address => uint256)) public allowance; /*////////////////////////////////////////////////////////////// EIP-2612 STORAGE //////////////////////////////////////////////////////////////*/ uint256 internal immutable INITIAL_CHAIN_ID; bytes32 internal immutable INITIAL_DOMAIN_SEPARATOR; mapping(address => uint256) public nonces; /*////////////////////////////////////////////////////////////// CONSTRUCTOR //////////////////////////////////////////////////////////////*/ constructor( string memory _name, string memory _symbol, uint8 _decimals ) { name = _name; symbol = _symbol; decimals = _decimals; INITIAL_CHAIN_ID = block.chainid; INITIAL_DOMAIN_SEPARATOR = computeDomainSeparator(); } /*////////////////////////////////////////////////////////////// ERC20 LOGIC //////////////////////////////////////////////////////////////*/ function approve(address spender, uint256 amount) public virtual returns (bool) { allowance[msg.sender][spender] = amount; emit Approval(msg.sender, spender, amount); return true; } function transfer(address to, uint256 amount) public virtual returns (bool) { balanceOf[msg.sender] -= amount; // Cannot overflow because the sum of all user // balances can't exceed the max uint256 value. unchecked { balanceOf[to] += amount; } emit Transfer(msg.sender, to, amount); return true; } function transferFrom( address from, address to, uint256 amount ) public virtual returns (bool) { uint256 allowed = allowance[from][msg.sender]; // Saves gas for limited approvals. if (allowed != type(uint256).max) allowance[from][msg.sender] = allowed - amount; balanceOf[from] -= amount; // Cannot overflow because the sum of all user // balances can't exceed the max uint256 value. unchecked { balanceOf[to] += amount; } emit Transfer(from, to, amount); return true; } /*////////////////////////////////////////////////////////////// EIP-2612 LOGIC //////////////////////////////////////////////////////////////*/ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) public virtual { require(deadline >= block.timestamp, "PERMIT_DEADLINE_EXPIRED"); // Unchecked because the only math done is incrementing // the owner's nonce which cannot realistically overflow. unchecked { address recoveredAddress = ecrecover( keccak256( abi.encodePacked( "\x19\x01", DOMAIN_SEPARATOR(), keccak256( abi.encode( keccak256( "Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)" ), owner, spender, value, nonces[owner]++, deadline ) ) ) ), v, r, s ); require(recoveredAddress != address(0) && recoveredAddress == owner, "INVALID_SIGNER"); allowance[recoveredAddress][spender] = value; } emit Approval(owner, spender, value); } function DOMAIN_SEPARATOR() public view virtual returns (bytes32) { return block.chainid == INITIAL_CHAIN_ID ? INITIAL_DOMAIN_SEPARATOR : computeDomainSeparator(); } function computeDomainSeparator() internal view virtual returns (bytes32) { return keccak256( abi.encode( keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"), keccak256(bytes(name)), keccak256("1"), block.chainid, address(this) ) ); } /*////////////////////////////////////////////////////////////// INTERNAL MINT/BURN LOGIC //////////////////////////////////////////////////////////////*/ function _mint(address to, uint256 amount) internal virtual { totalSupply += amount; // Cannot overflow because the sum of all user // balances can't exceed the max uint256 value. unchecked { balanceOf[to] += amount; } emit Transfer(address(0), to, amount); } function _burn(address from, uint256 amount) internal virtual { balanceOf[from] -= amount; // Cannot underflow because a user's balance // will never be larger than the total supply. unchecked { totalSupply -= amount; } emit Transfer(from, address(0), amount); } }
{ "evmVersion": "london", "libraries": {}, "metadata": { "bytecodeHash": "ipfs", "useLiteralContent": true }, "optimizer": { "enabled": true, "runs": 100000 }, "remappings": [], "viaIR": true, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"contract IUniversalRouter","name":"_uniswap","type":"address"},{"internalType":"contract Permit2","name":"_permit2","type":"address"},{"internalType":"address","name":"_initialOperator","type":"address"},{"internalType":"address","name":"_initialFeeDestination","type":"address"},{"internalType":"contract IWrappedNativeCurrency","name":"_wrappedNativeCurrency","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AlreadyProcessed","type":"error"},{"inputs":[],"name":"ExpiredIntent","type":"error"},{"inputs":[{"internalType":"address","name":"attemptedCurrency","type":"address"}],"name":"IncorrectCurrency","type":"error"},{"inputs":[],"name":"InexactTransfer","type":"error"},{"inputs":[{"internalType":"uint256","name":"difference","type":"uint256"}],"name":"InsufficientAllowance","type":"error"},{"inputs":[{"internalType":"uint256","name":"difference","type":"uint256"}],"name":"InsufficientBalance","type":"error"},{"inputs":[{"internalType":"int256","name":"difference","type":"int256"}],"name":"InvalidNativeAmount","type":"error"},{"inputs":[],"name":"InvalidSignature","type":"error"},{"inputs":[],"name":"InvalidTransferDetails","type":"error"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bool","name":"isRefund","type":"bool"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"NativeTransferFailed","type":"error"},{"inputs":[],"name":"NullRecipient","type":"error"},{"inputs":[],"name":"OperatorNotRegistered","type":"error"},{"inputs":[{"internalType":"bytes","name":"reason","type":"bytes"}],"name":"SwapFailedBytes","type":"error"},{"inputs":[{"internalType":"string","name":"reason","type":"string"}],"name":"SwapFailedString","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"address","name":"feeDestination","type":"address"}],"name":"OperatorRegistered","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"operator","type":"address"}],"name":"OperatorUnregistered","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bytes16","name":"id","type":"bytes16"},{"indexed":false,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"spentAmount","type":"uint256"},{"indexed":false,"internalType":"address","name":"spentCurrency","type":"address"}],"name":"Transferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"permit2","outputs":[{"internalType":"contract Permit2","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"registerOperator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_feeDestination","type":"address"}],"name":"registerOperatorWithFeeDestination","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newSweeper","type":"address"}],"name":"setSweeper","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"recipientAmount","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"address payable","name":"recipient","type":"address"},{"internalType":"address","name":"recipientCurrency","type":"address"},{"internalType":"address","name":"refundDestination","type":"address"},{"internalType":"uint256","name":"feeAmount","type":"uint256"},{"internalType":"bytes16","name":"id","type":"bytes16"},{"internalType":"address","name":"operator","type":"address"},{"internalType":"bytes","name":"signature","type":"bytes"},{"internalType":"bytes","name":"prefix","type":"bytes"}],"internalType":"struct TransferIntent","name":"_intent","type":"tuple"},{"internalType":"uint24","name":"poolFeesTier","type":"uint24"}],"name":"swapAndTransferUniswapV3Native","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"recipientAmount","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"address payable","name":"recipient","type":"address"},{"internalType":"address","name":"recipientCurrency","type":"address"},{"internalType":"address","name":"refundDestination","type":"address"},{"internalType":"uint256","name":"feeAmount","type":"uint256"},{"internalType":"bytes16","name":"id","type":"bytes16"},{"internalType":"address","name":"operator","type":"address"},{"internalType":"bytes","name":"signature","type":"bytes"},{"internalType":"bytes","name":"prefix","type":"bytes"}],"internalType":"struct TransferIntent","name":"_intent","type":"tuple"},{"components":[{"components":[{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"internalType":"struct ISignatureTransfer.TokenPermissions","name":"permitted","type":"tuple"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"internalType":"struct ISignatureTransfer.PermitTransferFrom","name":"permit","type":"tuple"},{"components":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"requestedAmount","type":"uint256"}],"internalType":"struct ISignatureTransfer.SignatureTransferDetails","name":"transferDetails","type":"tuple"},{"internalType":"bytes","name":"signature","type":"bytes"}],"internalType":"struct Permit2SignatureTransferData","name":"_signatureTransferData","type":"tuple"},{"internalType":"uint24","name":"poolFeesTier","type":"uint24"}],"name":"swapAndTransferUniswapV3Token","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"recipientAmount","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"address payable","name":"recipient","type":"address"},{"internalType":"address","name":"recipientCurrency","type":"address"},{"internalType":"address","name":"refundDestination","type":"address"},{"internalType":"uint256","name":"feeAmount","type":"uint256"},{"internalType":"bytes16","name":"id","type":"bytes16"},{"internalType":"address","name":"operator","type":"address"},{"internalType":"bytes","name":"signature","type":"bytes"},{"internalType":"bytes","name":"prefix","type":"bytes"}],"internalType":"struct TransferIntent","name":"_intent","type":"tuple"},{"internalType":"address","name":"_tokenIn","type":"address"},{"internalType":"uint256","name":"maxWillingToPay","type":"uint256"},{"internalType":"uint24","name":"poolFeesTier","type":"uint24"}],"name":"swapAndTransferUniswapV3TokenPreApproved","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"destination","type":"address"}],"name":"sweepETH","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"destination","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"sweepETHAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"destination","type":"address"}],"name":"sweepToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"destination","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"sweepTokenAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"sweeper","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"recipientAmount","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"address payable","name":"recipient","type":"address"},{"internalType":"address","name":"recipientCurrency","type":"address"},{"internalType":"address","name":"refundDestination","type":"address"},{"internalType":"uint256","name":"feeAmount","type":"uint256"},{"internalType":"bytes16","name":"id","type":"bytes16"},{"internalType":"address","name":"operator","type":"address"},{"internalType":"bytes","name":"signature","type":"bytes"},{"internalType":"bytes","name":"prefix","type":"bytes"}],"internalType":"struct TransferIntent","name":"_intent","type":"tuple"}],"name":"transferNative","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"recipientAmount","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"address payable","name":"recipient","type":"address"},{"internalType":"address","name":"recipientCurrency","type":"address"},{"internalType":"address","name":"refundDestination","type":"address"},{"internalType":"uint256","name":"feeAmount","type":"uint256"},{"internalType":"bytes16","name":"id","type":"bytes16"},{"internalType":"address","name":"operator","type":"address"},{"internalType":"bytes","name":"signature","type":"bytes"},{"internalType":"bytes","name":"prefix","type":"bytes"}],"internalType":"struct TransferIntent","name":"_intent","type":"tuple"},{"components":[{"components":[{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"internalType":"struct ISignatureTransfer.TokenPermissions","name":"permitted","type":"tuple"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"internalType":"struct ISignatureTransfer.PermitTransferFrom","name":"permit","type":"tuple"},{"components":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"requestedAmount","type":"uint256"}],"internalType":"struct ISignatureTransfer.SignatureTransferDetails","name":"transferDetails","type":"tuple"},{"internalType":"bytes","name":"signature","type":"bytes"}],"internalType":"struct Permit2SignatureTransferData","name":"_signatureTransferData","type":"tuple"}],"name":"transferToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"recipientAmount","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"address payable","name":"recipient","type":"address"},{"internalType":"address","name":"recipientCurrency","type":"address"},{"internalType":"address","name":"refundDestination","type":"address"},{"internalType":"uint256","name":"feeAmount","type":"uint256"},{"internalType":"bytes16","name":"id","type":"bytes16"},{"internalType":"address","name":"operator","type":"address"},{"internalType":"bytes","name":"signature","type":"bytes"},{"internalType":"bytes","name":"prefix","type":"bytes"}],"internalType":"struct TransferIntent","name":"_intent","type":"tuple"}],"name":"transferTokenPreApproved","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unregisterOperator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"recipientAmount","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"address payable","name":"recipient","type":"address"},{"internalType":"address","name":"recipientCurrency","type":"address"},{"internalType":"address","name":"refundDestination","type":"address"},{"internalType":"uint256","name":"feeAmount","type":"uint256"},{"internalType":"bytes16","name":"id","type":"bytes16"},{"internalType":"address","name":"operator","type":"address"},{"internalType":"bytes","name":"signature","type":"bytes"},{"internalType":"bytes","name":"prefix","type":"bytes"}],"internalType":"struct TransferIntent","name":"_intent","type":"tuple"},{"components":[{"components":[{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"internalType":"struct ISignatureTransfer.TokenPermissions","name":"permitted","type":"tuple"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"internalType":"struct ISignatureTransfer.PermitTransferFrom","name":"permit","type":"tuple"},{"components":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"requestedAmount","type":"uint256"}],"internalType":"struct ISignatureTransfer.SignatureTransferDetails","name":"transferDetails","type":"tuple"},{"internalType":"bytes","name":"signature","type":"bytes"}],"internalType":"struct Permit2SignatureTransferData","name":"_signatureTransferData","type":"tuple"}],"name":"unwrapAndTransfer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"recipientAmount","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"address payable","name":"recipient","type":"address"},{"internalType":"address","name":"recipientCurrency","type":"address"},{"internalType":"address","name":"refundDestination","type":"address"},{"internalType":"uint256","name":"feeAmount","type":"uint256"},{"internalType":"bytes16","name":"id","type":"bytes16"},{"internalType":"address","name":"operator","type":"address"},{"internalType":"bytes","name":"signature","type":"bytes"},{"internalType":"bytes","name":"prefix","type":"bytes"}],"internalType":"struct TransferIntent","name":"_intent","type":"tuple"}],"name":"unwrapAndTransferPreApproved","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"recipientAmount","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"address payable","name":"recipient","type":"address"},{"internalType":"address","name":"recipientCurrency","type":"address"},{"internalType":"address","name":"refundDestination","type":"address"},{"internalType":"uint256","name":"feeAmount","type":"uint256"},{"internalType":"bytes16","name":"id","type":"bytes16"},{"internalType":"address","name":"operator","type":"address"},{"internalType":"bytes","name":"signature","type":"bytes"},{"internalType":"bytes","name":"prefix","type":"bytes"}],"internalType":"struct TransferIntent","name":"_intent","type":"tuple"}],"name":"wrapAndTransfer","outputs":[],"stateMutability":"payable","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
61010034620002ec57601f6200619038819003918201601f19168301916001600160401b03831184841017620002f15780849260a094604052833981010312620002ec5780516001600160a01b039081811690818103620002ec5760208401519183831692838103620002ec576200007a6040870162000307565b9260806200008b6060890162000307565b9701519286841695868503620002ec5760009687549260405193338b82167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08c80a36001600160a81b0319163360ff60a01b191617895560018055608089905215159182620002e1575b5081620002d6575b5080620002ca575b80620002be575b156200027c575060a05260c05260e05282168152600360205260409081902080546001600160a01b0319169390921692909217905551615e7390816200031d82396080518181816104a901528181610faa015281816119f501528181611e4f01528181612372015281816128f6015281816129c10152818161306301528181613fcb01528181614bb80152818161513a015281816157de0152615908015260a0518181816140f2015281816142b301528181614312015281816145bf015281816146830152818161471c015281816147fb01528181614c2701528181614c8501528181614de2015281816150ea015281816152910152615379015260c0518181816113ff01528181611f2a0152818161246a0152612d66015260e051818181603001528181610fde0152818161116001528181611a5001528181611a8f01528181611e8b01528181612069015281816128bf0152818161400c0152818161435401528181614cc701526159420152f35b62461bcd60e51b815260206004820152601e60248201527f696e76616c696420636f6e7374727563746f7220706172616d657465727300006044820152606490fd5b5086881615156200010c565b50868516151562000105565b9050151538620000fd565b1515915038620000f5565b600080fd5b634e487b7160e01b600052604160045260246000fd5b51906001600160a01b0382168203620002ec5756fe608060405260043610156100b6575b361561001957600080fd5b73ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016330361005857005b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f6f6e6c792070617961626c6520666f7220756e7772617070696e6700000000006044820152fd5b60e060008035821c6304e0fc368114612e075780631163b2b014612d8a57806312261ee714612d1b57806323d4c2ba14612c8e578063258836fe14612b915780632acde09814612af35780633f4ba83a146129ff57806347a8c964146126415780635c975abb146125fe5780636614eb711461212e578063715018a61461209157806380747a8314611bf05780638456cb5914611b475780638648955314611ab75780638bf122da146118715780638da5cb5b146118205780639189a59e146117ce578063a54180af146116c4578063a876b89a14611636578063b8d8e4891461156e578063ccba8aac146111c2578063e536814714610d39578063f2fda4ae14610786578063f2fde38b1461064c5763fc8f31e0146101d757505061000e565b6101e03661329a565b90600154600214156101f19061341d565b60026001556101fe6136e0565b81359160209283820135936040830161021681613482565b91606085019761022589613482565b9261023260808801613482565b60a08801359560c0890193610246856134a3565b908a019661025388613482565b928d8b6040519586958d8c8801998a973097339746976103149b9a9894999590918b9792989398885260208801527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000809a81988280978160609d8e1b1660408401528c1b169060540152891b1660688c0152607c8b01527fffffffffffffffffffffffffffffffff0000000000000000000000000000000016609c8a0152851b1660ac88015260c0870152821b1660e08501521b1660f48201526101080190565b037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0810182526103449082613567565b519020986101208801996103588b8a6135a8565b9050156000149a6103939161039b9c610613576103759150613a6c565b61038d6103866101008c018c6135a8565b3691613633565b90613972565b9a909a61374d565b73ffffffffffffffffffffffffffffffffffffffff998a806103bc88613482565b169116036105e95742116105c0576103d48991613482565b161561059657876103e484613482565b168752600482527fffffffffffffffffffffffffffffffff0000000000000000000000000000000061041960408920926134a3565b168752815260ff60408720541661056c5786610436600393613482565b1686525284604085205416156105425761044f9161366a565b9384341160001461049457602461046686346136a6565b604051907fb06a5d510000000000000000000000000000000000000000000000000000000082526004820152fd5b8480341061052d57506104a690613482565b907f00000000000000000000000000000000000000000000000000000000000000009184831694859116036104fc57906104e791346104ee575b34906159cb565b6001805580f35b6104f7816157b5565b6104e0565b602484604051907f6453b66b0000000000000000000000000000000000000000000000000000000082526004820152fd5b61046661053d60249234906136a6565b6136b3565b60046040517f25ec6c1f000000000000000000000000000000000000000000000000000000008152fd5b60046040517f57eee766000000000000000000000000000000000000000000000000000000008152fd5b60046040517fdf99255c000000000000000000000000000000000000000000000000000000008152fd5b60046040517e80add4000000000000000000000000000000000000000000000000000000008152fd5b60046040517f8baa579f000000000000000000000000000000000000000000000000000000008152fd5b6106446106226040938d6135a8565b84919451938185928c84019788378201908b8201520389810184520182613567565b519020610375565b50346107835760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610783576106846132eb565b61068c61339e565b73ffffffffffffffffffffffffffffffffffffffff8091169081156106ff57600054827fffffffffffffffffffffffff0000000000000000000000000000000000000000821617600055167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a380f35b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152fd5b80fd5b5034610783577ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc608081360112610d355767ffffffffffffffff60043511610d35576101409060043536030112610783576107df61330e565b6044359062ffffff6064351660643503610bc8576108026002600154141561341d565b600260015561080f6136e0565b6109a5610820604460043501613482565b9161099d6064600435019361095561083786613482565b91610929610849608460043501613482565b9161085860c4600435016134a3565b9261086760e460043501613482565b6040805160048035908101356020830152602481013592820192909252606094851b7fffffffffffffffffffffffffffffffffffffffff0000000000000000000000009081168683015298851b8916607482015292841b8816608884015260a40135609c8301527fffffffffffffffffffffffffffffffff0000000000000000000000000000000090941660bc82015292811b851660cc8401524660e084015233811b851661010084015230901b909316610114820152918290610128820190565b037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08101835282613567565b602081519101206101246004350190610973826004356004016135a8565b15159050610cf4576109859150613a6c565b61038d610386610104600435016004356004016135a8565b92909261374d565b73ffffffffffffffffffffffffffffffffffffffff9182806109cb60e460043501613482565b169116036105e9574260246004350135106105c057816109ef604460043501613482565b16156105965781610a0460e460043501613482565b1685526004602052604085207fffffffffffffffffffffffffffffffff00000000000000000000000000000000610a3f60c4600435016134a3565b16865260205260ff60408620541661056c5781610a6060e460043501613482565b168552600360205281604086205416156105425781610a80911692613482565b168114610cc3576040517f70a082310000000000000000000000000000000000000000000000000000000090818152336004820152602081602481865afa908115610c4c578591610c91575b50838110610c5757506040517fdd62ed3e000000000000000000000000000000000000000000000000000000008152336004820152306024820152602081604481865afa908115610c4c578591610c1a575b50838110610be05750839083610b40575b506104e792506004356004016159cb565b9050604051908152306004820152602081602481855afa908115610bd5578491610b9c575b5082610b86610b9692610b7d6104e796303388613b6f565b84309184615b4e565b6064359083600435600401613f9c565b84610b2f565b90506020813d602011610bcd575b81610bb760209383613567565b81010312610bc857516104e7610b65565b600080fd5b3d9150610baa565b6040513d86823e3d90fd5b610bec602491856136a6565b604051907ff96fb0710000000000000000000000000000000000000000000000000000000082526004820152fd5b90506020813d602011610c44575b81610c3560209383613567565b81010312610bc8575185610b1e565b3d9150610c28565b6040513d87823e3d90fd5b610c63602491856136a6565b604051907f926653510000000000000000000000000000000000000000000000000000000082526004820152fd5b90506020813d602011610cbb575b81610cac60209383613567565b81010312610bc8575185610acc565b3d9150610c9f565b602490604051907f6453b66b0000000000000000000000000000000000000000000000000000000082526004820152fd5b610d2d610d086040936004356004016135a8565b8491945193818592602084019788378201906020820152036020810184520182613567565b519020610985565b5080fd5b503461078357610d483661329a565b9160015460021415610d599061341d565b6002600155610d666136e0565b8235602091829182860135916040870190610d8082613482565b906060890192610d8f84613482565b95610d9c60808c01613482565b968b8960a0820135998a9360c0840197610db5896134a3565b9401988b610dc28b613482565b60408051968701928352602083018a9052606093841b7fffffffffffffffffffffffffffffffffffffffff0000000000000000000000009081169184019190915293831b8416605483015293821b83166068820152607c8101969096527fffffffffffffffffffffffffffffffff00000000000000000000000000000000909416609c86015290831b811660ac8501524660c085015233831b811660e08501523090921b90911660f4830152806101088301037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081018252610ea49082613567565b5190208b6101208101610eb781836135a8565b905015600014610ef19b610ee99461038d93610386936111875750610edc9150613a6c565b925b6101008101906135a8565b98909861374d565b73ffffffffffffffffffffffffffffffffffffffff978880610f1287613482565b169116036105e95742116105c057610f2a8791613482565b16156105965785610f3a83613482565b168852600487527fffffffffffffffffffffffffffffffff00000000000000000000000000000000610f6f60408a20926134a3565b168852865260ff60408820541661056c57610f8a8591613482565b16865260038552836040872054161561054257610fa690613482565b83807f0000000000000000000000000000000000000000000000000000000000000000169116036111345790610fdb9161366a565b907f000000000000000000000000000000000000000000000000000000000000000016916040517f70a082310000000000000000000000000000000000000000000000000000000081523360048201528181602481875afa908115610c4c578591611107575b508281106110fb57506040517fdd62ed3e0000000000000000000000000000000000000000000000000000000081523360048201523060248201528181604481875afa918215610c4c5785926110cd575b50508181106110c157506104e7929381156159cb576110b382303386613b6f565b6110bc816158d2565b6159cb565b610bec906024926136a6565b90809250813d83116110f4575b6110e48183613567565b81010312610bc857513880611092565b503d6110da565b610c63602491846136a6565b90508181813d831161112d575b61111e8183613567565b81010312610bc8575138611041565b503d611114565b602483604051907f6453b66b0000000000000000000000000000000000000000000000000000000082527f0000000000000000000000000000000000000000000000000000000000000000166004820152fd5b60406111966111b992886135a8565b829591955194818692848401988937820190838201520390810184520182613567565b51902092610ede565b509034610d35577ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc9060608236011261156a5767ffffffffffffffff9182600435116114c25761014081600435360301126114c2576024359283116114c2578236030112610d355762ffffff6044351660443503610bc8576112496002600154141561341d565b60026001556112566136e0565b611264604460043501613482565b61128561127d6064600435019261095561083785613482565b91909161374d565b73ffffffffffffffffffffffffffffffffffffffff9081806112ab60e460043501613482565b169116036105e9574260246004350135106105c057806112cf604460043501613482565b161561059657806112e460e460043501613482565b1684526004602052604084207fffffffffffffffffffffffffffffffff0000000000000000000000000000000061131f60c4600435016134a3565b16855260205260ff60408520541661056c578061134060e460043501613482565b168452600360205280604085205416156105425782600401908061136e8161136785613482565b1694613482565b168314611539576084840193308261138587613482565b160361150f578060a487920135958294876113ac575b836104e788886004356004016159cb565b909192939450604051947f70a082310000000000000000000000000000000000000000000000000000000086523060048701526020866024818a5afa958615610c4c5785966114d5575b5060c4611427917f0000000000000000000000000000000000000000000000000000000000000000169401826135a8565b939091813b156114d15785809461146f604051978896879586947f30f28b7a000000000000000000000000000000000000000000000000000000008652339160048701613adc565b03925af180156114c6576114ae575b50506104e7926114946114a49284309184615b4e565b6044359083600435600401613f9c565b388481808061139b565b6114b7906134d0565b6114c257833861147e565b8380fd5b6040513d84823e3d90fd5b8580fd5b945094506020843d602011611507575b816114f260209383613567565b81010312610bc85792519387939060c46113f6565b3d91506114e5565b60046040517fed5c6561000000000000000000000000000000000000000000000000000000008152fd5b602483604051907f6453b66b0000000000000000000000000000000000000000000000000000000082526004820152fd5b8280fd5b50346107835760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610783577fa453db612af59e5521d6ab9284dc3e2d06af286eb1b1b7b771fce4716c19f2c16116306115ca6132eb565b3380855260036020908152604080872080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff959095169485179055805192835290820192909252918291820190565b0390a180f35b503461078357807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610783573381526003602052604081207fffffffffffffffffffffffff000000000000000000000000000000000000000081541690557f6f42117a557500c705ddf040a619d86f39101e6b74ac20d7b3e5943ba473fc7f6020604051338152a180f35b50346107835760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610783576116fc6132eb565b61170461330e565b906044359073ffffffffffffffffffffffffffffffffffffffff9061172e82600254163314615ca9565b61173b8285161515615c1e565b1691604051927f70a08231000000000000000000000000000000000000000000000000000000008452306004850152602084602481845afa938415610c4c578594611799575b5061179183611796951015615dd8565b615756565b80f35b93506020843d82116117c6575b816117b360209383613567565b81010312610bc857925192611791611781565b3d91506117a6565b503461078357807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261078357602073ffffffffffffffffffffffffffffffffffffffff60025416604051908152f35b503461078357807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126107835773ffffffffffffffffffffffffffffffffffffffff6020915416604051908152f35b507ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc604081360112610d355767ffffffffffffffff60043511610d355761014090600435360301126107835762ffffff6024351660243503610bc857611919906118e06002600154141561341d565b60026001556118ed6136e0565b6118fb604460043501613482565b6119116064600435019161095561083784613482565b93909361374d565b73ffffffffffffffffffffffffffffffffffffffff92838061193f60e460043501613482565b169116036105e9574260246004350135106105c05782611963604460043501613482565b1615610596578261197860e460043501613482565b1682526004602052604082207fffffffffffffffffffffffffffffffff000000000000000000000000000000006119b360c4600435016134a3565b16835260205260ff60408320541661056c57826119d460e460043501613482565b1682526003602052826040832054161561054257826119f282613482565b917f0000000000000000000000000000000000000000000000000000000000000000928284169586911614908115611a81575b506104fc57906104e791839034611a43575b506004356004016159cb565b611a7b91506024359034907f000000000000000000000000000000000000000000000000000000000000000016600435600401613f9c565b84611a37565b611a8b9150613482565b81167f000000000000000000000000000000000000000000000000000000000000000082161485611a25565b50346107835760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126107835761179681808080611af66132eb565b6024359073ffffffffffffffffffffffffffffffffffffffff90611b1f82600254163314615ca9565b16611b2b811515615c1e565b611b3782471015615dd8565b5af1611b41613d94565b50615d73565b503461078357807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261078357611b7e61339e565b611b866136e0565b740100000000000000000000000000000000000000007fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff8254161781557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586020604051338152a180f35b509034610d3557611c0036613331565b60019291925460021415611c139061341d565b6002600155611c206136e0565b8235602092839182860135916040870190611c3a82613482565b906060890192611c4984613482565b95611c5660808c01613482565b968b8960a0820135998a9360c0840197611c6f896134a3565b9401988b611c7c8b613482565b60408051968701928352602083018a9052606093841b7fffffffffffffffffffffffffffffffffffffffff0000000000000000000000009081169184019190915293831b8416605483015293821b83166068820152607c8101969096527fffffffffffffffffffffffffffffffff00000000000000000000000000000000909416609c86015290831b811660ac8501524660c085015233831b811660e08501523090921b90911660f4830152806101088301037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081018252611d5e9082613567565b5190208b6101208101611d7181836135a8565b905015600014611d969b610ee99461038d93610386936111875750610edc9150613a6c565b73ffffffffffffffffffffffffffffffffffffffff978880611db787613482565b169116036105e95742116105c057611dcf8791613482565b16156105965785611ddf83613482565b168a52600488527fffffffffffffffffffffffffffffffff00000000000000000000000000000000611e1460408c20926134a3565b168a52875260ff60408a20541661056c57611e2f8591613482565b16885260038652836040892054161561054257611e4b90613482565b83167f000000000000000000000000000000000000000000000000000000000000000084161480159061205b575b6120205790611e879161366a565b91817f000000000000000000000000000000000000000000000000000000000000000016936040517f70a082310000000000000000000000000000000000000000000000000000000081523360048201528181602481895afa918215612015578892611fe7575b5050838110610c57575082611f09575b50506104e7926159cb565b608081013083611f1883613482565b1614801590611fd9575b61150f5786927f00000000000000000000000000000000000000000000000000000000000000001691611f5860c08201826135a8565b939091813b156114d157858094611fa0604051978896879586947f30f28b7a000000000000000000000000000000000000000000000000000000008652339160048701613adc565b03925af180156114c657611fc5575b505082611fbe6104e7946158d2565b9238611efe565b611fce906134d0565b6114c2578338611faf565b508360a08301351415611f22565b90809250813d831161200e575b611ffe8183613567565b81010312610bc857513880611eee565b503d611ff4565b6040513d8a823e3d90fd5b60248361202c86613482565b6040517f6453b66b00000000000000000000000000000000000000000000000000000000815291166004820152fd5b5061206584613482565b83167f000000000000000000000000000000000000000000000000000000000000000084161415611e79565b503461078357807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610783576120c861339e565b600073ffffffffffffffffffffffffffffffffffffffff81547fffffffffffffffffffffffff000000000000000000000000000000000000000081168355167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b509034610d35576122aa61214136613331565b6121536002600194939454141561341d565b60026001556121606136e0565b60208301359361217260408501613482565b946122a285612268606082019861092961218b8b613482565b61219760808601613482565b92876121a560c088016134a3565b6121b08b8901613482565b604080518a356020820152908101939093527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606094851b81168585015294841b8516607484015295831b8416608883015260a090970135609c8201527fffffffffffffffffffffffffffffffff0000000000000000000000000000000090961660bc87015292831b811660cc8601524660e086015233831b81166101008601523090921b9091166101148401528290610128820190565b6020815191012061012087019061227f82896135a8565b151590506125e7576122919150613a6c565b61038d6103866101008901896135a8565b94909461374d565b73ffffffffffffffffffffffffffffffffffffffff9384806122cd858901613482565b169116036105e95742116105c057826122e860408601613482565b161561059657826122fa828601613482565b1686526004602052604086207fffffffffffffffffffffffffffffffff0000000000000000000000000000000061233360c087016134a3565b16875260205260ff60408720541661056c5761235183918501613482565b168552600360205281604086205416156105425761236e84613482565b82167f000000000000000000000000000000000000000000000000000000000000000083161480156125c8575b6125bc57816123a985613482565b166123b960a0850135853561366a565b92604051927f70a082310000000000000000000000000000000000000000000000000000000093848152336004820152602081602481875afa9081156125b157899161257f575b50858110612573575084612425575b5050505061241f6104e793613482565b916159cb565b60808101308361243483613482565b1614801590612565575b61150f578892604051958652306004870152602086602481885afa958615610bd557849661252e575b507f0000000000000000000000000000000000000000000000000000000000000000169161249860c08201826135a8565b939091813b156114d1578580946124e0604051978896879586947f30f28b7a000000000000000000000000000000000000000000000000000000008652339160048701613adc565b03925af180156114c657612516575b50509361250561241f926104e796309186615b4e565b61250e846157b5565b93388061240f565b612522909692966134d0565b6114d1579385386124ef565b935094506020833d60201161255d575b8161254b60209383613567565b81010312610bc8578892519438612467565b3d915061253e565b508560a0830135141561243e565b610c63602491876136a6565b90506020813d6020116125a9575b8161259a60209383613567565b81010312610bc8575138612400565b3d915061258d565b6040513d8b823e3d90fd5b9061202c602492613482565b506125d281613482565b82806125dd87613482565b169116141561239b565b6125f6610d086040938a6135a8565b519020612291565b503461078357807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126107835760ff6020915460a01c166040519015158152f35b5061264b3661329a565b6001546002141561265b9061341d565b60026001556126686136e0565b803560209081830135916040840161267f81613482565b91606086019761268e89613482565b9261269b60808901613482565b60a08901359560c08a01936126af856134a3565b908b01966126bc88613482565b604080518981018d8152602081018f9052606096871b7fffffffffffffffffffffffffffffffffffffffff0000000000000000000000009081169382019390935293861b8216605485015295851b81166068840152607c83018b90527fffffffffffffffffffffffffffffffff00000000000000000000000000000000909316609c830152831b821660ac8201524660c082015233831b821660e08201523090921b1660f482015290806101088301037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08101825261279b9082613567565b519020968861012081016127af81836135a8565b90501560001499610ee9926127de9b6129e857506127cd9150613a6c565b61038d6103866101008d018d6135a8565b73ffffffffffffffffffffffffffffffffffffffff9788806127ff88613482565b169116036105e95742116105c0576128178791613482565b1615610596578561282784613482565b168852600482527fffffffffffffffffffffffffffffffff0000000000000000000000000000000061285c60408a20926134a3565b168852815260ff60408820541661056c5784612879600393613482565b168752528260408620541615610542576128929161366a565b938434116000146128a957602461046686346136a6565b8480341061052d57506128bc8291613482565b817f000000000000000000000000000000000000000000000000000000000000000016928391160361299557503461291d575b506104e7907f00000000000000000000000000000000000000000000000000000000000000009034906159cb565b82813b1561078357600491604051928380927fd0e30db000000000000000000000000000000000000000000000000000000000825234905af1801561298a57612975575b508061296f6104e7926157b5565b906128ef565b916129836104e792936134d0565b9190612961565b6040513d85823e3d90fd5b602490604051907f6453b66b0000000000000000000000000000000000000000000000000000000082527f0000000000000000000000000000000000000000000000000000000000000000166004820152fd5b6106226040936129f7926135a8565b5190206127cd565b503461078357807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261078357612a3661339e565b805460ff8160a01c1615612a95577fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1681557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6020604051338152a180f35b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f5061757361626c653a206e6f74207061757365640000000000000000000000006044820152fd5b503461078357807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610783573380825260036020908152604080842080547fffffffffffffffffffffffff000000000000000000000000000000000000000016841790558051838152918201929092527fa453db612af59e5521d6ab9284dc3e2d06af286eb1b1b7b771fce4716c19f2c19181908101611630565b50346107835760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261078357612bc96132eb565b612bd161330e565b9073ffffffffffffffffffffffffffffffffffffffff90612bf782600254163314615ca9565b612c048284161515615c1e565b16604051917f70a08231000000000000000000000000000000000000000000000000000000008352306004840152602083602481855afa918215610bd5578492612c59575b6117969350611791831515615d0e565b91506020833d8211612c86575b81612c7360209383613567565b810103126114c257611796925191612c49565b3d9150612c66565b50346107835760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126107835773ffffffffffffffffffffffffffffffffffffffff612cdb6132eb565b612ce361339e565b16612cef811515615c1e565b7fffffffffffffffffffffffff0000000000000000000000000000000000000000600254161760025580f35b503461078357807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261078357602060405173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b50346107835760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126107835761179681808080612dc96132eb565b73ffffffffffffffffffffffffffffffffffffffff90612dee82600254163314615ca9565b16612dfa811515615c1e565b4790611b37821515615d0e565b509034610d3557612e173661329a565b60015460021415612e279061341d565b6002600155612e346136e0565b803560208083013593604084019484612e4c87613482565b926060820197612e5b89613482565b94612e6860808501613482565b908760a0860135978892888c60c08a0198612e828a6134a3565b9a0199612e8e8b613482565b6040805197880193845260208401949094527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606095861b81169484019490945294841b8316605483015296831b82166068820152607c8101959095527fffffffffffffffffffffffffffffffff00000000000000000000000000000000909516609c85015290811b841660ac8401524660c084015233811b841660e084015230901b90921660f482015290806101088301037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081018252612f709082613567565b51902093886101208101612f8481836135a8565b90501560001496612fa292612faa9861326957506127cd9150613a6c565b95909561374d565b73ffffffffffffffffffffffffffffffffffffffff948580612fcb87613482565b169116036105e95742116105c057612fe38491613482565b16156105965782612ff383613482565b168952600485527fffffffffffffffffffffffffffffffff0000000000000000000000000000000061302860408b20926134a3565b168952845260ff60408920541661056c576130438291613482565b1687526003835280604088205416156105425761305f86613482565b81167f000000000000000000000000000000000000000000000000000000000000000082161461325d579061309e9161309787613482565b169361366a565b916040517f70a0823100000000000000000000000000000000000000000000000000000000908181523360048201528381602481865afa908115612015578891613230575b5084811061322457506040517fdd62ed3e0000000000000000000000000000000000000000000000000000000081523360048201523060248201528381604481865afa9081156120155788916131f3575b508481106131e7575083613152575b50505061241f6104e793613482565b6040519081523060048201528281602481855afa9283156131dc5787936131a6575b50509361319661241f926104e79661318e86303384613b6f565b309186615b4e565b61319f846157b5565b9338613143565b908096929350813d83116131d5575b6131bf8183613567565b810103126114d1579351906131966104e7613174565b503d6131b5565b6040513d89823e3d90fd5b610bec602491866136a6565b90508381813d831161321d575b61320a8183613567565b81010312613219575138613134565b8780fd5b503d613200565b610c63602491866136a6565b90508381813d8311613256575b6132478183613567565b810103126132195751386130e3565b503d61323d565b60249061202c87613482565b6132786040936129f7926135a8565b8c8592955194828693838501988937830191820152038c810184520182613567565b7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc90602082820112610bc8576004359167ffffffffffffffff8311610bc8578261014092030112610bc85760040190565b6004359073ffffffffffffffffffffffffffffffffffffffff82168203610bc857565b6024359073ffffffffffffffffffffffffffffffffffffffff82168203610bc857565b907ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc91604083820112610bc85767ffffffffffffffff90600435828111610bc857610140858284030112610bc85760040193602435928311610bc8578260e092030112610bc85760040190565b73ffffffffffffffffffffffffffffffffffffffff6000541633036133bf57565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b1561342457565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152fd5b3573ffffffffffffffffffffffffffffffffffffffff81168103610bc85790565b357fffffffffffffffffffffffffffffffff0000000000000000000000000000000081168103610bc85790565b67ffffffffffffffff81116134e457604052565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6060810190811067ffffffffffffffff8211176134e457604052565b6040810190811067ffffffffffffffff8211176134e457604052565b6080810190811067ffffffffffffffff8211176134e457604052565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff8211176134e457604052565b9035907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe181360301821215610bc8570180359067ffffffffffffffff8211610bc857602001918136038313610bc857565b67ffffffffffffffff81116134e457601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b92919261363f826135f9565b9161364d6040519384613567565b829481845281830111610bc8578281602093846000960137010152565b9190820180921161367757565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b9190820391821161367757565b7f800000000000000000000000000000000000000000000000000000000000000081146136775760000390565b60ff60005460a01c166136ef57565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152fd5b6005811015613943578061375e5750565b600181036137c45760646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152fd5b6002810361382a5760646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152fd5b600381036138b65760846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c60448201527f75650000000000000000000000000000000000000000000000000000000000006064820152fd5b6004146138bf57565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c60448201527f75650000000000000000000000000000000000000000000000000000000000006064820152fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b9060418151146000146139a05761399c916020820151906060604084015193015160001a906139aa565b9091565b5050600090600290565b9291907f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311613a605760ff16601b81141580613a55575b613a49579160809493916020936040519384528484015260408301526060820152600093849182805260015afa15613a3c57815173ffffffffffffffffffffffffffffffffffffffff811615613a36579190565b50600190565b50604051903d90823e3d90fd5b50505050600090600490565b50601c8114156139e2565b50505050600090600390565b60405160208101917f19457468657265756d205369676e6564204d6573736167653a0a3332000000008352603c820152603c8152613aa981613513565b51902090565b803573ffffffffffffffffffffffffffffffffffffffff8116809103610bc8578252602090810135910152565b9394907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe093613b44601f94606073ffffffffffffffffffffffffffffffffffffffff94613b298a82613aaf565b604081013560408b0152013560608901526080880190613aaf565b1660c0850152806101008060e087015285015280610120958686013760008582860101520116010190565b6040517f23b872dd00000000000000000000000000000000000000000000000000000000602082015273ffffffffffffffffffffffffffffffffffffffff92831660248201529290911660448301526064820192909252613c0491613bff82608481015b037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08101845283613567565b613c06565b565b73ffffffffffffffffffffffffffffffffffffffff1690604051613c298161352f565b6020928382527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656484830152803b15613d365790613c7e9160008481959282888195519301915af1613c78613d94565b90613e22565b805180613c8c575b50505050565b81849181010312610d3557820151908115918215036107835750613cb257808080613c86565b608490604051907f08c379a00000000000000000000000000000000000000000000000000000000082526004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152fd5b606484604051907f08c379a00000000000000000000000000000000000000000000000000000000082526004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152fd5b3d15613dbf573d90613da5826135f9565b91613db36040519384613567565b82523d6000602084013e565b606090565b919082519283825260005b848110613e0e5750507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8460006020809697860101520116010190565b602081830181015184830182015201613dcf565b90919015613e2e575090565b815115613e3e5750805190602001fd5b613e7c906040519182917f08c379a0000000000000000000000000000000000000000000000000000000008352602060048401526024830190613dc4565b0390fd5b805115613e8d5760200190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b805160011015613e8d5760400190565b805160021015613e8d5760600190565b805160031015613e8d5760800190565b805160041015613e8d5760a00190565b805160051015613e8d5760c00190565b600060443d10613f88576040517ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc91823d016004833e815167ffffffffffffffff918282113d602484011117613f8b57818401948551938411613f93573d85010160208487010111613f8b5750613f8892910160200190613567565b90565b949350505050565b50949350505050565b9193929093600094600093613fb360608201613482565b73ffffffffffffffffffffffffffffffffffffffff807f0000000000000000000000000000000000000000000000000000000000000000169116146000146157445773ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016905b61413461416961404360a0840135843561366a565b967fffffff0000000000000000000000000000000000000000000000000000000000604051917fffffffffffffffffffffffffffffffffffffffff0000000000000000000000008760601b16602084015260e81b1660348201527fffffffffffffffffffffffffffffffffffffffff0000000000000000000000008660601b166037820152602b81526140d581613513565b60405192839173ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016602084015289604084015288606084015260a0608084015260c0830190613dc4565b600060a08301527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08282030182520382613567565b61417560608301613482565b9573ffffffffffffffffffffffffffffffffffffffff61419760408501613482565b81604051991660208a015216604088015282356060880152606087526141bc8761354b565b6141c860608401613482565b9573ffffffffffffffffffffffffffffffffffffffff6141ea60e08601613482565b16600052600360205261428173ffffffffffffffffffffffffffffffffffffffff60406000205416614255604051998a9260a0890135916020850160409194939294606082019573ffffffffffffffffffffffffffffffffffffffff80921683521660208201520152565b037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08101895288613567565b60009081903415615037575050505061429b34333161366a565b9473ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001631604051907f70a0823100000000000000000000000000000000000000000000000000000000825273ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016600483015260208260248173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000165afa908115614fc357600091615001575b61438f925061366a565b9673ffffffffffffffffffffffffffffffffffffffff6143b160e08601613482565b16600052600360205273ffffffffffffffffffffffffffffffffffffffff60406000205416604051907f70a08231000000000000000000000000000000000000000000000000000000008252600482015260208160248173ffffffffffffffffffffffffffffffffffffffff8a165afa908115614fc357600091614fcf575b509261443e60408601613482565b73ffffffffffffffffffffffffffffffffffffffff604051917f70a0823100000000000000000000000000000000000000000000000000000000835216600482015260208160248173ffffffffffffffffffffffffffffffffffffffff8b165afa908115614fc357600091614f91575b50926040517f0b0000000000000000000000000000000000000000000000000000000000000060208201527f010000000000000000000000000000000000000000000000000000000000000060218201527f050000000000000000000000000000000000000000000000000000000000000080602283015260238201527f0c0000000000000000000000000000000000000000000000000000000000000060248201527f04000000000000000000000000000000000000000000000000000000000000006025820152600681526145848161352f565b92604051918260e081011067ffffffffffffffff60e0850111176134e45760e083016040526006835260005b60c08110614f805750604080517f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166020820152349181019190915292936147039385939291906146198160608101610929565b61462285613e80565b5261462c84613e80565b5061463684613ebc565b5261464083613ebc565b5061464a83613ecc565b5261465482613ecc565b5061465e82613edc565b5261466881613edc565b5060405173ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016602082015260006040820152604081526146bc81613513565b6146c582613eec565b526146cf81613eec565b506040516000602082015233604082015260006060820152606081526146f48161354b565b6146fd82613efc565b52613efc565b505b73ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000163b15610bc85790614781916040519283927f3593564c000000000000000000000000000000000000000000000000000000008452606060048501526064840190613dc4565b7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc838203016024840152815180825260208201916020808360051b8301019401926000915b838310614f3157505050505090806000926020880135604483015203813473ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000165af19081614f1d575b50614b9857505050505050506001908060033d11614b88575b6308c379a014614b34575b5061484f57565b614857613d94565b805160208201207f865c3ff234d3d0edd202666a7ee80e1df8991d5f3d0735c47363eaf02da248f681036148e35760646040517f8a627c1600000000000000000000000000000000000000000000000000000000815260206004820152600d60248201527f5633496e76616c696453776170000000000000000000000000000000000000006044820152fd5b7f7949afa5f7d1aca4443eae437acb1046b7439815697e5489cca05d226a192b1381036149685760646040517f8a627c1600000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f5633546f6f4c6974746c655265636569766564000000000000000000000000006044820152fd5b7f6c00b934adb0b7404a228838c719adfbb4e9deac0b09dc9249e888189cb51f6a81036149ed5760646040517f8a627c1600000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f5633546f6f4d75636852657175657374656400000000000000000000000000006044820152fd5b7f483c13bc9b4251bad271f371298893f2995abed398de6edf3108289714194b898103614a725760646040517f8a627c1600000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f5633496e76616c6964416d6f756e744f757400000000000000000000000000006044820152fd5b7ff14c0a0eab0cabeb85cee7eed6c1c3d990aa7959546121092a1062bf3a5d784103614af65760646040517f8a627c1600000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f5633496e76616c696443616c6c657200000000000000000000000000000000006044820152fd5b613e7c906040519182917f917827e1000000000000000000000000000000000000000000000000000000008352602060048401526024830190613dc4565b614b3c613f0c565b9081614b485750614848565b613e7c9250506040519182917f8a627c16000000000000000000000000000000000000000000000000000000008352602060048401526024830190613dc4565b50600481803e805160e01c61483d565b90919293949597985073ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff614bf960608601613482565b1603614e91575b505034159150614d5c9050575033319173ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016316040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016600482015260208160248173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000165afa928315614d505792614d18575b50613f8894614d0c614d129493614d0c9361366a565b9261366a565b906136a6565b9291506020833d602011614d48575b81614d3460209383613567565b81010312610bc85791519091613f88614cf6565b3d9150614d27565b604051903d90823e3d90fd5b9160409391935173ffffffffffffffffffffffffffffffffffffffff7f70a0823100000000000000000000000000000000000000000000000000000000948583523360048401521690602081602481855afa801561298a578390614e5e575b6020915094602460405180948193825273ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001660048301525afa918215614d505791614e28575b50613f8893614d1292614d0c9161366a565b9390506020843d602011614e56575b81614e4460209383613567565b81010312610bc8579251614d0c614e16565b3d9150614e37565b506020813d602011614e89575b81614e7860209383613567565b81010312610bc85760209051614dbb565b3d9150614e6b565b614eeb614f149473ffffffffffffffffffffffffffffffffffffffff614eb960e08701613482565b168952600360205273ffffffffffffffffffffffffffffffffffffffff8060408b2054169116809460a0870135615b4e565b73ffffffffffffffffffffffffffffffffffffffff614f0c60408501613482565b169235615b4e565b38808080614c00565b614f289199506134d0565b60009738614824565b919395509193602080614f6e837fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe086600196030187528951613dc4565b970193019301909286959492936147c6565b8060606020809387010152016145b0565b90506020813d602011614fbb575b81614fac60209383613567565b81010312610bc85751386144ae565b3d9150614f9f565b6040513d6000823e3d90fd5b90506020813d602011614ff9575b81614fea60209383613567565b81010312610bc8575138614430565b3d9150614fdd565b90506020823d60201161502f575b8161501c60209383613567565b81010312610bc85761438f915190614385565b3d915061500f565b6040989294919398517f70a0823100000000000000000000000000000000000000000000000000000000815233600482015260208160248173ffffffffffffffffffffffffffffffffffffffff8d165afa8015614fc357829060009061570e575b6150a2925061366a565b9873ffffffffffffffffffffffffffffffffffffffff60208a6024604051809481937f70a08231000000000000000000000000000000000000000000000000000000008352817f0000000000000000000000000000000000000000000000000000000000000000166004840152165afa908115614fc3576000916156dc575b509a73ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff61517b60608b01613482565b16036153cb576040517f010000000000000000000000000000000000000000000000000000000000000060208201527f0c0000000000000000000000000000000000000000000000000000000000000060218201527f050000000000000000000000000000000000000000000000000000000000000080602283015260238201527f040000000000000000000000000000000000000000000000000000000000000060248201526005815261522f8161352f565b94604051928360c081011067ffffffffffffffff60c0860111176134e45760c084016040526005845260005b60a081106153ba57509183916109296152dc615360956153b598979961528087613e80565b5261528a86613e80565b50604080517f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166020820152908101919091529182906060820190565b6152e584613ebc565b526152ef83613ebc565b506152f983613ecc565b5261530382613ecc565b5061530d82613edc565b5261531781613edc565b5060405173ffffffffffffffffffffffffffffffffffffffff8c16602082015233604082015260006060820152606081526153518161354b565b61535a82613eec565b52613eec565b505b73ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8a16615756565b614705565b80606060208093880101520161525b565b945050935073ffffffffffffffffffffffffffffffffffffffff6153f160e08701613482565b16600052600360205273ffffffffffffffffffffffffffffffffffffffff60406000205416604051907f70a08231000000000000000000000000000000000000000000000000000000008252600482015260208160248173ffffffffffffffffffffffffffffffffffffffff8b165afa908115614fc3576000916156aa575b509361547e60408701613482565b73ffffffffffffffffffffffffffffffffffffffff604051917f70a0823100000000000000000000000000000000000000000000000000000000835216600482015260208160248173ffffffffffffffffffffffffffffffffffffffff8c165afa908115614fc357600091615678575b5093604051907f010000000000000000000000000000000000000000000000000000000000000060208301527f050000000000000000000000000000000000000000000000000000000000000080602184015260228301527f040000000000000000000000000000000000000000000000000000000000000060238301526004825281604081011067ffffffffffffffff6040840111176134e45781946040830160e084011067ffffffffffffffff60e0850111176134e45760e083016040526004604084015260005b6080811061566857508261566292604092836153b5979601976155dc858501613e80565b526155e8848401613e80565b506155f4848401613ebc565b52615600838301613ebc565b5061560c838301613ecc565b52615618828201613ecc565b50815173ffffffffffffffffffffffffffffffffffffffff8d166020820152338382015260006060820152606081526156508161354b565b61565b838301613edc565b5201613edc565b50615362565b60608482018101526020016155b8565b90506020813d6020116156a2575b8161569360209383613567565b81010312610bc85751386154ee565b3d9150615686565b90506020813d6020116156d4575b816156c560209383613567565b81010312610bc8575138615470565b3d91506156b8565b90506020813d602011615706575b816156f760209383613567565b81010312610bc8575138615121565b3d91506156ea565b50506020813d60201161573c575b8161572960209383613567565b81010312610bc857816150a29151615098565b3d915061571c565b61575060608201613482565b9061402e565b6040517fa9059cbb00000000000000000000000000000000000000000000000000000000602082015273ffffffffffffffffffffffffffffffffffffffff90921660248301526044820192909252613c0491613bff8260648101613bd3565b606081016157c281613482565b73ffffffffffffffffffffffffffffffffffffffff91829182167f0000000000000000000000000000000000000000000000000000000000000000831603615861575050813580615844575b5060a0820135908161581f57505050565b8061582f60e0613c049501613482565b16600052600360205260406000205416615acd565b61585b908261585560408601613482565b16615acd565b3861580e565b61586a90613482565b168235806158b4575b5060a083013591826158855750505050565b8061589560e06158ab9601613482565b1660005260036020526040600020541690615756565b38808080613c86565b6158cc90836158c560408701613482565b1683615756565b38615873565b6158e160a0820135823561366a565b906158ee60608201613482565b73ffffffffffffffffffffffffffffffffffffffff9081167f0000000000000000000000000000000000000000000000000000000000000000821614806159c2575b615940575b50613c0491506157b5565b7f00000000000000000000000000000000000000000000000000000000000000001691823b15610bc8576000926024849260405195869384927f2e1a7d4d00000000000000000000000000000000000000000000000000000000845260048401525af1918215614fc357613c049215615935576159bc906134d0565b38615935565b50821515615930565b9160a0907fb7ee4fafa10d16ee883a136a3dcc9179d8e6041ba71cc29c2b0bce4f7bdd6e869260e085019073ffffffffffffffffffffffffffffffffffffffff92839182615a1885613482565b1660005260046020528288615aa96040615aa2615a9c60c0836000209501997fffffffffffffffffffffffffffffffff000000000000000000000000000000009586615a638d6134a3565b166000526020528360002060017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00825416179055613482565b986134a3565b9b01613482565b906040519a168a5216602089015233604089015260608801521660808601521692a2565b73ffffffffffffffffffffffffffffffffffffffff16600080808085855af1615af4613d94565b9015615aff57505050565b613e7c906040519384937f28688b550000000000000000000000000000000000000000000000000000000085526004850152602484015260006044840152608060648401526084830190613dc4565b9290916020906024604051809481937f70a0823100000000000000000000000000000000000000000000000000000000835273ffffffffffffffffffffffffffffffffffffffff8092166004840152165afa908115614fc357600091615beb575b5090615bba916136a6565b03615bc157565b60046040517fee20c618000000000000000000000000000000000000000000000000000000008152fd5b906020823d8211615c16575b81615c0460209383613567565b81010312610783575051615bba615baf565b3d9150615bf7565b15615c2557565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f537765657061626c653a2063616e6e6f74206265207a65726f2061646472657360448201527f73000000000000000000000000000000000000000000000000000000000000006064820152fd5b15615cb057565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f537765657061626c653a206e6f742074686520737765657065720000000000006044820152fd5b15615d1557565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f537765657061626c653a207a65726f2062616c616e63650000000000000000006044820152fd5b15615d7a57565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f537765657061626c653a207472616e73666572206572726f72000000000000006044820152fd5b15615ddf57565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f537765657061626c653a20696e73756666696369656e742062616c616e6365006044820152fdfea2646970667358221220c2d6dd41fd140f8cb6cfe88a313ddec3c245be17abaa588ab4c338c1e5c61ac564736f6c634300081100330000000000000000000000003fc91a3afd70395cd496c647d5a6cc9d4b2b7fad000000000000000000000000000000000022d473030f116ddee9f6b43ac78ba30000000000000000000000008fccc78dae0a8f93b0fe6799de888d4c57e273db0000000000000000000000006d8675a52438849d90241cb639fba41bdc3329c8000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
Deployed Bytecode
0x608060405260043610156100b6575b361561001957600080fd5b73ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc216330361005857005b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f6f6e6c792070617961626c6520666f7220756e7772617070696e6700000000006044820152fd5b60e060008035821c6304e0fc368114612e075780631163b2b014612d8a57806312261ee714612d1b57806323d4c2ba14612c8e578063258836fe14612b915780632acde09814612af35780633f4ba83a146129ff57806347a8c964146126415780635c975abb146125fe5780636614eb711461212e578063715018a61461209157806380747a8314611bf05780638456cb5914611b475780638648955314611ab75780638bf122da146118715780638da5cb5b146118205780639189a59e146117ce578063a54180af146116c4578063a876b89a14611636578063b8d8e4891461156e578063ccba8aac146111c2578063e536814714610d39578063f2fda4ae14610786578063f2fde38b1461064c5763fc8f31e0146101d757505061000e565b6101e03661329a565b90600154600214156101f19061341d565b60026001556101fe6136e0565b81359160209283820135936040830161021681613482565b91606085019761022589613482565b9261023260808801613482565b60a08801359560c0890193610246856134a3565b908a019661025388613482565b928d8b6040519586958d8c8801998a973097339746976103149b9a9894999590918b9792989398885260208801527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000809a81988280978160609d8e1b1660408401528c1b169060540152891b1660688c0152607c8b01527fffffffffffffffffffffffffffffffff0000000000000000000000000000000016609c8a0152851b1660ac88015260c0870152821b1660e08501521b1660f48201526101080190565b037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0810182526103449082613567565b519020986101208801996103588b8a6135a8565b9050156000149a6103939161039b9c610613576103759150613a6c565b61038d6103866101008c018c6135a8565b3691613633565b90613972565b9a909a61374d565b73ffffffffffffffffffffffffffffffffffffffff998a806103bc88613482565b169116036105e95742116105c0576103d48991613482565b161561059657876103e484613482565b168752600482527fffffffffffffffffffffffffffffffff0000000000000000000000000000000061041960408920926134a3565b168752815260ff60408720541661056c5786610436600393613482565b1686525284604085205416156105425761044f9161366a565b9384341160001461049457602461046686346136a6565b604051907fb06a5d510000000000000000000000000000000000000000000000000000000082526004820152fd5b8480341061052d57506104a690613482565b907f00000000000000000000000000000000000000000000000000000000000000009184831694859116036104fc57906104e791346104ee575b34906159cb565b6001805580f35b6104f7816157b5565b6104e0565b602484604051907f6453b66b0000000000000000000000000000000000000000000000000000000082526004820152fd5b61046661053d60249234906136a6565b6136b3565b60046040517f25ec6c1f000000000000000000000000000000000000000000000000000000008152fd5b60046040517f57eee766000000000000000000000000000000000000000000000000000000008152fd5b60046040517fdf99255c000000000000000000000000000000000000000000000000000000008152fd5b60046040517e80add4000000000000000000000000000000000000000000000000000000008152fd5b60046040517f8baa579f000000000000000000000000000000000000000000000000000000008152fd5b6106446106226040938d6135a8565b84919451938185928c84019788378201908b8201520389810184520182613567565b519020610375565b50346107835760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610783576106846132eb565b61068c61339e565b73ffffffffffffffffffffffffffffffffffffffff8091169081156106ff57600054827fffffffffffffffffffffffff0000000000000000000000000000000000000000821617600055167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a380f35b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152fd5b80fd5b5034610783577ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc608081360112610d355767ffffffffffffffff60043511610d35576101409060043536030112610783576107df61330e565b6044359062ffffff6064351660643503610bc8576108026002600154141561341d565b600260015561080f6136e0565b6109a5610820604460043501613482565b9161099d6064600435019361095561083786613482565b91610929610849608460043501613482565b9161085860c4600435016134a3565b9261086760e460043501613482565b6040805160048035908101356020830152602481013592820192909252606094851b7fffffffffffffffffffffffffffffffffffffffff0000000000000000000000009081168683015298851b8916607482015292841b8816608884015260a40135609c8301527fffffffffffffffffffffffffffffffff0000000000000000000000000000000090941660bc82015292811b851660cc8401524660e084015233811b851661010084015230901b909316610114820152918290610128820190565b037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08101835282613567565b602081519101206101246004350190610973826004356004016135a8565b15159050610cf4576109859150613a6c565b61038d610386610104600435016004356004016135a8565b92909261374d565b73ffffffffffffffffffffffffffffffffffffffff9182806109cb60e460043501613482565b169116036105e9574260246004350135106105c057816109ef604460043501613482565b16156105965781610a0460e460043501613482565b1685526004602052604085207fffffffffffffffffffffffffffffffff00000000000000000000000000000000610a3f60c4600435016134a3565b16865260205260ff60408620541661056c5781610a6060e460043501613482565b168552600360205281604086205416156105425781610a80911692613482565b168114610cc3576040517f70a082310000000000000000000000000000000000000000000000000000000090818152336004820152602081602481865afa908115610c4c578591610c91575b50838110610c5757506040517fdd62ed3e000000000000000000000000000000000000000000000000000000008152336004820152306024820152602081604481865afa908115610c4c578591610c1a575b50838110610be05750839083610b40575b506104e792506004356004016159cb565b9050604051908152306004820152602081602481855afa908115610bd5578491610b9c575b5082610b86610b9692610b7d6104e796303388613b6f565b84309184615b4e565b6064359083600435600401613f9c565b84610b2f565b90506020813d602011610bcd575b81610bb760209383613567565b81010312610bc857516104e7610b65565b600080fd5b3d9150610baa565b6040513d86823e3d90fd5b610bec602491856136a6565b604051907ff96fb0710000000000000000000000000000000000000000000000000000000082526004820152fd5b90506020813d602011610c44575b81610c3560209383613567565b81010312610bc8575185610b1e565b3d9150610c28565b6040513d87823e3d90fd5b610c63602491856136a6565b604051907f926653510000000000000000000000000000000000000000000000000000000082526004820152fd5b90506020813d602011610cbb575b81610cac60209383613567565b81010312610bc8575185610acc565b3d9150610c9f565b602490604051907f6453b66b0000000000000000000000000000000000000000000000000000000082526004820152fd5b610d2d610d086040936004356004016135a8565b8491945193818592602084019788378201906020820152036020810184520182613567565b519020610985565b5080fd5b503461078357610d483661329a565b9160015460021415610d599061341d565b6002600155610d666136e0565b8235602091829182860135916040870190610d8082613482565b906060890192610d8f84613482565b95610d9c60808c01613482565b968b8960a0820135998a9360c0840197610db5896134a3565b9401988b610dc28b613482565b60408051968701928352602083018a9052606093841b7fffffffffffffffffffffffffffffffffffffffff0000000000000000000000009081169184019190915293831b8416605483015293821b83166068820152607c8101969096527fffffffffffffffffffffffffffffffff00000000000000000000000000000000909416609c86015290831b811660ac8501524660c085015233831b811660e08501523090921b90911660f4830152806101088301037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081018252610ea49082613567565b5190208b6101208101610eb781836135a8565b905015600014610ef19b610ee99461038d93610386936111875750610edc9150613a6c565b925b6101008101906135a8565b98909861374d565b73ffffffffffffffffffffffffffffffffffffffff978880610f1287613482565b169116036105e95742116105c057610f2a8791613482565b16156105965785610f3a83613482565b168852600487527fffffffffffffffffffffffffffffffff00000000000000000000000000000000610f6f60408a20926134a3565b168852865260ff60408820541661056c57610f8a8591613482565b16865260038552836040872054161561054257610fa690613482565b83807f0000000000000000000000000000000000000000000000000000000000000000169116036111345790610fdb9161366a565b907f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc216916040517f70a082310000000000000000000000000000000000000000000000000000000081523360048201528181602481875afa908115610c4c578591611107575b508281106110fb57506040517fdd62ed3e0000000000000000000000000000000000000000000000000000000081523360048201523060248201528181604481875afa918215610c4c5785926110cd575b50508181106110c157506104e7929381156159cb576110b382303386613b6f565b6110bc816158d2565b6159cb565b610bec906024926136a6565b90809250813d83116110f4575b6110e48183613567565b81010312610bc857513880611092565b503d6110da565b610c63602491846136a6565b90508181813d831161112d575b61111e8183613567565b81010312610bc8575138611041565b503d611114565b602483604051907f6453b66b0000000000000000000000000000000000000000000000000000000082527f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2166004820152fd5b60406111966111b992886135a8565b829591955194818692848401988937820190838201520390810184520182613567565b51902092610ede565b509034610d35577ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc9060608236011261156a5767ffffffffffffffff9182600435116114c25761014081600435360301126114c2576024359283116114c2578236030112610d355762ffffff6044351660443503610bc8576112496002600154141561341d565b60026001556112566136e0565b611264604460043501613482565b61128561127d6064600435019261095561083785613482565b91909161374d565b73ffffffffffffffffffffffffffffffffffffffff9081806112ab60e460043501613482565b169116036105e9574260246004350135106105c057806112cf604460043501613482565b161561059657806112e460e460043501613482565b1684526004602052604084207fffffffffffffffffffffffffffffffff0000000000000000000000000000000061131f60c4600435016134a3565b16855260205260ff60408520541661056c578061134060e460043501613482565b168452600360205280604085205416156105425782600401908061136e8161136785613482565b1694613482565b168314611539576084840193308261138587613482565b160361150f578060a487920135958294876113ac575b836104e788886004356004016159cb565b909192939450604051947f70a082310000000000000000000000000000000000000000000000000000000086523060048701526020866024818a5afa958615610c4c5785966114d5575b5060c4611427917f000000000000000000000000000000000022d473030f116ddee9f6b43ac78ba3169401826135a8565b939091813b156114d15785809461146f604051978896879586947f30f28b7a000000000000000000000000000000000000000000000000000000008652339160048701613adc565b03925af180156114c6576114ae575b50506104e7926114946114a49284309184615b4e565b6044359083600435600401613f9c565b388481808061139b565b6114b7906134d0565b6114c257833861147e565b8380fd5b6040513d84823e3d90fd5b8580fd5b945094506020843d602011611507575b816114f260209383613567565b81010312610bc85792519387939060c46113f6565b3d91506114e5565b60046040517fed5c6561000000000000000000000000000000000000000000000000000000008152fd5b602483604051907f6453b66b0000000000000000000000000000000000000000000000000000000082526004820152fd5b8280fd5b50346107835760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610783577fa453db612af59e5521d6ab9284dc3e2d06af286eb1b1b7b771fce4716c19f2c16116306115ca6132eb565b3380855260036020908152604080872080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff959095169485179055805192835290820192909252918291820190565b0390a180f35b503461078357807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610783573381526003602052604081207fffffffffffffffffffffffff000000000000000000000000000000000000000081541690557f6f42117a557500c705ddf040a619d86f39101e6b74ac20d7b3e5943ba473fc7f6020604051338152a180f35b50346107835760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610783576116fc6132eb565b61170461330e565b906044359073ffffffffffffffffffffffffffffffffffffffff9061172e82600254163314615ca9565b61173b8285161515615c1e565b1691604051927f70a08231000000000000000000000000000000000000000000000000000000008452306004850152602084602481845afa938415610c4c578594611799575b5061179183611796951015615dd8565b615756565b80f35b93506020843d82116117c6575b816117b360209383613567565b81010312610bc857925192611791611781565b3d91506117a6565b503461078357807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261078357602073ffffffffffffffffffffffffffffffffffffffff60025416604051908152f35b503461078357807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126107835773ffffffffffffffffffffffffffffffffffffffff6020915416604051908152f35b507ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc604081360112610d355767ffffffffffffffff60043511610d355761014090600435360301126107835762ffffff6024351660243503610bc857611919906118e06002600154141561341d565b60026001556118ed6136e0565b6118fb604460043501613482565b6119116064600435019161095561083784613482565b93909361374d565b73ffffffffffffffffffffffffffffffffffffffff92838061193f60e460043501613482565b169116036105e9574260246004350135106105c05782611963604460043501613482565b1615610596578261197860e460043501613482565b1682526004602052604082207fffffffffffffffffffffffffffffffff000000000000000000000000000000006119b360c4600435016134a3565b16835260205260ff60408320541661056c57826119d460e460043501613482565b1682526003602052826040832054161561054257826119f282613482565b917f0000000000000000000000000000000000000000000000000000000000000000928284169586911614908115611a81575b506104fc57906104e791839034611a43575b506004356004016159cb565b611a7b91506024359034907f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc216600435600401613f9c565b84611a37565b611a8b9150613482565b81167f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc282161485611a25565b50346107835760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126107835761179681808080611af66132eb565b6024359073ffffffffffffffffffffffffffffffffffffffff90611b1f82600254163314615ca9565b16611b2b811515615c1e565b611b3782471015615dd8565b5af1611b41613d94565b50615d73565b503461078357807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261078357611b7e61339e565b611b866136e0565b740100000000000000000000000000000000000000007fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff8254161781557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586020604051338152a180f35b509034610d3557611c0036613331565b60019291925460021415611c139061341d565b6002600155611c206136e0565b8235602092839182860135916040870190611c3a82613482565b906060890192611c4984613482565b95611c5660808c01613482565b968b8960a0820135998a9360c0840197611c6f896134a3565b9401988b611c7c8b613482565b60408051968701928352602083018a9052606093841b7fffffffffffffffffffffffffffffffffffffffff0000000000000000000000009081169184019190915293831b8416605483015293821b83166068820152607c8101969096527fffffffffffffffffffffffffffffffff00000000000000000000000000000000909416609c86015290831b811660ac8501524660c085015233831b811660e08501523090921b90911660f4830152806101088301037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081018252611d5e9082613567565b5190208b6101208101611d7181836135a8565b905015600014611d969b610ee99461038d93610386936111875750610edc9150613a6c565b73ffffffffffffffffffffffffffffffffffffffff978880611db787613482565b169116036105e95742116105c057611dcf8791613482565b16156105965785611ddf83613482565b168a52600488527fffffffffffffffffffffffffffffffff00000000000000000000000000000000611e1460408c20926134a3565b168a52875260ff60408a20541661056c57611e2f8591613482565b16885260038652836040892054161561054257611e4b90613482565b83167f000000000000000000000000000000000000000000000000000000000000000084161480159061205b575b6120205790611e879161366a565b91817f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc216936040517f70a082310000000000000000000000000000000000000000000000000000000081523360048201528181602481895afa918215612015578892611fe7575b5050838110610c57575082611f09575b50506104e7926159cb565b608081013083611f1883613482565b1614801590611fd9575b61150f5786927f000000000000000000000000000000000022d473030f116ddee9f6b43ac78ba31691611f5860c08201826135a8565b939091813b156114d157858094611fa0604051978896879586947f30f28b7a000000000000000000000000000000000000000000000000000000008652339160048701613adc565b03925af180156114c657611fc5575b505082611fbe6104e7946158d2565b9238611efe565b611fce906134d0565b6114c2578338611faf565b508360a08301351415611f22565b90809250813d831161200e575b611ffe8183613567565b81010312610bc857513880611eee565b503d611ff4565b6040513d8a823e3d90fd5b60248361202c86613482565b6040517f6453b66b00000000000000000000000000000000000000000000000000000000815291166004820152fd5b5061206584613482565b83167f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc284161415611e79565b503461078357807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610783576120c861339e565b600073ffffffffffffffffffffffffffffffffffffffff81547fffffffffffffffffffffffff000000000000000000000000000000000000000081168355167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b509034610d35576122aa61214136613331565b6121536002600194939454141561341d565b60026001556121606136e0565b60208301359361217260408501613482565b946122a285612268606082019861092961218b8b613482565b61219760808601613482565b92876121a560c088016134a3565b6121b08b8901613482565b604080518a356020820152908101939093527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606094851b81168585015294841b8516607484015295831b8416608883015260a090970135609c8201527fffffffffffffffffffffffffffffffff0000000000000000000000000000000090961660bc87015292831b811660cc8601524660e086015233831b81166101008601523090921b9091166101148401528290610128820190565b6020815191012061012087019061227f82896135a8565b151590506125e7576122919150613a6c565b61038d6103866101008901896135a8565b94909461374d565b73ffffffffffffffffffffffffffffffffffffffff9384806122cd858901613482565b169116036105e95742116105c057826122e860408601613482565b161561059657826122fa828601613482565b1686526004602052604086207fffffffffffffffffffffffffffffffff0000000000000000000000000000000061233360c087016134a3565b16875260205260ff60408720541661056c5761235183918501613482565b168552600360205281604086205416156105425761236e84613482565b82167f000000000000000000000000000000000000000000000000000000000000000083161480156125c8575b6125bc57816123a985613482565b166123b960a0850135853561366a565b92604051927f70a082310000000000000000000000000000000000000000000000000000000093848152336004820152602081602481875afa9081156125b157899161257f575b50858110612573575084612425575b5050505061241f6104e793613482565b916159cb565b60808101308361243483613482565b1614801590612565575b61150f578892604051958652306004870152602086602481885afa958615610bd557849661252e575b507f000000000000000000000000000000000022d473030f116ddee9f6b43ac78ba3169161249860c08201826135a8565b939091813b156114d1578580946124e0604051978896879586947f30f28b7a000000000000000000000000000000000000000000000000000000008652339160048701613adc565b03925af180156114c657612516575b50509361250561241f926104e796309186615b4e565b61250e846157b5565b93388061240f565b612522909692966134d0565b6114d1579385386124ef565b935094506020833d60201161255d575b8161254b60209383613567565b81010312610bc8578892519438612467565b3d915061253e565b508560a0830135141561243e565b610c63602491876136a6565b90506020813d6020116125a9575b8161259a60209383613567565b81010312610bc8575138612400565b3d915061258d565b6040513d8b823e3d90fd5b9061202c602492613482565b506125d281613482565b82806125dd87613482565b169116141561239b565b6125f6610d086040938a6135a8565b519020612291565b503461078357807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126107835760ff6020915460a01c166040519015158152f35b5061264b3661329a565b6001546002141561265b9061341d565b60026001556126686136e0565b803560209081830135916040840161267f81613482565b91606086019761268e89613482565b9261269b60808901613482565b60a08901359560c08a01936126af856134a3565b908b01966126bc88613482565b604080518981018d8152602081018f9052606096871b7fffffffffffffffffffffffffffffffffffffffff0000000000000000000000009081169382019390935293861b8216605485015295851b81166068840152607c83018b90527fffffffffffffffffffffffffffffffff00000000000000000000000000000000909316609c830152831b821660ac8201524660c082015233831b821660e08201523090921b1660f482015290806101088301037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08101825261279b9082613567565b519020968861012081016127af81836135a8565b90501560001499610ee9926127de9b6129e857506127cd9150613a6c565b61038d6103866101008d018d6135a8565b73ffffffffffffffffffffffffffffffffffffffff9788806127ff88613482565b169116036105e95742116105c0576128178791613482565b1615610596578561282784613482565b168852600482527fffffffffffffffffffffffffffffffff0000000000000000000000000000000061285c60408a20926134a3565b168852815260ff60408820541661056c5784612879600393613482565b168752528260408620541615610542576128929161366a565b938434116000146128a957602461046686346136a6565b8480341061052d57506128bc8291613482565b817f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc216928391160361299557503461291d575b506104e7907f00000000000000000000000000000000000000000000000000000000000000009034906159cb565b82813b1561078357600491604051928380927fd0e30db000000000000000000000000000000000000000000000000000000000825234905af1801561298a57612975575b508061296f6104e7926157b5565b906128ef565b916129836104e792936134d0565b9190612961565b6040513d85823e3d90fd5b602490604051907f6453b66b0000000000000000000000000000000000000000000000000000000082527f0000000000000000000000000000000000000000000000000000000000000000166004820152fd5b6106226040936129f7926135a8565b5190206127cd565b503461078357807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261078357612a3661339e565b805460ff8160a01c1615612a95577fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1681557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6020604051338152a180f35b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f5061757361626c653a206e6f74207061757365640000000000000000000000006044820152fd5b503461078357807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610783573380825260036020908152604080842080547fffffffffffffffffffffffff000000000000000000000000000000000000000016841790558051838152918201929092527fa453db612af59e5521d6ab9284dc3e2d06af286eb1b1b7b771fce4716c19f2c19181908101611630565b50346107835760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261078357612bc96132eb565b612bd161330e565b9073ffffffffffffffffffffffffffffffffffffffff90612bf782600254163314615ca9565b612c048284161515615c1e565b16604051917f70a08231000000000000000000000000000000000000000000000000000000008352306004840152602083602481855afa918215610bd5578492612c59575b6117969350611791831515615d0e565b91506020833d8211612c86575b81612c7360209383613567565b810103126114c257611796925191612c49565b3d9150612c66565b50346107835760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126107835773ffffffffffffffffffffffffffffffffffffffff612cdb6132eb565b612ce361339e565b16612cef811515615c1e565b7fffffffffffffffffffffffff0000000000000000000000000000000000000000600254161760025580f35b503461078357807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261078357602060405173ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000022d473030f116ddee9f6b43ac78ba3168152f35b50346107835760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126107835761179681808080612dc96132eb565b73ffffffffffffffffffffffffffffffffffffffff90612dee82600254163314615ca9565b16612dfa811515615c1e565b4790611b37821515615d0e565b509034610d3557612e173661329a565b60015460021415612e279061341d565b6002600155612e346136e0565b803560208083013593604084019484612e4c87613482565b926060820197612e5b89613482565b94612e6860808501613482565b908760a0860135978892888c60c08a0198612e828a6134a3565b9a0199612e8e8b613482565b6040805197880193845260208401949094527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606095861b81169484019490945294841b8316605483015296831b82166068820152607c8101959095527fffffffffffffffffffffffffffffffff00000000000000000000000000000000909516609c85015290811b841660ac8401524660c084015233811b841660e084015230901b90921660f482015290806101088301037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081018252612f709082613567565b51902093886101208101612f8481836135a8565b90501560001496612fa292612faa9861326957506127cd9150613a6c565b95909561374d565b73ffffffffffffffffffffffffffffffffffffffff948580612fcb87613482565b169116036105e95742116105c057612fe38491613482565b16156105965782612ff383613482565b168952600485527fffffffffffffffffffffffffffffffff0000000000000000000000000000000061302860408b20926134a3565b168952845260ff60408920541661056c576130438291613482565b1687526003835280604088205416156105425761305f86613482565b81167f000000000000000000000000000000000000000000000000000000000000000082161461325d579061309e9161309787613482565b169361366a565b916040517f70a0823100000000000000000000000000000000000000000000000000000000908181523360048201528381602481865afa908115612015578891613230575b5084811061322457506040517fdd62ed3e0000000000000000000000000000000000000000000000000000000081523360048201523060248201528381604481865afa9081156120155788916131f3575b508481106131e7575083613152575b50505061241f6104e793613482565b6040519081523060048201528281602481855afa9283156131dc5787936131a6575b50509361319661241f926104e79661318e86303384613b6f565b309186615b4e565b61319f846157b5565b9338613143565b908096929350813d83116131d5575b6131bf8183613567565b810103126114d1579351906131966104e7613174565b503d6131b5565b6040513d89823e3d90fd5b610bec602491866136a6565b90508381813d831161321d575b61320a8183613567565b81010312613219575138613134565b8780fd5b503d613200565b610c63602491866136a6565b90508381813d8311613256575b6132478183613567565b810103126132195751386130e3565b503d61323d565b60249061202c87613482565b6132786040936129f7926135a8565b8c8592955194828693838501988937830191820152038c810184520182613567565b7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc90602082820112610bc8576004359167ffffffffffffffff8311610bc8578261014092030112610bc85760040190565b6004359073ffffffffffffffffffffffffffffffffffffffff82168203610bc857565b6024359073ffffffffffffffffffffffffffffffffffffffff82168203610bc857565b907ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc91604083820112610bc85767ffffffffffffffff90600435828111610bc857610140858284030112610bc85760040193602435928311610bc8578260e092030112610bc85760040190565b73ffffffffffffffffffffffffffffffffffffffff6000541633036133bf57565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b1561342457565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152fd5b3573ffffffffffffffffffffffffffffffffffffffff81168103610bc85790565b357fffffffffffffffffffffffffffffffff0000000000000000000000000000000081168103610bc85790565b67ffffffffffffffff81116134e457604052565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6060810190811067ffffffffffffffff8211176134e457604052565b6040810190811067ffffffffffffffff8211176134e457604052565b6080810190811067ffffffffffffffff8211176134e457604052565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff8211176134e457604052565b9035907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe181360301821215610bc8570180359067ffffffffffffffff8211610bc857602001918136038313610bc857565b67ffffffffffffffff81116134e457601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b92919261363f826135f9565b9161364d6040519384613567565b829481845281830111610bc8578281602093846000960137010152565b9190820180921161367757565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b9190820391821161367757565b7f800000000000000000000000000000000000000000000000000000000000000081146136775760000390565b60ff60005460a01c166136ef57565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152fd5b6005811015613943578061375e5750565b600181036137c45760646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152fd5b6002810361382a5760646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152fd5b600381036138b65760846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c60448201527f75650000000000000000000000000000000000000000000000000000000000006064820152fd5b6004146138bf57565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c60448201527f75650000000000000000000000000000000000000000000000000000000000006064820152fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b9060418151146000146139a05761399c916020820151906060604084015193015160001a906139aa565b9091565b5050600090600290565b9291907f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311613a605760ff16601b81141580613a55575b613a49579160809493916020936040519384528484015260408301526060820152600093849182805260015afa15613a3c57815173ffffffffffffffffffffffffffffffffffffffff811615613a36579190565b50600190565b50604051903d90823e3d90fd5b50505050600090600490565b50601c8114156139e2565b50505050600090600390565b60405160208101917f19457468657265756d205369676e6564204d6573736167653a0a3332000000008352603c820152603c8152613aa981613513565b51902090565b803573ffffffffffffffffffffffffffffffffffffffff8116809103610bc8578252602090810135910152565b9394907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe093613b44601f94606073ffffffffffffffffffffffffffffffffffffffff94613b298a82613aaf565b604081013560408b0152013560608901526080880190613aaf565b1660c0850152806101008060e087015285015280610120958686013760008582860101520116010190565b6040517f23b872dd00000000000000000000000000000000000000000000000000000000602082015273ffffffffffffffffffffffffffffffffffffffff92831660248201529290911660448301526064820192909252613c0491613bff82608481015b037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08101845283613567565b613c06565b565b73ffffffffffffffffffffffffffffffffffffffff1690604051613c298161352f565b6020928382527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656484830152803b15613d365790613c7e9160008481959282888195519301915af1613c78613d94565b90613e22565b805180613c8c575b50505050565b81849181010312610d3557820151908115918215036107835750613cb257808080613c86565b608490604051907f08c379a00000000000000000000000000000000000000000000000000000000082526004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152fd5b606484604051907f08c379a00000000000000000000000000000000000000000000000000000000082526004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152fd5b3d15613dbf573d90613da5826135f9565b91613db36040519384613567565b82523d6000602084013e565b606090565b919082519283825260005b848110613e0e5750507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8460006020809697860101520116010190565b602081830181015184830182015201613dcf565b90919015613e2e575090565b815115613e3e5750805190602001fd5b613e7c906040519182917f08c379a0000000000000000000000000000000000000000000000000000000008352602060048401526024830190613dc4565b0390fd5b805115613e8d5760200190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b805160011015613e8d5760400190565b805160021015613e8d5760600190565b805160031015613e8d5760800190565b805160041015613e8d5760a00190565b805160051015613e8d5760c00190565b600060443d10613f88576040517ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc91823d016004833e815167ffffffffffffffff918282113d602484011117613f8b57818401948551938411613f93573d85010160208487010111613f8b5750613f8892910160200190613567565b90565b949350505050565b50949350505050565b9193929093600094600093613fb360608201613482565b73ffffffffffffffffffffffffffffffffffffffff807f0000000000000000000000000000000000000000000000000000000000000000169116146000146157445773ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc216905b61413461416961404360a0840135843561366a565b967fffffff0000000000000000000000000000000000000000000000000000000000604051917fffffffffffffffffffffffffffffffffffffffff0000000000000000000000008760601b16602084015260e81b1660348201527fffffffffffffffffffffffffffffffffffffffff0000000000000000000000008660601b166037820152602b81526140d581613513565b60405192839173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000003fc91a3afd70395cd496c647d5a6cc9d4b2b7fad16602084015289604084015288606084015260a0608084015260c0830190613dc4565b600060a08301527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08282030182520382613567565b61417560608301613482565b9573ffffffffffffffffffffffffffffffffffffffff61419760408501613482565b81604051991660208a015216604088015282356060880152606087526141bc8761354b565b6141c860608401613482565b9573ffffffffffffffffffffffffffffffffffffffff6141ea60e08601613482565b16600052600360205261428173ffffffffffffffffffffffffffffffffffffffff60406000205416614255604051998a9260a0890135916020850160409194939294606082019573ffffffffffffffffffffffffffffffffffffffff80921683521660208201520152565b037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08101895288613567565b60009081903415615037575050505061429b34333161366a565b9473ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000003fc91a3afd70395cd496c647d5a6cc9d4b2b7fad1631604051907f70a0823100000000000000000000000000000000000000000000000000000000825273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000003fc91a3afd70395cd496c647d5a6cc9d4b2b7fad16600483015260208260248173ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2165afa908115614fc357600091615001575b61438f925061366a565b9673ffffffffffffffffffffffffffffffffffffffff6143b160e08601613482565b16600052600360205273ffffffffffffffffffffffffffffffffffffffff60406000205416604051907f70a08231000000000000000000000000000000000000000000000000000000008252600482015260208160248173ffffffffffffffffffffffffffffffffffffffff8a165afa908115614fc357600091614fcf575b509261443e60408601613482565b73ffffffffffffffffffffffffffffffffffffffff604051917f70a0823100000000000000000000000000000000000000000000000000000000835216600482015260208160248173ffffffffffffffffffffffffffffffffffffffff8b165afa908115614fc357600091614f91575b50926040517f0b0000000000000000000000000000000000000000000000000000000000000060208201527f010000000000000000000000000000000000000000000000000000000000000060218201527f050000000000000000000000000000000000000000000000000000000000000080602283015260238201527f0c0000000000000000000000000000000000000000000000000000000000000060248201527f04000000000000000000000000000000000000000000000000000000000000006025820152600681526145848161352f565b92604051918260e081011067ffffffffffffffff60e0850111176134e45760e083016040526006835260005b60c08110614f805750604080517f0000000000000000000000003fc91a3afd70395cd496c647d5a6cc9d4b2b7fad73ffffffffffffffffffffffffffffffffffffffff166020820152349181019190915292936147039385939291906146198160608101610929565b61462285613e80565b5261462c84613e80565b5061463684613ebc565b5261464083613ebc565b5061464a83613ecc565b5261465482613ecc565b5061465e82613edc565b5261466881613edc565b5060405173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000003fc91a3afd70395cd496c647d5a6cc9d4b2b7fad16602082015260006040820152604081526146bc81613513565b6146c582613eec565b526146cf81613eec565b506040516000602082015233604082015260006060820152606081526146f48161354b565b6146fd82613efc565b52613efc565b505b73ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000003fc91a3afd70395cd496c647d5a6cc9d4b2b7fad163b15610bc85790614781916040519283927f3593564c000000000000000000000000000000000000000000000000000000008452606060048501526064840190613dc4565b7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc838203016024840152815180825260208201916020808360051b8301019401926000915b838310614f3157505050505090806000926020880135604483015203813473ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000003fc91a3afd70395cd496c647d5a6cc9d4b2b7fad165af19081614f1d575b50614b9857505050505050506001908060033d11614b88575b6308c379a014614b34575b5061484f57565b614857613d94565b805160208201207f865c3ff234d3d0edd202666a7ee80e1df8991d5f3d0735c47363eaf02da248f681036148e35760646040517f8a627c1600000000000000000000000000000000000000000000000000000000815260206004820152600d60248201527f5633496e76616c696453776170000000000000000000000000000000000000006044820152fd5b7f7949afa5f7d1aca4443eae437acb1046b7439815697e5489cca05d226a192b1381036149685760646040517f8a627c1600000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f5633546f6f4c6974746c655265636569766564000000000000000000000000006044820152fd5b7f6c00b934adb0b7404a228838c719adfbb4e9deac0b09dc9249e888189cb51f6a81036149ed5760646040517f8a627c1600000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f5633546f6f4d75636852657175657374656400000000000000000000000000006044820152fd5b7f483c13bc9b4251bad271f371298893f2995abed398de6edf3108289714194b898103614a725760646040517f8a627c1600000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f5633496e76616c6964416d6f756e744f757400000000000000000000000000006044820152fd5b7ff14c0a0eab0cabeb85cee7eed6c1c3d990aa7959546121092a1062bf3a5d784103614af65760646040517f8a627c1600000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f5633496e76616c696443616c6c657200000000000000000000000000000000006044820152fd5b613e7c906040519182917f917827e1000000000000000000000000000000000000000000000000000000008352602060048401526024830190613dc4565b614b3c613f0c565b9081614b485750614848565b613e7c9250506040519182917f8a627c16000000000000000000000000000000000000000000000000000000008352602060048401526024830190613dc4565b50600481803e805160e01c61483d565b90919293949597985073ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff614bf960608601613482565b1603614e91575b505034159150614d5c9050575033319173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000003fc91a3afd70395cd496c647d5a6cc9d4b2b7fad16316040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000003fc91a3afd70395cd496c647d5a6cc9d4b2b7fad16600482015260208160248173ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2165afa928315614d505792614d18575b50613f8894614d0c614d129493614d0c9361366a565b9261366a565b906136a6565b9291506020833d602011614d48575b81614d3460209383613567565b81010312610bc85791519091613f88614cf6565b3d9150614d27565b604051903d90823e3d90fd5b9160409391935173ffffffffffffffffffffffffffffffffffffffff7f70a0823100000000000000000000000000000000000000000000000000000000948583523360048401521690602081602481855afa801561298a578390614e5e575b6020915094602460405180948193825273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000003fc91a3afd70395cd496c647d5a6cc9d4b2b7fad1660048301525afa918215614d505791614e28575b50613f8893614d1292614d0c9161366a565b9390506020843d602011614e56575b81614e4460209383613567565b81010312610bc8579251614d0c614e16565b3d9150614e37565b506020813d602011614e89575b81614e7860209383613567565b81010312610bc85760209051614dbb565b3d9150614e6b565b614eeb614f149473ffffffffffffffffffffffffffffffffffffffff614eb960e08701613482565b168952600360205273ffffffffffffffffffffffffffffffffffffffff8060408b2054169116809460a0870135615b4e565b73ffffffffffffffffffffffffffffffffffffffff614f0c60408501613482565b169235615b4e565b38808080614c00565b614f289199506134d0565b60009738614824565b919395509193602080614f6e837fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe086600196030187528951613dc4565b970193019301909286959492936147c6565b8060606020809387010152016145b0565b90506020813d602011614fbb575b81614fac60209383613567565b81010312610bc85751386144ae565b3d9150614f9f565b6040513d6000823e3d90fd5b90506020813d602011614ff9575b81614fea60209383613567565b81010312610bc8575138614430565b3d9150614fdd565b90506020823d60201161502f575b8161501c60209383613567565b81010312610bc85761438f915190614385565b3d915061500f565b6040989294919398517f70a0823100000000000000000000000000000000000000000000000000000000815233600482015260208160248173ffffffffffffffffffffffffffffffffffffffff8d165afa8015614fc357829060009061570e575b6150a2925061366a565b9873ffffffffffffffffffffffffffffffffffffffff60208a6024604051809481937f70a08231000000000000000000000000000000000000000000000000000000008352817f0000000000000000000000003fc91a3afd70395cd496c647d5a6cc9d4b2b7fad166004840152165afa908115614fc3576000916156dc575b509a73ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff61517b60608b01613482565b16036153cb576040517f010000000000000000000000000000000000000000000000000000000000000060208201527f0c0000000000000000000000000000000000000000000000000000000000000060218201527f050000000000000000000000000000000000000000000000000000000000000080602283015260238201527f040000000000000000000000000000000000000000000000000000000000000060248201526005815261522f8161352f565b94604051928360c081011067ffffffffffffffff60c0860111176134e45760c084016040526005845260005b60a081106153ba57509183916109296152dc615360956153b598979961528087613e80565b5261528a86613e80565b50604080517f0000000000000000000000003fc91a3afd70395cd496c647d5a6cc9d4b2b7fad73ffffffffffffffffffffffffffffffffffffffff166020820152908101919091529182906060820190565b6152e584613ebc565b526152ef83613ebc565b506152f983613ecc565b5261530382613ecc565b5061530d82613edc565b5261531781613edc565b5060405173ffffffffffffffffffffffffffffffffffffffff8c16602082015233604082015260006060820152606081526153518161354b565b61535a82613eec565b52613eec565b505b73ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000003fc91a3afd70395cd496c647d5a6cc9d4b2b7fad1673ffffffffffffffffffffffffffffffffffffffff8a16615756565b614705565b80606060208093880101520161525b565b945050935073ffffffffffffffffffffffffffffffffffffffff6153f160e08701613482565b16600052600360205273ffffffffffffffffffffffffffffffffffffffff60406000205416604051907f70a08231000000000000000000000000000000000000000000000000000000008252600482015260208160248173ffffffffffffffffffffffffffffffffffffffff8b165afa908115614fc3576000916156aa575b509361547e60408701613482565b73ffffffffffffffffffffffffffffffffffffffff604051917f70a0823100000000000000000000000000000000000000000000000000000000835216600482015260208160248173ffffffffffffffffffffffffffffffffffffffff8c165afa908115614fc357600091615678575b5093604051907f010000000000000000000000000000000000000000000000000000000000000060208301527f050000000000000000000000000000000000000000000000000000000000000080602184015260228301527f040000000000000000000000000000000000000000000000000000000000000060238301526004825281604081011067ffffffffffffffff6040840111176134e45781946040830160e084011067ffffffffffffffff60e0850111176134e45760e083016040526004604084015260005b6080811061566857508261566292604092836153b5979601976155dc858501613e80565b526155e8848401613e80565b506155f4848401613ebc565b52615600838301613ebc565b5061560c838301613ecc565b52615618828201613ecc565b50815173ffffffffffffffffffffffffffffffffffffffff8d166020820152338382015260006060820152606081526156508161354b565b61565b838301613edc565b5201613edc565b50615362565b60608482018101526020016155b8565b90506020813d6020116156a2575b8161569360209383613567565b81010312610bc85751386154ee565b3d9150615686565b90506020813d6020116156d4575b816156c560209383613567565b81010312610bc8575138615470565b3d91506156b8565b90506020813d602011615706575b816156f760209383613567565b81010312610bc8575138615121565b3d91506156ea565b50506020813d60201161573c575b8161572960209383613567565b81010312610bc857816150a29151615098565b3d915061571c565b61575060608201613482565b9061402e565b6040517fa9059cbb00000000000000000000000000000000000000000000000000000000602082015273ffffffffffffffffffffffffffffffffffffffff90921660248301526044820192909252613c0491613bff8260648101613bd3565b606081016157c281613482565b73ffffffffffffffffffffffffffffffffffffffff91829182167f0000000000000000000000000000000000000000000000000000000000000000831603615861575050813580615844575b5060a0820135908161581f57505050565b8061582f60e0613c049501613482565b16600052600360205260406000205416615acd565b61585b908261585560408601613482565b16615acd565b3861580e565b61586a90613482565b168235806158b4575b5060a083013591826158855750505050565b8061589560e06158ab9601613482565b1660005260036020526040600020541690615756565b38808080613c86565b6158cc90836158c560408701613482565b1683615756565b38615873565b6158e160a0820135823561366a565b906158ee60608201613482565b73ffffffffffffffffffffffffffffffffffffffff9081167f0000000000000000000000000000000000000000000000000000000000000000821614806159c2575b615940575b50613c0491506157b5565b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc21691823b15610bc8576000926024849260405195869384927f2e1a7d4d00000000000000000000000000000000000000000000000000000000845260048401525af1918215614fc357613c049215615935576159bc906134d0565b38615935565b50821515615930565b9160a0907fb7ee4fafa10d16ee883a136a3dcc9179d8e6041ba71cc29c2b0bce4f7bdd6e869260e085019073ffffffffffffffffffffffffffffffffffffffff92839182615a1885613482565b1660005260046020528288615aa96040615aa2615a9c60c0836000209501997fffffffffffffffffffffffffffffffff000000000000000000000000000000009586615a638d6134a3565b166000526020528360002060017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00825416179055613482565b986134a3565b9b01613482565b906040519a168a5216602089015233604089015260608801521660808601521692a2565b73ffffffffffffffffffffffffffffffffffffffff16600080808085855af1615af4613d94565b9015615aff57505050565b613e7c906040519384937f28688b550000000000000000000000000000000000000000000000000000000085526004850152602484015260006044840152608060648401526084830190613dc4565b9290916020906024604051809481937f70a0823100000000000000000000000000000000000000000000000000000000835273ffffffffffffffffffffffffffffffffffffffff8092166004840152165afa908115614fc357600091615beb575b5090615bba916136a6565b03615bc157565b60046040517fee20c618000000000000000000000000000000000000000000000000000000008152fd5b906020823d8211615c16575b81615c0460209383613567565b81010312610783575051615bba615baf565b3d9150615bf7565b15615c2557565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f537765657061626c653a2063616e6e6f74206265207a65726f2061646472657360448201527f73000000000000000000000000000000000000000000000000000000000000006064820152fd5b15615cb057565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f537765657061626c653a206e6f742074686520737765657065720000000000006044820152fd5b15615d1557565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f537765657061626c653a207a65726f2062616c616e63650000000000000000006044820152fd5b15615d7a57565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f537765657061626c653a207472616e73666572206572726f72000000000000006044820152fd5b15615ddf57565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f537765657061626c653a20696e73756666696369656e742062616c616e6365006044820152fdfea2646970667358221220c2d6dd41fd140f8cb6cfe88a313ddec3c245be17abaa588ab4c338c1e5c61ac564736f6c63430008110033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000003fc91a3afd70395cd496c647d5a6cc9d4b2b7fad000000000000000000000000000000000022d473030f116ddee9f6b43ac78ba30000000000000000000000008fccc78dae0a8f93b0fe6799de888d4c57e273db0000000000000000000000006d8675a52438849d90241cb639fba41bdc3329c8000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
-----Decoded View---------------
Arg [0] : _uniswap (address): 0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD
Arg [1] : _permit2 (address): 0x000000000022D473030F116dDEE9F6B43aC78BA3
Arg [2] : _initialOperator (address): 0x8fcCC78Dae0a8f93B0fE6799de888d4C57e273db
Arg [3] : _initialFeeDestination (address): 0x6D8675A52438849d90241cB639fba41bDC3329c8
Arg [4] : _wrappedNativeCurrency (address): 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
-----Encoded View---------------
5 Constructor Arguments found :
Arg [0] : 0000000000000000000000003fc91a3afd70395cd496c647d5a6cc9d4b2b7fad
Arg [1] : 000000000000000000000000000000000022d473030f116ddee9f6b43ac78ba3
Arg [2] : 0000000000000000000000008fccc78dae0a8f93b0fe6799de888d4c57e273db
Arg [3] : 0000000000000000000000006d8675a52438849d90241cb639fba41bdc3329c8
Arg [4] : 000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.