Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 672 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Execute Swap | 21279604 | 7 hrs ago | IN | 0.066 ETH | 0.00347328 | ||||
Execute Swap | 21278183 | 12 hrs ago | IN | 0 ETH | 0.00231542 | ||||
Execute Swap | 21278154 | 12 hrs ago | IN | 0 ETH | 0.00243908 | ||||
Execute Swap | 21278112 | 12 hrs ago | IN | 0 ETH | 0.00252061 | ||||
Execute Swap | 21276934 | 16 hrs ago | IN | 0.02 ETH | 0.00181314 | ||||
Execute Swap | 21275859 | 20 hrs ago | IN | 0.0059 ETH | 0.00228646 | ||||
Execute Swap | 21275719 | 20 hrs ago | IN | 0 ETH | 0.00198893 | ||||
Execute Swap | 21271581 | 34 hrs ago | IN | 0 ETH | 0.00340852 | ||||
Execute Swap | 21270339 | 38 hrs ago | IN | 0 ETH | 0.00227138 | ||||
Execute Swap | 21269127 | 42 hrs ago | IN | 0.01 ETH | 0.00293703 | ||||
Execute Swap | 21266184 | 2 days ago | IN | 0 ETH | 0.00445921 | ||||
Execute Swap | 21265882 | 2 days ago | IN | 9.7224 ETH | 0.01137307 | ||||
Execute Swap | 21265880 | 2 days ago | IN | 10.4975 ETH | 0.0062822 | ||||
Execute Swap | 21265339 | 2 days ago | IN | 8.479 ETH | 0.00491746 | ||||
Execute Swap | 21265335 | 2 days ago | IN | 11.257 ETH | 0.00450683 | ||||
Execute Swap | 21265280 | 2 days ago | IN | 19.8376 ETH | 0.00483496 | ||||
Execute Swap | 21265279 | 2 days ago | IN | 7.013 ETH | 0.00399308 | ||||
Execute Swap | 21265268 | 2 days ago | IN | 12.585 ETH | 0.00533019 | ||||
Execute Swap | 21265264 | 2 days ago | IN | 14.573 ETH | 0.00464862 | ||||
Execute Swap | 21264892 | 2 days ago | IN | 12.6448 ETH | 0.00466019 | ||||
Execute Swap | 21264884 | 2 days ago | IN | 13.274 ETH | 0.00353681 | ||||
Execute Swap | 21264498 | 2 days ago | IN | 4.869 ETH | 0.00319856 | ||||
Execute Swap | 21264496 | 2 days ago | IN | 4.9748 ETH | 0.00319673 | ||||
Execute Swap | 21264463 | 2 days ago | IN | 4.958 ETH | 0.00279118 | ||||
Execute Swap | 21264463 | 2 days ago | IN | 4.9573 ETH | 0.00279163 |
Latest 25 internal transactions (View All)
Advanced mode:
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
21279604 | 7 hrs ago | 0.066 ETH | ||||
21276934 | 16 hrs ago | 0.02 ETH | ||||
21275859 | 20 hrs ago | 0.0059 ETH | ||||
21275719 | 20 hrs ago | 0.08079837 ETH | ||||
21275719 | 20 hrs ago | 0.08079837 ETH | ||||
21271581 | 34 hrs ago | 11.50156169 ETH | ||||
21271581 | 34 hrs ago | 11.50156169 ETH | ||||
21270339 | 38 hrs ago | 0.00862524 ETH | ||||
21270339 | 38 hrs ago | 0.00862524 ETH | ||||
21269127 | 42 hrs ago | 0.01 ETH | ||||
21266184 | 2 days ago | 11.03686141 ETH | ||||
21266184 | 2 days ago | 11.03686141 ETH | ||||
21265882 | 2 days ago | 9.7224 ETH | ||||
21265880 | 2 days ago | 10.4975 ETH | ||||
21265339 | 2 days ago | 8.479 ETH | ||||
21265335 | 2 days ago | 11.257 ETH | ||||
21265280 | 2 days ago | 19.8376 ETH | ||||
21265279 | 2 days ago | 7.013 ETH | ||||
21265268 | 2 days ago | 12.585 ETH | ||||
21265264 | 2 days ago | 14.573 ETH | ||||
21264892 | 2 days ago | 12.6448 ETH | ||||
21264884 | 2 days ago | 13.274 ETH | ||||
21264498 | 2 days ago | 4.869 ETH | ||||
21264496 | 2 days ago | 4.9748 ETH | ||||
21264463 | 2 days ago | 4.958 ETH |
Loading...
Loading
Contract Name:
GenericSwap
Compiler Version
v0.8.17+commit.8df45f5f
Optimization Enabled:
Yes with 1000 runs
Other Settings:
london EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity 0.8.17; import { TokenCollector } from "./abstracts/TokenCollector.sol"; import { EIP712 } from "./abstracts/EIP712.sol"; import { IGenericSwap } from "./interfaces/IGenericSwap.sol"; import { IStrategy } from "./interfaces/IStrategy.sol"; import { GenericSwapData, getGSDataHash } from "./libraries/GenericSwapData.sol"; import { Asset } from "./libraries/Asset.sol"; import { SignatureValidator } from "./libraries/SignatureValidator.sol"; contract GenericSwap is IGenericSwap, TokenCollector, EIP712 { using Asset for address; mapping(bytes32 => bool) private filledSwap; constructor(address _uniswapPermit2, address _allowanceTarget) TokenCollector(_uniswapPermit2, _allowanceTarget) {} receive() external payable {} /// @param swapData Swap data /// @return returnAmount Output amount of the swap function executeSwap(GenericSwapData calldata swapData, bytes calldata takerTokenPermit) external payable override returns (uint256 returnAmount) { returnAmount = _executeSwap(swapData, msg.sender, takerTokenPermit); emit Swap( getGSDataHash(swapData), swapData.maker, msg.sender, // taker swapData.recipient, swapData.takerToken, swapData.takerTokenAmount, swapData.makerToken, returnAmount ); } /// @param swapData Swap data /// @param taker Claimed taker address /// @param takerSig Taker signature /// @return returnAmount Output amount of the swap function executeSwap( GenericSwapData calldata swapData, bytes calldata takerTokenPermit, address taker, bytes calldata takerSig ) external payable override returns (uint256 returnAmount) { bytes32 swapHash = getGSDataHash(swapData); bytes32 gs712Hash = getEIP712Hash(swapHash); if (filledSwap[swapHash]) revert AlreadyFilled(); filledSwap[swapHash] = true; if (!SignatureValidator.isValidSignature(taker, gs712Hash, takerSig)) revert InvalidSignature(); returnAmount = _executeSwap(swapData, taker, takerTokenPermit); emit Swap(swapHash, swapData.maker, taker, swapData.recipient, swapData.takerToken, swapData.takerTokenAmount, swapData.makerToken, returnAmount); } function _executeSwap( GenericSwapData calldata _swapData, address _authorizedUser, bytes calldata _takerTokenPermit ) private returns (uint256 returnAmount) { if (_swapData.expiry < block.timestamp) revert ExpiredOrder(); if (_swapData.recipient == address(0)) revert ZeroAddress(); address _inputToken = _swapData.takerToken; address _outputToken = _swapData.makerToken; if (_inputToken.isETH()) { if (msg.value != _swapData.takerTokenAmount) revert InvalidMsgValue(); } if (!_inputToken.isETH()) { if (msg.value != 0) revert InvalidMsgValue(); _collect(_inputToken, _authorizedUser, _swapData.maker, _swapData.takerTokenAmount, _takerTokenPermit); } IStrategy(_swapData.maker).executeStrategy{ value: msg.value }(_inputToken, _outputToken, _swapData.takerTokenAmount, _swapData.strategyData); returnAmount = _outputToken.getBalance(address(this)); if (returnAmount < _swapData.minMakerTokenAmount) revert InsufficientOutput(); _outputToken.transferTo(_swapData.recipient, returnAmount); } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.17; import { IERC20Permit } from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol"; import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import { IUniswapPermit2 } from "../interfaces/IUniswapPermit2.sol"; import { IAllowanceTarget } from "../interfaces/IAllowanceTarget.sol"; abstract contract TokenCollector { using SafeERC20 for IERC20; error Permit2DataEmpty(); enum Source { TokenlonAllowanceTarget, Token, TokenPermit, Permit2AllowanceTransfer, Permit2SignatureTransfer } address public immutable permit2; address public immutable allowanceTarget; constructor(address _permit2, address _allowanceTarget) { permit2 = _permit2; allowanceTarget = _allowanceTarget; } function _collect( address token, address from, address to, uint256 amount, bytes calldata data ) internal { Source src = Source(uint8(data[0])); if (src == Source.TokenlonAllowanceTarget) { return IAllowanceTarget(allowanceTarget).spendFromUserTo(from, token, to, amount); } else if (src == Source.Token) { return IERC20(token).safeTransferFrom(from, to, amount); } else if (src == Source.TokenPermit) { (bool success, bytes memory result) = token.call(abi.encodePacked(IERC20Permit.permit.selector, data[1:])); if (!success) { assembly { revert(add(result, 32), returndatasize()) } } return IERC20(token).safeTransferFrom(from, to, amount); } else if (src == Source.Permit2AllowanceTransfer) { bytes memory permit2Data = data[1:]; if (permit2Data.length > 0) { (bool success, bytes memory result) = permit2.call(abi.encodePacked(IUniswapPermit2.permit.selector, permit2Data)); if (!success) { assembly { revert(add(result, 32), returndatasize()) } } } return IUniswapPermit2(permit2).transferFrom(from, to, uint160(amount), token); } else if (src == Source.Permit2SignatureTransfer) { bytes memory permit2Data = data[1:]; if (permit2Data.length == 0) revert Permit2DataEmpty(); (uint256 nonce, uint256 deadline, bytes memory permitSig) = abi.decode(permit2Data, (uint256, uint256, bytes)); IUniswapPermit2.PermitTransferFrom memory permit = IUniswapPermit2.PermitTransferFrom({ permitted: IUniswapPermit2.TokenPermissions({ token: token, amount: amount }), nonce: nonce, deadline: deadline }); IUniswapPermit2.SignatureTransferDetails memory detail = IUniswapPermit2.SignatureTransferDetails({ to: to, requestedAmount: amount }); return IUniswapPermit2(permit2).permitTransferFrom(permit, detail, from, permitSig); } // won't be reached revert(); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; abstract contract EIP712 { // EIP-191 Header string public constant EIP191_HEADER = "\x19\x01"; // EIP-712 Domain string public constant EIP712_NAME = "Tokenlon"; string public constant EIP712_VERSION = "v6"; bytes32 public constant EIP712_TYPE_HASH = keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"); bytes32 private constant EIP712_HASHED_NAME = keccak256(bytes(EIP712_NAME)); bytes32 private constant EIP712_HASHED_VERSION = keccak256(bytes(EIP712_VERSION)); uint256 public immutable originalChainId; bytes32 public immutable originalEIP712DomainSeparator; constructor() { originalChainId = block.chainid; originalEIP712DomainSeparator = _buildDomainSeparator(); } function _buildDomainSeparator() private view returns (bytes32) { return keccak256(abi.encode(EIP712_TYPE_HASH, EIP712_HASHED_NAME, EIP712_HASHED_VERSION, block.chainid, address(this))); } function _getDomainSeparator() private view returns (bytes32) { if (block.chainid == originalChainId) { return originalEIP712DomainSeparator; } else { return _buildDomainSeparator(); } } function getEIP712Hash(bytes32 structHash) internal view returns (bytes32) { return keccak256(abi.encodePacked(EIP191_HEADER, _getDomainSeparator(), structHash)); } function EIP712_DOMAIN_SEPARATOR() external view returns (bytes32) { return _getDomainSeparator(); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; import { GenericSwapData } from "../libraries/GenericSwapData.sol"; interface IGenericSwap { error AlreadyFilled(); error InvalidMsgValue(); error InsufficientOutput(); error InvalidSignature(); error ExpiredOrder(); error ZeroAddress(); event Swap( bytes32 indexed swapHash, address indexed maker, address indexed taker, address recipient, address inputToken, uint256 inputAmount, address outputToken, uint256 outputAmount ); function executeSwap(GenericSwapData calldata swapData, bytes calldata takerTokenPermit) external payable returns (uint256 returnAmount); function executeSwap( GenericSwapData calldata swapData, bytes calldata takerTokenPermit, address taker, bytes calldata takerSig ) external payable returns (uint256 returnAmount); }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; /// @title IStrategy Interface /// @author imToken Labs interface IStrategy { function executeStrategy( address inputToken, address outputToken, uint256 inputAmount, bytes calldata data ) external payable; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; string constant GS_DATA_TYPESTRING = string( abi.encodePacked( "GenericSwapData(address maker,address takerToken,uint256 takerTokenAmount,address makerToken,uint256 makerTokenAmount,uint256 minMakerTokenAmount,uint256 expiry,uint256 salt,address recipient,bytes strategyData)" ) ); bytes32 constant GS_DATA_TYPEHASH = 0x1b6f9d7673107802b331a5ab52a40f7d942bdf74fa821744df8b69eead3d26c1; // keccak256(GS_DATA_TYPESTRING); struct GenericSwapData { address payable maker; address takerToken; uint256 takerTokenAmount; address makerToken; uint256 makerTokenAmount; uint256 minMakerTokenAmount; uint256 expiry; uint256 salt; address payable recipient; bytes strategyData; } // solhint-disable-next-line func-visibility function getGSDataHash(GenericSwapData memory gsData) pure returns (bytes32) { return keccak256( abi.encode( GS_DATA_TYPEHASH, gsData.maker, gsData.takerToken, gsData.takerTokenAmount, gsData.makerToken, gsData.makerTokenAmount, gsData.minMakerTokenAmount, gsData.expiry, gsData.salt, gsData.recipient, keccak256(gsData.strategyData) ) ); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import { Constant } from "./Constant.sol"; library Asset { using SafeERC20 for IERC20; error InsufficientBalance(); function isETH(address addr) internal pure returns (bool) { return (addr == Constant.ETH_ADDRESS || addr == Constant.ZERO_ADDRESS); } function getBalance(address asset, address owner) internal view returns (uint256) { if (isETH(asset)) { return owner.balance; } else { return IERC20(asset).balanceOf(owner); } } function transferTo( address asset, address payable to, uint256 amount ) internal { if (to == address(this) || amount == 0) { return; } if (isETH(asset)) { // @dev forward all available gas and may cause reentrancy if (address(this).balance < amount) revert InsufficientBalance(); (bool success, bytes memory result) = to.call{ value: amount }(""); if (!success) { assembly { revert(add(result, 32), mload(result)) } } } else { IERC20(asset).safeTransfer(to, amount); } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import { ECDSA } from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; import { Address } from "@openzeppelin/contracts/utils/Address.sol"; import { IERC1271Wallet } from "../interfaces/IERC1271Wallet.sol"; library SignatureValidator { using Address for address; // bytes4(keccak256("isValidSignature(bytes32,bytes)")) bytes4 internal constant ERC1271_MAGICVALUE = 0x1626ba7e; /** * @dev Verifies that a hash has been signed by the given signer. * @param _signerAddress Address that should have signed the given hash. * @param _hash Hash of the EIP-712 encoded data * @param _signature Proof that the hash has been signed by signer. * @return True if the address recovered from the provided signature matches the input signer address. */ function isValidSignature( address _signerAddress, bytes32 _hash, bytes memory _signature ) internal view returns (bool) { if (_signerAddress.isContract()) { return ERC1271_MAGICVALUE == IERC1271Wallet(_signerAddress).isValidSignature(_hash, _signature); } else { return _signerAddress == ECDSA.recover(_hash, _signature); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/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.9.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 amount) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/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; /** * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } /** * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful. */ function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.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)); } /** * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 oldAllowance = token.allowance(address(this), spender); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value)); } /** * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ 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"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value)); } } /** * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. Compatible with tokens that require the approval to be set to * 0 before setting it to a non-zero value. */ function forceApprove(IERC20 token, address spender, uint256 value) internal { bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value); if (!_callOptionalReturnBool(token, approvalCall)) { _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0)); _callOptionalReturn(token, approvalCall); } } /** * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`. * Revert on invalid signature. */ 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"); require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation 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). * * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead. */ function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false // and not revert is the subcall reverts. (bool success, bytes memory returndata) = address(token).call(data); return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token)); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; interface IUniswapPermit2 { /// @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 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 validating that the inputted nonce has not been used error InvalidNonce(); /// @notice Thrown when the recovered signer does not equal the claimedSigner error InvalidSigner(); /// @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); /* * Allowance Transfer */ /// @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 Returns the domain separator for the current chain. /// @dev Uses cached version if chainid and address are unchanged from construction. function DOMAIN_SEPARATOR() external view returns (bytes32); /// @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 user, address token, address spender ) external view returns ( uint160 amount, uint48 expiration, uint48 nonce ); /// @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 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 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; /* * Signature Transfer */ /// @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 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; }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; /// @title IAllowanceTarget Interface /// @author imToken Labs interface IAllowanceTarget { error NotAuthorized(); /// @dev Spend tokens on user's behalf. Only an authority can call this. /// @param from The user to spend token from. /// @param token The address of the token. /// @param to The recipient of the trasnfer. /// @param amount Amount to spend. function spendFromUserTo( address from, address token, address to, uint256 amount ) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; library Constant { uint16 internal constant BPS_MAX = 10000; address internal constant ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE; address internal constant ZERO_ADDRESS = address(0); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.0; import "../Strings.sol"; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSA { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS, InvalidSignatureV // Deprecated in v4.8 } function _throwError(RecoverError error) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert("ECDSA: invalid signature"); } else if (error == RecoverError.InvalidSignatureLength) { revert("ECDSA: invalid signature length"); } else if (error == RecoverError.InvalidSignatureS) { revert("ECDSA: invalid signature 's' value"); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature` or error string. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) { if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. /// @solidity memory-safe-assembly assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return tryRecover(hash, v, r, s); } else { return (address(0), RecoverError.InvalidSignatureLength); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, signature); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately. * * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError) { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); uint8 v = uint8((uint256(vs) >> 255) + 27); return tryRecover(hash, v, r, s); } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. * * _Available since v4.2._ */ function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, r, vs); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. * * _Available since v4.3._ */ function tryRecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address, RecoverError) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS); } // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature); } return (signer, RecoverError.NoError); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, v, r, s); _throwError(error); return recovered; } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 message) { // 32 is the length in bytes of hash, // enforced by the type signature above /// @solidity memory-safe-assembly assembly { mstore(0x00, "\x19Ethereum Signed Message:\n32") mstore(0x1c, hash) message := keccak256(0x00, 0x3c) } } /** * @dev Returns an Ethereum Signed Message, created from `s`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s)); } /** * @dev Returns an Ethereum Signed Typed Data, created from a * `domainSeparator` and a `structHash`. This produces hash corresponding * to the one signed with the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] * JSON-RPC method as part of EIP-712. * * See {recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 data) { /// @solidity memory-safe-assembly assembly { let ptr := mload(0x40) mstore(ptr, "\x19\x01") mstore(add(ptr, 0x02), domainSeparator) mstore(add(ptr, 0x22), structHash) data := keccak256(ptr, 0x42) } } /** * @dev Returns an Ethereum Signed Data with intended validator, created from a * `validator` and `data` according to the version 0 of EIP-191. * * See {recover}. */ function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19\x00", validator, data)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library 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 * * Furthermore, `isContract` will also return true if the target contract within * the same transaction is already scheduled for destruction by `SELFDESTRUCT`, * which only has an effect at the end of a transaction. * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; interface IERC1271Wallet { function isValidSignature(bytes32 _hash, bytes calldata _signature) external view returns (bytes4 magicValue); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol) pragma solidity ^0.8.0; import "./math/Math.sol"; import "./math/SignedMath.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant _SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), _SYMBOLS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `int256` to its ASCII `string` decimal representation. */ function toString(int256 value) internal pure returns (string memory) { return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMath.abs(value)))); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, Math.log256(value) + 1); } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } /** * @dev Returns true if the two strings are equal. */ function equal(string memory a, string memory b) internal pure returns (bool) { return keccak256(bytes(a)) == keccak256(bytes(b)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { // Solidity will revert if denominator == 0, unlike the div opcode on its own. // The surrounding unchecked block does not change this fact. // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic. return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1, "Math: mulDiv overflow"); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works // in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10 ** 64) { value /= 10 ** 64; result += 64; } if (value >= 10 ** 32) { value /= 10 ** 32; result += 32; } if (value >= 10 ** 16) { value /= 10 ** 16; result += 16; } if (value >= 10 ** 8) { value /= 10 ** 8; result += 8; } if (value >= 10 ** 4) { value /= 10 ** 4; result += 4; } if (value >= 10 ** 2) { value /= 10 ** 2; result += 2; } if (value >= 10 ** 1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 256, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol) pragma solidity ^0.8.0; /** * @dev Standard signed math utilities missing in the Solidity language. */ library SignedMath { /** * @dev Returns the largest of two signed numbers. */ function max(int256 a, int256 b) internal pure returns (int256) { return a > b ? a : b; } /** * @dev Returns the smallest of two signed numbers. */ function min(int256 a, int256 b) internal pure returns (int256) { return a < b ? a : b; } /** * @dev Returns the average of two signed numbers without overflow. * The result is rounded towards zero. */ function average(int256 a, int256 b) internal pure returns (int256) { // Formula from the book "Hacker's Delight" int256 x = (a & b) + ((a ^ b) >> 1); return x + (int256(uint256(x) >> 255) & (a ^ b)); } /** * @dev Returns the absolute unsigned value of a signed value. */ function abs(int256 n) internal pure returns (uint256) { unchecked { // must be unchecked in order to support `n = type(int256).min` return uint256(n >= 0 ? n : -n); } } }
{ "remappings": [ "@openzeppelin/=lib/openzeppelin-contracts/", "forge-std/=lib/forge-std/src/", "ds-test/=lib/forge-std/lib/ds-test/src/", "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/", "openzeppelin-contracts/=lib/openzeppelin-contracts/", "openzeppelin/=lib/openzeppelin-contracts/contracts/" ], "optimizer": { "enabled": true, "runs": 1000 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "ipfs" }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "london", "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_uniswapPermit2","type":"address"},{"internalType":"address","name":"_allowanceTarget","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AlreadyFilled","type":"error"},{"inputs":[],"name":"ExpiredOrder","type":"error"},{"inputs":[],"name":"InsufficientBalance","type":"error"},{"inputs":[],"name":"InsufficientOutput","type":"error"},{"inputs":[],"name":"InvalidMsgValue","type":"error"},{"inputs":[],"name":"InvalidSignature","type":"error"},{"inputs":[],"name":"Permit2DataEmpty","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"swapHash","type":"bytes32"},{"indexed":true,"internalType":"address","name":"maker","type":"address"},{"indexed":true,"internalType":"address","name":"taker","type":"address"},{"indexed":false,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"address","name":"inputToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"inputAmount","type":"uint256"},{"indexed":false,"internalType":"address","name":"outputToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"outputAmount","type":"uint256"}],"name":"Swap","type":"event"},{"inputs":[],"name":"EIP191_HEADER","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"EIP712_DOMAIN_SEPARATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"EIP712_NAME","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"EIP712_TYPE_HASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"EIP712_VERSION","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"allowanceTarget","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address payable","name":"maker","type":"address"},{"internalType":"address","name":"takerToken","type":"address"},{"internalType":"uint256","name":"takerTokenAmount","type":"uint256"},{"internalType":"address","name":"makerToken","type":"address"},{"internalType":"uint256","name":"makerTokenAmount","type":"uint256"},{"internalType":"uint256","name":"minMakerTokenAmount","type":"uint256"},{"internalType":"uint256","name":"expiry","type":"uint256"},{"internalType":"uint256","name":"salt","type":"uint256"},{"internalType":"address payable","name":"recipient","type":"address"},{"internalType":"bytes","name":"strategyData","type":"bytes"}],"internalType":"struct GenericSwapData","name":"swapData","type":"tuple"},{"internalType":"bytes","name":"takerTokenPermit","type":"bytes"}],"name":"executeSwap","outputs":[{"internalType":"uint256","name":"returnAmount","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address payable","name":"maker","type":"address"},{"internalType":"address","name":"takerToken","type":"address"},{"internalType":"uint256","name":"takerTokenAmount","type":"uint256"},{"internalType":"address","name":"makerToken","type":"address"},{"internalType":"uint256","name":"makerTokenAmount","type":"uint256"},{"internalType":"uint256","name":"minMakerTokenAmount","type":"uint256"},{"internalType":"uint256","name":"expiry","type":"uint256"},{"internalType":"uint256","name":"salt","type":"uint256"},{"internalType":"address payable","name":"recipient","type":"address"},{"internalType":"bytes","name":"strategyData","type":"bytes"}],"internalType":"struct GenericSwapData","name":"swapData","type":"tuple"},{"internalType":"bytes","name":"takerTokenPermit","type":"bytes"},{"internalType":"address","name":"taker","type":"address"},{"internalType":"bytes","name":"takerSig","type":"bytes"}],"name":"executeSwap","outputs":[{"internalType":"uint256","name":"returnAmount","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"originalChainId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"originalEIP712DomainSeparator","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"permit2","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
6101006040523480156200001257600080fd5b506040516200213538038062002135833981016040819052620000359162000149565b6001600160a01b03808316608052811660a0524660c0526200012060408051808201825260088152672a37b5b2b73637b760c11b6020918201528151808301835260028152613b1b60f11b9082015281517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f818301527f4428669f887e7f6a6e361e218ee42308201bdbacbf601211fc38b8b2ec696181818401527fe38c993d0cb6abdb6be519a6875b139ddd45568fc076f7b5fa6362a5581f4a1460608201524660808201523060a0808301919091528351808303909101815260c0909101909252815191012090565b60e05250620001819050565b80516001600160a01b03811681146200014457600080fd5b919050565b600080604083850312156200015d57600080fd5b62000168836200012c565b915062000178602084016200012c565b90509250929050565b60805160a05160c05160e051611f51620001e46000396000818161018401526109e101526000818160de01526109b90152600081816102400152610ba801526000818161012501528181610d9b01528181610e9d015261101b0152611f516000f3fe6080604052600436106100c05760003560e01c806355b53e2e11610074578063dab400f31161004e578063dab400f314610262578063e0c05c2414610277578063eccec5a8146102a557600080fd5b806355b53e2e146101e757806374a640ff146101fa578063910cab111461022e57600080fd5b806336ac25a2116100a557806336ac25a21461015f57806337be5439146101725780633b2fb7a8146101a657600080fd5b80630d788c36146100cc57806312261ee71461011357600080fd5b366100c757005b600080fd5b3480156100d857600080fd5b506101007f000000000000000000000000000000000000000000000000000000000000000081565b6040519081526020015b60405180910390f35b34801561011f57600080fd5b506101477f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161010a565b61010061016d3660046118a9565b6102d3565b34801561017e57600080fd5b506101007f000000000000000000000000000000000000000000000000000000000000000081565b3480156101b257600080fd5b506101da604051806040016040528060088152602001672a37b5b2b73637b760c11b81525081565b60405161010a9190611962565b6101006101f536600461199a565b6103a3565b34801561020657600080fd5b506101007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f81565b34801561023a57600080fd5b506101477f000000000000000000000000000000000000000000000000000000000000000081565b34801561026e57600080fd5b5061010061056c565b34801561028357600080fd5b506101da60405180604001604052806002815260200161190160f01b81525081565b3480156102b157600080fd5b506101da604051806040016040528060028152602001613b1b60f11b81525081565b60006102e18433858561057b565b9050336102f16020860186611a43565b6001600160a01b031661030b61030687611b4f565b6107d4565b7f4a6de6fb74140040ff5f8a230383d4ce15312512a98da513ec606b8c60c4531461033e61012089016101008a01611a43565b61034e60408a0160208b01611a43565b60408a013561036360808c0160608d01611a43565b604080516001600160a01b039586168152938516602085015283019190915290911660608201526080810186905260a00160405180910390a49392505050565b6000806103b261030689611b4f565b905060006103bf826108ba565b60008381526020819052604090205490915060ff161561040b576040517f41a26a6300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008281526020818152604091829020805460ff191660011790558151601f870182900482028101820190925285825261046491889184919089908990819084018382808284376000920191909152506108f292505050565b61049a576040517f8baa579f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6104a689878a8a61057b565b92506001600160a01b0386166104bf60208b018b611a43565b6001600160a01b0316837f4a6de6fb74140040ff5f8a230383d4ce15312512a98da513ec606b8c60c453146104fc6101208e016101008f01611a43565b8d602001602081019061050f9190611a43565b8e604001358f60600160208101906105279190611a43565b604080516001600160a01b039586168152938516602085015283019190915290911660608201526080810188905260a00160405180910390a450509695505050505050565b60006105766109b5565b905090565b6000428560c0013510156105bb576040517f45fa2d0600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006105cf61012087016101008801611a43565b6001600160a01b03160361060f576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006106216040870160208801611a43565b905060006106356080880160608901611a43565b9050610649826001600160a01b0316610ad4565b15610672578660400135341461067257604051631841b4e160e01b815260040160405180910390fd5b610684826001600160a01b0316610ad4565b6106c55734156106a757604051631841b4e160e01b815260040160405180910390fd5b6106c582876106b960208b018b611a43565b8a604001358989610b0e565b6106d26020880188611a43565b6001600160a01b0316638199411334848460408c01356106f66101208e018e611c11565b6040518763ffffffff1660e01b8152600401610716959493929190611c58565b6000604051808303818588803b15801561072f57600080fd5b505af1158015610743573d6000803e3d6000fd5b505050505061076430826001600160a01b03166110ad90919063ffffffff16565b92508660a001358310156107a4576040517fbb2875c300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6107ca6107b961012089016101008a01611a43565b6001600160a01b0383169085611151565b5050949350505050565b80516020808301516040808501516060860151608087015160a088015160c089015160e08a01516101008b01516101208c01518051908b0120975160009b61089d9b7f1b6f9d7673107802b331a5ab52a40f7d942bdf74fa821744df8b69eead3d26c19b919a919998979695949392019a8b526001600160a01b03998a1660208c015297891660408b015260608a0196909652938716608089015260a088019290925260c087015260e08601526101008501529091166101208301526101408201526101600190565b604051602081830303815290604052805190602001209050919050565b600060405180604001604052806002815260200161190160f01b8152506108df6109b5565b8360405160200161089d93929190611cac565b60006001600160a01b0384163b1561098d57604051630b135d3f60e11b81526001600160a01b03851690631626ba7e906109329086908690600401611cd3565b602060405180830381865afa15801561094f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109739190611cec565b6001600160e01b031916630b135d3f60e11b1490506109ae565b610997838361123d565b6001600160a01b0316846001600160a01b03161490505b9392505050565b60007f00000000000000000000000000000000000000000000000000000000000000004603610a0357507f000000000000000000000000000000000000000000000000000000000000000090565b5060408051808201825260088152672a37b5b2b73637b760c11b6020918201528151808301835260028152613b1b60f11b9082015281517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f818301527f4428669f887e7f6a6e361e218ee42308201bdbacbf601211fc38b8b2ec696181818401527fe38c993d0cb6abdb6be519a6875b139ddd45568fc076f7b5fa6362a5581f4a1460608201524660808201523060a0808301919091528351808303909101815260c0909101909252815191012090565b60006001600160a01b03821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1480610b0857506001600160a01b038216155b92915050565b600082826000818110610b2357610b23611d16565b919091013560f81c90506004811115610b3e57610b3e611d2c565b90506000816004811115610b5457610b54611d2c565b03610c0a576040517f1567599f0000000000000000000000000000000000000000000000000000000081526001600160a01b03878116600483015288811660248301528681166044830152606482018690527f00000000000000000000000000000000000000000000000000000000000000001690631567599f90608401600060405180830381600087803b158015610bec57600080fd5b505af1158015610c00573d6000803e3d6000fd5b50505050506110a5565b6001816004811115610c1e57610c1e611d2c565b03610c3e57610c386001600160a01b038816878787611261565b506110a5565b6002816004811115610c5257610c52611d2c565b03610d2e576000806001600160a01b0389167fd505accf00000000000000000000000000000000000000000000000000000000610c92866001818a611d42565b604051602001610ca493929190611d6c565b60408051601f1981840301815290829052610cbe91611d90565b6000604051808303816000865af19150503d8060008114610cfb576040519150601f19603f3d011682016040523d82523d6000602084013e610d00565b606091505b509150915081610d11573d60208201fd5b610d266001600160a01b038a16898989611261565b5050506110a5565b6003816004811115610d4257610d42611d2c565b03610f00576000610d568360018187611d42565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505082519293505090159050610e4d576000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316632b67b57060e01b84604051602001610ddd929190611dac565b60408051601f1981840301815290829052610df791611d90565b6000604051808303816000865af19150503d8060008114610e34576040519150601f19603f3d011682016040523d82523d6000602084013e610e39565b606091505b509150915081610e4a573d60208201fd5b50505b6040517f36c785160000000000000000000000000000000000000000000000000000000081526001600160a01b0388811660048301528781166024830152868116604483015289811660648301527f000000000000000000000000000000000000000000000000000000000000000016906336c7851690608401600060405180830381600087803b158015610ee157600080fd5b505af1158015610ef5573d6000803e3d6000fd5b5050505050506110a5565b6004816004811115610f1457610f14611d2c565b036100c7576000610f288360018187611d42565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201829052508451949550939093039250610f9c915050576040517fb826d62c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600080600083806020019051810190610fb59190611ddc565b9250925092506000604051806060016040528060405180604001604052808f6001600160a01b031681526020018c8152508152602001858152602001848152509050600060405180604001604052808c6001600160a01b031681526020018b81525090507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166330f28b7a83838f876040518563ffffffff1660e01b815260040161106b9493929190611e68565b600060405180830381600087803b15801561108557600080fd5b505af1158015611099573d6000803e3d6000fd5b50505050505050505050505b505050505050565b60006110b883610ad4565b156110ce57506001600160a01b03811631610b08565b6040517f70a082310000000000000000000000000000000000000000000000000000000081526001600160a01b0383811660048301528416906370a0823190602401602060405180830381865afa15801561112d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109ae9190611ee0565b6001600160a01b038216301480611166575080155b1561117057505050565b61117983610ad4565b1561122457804710156111b8576040517ff4d678b800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600080836001600160a01b03168360405160006040518083038185875af1925050503d8060008114611206576040519150601f19603f3d011682016040523d82523d6000602084013e61120b565b606091505b50915091508161121d57805160208201fd5b5050505050565b6112386001600160a01b0384168383611300565b505050565b600080600061124c8585611349565b915091506112598161138e565b509392505050565b6040516001600160a01b03808516602483015283166044820152606481018290526112fa9085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166001600160e01b0319909316929092179091526114fb565b50505050565b6040516001600160a01b0383166024820152604481018290526112389084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064016112ae565b600080825160410361137f5760208301516040840151606085015160001a611373878285856115e3565b94509450505050611387565b506000905060025b9250929050565b60008160048111156113a2576113a2611d2c565b036113aa5750565b60018160048111156113be576113be611d2c565b036114105760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e6174757265000000000000000060448201526064015b60405180910390fd5b600281600481111561142457611424611d2c565b036114715760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401611407565b600381600481111561148557611485611d2c565b036114f85760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c60448201527f75650000000000000000000000000000000000000000000000000000000000006064820152608401611407565b50565b6000611550826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166116a79092919063ffffffff16565b90508051600014806115715750808060200190518101906115719190611ef9565b6112385760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401611407565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083111561161a575060009050600361169e565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa15801561166e573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166116975760006001925092505061169e565b9150600090505b94509492505050565b60606116b684846000856116be565b949350505050565b6060824710156117365760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401611407565b600080866001600160a01b031685876040516117529190611d90565b60006040518083038185875af1925050503d806000811461178f576040519150601f19603f3d011682016040523d82523d6000602084013e611794565b606091505b50915091506117a5878383876117b0565b979650505050505050565b6060831561181f578251600003611818576001600160a01b0385163b6118185760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401611407565b50816116b6565b6116b683838151156118345781518083602001fd5b8060405162461bcd60e51b81526004016114079190611962565b6000610140828403121561186157600080fd5b50919050565b60008083601f84011261187957600080fd5b50813567ffffffffffffffff81111561189157600080fd5b60208301915083602082850101111561138757600080fd5b6000806000604084860312156118be57600080fd5b833567ffffffffffffffff808211156118d657600080fd5b6118e28783880161184e565b945060208601359150808211156118f857600080fd5b5061190586828701611867565b9497909650939450505050565b60005b8381101561192d578181015183820152602001611915565b50506000910152565b6000815180845261194e816020860160208601611912565b601f01601f19169290920160200192915050565b6020815260006109ae6020830184611936565b6001600160a01b03811681146114f857600080fd5b803561199581611975565b919050565b600080600080600080608087890312156119b357600080fd5b863567ffffffffffffffff808211156119cb57600080fd5b6119d78a838b0161184e565b975060208901359150808211156119ed57600080fd5b6119f98a838b01611867565b909750955060408901359150611a0e82611975565b90935060608801359080821115611a2457600080fd5b50611a3189828a01611867565b979a9699509497509295939492505050565b600060208284031215611a5557600080fd5b81356109ae81611975565b634e487b7160e01b600052604160045260246000fd5b604051610140810167ffffffffffffffff81118282101715611a9a57611a9a611a60565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715611ac957611ac9611a60565b604052919050565b600067ffffffffffffffff821115611aeb57611aeb611a60565b50601f01601f191660200190565b600082601f830112611b0a57600080fd5b8135611b1d611b1882611ad1565b611aa0565b818152846020838601011115611b3257600080fd5b816020850160208301376000918101602001919091529392505050565b60006101408236031215611b6257600080fd5b611b6a611a76565b611b738361198a565b8152611b816020840161198a565b602082015260408301356040820152611b9c6060840161198a565b60608201526080830135608082015260a083013560a082015260c083013560c082015260e083013560e0820152610100611bd781850161198a565b908201526101208381013567ffffffffffffffff811115611bf757600080fd5b611c0336828701611af9565b918301919091525092915050565b6000808335601e19843603018112611c2857600080fd5b83018035915067ffffffffffffffff821115611c4357600080fd5b60200191503681900382131561138757600080fd5b60006001600160a01b03808816835280871660208401525084604083015260806060830152826080830152828460a0840137600060a0848401015260a0601f19601f85011683010190509695505050505050565b60008451611cbe818460208901611912565b91909101928352506020820152604001919050565b8281526040602082015260006116b66040830184611936565b600060208284031215611cfe57600080fd5b81516001600160e01b0319811681146109ae57600080fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052602160045260246000fd5b60008085851115611d5257600080fd5b83861115611d5f57600080fd5b5050820193919092039150565b6001600160e01b031984168152818360048301376000910160040190815292915050565b60008251611da2818460208701611912565b9190910192915050565b6001600160e01b03198316815260008251611dce816004850160208701611912565b919091016004019392505050565b600080600060608486031215611df157600080fd5b8351925060208401519150604084015167ffffffffffffffff811115611e1657600080fd5b8401601f81018613611e2757600080fd5b8051611e35611b1882611ad1565b818152876020838501011115611e4a57600080fd5b611e5b826020830160208601611912565b8093505050509250925092565b6000610100611e8b83885180516001600160a01b03168252602090810151910152565b6020870151604084015260408701516060840152611ebf608084018780516001600160a01b03168252602090810151910152565b6001600160a01b03851660c08401528060e08401526117a581840185611936565b600060208284031215611ef257600080fd5b5051919050565b600060208284031215611f0b57600080fd5b815180151581146109ae57600080fdfea2646970667358221220cf81aaeaceae0fdda719236bdd03ff7e5d8c23035dca59eab2b88a1afec5ebdc64736f6c63430008110033000000000000000000000000000000000022d473030f116ddee9f6b43ac78ba300000000000000000000000015974e3165cfe1fb21324c5bd1d3b63d34212ec6
Deployed Bytecode
0x6080604052600436106100c05760003560e01c806355b53e2e11610074578063dab400f31161004e578063dab400f314610262578063e0c05c2414610277578063eccec5a8146102a557600080fd5b806355b53e2e146101e757806374a640ff146101fa578063910cab111461022e57600080fd5b806336ac25a2116100a557806336ac25a21461015f57806337be5439146101725780633b2fb7a8146101a657600080fd5b80630d788c36146100cc57806312261ee71461011357600080fd5b366100c757005b600080fd5b3480156100d857600080fd5b506101007f000000000000000000000000000000000000000000000000000000000000000181565b6040519081526020015b60405180910390f35b34801561011f57600080fd5b506101477f000000000000000000000000000000000022d473030f116ddee9f6b43ac78ba381565b6040516001600160a01b03909116815260200161010a565b61010061016d3660046118a9565b6102d3565b34801561017e57600080fd5b506101007f0690d46f0f5acfd81716486cca6471b35b53ffdc6cead0ede5a95a9c621a2e7381565b3480156101b257600080fd5b506101da604051806040016040528060088152602001672a37b5b2b73637b760c11b81525081565b60405161010a9190611962565b6101006101f536600461199a565b6103a3565b34801561020657600080fd5b506101007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f81565b34801561023a57600080fd5b506101477f00000000000000000000000015974e3165cfe1fb21324c5bd1d3b63d34212ec681565b34801561026e57600080fd5b5061010061056c565b34801561028357600080fd5b506101da60405180604001604052806002815260200161190160f01b81525081565b3480156102b157600080fd5b506101da604051806040016040528060028152602001613b1b60f11b81525081565b60006102e18433858561057b565b9050336102f16020860186611a43565b6001600160a01b031661030b61030687611b4f565b6107d4565b7f4a6de6fb74140040ff5f8a230383d4ce15312512a98da513ec606b8c60c4531461033e61012089016101008a01611a43565b61034e60408a0160208b01611a43565b60408a013561036360808c0160608d01611a43565b604080516001600160a01b039586168152938516602085015283019190915290911660608201526080810186905260a00160405180910390a49392505050565b6000806103b261030689611b4f565b905060006103bf826108ba565b60008381526020819052604090205490915060ff161561040b576040517f41a26a6300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008281526020818152604091829020805460ff191660011790558151601f870182900482028101820190925285825261046491889184919089908990819084018382808284376000920191909152506108f292505050565b61049a576040517f8baa579f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6104a689878a8a61057b565b92506001600160a01b0386166104bf60208b018b611a43565b6001600160a01b0316837f4a6de6fb74140040ff5f8a230383d4ce15312512a98da513ec606b8c60c453146104fc6101208e016101008f01611a43565b8d602001602081019061050f9190611a43565b8e604001358f60600160208101906105279190611a43565b604080516001600160a01b039586168152938516602085015283019190915290911660608201526080810188905260a00160405180910390a450509695505050505050565b60006105766109b5565b905090565b6000428560c0013510156105bb576040517f45fa2d0600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006105cf61012087016101008801611a43565b6001600160a01b03160361060f576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006106216040870160208801611a43565b905060006106356080880160608901611a43565b9050610649826001600160a01b0316610ad4565b15610672578660400135341461067257604051631841b4e160e01b815260040160405180910390fd5b610684826001600160a01b0316610ad4565b6106c55734156106a757604051631841b4e160e01b815260040160405180910390fd5b6106c582876106b960208b018b611a43565b8a604001358989610b0e565b6106d26020880188611a43565b6001600160a01b0316638199411334848460408c01356106f66101208e018e611c11565b6040518763ffffffff1660e01b8152600401610716959493929190611c58565b6000604051808303818588803b15801561072f57600080fd5b505af1158015610743573d6000803e3d6000fd5b505050505061076430826001600160a01b03166110ad90919063ffffffff16565b92508660a001358310156107a4576040517fbb2875c300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6107ca6107b961012089016101008a01611a43565b6001600160a01b0383169085611151565b5050949350505050565b80516020808301516040808501516060860151608087015160a088015160c089015160e08a01516101008b01516101208c01518051908b0120975160009b61089d9b7f1b6f9d7673107802b331a5ab52a40f7d942bdf74fa821744df8b69eead3d26c19b919a919998979695949392019a8b526001600160a01b03998a1660208c015297891660408b015260608a0196909652938716608089015260a088019290925260c087015260e08601526101008501529091166101208301526101408201526101600190565b604051602081830303815290604052805190602001209050919050565b600060405180604001604052806002815260200161190160f01b8152506108df6109b5565b8360405160200161089d93929190611cac565b60006001600160a01b0384163b1561098d57604051630b135d3f60e11b81526001600160a01b03851690631626ba7e906109329086908690600401611cd3565b602060405180830381865afa15801561094f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109739190611cec565b6001600160e01b031916630b135d3f60e11b1490506109ae565b610997838361123d565b6001600160a01b0316846001600160a01b03161490505b9392505050565b60007f00000000000000000000000000000000000000000000000000000000000000014603610a0357507f0690d46f0f5acfd81716486cca6471b35b53ffdc6cead0ede5a95a9c621a2e7390565b5060408051808201825260088152672a37b5b2b73637b760c11b6020918201528151808301835260028152613b1b60f11b9082015281517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f818301527f4428669f887e7f6a6e361e218ee42308201bdbacbf601211fc38b8b2ec696181818401527fe38c993d0cb6abdb6be519a6875b139ddd45568fc076f7b5fa6362a5581f4a1460608201524660808201523060a0808301919091528351808303909101815260c0909101909252815191012090565b60006001600160a01b03821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1480610b0857506001600160a01b038216155b92915050565b600082826000818110610b2357610b23611d16565b919091013560f81c90506004811115610b3e57610b3e611d2c565b90506000816004811115610b5457610b54611d2c565b03610c0a576040517f1567599f0000000000000000000000000000000000000000000000000000000081526001600160a01b03878116600483015288811660248301528681166044830152606482018690527f00000000000000000000000015974e3165cfe1fb21324c5bd1d3b63d34212ec61690631567599f90608401600060405180830381600087803b158015610bec57600080fd5b505af1158015610c00573d6000803e3d6000fd5b50505050506110a5565b6001816004811115610c1e57610c1e611d2c565b03610c3e57610c386001600160a01b038816878787611261565b506110a5565b6002816004811115610c5257610c52611d2c565b03610d2e576000806001600160a01b0389167fd505accf00000000000000000000000000000000000000000000000000000000610c92866001818a611d42565b604051602001610ca493929190611d6c565b60408051601f1981840301815290829052610cbe91611d90565b6000604051808303816000865af19150503d8060008114610cfb576040519150601f19603f3d011682016040523d82523d6000602084013e610d00565b606091505b509150915081610d11573d60208201fd5b610d266001600160a01b038a16898989611261565b5050506110a5565b6003816004811115610d4257610d42611d2c565b03610f00576000610d568360018187611d42565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505082519293505090159050610e4d576000807f000000000000000000000000000000000022d473030f116ddee9f6b43ac78ba36001600160a01b0316632b67b57060e01b84604051602001610ddd929190611dac565b60408051601f1981840301815290829052610df791611d90565b6000604051808303816000865af19150503d8060008114610e34576040519150601f19603f3d011682016040523d82523d6000602084013e610e39565b606091505b509150915081610e4a573d60208201fd5b50505b6040517f36c785160000000000000000000000000000000000000000000000000000000081526001600160a01b0388811660048301528781166024830152868116604483015289811660648301527f000000000000000000000000000000000022d473030f116ddee9f6b43ac78ba316906336c7851690608401600060405180830381600087803b158015610ee157600080fd5b505af1158015610ef5573d6000803e3d6000fd5b5050505050506110a5565b6004816004811115610f1457610f14611d2c565b036100c7576000610f288360018187611d42565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201829052508451949550939093039250610f9c915050576040517fb826d62c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600080600083806020019051810190610fb59190611ddc565b9250925092506000604051806060016040528060405180604001604052808f6001600160a01b031681526020018c8152508152602001858152602001848152509050600060405180604001604052808c6001600160a01b031681526020018b81525090507f000000000000000000000000000000000022d473030f116ddee9f6b43ac78ba36001600160a01b03166330f28b7a83838f876040518563ffffffff1660e01b815260040161106b9493929190611e68565b600060405180830381600087803b15801561108557600080fd5b505af1158015611099573d6000803e3d6000fd5b50505050505050505050505b505050505050565b60006110b883610ad4565b156110ce57506001600160a01b03811631610b08565b6040517f70a082310000000000000000000000000000000000000000000000000000000081526001600160a01b0383811660048301528416906370a0823190602401602060405180830381865afa15801561112d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109ae9190611ee0565b6001600160a01b038216301480611166575080155b1561117057505050565b61117983610ad4565b1561122457804710156111b8576040517ff4d678b800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600080836001600160a01b03168360405160006040518083038185875af1925050503d8060008114611206576040519150601f19603f3d011682016040523d82523d6000602084013e61120b565b606091505b50915091508161121d57805160208201fd5b5050505050565b6112386001600160a01b0384168383611300565b505050565b600080600061124c8585611349565b915091506112598161138e565b509392505050565b6040516001600160a01b03808516602483015283166044820152606481018290526112fa9085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166001600160e01b0319909316929092179091526114fb565b50505050565b6040516001600160a01b0383166024820152604481018290526112389084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064016112ae565b600080825160410361137f5760208301516040840151606085015160001a611373878285856115e3565b94509450505050611387565b506000905060025b9250929050565b60008160048111156113a2576113a2611d2c565b036113aa5750565b60018160048111156113be576113be611d2c565b036114105760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e6174757265000000000000000060448201526064015b60405180910390fd5b600281600481111561142457611424611d2c565b036114715760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401611407565b600381600481111561148557611485611d2c565b036114f85760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c60448201527f75650000000000000000000000000000000000000000000000000000000000006064820152608401611407565b50565b6000611550826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166116a79092919063ffffffff16565b90508051600014806115715750808060200190518101906115719190611ef9565b6112385760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401611407565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083111561161a575060009050600361169e565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa15801561166e573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166116975760006001925092505061169e565b9150600090505b94509492505050565b60606116b684846000856116be565b949350505050565b6060824710156117365760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401611407565b600080866001600160a01b031685876040516117529190611d90565b60006040518083038185875af1925050503d806000811461178f576040519150601f19603f3d011682016040523d82523d6000602084013e611794565b606091505b50915091506117a5878383876117b0565b979650505050505050565b6060831561181f578251600003611818576001600160a01b0385163b6118185760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401611407565b50816116b6565b6116b683838151156118345781518083602001fd5b8060405162461bcd60e51b81526004016114079190611962565b6000610140828403121561186157600080fd5b50919050565b60008083601f84011261187957600080fd5b50813567ffffffffffffffff81111561189157600080fd5b60208301915083602082850101111561138757600080fd5b6000806000604084860312156118be57600080fd5b833567ffffffffffffffff808211156118d657600080fd5b6118e28783880161184e565b945060208601359150808211156118f857600080fd5b5061190586828701611867565b9497909650939450505050565b60005b8381101561192d578181015183820152602001611915565b50506000910152565b6000815180845261194e816020860160208601611912565b601f01601f19169290920160200192915050565b6020815260006109ae6020830184611936565b6001600160a01b03811681146114f857600080fd5b803561199581611975565b919050565b600080600080600080608087890312156119b357600080fd5b863567ffffffffffffffff808211156119cb57600080fd5b6119d78a838b0161184e565b975060208901359150808211156119ed57600080fd5b6119f98a838b01611867565b909750955060408901359150611a0e82611975565b90935060608801359080821115611a2457600080fd5b50611a3189828a01611867565b979a9699509497509295939492505050565b600060208284031215611a5557600080fd5b81356109ae81611975565b634e487b7160e01b600052604160045260246000fd5b604051610140810167ffffffffffffffff81118282101715611a9a57611a9a611a60565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715611ac957611ac9611a60565b604052919050565b600067ffffffffffffffff821115611aeb57611aeb611a60565b50601f01601f191660200190565b600082601f830112611b0a57600080fd5b8135611b1d611b1882611ad1565b611aa0565b818152846020838601011115611b3257600080fd5b816020850160208301376000918101602001919091529392505050565b60006101408236031215611b6257600080fd5b611b6a611a76565b611b738361198a565b8152611b816020840161198a565b602082015260408301356040820152611b9c6060840161198a565b60608201526080830135608082015260a083013560a082015260c083013560c082015260e083013560e0820152610100611bd781850161198a565b908201526101208381013567ffffffffffffffff811115611bf757600080fd5b611c0336828701611af9565b918301919091525092915050565b6000808335601e19843603018112611c2857600080fd5b83018035915067ffffffffffffffff821115611c4357600080fd5b60200191503681900382131561138757600080fd5b60006001600160a01b03808816835280871660208401525084604083015260806060830152826080830152828460a0840137600060a0848401015260a0601f19601f85011683010190509695505050505050565b60008451611cbe818460208901611912565b91909101928352506020820152604001919050565b8281526040602082015260006116b66040830184611936565b600060208284031215611cfe57600080fd5b81516001600160e01b0319811681146109ae57600080fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052602160045260246000fd5b60008085851115611d5257600080fd5b83861115611d5f57600080fd5b5050820193919092039150565b6001600160e01b031984168152818360048301376000910160040190815292915050565b60008251611da2818460208701611912565b9190910192915050565b6001600160e01b03198316815260008251611dce816004850160208701611912565b919091016004019392505050565b600080600060608486031215611df157600080fd5b8351925060208401519150604084015167ffffffffffffffff811115611e1657600080fd5b8401601f81018613611e2757600080fd5b8051611e35611b1882611ad1565b818152876020838501011115611e4a57600080fd5b611e5b826020830160208601611912565b8093505050509250925092565b6000610100611e8b83885180516001600160a01b03168252602090810151910152565b6020870151604084015260408701516060840152611ebf608084018780516001600160a01b03168252602090810151910152565b6001600160a01b03851660c08401528060e08401526117a581840185611936565b600060208284031215611ef257600080fd5b5051919050565b600060208284031215611f0b57600080fd5b815180151581146109ae57600080fdfea2646970667358221220cf81aaeaceae0fdda719236bdd03ff7e5d8c23035dca59eab2b88a1afec5ebdc64736f6c63430008110033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000000000000022d473030f116ddee9f6b43ac78ba300000000000000000000000015974e3165cfe1fb21324c5bd1d3b63d34212ec6
-----Decoded View---------------
Arg [0] : _uniswapPermit2 (address): 0x000000000022D473030F116dDEE9F6B43aC78BA3
Arg [1] : _allowanceTarget (address): 0x15974e3165CFE1fb21324C5bD1D3b63D34212EC6
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000000000000022d473030f116ddee9f6b43ac78ba3
Arg [1] : 00000000000000000000000015974e3165cfe1fb21324c5bd1d3b63d34212ec6
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
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.